From c34ad4eaa91a742b8ff1400b9b7389ee570d349a Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Thu, 29 Aug 2024 18:44:21 +1200 Subject: [PATCH] API Remove GraphQL --- _config/config.yml | 24 +- _config/graphql.yml | 10 - _graphql/config.yml | 7 - _graphql/interfaces.yml | 23 - _graphql/mutations.yml | 39 - _graphql/queries.yml | 4 - _graphql/types/DescendantFileCount.yml | 5 - _graphql/types/File.yml | 37 - _graphql/types/FileFilterInput.yml | 24 - _graphql/types/FileInput.yml | 7 - _graphql/types/FileUsage.yml | 5 - _graphql/types/Folder.yml | 40 - _graphql/types/FolderInput.yml | 7 - _graphql/types/PublicationNotice.yml | 12 - _graphql/unions.yml | 11 - client/dist/js/TinyMCE_sslink-file.js | 31 +- client/dist/js/TinyMCE_ssmedia.js | 31 +- client/dist/js/bundle.js | 31 +- client/src/boot/index.js | 3 - client/src/boot/registerQueries.js | 16 - .../BulkActions/tests/BulkActions-test.js | 10 +- .../GalleryItem/tests/GalleryItem-test.js | 2 +- .../src/components/UploadField/UploadField.js | 12 +- .../UploadField/tests/UploadField-test.js | 15 +- .../src/containers/AssetAdmin/AssetAdmin.js | 385 ++++++---- .../AssetAdmin/AssetAdminBreadcrumb.js | 9 +- .../AssetAdmin/tests/AssetAdmin-test.js | 394 +++++++--- .../tests/AssetAdminBreadcrumb-test.js | 4 +- .../BulkDeleteConfirmation.js | 93 ++- .../BulkDeleteMessage.js | 57 +- .../BulkDeleteConfirmation/DeletionModal.js | 5 +- .../BulkDeleteConfirmation/helpers.js | 64 -- .../tests/BulkDeleteConfirmation-test.js | 164 ++-- .../tests/BulkDeleteMessage-test.js | 28 +- .../tests/helpers-test.js | 38 - client/src/containers/Editor/Editor.js | 54 +- .../containers/Editor/tests/Editor-test.js | 48 +- client/src/containers/Gallery/Gallery.js | 26 +- .../containers/Gallery/tests/Gallery-test.js | 4 - .../src/containers/HistoryList/HistoryList.js | 2 +- client/src/containers/MoveModal/MoveModal.js | 36 +- client/src/lib/fileFragments.js | 35 - .../confirmDeletion/ConfirmDeletionActions.js | 2 +- .../state/files/buildPublicationMutation.js | 52 -- .../src/state/files/createFolderMutation.js | 43 -- client/src/state/files/deleteFilesMutation.js | 67 -- client/src/state/files/moveFilesMutation.js | 36 - .../src/state/files/publishFilesMutation.js | 7 - .../files/readDescendantFileCountsQuery.js | 54 -- client/src/state/files/readFileUsageQuery.js | 54 -- client/src/state/files/readFilesQuery.js | 138 ---- client/src/state/files/readOneFileQuery.js | 53 -- .../state/files/tests/readFilesQuery-test.js | 79 -- .../src/state/files/unpublishFilesMutation.js | 7 - code/Controller/AssetAdmin.php | 410 +++++++--- code/Controller/AssetAdminOpen.php | 422 +++++++++++ code/Forms/UploadField.php | 2 +- code/GraphQL/FileFilter.php | 125 ---- code/GraphQL/Notice.php | 105 --- code/GraphQL/Resolvers/AssetAdminResolver.php | 338 --------- code/GraphQL/Resolvers/FieldResolver.php | 31 - code/GraphQL/Resolvers/FileTypeResolver.php | 200 ----- code/GraphQL/Resolvers/FolderTypeResolver.php | 195 ----- .../GraphQL/Resolvers/PublicationResolver.php | 176 ----- code/GraphQL/Schema/Builder.php | 44 -- composer.json | 3 +- lang/en.yml | 1 + package.json | 6 +- tests/behat/features/manage-files.feature | 26 +- tests/behat/src/FixtureContext.php | 19 +- tests/php/Controller/AssetAdminOpenTest.php | 306 ++++++++ tests/php/Controller/AssetAdminOpenTest.yml | 29 + tests/php/Controller/AssetAdminTest.php | 700 +++++++++++++++++- .../FilesInUseFileExtension.php | 23 + .../Controller/AssetAdminTest/TestFile.php | 48 ++ .../Controller/AssetAdminTest/TestObject.php | 25 + tests/php/Forms/UploadFieldTest.php | 10 +- .../CreateFolderMutationCreatorTest.php | 68 -- tests/php/GraphQL/FakeResolveInfo.php | 28 - .../FileFilterInputTypeCreatorTest.php | 283 ------- tests/php/GraphQL/FileTypeCreatorTest.php | 84 --- tests/php/GraphQL/FolderTypeCreatorTest.php | 142 ---- .../php/GraphQL/ReadFileQueryCreatorTest.php | 95 --- .../GraphQL/ReadFileUsageQueryCreatorTest.php | 105 --- .../UnpublishFileMutationCreatorTest.php | 70 -- .../UnpublishFileMutationCreatorTest.yml | 51 -- .../FileOwner.php | 31 - tests/php/fixtures.yml | 28 + yarn.lock | 243 +----- 89 files changed, 2837 insertions(+), 4079 deletions(-) delete mode 100644 _config/graphql.yml delete mode 100644 _graphql/config.yml delete mode 100644 _graphql/interfaces.yml delete mode 100644 _graphql/mutations.yml delete mode 100644 _graphql/queries.yml delete mode 100644 _graphql/types/DescendantFileCount.yml delete mode 100644 _graphql/types/File.yml delete mode 100644 _graphql/types/FileFilterInput.yml delete mode 100644 _graphql/types/FileInput.yml delete mode 100644 _graphql/types/FileUsage.yml delete mode 100644 _graphql/types/Folder.yml delete mode 100644 _graphql/types/FolderInput.yml delete mode 100644 _graphql/types/PublicationNotice.yml delete mode 100644 _graphql/unions.yml delete mode 100644 client/src/boot/registerQueries.js delete mode 100644 client/src/containers/BulkDeleteConfirmation/helpers.js delete mode 100644 client/src/containers/BulkDeleteConfirmation/tests/helpers-test.js delete mode 100644 client/src/lib/fileFragments.js delete mode 100644 client/src/state/files/buildPublicationMutation.js delete mode 100644 client/src/state/files/createFolderMutation.js delete mode 100644 client/src/state/files/deleteFilesMutation.js delete mode 100644 client/src/state/files/moveFilesMutation.js delete mode 100644 client/src/state/files/publishFilesMutation.js delete mode 100644 client/src/state/files/readDescendantFileCountsQuery.js delete mode 100644 client/src/state/files/readFileUsageQuery.js delete mode 100644 client/src/state/files/readFilesQuery.js delete mode 100644 client/src/state/files/readOneFileQuery.js delete mode 100644 client/src/state/files/tests/readFilesQuery-test.js delete mode 100644 client/src/state/files/unpublishFilesMutation.js create mode 100644 code/Controller/AssetAdminOpen.php delete mode 100644 code/GraphQL/FileFilter.php delete mode 100644 code/GraphQL/Notice.php delete mode 100644 code/GraphQL/Resolvers/AssetAdminResolver.php delete mode 100644 code/GraphQL/Resolvers/FieldResolver.php delete mode 100644 code/GraphQL/Resolvers/FileTypeResolver.php delete mode 100644 code/GraphQL/Resolvers/FolderTypeResolver.php delete mode 100644 code/GraphQL/Resolvers/PublicationResolver.php delete mode 100644 code/GraphQL/Schema/Builder.php create mode 100644 tests/php/Controller/AssetAdminOpenTest.php create mode 100644 tests/php/Controller/AssetAdminOpenTest.yml create mode 100644 tests/php/Controller/AssetAdminTest/FilesInUseFileExtension.php create mode 100644 tests/php/Controller/AssetAdminTest/TestFile.php create mode 100644 tests/php/Controller/AssetAdminTest/TestObject.php delete mode 100644 tests/php/GraphQL/CreateFolderMutationCreatorTest.php delete mode 100644 tests/php/GraphQL/FakeResolveInfo.php delete mode 100644 tests/php/GraphQL/FileFilterInputTypeCreatorTest.php delete mode 100644 tests/php/GraphQL/FileTypeCreatorTest.php delete mode 100644 tests/php/GraphQL/FolderTypeCreatorTest.php delete mode 100644 tests/php/GraphQL/ReadFileQueryCreatorTest.php delete mode 100644 tests/php/GraphQL/ReadFileUsageQueryCreatorTest.php delete mode 100644 tests/php/GraphQL/UnpublishFileMutationCreatorTest.php delete mode 100644 tests/php/GraphQL/UnpublishFileMutationCreatorTest.yml delete mode 100644 tests/php/GraphQL/UnpublishFileMutationCreatorTest/FileOwner.php diff --git a/_config/config.yml b/_config/config.yml index 69f589235..6277c7269 100644 --- a/_config/config.yml +++ b/_config/config.yml @@ -18,13 +18,27 @@ SilverStripe\Admin\Forms\UsedOnTable: Name: assetadminthumbnails --- SilverStripe\Core\Injector\Injector: + # This ThumbnailGenerator is used for upload fields despite its name. + # It generates thumbnails because there aren't expected to be many loaded on any given page load SilverStripe\AssetAdmin\Model\ThumbnailGenerator.assetadmin: class: SilverStripe\AssetAdmin\Model\ThumbnailGenerator properties: Generates: true + # This ThumbnailGenerator is used for asset admin. + # It doesn't generate thumbnails (other than on upload) because we expect lots of images + # on any given page load. + # Setting `Generates: false` to prevent trying to generate new thumbnails when loading asset admin + # if the thumbnail generation criteria change, because that would massively slow down the CMS. + SilverStripe\AssetAdmin\Model\ThumbnailGenerator.assetadminopen: + class: SilverStripe\AssetAdmin\Model\ThumbnailGenerator + properties: + Generates: false SilverStripe\AssetAdmin\Controller\AssetAdmin: properties: ThumbnailGenerator: '%$SilverStripe\AssetAdmin\Model\ThumbnailGenerator.assetadmin' + SilverStripe\AssetAdmin\Controller\AssetAdminOpen: + properties: + ThumbnailGenerator: '%$SilverStripe\AssetAdmin\Model\ThumbnailGenerator.assetadminopen' --- Name: assetadminfield After: @@ -47,13 +61,3 @@ Name: assetadminmodals SilverStripe\Admin\ModalController: extensions: - SilverStripe\AssetAdmin\Extensions\RemoteFileModalExtension ---- -Name: asset-admin-graphql-thumbnails -Only: - moduleexists: 'silverstripe/graphql' ---- -SilverStripe\Core\Injector\Injector: - SilverStripe\AssetAdmin\Model\ThumbnailGenerator.graphql: - class: SilverStripe\AssetAdmin\Model\ThumbnailGenerator - properties: - Generates: false diff --git a/_config/graphql.yml b/_config/graphql.yml deleted file mode 100644 index fb89f0b72..000000000 --- a/_config/graphql.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -Name: asset-admin-graphql -Only: - classexists: 'SilverStripe\GraphQL\Schema\Schema' ---- -SilverStripe\GraphQL\Schema\Schema: - schemas: - admin: - src: - assetAdmin: 'silverstripe/asset-admin: _graphql' diff --git a/_graphql/config.yml b/_graphql/config.yml deleted file mode 100644 index c2ccd16d9..000000000 --- a/_graphql/config.yml +++ /dev/null @@ -1,7 +0,0 @@ -resolvers: - - SilverStripe\AssetAdmin\GraphQL\Resolvers\AssetAdminResolver - - SilverStripe\AssetAdmin\GraphQL\Resolvers\FileTypeResolver - - SilverStripe\AssetAdmin\GraphQL\Resolvers\FolderTypeResolver - - SilverStripe\AssetAdmin\GraphQL\Resolvers\PublicationResolver -execute: - - SilverStripe\AssetAdmin\GraphQL\Schema\Builder diff --git a/_graphql/interfaces.yml b/_graphql/interfaces.yml deleted file mode 100644 index c509874e5..000000000 --- a/_graphql/interfaces.yml +++ /dev/null @@ -1,23 +0,0 @@ -FileInterface: - typeResolver: - - SilverStripe\AssetAdmin\GraphQL\Resolvers\AssetAdminResolver - - resolveFileInterfaceType - description: Interface for files and folders - fields: - id: Int! - created: String - lastEdited: String - owner: String - parentId: Int - title: String - type: String - category: String - exists: Boolean - name: String - filename: String - url: String - canView: Boolean - canEdit: Boolean - canDelete: Boolean - hasRestrictedAccess: Boolean - visibility: String diff --git a/_graphql/mutations.yml b/_graphql/mutations.yml deleted file mode 100644 index ec092f75e..000000000 --- a/_graphql/mutations.yml +++ /dev/null @@ -1,39 +0,0 @@ -'createFile(file: FileInput)': - type: FileInterface - description: Creates files and images -'createFolder(folder: FolderInput)': - type: FileInterface - description: Creates files and images -'deleteFiles(ids: [ID]!)': - type: '[ID]' - description: -'moveFiles(folderId: ID!, fileIds: [ID])': - type: FileInterface -publishFiles: - type: '[PublicationResult]' - description: Publishes a list of files - args: - ids: - type: '[ID]!' - force: - type: Boolean - description: If true, proceed with the mutation, regardless of notices - defaultValue: false - quiet: - type: Boolean - description: If true, suppress warnings -unpublishFiles: - type: '[PublicationResult]' - description: Unpublishes a list of files - args: - ids: - type: '[ID]!' - force: - type: Boolean - description: If true, proceed with the mutation, regardless of notices - defaultValue: false - quiet: - type: Boolean - description: If true, suppress warnings -'updateFiles(id: ID!, file: FileInput)': File - diff --git a/_graphql/queries.yml b/_graphql/queries.yml deleted file mode 100644 index 331603285..000000000 --- a/_graphql/queries.yml +++ /dev/null @@ -1,4 +0,0 @@ -'readFileUsage(ids: [ID]!)': '[FileUsage]' -'readDescendantFileCounts(ids: [ID]!)': '[DescendantFileCount]' -'readFiles(filter: FileFilterInput)': - type: '[FileResult]' diff --git a/_graphql/types/DescendantFileCount.yml b/_graphql/types/DescendantFileCount.yml deleted file mode 100644 index f8b102ac9..000000000 --- a/_graphql/types/DescendantFileCount.yml +++ /dev/null @@ -1,5 +0,0 @@ -DescendantFileCount: - description: Count of descendant non-folder Files - fields: - id: ID! - count: Int diff --git a/_graphql/types/File.yml b/_graphql/types/File.yml deleted file mode 100644 index ea9217adc..000000000 --- a/_graphql/types/File.yml +++ /dev/null @@ -1,37 +0,0 @@ -File: - description: Type for files and images - interfaces: [FileInterface] - fieldResolver: - - SilverStripe\AssetAdmin\GraphQL\Resolvers\FieldResolver - - resolve - fields: - id: Int! - created: String - lastEdited: String - owner: String - parentId: Int - title: String - exists: Boolean - type: String - category: String - name: String - filename: String - extension: String - size: Int - url: String - thumbnail: String - smallThumbnail: String - width: Int - height: Int - isTrackedFormUpload: Boolean - draft: Boolean - published: Boolean - modified: Boolean - inUseCount: Int - version: Int! - canView: Boolean - canEdit: Boolean - canDelete: Boolean - hasRestrictedAccess: Boolean - visibility: String - diff --git a/_graphql/types/FileFilterInput.yml b/_graphql/types/FileFilterInput.yml deleted file mode 100644 index 801b7b8eb..000000000 --- a/_graphql/types/FileFilterInput.yml +++ /dev/null @@ -1,24 +0,0 @@ -FileFilterInput: - input: true - description: Input type for a File type - fields: - id: ID - anyChildId: - type: ID - description: Identifies this file by the id of any immediate child - parentId: ID - name: - type: String - description: Searches both name and title fields with a partial match - lastEditedFrom: - type: String - description: Date in ISO format (YYYY-mm-dd) - lastEditedTo: - type: String - description: Date in ISO format (YYYY-mm-dd) - appCategory: AppCategory - recursive: - type: Boolean - description: > - Find all descendants of "parentId" (not only direct children). Caution: Only works with - parentId=0 at the moment. diff --git a/_graphql/types/FileInput.yml b/_graphql/types/FileInput.yml deleted file mode 100644 index 1c7a6a603..000000000 --- a/_graphql/types/FileInput.yml +++ /dev/null @@ -1,7 +0,0 @@ -FileInput: - input: true - description: Input type for files and images - fields: - parentId: Int! - title: String - name: String diff --git a/_graphql/types/FileUsage.yml b/_graphql/types/FileUsage.yml deleted file mode 100644 index 0497ce663..000000000 --- a/_graphql/types/FileUsage.yml +++ /dev/null @@ -1,5 +0,0 @@ -FileUsage: - description: Describe the usage of a file or folder - fields: - id: ID! - inUseCount: Int diff --git a/_graphql/types/Folder.yml b/_graphql/types/Folder.yml deleted file mode 100644 index 4bf6a6819..000000000 --- a/_graphql/types/Folder.yml +++ /dev/null @@ -1,40 +0,0 @@ -Folder: - description: Type for folders - interfaces: [FileInterface] - fieldResolver: - - SilverStripe\AssetAdmin\GraphQL\Resolvers\FieldResolver - - resolve - fields: - id: Int! - created: String - lastEdited: String - owner: String - parentId: Int - title: String - type: String - category: String - exists: Boolean - name: String - filename: String - url: String - canView: Boolean - canEdit: Boolean - canDelete: Boolean - hasRestrictedAccess: Boolean - visibility: String - parents: '[FileInterface]' - descendantFileCount: Int - filesInUseCount: Int - 'children(filter: FileFilterInput)': - type: '[FileInterface]' - plugins: - sorter: - input: FolderChildrenSortFields - resolver: [SilverStripe\AssetAdmin\GraphQL\Resolvers\FolderTypeResolver, sortChildren] - fields: - id: ID - title: Title - created: Created - lastEdited: LastEdited - paginate: - resolver: [SilverStripe\GraphQL\Schema\DataObject\Plugin\Paginator, paginate] diff --git a/_graphql/types/FolderInput.yml b/_graphql/types/FolderInput.yml deleted file mode 100644 index 348922cf5..000000000 --- a/_graphql/types/FolderInput.yml +++ /dev/null @@ -1,7 +0,0 @@ -FolderInput: - input: true - description: Input type for folders - fields: - parentId: Int! - title: String - name: String diff --git a/_graphql/types/PublicationNotice.yml b/_graphql/types/PublicationNotice.yml deleted file mode 100644 index 5efed614d..000000000 --- a/_graphql/types/PublicationNotice.yml +++ /dev/null @@ -1,12 +0,0 @@ -PublicationNotice: - description: Describes an error that occurred on a failed publication operation - fields: - noticeType: - type: String! - description: The type of notice - message: - type: String - description: Relevant information pertaining to the error - ids: - type: '[ID]' - description: Relevant record IDs diff --git a/_graphql/unions.yml b/_graphql/unions.yml deleted file mode 100644 index 09d0719a0..000000000 --- a/_graphql/unions.yml +++ /dev/null @@ -1,11 +0,0 @@ -PublicationResult: - types: [File, PublicationNotice] - typeResolver: - - SilverStripe\AssetAdmin\GraphQL\Resolvers\AssetAdminResolver - - resolvePublicationResultUnion -FileResult: - types: [File, Folder] - typeResolver: - - SilverStripe\AssetAdmin\GraphQL\Resolvers\AssetAdminResolver - - resolveFileInterfaceType - diff --git a/client/dist/js/TinyMCE_sslink-file.js b/client/dist/js/TinyMCE_sslink-file.js index ca62da7f3..18ee73344 100644 --- a/client/dist/js/TinyMCE_sslink-file.js +++ b/client/dist/js/TinyMCE_sslink-file.js @@ -1,30 +1 @@ -!function(){var e={853:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=u(n(5815)),i=u(n(3724)),s=u(n(1669)),l=n(5716),a=u(n(6935));function u(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}let c=0;class p extends r.Component{constructor(e){super(e),this.dropzone=null,this.dragging=!1,this.handleAccept=this.handleAccept.bind(this),this.handleAddedFile=this.handleAddedFile.bind(this),this.handleDragEnter=this.handleDragEnter.bind(this),this.handleDragLeave=this.handleDragLeave.bind(this),this.handleDrop=this.handleDrop.bind(this),this.handleUploadProgress=this.handleUploadProgress.bind(this),this.handleUploadComplete=this.handleUploadComplete.bind(this),this.handleError=this.handleError.bind(this),this.handleSending=this.handleSending.bind(this),this.handleSuccess=this.handleSuccess.bind(this),this.handleQueueComplete=this.handleQueueComplete.bind(this),this.loadImage=this.loadImage.bind(this),this.handleMaxFilesExceeded=this.handleMaxFilesExceeded.bind(this)}componentDidMount(){this.dropzone=new i.default(this.dropzoneRef,Object.assign({},this.getDefaultOptions(),this.props.options));const{name:e}=this.props;e&&this.dropzone.hiddenFileInput&&this.dropzone.hiddenFileInput.classList.add(`dz-input-${e}`),void 0!==this.props.promptOnRemove&&this.setPromptOnRemove(this.props.promptOnRemove)}componentDidUpdate(e){const{name:t}=this.props;t&&this.dropzone.hiddenFileInput&&this.dropzone.hiddenFileInput.classList.add(`dz-input-${t}`),this.props.canUpload&&e.options!==this.props.options&&this.dropzone&&(this.dropzone.enable(),this.dropzone.options=Object.assign({},this.getDefaultOptions(),this.dropzone.options,this.props.options))}componentWillUnmount(){this.dropzone.files=[],this.dropzone.destroy()}getDefaultOptions(){let e=null,t=this.props.uploadSelector;if(!t&&this.props.uploadButton&&(t=".asset-dropzone__upload-button"),t){const n=(0,s.default)(this.dropzoneRef).find(t);n&&n.length&&(e=n.toArray())}return{accept:this.handleAccept,addedfile:this.handleAddedFile,dragenter:this.handleDragEnter,dragleave:this.handleDragLeave,drop:this.handleDrop,maxfilesexceeded:this.handleMaxFilesExceeded,uploadprogress:this.handleUploadProgress,complete:this.handleUploadComplete,dictDefaultMessage:o.default._t("AssetAdmin.DROPZONE_DEFAULT_MESSAGE","Drop files here to upload"),dictFallbackMessage:o.default._t("AssetAdmin.DROPZONE_FALLBACK_MESSAGE","Your browser does not support drag'n'drop file uploads."),dictFallbackText:o.default._t("AssetAdmin.DROPZONE_FALLBACK_TEXT","Please use the fallback form below to upload your files like in the olden days."),dictInvalidFileType:o.default._t("AssetAdmin.DROPZONE_INVALID_FILE_TYPE","You can't upload files of this type."),dictResponseError:o.default._t("AssetAdmin.DROPZONE_RESPONSE_ERROR","Server responded with an error."),dictCancelUpload:o.default._t("AssetAdmin.DROPZONE_CANCEL_UPLOAD","Cancel upload"),dictCancelUploadConfirmation:o.default._t("AssetAdmin.DROPZONE_CANCEL_UPLOAD_CONFIRMATION","Are you sure you want to cancel this upload?"),dictRemoveFile:o.default._t("AssetAdmin.DROPZONE_REMOVE_FILE","Remove file"),dictMaxFilesExceeded:o.default._t("AssetAdmin.DROPZONE_MAX_FILES_EXCEEDED","You can not upload any more files."),error:this.handleError,sending:this.handleSending,success:this.handleSuccess,queuecomplete:this.handleQueueComplete,thumbnailHeight:150,thumbnailWidth:200,timeout:0,clickable:e}}getFileCategory(e){return e.split("/")[0]}getLoadPreview(e){return new Promise((t=>{const n=new FileReader;n.onload=n=>{if("image"===this.getFileCategory(e.type)){const e=new Image;t(this.loadImage(e,n.target.result))}else t({})},n.readAsDataURL(e)}))}getFileTitle(e){return e.replace(/[.][^.]+$/,"").replace(/-_/," ")}setPromptOnRemove(e){this.dropzone.options.dictRemoveFileConfirmation=e}handleDragEnter(e){this.props.canUpload&&(this.dragging=!0,this.forceUpdate(),"function"==typeof this.props.onDragEnter&&this.props.onDragEnter(e))}handleDragLeave(e){const t=this.dropzoneRef;this.props.canUpload&&e.target===t&&(this.dragging=!1,this.forceUpdate(),"function"==typeof this.props.onDragLeave&&this.props.onDragLeave(e,t))}handleUploadProgress(e,t,n){"function"==typeof this.props.onUploadProgress&&this.props.onUploadProgress(e,t,n)}handleUploadComplete(e){"function"==typeof this.props.onUploadComplete&&this.props.onUploadComplete(e.status)}handleDrop(e){this.dragging=!1,this.forceUpdate(),"function"==typeof this.props.onDrop&&this.props.onDrop(e)}handleSending(e,t,n){"function"==typeof this.props.updateFormData&&this.props.updateFormData(n),n.append("SecurityID",this.props.securityID),n.append("ParentID",this.props.folderId);const r=Object.assign({},t,{abort:()=>{this.dropzone.cancelUpload(e),t.abort()}});"function"==typeof this.props.onSending&&this.props.onSending(e,r,n)}handleMaxFilesExceeded(e){return"function"!=typeof this.props.onMaxFilesExceeded||this.props.onMaxFilesExceeded(e)}generateQueuedId(){return c+=1,c}handleAccept(e,t){return("function"!=typeof this.props.canFileUpload||this.props.canFileUpload(e))&&this.props.canUpload?t():t(o.default._t("AssetAdmin.DROPZONE_CANNOT_UPLOAD","Uploading not permitted."))}handleAddedFile(e){e._queuedId=this.generateQueuedId();const t={category:this.getFileCategory(e.type),filename:e.name,queuedId:e._queuedId,size:e.size,title:this.getFileTitle(e.name),extension:(0,l.getFileExtension)(e.name),type:e.type,uploadedToFolderId:this.props.folderId};this.props.onAddedFile(t);return this.getLoadPreview(e).then((e=>{const n={height:e.height,width:e.width,url:e.thumbnailURL,thumbnail:e.thumbnailURL,smallThumbnail:e.thumbnailURL};return"function"==typeof this.props.onPreviewLoaded&&this.props.onPreviewLoaded(t,n),{...t,...n}}))}loadImage(e,t){return new Promise((n=>{const r=document.createElement("canvas"),o=r.getContext("2d");e.onload=()=>{const t=2*this.props.preview.width,i=2*this.props.preview.height,s=e.naturalWidth/e.naturalHeight;e.naturalWidth{this.dropzoneRef=e}},this.props.uploadButton&&r.default.createElement("button",t,o.default._t("AssetAdmin.DROPZONE_UPLOAD")),this.props.children)}}p.propTypes={folderId:a.default.number.isRequired,onAccept:a.default.func,onAddedFile:a.default.func.isRequired,onDragEnter:a.default.func,onDragLeave:a.default.func,onDrop:a.default.func,onError:a.default.func.isRequired,onPreviewLoaded:a.default.func,onSending:a.default.func,onSuccess:a.default.func.isRequired,onMaxFilesExceeded:a.default.func,updateFormData:a.default.func,canFileUpload:a.default.func,onQueueComplete:a.default.func,options:a.default.shape({url:a.default.string.isRequired}),promptOnRemove:a.default.string,securityID:a.default.string.isRequired,uploadButton:a.default.bool,uploadSelector:a.default.string,canUpload:a.default.bool.isRequired,preview:a.default.shape({width:a.default.number,height:a.default.number}),className:a.default.string},p.defaultProps={uploadButton:!0};t.default=p},3229:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=c(n(5815)),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=n(9040),s=n(5207),l=n(3556),a=c(n(6923)),u=c(n(6935));function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}function c(e){return e&&e.__esModule?e:{default:e}}class p extends o.Component{constructor(e){super(e),this.handleChangeValue=this.handleChangeValue.bind(this),this.renderChild=this.renderChild.bind(this)}getOptionByValue(e){return this.props.actions.find((t=>t.value===e))}handleChangeValue(e){let t=null;const n=this.getOptionByValue(e.target.value);return null===n?null:(t="function"==typeof n.confirm?n.confirm(this.props.items).then((()=>n.callback(e,this.props.items))).catch((e=>{if("cancelled"!==e)throw e})):n.callback(e,this.props.items)||Promise.resolve(),t)}renderChild(e,t){const n=(0,a.default)("bulk-actions__action",e.className||"font-icon-info-circled",{btn:t<2,"bulk-actions__action--more":t>2});return t<2?o.default.createElement(l.Button,{className:n,key:e.value,onClick:this.handleChangeValue,value:e.value,color:e.color},e.label):o.default.createElement(l.DropdownItem,{type:"button",className:n,key:e.value,onClick:this.handleChangeValue,value:e.value},e.label)}render(){if(!this.props.items.length)return null;let e=this.props.actions.filter((e=>!e.canApply||e.canApply(this.props.items)));if(e=e.map(this.renderChild),!e.length)return null;const{ActionMenu:t,showCount:n}=this.props,i=r.default._t("AssetAdmin.BULK_ACTIONS_SELECT_ALL","Select all"),s=r.default.sprintf(r.default._t("AssetAdmin.BULK_ACTIONS_SELECTED","%s selected"),this.props.items.length),a=r.default._t("AssetAdmin.BULK_ACTIONS_CLEAR_SELECTION","Clear selection");return o.default.createElement("div",{className:"bulk-actions fieldholder-small"},n&&o.default.createElement(o.default.Fragment,null,o.default.createElement(l.Button,{className:"bulk-actions-counter font-icon-cross-mark",onClick:this.props.onClearSelection,title:a},s),o.default.createElement("div",{className:"bulk-actions-select-all"},o.default.createElement(l.Button,{onClick:this.props.onSelectAll},i))),e.slice(0,2),e.length>2&&t?o.default.createElement(t,{id:"BulkActions",className:"bulk-actions__more-actions-menu"},e.slice(2)):e.slice(2))}}t.Component=p,p.propTypes={items:u.default.array,actions:u.default.arrayOf(u.default.shape({value:u.default.string.isRequired,label:u.default.string.isRequired,className:u.default.string,destructive:u.default.bool,callback:u.default.func,canApply:u.default.func,confirm:u.default.func})),ActionMenu:u.default.elementType,showCount:u.default.bool,onClearSelection:u.default.func.isRequired,onSelectAll:u.default.func.isRequired},p.defaultProps={items:[],actions:[],ActionMenu:null,total:null,showCount:!0,totalReachedMessage:r.default._t("")};const f=(0,i.connect)((function(e){return{gallery:e.assetAdmin.gallery}}))(p);t.default=(0,s.inject)(["ActionMenu"],(e=>({ActionMenu:e})),(()=>"BulkActions"))(f)},1037:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Folder=t.File=t.Component=void 0;var r=E(n(5815)),o=C(n(1594)),i=E(n(6923)),s=E(n(6379)),l=E(n(6022)),a=E(n(2063)),u=E(n(2932)),d=E(n(2926)),c=E(n(1990)),p=E(n(4350)),f=n(9040),h=n(9367),m=n(4172),g=C(n(769)),y=E(n(1838)),v=E(n(6935));function b(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(b=function(e){return e?n:t})(e)}function C(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=b(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function E(e){return e&&e.__esModule?e:{default:e}}function S(){return S=Object.assign?Object.assign.bind():function(e){for(var t=1;t{e.preventDefault()};class x extends o.Component{constructor(e){super(e),this.handleSelect=this.handleSelect.bind(this),this.handleActivate=this.handleActivate.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancelUpload=this.handleCancelUpload.bind(this)}componentDidUpdate(){_(this.props)&&this.props.actions.imageLoad.loadImage(this.props.item.thumbnail,this.props.sectionConfig.imageRetry)}getThumbnailStyles(){const{item:{thumbnail:e,version:t},bustCache:n}=this.props;if(!this.isImage()||!e||this.missing())return{};const r=!1===n||!t||e.startsWith("data:image/")?e:`${e}?vid=${t}`;switch(this.props.loadState){case y.default.SUCCESS:case y.default.DISABLED:return{backgroundImage:`url(${r})`};default:return{}}}getErrorMessage(){let e=null;const{item:t,loadState:n}=this.props;if(this.hasError()?e=t.message.value:this.missing()?e=r.default._t("AssetAdmin.FILE_MISSING","File cannot be found"):n===y.default.FAILED&&(e=r.default._t("AssetAdmin.FILE_LOAD_ERROR","Thumbnail not available")),null!==e){return e=this.getItemFunction("updateErrorMessage")(e,this.props),o.default.createElement("span",{className:"gallery-item__error-message"},e)}return null}getThumbnailClassNames(){const e=["gallery-item__thumbnail"];switch(this.isImageSmallerThanThumbnail()&&e.push("gallery-item__thumbnail--small"),!this.props.item.thumbnail&&this.isImage()&&e.push("gallery-item__thumbnail--no-preview"),this.props.loadState){case y.default.LOADING:case y.default.WAITING:e.push("gallery-item__thumbnail--loading");break;case y.default.FAILED:e.push("gallery-item__thumbnail--error")}return e.join(" ")}getItemClassNames(){const e=this.props.item.category||"false",t=this.props.selectable&&(this.props.item.selected||this.props.isDragging);return(0,i.default)({"gallery-item":!0,[`gallery-item--${e}`]:!0,"gallery-item--max-selected":this.props.maxSelected&&!t,"gallery-item--missing":this.missing(),"gallery-item--selectable":this.props.selectable,"gallery-item--selected":t,"gallery-item--dropping":this.props.isDropping,"gallery-item--highlighted":this.props.item.highlighted,"gallery-item--error":this.hasError(),"gallery-item--dragging":this.props.isDragging})}getItemFunction(e){const{item:t}=this.props;return"function"==typeof t[e]?t[e]:this.props[e]}getStatusFlags(){let e=[];const{item:t}=this.props;"folder"!==t.type&&(t.draft?e.push({key:"status-draft",title:r.default._t("File.DRAFT","Draft"),className:"gallery-item--draft"}):t.modified&&e.push({key:"status-modified",title:r.default._t("File.MODIFIED","Modified"),className:"gallery-item--modified"}));return e=this.getItemFunction("updateStatusFlags")(e,this.props),o.default.createElement("div",{className:"gallery-item__status-flags"},e.map((e=>o.default.createElement("span",e))))}getStatusIcons(){const{item:e}=this.props,t=[];return e.hasRestrictedAccess&&t.push({key:"status-restricted",fileID:e.id,hasRestrictedAccess:!0,placement:"top",disableTooltip:"folder"===e.type,includeBackground:"folder"!==e.type}),e.isTrackedFormUpload&&"folder"!==e.type&&t.push({key:"status-tracked-form-upload",fileID:e.id,isTrackedFormUpload:!0,hasRestrictedAccess:e.hasRestrictedAccess,placement:"top",includeBackground:!0}),o.default.createElement("div",{className:"gallery-item__status-icons"},t.map((e=>o.default.createElement(c.default,e))))}getProgressBar(){let e=null;const{item:t}=this.props,n={className:"gallery-item__progress-bar",style:{width:`${t.progress}%`}};this.hasError()||!this.uploading()||this.complete()||(e=o.default.createElement("div",{className:"gallery-item__upload-progress"},o.default.createElement("div",n)));return e=this.getItemFunction("updateProgressBar")(e,this.props),e}isImageSmallerThanThumbnail(){if(!this.isImage()||this.missing())return!1;const e=this.props.item.width,t=this.props.item.height;return t&&e&&t0}missing(){return!this.exists()&&this.saved()}uploading(){return this.props.item.queuedId&&!this.saved()}exists(){return this.props.item.exists}isImage(){return"image"===this.props.item.category}canBatchSelect(){return this.props.selectable&&this.props.item.canEdit}hasError(){let e=!1;return this.props.item.message&&(e="error"===this.props.item.message.type),e}handleActivate(e){e.stopPropagation(),"function"==typeof this.props.onActivate&&this.saved()&&this.props.onActivate(e,this.props.item)}handleSelect(e){e.stopPropagation(),e.preventDefault(),"function"==typeof this.props.onSelect&&this.props.onSelect(e,this.props.item)}handleKeyDown(e){s.default.SPACE_KEY_CODE===e.keyCode&&(e.preventDefault(),this.canBatchSelect()&&this.handleSelect(e)),s.default.RETURN_KEY_CODE===e.keyCode&&this.handleActivate(e)}handleCancelUpload(e){e.stopPropagation(),e.preventDefault(),this.hasError()?this.props.onRemoveErroredUpload(this.props.item):this.props.onCancelUpload&&this.props.onCancelUpload(this.props.item)}render(){let e=null,t=null,n=null;const{id:i,queuedId:s}=this.props.item,l=i?`item-${i}`:`queued-${s}`;if(this.props.selectable&&(this.canBatchSelect()&&(e=this.handleSelect),t="font-icon-tick"),this.uploading())e=this.handleCancelUpload,t="font-icon-cancel";else if(this.exists()){const e=r.default._t("AssetAdmin.VIEW","View");n=o.default.createElement("div",{className:"gallery-item--overlay font-icon-eye"},e)}const a=this.props.badge,u={className:"gallery-item__checkbox",type:"checkbox",title:r.default._t("AssetAdmin.SELECT","Select"),tabIndex:-1,onMouseDown:w,id:l},c=["gallery-item__checkbox-label",t];this.canBatchSelect()||(u.disabled=!0,c.push("gallery-item__checkbox-label--disabled"));const p={className:c.join(" "),onClick:e};return o.default.createElement("div",{className:this.getItemClassNames(),"data-id":this.props.item.id,tabIndex:0,role:"button",onKeyDown:this.handleKeyDown,onClick:this.handleActivate},!!a&&o.default.createElement(d.default,{className:"gallery-item__badge",status:a.status,message:a.message}),o.default.createElement("div",{ref:e=>{this.thumbnail=e},className:this.getThumbnailClassNames(),style:this.getThumbnailStyles()},n,this.getStatusFlags(),this.getStatusIcons()),this.getProgressBar(),this.getErrorMessage(),this.props.children,o.default.createElement("div",{className:"gallery-item__title",ref:e=>{this.title=e}},o.default.createElement("label",S({},p,{htmlFor:l}),o.default.createElement("input",u)),this.props.item.title))}}t.Component=x,x.propTypes={sectionConfig:p.default,item:l.default,loadState:v.default.oneOf(Object.values(y.default)),bustCache:v.default.bool,highlighted:v.default.bool,selected:v.default.bool,isDropping:v.default.bool,isDragging:v.default.bool,message:v.default.shape({value:v.default.string,type:v.default.string}),selectable:v.default.bool,onActivate:v.default.func,onSelect:v.default.func,onCancelUpload:v.default.func,onRemoveErroredUpload:v.default.func,badge:v.default.shape({status:v.default.string,message:v.default.string}),updateStatusFlags:v.default.func,updateProgressBar:v.default.func,updateErrorMessage:v.default.func},x.defaultProps={item:{},sectionConfig:{imageRetry:{}},updateStatusFlags:e=>e,updateProgressBar:e=>e,updateErrorMessage:e=>e,bustCache:!0};const F=(0,f.connect)((function(e,t){const{bustCache:n}=e.config.sections.find((e=>"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"===e.name));let r=y.default.DISABLED;if(_(t)){const n=e.assetAdmin.imageLoad.files.find((e=>t.item.thumbnail===e.url));r=n&&n.status||y.default.NONE}return{bustCache:n,loadState:r}}),(function(e){return{actions:{imageLoad:(0,h.bindActionCreators)(g,e)}}}))(x),O="GalleryItem",A=t.File=(0,m.createSelectable)((0,a.default)(O)(F));t.Folder=(0,m.createSelectable)((0,u.default)(O)(A));t.default=F},2914:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=a(n(6935)),i=n(1820),s=a(n(2926)),l=a(n(1037));function a(e){return e&&e.__esModule?e:{default:e}}function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t1?r.default.createElement("div",{key:"1",className:"gallery-item__drag-shadow"}):null,t>2?r.default.createElement("div",{key:"2",className:"gallery-item__drag-shadow gallery-item__drag-shadow--second"}):null];return r.default.createElement("div",{className:"gallery-item__drag-layer"},r.default.createElement("div",{className:"gallery-item__drag-layer-item",style:this.getOffset()},r.default.createElement("div",{className:"gallery-item__drag-layer-preview"},n,r.default.createElement(l.default,d({},e.props,{isDragging:!0}))),t>1?r.default.createElement(s.default,{className:"gallery-item__drag-layer-count",status:"info",message:`${t}`}):null))}}c.propTypes={item:o.default.object,offset:o.default.shape({x:o.default.number.isRequired,y:o.default.number.isRequired}),isDragging:o.default.bool.isRequired};t.default=(0,i.DragLayer)((e=>({item:e.getItem(),offset:e.getInitialClientOffset(),dragged:e.getDifferenceFromInitialOffset(),isDragging:e.isDragging()})))(c)},2063:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){const t={canDrag(e){return e.canDrag},beginDrag(e){const{id:t}=e.item;"function"==typeof e.onDrag&&e.onDrag(!0,t);const n=e.selectedFiles.concat([]);return n.includes(t)||n.push(t),{selected:n,props:e}},endDrag(e){const{id:t}=e.item;"function"==typeof e.onDrag&&e.onDrag(!1,t)}},n=(0,s.DragSource)(e,t,((e,t)=>({connectDragPreview:e.dragPreview(),connectDragSource:e.dragSource(),isDragging:t.isDragging()})));return e=>{class t extends o.Component{componentDidMount(){this.props.connectDragPreview((0,l.getEmptyImage)(),{captureDraggingState:!0})}render(){const{connectDragSource:t}=this.props,n=o.default.createElement(e,this.props);return"string"==typeof n.type?t(n):t(o.default.createElement("div",{className:"gallery-item__draggable"},n))}}return t.propTypes={connectDragSource:i.default.func.isRequired,connectDragPreview:i.default.func.isRequired,item:i.default.shape({id:i.default.number.isRequired}).isRequired,onDrag:i.default.func,selectedFiles:i.default.arrayOf(i.default.number)},n(t)}};var r,o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=a(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=(r=n(6935))&&r.__esModule?r:{default:r},s=n(1820),l=n(8724);function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(a=function(e){return e?n:t})(e)}},2932:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){const t={drop(e,t){if(t.canDrop()){const n=t.getItem();e.onDropFiles(e.item.id,n.selected)}},canDrop(e,t){return!t.getItem().selected.includes(e.item.id)}},n=(0,s.DropTarget)(e,t,((e,t)=>{const n=t.isOver();return{isDropping:n&&t.canDrop(),connectDropTarget:e.dropTarget(),isOver:n}}));return e=>{class t extends o.Component{render(){const{connectDropTarget:t}=this.props,n=o.default.createElement(e,this.props);return"string"==typeof n.type?t(n):t(o.default.createElement("div",{className:"gallery-item__droppable"},n))}}return t.propTypes={connectDropTarget:i.default.func.isRequired,item:i.default.shape({id:i.default.number.isRequired}).isRequired},n(t)}};var r,o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=(r=n(6935))&&r.__esModule?r:{default:r},s=n(1820);function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}},6379:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o=(r=n(5815))&&r.__esModule?r:{default:r};t.default={ACTIONS:{CREATE_FOLDER:"create-folder",EDIT_FILE:"edit"},MOVE_SUCCESS_DURATION:3e3,CSS_TRANSITION_TIME:300,SMALL_THUMBNAIL_HEIGHT:60,SMALL_THUMBNAIL_WIDTH:60,THUMBNAIL_HEIGHT:150,THUMBNAIL_WIDTH:200,BULK_ACTIONS:[{value:"delete",label:o.default._t("AssetAdmin.BULK_ACTIONS_DELETE","Delete"),className:"font-icon-trash",destructive:!0,callback:null,canApply:e=>e.every((e=>e&&e.canDelete))},{value:"archive",label:o.default._t("AssetAdmin.BULK_ACTIONS_ARCHIVE","Archive"),className:"font-icon-box",destructive:!0,callback:null,canApply:e=>e.every((e=>e&&e.canDelete))},{value:"edit",label:o.default._t("AssetAdmin.BULK_ACTIONS_EDIT","Edit"),className:"font-icon-edit",destructive:!1,canApply:e=>1===e.length,callback:null},{value:"move",label:o.default._t("AssetAdmin.BULK_ACTIONS_MOVE","Move"),className:"font-icon-folder-move",canApply:e=>e.every((e=>e&&e.canEdit)),destructive:!1,callback:null},{value:"publish",label:o.default._t("AssetAdmin.BULK_ACTIONS_PUBLISH","Publish"),className:"font-icon-rocket",destructive:!1,callback:null,canApply:e=>e.some((e=>e&&e.modified))&&e.every((e=>e.canEdit&&"folder"!==e.type)),confirm:null},{value:"unpublish",label:o.default._t("AssetAdmin.BULK_ACTIONS_UNPUBLISH","Unpublish"),className:"font-icon-cancel-circled",destructive:!1,callback:null,canApply:e=>e.some((e=>e.published))&&e.every((e=>e.canEdit&&"folder"!==e.type)),confirm:null},{value:"insert",label:o.default._t("AssetAdmin.BULK_ACTIONS_INSERT","Insert"),className:"font-icon-plus-circled btn-primary",destructive:!1,callback:null,canApply:e=>e.length,confirm:null}],BULK_ACTIONS_PLACEHOLDER:o.default._t("AssetAdmin.BULK_ACTIONS_PLACEHOLDER"),SPACE_KEY_CODE:32,RETURN_KEY_CODE:13,DEFAULT_PREVIEW:"framework/client/dist/images/app_icons/generic_92.png",MODAL_MOVE:"MODAL_MOVE"}},7917:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=M(n(1594)),o=D(n(6935)),i=n(9040),s=n(9367),l=D(n(5609)),a=D(n(5815)),u=D(n(6923)),d=M(n(4201)),c=M(n(8918)),p=M(n(1369)),f=M(n(9517)),h=D(n(1869)),m=D(n(5789)),g=D(n(2294)),y=n(708),v=M(n(6303)),b=D(n(6175)),C=D(n(3934)),E=D(n(3929)),S=D(n(5230)),_=D(n(6379)),w=D(n(4350)),x=n(5207),F=M(n(4461)),O=D(n(8268)),A=D(n(175)),I=D(n(2308));function D(e){return e&&e.__esModule?e:{default:e}}function N(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(N=function(e){return e?n:t})(e)}function M(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=N(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}class R extends r.Component{constructor(e){super(e),this.handleOpenFile=this.handleOpenFile.bind(this),this.handleCloseFile=this.handleCloseFile.bind(this),this.handleDelete=this.handleDelete.bind(this),this.doPublish=this.doPublish.bind(this),this.doUnpublish=this.doUnpublish.bind(this),this.handleUnpublish=this.handleUnpublish.bind(this),this.handleDoSearch=this.handleDoSearch.bind(this),this.handleClearSearch=this.handleClearSearch.bind(this),this.handleSubmitEditor=this.handleSubmitEditor.bind(this),this.handleOpenFolder=this.handleOpenFolder.bind(this),this.handleSort=this.handleSort.bind(this),this.handleSetPage=this.handleSetPage.bind(this),this.createEndpoint=this.createEndpoint.bind(this),this.handleBackButtonClick=this.handleBackButtonClick.bind(this),this.handleFolderIcon=this.handleFolderIcon.bind(this),this.handleBrowse=this.handleBrowse.bind(this),this.handleViewChange=this.handleViewChange.bind(this),this.handleUpload=this.handleUpload.bind(this),this.handleUploadQueue=this.handleUploadQueue.bind(this),this.handleCreateFolder=this.handleCreateFolder.bind(this),this.handleMoveFilesSuccess=this.handleMoveFilesSuccess.bind(this)}componentDidUpdate(){"function"==typeof this.props.onReplaceUrl&&!this.props.loading&&this.props.folder&&this.props.folderId!==this.props.folder.id&&this.props.onReplaceUrl(this.props.folder.id,this.props.fileId,this.props.query,this.props.viewAction)}getFolderId(){return null!==this.props.folderId?this.props.folderId:this.props.folder?this.props.folder.id:0}getFiles(){const{files:e,queuedFiles:t,folderId:n}=this.props,r=[...t.items.filter((t=>!(t.id&&e.find((e=>e.id===t.id))||t.hasOwnProperty("uploadedToFolderId")&&t.uploadedToFolderId!==n))),...e],o=r.filter((e=>"folder"===e.type)),i=r.filter((e=>"folder"!==e.type));return o.concat(i)}handleBrowse(e,t,n){"function"==typeof this.props.onBrowse&&this.props.onBrowse(e,t,n),e!==this.getFolderId()&&this.props.actions.gallery.deselectFiles()}handleSetPage(e){this.handleBrowse(this.getFolderId(),this.props.fileId,Object.assign({},this.props.query,{page:e}))}handleDoSearch(e){this.props.actions.gallery.deselectFiles(),this.props.actions.queuedFiles.purgeUploadQueue(),this.props.actions.files.readFiles(),this.handleBrowse(e.currentFolderOnly?this.getFolderId():0,null,{filter:e,view:this.props.query.view})}handleClearSearch(e){this.props.actions.displaySearch.closeSearch(),this.props.actions.gallery.deselectFiles(),this.props.actions.queuedFiles.purgeUploadQueue(),this.props.actions.files.readFiles(),this.handleOpenFolder(e,this.props.folder)}handleSort(e){this.handleBrowse(this.getFolderId(),this.props.fileId,{...this.props.query,sort:e,limit:void 0,page:void 0})}handleViewChange(e){this.handleBrowse(this.getFolderId(),this.props.fileId,Object.assign({},this.props.query,{view:e}))}createEndpoint(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return l.default.createEndpointFetcher(Object.assign({},e,t?{defaultData:{SecurityID:this.props.securityId}}:{}))}handleBackButtonClick(e){e.preventDefault(),this.props.actions.gallery.deselectFiles(),this.props.folder?this.handleOpenFolder(this.props.folder.parentId||0):this.handleOpenFolder(0)}resetFile(e){e.queuedId&&this.props.actions.queuedFiles.removeQueuedFile(e.queuedId),this.props.fileId===e.id&&this.props.resetFileDetails(this.getFolderId(),e.id,this.props.query)}handleFolderIcon(){this.handleOpenFile(this.getFolderId())}handleOpenFile(e){this.handleBrowse(this.getFolderId(),e,this.props.query)}handleSubmitEditor(e,t,n){let r=null;if("action_insert"===t&&"select"===this.props.type){const t=this.getFiles().find((t=>t.id===parseInt(e.ID,10)));return this.props.onInsertMany(null,[t]),Promise.resolve()}if("function"==typeof this.props.onSubmitEditor){const o=this.findFile(this.props.fileId);r=this.props.onSubmitEditor(e,t,n,o)}else r=n();if(!r)throw new Error("Promise was not returned for submitting");return r.then((e=>("action_createfolder"===t&&"admin"===this.props.type&&this.handleOpenFile(e.record.id),this.props.actions.files.readFiles().then((()=>("action_createfolder"===t&&"admin"!==this.props.type&&this.handleOpenFolder(this.getFolderId()),e))))))}handleCloseFile(){this.handleBrowse(this.getFolderId(),null,this.props.query)}handleOpenFolder(e){const{page:t,filter:n,...r}=this.props.query;this.handleBrowse(e,null,r)}handleDelete(e){this.props.actions.confirmDeletion.deleting();const t=e.map((e=>{const t=this.findFile(e);if(!t)throw new Error(`File selected for deletion cannot be found: ${e}`);return t.queuedId&&this.props.actions.queuedFiles.removeQueuedFile(t.queuedId),t})).map((e=>e.id)),n=this.props.folder?this.props.folder.id:0;return this.props.actions.files.deleteFiles(t,n).then((e=>{let{data:{deleteFiles:r}}=e;this.handleBrowse(n,null,this.props.query);return this.props.queuedFiles.items.filter((e=>t.includes(e.id))).forEach((e=>{e.queuedId&&this.props.actions.queuedFiles.removeQueuedFile(e.queuedId)})),this.props.actions.files.readFiles(),r})).then((t=>{const n=t.filter((e=>e)).length,{archiveFiles:r}=this.props.sectionConfig;if(n!==e.length){let t="AssetAdmin.BULK_ACTIONS_DELETE_FAIL_02",o="%s folders/files were successfully deleted, but %s files were not able to be deleted.";r&&(t="AssetAdmin.BULK_ACTIONS_ARCHIVE_FAIL_02",o="%s folders/files were successfully archived, but %s files were not able to be archived."),this.props.actions.toasts.error(a.default.sprintf(a.default._t(t,o),n,e.length-n))}else{let e="AssetAdmin.BULK_ACTIONS_DELETE_SUCCESS_02",t="%s folders/files were successfully deleted.";r&&(e="AssetAdmin.BULK_ACTIONS_ARCHIVE_SUCCESS_02",t="%s folders/files were successfully archived."),this.props.actions.toasts.success(a.default.sprintf(a.default._t(e,t),n)),this.props.actions.gallery.deselectFiles()}return t})).finally(this.props.actions.confirmDeletion.reset)}doUnpublish(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=e.map((e=>{const t=this.findFile(e);if(!t)throw new Error(`File selected for unpublishing cannot be found: ${e}`);if("folder"===t.type)throw new Error("Cannot unpublish folders");return t})).map((e=>e.id));return this.props.actions.files.unpublishFiles(n,t).then((e=>{let{data:{unpublishFiles:t}}=e;const n=t.filter((e=>"File"===e.__typename)),r=t.filter((e=>"PublicationNotice"===e.__typename&&"HAS_OWNERS"===e.noticeType)),o=n.map((e=>(this.resetFile(e),e))),i=r.slice(0,4),s=r.slice(5),l=i.map((e=>e.message));if(s.length&&l.push(a.default.inject(a.default._t("AssetAdmin.BULK_OWNED_WARNING_REMAINING","And {count} other file(s)"),{count:s.length})),i.length){const e=[a.default.inject(a.default._t("AssetAdmin.BULK_OWNED_WARNING_HEADING","{count} file(s) are being used by other published content."),{count:r.length}),l.join("\n"),a.default._t("AssetAdmin.BULK_OWNED_WARNING_FOOTER","Unpublishing will only remove files from the published version of the content. They will remain on the draft version. Unpublish anyway?")];if(confirm(e.join("\n\n"))){const e=r.reduce(((e,t)=>e.concat(t.ids)),[]);return this.doUnpublish(e,!0).then((e=>o.concat(e)))}}return o}))}handleUnpublish(e){return this.doUnpublish(e).then((e=>{const{fileId:t}=this.props;this.props.actions.files.readFiles().then((()=>{t&&e.find((e=>e.id===t))&&this.props.resetFileDetails(this.getFolderId(),t,this.props.query)}))}))}doPublish(e){const t=e.map((e=>{const t=this.findFile(e);if(!t)throw new Error(`File selected for publishing cannot be found: ${e}`);if("folder"===t.type)throw new Error("Cannot publish folders");return t})).map((e=>e.id));return this.props.actions.files.publishFiles(t).then((e=>{let{data:{publishFiles:t}}=e;return t.filter((e=>"File"===e.__typename)).map((e=>(this.resetFile(e),e)))}))}findFile(e){return this.getFiles().find((t=>t.id===parseInt(e,10)))}handleUpload(){}handleUploadQueue(){this.props.fileId&&this.props.actions.files.readFiles()}handleCreateFolder(){this.props.onBrowse(this.getFolderId(),null,this.props.query,_.default.ACTIONS.CREATE_FOLDER)}handleMoveFilesSuccess(e,t){this.props.queuedFiles.items.filter((e=>t.includes(e.id))).forEach((e=>{e.queuedId&&this.props.actions.queuedFiles.removeQueuedFile(e.queuedId)})),this.props.actions.gallery.deselectFiles(),this.props.actions.files.readFiles()}renderGallery(){const{GalleryComponent:e}=this.props,t=this.props.sectionConfig,n=t.createFileEndpoint.url,o=t.createFileEndpoint.method,i=this.props.query&&parseInt(this.props.query.limit||t.limit,10),s=this.props.query&&parseInt(this.props.query.page||1,10),l=this.props.query&&this.props.query.sort,a=this.props.query&&this.props.query.view,u=this.props.query.filter||{};return r.default.createElement(e,{files:this.getFiles(),fileId:this.props.fileId,folderId:this.getFolderId(),folder:this.props.folder,type:this.props.type,limit:i,page:s,totalCount:this.props.filesTotalCount,view:a,filters:u,graphQLErrors:this.props.graphQLErrors,createFileApiUrl:n,createFileApiMethod:o,onInsertMany:this.props.onInsertMany,onPublish:this.doPublish,onUnpublish:this.doUnpublish,onOpenFile:this.handleOpenFile,onOpenFolder:this.handleOpenFolder,onSuccessfulUpload:this.handleUpload,onSuccessfulUploadQueue:this.handleUploadQueue,onCreateFolder:this.handleCreateFolder,onMoveFilesSuccess:this.handleMoveFilesSuccess,onClearSearch:this.handleClearSearch,onSort:this.handleSort,onSetPage:this.handleSetPage,onViewChange:this.handleViewChange,sort:l,sectionConfig:t,loading:this.props.loading,maxFilesSelect:this.props.maxFiles,dialog:this.props.dialog})}renderEditor(){const{sectionConfig:e,viewAction:t,type:n,fileId:o,dialog:i,requireLinkText:s,fileSelected:l,EditorComponent:a}=this.props,{schemaUrl:u,targetId:d}=(0,O.default)({config:e,viewAction:t,folderId:this.getFolderId(),type:n,fileId:o});if(!u)return null;const c=[];s&&c.push({name:"requireLinkText",value:!0}),l&&c.push({name:"fileSelected",value:!0});const p={dialog:i,fileId:d,schemaUrl:u,schemaUrlQueries:c,onClose:this.handleCloseFile,onSubmit:this.handleSubmitEditor,onUnpublish:this.handleUnpublish,addToCampaignSchemaUrl:e.form.addToCampaignForm.schemaUrl};return r.default.createElement(a,p)}render(){const{folder:e,folderId:t,query:n,getUrl:o,type:i,maxFiles:s,toolbarChildren:l,SearchComponent:a,BulkDeleteConfirmationComponent:d}=this.props,c=Boolean(t||(0,v.hasFilters)(n.filter)),p=this.props.sectionConfig.form.fileSearchForm.schemaUrl,f=n.filter||{},h=(0,u.default)("fill-height asset-admin","select"===i&&{"asset-admin--single-select":1===s,"asset-admin--multi-select":1!==s}),m=(0,v.hasFilters)(n.filter)||this.props.showSearch,y=this.props.actions.displaySearch?this.props.actions.displaySearch.toggleSearch:void 0,C={folder:e,query:n,getUrl:o,onBrowse:this.handleBrowse,onFolderIcon:this.handleFolderIcon};return r.default.createElement("div",{className:h},r.default.createElement(g.default,{showBackButton:c,onBackButtonClick:this.handleBackButtonClick},r.default.createElement(I.default,C),r.default.createElement("div",{className:"asset-admin__toolbar-extra pull-xs-right fill-width vertical-align-items"},r.default.createElement(b.default,{toggled:m,onToggle:y}),l)),m&&r.default.createElement(a,{onSearch:this.handleDoSearch,id:"AssetSearchForm",formSchemaUrl:p,onHide:this.handleClearSearch,displayBehavior:"HIDEABLE",filters:f,name:"name"}),r.default.createElement("div",{className:"flexbox-area-grow fill-width fill-height gallery"},this.renderGallery(),this.renderEditor()),r.default.createElement(d,{onConfirm:this.handleDelete}))}}t.Component=R,R.propTypes={dialog:o.default.bool,sectionConfig:w.default,fileId:o.default.number,folderId:o.default.number,resetFileDetails:o.default.func,onBrowse:o.default.func,onReplaceUrl:o.default.func,onInsertMany:o.default.func,graphQLErrors:o.default.arrayOf(o.default.string),getUrl:o.default.func,query:o.default.shape({sort:o.default.string,limit:o.default.oneOfType([o.default.number,o.default.string]),page:o.default.oneOfType([o.default.number,o.default.string]),filter:o.default.object}),onSubmitEditor:o.default.func,type:o.default.oneOf(["insert-media","insert-link","select","admin"]),files:o.default.array,queuedFiles:o.default.shape({items:o.default.array.isRequired}),filesTotalCount:o.default.number,folder:o.default.shape({id:o.default.number,title:o.default.string,parents:o.default.array,parentId:o.default.number,canView:o.default.bool,canEdit:o.default.bool}),loading:o.default.bool,actions:o.default.object,maxFiles:o.default.number,fileSelected:o.default.bool,EditorComponent:o.default.oneOfType([o.default.object,o.default.func]),GalleryComponent:o.default.oneOfType([o.default.object,o.default.func]),SearchComponent:o.default.oneOfType([o.default.object,o.default.func]),BulkDeleteConfirmationComponent:o.default.oneOfType([o.default.object,o.default.func])},R.defaultProps={type:"admin",query:{sort:"",limit:null,page:0,filter:{}},maxFiles:null,EditorComponent:h.default,GalleryComponent:m.default,SearchComponent:v.default,BulkDeleteConfirmationComponent:A.default};t.default=(0,s.compose)((0,i.connect)((function(e,t){const{formSchema:n}=e.assetAdmin.modal;return{securityId:e.config.SecurityID,queuedFiles:e.assetAdmin.queuedFiles,showSearch:e.assetAdmin.displaySearch.isOpen,type:n&&n.type||t.type}}),(function(e){return{actions:{gallery:(0,s.bindActionCreators)(d,e),toasts:(0,s.bindActionCreators)(c,e),displaySearch:(0,s.bindActionCreators)(f,e),queuedFiles:(0,s.bindActionCreators)(p,e),confirmDeletion:(0,s.bindActionCreators)(F,e)}}})),(0,x.injectGraphql)("ReadFilesQuery"),C.default,E.default,S.default,y.withApollo)(R)},2308:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=a(n(1594)),o=a(n(6935)),i=a(n(5815)),s=n(6418),l=n(6303);function a(e){return e&&e.__esModule?e:{default:e}}const u=e=>{let{folder:t,query:n,getUrl:o,onBrowse:s,onFolderIcon:a,PlainBreadcrumbComponent:u}=e;const d=function(){for(var e=arguments.length,t=new Array(e),n=0;n{e.preventDefault(),s(...t)}},c=function(){return o&&o(...arguments)},p=[{text:i.default._t("AssetAdmin.FILES","Files"),href:c(0,null,n),onClick:d(0,null,n)}];if(t&&t.id){t.parents&&t.parents.forEach((e=>{p.push({text:e.title,href:c(e.id,null,n),onClick:d(e.id,null,n)})}));const e=[{className:"icon font-icon-edit-list",onClick:e=>{e.preventDefault(),a()}}];t.hasRestrictedAccess&&e.push({nodeName:"FileStatusIcon",hasRestrictedAccess:!0}),p.push({text:t.title,href:c(t.id,null,n),onClick:d(t.id,null,n),icons:e})}return(0,l.hasFilters)(n.filter)&&p.push({text:i.default._t("LeftAndMain.SEARCHRESULTS","Search results")}),r.default.createElement(u,{multiline:!0,crumbs:p})};u.propTypes={onBrowse:o.default.func,onFolderIcon:o.default.func,getUrl:o.default.func,query:o.default.shape({sort:o.default.string,limit:o.default.oneOfType([o.default.number,o.default.string]),page:o.default.oneOfType([o.default.number,o.default.string]),filter:o.default.object,view:o.default.string}),folder:o.default.shape({id:o.default.number,title:o.default.string,parents:o.default.array,parentId:o.default.number,canView:o.default.bool,canEdit:o.default.bool}),PlainBreadcrumbComponent:o.default.oneOfType([o.default.object,o.default.func])},u.defaultProps={PlainBreadcrumbComponent:s.Component};t.default=u},4736:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Component=void 0,t.buildUrl=v,t.default=void 0;var r=g(n(1594)),o=n(8926),i=n(9040),s=g(n(6478)),l=h(n(7917)),a=n(5716),u=h(n(7675)),d=h(n(6379)),c=h(n(4350)),p=n(5125),f=h(n(6935));function h(e){return e&&e.__esModule?e:{default:e}}function m(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(m=function(e){return e?n:t})(e)}function g(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=m(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}const y=Object.keys(d.default.ACTIONS).map((e=>d.default.ACTIONS[e]));function v(e){let{base:t,folderId:n,fileId:r,query:o,action:i}=e;if(i&&-1===y.indexOf(i))throw new Error(`Invalid action provided: ${i}`);let s=null;s=r?(0,p.joinUrlPaths)(t,`show/${n}/${d.default.ACTIONS.EDIT_FILE}/${r}`):n?(0,p.joinUrlPaths)(t,`show/${n}`):t,i===d.default.ACTIONS.CREATE_FOLDER&&(s=(0,p.joinUrlPaths)(t,`show/${n||0}/${i}`));return o&&Object.keys(o).length>0&&(s=`${s}?${u.default.stringify(o)}`),s}class b extends r.Component{constructor(e){super(e),this.handleBrowse=this.handleBrowse.bind(this),this.handleReplaceUrl=this.handleReplaceUrl.bind(this),this.handleResetDetails=this.handleResetDetails.bind(this),this.getUrl=this.getUrl.bind(this)}getUrl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:d.default.ACTIONS.EDIT_FILE;const o=parseInt(e||0,10),i=parseInt(t||0,10),s=o!==this.getFolderId(),l=Object.assign({},n);return(s||l.page<=1)&&delete l.page,v({base:`/${this.props.sectionConfig.reactRoutePath}`,folderId:o,fileId:i,query:l,action:r})}getFolderId(){return this.props.router.params&&this.props.router.params.folderId?parseInt(this.props.router.params.folderId,10):0}getFileId(){return this.props.router.params&&this.props.router.params.fileId?parseInt(this.props.router.params.fileId,10):0}getViewAction(){return this.props.router.params&&this.props.router.params.viewAction?this.props.router.params.viewAction:d.default.ACTIONS.EDIT_FILE}getSectionProps(){return{sectionConfig:this.props.sectionConfig,type:"admin",folderId:this.getFolderId(),viewAction:this.getViewAction(),fileId:this.getFileId(),query:this.getQuery(),getUrl:this.getUrl,onBrowse:this.handleBrowse,onReplaceUrl:this.handleReplaceUrl,resetFileDetails:this.handleResetDetails}}getQuery(){return(0,a.decodeQuery)(this.props.router.location.search)}handleBrowse(e,t,n,r){const o=this.getUrl(e,t,n,r);this.props.router.navigate(o)}handleReplaceUrl(e,t,n,r){const o=this.getUrl(e,t,n,r);this.props.router.navigate(o,{replace:!0})}handleResetDetails(e,t,n){const r=this.getUrl(e,t,n),o=this.getUrl(e,null,n);this.props.router.navigate(o,{replace:!0,state:{reset:!0,resetPath:r}})}render(){const{AssetAdminComponent:e}=this.props,t=this.props.router.location.state;return t&&t&&t.reset?r.default.createElement(o.Navigate,{to:t.resetPath,replace:!0}):this.props.sectionConfig?r.default.createElement(e,this.getSectionProps()):null}}t.Component=b,b.propTypes={sectionConfig:c.default,router:s.routerPropTypes,AssetAdminComponent:f.default.oneOfType([f.default.object,f.default.func])},b.defaultProps={AssetAdminComponent:l.default};t.default=(0,s.default)((0,i.connect)((function(e){return{sectionConfig:e.config.sections.find((e=>"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"===e.name))}}))(b))},2908:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.AssetAdminStateRouter=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=u(n(6935)),i=n(9040),s=n(4736),l=u(n(6379)),a=n(1021);function u(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}const c={folderId:null,fileId:null,query:{},action:l.default.ACTIONS.EDIT_FILE};class p extends r.Component{constructor(e){super(e),this.handleBrowse=this.handleBrowse.bind(this),this.getUrl=this.getUrl.bind(this),this.state=Object.assign({},c,{folderId:e.folderId})}getUrl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l.default.ACTIONS.EDIT_FILE;const o=parseInt(e||0,10),i=parseInt(t||0,10),a=this.getFolderId(),u=o!==a&&null!==a,d=Object.assign({},n);return(u||d.page<=1)&&delete d.page,(0,s.buildUrl)({base:this.props.sectionConfig.reactRoutePath,folderId:o,fileId:i,query:d,action:r})}getFolderId(){return null===this.state.folderId?null:parseInt(this.state.folderId||0,10)}getFileId(){return parseInt(this.state.fileId||this.props.fileId||0,10)}getViewAction(){return this.state.action||l.default.ACTIONS.EDIT_FILE}getSectionProps(){const e=Object.assign({},this.props,{folderId:this.getFolderId(),fileId:this.getFileId(),viewAction:this.getViewAction(),query:this.state.query,getUrl:this.getUrl,onBrowse:this.handleBrowse});return delete e.Component,e}handleBrowse(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l.default.ACTIONS.EDIT_FILE;if(r&&-1===Object.values(l.default.ACTIONS).indexOf(r))throw new Error(`Invalid action provided: ${r}`);this.state.fileId!==t&&this.props.actions.resetFormStack(),this.setState({folderId:e,fileId:t,query:n,action:r})}render(){const e=this.getSectionProps(),t=this.props.Component;return r.default.createElement(t,e)}}function f(e){return{actions:{resetFormStack:()=>e((0,a.resetFormStack)())}}}t.AssetAdminStateRouter=p,p.propTypes={Component:o.default.elementType,sectionConfig:o.default.shape({url:o.default.string.isRequired}).isRequired,fileId:o.default.number};t.default=function(e){return(0,i.connect)((function(t){const n=t.config.sections.find((e=>"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"===e.name));return{Component:e,sectionConfig:n}}),f)(p)}},175:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=v(n(1594)),o=n(9367),i=n(9040),s=v(n(6935)),l=n(708),a=n(5207),u=y(n(4461)),d=y(n(762)),c=v(n(5815)),p=v(n(6022)),f=v(n(134)),h=v(n(7871)),m=n(60);function g(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(g=function(e){return e?n:t})(e)}function y(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=g(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function v(e){return e&&e.__esModule?e:{default:e}}function b(){return b=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{loading:t,LoadingComponent:n,transition:o,files:i,descendantFileCounts:s,onModalClose:l,onCancel:a,onConfirm:u,archiveFiles:p}=e,g=null;const y=p?"AssetAdmin.ARCHIVE":"AssetAdmin.DELETE",v=p?"Archive":"Delete";let b=[{label:c.default._t(y,v),handler:()=>u(i.map((e=>{let{id:t}=e;return t}))),color:"danger"},{label:c.default._t("AssetAdmin.CANCEL","Cancel"),handler:a}];if(t)g=r.default.createElement(n,null);else{const e=Object.keys(s).length,t=(0,m.getFolderDescendantFileTotals)(i,s),n=(0,m.getFileTotalItems)(i),o={folderCount:e,folderDescendantFileTotals:t,fileTotalItems:n,archiveFiles:p};g=r.default.createElement(h.default,o),(t.totalItems||n)&&(b=[{label:c.default._t("AssetAdmin.CANCEL","Cancel"),handler:a,color:"primary"},{label:c.default._t(y,v),handler:()=>u(i.map((e=>{let{id:t}=e;return t}))),color:"danger"}])}const C=![d.CANCELING,d.DELETING].includes(o);return r.default.createElement(f.default,{body:g,isOpen:C,actions:b,onCancel:a,onClosed:l,archiveFiles:p})};t.Component=C,C.propTypes={loading:s.default.bool.isRequired,LoadingComponent:s.default.elementType,transition:s.default.oneOf(["canceling","deleting",!1]),files:s.default.arrayOf(p.default),descendantFileCounts:s.default.object,onCancel:s.default.func.isRequired,onModalClose:s.default.func.isRequired,onConfirm:s.default.func.isRequired,archiveFiles:s.default.bool.isRequired};const E=(0,o.compose)((0,a.inject)(["Loading"],(e=>({LoadingComponent:e}))),(0,a.injectGraphql)("readDescendantFileCountsQuery"),l.withApollo)(C),S={onCancel:u.cancel,onModalClose:u.modalClose};t.default=(0,o.compose)((0,i.connect)((e=>{let{assetAdmin:{confirmDeletion:t}}=e;return t}),S))((e=>{let{showConfirmation:t,files:n,...o}=e;return t&&n.length>0?r.default.createElement(E,b({},o,{files:n})):null}))},7871:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=l(n(5815)),o=l(n(1594)),i=l(n(6935)),s=n(60);function l(e){return e&&e.__esModule?e:{default:e}}const a=e=>{let{folderCount:t,folderDescendantFileTotals:n,fileTotalItems:i,archiveFiles:s}=e,l="AssetAdmin.BULK_ACTIONS_DELETE_WARNING",a="Ensure files are removed from content areas prior to deleting them, otherwise they will appear as broken links.";s&&(l="AssetAdmin.BULK_ACTIONS_ARCHIVE_WARNING",a="Ensure files are removed from content areas prior to archiving them, otherwise they will appear as broken links.");const u=((e,t,n,o)=>{const i=t.totalCount+n;if(i>0){let e="AssetAdmin.BULK_ACTIONS_DELETE_ITEMS_CONFIRM",t=["You're about to delete %s file(s) which may be used in your site's content.","Carefully check the file usage on the files before deleting the file(s)."].join(" ");return o&&(e="AssetAdmin.BULK_ACTIONS_ARCHIVE_ITEMS_CONFIRM",t=["You're about to archive %s file(s) which may be used in your site's content.","Carefully check the file usage on the files before archiving the file(s)."].join(" ")),r.default.sprintf(r.default._t(e,t),i)}if(1===e){let e="AssetAdmin.BULK_ACTIONS_DELETE_FOLDER_CONFIRM",t="Are you sure you want to delete this folder?";return o&&(e="AssetAdmin.BULK_ACTIONS_ARCHIVE_FOLDER_CONFIRM",t="Are you sure you want to archive this folder?"),r.default._t(e,t)}let s="AssetAdmin.BULK_ACTIONS_DELETE_FOLDERS_CONFIRM",l="Are you sure you want to delete these folders?";return o&&(s="AssetAdmin.BULK_ACTIONS_ARCHIVE_FOLDERS_CONFIRM",l="Are you sure you want to archive these folders?"),r.default._t(s,l)})(t,n,i,s);return o.default.createElement(o.default.Fragment,null,o.default.createElement("p",null,u),(n.totalItems>0||i>0)&&o.default.createElement("p",null,r.default._t(l,a)))};a.propTypes={folderCount:i.default.number,folderDescendantFileTotals:s.descendantFileTotalsShape,fileTotalItems:i.default.number},a.defaultProps={folderCount:0,folderDescendantFileTotals:{totalItems:0,totalCount:0},fileTotalItems:0};t.default=a},134:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=l(n(5815)),o=l(n(1594)),i=l(n(6935)),s=n(3556);function l(e){return e&&e.__esModule?e:{default:e}}const a=e=>{let{isOpen:t,body:n,onCancel:i,actions:l,archiveFiles:a}=e,u="AssetAdmin.CONFIRM_FILE_DELETION",d="Confirm deletion";return a&&(u="AssetAdmin.CONFIRM_FILE_ARCHIVE",d="Confirm archive"),o.default.createElement(s.Modal,{isOpen:t,toggle:i},o.default.createElement(s.ModalHeader,{toggle:i},r.default._t(u,d)),o.default.createElement(s.ModalBody,null,n),o.default.createElement(s.ModalFooter,null,l.map((e=>{let{label:t,handler:n,color:r}=e;return o.default.createElement(s.Button,{key:t,color:r,onClick:n},t)}))))};a.propTypes={isOpen:i.default.bool.isRequired,body:i.default.node.isRequired,onCancel:i.default.func.isRequired,actions:i.default.arrayOf(i.default.shape({label:i.default.string.isRequired,handler:i.default.func,color:i.default.string})),archiveFiles:i.default.bool.isRequired};t.default=a},60:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getFolderDescendantFileTotals=t.getFileTotalItems=t.descendantFileTotalsShape=void 0;var r,o=(r=n(6935))&&r.__esModule?r:{default:r};const i=e=>{let{type:t}=e;return"folder"===t},s=e=>!i(e),l={totalItems:0,totalCount:0};t.descendantFileTotalsShape=o.default.shape({totalItems:o.default.number,totalCount:o.default.number});t.getFolderDescendantFileTotals=(e,t)=>{return e.filter(i).reduce((n=t,(e,t)=>{let{id:r}=t;return n[r]>0?{totalItems:e.totalItems+1,totalCount:e.totalCount+n[r]}:e}),l);var n};t.getFileTotalItems=e=>e.filter(s).length},1869:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=S(n(5815)),o=n(9040),i=n(9367),s=E(n(1594)),l=S(n(6379)),a=S(n(55)),u=S(n(8737)),d=E(n(9077)),c=S(n(6022)),p=S(n(6935)),f=n(5207),h=E(n(4461)),m=E(n(1021)),g=S(n(6923)),y=S(n(7008)),v=S(n(7675)),b=E(n(1584));function C(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(C=function(e){return e?n:t})(e)}function E(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=C(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function S(e){return e&&e.__esModule?e:{default:e}}function _(){return _=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{name:n,value:r}=t;return{...e,[n]:r}}),{});return y.default.format({...r,pathname:`${r.path}/${n}`,search:v.default.stringify(o)})}handleAction(e){switch(e.currentTarget.name){case"action_addtocampaign":this.openModal(),e.preventDefault();break;case"action_replacefile":this.replaceFile(),e.preventDefault();break;case"action_downloadfile":this.downloadFile(),e.preventDefault();break;case"action_delete":this.props.actions.confirmDeletion.confirm([this.props.file]),e.preventDefault()}}handleCancelKeyDown(e){e.keyCode!==l.default.SPACE_KEY_CODE&&e.keyCode!==l.default.RETURN_KEY_CODE||this.handleClose(e)}handleSubmit(e,t,n){const{showingSubForm:r,actions:o}=this.props;return"function"==typeof this.props.onSubmit?this.props.onSubmit(e,t,n).finally((()=>{r&&-1!==["action_save","action_publish"].indexOf(t)&&o.modal.popFormStackEntry()})):n()}handleClose(e){const{showingSubForm:t,onClose:n,actions:r}=this.props;t?r.modal.popFormStackEntry():(n(),this.closeModal()),e&&e.preventDefault()}openModal(){this.setState({openModal:!0})}closeModal(){this.setState({openModal:!1})}replaceFile(){const e=document.querySelector(".dz-input-PreviewImage");e&&e.click()}downloadFile(){!function(e,t){const n=document.createElement("a");n.download=t,n.href=e,document.body.appendChild(n),n.click(),document.body.removeChild(n)}(this.props.file.url,this.props.file.name),document.getElementById("Form_fileEditForm_PopoverActions").focus()}handleLoadingError(e){this.setState({loadingForm:!1,loadingError:e.errors[0]})}handleLoadingSuccess(){this.setState({loadingForm:!1,loadingError:null})}handleFetchingSchema(){this.setState({loadingForm:!0})}editorHeader(e){let{SchemaComponent:t,...n}=e;const{dialog:r,nextType:o,showingSubForm:i,actions:l,file:a,EditorHeaderComponent:u}=this.props,d=this.getFormSchemaUrl();let c=b.buttonStates.SWITCH;r&&a&&"folder"!==a.type&&(c=i?b.buttonStates.ALWAYS_BACK:b.buttonStates.ONLY_BACK);const{formid:p}=n,f=o&&a&&"folder"!==a.type?()=>{l.modal.stashFormValues(p,d),l.modal.pushFormStackEntry(o)}:void 0,h={onCancel:this.handleClose,showButton:c,onDetails:f};return s.default.createElement(u,h,s.default.createElement(t,n))}createFn(e,t){if("AssetEditorHeaderFieldGroup"===t.name){const n=this.editorHeader,r={key:t.id,SchemaComponent:e,...t};return s.default.createElement(n,r)}return s.default.createElement(e,_({key:t.id},t))}render(){const{FormBuilderLoaderComponent:e,FormBuilderModalComponent:t}=this.props,n=this.getFormSchemaUrl(),o=`${this.props.addToCampaignSchemaUrl}/${this.props.fileId}`,i=(0,g.default)("panel","form--no-dividers","editor",{"editor--asset-dropzone--disable":!this.props.enableDropzone},this.props.className);let l=null;if(this.state.loadingError){let e=this.state.loadingError.value;404===this.state.loadingError.code&&(e=r.default._t("AssetAdmin.FILE_MISSING","File cannot be found")),e||(e=r.default._t("Admin.UNKNOWN_ERROR","An unknown error has occurred")),l=s.default.createElement("div",{className:"editor__file-preview-message--file-missing"},e)}const a=r.default._t("Admin.ADD_TO_CAMPAIGN","Add to campaign"),u=this.props.loadingComponent,{file:d}=this.props;return s.default.createElement("div",{className:i},s.default.createElement("div",{className:"editor__details fill-height"},s.default.createElement(e,{identifier:"AssetAdmin.EditForm",schemaUrl:n,onSubmit:this.handleSubmit,onAction:this.handleAction,onLoadingSuccess:this.handleLoadingSuccess,onLoadingError:this.handleLoadingError,onFetchingSchema:this.handleFetchingSchema,createFn:this.createFn,file:d}),l,s.default.createElement(t,{title:a,identifier:"AssetAdmin.AddToCampaign",isOpen:this.state.openModal,onClosed:this.closeModal,schemaUrl:o,bodyClassName:"modal__dialog",responseClassBad:"modal__response modal__response--error",responseClassGood:"modal__response modal__response--good"}),this.state.loadingForm&&s.default.createElement(u,null)))}}t.Component=w,w.propTypes={file:c.default,className:p.default.string,fileId:p.default.number.isRequired,enableDropzone:p.default.bool,dialog:p.default.bool,onClose:p.default.func.isRequired,onSubmit:p.default.func.isRequired,schemaUrl:p.default.string.isRequired,schemaUrlQueries:p.default.arrayOf(p.default.shape({name:p.default.string,value:p.default.any})),addToCampaignSchemaUrl:p.default.string,actions:p.default.object,showingSubForm:p.default.bool,nextType:p.default.string,EditorHeaderComponent:p.default.oneOfType([p.default.object,p.default.func]),FormBuilderLoaderComponent:p.default.oneOfType([p.default.object,p.default.func]),FormBuilderModalComponent:p.default.oneOfType([p.default.object,p.default.func])},w.defaultProps={EditorHeaderComponent:b.default,FormBuilderLoaderComponent:a.default,FormBuilderModalComponent:u.default};t.default=(0,i.compose)((0,f.inject)(["Loading"],(e=>({loadingComponent:e})),(()=>"AssetAdmin.Editor")),(0,o.connect)((function(e){let{assetAdmin:{gallery:t,modal:n}}=e;return{enableDropzone:t.enableDropzone,nextType:n.formSchema&&n.formSchema.nextType,showingSubForm:n.formSchemaStack&&n.formSchemaStack.length>1}}),(function(e){return{actions:{unsavedForms:(0,i.bindActionCreators)(d,e),confirmDeletion:(0,i.bindActionCreators)(h,e),modal:(0,i.bindActionCreators)(m,e)}}})),(0,f.injectGraphql)("ReadOneFileQuery"))(w)},1584:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.buttonStates=void 0;var r=u(n(1594)),o=u(n(5815)),i=u(n(551)),s=u(n(2164)),l=u(n(6935)),a=u(n(6923));function u(e){return e&&e.__esModule?e:{default:e}}const d=e=>t=>{t.preventDefault(),e&&e()},c="ALWAYS_BACK",p="ALWAYS_CANCEL",f="SWITCH",h="ONLY_BACK",m="ONLY_CANCEL",g=t.buttonStates={ALWAYS_BACK:c,ALWAYS_CANCEL:p,SWITCH:f,ONLY_BACK:h,ONLY_CANCEL:m,NONE:"NONE"},y=e=>{let{onCancel:t,onDetails:n,showButton:l,children:u}=e;const g=d(t),y=[c,f,h].indexOf(l)>=0,v=[p,f,m].indexOf(l)>=0,b=(0,a.default)("editor-header__back-button","btn--icon-xl",{"editor-header__back-button--md-below":[f,h].indexOf(l)>=0}),C=(0,a.default)("editor-header__cancel-button","btn--icon-xl",{"editor-header__cancel-button--lg-above":[f,m].indexOf(l)>=0});return r.default.createElement("div",{className:"editor-header"},y&&r.default.createElement(s.default,{className:b,onClick:g}),r.default.createElement("div",{className:"editor-header__field"},u),n&&r.default.createElement(i.default,{onClick:d(n),icon:"edit-list",className:"editor-header__edit",outline:!0},o.default._t("AssetAdmin.DETAILS","Details")),v&&r.default.createElement("div",null,r.default.createElement(i.default,{icon:"cancel",className:C,noText:!0,onClick:g},o.default._t("AssetAdmin.CANCEL"))))};y.propTypes={onCancel:l.default.func,onDetails:l.default.func,showButton:l.default.oneOf(Object.keys(g).map((e=>g[e]))),children:l.default.node};t.default=y},5789:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.galleryViewPropTypes=t.galleryViewDefaultProps=t.default=t.Component=void 0;var r=I(n(1669)),o=I(n(5815)),i=A(n(1594)),s=n(9040),l=n(9367),a=I(n(853)),u=I(n(3229)),d=I(n(2853)),c=I(n(6609)),p=I(n(6379)),f=I(n(6621)),h=A(n(4201)),m=A(n(8918)),g=A(n(1369)),y=A(n(4461)),v=I(n(4064)),b=n(708),C=n(4172),E=I(n(4350)),S=I(n(9247)),_=n(5207),w=I(n(6935)),x=I(n(5769)),F=I(n(3863));function O(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(O=function(e){return e?n:t})(e)}function A(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=O(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function I(e){return e&&e.__esModule?e:{default:e}}const D={DELETE:"delete",ARCHIVE:"archive",EDIT:"edit",MOVE:"move",PUBLISH:"publish",UNPUBLISH:"unpublish",INSERT:"insert",ADMIN:"admin",SELECT:"select"};class N extends i.Component{constructor(e){super(e),this.handleOpenFolder=this.handleOpenFolder.bind(this),this.handleOpenFile=this.handleOpenFile.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleAddedFile=this.handleAddedFile.bind(this),this.handlePreviewLoaded=this.handlePreviewLoaded.bind(this),this.handleCancelUpload=this.handleCancelUpload.bind(this),this.handleRemoveErroredUpload=this.handleRemoveErroredUpload.bind(this),this.handleUploadProgress=this.handleUploadProgress.bind(this),this.handleSending=this.handleSending.bind(this),this.handleSort=this.handleSort.bind(this),this.handleSetPage=this.handleSetPage.bind(this),this.handleSuccessfulUpload=this.handleSuccessfulUpload.bind(this),this.handleQueueComplete=this.handleQueueComplete.bind(this),this.handleFailedUpload=this.handleFailedUpload.bind(this),this.handleClearSearch=this.handleClearSearch.bind(this),this.handleEnableDropzone=this.handleEnableDropzone.bind(this),this.handleMoveFiles=this.handleMoveFiles.bind(this),this.handleBulkEdit=this.handleBulkEdit.bind(this),this.handleBulkPublish=this.handleBulkPublish.bind(this),this.handleBulkUnpublish=this.handleBulkUnpublish.bind(this),this.handleBulkMove=this.handleBulkMove.bind(this),this.handleBulkInsert=this.handleBulkInsert.bind(this),this.handleBeginSelection=this.handleBeginSelection.bind(this),this.handleGroupSelect=this.handleGroupSelect.bind(this),this.handleClearSelection=this.handleClearSelection.bind(this),this.handleSelectAll=this.handleSelectAll.bind(this),this.toggleSelectConcat=this.toggleSelectConcat.bind(this),this.getSelectableFiles=this.getSelectableFiles.bind(this)}componentDidMount(){this.initSortDropdown(),window.addEventListener("keydown",this.toggleSelectConcat),window.addEventListener("keyup",this.toggleSelectConcat)}componentDidUpdate(e){this.initSortDropdown(),this.initFlushUploadFiles(e)}componentWillUnmount(){window.removeEventListener("keydown",this.toggleSelectConcat),window.removeEventListener("keyup",this.toggleSelectConcat)}initFlushUploadFiles(e){if("tile"!==this.props.view){this.getSortElement().off("change")}e.folderId!==this.props.folderId&&this.props.actions.queuedFiles.purgeUploadQueue()}getSortElement(){return(0,r.default)(this.gallery).find(".gallery__sort .dropdown")}getSearchMessage(e){const t=[];e.name&&t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGEKEYWORDS","with keywords '{name}'")),e.lastEditedFrom&&e.lastEditedTo?t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGEEDITEDBETWEEN","last edited between '{lastEditedFrom}' and '{lastEditedTo}'")):e.lastEditedFrom?t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGEEDITEDFROM","last edited after '{lastEditedFrom}'")):e.lastEditedTo&&t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGEEDITEDTO","last edited before '{lastEditedTo}'")),e.appCategory&&t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGECATEGORY","categorised as '{appCategory}'")),e.currentFolderOnly&&this.props.folder.title&&t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGELIMIT","limited to the folder '{folder}'"));const n=[t.slice(0,-1).join(`${o.default._t("AssetAdmin.JOIN",",")} `),t.slice(-1)].filter((e=>e)).join(` ${o.default._t("AssetAdmin.JOINLAST","and")} `);if(""===n)return"";const r={parts:o.default.inject(n,Object.assign({folder:this.props.folder.title},e,{appCategory:e.appCategory?e.appCategory.toLowerCase():void 0}))};return o.default.inject(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGE","Search results {parts}"),r)}getSelection(e,t){const n=this.getSelectableFiles(),r=[e,t].map((e=>n.findIndex((t=>t.id===e)))).filter((e=>-1!==e)).sort(((e,t)=>e-t));if(2!==r.length)return r.map((e=>n[e].id));const[o,i]=r;return n.filter(((e,t)=>t>=o&&t<=i)).map((e=>e.id))}getSelectableFiles(){const e=this.props.files.filter((e=>e.id));return this.props.type===D.SELECT?e.filter((e=>"folder"!==e.type)):e}handleBulkInsert(e,t){this.props.onInsertMany(e,t)}handleBulkPublish(e,t){const n=t.map((e=>e.id));return n.length?(this.props.actions.gallery.setLoading(!0),this.props.onPublish(n).then((e=>{this.props.actions.gallery.setLoading(!1),this.props.actions.toasts.success(o.default.sprintf(o.default._t("AssetAdmin.BULK_ACTIONS_PUBLISH_SUCCESS","%s folders/files were successfully published."),e.length)),this.props.actions.gallery.deselectFiles()}))):(this.props.actions.gallery.deselectFiles(),Promise.resolve(!0))}handleBulkUnpublish(e,t){const n=t.filter((e=>e.published)).map((e=>e.id));return n.length?(this.props.actions.gallery.setLoading(!0),this.props.onUnpublish(n).then((e=>{this.props.actions.gallery.setLoading(!1),this.props.actions.toasts.success(o.default.sprintf(o.default._t("AssetAdmin.BULK_ACTIONS_UNPUBLISH_SUCCESS","%s folders/files were successfully unpublished."),e.length)),this.props.actions.gallery.deselectFiles()}))):(this.props.actions.gallery.deselectFiles(),Promise.resolve(!0))}initSortDropdown(){if("tile"===this.props.view){const e=this.getSortElement();e.chosen({allow_single_deselect:!0,disable_search_threshold:20}),e.off("change"),e.on("change",(()=>e.find(":selected")[0].click()))}}handleSort(e){this.props.actions.queuedFiles.purgeUploadQueue(),this.props.onSort(e)}handleSetPage(e){this.props.onSetPage(e)}handleCancelUpload(e){e.xhr.abort(),this.props.actions.queuedFiles.removeQueuedFile(e.queuedId)}handleRemoveErroredUpload(e){this.props.actions.queuedFiles.removeQueuedFile(e.queuedId)}handleAddedFile(e){this.props.actions.queuedFiles.addQueuedFile(e)}handlePreviewLoaded(e,t){this.props.actions.queuedFiles.updateQueuedFile(e.queuedId,t)}handleSending(e,t){this.props.actions.queuedFiles.updateQueuedFile(e._queuedId,{xhr:t})}handleUploadProgress(e,t){this.props.actions.queuedFiles.updateQueuedFile(e._queuedId,{progress:t})}handleSuccessfulUpload(e){const t=JSON.parse(e.xhr.response);if(void 0!==t[0].error)return void this.handleFailedUpload(e);this.props.actions.queuedFiles.succeedUpload(e._queuedId,t[0]),this.props.onSuccessfulUpload&&this.props.onSuccessfulUpload(t);const n=this.props.queuedFiles.items.reduce(((e,t)=>100!==t.progress?e+1:e),0);if(!this.props.fileId&&!this.props.selectedFiles.length&&0===n){const e=t.pop();this.props.onOpenFile(e.id)}}handleQueueComplete(){this.props.onSuccessfulUploadQueue&&this.props.onSuccessfulUploadQueue()}handleFailedUpload(e,t){const n=e.xhr&&e.xhr.status?(0,S.default)(e.xhr.status,e.xhr):"";this.props.actions.queuedFiles.failUpload(e._queuedId,t,n)}itemIsSelected(e){return this.props.selectedFiles.indexOf(e)>-1}toggleSelectConcat(e){this.props.actions.gallery.setConcatenateSelect(this.isConcat(e))}isConcat(e){return e.metaKey||e.ctrlKey||e.shiftKey}itemIsHighlighted(e){return this.props.fileId===e}hasOpenedItem(){return!!this.props.fileId}handleClearSearch(e){this.props.onClearSearch(e)}handleGroupSelect(e,t){const{setSelectedFiles:n,selectFiles:r}=this.props.actions.gallery,o=this.getSelectableFiles(),i=e.filter(((t,n)=>e.indexOf(t)===n&&o.find((e=>e.id===t)))),s=this.props.concatenateSelect||this.isConcat(t);if(null!==this.props.maxFilesSelect){let e=i.length;if(s){e=this.props.selectedFiles.filter((e=>!this.props.selectedFiles.includes(e))).concat(this.props.selectedFiles).length}if(e>=this.props.maxFilesSelect)return}s?r(i):n(i)}handleClearSelection(){this.props.actions.gallery.deselectFiles()}handleSelectAll(){const e=this.props.files.map((e=>e.id));this.handleGroupSelect(e,new Event("na"))}handleBeginSelection(e){let t=e.target;for(;t;){if(t.classList.contains("griddle-footer"))return!1;if(t.classList.contains("gallery__main--selectable"))break;t=t.parentNode}return!0}handleOpenFolder(e,t){e.preventDefault(),this.props.onOpenFolder(t.id)}handleOpenFile(e,t){e.preventDefault(),null!==t.created&&(this.props.selectedFiles.length&&1!==this.props.maxFilesSelect||this.props.type!==D.SELECT||this.handleSelect(e,t),this.props.onOpenFile(t.id,t))}handleSelect(e,t){const n=this.props.maxFilesSelect;let r=this.getSelectableFiles().filter((e=>e.id===t.id)).map((e=>e.id));if(1!==n)if(-1===this.props.selectedFiles.indexOf(t.id)){e.shiftKey&&(r=this.getSelection(this.props.lastSelected,t.id));if(this.props.selectedFiles.filter((e=>!r.includes(e))).concat(r).length>n&&null!==n)return;this.props.actions.gallery.selectFiles(r),this.props.actions.gallery.setLastSelected(t.id)}else this.props.actions.gallery.deselectFiles([t.id]),e.shiftKey&&this.props.actions.gallery.setLastSelected(null);else this.props.actions.gallery.setSelectedFiles(r)}handleEnableDropzone(e){this.props.actions.gallery.setEnableDropzone(e)}handleMoveFiles(e,t){this.props.actions.files.moveFiles(e,t).then((()=>{const n=p.default.MOVE_SUCCESS_DURATION,r=`+${t.length}`;this.props.actions.gallery.setFileBadge(e,r,"success",n),"function"==typeof this.props.onMoveFilesSuccess&&this.props.onMoveFilesSuccess(e,t)})).catch((()=>{this.props.actions.toasts.error(o.default._t("AssetAdmin.FAILED_MOVE","There was an error moving the selected items."))}))}handleBulkEdit(e,t){this.handleOpenFile(e,t[0])}handleBulkMove(){this.props.actions.gallery.activateModal(p.default.MODAL_MOVE)}renderTransitionBulkActions(){return this.renderBulkActions()}renderBulkActions(){const{type:e,dialog:t,maxFilesSelect:n,files:r,selectedFiles:o,BulkActionsComponent:s,sectionConfig:l}=this.props,a=e===D.SELECT||t?e=>e.value===D.INSERT:e=>e.value!==D.INSERT,u=l.archiveFiles?e=>e.value!==D.DELETE:e=>e.value!==D.ARCHIVE,d=p.default.BULK_ACTIONS.filter(a).filter(u).map((e=>{if(e.callback)return e;switch(e.value){case D.DELETE:case D.ARCHIVE:return{...e,callback:(e,t)=>{this.props.actions.confirmDeletion.confirm(t)},confirm:void 0};case D.EDIT:return{...e,callback:this.handleBulkEdit};case D.MOVE:return{...e,callback:this.handleBulkMove};case D.PUBLISH:return{...e,callback:this.handleBulkPublish};case D.UNPUBLISH:return{...e,callback:this.handleBulkUnpublish};case D.INSERT:return{...e,callback:this.handleBulkInsert,color:"primary"};default:return e}})),c=o.map((e=>r.find((t=>t&&e===t.id)))).filter((e=>e));return c.length>0&&[D.ADMIN,D.SELECT].includes(e)?i.default.createElement(s,{actions:d,items:c,total:n,key:c.length>0,container:this.gallery,showCount:1!==n,onClearSelection:this.handleClearSelection,onSelectAll:this.handleSelectAll}):null}renderGalleryView(){const e="table"===this.props.view?c.default:d.default,t=this.props.files.map((e=>{const t=this.itemIsSelected(e.id),n=this.itemIsHighlighted(e.id),r=(e.queuedId?`queueId${e.queuedId}`:`id${e.id}`)+(t?"--selected":"");return{...e,selected:t,highlighted:n,key:r}})),{type:n,loading:r,dialog:o,page:s,totalCount:l,limit:a,sort:u,selectedFiles:p,badges:f,maxFilesSelect:h,sectionConfig:m}=this.props,g={selectableItems:n===D.SELECT||n===D.ADMIN&&(!h||h>1),selectableFolders:n!==D.SELECT&&!o,files:t,loading:r,page:s,totalCount:l,limit:a,sort:u,selectedFiles:p,badges:f,onSort:this.handleSort,onSetPage:this.handleSetPage,onOpenFile:this.handleOpenFile,onOpenFolder:this.handleOpenFolder,onSelect:this.handleSelect,onCancelUpload:this.handleCancelUpload,onDropFiles:this.handleMoveFiles,onRemoveErroredUpload:this.handleRemoveErroredUpload,onEnableDropzone:this.handleEnableDropzone,sectionConfig:m,canDrag:n===D.ADMIN,maxFilesSelect:h};return i.default.createElement(e,g)}renderToolbar(){const{GalleryToolbar:e,sort:t,view:n,folder:r,onCreateFolder:o,onOpenFolder:s,onViewChange:l}=this.props,a={onMoveFiles:this.handleMoveFiles,onSort:this.handleSort,onCreateFolder:o,onOpenFolder:s,onViewChange:l,view:n,sort:t,folder:r};return i.default.createElement(e,a)}render(){const{folder:e,loading:t,errorMessage:n,graphQLErrors:r,noticeMessage:s}=this.props,l=this.props.LoadingComponent,u=r&&r.length>0;if(!e)return n||u?i.default.createElement("div",{className:"gallery__error flexbox-area-grow"},i.default.createElement("div",{className:"gallery__error-message"},i.default.createElement("h3",null,o.default._t("AssetAdmin.DROPZONE_RESPONSE_ERROR","Server responded with an error.")),n&&i.default.createElement("p",null,n),u&&r.map(((e,t)=>i.default.createElement("p",{key:t},e))))):t?i.default.createElement("div",{className:"flexbox-area-grow"},i.default.createElement(l,null)):i.default.createElement("div",{className:"flexbox-area-grow"},i.default.createElement("div",{className:"editor__file-preview-message--file-missing m-t-3"},o.default._t("Admin.UNKNOWN_ERROR","An unknown error has occurred")));const d=i.default.createElement("div",{className:"gallery_messages"},n&&i.default.createElement(f.default,{value:n,type:"danger"}),s&&i.default.createElement(f.default,{value:s,type:"success"})),c={height:p.default.THUMBNAIL_HEIGHT,width:p.default.THUMBNAIL_WIDTH},h={url:this.props.createFileApiUrl,method:this.props.createFileApiMethod,paramName:"Upload",clickable:"#upload-button",...this.props.sectionConfig.dropzoneOptions},m=this.props.securityId,g=this.props.folder.canEdit&&this.props.enableDropzone,y=["panel","panel--padded","panel--scrollable","gallery__main","fill-height"];this.props.type===D.INSERT&&y.push("insert-media-modal__main");const v=y;return this.hasOpenedItem()&&v.push("gallery__main--has-opened-item"),i.default.createElement("div",{className:"flexbox-area-grow gallery__outer",ref:e=>{this.gallery=e}},this.renderTransitionBulkActions(),i.default.createElement(F.default,{className:y.join(" ")},this.renderToolbar(),i.default.createElement(C.SelectableGroup,{enabled:"tile"===this.props.view&&this.props.type===D.ADMIN,className:"flexbox-area-grow fill-height gallery__main--selectable",onSelection:this.handleGroupSelect,onNonItemClick:this.handleClearSelection,onBeginSelection:this.handleBeginSelection,preventDefault:!1,fixedPosition:!0},i.default.createElement(a.default,{name:"gallery-container",className:"flexbox-area-grow",canUpload:g,onAddedFile:this.handleAddedFile,onPreviewLoaded:this.handlePreviewLoaded,onError:this.handleFailedUpload,onSuccess:this.handleSuccessfulUpload,onQueueComplete:this.handleQueueComplete,onSending:this.handleSending,onUploadProgress:this.handleUploadProgress,preview:c,folderId:this.props.folderId,options:h,securityID:m,uploadButton:!1},d,this.renderGalleryView()))),this.props.loading&&i.default.createElement(l,null),i.default.createElement(x.default,{sectionConfig:this.props.sectionConfig,folderId:this.props.folderId,onSuccess:this.props.onMoveFilesSuccess,onOpenFolder:this.props.onOpenFolder}))}}t.Component=N;const M={page:1,limit:15},R={sectionConfig:E.default,loading:w.default.bool,sort:w.default.string,files:w.default.arrayOf(w.default.shape({id:w.default.number,parent:w.default.shape({id:w.default.number})})).isRequired,selectedFiles:w.default.arrayOf(w.default.number),totalCount:w.default.number,page:w.default.number,limit:w.default.number,badges:w.default.arrayOf(w.default.shape({id:w.default.number,message:w.default.node,status:w.default.string})),onOpenFile:w.default.func.isRequired,onOpenFolder:w.default.func.isRequired,onSort:w.default.func.isRequired,onSetPage:w.default.func.isRequired,maxFilesSelect:w.default.number};t.galleryViewDefaultProps=Object.assign({},M,{selectableItems:!1}),t.galleryViewPropTypes=Object.assign({},R,{selectableItems:w.default.bool,selectableFolders:w.default.bool,onSelect:w.default.func,onCancelUpload:w.default.func,onRemoveErroredUpload:w.default.func,onEnableDropzone:w.default.func});N.defaultProps=Object.assign({},M,{type:D.ADMIN,view:"tile",enableDropzone:!0,dialog:!1,BulkActionsComponent:u.default}),N.propTypes=Object.assign({},R,{onSuccessfulUpload:w.default.func,onSuccessfulUploadQueue:w.default.func,onCreateFolder:w.default.func,onMoveFilesSuccess:w.default.func,onPublish:w.default.func,onUnpublish:w.default.func,type:w.default.oneOf(["insert-media","insert-link",D.SELECT,D.ADMIN]),view:w.default.oneOf(["tile","table"]),lastSelected:w.default.number,dialog:w.default.bool,fileId:w.default.number,folderId:w.default.number.isRequired,folder:w.default.shape({id:w.default.number,title:w.default.string,parentId:w.default.number,canView:w.default.bool,canEdit:w.default.bool}),files:w.default.array,errorMessage:w.default.string,graphQLErrors:w.default.arrayOf(w.default.string),actions:w.default.object,securityId:w.default.string,onViewChange:w.default.func.isRequired,createFileApiUrl:w.default.string,createFileApiMethod:w.default.string,search:w.default.object,enableDropzone:w.default.bool,concatenateSelect:w.default.bool,GalleryToolbar:w.default.elementType,sorters:w.default.arrayOf(w.default.shape({field:w.default.string.isRequired,direction:w.default.oneOf(["asc","desc"]).isRequired,label:w.default.string.isRequired})).isRequired,BulkActionsComponent:w.default.oneOfType([w.default.object,w.default.func])});t.default=(0,l.compose)((0,_.inject)(["GalleryToolbar","Loading"],((e,t)=>({GalleryToolbar:e,LoadingComponent:t})),(()=>"AssetAdmin.Gallery")),(0,s.connect)((function(e,t){let{sort:n}=t;const{selectedFiles:r,errorMessage:o,noticeMessage:i,enableDropzone:s,badges:l,concatenateSelect:a,loading:u,sorters:d,lastSelected:c}=e.assetAdmin.gallery;return!n&&d&&d[0]&&(n=`${d[0].field},${d[0].direction}`),{lastSelected:c,selectedFiles:r,errorMessage:o,noticeMessage:i,enableDropzone:s,badges:l,concatenateSelect:a,loading:t.loading||u,queuedFiles:e.assetAdmin.queuedFiles,securityId:e.config.SecurityID,sorters:d,sort:n}}),(function(e){return{actions:{gallery:(0,l.bindActionCreators)(h,e),toasts:(0,l.bindActionCreators)(m,e),queuedFiles:(0,l.bindActionCreators)(g,e),confirmDeletion:(0,l.bindActionCreators)(y,e)}}})),v.default,(e=>(0,b.withApollo)(e)))(N)},3863:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=a(n(6923)),i=a(n(2914)),s=a(n(6935)),l=a(n(5799));function a(e){return e&&e.__esModule?e:{default:e}}function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}class d extends r.Component{constructor(e){super(e),this.state={dragging:!1},this.mounted=!1,this.handleDrop=this.handleDrop.bind(this)}componentDidMount(){this.mounted=!0,window.addEventListener("drop",this.handleDrop,!0)}componentDidUpdate(){setTimeout((()=>{if(!this.mounted||!this.context.dragDropManager)return;const e=this.context.dragDropManager.monitor.isDragging();this.state.dragging!==e&&this.setState({dragging:e})}))}componentWillUnmount(){this.mounted=!1,window.removeEventListener("drop",this.handleDrop,!0)}handleDrop(){const e=this.context.dragDropManager,t=e&&e.backend;t&&t.isDraggingNativeItem()&&t.endDragNativeItem()}render(){const{className:e,children:t}=this.props;return r.default.createElement("div",{className:(0,o.default)(e,{"gallery__main--dragging":this.state.dragging})},t,r.default.createElement(i.default,null))}}d.contextTypes={dragDropManager:s.default.object},d.propTypes={className:s.default.string,children:s.default.oneOfType([s.default.arrayOf(s.default.node),s.default.node])};t.default=(0,l.default)(d)},6931:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=b(n(5815)),o=v(n(1594)),i=n(9367),s=n(9040),l=b(n(7917)),a=b(n(2908)),u=b(n(1957)),d=v(n(4201)),c=v(n(1021)),p=b(n(8737)),f=b(n(6923)),h=b(n(6935)),m=b(n(8268)),g=b(n(7675));function y(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(y=function(e){return e?n:t})(e)}function v(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=y(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function b(e){return e&&e.__esModule?e:{default:e}}class C extends o.Component{constructor(e){super(e),this.handleSubmit=this.handleSubmit.bind(this)}componentDidMount(){const{isOpen:e,onBrowse:t,setOverrides:n,fileAttributes:r,folderId:o}=this.props;e?"function"==typeof n&&r.ID&&(n(this.props),t(o,r.ID)):t(o||0)}componentDidUpdate(e){!this.props.isOpen&&e.isOpen&&(this.props.onBrowse(this.props.folderId),this.props.actions.gallery.deselectFiles()),"function"==typeof e.setOverrides&&this.props.isOpen&&!e.isOpen&&(e.setOverrides(this.props),this.props.onBrowse(this.props.folderId,this.props.fileAttributes?this.props.fileAttributes.ID:null))}getSectionProps(){return{...this.props,dialog:!0,toolbarChildren:this.renderToolbarChildren(),onSubmitEditor:this.handleSubmit,onReplaceUrl:this.props.onBrowse}}getModalProps(){const{onHide:e,onInsert:t,sectionConfig:n,schemaUrl:r,className:o,...i}=this.props;return{...i,className:(0,f.default)("insert-media-modal",o),size:"lg",showCloseButton:!1}}handleSubmit(e,t,n,r){return"action_insert"===t?this.props.onInsert(e,r):n()}renderToolbarChildren(){return o.default.createElement("button",{type:"button",className:"close modal__close-button insert-media-modal__close-button",onClick:this.props.onClosed,"aria-label":r.default._t("FormBuilderModal.CLOSE","Close")},o.default.createElement("span",{"aria-hidden":"true"},"×"))}render(){const e=this.getModalProps(),t=this.getSectionProps(),n=this.props.isOpen?o.default.createElement(l.default,t):null;return o.default.createElement(p.default,e,n)}}t.Component=C,C.propTypes={sectionConfig:h.default.shape({url:h.default.string,form:h.default.object}),type:h.default.oneOf(["insert-media","insert-link","select","admin"]),schemaUrl:h.default.string,isOpen:h.default.bool,setOverrides:h.default.func,onInsert:h.default.func.isRequired,fileAttributes:h.default.shape({ID:h.default.number,AltText:h.default.string,Width:h.default.number,Height:h.default.number,Loading:h.default.string,TitleTooltip:h.default.string,Alignment:h.default.string,Description:h.default.string,TargetBlank:h.default.bool}),requireLinkText:h.default.bool,folderId:h.default.number,fileId:h.default.number,viewAction:h.default.string,query:h.default.object,getUrl:h.default.func,onBrowse:h.default.func.isRequired,onClosed:h.default.func,className:h.default.string,actions:h.default.object,maxFiles:h.default.number,fileSelected:h.default.bool},C.defaultProps={className:"",fileAttributes:{},type:"insert-media",folderId:0,maxFiles:1};t.default=(0,i.compose)(a.default,(0,s.connect)((function(e,t){const n=t.sectionConfig;if(!n)return{};let r=0;null!==t.folderId?r=t.folderId:t.folder&&(r=t.folder.id);const o=t.fileAttributes?t.fileAttributes.ID:t.fileId,i=e.assetAdmin.modal.formSchema,s={config:n,viewAction:t.viewAction,folderId:r,type:i&&i.type,fileId:o},{schemaUrl:l,targetId:a}=(0,m.default)(s);if(!l)return{};const u={};t.requireLinkText&&(u.requireLinkText=!0),t.fileSelected&&(u.fileSelected=!0);let d=g.default.stringify(u);return d=d?`?${d}`:"",{schemaUrl:`${l}/${a}${d}`,type:i&&i.type}}),(function(e){return{actions:{gallery:(0,i.bindActionCreators)(d,e),modal:(0,i.bindActionCreators)(c,e)}}})),u.default)(C)},5769:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=h(n(1594)),o=n(9040),i=n(9367),s=h(n(5815)),l=h(n(6379)),a=h(n(6935)),u=n(4201),d=n(8918),c=h(n(8737)),p=h(n(4350)),f=h(n(4064));function h(e){return e&&e.__esModule?e:{default:e}}class m extends r.default.Component{constructor(e){super(e),this.handleSubmit=this.handleSubmit.bind(this),this.timeout=null}handleSubmit(e){let{FolderID:t}=e;const{moveFiles:n}=this.props.actions.files,{selectedFiles:r,onSuccess:o,onClosed:i,setNotice:a,setError:u,setBadge:d}=this.props;return n(t||0,r).then((e=>{let{data:{moveFiles:{id:n,filename:u}}}=e;"function"==typeof o&&o(t,r),d(n,`${r.length}`,"success",l.default.MOVE_SUCCESS_DURATION),a(s.default.sprintf(s.default._t("AssetAdmin.MOVED_ITEMS_TO","Moved %s item(s) to %s"),r.length,u),[{label:s.default._t("AssetAdmin.GO_TO_FOLDER","Go to folder"),onClick:()=>this.props.onOpenFolder(n)}]),i()})).catch((()=>{u(s.default._t("AssetAdmin.FAILED_MOVE","There was an error moving the selected items."))}))}render(){const{isOpen:e,onClosed:t,title:n,folderId:o,sectionConfig:i}=this.props,{schemaUrl:s}=i.form.moveForm;return r.default.createElement(c.default,{title:n,isOpen:e,onClosed:t,onSubmit:this.handleSubmit,identifier:"AssetAdmin.MoveForm",schemaUrl:`${s}/${o}`})}}m.propTypes={sectionConfig:p.default,folderId:a.default.number.isRequired,isOpen:a.default.bool,onClosed:a.default.func,setNotice:a.default.func,setBadge:a.default.func,setError:a.default.func,title:a.default.string,onSuccess:a.default.func,onOpenFolder:a.default.func.isRequired,selectedFiles:a.default.array.isRequired,actions:a.default.shape({files:a.default.shape({moveFiles:a.default.func})}).isRequired},m.defaultProps={isOpen:!1};t.default=(0,i.compose)((0,o.connect)((function(e){const{modal:t,selectedFiles:n}=e.assetAdmin.gallery;return{isOpen:t===l.default.MODAL_MOVE,selectedFiles:n,title:s.default.sprintf(s.default._t("AssetAdmin.MOVE_ITEMS_TO","Move %s item(s) to..."),n.length)}}),(function(e){return{onClosed(){e((0,u.deactivateModal)())},setNotice(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];e((0,d.display)({text:t,type:"success",actions:n}))},setError(t){e((0,d.display)({text:t,type:"error"}))},setBadge(){e((0,u.setFileBadge)(...arguments))}}})),f.default)(m)},6609:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=f(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=p(n(6935)),i=p(n(9888)),s=p(n(5815)),l=p(n(1990)),a=n(5789),u=n(5716),d=n(5207),c=n(9367);function p(e){return e&&e.__esModule?e:{default:e}}function f(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(f=function(e){return e?n:t})(e)}class h extends r.Component{constructor(e){super(e),this.getColumns=this.getColumns.bind(this),this.handleSort=this.handleSort.bind(this),this.handleSetPage=this.handleSetPage.bind(this),this.handleRowClick=this.handleRowClick.bind(this),this.renderSelect=this.renderSelect.bind(this),this.renderTitle=this.renderTitle.bind(this),this.renderStatus=this.renderStatus.bind(this),this.renderNoItemsNotice=this.renderNoItemsNotice.bind(this)}getColumns(){const e=["thumbnail","title","status","size","lastEdited"];return this.props.selectableItems&&e.unshift("selected"),e}getColumnConfig(){return[{columnName:"selected",sortable:!1,displayName:"",cssClassName:"gallery__table-column--select",customComponent:this.renderSelect},{columnName:"thumbnail",sortable:!1,displayName:"",cssClassName:"gallery__table-column--image",customComponent:this.renderThumbnail},{columnName:"title",customCompareFn:()=>0,displayName:s.default._t("File.TITLE","Title"),cssClassName:"gallery__table-column--title",customComponent:this.renderTitle},{columnName:"status",sortable:!1,cssClassName:"sort--disabled",customComponent:this.renderStatus,displayName:s.default._t("File.STATUS","Status")},{columnName:"lastEdited",displayName:s.default._t("File.MODIFIED","Modified"),customComponent:this.renderDate},{columnName:"size",sortable:!1,displayName:s.default._t("File.SIZE","Size"),cssClassName:"sort--disabled",customComponent:this.renderSize}]}getRowMetadata(e){return"gallery__table-row "+(e.highlighted?"gallery__table-row--highlighted":"")}getTableProps(){const[e,t]=this.props.sort.split(",");return{tableClassName:"gallery__table table table-hover",gridClassName:"gallery__main-view--table",rowMetadata:{bodyCssClassName:this.getRowMetadata,key:"key"},sortAscendingComponent:"",sortDescendingComponent:"",useExternal:!0,externalSetPage:this.handleSetPage,externalChangeSort:this.handleSort,externalSetFilter:()=>null,externalSetPageSize:()=>null,externalCurrentPage:this.props.page-1,externalMaxPage:Math.ceil(this.props.totalCount/this.props.limit),externalSortColumn:e,externalSortAscending:"asc"===t,initialSort:e,columns:this.getColumns(),columnMetadata:this.getColumnConfig(),useGriddleStyles:!1,onRowClick:this.handleRowClick,results:this.props.files,customNoDataComponent:this.renderNoItemsNotice}}handleActivate(e,t){"folder"===t.type?this.props.onOpenFolder(e,t):this.props.onOpenFile(e,t)}handleRowClick(e,t){const n=e.props.data;t.currentTarget.classList.contains("gallery__table-column--select")&&(t.stopPropagation(),t.preventDefault(),"function"==typeof this.props.onSelect)?this.props.onSelect(t,n):this.handleActivate(t,n)}handleSort(e,t){const n=t?"asc":"desc";this.props.onSort(`${e},${n}`)}handleSetPage(e){this.props.onSetPage(e+1)}preventFocus(e){e.preventDefault()}renderNoItemsNotice(){return 0!==this.props.files.length||this.props.loading?null:r.default.createElement("p",{className:"gallery__no-item-notice"},s.default._t("AssetAdmin.NOITEMSFOUND"))}renderSize(e){if("folder"===e.rowData.type)return null;const t=(0,u.fileSize)(e.data);return r.default.createElement("span",null,t)}renderStatus(e){let t=[];const n=e.rowData,{VersionedBadge:o}=this.props;return"folder"!==n.type&&(n.draft?t.push({key:"status-draft",status:"draft"}):n.modified&&t.push({key:"status-modified",status:"modified"})),t=t.map((e=>{let{...t}=e;return r.default.createElement(o,t)})),t?r.default.createElement("span",null,t):null}renderProgressBar(e){if(!e.queuedId||e.message&&"error"===e.message.type)return null;if(e.id>0)return r.default.createElement("div",{className:"gallery__progress-bar--complete"});const t={className:"gallery__progress-bar-progress",style:{width:`${e.progress}%`}};return r.default.createElement("div",{className:"gallery__progress-bar"},r.default.createElement("div",t))}renderRestrictedAccess(e){const{hasRestrictedAccess:t}=e,n={fileID:e.id,placement:"top",hasRestrictedAccess:t};return r.default.createElement(l.default,n)}renderTrackedFormUpload(e){const{isTrackedFormUpload:t,hasRestrictedAccess:n}=e,o={fileID:e.id,placement:"top",isTrackedFormUpload:t,hasRestrictedAccess:n};return r.default.createElement(l.default,o)}renderTitle(e){const t=this.renderProgressBar(e.rowData);return r.default.createElement("div",{className:"fill-width"},r.default.createElement("div",{className:"flexbox-area-grow"},r.default.createElement("span",null,e.data),e.rowData.hasRestrictedAccess&&this.renderRestrictedAccess(e.rowData),e.rowData.isTrackedFormUpload&&this.renderTrackedFormUpload(e.rowData)),t)}renderSelect(e){if(this.props.selectableItems&&(this.props.selectableFolders||"folder"!==e.rowData.type)){const t={type:"checkbox",title:s.default._t("AssetAdmin.SELECT"),defaultChecked:e.data,tabIndex:-1,onMouseDown:this.preventFocus};return![null,1].includes(this.props.maxFilesSelect)&&this.props.selectedFiles.length>=this.props.maxFilesSelect&&!e.data&&(t.disabled=!0),r.default.createElement("input",t)}return null}renderDate(e){return"folder"===e.rowData.type?null:(moment.locale(s.default.detectLocale()),r.default.createElement("span",null,moment(e.data).format("L LT")))}renderThumbnail(e){const t=e.data||e.rowData.url,n=e.rowData.queuedId&&!e.rowData.id,o=e.rowData.category||"false",i="gallery__table-image",s=[i],l={};return s.push(`${i}--${o}`),"image"===o&&t&&(l.backgroundImage=`url("${t}")`),n||t||"folder"===o||s.push(`${i}--error`),r.default.createElement("div",{className:s.join(" "),style:l})}render(){return r.default.createElement(i.default,this.getTableProps())}}t.Component=h,h.defaultProps=a.galleryViewDefaultProps,h.propTypes={...a.galleryViewPropTypes,sort:o.default.string.isRequired,VersionedBadge:o.default.elementType};t.default=(0,c.compose)((0,d.inject)(["VersionedBadge"],(e=>({VersionedBadge:e}))))(h)},2853:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=d(n(5815)),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=n(5207),s=n(5789),l=d(n(9888)),a=d(n(6935));function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}function d(e){return e&&e.__esModule?e:{default:e}}class c extends o.Component{constructor(e){super(e),this.renderItem=this.renderItem.bind(this),this.handleSetPage=this.handleSetPage.bind(this),this.handlePrevPage=this.handlePrevPage.bind(this),this.handleNextPage=this.handleNextPage.bind(this),this.handleDrag=this.handleDrag.bind(this)}handleDrag(e){this.props.onEnableDropzone(!e)}handleSetPage(e){this.props.onSetPage(e+1)}handleNextPage(){const e=this.props.page-1;this.handleSetPage(e+1)}handlePrevPage(){const e=this.props.page-1;0!==e?this.handleSetPage(e-1):this.handleSetPage(e)}folderFilter(e){return"folder"===e.type}fileFilter(e){return"folder"!==e.type}renderPagination(){if(this.props.totalCount<=this.props.limit)return null;const e={setPage:this.handleSetPage,maxPage:Math.ceil(this.props.totalCount/this.props.limit),next:this.handleNextPage,nextText:r.default._t("AssetAdmin.NEXT","Next"),previous:this.handlePrevPage,previousText:r.default._t("AssetAdmin.PREVIOUS","Previous"),currentPage:this.props.page-1,useGriddleStyles:!1};return o.default.createElement("div",{className:"griddle-footer"},o.default.createElement(l.default.GridPagination,e))}renderItem(e){const{File:t,Folder:n,badges:r,sectionConfig:i,selectedFiles:s,selectableItems:l,selectableFolders:a}=this.props,u=r.find((t=>t.id===e.id));let d={sectionConfig:i,key:e.key,selectableKey:e.id,item:e,selectedFiles:s,onDrag:this.handleDrag,badge:u,canDrag:this.props.canDrag};if(e.queuedId&&!e.id){const{onCancelUpload:e,onRemoveErroredUpload:t}=this.props;d={...d,onCancelUpload:e,onRemoveErroredUpload:t}}else{const{onOpenFolder:t,onOpenFile:n}=this.props;d={...d,onActivate:"folder"===e.type?t:n}}if(l&&(a||"folder"!==e.type)){const e=![null,1].includes(this.props.maxFilesSelect)&&this.props.selectedFiles.length>=this.props.maxFilesSelect,t=1===this.props.maxFilesSelect?d.onActivate:this.props.onSelect;d={...d,selectable:!0,onSelect:t,maxSelected:e}}if("folder"===e.type){const{onDropFiles:e}=this.props;return d={...d,onDropFiles:e},o.default.createElement(n,d)}return o.default.createElement(t,d)}render(){return o.default.createElement("div",{className:"gallery__main-view--tile"},o.default.createElement("div",{className:"gallery__folders"},this.props.files.filter(this.folderFilter).map(this.renderItem)),o.default.createElement("div",{className:"gallery__files"},this.props.files.filter(this.fileFilter).map(this.renderItem)),0===this.props.files.length&&!this.props.loading&&o.default.createElement("p",{className:"gallery__no-item-notice"},r.default._t("AssetAdmin.NOITEMSFOUND")),o.default.createElement("div",{className:"gallery__load"},this.renderPagination()))}}t.Component=c,c.defaultProps=s.galleryViewDefaultProps,c.propTypes={...s.galleryViewPropTypes,File:a.default.elementType.isRequired,Folder:a.default.elementType.isRequired};const p=(0,i.inject)(["GalleryItemFile","GalleryItemFolder"],((e,t)=>({File:e,Folder:t})),(()=>"AssetAdmin.Gallery.ThumbnailView"));t.default=p(c)},4350:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o=(r=n(6935))&&r.__esModule?r:{default:r};const i=o.default.shape({url:o.default.string,limit:o.default.number,imageRetry:o.default.shape({minRetry:o.default.number,maxRetry:o.default.number,expiry:o.default.number}),form:o.default.object,dropzoneOptions:o.default.object});t.default=i},6298:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fileInterface=t.file=void 0;t.fileInterface="\n fragment FileInterfaceFields on FileInterface {\n canDelete\n canEdit\n canView\n category\n exists\n filename\n id\n lastEdited\n name\n parentId\n title\n type\n url\n visibility\n hasRestrictedAccess\n }\n",t.file="\n fragment FileFields on File {\n draft\n extension\n published\n modified\n size\n smallThumbnail\n thumbnail\n version\n isTrackedFormUpload\n }\n"},6022:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o=(r=n(6935))&&r.__esModule?r:{default:r};const i=o.default.shape({canEdit:o.default.bool,canDelete:o.default.bool,canView:o.default.bool,exists:o.default.bool,type:o.default.string,smallThumbnail:o.default.string,thumbnail:o.default.string,width:o.default.number,height:o.default.number,category:o.default.oneOfType([o.default.bool,o.default.string]),id:o.default.number,url:o.default.string,title:o.default.string,progress:o.default.number,visibility:o.default.string,hasRestrictedAccess:o.default.bool,isTrackedFormUpload:o.default.bool});t.default=i},8268:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){let{config:{form:t},viewAction:n,folderId:r,fileId:o,type:l}=e,a=null,u=null;if(n===i)return a=t.folderCreateForm.schemaUrl,u=r,{schemaUrl:a,targetId:u};if(n===s&&o){switch(l){case"insert-media":a=t.fileInsertForm.schemaUrl;break;case"insert-link":a=t.fileEditorLinkForm.schemaUrl;break;case"select":a=t.fileSelectForm.schemaUrl;break;default:a=t.fileEditForm.schemaUrl}return u=o,{schemaUrl:a,targetId:u}}return{}};var r,o=(r=n(6379))&&r.__esModule?r:{default:r};const{CREATE_FOLDER:i,EDIT_FILE:s}=o.default.ACTIONS},9247:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(413===e)return o.default._t("AssetAdmin.ERROR_FILE_SIZE","File size limit exceeded");if(403===e&&t&&"string"==typeof t.response)return t.response;return o.default._t("AssetAdmin.ERROR_DEFAULT","Something went wrong, please try again")};var r,o=(r=n(5815))&&r.__esModule?r:{default:r}},6405:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={CONFIRM_DELETION_ASK:"CONFIRM_DELETION_ASK",CONFIRM_DELETION_CONFIRM:"CONFIRM_DELETION_CONFIRM",CONFIRM_DELETION_CANCEL:"CONFIRM_DELETION_CANCEL",CONFIRM_DELETION_RESET:"CONFIRM_DELETION_RESET",CONFIRM_DELETION_MODAL_CLOSE:"CONFIRM_DELETION_MODAL_CLOSE"}},4461:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cancel=function(){return{type:o.default.CONFIRM_DELETION_CANCEL,payload:{}}},t.confirm=function(e){return{type:o.default.CONFIRM_DELETION_ASK,payload:{files:e}}},t.deleting=function(){return{type:o.default.CONFIRM_DELETION_CONFIRM,payload:{}}},t.modalClose=function(){return{type:o.default.CONFIRM_DELETION_MODAL_CLOSE,payload:{}}},t.reset=function(){return{type:o.default.CONFIRM_DELETION_RESET,payload:{}}};var r,o=(r=n(6405))&&r.__esModule?r:{default:r}},762:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NO_TRANSITION=t.DELETING=t.CANCELING=void 0;t.NO_TRANSITION=!1,t.CANCELING="canceling",t.DELETING="deleting"},6533:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={TOGGLE_SEARCH:"TOGGLE_SEARCH",OPEN_SEARCH:"OPEN_SEARCH",CLOSE_SEARCH:"CLOSE_SEARCH"}},9517:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.closeSearch=function(){return{type:o.default.CLOSE_SEARCH,payload:null}},t.openSearch=function(){return{type:o.default.OPEN_SEARCH,payload:null}},t.toggleSearch=function(){return{type:o.default.TOGGLE_SEARCH,payload:null}};var r,o=(r=n(6533))&&r.__esModule?r:{default:r}},2310:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o=(r=n(7284))&&r.__esModule?r:{default:r},i=n(6298);t.default=e=>{const t=e.charAt(0).toUpperCase()+e.slice(1),n=o.default` - mutation ${t}($ids:[ID]!, $force:Boolean, $quiet:Boolean) { - ${e}(ids: $ids, force: $force, quiet: $quiet) { - ...on File { - __typename - ...FileInterfaceFields - ...FileFields - } - ...on PublicationNotice { - __typename - noticeType - message - ids - } - } - } - ${i.fileInterface} - ${i.file} -`,r={props:t=>{let{mutate:n,ownProps:{actions:r}}=t;return{actions:{...r,files:{...r.files,[e]:function(e){return n({variables:{ids:e,quiet:!(arguments.length>2&&void 0!==arguments[2])||arguments[2],force:arguments.length>1&&void 0!==arguments[1]&&arguments[1]}})}}}}}};return{mutation:n,config:r}}},3934:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mutation=t.default=t.config=void 0;var r=n(708),o=s(n(7284)),i=s(n(5207));function s(e){return e&&e.__esModule?e:{default:e}}const l=t.mutation=o.default`mutation DeleteFiles($ids:[ID]!) { - deleteFiles(ids: $ids) -}`,a=t.config={props:e=>{let{mutate:t,ownProps:n}=e;const{actions:r}=n;return{actions:{...r,files:{...r.files,deleteFiles:function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t({variables:{ids:e},update:t=>{const o=i.default.query.get("ReadFilesQuery"),s=o.getApolloConfig().options(n).variables;null!==r&&(s.rootFilter.id=r,s.rootFilter.anyChildId=null);const l=o.getGraphqlAST(),a=t.readQuery({query:l,variables:s});if(!a)return;const u=JSON.parse(JSON.stringify(a));if(u.readFiles.nodes){let{nodes:t}=u.readFiles.nodes[0].children;t=t.filter((t=>!e.includes(t.id))),u.readFiles.nodes[0].children.nodes=t,u.readFiles.nodes[0].children.pageInfo.totalCount=t.length}else{let{nodes:t}=u.readFiles[0].children;t=t.filter((t=>!e.includes(t.id))),u.readFiles[0].children.nodes=t,u.readFiles[0].children.pageInfo.totalCount=t.length}t.writeQuery({query:l,data:u,variables:s})}})}}}}}};t.default=(0,r.graphql)(l,a)},4064:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mutation=t.default=t.config=void 0;var r,o=n(708),i=(r=n(7284))&&r.__esModule?r:{default:r},s=n(6298);const l=t.mutation=i.default` - mutation MoveFiles($folderId:ID!, $fileIds:[ID]!) { - moveFiles(folderId: $folderId, fileIds: $fileIds) { - ...FileInterfaceFields - ...FileFields - } - } - ${s.fileInterface} - ${s.file} -`,a=t.config={props:e=>{let{mutate:t,ownProps:{actions:n={}}}=e;return{actions:Object.assign({},n,{files:Object.assign({},n.files,{moveFiles:(e,n)=>t({variables:{folderId:e,fileIds:n},update:()=>{window.ss.apolloClient.resetStore()}})})})}}};t.default=(0,o.graphql)(l,a)},5230:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mutation=t.default=t.config=void 0;var r,o=n(708),i=(r=n(2310))&&r.__esModule?r:{default:r};const{mutation:s,config:l}=(0,i.default)("publishFiles");t.config=l,t.mutation=s;t.default=(0,o.graphql)(s,l)},3929:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mutation=t.default=t.config=void 0;var r,o=n(708),i=(r=n(2310))&&r.__esModule?r:{default:r};const{mutation:s,config:l}=(0,i.default)("unpublishFiles");t.config=l,t.mutation=s;t.default=(0,o.graphql)(s,l)},4913:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=["SET_LAST_SELECTED","SET_SELECTED_FILES","DESELECT_FILES","SELECT_FILES","LOAD_FILE_REQUEST","LOAD_FILE_SUCCESS","HIGHLIGHT_FILES","UPDATE_BATCH_ACTIONS","SET_NOTICE_MESSAGE","SET_ERROR_MESSAGE","SET_ENABLE_DROPZONE","SET_FILE_BADGE","CLEAR_FILE_BADGE","ACTIVATE_MODAL","DEACTIVATE_MODAL","CONCATENATE_SELECT","SET_LOADING"].reduce(((e,t)=>Object.assign(e,{[t]:`GALLERY.${t}`})),{})},4201:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.activateModal=function(e){return t=>{t({type:o.default.ACTIVATE_MODAL,payload:e})}},t.clearFileBadge=i,t.deactivateModal=function(){return e=>{e({type:o.default.DEACTIVATE_MODAL})}},t.deselectFiles=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return t=>t({type:o.default.DESELECT_FILES,payload:{ids:e}})},t.loadFile=function(e,t){return n=>{n({type:o.default.LOAD_FILE_SUCCESS,payload:{id:e,file:t}})}},t.selectFiles=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return t=>t({type:o.default.SELECT_FILES,payload:{ids:e}})},t.setConcatenateSelect=function(e){return t=>t({type:o.default.CONCATENATE_SELECT,payload:!!e})},t.setEnableDropzone=function(e){return t=>t({type:o.default.SET_ENABLE_DROPZONE,payload:{enableDropzone:e}})},t.setErrorMessage=function(e){return t=>t({type:o.default.SET_ERROR_MESSAGE,payload:{message:e}})},t.setFileBadge=function(e,t,n,r){return(s,l)=>{const{assetAdmin:a}=l(),u=a.gallery.badges.find((t=>t.id===e));u&&u.timer&&clearTimeout(u.timer);const d=r>0?setTimeout((()=>i(e)(s)),r):null;s({type:o.default.SET_FILE_BADGE,payload:{id:e,message:t,status:n,timer:d}})}},t.setLastSelected=function(e){return t=>{t({type:o.default.SET_LAST_SELECTED,payload:{id:e}})}},t.setLoading=function(e){return t=>{t({type:o.default.SET_LOADING,payload:!!e})}},t.setNoticeMessage=function(e){return t=>t({type:o.default.SET_NOTICE_MESSAGE,payload:{message:e}})},t.setSelectedFiles=function(e){return t=>{t({type:o.default.SET_SELECTED_FILES,payload:{files:e}})}};var r,o=(r=n(4913))&&r.__esModule?r:{default:r};function i(e){return t=>{t({type:o.default.CLEAR_FILE_BADGE,payload:{id:e}})}}},423:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultImageFactory=t.default=void 0;var r=i(n(1838)),o=i(n(8632));function i(e){return e&&e.__esModule?e:{default:e}}const s={minRetry:0,maxRetry:0,expiry:0,onStatusChange:()=>null,onRetry:()=>null,onReset:()=>null,onTimeout:()=>null},l=(e,t,n)=>{const r=new Image;r.onload=t,r.onerror=n,r.src=e};t.defaultImageFactory=l;t.default=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;this.options={...s,...e},this.factory=t}loadImage(e){return this.options.minRetry&&o.default.lock(e)?this.loadImageLoop(e,this.options.minRetry):null}loadImageLoop(e,t){return this.options.onStatusChange(e,r.default.LOADING),new Promise(((t,n)=>this.factory(e,t,n))).then((()=>this.handleSuccess(e))).catch((()=>this.handleError(e,t)))}handleReset(e,t){this.options.onReset(e),t()}handleTimeout(e,t){const n=setTimeout(e,t);return this.options.onTimeout(n,t),n}handleSuccess(e){o.default.unlock(e),this.options.onStatusChange(e,r.default.SUCCESS)}handleFailure(e){return o.default.unlock(e),this.options.onStatusChange(e,r.default.FAILED),this.options.expiry?new Promise((t=>{this.handleTimeout((()=>this.handleReset(e,t)),1e3*this.options.expiry)})):null}handleError(e,t){return t>this.options.maxRetry?this.handleFailure(e):(this.options.onStatusChange(e,r.default.WAITING),this.handleRetry(e,t))}handleRetry(e,t){const n=new Promise((n=>{this.handleTimeout((()=>n(this.loadImageLoop(e,2*t))),1e3*t)}));return this.options.onRetry(e,t,n),n}setOnRetry(e){this.options.onRetry=e}setOnReset(e){this.options.onReset=e}setOnStatusChange(e){this.options.onStatusChange=e}setOnTimeout(e){this.options.onTimeout=e}}},2153:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={SET_STATUS:"IMAGE_LOAD_SET_STATUS",RESET:"IMAGE_LOAD_RESET"}},769:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loadImage=function(e,t){return(n,i)=>{if(!e)return null;if(i().assetAdmin.imageLoad.files.find((t=>t.url===e)))return null;const s={...t,onStatusChange:(e,t)=>n({type:r.default.SET_STATUS,payload:{status:t,url:e}}),onReset:e=>n({type:r.default.RESET,payload:{url:e}})};return new o.default(s).loadImage(e)}};var r=i(n(2153)),o=i(n(423));function i(e){return e&&e.__esModule?e:{default:e}}},8632:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;class n{constructor(){this.urls=[]}lock(e){return!(this.urls.indexOf(e)>=0)&&(this.urls=[...this.urls,e],!0)}unlock(e){this.urls=this.urls.filter((t=>t!==e))}}t.Component=n,window.ss=window.ss||{},window.ss.imagelocker=window.ss.imagelocker||new n;t.default=window.ss.imagelocker},1838:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={DISABLED:"DISABLED",NONE:"NONE",SUCCESS:"SUCCESS",LOADING:"LOADING",WAITING:"WAITING",FAILED:"FAILED"}},2613:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={DEFINE_IMAGE_SIZE_PRESETS:"DEFINE_IMAGE_SIZE_PRESETS",INIT_FORM_SCHEMA_STACK:"INIT_FORM_SCHEMA_STACK",POP_FORM_SCHEMA:"POP_FORM_SCHEMA",PUSH_FORM_SCHEMA:"PUSH_FORM_SCHEMA",RESET:"RESET",RESET_FORM_STACK:"RESET_FORM_STACK"}},1021:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defineImageSizePresets=function(e){return{type:i.default.DEFINE_IMAGE_SIZE_PRESETS,payload:{imageSizePresets:e}}},t.initFormStack=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return{type:i.default.INIT_FORM_SCHEMA_STACK,payload:{formSchema:{type:e,nextType:t}}}},t.popFormStackEntry=function(){return{type:i.default.POP_FORM_SCHEMA}},t.pushFormStackEntry=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return{type:i.default.PUSH_FORM_SCHEMA,payload:{formSchema:{type:e,nextType:t}}}},t.reset=function(){return{type:i.default.RESET}},t.resetFormStack=function(){return{type:i.default.RESET_FORM_STACK}},t.stashFormValues=function(e,t){return(n,i)=>{const l=i(),a=(0,r.default)(l.form.formState,`${e}.values`),u=(0,r.default)(l.form.formSchemas,`${t}.schema.fields`);if(a){const e=Object.keys(a).filter((e=>null!==a[e]&&(0,s.default)(e,u))).map((e=>({name:e,value:a[e]})));n((0,o.setSchemaStateOverrides)(t,{fields:e}))}}};var r=l(n(6104)),o=n(2811),i=l(n(2613)),s=l(n(8896));function l(e){return e&&e.__esModule?e:{default:e}}},8896:function(e,t){"use strict";function n(e,t){let r;for(r=0;rt({type:o.default.ADD_QUEUED_FILE,payload:{file:e}})},t.failUpload=function(e,t,n){return r=>{let i=t.message;return t.errors&&t.errors.length&&(i=t.errors[0]),"string"==typeof t&&(i={value:n||t,type:"error"}),r({type:o.default.FAIL_UPLOAD,payload:{queuedId:e,message:i}})}},t.purgeUploadQueue=function(){return e=>e({type:o.default.PURGE_UPLOAD_QUEUE,payload:null})},t.removeQueuedFile=function(e){return t=>t({type:o.default.REMOVE_QUEUED_FILE,payload:{queuedId:e}})},t.succeedUpload=function(e,t){return n=>n({type:o.default.SUCCEED_UPLOAD,payload:{queuedId:e,json:t}})},t.updateQueuedFile=function(e,t){return n=>n({type:o.default.UPDATE_QUEUED_FILE,payload:{queuedId:e,updates:t}})};var r,o=(r=n(5793))&&r.__esModule?r:{default:r}},1804:function(e,t,n){"use strict";var r=n(5228),o={};var i=function(e){};function s(e,t,n,r,o,s,l,a){if(i(t),!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var d=[n,r,o,s,l,a],c=0;(u=new Error(t.replace(/%s/g,(function(){return d[c++]})))).name="Invariant Violation"}throw u.framesToPop=1,u}}var l="mixins";e.exports=function(e,t,n){var i=[],a={mixins:"DEFINE_MANY",statics:"DEFINE_MANY",propTypes:"DEFINE_MANY",contextTypes:"DEFINE_MANY",childContextTypes:"DEFINE_MANY",getDefaultProps:"DEFINE_MANY_MERGED",getInitialState:"DEFINE_MANY_MERGED",getChildContext:"DEFINE_MANY_MERGED",render:"DEFINE_ONCE",componentWillMount:"DEFINE_MANY",componentDidMount:"DEFINE_MANY",componentWillReceiveProps:"DEFINE_MANY",shouldComponentUpdate:"DEFINE_ONCE",componentWillUpdate:"DEFINE_MANY",componentDidUpdate:"DEFINE_MANY",componentWillUnmount:"DEFINE_MANY",UNSAFE_componentWillMount:"DEFINE_MANY",UNSAFE_componentWillReceiveProps:"DEFINE_MANY",UNSAFE_componentWillUpdate:"DEFINE_MANY",updateComponent:"OVERRIDE_BASE"},u={getDerivedStateFromProps:"DEFINE_MANY_MERGED"},d={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var n=0;n0}},{key:"getMetadataColumnProperty",value:function(e,t,n){var r=this.getColumnMetadataByName(e);return null==r?n:r.hasOwnProperty(t)?r[t]:n}},{key:"orderColumns",value:function(e){var t=this;return l(e,(function(e){var n=s(t.columnMetadata,{columnName:e});return null==n||isNaN(n.order)?100:n.order}))}},{key:"getColumns",value:function(){var e=0===this.filteredColumns.length?this.allColumns:this.filteredColumns;return e=a(e,this.metadataColumns),e=this.orderColumns(e)}}]),e}();e.exports=u},3715:function(e,t,n){"use strict";var r=n(1594),o=n(2306)({getDefaultProps:function(){return{placeholderText:""}},render:function(){return"function"!=typeof this.props.customFilterComponent?(console.log("Couldn't find valid template."),r.createElement("div",null)):r.createElement(this.props.customFilterComponent,{changeFilter:this.props.changeFilter,results:this.props.results,currentResults:this.props.currentResults,placeholderText:this.props.placeholderText})}});e.exports=o},8465:function(e,t,n){"use strict";var r=Object.assign||function(e){for(var t=1;t0&&(e=r.createElement("button",{type:"button",onClick:this.props.previous,style:this.props.useGriddleStyles?{color:"#222",border:"none",background:"none",margin:"0 0 0 10px"}:null},this.props.previousIconComponent,this.props.previousText)),this.props.currentPage!==this.props.maxPage-1&&(t=r.createElement("button",{type:"button",onClick:this.props.next,style:this.props.useGriddleStyles?{color:"#222",border:"none",background:"none",margin:"0 10px 0 0"}:null},this.props.nextText,this.props.nextIconComponent));var n=null,o=null,s=null;if(!0===this.props.useGriddleStyles){var l={float:"left",minHeight:"1px",marginTop:"5px"};s=i({textAlign:"right",width:"34%"},l),o=i({textAlign:"center",width:"33%"},l),n=i({width:"33%"},l)}for(var a=[],u=1;u<=this.props.maxPage;u++)a.push(r.createElement("option",{value:u,key:u},u));return r.createElement("div",{style:this.props.useGriddleStyles?{minHeight:"35px"}:null},r.createElement("div",{className:this.props.previousClassName,style:n},e),r.createElement("div",{className:"griddle-page",style:o},r.createElement("select",{value:this.props.currentPage+1,onChange:this.pageChange},a)," / ",this.props.maxPage),r.createElement("div",{className:this.props.nextClassName,style:s},t))}});e.exports=s},1507:function(e,t,n){"use strict";var r=n(1594),o=n(2306),i=(n(493),n(9280)),s=n(1882),l=n(7248),a=n(6139),u=n(4684),d=n(8938),c=n(1648),p=o({getDefaultProps:function(){return{isChildRow:!1,showChildren:!1,data:{},columnSettings:null,rowSettings:null,hasChildren:!1,useGriddleStyles:!0,useGriddleIcons:!0,isSubGriddle:!1,paddingHeight:null,rowHeight:null,parentRowCollapsedClassName:"parent-row",parentRowExpandedClassName:"parent-row expanded",parentRowCollapsedComponent:"▶",parentRowExpandedComponent:"▼",onRowClick:null,multipleSelectionSettings:null,onRowMouseEnter:null,onRowMouseLeave:null,onRowWillMount:null,onRowWillUnmount:null}},componentWillMount:function(){null!==this.props.onRowWillMount&&s(this.props.onRowWillMount)&&this.props.onRowWillMount(this)},componentWillUnmount:function(){null!==this.props.onRowWillUnmount&&s(this.props.onRowWillUnmount)&&this.props.onRowWillUnmount(this)},handleClick:function(e){null!==this.props.onRowClick&&s(this.props.onRowClick)?this.props.onRowClick(this,e):this.props.hasChildren&&this.props.toggleChildren()},handleMouseEnter:function(e){null!==this.props.onRowMouseEnter&&s(this.props.onRowMouseEnter)&&this.props.onRowMouseEnter(this,e)},handleMouseLeave:function(e){null!==this.props.onRowMouseLeave&&s(this.props.onRowMouseLeave)&&this.props.onRowMouseLeave(this,e)},handleSelectionChange:function(e){},handleSelectClick:function(e){this.props.multipleSelectionSettings.isMultipleSelection&&("checkbox"===e.target.type?this.props.multipleSelectionSettings.toggleSelectRow(this.props.data,this.refs.selected.checked):this.props.multipleSelectionSettings.toggleSelectRow(this.props.data,!this.refs.selected.checked))},verifyProps:function(){null===this.props.columnSettings&&console.error("gridRow: The columnSettings prop is null and it shouldn't be")},formatData:function(e){return"boolean"==typeof e?String(e):e},render:function(){var e=this;this.verifyProps();var t=this,n=null;this.props.useGriddleStyles&&(n={margin:"0px",padding:t.props.paddingHeight+"px 5px "+t.props.paddingHeight+"px 5px",height:t.props.rowHeight?this.props.rowHeight-2*t.props.paddingHeight+"px":null,backgroundColor:"#FFF",borderTopColor:"#DDD",color:"#222"});var o=this.props.columnSettings.getColumns(),p=l(o,[]),f=a({},this.props.data);u(f,p);var h,m,g=d(i.pick(f,c(o,"children"))).map((function(t,o){var i=null,s=e.props.columnSettings.getColumnMetadataByName(t[0]),l=0===o&&e.props.hasChildren&&!1===e.props.showChildren&&e.props.useGriddleIcons?r.createElement("span",{style:e.props.useGriddleStyles?{fontSize:"10px",marginRight:"5px"}:null},e.props.parentRowCollapsedComponent):0===o&&e.props.hasChildren&&e.props.showChildren&&e.props.useGriddleIcons?r.createElement("span",{style:e.props.useGriddleStyles?{fontSize:"10px"}:null},e.props.parentRowExpandedComponent):"";if(0===o&&e.props.isChildRow&&e.props.useGriddleStyles&&(n=a(n,{paddingLeft:10})),e.props.columnSettings.hasColumnMetadata()&&null!=s)if(void 0!==s.customComponent&&null!==s.customComponent){var u=r.createElement(s.customComponent,{data:t[1],rowData:f,metadata:s});i=r.createElement("td",{onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,onMouseLeave:e.handleMouseLeave,className:s.cssClassName,key:o,style:n},u)}else i=r.createElement("td",{onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,onMouseLeave:e.handleMouseLeave,className:s.cssClassName,key:o,style:n},l,e.formatData(t[1]));return i||r.createElement("td",{onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,onMouseLeave:e.handleMouseLeave,key:o,style:n},l,t[1])}));if(null!==this.props.onRowClick&&s(this.props.onRowClick)?(h=null,m=this.handleSelectClick):this.props.multipleSelectionSettings&&this.props.multipleSelectionSettings.isMultipleSelection?(h=this.handleSelectClick,m=null):(h=null,m=null),g&&this.props.multipleSelectionSettings&&this.props.multipleSelectionSettings.isMultipleSelection){this.props.multipleSelectionSettings.getSelectedRowIds();g.unshift(r.createElement("td",{key:"selection",style:n,className:"griddle-select griddle-select-cell",onClick:m},r.createElement("input",{type:"checkbox",checked:this.props.multipleSelectionSettings.getIsRowChecked(f),onChange:this.handleSelectionChange,ref:"selected"})))}var y=t.props.rowSettings&&t.props.rowSettings.getBodyRowMetadataClass(t.props.data)||"standard-row";return t.props.isChildRow?y="child-row":t.props.hasChildren&&(y=t.props.showChildren?this.props.parentRowExpandedClassName:this.props.parentRowCollapsedClassName),r.createElement("tr",{onClick:h,className:y},g)}});e.exports=p},4734:function(e,t,n){"use strict";var r=n(1594),o=n(2306),i=(n(493),n(4383)),s=o({getDefaultProps:function(){return{useGriddleStyles:!0,useGriddleIcons:!0,isSubGriddle:!1,columnSettings:null,rowSettings:null,paddingHeight:null,rowHeight:null,parentRowCollapsedClassName:"parent-row",parentRowExpandedClassName:"parent-row expanded",parentRowCollapsedComponent:"▶",parentRowExpandedComponent:"▼",onRowClick:null,onRowMouseEnter:null,onRowMouseLeave:null,onRowWillMount:null,onRowWillUnmount:null,multipleSelectionSettings:null}},getInitialState:function(){return{data:{},showChildren:!1}},componentWillReceiveProps:function(){this.setShowChildren(!1)},toggleChildren:function(){this.setShowChildren(!1===this.state.showChildren)},setShowChildren:function(e){this.setState({showChildren:e})},verifyProps:function(){null===this.props.columnSettings&&console.error("gridRowContainer: The columnSettings prop is null and it shouldn't be")},render:function(){this.verifyProps();var e=this;if(void 0===this.props.data)return r.createElement("tbody",null);var t=[],n=this.props.columnSettings.getColumns();t.push(r.createElement(this.props.rowSettings.rowComponent,{useGriddleStyles:this.props.useGriddleStyles,isSubGriddle:this.props.isSubGriddle,data:this.props.rowSettings.isCustom?i(this.props.data,n):this.props.data,rowData:this.props.rowSettings.isCustom?this.props.data:null,columnSettings:this.props.columnSettings,rowSettings:this.props.rowSettings,hasChildren:e.props.hasChildren,toggleChildren:e.toggleChildren,showChildren:e.state.showChildren,key:e.props.uniqueId+"_base_row",useGriddleIcons:e.props.useGriddleIcons,parentRowExpandedClassName:this.props.parentRowExpandedClassName,parentRowCollapsedClassName:this.props.parentRowCollapsedClassName,parentRowExpandedComponent:this.props.parentRowExpandedComponent,parentRowCollapsedComponent:this.props.parentRowCollapsedComponent,paddingHeight:e.props.paddingHeight,rowHeight:e.props.rowHeight,onRowClick:e.props.onRowClick,onRowMouseEnter:e.props.onRowMouseEnter,onRowMouseLeave:e.props.onRowMouseLeave,multipleSelectionSettings:this.props.multipleSelectionSettings,onRowWillMount:e.props.onRowWillMount,onRowWillUnmount:e.props.onRowWillUnmount}));var o=null;return e.state.showChildren&&(o=e.props.hasChildren&&this.props.data.children.map((function(t,n){var o=e.props.rowSettings.getRowKey(t,n);if(void 0!==t.children){var i=e.constructor.Griddle;return r.createElement("tr",{key:o,style:{paddingLeft:5}},r.createElement("td",{colSpan:e.props.columnSettings.getVisibleColumnCount(),className:"griddle-parent",style:e.props.useGriddleStyles?{border:"none",padding:"0 0 0 5px"}:null},r.createElement(i,{rowMetadata:{key:"id"},isSubGriddle:!0,results:[t],columns:e.props.columnSettings.getColumns(),tableClassName:e.props.tableClassName,parentRowExpandedClassName:e.props.parentRowExpandedClassName,parentRowCollapsedClassName:e.props.parentRowCollapsedClassName,showTableHeading:!1,showPager:!1,columnMetadata:e.props.columnSettings.columnMetadata,parentRowExpandedComponent:e.props.parentRowExpandedComponent,parentRowCollapsedComponent:e.props.parentRowCollapsedComponent,paddingHeight:e.props.paddingHeight,rowHeight:e.props.rowHeight})))}return r.createElement(e.props.rowSettings.rowComponent,{useGriddleStyles:e.props.useGriddleStyles,isSubGriddle:e.props.isSubGriddle,data:t,columnSettings:e.props.columnSettings,isChildRow:!0,columnMetadata:e.props.columnSettings.columnMetadata,key:o})}))),!1===e.props.hasChildren?t[0]:r.createElement("tbody",null,e.state.showChildren?t.concat(o):t)}});e.exports=s},4376:function(e,t,n){"use strict";var r=n(1594),o=n(2306),i=n(9859),s=n(1648),l=n(7309),a=o({getDefaultProps:function(){return{columns:[],columnMetadata:[],selectedColumns:[],settingsText:"",maxRowsText:"",resultsPerPage:0,enableToggleCustom:!1,useCustomComponent:!1,useGriddleStyles:!0,toggleCustomComponent:function(){}}},setPageSize:function(e){var t=parseInt(e.target.value,10);this.props.setPageSize(t)},handleChange:function(e){var t=e.target.dataset?e.target.dataset.name:e.target.getAttribute("data-name");!0===e.target.checked&&!1===i(this.props.selectedColumns,t)?(this.props.selectedColumns.push(t),this.props.setColumns(this.props.selectedColumns)):this.props.setColumns(s(this.props.selectedColumns,t))},render:function(){var e=this,t=[];!1===e.props.useCustomComponent&&(t=this.props.columns.map((function(t,n){var o=i(e.props.selectedColumns,t),s=l(e.props.columnMetadata,{columnName:t}),a=t;return void 0!==s&&void 0!==s.displayName&&null!=s.displayName&&(a=s.displayName),void 0!==s&&null!=s&&s.locked?r.createElement("div",{className:"column checkbox"},r.createElement("label",null,r.createElement("input",{type:"checkbox",disabled:!0,name:"check",checked:o,"data-name":t}),a)):void 0!==s&&null!=s&&void 0!==s.visible&&!1===s.visible?null:r.createElement("div",{className:"griddle-column-selection checkbox",key:t,style:e.props.useGriddleStyles?{float:"left",width:"20%"}:null},r.createElement("label",null,r.createElement("input",{type:"checkbox",name:"check",onChange:e.handleChange,checked:o,"data-name":t}),a))})));var n=e.props.enableToggleCustom?r.createElement("div",{className:"form-group"},r.createElement("label",{htmlFor:"maxRows"},r.createElement("input",{type:"checkbox",checked:this.props.useCustomComponent,onChange:this.props.toggleCustomComponent})," ",this.props.enableCustomFormatText)):"",o=this.props.showSetPageSize?r.createElement("div",null,r.createElement("label",{htmlFor:"maxRows"},this.props.maxRowsText,":",r.createElement("select",{onChange:this.setPageSize,value:this.props.resultsPerPage},r.createElement("option",{value:"5"},"5"),r.createElement("option",{value:"10"},"10"),r.createElement("option",{value:"25"},"25"),r.createElement("option",{value:"50"},"50"),r.createElement("option",{value:"100"},"100")))):"";return r.createElement("div",{className:"griddle-settings",style:this.props.useGriddleStyles?{backgroundColor:"#FFF",border:"1px solid #DDD",color:"#222",padding:"10px",marginBottom:"10px"}:null},r.createElement("h6",null,this.props.settingsText),r.createElement("div",{className:"griddle-columns",style:this.props.useGriddleStyles?{clear:"both",display:"table",width:"100%",borderBottom:"1px solid #EDEDED",marginBottom:"10px"}:null},t),o,n)}});e.exports=a},2991:function(e,t,n){"use strict";var r=n(1594),o=n(2306),i=n(9593),s=n(4734),l=(n(493),n(1545),o({getDefaultProps:function(){return{data:[],columnSettings:null,rowSettings:null,sortSettings:null,multipleSelectionSettings:null,className:"",enableInfiniteScroll:!1,nextPage:null,hasMorePages:!1,useFixedHeader:!1,useFixedLayout:!0,paddingHeight:null,rowHeight:null,filterByColumn:null,infiniteScrollLoadTreshold:null,bodyHeight:null,useGriddleStyles:!0,useGriddleIcons:!0,isSubGriddle:!1,parentRowCollapsedClassName:"parent-row",parentRowExpandedClassName:"parent-row expanded",parentRowCollapsedComponent:"▶",parentRowExpandedComponent:"▼",externalLoadingComponent:null,externalIsLoading:!1,onRowClick:null,onRowMouseEnter:null,onRowMouseLeave:null,onRowWillMount:null,onRowWillUnmount:null}},getInitialState:function(){return{scrollTop:0,scrollHeight:this.props.bodyHeight,clientHeight:this.props.bodyHeight}},componentDidMount:function(){this.gridScroll()},componentDidUpdate:function(e,t){this.gridScroll()},gridScroll:function(){if(this.props.enableInfiniteScroll&&!this.props.externalIsLoading){var e=this.refs.scrollable,t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;if(null!==this.props.rowHeight&&this.state.scrollTop!==t&&Math.abs(this.state.scrollTop-t)>=this.getAdjustedRowHeight()){var o={scrollTop:t,scrollHeight:n,clientHeight:r};this.setState(o)}.6*(n-(t+r)-this.props.infiniteScrollLoadTreshold)<=this.props.infiniteScrollLoadTreshold&&this.props.nextPage()}},verifyProps:function(){null===this.props.columnSettings&&console.error("gridTable: The columnSettings prop is null and it shouldn't be"),null===this.props.rowSettings&&console.error("gridTable: The rowSettings prop is null and it shouldn't be")},getAdjustedRowHeight:function(){return this.props.rowHeight+2*this.props.paddingHeight},getNodeContent:function(){this.verifyProps();var e=this,t=!1;if(!this.props.externalIsLoading||this.props.enableInfiniteScroll){var n=e.props.data,o=null,i=null;if(this.props.enableInfiniteScroll&&null!==this.props.rowHeight&&void 0!==this.refs.scrollable){var l=e.getAdjustedRowHeight(),a=Math.ceil(e.state.clientHeight/l),u=Math.max(0,Math.floor(e.state.scrollTop/l)-.25*a),d=Math.min(u+1.25*a,this.props.data.length-1);n=n.slice(u,d+1);var c={height:u*l+"px"};o=r.createElement("tr",{key:"above-"+c.height,style:c});var p={height:(this.props.data.length-d)*l+"px"};i=r.createElement("tr",{key:"below-"+p.height,style:p})}var f=n.map((function(n,o){var i=void 0!==n.children&&n.children.length>0,l=e.props.rowSettings.getRowKey(n,o);return i&&(t=i),r.createElement(s,{useGriddleStyles:e.props.useGriddleStyles,isSubGriddle:e.props.isSubGriddle,parentRowExpandedClassName:e.props.parentRowExpandedClassName,parentRowCollapsedClassName:e.props.parentRowCollapsedClassName,parentRowExpandedComponent:e.props.parentRowExpandedComponent,parentRowCollapsedComponent:e.props.parentRowCollapsedComponent,data:n,key:l+"-container",uniqueId:l,columnSettings:e.props.columnSettings,rowSettings:e.props.rowSettings,paddingHeight:e.props.paddingHeight,multipleSelectionSettings:e.props.multipleSelectionSettings,rowHeight:e.props.rowHeight,hasChildren:i,tableClassName:e.props.className,onRowClick:e.props.onRowClick,onRowMouseEnter:e.props.onRowMouseEnter,onRowMouseLeave:e.props.onRowMouseLeave,onRowWillMount:e.props.onRowWillMount,onRowWillUnmount:e.props.onRowWillUnmount})}));if(this.props.showNoData){var h=this.props.columnSettings.getVisibleColumnCount();f.push(r.createElement("tr",{key:"no-data-section"},r.createElement("td",{colSpan:h},this.props.noDataSection)))}return o&&f.unshift(o),i&&f.push(i),{nodes:f,anyHasChildren:t}}return null},render:function(){var e=[],t=!1,n=this.getNodeContent();n&&(e=n.nodes,t=n.anyHasChildren);var o=null,s=null,l={width:"100%"};if(this.props.useFixedLayout&&(l.tableLayout="fixed"),this.props.enableInfiniteScroll&&(o={position:"relative",overflowY:"scroll",height:this.props.bodyHeight+"px",width:"100%"}),this.props.externalIsLoading){var a,u=null;this.props.useGriddleStyles&&(u={textAlign:"center",paddingBottom:"40px"}),a=this.props.columnSettings.getVisibleColumnCount();var d=this.props.externalLoadingComponent?r.createElement(this.props.externalLoadingComponent,null):r.createElement("div",null,"Loading...");s=r.createElement("tbody",null,r.createElement("tr",null,r.createElement("td",{style:u,colSpan:a},d)))}var c=this.props.showTableHeading?r.createElement(i,{useGriddleStyles:this.props.useGriddleStyles,useGriddleIcons:this.props.useGriddleIcons,sortSettings:this.props.sortSettings,multipleSelectionSettings:this.props.multipleSelectionSettings,columnSettings:this.props.columnSettings,filterByColumn:this.props.filterByColumn,rowSettings:this.props.rowSettings}):void 0;t||(e=r.createElement("tbody",null,e));var p=r.createElement("tbody",null);if(this.props.showPager){var f=this.props.useGriddleStyles?{padding:"0px",backgroundColor:"#EDEDED",border:"0px",color:"#222",height:this.props.showNoData?"20px":null}:null;p=r.createElement("tbody",null,r.createElement("tr",null,r.createElement("td",{colSpan:this.props.multipleSelectionSettings.isMultipleSelection?this.props.columnSettings.getVisibleColumnCount()+1:this.props.columnSettings.getVisibleColumnCount(),style:f,className:"footer-container"},this.props.showNoData?null:this.props.pagingContent)))}return this.props.useFixedHeader?(this.props.useGriddleStyles&&(l.tableLayout="fixed"),r.createElement("div",null,r.createElement("table",{className:this.props.className,style:this.props.useGriddleStyles&&l||null},c),r.createElement("div",{ref:"scrollable",onScroll:this.gridScroll,style:o},r.createElement("table",{className:this.props.className,style:this.props.useGriddleStyles&&l||null},e,s,p)))):r.createElement("div",{ref:"scrollable",onScroll:this.gridScroll,style:o},r.createElement("table",{className:this.props.className,style:this.props.useGriddleStyles&&l||null},c,e,s,p))}}));e.exports=l},9593:function(e,t,n){"use strict";var r=Object.assign||function(e){for(var t=1;t=0)return!0}return!1}))},defaultColumnFilter:function(e,t,n){var r=M(O(n)?n:[n],(function(e){return(e||"").toLowerCase()}));return L(b.getObjectValues(t),(function(e){return e=e.toString().toLowerCase(),L(r,(function(t){return e.indexOf(t)>=0}))}))},filterByColumnFilters:function(e){var t=this.props.columnFilterFunc||this.defaultColumnFilter,n=Object.keys(e).reduce((function(n,r){return T(n,(function(n){var o=b.getAt(n,r||""),i=e[r];return t(r||"",o,i)}))}),this.props.results),r={columnFilters:e};e?(r.filteredResults=n,r.maxPage=this.getMaxPage(r.filteredResults)):this.state.filter?r.filteredResults=this.props.useCustomFilterer?this.props.customFilterer(this.props.results,filter):this.defaultFilter(this.props.results,filter):r.filteredResults=null,this.setState(r)},filterByColumn:function(e,t){var n=this.state.columnFilters;if(n.hasOwnProperty(t)&&!e)n=N(n,t);else{var r={};r[t]=e,n=R({},n,r)}this.filterByColumnFilters(n)},setFilter:function(e){var t=arguments.length<=1||void 0===arguments[1]?null:arguments[1];if(this.props.useExternal)this.props.externalSetFilter(e);else{var n={page:0,filter:e};n.filteredResults=this.props.useCustomFilterer?this.props.customFilterer(t||this.props.results,e):this.defaultFilter(t||this.props.results,e),n.maxPage=this.getMaxPage(n.filteredResults),(D(e)||I(e)||A(e))&&(n.filter=e,n.filteredResults=null),this.setState(n),this._resetSelectedRows()}},setPageSize:function(e){if(this.props.useExternal)return this.setState({resultsPerPage:e}),void this.props.externalSetPageSize(e);this.state.resultsPerPage=e,this.setMaxPage()},toggleColumnChooser:function(){this.setState({showColumnChooser:!this.state.showColumnChooser})},isNullOrUndefined:function(e){return null==e},shouldUseCustomRowComponent:function(){return this.isNullOrUndefined(this.state.useCustomRowComponent)?this.props.useCustomRowComponent:this.state.useCustomRowComponent},shouldUseCustomGridComponent:function(){return this.isNullOrUndefined(this.state.useCustomGridComponent)?this.props.useCustomGridComponent:this.state.useCustomGridComponent},toggleCustomComponent:function(){"grid"===this.state.customComponentType?this.setState({useCustomGridComponent:!this.shouldUseCustomGridComponent()}):"row"===this.state.customComponentType&&this.setState({useCustomRowComponent:!this.shouldUseCustomRowComponent()})},getMaxPage:function(e,t){return this.props.useExternal?this.props.externalMaxPage:(t||(t=(e||this.getCurrentResults()).length),Math.ceil(t/this.state.resultsPerPage))},setMaxPage:function(e){var t=this.getMaxPage(e);this.state.maxPage!==t&&this.setState({page:0,maxPage:t,filteredColumns:this.columnSettings.filteredColumns})},setPage:function(e){if(this.props.useExternal)this.props.externalSetPage(e);else{if(e*this.state.resultsPerPage<=this.state.resultsPerPage*this.state.maxPage){var t={page:e};this.setState(t)}this.props.enableInfiniteScroll&&this.setState({isSelectAllChecked:!1})}},setColumns:function(e){this.columnSettings.filteredColumns=O(e)?e:[e],this.setState({filteredColumns:this.columnSettings.filteredColumns})},nextPage:function(){var e=this.getCurrentPage();e0&&this.setPage(e-1)},changeSort:function(e){if(!1!==this.props.enableSort){if(this.props.useExternal){var t=this.props.externalSortColumn!==e||!this.props.externalSortAscending;return this.setState({sortColumn:e,sortDirection:t?"asc":"desc"}),void this.props.externalChangeSort(e,t)}var n=S(this.props.columnMetadata,{columnName:e})||{},r=n.sortDirectionCycle?n.sortDirectionCycle:[null,"asc","desc"],o=r.indexOf(this.state.sortDirection&&e===this.state.sortColumn?this.state.sortDirection:null),i={page:0,sortColumn:e,sortDirection:r[o=(o+1)%r.length]?r[o]:null};this.setState(i)}},componentWillReceiveProps:function(e){if(e.results!==this.props.results&&this.setFilter(this.state.filter,e.results),this.setMaxPage(e.results),e.resultsPerPage!==this.props.resultsPerPage&&this.setPageSize(e.resultsPerPage),this.columnSettings.columnMetadata=e.columnMetadata,e.results.length>0){var t=b.keys(e.results[0]);this.columnSettings.allColumns.length==t.length&&this.columnSettings.allColumns.every((function(e,n){return e===t[n]}))||(this.columnSettings.allColumns=t)}else this.columnSettings.allColumns.length>0&&(this.columnSettings.allColumns=[]);if(e.selectedRowIds){var n=this.getDataForRender(this.getCurrentResults(e.results),this.columnSettings.getColumns(),!0);this.setState({isSelectAllChecked:this._getAreAllRowsChecked(e.selectedRowIds,M(n,this.props.uniqueIdentifier)),selectedRowIds:e.selectedRowIds})}},getInitialState:function(){return{maxPage:0,page:0,filteredResults:null,filteredColumns:[],filter:"",columnFilters:{},resultsPerPage:this.props.resultsPerPage||5,showColumnChooser:!1,isSelectAllChecked:!1,selectedRowIds:this.props.selectedRowIds}},componentWillMount:function(){this.verifyExternal(),this.verifyCustom(),this.columnSettings=new y(this.props.results.length>0?b.keys(this.props.results[0]):[],this.props.columns,this.props.childrenColumnName,this.props.columnMetadata,this.props.metadataColumns),this.rowSettings=new v(this.props.rowMetadata,this.props.useCustomTableRowComponent&&this.props.customTableRowComponent?this.props.customTableRowComponent:p,this.props.useCustomTableRowComponent),this.props.initialSort&&(this.props.useExternal?this.setState({sortColumn:this.props.externalSortColumn,sortDirection:this.props.externalSortAscending?"asc":"desc"}):this.changeSort(this.props.initialSort)),this.setMaxPage(),this.shouldUseCustomGridComponent()?this.setState({customComponentType:"grid"}):this.shouldUseCustomRowComponent()?this.setState({customComponentType:"row"}):this.setState({filteredColumns:this.columnSettings.filteredColumns})},componentDidMount:function(){if(this.props.componentDidMount&&"function"==typeof this.props.componentDidMount)return this.props.componentDidMount()},componentDidUpdate:function(){if(this.props.componentDidUpdate&&"function"==typeof this.props.componentDidUpdate)return this.props.componentDidUpdate(this.state)},verifyExternal:function(){!0===this.props.useExternal&&(null===this.props.externalSetPage&&console.error("useExternal is set to true but there is no externalSetPage function specified."),null===this.props.externalChangeSort&&console.error("useExternal is set to true but there is no externalChangeSort function specified."),null===this.props.externalSetFilter&&console.error("useExternal is set to true but there is no externalSetFilter function specified."),null===this.props.externalSetPageSize&&console.error("useExternal is set to true but there is no externalSetPageSize function specified."),null===this.props.externalMaxPage&&console.error("useExternal is set to true but externalMaxPage is not set."),null===this.props.externalCurrentPage&&console.error("useExternal is set to true but externalCurrentPage is not set. Griddle will not page correctly without that property when using external data."))},verifyCustom:function(){!0===this.props.useCustomGridComponent&&null===this.props.customGridComponent&&console.error("useCustomGridComponent is set to true but no custom component was specified."),!0===this.props.useCustomRowComponent&&null===this.props.customRowComponent&&console.error("useCustomRowComponent is set to true but no custom component was specified."),!0===this.props.useCustomGridComponent&&!0===this.props.useCustomRowComponent&&console.error("Cannot currently use both customGridComponent and customRowComponent."),!0===this.props.useCustomFilterer&&null===this.props.customFilterer&&console.error("useCustomFilterer is set to true but no custom filter function was specified."),!0===this.props.useCustomFilterComponent&&null===this.props.customFilterComponent&&console.error("useCustomFilterComponent is set to true but no customFilterComponent was specified.")},getDataForRender:function(e,t,n){var r=this,o=this;if(!this.props.useExternal){if(""!==this.state.sortColumn){var i,s=this.state.sortColumn,l=T(this.props.columnMetadata,{columnName:s}),a={columns:[],orders:[]};if(l.length>0&&(i=l[0].hasOwnProperty("customCompareFn")&&l[0].customCompareFn,l[0].multiSort&&(a=l[0].multiSort)),this.state.sortDirection)if("function"==typeof i)2===i.length?(e=e.sort((function(e,t){return i(k(e,s),k(t,s))})),"desc"===this.state.sortDirection&&e.reverse()):1===i.length&&(e=P(e,(function(e){return i(k(e,s))}),[this.state.sortDirection]));else{var u=[function(e){return(k(e,s)||"").toString().toLowerCase()}],d=[this.state.sortDirection];a.columns.forEach((function(e,t){u.push((function(t){return(k(t,e)||"").toString().toLowerCase()})),"asc"===a.orders[t]||"desc"===a.orders[t]?d.push(a.orders[t]):d.push(r.state.sortDirection)})),e=P(e,u,d)}}var c=this.getCurrentPage();if(!this.props.useExternal&&n&&this.state.resultsPerPage*(c+1)<=this.state.resultsPerPage*this.state.maxPage&&c>=0)if(this.isInfiniteScrollEnabled())e=_(e,(c+1)*this.state.resultsPerPage);else{var p=C(e,c*this.state.resultsPerPage);e=(E||x)(p,p.length-this.state.resultsPerPage)}}for(var f=[],h=0;h0&&(m.children=o.getDataForRender(m[o.props.childrenColumnName],t,!1),"children"!==o.props.childrenColumnName&&delete m[o.props.childrenColumnName]),f.push(m)}return f},getCurrentResults:function(e){return this.state.filteredResults||e||this.props.results},getCurrentPage:function(){return this.props.externalCurrentPage||this.state.page},getCurrentSort:function(){return this.props.useExternal?this.props.externalSortColumn:this.state.sortColumn},getCurrentSortAscending:function(){return this.props.useExternal?this.props.externalSortAscending:"asc"===this.state.sortDirection},getCurrentMaxPage:function(){return this.props.useExternal?this.props.externalMaxPage:this.state.maxPage},getSortObject:function(){return{enableSort:this.props.enableSort,changeSort:this.changeSort,sortColumn:this.getCurrentSort(),sortAscending:this.getCurrentSortAscending(),sortDirection:this.state.sortDirection,sortAscendingClassName:this.props.sortAscendingClassName,sortDescendingClassName:this.props.sortDescendingClassName,sortAscendingComponent:this.props.sortAscendingComponent,sortDescendingComponent:this.props.sortDescendingComponent,sortDefaultComponent:this.props.sortDefaultComponent}},_toggleSelectAll:function(){var e=this.getDataForRender(this.getCurrentResults(),this.columnSettings.getColumns(),!0),t=!this.state.isSelectAllChecked,n=JSON.parse(JSON.stringify(this.state.selectedRowIds)),r=this;w(e,(function(e){r._updateSelectedRowIds(e[r.props.uniqueIdentifier],n,t)}),this),this.setState({isSelectAllChecked:t,selectedRowIds:n}),this.props.onSelectionChange&&this.props.onSelectionChange(n,t)},_toggleSelectRow:function(e,t){var n=this.getDataForRender(this.getCurrentResults(),this.columnSettings.getColumns(),!0),r=JSON.parse(JSON.stringify(this.state.selectedRowIds));this._updateSelectedRowIds(e[this.props.uniqueIdentifier],r,t);var o=this._getAreAllRowsChecked(r,M(n,this.props.uniqueIdentifier));this.setState({isSelectAllChecked:o,selectedRowIds:r}),this.props.onSelectionChange&&this.props.onSelectionChange(r,o)},_updateSelectedRowIds:function(e,t,n){n?void 0===S(t,(function(t){return e===t}))&&t.push(e):t.splice(t.indexOf(e),1)},_getIsSelectAllChecked:function(){return this.state.isSelectAllChecked},_getAreAllRowsChecked:function(e,t){return t.length===F(t,e).length},_getIsRowChecked:function(e){return this.state.selectedRowIds.indexOf(e[this.props.uniqueIdentifier])>-1},getSelectedRowIds:function(){return this.state.selectedRowIds},_resetSelectedRows:function(){this.setState({isSelectAllChecked:!1,selectedRowIds:[]})},getMultipleSelectionObject:function(){return{isMultipleSelection:!S(this.props.results,(function(e){return"children"in e}))&&this.props.isMultipleSelection,toggleSelectAll:this._toggleSelectAll,getIsSelectAllChecked:this._getIsSelectAllChecked,toggleSelectRow:this._toggleSelectRow,getSelectedRowIds:this.getSelectedRowIds,getIsRowChecked:this._getIsRowChecked}},isInfiniteScrollEnabled:function(){return!this.props.useCustomPagerComponent&&this.props.enableInfiniteScroll},getClearFixStyles:function(){return{clear:"both",display:"table",width:"100%"}},getSettingsStyles:function(){return{float:"left",width:"50%",textAlign:"right"}},getFilterStyles:function(){return{float:"left",width:"50%",textAlign:"left",color:"#222",minHeight:"1px"}},getFilter:function(){return this.props.showFilter&&!1===this.shouldUseCustomGridComponent()?this.props.useCustomFilterComponent?o.createElement(g,{changeFilter:this.setFilter,placeholderText:this.props.filterPlaceholderText,customFilterComponent:this.props.customFilterComponent,results:this.props.results,currentResults:this.getCurrentResults()}):o.createElement(a,{changeFilter:this.setFilter,placeholderText:this.props.filterPlaceholderText}):""},getSettings:function(){return this.props.showSettings?o.createElement("button",{type:"button",className:this.props.settingsToggleClassName,onClick:this.toggleColumnChooser,style:this.props.useGriddleStyles?{background:"none",border:"none",padding:0,margin:0,fontSize:14}:null},this.props.settingsText,this.props.settingsIconComponent):""},getTopSection:function(e,t){if(!1===this.props.showFilter&&!1===this.props.showSettings)return"";var n=null,r=null,i=null;return this.props.useGriddleStyles&&(n=this.getFilterStyles(),r=this.getSettingsStyles(),i=this.getClearFixStyles()),o.createElement("div",{className:"top-section",style:i},o.createElement("div",{className:"griddle-filter",style:n},e),o.createElement("div",{className:"griddle-settings-toggle",style:r},t))},getPagingSection:function(e,t){if(!1!==(this.props.showPager&&!this.isInfiniteScrollEnabled()&&!this.shouldUseCustomGridComponent()))return o.createElement("div",{className:"griddle-footer"},this.props.useCustomPagerComponent?o.createElement(m,{customPagerComponentOptions:this.props.customPagerComponentOptions,next:this.nextPage,previous:this.previousPage,currentPage:e,maxPage:t,setPage:this.setPage,nextText:this.props.nextText,previousText:this.props.previousText,customPagerComponent:this.props.customPagerComponent}):o.createElement(u,{useGriddleStyles:this.props.useGriddleStyles,next:this.nextPage,previous:this.previousPage,nextClassName:this.props.nextClassName,nextIconComponent:this.props.nextIconComponent,previousClassName:this.props.previousClassName,previousIconComponent:this.props.previousIconComponent,currentPage:e,maxPage:t,setPage:this.setPage,nextText:this.props.nextText,previousText:this.props.previousText}))},getColumnSelectorSection:function(e,t){return this.state.showColumnChooser?o.createElement(d,{columns:e,selectedColumns:t,setColumns:this.setColumns,settingsText:this.props.settingsText,settingsIconComponent:this.props.settingsIconComponent,maxRowsText:this.props.maxRowsText,setPageSize:this.setPageSize,showSetPageSize:!this.shouldUseCustomGridComponent(),resultsPerPage:this.state.resultsPerPage,enableToggleCustom:this.props.enableToggleCustom,toggleCustomComponent:this.toggleCustomComponent,useCustomComponent:this.shouldUseCustomRowComponent()||this.shouldUseCustomGridComponent(),useGriddleStyles:this.props.useGriddleStyles,enableCustomFormatText:this.props.enableCustomFormatText,columnMetadata:this.props.columnMetadata}):""},getCustomGridSection:function(){return o.createElement(this.props.customGridComponent,r({data:this.props.results,className:this.props.customGridComponentClassName},this.props.gridMetadata))},getCustomRowSection:function(e,t,n,r,i){return o.createElement("div",null,o.createElement(h,{data:e,columns:t,metadataColumns:n,globalData:i,className:this.props.customRowComponentClassName,customComponent:this.props.customRowComponent,style:this.props.useGriddleStyles?this.getClearFixStyles():null}),this.props.showPager&&r)},getStandardGridSection:function(e,t,n,r,i){var s=this.getSortObject(),a=this.getMultipleSelectionObject(),u=this.shouldShowNoDataSection(e),d=this.getNoDataSection();return o.createElement("div",{className:"griddle-body"},o.createElement(l,{useGriddleStyles:this.props.useGriddleStyles,noDataSection:d,showNoData:u,columnSettings:this.columnSettings,rowSettings:this.rowSettings,sortSettings:s,multipleSelectionSettings:a,filterByColumn:this.filterByColumn,isSubGriddle:this.props.isSubGriddle,useGriddleIcons:this.props.useGriddleIcons,useFixedLayout:this.props.useFixedLayout,showPager:this.props.showPager,pagingContent:r,data:e,className:this.props.tableClassName,enableInfiniteScroll:this.isInfiniteScrollEnabled(),nextPage:this.nextPage,showTableHeading:this.props.showTableHeading,useFixedHeader:this.props.useFixedHeader,parentRowCollapsedClassName:this.props.parentRowCollapsedClassName,parentRowExpandedClassName:this.props.parentRowExpandedClassName,parentRowCollapsedComponent:this.props.parentRowCollapsedComponent,parentRowExpandedComponent:this.props.parentRowExpandedComponent,bodyHeight:this.props.bodyHeight,paddingHeight:this.props.paddingHeight,rowHeight:this.props.rowHeight,infiniteScrollLoadTreshold:this.props.infiniteScrollLoadTreshold,externalLoadingComponent:this.props.externalLoadingComponent,externalIsLoading:this.props.externalIsLoading,hasMorePages:i,onRowClick:this.props.onRowClick,onRowMouseEnter:this.props.onRowMouseEnter,onRowMouseLeave:this.props.onRowMouseLeave,onRowWillMount:this.props.onRowWillMount,onRowWillUnmount:this.props.onRowWillUnmount}))},getContentSection:function(e,t,n,r,o,i){return this.shouldUseCustomGridComponent()&&null!==this.props.customGridComponent?this.getCustomGridSection():this.shouldUseCustomRowComponent()?this.getCustomRowSection(e,t,n,r,i):this.getStandardGridSection(e,t,n,r,o)},getNoDataSection:function(){return null!=this.props.customNoDataComponent?o.createElement("div",{className:this.props.noDataClassName},o.createElement(this.props.customNoDataComponent,this.props.customNoDataComponentProps)):o.createElement(c,{noDataMessage:this.props.noDataMessage})},shouldShowNoDataSection:function(e){return!this.props.allowEmptyGrid&&(!1===this.props.useExternal&&(void 0===e||0===e.length)||!0===this.props.useExternal&&!1===this.props.externalIsLoading&&0===e.length)},render:function(){var e=this.getCurrentResults(),t=(this.props.tableClassName,this.getFilter()),n=this.getSettings(),r=this.getTopSection(t,n),i=[],s=this.columnSettings.getColumns(),l=this.getDataForRender(e,s,!0),a=this.columnSettings.getMetadataColumns();this.props.columnMetadata?w(this.props.columnMetadata,(function(e){"boolean"==typeof e.visible&&!1===e.visible||i.push(e.columnName)})):i=b.keys(N(e[0],a)),i=this.columnSettings.orderColumns(i);var u=this.getCurrentPage(),d=this.getCurrentMaxPage(),c=u+10?"griddle "+this.props.gridClassName:"griddle";return m+=this.shouldUseCustomRowComponent()?" griddle-custom":"",o.createElement("div",{className:m},r,h,o.createElement("div",{className:"griddle-container",style:this.props.useGriddleStyles&&!this.props.isSubGriddle?{border:"1px solid #DDD"}:null},f))}});f.Griddle=e.exports=j},1545:function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n-1}},9905:function(e){e.exports=function(e,t,n){for(var r=-1,o=null==e?0:e.length;++r=200&&(c=a,p=!1,t=new r(t));e:for(;++d0&&i(d)?n>1?e(d,n-1,i,s,l):r(l,d):s||(l[l.length]=d)}return l}},6649:function(e,t,n){var r=n(3221)();e.exports=r},641:function(e,t,n){var r=n(6649),o=n(5950);e.exports=function(e,t){return e&&r(e,t,o)}},7422:function(e,t,n){var r=n(1769),o=n(7797);e.exports=function(e,t){for(var n=0,i=(t=r(t,e)).length;null!=e&&n=120&&y.length>=120)?new r(f&&y):void 0}y=e[0];var v=-1,b=h[0];e:for(;++vo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(o);++rt||s&&l&&u&&!a&&!d||o&&l&&u||!n&&u||!i)return 1;if(!o&&!s&&!d&&e=a?u:u*("desc"==n[o]?-1:1)}return e.index-t.index}},3007:function(e){e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n1?n[i-1]:void 0,l=i>2?n[2]:void 0;for(s=e.length>3&&"function"==typeof s?(i--,s):void 0,l&&o(n[0],n[1],l)&&(s=i<3?void 0:s,i=1),t=Object(t);++r-1?l[a?t[u]:u]:void 0}}},2963:function(e,t,n){var r=n(1372),o=n(5861),i=n(317),s=n(799);e.exports=function(e){return function(t){var n=o(t);return"[object Map]"==n?i(t):"[object Set]"==n?s(t):r(t,e(t))}}},3138:function(e,t,n){var r=n(1331);e.exports=function(e){return r(e)?void 0:e}},3243:function(e,t,n){var r=n(6110),o=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=o},5911:function(e,t,n){var r=n(8859),o=n(4248),i=n(9219);e.exports=function(e,t,n,s,l,a){var u=1&n,d=e.length,c=t.length;if(d!=c&&!(u&&c>d))return!1;var p=a.get(e),f=a.get(t);if(p&&f)return p==t&&f==e;var h=-1,m=!0,g=2&n?new r:void 0;for(a.set(e,t),a.set(t,e);++h-1&&e%1==0&&e-1}},1175:function(e,t,n){var r=n(6025);e.exports=function(e,t){var n=this.__data__,o=r(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this}},3040:function(e,t,n){var r=n(1549),o=n(79),i=n(8223);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(i||o),string:new r}}},7670:function(e,t,n){var r=n(2651);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},289:function(e,t,n){var r=n(2651);e.exports=function(e){return r(this,e).get(e)}},4509:function(e,t,n){var r=n(2651);e.exports=function(e){return r(this,e).has(e)}},2949:function(e,t,n){var r=n(2651);e.exports=function(e,t){var n=r(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this}},317:function(e){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}},7197:function(e){e.exports=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}},2224:function(e,t,n){var r=n(104);e.exports=function(e){var t=r(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}},1042:function(e,t,n){var r=n(6110)(Object,"create");e.exports=r},3650:function(e,t,n){var r=n(4335)(Object.keys,Object);e.exports=r},181:function(e){e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},6009:function(e,t,n){e=n.nmd(e);var r=n(4840),o=t&&!t.nodeType&&t,i=o&&e&&!e.nodeType&&e,s=i&&i.exports===o&&r.process,l=function(){try{var e=i&&i.require&&i.require("util").types;return e||s&&s.binding&&s.binding("util")}catch(e){}}();e.exports=l},9350:function(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},4335:function(e){e.exports=function(e,t){return function(n){return e(t(n))}}},6757:function(e,t,n){var r=n(1033),o=Math.max;e.exports=function(e,t,n){return t=o(void 0===t?e.length-1:t,0),function(){for(var i=arguments,s=-1,l=o(i.length-t,0),a=Array(l);++s0){if(++n>=800)return arguments[0]}else n=0;return e.apply(void 0,arguments)}}},1420:function(e,t,n){var r=n(79);e.exports=function(){this.__data__=new r,this.size=0}},938:function(e){e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},3605:function(e){e.exports=function(e){return this.__data__.get(e)}},9817:function(e){e.exports=function(e){return this.__data__.has(e)}},945:function(e,t,n){var r=n(79),o=n(8223),i=n(3661);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var s=n.__data__;if(!o||s.length<199)return s.push([e,t]),this.size=++n.size,this;n=this.__data__=new i(s)}return n.set(e,t),this.size=n.size,this}},6959:function(e){e.exports=function(e,t,n){for(var r=n-1,o=e.length;++r2?t[2]:void 0;for(u&&i(t[0],t[1],u)&&(r=1);++n-1:!!d&&r(e,t,n)>-1}},3424:function(e,t,n){var r=n(5160);e.exports=function(e){return(null==e?0:e.length)?r(e,0,-1):[]}},5287:function(e,t,n){var r=n(4932),o=n(7185),i=n(9302),s=n(741),l=i((function(e){var t=r(e,s);return t.length&&t[0]===e[0]?o(t):[]}));e.exports=l},2428:function(e,t,n){var r=n(7534),o=n(346),i=Object.prototype,s=i.hasOwnProperty,l=i.propertyIsEnumerable,a=r(function(){return arguments}())?r:function(e){return o(e)&&s.call(e,"callee")&&!l.call(e,"callee")};e.exports=a},6449:function(e){var t=Array.isArray;e.exports=t},4894:function(e,t,n){var r=n(1882),o=n(294);e.exports=function(e){return null!=e&&o(e.length)&&!r(e)}},3693:function(e,t,n){var r=n(4894),o=n(346);e.exports=function(e){return o(e)&&r(e)}},3656:function(e,t,n){e=n.nmd(e);var r=n(9325),o=n(9935),i=t&&!t.nodeType&&t,s=i&&e&&!e.nodeType&&e,l=s&&s.exports===i?r.Buffer:void 0,a=(l?l.isBuffer:void 0)||o;e.exports=a},2193:function(e,t,n){var r=n(8984),o=n(5861),i=n(2428),s=n(6449),l=n(4894),a=n(3656),u=n(5527),d=n(7167),c=Object.prototype.hasOwnProperty;e.exports=function(e){if(null==e)return!0;if(l(e)&&(s(e)||"string"==typeof e||"function"==typeof e.splice||a(e)||d(e)||i(e)))return!e.length;var t=o(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(u(e))return!r(e).length;for(var n in e)if(c.call(e,n))return!1;return!0}},1882:function(e,t,n){var r=n(2552),o=n(3805);e.exports=function(e){if(!o(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},294:function(e){e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},7730:function(e,t,n){var r=n(9172),o=n(7301),i=n(6009),s=i&&i.isMap,l=s?o(s):r;e.exports=l},5187:function(e){e.exports=function(e){return null===e}},3805:function(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},346:function(e){e.exports=function(e){return null!=e&&"object"==typeof e}},1331:function(e,t,n){var r=n(2552),o=n(8879),i=n(346),s=Function.prototype,l=Object.prototype,a=s.toString,u=l.hasOwnProperty,d=a.call(Object);e.exports=function(e){if(!i(e)||"[object Object]"!=r(e))return!1;var t=o(e);if(null===t)return!0;var n=u.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&a.call(n)==d}},8440:function(e,t,n){var r=n(6038),o=n(7301),i=n(6009),s=i&&i.isSet,l=s?o(s):r;e.exports=l},5015:function(e,t,n){var r=n(2552),o=n(6449),i=n(346);e.exports=function(e){return"string"==typeof e||!o(e)&&i(e)&&"[object String]"==r(e)}},4394:function(e,t,n){var r=n(2552),o=n(346);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},7167:function(e,t,n){var r=n(4901),o=n(7301),i=n(6009),s=i&&i.isTypedArray,l=s?o(s):r;e.exports=l},2216:function(e){e.exports=function(e){return void 0===e}},5950:function(e,t,n){var r=n(695),o=n(8984),i=n(4894);e.exports=function(e){return i(e)?r(e):o(e)}},7241:function(e,t,n){var r=n(695),o=n(2903),i=n(4894);e.exports=function(e){return i(e)?r(e,!0):o(e)}},8090:function(e){e.exports=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}},5378:function(e,t,n){var r=n(4932),o=n(5389),i=n(5128),s=n(6449);e.exports=function(e,t){return(s(e)?r:i)(e,o(t,3))}},104:function(e,t,n){var r=n(3661);function o(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=e.apply(this,r);return n.cache=i.set(o,s)||i,s};return n.cache=new(o.Cache||r),n}o.Cache=r,e.exports=o},179:function(e,t,n){var r=n(4932),o=n(9999),i=n(9931),s=n(1769),l=n(1791),a=n(3138),u=n(8816),d=n(3349),c=u((function(e,t){var n={};if(null==e)return n;var u=!1;t=r(t,(function(t){return t=s(t,e),u||(u=t.length>1),t})),l(e,d(e),n),u&&(n=o(n,7,a));for(var c=t.length;c--;)i(n,t[c]);return n}));e.exports=c},2877:function(e,t,n){var r=n(6155),o=n(6449);e.exports=function(e,t,n,i){return null==e?[]:(o(t)||(t=null==t?[]:[t]),o(n=i?void 0:n)||(n=null==n?[]:[n]),r(e,t,n))}},4383:function(e,t,n){var r=n(6001),o=n(8816)((function(e,t){return null==e?{}:r(e,t)}));e.exports=o},583:function(e,t,n){var r=n(7237),o=n(7255),i=n(8586),s=n(7797);e.exports=function(e){return i(e)?r(s(e)):o(e)}},2426:function(e,t,n){var r=n(4248),o=n(5389),i=n(916),s=n(6449),l=n(6800);e.exports=function(e,t,n){var a=s(e)?r:i;return n&&l(e,t,n)&&(t=void 0),a(e,o(t,3))}},3031:function(e,t,n){var r=n(3120),o=n(6155),i=n(9302),s=n(6800),l=i((function(e,t){if(null==e)return[];var n=t.length;return n>1&&s(e,t[0],t[1])?t=[]:n>2&&s(t[0],t[1],t[2])&&(t=[t[0]]),o(e,r(t,1),[])}));e.exports=l},3345:function(e){e.exports=function(){return[]}},9935:function(e){e.exports=function(){return!1}},4921:function(e,t,n){var r=n(5160),o=n(1489);e.exports=function(e,t,n){return e&&e.length?(t=n||void 0===t?1:o(t),r(e,0,t<0?0:t)):[]}},7400:function(e,t,n){var r=n(9374),o=1/0;e.exports=function(e){return e?(e=r(e))===o||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},1489:function(e,t,n){var r=n(7400);e.exports=function(e){var t=r(e),n=t%1;return t==t?n?t-n:t:0}},9374:function(e,t,n){var r=n(4128),o=n(3805),i=n(4394),s=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,a=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=l.test(e);return n||a.test(e)?u(e.slice(2),n?2:8):s.test(e)?NaN:+e}},8938:function(e,t,n){var r=n(2963)(n(5950));e.exports=r},2072:function(e,t,n){var r=n(4932),o=n(3007),i=n(6449),s=n(4394),l=n(1802),a=n(7797),u=n(3222);e.exports=function(e){return i(e)?r(e,a):s(e)?[e]:o(l(u(e)))}},3222:function(e,t,n){var r=n(7556);e.exports=function(e){return null==e?"":r(e)}},7200:function(e,t,n){var r=n(3222),o=0;e.exports=function(e){var t=++o;return r(e)+t}},5880:function(e,t,n){var r=n(514),o=n(5950);e.exports=function(e){return null==e?[]:r(e,o(e))}},1648:function(e,t,n){var r=n(3915),o=n(9302),i=n(3693),s=o((function(e,t){return i(e)?r(e,t):[]}));e.exports=s},7248:function(e,t,n){var r=n(6547),o=n(1234);e.exports=function(e,t){return o(e||[],t||[],r)}},5228:function(e){"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,o){for(var i,s,l=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),a=1;a1)for(var n=1;n1?t-1:0),r=1;r2?n-2:0),i=2;i1&&void 0!==arguments[1]&&arguments[1],n=this.props,r=n.tolerance,o=n.onSelection,i=n.onEndSelection,s=[],l=(0,d.findDOMNode)(this.refs.selectbox);l&&(this._registry.forEach((function(e){e.domNode&&(0,g.default)(l,e.domNode,r)&&!s.includes(e.key)&&s.push(e.key)})),t?"function"==typeof i&&i(s,e):"function"==typeof o&&o(s,e))}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.enabled,r=e.fixedPosition,o=e.className,i=e.selectingClassName,s=this.state,l=s.isBoxSelecting,a=s.boxLeft,d=s.boxTop,c=s.boxWidth,f=s.boxHeight,h=this.props.component;if(!n)return u.default.createElement(h,{className:o},t);var m={left:a,top:d,width:c,height:f,zIndex:9e3,position:r?"fixed":"absolute",cursor:"default"},g={backgroundColor:"transparent",border:"1px dashed #999",width:"100%",height:"100%",float:"left"},y={position:"relative",overflow:"visible"};return u.default.createElement(h,{className:(0,p.default)(o,l?i:null),style:y},l?u.default.createElement("div",{style:m,ref:"selectbox"},u.default.createElement("span",{style:g})):null,t)}}]),t}(a.Component);v.propTypes={children:c.default.node,onBeginSelection:c.default.func,onEndSelection:c.default.func,onSelection:c.default.func,component:c.default.node,tolerance:c.default.number,fixedPosition:c.default.bool,preventDefault:c.default.bool,onNonItemClick:c.default.func,enabled:c.default.bool,className:c.default.string,selectingClassName:c.default.string},v.defaultProps={component:"div",tolerance:0,fixedPosition:!1,preventDefault:!0,enabled:!0},v.childContextTypes={selectable:c.default.object},t.default=v},function(e,t,n){"use strict";(function(t){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=n(1),i=n(2),s=n(8),l=n(15),a=n(3),u=n(16);e.exports=function(e,n){function d(e){var t=e&&(A&&e[A]||e[I]);if("function"==typeof t)return t}function c(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function p(e){this.message=e,this.stack=""}function f(e){function r(r,u,d,c,f,h,m){if(c=c||D,h=h||d,m!==a)if(n)i(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("production"!==t.env.NODE_ENV&&"undefined"!=typeof console){var g=c+":"+d;!o[g]&&l<3&&(s(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",h,c),o[g]=!0,l++)}return null==u[d]?r?new p(null===u[d]?"The "+f+" `"+h+"` is marked as required in `"+c+"`, but its value is `null`.":"The "+f+" `"+h+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:e(u,d,c,f,h)}if("production"!==t.env.NODE_ENV)var o={},l=0;var u=r.bind(null,!1);return u.isRequired=r.bind(null,!0),u}function h(e){function t(t,n,r,o,i,s){var l=t[n];return w(l)!==e?new p("Invalid "+o+" `"+i+"` of type `"+x(l)+"` supplied to `"+r+"`, expected `"+e+"`."):null}return f(t)}function m(e){function t(t,n,r,o,i){if("function"!=typeof e)return new p("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s))return new p("Invalid "+o+" `"+i+"` of type `"+w(s)+"` supplied to `"+r+"`, expected an array.");for(var l=0;ln+l||t+o-ar+s)};t.default=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=e instanceof HTMLElement?(0,r.default)(e):e,s=t instanceof HTMLElement?(0,r.default)(t):t;return o(i.top,i.left,s.top,s.left,i.offsetWidth,i.offsetHeight,s.offsetWidth,s.offsetHeight,n)}},function(e,t,n){"use strict";(function(t){function n(e,t,n){function r(t){var n=m,r=g;return m=g=void 0,w=t,v=e.apply(r,n)}function i(e){return w=e,b=setTimeout(d,t),x?r(e):v}function s(e){var n=t-(e-C);return F?S(n,y-(e-w)):n}function a(e){var n=e-C;return void 0===C||n>=t||n<0||F&&e-w>=y}function d(){var e=_();if(a(e))return c(e);b=setTimeout(d,s(e))}function c(e){return b=void 0,O&&m?r(e):(m=g=void 0,v)}function p(){void 0!==b&&clearTimeout(b),w=0,m=C=g=b=void 0}function f(){return void 0===b?v:c(_())}function h(){var e=_(),n=a(e);if(m=arguments,g=this,C=e,n){if(void 0===b)return i(C);if(F)return b=setTimeout(d,t),r(C)}return void 0===b&&(b=setTimeout(d,t)),v}var m,g,y,v,b,C,w=0,x=!1,F=!1,O=!0;if("function"!=typeof e)throw new TypeError(u);return t=l(t)||0,o(n)&&(x=!!n.leading,y=(F="maxWait"in n)?E(l(n.maxWait)||0,t):y,O="trailing"in n?!!n.trailing:O),h.cancel=p,h.flush=f,h}function r(e,t,r){var i=!0,s=!0;if("function"!=typeof e)throw new TypeError(u);return o(r)&&(i="leading"in r?!!r.leading:i,s="trailing"in r?!!r.trailing:s),n(e,t,{leading:i,maxWait:t,trailing:s})}function o(e){var t=void 0===e?"undefined":a(e);return!!e&&("object"==t||"function"==t)}function i(e){return!!e&&"object"==(void 0===e?"undefined":a(e))}function s(e){return"symbol"==(void 0===e?"undefined":a(e))||i(e)&&C.call(e)==c}function l(e){if("number"==typeof e)return e;if(s(e))return d;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(p,"");var n=h.test(e);return n||m.test(e)?g(e.slice(2),n?2:8):f.test(e)?d:+e}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u="Expected a function",d=NaN,c="[object Symbol]",p=/^\s+|\s+$/g,f=/^[-+]0x[0-9a-f]+$/i,h=/^0b[01]+$/i,m=/^0o[0-7]+$/i,g=parseInt,y="object"==(void 0===t?"undefined":a(t))&&t&&t.Object===Object&&t,v="object"==("undefined"==typeof self?"undefined":a(self))&&self&&self.Object===Object&&self,b=y||v||Function("return this")(),C=Object.prototype.toString,E=Math.max,S=Math.min,_=function(){return b.Date.now()};e.exports=r}).call(t,n(21))},function(e,t,n){"use strict";var r,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"===("undefined"==typeof window?"undefined":o(window))&&(r=window)}e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function 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)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n'),this.element.appendChild(e));let t=e.getElementsByTagName("span")[0];return t&&(null!=t.textContent?t.textContent=this.options.dictFallbackMessage:null!=t.innerText&&(t.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize(e,t,n,r){let o={srcX:0,srcY:0,srcWidth:e.width,srcHeight:e.height},i=e.width/e.height;null==t&&null==n?(t=o.srcWidth,n=o.srcHeight):null==t?t=n*i:null==n&&(n=t/i);let s=(t=Math.min(t,o.srcWidth))/(n=Math.min(n,o.srcHeight));if(o.srcWidth>t||o.srcHeight>n)if("crop"===r)i>s?(o.srcHeight=e.height,o.srcWidth=o.srcHeight*s):(o.srcWidth=e.width,o.srcHeight=o.srcWidth/s);else{if("contain"!==r)throw new Error(`Unknown resizeMethod '${r}'`);i>s?n=t/i:t=n*i}return o.srcX=(e.width-o.srcWidth)/2,o.srcY=(e.height-o.srcHeight)/2,o.trgWidth=t,o.trgHeight=n,o},transformFile(e,t){return(this.options.resizeWidth||this.options.resizeHeight)&&e.type.match(/image.*/)?this.resizeImage(e,this.options.resizeWidth,this.options.resizeHeight,this.options.resizeMethod,t):t(e)},previewTemplate:i('
\n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n \n \n \n
\n
\n \n \n \n
\n
\n'),drop(e){return this.element.classList.remove("dz-drag-hover")},dragstart(e){},dragend(e){return this.element.classList.remove("dz-drag-hover")},dragenter(e){return this.element.classList.add("dz-drag-hover")},dragover(e){return this.element.classList.add("dz-drag-hover")},dragleave(e){return this.element.classList.remove("dz-drag-hover")},paste(e){},reset(){return this.element.classList.remove("dz-started")},addedfile(e){if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer&&!this.options.disablePreviews){for(var t of(e.previewElement=a.createElement(this.options.previewTemplate.trim()),e.previewTemplate=e.previewElement,this.previewsContainer.appendChild(e.previewElement),e.previewElement.querySelectorAll("[data-dz-name]")))t.textContent=e.name;for(t of e.previewElement.querySelectorAll("[data-dz-size]"))t.innerHTML=this.filesize(e.size);this.options.addRemoveLinks&&(e._removeLink=a.createElement(`${this.options.dictRemoveFile}`),e.previewElement.appendChild(e._removeLink));let n=t=>(t.preventDefault(),t.stopPropagation(),e.status===a.UPLOADING?a.confirm(this.options.dictCancelUploadConfirmation,(()=>this.removeFile(e))):this.options.dictRemoveFileConfirmation?a.confirm(this.options.dictRemoveFileConfirmation,(()=>this.removeFile(e))):this.removeFile(e));for(let t of e.previewElement.querySelectorAll("[data-dz-remove]"))t.addEventListener("click",n)}},removedfile(e){return null!=e.previewElement&&null!=e.previewElement.parentNode&&e.previewElement.parentNode.removeChild(e.previewElement),this._updateMaxFilesReachedClass()},thumbnail(e,t){if(e.previewElement){e.previewElement.classList.remove("dz-file-preview");for(let n of e.previewElement.querySelectorAll("[data-dz-thumbnail]"))n.alt=e.name,n.src=t;return setTimeout((()=>e.previewElement.classList.add("dz-image-preview")),1)}},error(e,t){if(e.previewElement){e.previewElement.classList.add("dz-error"),"string"!=typeof t&&t.error&&(t=t.error);for(let n of e.previewElement.querySelectorAll("[data-dz-errormessage]"))n.textContent=t}},errormultiple(){},processing(e){if(e.previewElement&&(e.previewElement.classList.add("dz-processing"),e._removeLink))return e._removeLink.innerHTML=this.options.dictCancelUpload},processingmultiple(){},uploadprogress(e,t,n){if(e.previewElement)for(let n of e.previewElement.querySelectorAll("[data-dz-uploadprogress]"))"PROGRESS"===n.nodeName?n.value=t:n.style.width=`${t}%`},totaluploadprogress(){},sending(){},sendingmultiple(){},success(e){if(e.previewElement)return e.previewElement.classList.add("dz-success")},successmultiple(){},canceled(e){return this.emit("error",e,this.options.dictUploadCanceled)},canceledmultiple(){},complete(e){if(e._removeLink&&(e._removeLink.innerHTML=this.options.dictRemoveFile),e.previewElement)return e.previewElement.classList.add("dz-complete")},completemultiple(){},maxfilesexceeded(){},maxfilesreached(){},queuecomplete(){},addedfiles(){}};class a extends s{static initClass(){this.prototype.Emitter=s,this.prototype.events=["drop","dragstart","dragend","dragenter","dragover","dragleave","addedfile","addedfiles","removedfile","thumbnail","error","errormultiple","processing","processingmultiple","uploadprogress","totaluploadprogress","sending","sendingmultiple","success","successmultiple","canceled","canceledmultiple","complete","completemultiple","reset","maxfilesexceeded","maxfilesreached","queuecomplete"],this.prototype._thumbnailQueue=[],this.prototype._processingThumbnail=!1}getAcceptedFiles(){return this.files.filter((e=>e.accepted)).map((e=>e))}getRejectedFiles(){return this.files.filter((e=>!e.accepted)).map((e=>e))}getFilesWithStatus(e){return this.files.filter((t=>t.status===e)).map((e=>e))}getQueuedFiles(){return this.getFilesWithStatus(a.QUEUED)}getUploadingFiles(){return this.getFilesWithStatus(a.UPLOADING)}getAddedFiles(){return this.getFilesWithStatus(a.ADDED)}getActiveFiles(){return this.files.filter((e=>e.status===a.UPLOADING||e.status===a.QUEUED)).map((e=>e))}init(){if("form"===this.element.tagName&&this.element.setAttribute("enctype","multipart/form-data"),this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")&&this.element.appendChild(a.createElement(`
`)),this.clickableElements.length){let e=()=>{this.hiddenFileInput&&this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=document.createElement("input"),this.hiddenFileInput.setAttribute("type","file"),(null===this.options.maxFiles||this.options.maxFiles>1)&&this.hiddenFileInput.setAttribute("multiple","multiple"),this.hiddenFileInput.className="dz-hidden-input",null!==this.options.acceptedFiles&&this.hiddenFileInput.setAttribute("accept",this.options.acceptedFiles),null!==this.options.capture&&this.hiddenFileInput.setAttribute("capture",this.options.capture),this.hiddenFileInput.setAttribute("tabindex","-1"),this.hiddenFileInput.style.visibility="hidden",this.hiddenFileInput.style.position="absolute",this.hiddenFileInput.style.top="0",this.hiddenFileInput.style.left="0",this.hiddenFileInput.style.height="0",this.hiddenFileInput.style.width="0",a.getElement(this.options.hiddenInputContainer,"hiddenInputContainer").appendChild(this.hiddenFileInput),this.hiddenFileInput.addEventListener("change",(()=>{let{files:t}=this.hiddenFileInput;if(t.length)for(let e of t)this.addFile(e);this.emit("addedfiles",t),e()}))};e()}this.URL=null!==window.URL?window.URL:window.webkitURL;for(let e of this.events)this.on(e,this.options[e]);this.on("uploadprogress",(()=>this.updateTotalUploadProgress())),this.on("removedfile",(()=>this.updateTotalUploadProgress())),this.on("canceled",(e=>this.emit("complete",e))),this.on("complete",(e=>{if(0===this.getAddedFiles().length&&0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length)return setTimeout((()=>this.emit("queuecomplete")),0)}));let e=function(e){if(function(e){if(e.dataTransfer.types)for(var t=0;tthis.emit("dragstart",e),dragenter:t=>(e(t),this.emit("dragenter",t)),dragover:t=>{let n;try{n=t.dataTransfer.effectAllowed}catch(e){}return t.dataTransfer.dropEffect="move"===n||"linkMove"===n?"move":"copy",e(t),this.emit("dragover",t)},dragleave:e=>this.emit("dragleave",e),drop:t=>(e(t),this.drop(t)),dragend:e=>this.emit("dragend",e)}}],this.clickableElements.forEach((e=>this.listeners.push({element:e,events:{click:t=>((e!==this.element||t.target===this.element||a.elementInside(t.target,this.element.querySelector(".dz-message")))&&this.hiddenFileInput.click(),!0)}}))),this.enable(),this.options.init.call(this)}destroy(){return this.disable(),this.removeAllFiles(!0),(null!=this.hiddenFileInput?this.hiddenFileInput.parentNode:void 0)&&(this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=null),delete this.element.dropzone,a.instances.splice(a.instances.indexOf(this),1)}updateTotalUploadProgress(){let e,t=0,n=0;if(this.getActiveFiles().length){for(let e of this.getActiveFiles())t+=e.upload.bytesSent,n+=e.upload.total;e=100*t/n}else e=100;return this.emit("totaluploadprogress",e,n,t)}_getParamName(e){return"function"==typeof this.options.paramName?this.options.paramName(e):`${this.options.paramName}${this.options.uploadMultiple?`[${e}]`:""}`}_renameFile(e){return"function"!=typeof this.options.renameFile?e.name:this.options.renameFile(e)}getFallbackForm(){let e,t;if(e=this.getExistingFallback())return e;let n='
';this.options.dictFallbackText&&(n+=`

${this.options.dictFallbackText}

`),n+=`
`;let r=a.createElement(n);return"FORM"!==this.element.tagName?(t=a.createElement(`
`),t.appendChild(r)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),null!=t?t:r}getExistingFallback(){let e=function(e){for(let t of e)if(/(^| )fallback($| )/.test(t.className))return t};for(let n of["div","form"]){var t;if(t=e(this.element.getElementsByTagName(n)))return t}}setupEventListeners(){return this.listeners.map((e=>(()=>{let t=[];for(let n in e.events){let r=e.events[n];t.push(e.element.addEventListener(n,r,!1))}return t})()))}removeEventListeners(){return this.listeners.map((e=>(()=>{let t=[];for(let n in e.events){let r=e.events[n];t.push(e.element.removeEventListener(n,r,!1))}return t})()))}disable(){return this.clickableElements.forEach((e=>e.classList.remove("dz-clickable"))),this.removeEventListeners(),this.disabled=!0,this.files.map((e=>this.cancelUpload(e)))}enable(){return delete this.disabled,this.clickableElements.forEach((e=>e.classList.add("dz-clickable"))),this.setupEventListeners()}filesize(e){let t=0,n="b";if(e>0){let r=["tb","gb","mb","kb","b"];for(let o=0;o=Math.pow(this.options.filesizeBase,4-o)/10){t=e/Math.pow(this.options.filesizeBase,4-o),n=i;break}}t=Math.round(10*t)/10}return`${t} ${this.options.dictFileSizeUnits[n]}`}_updateMaxFilesReachedClass(){return null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")}drop(e){if(!e.dataTransfer)return;this.emit("drop",e);let t=[];for(let n=0;ne.items,null!=t?n(t):void 0))return;var t,n;this.emit("paste",e);let{items:r}=e.clipboardData;return r.length?this._addFilesFromItems(r):void 0}handleFiles(e){for(let t of e)this.addFile(t)}_addFilesFromItems(e){return(()=>{let t=[];for(let r of e){var n;null!=r.webkitGetAsEntry&&(n=r.webkitGetAsEntry())?n.isFile?t.push(this.addFile(r.getAsFile())):n.isDirectory?t.push(this._addFilesFromDirectory(n,n.name)):t.push(void 0):null!=r.getAsFile&&(null==r.kind||"file"===r.kind)?t.push(this.addFile(r.getAsFile())):t.push(void 0)}return t})()}_addFilesFromDirectory(e,t){let n=e.createReader(),r=e=>{return t=console,n="log",r=t=>t.log(e),null!=t&&"function"==typeof t[n]?r(t,n):void 0;var t,n,r};var o=()=>n.readEntries((e=>{if(e.length>0){for(let n of e)n.isFile?n.file((e=>{if(!this.options.ignoreHiddenFiles||"."!==e.name.substring(0,1))return e.fullPath=`${t}/${e.name}`,this.addFile(e)})):n.isDirectory&&this._addFilesFromDirectory(n,`${t}/${n.name}`);o()}return null}),r);return o()}accept(e,t){this.options.maxFilesize&&e.size>1048576*this.options.maxFilesize?t(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(e.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):a.isValidFile(e,this.options.acceptedFiles)?null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(t(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",e)):this.options.accept.call(this,e,t):t(this.options.dictInvalidFileType)}addFile(e){e.upload={uuid:a.uuidv4(),progress:0,total:e.size,bytesSent:0,filename:this._renameFile(e)},this.files.push(e),e.status=a.ADDED,this.emit("addedfile",e),this._enqueueThumbnail(e),this.accept(e,(t=>{t?(e.accepted=!1,this._errorProcessing([e],t)):(e.accepted=!0,this.options.autoQueue&&this.enqueueFile(e)),this._updateMaxFilesReachedClass()}))}enqueueFiles(e){for(let t of e)this.enqueueFile(t);return null}enqueueFile(e){if(e.status!==a.ADDED||!0!==e.accepted)throw new Error("This file can't be queued because it has already been processed or was rejected.");if(e.status=a.QUEUED,this.options.autoProcessQueue)return setTimeout((()=>this.processQueue()),0)}_enqueueThumbnail(e){if(this.options.createImageThumbnails&&e.type.match(/image.*/)&&e.size<=1048576*this.options.maxThumbnailFilesize)return this._thumbnailQueue.push(e),setTimeout((()=>this._processThumbnailQueue()),0)}_processThumbnailQueue(){if(this._processingThumbnail||0===this._thumbnailQueue.length)return;this._processingThumbnail=!0;let e=this._thumbnailQueue.shift();return this.createThumbnail(e,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,!0,(t=>(this.emit("thumbnail",e,t),this._processingThumbnail=!1,this._processThumbnailQueue())))}removeFile(e){if(e.status===a.UPLOADING&&this.cancelUpload(e),this.files=u(this.files,e),this.emit("removedfile",e),0===this.files.length)return this.emit("reset")}removeAllFiles(e){null==e&&(e=!1);for(let t of this.files.slice())(t.status!==a.UPLOADING||e)&&this.removeFile(t);return null}resizeImage(e,t,n,r,o){return this.createThumbnail(e,t,n,r,!0,((t,n)=>{if(null==n)return o(e);{let{resizeMimeType:t}=this.options;null==t&&(t=e.type);let r=n.toDataURL(t,this.options.resizeQuality);return"image/jpeg"!==t&&"image/jpg"!==t||(r=p.restore(e.dataURL,r)),o(a.dataURItoBlob(r))}}))}createThumbnail(e,t,n,r,o,i){let s=new FileReader;s.onload=()=>{e.dataURL=s.result,"image/svg+xml"!==e.type?this.createThumbnailFromUrl(e,t,n,r,o,i):null!=i&&i(s.result)},s.readAsDataURL(e)}displayExistingFile(e,t,n,r,o=!0){if(this.emit("addedfile",e),this.emit("complete",e),o){let o=t=>{this.emit("thumbnail",e,t),n&&n()};e.dataURL=t,this.createThumbnailFromUrl(e,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,this.options.fixOrientation,o,r)}else this.emit("thumbnail",e,t),n&&n()}createThumbnailFromUrl(e,t,n,r,o,i,s){let l=document.createElement("img");return s&&(l.crossOrigin=s),o="from-image"!=getComputedStyle(document.body).imageOrientation&&o,l.onload=()=>{let s=e=>e(1);return"undefined"!=typeof EXIF&&null!==EXIF&&o&&(s=e=>EXIF.getData(l,(function(){return e(EXIF.getTag(this,"Orientation"))}))),s((o=>{e.width=l.width,e.height=l.height;let s=this.options.resize.call(this,e,t,n,r),a=document.createElement("canvas"),u=a.getContext("2d");switch(a.width=s.trgWidth,a.height=s.trgHeight,o>4&&(a.width=s.trgHeight,a.height=s.trgWidth),o){case 2:u.translate(a.width,0),u.scale(-1,1);break;case 3:u.translate(a.width,a.height),u.rotate(Math.PI);break;case 4:u.translate(0,a.height),u.scale(1,-1);break;case 5:u.rotate(.5*Math.PI),u.scale(1,-1);break;case 6:u.rotate(.5*Math.PI),u.translate(0,-a.width);break;case 7:u.rotate(.5*Math.PI),u.translate(a.height,-a.width),u.scale(-1,1);break;case 8:u.rotate(-.5*Math.PI),u.translate(-a.height,0)}c(u,l,null!=s.srcX?s.srcX:0,null!=s.srcY?s.srcY:0,s.srcWidth,s.srcHeight,null!=s.trgX?s.trgX:0,null!=s.trgY?s.trgY:0,s.trgWidth,s.trgHeight);let d=a.toDataURL("image/png");if(null!=i)return i(d,a)}))},null!=i&&(l.onerror=i),l.src=e.dataURL}processQueue(){let{parallelUploads:e}=this.options,t=this.getUploadingFiles().length,n=t;if(t>=e)return;let r=this.getQueuedFiles();if(r.length>0){if(this.options.uploadMultiple)return this.processFiles(r.slice(0,e-t));for(;nt.xhr===e)).map((e=>e))}cancelUpload(e){if(e.status===a.UPLOADING){let t=this._getFilesWithXhr(e.xhr);for(let e of t)e.status=a.CANCELED;void 0!==e.xhr&&e.xhr.abort();for(let e of t)this.emit("canceled",e);this.options.uploadMultiple&&this.emit("canceledmultiple",t)}else e.status!==a.ADDED&&e.status!==a.QUEUED||(e.status=a.CANCELED,this.emit("canceled",e),this.options.uploadMultiple&&this.emit("canceledmultiple",[e]));if(this.options.autoProcessQueue)return this.processQueue()}resolveOption(e,...t){return"function"==typeof e?e.apply(this,t):e}uploadFile(e){return this.uploadFiles([e])}uploadFiles(e){this._transformFiles(e,(t=>{if(this.options.chunking){let n=t[0];e[0].upload.chunked=this.options.chunking&&(this.options.forceChunking||n.size>this.options.chunkSize),e[0].upload.totalChunkCount=Math.ceil(n.size/this.options.chunkSize)}if(e[0].upload.chunked){let n=e[0],r=t[0],o=0;n.upload.chunks=[];let i=()=>{let t=0;for(;void 0!==n.upload.chunks[t];)t++;if(t>=n.upload.totalChunkCount)return;o++;let i=t*this.options.chunkSize,s=Math.min(i+this.options.chunkSize,r.size),l={name:this._getParamName(0),data:r.webkitSlice?r.webkitSlice(i,s):r.slice(i,s),filename:n.upload.filename,chunkIndex:t};n.upload.chunks[t]={file:n,index:t,dataBlock:l,status:a.UPLOADING,progress:0,retries:0},this._uploadData(e,[l])};if(n.upload.finishedChunkUpload=(t,r)=>{let o=!0;t.status=a.SUCCESS,t.dataBlock=null,t.response=t.xhr.responseText,t.responseHeaders=t.xhr.getAllResponseHeaders(),t.xhr=null;for(let e=0;e{this._finished(e,r,null)}))},this.options.parallelChunkUploads)for(let e=0;e{this._finishedUploading(e,n,t)},n.ontimeout=()=>{this._handleUploadError(e,n,`Request timedout after ${this.options.timeout/1e3} seconds`)},n.onerror=()=>{this._handleUploadError(e,n)},(null!=n.upload?n.upload:n).onprogress=t=>this._updateFilesUploadProgress(e,n,t);let s=this.options.defaultHeaders?{Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"}:{};this.options.binaryBody&&(s["Content-Type"]=e[0].type),this.options.headers&&r(s,this.options.headers);for(let e in s){let t=s[e];t&&n.setRequestHeader(e,t)}if(this.options.binaryBody){for(let t of e)this.emit("sending",t,n);this.options.uploadMultiple&&this.emit("sendingmultiple",e,n),this.submitRequest(n,null,e)}else{let r=new FormData;if(this.options.params){let t=this.options.params;"function"==typeof t&&(t=t.call(this,e,n,e[0].upload.chunked?this._getChunk(e[0],n):null));for(let e in t){let n=t[e];if(Array.isArray(n))for(let t=0;t{n[o]=i,++r===e.length&&t(n)}))}_addFormElementData(e){if("FORM"===this.element.tagName)for(let t of this.element.querySelectorAll("input, textarea, select, button")){let n=t.getAttribute("name"),r=t.getAttribute("type");if(r&&(r=r.toLowerCase()),null!=n)if("SELECT"===t.tagName&&t.hasAttribute("multiple"))for(let r of t.options)r.selected&&e.append(n,r.value);else(!r||"checkbox"!==r&&"radio"!==r||t.checked)&&e.append(n,t.value)}}_updateFilesUploadProgress(e,t,n){if(e[0].upload.chunked){let r=e[0],o=this._getChunk(r,t);n?(o.progress=100*n.loaded/n.total,o.total=n.total,o.bytesSent=n.loaded):(o.progress=100,o.bytesSent=o.total),r.upload.progress=0,r.upload.total=0,r.upload.bytesSent=0;for(let e=0;ethis.options.renameFilename.call(this,e.name,e)),"string"==typeof this.options.method&&(this.options.method=this.options.method.toUpperCase()),(n=this.getExistingFallback())&&n.parentNode&&n.parentNode.removeChild(n),!1!==this.options.previewsContainer&&(this.options.previewsContainer?this.previewsContainer=a.getElement(this.options.previewsContainer,"previewsContainer"):this.previewsContainer=this.element),this.options.clickable&&(!0===this.options.clickable?this.clickableElements=[this.element]:this.clickableElements=a.getElements(this.options.clickable,"clickable")),this.init()}}a.initClass(),a.options={},a.optionsForElement=function(e){return e.getAttribute("id")?a.options[d(e.getAttribute("id"))]:void 0},a.instances=[],a.forElement=function(e){if("string"==typeof e&&(e=document.querySelector(e)),null==(null!=e?e.dropzone:void 0))throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");return e.dropzone},a.discover=function(){let e;if(document.querySelectorAll)e=document.querySelectorAll(".dropzone");else{e=[];let t=t=>(()=>{let n=[];for(let r of t)/(^| )dropzone($| )/.test(r.className)?n.push(e.push(r)):n.push(void 0);return n})();t(document.getElementsByTagName("div")),t(document.getElementsByTagName("form"))}return(()=>{let t=[];for(let n of e)!1!==a.optionsForElement(n)?t.push(new a(n)):t.push(void 0);return t})()},a.blockedBrowsers=[/opera.*(Macintosh|Windows Phone).*version\/12/i],a.isBrowserSupported=function(){let e=!0;if(window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if("classList"in document.createElement("a")){void 0!==a.blacklistedBrowsers&&(a.blockedBrowsers=a.blacklistedBrowsers);for(let t of a.blockedBrowsers)if(t.test(navigator.userAgent)){e=!1;continue}}else e=!1;else e=!1;return e},a.dataURItoBlob=function(e){let t=atob(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],r=new ArrayBuffer(t.length),o=new Uint8Array(r);for(let e=0,n=t.length,r=0<=n;r?e<=n:e>=n;r?e++:e--)o[e]=t.charCodeAt(e);return new Blob([r],{type:n})};const u=(e,t)=>e.filter((e=>e!==t)).map((e=>e)),d=e=>e.replace(/[\-_](\w)/g,(e=>e.charAt(1).toUpperCase()));a.createElement=function(e){let t=document.createElement("div");return t.innerHTML=e,t.childNodes[0]},a.elementInside=function(e,t){if(e===t)return!0;for(;e=e.parentNode;)if(e===t)return!0;return!1},a.getElement=function(e,t){let n;if("string"==typeof e?n=document.querySelector(e):null!=e.nodeType&&(n=e),null==n)throw new Error(`Invalid \`${t}\` option provided. Please provide a CSS selector or a plain HTML element.`);return n},a.getElements=function(e,t){let n,r;if(e instanceof Array){r=[];try{for(n of e)r.push(this.getElement(n,t))}catch(e){r=null}}else if("string"==typeof e)for(n of(r=[],document.querySelectorAll(e)))r.push(n);else null!=e.nodeType&&(r=[e]);if(null==r||!r.length)throw new Error(`Invalid \`${t}\` option provided. Please provide a CSS selector, a plain HTML element or a list of those.`);return r},a.confirm=function(e,t,n){return window.confirm(e)?t():null!=n?n():void 0},a.isValidFile=function(e,t){if(!t)return!0;t=t.split(",");let n=e.type,r=n.replace(/\/.*$/,"");for(let o of t)if(o=o.trim(),"."===o.charAt(0)){if(-1!==e.name.toLowerCase().indexOf(o.toLowerCase(),e.name.length-o.length))return!0}else if(/\/\*$/.test(o)){if(r===o.replace(/\/.*$/,""))return!0}else if(n===o)return!0;return!1},"undefined"!=typeof jQuery&&null!==jQuery&&(jQuery.fn.dropzone=function(e){return this.each((function(){return new a(this,e)}))}),a.ADDED="added",a.QUEUED="queued",a.ACCEPTED=a.QUEUED,a.UPLOADING="uploading",a.PROCESSING=a.UPLOADING,a.CANCELED="canceled",a.ERROR="error",a.SUCCESS="success";var c=function(e,t,n,r,o,i,s,l,a,u){let d=function(e){e.naturalWidth;let t=e.naturalHeight,n=document.createElement("canvas");n.width=1,n.height=t;let r=n.getContext("2d");r.drawImage(e,0,0);let{data:o}=r.getImageData(1,0,1,t),i=0,s=t,l=t;for(;l>i;)0===o[4*(l-1)+3]?s=l:i=l,l=s+i>>1;let a=l/t;return 0===a?1:a}(t);return e.drawImage(t,n,r,o,i,s,l,a,u/d)};class p{static initClass(){this.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}static encode64(e){let t,n,r,o,i,s="",l="",a="",u=0;for(;t=e[u++],n=e[u++],l=e[u++],r=t>>2,o=(3&t)<<4|n>>4,i=(15&n)<<2|l>>6,a=63&l,isNaN(n)?i=a=64:isNaN(l)&&(a=64),s=s+this.KEY_STR.charAt(r)+this.KEY_STR.charAt(o)+this.KEY_STR.charAt(i)+this.KEY_STR.charAt(a),t=n=l="",r=o=i=a="",ue.length)break}return n}static decode64(e){let t,n,r,o,i,s="",l="",a=0,u=[];for(/[^A-Za-z0-9\+\/\=]/g.exec(e)&&console.warn("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\nExpect errors in decoding."),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");r=this.KEY_STR.indexOf(e.charAt(a++)),o=this.KEY_STR.indexOf(e.charAt(a++)),i=this.KEY_STR.indexOf(e.charAt(a++)),l=this.KEY_STR.indexOf(e.charAt(a++)),t=r<<2|o>>4,n=(15&o)<<4|i>>2,s=(3&i)<<6|l,u.push(t),64!==i&&u.push(n),64!==l&&u.push(s),t=n=s="",r=o=i=l="",ae.execCommand(f),priority:80},n.getParam("editorIdentifier")).addCommandWithUrlTest(f,/^\[file_link/),n.addCommand(f,(()=>{(0,i.default)(`#${n.id}`).entwine("ss").openLinkFileDialog()}))}},m="insert-link__dialog-wrapper--file",g=(0,a.loadComponent)(l.default);i.default.entwine("ss",(e=>{e("textarea.htmleditor").entwine({openLinkFileDialog(){let t=e(`#${m}`);t.length||(t=e(`
`),e("body").append(t)),t.addClass("insert-link__dialog-wrapper"),t.setElement(this),t.open()}}),e(`.js-injector-boot #${m}`).entwine({ReactRoot:null,renderModal(e){var t=this;const{dispatch:n}=a.default.reducer.store;n(u.initFormStack("insert-link","admin"));const i=this.getOriginalAttributes(),s=this.getFolderId(),l=this.getRequireLinkText();let d=this.getReactRoot();d||(d=(0,o.createRoot)(this[0]),this.setReactRoot(d)),d.render(r.default.createElement(g,{isOpen:e,type:"insert-link",folderId:s,onInsert:function(){return t.handleInsert(...arguments)},onClosed:()=>{n(u.reset()),this.close()},title:!1,bodyClassName:"modal__dialog",className:"insert-link__dialog-wrapper--internal",fileAttributes:i,requireLinkText:l}))},buildAttributes(e){return{href:`${s.default.serialise({name:"file_link",properties:{id:e.ID}},!0)}${e.Anchor&&e.Anchor.length?`#${e.Anchor}`:""}`,target:e.TargetBlank?"_blank":"",title:e.Description}},getFolderId(){const e=this.getElement();if(!e)return null;const t=Number(e.data("config").upload_folder_id);return isNaN(t)?null:t},getOriginalAttributes(){const t=this.getElement().getEditor(),n=e(t.getSelectedNode()),r=(n.attr("href")||"").split("#");if(!r[0])return{};const o=s.default.match("file_link",!1,r[0]);return o?{ID:o.properties.id?parseInt(o.properties.id,10):0,Anchor:r[1]||"",Description:n.attr("title"),TargetBlank:!!n.attr("target")}:{}}})})),tinymce.PluginManager.add(f,(e=>h.init(e)))}()}(); \ No newline at end of file +!function(){var e={853:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=u(n(5815)),i=u(n(3724)),s=u(n(1669)),l=n(5716),a=u(n(6935));function u(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}let c=0;class p extends r.Component{constructor(e){super(e),this.dropzone=null,this.dragging=!1,this.handleAccept=this.handleAccept.bind(this),this.handleAddedFile=this.handleAddedFile.bind(this),this.handleDragEnter=this.handleDragEnter.bind(this),this.handleDragLeave=this.handleDragLeave.bind(this),this.handleDrop=this.handleDrop.bind(this),this.handleUploadProgress=this.handleUploadProgress.bind(this),this.handleUploadComplete=this.handleUploadComplete.bind(this),this.handleError=this.handleError.bind(this),this.handleSending=this.handleSending.bind(this),this.handleSuccess=this.handleSuccess.bind(this),this.handleQueueComplete=this.handleQueueComplete.bind(this),this.loadImage=this.loadImage.bind(this),this.handleMaxFilesExceeded=this.handleMaxFilesExceeded.bind(this)}componentDidMount(){this.dropzone=new i.default(this.dropzoneRef,Object.assign({},this.getDefaultOptions(),this.props.options));const{name:e}=this.props;e&&this.dropzone.hiddenFileInput&&this.dropzone.hiddenFileInput.classList.add(`dz-input-${e}`),void 0!==this.props.promptOnRemove&&this.setPromptOnRemove(this.props.promptOnRemove)}componentDidUpdate(e){const{name:t}=this.props;t&&this.dropzone.hiddenFileInput&&this.dropzone.hiddenFileInput.classList.add(`dz-input-${t}`),this.props.canUpload&&e.options!==this.props.options&&this.dropzone&&(this.dropzone.enable(),this.dropzone.options=Object.assign({},this.getDefaultOptions(),this.dropzone.options,this.props.options))}componentWillUnmount(){this.dropzone.files=[],this.dropzone.destroy()}getDefaultOptions(){let e=null,t=this.props.uploadSelector;if(!t&&this.props.uploadButton&&(t=".asset-dropzone__upload-button"),t){const n=(0,s.default)(this.dropzoneRef).find(t);n&&n.length&&(e=n.toArray())}return{accept:this.handleAccept,addedfile:this.handleAddedFile,dragenter:this.handleDragEnter,dragleave:this.handleDragLeave,drop:this.handleDrop,maxfilesexceeded:this.handleMaxFilesExceeded,uploadprogress:this.handleUploadProgress,complete:this.handleUploadComplete,dictDefaultMessage:o.default._t("AssetAdmin.DROPZONE_DEFAULT_MESSAGE","Drop files here to upload"),dictFallbackMessage:o.default._t("AssetAdmin.DROPZONE_FALLBACK_MESSAGE","Your browser does not support drag'n'drop file uploads."),dictFallbackText:o.default._t("AssetAdmin.DROPZONE_FALLBACK_TEXT","Please use the fallback form below to upload your files like in the olden days."),dictInvalidFileType:o.default._t("AssetAdmin.DROPZONE_INVALID_FILE_TYPE","You can't upload files of this type."),dictResponseError:o.default._t("AssetAdmin.DROPZONE_RESPONSE_ERROR","Server responded with an error."),dictCancelUpload:o.default._t("AssetAdmin.DROPZONE_CANCEL_UPLOAD","Cancel upload"),dictCancelUploadConfirmation:o.default._t("AssetAdmin.DROPZONE_CANCEL_UPLOAD_CONFIRMATION","Are you sure you want to cancel this upload?"),dictRemoveFile:o.default._t("AssetAdmin.DROPZONE_REMOVE_FILE","Remove file"),dictMaxFilesExceeded:o.default._t("AssetAdmin.DROPZONE_MAX_FILES_EXCEEDED","You can not upload any more files."),error:this.handleError,sending:this.handleSending,success:this.handleSuccess,queuecomplete:this.handleQueueComplete,thumbnailHeight:150,thumbnailWidth:200,timeout:0,clickable:e}}getFileCategory(e){return e.split("/")[0]}getLoadPreview(e){return new Promise((t=>{const n=new FileReader;n.onload=n=>{if("image"===this.getFileCategory(e.type)){const e=new Image;t(this.loadImage(e,n.target.result))}else t({})},n.readAsDataURL(e)}))}getFileTitle(e){return e.replace(/[.][^.]+$/,"").replace(/-_/," ")}setPromptOnRemove(e){this.dropzone.options.dictRemoveFileConfirmation=e}handleDragEnter(e){this.props.canUpload&&(this.dragging=!0,this.forceUpdate(),"function"==typeof this.props.onDragEnter&&this.props.onDragEnter(e))}handleDragLeave(e){const t=this.dropzoneRef;this.props.canUpload&&e.target===t&&(this.dragging=!1,this.forceUpdate(),"function"==typeof this.props.onDragLeave&&this.props.onDragLeave(e,t))}handleUploadProgress(e,t,n){"function"==typeof this.props.onUploadProgress&&this.props.onUploadProgress(e,t,n)}handleUploadComplete(e){"function"==typeof this.props.onUploadComplete&&this.props.onUploadComplete(e.status)}handleDrop(e){this.dragging=!1,this.forceUpdate(),"function"==typeof this.props.onDrop&&this.props.onDrop(e)}handleSending(e,t,n){"function"==typeof this.props.updateFormData&&this.props.updateFormData(n),n.append("SecurityID",this.props.securityID),n.append("ParentID",this.props.folderId);const r=Object.assign({},t,{abort:()=>{this.dropzone.cancelUpload(e),t.abort()}});"function"==typeof this.props.onSending&&this.props.onSending(e,r,n)}handleMaxFilesExceeded(e){return"function"!=typeof this.props.onMaxFilesExceeded||this.props.onMaxFilesExceeded(e)}generateQueuedId(){return c+=1,c}handleAccept(e,t){return("function"!=typeof this.props.canFileUpload||this.props.canFileUpload(e))&&this.props.canUpload?t():t(o.default._t("AssetAdmin.DROPZONE_CANNOT_UPLOAD","Uploading not permitted."))}handleAddedFile(e){e._queuedId=this.generateQueuedId();const t={category:this.getFileCategory(e.type),filename:e.name,queuedId:e._queuedId,size:e.size,title:this.getFileTitle(e.name),extension:(0,l.getFileExtension)(e.name),type:e.type,uploadedToFolderId:this.props.folderId};this.props.onAddedFile(t);return this.getLoadPreview(e).then((e=>{const n={height:e.height,width:e.width,url:e.thumbnailURL,thumbnail:e.thumbnailURL,smallThumbnail:e.thumbnailURL};return"function"==typeof this.props.onPreviewLoaded&&this.props.onPreviewLoaded(t,n),{...t,...n}}))}loadImage(e,t){return new Promise((n=>{const r=document.createElement("canvas"),o=r.getContext("2d");e.onload=()=>{const t=2*this.props.preview.width,i=2*this.props.preview.height,s=e.naturalWidth/e.naturalHeight;e.naturalWidth{this.dropzoneRef=e}},this.props.uploadButton&&r.default.createElement("button",t,o.default._t("AssetAdmin.DROPZONE_UPLOAD")),this.props.children)}}p.propTypes={folderId:a.default.number.isRequired,onAccept:a.default.func,onAddedFile:a.default.func.isRequired,onDragEnter:a.default.func,onDragLeave:a.default.func,onDrop:a.default.func,onError:a.default.func.isRequired,onPreviewLoaded:a.default.func,onSending:a.default.func,onSuccess:a.default.func.isRequired,onMaxFilesExceeded:a.default.func,updateFormData:a.default.func,canFileUpload:a.default.func,onQueueComplete:a.default.func,options:a.default.shape({url:a.default.string.isRequired}),promptOnRemove:a.default.string,securityID:a.default.string.isRequired,uploadButton:a.default.bool,uploadSelector:a.default.string,canUpload:a.default.bool.isRequired,preview:a.default.shape({width:a.default.number,height:a.default.number}),className:a.default.string},p.defaultProps={uploadButton:!0};t.default=p},3229:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=c(n(5815)),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=n(9040),s=n(5207),l=n(3556),a=c(n(6923)),u=c(n(6935));function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}function c(e){return e&&e.__esModule?e:{default:e}}class p extends o.Component{constructor(e){super(e),this.handleChangeValue=this.handleChangeValue.bind(this),this.renderChild=this.renderChild.bind(this)}getOptionByValue(e){return this.props.actions.find((t=>t.value===e))}handleChangeValue(e){let t=null;const n=this.getOptionByValue(e.target.value);return null===n?null:(t="function"==typeof n.confirm?n.confirm(this.props.items).then((()=>n.callback(e,this.props.items))).catch((e=>{if("cancelled"!==e)throw e})):n.callback(e,this.props.items)||Promise.resolve(),t)}renderChild(e,t){const n=(0,a.default)("bulk-actions__action",e.className||"font-icon-info-circled",{btn:t<2,"bulk-actions__action--more":t>2});return t<2?o.default.createElement(l.Button,{className:n,key:e.value,onClick:this.handleChangeValue,value:e.value,color:e.color},e.label):o.default.createElement(l.DropdownItem,{type:"button",className:n,key:e.value,onClick:this.handleChangeValue,value:e.value},e.label)}render(){if(!this.props.items.length)return null;let e=this.props.actions.filter((e=>!e.canApply||e.canApply(this.props.items)));if(e=e.map(this.renderChild),!e.length)return null;const{ActionMenu:t,showCount:n}=this.props,i=r.default._t("AssetAdmin.BULK_ACTIONS_SELECT_ALL","Select all"),s=r.default.sprintf(r.default._t("AssetAdmin.BULK_ACTIONS_SELECTED","%s selected"),this.props.items.length),a=r.default._t("AssetAdmin.BULK_ACTIONS_CLEAR_SELECTION","Clear selection");return o.default.createElement("div",{className:"bulk-actions fieldholder-small"},n&&o.default.createElement(o.default.Fragment,null,o.default.createElement(l.Button,{className:"bulk-actions-counter font-icon-cross-mark",onClick:this.props.onClearSelection,title:a},s),o.default.createElement("div",{className:"bulk-actions-select-all"},o.default.createElement(l.Button,{onClick:this.props.onSelectAll},i))),e.slice(0,2),e.length>2&&t?o.default.createElement(t,{id:"BulkActions",className:"bulk-actions__more-actions-menu"},e.slice(2)):e.slice(2))}}t.Component=p,p.propTypes={items:u.default.array,actions:u.default.arrayOf(u.default.shape({value:u.default.string.isRequired,label:u.default.string.isRequired,className:u.default.string,destructive:u.default.bool,callback:u.default.func,canApply:u.default.func,confirm:u.default.func})),ActionMenu:u.default.elementType,showCount:u.default.bool,onClearSelection:u.default.func.isRequired,onSelectAll:u.default.func.isRequired},p.defaultProps={items:[],actions:[],ActionMenu:null,total:null,showCount:!0,totalReachedMessage:r.default._t("")};const h=(0,i.connect)((function(e){return{gallery:e.assetAdmin.gallery}}))(p);t.default=(0,s.inject)(["ActionMenu"],(e=>({ActionMenu:e})),(()=>"BulkActions"))(h)},1037:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Folder=t.File=t.Component=void 0;var r=S(n(5815)),o=C(n(1594)),i=S(n(6923)),s=S(n(6379)),l=S(n(6022)),a=S(n(2063)),u=S(n(2932)),d=S(n(2926)),c=S(n(1990)),p=S(n(4350)),h=n(9040),f=n(9367),m=n(4172),g=C(n(769)),y=S(n(1838)),v=S(n(6935));function b(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(b=function(e){return e?n:t})(e)}function C(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=b(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function S(e){return e&&e.__esModule?e:{default:e}}function E(){return E=Object.assign?Object.assign.bind():function(e){for(var t=1;t{e.preventDefault()};class x extends o.Component{constructor(e){super(e),this.handleSelect=this.handleSelect.bind(this),this.handleActivate=this.handleActivate.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancelUpload=this.handleCancelUpload.bind(this)}componentDidUpdate(){_(this.props)&&this.props.actions.imageLoad.loadImage(this.props.item.thumbnail,this.props.sectionConfig.imageRetry)}getThumbnailStyles(){const{item:{thumbnail:e,version:t},bustCache:n}=this.props;if(!this.isImage()||!e||this.missing())return{};const r=!1===n||!t||e.startsWith("data:image/")?e:`${e}?vid=${t}`;switch(this.props.loadState){case y.default.SUCCESS:case y.default.DISABLED:return{backgroundImage:`url(${r})`};default:return{}}}getErrorMessage(){let e=null;const{item:t,loadState:n}=this.props;if(this.hasError()?e=t.message.value:this.missing()?e=r.default._t("AssetAdmin.FILE_MISSING","File cannot be found"):n===y.default.FAILED&&(e=r.default._t("AssetAdmin.FILE_LOAD_ERROR","Thumbnail not available")),null!==e){return e=this.getItemFunction("updateErrorMessage")(e,this.props),o.default.createElement("span",{className:"gallery-item__error-message"},e)}return null}getThumbnailClassNames(){const e=["gallery-item__thumbnail"];switch(this.isImageSmallerThanThumbnail()&&e.push("gallery-item__thumbnail--small"),!this.props.item.thumbnail&&this.isImage()&&e.push("gallery-item__thumbnail--no-preview"),this.props.loadState){case y.default.LOADING:case y.default.WAITING:e.push("gallery-item__thumbnail--loading");break;case y.default.FAILED:e.push("gallery-item__thumbnail--error")}return e.join(" ")}getItemClassNames(){const e=this.props.item.category||"false",t=this.props.selectable&&(this.props.item.selected||this.props.isDragging);return(0,i.default)({"gallery-item":!0,[`gallery-item--${e}`]:!0,"gallery-item--max-selected":this.props.maxSelected&&!t,"gallery-item--missing":this.missing(),"gallery-item--selectable":this.props.selectable,"gallery-item--selected":t,"gallery-item--dropping":this.props.isDropping,"gallery-item--highlighted":this.props.item.highlighted,"gallery-item--error":this.hasError(),"gallery-item--dragging":this.props.isDragging})}getItemFunction(e){const{item:t}=this.props;return"function"==typeof t[e]?t[e]:this.props[e]}getStatusFlags(){let e=[];const{item:t}=this.props;"folder"!==t.type&&(t.draft?e.push({key:"status-draft",title:r.default._t("File.DRAFT","Draft"),className:"gallery-item--draft"}):t.modified&&e.push({key:"status-modified",title:r.default._t("File.MODIFIED","Modified"),className:"gallery-item--modified"}));return e=this.getItemFunction("updateStatusFlags")(e,this.props),o.default.createElement("div",{className:"gallery-item__status-flags"},e.map((e=>o.default.createElement("span",e))))}getStatusIcons(){const{item:e}=this.props,t=[];return e.hasRestrictedAccess&&t.push({key:"status-restricted",fileID:e.id,hasRestrictedAccess:!0,placement:"top",disableTooltip:"folder"===e.type,includeBackground:"folder"!==e.type}),e.isTrackedFormUpload&&"folder"!==e.type&&t.push({key:"status-tracked-form-upload",fileID:e.id,isTrackedFormUpload:!0,hasRestrictedAccess:e.hasRestrictedAccess,placement:"top",includeBackground:!0}),o.default.createElement("div",{className:"gallery-item__status-icons"},t.map((e=>o.default.createElement(c.default,e))))}getProgressBar(){let e=null;const{item:t}=this.props,n={className:"gallery-item__progress-bar",style:{width:`${t.progress}%`}};this.hasError()||!this.uploading()||this.complete()||(e=o.default.createElement("div",{className:"gallery-item__upload-progress"},o.default.createElement("div",n)));return e=this.getItemFunction("updateProgressBar")(e,this.props),e}isImageSmallerThanThumbnail(){if(!this.isImage()||this.missing())return!1;const e=this.props.item.width,t=this.props.item.height;return t&&e&&t0}missing(){return!this.exists()&&this.saved()}uploading(){return this.props.item.queuedId&&!this.saved()}exists(){return this.props.item.exists}isImage(){return"image"===this.props.item.category}canBatchSelect(){return this.props.selectable&&this.props.item.canEdit}hasError(){let e=!1;return this.props.item.message&&(e="error"===this.props.item.message.type),e}handleActivate(e){e.stopPropagation(),"function"==typeof this.props.onActivate&&this.saved()&&this.props.onActivate(e,this.props.item)}handleSelect(e){e.stopPropagation(),e.preventDefault(),"function"==typeof this.props.onSelect&&this.props.onSelect(e,this.props.item)}handleKeyDown(e){s.default.SPACE_KEY_CODE===e.keyCode&&(e.preventDefault(),this.canBatchSelect()&&this.handleSelect(e)),s.default.RETURN_KEY_CODE===e.keyCode&&this.handleActivate(e)}handleCancelUpload(e){e.stopPropagation(),e.preventDefault(),this.hasError()?this.props.onRemoveErroredUpload(this.props.item):this.props.onCancelUpload&&this.props.onCancelUpload(this.props.item)}render(){let e=null,t=null,n=null;const{id:i,queuedId:s}=this.props.item,l=i?`item-${i}`:`queued-${s}`;if(this.props.selectable&&(this.canBatchSelect()&&(e=this.handleSelect),t="font-icon-tick"),this.uploading())e=this.handleCancelUpload,t="font-icon-cancel";else if(this.exists()){const e=r.default._t("AssetAdmin.VIEW","View");n=o.default.createElement("div",{className:"gallery-item--overlay font-icon-eye"},e)}const a=this.props.badge,u={className:"gallery-item__checkbox",type:"checkbox",title:r.default._t("AssetAdmin.SELECT","Select"),tabIndex:-1,onMouseDown:w,id:l},c=["gallery-item__checkbox-label",t];this.canBatchSelect()||(u.disabled=!0,c.push("gallery-item__checkbox-label--disabled"));const p={className:c.join(" "),onClick:e};return o.default.createElement("div",{className:this.getItemClassNames(),"data-id":this.props.item.id,tabIndex:0,role:"button",onKeyDown:this.handleKeyDown,onClick:this.handleActivate},!!a&&o.default.createElement(d.default,{className:"gallery-item__badge",status:a.status,message:a.message}),o.default.createElement("div",{ref:e=>{this.thumbnail=e},className:this.getThumbnailClassNames(),style:this.getThumbnailStyles()},n,this.getStatusFlags(),this.getStatusIcons()),this.getProgressBar(),this.getErrorMessage(),this.props.children,o.default.createElement("div",{className:"gallery-item__title",ref:e=>{this.title=e}},o.default.createElement("label",E({},p,{htmlFor:l}),o.default.createElement("input",u)),this.props.item.title))}}t.Component=x,x.propTypes={sectionConfig:p.default,item:l.default,loadState:v.default.oneOf(Object.values(y.default)),bustCache:v.default.bool,highlighted:v.default.bool,selected:v.default.bool,isDropping:v.default.bool,isDragging:v.default.bool,message:v.default.shape({value:v.default.string,type:v.default.string}),selectable:v.default.bool,onActivate:v.default.func,onSelect:v.default.func,onCancelUpload:v.default.func,onRemoveErroredUpload:v.default.func,badge:v.default.shape({status:v.default.string,message:v.default.string}),updateStatusFlags:v.default.func,updateProgressBar:v.default.func,updateErrorMessage:v.default.func},x.defaultProps={item:{},sectionConfig:{imageRetry:{}},updateStatusFlags:e=>e,updateProgressBar:e=>e,updateErrorMessage:e=>e,bustCache:!0};const F=(0,h.connect)((function(e,t){const{bustCache:n}=e.config.sections.find((e=>"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"===e.name));let r=y.default.DISABLED;if(_(t)){const n=e.assetAdmin.imageLoad.files.find((e=>t.item.thumbnail===e.url));r=n&&n.status||y.default.NONE}return{bustCache:n,loadState:r}}),(function(e){return{actions:{imageLoad:(0,f.bindActionCreators)(g,e)}}}))(x),A="GalleryItem",O=t.File=(0,m.createSelectable)((0,a.default)(A)(F));t.Folder=(0,m.createSelectable)((0,u.default)(A)(O));t.default=F},2914:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=a(n(6935)),i=n(1820),s=a(n(2926)),l=a(n(1037));function a(e){return e&&e.__esModule?e:{default:e}}function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t1?r.default.createElement("div",{key:"1",className:"gallery-item__drag-shadow"}):null,t>2?r.default.createElement("div",{key:"2",className:"gallery-item__drag-shadow gallery-item__drag-shadow--second"}):null];return r.default.createElement("div",{className:"gallery-item__drag-layer"},r.default.createElement("div",{className:"gallery-item__drag-layer-item",style:this.getOffset()},r.default.createElement("div",{className:"gallery-item__drag-layer-preview"},n,r.default.createElement(l.default,d({},e.props,{isDragging:!0}))),t>1?r.default.createElement(s.default,{className:"gallery-item__drag-layer-count",status:"info",message:`${t}`}):null))}}c.propTypes={item:o.default.object,offset:o.default.shape({x:o.default.number.isRequired,y:o.default.number.isRequired}),isDragging:o.default.bool.isRequired};t.default=(0,i.DragLayer)((e=>({item:e.getItem(),offset:e.getInitialClientOffset(),dragged:e.getDifferenceFromInitialOffset(),isDragging:e.isDragging()})))(c)},2063:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){const t={canDrag(e){return e.canDrag},beginDrag(e){const{id:t}=e.item;"function"==typeof e.onDrag&&e.onDrag(!0,t);const n=e.selectedFiles.concat([]);return n.includes(t)||n.push(t),{selected:n,props:e}},endDrag(e){const{id:t}=e.item;"function"==typeof e.onDrag&&e.onDrag(!1,t)}},n=(0,s.DragSource)(e,t,((e,t)=>({connectDragPreview:e.dragPreview(),connectDragSource:e.dragSource(),isDragging:t.isDragging()})));return e=>{class t extends o.Component{componentDidMount(){this.props.connectDragPreview((0,l.getEmptyImage)(),{captureDraggingState:!0})}render(){const{connectDragSource:t}=this.props,n=o.default.createElement(e,this.props);return"string"==typeof n.type?t(n):t(o.default.createElement("div",{className:"gallery-item__draggable"},n))}}return t.propTypes={connectDragSource:i.default.func.isRequired,connectDragPreview:i.default.func.isRequired,item:i.default.shape({id:i.default.number.isRequired}).isRequired,onDrag:i.default.func,selectedFiles:i.default.arrayOf(i.default.number)},n(t)}};var r,o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=a(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=(r=n(6935))&&r.__esModule?r:{default:r},s=n(1820),l=n(8724);function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(a=function(e){return e?n:t})(e)}},2932:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){const t={drop(e,t){if(t.canDrop()){const n=t.getItem();e.onDropFiles(e.item.id,n.selected)}},canDrop(e,t){return!t.getItem().selected.includes(e.item.id)}},n=(0,s.DropTarget)(e,t,((e,t)=>{const n=t.isOver();return{isDropping:n&&t.canDrop(),connectDropTarget:e.dropTarget(),isOver:n}}));return e=>{class t extends o.Component{render(){const{connectDropTarget:t}=this.props,n=o.default.createElement(e,this.props);return"string"==typeof n.type?t(n):t(o.default.createElement("div",{className:"gallery-item__droppable"},n))}}return t.propTypes={connectDropTarget:i.default.func.isRequired,item:i.default.shape({id:i.default.number.isRequired}).isRequired},n(t)}};var r,o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=(r=n(6935))&&r.__esModule?r:{default:r},s=n(1820);function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}},6379:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o=(r=n(5815))&&r.__esModule?r:{default:r};t.default={ACTIONS:{CREATE_FOLDER:"create-folder",EDIT_FILE:"edit"},MOVE_SUCCESS_DURATION:3e3,CSS_TRANSITION_TIME:300,SMALL_THUMBNAIL_HEIGHT:60,SMALL_THUMBNAIL_WIDTH:60,THUMBNAIL_HEIGHT:150,THUMBNAIL_WIDTH:200,BULK_ACTIONS:[{value:"delete",label:o.default._t("AssetAdmin.BULK_ACTIONS_DELETE","Delete"),className:"font-icon-trash",destructive:!0,callback:null,canApply:e=>e.every((e=>e&&e.canDelete))},{value:"archive",label:o.default._t("AssetAdmin.BULK_ACTIONS_ARCHIVE","Archive"),className:"font-icon-box",destructive:!0,callback:null,canApply:e=>e.every((e=>e&&e.canDelete))},{value:"edit",label:o.default._t("AssetAdmin.BULK_ACTIONS_EDIT","Edit"),className:"font-icon-edit",destructive:!1,canApply:e=>1===e.length,callback:null},{value:"move",label:o.default._t("AssetAdmin.BULK_ACTIONS_MOVE","Move"),className:"font-icon-folder-move",canApply:e=>e.every((e=>e&&e.canEdit)),destructive:!1,callback:null},{value:"publish",label:o.default._t("AssetAdmin.BULK_ACTIONS_PUBLISH","Publish"),className:"font-icon-rocket",destructive:!1,callback:null,canApply:e=>e.some((e=>e&&e.modified))&&e.every((e=>e.canEdit&&"folder"!==e.type)),confirm:null},{value:"unpublish",label:o.default._t("AssetAdmin.BULK_ACTIONS_UNPUBLISH","Unpublish"),className:"font-icon-cancel-circled",destructive:!1,callback:null,canApply:e=>e.some((e=>e.published))&&e.every((e=>e.canEdit&&"folder"!==e.type)),confirm:null},{value:"insert",label:o.default._t("AssetAdmin.BULK_ACTIONS_INSERT","Insert"),className:"font-icon-plus-circled btn-primary",destructive:!1,callback:null,canApply:e=>e.length,confirm:null}],BULK_ACTIONS_PLACEHOLDER:o.default._t("AssetAdmin.BULK_ACTIONS_PLACEHOLDER"),SPACE_KEY_CODE:32,RETURN_KEY_CODE:13,DEFAULT_PREVIEW:"framework/client/dist/images/app_icons/generic_92.png",MODAL_MOVE:"MODAL_MOVE"}},7917:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=I(n(1594)),o=A(n(6935)),i=n(9040),s=n(9367),l=A(n(5609)),a=A(n(5815)),u=A(n(6923)),d=I(n(4201)),c=I(n(8918)),p=I(n(1369)),h=I(n(9517)),f=A(n(1869)),m=A(n(5789)),g=A(n(2294)),y=I(n(6303)),v=A(n(6175)),b=A(n(6379)),C=A(n(4350)),S=A(n(6177)),E=I(n(4461)),_=A(n(8268)),w=A(n(4014)),x=A(n(175)),F=A(n(2308));function A(e){return e&&e.__esModule?e:{default:e}}function O(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(O=function(e){return e?n:t})(e)}function I(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=O(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}class D extends r.Component{constructor(e){super(e),this.handleOpenFile=this.handleOpenFile.bind(this),this.handleCloseFile=this.handleCloseFile.bind(this),this.handleDelete=this.handleDelete.bind(this),this.doPublish=this.doPublish.bind(this),this.doUnpublish=this.doUnpublish.bind(this),this.handleUnpublish=this.handleUnpublish.bind(this),this.handleDoSearch=this.handleDoSearch.bind(this),this.handleClearSearch=this.handleClearSearch.bind(this),this.handleSubmitEditor=this.handleSubmitEditor.bind(this),this.handleOpenFolder=this.handleOpenFolder.bind(this),this.handleSort=this.handleSort.bind(this),this.handleSetPage=this.handleSetPage.bind(this),this.createEndpoint=this.createEndpoint.bind(this),this.handleBackButtonClick=this.handleBackButtonClick.bind(this),this.handleFolderIcon=this.handleFolderIcon.bind(this),this.handleBrowse=this.handleBrowse.bind(this),this.handleViewChange=this.handleViewChange.bind(this),this.handleUpload=this.handleUpload.bind(this),this.handleUploadQueue=this.handleUploadQueue.bind(this),this.handleCreateFolder=this.handleCreateFolder.bind(this),this.handleMoveFilesSuccess=this.handleMoveFilesSuccess.bind(this),this.refetchFolder=this.refetchFolder.bind(this),this.state={loading:!1,folder:null,files:[],totalCount:0,forceRefetch:!1}}componentDidMount(){this.refetchFolder()}componentDidUpdate(e){(this.props.folderId!==e.folderId||this.props.fileId!==e.fileId&&0!==this.props.fileId||this.state.forceRefetch)&&this.refetchFolder(),this.state.forceRefetch&&this.setState({forceRefetch:!1})}getFolderId(){return null!==this.props.folderId?this.props.folderId:this.state.folder?this.state.folder.id:0}refetchFolder(){const e=this.getFolderId(),t=new URLSearchParams(window.location.search),n=[];t.forEach(((e,t)=>{"page"!==t&&"filter"!==t.substring(0,6)&&"sort"!==t.substring(0,4)||n.push(`${t}=${e}`)}));let r="";n.length&&(r=`?${n.join("&")}`);const o=`${S.default.getSection("SilverStripe\\AssetAdmin\\Controller\\AssetAdminOpen").endpoints.read.url}/${e}${r}`;l.default.get(o).then((async e=>{const t=await e.json();this.setState({loading:!1,folder:t,files:t.children.nodes,totalCount:t.children.pageInfo.totalCount})})).catch((async e=>{this.setState({loading:!1,folder:null,files:[],totalCount:0});const t=await(0,w.default)(e);this.props.actions.toasts.error(t)}))}getFiles(){const{queuedFiles:e,folderId:t}=this.props,n=this.state.files,r=[...e.items.filter((e=>!(e.id&&n.find((t=>t.id===e.id))||e.hasOwnProperty("uploadedToFolderId")&&e.uploadedToFolderId!==t))),...n],o=r.filter((e=>"folder"===e.type)),i=r.filter((e=>"folder"!==e.type));return o.concat(i)}handleBrowse(e,t,n){"function"==typeof this.props.onBrowse&&(this.props.onBrowse(e,t,n),this.setState({forceRefetch:!0})),e!==this.getFolderId()&&this.props.actions.gallery.deselectFiles()}handleSetPage(e){this.handleBrowse(this.getFolderId(),this.props.fileId,Object.assign({},this.props.query,{page:e})),this.setState({forceRefetch:!0})}handleDoSearch(e){this.props.actions.gallery.deselectFiles(),this.props.actions.queuedFiles.purgeUploadQueue(),this.handleBrowse(e.currentFolderOnly?this.getFolderId():0,null,{filter:e,view:this.props.query.view})}handleClearSearch(e){this.props.actions.displaySearch.closeSearch(),this.props.actions.gallery.deselectFiles(),this.props.actions.queuedFiles.purgeUploadQueue(),this.refetchFolder();const t=this.state.folder;this.handleOpenFolder(e,t)}handleSort(e){this.handleBrowse(this.getFolderId(),this.props.fileId,{...this.props.query,sort:e,limit:void 0,page:void 0}),this.setState({forceRefetch:!0})}handleViewChange(e){this.handleBrowse(this.getFolderId(),this.props.fileId,Object.assign({},this.props.query,{view:e}))}createEndpoint(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return l.default.createEndpointFetcher(Object.assign({},e,t?{defaultData:{SecurityID:this.props.securityId}}:{}))}handleBackButtonClick(e){e.preventDefault(),this.props.actions.gallery.deselectFiles();const t=this.state.folder;t?this.handleOpenFolder(t.parentId||0):this.handleOpenFolder(0)}resetFile(e){e.queuedId&&this.props.actions.queuedFiles.removeQueuedFile(e.queuedId),this.props.fileId===e.id&&this.props.resetFileDetails(this.getFolderId(),e.id,this.props.query)}handleFolderIcon(){this.handleOpenFile(this.getFolderId())}handleOpenFile(e){this.handleBrowse(this.getFolderId(),e,this.props.query)}handleSubmitEditor(e,t,n){let r=null;if("action_insert"===t&&"select"===this.props.type){const t=this.getFiles().find((t=>t.id===parseInt(e.ID,10)));return this.props.onInsertMany(null,[t]),this.setState({forceRefetch:!0}),Promise.resolve()}if("function"==typeof this.props.onSubmitEditor){const o=this.findFile(this.props.fileId);r=this.props.onSubmitEditor(e,t,n,o)}else r=n();if(!r)throw new Error("Promise was not returned for submitting");return this.setState({forceRefetch:!0}),r.then((e=>("action_createfolder"===t?"admin"===this.props.type?this.handleOpenFile(e.record.id):this.handleOpenFolder(this.getFolderId()):"action_save"!==t&&"action_publish"!==t||this.getFolderId()===e.record.parent.id||this.handleBrowse(e.record.parent.id,e.record.id,null),e)))}handleCloseFile(){this.handleBrowse(this.getFolderId(),null,this.props.query)}handleOpenFolder(e){const{page:t,filter:n,...r}=this.props.query;this.handleBrowse(e,null,r)}handleDelete(e){this.props.actions.confirmDeletion.deleting();const t=e.map((e=>{const t=this.findFile(e);if(!t)throw new Error(`File selected for deletion cannot be found: ${e}`);return t.queuedId&&this.props.actions.queuedFiles.removeQueuedFile(t.queuedId),t})).map((e=>e.id)),n=this.state.folder,r=n?n.id:0,o=this.props.sectionConfig.endpoints.delete.url;return l.default.post(o,{ids:t},{"X-SecurityID":S.default.get("SecurityID")}).then((()=>{this.handleBrowse(r,null,this.props.query);this.props.queuedFiles.items.filter((e=>t.includes(e.id))).forEach((e=>{e.queuedId&&this.props.actions.queuedFiles.removeQueuedFile(e.queuedId)}));let e="AssetAdmin.BULK_ACTIONS_DELETE_SUCCESS_02",n="%s folders/files were successfully deleted.";this.props.sectionConfig.filesAreVersioned&&this.props.sectionConfig.archiveFiles&&(e="AssetAdmin.BULK_ACTIONS_ARCHIVE_SUCCESS_02",n="%s folders/files were successfully archived."),this.props.actions.toasts.success(a.default.sprintf(a.default._t(e,n),t.length)),this.props.actions.gallery.deselectFiles(),this.refetchFolder()})).catch((async e=>{const t=await(0,w.default)(e);this.props.actions.toasts.error(t)})).finally((()=>this.props.actions.confirmDeletion.reset()))}doUnpublish(e){const t=e.map((e=>{const t=this.findFile(e);if(!t)throw new Error(`File selected for unpublishing cannot be found: ${e}`);if("folder"===t.type)throw new Error("Cannot unpublish folders");return t})),n=t.map((e=>e.id)),r=n.map((e=>`ids[]=${e}`)).join("&");let o=`${this.props.sectionConfig.endpoints.readLiveOwnerCounts.url}?${r}`;return l.default.get(o).then((async e=>{const t=(await e.json()).filter((e=>e.count>0)),n=t.slice(0,4).map((e=>e.message)),r=t.slice(5).length;let o="";if(r>0&&(o=a.default.inject(a.default._t("AssetAdmin.BULK_OWNED_WARNING_REMAINING","And {count} other file(s)"),{count:r})),n.length){const e=[a.default.inject(a.default._t("AssetAdmin.BULK_OWNED_WARNING_HEADING","{count} file(s) are being used by other published content."),{count:n.length}),...n,o,a.default._t("AssetAdmin.BULK_OWNED_WARNING_FOOTER","Unpublishing will only remove files from the published version of the content. They will remain on the draft version. Unpublish anyway?")].filter((e=>e)).join("\n\n");if(!confirm(e))return Promise.reject()}return Promise.resolve()})).then((()=>(o=this.props.sectionConfig.endpoints.unpublish.url,l.default.post(o,{ids:n},{"X-SecurityID":S.default.get("SecurityID")}).catch((async e=>{const t=await(0,w.default)(e);this.props.actions.toasts.error(t)}))))).then((()=>(this.refetchFolder(),t))).catch((async e=>{const t=await(0,w.default)(e);return this.props.actions.toasts.error(t),[]}))}handleUnpublish(e){return this.doUnpublish(e).then((e=>{const{fileId:t}=this.props;this.refetchFolder().then((()=>{t&&e.find((e=>e.id===t))&&this.props.resetFileDetails(this.getFolderId(),t,this.props.query)}))}))}doPublish(e){const t=e.map((e=>{const t=this.findFile(e);if(!t)throw new Error(`File selected for publishing cannot be found: ${e}`);if("folder"===t.type)throw new Error("Cannot publish folders");return t})),n=t.map((e=>e.id)),r=this.props.sectionConfig.endpoints.publish.url;return l.default.post(r,{ids:n},{"X-SecurityID":S.default.get("SecurityID")}).then((()=>(t.forEach((e=>this.resetFile(e))),this.refetchFolder(),t))).catch((async e=>{const t=await(0,w.default)(e);this.props.actions.toasts.error(t)}))}findFile(e){return this.getFiles().find((t=>t.id===parseInt(e,10)))}handleUpload(){}handleUploadQueue(){this.props.fileId&&this.refetchFolder()}handleCreateFolder(){this.props.onBrowse(this.getFolderId(),null,this.props.query,b.default.ACTIONS.CREATE_FOLDER)}handleMoveFilesSuccess(e,t){this.props.queuedFiles.items.filter((e=>t.includes(e.id))).forEach((e=>{e.queuedId&&this.props.actions.queuedFiles.removeQueuedFile(e.queuedId)})),this.props.actions.gallery.deselectFiles(),this.refetchFolder()}renderGallery(){const{GalleryComponent:e}=this.props,t=this.props.sectionConfig,n=t.endpoints.createFile.url,o=t.endpoints.createFile.method,i=this.props.query&&parseInt(this.props.query.limit||t.limit,10),s=this.props.query&&parseInt(this.props.query.page||1,10),l=this.props.query&&this.props.query.sort,a=this.props.query&&this.props.query.view,u=this.props.query.filter||{},d=this.state.folder,c=this.state.loading;return r.default.createElement(e,{files:this.getFiles(),fileId:this.props.fileId,folderId:this.getFolderId(),folder:d,type:this.props.type,limit:i,page:s,totalCount:this.state.totalCount,view:a,filters:u,createFileApiUrl:n,createFileApiMethod:o,onInsertMany:this.props.onInsertMany,onPublish:this.doPublish,onUnpublish:this.doUnpublish,onOpenFile:this.handleOpenFile,onOpenFolder:this.handleOpenFolder,onSuccessfulUpload:this.handleUpload,onSuccessfulUploadQueue:this.handleUploadQueue,onCreateFolder:this.handleCreateFolder,onMoveFilesSuccess:this.handleMoveFilesSuccess,onClearSearch:this.handleClearSearch,onSort:this.handleSort,onSetPage:this.handleSetPage,onViewChange:this.handleViewChange,sort:l,sectionConfig:t,loading:c,maxFilesSelect:this.props.maxFiles,dialog:this.props.dialog})}renderEditor(){const{sectionConfig:e,viewAction:t,type:n,fileId:o,dialog:i,requireLinkText:s,fileSelected:l,EditorComponent:a}=this.props,{schemaUrl:u,targetId:d}=(0,_.default)({config:e,viewAction:t,folderId:this.getFolderId(),type:n,fileId:o});if(!u)return null;const c=[];s&&c.push({name:"requireLinkText",value:!0}),l&&c.push({name:"fileSelected",value:!0});const p={dialog:i,fileId:d,schemaUrl:u,schemaUrlQueries:c,onClose:this.handleCloseFile,onSubmit:this.handleSubmitEditor,onUnpublish:this.handleUnpublish,addToCampaignSchemaUrl:e.form.addToCampaignForm.schemaUrl};return r.default.createElement(a,p)}render(){const{folderId:e,query:t,getUrl:n,type:o,maxFiles:i,toolbarChildren:s,SearchComponent:l,BulkDeleteConfirmationComponent:a}=this.props;if(null===this.state.folder)return null;const d=Boolean(e||(0,y.hasFilters)(t.filter)),c=this.props.sectionConfig.form.fileSearchForm.schemaUrl,p=t.filter||{},h=(0,u.default)("fill-height asset-admin","select"===o&&{"asset-admin--single-select":1===i,"asset-admin--multi-select":1!==i}),f=(0,y.hasFilters)(t.filter)||this.props.showSearch,m=this.props.actions.displaySearch?this.props.actions.displaySearch.toggleSearch:void 0,b=this.state.folder,C={folder:b,query:t,getUrl:n,onBrowse:this.handleBrowse,onFolderIcon:this.handleFolderIcon};return r.default.createElement("div",{className:h},r.default.createElement(g.default,{showBackButton:d,onBackButtonClick:this.handleBackButtonClick},b&&r.default.createElement(F.default,C),r.default.createElement("div",{className:"asset-admin__toolbar-extra pull-xs-right fill-width vertical-align-items"},r.default.createElement(v.default,{toggled:f,onToggle:m}),s)),f&&r.default.createElement(l,{onSearch:this.handleDoSearch,id:"AssetSearchForm",formSchemaUrl:c,onHide:this.handleClearSearch,displayBehavior:"HIDEABLE",filters:p,name:"name"}),r.default.createElement("div",{className:"flexbox-area-grow fill-width fill-height gallery"},this.renderGallery(),this.renderEditor()),r.default.createElement(a,{onConfirm:this.handleDelete,filesAreVersioned:this.props.sectionConfig.filesAreVersioned,archiveFiles:this.props.sectionConfig.archiveFiles}))}}t.Component=D,D.propTypes={dialog:o.default.bool,sectionConfig:C.default,fileId:o.default.number,folderId:o.default.number,resetFileDetails:o.default.func,onBrowse:o.default.func,onReplaceUrl:o.default.func,onInsertMany:o.default.func,getUrl:o.default.func,query:o.default.shape({sort:o.default.string,limit:o.default.oneOfType([o.default.number,o.default.string]),page:o.default.oneOfType([o.default.number,o.default.string]),filter:o.default.object}),onSubmitEditor:o.default.func,type:o.default.oneOf(["insert-media","insert-link","select","admin"]),queuedFiles:o.default.shape({items:o.default.array.isRequired}),filesTotalCount:o.default.number,loading:o.default.bool,actions:o.default.object,maxFiles:o.default.number,fileSelected:o.default.bool,EditorComponent:o.default.oneOfType([o.default.object,o.default.func]),GalleryComponent:o.default.oneOfType([o.default.object,o.default.func]),SearchComponent:o.default.oneOfType([o.default.object,o.default.func]),BulkDeleteConfirmationComponent:o.default.oneOfType([o.default.object,o.default.func])},D.defaultProps={type:"admin",query:{sort:"",limit:null,page:0,filter:{}},maxFiles:null,EditorComponent:f.default,GalleryComponent:m.default,SearchComponent:y.default,BulkDeleteConfirmationComponent:x.default};t.default=(0,s.compose)((0,i.connect)((function(e,t){const{formSchema:n}=e.assetAdmin.modal;return{securityId:e.config.SecurityID,queuedFiles:e.assetAdmin.queuedFiles,showSearch:e.assetAdmin.displaySearch.isOpen,type:n&&n.type||t.type}}),(function(e){return{actions:{gallery:(0,s.bindActionCreators)(d,e),toasts:(0,s.bindActionCreators)(c,e),displaySearch:(0,s.bindActionCreators)(h,e),queuedFiles:(0,s.bindActionCreators)(p,e),confirmDeletion:(0,s.bindActionCreators)(E,e)}}})))(D)},2308:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=a(n(1594)),o=a(n(6935)),i=a(n(5815)),s=n(6418),l=n(6303);function a(e){return e&&e.__esModule?e:{default:e}}const u=e=>{let{folder:t,query:n,getUrl:o,onBrowse:s,onFolderIcon:a,PlainBreadcrumbComponent:u}=e;const d=function(){for(var e=arguments.length,t=new Array(e),n=0;n{e.preventDefault(),s(...t)}},c=function(){return o&&o(...arguments)},p=[{text:i.default._t("AssetAdmin.FILES","Files"),href:c(0,null,n),onClick:d(0,null,n)}];if(t&&t.id){t.ancestors&&t.ancestors.forEach((e=>{p.push({text:e.title,href:c(e.id,null,n),onClick:d(e.id,null,n)})}));const e=[{className:"icon font-icon-edit-list",onClick:e=>{e.preventDefault(),a()}}];t.hasRestrictedAccess&&e.push({nodeName:"FileStatusIcon",hasRestrictedAccess:!0}),p.push({text:t.title,href:c(t.id,null,n),onClick:d(t.id,null,n),icons:e})}return(0,l.hasFilters)(n.filter)&&p.push({text:i.default._t("LeftAndMain.SEARCHRESULTS","Search results")}),r.default.createElement(u,{multiline:!0,crumbs:p})};u.propTypes={onBrowse:o.default.func,onFolderIcon:o.default.func,getUrl:o.default.func,query:o.default.shape({sort:o.default.string,limit:o.default.oneOfType([o.default.number,o.default.string]),page:o.default.oneOfType([o.default.number,o.default.string]),filter:o.default.object,view:o.default.string}),folder:o.default.shape({id:o.default.number,title:o.default.string,ancestors:o.default.array,parentId:o.default.number,canView:o.default.bool,canEdit:o.default.bool}),PlainBreadcrumbComponent:o.default.oneOfType([o.default.object,o.default.func])},u.defaultProps={PlainBreadcrumbComponent:s.Component};t.default=u},4736:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Component=void 0,t.buildUrl=v,t.default=void 0;var r=g(n(1594)),o=n(8926),i=n(9040),s=g(n(6478)),l=f(n(7917)),a=n(5716),u=f(n(7675)),d=f(n(6379)),c=f(n(4350)),p=n(5125),h=f(n(6935));function f(e){return e&&e.__esModule?e:{default:e}}function m(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(m=function(e){return e?n:t})(e)}function g(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=m(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}const y=Object.keys(d.default.ACTIONS).map((e=>d.default.ACTIONS[e]));function v(e){let{base:t,folderId:n,fileId:r,query:o,action:i}=e;if(i&&-1===y.indexOf(i))throw new Error(`Invalid action provided: ${i}`);let s=null;s=r?(0,p.joinUrlPaths)(t,`show/${n}/${d.default.ACTIONS.EDIT_FILE}/${r}`):n?(0,p.joinUrlPaths)(t,`show/${n}`):t,i===d.default.ACTIONS.CREATE_FOLDER&&(s=(0,p.joinUrlPaths)(t,`show/${n||0}/${i}`));return o&&Object.keys(o).length>0&&(s=`${s}?${u.default.stringify(o)}`),s}class b extends r.Component{constructor(e){super(e),this.handleBrowse=this.handleBrowse.bind(this),this.handleReplaceUrl=this.handleReplaceUrl.bind(this),this.handleResetDetails=this.handleResetDetails.bind(this),this.getUrl=this.getUrl.bind(this)}getUrl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:d.default.ACTIONS.EDIT_FILE;const o=parseInt(e||0,10),i=parseInt(t||0,10),s=o!==this.getFolderId(),l=Object.assign({},n);return(s||l.page<=1)&&delete l.page,v({base:`/${this.props.sectionConfig.reactRoutePath}`,folderId:o,fileId:i,query:l,action:r})}getFolderId(){return this.props.router.params&&this.props.router.params.folderId?parseInt(this.props.router.params.folderId,10):0}getFileId(){return this.props.router.params&&this.props.router.params.fileId?parseInt(this.props.router.params.fileId,10):0}getViewAction(){return this.props.router.params&&this.props.router.params.viewAction?this.props.router.params.viewAction:d.default.ACTIONS.EDIT_FILE}getSectionProps(){return{sectionConfig:this.props.sectionConfig,type:"admin",folderId:this.getFolderId(),viewAction:this.getViewAction(),fileId:this.getFileId(),query:this.getQuery(),getUrl:this.getUrl,onBrowse:this.handleBrowse,onReplaceUrl:this.handleReplaceUrl,resetFileDetails:this.handleResetDetails}}getQuery(){return(0,a.decodeQuery)(this.props.router.location.search)}handleBrowse(e,t,n,r){const o=this.getUrl(e,t,n,r);this.props.router.navigate(o)}handleReplaceUrl(e,t,n,r){const o=this.getUrl(e,t,n,r);this.props.router.navigate(o,{replace:!0})}handleResetDetails(e,t,n){const r=this.getUrl(e,t,n),o=this.getUrl(e,null,n);this.props.router.navigate(o,{replace:!0,state:{reset:!0,resetPath:r}})}render(){const{AssetAdminComponent:e}=this.props,t=this.props.router.location.state;return t&&t&&t.reset?r.default.createElement(o.Navigate,{to:t.resetPath,replace:!0}):this.props.sectionConfig?r.default.createElement(e,this.getSectionProps()):null}}t.Component=b,b.propTypes={sectionConfig:c.default,router:s.routerPropTypes,AssetAdminComponent:h.default.oneOfType([h.default.object,h.default.func])},b.defaultProps={AssetAdminComponent:l.default};t.default=(0,s.default)((0,i.connect)((function(e){return{sectionConfig:e.config.sections.find((e=>"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"===e.name))}}))(b))},2908:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.AssetAdminStateRouter=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=u(n(6935)),i=n(9040),s=n(4736),l=u(n(6379)),a=n(1021);function u(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}const c={folderId:null,fileId:null,query:{},action:l.default.ACTIONS.EDIT_FILE};class p extends r.Component{constructor(e){super(e),this.handleBrowse=this.handleBrowse.bind(this),this.getUrl=this.getUrl.bind(this),this.state=Object.assign({},c,{folderId:e.folderId})}getUrl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l.default.ACTIONS.EDIT_FILE;const o=parseInt(e||0,10),i=parseInt(t||0,10),a=this.getFolderId(),u=o!==a&&null!==a,d=Object.assign({},n);return(u||d.page<=1)&&delete d.page,(0,s.buildUrl)({base:this.props.sectionConfig.reactRoutePath,folderId:o,fileId:i,query:d,action:r})}getFolderId(){return null===this.state.folderId?null:parseInt(this.state.folderId||0,10)}getFileId(){return parseInt(this.state.fileId||this.props.fileId||0,10)}getViewAction(){return this.state.action||l.default.ACTIONS.EDIT_FILE}getSectionProps(){const e=Object.assign({},this.props,{folderId:this.getFolderId(),fileId:this.getFileId(),viewAction:this.getViewAction(),query:this.state.query,getUrl:this.getUrl,onBrowse:this.handleBrowse});return delete e.Component,e}handleBrowse(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l.default.ACTIONS.EDIT_FILE;if(r&&-1===Object.values(l.default.ACTIONS).indexOf(r))throw new Error(`Invalid action provided: ${r}`);this.state.fileId!==t&&this.props.actions.resetFormStack(),this.setState({folderId:e,fileId:t,query:n,action:r})}render(){const e=this.getSectionProps(),t=this.props.Component;return r.default.createElement(t,e)}}function h(e){return{actions:{resetFormStack:()=>e((0,a.resetFormStack)())}}}t.AssetAdminStateRouter=p,p.propTypes={Component:o.default.elementType,sectionConfig:o.default.shape({url:o.default.string.isRequired}).isRequired,fileId:o.default.number};t.default=function(e){return(0,i.connect)((function(t){const n=t.config.sections.find((e=>"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"===e.name));return{Component:e,sectionConfig:n}}),h)(p)}},175:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=C(n(1594)),o=n(9367),i=n(9040),s=v(n(6935)),l=n(5207),a=C(n(4461)),u=C(n(762)),d=C(n(8918)),c=v(n(5815)),p=v(n(6022)),h=v(n(5609)),f=v(n(6177)),m=v(n(4014)),g=v(n(134)),y=v(n(7871));function v(e){return e&&e.__esModule?e:{default:e}}function b(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(b=function(e){return e?n:t})(e)}function C(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=b(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function S(){return S=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{LoadingComponent:t,transition:n,files:o,onModalClose:i,onCancel:s,onConfirm:l,filesAreVersioned:a,archiveFiles:d,actions:p}=e;const[v,b]=(0,r.useState)(!0),[C,S]=(0,r.useState)({});(0,r.useEffect)((()=>{const e=f.default.getSection("SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"),t=o.map((e=>e.id)).map((e=>`ids[]=${e}`)).join("&"),n=`${e.endpoints.readDescendantCounts.url}?${t}`;b(!0),h.default.get(n).then((async e=>{const t=await e.json();b(!1),S(t)})).catch((async e=>{const t=await(0,m.default)(e);p.toasts.error(t)}))}),[o]);let E=null;const _=a&&d?"AssetAdmin.ARCHIVE":"AssetAdmin.DELETE",w=a&&d?"Archive":"Delete";let x=[{label:c.default._t(_,w),handler:()=>l(o.map((e=>{let{id:t}=e;return t}))),color:"danger"},{label:c.default._t("AssetAdmin.CANCEL","Cancel"),handler:s}];if(v)E=r.default.createElement(t,null);else{const e=C.filter((e=>"folder"===e.type)).length,t=C.filter((e=>"file"===e.type)).length,n=C.reduce(((e,t)=>e+t.count),0),i={topLevelFolderCount:e,topLevelFileCount:t,descendantFileCount:n,filesAreVersioned:a,archiveFiles:d};E=r.default.createElement(y.default,i),t+n>0&&(x=[{label:c.default._t("AssetAdmin.CANCEL","Cancel"),handler:s,color:"primary"},{label:c.default._t(_,w),handler:()=>l(o.map((e=>{let{id:t}=e;return t}))),color:"danger"}])}const F=![u.CANCELING,u.DELETING].includes(n);return r.default.createElement(g.default,{body:E,isOpen:F,actions:x,onCancel:s,onClosed:i,filesAreVersioned:a,archiveFiles:d})};t.Component=E,E.propTypes={LoadingComponent:s.default.elementType,transition:s.default.oneOf(["canceling","deleting",!1]),files:s.default.arrayOf(p.default),descendantFileCounts:s.default.object,onCancel:s.default.func.isRequired,onModalClose:s.default.func.isRequired,onConfirm:s.default.func.isRequired,filesAreVersioned:s.default.bool.isRequired,archiveFiles:s.default.bool.isRequired,actions:s.default.object.isRequired};const _=(0,o.compose)((0,l.inject)(["Loading"],(e=>({LoadingComponent:e}))))(E);t.default=(0,o.compose)((0,i.connect)((e=>{let{assetAdmin:{confirmDeletion:t}}=e;return t}),(e=>({onCancel:()=>e(a.cancel()),onModalClose:()=>e(a.modalClose()),actions:{toasts:(0,o.bindActionCreators)(d,e),confirmation:(0,o.bindActionCreators)(a,e)}}))))((e=>{let{showConfirmation:t,files:n,...o}=e;return t&&n.length>0?r.default.createElement(_,S({},o,{files:n})):null}))},7871:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=s(n(5815)),o=s(n(1594)),i=s(n(6935));function s(e){return e&&e.__esModule?e:{default:e}}const l=e=>{let{topLevelFolderCount:t,topLevelFileCount:n,descendantFileCount:i,filesAreVersioned:s,archiveFiles:l}=e,a="AssetAdmin.BULK_ACTIONS_DELETE_WARNING",u="Ensure files are removed from content areas prior to deleting them, otherwise they will appear as broken links.";s&&l&&(a="AssetAdmin.BULK_ACTIONS_ARCHIVE_WARNING",u="Ensure files are removed from content areas prior to archiving them, otherwise they will appear as broken links.");const d=((e,t,n,o,i)=>{const s=t+n;if(s>0){let e="AssetAdmin.BULK_ACTIONS_DELETE_ITEMS_CONFIRM",t=["You're about to delete %s file(s) which may be used in your site's content.","Carefully check the file usage on the files before deleting the file(s)."].join(" ");return o&&i&&(e="AssetAdmin.BULK_ACTIONS_ARCHIVE_ITEMS_CONFIRM",t=["You're about to archive %s file(s) which may be used in your site's content.","Carefully check the file usage on the files before archiving the file(s)."].join(" ")),r.default.sprintf(r.default._t(e,t),s)}if(1===e){let e="AssetAdmin.BULK_ACTIONS_DELETE_FOLDER_CONFIRM",t="Are you sure you want to delete this folder?";return o&&i&&(e="AssetAdmin.BULK_ACTIONS_ARCHIVE_FOLDER_CONFIRM",t="Are you sure you want to archive this folder?"),r.default._t(e,t)}let l="AssetAdmin.BULK_ACTIONS_DELETE_FOLDERS_CONFIRM",a="Are you sure you want to delete these folders?";return o&&i&&(l="AssetAdmin.BULK_ACTIONS_ARCHIVE_FOLDERS_CONFIRM",a="Are you sure you want to archive these folders?"),r.default._t(l,a)})(t,n,i,s,l);return o.default.createElement(o.default.Fragment,null,o.default.createElement("p",null,d),n+i>0&&o.default.createElement("p",null,r.default._t(a,u)))};l.propTypes={topLevelFolderCount:i.default.number,topLevelFileCount:i.default.number,descendantFileCount:i.default.number},l.defaultProps={topLevelFolderCount:0,topLevelFileCount:0,descendantFileCount:0};t.default=l},134:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=l(n(5815)),o=l(n(1594)),i=l(n(6935)),s=n(3556);function l(e){return e&&e.__esModule?e:{default:e}}const a=e=>{let{isOpen:t,body:n,onCancel:i,actions:l,filesAreVersioned:a,archiveFiles:u}=e,d="AssetAdmin.CONFIRM_FILE_DELETION",c="Confirm deletion";return a&&u&&(d="AssetAdmin.CONFIRM_FILE_ARCHIVE",c="Confirm archive"),o.default.createElement(s.Modal,{isOpen:t,toggle:i},o.default.createElement(s.ModalHeader,{toggle:i},r.default._t(d,c)),o.default.createElement(s.ModalBody,null,n),o.default.createElement(s.ModalFooter,null,l.map((e=>{let{label:t,handler:n,color:r}=e;return o.default.createElement(s.Button,{key:t,color:r,onClick:n},t)}))))};a.propTypes={isOpen:i.default.bool.isRequired,body:i.default.node.isRequired,onCancel:i.default.func.isRequired,actions:i.default.arrayOf(i.default.shape({label:i.default.string.isRequired,handler:i.default.func,color:i.default.string})),filesAreVersioned:i.default.bool.isRequired,archiveFiles:i.default.bool.isRequired};t.default=a},1869:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=_(n(5815)),o=n(9040),i=n(9367),s=E(n(1594)),l=_(n(6379)),a=_(n(55)),u=_(n(8737)),d=E(n(9077)),c=_(n(6935)),p=n(5207),h=_(n(6177)),f=_(n(5609)),m=E(n(4461)),g=E(n(1021)),y=_(n(6923)),v=_(n(7008)),b=_(n(7675)),C=E(n(1584));function S(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(S=function(e){return e?n:t})(e)}function E(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=S(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function _(e){return e&&e.__esModule?e:{default:e}}function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;te.json())).then((e=>{this.setState({file:e})}))}getFormSchemaUrl(){const{schemaUrlQueries:e,schemaUrl:t,fileId:n}=this.props,r=v.default.parse(t),o=e.reduce(((e,t)=>{let{name:n,value:r}=t;return{...e,[n]:r}}),{});return v.default.format({...r,pathname:`${r.path}/${n}`,search:b.default.stringify(o)})}handleAction(e){const t=this.state.file;switch(e.currentTarget.name){case"action_addtocampaign":this.openModal(),e.preventDefault();break;case"action_replacefile":this.replaceFile(),e.preventDefault();break;case"action_downloadfile":this.downloadFile(),e.preventDefault();break;case"action_delete":this.props.actions.confirmDeletion.confirm([t]),e.preventDefault()}}handleCancelKeyDown(e){e.keyCode!==l.default.SPACE_KEY_CODE&&e.keyCode!==l.default.RETURN_KEY_CODE||this.handleClose(e)}handleSubmit(e,t,n){const{showingSubForm:r,actions:o}=this.props;return"function"==typeof this.props.onSubmit?this.props.onSubmit(e,t,n).finally((()=>{r&&-1!==["action_save","action_publish"].indexOf(t)&&o.modal.popFormStackEntry()})):n()}handleClose(e){const{showingSubForm:t,onClose:n,actions:r}=this.props;t?r.modal.popFormStackEntry():(n(),this.closeModal()),e&&e.preventDefault()}openModal(){this.setState({openModal:!0})}closeModal(){this.setState({openModal:!1})}replaceFile(){const e=document.querySelector(".dz-input-PreviewImage");e&&e.click()}downloadFile(){const e=this.state.file;!function(e,t){const n=document.createElement("a");n.download=t,n.href=e,document.body.appendChild(n),n.click(),document.body.removeChild(n)}(e.url,e.name),document.getElementById("Form_fileEditForm_PopoverActions").focus()}handleLoadingError(e){this.setState({loadingForm:!1,loadingError:e.errors[0]})}handleLoadingSuccess(){this.setState({loadingForm:!1,loadingError:null})}handleFetchingSchema(){this.setState({loadingForm:!0})}editorHeader(e){let{SchemaComponent:t,...n}=e;const{dialog:r,nextType:o,showingSubForm:i,actions:l,EditorHeaderComponent:a}=this.props,u=this.getFormSchemaUrl(),d=this.state.file;let c=C.buttonStates.SWITCH;r&&d&&"folder"!==d.type&&(c=i?C.buttonStates.ALWAYS_BACK:C.buttonStates.ONLY_BACK);const{formid:p}=n,h=o&&d&&"folder"!==d.type?()=>{l.modal.stashFormValues(p,u),l.modal.pushFormStackEntry(o)}:void 0,f={onCancel:this.handleClose,showButton:c,onDetails:h};return s.default.createElement(a,f,s.default.createElement(t,n))}createFn(e,t){if("AssetEditorHeaderFieldGroup"===t.name){const n=this.editorHeader,r={key:t.id,SchemaComponent:e,...t};return s.default.createElement(n,r)}return s.default.createElement(e,w({key:t.id},t))}render(){if(!this.state.file)return null;const{FormBuilderLoaderComponent:e,FormBuilderModalComponent:t}=this.props,n=this.getFormSchemaUrl(),o=`${this.props.addToCampaignSchemaUrl}/${this.props.fileId}`,i=(0,y.default)("panel","form--no-dividers","editor",{"editor--asset-dropzone--disable":!this.props.enableDropzone},this.props.className);let l=null;if(this.state.loadingError){let e=this.state.loadingError.value;404===this.state.loadingError.code&&(e=r.default._t("AssetAdmin.FILE_MISSING","File cannot be found")),e||(e=r.default._t("Admin.UNKNOWN_ERROR","An unknown error has occurred")),l=s.default.createElement("div",{className:"editor__file-preview-message--file-missing"},e)}const a=r.default._t("Admin.ADD_TO_CAMPAIGN","Add to campaign"),u=this.props.loadingComponent;return s.default.createElement("div",{className:i},s.default.createElement("div",{className:"editor__details fill-height"},s.default.createElement(e,{identifier:"AssetAdmin.EditForm",schemaUrl:n,onSubmit:this.handleSubmit,onAction:this.handleAction,onLoadingSuccess:this.handleLoadingSuccess,onLoadingError:this.handleLoadingError,onFetchingSchema:this.handleFetchingSchema,createFn:this.createFn,file:this.state.file}),l,s.default.createElement(t,{title:a,identifier:"AssetAdmin.AddToCampaign",isOpen:this.state.openModal,onClosed:this.closeModal,schemaUrl:o,bodyClassName:"modal__dialog",responseClassBad:"modal__response modal__response--error",responseClassGood:"modal__response modal__response--good"}),this.state.loadingForm&&s.default.createElement(u,null)))}}t.Component=x,x.propTypes={className:c.default.string,fileId:c.default.number.isRequired,enableDropzone:c.default.bool,dialog:c.default.bool,onClose:c.default.func.isRequired,onSubmit:c.default.func.isRequired,schemaUrl:c.default.string.isRequired,schemaUrlQueries:c.default.arrayOf(c.default.shape({name:c.default.string,value:c.default.any})),addToCampaignSchemaUrl:c.default.string,actions:c.default.object,showingSubForm:c.default.bool,nextType:c.default.string,EditorHeaderComponent:c.default.oneOfType([c.default.object,c.default.func]),FormBuilderLoaderComponent:c.default.oneOfType([c.default.object,c.default.func]),FormBuilderModalComponent:c.default.oneOfType([c.default.object,c.default.func])},x.defaultProps={EditorHeaderComponent:C.default,FormBuilderLoaderComponent:a.default,FormBuilderModalComponent:u.default};t.default=(0,i.compose)((0,p.inject)(["Loading"],(e=>({loadingComponent:e})),(()=>"AssetAdmin.Editor")),(0,o.connect)((function(e){let{assetAdmin:{gallery:t,modal:n}}=e;return{enableDropzone:t.enableDropzone,nextType:n.formSchema&&n.formSchema.nextType,showingSubForm:n.formSchemaStack&&n.formSchemaStack.length>1}}),(function(e){return{actions:{unsavedForms:(0,i.bindActionCreators)(d,e),confirmDeletion:(0,i.bindActionCreators)(m,e),modal:(0,i.bindActionCreators)(g,e)}}})))(x)},1584:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.buttonStates=void 0;var r=u(n(1594)),o=u(n(5815)),i=u(n(551)),s=u(n(2164)),l=u(n(6935)),a=u(n(6923));function u(e){return e&&e.__esModule?e:{default:e}}const d=e=>t=>{t.preventDefault(),e&&e()},c="ALWAYS_BACK",p="ALWAYS_CANCEL",h="SWITCH",f="ONLY_BACK",m="ONLY_CANCEL",g=t.buttonStates={ALWAYS_BACK:c,ALWAYS_CANCEL:p,SWITCH:h,ONLY_BACK:f,ONLY_CANCEL:m,NONE:"NONE"},y=e=>{let{onCancel:t,onDetails:n,showButton:l,children:u}=e;const g=d(t),y=[c,h,f].indexOf(l)>=0,v=[p,h,m].indexOf(l)>=0,b=(0,a.default)("editor-header__back-button","btn--icon-xl",{"editor-header__back-button--md-below":[h,f].indexOf(l)>=0}),C=(0,a.default)("editor-header__cancel-button","btn--icon-xl",{"editor-header__cancel-button--lg-above":[h,m].indexOf(l)>=0});return r.default.createElement("div",{className:"editor-header"},y&&r.default.createElement(s.default,{className:b,onClick:g}),r.default.createElement("div",{className:"editor-header__field"},u),n&&r.default.createElement(i.default,{onClick:d(n),icon:"edit-list",className:"editor-header__edit",outline:!0},o.default._t("AssetAdmin.DETAILS","Details")),v&&r.default.createElement("div",null,r.default.createElement(i.default,{icon:"cancel",className:C,noText:!0,onClick:g},o.default._t("AssetAdmin.CANCEL"))))};y.propTypes={onCancel:l.default.func,onDetails:l.default.func,showButton:l.default.oneOf(Object.keys(g).map((e=>g[e]))),children:l.default.node};t.default=y},5789:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.galleryViewPropTypes=t.galleryViewDefaultProps=t.default=t.Component=void 0;var r=I(n(1669)),o=I(n(5815)),i=O(n(1594)),s=n(9040),l=n(9367),a=I(n(853)),u=I(n(3229)),d=I(n(2853)),c=I(n(6609)),p=I(n(6379)),h=I(n(6621)),f=O(n(4201)),m=O(n(8918)),g=O(n(1369)),y=O(n(4461)),v=n(4172),b=I(n(4350)),C=I(n(6177)),S=I(n(9247)),E=n(5207),_=I(n(6935)),w=I(n(5609)),x=I(n(5769)),F=I(n(3863));function A(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(A=function(e){return e?n:t})(e)}function O(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=A(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function I(e){return e&&e.__esModule?e:{default:e}}const D={DELETE:"delete",ARCHIVE:"archive",EDIT:"edit",MOVE:"move",PUBLISH:"publish",UNPUBLISH:"unpublish",INSERT:"insert",ADMIN:"admin",SELECT:"select"};class R extends i.Component{constructor(e){super(e),this.handleOpenFolder=this.handleOpenFolder.bind(this),this.handleOpenFile=this.handleOpenFile.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleAddedFile=this.handleAddedFile.bind(this),this.handlePreviewLoaded=this.handlePreviewLoaded.bind(this),this.handleCancelUpload=this.handleCancelUpload.bind(this),this.handleRemoveErroredUpload=this.handleRemoveErroredUpload.bind(this),this.handleUploadProgress=this.handleUploadProgress.bind(this),this.handleSending=this.handleSending.bind(this),this.handleSort=this.handleSort.bind(this),this.handleSetPage=this.handleSetPage.bind(this),this.handleSuccessfulUpload=this.handleSuccessfulUpload.bind(this),this.handleQueueComplete=this.handleQueueComplete.bind(this),this.handleFailedUpload=this.handleFailedUpload.bind(this),this.handleClearSearch=this.handleClearSearch.bind(this),this.handleEnableDropzone=this.handleEnableDropzone.bind(this),this.handleMoveFiles=this.handleMoveFiles.bind(this),this.handleBulkEdit=this.handleBulkEdit.bind(this),this.handleBulkPublish=this.handleBulkPublish.bind(this),this.handleBulkUnpublish=this.handleBulkUnpublish.bind(this),this.handleBulkMove=this.handleBulkMove.bind(this),this.handleBulkInsert=this.handleBulkInsert.bind(this),this.handleBeginSelection=this.handleBeginSelection.bind(this),this.handleGroupSelect=this.handleGroupSelect.bind(this),this.handleClearSelection=this.handleClearSelection.bind(this),this.handleSelectAll=this.handleSelectAll.bind(this),this.toggleSelectConcat=this.toggleSelectConcat.bind(this),this.getSelectableFiles=this.getSelectableFiles.bind(this)}componentDidMount(){this.initSortDropdown(),window.addEventListener("keydown",this.toggleSelectConcat),window.addEventListener("keyup",this.toggleSelectConcat)}componentDidUpdate(e){this.initSortDropdown(),this.initFlushUploadFiles(e)}componentWillUnmount(){window.removeEventListener("keydown",this.toggleSelectConcat),window.removeEventListener("keyup",this.toggleSelectConcat)}initFlushUploadFiles(e){if("tile"!==this.props.view){this.getSortElement().off("change")}e.folderId!==this.props.folderId&&this.props.actions.queuedFiles.purgeUploadQueue()}getSortElement(){return(0,r.default)(this.gallery).find(".gallery__sort .dropdown")}getSearchMessage(e){const t=[];e.name&&t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGEKEYWORDS","with keywords '{name}'")),e.lastEditedFrom&&e.lastEditedTo?t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGEEDITEDBETWEEN","last edited between '{lastEditedFrom}' and '{lastEditedTo}'")):e.lastEditedFrom?t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGEEDITEDFROM","last edited after '{lastEditedFrom}'")):e.lastEditedTo&&t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGEEDITEDTO","last edited before '{lastEditedTo}'")),e.appCategory&&t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGECATEGORY","categorised as '{appCategory}'")),e.currentFolderOnly&&this.props.folder.title&&t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGELIMIT","limited to the folder '{folder}'"));const n=[t.slice(0,-1).join(`${o.default._t("AssetAdmin.JOIN",",")} `),t.slice(-1)].filter((e=>e)).join(` ${o.default._t("AssetAdmin.JOINLAST","and")} `);if(""===n)return"";const r={parts:o.default.inject(n,Object.assign({folder:this.props.folder.title},e,{appCategory:e.appCategory?e.appCategory.toLowerCase():void 0}))};return o.default.inject(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGE","Search results {parts}"),r)}getSelection(e,t){const n=this.getSelectableFiles(),r=[e,t].map((e=>n.findIndex((t=>t.id===e)))).filter((e=>-1!==e)).sort(((e,t)=>e-t));if(2!==r.length)return r.map((e=>n[e].id));const[o,i]=r;return n.filter(((e,t)=>t>=o&&t<=i)).map((e=>e.id))}getSelectableFiles(){const e=this.props.files.filter((e=>e.id));return this.props.type===D.SELECT?e.filter((e=>"folder"!==e.type)):e}handleBulkInsert(e,t){this.props.onInsertMany(e,t)}handleBulkPublish(e,t){const n=t.map((e=>e.id));return n.length?(this.props.actions.gallery.setLoading(!0),this.props.onPublish(n).then((e=>{this.props.actions.gallery.setLoading(!1),this.props.actions.toasts.success(o.default.sprintf(o.default._t("AssetAdmin.BULK_ACTIONS_PUBLISH_SUCCESS","%s folders/files were successfully published."),e.length)),this.props.actions.gallery.deselectFiles()}))):(this.props.actions.gallery.deselectFiles(),Promise.resolve(!0))}handleBulkUnpublish(e,t){const n=t.filter((e=>e.published)).map((e=>e.id));return n.length?(this.props.actions.gallery.setLoading(!0),this.props.onUnpublish(n).then((e=>{this.props.actions.gallery.setLoading(!1),this.props.actions.toasts.success(o.default.sprintf(o.default._t("AssetAdmin.BULK_ACTIONS_UNPUBLISH_SUCCESS","%s folders/files were successfully unpublished."),e.length)),this.props.actions.gallery.deselectFiles()}))):(this.props.actions.gallery.deselectFiles(),Promise.resolve(!0))}initSortDropdown(){if("tile"===this.props.view){const e=this.getSortElement();e.chosen({allow_single_deselect:!0,disable_search_threshold:20}),e.off("change"),e.on("change",(()=>e.find(":selected")[0].click()))}}handleSort(e){this.props.actions.queuedFiles.purgeUploadQueue(),this.props.onSort(e)}handleSetPage(e){this.props.onSetPage(e)}handleCancelUpload(e){e.xhr.abort(),this.props.actions.queuedFiles.removeQueuedFile(e.queuedId)}handleRemoveErroredUpload(e){this.props.actions.queuedFiles.removeQueuedFile(e.queuedId)}handleAddedFile(e){this.props.actions.queuedFiles.addQueuedFile(e)}handlePreviewLoaded(e,t){this.props.actions.queuedFiles.updateQueuedFile(e.queuedId,t)}handleSending(e,t){this.props.actions.queuedFiles.updateQueuedFile(e._queuedId,{xhr:t})}handleUploadProgress(e,t){this.props.actions.queuedFiles.updateQueuedFile(e._queuedId,{progress:t})}handleSuccessfulUpload(e){const t=JSON.parse(e.xhr.response);if(void 0!==t[0].error)return void this.handleFailedUpload(e);this.props.actions.queuedFiles.succeedUpload(e._queuedId,t[0]),this.props.onSuccessfulUpload&&this.props.onSuccessfulUpload(t);const n=this.props.queuedFiles.items.reduce(((e,t)=>100!==t.progress?e+1:e),0);if(!this.props.fileId&&!this.props.selectedFiles.length&&0===n){const e=t.pop();this.props.onOpenFile(e.id)}}handleQueueComplete(){this.props.onSuccessfulUploadQueue&&this.props.onSuccessfulUploadQueue()}handleFailedUpload(e,t){const n=e.xhr&&e.xhr.status?(0,S.default)(e.xhr.status,e.xhr):"";this.props.actions.queuedFiles.failUpload(e._queuedId,t,n)}itemIsSelected(e){return this.props.selectedFiles.indexOf(e)>-1}toggleSelectConcat(e){this.props.actions.gallery.setConcatenateSelect(this.isConcat(e))}isConcat(e){return e.metaKey||e.ctrlKey||e.shiftKey}itemIsHighlighted(e){return this.props.fileId===e}hasOpenedItem(){return!!this.props.fileId}handleClearSearch(e){this.props.onClearSearch(e)}handleGroupSelect(e,t){const{setSelectedFiles:n,selectFiles:r}=this.props.actions.gallery,o=this.getSelectableFiles(),i=e.filter(((t,n)=>e.indexOf(t)===n&&o.find((e=>e.id===t)))),s=this.props.concatenateSelect||this.isConcat(t);if(null!==this.props.maxFilesSelect){let e=i.length;if(s){e=this.props.selectedFiles.filter((e=>!this.props.selectedFiles.includes(e))).concat(this.props.selectedFiles).length}if(e>=this.props.maxFilesSelect)return}s?r(i):n(i)}handleClearSelection(){this.props.actions.gallery.deselectFiles()}handleSelectAll(){const e=this.props.files.map((e=>e.id));this.handleGroupSelect(e,new Event("na"))}handleBeginSelection(e){let t=e.target;for(;t;){if(t.classList.contains("griddle-footer"))return!1;if(t.classList.contains("gallery__main--selectable"))break;t=t.parentNode}return!0}handleOpenFolder(e,t){e.preventDefault(),this.props.onOpenFolder(t.id)}handleOpenFile(e,t){e.preventDefault(),null!==t.created&&(this.props.selectedFiles.length&&1!==this.props.maxFilesSelect||this.props.type!==D.SELECT||this.handleSelect(e,t),this.props.onOpenFile(t.id,t))}handleSelect(e,t){const n=this.props.maxFilesSelect;let r=this.getSelectableFiles().filter((e=>e.id===t.id)).map((e=>e.id));if(1!==n)if(-1===this.props.selectedFiles.indexOf(t.id)){e.shiftKey&&(r=this.getSelection(this.props.lastSelected,t.id));if(this.props.selectedFiles.filter((e=>!r.includes(e))).concat(r).length>n&&null!==n)return;this.props.actions.gallery.selectFiles(r),this.props.actions.gallery.setLastSelected(t.id)}else this.props.actions.gallery.deselectFiles([t.id]),e.shiftKey&&this.props.actions.gallery.setLastSelected(null);else this.props.actions.gallery.setSelectedFiles(r)}handleEnableDropzone(e){this.props.actions.gallery.setEnableDropzone(e)}handleMoveFiles(e,t){const n=this.props.sectionConfig.endpoints.move.url;return w.default.post(n,{ids:t,folderID:e},{"X-SecurityID":C.default.get("SecurityID")}).then((()=>{const n=p.default.MOVE_SUCCESS_DURATION,r=`+${t.length}`;this.props.actions.gallery.setFileBadge(e,r,"success",n),"function"==typeof this.props.onMoveFilesSuccess&&this.props.onMoveFilesSuccess(e,t)})).catch((()=>{this.props.actions.toasts.error(o.default._t("AssetAdmin.FAILED_MOVE","There was an error moving the selected items."))}))}handleBulkEdit(e,t){this.handleOpenFile(e,t[0])}handleBulkMove(){this.props.actions.gallery.activateModal(p.default.MODAL_MOVE)}renderTransitionBulkActions(){return this.renderBulkActions()}renderBulkActions(){const{type:e,dialog:t,maxFilesSelect:n,files:r,selectedFiles:o,BulkActionsComponent:s,sectionConfig:l}=this.props,a=e===D.SELECT||t?e=>e.value===D.INSERT:e=>e.value!==D.INSERT,u=l.filesAreVersioned&&l.archiveFiles?e=>e.value!==D.DELETE:e=>e.value!==D.ARCHIVE,d=p.default.BULK_ACTIONS.filter(a).filter(u).map((e=>{if(e.callback)return e;switch(e.value){case D.DELETE:case D.ARCHIVE:return{...e,callback:(e,t)=>{this.props.actions.confirmDeletion.confirm(t)},confirm:void 0};case D.EDIT:return{...e,callback:this.handleBulkEdit};case D.MOVE:return{...e,callback:this.handleBulkMove};case D.PUBLISH:return{...e,callback:this.handleBulkPublish};case D.UNPUBLISH:return{...e,callback:this.handleBulkUnpublish};case D.INSERT:return{...e,callback:this.handleBulkInsert,color:"primary"};default:return e}})),c=o.map((e=>r.find((t=>t&&e===t.id)))).filter((e=>e));return c.length>0&&[D.ADMIN,D.SELECT].includes(e)?i.default.createElement(s,{actions:d,items:c,total:n,key:c.length>0,container:this.gallery,showCount:1!==n,onClearSelection:this.handleClearSelection,onSelectAll:this.handleSelectAll}):null}renderGalleryView(){const e="table"===this.props.view?c.default:d.default,t=this.props.files.map((e=>{const t=this.itemIsSelected(e.id),n=this.itemIsHighlighted(e.id),r=(e.queuedId?`queueId${e.queuedId}`:`id${e.id}`)+(t?"--selected":"");return{...e,selected:t,highlighted:n,key:r}})),{type:n,loading:r,dialog:o,page:s,totalCount:l,limit:a,sort:u,selectedFiles:p,badges:h,maxFilesSelect:f,sectionConfig:m}=this.props,g={selectableItems:n===D.SELECT||n===D.ADMIN&&(!f||f>1),selectableFolders:n!==D.SELECT&&!o,files:t,loading:r,page:s,totalCount:l,limit:a,sort:u,selectedFiles:p,badges:h,onSort:this.handleSort,onSetPage:this.handleSetPage,onOpenFile:this.handleOpenFile,onOpenFolder:this.handleOpenFolder,onSelect:this.handleSelect,onCancelUpload:this.handleCancelUpload,onDropFiles:this.handleMoveFiles,onRemoveErroredUpload:this.handleRemoveErroredUpload,onEnableDropzone:this.handleEnableDropzone,sectionConfig:m,canDrag:n===D.ADMIN,maxFilesSelect:f};return i.default.createElement(e,g)}renderToolbar(){const{GalleryToolbar:e,sort:t,view:n,folder:r,onCreateFolder:o,onOpenFolder:s,onViewChange:l}=this.props,a={onMoveFiles:this.handleMoveFiles,onSort:this.handleSort,onCreateFolder:o,onOpenFolder:s,onViewChange:l,view:n,sort:t,folder:r};return i.default.createElement(e,a)}render(){const{folder:e,loading:t,errorMessage:n,noticeMessage:r}=this.props,s=this.props.LoadingComponent;if(!e)return n?i.default.createElement("div",{className:"gallery__error flexbox-area-grow"},i.default.createElement("div",{className:"gallery__error-message"},i.default.createElement("h3",null,o.default._t("AssetAdmin.DROPZONE_RESPONSE_ERROR","Server responded with an error.")),n&&i.default.createElement("p",null,n))):t?i.default.createElement("div",{className:"flexbox-area-grow"},i.default.createElement(s,null)):i.default.createElement("div",{className:"flexbox-area-grow"},i.default.createElement("div",{className:"editor__file-preview-message--file-missing m-t-3"},o.default._t("Admin.UNKNOWN_ERROR","An unknown error has occurred")));const l=i.default.createElement("div",{className:"gallery_messages"},n&&i.default.createElement(h.default,{value:n,type:"danger"}),r&&i.default.createElement(h.default,{value:r,type:"success"})),u={height:p.default.THUMBNAIL_HEIGHT,width:p.default.THUMBNAIL_WIDTH},d={url:this.props.createFileApiUrl,method:this.props.createFileApiMethod,paramName:"Upload",clickable:"#upload-button",...this.props.sectionConfig.dropzoneOptions},c=this.props.securityId,f=this.props.folder.canEdit&&this.props.enableDropzone,m=["panel","panel--padded","panel--scrollable","gallery__main","fill-height"];this.props.type===D.INSERT&&m.push("insert-media-modal__main");const g=m;return this.hasOpenedItem()&&g.push("gallery__main--has-opened-item"),i.default.createElement("div",{className:"flexbox-area-grow gallery__outer",ref:e=>{this.gallery=e}},this.renderTransitionBulkActions(),i.default.createElement(F.default,{className:m.join(" ")},this.renderToolbar(),i.default.createElement(v.SelectableGroup,{enabled:"tile"===this.props.view&&this.props.type===D.ADMIN,className:"flexbox-area-grow fill-height gallery__main--selectable",onSelection:this.handleGroupSelect,onNonItemClick:this.handleClearSelection,onBeginSelection:this.handleBeginSelection,preventDefault:!1,fixedPosition:!0},i.default.createElement(a.default,{name:"gallery-container",className:"flexbox-area-grow",canUpload:f,onAddedFile:this.handleAddedFile,onPreviewLoaded:this.handlePreviewLoaded,onError:this.handleFailedUpload,onSuccess:this.handleSuccessfulUpload,onQueueComplete:this.handleQueueComplete,onSending:this.handleSending,onUploadProgress:this.handleUploadProgress,preview:u,folderId:this.props.folderId,options:d,securityID:c,uploadButton:!1},l,this.renderGalleryView()))),this.props.loading&&i.default.createElement(s,null),i.default.createElement(x.default,{sectionConfig:this.props.sectionConfig,folderId:this.props.folderId,onSuccess:this.props.onMoveFilesSuccess,onOpenFolder:this.props.onOpenFolder}))}}t.Component=R;const N={page:1,limit:15},M={sectionConfig:b.default,loading:_.default.bool,sort:_.default.string,files:_.default.arrayOf(_.default.shape({id:_.default.number,parent:_.default.shape({id:_.default.number})})).isRequired,selectedFiles:_.default.arrayOf(_.default.number),totalCount:_.default.number,page:_.default.number,limit:_.default.number,badges:_.default.arrayOf(_.default.shape({id:_.default.number,message:_.default.node,status:_.default.string})),onOpenFile:_.default.func.isRequired,onOpenFolder:_.default.func.isRequired,onSort:_.default.func.isRequired,onSetPage:_.default.func.isRequired,maxFilesSelect:_.default.number};t.galleryViewDefaultProps=Object.assign({},N,{selectableItems:!1}),t.galleryViewPropTypes=Object.assign({},M,{selectableItems:_.default.bool,selectableFolders:_.default.bool,onSelect:_.default.func,onCancelUpload:_.default.func,onRemoveErroredUpload:_.default.func,onEnableDropzone:_.default.func});R.defaultProps=Object.assign({},N,{type:D.ADMIN,view:"tile",enableDropzone:!0,dialog:!1,BulkActionsComponent:u.default}),R.propTypes=Object.assign({},M,{onSuccessfulUpload:_.default.func,onSuccessfulUploadQueue:_.default.func,onCreateFolder:_.default.func,onMoveFilesSuccess:_.default.func,onPublish:_.default.func,onUnpublish:_.default.func,type:_.default.oneOf(["insert-media","insert-link",D.SELECT,D.ADMIN]),view:_.default.oneOf(["tile","table"]),lastSelected:_.default.number,dialog:_.default.bool,fileId:_.default.number,folderId:_.default.number.isRequired,folder:_.default.shape({id:_.default.number,title:_.default.string,parentId:_.default.number,canView:_.default.bool,canEdit:_.default.bool}),files:_.default.array,errorMessage:_.default.string,actions:_.default.object,securityId:_.default.string,onViewChange:_.default.func.isRequired,createFileApiUrl:_.default.string,createFileApiMethod:_.default.string,search:_.default.object,enableDropzone:_.default.bool,concatenateSelect:_.default.bool,GalleryToolbar:_.default.elementType,sorters:_.default.arrayOf(_.default.shape({field:_.default.string.isRequired,direction:_.default.oneOf(["asc","desc"]).isRequired,label:_.default.string.isRequired})).isRequired,BulkActionsComponent:_.default.oneOfType([_.default.object,_.default.func])});t.default=(0,l.compose)((0,E.inject)(["GalleryToolbar","Loading"],((e,t)=>({GalleryToolbar:e,LoadingComponent:t})),(()=>"AssetAdmin.Gallery")),(0,s.connect)((function(e,t){let{sort:n}=t;const{selectedFiles:r,errorMessage:o,noticeMessage:i,enableDropzone:s,badges:l,concatenateSelect:a,loading:u,sorters:d,lastSelected:c}=e.assetAdmin.gallery;return!n&&d&&d[0]&&(n=`${d[0].field},${d[0].direction}`),{lastSelected:c,selectedFiles:r,errorMessage:o,noticeMessage:i,enableDropzone:s,badges:l,concatenateSelect:a,loading:t.loading||u,queuedFiles:e.assetAdmin.queuedFiles,securityId:e.config.SecurityID,sorters:d,sort:n}}),(function(e){return{actions:{gallery:(0,l.bindActionCreators)(f,e),toasts:(0,l.bindActionCreators)(m,e),queuedFiles:(0,l.bindActionCreators)(g,e),confirmDeletion:(0,l.bindActionCreators)(y,e)}}})))(R)},3863:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=a(n(6923)),i=a(n(2914)),s=a(n(6935)),l=a(n(5799));function a(e){return e&&e.__esModule?e:{default:e}}function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}class d extends r.Component{constructor(e){super(e),this.state={dragging:!1},this.mounted=!1,this.handleDrop=this.handleDrop.bind(this)}componentDidMount(){this.mounted=!0,window.addEventListener("drop",this.handleDrop,!0)}componentDidUpdate(){setTimeout((()=>{if(!this.mounted||!this.context.dragDropManager)return;const e=this.context.dragDropManager.monitor.isDragging();this.state.dragging!==e&&this.setState({dragging:e})}))}componentWillUnmount(){this.mounted=!1,window.removeEventListener("drop",this.handleDrop,!0)}handleDrop(){const e=this.context.dragDropManager,t=e&&e.backend;t&&t.isDraggingNativeItem()&&t.endDragNativeItem()}render(){const{className:e,children:t}=this.props;return r.default.createElement("div",{className:(0,o.default)(e,{"gallery__main--dragging":this.state.dragging})},t,r.default.createElement(i.default,null))}}d.contextTypes={dragDropManager:s.default.object},d.propTypes={className:s.default.string,children:s.default.oneOfType([s.default.arrayOf(s.default.node),s.default.node])};t.default=(0,l.default)(d)},6931:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=b(n(5815)),o=v(n(1594)),i=n(9367),s=n(9040),l=b(n(7917)),a=b(n(2908)),u=b(n(1957)),d=v(n(4201)),c=v(n(1021)),p=b(n(8737)),h=b(n(6923)),f=b(n(6935)),m=b(n(8268)),g=b(n(7675));function y(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(y=function(e){return e?n:t})(e)}function v(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=y(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function b(e){return e&&e.__esModule?e:{default:e}}class C extends o.Component{constructor(e){super(e),this.handleSubmit=this.handleSubmit.bind(this)}componentDidMount(){const{isOpen:e,onBrowse:t,setOverrides:n,fileAttributes:r,folderId:o}=this.props;e?"function"==typeof n&&r.ID&&(n(this.props),t(o,r.ID)):t(o||0)}componentDidUpdate(e){!this.props.isOpen&&e.isOpen&&(this.props.onBrowse(this.props.folderId),this.props.actions.gallery.deselectFiles()),"function"==typeof e.setOverrides&&this.props.isOpen&&!e.isOpen&&(e.setOverrides(this.props),this.props.onBrowse(this.props.folderId,this.props.fileAttributes?this.props.fileAttributes.ID:null))}getSectionProps(){return{...this.props,dialog:!0,toolbarChildren:this.renderToolbarChildren(),onSubmitEditor:this.handleSubmit,onReplaceUrl:this.props.onBrowse}}getModalProps(){const{onHide:e,onInsert:t,sectionConfig:n,schemaUrl:r,className:o,...i}=this.props;return{...i,className:(0,h.default)("insert-media-modal",o),size:"lg",showCloseButton:!1}}handleSubmit(e,t,n,r){return"action_insert"===t?this.props.onInsert(e,r):n()}renderToolbarChildren(){return o.default.createElement("button",{type:"button",className:"close modal__close-button insert-media-modal__close-button",onClick:this.props.onClosed,"aria-label":r.default._t("FormBuilderModal.CLOSE","Close")},o.default.createElement("span",{"aria-hidden":"true"},"×"))}render(){const e=this.getModalProps(),t=this.getSectionProps(),n=this.props.isOpen?o.default.createElement(l.default,t):null;return o.default.createElement(p.default,e,n)}}t.Component=C,C.propTypes={sectionConfig:f.default.shape({url:f.default.string,form:f.default.object}),type:f.default.oneOf(["insert-media","insert-link","select","admin"]),schemaUrl:f.default.string,isOpen:f.default.bool,setOverrides:f.default.func,onInsert:f.default.func.isRequired,fileAttributes:f.default.shape({ID:f.default.number,AltText:f.default.string,Width:f.default.number,Height:f.default.number,Loading:f.default.string,TitleTooltip:f.default.string,Alignment:f.default.string,Description:f.default.string,TargetBlank:f.default.bool}),requireLinkText:f.default.bool,folderId:f.default.number,fileId:f.default.number,viewAction:f.default.string,query:f.default.object,getUrl:f.default.func,onBrowse:f.default.func.isRequired,onClosed:f.default.func,className:f.default.string,actions:f.default.object,maxFiles:f.default.number,fileSelected:f.default.bool},C.defaultProps={className:"",fileAttributes:{},type:"insert-media",folderId:0,maxFiles:1};t.default=(0,i.compose)(a.default,(0,s.connect)((function(e,t){const n=t.sectionConfig;if(!n)return{};let r=0;null!==t.folderId?r=t.folderId:t.folder&&(r=t.folder.id);const o=t.fileAttributes?t.fileAttributes.ID:t.fileId,i=e.assetAdmin.modal.formSchema,s={config:n,viewAction:t.viewAction,folderId:r,type:i&&i.type,fileId:o},{schemaUrl:l,targetId:a}=(0,m.default)(s);if(!l)return{};const u={};t.requireLinkText&&(u.requireLinkText=!0),t.fileSelected&&(u.fileSelected=!0);let d=g.default.stringify(u);return d=d?`?${d}`:"",{schemaUrl:`${l}/${a}${d}`,type:i&&i.type}}),(function(e){return{actions:{gallery:(0,i.bindActionCreators)(d,e),modal:(0,i.bindActionCreators)(c,e)}}})),u.default)(C)},5769:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=m(n(1594)),o=n(9040),i=n(9367),s=m(n(5815)),l=m(n(6379)),a=m(n(6935)),u=n(4201),d=n(8918),c=m(n(8737)),p=m(n(4350)),h=m(n(6177)),f=m(n(5609));function m(e){return e&&e.__esModule?e:{default:e}}class g extends r.default.Component{constructor(e){super(e),this.handleSubmit=this.handleSubmit.bind(this),this.timeout=null}handleSubmit(e){let{FolderID:t}=e;const{selectedFiles:n,onSuccess:r,onClosed:o,setNotice:i,setError:a,setBadge:u}=this.props;let d=this.props.sectionConfig.endpoints.move.url;return f.default.post(d,{ids:n,folderID:t},{"X-SecurityID":h.default.get("SecurityID")}).then((()=>(d=`${this.props.sectionConfig.endpoints.read.url}/${t}`,f.default.get(d)))).then((e=>e.json())).then((e=>{"function"==typeof r&&r(e.id,n),u(e.id,`${n.length}`,"success",l.default.MOVE_SUCCESS_DURATION),i(s.default.sprintf(s.default._t("AssetAdmin.MOVED_ITEMS_TO","Moved %s item(s) to %s"),n.length,e.name),[{label:s.default._t("AssetAdmin.GO_TO_FOLDER","Go to folder"),onClick:()=>this.props.onOpenFolder(e.id)}]),o()})).catch((()=>{a(s.default._t("AssetAdmin.FAILED_MOVE","There was an error moving the selected items."))}))}render(){const{isOpen:e,onClosed:t,title:n,folderId:o,sectionConfig:i}=this.props,{schemaUrl:s}=i.form.moveForm;return r.default.createElement(c.default,{title:n,isOpen:e,onClosed:t,onSubmit:this.handleSubmit,identifier:"AssetAdmin.MoveForm",schemaUrl:`${s}/${o}`})}}g.propTypes={sectionConfig:p.default,folderId:a.default.number.isRequired,isOpen:a.default.bool,onClosed:a.default.func,setNotice:a.default.func,setBadge:a.default.func,setError:a.default.func,title:a.default.string,onSuccess:a.default.func,onOpenFolder:a.default.func.isRequired,selectedFiles:a.default.array.isRequired},g.defaultProps={isOpen:!1};t.default=(0,i.compose)((0,o.connect)((function(e){const{modal:t,selectedFiles:n}=e.assetAdmin.gallery;return{isOpen:t===l.default.MODAL_MOVE,selectedFiles:n,title:s.default.sprintf(s.default._t("AssetAdmin.MOVE_ITEMS_TO","Move %s item(s) to..."),n.length)}}),(function(e){return{onClosed(){e((0,u.deactivateModal)())},setNotice(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];e((0,d.display)({text:t,type:"success",actions:n}))},setError(t){e((0,d.display)({text:t,type:"error"}))},setBadge(){e((0,u.setFileBadge)(...arguments))}}})))(g)},6609:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=h(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=p(n(6935)),i=p(n(9888)),s=p(n(5815)),l=p(n(1990)),a=n(5789),u=n(5716),d=n(5207),c=n(9367);function p(e){return e&&e.__esModule?e:{default:e}}function h(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(h=function(e){return e?n:t})(e)}class f extends r.Component{constructor(e){super(e),this.getColumns=this.getColumns.bind(this),this.handleSort=this.handleSort.bind(this),this.handleSetPage=this.handleSetPage.bind(this),this.handleRowClick=this.handleRowClick.bind(this),this.renderSelect=this.renderSelect.bind(this),this.renderTitle=this.renderTitle.bind(this),this.renderStatus=this.renderStatus.bind(this),this.renderNoItemsNotice=this.renderNoItemsNotice.bind(this)}getColumns(){const e=["thumbnail","title","status","size","lastEdited"];return this.props.selectableItems&&e.unshift("selected"),e}getColumnConfig(){return[{columnName:"selected",sortable:!1,displayName:"",cssClassName:"gallery__table-column--select",customComponent:this.renderSelect},{columnName:"thumbnail",sortable:!1,displayName:"",cssClassName:"gallery__table-column--image",customComponent:this.renderThumbnail},{columnName:"title",customCompareFn:()=>0,displayName:s.default._t("File.TITLE","Title"),cssClassName:"gallery__table-column--title",customComponent:this.renderTitle},{columnName:"status",sortable:!1,cssClassName:"sort--disabled",customComponent:this.renderStatus,displayName:s.default._t("File.STATUS","Status")},{columnName:"lastEdited",displayName:s.default._t("File.MODIFIED","Modified"),customComponent:this.renderDate},{columnName:"size",sortable:!1,displayName:s.default._t("File.SIZE","Size"),cssClassName:"sort--disabled",customComponent:this.renderSize}]}getRowMetadata(e){return"gallery__table-row "+(e.highlighted?"gallery__table-row--highlighted":"")}getTableProps(){const[e,t]=this.props.sort.split(",");return{tableClassName:"gallery__table table table-hover",gridClassName:"gallery__main-view--table",rowMetadata:{bodyCssClassName:this.getRowMetadata,key:"key"},sortAscendingComponent:"",sortDescendingComponent:"",useExternal:!0,externalSetPage:this.handleSetPage,externalChangeSort:this.handleSort,externalSetFilter:()=>null,externalSetPageSize:()=>null,externalCurrentPage:this.props.page-1,externalMaxPage:Math.ceil(this.props.totalCount/this.props.limit),externalSortColumn:e,externalSortAscending:"asc"===t,initialSort:e,columns:this.getColumns(),columnMetadata:this.getColumnConfig(),useGriddleStyles:!1,onRowClick:this.handleRowClick,results:this.props.files,customNoDataComponent:this.renderNoItemsNotice}}handleActivate(e,t){"folder"===t.type?this.props.onOpenFolder(e,t):this.props.onOpenFile(e,t)}handleRowClick(e,t){const n=e.props.data;t.currentTarget.classList.contains("gallery__table-column--select")&&(t.stopPropagation(),t.preventDefault(),"function"==typeof this.props.onSelect)?this.props.onSelect(t,n):this.handleActivate(t,n)}handleSort(e,t){const n=t?"asc":"desc";this.props.onSort(`${e},${n}`)}handleSetPage(e){this.props.onSetPage(e+1)}preventFocus(e){e.preventDefault()}renderNoItemsNotice(){return 0!==this.props.files.length||this.props.loading?null:r.default.createElement("p",{className:"gallery__no-item-notice"},s.default._t("AssetAdmin.NOITEMSFOUND"))}renderSize(e){if("folder"===e.rowData.type)return null;const t=(0,u.fileSize)(e.data);return r.default.createElement("span",null,t)}renderStatus(e){let t=[];const n=e.rowData,{VersionedBadge:o}=this.props;return"folder"!==n.type&&(n.draft?t.push({key:"status-draft",status:"draft"}):n.modified&&t.push({key:"status-modified",status:"modified"})),t=t.map((e=>{let{...t}=e;return r.default.createElement(o,t)})),t?r.default.createElement("span",null,t):null}renderProgressBar(e){if(!e.queuedId||e.message&&"error"===e.message.type)return null;if(e.id>0)return r.default.createElement("div",{className:"gallery__progress-bar--complete"});const t={className:"gallery__progress-bar-progress",style:{width:`${e.progress}%`}};return r.default.createElement("div",{className:"gallery__progress-bar"},r.default.createElement("div",t))}renderRestrictedAccess(e){const{hasRestrictedAccess:t}=e,n={fileID:e.id,placement:"top",hasRestrictedAccess:t};return r.default.createElement(l.default,n)}renderTrackedFormUpload(e){const{isTrackedFormUpload:t,hasRestrictedAccess:n}=e,o={fileID:e.id,placement:"top",isTrackedFormUpload:t,hasRestrictedAccess:n};return r.default.createElement(l.default,o)}renderTitle(e){const t=this.renderProgressBar(e.rowData);return r.default.createElement("div",{className:"fill-width"},r.default.createElement("div",{className:"flexbox-area-grow"},r.default.createElement("span",null,e.data),e.rowData.hasRestrictedAccess&&this.renderRestrictedAccess(e.rowData),e.rowData.isTrackedFormUpload&&this.renderTrackedFormUpload(e.rowData)),t)}renderSelect(e){if(this.props.selectableItems&&(this.props.selectableFolders||"folder"!==e.rowData.type)){const t={type:"checkbox",title:s.default._t("AssetAdmin.SELECT"),defaultChecked:e.data,tabIndex:-1,onMouseDown:this.preventFocus};return![null,1].includes(this.props.maxFilesSelect)&&this.props.selectedFiles.length>=this.props.maxFilesSelect&&!e.data&&(t.disabled=!0),r.default.createElement("input",t)}return null}renderDate(e){return"folder"===e.rowData.type?null:(moment.locale(s.default.detectLocale()),r.default.createElement("span",null,moment(e.data).format("L LT")))}renderThumbnail(e){const t=e.data||e.rowData.url,n=e.rowData.queuedId&&!e.rowData.id,o=e.rowData.category||"false",i="gallery__table-image",s=[i],l={};return s.push(`${i}--${o}`),"image"===o&&t&&(l.backgroundImage=`url("${t}")`),n||t||"folder"===o||s.push(`${i}--error`),r.default.createElement("div",{className:s.join(" "),style:l})}render(){return r.default.createElement(i.default,this.getTableProps())}}t.Component=f,f.defaultProps=a.galleryViewDefaultProps,f.propTypes={...a.galleryViewPropTypes,sort:o.default.string.isRequired,VersionedBadge:o.default.elementType};t.default=(0,c.compose)((0,d.inject)(["VersionedBadge"],(e=>({VersionedBadge:e}))))(f)},2853:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=d(n(5815)),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=n(5207),s=n(5789),l=d(n(9888)),a=d(n(6935));function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}function d(e){return e&&e.__esModule?e:{default:e}}class c extends o.Component{constructor(e){super(e),this.renderItem=this.renderItem.bind(this),this.handleSetPage=this.handleSetPage.bind(this),this.handlePrevPage=this.handlePrevPage.bind(this),this.handleNextPage=this.handleNextPage.bind(this),this.handleDrag=this.handleDrag.bind(this)}handleDrag(e){this.props.onEnableDropzone(!e)}handleSetPage(e){this.props.onSetPage(e+1)}handleNextPage(){const e=this.props.page-1;this.handleSetPage(e+1)}handlePrevPage(){const e=this.props.page-1;0!==e?this.handleSetPage(e-1):this.handleSetPage(e)}folderFilter(e){return"folder"===e.type}fileFilter(e){return"folder"!==e.type}renderPagination(){if(this.props.totalCount<=this.props.limit)return null;const e={setPage:this.handleSetPage,maxPage:Math.ceil(this.props.totalCount/this.props.limit),next:this.handleNextPage,nextText:r.default._t("AssetAdmin.NEXT","Next"),previous:this.handlePrevPage,previousText:r.default._t("AssetAdmin.PREVIOUS","Previous"),currentPage:this.props.page-1,useGriddleStyles:!1};return o.default.createElement("div",{className:"griddle-footer"},o.default.createElement(l.default.GridPagination,e))}renderItem(e){const{File:t,Folder:n,badges:r,sectionConfig:i,selectedFiles:s,selectableItems:l,selectableFolders:a}=this.props,u=r.find((t=>t.id===e.id));let d={sectionConfig:i,key:e.key,selectableKey:e.id,item:e,selectedFiles:s,onDrag:this.handleDrag,badge:u,canDrag:this.props.canDrag};if(e.queuedId&&!e.id){const{onCancelUpload:e,onRemoveErroredUpload:t}=this.props;d={...d,onCancelUpload:e,onRemoveErroredUpload:t}}else{const{onOpenFolder:t,onOpenFile:n}=this.props;d={...d,onActivate:"folder"===e.type?t:n}}if(l&&(a||"folder"!==e.type)){const e=![null,1].includes(this.props.maxFilesSelect)&&this.props.selectedFiles.length>=this.props.maxFilesSelect,t=1===this.props.maxFilesSelect?d.onActivate:this.props.onSelect;d={...d,selectable:!0,onSelect:t,maxSelected:e}}if("folder"===e.type){const{onDropFiles:e}=this.props;return d={...d,onDropFiles:e},o.default.createElement(n,d)}return o.default.createElement(t,d)}render(){return o.default.createElement("div",{className:"gallery__main-view--tile"},o.default.createElement("div",{className:"gallery__folders"},this.props.files.filter(this.folderFilter).map(this.renderItem)),o.default.createElement("div",{className:"gallery__files"},this.props.files.filter(this.fileFilter).map(this.renderItem)),0===this.props.files.length&&!this.props.loading&&o.default.createElement("p",{className:"gallery__no-item-notice"},r.default._t("AssetAdmin.NOITEMSFOUND")),o.default.createElement("div",{className:"gallery__load"},this.renderPagination()))}}t.Component=c,c.defaultProps=s.galleryViewDefaultProps,c.propTypes={...s.galleryViewPropTypes,File:a.default.elementType.isRequired,Folder:a.default.elementType.isRequired};const p=(0,i.inject)(["GalleryItemFile","GalleryItemFolder"],((e,t)=>({File:e,Folder:t})),(()=>"AssetAdmin.Gallery.ThumbnailView"));t.default=p(c)},4350:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o=(r=n(6935))&&r.__esModule?r:{default:r};const i=o.default.shape({url:o.default.string,limit:o.default.number,imageRetry:o.default.shape({minRetry:o.default.number,maxRetry:o.default.number,expiry:o.default.number}),form:o.default.object,dropzoneOptions:o.default.object});t.default=i},6022:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o=(r=n(6935))&&r.__esModule?r:{default:r};const i=o.default.shape({canEdit:o.default.bool,canDelete:o.default.bool,canView:o.default.bool,exists:o.default.bool,type:o.default.string,smallThumbnail:o.default.string,thumbnail:o.default.string,width:o.default.number,height:o.default.number,category:o.default.oneOfType([o.default.bool,o.default.string]),id:o.default.number,url:o.default.string,title:o.default.string,progress:o.default.number,visibility:o.default.string,hasRestrictedAccess:o.default.bool,isTrackedFormUpload:o.default.bool});t.default=i},8268:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){let{config:{form:t},viewAction:n,folderId:r,fileId:o,type:l}=e,a=null,u=null;if(n===i)return a=t.folderCreateForm.schemaUrl,u=r,{schemaUrl:a,targetId:u};if(n===s&&o){switch(l){case"insert-media":a=t.fileInsertForm.schemaUrl;break;case"insert-link":a=t.fileEditorLinkForm.schemaUrl;break;case"select":a=t.fileSelectForm.schemaUrl;break;default:a=t.fileEditForm.schemaUrl}return u=o,{schemaUrl:a,targetId:u}}return{}};var r,o=(r=n(6379))&&r.__esModule?r:{default:r};const{CREATE_FOLDER:i,EDIT_FILE:s}=o.default.ACTIONS},9247:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(413===e)return o.default._t("AssetAdmin.ERROR_FILE_SIZE","File size limit exceeded");if(403===e&&t&&"string"==typeof t.response)return t.response;return o.default._t("AssetAdmin.ERROR_DEFAULT","Something went wrong, please try again")};var r,o=(r=n(5815))&&r.__esModule?r:{default:r}},6405:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={CONFIRM_DELETION_ASK:"CONFIRM_DELETION_ASK",CONFIRM_DELETION_CONFIRM:"CONFIRM_DELETION_CONFIRM",CONFIRM_DELETION_CANCEL:"CONFIRM_DELETION_CANCEL",CONFIRM_DELETION_RESET:"CONFIRM_DELETION_RESET",CONFIRM_DELETION_MODAL_CLOSE:"CONFIRM_DELETION_MODAL_CLOSE"}},4461:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cancel=function(){return{type:o.default.CONFIRM_DELETION_CANCEL,payload:{}}},t.confirm=function(e){return{type:o.default.CONFIRM_DELETION_ASK,payload:{files:e}}},t.deleting=function(){return{type:o.default.CONFIRM_DELETION_CONFIRM,payload:{}}},t.modalClose=function(){return{type:o.default.CONFIRM_DELETION_MODAL_CLOSE,payload:{}}},t.reset=function(){return{type:o.default.CONFIRM_DELETION_RESET,payload:{}}};var r,o=(r=n(6405))&&r.__esModule?r:{default:r}},762:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NO_TRANSITION=t.DELETING=t.CANCELING=void 0;t.NO_TRANSITION=!1,t.CANCELING="canceling",t.DELETING="deleting"},6533:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={TOGGLE_SEARCH:"TOGGLE_SEARCH",OPEN_SEARCH:"OPEN_SEARCH",CLOSE_SEARCH:"CLOSE_SEARCH"}},9517:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.closeSearch=function(){return{type:o.default.CLOSE_SEARCH,payload:null}},t.openSearch=function(){return{type:o.default.OPEN_SEARCH,payload:null}},t.toggleSearch=function(){return{type:o.default.TOGGLE_SEARCH,payload:null}};var r,o=(r=n(6533))&&r.__esModule?r:{default:r}},4913:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=["SET_LAST_SELECTED","SET_SELECTED_FILES","DESELECT_FILES","SELECT_FILES","LOAD_FILE_REQUEST","LOAD_FILE_SUCCESS","HIGHLIGHT_FILES","UPDATE_BATCH_ACTIONS","SET_NOTICE_MESSAGE","SET_ERROR_MESSAGE","SET_ENABLE_DROPZONE","SET_FILE_BADGE","CLEAR_FILE_BADGE","ACTIVATE_MODAL","DEACTIVATE_MODAL","CONCATENATE_SELECT","SET_LOADING"].reduce(((e,t)=>Object.assign(e,{[t]:`GALLERY.${t}`})),{})},4201:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.activateModal=function(e){return t=>{t({type:o.default.ACTIVATE_MODAL,payload:e})}},t.clearFileBadge=i,t.deactivateModal=function(){return e=>{e({type:o.default.DEACTIVATE_MODAL})}},t.deselectFiles=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return t=>t({type:o.default.DESELECT_FILES,payload:{ids:e}})},t.loadFile=function(e,t){return n=>{n({type:o.default.LOAD_FILE_SUCCESS,payload:{id:e,file:t}})}},t.selectFiles=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return t=>t({type:o.default.SELECT_FILES,payload:{ids:e}})},t.setConcatenateSelect=function(e){return t=>t({type:o.default.CONCATENATE_SELECT,payload:!!e})},t.setEnableDropzone=function(e){return t=>t({type:o.default.SET_ENABLE_DROPZONE,payload:{enableDropzone:e}})},t.setErrorMessage=function(e){return t=>t({type:o.default.SET_ERROR_MESSAGE,payload:{message:e}})},t.setFileBadge=function(e,t,n,r){return(s,l)=>{const{assetAdmin:a}=l(),u=a.gallery.badges.find((t=>t.id===e));u&&u.timer&&clearTimeout(u.timer);const d=r>0?setTimeout((()=>i(e)(s)),r):null;s({type:o.default.SET_FILE_BADGE,payload:{id:e,message:t,status:n,timer:d}})}},t.setLastSelected=function(e){return t=>{t({type:o.default.SET_LAST_SELECTED,payload:{id:e}})}},t.setLoading=function(e){return t=>{t({type:o.default.SET_LOADING,payload:!!e})}},t.setNoticeMessage=function(e){return t=>t({type:o.default.SET_NOTICE_MESSAGE,payload:{message:e}})},t.setSelectedFiles=function(e){return t=>{t({type:o.default.SET_SELECTED_FILES,payload:{files:e}})}};var r,o=(r=n(4913))&&r.__esModule?r:{default:r};function i(e){return t=>{t({type:o.default.CLEAR_FILE_BADGE,payload:{id:e}})}}},423:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultImageFactory=t.default=void 0;var r=i(n(1838)),o=i(n(8632));function i(e){return e&&e.__esModule?e:{default:e}}const s={minRetry:0,maxRetry:0,expiry:0,onStatusChange:()=>null,onRetry:()=>null,onReset:()=>null,onTimeout:()=>null},l=(e,t,n)=>{const r=new Image;r.onload=t,r.onerror=n,r.src=e};t.defaultImageFactory=l;t.default=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;this.options={...s,...e},this.factory=t}loadImage(e){return this.options.minRetry&&o.default.lock(e)?this.loadImageLoop(e,this.options.minRetry):null}loadImageLoop(e,t){return this.options.onStatusChange(e,r.default.LOADING),new Promise(((t,n)=>this.factory(e,t,n))).then((()=>this.handleSuccess(e))).catch((()=>this.handleError(e,t)))}handleReset(e,t){this.options.onReset(e),t()}handleTimeout(e,t){const n=setTimeout(e,t);return this.options.onTimeout(n,t),n}handleSuccess(e){o.default.unlock(e),this.options.onStatusChange(e,r.default.SUCCESS)}handleFailure(e){return o.default.unlock(e),this.options.onStatusChange(e,r.default.FAILED),this.options.expiry?new Promise((t=>{this.handleTimeout((()=>this.handleReset(e,t)),1e3*this.options.expiry)})):null}handleError(e,t){return t>this.options.maxRetry?this.handleFailure(e):(this.options.onStatusChange(e,r.default.WAITING),this.handleRetry(e,t))}handleRetry(e,t){const n=new Promise((n=>{this.handleTimeout((()=>n(this.loadImageLoop(e,2*t))),1e3*t)}));return this.options.onRetry(e,t,n),n}setOnRetry(e){this.options.onRetry=e}setOnReset(e){this.options.onReset=e}setOnStatusChange(e){this.options.onStatusChange=e}setOnTimeout(e){this.options.onTimeout=e}}},2153:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={SET_STATUS:"IMAGE_LOAD_SET_STATUS",RESET:"IMAGE_LOAD_RESET"}},769:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loadImage=function(e,t){return(n,i)=>{if(!e)return null;if(i().assetAdmin.imageLoad.files.find((t=>t.url===e)))return null;const s={...t,onStatusChange:(e,t)=>n({type:r.default.SET_STATUS,payload:{status:t,url:e}}),onReset:e=>n({type:r.default.RESET,payload:{url:e}})};return new o.default(s).loadImage(e)}};var r=i(n(2153)),o=i(n(423));function i(e){return e&&e.__esModule?e:{default:e}}},8632:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;class n{constructor(){this.urls=[]}lock(e){return!(this.urls.indexOf(e)>=0)&&(this.urls=[...this.urls,e],!0)}unlock(e){this.urls=this.urls.filter((t=>t!==e))}}t.Component=n,window.ss=window.ss||{},window.ss.imagelocker=window.ss.imagelocker||new n;t.default=window.ss.imagelocker},1838:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={DISABLED:"DISABLED",NONE:"NONE",SUCCESS:"SUCCESS",LOADING:"LOADING",WAITING:"WAITING",FAILED:"FAILED"}},2613:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={DEFINE_IMAGE_SIZE_PRESETS:"DEFINE_IMAGE_SIZE_PRESETS",INIT_FORM_SCHEMA_STACK:"INIT_FORM_SCHEMA_STACK",POP_FORM_SCHEMA:"POP_FORM_SCHEMA",PUSH_FORM_SCHEMA:"PUSH_FORM_SCHEMA",RESET:"RESET",RESET_FORM_STACK:"RESET_FORM_STACK"}},1021:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defineImageSizePresets=function(e){return{type:i.default.DEFINE_IMAGE_SIZE_PRESETS,payload:{imageSizePresets:e}}},t.initFormStack=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return{type:i.default.INIT_FORM_SCHEMA_STACK,payload:{formSchema:{type:e,nextType:t}}}},t.popFormStackEntry=function(){return{type:i.default.POP_FORM_SCHEMA}},t.pushFormStackEntry=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return{type:i.default.PUSH_FORM_SCHEMA,payload:{formSchema:{type:e,nextType:t}}}},t.reset=function(){return{type:i.default.RESET}},t.resetFormStack=function(){return{type:i.default.RESET_FORM_STACK}},t.stashFormValues=function(e,t){return(n,i)=>{const l=i(),a=(0,r.default)(l.form.formState,`${e}.values`),u=(0,r.default)(l.form.formSchemas,`${t}.schema.fields`);if(a){const e=Object.keys(a).filter((e=>null!==a[e]&&(0,s.default)(e,u))).map((e=>({name:e,value:a[e]})));n((0,o.setSchemaStateOverrides)(t,{fields:e}))}}};var r=l(n(6104)),o=n(2811),i=l(n(2613)),s=l(n(8896));function l(e){return e&&e.__esModule?e:{default:e}}},8896:function(e,t){"use strict";function n(e,t){let r;for(r=0;rt({type:o.default.ADD_QUEUED_FILE,payload:{file:e}})},t.failUpload=function(e,t,n){return r=>{let i=t.message;return t.errors&&t.errors.length&&(i=t.errors[0]),"string"==typeof t&&(i={value:n||t,type:"error"}),r({type:o.default.FAIL_UPLOAD,payload:{queuedId:e,message:i}})}},t.purgeUploadQueue=function(){return e=>e({type:o.default.PURGE_UPLOAD_QUEUE,payload:null})},t.removeQueuedFile=function(e){return t=>t({type:o.default.REMOVE_QUEUED_FILE,payload:{queuedId:e}})},t.succeedUpload=function(e,t){return n=>n({type:o.default.SUCCEED_UPLOAD,payload:{queuedId:e,json:t}})},t.updateQueuedFile=function(e,t){return n=>n({type:o.default.UPDATE_QUEUED_FILE,payload:{queuedId:e,updates:t}})};var r,o=(r=n(5793))&&r.__esModule?r:{default:r}},1804:function(e,t,n){"use strict";var r=n(5228),o={};var i=function(e){};function s(e,t,n,r,o,s,l,a){if(i(t),!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var d=[n,r,o,s,l,a],c=0;(u=new Error(t.replace(/%s/g,(function(){return d[c++]})))).name="Invariant Violation"}throw u.framesToPop=1,u}}var l="mixins";e.exports=function(e,t,n){var i=[],a={mixins:"DEFINE_MANY",statics:"DEFINE_MANY",propTypes:"DEFINE_MANY",contextTypes:"DEFINE_MANY",childContextTypes:"DEFINE_MANY",getDefaultProps:"DEFINE_MANY_MERGED",getInitialState:"DEFINE_MANY_MERGED",getChildContext:"DEFINE_MANY_MERGED",render:"DEFINE_ONCE",componentWillMount:"DEFINE_MANY",componentDidMount:"DEFINE_MANY",componentWillReceiveProps:"DEFINE_MANY",shouldComponentUpdate:"DEFINE_ONCE",componentWillUpdate:"DEFINE_MANY",componentDidUpdate:"DEFINE_MANY",componentWillUnmount:"DEFINE_MANY",UNSAFE_componentWillMount:"DEFINE_MANY",UNSAFE_componentWillReceiveProps:"DEFINE_MANY",UNSAFE_componentWillUpdate:"DEFINE_MANY",updateComponent:"OVERRIDE_BASE"},u={getDerivedStateFromProps:"DEFINE_MANY_MERGED"},d={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var n=0;n0}},{key:"getMetadataColumnProperty",value:function(e,t,n){var r=this.getColumnMetadataByName(e);return null==r?n:r.hasOwnProperty(t)?r[t]:n}},{key:"orderColumns",value:function(e){var t=this;return l(e,(function(e){var n=s(t.columnMetadata,{columnName:e});return null==n||isNaN(n.order)?100:n.order}))}},{key:"getColumns",value:function(){var e=0===this.filteredColumns.length?this.allColumns:this.filteredColumns;return e=a(e,this.metadataColumns),e=this.orderColumns(e)}}]),e}();e.exports=u},3715:function(e,t,n){"use strict";var r=n(1594),o=n(2306)({getDefaultProps:function(){return{placeholderText:""}},render:function(){return"function"!=typeof this.props.customFilterComponent?(console.log("Couldn't find valid template."),r.createElement("div",null)):r.createElement(this.props.customFilterComponent,{changeFilter:this.props.changeFilter,results:this.props.results,currentResults:this.props.currentResults,placeholderText:this.props.placeholderText})}});e.exports=o},8465:function(e,t,n){"use strict";var r=Object.assign||function(e){for(var t=1;t0&&(e=r.createElement("button",{type:"button",onClick:this.props.previous,style:this.props.useGriddleStyles?{color:"#222",border:"none",background:"none",margin:"0 0 0 10px"}:null},this.props.previousIconComponent,this.props.previousText)),this.props.currentPage!==this.props.maxPage-1&&(t=r.createElement("button",{type:"button",onClick:this.props.next,style:this.props.useGriddleStyles?{color:"#222",border:"none",background:"none",margin:"0 10px 0 0"}:null},this.props.nextText,this.props.nextIconComponent));var n=null,o=null,s=null;if(!0===this.props.useGriddleStyles){var l={float:"left",minHeight:"1px",marginTop:"5px"};s=i({textAlign:"right",width:"34%"},l),o=i({textAlign:"center",width:"33%"},l),n=i({width:"33%"},l)}for(var a=[],u=1;u<=this.props.maxPage;u++)a.push(r.createElement("option",{value:u,key:u},u));return r.createElement("div",{style:this.props.useGriddleStyles?{minHeight:"35px"}:null},r.createElement("div",{className:this.props.previousClassName,style:n},e),r.createElement("div",{className:"griddle-page",style:o},r.createElement("select",{value:this.props.currentPage+1,onChange:this.pageChange},a)," / ",this.props.maxPage),r.createElement("div",{className:this.props.nextClassName,style:s},t))}});e.exports=s},1507:function(e,t,n){"use strict";var r=n(1594),o=n(2306),i=(n(493),n(9280)),s=n(1882),l=n(7248),a=n(6139),u=n(4684),d=n(8938),c=n(1648),p=o({getDefaultProps:function(){return{isChildRow:!1,showChildren:!1,data:{},columnSettings:null,rowSettings:null,hasChildren:!1,useGriddleStyles:!0,useGriddleIcons:!0,isSubGriddle:!1,paddingHeight:null,rowHeight:null,parentRowCollapsedClassName:"parent-row",parentRowExpandedClassName:"parent-row expanded",parentRowCollapsedComponent:"▶",parentRowExpandedComponent:"▼",onRowClick:null,multipleSelectionSettings:null,onRowMouseEnter:null,onRowMouseLeave:null,onRowWillMount:null,onRowWillUnmount:null}},componentWillMount:function(){null!==this.props.onRowWillMount&&s(this.props.onRowWillMount)&&this.props.onRowWillMount(this)},componentWillUnmount:function(){null!==this.props.onRowWillUnmount&&s(this.props.onRowWillUnmount)&&this.props.onRowWillUnmount(this)},handleClick:function(e){null!==this.props.onRowClick&&s(this.props.onRowClick)?this.props.onRowClick(this,e):this.props.hasChildren&&this.props.toggleChildren()},handleMouseEnter:function(e){null!==this.props.onRowMouseEnter&&s(this.props.onRowMouseEnter)&&this.props.onRowMouseEnter(this,e)},handleMouseLeave:function(e){null!==this.props.onRowMouseLeave&&s(this.props.onRowMouseLeave)&&this.props.onRowMouseLeave(this,e)},handleSelectionChange:function(e){},handleSelectClick:function(e){this.props.multipleSelectionSettings.isMultipleSelection&&("checkbox"===e.target.type?this.props.multipleSelectionSettings.toggleSelectRow(this.props.data,this.refs.selected.checked):this.props.multipleSelectionSettings.toggleSelectRow(this.props.data,!this.refs.selected.checked))},verifyProps:function(){null===this.props.columnSettings&&console.error("gridRow: The columnSettings prop is null and it shouldn't be")},formatData:function(e){return"boolean"==typeof e?String(e):e},render:function(){var e=this;this.verifyProps();var t=this,n=null;this.props.useGriddleStyles&&(n={margin:"0px",padding:t.props.paddingHeight+"px 5px "+t.props.paddingHeight+"px 5px",height:t.props.rowHeight?this.props.rowHeight-2*t.props.paddingHeight+"px":null,backgroundColor:"#FFF",borderTopColor:"#DDD",color:"#222"});var o=this.props.columnSettings.getColumns(),p=l(o,[]),h=a({},this.props.data);u(h,p);var f,m,g=d(i.pick(h,c(o,"children"))).map((function(t,o){var i=null,s=e.props.columnSettings.getColumnMetadataByName(t[0]),l=0===o&&e.props.hasChildren&&!1===e.props.showChildren&&e.props.useGriddleIcons?r.createElement("span",{style:e.props.useGriddleStyles?{fontSize:"10px",marginRight:"5px"}:null},e.props.parentRowCollapsedComponent):0===o&&e.props.hasChildren&&e.props.showChildren&&e.props.useGriddleIcons?r.createElement("span",{style:e.props.useGriddleStyles?{fontSize:"10px"}:null},e.props.parentRowExpandedComponent):"";if(0===o&&e.props.isChildRow&&e.props.useGriddleStyles&&(n=a(n,{paddingLeft:10})),e.props.columnSettings.hasColumnMetadata()&&null!=s)if(void 0!==s.customComponent&&null!==s.customComponent){var u=r.createElement(s.customComponent,{data:t[1],rowData:h,metadata:s});i=r.createElement("td",{onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,onMouseLeave:e.handleMouseLeave,className:s.cssClassName,key:o,style:n},u)}else i=r.createElement("td",{onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,onMouseLeave:e.handleMouseLeave,className:s.cssClassName,key:o,style:n},l,e.formatData(t[1]));return i||r.createElement("td",{onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,onMouseLeave:e.handleMouseLeave,key:o,style:n},l,t[1])}));if(null!==this.props.onRowClick&&s(this.props.onRowClick)?(f=null,m=this.handleSelectClick):this.props.multipleSelectionSettings&&this.props.multipleSelectionSettings.isMultipleSelection?(f=this.handleSelectClick,m=null):(f=null,m=null),g&&this.props.multipleSelectionSettings&&this.props.multipleSelectionSettings.isMultipleSelection){this.props.multipleSelectionSettings.getSelectedRowIds();g.unshift(r.createElement("td",{key:"selection",style:n,className:"griddle-select griddle-select-cell",onClick:m},r.createElement("input",{type:"checkbox",checked:this.props.multipleSelectionSettings.getIsRowChecked(h),onChange:this.handleSelectionChange,ref:"selected"})))}var y=t.props.rowSettings&&t.props.rowSettings.getBodyRowMetadataClass(t.props.data)||"standard-row";return t.props.isChildRow?y="child-row":t.props.hasChildren&&(y=t.props.showChildren?this.props.parentRowExpandedClassName:this.props.parentRowCollapsedClassName),r.createElement("tr",{onClick:f,className:y},g)}});e.exports=p},4734:function(e,t,n){"use strict";var r=n(1594),o=n(2306),i=(n(493),n(4383)),s=o({getDefaultProps:function(){return{useGriddleStyles:!0,useGriddleIcons:!0,isSubGriddle:!1,columnSettings:null,rowSettings:null,paddingHeight:null,rowHeight:null,parentRowCollapsedClassName:"parent-row",parentRowExpandedClassName:"parent-row expanded",parentRowCollapsedComponent:"▶",parentRowExpandedComponent:"▼",onRowClick:null,onRowMouseEnter:null,onRowMouseLeave:null,onRowWillMount:null,onRowWillUnmount:null,multipleSelectionSettings:null}},getInitialState:function(){return{data:{},showChildren:!1}},componentWillReceiveProps:function(){this.setShowChildren(!1)},toggleChildren:function(){this.setShowChildren(!1===this.state.showChildren)},setShowChildren:function(e){this.setState({showChildren:e})},verifyProps:function(){null===this.props.columnSettings&&console.error("gridRowContainer: The columnSettings prop is null and it shouldn't be")},render:function(){this.verifyProps();var e=this;if(void 0===this.props.data)return r.createElement("tbody",null);var t=[],n=this.props.columnSettings.getColumns();t.push(r.createElement(this.props.rowSettings.rowComponent,{useGriddleStyles:this.props.useGriddleStyles,isSubGriddle:this.props.isSubGriddle,data:this.props.rowSettings.isCustom?i(this.props.data,n):this.props.data,rowData:this.props.rowSettings.isCustom?this.props.data:null,columnSettings:this.props.columnSettings,rowSettings:this.props.rowSettings,hasChildren:e.props.hasChildren,toggleChildren:e.toggleChildren,showChildren:e.state.showChildren,key:e.props.uniqueId+"_base_row",useGriddleIcons:e.props.useGriddleIcons,parentRowExpandedClassName:this.props.parentRowExpandedClassName,parentRowCollapsedClassName:this.props.parentRowCollapsedClassName,parentRowExpandedComponent:this.props.parentRowExpandedComponent,parentRowCollapsedComponent:this.props.parentRowCollapsedComponent,paddingHeight:e.props.paddingHeight,rowHeight:e.props.rowHeight,onRowClick:e.props.onRowClick,onRowMouseEnter:e.props.onRowMouseEnter,onRowMouseLeave:e.props.onRowMouseLeave,multipleSelectionSettings:this.props.multipleSelectionSettings,onRowWillMount:e.props.onRowWillMount,onRowWillUnmount:e.props.onRowWillUnmount}));var o=null;return e.state.showChildren&&(o=e.props.hasChildren&&this.props.data.children.map((function(t,n){var o=e.props.rowSettings.getRowKey(t,n);if(void 0!==t.children){var i=e.constructor.Griddle;return r.createElement("tr",{key:o,style:{paddingLeft:5}},r.createElement("td",{colSpan:e.props.columnSettings.getVisibleColumnCount(),className:"griddle-parent",style:e.props.useGriddleStyles?{border:"none",padding:"0 0 0 5px"}:null},r.createElement(i,{rowMetadata:{key:"id"},isSubGriddle:!0,results:[t],columns:e.props.columnSettings.getColumns(),tableClassName:e.props.tableClassName,parentRowExpandedClassName:e.props.parentRowExpandedClassName,parentRowCollapsedClassName:e.props.parentRowCollapsedClassName,showTableHeading:!1,showPager:!1,columnMetadata:e.props.columnSettings.columnMetadata,parentRowExpandedComponent:e.props.parentRowExpandedComponent,parentRowCollapsedComponent:e.props.parentRowCollapsedComponent,paddingHeight:e.props.paddingHeight,rowHeight:e.props.rowHeight})))}return r.createElement(e.props.rowSettings.rowComponent,{useGriddleStyles:e.props.useGriddleStyles,isSubGriddle:e.props.isSubGriddle,data:t,columnSettings:e.props.columnSettings,isChildRow:!0,columnMetadata:e.props.columnSettings.columnMetadata,key:o})}))),!1===e.props.hasChildren?t[0]:r.createElement("tbody",null,e.state.showChildren?t.concat(o):t)}});e.exports=s},4376:function(e,t,n){"use strict";var r=n(1594),o=n(2306),i=n(9859),s=n(1648),l=n(7309),a=o({getDefaultProps:function(){return{columns:[],columnMetadata:[],selectedColumns:[],settingsText:"",maxRowsText:"",resultsPerPage:0,enableToggleCustom:!1,useCustomComponent:!1,useGriddleStyles:!0,toggleCustomComponent:function(){}}},setPageSize:function(e){var t=parseInt(e.target.value,10);this.props.setPageSize(t)},handleChange:function(e){var t=e.target.dataset?e.target.dataset.name:e.target.getAttribute("data-name");!0===e.target.checked&&!1===i(this.props.selectedColumns,t)?(this.props.selectedColumns.push(t),this.props.setColumns(this.props.selectedColumns)):this.props.setColumns(s(this.props.selectedColumns,t))},render:function(){var e=this,t=[];!1===e.props.useCustomComponent&&(t=this.props.columns.map((function(t,n){var o=i(e.props.selectedColumns,t),s=l(e.props.columnMetadata,{columnName:t}),a=t;return void 0!==s&&void 0!==s.displayName&&null!=s.displayName&&(a=s.displayName),void 0!==s&&null!=s&&s.locked?r.createElement("div",{className:"column checkbox"},r.createElement("label",null,r.createElement("input",{type:"checkbox",disabled:!0,name:"check",checked:o,"data-name":t}),a)):void 0!==s&&null!=s&&void 0!==s.visible&&!1===s.visible?null:r.createElement("div",{className:"griddle-column-selection checkbox",key:t,style:e.props.useGriddleStyles?{float:"left",width:"20%"}:null},r.createElement("label",null,r.createElement("input",{type:"checkbox",name:"check",onChange:e.handleChange,checked:o,"data-name":t}),a))})));var n=e.props.enableToggleCustom?r.createElement("div",{className:"form-group"},r.createElement("label",{htmlFor:"maxRows"},r.createElement("input",{type:"checkbox",checked:this.props.useCustomComponent,onChange:this.props.toggleCustomComponent})," ",this.props.enableCustomFormatText)):"",o=this.props.showSetPageSize?r.createElement("div",null,r.createElement("label",{htmlFor:"maxRows"},this.props.maxRowsText,":",r.createElement("select",{onChange:this.setPageSize,value:this.props.resultsPerPage},r.createElement("option",{value:"5"},"5"),r.createElement("option",{value:"10"},"10"),r.createElement("option",{value:"25"},"25"),r.createElement("option",{value:"50"},"50"),r.createElement("option",{value:"100"},"100")))):"";return r.createElement("div",{className:"griddle-settings",style:this.props.useGriddleStyles?{backgroundColor:"#FFF",border:"1px solid #DDD",color:"#222",padding:"10px",marginBottom:"10px"}:null},r.createElement("h6",null,this.props.settingsText),r.createElement("div",{className:"griddle-columns",style:this.props.useGriddleStyles?{clear:"both",display:"table",width:"100%",borderBottom:"1px solid #EDEDED",marginBottom:"10px"}:null},t),o,n)}});e.exports=a},2991:function(e,t,n){"use strict";var r=n(1594),o=n(2306),i=n(9593),s=n(4734),l=(n(493),n(1545),o({getDefaultProps:function(){return{data:[],columnSettings:null,rowSettings:null,sortSettings:null,multipleSelectionSettings:null,className:"",enableInfiniteScroll:!1,nextPage:null,hasMorePages:!1,useFixedHeader:!1,useFixedLayout:!0,paddingHeight:null,rowHeight:null,filterByColumn:null,infiniteScrollLoadTreshold:null,bodyHeight:null,useGriddleStyles:!0,useGriddleIcons:!0,isSubGriddle:!1,parentRowCollapsedClassName:"parent-row",parentRowExpandedClassName:"parent-row expanded",parentRowCollapsedComponent:"▶",parentRowExpandedComponent:"▼",externalLoadingComponent:null,externalIsLoading:!1,onRowClick:null,onRowMouseEnter:null,onRowMouseLeave:null,onRowWillMount:null,onRowWillUnmount:null}},getInitialState:function(){return{scrollTop:0,scrollHeight:this.props.bodyHeight,clientHeight:this.props.bodyHeight}},componentDidMount:function(){this.gridScroll()},componentDidUpdate:function(e,t){this.gridScroll()},gridScroll:function(){if(this.props.enableInfiniteScroll&&!this.props.externalIsLoading){var e=this.refs.scrollable,t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;if(null!==this.props.rowHeight&&this.state.scrollTop!==t&&Math.abs(this.state.scrollTop-t)>=this.getAdjustedRowHeight()){var o={scrollTop:t,scrollHeight:n,clientHeight:r};this.setState(o)}.6*(n-(t+r)-this.props.infiniteScrollLoadTreshold)<=this.props.infiniteScrollLoadTreshold&&this.props.nextPage()}},verifyProps:function(){null===this.props.columnSettings&&console.error("gridTable: The columnSettings prop is null and it shouldn't be"),null===this.props.rowSettings&&console.error("gridTable: The rowSettings prop is null and it shouldn't be")},getAdjustedRowHeight:function(){return this.props.rowHeight+2*this.props.paddingHeight},getNodeContent:function(){this.verifyProps();var e=this,t=!1;if(!this.props.externalIsLoading||this.props.enableInfiniteScroll){var n=e.props.data,o=null,i=null;if(this.props.enableInfiniteScroll&&null!==this.props.rowHeight&&void 0!==this.refs.scrollable){var l=e.getAdjustedRowHeight(),a=Math.ceil(e.state.clientHeight/l),u=Math.max(0,Math.floor(e.state.scrollTop/l)-.25*a),d=Math.min(u+1.25*a,this.props.data.length-1);n=n.slice(u,d+1);var c={height:u*l+"px"};o=r.createElement("tr",{key:"above-"+c.height,style:c});var p={height:(this.props.data.length-d)*l+"px"};i=r.createElement("tr",{key:"below-"+p.height,style:p})}var h=n.map((function(n,o){var i=void 0!==n.children&&n.children.length>0,l=e.props.rowSettings.getRowKey(n,o);return i&&(t=i),r.createElement(s,{useGriddleStyles:e.props.useGriddleStyles,isSubGriddle:e.props.isSubGriddle,parentRowExpandedClassName:e.props.parentRowExpandedClassName,parentRowCollapsedClassName:e.props.parentRowCollapsedClassName,parentRowExpandedComponent:e.props.parentRowExpandedComponent,parentRowCollapsedComponent:e.props.parentRowCollapsedComponent,data:n,key:l+"-container",uniqueId:l,columnSettings:e.props.columnSettings,rowSettings:e.props.rowSettings,paddingHeight:e.props.paddingHeight,multipleSelectionSettings:e.props.multipleSelectionSettings,rowHeight:e.props.rowHeight,hasChildren:i,tableClassName:e.props.className,onRowClick:e.props.onRowClick,onRowMouseEnter:e.props.onRowMouseEnter,onRowMouseLeave:e.props.onRowMouseLeave,onRowWillMount:e.props.onRowWillMount,onRowWillUnmount:e.props.onRowWillUnmount})}));if(this.props.showNoData){var f=this.props.columnSettings.getVisibleColumnCount();h.push(r.createElement("tr",{key:"no-data-section"},r.createElement("td",{colSpan:f},this.props.noDataSection)))}return o&&h.unshift(o),i&&h.push(i),{nodes:h,anyHasChildren:t}}return null},render:function(){var e=[],t=!1,n=this.getNodeContent();n&&(e=n.nodes,t=n.anyHasChildren);var o=null,s=null,l={width:"100%"};if(this.props.useFixedLayout&&(l.tableLayout="fixed"),this.props.enableInfiniteScroll&&(o={position:"relative",overflowY:"scroll",height:this.props.bodyHeight+"px",width:"100%"}),this.props.externalIsLoading){var a,u=null;this.props.useGriddleStyles&&(u={textAlign:"center",paddingBottom:"40px"}),a=this.props.columnSettings.getVisibleColumnCount();var d=this.props.externalLoadingComponent?r.createElement(this.props.externalLoadingComponent,null):r.createElement("div",null,"Loading...");s=r.createElement("tbody",null,r.createElement("tr",null,r.createElement("td",{style:u,colSpan:a},d)))}var c=this.props.showTableHeading?r.createElement(i,{useGriddleStyles:this.props.useGriddleStyles,useGriddleIcons:this.props.useGriddleIcons,sortSettings:this.props.sortSettings,multipleSelectionSettings:this.props.multipleSelectionSettings,columnSettings:this.props.columnSettings,filterByColumn:this.props.filterByColumn,rowSettings:this.props.rowSettings}):void 0;t||(e=r.createElement("tbody",null,e));var p=r.createElement("tbody",null);if(this.props.showPager){var h=this.props.useGriddleStyles?{padding:"0px",backgroundColor:"#EDEDED",border:"0px",color:"#222",height:this.props.showNoData?"20px":null}:null;p=r.createElement("tbody",null,r.createElement("tr",null,r.createElement("td",{colSpan:this.props.multipleSelectionSettings.isMultipleSelection?this.props.columnSettings.getVisibleColumnCount()+1:this.props.columnSettings.getVisibleColumnCount(),style:h,className:"footer-container"},this.props.showNoData?null:this.props.pagingContent)))}return this.props.useFixedHeader?(this.props.useGriddleStyles&&(l.tableLayout="fixed"),r.createElement("div",null,r.createElement("table",{className:this.props.className,style:this.props.useGriddleStyles&&l||null},c),r.createElement("div",{ref:"scrollable",onScroll:this.gridScroll,style:o},r.createElement("table",{className:this.props.className,style:this.props.useGriddleStyles&&l||null},e,s,p)))):r.createElement("div",{ref:"scrollable",onScroll:this.gridScroll,style:o},r.createElement("table",{className:this.props.className,style:this.props.useGriddleStyles&&l||null},c,e,s,p))}}));e.exports=l},9593:function(e,t,n){"use strict";var r=Object.assign||function(e){for(var t=1;t=0)return!0}return!1}))},defaultColumnFilter:function(e,t,n){var r=N(A(n)?n:[n],(function(e){return(e||"").toLowerCase()}));return L(b.getObjectValues(t),(function(e){return e=e.toString().toLowerCase(),L(r,(function(t){return e.indexOf(t)>=0}))}))},filterByColumnFilters:function(e){var t=this.props.columnFilterFunc||this.defaultColumnFilter,n=Object.keys(e).reduce((function(n,r){return P(n,(function(n){var o=b.getAt(n,r||""),i=e[r];return t(r||"",o,i)}))}),this.props.results),r={columnFilters:e};e?(r.filteredResults=n,r.maxPage=this.getMaxPage(r.filteredResults)):this.state.filter?r.filteredResults=this.props.useCustomFilterer?this.props.customFilterer(this.props.results,filter):this.defaultFilter(this.props.results,filter):r.filteredResults=null,this.setState(r)},filterByColumn:function(e,t){var n=this.state.columnFilters;if(n.hasOwnProperty(t)&&!e)n=R(n,t);else{var r={};r[t]=e,n=M({},n,r)}this.filterByColumnFilters(n)},setFilter:function(e){var t=arguments.length<=1||void 0===arguments[1]?null:arguments[1];if(this.props.useExternal)this.props.externalSetFilter(e);else{var n={page:0,filter:e};n.filteredResults=this.props.useCustomFilterer?this.props.customFilterer(t||this.props.results,e):this.defaultFilter(t||this.props.results,e),n.maxPage=this.getMaxPage(n.filteredResults),(D(e)||I(e)||O(e))&&(n.filter=e,n.filteredResults=null),this.setState(n),this._resetSelectedRows()}},setPageSize:function(e){if(this.props.useExternal)return this.setState({resultsPerPage:e}),void this.props.externalSetPageSize(e);this.state.resultsPerPage=e,this.setMaxPage()},toggleColumnChooser:function(){this.setState({showColumnChooser:!this.state.showColumnChooser})},isNullOrUndefined:function(e){return null==e},shouldUseCustomRowComponent:function(){return this.isNullOrUndefined(this.state.useCustomRowComponent)?this.props.useCustomRowComponent:this.state.useCustomRowComponent},shouldUseCustomGridComponent:function(){return this.isNullOrUndefined(this.state.useCustomGridComponent)?this.props.useCustomGridComponent:this.state.useCustomGridComponent},toggleCustomComponent:function(){"grid"===this.state.customComponentType?this.setState({useCustomGridComponent:!this.shouldUseCustomGridComponent()}):"row"===this.state.customComponentType&&this.setState({useCustomRowComponent:!this.shouldUseCustomRowComponent()})},getMaxPage:function(e,t){return this.props.useExternal?this.props.externalMaxPage:(t||(t=(e||this.getCurrentResults()).length),Math.ceil(t/this.state.resultsPerPage))},setMaxPage:function(e){var t=this.getMaxPage(e);this.state.maxPage!==t&&this.setState({page:0,maxPage:t,filteredColumns:this.columnSettings.filteredColumns})},setPage:function(e){if(this.props.useExternal)this.props.externalSetPage(e);else{if(e*this.state.resultsPerPage<=this.state.resultsPerPage*this.state.maxPage){var t={page:e};this.setState(t)}this.props.enableInfiniteScroll&&this.setState({isSelectAllChecked:!1})}},setColumns:function(e){this.columnSettings.filteredColumns=A(e)?e:[e],this.setState({filteredColumns:this.columnSettings.filteredColumns})},nextPage:function(){var e=this.getCurrentPage();e0&&this.setPage(e-1)},changeSort:function(e){if(!1!==this.props.enableSort){if(this.props.useExternal){var t=this.props.externalSortColumn!==e||!this.props.externalSortAscending;return this.setState({sortColumn:e,sortDirection:t?"asc":"desc"}),void this.props.externalChangeSort(e,t)}var n=E(this.props.columnMetadata,{columnName:e})||{},r=n.sortDirectionCycle?n.sortDirectionCycle:[null,"asc","desc"],o=r.indexOf(this.state.sortDirection&&e===this.state.sortColumn?this.state.sortDirection:null),i={page:0,sortColumn:e,sortDirection:r[o=(o+1)%r.length]?r[o]:null};this.setState(i)}},componentWillReceiveProps:function(e){if(e.results!==this.props.results&&this.setFilter(this.state.filter,e.results),this.setMaxPage(e.results),e.resultsPerPage!==this.props.resultsPerPage&&this.setPageSize(e.resultsPerPage),this.columnSettings.columnMetadata=e.columnMetadata,e.results.length>0){var t=b.keys(e.results[0]);this.columnSettings.allColumns.length==t.length&&this.columnSettings.allColumns.every((function(e,n){return e===t[n]}))||(this.columnSettings.allColumns=t)}else this.columnSettings.allColumns.length>0&&(this.columnSettings.allColumns=[]);if(e.selectedRowIds){var n=this.getDataForRender(this.getCurrentResults(e.results),this.columnSettings.getColumns(),!0);this.setState({isSelectAllChecked:this._getAreAllRowsChecked(e.selectedRowIds,N(n,this.props.uniqueIdentifier)),selectedRowIds:e.selectedRowIds})}},getInitialState:function(){return{maxPage:0,page:0,filteredResults:null,filteredColumns:[],filter:"",columnFilters:{},resultsPerPage:this.props.resultsPerPage||5,showColumnChooser:!1,isSelectAllChecked:!1,selectedRowIds:this.props.selectedRowIds}},componentWillMount:function(){this.verifyExternal(),this.verifyCustom(),this.columnSettings=new y(this.props.results.length>0?b.keys(this.props.results[0]):[],this.props.columns,this.props.childrenColumnName,this.props.columnMetadata,this.props.metadataColumns),this.rowSettings=new v(this.props.rowMetadata,this.props.useCustomTableRowComponent&&this.props.customTableRowComponent?this.props.customTableRowComponent:p,this.props.useCustomTableRowComponent),this.props.initialSort&&(this.props.useExternal?this.setState({sortColumn:this.props.externalSortColumn,sortDirection:this.props.externalSortAscending?"asc":"desc"}):this.changeSort(this.props.initialSort)),this.setMaxPage(),this.shouldUseCustomGridComponent()?this.setState({customComponentType:"grid"}):this.shouldUseCustomRowComponent()?this.setState({customComponentType:"row"}):this.setState({filteredColumns:this.columnSettings.filteredColumns})},componentDidMount:function(){if(this.props.componentDidMount&&"function"==typeof this.props.componentDidMount)return this.props.componentDidMount()},componentDidUpdate:function(){if(this.props.componentDidUpdate&&"function"==typeof this.props.componentDidUpdate)return this.props.componentDidUpdate(this.state)},verifyExternal:function(){!0===this.props.useExternal&&(null===this.props.externalSetPage&&console.error("useExternal is set to true but there is no externalSetPage function specified."),null===this.props.externalChangeSort&&console.error("useExternal is set to true but there is no externalChangeSort function specified."),null===this.props.externalSetFilter&&console.error("useExternal is set to true but there is no externalSetFilter function specified."),null===this.props.externalSetPageSize&&console.error("useExternal is set to true but there is no externalSetPageSize function specified."),null===this.props.externalMaxPage&&console.error("useExternal is set to true but externalMaxPage is not set."),null===this.props.externalCurrentPage&&console.error("useExternal is set to true but externalCurrentPage is not set. Griddle will not page correctly without that property when using external data."))},verifyCustom:function(){!0===this.props.useCustomGridComponent&&null===this.props.customGridComponent&&console.error("useCustomGridComponent is set to true but no custom component was specified."),!0===this.props.useCustomRowComponent&&null===this.props.customRowComponent&&console.error("useCustomRowComponent is set to true but no custom component was specified."),!0===this.props.useCustomGridComponent&&!0===this.props.useCustomRowComponent&&console.error("Cannot currently use both customGridComponent and customRowComponent."),!0===this.props.useCustomFilterer&&null===this.props.customFilterer&&console.error("useCustomFilterer is set to true but no custom filter function was specified."),!0===this.props.useCustomFilterComponent&&null===this.props.customFilterComponent&&console.error("useCustomFilterComponent is set to true but no customFilterComponent was specified.")},getDataForRender:function(e,t,n){var r=this,o=this;if(!this.props.useExternal){if(""!==this.state.sortColumn){var i,s=this.state.sortColumn,l=P(this.props.columnMetadata,{columnName:s}),a={columns:[],orders:[]};if(l.length>0&&(i=l[0].hasOwnProperty("customCompareFn")&&l[0].customCompareFn,l[0].multiSort&&(a=l[0].multiSort)),this.state.sortDirection)if("function"==typeof i)2===i.length?(e=e.sort((function(e,t){return i(k(e,s),k(t,s))})),"desc"===this.state.sortDirection&&e.reverse()):1===i.length&&(e=T(e,(function(e){return i(k(e,s))}),[this.state.sortDirection]));else{var u=[function(e){return(k(e,s)||"").toString().toLowerCase()}],d=[this.state.sortDirection];a.columns.forEach((function(e,t){u.push((function(t){return(k(t,e)||"").toString().toLowerCase()})),"asc"===a.orders[t]||"desc"===a.orders[t]?d.push(a.orders[t]):d.push(r.state.sortDirection)})),e=T(e,u,d)}}var c=this.getCurrentPage();if(!this.props.useExternal&&n&&this.state.resultsPerPage*(c+1)<=this.state.resultsPerPage*this.state.maxPage&&c>=0)if(this.isInfiniteScrollEnabled())e=_(e,(c+1)*this.state.resultsPerPage);else{var p=C(e,c*this.state.resultsPerPage);e=(S||x)(p,p.length-this.state.resultsPerPage)}}for(var h=[],f=0;f0&&(m.children=o.getDataForRender(m[o.props.childrenColumnName],t,!1),"children"!==o.props.childrenColumnName&&delete m[o.props.childrenColumnName]),h.push(m)}return h},getCurrentResults:function(e){return this.state.filteredResults||e||this.props.results},getCurrentPage:function(){return this.props.externalCurrentPage||this.state.page},getCurrentSort:function(){return this.props.useExternal?this.props.externalSortColumn:this.state.sortColumn},getCurrentSortAscending:function(){return this.props.useExternal?this.props.externalSortAscending:"asc"===this.state.sortDirection},getCurrentMaxPage:function(){return this.props.useExternal?this.props.externalMaxPage:this.state.maxPage},getSortObject:function(){return{enableSort:this.props.enableSort,changeSort:this.changeSort,sortColumn:this.getCurrentSort(),sortAscending:this.getCurrentSortAscending(),sortDirection:this.state.sortDirection,sortAscendingClassName:this.props.sortAscendingClassName,sortDescendingClassName:this.props.sortDescendingClassName,sortAscendingComponent:this.props.sortAscendingComponent,sortDescendingComponent:this.props.sortDescendingComponent,sortDefaultComponent:this.props.sortDefaultComponent}},_toggleSelectAll:function(){var e=this.getDataForRender(this.getCurrentResults(),this.columnSettings.getColumns(),!0),t=!this.state.isSelectAllChecked,n=JSON.parse(JSON.stringify(this.state.selectedRowIds)),r=this;w(e,(function(e){r._updateSelectedRowIds(e[r.props.uniqueIdentifier],n,t)}),this),this.setState({isSelectAllChecked:t,selectedRowIds:n}),this.props.onSelectionChange&&this.props.onSelectionChange(n,t)},_toggleSelectRow:function(e,t){var n=this.getDataForRender(this.getCurrentResults(),this.columnSettings.getColumns(),!0),r=JSON.parse(JSON.stringify(this.state.selectedRowIds));this._updateSelectedRowIds(e[this.props.uniqueIdentifier],r,t);var o=this._getAreAllRowsChecked(r,N(n,this.props.uniqueIdentifier));this.setState({isSelectAllChecked:o,selectedRowIds:r}),this.props.onSelectionChange&&this.props.onSelectionChange(r,o)},_updateSelectedRowIds:function(e,t,n){n?void 0===E(t,(function(t){return e===t}))&&t.push(e):t.splice(t.indexOf(e),1)},_getIsSelectAllChecked:function(){return this.state.isSelectAllChecked},_getAreAllRowsChecked:function(e,t){return t.length===F(t,e).length},_getIsRowChecked:function(e){return this.state.selectedRowIds.indexOf(e[this.props.uniqueIdentifier])>-1},getSelectedRowIds:function(){return this.state.selectedRowIds},_resetSelectedRows:function(){this.setState({isSelectAllChecked:!1,selectedRowIds:[]})},getMultipleSelectionObject:function(){return{isMultipleSelection:!E(this.props.results,(function(e){return"children"in e}))&&this.props.isMultipleSelection,toggleSelectAll:this._toggleSelectAll,getIsSelectAllChecked:this._getIsSelectAllChecked,toggleSelectRow:this._toggleSelectRow,getSelectedRowIds:this.getSelectedRowIds,getIsRowChecked:this._getIsRowChecked}},isInfiniteScrollEnabled:function(){return!this.props.useCustomPagerComponent&&this.props.enableInfiniteScroll},getClearFixStyles:function(){return{clear:"both",display:"table",width:"100%"}},getSettingsStyles:function(){return{float:"left",width:"50%",textAlign:"right"}},getFilterStyles:function(){return{float:"left",width:"50%",textAlign:"left",color:"#222",minHeight:"1px"}},getFilter:function(){return this.props.showFilter&&!1===this.shouldUseCustomGridComponent()?this.props.useCustomFilterComponent?o.createElement(g,{changeFilter:this.setFilter,placeholderText:this.props.filterPlaceholderText,customFilterComponent:this.props.customFilterComponent,results:this.props.results,currentResults:this.getCurrentResults()}):o.createElement(a,{changeFilter:this.setFilter,placeholderText:this.props.filterPlaceholderText}):""},getSettings:function(){return this.props.showSettings?o.createElement("button",{type:"button",className:this.props.settingsToggleClassName,onClick:this.toggleColumnChooser,style:this.props.useGriddleStyles?{background:"none",border:"none",padding:0,margin:0,fontSize:14}:null},this.props.settingsText,this.props.settingsIconComponent):""},getTopSection:function(e,t){if(!1===this.props.showFilter&&!1===this.props.showSettings)return"";var n=null,r=null,i=null;return this.props.useGriddleStyles&&(n=this.getFilterStyles(),r=this.getSettingsStyles(),i=this.getClearFixStyles()),o.createElement("div",{className:"top-section",style:i},o.createElement("div",{className:"griddle-filter",style:n},e),o.createElement("div",{className:"griddle-settings-toggle",style:r},t))},getPagingSection:function(e,t){if(!1!==(this.props.showPager&&!this.isInfiniteScrollEnabled()&&!this.shouldUseCustomGridComponent()))return o.createElement("div",{className:"griddle-footer"},this.props.useCustomPagerComponent?o.createElement(m,{customPagerComponentOptions:this.props.customPagerComponentOptions,next:this.nextPage,previous:this.previousPage,currentPage:e,maxPage:t,setPage:this.setPage,nextText:this.props.nextText,previousText:this.props.previousText,customPagerComponent:this.props.customPagerComponent}):o.createElement(u,{useGriddleStyles:this.props.useGriddleStyles,next:this.nextPage,previous:this.previousPage,nextClassName:this.props.nextClassName,nextIconComponent:this.props.nextIconComponent,previousClassName:this.props.previousClassName,previousIconComponent:this.props.previousIconComponent,currentPage:e,maxPage:t,setPage:this.setPage,nextText:this.props.nextText,previousText:this.props.previousText}))},getColumnSelectorSection:function(e,t){return this.state.showColumnChooser?o.createElement(d,{columns:e,selectedColumns:t,setColumns:this.setColumns,settingsText:this.props.settingsText,settingsIconComponent:this.props.settingsIconComponent,maxRowsText:this.props.maxRowsText,setPageSize:this.setPageSize,showSetPageSize:!this.shouldUseCustomGridComponent(),resultsPerPage:this.state.resultsPerPage,enableToggleCustom:this.props.enableToggleCustom,toggleCustomComponent:this.toggleCustomComponent,useCustomComponent:this.shouldUseCustomRowComponent()||this.shouldUseCustomGridComponent(),useGriddleStyles:this.props.useGriddleStyles,enableCustomFormatText:this.props.enableCustomFormatText,columnMetadata:this.props.columnMetadata}):""},getCustomGridSection:function(){return o.createElement(this.props.customGridComponent,r({data:this.props.results,className:this.props.customGridComponentClassName},this.props.gridMetadata))},getCustomRowSection:function(e,t,n,r,i){return o.createElement("div",null,o.createElement(f,{data:e,columns:t,metadataColumns:n,globalData:i,className:this.props.customRowComponentClassName,customComponent:this.props.customRowComponent,style:this.props.useGriddleStyles?this.getClearFixStyles():null}),this.props.showPager&&r)},getStandardGridSection:function(e,t,n,r,i){var s=this.getSortObject(),a=this.getMultipleSelectionObject(),u=this.shouldShowNoDataSection(e),d=this.getNoDataSection();return o.createElement("div",{className:"griddle-body"},o.createElement(l,{useGriddleStyles:this.props.useGriddleStyles,noDataSection:d,showNoData:u,columnSettings:this.columnSettings,rowSettings:this.rowSettings,sortSettings:s,multipleSelectionSettings:a,filterByColumn:this.filterByColumn,isSubGriddle:this.props.isSubGriddle,useGriddleIcons:this.props.useGriddleIcons,useFixedLayout:this.props.useFixedLayout,showPager:this.props.showPager,pagingContent:r,data:e,className:this.props.tableClassName,enableInfiniteScroll:this.isInfiniteScrollEnabled(),nextPage:this.nextPage,showTableHeading:this.props.showTableHeading,useFixedHeader:this.props.useFixedHeader,parentRowCollapsedClassName:this.props.parentRowCollapsedClassName,parentRowExpandedClassName:this.props.parentRowExpandedClassName,parentRowCollapsedComponent:this.props.parentRowCollapsedComponent,parentRowExpandedComponent:this.props.parentRowExpandedComponent,bodyHeight:this.props.bodyHeight,paddingHeight:this.props.paddingHeight,rowHeight:this.props.rowHeight,infiniteScrollLoadTreshold:this.props.infiniteScrollLoadTreshold,externalLoadingComponent:this.props.externalLoadingComponent,externalIsLoading:this.props.externalIsLoading,hasMorePages:i,onRowClick:this.props.onRowClick,onRowMouseEnter:this.props.onRowMouseEnter,onRowMouseLeave:this.props.onRowMouseLeave,onRowWillMount:this.props.onRowWillMount,onRowWillUnmount:this.props.onRowWillUnmount}))},getContentSection:function(e,t,n,r,o,i){return this.shouldUseCustomGridComponent()&&null!==this.props.customGridComponent?this.getCustomGridSection():this.shouldUseCustomRowComponent()?this.getCustomRowSection(e,t,n,r,i):this.getStandardGridSection(e,t,n,r,o)},getNoDataSection:function(){return null!=this.props.customNoDataComponent?o.createElement("div",{className:this.props.noDataClassName},o.createElement(this.props.customNoDataComponent,this.props.customNoDataComponentProps)):o.createElement(c,{noDataMessage:this.props.noDataMessage})},shouldShowNoDataSection:function(e){return!this.props.allowEmptyGrid&&(!1===this.props.useExternal&&(void 0===e||0===e.length)||!0===this.props.useExternal&&!1===this.props.externalIsLoading&&0===e.length)},render:function(){var e=this.getCurrentResults(),t=(this.props.tableClassName,this.getFilter()),n=this.getSettings(),r=this.getTopSection(t,n),i=[],s=this.columnSettings.getColumns(),l=this.getDataForRender(e,s,!0),a=this.columnSettings.getMetadataColumns();this.props.columnMetadata?w(this.props.columnMetadata,(function(e){"boolean"==typeof e.visible&&!1===e.visible||i.push(e.columnName)})):i=b.keys(R(e[0],a)),i=this.columnSettings.orderColumns(i);var u=this.getCurrentPage(),d=this.getCurrentMaxPage(),c=u+10?"griddle "+this.props.gridClassName:"griddle";return m+=this.shouldUseCustomRowComponent()?" griddle-custom":"",o.createElement("div",{className:m},r,f,o.createElement("div",{className:"griddle-container",style:this.props.useGriddleStyles&&!this.props.isSubGriddle?{border:"1px solid #DDD"}:null},h))}});h.Griddle=e.exports=j},1545:function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n-1}},9905:function(e){e.exports=function(e,t,n){for(var r=-1,o=null==e?0:e.length;++r=200&&(c=a,p=!1,t=new r(t));e:for(;++d0&&i(d)?n>1?e(d,n-1,i,s,l):r(l,d):s||(l[l.length]=d)}return l}},6649:function(e,t,n){var r=n(3221)();e.exports=r},641:function(e,t,n){var r=n(6649),o=n(5950);e.exports=function(e,t){return e&&r(e,t,o)}},7422:function(e,t,n){var r=n(1769),o=n(7797);e.exports=function(e,t){for(var n=0,i=(t=r(t,e)).length;null!=e&&n=120&&y.length>=120)?new r(h&&y):void 0}y=e[0];var v=-1,b=f[0];e:for(;++vo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(o);++rt||s&&l&&u&&!a&&!d||o&&l&&u||!n&&u||!i)return 1;if(!o&&!s&&!d&&e=a?u:u*("desc"==n[o]?-1:1)}return e.index-t.index}},3007:function(e){e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n1?n[i-1]:void 0,l=i>2?n[2]:void 0;for(s=e.length>3&&"function"==typeof s?(i--,s):void 0,l&&o(n[0],n[1],l)&&(s=i<3?void 0:s,i=1),t=Object(t);++r-1?l[a?t[u]:u]:void 0}}},2963:function(e,t,n){var r=n(1372),o=n(5861),i=n(317),s=n(799);e.exports=function(e){return function(t){var n=o(t);return"[object Map]"==n?i(t):"[object Set]"==n?s(t):r(t,e(t))}}},3138:function(e,t,n){var r=n(1331);e.exports=function(e){return r(e)?void 0:e}},3243:function(e,t,n){var r=n(6110),o=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=o},5911:function(e,t,n){var r=n(8859),o=n(4248),i=n(9219);e.exports=function(e,t,n,s,l,a){var u=1&n,d=e.length,c=t.length;if(d!=c&&!(u&&c>d))return!1;var p=a.get(e),h=a.get(t);if(p&&h)return p==t&&h==e;var f=-1,m=!0,g=2&n?new r:void 0;for(a.set(e,t),a.set(t,e);++f-1&&e%1==0&&e-1}},1175:function(e,t,n){var r=n(6025);e.exports=function(e,t){var n=this.__data__,o=r(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this}},3040:function(e,t,n){var r=n(1549),o=n(79),i=n(8223);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(i||o),string:new r}}},7670:function(e,t,n){var r=n(2651);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},289:function(e,t,n){var r=n(2651);e.exports=function(e){return r(this,e).get(e)}},4509:function(e,t,n){var r=n(2651);e.exports=function(e){return r(this,e).has(e)}},2949:function(e,t,n){var r=n(2651);e.exports=function(e,t){var n=r(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this}},317:function(e){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}},7197:function(e){e.exports=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}},2224:function(e,t,n){var r=n(104);e.exports=function(e){var t=r(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}},1042:function(e,t,n){var r=n(6110)(Object,"create");e.exports=r},3650:function(e,t,n){var r=n(4335)(Object.keys,Object);e.exports=r},181:function(e){e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},6009:function(e,t,n){e=n.nmd(e);var r=n(4840),o=t&&!t.nodeType&&t,i=o&&e&&!e.nodeType&&e,s=i&&i.exports===o&&r.process,l=function(){try{var e=i&&i.require&&i.require("util").types;return e||s&&s.binding&&s.binding("util")}catch(e){}}();e.exports=l},9350:function(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},4335:function(e){e.exports=function(e,t){return function(n){return e(t(n))}}},6757:function(e,t,n){var r=n(1033),o=Math.max;e.exports=function(e,t,n){return t=o(void 0===t?e.length-1:t,0),function(){for(var i=arguments,s=-1,l=o(i.length-t,0),a=Array(l);++s0){if(++n>=800)return arguments[0]}else n=0;return e.apply(void 0,arguments)}}},1420:function(e,t,n){var r=n(79);e.exports=function(){this.__data__=new r,this.size=0}},938:function(e){e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},3605:function(e){e.exports=function(e){return this.__data__.get(e)}},9817:function(e){e.exports=function(e){return this.__data__.has(e)}},945:function(e,t,n){var r=n(79),o=n(8223),i=n(3661);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var s=n.__data__;if(!o||s.length<199)return s.push([e,t]),this.size=++n.size,this;n=this.__data__=new i(s)}return n.set(e,t),this.size=n.size,this}},6959:function(e){e.exports=function(e,t,n){for(var r=n-1,o=e.length;++r2?t[2]:void 0;for(u&&i(t[0],t[1],u)&&(r=1);++n-1:!!d&&r(e,t,n)>-1}},3424:function(e,t,n){var r=n(5160);e.exports=function(e){return(null==e?0:e.length)?r(e,0,-1):[]}},5287:function(e,t,n){var r=n(4932),o=n(7185),i=n(9302),s=n(741),l=i((function(e){var t=r(e,s);return t.length&&t[0]===e[0]?o(t):[]}));e.exports=l},2428:function(e,t,n){var r=n(7534),o=n(346),i=Object.prototype,s=i.hasOwnProperty,l=i.propertyIsEnumerable,a=r(function(){return arguments}())?r:function(e){return o(e)&&s.call(e,"callee")&&!l.call(e,"callee")};e.exports=a},6449:function(e){var t=Array.isArray;e.exports=t},4894:function(e,t,n){var r=n(1882),o=n(294);e.exports=function(e){return null!=e&&o(e.length)&&!r(e)}},3693:function(e,t,n){var r=n(4894),o=n(346);e.exports=function(e){return o(e)&&r(e)}},3656:function(e,t,n){e=n.nmd(e);var r=n(9325),o=n(9935),i=t&&!t.nodeType&&t,s=i&&e&&!e.nodeType&&e,l=s&&s.exports===i?r.Buffer:void 0,a=(l?l.isBuffer:void 0)||o;e.exports=a},2193:function(e,t,n){var r=n(8984),o=n(5861),i=n(2428),s=n(6449),l=n(4894),a=n(3656),u=n(5527),d=n(7167),c=Object.prototype.hasOwnProperty;e.exports=function(e){if(null==e)return!0;if(l(e)&&(s(e)||"string"==typeof e||"function"==typeof e.splice||a(e)||d(e)||i(e)))return!e.length;var t=o(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(u(e))return!r(e).length;for(var n in e)if(c.call(e,n))return!1;return!0}},1882:function(e,t,n){var r=n(2552),o=n(3805);e.exports=function(e){if(!o(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},294:function(e){e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},7730:function(e,t,n){var r=n(9172),o=n(7301),i=n(6009),s=i&&i.isMap,l=s?o(s):r;e.exports=l},5187:function(e){e.exports=function(e){return null===e}},3805:function(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},346:function(e){e.exports=function(e){return null!=e&&"object"==typeof e}},1331:function(e,t,n){var r=n(2552),o=n(8879),i=n(346),s=Function.prototype,l=Object.prototype,a=s.toString,u=l.hasOwnProperty,d=a.call(Object);e.exports=function(e){if(!i(e)||"[object Object]"!=r(e))return!1;var t=o(e);if(null===t)return!0;var n=u.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&a.call(n)==d}},8440:function(e,t,n){var r=n(6038),o=n(7301),i=n(6009),s=i&&i.isSet,l=s?o(s):r;e.exports=l},5015:function(e,t,n){var r=n(2552),o=n(6449),i=n(346);e.exports=function(e){return"string"==typeof e||!o(e)&&i(e)&&"[object String]"==r(e)}},4394:function(e,t,n){var r=n(2552),o=n(346);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},7167:function(e,t,n){var r=n(4901),o=n(7301),i=n(6009),s=i&&i.isTypedArray,l=s?o(s):r;e.exports=l},2216:function(e){e.exports=function(e){return void 0===e}},5950:function(e,t,n){var r=n(695),o=n(8984),i=n(4894);e.exports=function(e){return i(e)?r(e):o(e)}},7241:function(e,t,n){var r=n(695),o=n(2903),i=n(4894);e.exports=function(e){return i(e)?r(e,!0):o(e)}},8090:function(e){e.exports=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}},5378:function(e,t,n){var r=n(4932),o=n(5389),i=n(5128),s=n(6449);e.exports=function(e,t){return(s(e)?r:i)(e,o(t,3))}},104:function(e,t,n){var r=n(3661);function o(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=e.apply(this,r);return n.cache=i.set(o,s)||i,s};return n.cache=new(o.Cache||r),n}o.Cache=r,e.exports=o},179:function(e,t,n){var r=n(4932),o=n(9999),i=n(9931),s=n(1769),l=n(1791),a=n(3138),u=n(8816),d=n(3349),c=u((function(e,t){var n={};if(null==e)return n;var u=!1;t=r(t,(function(t){return t=s(t,e),u||(u=t.length>1),t})),l(e,d(e),n),u&&(n=o(n,7,a));for(var c=t.length;c--;)i(n,t[c]);return n}));e.exports=c},2877:function(e,t,n){var r=n(6155),o=n(6449);e.exports=function(e,t,n,i){return null==e?[]:(o(t)||(t=null==t?[]:[t]),o(n=i?void 0:n)||(n=null==n?[]:[n]),r(e,t,n))}},4383:function(e,t,n){var r=n(6001),o=n(8816)((function(e,t){return null==e?{}:r(e,t)}));e.exports=o},583:function(e,t,n){var r=n(7237),o=n(7255),i=n(8586),s=n(7797);e.exports=function(e){return i(e)?r(s(e)):o(e)}},2426:function(e,t,n){var r=n(4248),o=n(5389),i=n(916),s=n(6449),l=n(6800);e.exports=function(e,t,n){var a=s(e)?r:i;return n&&l(e,t,n)&&(t=void 0),a(e,o(t,3))}},3031:function(e,t,n){var r=n(3120),o=n(6155),i=n(9302),s=n(6800),l=i((function(e,t){if(null==e)return[];var n=t.length;return n>1&&s(e,t[0],t[1])?t=[]:n>2&&s(t[0],t[1],t[2])&&(t=[t[0]]),o(e,r(t,1),[])}));e.exports=l},3345:function(e){e.exports=function(){return[]}},9935:function(e){e.exports=function(){return!1}},4921:function(e,t,n){var r=n(5160),o=n(1489);e.exports=function(e,t,n){return e&&e.length?(t=n||void 0===t?1:o(t),r(e,0,t<0?0:t)):[]}},7400:function(e,t,n){var r=n(9374),o=1/0;e.exports=function(e){return e?(e=r(e))===o||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},1489:function(e,t,n){var r=n(7400);e.exports=function(e){var t=r(e),n=t%1;return t==t?n?t-n:t:0}},9374:function(e,t,n){var r=n(4128),o=n(3805),i=n(4394),s=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,a=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=l.test(e);return n||a.test(e)?u(e.slice(2),n?2:8):s.test(e)?NaN:+e}},8938:function(e,t,n){var r=n(2963)(n(5950));e.exports=r},2072:function(e,t,n){var r=n(4932),o=n(3007),i=n(6449),s=n(4394),l=n(1802),a=n(7797),u=n(3222);e.exports=function(e){return i(e)?r(e,a):s(e)?[e]:o(l(u(e)))}},3222:function(e,t,n){var r=n(7556);e.exports=function(e){return null==e?"":r(e)}},7200:function(e,t,n){var r=n(3222),o=0;e.exports=function(e){var t=++o;return r(e)+t}},5880:function(e,t,n){var r=n(514),o=n(5950);e.exports=function(e){return null==e?[]:r(e,o(e))}},1648:function(e,t,n){var r=n(3915),o=n(9302),i=n(3693),s=o((function(e,t){return i(e)?r(e,t):[]}));e.exports=s},7248:function(e,t,n){var r=n(6547),o=n(1234);e.exports=function(e,t){return o(e||[],t||[],r)}},5228:function(e){"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,o){for(var i,s,l=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),a=1;a1)for(var n=1;n1?t-1:0),r=1;r2?n-2:0),i=2;i1&&void 0!==arguments[1]&&arguments[1],n=this.props,r=n.tolerance,o=n.onSelection,i=n.onEndSelection,s=[],l=(0,d.findDOMNode)(this.refs.selectbox);l&&(this._registry.forEach((function(e){e.domNode&&(0,g.default)(l,e.domNode,r)&&!s.includes(e.key)&&s.push(e.key)})),t?"function"==typeof i&&i(s,e):"function"==typeof o&&o(s,e))}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.enabled,r=e.fixedPosition,o=e.className,i=e.selectingClassName,s=this.state,l=s.isBoxSelecting,a=s.boxLeft,d=s.boxTop,c=s.boxWidth,h=s.boxHeight,f=this.props.component;if(!n)return u.default.createElement(f,{className:o},t);var m={left:a,top:d,width:c,height:h,zIndex:9e3,position:r?"fixed":"absolute",cursor:"default"},g={backgroundColor:"transparent",border:"1px dashed #999",width:"100%",height:"100%",float:"left"},y={position:"relative",overflow:"visible"};return u.default.createElement(f,{className:(0,p.default)(o,l?i:null),style:y},l?u.default.createElement("div",{style:m,ref:"selectbox"},u.default.createElement("span",{style:g})):null,t)}}]),t}(a.Component);v.propTypes={children:c.default.node,onBeginSelection:c.default.func,onEndSelection:c.default.func,onSelection:c.default.func,component:c.default.node,tolerance:c.default.number,fixedPosition:c.default.bool,preventDefault:c.default.bool,onNonItemClick:c.default.func,enabled:c.default.bool,className:c.default.string,selectingClassName:c.default.string},v.defaultProps={component:"div",tolerance:0,fixedPosition:!1,preventDefault:!0,enabled:!0},v.childContextTypes={selectable:c.default.object},t.default=v},function(e,t,n){"use strict";(function(t){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=n(1),i=n(2),s=n(8),l=n(15),a=n(3),u=n(16);e.exports=function(e,n){function d(e){var t=e&&(O&&e[O]||e[I]);if("function"==typeof t)return t}function c(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function p(e){this.message=e,this.stack=""}function h(e){function r(r,u,d,c,h,f,m){if(c=c||D,f=f||d,m!==a)if(n)i(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("production"!==t.env.NODE_ENV&&"undefined"!=typeof console){var g=c+":"+d;!o[g]&&l<3&&(s(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",f,c),o[g]=!0,l++)}return null==u[d]?r?new p(null===u[d]?"The "+h+" `"+f+"` is marked as required in `"+c+"`, but its value is `null`.":"The "+h+" `"+f+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:e(u,d,c,h,f)}if("production"!==t.env.NODE_ENV)var o={},l=0;var u=r.bind(null,!1);return u.isRequired=r.bind(null,!0),u}function f(e){function t(t,n,r,o,i,s){var l=t[n];return w(l)!==e?new p("Invalid "+o+" `"+i+"` of type `"+x(l)+"` supplied to `"+r+"`, expected `"+e+"`."):null}return h(t)}function m(e){function t(t,n,r,o,i){if("function"!=typeof e)return new p("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s))return new p("Invalid "+o+" `"+i+"` of type `"+w(s)+"` supplied to `"+r+"`, expected an array.");for(var l=0;ln+l||t+o-ar+s)};t.default=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=e instanceof HTMLElement?(0,r.default)(e):e,s=t instanceof HTMLElement?(0,r.default)(t):t;return o(i.top,i.left,s.top,s.left,i.offsetWidth,i.offsetHeight,s.offsetWidth,s.offsetHeight,n)}},function(e,t,n){"use strict";(function(t){function n(e,t,n){function r(t){var n=m,r=g;return m=g=void 0,w=t,v=e.apply(r,n)}function i(e){return w=e,b=setTimeout(d,t),x?r(e):v}function s(e){var n=t-(e-C);return F?E(n,y-(e-w)):n}function a(e){var n=e-C;return void 0===C||n>=t||n<0||F&&e-w>=y}function d(){var e=_();if(a(e))return c(e);b=setTimeout(d,s(e))}function c(e){return b=void 0,A&&m?r(e):(m=g=void 0,v)}function p(){void 0!==b&&clearTimeout(b),w=0,m=C=g=b=void 0}function h(){return void 0===b?v:c(_())}function f(){var e=_(),n=a(e);if(m=arguments,g=this,C=e,n){if(void 0===b)return i(C);if(F)return b=setTimeout(d,t),r(C)}return void 0===b&&(b=setTimeout(d,t)),v}var m,g,y,v,b,C,w=0,x=!1,F=!1,A=!0;if("function"!=typeof e)throw new TypeError(u);return t=l(t)||0,o(n)&&(x=!!n.leading,y=(F="maxWait"in n)?S(l(n.maxWait)||0,t):y,A="trailing"in n?!!n.trailing:A),f.cancel=p,f.flush=h,f}function r(e,t,r){var i=!0,s=!0;if("function"!=typeof e)throw new TypeError(u);return o(r)&&(i="leading"in r?!!r.leading:i,s="trailing"in r?!!r.trailing:s),n(e,t,{leading:i,maxWait:t,trailing:s})}function o(e){var t=void 0===e?"undefined":a(e);return!!e&&("object"==t||"function"==t)}function i(e){return!!e&&"object"==(void 0===e?"undefined":a(e))}function s(e){return"symbol"==(void 0===e?"undefined":a(e))||i(e)&&C.call(e)==c}function l(e){if("number"==typeof e)return e;if(s(e))return d;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(p,"");var n=f.test(e);return n||m.test(e)?g(e.slice(2),n?2:8):h.test(e)?d:+e}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u="Expected a function",d=NaN,c="[object Symbol]",p=/^\s+|\s+$/g,h=/^[-+]0x[0-9a-f]+$/i,f=/^0b[01]+$/i,m=/^0o[0-7]+$/i,g=parseInt,y="object"==(void 0===t?"undefined":a(t))&&t&&t.Object===Object&&t,v="object"==("undefined"==typeof self?"undefined":a(self))&&self&&self.Object===Object&&self,b=y||v||Function("return this")(),C=Object.prototype.toString,S=Math.max,E=Math.min,_=function(){return b.Date.now()};e.exports=r}).call(t,n(21))},function(e,t,n){"use strict";var r,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"===("undefined"==typeof window?"undefined":o(window))&&(r=window)}e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function 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)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n
'),this.element.appendChild(e));let t=e.getElementsByTagName("span")[0];return t&&(null!=t.textContent?t.textContent=this.options.dictFallbackMessage:null!=t.innerText&&(t.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize(e,t,n,r){let o={srcX:0,srcY:0,srcWidth:e.width,srcHeight:e.height},i=e.width/e.height;null==t&&null==n?(t=o.srcWidth,n=o.srcHeight):null==t?t=n*i:null==n&&(n=t/i);let s=(t=Math.min(t,o.srcWidth))/(n=Math.min(n,o.srcHeight));if(o.srcWidth>t||o.srcHeight>n)if("crop"===r)i>s?(o.srcHeight=e.height,o.srcWidth=o.srcHeight*s):(o.srcWidth=e.width,o.srcHeight=o.srcWidth/s);else{if("contain"!==r)throw new Error(`Unknown resizeMethod '${r}'`);i>s?n=t/i:t=n*i}return o.srcX=(e.width-o.srcWidth)/2,o.srcY=(e.height-o.srcHeight)/2,o.trgWidth=t,o.trgHeight=n,o},transformFile(e,t){return(this.options.resizeWidth||this.options.resizeHeight)&&e.type.match(/image.*/)?this.resizeImage(e,this.options.resizeWidth,this.options.resizeHeight,this.options.resizeMethod,t):t(e)},previewTemplate:i('
\n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n \n \n \n
\n
\n \n \n \n
\n
\n'),drop(e){return this.element.classList.remove("dz-drag-hover")},dragstart(e){},dragend(e){return this.element.classList.remove("dz-drag-hover")},dragenter(e){return this.element.classList.add("dz-drag-hover")},dragover(e){return this.element.classList.add("dz-drag-hover")},dragleave(e){return this.element.classList.remove("dz-drag-hover")},paste(e){},reset(){return this.element.classList.remove("dz-started")},addedfile(e){if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer&&!this.options.disablePreviews){for(var t of(e.previewElement=a.createElement(this.options.previewTemplate.trim()),e.previewTemplate=e.previewElement,this.previewsContainer.appendChild(e.previewElement),e.previewElement.querySelectorAll("[data-dz-name]")))t.textContent=e.name;for(t of e.previewElement.querySelectorAll("[data-dz-size]"))t.innerHTML=this.filesize(e.size);this.options.addRemoveLinks&&(e._removeLink=a.createElement(`${this.options.dictRemoveFile}`),e.previewElement.appendChild(e._removeLink));let n=t=>(t.preventDefault(),t.stopPropagation(),e.status===a.UPLOADING?a.confirm(this.options.dictCancelUploadConfirmation,(()=>this.removeFile(e))):this.options.dictRemoveFileConfirmation?a.confirm(this.options.dictRemoveFileConfirmation,(()=>this.removeFile(e))):this.removeFile(e));for(let t of e.previewElement.querySelectorAll("[data-dz-remove]"))t.addEventListener("click",n)}},removedfile(e){return null!=e.previewElement&&null!=e.previewElement.parentNode&&e.previewElement.parentNode.removeChild(e.previewElement),this._updateMaxFilesReachedClass()},thumbnail(e,t){if(e.previewElement){e.previewElement.classList.remove("dz-file-preview");for(let n of e.previewElement.querySelectorAll("[data-dz-thumbnail]"))n.alt=e.name,n.src=t;return setTimeout((()=>e.previewElement.classList.add("dz-image-preview")),1)}},error(e,t){if(e.previewElement){e.previewElement.classList.add("dz-error"),"string"!=typeof t&&t.error&&(t=t.error);for(let n of e.previewElement.querySelectorAll("[data-dz-errormessage]"))n.textContent=t}},errormultiple(){},processing(e){if(e.previewElement&&(e.previewElement.classList.add("dz-processing"),e._removeLink))return e._removeLink.innerHTML=this.options.dictCancelUpload},processingmultiple(){},uploadprogress(e,t,n){if(e.previewElement)for(let n of e.previewElement.querySelectorAll("[data-dz-uploadprogress]"))"PROGRESS"===n.nodeName?n.value=t:n.style.width=`${t}%`},totaluploadprogress(){},sending(){},sendingmultiple(){},success(e){if(e.previewElement)return e.previewElement.classList.add("dz-success")},successmultiple(){},canceled(e){return this.emit("error",e,this.options.dictUploadCanceled)},canceledmultiple(){},complete(e){if(e._removeLink&&(e._removeLink.innerHTML=this.options.dictRemoveFile),e.previewElement)return e.previewElement.classList.add("dz-complete")},completemultiple(){},maxfilesexceeded(){},maxfilesreached(){},queuecomplete(){},addedfiles(){}};class a extends s{static initClass(){this.prototype.Emitter=s,this.prototype.events=["drop","dragstart","dragend","dragenter","dragover","dragleave","addedfile","addedfiles","removedfile","thumbnail","error","errormultiple","processing","processingmultiple","uploadprogress","totaluploadprogress","sending","sendingmultiple","success","successmultiple","canceled","canceledmultiple","complete","completemultiple","reset","maxfilesexceeded","maxfilesreached","queuecomplete"],this.prototype._thumbnailQueue=[],this.prototype._processingThumbnail=!1}getAcceptedFiles(){return this.files.filter((e=>e.accepted)).map((e=>e))}getRejectedFiles(){return this.files.filter((e=>!e.accepted)).map((e=>e))}getFilesWithStatus(e){return this.files.filter((t=>t.status===e)).map((e=>e))}getQueuedFiles(){return this.getFilesWithStatus(a.QUEUED)}getUploadingFiles(){return this.getFilesWithStatus(a.UPLOADING)}getAddedFiles(){return this.getFilesWithStatus(a.ADDED)}getActiveFiles(){return this.files.filter((e=>e.status===a.UPLOADING||e.status===a.QUEUED)).map((e=>e))}init(){if("form"===this.element.tagName&&this.element.setAttribute("enctype","multipart/form-data"),this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")&&this.element.appendChild(a.createElement(`
`)),this.clickableElements.length){let e=()=>{this.hiddenFileInput&&this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=document.createElement("input"),this.hiddenFileInput.setAttribute("type","file"),(null===this.options.maxFiles||this.options.maxFiles>1)&&this.hiddenFileInput.setAttribute("multiple","multiple"),this.hiddenFileInput.className="dz-hidden-input",null!==this.options.acceptedFiles&&this.hiddenFileInput.setAttribute("accept",this.options.acceptedFiles),null!==this.options.capture&&this.hiddenFileInput.setAttribute("capture",this.options.capture),this.hiddenFileInput.setAttribute("tabindex","-1"),this.hiddenFileInput.style.visibility="hidden",this.hiddenFileInput.style.position="absolute",this.hiddenFileInput.style.top="0",this.hiddenFileInput.style.left="0",this.hiddenFileInput.style.height="0",this.hiddenFileInput.style.width="0",a.getElement(this.options.hiddenInputContainer,"hiddenInputContainer").appendChild(this.hiddenFileInput),this.hiddenFileInput.addEventListener("change",(()=>{let{files:t}=this.hiddenFileInput;if(t.length)for(let e of t)this.addFile(e);this.emit("addedfiles",t),e()}))};e()}this.URL=null!==window.URL?window.URL:window.webkitURL;for(let e of this.events)this.on(e,this.options[e]);this.on("uploadprogress",(()=>this.updateTotalUploadProgress())),this.on("removedfile",(()=>this.updateTotalUploadProgress())),this.on("canceled",(e=>this.emit("complete",e))),this.on("complete",(e=>{if(0===this.getAddedFiles().length&&0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length)return setTimeout((()=>this.emit("queuecomplete")),0)}));let e=function(e){if(function(e){if(e.dataTransfer.types)for(var t=0;tthis.emit("dragstart",e),dragenter:t=>(e(t),this.emit("dragenter",t)),dragover:t=>{let n;try{n=t.dataTransfer.effectAllowed}catch(e){}return t.dataTransfer.dropEffect="move"===n||"linkMove"===n?"move":"copy",e(t),this.emit("dragover",t)},dragleave:e=>this.emit("dragleave",e),drop:t=>(e(t),this.drop(t)),dragend:e=>this.emit("dragend",e)}}],this.clickableElements.forEach((e=>this.listeners.push({element:e,events:{click:t=>((e!==this.element||t.target===this.element||a.elementInside(t.target,this.element.querySelector(".dz-message")))&&this.hiddenFileInput.click(),!0)}}))),this.enable(),this.options.init.call(this)}destroy(){return this.disable(),this.removeAllFiles(!0),(null!=this.hiddenFileInput?this.hiddenFileInput.parentNode:void 0)&&(this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=null),delete this.element.dropzone,a.instances.splice(a.instances.indexOf(this),1)}updateTotalUploadProgress(){let e,t=0,n=0;if(this.getActiveFiles().length){for(let e of this.getActiveFiles())t+=e.upload.bytesSent,n+=e.upload.total;e=100*t/n}else e=100;return this.emit("totaluploadprogress",e,n,t)}_getParamName(e){return"function"==typeof this.options.paramName?this.options.paramName(e):`${this.options.paramName}${this.options.uploadMultiple?`[${e}]`:""}`}_renameFile(e){return"function"!=typeof this.options.renameFile?e.name:this.options.renameFile(e)}getFallbackForm(){let e,t;if(e=this.getExistingFallback())return e;let n='
';this.options.dictFallbackText&&(n+=`

${this.options.dictFallbackText}

`),n+=`
`;let r=a.createElement(n);return"FORM"!==this.element.tagName?(t=a.createElement(`
`),t.appendChild(r)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),null!=t?t:r}getExistingFallback(){let e=function(e){for(let t of e)if(/(^| )fallback($| )/.test(t.className))return t};for(let n of["div","form"]){var t;if(t=e(this.element.getElementsByTagName(n)))return t}}setupEventListeners(){return this.listeners.map((e=>(()=>{let t=[];for(let n in e.events){let r=e.events[n];t.push(e.element.addEventListener(n,r,!1))}return t})()))}removeEventListeners(){return this.listeners.map((e=>(()=>{let t=[];for(let n in e.events){let r=e.events[n];t.push(e.element.removeEventListener(n,r,!1))}return t})()))}disable(){return this.clickableElements.forEach((e=>e.classList.remove("dz-clickable"))),this.removeEventListeners(),this.disabled=!0,this.files.map((e=>this.cancelUpload(e)))}enable(){return delete this.disabled,this.clickableElements.forEach((e=>e.classList.add("dz-clickable"))),this.setupEventListeners()}filesize(e){let t=0,n="b";if(e>0){let r=["tb","gb","mb","kb","b"];for(let o=0;o=Math.pow(this.options.filesizeBase,4-o)/10){t=e/Math.pow(this.options.filesizeBase,4-o),n=i;break}}t=Math.round(10*t)/10}return`${t} ${this.options.dictFileSizeUnits[n]}`}_updateMaxFilesReachedClass(){return null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")}drop(e){if(!e.dataTransfer)return;this.emit("drop",e);let t=[];for(let n=0;ne.items,null!=t?n(t):void 0))return;var t,n;this.emit("paste",e);let{items:r}=e.clipboardData;return r.length?this._addFilesFromItems(r):void 0}handleFiles(e){for(let t of e)this.addFile(t)}_addFilesFromItems(e){return(()=>{let t=[];for(let r of e){var n;null!=r.webkitGetAsEntry&&(n=r.webkitGetAsEntry())?n.isFile?t.push(this.addFile(r.getAsFile())):n.isDirectory?t.push(this._addFilesFromDirectory(n,n.name)):t.push(void 0):null!=r.getAsFile&&(null==r.kind||"file"===r.kind)?t.push(this.addFile(r.getAsFile())):t.push(void 0)}return t})()}_addFilesFromDirectory(e,t){let n=e.createReader(),r=e=>{return t=console,n="log",r=t=>t.log(e),null!=t&&"function"==typeof t[n]?r(t,n):void 0;var t,n,r};var o=()=>n.readEntries((e=>{if(e.length>0){for(let n of e)n.isFile?n.file((e=>{if(!this.options.ignoreHiddenFiles||"."!==e.name.substring(0,1))return e.fullPath=`${t}/${e.name}`,this.addFile(e)})):n.isDirectory&&this._addFilesFromDirectory(n,`${t}/${n.name}`);o()}return null}),r);return o()}accept(e,t){this.options.maxFilesize&&e.size>1048576*this.options.maxFilesize?t(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(e.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):a.isValidFile(e,this.options.acceptedFiles)?null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(t(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",e)):this.options.accept.call(this,e,t):t(this.options.dictInvalidFileType)}addFile(e){e.upload={uuid:a.uuidv4(),progress:0,total:e.size,bytesSent:0,filename:this._renameFile(e)},this.files.push(e),e.status=a.ADDED,this.emit("addedfile",e),this._enqueueThumbnail(e),this.accept(e,(t=>{t?(e.accepted=!1,this._errorProcessing([e],t)):(e.accepted=!0,this.options.autoQueue&&this.enqueueFile(e)),this._updateMaxFilesReachedClass()}))}enqueueFiles(e){for(let t of e)this.enqueueFile(t);return null}enqueueFile(e){if(e.status!==a.ADDED||!0!==e.accepted)throw new Error("This file can't be queued because it has already been processed or was rejected.");if(e.status=a.QUEUED,this.options.autoProcessQueue)return setTimeout((()=>this.processQueue()),0)}_enqueueThumbnail(e){if(this.options.createImageThumbnails&&e.type.match(/image.*/)&&e.size<=1048576*this.options.maxThumbnailFilesize)return this._thumbnailQueue.push(e),setTimeout((()=>this._processThumbnailQueue()),0)}_processThumbnailQueue(){if(this._processingThumbnail||0===this._thumbnailQueue.length)return;this._processingThumbnail=!0;let e=this._thumbnailQueue.shift();return this.createThumbnail(e,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,!0,(t=>(this.emit("thumbnail",e,t),this._processingThumbnail=!1,this._processThumbnailQueue())))}removeFile(e){if(e.status===a.UPLOADING&&this.cancelUpload(e),this.files=u(this.files,e),this.emit("removedfile",e),0===this.files.length)return this.emit("reset")}removeAllFiles(e){null==e&&(e=!1);for(let t of this.files.slice())(t.status!==a.UPLOADING||e)&&this.removeFile(t);return null}resizeImage(e,t,n,r,o){return this.createThumbnail(e,t,n,r,!0,((t,n)=>{if(null==n)return o(e);{let{resizeMimeType:t}=this.options;null==t&&(t=e.type);let r=n.toDataURL(t,this.options.resizeQuality);return"image/jpeg"!==t&&"image/jpg"!==t||(r=p.restore(e.dataURL,r)),o(a.dataURItoBlob(r))}}))}createThumbnail(e,t,n,r,o,i){let s=new FileReader;s.onload=()=>{e.dataURL=s.result,"image/svg+xml"!==e.type?this.createThumbnailFromUrl(e,t,n,r,o,i):null!=i&&i(s.result)},s.readAsDataURL(e)}displayExistingFile(e,t,n,r,o=!0){if(this.emit("addedfile",e),this.emit("complete",e),o){let o=t=>{this.emit("thumbnail",e,t),n&&n()};e.dataURL=t,this.createThumbnailFromUrl(e,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,this.options.fixOrientation,o,r)}else this.emit("thumbnail",e,t),n&&n()}createThumbnailFromUrl(e,t,n,r,o,i,s){let l=document.createElement("img");return s&&(l.crossOrigin=s),o="from-image"!=getComputedStyle(document.body).imageOrientation&&o,l.onload=()=>{let s=e=>e(1);return"undefined"!=typeof EXIF&&null!==EXIF&&o&&(s=e=>EXIF.getData(l,(function(){return e(EXIF.getTag(this,"Orientation"))}))),s((o=>{e.width=l.width,e.height=l.height;let s=this.options.resize.call(this,e,t,n,r),a=document.createElement("canvas"),u=a.getContext("2d");switch(a.width=s.trgWidth,a.height=s.trgHeight,o>4&&(a.width=s.trgHeight,a.height=s.trgWidth),o){case 2:u.translate(a.width,0),u.scale(-1,1);break;case 3:u.translate(a.width,a.height),u.rotate(Math.PI);break;case 4:u.translate(0,a.height),u.scale(1,-1);break;case 5:u.rotate(.5*Math.PI),u.scale(1,-1);break;case 6:u.rotate(.5*Math.PI),u.translate(0,-a.width);break;case 7:u.rotate(.5*Math.PI),u.translate(a.height,-a.width),u.scale(-1,1);break;case 8:u.rotate(-.5*Math.PI),u.translate(-a.height,0)}c(u,l,null!=s.srcX?s.srcX:0,null!=s.srcY?s.srcY:0,s.srcWidth,s.srcHeight,null!=s.trgX?s.trgX:0,null!=s.trgY?s.trgY:0,s.trgWidth,s.trgHeight);let d=a.toDataURL("image/png");if(null!=i)return i(d,a)}))},null!=i&&(l.onerror=i),l.src=e.dataURL}processQueue(){let{parallelUploads:e}=this.options,t=this.getUploadingFiles().length,n=t;if(t>=e)return;let r=this.getQueuedFiles();if(r.length>0){if(this.options.uploadMultiple)return this.processFiles(r.slice(0,e-t));for(;nt.xhr===e)).map((e=>e))}cancelUpload(e){if(e.status===a.UPLOADING){let t=this._getFilesWithXhr(e.xhr);for(let e of t)e.status=a.CANCELED;void 0!==e.xhr&&e.xhr.abort();for(let e of t)this.emit("canceled",e);this.options.uploadMultiple&&this.emit("canceledmultiple",t)}else e.status!==a.ADDED&&e.status!==a.QUEUED||(e.status=a.CANCELED,this.emit("canceled",e),this.options.uploadMultiple&&this.emit("canceledmultiple",[e]));if(this.options.autoProcessQueue)return this.processQueue()}resolveOption(e,...t){return"function"==typeof e?e.apply(this,t):e}uploadFile(e){return this.uploadFiles([e])}uploadFiles(e){this._transformFiles(e,(t=>{if(this.options.chunking){let n=t[0];e[0].upload.chunked=this.options.chunking&&(this.options.forceChunking||n.size>this.options.chunkSize),e[0].upload.totalChunkCount=Math.ceil(n.size/this.options.chunkSize)}if(e[0].upload.chunked){let n=e[0],r=t[0],o=0;n.upload.chunks=[];let i=()=>{let t=0;for(;void 0!==n.upload.chunks[t];)t++;if(t>=n.upload.totalChunkCount)return;o++;let i=t*this.options.chunkSize,s=Math.min(i+this.options.chunkSize,r.size),l={name:this._getParamName(0),data:r.webkitSlice?r.webkitSlice(i,s):r.slice(i,s),filename:n.upload.filename,chunkIndex:t};n.upload.chunks[t]={file:n,index:t,dataBlock:l,status:a.UPLOADING,progress:0,retries:0},this._uploadData(e,[l])};if(n.upload.finishedChunkUpload=(t,r)=>{let o=!0;t.status=a.SUCCESS,t.dataBlock=null,t.response=t.xhr.responseText,t.responseHeaders=t.xhr.getAllResponseHeaders(),t.xhr=null;for(let e=0;e{this._finished(e,r,null)}))},this.options.parallelChunkUploads)for(let e=0;e{this._finishedUploading(e,n,t)},n.ontimeout=()=>{this._handleUploadError(e,n,`Request timedout after ${this.options.timeout/1e3} seconds`)},n.onerror=()=>{this._handleUploadError(e,n)},(null!=n.upload?n.upload:n).onprogress=t=>this._updateFilesUploadProgress(e,n,t);let s=this.options.defaultHeaders?{Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"}:{};this.options.binaryBody&&(s["Content-Type"]=e[0].type),this.options.headers&&r(s,this.options.headers);for(let e in s){let t=s[e];t&&n.setRequestHeader(e,t)}if(this.options.binaryBody){for(let t of e)this.emit("sending",t,n);this.options.uploadMultiple&&this.emit("sendingmultiple",e,n),this.submitRequest(n,null,e)}else{let r=new FormData;if(this.options.params){let t=this.options.params;"function"==typeof t&&(t=t.call(this,e,n,e[0].upload.chunked?this._getChunk(e[0],n):null));for(let e in t){let n=t[e];if(Array.isArray(n))for(let t=0;t{n[o]=i,++r===e.length&&t(n)}))}_addFormElementData(e){if("FORM"===this.element.tagName)for(let t of this.element.querySelectorAll("input, textarea, select, button")){let n=t.getAttribute("name"),r=t.getAttribute("type");if(r&&(r=r.toLowerCase()),null!=n)if("SELECT"===t.tagName&&t.hasAttribute("multiple"))for(let r of t.options)r.selected&&e.append(n,r.value);else(!r||"checkbox"!==r&&"radio"!==r||t.checked)&&e.append(n,t.value)}}_updateFilesUploadProgress(e,t,n){if(e[0].upload.chunked){let r=e[0],o=this._getChunk(r,t);n?(o.progress=100*n.loaded/n.total,o.total=n.total,o.bytesSent=n.loaded):(o.progress=100,o.bytesSent=o.total),r.upload.progress=0,r.upload.total=0,r.upload.bytesSent=0;for(let e=0;ethis.options.renameFilename.call(this,e.name,e)),"string"==typeof this.options.method&&(this.options.method=this.options.method.toUpperCase()),(n=this.getExistingFallback())&&n.parentNode&&n.parentNode.removeChild(n),!1!==this.options.previewsContainer&&(this.options.previewsContainer?this.previewsContainer=a.getElement(this.options.previewsContainer,"previewsContainer"):this.previewsContainer=this.element),this.options.clickable&&(!0===this.options.clickable?this.clickableElements=[this.element]:this.clickableElements=a.getElements(this.options.clickable,"clickable")),this.init()}}a.initClass(),a.options={},a.optionsForElement=function(e){return e.getAttribute("id")?a.options[d(e.getAttribute("id"))]:void 0},a.instances=[],a.forElement=function(e){if("string"==typeof e&&(e=document.querySelector(e)),null==(null!=e?e.dropzone:void 0))throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");return e.dropzone},a.discover=function(){let e;if(document.querySelectorAll)e=document.querySelectorAll(".dropzone");else{e=[];let t=t=>(()=>{let n=[];for(let r of t)/(^| )dropzone($| )/.test(r.className)?n.push(e.push(r)):n.push(void 0);return n})();t(document.getElementsByTagName("div")),t(document.getElementsByTagName("form"))}return(()=>{let t=[];for(let n of e)!1!==a.optionsForElement(n)?t.push(new a(n)):t.push(void 0);return t})()},a.blockedBrowsers=[/opera.*(Macintosh|Windows Phone).*version\/12/i],a.isBrowserSupported=function(){let e=!0;if(window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if("classList"in document.createElement("a")){void 0!==a.blacklistedBrowsers&&(a.blockedBrowsers=a.blacklistedBrowsers);for(let t of a.blockedBrowsers)if(t.test(navigator.userAgent)){e=!1;continue}}else e=!1;else e=!1;return e},a.dataURItoBlob=function(e){let t=atob(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],r=new ArrayBuffer(t.length),o=new Uint8Array(r);for(let e=0,n=t.length,r=0<=n;r?e<=n:e>=n;r?e++:e--)o[e]=t.charCodeAt(e);return new Blob([r],{type:n})};const u=(e,t)=>e.filter((e=>e!==t)).map((e=>e)),d=e=>e.replace(/[\-_](\w)/g,(e=>e.charAt(1).toUpperCase()));a.createElement=function(e){let t=document.createElement("div");return t.innerHTML=e,t.childNodes[0]},a.elementInside=function(e,t){if(e===t)return!0;for(;e=e.parentNode;)if(e===t)return!0;return!1},a.getElement=function(e,t){let n;if("string"==typeof e?n=document.querySelector(e):null!=e.nodeType&&(n=e),null==n)throw new Error(`Invalid \`${t}\` option provided. Please provide a CSS selector or a plain HTML element.`);return n},a.getElements=function(e,t){let n,r;if(e instanceof Array){r=[];try{for(n of e)r.push(this.getElement(n,t))}catch(e){r=null}}else if("string"==typeof e)for(n of(r=[],document.querySelectorAll(e)))r.push(n);else null!=e.nodeType&&(r=[e]);if(null==r||!r.length)throw new Error(`Invalid \`${t}\` option provided. Please provide a CSS selector, a plain HTML element or a list of those.`);return r},a.confirm=function(e,t,n){return window.confirm(e)?t():null!=n?n():void 0},a.isValidFile=function(e,t){if(!t)return!0;t=t.split(",");let n=e.type,r=n.replace(/\/.*$/,"");for(let o of t)if(o=o.trim(),"."===o.charAt(0)){if(-1!==e.name.toLowerCase().indexOf(o.toLowerCase(),e.name.length-o.length))return!0}else if(/\/\*$/.test(o)){if(r===o.replace(/\/.*$/,""))return!0}else if(n===o)return!0;return!1},"undefined"!=typeof jQuery&&null!==jQuery&&(jQuery.fn.dropzone=function(e){return this.each((function(){return new a(this,e)}))}),a.ADDED="added",a.QUEUED="queued",a.ACCEPTED=a.QUEUED,a.UPLOADING="uploading",a.PROCESSING=a.UPLOADING,a.CANCELED="canceled",a.ERROR="error",a.SUCCESS="success";var c=function(e,t,n,r,o,i,s,l,a,u){let d=function(e){e.naturalWidth;let t=e.naturalHeight,n=document.createElement("canvas");n.width=1,n.height=t;let r=n.getContext("2d");r.drawImage(e,0,0);let{data:o}=r.getImageData(1,0,1,t),i=0,s=t,l=t;for(;l>i;)0===o[4*(l-1)+3]?s=l:i=l,l=s+i>>1;let a=l/t;return 0===a?1:a}(t);return e.drawImage(t,n,r,o,i,s,l,a,u/d)};class p{static initClass(){this.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}static encode64(e){let t,n,r,o,i,s="",l="",a="",u=0;for(;t=e[u++],n=e[u++],l=e[u++],r=t>>2,o=(3&t)<<4|n>>4,i=(15&n)<<2|l>>6,a=63&l,isNaN(n)?i=a=64:isNaN(l)&&(a=64),s=s+this.KEY_STR.charAt(r)+this.KEY_STR.charAt(o)+this.KEY_STR.charAt(i)+this.KEY_STR.charAt(a),t=n=l="",r=o=i=a="",ue.length)break}return n}static decode64(e){let t,n,r,o,i,s="",l="",a=0,u=[];for(/[^A-Za-z0-9\+\/\=]/g.exec(e)&&console.warn("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\nExpect errors in decoding."),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");r=this.KEY_STR.indexOf(e.charAt(a++)),o=this.KEY_STR.indexOf(e.charAt(a++)),i=this.KEY_STR.indexOf(e.charAt(a++)),l=this.KEY_STR.indexOf(e.charAt(a++)),t=r<<2|o>>4,n=(15&o)<<4|i>>2,s=(3&i)<<6|l,u.push(t),64!==i&&u.push(n),64!==l&&u.push(s),t=n=s="",r=o=i=l="",ae.execCommand(h),priority:80},n.getParam("editorIdentifier")).addCommandWithUrlTest(h,/^\[file_link/),n.addCommand(h,(()=>{(0,i.default)(`#${n.id}`).entwine("ss").openLinkFileDialog()}))}},m="insert-link__dialog-wrapper--file",g=(0,a.loadComponent)(l.default);i.default.entwine("ss",(e=>{e("textarea.htmleditor").entwine({openLinkFileDialog(){let t=e(`#${m}`);t.length||(t=e(`
`),e("body").append(t)),t.addClass("insert-link__dialog-wrapper"),t.setElement(this),t.open()}}),e(`.js-injector-boot #${m}`).entwine({ReactRoot:null,renderModal(e){var t=this;const{dispatch:n}=a.default.reducer.store;n(u.initFormStack("insert-link","admin"));const i=this.getOriginalAttributes(),s=this.getFolderId(),l=this.getRequireLinkText();let d=this.getReactRoot();d||(d=(0,o.createRoot)(this[0]),this.setReactRoot(d)),d.render(r.default.createElement(g,{isOpen:e,type:"insert-link",folderId:s,onInsert:function(){return t.handleInsert(...arguments)},onClosed:()=>{n(u.reset()),this.close()},title:!1,bodyClassName:"modal__dialog",className:"insert-link__dialog-wrapper--internal",fileAttributes:i,requireLinkText:l}))},buildAttributes(e){return{href:`${s.default.serialise({name:"file_link",properties:{id:e.ID}},!0)}${e.Anchor&&e.Anchor.length?`#${e.Anchor}`:""}`,target:e.TargetBlank?"_blank":"",title:e.Description}},getFolderId(){const e=this.getElement();if(!e)return null;const t=Number(e.data("config").upload_folder_id);return isNaN(t)?null:t},getOriginalAttributes(){const t=this.getElement().getEditor(),n=e(t.getSelectedNode()),r=(n.attr("href")||"").split("#");if(!r[0])return{};const o=s.default.match("file_link",!1,r[0]);return o?{ID:o.properties.id?parseInt(o.properties.id,10):0,Anchor:r[1]||"",Description:n.attr("title"),TargetBlank:!!n.attr("target")}:{}}})})),tinymce.PluginManager.add(h,(e=>f.init(e)))}()}(); \ No newline at end of file diff --git a/client/dist/js/TinyMCE_ssmedia.js b/client/dist/js/TinyMCE_ssmedia.js index a0b8d6604..3e4c01ffd 100644 --- a/client/dist/js/TinyMCE_ssmedia.js +++ b/client/dist/js/TinyMCE_ssmedia.js @@ -1,30 +1 @@ -!function(){var e={853:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=u(n(5815)),i=u(n(3724)),s=u(n(1669)),l=n(5716),a=u(n(6935));function u(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}let c=0;class p extends r.Component{constructor(e){super(e),this.dropzone=null,this.dragging=!1,this.handleAccept=this.handleAccept.bind(this),this.handleAddedFile=this.handleAddedFile.bind(this),this.handleDragEnter=this.handleDragEnter.bind(this),this.handleDragLeave=this.handleDragLeave.bind(this),this.handleDrop=this.handleDrop.bind(this),this.handleUploadProgress=this.handleUploadProgress.bind(this),this.handleUploadComplete=this.handleUploadComplete.bind(this),this.handleError=this.handleError.bind(this),this.handleSending=this.handleSending.bind(this),this.handleSuccess=this.handleSuccess.bind(this),this.handleQueueComplete=this.handleQueueComplete.bind(this),this.loadImage=this.loadImage.bind(this),this.handleMaxFilesExceeded=this.handleMaxFilesExceeded.bind(this)}componentDidMount(){this.dropzone=new i.default(this.dropzoneRef,Object.assign({},this.getDefaultOptions(),this.props.options));const{name:e}=this.props;e&&this.dropzone.hiddenFileInput&&this.dropzone.hiddenFileInput.classList.add(`dz-input-${e}`),void 0!==this.props.promptOnRemove&&this.setPromptOnRemove(this.props.promptOnRemove)}componentDidUpdate(e){const{name:t}=this.props;t&&this.dropzone.hiddenFileInput&&this.dropzone.hiddenFileInput.classList.add(`dz-input-${t}`),this.props.canUpload&&e.options!==this.props.options&&this.dropzone&&(this.dropzone.enable(),this.dropzone.options=Object.assign({},this.getDefaultOptions(),this.dropzone.options,this.props.options))}componentWillUnmount(){this.dropzone.files=[],this.dropzone.destroy()}getDefaultOptions(){let e=null,t=this.props.uploadSelector;if(!t&&this.props.uploadButton&&(t=".asset-dropzone__upload-button"),t){const n=(0,s.default)(this.dropzoneRef).find(t);n&&n.length&&(e=n.toArray())}return{accept:this.handleAccept,addedfile:this.handleAddedFile,dragenter:this.handleDragEnter,dragleave:this.handleDragLeave,drop:this.handleDrop,maxfilesexceeded:this.handleMaxFilesExceeded,uploadprogress:this.handleUploadProgress,complete:this.handleUploadComplete,dictDefaultMessage:o.default._t("AssetAdmin.DROPZONE_DEFAULT_MESSAGE","Drop files here to upload"),dictFallbackMessage:o.default._t("AssetAdmin.DROPZONE_FALLBACK_MESSAGE","Your browser does not support drag'n'drop file uploads."),dictFallbackText:o.default._t("AssetAdmin.DROPZONE_FALLBACK_TEXT","Please use the fallback form below to upload your files like in the olden days."),dictInvalidFileType:o.default._t("AssetAdmin.DROPZONE_INVALID_FILE_TYPE","You can't upload files of this type."),dictResponseError:o.default._t("AssetAdmin.DROPZONE_RESPONSE_ERROR","Server responded with an error."),dictCancelUpload:o.default._t("AssetAdmin.DROPZONE_CANCEL_UPLOAD","Cancel upload"),dictCancelUploadConfirmation:o.default._t("AssetAdmin.DROPZONE_CANCEL_UPLOAD_CONFIRMATION","Are you sure you want to cancel this upload?"),dictRemoveFile:o.default._t("AssetAdmin.DROPZONE_REMOVE_FILE","Remove file"),dictMaxFilesExceeded:o.default._t("AssetAdmin.DROPZONE_MAX_FILES_EXCEEDED","You can not upload any more files."),error:this.handleError,sending:this.handleSending,success:this.handleSuccess,queuecomplete:this.handleQueueComplete,thumbnailHeight:150,thumbnailWidth:200,timeout:0,clickable:e}}getFileCategory(e){return e.split("/")[0]}getLoadPreview(e){return new Promise((t=>{const n=new FileReader;n.onload=n=>{if("image"===this.getFileCategory(e.type)){const e=new Image;t(this.loadImage(e,n.target.result))}else t({})},n.readAsDataURL(e)}))}getFileTitle(e){return e.replace(/[.][^.]+$/,"").replace(/-_/," ")}setPromptOnRemove(e){this.dropzone.options.dictRemoveFileConfirmation=e}handleDragEnter(e){this.props.canUpload&&(this.dragging=!0,this.forceUpdate(),"function"==typeof this.props.onDragEnter&&this.props.onDragEnter(e))}handleDragLeave(e){const t=this.dropzoneRef;this.props.canUpload&&e.target===t&&(this.dragging=!1,this.forceUpdate(),"function"==typeof this.props.onDragLeave&&this.props.onDragLeave(e,t))}handleUploadProgress(e,t,n){"function"==typeof this.props.onUploadProgress&&this.props.onUploadProgress(e,t,n)}handleUploadComplete(e){"function"==typeof this.props.onUploadComplete&&this.props.onUploadComplete(e.status)}handleDrop(e){this.dragging=!1,this.forceUpdate(),"function"==typeof this.props.onDrop&&this.props.onDrop(e)}handleSending(e,t,n){"function"==typeof this.props.updateFormData&&this.props.updateFormData(n),n.append("SecurityID",this.props.securityID),n.append("ParentID",this.props.folderId);const r=Object.assign({},t,{abort:()=>{this.dropzone.cancelUpload(e),t.abort()}});"function"==typeof this.props.onSending&&this.props.onSending(e,r,n)}handleMaxFilesExceeded(e){return"function"!=typeof this.props.onMaxFilesExceeded||this.props.onMaxFilesExceeded(e)}generateQueuedId(){return c+=1,c}handleAccept(e,t){return("function"!=typeof this.props.canFileUpload||this.props.canFileUpload(e))&&this.props.canUpload?t():t(o.default._t("AssetAdmin.DROPZONE_CANNOT_UPLOAD","Uploading not permitted."))}handleAddedFile(e){e._queuedId=this.generateQueuedId();const t={category:this.getFileCategory(e.type),filename:e.name,queuedId:e._queuedId,size:e.size,title:this.getFileTitle(e.name),extension:(0,l.getFileExtension)(e.name),type:e.type,uploadedToFolderId:this.props.folderId};this.props.onAddedFile(t);return this.getLoadPreview(e).then((e=>{const n={height:e.height,width:e.width,url:e.thumbnailURL,thumbnail:e.thumbnailURL,smallThumbnail:e.thumbnailURL};return"function"==typeof this.props.onPreviewLoaded&&this.props.onPreviewLoaded(t,n),{...t,...n}}))}loadImage(e,t){return new Promise((n=>{const r=document.createElement("canvas"),o=r.getContext("2d");e.onload=()=>{const t=2*this.props.preview.width,i=2*this.props.preview.height,s=e.naturalWidth/e.naturalHeight;e.naturalWidth{this.dropzoneRef=e}},this.props.uploadButton&&r.default.createElement("button",t,o.default._t("AssetAdmin.DROPZONE_UPLOAD")),this.props.children)}}p.propTypes={folderId:a.default.number.isRequired,onAccept:a.default.func,onAddedFile:a.default.func.isRequired,onDragEnter:a.default.func,onDragLeave:a.default.func,onDrop:a.default.func,onError:a.default.func.isRequired,onPreviewLoaded:a.default.func,onSending:a.default.func,onSuccess:a.default.func.isRequired,onMaxFilesExceeded:a.default.func,updateFormData:a.default.func,canFileUpload:a.default.func,onQueueComplete:a.default.func,options:a.default.shape({url:a.default.string.isRequired}),promptOnRemove:a.default.string,securityID:a.default.string.isRequired,uploadButton:a.default.bool,uploadSelector:a.default.string,canUpload:a.default.bool.isRequired,preview:a.default.shape({width:a.default.number,height:a.default.number}),className:a.default.string},p.defaultProps={uploadButton:!0};t.default=p},3229:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=c(n(5815)),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=n(9040),s=n(5207),l=n(3556),a=c(n(6923)),u=c(n(6935));function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}function c(e){return e&&e.__esModule?e:{default:e}}class p extends o.Component{constructor(e){super(e),this.handleChangeValue=this.handleChangeValue.bind(this),this.renderChild=this.renderChild.bind(this)}getOptionByValue(e){return this.props.actions.find((t=>t.value===e))}handleChangeValue(e){let t=null;const n=this.getOptionByValue(e.target.value);return null===n?null:(t="function"==typeof n.confirm?n.confirm(this.props.items).then((()=>n.callback(e,this.props.items))).catch((e=>{if("cancelled"!==e)throw e})):n.callback(e,this.props.items)||Promise.resolve(),t)}renderChild(e,t){const n=(0,a.default)("bulk-actions__action",e.className||"font-icon-info-circled",{btn:t<2,"bulk-actions__action--more":t>2});return t<2?o.default.createElement(l.Button,{className:n,key:e.value,onClick:this.handleChangeValue,value:e.value,color:e.color},e.label):o.default.createElement(l.DropdownItem,{type:"button",className:n,key:e.value,onClick:this.handleChangeValue,value:e.value},e.label)}render(){if(!this.props.items.length)return null;let e=this.props.actions.filter((e=>!e.canApply||e.canApply(this.props.items)));if(e=e.map(this.renderChild),!e.length)return null;const{ActionMenu:t,showCount:n}=this.props,i=r.default._t("AssetAdmin.BULK_ACTIONS_SELECT_ALL","Select all"),s=r.default.sprintf(r.default._t("AssetAdmin.BULK_ACTIONS_SELECTED","%s selected"),this.props.items.length),a=r.default._t("AssetAdmin.BULK_ACTIONS_CLEAR_SELECTION","Clear selection");return o.default.createElement("div",{className:"bulk-actions fieldholder-small"},n&&o.default.createElement(o.default.Fragment,null,o.default.createElement(l.Button,{className:"bulk-actions-counter font-icon-cross-mark",onClick:this.props.onClearSelection,title:a},s),o.default.createElement("div",{className:"bulk-actions-select-all"},o.default.createElement(l.Button,{onClick:this.props.onSelectAll},i))),e.slice(0,2),e.length>2&&t?o.default.createElement(t,{id:"BulkActions",className:"bulk-actions__more-actions-menu"},e.slice(2)):e.slice(2))}}t.Component=p,p.propTypes={items:u.default.array,actions:u.default.arrayOf(u.default.shape({value:u.default.string.isRequired,label:u.default.string.isRequired,className:u.default.string,destructive:u.default.bool,callback:u.default.func,canApply:u.default.func,confirm:u.default.func})),ActionMenu:u.default.elementType,showCount:u.default.bool,onClearSelection:u.default.func.isRequired,onSelectAll:u.default.func.isRequired},p.defaultProps={items:[],actions:[],ActionMenu:null,total:null,showCount:!0,totalReachedMessage:r.default._t("")};const f=(0,i.connect)((function(e){return{gallery:e.assetAdmin.gallery}}))(p);t.default=(0,s.inject)(["ActionMenu"],(e=>({ActionMenu:e})),(()=>"BulkActions"))(f)},1037:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Folder=t.File=t.Component=void 0;var r=E(n(5815)),o=C(n(1594)),i=E(n(6923)),s=E(n(6379)),l=E(n(6022)),a=E(n(2063)),u=E(n(2932)),d=E(n(2926)),c=E(n(1990)),p=E(n(4350)),f=n(9040),h=n(9367),m=n(4172),g=C(n(769)),y=E(n(1838)),v=E(n(6935));function b(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(b=function(e){return e?n:t})(e)}function C(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=b(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function E(e){return e&&e.__esModule?e:{default:e}}function S(){return S=Object.assign?Object.assign.bind():function(e){for(var t=1;t{e.preventDefault()};class x extends o.Component{constructor(e){super(e),this.handleSelect=this.handleSelect.bind(this),this.handleActivate=this.handleActivate.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancelUpload=this.handleCancelUpload.bind(this)}componentDidUpdate(){_(this.props)&&this.props.actions.imageLoad.loadImage(this.props.item.thumbnail,this.props.sectionConfig.imageRetry)}getThumbnailStyles(){const{item:{thumbnail:e,version:t},bustCache:n}=this.props;if(!this.isImage()||!e||this.missing())return{};const r=!1===n||!t||e.startsWith("data:image/")?e:`${e}?vid=${t}`;switch(this.props.loadState){case y.default.SUCCESS:case y.default.DISABLED:return{backgroundImage:`url(${r})`};default:return{}}}getErrorMessage(){let e=null;const{item:t,loadState:n}=this.props;if(this.hasError()?e=t.message.value:this.missing()?e=r.default._t("AssetAdmin.FILE_MISSING","File cannot be found"):n===y.default.FAILED&&(e=r.default._t("AssetAdmin.FILE_LOAD_ERROR","Thumbnail not available")),null!==e){return e=this.getItemFunction("updateErrorMessage")(e,this.props),o.default.createElement("span",{className:"gallery-item__error-message"},e)}return null}getThumbnailClassNames(){const e=["gallery-item__thumbnail"];switch(this.isImageSmallerThanThumbnail()&&e.push("gallery-item__thumbnail--small"),!this.props.item.thumbnail&&this.isImage()&&e.push("gallery-item__thumbnail--no-preview"),this.props.loadState){case y.default.LOADING:case y.default.WAITING:e.push("gallery-item__thumbnail--loading");break;case y.default.FAILED:e.push("gallery-item__thumbnail--error")}return e.join(" ")}getItemClassNames(){const e=this.props.item.category||"false",t=this.props.selectable&&(this.props.item.selected||this.props.isDragging);return(0,i.default)({"gallery-item":!0,[`gallery-item--${e}`]:!0,"gallery-item--max-selected":this.props.maxSelected&&!t,"gallery-item--missing":this.missing(),"gallery-item--selectable":this.props.selectable,"gallery-item--selected":t,"gallery-item--dropping":this.props.isDropping,"gallery-item--highlighted":this.props.item.highlighted,"gallery-item--error":this.hasError(),"gallery-item--dragging":this.props.isDragging})}getItemFunction(e){const{item:t}=this.props;return"function"==typeof t[e]?t[e]:this.props[e]}getStatusFlags(){let e=[];const{item:t}=this.props;"folder"!==t.type&&(t.draft?e.push({key:"status-draft",title:r.default._t("File.DRAFT","Draft"),className:"gallery-item--draft"}):t.modified&&e.push({key:"status-modified",title:r.default._t("File.MODIFIED","Modified"),className:"gallery-item--modified"}));return e=this.getItemFunction("updateStatusFlags")(e,this.props),o.default.createElement("div",{className:"gallery-item__status-flags"},e.map((e=>o.default.createElement("span",e))))}getStatusIcons(){const{item:e}=this.props,t=[];return e.hasRestrictedAccess&&t.push({key:"status-restricted",fileID:e.id,hasRestrictedAccess:!0,placement:"top",disableTooltip:"folder"===e.type,includeBackground:"folder"!==e.type}),e.isTrackedFormUpload&&"folder"!==e.type&&t.push({key:"status-tracked-form-upload",fileID:e.id,isTrackedFormUpload:!0,hasRestrictedAccess:e.hasRestrictedAccess,placement:"top",includeBackground:!0}),o.default.createElement("div",{className:"gallery-item__status-icons"},t.map((e=>o.default.createElement(c.default,e))))}getProgressBar(){let e=null;const{item:t}=this.props,n={className:"gallery-item__progress-bar",style:{width:`${t.progress}%`}};this.hasError()||!this.uploading()||this.complete()||(e=o.default.createElement("div",{className:"gallery-item__upload-progress"},o.default.createElement("div",n)));return e=this.getItemFunction("updateProgressBar")(e,this.props),e}isImageSmallerThanThumbnail(){if(!this.isImage()||this.missing())return!1;const e=this.props.item.width,t=this.props.item.height;return t&&e&&t0}missing(){return!this.exists()&&this.saved()}uploading(){return this.props.item.queuedId&&!this.saved()}exists(){return this.props.item.exists}isImage(){return"image"===this.props.item.category}canBatchSelect(){return this.props.selectable&&this.props.item.canEdit}hasError(){let e=!1;return this.props.item.message&&(e="error"===this.props.item.message.type),e}handleActivate(e){e.stopPropagation(),"function"==typeof this.props.onActivate&&this.saved()&&this.props.onActivate(e,this.props.item)}handleSelect(e){e.stopPropagation(),e.preventDefault(),"function"==typeof this.props.onSelect&&this.props.onSelect(e,this.props.item)}handleKeyDown(e){s.default.SPACE_KEY_CODE===e.keyCode&&(e.preventDefault(),this.canBatchSelect()&&this.handleSelect(e)),s.default.RETURN_KEY_CODE===e.keyCode&&this.handleActivate(e)}handleCancelUpload(e){e.stopPropagation(),e.preventDefault(),this.hasError()?this.props.onRemoveErroredUpload(this.props.item):this.props.onCancelUpload&&this.props.onCancelUpload(this.props.item)}render(){let e=null,t=null,n=null;const{id:i,queuedId:s}=this.props.item,l=i?`item-${i}`:`queued-${s}`;if(this.props.selectable&&(this.canBatchSelect()&&(e=this.handleSelect),t="font-icon-tick"),this.uploading())e=this.handleCancelUpload,t="font-icon-cancel";else if(this.exists()){const e=r.default._t("AssetAdmin.VIEW","View");n=o.default.createElement("div",{className:"gallery-item--overlay font-icon-eye"},e)}const a=this.props.badge,u={className:"gallery-item__checkbox",type:"checkbox",title:r.default._t("AssetAdmin.SELECT","Select"),tabIndex:-1,onMouseDown:w,id:l},c=["gallery-item__checkbox-label",t];this.canBatchSelect()||(u.disabled=!0,c.push("gallery-item__checkbox-label--disabled"));const p={className:c.join(" "),onClick:e};return o.default.createElement("div",{className:this.getItemClassNames(),"data-id":this.props.item.id,tabIndex:0,role:"button",onKeyDown:this.handleKeyDown,onClick:this.handleActivate},!!a&&o.default.createElement(d.default,{className:"gallery-item__badge",status:a.status,message:a.message}),o.default.createElement("div",{ref:e=>{this.thumbnail=e},className:this.getThumbnailClassNames(),style:this.getThumbnailStyles()},n,this.getStatusFlags(),this.getStatusIcons()),this.getProgressBar(),this.getErrorMessage(),this.props.children,o.default.createElement("div",{className:"gallery-item__title",ref:e=>{this.title=e}},o.default.createElement("label",S({},p,{htmlFor:l}),o.default.createElement("input",u)),this.props.item.title))}}t.Component=x,x.propTypes={sectionConfig:p.default,item:l.default,loadState:v.default.oneOf(Object.values(y.default)),bustCache:v.default.bool,highlighted:v.default.bool,selected:v.default.bool,isDropping:v.default.bool,isDragging:v.default.bool,message:v.default.shape({value:v.default.string,type:v.default.string}),selectable:v.default.bool,onActivate:v.default.func,onSelect:v.default.func,onCancelUpload:v.default.func,onRemoveErroredUpload:v.default.func,badge:v.default.shape({status:v.default.string,message:v.default.string}),updateStatusFlags:v.default.func,updateProgressBar:v.default.func,updateErrorMessage:v.default.func},x.defaultProps={item:{},sectionConfig:{imageRetry:{}},updateStatusFlags:e=>e,updateProgressBar:e=>e,updateErrorMessage:e=>e,bustCache:!0};const F=(0,f.connect)((function(e,t){const{bustCache:n}=e.config.sections.find((e=>"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"===e.name));let r=y.default.DISABLED;if(_(t)){const n=e.assetAdmin.imageLoad.files.find((e=>t.item.thumbnail===e.url));r=n&&n.status||y.default.NONE}return{bustCache:n,loadState:r}}),(function(e){return{actions:{imageLoad:(0,h.bindActionCreators)(g,e)}}}))(x),A="GalleryItem",O=t.File=(0,m.createSelectable)((0,a.default)(A)(F));t.Folder=(0,m.createSelectable)((0,u.default)(A)(O));t.default=F},2914:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=a(n(6935)),i=n(1820),s=a(n(2926)),l=a(n(1037));function a(e){return e&&e.__esModule?e:{default:e}}function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t1?r.default.createElement("div",{key:"1",className:"gallery-item__drag-shadow"}):null,t>2?r.default.createElement("div",{key:"2",className:"gallery-item__drag-shadow gallery-item__drag-shadow--second"}):null];return r.default.createElement("div",{className:"gallery-item__drag-layer"},r.default.createElement("div",{className:"gallery-item__drag-layer-item",style:this.getOffset()},r.default.createElement("div",{className:"gallery-item__drag-layer-preview"},n,r.default.createElement(l.default,d({},e.props,{isDragging:!0}))),t>1?r.default.createElement(s.default,{className:"gallery-item__drag-layer-count",status:"info",message:`${t}`}):null))}}c.propTypes={item:o.default.object,offset:o.default.shape({x:o.default.number.isRequired,y:o.default.number.isRequired}),isDragging:o.default.bool.isRequired};t.default=(0,i.DragLayer)((e=>({item:e.getItem(),offset:e.getInitialClientOffset(),dragged:e.getDifferenceFromInitialOffset(),isDragging:e.isDragging()})))(c)},2063:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){const t={canDrag(e){return e.canDrag},beginDrag(e){const{id:t}=e.item;"function"==typeof e.onDrag&&e.onDrag(!0,t);const n=e.selectedFiles.concat([]);return n.includes(t)||n.push(t),{selected:n,props:e}},endDrag(e){const{id:t}=e.item;"function"==typeof e.onDrag&&e.onDrag(!1,t)}},n=(0,s.DragSource)(e,t,((e,t)=>({connectDragPreview:e.dragPreview(),connectDragSource:e.dragSource(),isDragging:t.isDragging()})));return e=>{class t extends o.Component{componentDidMount(){this.props.connectDragPreview((0,l.getEmptyImage)(),{captureDraggingState:!0})}render(){const{connectDragSource:t}=this.props,n=o.default.createElement(e,this.props);return"string"==typeof n.type?t(n):t(o.default.createElement("div",{className:"gallery-item__draggable"},n))}}return t.propTypes={connectDragSource:i.default.func.isRequired,connectDragPreview:i.default.func.isRequired,item:i.default.shape({id:i.default.number.isRequired}).isRequired,onDrag:i.default.func,selectedFiles:i.default.arrayOf(i.default.number)},n(t)}};var r,o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=a(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=(r=n(6935))&&r.__esModule?r:{default:r},s=n(1820),l=n(8724);function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(a=function(e){return e?n:t})(e)}},2932:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){const t={drop(e,t){if(t.canDrop()){const n=t.getItem();e.onDropFiles(e.item.id,n.selected)}},canDrop(e,t){return!t.getItem().selected.includes(e.item.id)}},n=(0,s.DropTarget)(e,t,((e,t)=>{const n=t.isOver();return{isDropping:n&&t.canDrop(),connectDropTarget:e.dropTarget(),isOver:n}}));return e=>{class t extends o.Component{render(){const{connectDropTarget:t}=this.props,n=o.default.createElement(e,this.props);return"string"==typeof n.type?t(n):t(o.default.createElement("div",{className:"gallery-item__droppable"},n))}}return t.propTypes={connectDropTarget:i.default.func.isRequired,item:i.default.shape({id:i.default.number.isRequired}).isRequired},n(t)}};var r,o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=(r=n(6935))&&r.__esModule?r:{default:r},s=n(1820);function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}},6379:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o=(r=n(5815))&&r.__esModule?r:{default:r};t.default={ACTIONS:{CREATE_FOLDER:"create-folder",EDIT_FILE:"edit"},MOVE_SUCCESS_DURATION:3e3,CSS_TRANSITION_TIME:300,SMALL_THUMBNAIL_HEIGHT:60,SMALL_THUMBNAIL_WIDTH:60,THUMBNAIL_HEIGHT:150,THUMBNAIL_WIDTH:200,BULK_ACTIONS:[{value:"delete",label:o.default._t("AssetAdmin.BULK_ACTIONS_DELETE","Delete"),className:"font-icon-trash",destructive:!0,callback:null,canApply:e=>e.every((e=>e&&e.canDelete))},{value:"archive",label:o.default._t("AssetAdmin.BULK_ACTIONS_ARCHIVE","Archive"),className:"font-icon-box",destructive:!0,callback:null,canApply:e=>e.every((e=>e&&e.canDelete))},{value:"edit",label:o.default._t("AssetAdmin.BULK_ACTIONS_EDIT","Edit"),className:"font-icon-edit",destructive:!1,canApply:e=>1===e.length,callback:null},{value:"move",label:o.default._t("AssetAdmin.BULK_ACTIONS_MOVE","Move"),className:"font-icon-folder-move",canApply:e=>e.every((e=>e&&e.canEdit)),destructive:!1,callback:null},{value:"publish",label:o.default._t("AssetAdmin.BULK_ACTIONS_PUBLISH","Publish"),className:"font-icon-rocket",destructive:!1,callback:null,canApply:e=>e.some((e=>e&&e.modified))&&e.every((e=>e.canEdit&&"folder"!==e.type)),confirm:null},{value:"unpublish",label:o.default._t("AssetAdmin.BULK_ACTIONS_UNPUBLISH","Unpublish"),className:"font-icon-cancel-circled",destructive:!1,callback:null,canApply:e=>e.some((e=>e.published))&&e.every((e=>e.canEdit&&"folder"!==e.type)),confirm:null},{value:"insert",label:o.default._t("AssetAdmin.BULK_ACTIONS_INSERT","Insert"),className:"font-icon-plus-circled btn-primary",destructive:!1,callback:null,canApply:e=>e.length,confirm:null}],BULK_ACTIONS_PLACEHOLDER:o.default._t("AssetAdmin.BULK_ACTIONS_PLACEHOLDER"),SPACE_KEY_CODE:32,RETURN_KEY_CODE:13,DEFAULT_PREVIEW:"framework/client/dist/images/app_icons/generic_92.png",MODAL_MOVE:"MODAL_MOVE"}},7917:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=N(n(1594)),o=D(n(6935)),i=n(9040),s=n(9367),l=D(n(5609)),a=D(n(5815)),u=D(n(6923)),d=N(n(4201)),c=N(n(8918)),p=N(n(1369)),f=N(n(9517)),h=D(n(1869)),m=D(n(5789)),g=D(n(2294)),y=n(708),v=N(n(6303)),b=D(n(6175)),C=D(n(3934)),E=D(n(3929)),S=D(n(5230)),_=D(n(6379)),w=D(n(4350)),x=n(5207),F=N(n(4461)),A=D(n(8268)),O=D(n(175)),I=D(n(2308));function D(e){return e&&e.__esModule?e:{default:e}}function M(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(M=function(e){return e?n:t})(e)}function N(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=M(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}class T extends r.Component{constructor(e){super(e),this.handleOpenFile=this.handleOpenFile.bind(this),this.handleCloseFile=this.handleCloseFile.bind(this),this.handleDelete=this.handleDelete.bind(this),this.doPublish=this.doPublish.bind(this),this.doUnpublish=this.doUnpublish.bind(this),this.handleUnpublish=this.handleUnpublish.bind(this),this.handleDoSearch=this.handleDoSearch.bind(this),this.handleClearSearch=this.handleClearSearch.bind(this),this.handleSubmitEditor=this.handleSubmitEditor.bind(this),this.handleOpenFolder=this.handleOpenFolder.bind(this),this.handleSort=this.handleSort.bind(this),this.handleSetPage=this.handleSetPage.bind(this),this.createEndpoint=this.createEndpoint.bind(this),this.handleBackButtonClick=this.handleBackButtonClick.bind(this),this.handleFolderIcon=this.handleFolderIcon.bind(this),this.handleBrowse=this.handleBrowse.bind(this),this.handleViewChange=this.handleViewChange.bind(this),this.handleUpload=this.handleUpload.bind(this),this.handleUploadQueue=this.handleUploadQueue.bind(this),this.handleCreateFolder=this.handleCreateFolder.bind(this),this.handleMoveFilesSuccess=this.handleMoveFilesSuccess.bind(this)}componentDidUpdate(){"function"==typeof this.props.onReplaceUrl&&!this.props.loading&&this.props.folder&&this.props.folderId!==this.props.folder.id&&this.props.onReplaceUrl(this.props.folder.id,this.props.fileId,this.props.query,this.props.viewAction)}getFolderId(){return null!==this.props.folderId?this.props.folderId:this.props.folder?this.props.folder.id:0}getFiles(){const{files:e,queuedFiles:t,folderId:n}=this.props,r=[...t.items.filter((t=>!(t.id&&e.find((e=>e.id===t.id))||t.hasOwnProperty("uploadedToFolderId")&&t.uploadedToFolderId!==n))),...e],o=r.filter((e=>"folder"===e.type)),i=r.filter((e=>"folder"!==e.type));return o.concat(i)}handleBrowse(e,t,n){"function"==typeof this.props.onBrowse&&this.props.onBrowse(e,t,n),e!==this.getFolderId()&&this.props.actions.gallery.deselectFiles()}handleSetPage(e){this.handleBrowse(this.getFolderId(),this.props.fileId,Object.assign({},this.props.query,{page:e}))}handleDoSearch(e){this.props.actions.gallery.deselectFiles(),this.props.actions.queuedFiles.purgeUploadQueue(),this.props.actions.files.readFiles(),this.handleBrowse(e.currentFolderOnly?this.getFolderId():0,null,{filter:e,view:this.props.query.view})}handleClearSearch(e){this.props.actions.displaySearch.closeSearch(),this.props.actions.gallery.deselectFiles(),this.props.actions.queuedFiles.purgeUploadQueue(),this.props.actions.files.readFiles(),this.handleOpenFolder(e,this.props.folder)}handleSort(e){this.handleBrowse(this.getFolderId(),this.props.fileId,{...this.props.query,sort:e,limit:void 0,page:void 0})}handleViewChange(e){this.handleBrowse(this.getFolderId(),this.props.fileId,Object.assign({},this.props.query,{view:e}))}createEndpoint(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return l.default.createEndpointFetcher(Object.assign({},e,t?{defaultData:{SecurityID:this.props.securityId}}:{}))}handleBackButtonClick(e){e.preventDefault(),this.props.actions.gallery.deselectFiles(),this.props.folder?this.handleOpenFolder(this.props.folder.parentId||0):this.handleOpenFolder(0)}resetFile(e){e.queuedId&&this.props.actions.queuedFiles.removeQueuedFile(e.queuedId),this.props.fileId===e.id&&this.props.resetFileDetails(this.getFolderId(),e.id,this.props.query)}handleFolderIcon(){this.handleOpenFile(this.getFolderId())}handleOpenFile(e){this.handleBrowse(this.getFolderId(),e,this.props.query)}handleSubmitEditor(e,t,n){let r=null;if("action_insert"===t&&"select"===this.props.type){const t=this.getFiles().find((t=>t.id===parseInt(e.ID,10)));return this.props.onInsertMany(null,[t]),Promise.resolve()}if("function"==typeof this.props.onSubmitEditor){const o=this.findFile(this.props.fileId);r=this.props.onSubmitEditor(e,t,n,o)}else r=n();if(!r)throw new Error("Promise was not returned for submitting");return r.then((e=>("action_createfolder"===t&&"admin"===this.props.type&&this.handleOpenFile(e.record.id),this.props.actions.files.readFiles().then((()=>("action_createfolder"===t&&"admin"!==this.props.type&&this.handleOpenFolder(this.getFolderId()),e))))))}handleCloseFile(){this.handleBrowse(this.getFolderId(),null,this.props.query)}handleOpenFolder(e){const{page:t,filter:n,...r}=this.props.query;this.handleBrowse(e,null,r)}handleDelete(e){this.props.actions.confirmDeletion.deleting();const t=e.map((e=>{const t=this.findFile(e);if(!t)throw new Error(`File selected for deletion cannot be found: ${e}`);return t.queuedId&&this.props.actions.queuedFiles.removeQueuedFile(t.queuedId),t})).map((e=>e.id)),n=this.props.folder?this.props.folder.id:0;return this.props.actions.files.deleteFiles(t,n).then((e=>{let{data:{deleteFiles:r}}=e;this.handleBrowse(n,null,this.props.query);return this.props.queuedFiles.items.filter((e=>t.includes(e.id))).forEach((e=>{e.queuedId&&this.props.actions.queuedFiles.removeQueuedFile(e.queuedId)})),this.props.actions.files.readFiles(),r})).then((t=>{const n=t.filter((e=>e)).length,{archiveFiles:r}=this.props.sectionConfig;if(n!==e.length){let t="AssetAdmin.BULK_ACTIONS_DELETE_FAIL_02",o="%s folders/files were successfully deleted, but %s files were not able to be deleted.";r&&(t="AssetAdmin.BULK_ACTIONS_ARCHIVE_FAIL_02",o="%s folders/files were successfully archived, but %s files were not able to be archived."),this.props.actions.toasts.error(a.default.sprintf(a.default._t(t,o),n,e.length-n))}else{let e="AssetAdmin.BULK_ACTIONS_DELETE_SUCCESS_02",t="%s folders/files were successfully deleted.";r&&(e="AssetAdmin.BULK_ACTIONS_ARCHIVE_SUCCESS_02",t="%s folders/files were successfully archived."),this.props.actions.toasts.success(a.default.sprintf(a.default._t(e,t),n)),this.props.actions.gallery.deselectFiles()}return t})).finally(this.props.actions.confirmDeletion.reset)}doUnpublish(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=e.map((e=>{const t=this.findFile(e);if(!t)throw new Error(`File selected for unpublishing cannot be found: ${e}`);if("folder"===t.type)throw new Error("Cannot unpublish folders");return t})).map((e=>e.id));return this.props.actions.files.unpublishFiles(n,t).then((e=>{let{data:{unpublishFiles:t}}=e;const n=t.filter((e=>"File"===e.__typename)),r=t.filter((e=>"PublicationNotice"===e.__typename&&"HAS_OWNERS"===e.noticeType)),o=n.map((e=>(this.resetFile(e),e))),i=r.slice(0,4),s=r.slice(5),l=i.map((e=>e.message));if(s.length&&l.push(a.default.inject(a.default._t("AssetAdmin.BULK_OWNED_WARNING_REMAINING","And {count} other file(s)"),{count:s.length})),i.length){const e=[a.default.inject(a.default._t("AssetAdmin.BULK_OWNED_WARNING_HEADING","{count} file(s) are being used by other published content."),{count:r.length}),l.join("\n"),a.default._t("AssetAdmin.BULK_OWNED_WARNING_FOOTER","Unpublishing will only remove files from the published version of the content. They will remain on the draft version. Unpublish anyway?")];if(confirm(e.join("\n\n"))){const e=r.reduce(((e,t)=>e.concat(t.ids)),[]);return this.doUnpublish(e,!0).then((e=>o.concat(e)))}}return o}))}handleUnpublish(e){return this.doUnpublish(e).then((e=>{const{fileId:t}=this.props;this.props.actions.files.readFiles().then((()=>{t&&e.find((e=>e.id===t))&&this.props.resetFileDetails(this.getFolderId(),t,this.props.query)}))}))}doPublish(e){const t=e.map((e=>{const t=this.findFile(e);if(!t)throw new Error(`File selected for publishing cannot be found: ${e}`);if("folder"===t.type)throw new Error("Cannot publish folders");return t})).map((e=>e.id));return this.props.actions.files.publishFiles(t).then((e=>{let{data:{publishFiles:t}}=e;return t.filter((e=>"File"===e.__typename)).map((e=>(this.resetFile(e),e)))}))}findFile(e){return this.getFiles().find((t=>t.id===parseInt(e,10)))}handleUpload(){}handleUploadQueue(){this.props.fileId&&this.props.actions.files.readFiles()}handleCreateFolder(){this.props.onBrowse(this.getFolderId(),null,this.props.query,_.default.ACTIONS.CREATE_FOLDER)}handleMoveFilesSuccess(e,t){this.props.queuedFiles.items.filter((e=>t.includes(e.id))).forEach((e=>{e.queuedId&&this.props.actions.queuedFiles.removeQueuedFile(e.queuedId)})),this.props.actions.gallery.deselectFiles(),this.props.actions.files.readFiles()}renderGallery(){const{GalleryComponent:e}=this.props,t=this.props.sectionConfig,n=t.createFileEndpoint.url,o=t.createFileEndpoint.method,i=this.props.query&&parseInt(this.props.query.limit||t.limit,10),s=this.props.query&&parseInt(this.props.query.page||1,10),l=this.props.query&&this.props.query.sort,a=this.props.query&&this.props.query.view,u=this.props.query.filter||{};return r.default.createElement(e,{files:this.getFiles(),fileId:this.props.fileId,folderId:this.getFolderId(),folder:this.props.folder,type:this.props.type,limit:i,page:s,totalCount:this.props.filesTotalCount,view:a,filters:u,graphQLErrors:this.props.graphQLErrors,createFileApiUrl:n,createFileApiMethod:o,onInsertMany:this.props.onInsertMany,onPublish:this.doPublish,onUnpublish:this.doUnpublish,onOpenFile:this.handleOpenFile,onOpenFolder:this.handleOpenFolder,onSuccessfulUpload:this.handleUpload,onSuccessfulUploadQueue:this.handleUploadQueue,onCreateFolder:this.handleCreateFolder,onMoveFilesSuccess:this.handleMoveFilesSuccess,onClearSearch:this.handleClearSearch,onSort:this.handleSort,onSetPage:this.handleSetPage,onViewChange:this.handleViewChange,sort:l,sectionConfig:t,loading:this.props.loading,maxFilesSelect:this.props.maxFiles,dialog:this.props.dialog})}renderEditor(){const{sectionConfig:e,viewAction:t,type:n,fileId:o,dialog:i,requireLinkText:s,fileSelected:l,EditorComponent:a}=this.props,{schemaUrl:u,targetId:d}=(0,A.default)({config:e,viewAction:t,folderId:this.getFolderId(),type:n,fileId:o});if(!u)return null;const c=[];s&&c.push({name:"requireLinkText",value:!0}),l&&c.push({name:"fileSelected",value:!0});const p={dialog:i,fileId:d,schemaUrl:u,schemaUrlQueries:c,onClose:this.handleCloseFile,onSubmit:this.handleSubmitEditor,onUnpublish:this.handleUnpublish,addToCampaignSchemaUrl:e.form.addToCampaignForm.schemaUrl};return r.default.createElement(a,p)}render(){const{folder:e,folderId:t,query:n,getUrl:o,type:i,maxFiles:s,toolbarChildren:l,SearchComponent:a,BulkDeleteConfirmationComponent:d}=this.props,c=Boolean(t||(0,v.hasFilters)(n.filter)),p=this.props.sectionConfig.form.fileSearchForm.schemaUrl,f=n.filter||{},h=(0,u.default)("fill-height asset-admin","select"===i&&{"asset-admin--single-select":1===s,"asset-admin--multi-select":1!==s}),m=(0,v.hasFilters)(n.filter)||this.props.showSearch,y=this.props.actions.displaySearch?this.props.actions.displaySearch.toggleSearch:void 0,C={folder:e,query:n,getUrl:o,onBrowse:this.handleBrowse,onFolderIcon:this.handleFolderIcon};return r.default.createElement("div",{className:h},r.default.createElement(g.default,{showBackButton:c,onBackButtonClick:this.handleBackButtonClick},r.default.createElement(I.default,C),r.default.createElement("div",{className:"asset-admin__toolbar-extra pull-xs-right fill-width vertical-align-items"},r.default.createElement(b.default,{toggled:m,onToggle:y}),l)),m&&r.default.createElement(a,{onSearch:this.handleDoSearch,id:"AssetSearchForm",formSchemaUrl:p,onHide:this.handleClearSearch,displayBehavior:"HIDEABLE",filters:f,name:"name"}),r.default.createElement("div",{className:"flexbox-area-grow fill-width fill-height gallery"},this.renderGallery(),this.renderEditor()),r.default.createElement(d,{onConfirm:this.handleDelete}))}}t.Component=T,T.propTypes={dialog:o.default.bool,sectionConfig:w.default,fileId:o.default.number,folderId:o.default.number,resetFileDetails:o.default.func,onBrowse:o.default.func,onReplaceUrl:o.default.func,onInsertMany:o.default.func,graphQLErrors:o.default.arrayOf(o.default.string),getUrl:o.default.func,query:o.default.shape({sort:o.default.string,limit:o.default.oneOfType([o.default.number,o.default.string]),page:o.default.oneOfType([o.default.number,o.default.string]),filter:o.default.object}),onSubmitEditor:o.default.func,type:o.default.oneOf(["insert-media","insert-link","select","admin"]),files:o.default.array,queuedFiles:o.default.shape({items:o.default.array.isRequired}),filesTotalCount:o.default.number,folder:o.default.shape({id:o.default.number,title:o.default.string,parents:o.default.array,parentId:o.default.number,canView:o.default.bool,canEdit:o.default.bool}),loading:o.default.bool,actions:o.default.object,maxFiles:o.default.number,fileSelected:o.default.bool,EditorComponent:o.default.oneOfType([o.default.object,o.default.func]),GalleryComponent:o.default.oneOfType([o.default.object,o.default.func]),SearchComponent:o.default.oneOfType([o.default.object,o.default.func]),BulkDeleteConfirmationComponent:o.default.oneOfType([o.default.object,o.default.func])},T.defaultProps={type:"admin",query:{sort:"",limit:null,page:0,filter:{}},maxFiles:null,EditorComponent:h.default,GalleryComponent:m.default,SearchComponent:v.default,BulkDeleteConfirmationComponent:O.default};t.default=(0,s.compose)((0,i.connect)((function(e,t){const{formSchema:n}=e.assetAdmin.modal;return{securityId:e.config.SecurityID,queuedFiles:e.assetAdmin.queuedFiles,showSearch:e.assetAdmin.displaySearch.isOpen,type:n&&n.type||t.type}}),(function(e){return{actions:{gallery:(0,s.bindActionCreators)(d,e),toasts:(0,s.bindActionCreators)(c,e),displaySearch:(0,s.bindActionCreators)(f,e),queuedFiles:(0,s.bindActionCreators)(p,e),confirmDeletion:(0,s.bindActionCreators)(F,e)}}})),(0,x.injectGraphql)("ReadFilesQuery"),C.default,E.default,S.default,y.withApollo)(T)},2308:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=a(n(1594)),o=a(n(6935)),i=a(n(5815)),s=n(6418),l=n(6303);function a(e){return e&&e.__esModule?e:{default:e}}const u=e=>{let{folder:t,query:n,getUrl:o,onBrowse:s,onFolderIcon:a,PlainBreadcrumbComponent:u}=e;const d=function(){for(var e=arguments.length,t=new Array(e),n=0;n{e.preventDefault(),s(...t)}},c=function(){return o&&o(...arguments)},p=[{text:i.default._t("AssetAdmin.FILES","Files"),href:c(0,null,n),onClick:d(0,null,n)}];if(t&&t.id){t.parents&&t.parents.forEach((e=>{p.push({text:e.title,href:c(e.id,null,n),onClick:d(e.id,null,n)})}));const e=[{className:"icon font-icon-edit-list",onClick:e=>{e.preventDefault(),a()}}];t.hasRestrictedAccess&&e.push({nodeName:"FileStatusIcon",hasRestrictedAccess:!0}),p.push({text:t.title,href:c(t.id,null,n),onClick:d(t.id,null,n),icons:e})}return(0,l.hasFilters)(n.filter)&&p.push({text:i.default._t("LeftAndMain.SEARCHRESULTS","Search results")}),r.default.createElement(u,{multiline:!0,crumbs:p})};u.propTypes={onBrowse:o.default.func,onFolderIcon:o.default.func,getUrl:o.default.func,query:o.default.shape({sort:o.default.string,limit:o.default.oneOfType([o.default.number,o.default.string]),page:o.default.oneOfType([o.default.number,o.default.string]),filter:o.default.object,view:o.default.string}),folder:o.default.shape({id:o.default.number,title:o.default.string,parents:o.default.array,parentId:o.default.number,canView:o.default.bool,canEdit:o.default.bool}),PlainBreadcrumbComponent:o.default.oneOfType([o.default.object,o.default.func])},u.defaultProps={PlainBreadcrumbComponent:s.Component};t.default=u},4736:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Component=void 0,t.buildUrl=v,t.default=void 0;var r=g(n(1594)),o=n(8926),i=n(9040),s=g(n(6478)),l=h(n(7917)),a=n(5716),u=h(n(7675)),d=h(n(6379)),c=h(n(4350)),p=n(5125),f=h(n(6935));function h(e){return e&&e.__esModule?e:{default:e}}function m(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(m=function(e){return e?n:t})(e)}function g(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=m(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}const y=Object.keys(d.default.ACTIONS).map((e=>d.default.ACTIONS[e]));function v(e){let{base:t,folderId:n,fileId:r,query:o,action:i}=e;if(i&&-1===y.indexOf(i))throw new Error(`Invalid action provided: ${i}`);let s=null;s=r?(0,p.joinUrlPaths)(t,`show/${n}/${d.default.ACTIONS.EDIT_FILE}/${r}`):n?(0,p.joinUrlPaths)(t,`show/${n}`):t,i===d.default.ACTIONS.CREATE_FOLDER&&(s=(0,p.joinUrlPaths)(t,`show/${n||0}/${i}`));return o&&Object.keys(o).length>0&&(s=`${s}?${u.default.stringify(o)}`),s}class b extends r.Component{constructor(e){super(e),this.handleBrowse=this.handleBrowse.bind(this),this.handleReplaceUrl=this.handleReplaceUrl.bind(this),this.handleResetDetails=this.handleResetDetails.bind(this),this.getUrl=this.getUrl.bind(this)}getUrl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:d.default.ACTIONS.EDIT_FILE;const o=parseInt(e||0,10),i=parseInt(t||0,10),s=o!==this.getFolderId(),l=Object.assign({},n);return(s||l.page<=1)&&delete l.page,v({base:`/${this.props.sectionConfig.reactRoutePath}`,folderId:o,fileId:i,query:l,action:r})}getFolderId(){return this.props.router.params&&this.props.router.params.folderId?parseInt(this.props.router.params.folderId,10):0}getFileId(){return this.props.router.params&&this.props.router.params.fileId?parseInt(this.props.router.params.fileId,10):0}getViewAction(){return this.props.router.params&&this.props.router.params.viewAction?this.props.router.params.viewAction:d.default.ACTIONS.EDIT_FILE}getSectionProps(){return{sectionConfig:this.props.sectionConfig,type:"admin",folderId:this.getFolderId(),viewAction:this.getViewAction(),fileId:this.getFileId(),query:this.getQuery(),getUrl:this.getUrl,onBrowse:this.handleBrowse,onReplaceUrl:this.handleReplaceUrl,resetFileDetails:this.handleResetDetails}}getQuery(){return(0,a.decodeQuery)(this.props.router.location.search)}handleBrowse(e,t,n,r){const o=this.getUrl(e,t,n,r);this.props.router.navigate(o)}handleReplaceUrl(e,t,n,r){const o=this.getUrl(e,t,n,r);this.props.router.navigate(o,{replace:!0})}handleResetDetails(e,t,n){const r=this.getUrl(e,t,n),o=this.getUrl(e,null,n);this.props.router.navigate(o,{replace:!0,state:{reset:!0,resetPath:r}})}render(){const{AssetAdminComponent:e}=this.props,t=this.props.router.location.state;return t&&t&&t.reset?r.default.createElement(o.Navigate,{to:t.resetPath,replace:!0}):this.props.sectionConfig?r.default.createElement(e,this.getSectionProps()):null}}t.Component=b,b.propTypes={sectionConfig:c.default,router:s.routerPropTypes,AssetAdminComponent:f.default.oneOfType([f.default.object,f.default.func])},b.defaultProps={AssetAdminComponent:l.default};t.default=(0,s.default)((0,i.connect)((function(e){return{sectionConfig:e.config.sections.find((e=>"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"===e.name))}}))(b))},2908:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.AssetAdminStateRouter=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=u(n(6935)),i=n(9040),s=n(4736),l=u(n(6379)),a=n(1021);function u(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}const c={folderId:null,fileId:null,query:{},action:l.default.ACTIONS.EDIT_FILE};class p extends r.Component{constructor(e){super(e),this.handleBrowse=this.handleBrowse.bind(this),this.getUrl=this.getUrl.bind(this),this.state=Object.assign({},c,{folderId:e.folderId})}getUrl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l.default.ACTIONS.EDIT_FILE;const o=parseInt(e||0,10),i=parseInt(t||0,10),a=this.getFolderId(),u=o!==a&&null!==a,d=Object.assign({},n);return(u||d.page<=1)&&delete d.page,(0,s.buildUrl)({base:this.props.sectionConfig.reactRoutePath,folderId:o,fileId:i,query:d,action:r})}getFolderId(){return null===this.state.folderId?null:parseInt(this.state.folderId||0,10)}getFileId(){return parseInt(this.state.fileId||this.props.fileId||0,10)}getViewAction(){return this.state.action||l.default.ACTIONS.EDIT_FILE}getSectionProps(){const e=Object.assign({},this.props,{folderId:this.getFolderId(),fileId:this.getFileId(),viewAction:this.getViewAction(),query:this.state.query,getUrl:this.getUrl,onBrowse:this.handleBrowse});return delete e.Component,e}handleBrowse(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l.default.ACTIONS.EDIT_FILE;if(r&&-1===Object.values(l.default.ACTIONS).indexOf(r))throw new Error(`Invalid action provided: ${r}`);this.state.fileId!==t&&this.props.actions.resetFormStack(),this.setState({folderId:e,fileId:t,query:n,action:r})}render(){const e=this.getSectionProps(),t=this.props.Component;return r.default.createElement(t,e)}}function f(e){return{actions:{resetFormStack:()=>e((0,a.resetFormStack)())}}}t.AssetAdminStateRouter=p,p.propTypes={Component:o.default.elementType,sectionConfig:o.default.shape({url:o.default.string.isRequired}).isRequired,fileId:o.default.number};t.default=function(e){return(0,i.connect)((function(t){const n=t.config.sections.find((e=>"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"===e.name));return{Component:e,sectionConfig:n}}),f)(p)}},175:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=v(n(1594)),o=n(9367),i=n(9040),s=v(n(6935)),l=n(708),a=n(5207),u=y(n(4461)),d=y(n(762)),c=v(n(5815)),p=v(n(6022)),f=v(n(134)),h=v(n(7871)),m=n(60);function g(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(g=function(e){return e?n:t})(e)}function y(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=g(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function v(e){return e&&e.__esModule?e:{default:e}}function b(){return b=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{loading:t,LoadingComponent:n,transition:o,files:i,descendantFileCounts:s,onModalClose:l,onCancel:a,onConfirm:u,archiveFiles:p}=e,g=null;const y=p?"AssetAdmin.ARCHIVE":"AssetAdmin.DELETE",v=p?"Archive":"Delete";let b=[{label:c.default._t(y,v),handler:()=>u(i.map((e=>{let{id:t}=e;return t}))),color:"danger"},{label:c.default._t("AssetAdmin.CANCEL","Cancel"),handler:a}];if(t)g=r.default.createElement(n,null);else{const e=Object.keys(s).length,t=(0,m.getFolderDescendantFileTotals)(i,s),n=(0,m.getFileTotalItems)(i),o={folderCount:e,folderDescendantFileTotals:t,fileTotalItems:n,archiveFiles:p};g=r.default.createElement(h.default,o),(t.totalItems||n)&&(b=[{label:c.default._t("AssetAdmin.CANCEL","Cancel"),handler:a,color:"primary"},{label:c.default._t(y,v),handler:()=>u(i.map((e=>{let{id:t}=e;return t}))),color:"danger"}])}const C=![d.CANCELING,d.DELETING].includes(o);return r.default.createElement(f.default,{body:g,isOpen:C,actions:b,onCancel:a,onClosed:l,archiveFiles:p})};t.Component=C,C.propTypes={loading:s.default.bool.isRequired,LoadingComponent:s.default.elementType,transition:s.default.oneOf(["canceling","deleting",!1]),files:s.default.arrayOf(p.default),descendantFileCounts:s.default.object,onCancel:s.default.func.isRequired,onModalClose:s.default.func.isRequired,onConfirm:s.default.func.isRequired,archiveFiles:s.default.bool.isRequired};const E=(0,o.compose)((0,a.inject)(["Loading"],(e=>({LoadingComponent:e}))),(0,a.injectGraphql)("readDescendantFileCountsQuery"),l.withApollo)(C),S={onCancel:u.cancel,onModalClose:u.modalClose};t.default=(0,o.compose)((0,i.connect)((e=>{let{assetAdmin:{confirmDeletion:t}}=e;return t}),S))((e=>{let{showConfirmation:t,files:n,...o}=e;return t&&n.length>0?r.default.createElement(E,b({},o,{files:n})):null}))},7871:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=l(n(5815)),o=l(n(1594)),i=l(n(6935)),s=n(60);function l(e){return e&&e.__esModule?e:{default:e}}const a=e=>{let{folderCount:t,folderDescendantFileTotals:n,fileTotalItems:i,archiveFiles:s}=e,l="AssetAdmin.BULK_ACTIONS_DELETE_WARNING",a="Ensure files are removed from content areas prior to deleting them, otherwise they will appear as broken links.";s&&(l="AssetAdmin.BULK_ACTIONS_ARCHIVE_WARNING",a="Ensure files are removed from content areas prior to archiving them, otherwise they will appear as broken links.");const u=((e,t,n,o)=>{const i=t.totalCount+n;if(i>0){let e="AssetAdmin.BULK_ACTIONS_DELETE_ITEMS_CONFIRM",t=["You're about to delete %s file(s) which may be used in your site's content.","Carefully check the file usage on the files before deleting the file(s)."].join(" ");return o&&(e="AssetAdmin.BULK_ACTIONS_ARCHIVE_ITEMS_CONFIRM",t=["You're about to archive %s file(s) which may be used in your site's content.","Carefully check the file usage on the files before archiving the file(s)."].join(" ")),r.default.sprintf(r.default._t(e,t),i)}if(1===e){let e="AssetAdmin.BULK_ACTIONS_DELETE_FOLDER_CONFIRM",t="Are you sure you want to delete this folder?";return o&&(e="AssetAdmin.BULK_ACTIONS_ARCHIVE_FOLDER_CONFIRM",t="Are you sure you want to archive this folder?"),r.default._t(e,t)}let s="AssetAdmin.BULK_ACTIONS_DELETE_FOLDERS_CONFIRM",l="Are you sure you want to delete these folders?";return o&&(s="AssetAdmin.BULK_ACTIONS_ARCHIVE_FOLDERS_CONFIRM",l="Are you sure you want to archive these folders?"),r.default._t(s,l)})(t,n,i,s);return o.default.createElement(o.default.Fragment,null,o.default.createElement("p",null,u),(n.totalItems>0||i>0)&&o.default.createElement("p",null,r.default._t(l,a)))};a.propTypes={folderCount:i.default.number,folderDescendantFileTotals:s.descendantFileTotalsShape,fileTotalItems:i.default.number},a.defaultProps={folderCount:0,folderDescendantFileTotals:{totalItems:0,totalCount:0},fileTotalItems:0};t.default=a},134:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=l(n(5815)),o=l(n(1594)),i=l(n(6935)),s=n(3556);function l(e){return e&&e.__esModule?e:{default:e}}const a=e=>{let{isOpen:t,body:n,onCancel:i,actions:l,archiveFiles:a}=e,u="AssetAdmin.CONFIRM_FILE_DELETION",d="Confirm deletion";return a&&(u="AssetAdmin.CONFIRM_FILE_ARCHIVE",d="Confirm archive"),o.default.createElement(s.Modal,{isOpen:t,toggle:i},o.default.createElement(s.ModalHeader,{toggle:i},r.default._t(u,d)),o.default.createElement(s.ModalBody,null,n),o.default.createElement(s.ModalFooter,null,l.map((e=>{let{label:t,handler:n,color:r}=e;return o.default.createElement(s.Button,{key:t,color:r,onClick:n},t)}))))};a.propTypes={isOpen:i.default.bool.isRequired,body:i.default.node.isRequired,onCancel:i.default.func.isRequired,actions:i.default.arrayOf(i.default.shape({label:i.default.string.isRequired,handler:i.default.func,color:i.default.string})),archiveFiles:i.default.bool.isRequired};t.default=a},60:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getFolderDescendantFileTotals=t.getFileTotalItems=t.descendantFileTotalsShape=void 0;var r,o=(r=n(6935))&&r.__esModule?r:{default:r};const i=e=>{let{type:t}=e;return"folder"===t},s=e=>!i(e),l={totalItems:0,totalCount:0};t.descendantFileTotalsShape=o.default.shape({totalItems:o.default.number,totalCount:o.default.number});t.getFolderDescendantFileTotals=(e,t)=>{return e.filter(i).reduce((n=t,(e,t)=>{let{id:r}=t;return n[r]>0?{totalItems:e.totalItems+1,totalCount:e.totalCount+n[r]}:e}),l);var n};t.getFileTotalItems=e=>e.filter(s).length},1869:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=S(n(5815)),o=n(9040),i=n(9367),s=E(n(1594)),l=S(n(6379)),a=S(n(55)),u=S(n(8737)),d=E(n(9077)),c=S(n(6022)),p=S(n(6935)),f=n(5207),h=E(n(4461)),m=E(n(1021)),g=S(n(6923)),y=S(n(7008)),v=S(n(7675)),b=E(n(1584));function C(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(C=function(e){return e?n:t})(e)}function E(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=C(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function S(e){return e&&e.__esModule?e:{default:e}}function _(){return _=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{name:n,value:r}=t;return{...e,[n]:r}}),{});return y.default.format({...r,pathname:`${r.path}/${n}`,search:v.default.stringify(o)})}handleAction(e){switch(e.currentTarget.name){case"action_addtocampaign":this.openModal(),e.preventDefault();break;case"action_replacefile":this.replaceFile(),e.preventDefault();break;case"action_downloadfile":this.downloadFile(),e.preventDefault();break;case"action_delete":this.props.actions.confirmDeletion.confirm([this.props.file]),e.preventDefault()}}handleCancelKeyDown(e){e.keyCode!==l.default.SPACE_KEY_CODE&&e.keyCode!==l.default.RETURN_KEY_CODE||this.handleClose(e)}handleSubmit(e,t,n){const{showingSubForm:r,actions:o}=this.props;return"function"==typeof this.props.onSubmit?this.props.onSubmit(e,t,n).finally((()=>{r&&-1!==["action_save","action_publish"].indexOf(t)&&o.modal.popFormStackEntry()})):n()}handleClose(e){const{showingSubForm:t,onClose:n,actions:r}=this.props;t?r.modal.popFormStackEntry():(n(),this.closeModal()),e&&e.preventDefault()}openModal(){this.setState({openModal:!0})}closeModal(){this.setState({openModal:!1})}replaceFile(){const e=document.querySelector(".dz-input-PreviewImage");e&&e.click()}downloadFile(){!function(e,t){const n=document.createElement("a");n.download=t,n.href=e,document.body.appendChild(n),n.click(),document.body.removeChild(n)}(this.props.file.url,this.props.file.name),document.getElementById("Form_fileEditForm_PopoverActions").focus()}handleLoadingError(e){this.setState({loadingForm:!1,loadingError:e.errors[0]})}handleLoadingSuccess(){this.setState({loadingForm:!1,loadingError:null})}handleFetchingSchema(){this.setState({loadingForm:!0})}editorHeader(e){let{SchemaComponent:t,...n}=e;const{dialog:r,nextType:o,showingSubForm:i,actions:l,file:a,EditorHeaderComponent:u}=this.props,d=this.getFormSchemaUrl();let c=b.buttonStates.SWITCH;r&&a&&"folder"!==a.type&&(c=i?b.buttonStates.ALWAYS_BACK:b.buttonStates.ONLY_BACK);const{formid:p}=n,f=o&&a&&"folder"!==a.type?()=>{l.modal.stashFormValues(p,d),l.modal.pushFormStackEntry(o)}:void 0,h={onCancel:this.handleClose,showButton:c,onDetails:f};return s.default.createElement(u,h,s.default.createElement(t,n))}createFn(e,t){if("AssetEditorHeaderFieldGroup"===t.name){const n=this.editorHeader,r={key:t.id,SchemaComponent:e,...t};return s.default.createElement(n,r)}return s.default.createElement(e,_({key:t.id},t))}render(){const{FormBuilderLoaderComponent:e,FormBuilderModalComponent:t}=this.props,n=this.getFormSchemaUrl(),o=`${this.props.addToCampaignSchemaUrl}/${this.props.fileId}`,i=(0,g.default)("panel","form--no-dividers","editor",{"editor--asset-dropzone--disable":!this.props.enableDropzone},this.props.className);let l=null;if(this.state.loadingError){let e=this.state.loadingError.value;404===this.state.loadingError.code&&(e=r.default._t("AssetAdmin.FILE_MISSING","File cannot be found")),e||(e=r.default._t("Admin.UNKNOWN_ERROR","An unknown error has occurred")),l=s.default.createElement("div",{className:"editor__file-preview-message--file-missing"},e)}const a=r.default._t("Admin.ADD_TO_CAMPAIGN","Add to campaign"),u=this.props.loadingComponent,{file:d}=this.props;return s.default.createElement("div",{className:i},s.default.createElement("div",{className:"editor__details fill-height"},s.default.createElement(e,{identifier:"AssetAdmin.EditForm",schemaUrl:n,onSubmit:this.handleSubmit,onAction:this.handleAction,onLoadingSuccess:this.handleLoadingSuccess,onLoadingError:this.handleLoadingError,onFetchingSchema:this.handleFetchingSchema,createFn:this.createFn,file:d}),l,s.default.createElement(t,{title:a,identifier:"AssetAdmin.AddToCampaign",isOpen:this.state.openModal,onClosed:this.closeModal,schemaUrl:o,bodyClassName:"modal__dialog",responseClassBad:"modal__response modal__response--error",responseClassGood:"modal__response modal__response--good"}),this.state.loadingForm&&s.default.createElement(u,null)))}}t.Component=w,w.propTypes={file:c.default,className:p.default.string,fileId:p.default.number.isRequired,enableDropzone:p.default.bool,dialog:p.default.bool,onClose:p.default.func.isRequired,onSubmit:p.default.func.isRequired,schemaUrl:p.default.string.isRequired,schemaUrlQueries:p.default.arrayOf(p.default.shape({name:p.default.string,value:p.default.any})),addToCampaignSchemaUrl:p.default.string,actions:p.default.object,showingSubForm:p.default.bool,nextType:p.default.string,EditorHeaderComponent:p.default.oneOfType([p.default.object,p.default.func]),FormBuilderLoaderComponent:p.default.oneOfType([p.default.object,p.default.func]),FormBuilderModalComponent:p.default.oneOfType([p.default.object,p.default.func])},w.defaultProps={EditorHeaderComponent:b.default,FormBuilderLoaderComponent:a.default,FormBuilderModalComponent:u.default};t.default=(0,i.compose)((0,f.inject)(["Loading"],(e=>({loadingComponent:e})),(()=>"AssetAdmin.Editor")),(0,o.connect)((function(e){let{assetAdmin:{gallery:t,modal:n}}=e;return{enableDropzone:t.enableDropzone,nextType:n.formSchema&&n.formSchema.nextType,showingSubForm:n.formSchemaStack&&n.formSchemaStack.length>1}}),(function(e){return{actions:{unsavedForms:(0,i.bindActionCreators)(d,e),confirmDeletion:(0,i.bindActionCreators)(h,e),modal:(0,i.bindActionCreators)(m,e)}}})),(0,f.injectGraphql)("ReadOneFileQuery"))(w)},1584:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.buttonStates=void 0;var r=u(n(1594)),o=u(n(5815)),i=u(n(551)),s=u(n(2164)),l=u(n(6935)),a=u(n(6923));function u(e){return e&&e.__esModule?e:{default:e}}const d=e=>t=>{t.preventDefault(),e&&e()},c="ALWAYS_BACK",p="ALWAYS_CANCEL",f="SWITCH",h="ONLY_BACK",m="ONLY_CANCEL",g=t.buttonStates={ALWAYS_BACK:c,ALWAYS_CANCEL:p,SWITCH:f,ONLY_BACK:h,ONLY_CANCEL:m,NONE:"NONE"},y=e=>{let{onCancel:t,onDetails:n,showButton:l,children:u}=e;const g=d(t),y=[c,f,h].indexOf(l)>=0,v=[p,f,m].indexOf(l)>=0,b=(0,a.default)("editor-header__back-button","btn--icon-xl",{"editor-header__back-button--md-below":[f,h].indexOf(l)>=0}),C=(0,a.default)("editor-header__cancel-button","btn--icon-xl",{"editor-header__cancel-button--lg-above":[f,m].indexOf(l)>=0});return r.default.createElement("div",{className:"editor-header"},y&&r.default.createElement(s.default,{className:b,onClick:g}),r.default.createElement("div",{className:"editor-header__field"},u),n&&r.default.createElement(i.default,{onClick:d(n),icon:"edit-list",className:"editor-header__edit",outline:!0},o.default._t("AssetAdmin.DETAILS","Details")),v&&r.default.createElement("div",null,r.default.createElement(i.default,{icon:"cancel",className:C,noText:!0,onClick:g},o.default._t("AssetAdmin.CANCEL"))))};y.propTypes={onCancel:l.default.func,onDetails:l.default.func,showButton:l.default.oneOf(Object.keys(g).map((e=>g[e]))),children:l.default.node};t.default=y},5789:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.galleryViewPropTypes=t.galleryViewDefaultProps=t.default=t.Component=void 0;var r=I(n(1669)),o=I(n(5815)),i=O(n(1594)),s=n(9040),l=n(9367),a=I(n(853)),u=I(n(3229)),d=I(n(2853)),c=I(n(6609)),p=I(n(6379)),f=I(n(6621)),h=O(n(4201)),m=O(n(8918)),g=O(n(1369)),y=O(n(4461)),v=I(n(4064)),b=n(708),C=n(4172),E=I(n(4350)),S=I(n(9247)),_=n(5207),w=I(n(6935)),x=I(n(5769)),F=I(n(3863));function A(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(A=function(e){return e?n:t})(e)}function O(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=A(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function I(e){return e&&e.__esModule?e:{default:e}}const D={DELETE:"delete",ARCHIVE:"archive",EDIT:"edit",MOVE:"move",PUBLISH:"publish",UNPUBLISH:"unpublish",INSERT:"insert",ADMIN:"admin",SELECT:"select"};class M extends i.Component{constructor(e){super(e),this.handleOpenFolder=this.handleOpenFolder.bind(this),this.handleOpenFile=this.handleOpenFile.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleAddedFile=this.handleAddedFile.bind(this),this.handlePreviewLoaded=this.handlePreviewLoaded.bind(this),this.handleCancelUpload=this.handleCancelUpload.bind(this),this.handleRemoveErroredUpload=this.handleRemoveErroredUpload.bind(this),this.handleUploadProgress=this.handleUploadProgress.bind(this),this.handleSending=this.handleSending.bind(this),this.handleSort=this.handleSort.bind(this),this.handleSetPage=this.handleSetPage.bind(this),this.handleSuccessfulUpload=this.handleSuccessfulUpload.bind(this),this.handleQueueComplete=this.handleQueueComplete.bind(this),this.handleFailedUpload=this.handleFailedUpload.bind(this),this.handleClearSearch=this.handleClearSearch.bind(this),this.handleEnableDropzone=this.handleEnableDropzone.bind(this),this.handleMoveFiles=this.handleMoveFiles.bind(this),this.handleBulkEdit=this.handleBulkEdit.bind(this),this.handleBulkPublish=this.handleBulkPublish.bind(this),this.handleBulkUnpublish=this.handleBulkUnpublish.bind(this),this.handleBulkMove=this.handleBulkMove.bind(this),this.handleBulkInsert=this.handleBulkInsert.bind(this),this.handleBeginSelection=this.handleBeginSelection.bind(this),this.handleGroupSelect=this.handleGroupSelect.bind(this),this.handleClearSelection=this.handleClearSelection.bind(this),this.handleSelectAll=this.handleSelectAll.bind(this),this.toggleSelectConcat=this.toggleSelectConcat.bind(this),this.getSelectableFiles=this.getSelectableFiles.bind(this)}componentDidMount(){this.initSortDropdown(),window.addEventListener("keydown",this.toggleSelectConcat),window.addEventListener("keyup",this.toggleSelectConcat)}componentDidUpdate(e){this.initSortDropdown(),this.initFlushUploadFiles(e)}componentWillUnmount(){window.removeEventListener("keydown",this.toggleSelectConcat),window.removeEventListener("keyup",this.toggleSelectConcat)}initFlushUploadFiles(e){if("tile"!==this.props.view){this.getSortElement().off("change")}e.folderId!==this.props.folderId&&this.props.actions.queuedFiles.purgeUploadQueue()}getSortElement(){return(0,r.default)(this.gallery).find(".gallery__sort .dropdown")}getSearchMessage(e){const t=[];e.name&&t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGEKEYWORDS","with keywords '{name}'")),e.lastEditedFrom&&e.lastEditedTo?t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGEEDITEDBETWEEN","last edited between '{lastEditedFrom}' and '{lastEditedTo}'")):e.lastEditedFrom?t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGEEDITEDFROM","last edited after '{lastEditedFrom}'")):e.lastEditedTo&&t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGEEDITEDTO","last edited before '{lastEditedTo}'")),e.appCategory&&t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGECATEGORY","categorised as '{appCategory}'")),e.currentFolderOnly&&this.props.folder.title&&t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGELIMIT","limited to the folder '{folder}'"));const n=[t.slice(0,-1).join(`${o.default._t("AssetAdmin.JOIN",",")} `),t.slice(-1)].filter((e=>e)).join(` ${o.default._t("AssetAdmin.JOINLAST","and")} `);if(""===n)return"";const r={parts:o.default.inject(n,Object.assign({folder:this.props.folder.title},e,{appCategory:e.appCategory?e.appCategory.toLowerCase():void 0}))};return o.default.inject(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGE","Search results {parts}"),r)}getSelection(e,t){const n=this.getSelectableFiles(),r=[e,t].map((e=>n.findIndex((t=>t.id===e)))).filter((e=>-1!==e)).sort(((e,t)=>e-t));if(2!==r.length)return r.map((e=>n[e].id));const[o,i]=r;return n.filter(((e,t)=>t>=o&&t<=i)).map((e=>e.id))}getSelectableFiles(){const e=this.props.files.filter((e=>e.id));return this.props.type===D.SELECT?e.filter((e=>"folder"!==e.type)):e}handleBulkInsert(e,t){this.props.onInsertMany(e,t)}handleBulkPublish(e,t){const n=t.map((e=>e.id));return n.length?(this.props.actions.gallery.setLoading(!0),this.props.onPublish(n).then((e=>{this.props.actions.gallery.setLoading(!1),this.props.actions.toasts.success(o.default.sprintf(o.default._t("AssetAdmin.BULK_ACTIONS_PUBLISH_SUCCESS","%s folders/files were successfully published."),e.length)),this.props.actions.gallery.deselectFiles()}))):(this.props.actions.gallery.deselectFiles(),Promise.resolve(!0))}handleBulkUnpublish(e,t){const n=t.filter((e=>e.published)).map((e=>e.id));return n.length?(this.props.actions.gallery.setLoading(!0),this.props.onUnpublish(n).then((e=>{this.props.actions.gallery.setLoading(!1),this.props.actions.toasts.success(o.default.sprintf(o.default._t("AssetAdmin.BULK_ACTIONS_UNPUBLISH_SUCCESS","%s folders/files were successfully unpublished."),e.length)),this.props.actions.gallery.deselectFiles()}))):(this.props.actions.gallery.deselectFiles(),Promise.resolve(!0))}initSortDropdown(){if("tile"===this.props.view){const e=this.getSortElement();e.chosen({allow_single_deselect:!0,disable_search_threshold:20}),e.off("change"),e.on("change",(()=>e.find(":selected")[0].click()))}}handleSort(e){this.props.actions.queuedFiles.purgeUploadQueue(),this.props.onSort(e)}handleSetPage(e){this.props.onSetPage(e)}handleCancelUpload(e){e.xhr.abort(),this.props.actions.queuedFiles.removeQueuedFile(e.queuedId)}handleRemoveErroredUpload(e){this.props.actions.queuedFiles.removeQueuedFile(e.queuedId)}handleAddedFile(e){this.props.actions.queuedFiles.addQueuedFile(e)}handlePreviewLoaded(e,t){this.props.actions.queuedFiles.updateQueuedFile(e.queuedId,t)}handleSending(e,t){this.props.actions.queuedFiles.updateQueuedFile(e._queuedId,{xhr:t})}handleUploadProgress(e,t){this.props.actions.queuedFiles.updateQueuedFile(e._queuedId,{progress:t})}handleSuccessfulUpload(e){const t=JSON.parse(e.xhr.response);if(void 0!==t[0].error)return void this.handleFailedUpload(e);this.props.actions.queuedFiles.succeedUpload(e._queuedId,t[0]),this.props.onSuccessfulUpload&&this.props.onSuccessfulUpload(t);const n=this.props.queuedFiles.items.reduce(((e,t)=>100!==t.progress?e+1:e),0);if(!this.props.fileId&&!this.props.selectedFiles.length&&0===n){const e=t.pop();this.props.onOpenFile(e.id)}}handleQueueComplete(){this.props.onSuccessfulUploadQueue&&this.props.onSuccessfulUploadQueue()}handleFailedUpload(e,t){const n=e.xhr&&e.xhr.status?(0,S.default)(e.xhr.status,e.xhr):"";this.props.actions.queuedFiles.failUpload(e._queuedId,t,n)}itemIsSelected(e){return this.props.selectedFiles.indexOf(e)>-1}toggleSelectConcat(e){this.props.actions.gallery.setConcatenateSelect(this.isConcat(e))}isConcat(e){return e.metaKey||e.ctrlKey||e.shiftKey}itemIsHighlighted(e){return this.props.fileId===e}hasOpenedItem(){return!!this.props.fileId}handleClearSearch(e){this.props.onClearSearch(e)}handleGroupSelect(e,t){const{setSelectedFiles:n,selectFiles:r}=this.props.actions.gallery,o=this.getSelectableFiles(),i=e.filter(((t,n)=>e.indexOf(t)===n&&o.find((e=>e.id===t)))),s=this.props.concatenateSelect||this.isConcat(t);if(null!==this.props.maxFilesSelect){let e=i.length;if(s){e=this.props.selectedFiles.filter((e=>!this.props.selectedFiles.includes(e))).concat(this.props.selectedFiles).length}if(e>=this.props.maxFilesSelect)return}s?r(i):n(i)}handleClearSelection(){this.props.actions.gallery.deselectFiles()}handleSelectAll(){const e=this.props.files.map((e=>e.id));this.handleGroupSelect(e,new Event("na"))}handleBeginSelection(e){let t=e.target;for(;t;){if(t.classList.contains("griddle-footer"))return!1;if(t.classList.contains("gallery__main--selectable"))break;t=t.parentNode}return!0}handleOpenFolder(e,t){e.preventDefault(),this.props.onOpenFolder(t.id)}handleOpenFile(e,t){e.preventDefault(),null!==t.created&&(this.props.selectedFiles.length&&1!==this.props.maxFilesSelect||this.props.type!==D.SELECT||this.handleSelect(e,t),this.props.onOpenFile(t.id,t))}handleSelect(e,t){const n=this.props.maxFilesSelect;let r=this.getSelectableFiles().filter((e=>e.id===t.id)).map((e=>e.id));if(1!==n)if(-1===this.props.selectedFiles.indexOf(t.id)){e.shiftKey&&(r=this.getSelection(this.props.lastSelected,t.id));if(this.props.selectedFiles.filter((e=>!r.includes(e))).concat(r).length>n&&null!==n)return;this.props.actions.gallery.selectFiles(r),this.props.actions.gallery.setLastSelected(t.id)}else this.props.actions.gallery.deselectFiles([t.id]),e.shiftKey&&this.props.actions.gallery.setLastSelected(null);else this.props.actions.gallery.setSelectedFiles(r)}handleEnableDropzone(e){this.props.actions.gallery.setEnableDropzone(e)}handleMoveFiles(e,t){this.props.actions.files.moveFiles(e,t).then((()=>{const n=p.default.MOVE_SUCCESS_DURATION,r=`+${t.length}`;this.props.actions.gallery.setFileBadge(e,r,"success",n),"function"==typeof this.props.onMoveFilesSuccess&&this.props.onMoveFilesSuccess(e,t)})).catch((()=>{this.props.actions.toasts.error(o.default._t("AssetAdmin.FAILED_MOVE","There was an error moving the selected items."))}))}handleBulkEdit(e,t){this.handleOpenFile(e,t[0])}handleBulkMove(){this.props.actions.gallery.activateModal(p.default.MODAL_MOVE)}renderTransitionBulkActions(){return this.renderBulkActions()}renderBulkActions(){const{type:e,dialog:t,maxFilesSelect:n,files:r,selectedFiles:o,BulkActionsComponent:s,sectionConfig:l}=this.props,a=e===D.SELECT||t?e=>e.value===D.INSERT:e=>e.value!==D.INSERT,u=l.archiveFiles?e=>e.value!==D.DELETE:e=>e.value!==D.ARCHIVE,d=p.default.BULK_ACTIONS.filter(a).filter(u).map((e=>{if(e.callback)return e;switch(e.value){case D.DELETE:case D.ARCHIVE:return{...e,callback:(e,t)=>{this.props.actions.confirmDeletion.confirm(t)},confirm:void 0};case D.EDIT:return{...e,callback:this.handleBulkEdit};case D.MOVE:return{...e,callback:this.handleBulkMove};case D.PUBLISH:return{...e,callback:this.handleBulkPublish};case D.UNPUBLISH:return{...e,callback:this.handleBulkUnpublish};case D.INSERT:return{...e,callback:this.handleBulkInsert,color:"primary"};default:return e}})),c=o.map((e=>r.find((t=>t&&e===t.id)))).filter((e=>e));return c.length>0&&[D.ADMIN,D.SELECT].includes(e)?i.default.createElement(s,{actions:d,items:c,total:n,key:c.length>0,container:this.gallery,showCount:1!==n,onClearSelection:this.handleClearSelection,onSelectAll:this.handleSelectAll}):null}renderGalleryView(){const e="table"===this.props.view?c.default:d.default,t=this.props.files.map((e=>{const t=this.itemIsSelected(e.id),n=this.itemIsHighlighted(e.id),r=(e.queuedId?`queueId${e.queuedId}`:`id${e.id}`)+(t?"--selected":"");return{...e,selected:t,highlighted:n,key:r}})),{type:n,loading:r,dialog:o,page:s,totalCount:l,limit:a,sort:u,selectedFiles:p,badges:f,maxFilesSelect:h,sectionConfig:m}=this.props,g={selectableItems:n===D.SELECT||n===D.ADMIN&&(!h||h>1),selectableFolders:n!==D.SELECT&&!o,files:t,loading:r,page:s,totalCount:l,limit:a,sort:u,selectedFiles:p,badges:f,onSort:this.handleSort,onSetPage:this.handleSetPage,onOpenFile:this.handleOpenFile,onOpenFolder:this.handleOpenFolder,onSelect:this.handleSelect,onCancelUpload:this.handleCancelUpload,onDropFiles:this.handleMoveFiles,onRemoveErroredUpload:this.handleRemoveErroredUpload,onEnableDropzone:this.handleEnableDropzone,sectionConfig:m,canDrag:n===D.ADMIN,maxFilesSelect:h};return i.default.createElement(e,g)}renderToolbar(){const{GalleryToolbar:e,sort:t,view:n,folder:r,onCreateFolder:o,onOpenFolder:s,onViewChange:l}=this.props,a={onMoveFiles:this.handleMoveFiles,onSort:this.handleSort,onCreateFolder:o,onOpenFolder:s,onViewChange:l,view:n,sort:t,folder:r};return i.default.createElement(e,a)}render(){const{folder:e,loading:t,errorMessage:n,graphQLErrors:r,noticeMessage:s}=this.props,l=this.props.LoadingComponent,u=r&&r.length>0;if(!e)return n||u?i.default.createElement("div",{className:"gallery__error flexbox-area-grow"},i.default.createElement("div",{className:"gallery__error-message"},i.default.createElement("h3",null,o.default._t("AssetAdmin.DROPZONE_RESPONSE_ERROR","Server responded with an error.")),n&&i.default.createElement("p",null,n),u&&r.map(((e,t)=>i.default.createElement("p",{key:t},e))))):t?i.default.createElement("div",{className:"flexbox-area-grow"},i.default.createElement(l,null)):i.default.createElement("div",{className:"flexbox-area-grow"},i.default.createElement("div",{className:"editor__file-preview-message--file-missing m-t-3"},o.default._t("Admin.UNKNOWN_ERROR","An unknown error has occurred")));const d=i.default.createElement("div",{className:"gallery_messages"},n&&i.default.createElement(f.default,{value:n,type:"danger"}),s&&i.default.createElement(f.default,{value:s,type:"success"})),c={height:p.default.THUMBNAIL_HEIGHT,width:p.default.THUMBNAIL_WIDTH},h={url:this.props.createFileApiUrl,method:this.props.createFileApiMethod,paramName:"Upload",clickable:"#upload-button",...this.props.sectionConfig.dropzoneOptions},m=this.props.securityId,g=this.props.folder.canEdit&&this.props.enableDropzone,y=["panel","panel--padded","panel--scrollable","gallery__main","fill-height"];this.props.type===D.INSERT&&y.push("insert-media-modal__main");const v=y;return this.hasOpenedItem()&&v.push("gallery__main--has-opened-item"),i.default.createElement("div",{className:"flexbox-area-grow gallery__outer",ref:e=>{this.gallery=e}},this.renderTransitionBulkActions(),i.default.createElement(F.default,{className:y.join(" ")},this.renderToolbar(),i.default.createElement(C.SelectableGroup,{enabled:"tile"===this.props.view&&this.props.type===D.ADMIN,className:"flexbox-area-grow fill-height gallery__main--selectable",onSelection:this.handleGroupSelect,onNonItemClick:this.handleClearSelection,onBeginSelection:this.handleBeginSelection,preventDefault:!1,fixedPosition:!0},i.default.createElement(a.default,{name:"gallery-container",className:"flexbox-area-grow",canUpload:g,onAddedFile:this.handleAddedFile,onPreviewLoaded:this.handlePreviewLoaded,onError:this.handleFailedUpload,onSuccess:this.handleSuccessfulUpload,onQueueComplete:this.handleQueueComplete,onSending:this.handleSending,onUploadProgress:this.handleUploadProgress,preview:c,folderId:this.props.folderId,options:h,securityID:m,uploadButton:!1},d,this.renderGalleryView()))),this.props.loading&&i.default.createElement(l,null),i.default.createElement(x.default,{sectionConfig:this.props.sectionConfig,folderId:this.props.folderId,onSuccess:this.props.onMoveFilesSuccess,onOpenFolder:this.props.onOpenFolder}))}}t.Component=M;const N={page:1,limit:15},T={sectionConfig:E.default,loading:w.default.bool,sort:w.default.string,files:w.default.arrayOf(w.default.shape({id:w.default.number,parent:w.default.shape({id:w.default.number})})).isRequired,selectedFiles:w.default.arrayOf(w.default.number),totalCount:w.default.number,page:w.default.number,limit:w.default.number,badges:w.default.arrayOf(w.default.shape({id:w.default.number,message:w.default.node,status:w.default.string})),onOpenFile:w.default.func.isRequired,onOpenFolder:w.default.func.isRequired,onSort:w.default.func.isRequired,onSetPage:w.default.func.isRequired,maxFilesSelect:w.default.number};t.galleryViewDefaultProps=Object.assign({},N,{selectableItems:!1}),t.galleryViewPropTypes=Object.assign({},T,{selectableItems:w.default.bool,selectableFolders:w.default.bool,onSelect:w.default.func,onCancelUpload:w.default.func,onRemoveErroredUpload:w.default.func,onEnableDropzone:w.default.func});M.defaultProps=Object.assign({},N,{type:D.ADMIN,view:"tile",enableDropzone:!0,dialog:!1,BulkActionsComponent:u.default}),M.propTypes=Object.assign({},T,{onSuccessfulUpload:w.default.func,onSuccessfulUploadQueue:w.default.func,onCreateFolder:w.default.func,onMoveFilesSuccess:w.default.func,onPublish:w.default.func,onUnpublish:w.default.func,type:w.default.oneOf(["insert-media","insert-link",D.SELECT,D.ADMIN]),view:w.default.oneOf(["tile","table"]),lastSelected:w.default.number,dialog:w.default.bool,fileId:w.default.number,folderId:w.default.number.isRequired,folder:w.default.shape({id:w.default.number,title:w.default.string,parentId:w.default.number,canView:w.default.bool,canEdit:w.default.bool}),files:w.default.array,errorMessage:w.default.string,graphQLErrors:w.default.arrayOf(w.default.string),actions:w.default.object,securityId:w.default.string,onViewChange:w.default.func.isRequired,createFileApiUrl:w.default.string,createFileApiMethod:w.default.string,search:w.default.object,enableDropzone:w.default.bool,concatenateSelect:w.default.bool,GalleryToolbar:w.default.elementType,sorters:w.default.arrayOf(w.default.shape({field:w.default.string.isRequired,direction:w.default.oneOf(["asc","desc"]).isRequired,label:w.default.string.isRequired})).isRequired,BulkActionsComponent:w.default.oneOfType([w.default.object,w.default.func])});t.default=(0,l.compose)((0,_.inject)(["GalleryToolbar","Loading"],((e,t)=>({GalleryToolbar:e,LoadingComponent:t})),(()=>"AssetAdmin.Gallery")),(0,s.connect)((function(e,t){let{sort:n}=t;const{selectedFiles:r,errorMessage:o,noticeMessage:i,enableDropzone:s,badges:l,concatenateSelect:a,loading:u,sorters:d,lastSelected:c}=e.assetAdmin.gallery;return!n&&d&&d[0]&&(n=`${d[0].field},${d[0].direction}`),{lastSelected:c,selectedFiles:r,errorMessage:o,noticeMessage:i,enableDropzone:s,badges:l,concatenateSelect:a,loading:t.loading||u,queuedFiles:e.assetAdmin.queuedFiles,securityId:e.config.SecurityID,sorters:d,sort:n}}),(function(e){return{actions:{gallery:(0,l.bindActionCreators)(h,e),toasts:(0,l.bindActionCreators)(m,e),queuedFiles:(0,l.bindActionCreators)(g,e),confirmDeletion:(0,l.bindActionCreators)(y,e)}}})),v.default,(e=>(0,b.withApollo)(e)))(M)},3863:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=a(n(6923)),i=a(n(2914)),s=a(n(6935)),l=a(n(5799));function a(e){return e&&e.__esModule?e:{default:e}}function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}class d extends r.Component{constructor(e){super(e),this.state={dragging:!1},this.mounted=!1,this.handleDrop=this.handleDrop.bind(this)}componentDidMount(){this.mounted=!0,window.addEventListener("drop",this.handleDrop,!0)}componentDidUpdate(){setTimeout((()=>{if(!this.mounted||!this.context.dragDropManager)return;const e=this.context.dragDropManager.monitor.isDragging();this.state.dragging!==e&&this.setState({dragging:e})}))}componentWillUnmount(){this.mounted=!1,window.removeEventListener("drop",this.handleDrop,!0)}handleDrop(){const e=this.context.dragDropManager,t=e&&e.backend;t&&t.isDraggingNativeItem()&&t.endDragNativeItem()}render(){const{className:e,children:t}=this.props;return r.default.createElement("div",{className:(0,o.default)(e,{"gallery__main--dragging":this.state.dragging})},t,r.default.createElement(i.default,null))}}d.contextTypes={dragDropManager:s.default.object},d.propTypes={className:s.default.string,children:s.default.oneOfType([s.default.arrayOf(s.default.node),s.default.node])};t.default=(0,l.default)(d)},6931:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=b(n(5815)),o=v(n(1594)),i=n(9367),s=n(9040),l=b(n(7917)),a=b(n(2908)),u=b(n(1957)),d=v(n(4201)),c=v(n(1021)),p=b(n(8737)),f=b(n(6923)),h=b(n(6935)),m=b(n(8268)),g=b(n(7675));function y(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(y=function(e){return e?n:t})(e)}function v(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=y(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function b(e){return e&&e.__esModule?e:{default:e}}class C extends o.Component{constructor(e){super(e),this.handleSubmit=this.handleSubmit.bind(this)}componentDidMount(){const{isOpen:e,onBrowse:t,setOverrides:n,fileAttributes:r,folderId:o}=this.props;e?"function"==typeof n&&r.ID&&(n(this.props),t(o,r.ID)):t(o||0)}componentDidUpdate(e){!this.props.isOpen&&e.isOpen&&(this.props.onBrowse(this.props.folderId),this.props.actions.gallery.deselectFiles()),"function"==typeof e.setOverrides&&this.props.isOpen&&!e.isOpen&&(e.setOverrides(this.props),this.props.onBrowse(this.props.folderId,this.props.fileAttributes?this.props.fileAttributes.ID:null))}getSectionProps(){return{...this.props,dialog:!0,toolbarChildren:this.renderToolbarChildren(),onSubmitEditor:this.handleSubmit,onReplaceUrl:this.props.onBrowse}}getModalProps(){const{onHide:e,onInsert:t,sectionConfig:n,schemaUrl:r,className:o,...i}=this.props;return{...i,className:(0,f.default)("insert-media-modal",o),size:"lg",showCloseButton:!1}}handleSubmit(e,t,n,r){return"action_insert"===t?this.props.onInsert(e,r):n()}renderToolbarChildren(){return o.default.createElement("button",{type:"button",className:"close modal__close-button insert-media-modal__close-button",onClick:this.props.onClosed,"aria-label":r.default._t("FormBuilderModal.CLOSE","Close")},o.default.createElement("span",{"aria-hidden":"true"},"×"))}render(){const e=this.getModalProps(),t=this.getSectionProps(),n=this.props.isOpen?o.default.createElement(l.default,t):null;return o.default.createElement(p.default,e,n)}}t.Component=C,C.propTypes={sectionConfig:h.default.shape({url:h.default.string,form:h.default.object}),type:h.default.oneOf(["insert-media","insert-link","select","admin"]),schemaUrl:h.default.string,isOpen:h.default.bool,setOverrides:h.default.func,onInsert:h.default.func.isRequired,fileAttributes:h.default.shape({ID:h.default.number,AltText:h.default.string,Width:h.default.number,Height:h.default.number,Loading:h.default.string,TitleTooltip:h.default.string,Alignment:h.default.string,Description:h.default.string,TargetBlank:h.default.bool}),requireLinkText:h.default.bool,folderId:h.default.number,fileId:h.default.number,viewAction:h.default.string,query:h.default.object,getUrl:h.default.func,onBrowse:h.default.func.isRequired,onClosed:h.default.func,className:h.default.string,actions:h.default.object,maxFiles:h.default.number,fileSelected:h.default.bool},C.defaultProps={className:"",fileAttributes:{},type:"insert-media",folderId:0,maxFiles:1};t.default=(0,i.compose)(a.default,(0,s.connect)((function(e,t){const n=t.sectionConfig;if(!n)return{};let r=0;null!==t.folderId?r=t.folderId:t.folder&&(r=t.folder.id);const o=t.fileAttributes?t.fileAttributes.ID:t.fileId,i=e.assetAdmin.modal.formSchema,s={config:n,viewAction:t.viewAction,folderId:r,type:i&&i.type,fileId:o},{schemaUrl:l,targetId:a}=(0,m.default)(s);if(!l)return{};const u={};t.requireLinkText&&(u.requireLinkText=!0),t.fileSelected&&(u.fileSelected=!0);let d=g.default.stringify(u);return d=d?`?${d}`:"",{schemaUrl:`${l}/${a}${d}`,type:i&&i.type}}),(function(e){return{actions:{gallery:(0,i.bindActionCreators)(d,e),modal:(0,i.bindActionCreators)(c,e)}}})),u.default)(C)},5769:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=h(n(1594)),o=n(9040),i=n(9367),s=h(n(5815)),l=h(n(6379)),a=h(n(6935)),u=n(4201),d=n(8918),c=h(n(8737)),p=h(n(4350)),f=h(n(4064));function h(e){return e&&e.__esModule?e:{default:e}}class m extends r.default.Component{constructor(e){super(e),this.handleSubmit=this.handleSubmit.bind(this),this.timeout=null}handleSubmit(e){let{FolderID:t}=e;const{moveFiles:n}=this.props.actions.files,{selectedFiles:r,onSuccess:o,onClosed:i,setNotice:a,setError:u,setBadge:d}=this.props;return n(t||0,r).then((e=>{let{data:{moveFiles:{id:n,filename:u}}}=e;"function"==typeof o&&o(t,r),d(n,`${r.length}`,"success",l.default.MOVE_SUCCESS_DURATION),a(s.default.sprintf(s.default._t("AssetAdmin.MOVED_ITEMS_TO","Moved %s item(s) to %s"),r.length,u),[{label:s.default._t("AssetAdmin.GO_TO_FOLDER","Go to folder"),onClick:()=>this.props.onOpenFolder(n)}]),i()})).catch((()=>{u(s.default._t("AssetAdmin.FAILED_MOVE","There was an error moving the selected items."))}))}render(){const{isOpen:e,onClosed:t,title:n,folderId:o,sectionConfig:i}=this.props,{schemaUrl:s}=i.form.moveForm;return r.default.createElement(c.default,{title:n,isOpen:e,onClosed:t,onSubmit:this.handleSubmit,identifier:"AssetAdmin.MoveForm",schemaUrl:`${s}/${o}`})}}m.propTypes={sectionConfig:p.default,folderId:a.default.number.isRequired,isOpen:a.default.bool,onClosed:a.default.func,setNotice:a.default.func,setBadge:a.default.func,setError:a.default.func,title:a.default.string,onSuccess:a.default.func,onOpenFolder:a.default.func.isRequired,selectedFiles:a.default.array.isRequired,actions:a.default.shape({files:a.default.shape({moveFiles:a.default.func})}).isRequired},m.defaultProps={isOpen:!1};t.default=(0,i.compose)((0,o.connect)((function(e){const{modal:t,selectedFiles:n}=e.assetAdmin.gallery;return{isOpen:t===l.default.MODAL_MOVE,selectedFiles:n,title:s.default.sprintf(s.default._t("AssetAdmin.MOVE_ITEMS_TO","Move %s item(s) to..."),n.length)}}),(function(e){return{onClosed(){e((0,u.deactivateModal)())},setNotice(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];e((0,d.display)({text:t,type:"success",actions:n}))},setError(t){e((0,d.display)({text:t,type:"error"}))},setBadge(){e((0,u.setFileBadge)(...arguments))}}})),f.default)(m)},6609:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=f(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=p(n(6935)),i=p(n(9888)),s=p(n(5815)),l=p(n(1990)),a=n(5789),u=n(5716),d=n(5207),c=n(9367);function p(e){return e&&e.__esModule?e:{default:e}}function f(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(f=function(e){return e?n:t})(e)}class h extends r.Component{constructor(e){super(e),this.getColumns=this.getColumns.bind(this),this.handleSort=this.handleSort.bind(this),this.handleSetPage=this.handleSetPage.bind(this),this.handleRowClick=this.handleRowClick.bind(this),this.renderSelect=this.renderSelect.bind(this),this.renderTitle=this.renderTitle.bind(this),this.renderStatus=this.renderStatus.bind(this),this.renderNoItemsNotice=this.renderNoItemsNotice.bind(this)}getColumns(){const e=["thumbnail","title","status","size","lastEdited"];return this.props.selectableItems&&e.unshift("selected"),e}getColumnConfig(){return[{columnName:"selected",sortable:!1,displayName:"",cssClassName:"gallery__table-column--select",customComponent:this.renderSelect},{columnName:"thumbnail",sortable:!1,displayName:"",cssClassName:"gallery__table-column--image",customComponent:this.renderThumbnail},{columnName:"title",customCompareFn:()=>0,displayName:s.default._t("File.TITLE","Title"),cssClassName:"gallery__table-column--title",customComponent:this.renderTitle},{columnName:"status",sortable:!1,cssClassName:"sort--disabled",customComponent:this.renderStatus,displayName:s.default._t("File.STATUS","Status")},{columnName:"lastEdited",displayName:s.default._t("File.MODIFIED","Modified"),customComponent:this.renderDate},{columnName:"size",sortable:!1,displayName:s.default._t("File.SIZE","Size"),cssClassName:"sort--disabled",customComponent:this.renderSize}]}getRowMetadata(e){return"gallery__table-row "+(e.highlighted?"gallery__table-row--highlighted":"")}getTableProps(){const[e,t]=this.props.sort.split(",");return{tableClassName:"gallery__table table table-hover",gridClassName:"gallery__main-view--table",rowMetadata:{bodyCssClassName:this.getRowMetadata,key:"key"},sortAscendingComponent:"",sortDescendingComponent:"",useExternal:!0,externalSetPage:this.handleSetPage,externalChangeSort:this.handleSort,externalSetFilter:()=>null,externalSetPageSize:()=>null,externalCurrentPage:this.props.page-1,externalMaxPage:Math.ceil(this.props.totalCount/this.props.limit),externalSortColumn:e,externalSortAscending:"asc"===t,initialSort:e,columns:this.getColumns(),columnMetadata:this.getColumnConfig(),useGriddleStyles:!1,onRowClick:this.handleRowClick,results:this.props.files,customNoDataComponent:this.renderNoItemsNotice}}handleActivate(e,t){"folder"===t.type?this.props.onOpenFolder(e,t):this.props.onOpenFile(e,t)}handleRowClick(e,t){const n=e.props.data;t.currentTarget.classList.contains("gallery__table-column--select")&&(t.stopPropagation(),t.preventDefault(),"function"==typeof this.props.onSelect)?this.props.onSelect(t,n):this.handleActivate(t,n)}handleSort(e,t){const n=t?"asc":"desc";this.props.onSort(`${e},${n}`)}handleSetPage(e){this.props.onSetPage(e+1)}preventFocus(e){e.preventDefault()}renderNoItemsNotice(){return 0!==this.props.files.length||this.props.loading?null:r.default.createElement("p",{className:"gallery__no-item-notice"},s.default._t("AssetAdmin.NOITEMSFOUND"))}renderSize(e){if("folder"===e.rowData.type)return null;const t=(0,u.fileSize)(e.data);return r.default.createElement("span",null,t)}renderStatus(e){let t=[];const n=e.rowData,{VersionedBadge:o}=this.props;return"folder"!==n.type&&(n.draft?t.push({key:"status-draft",status:"draft"}):n.modified&&t.push({key:"status-modified",status:"modified"})),t=t.map((e=>{let{...t}=e;return r.default.createElement(o,t)})),t?r.default.createElement("span",null,t):null}renderProgressBar(e){if(!e.queuedId||e.message&&"error"===e.message.type)return null;if(e.id>0)return r.default.createElement("div",{className:"gallery__progress-bar--complete"});const t={className:"gallery__progress-bar-progress",style:{width:`${e.progress}%`}};return r.default.createElement("div",{className:"gallery__progress-bar"},r.default.createElement("div",t))}renderRestrictedAccess(e){const{hasRestrictedAccess:t}=e,n={fileID:e.id,placement:"top",hasRestrictedAccess:t};return r.default.createElement(l.default,n)}renderTrackedFormUpload(e){const{isTrackedFormUpload:t,hasRestrictedAccess:n}=e,o={fileID:e.id,placement:"top",isTrackedFormUpload:t,hasRestrictedAccess:n};return r.default.createElement(l.default,o)}renderTitle(e){const t=this.renderProgressBar(e.rowData);return r.default.createElement("div",{className:"fill-width"},r.default.createElement("div",{className:"flexbox-area-grow"},r.default.createElement("span",null,e.data),e.rowData.hasRestrictedAccess&&this.renderRestrictedAccess(e.rowData),e.rowData.isTrackedFormUpload&&this.renderTrackedFormUpload(e.rowData)),t)}renderSelect(e){if(this.props.selectableItems&&(this.props.selectableFolders||"folder"!==e.rowData.type)){const t={type:"checkbox",title:s.default._t("AssetAdmin.SELECT"),defaultChecked:e.data,tabIndex:-1,onMouseDown:this.preventFocus};return![null,1].includes(this.props.maxFilesSelect)&&this.props.selectedFiles.length>=this.props.maxFilesSelect&&!e.data&&(t.disabled=!0),r.default.createElement("input",t)}return null}renderDate(e){return"folder"===e.rowData.type?null:(moment.locale(s.default.detectLocale()),r.default.createElement("span",null,moment(e.data).format("L LT")))}renderThumbnail(e){const t=e.data||e.rowData.url,n=e.rowData.queuedId&&!e.rowData.id,o=e.rowData.category||"false",i="gallery__table-image",s=[i],l={};return s.push(`${i}--${o}`),"image"===o&&t&&(l.backgroundImage=`url("${t}")`),n||t||"folder"===o||s.push(`${i}--error`),r.default.createElement("div",{className:s.join(" "),style:l})}render(){return r.default.createElement(i.default,this.getTableProps())}}t.Component=h,h.defaultProps=a.galleryViewDefaultProps,h.propTypes={...a.galleryViewPropTypes,sort:o.default.string.isRequired,VersionedBadge:o.default.elementType};t.default=(0,c.compose)((0,d.inject)(["VersionedBadge"],(e=>({VersionedBadge:e}))))(h)},2853:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=d(n(5815)),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=n(5207),s=n(5789),l=d(n(9888)),a=d(n(6935));function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}function d(e){return e&&e.__esModule?e:{default:e}}class c extends o.Component{constructor(e){super(e),this.renderItem=this.renderItem.bind(this),this.handleSetPage=this.handleSetPage.bind(this),this.handlePrevPage=this.handlePrevPage.bind(this),this.handleNextPage=this.handleNextPage.bind(this),this.handleDrag=this.handleDrag.bind(this)}handleDrag(e){this.props.onEnableDropzone(!e)}handleSetPage(e){this.props.onSetPage(e+1)}handleNextPage(){const e=this.props.page-1;this.handleSetPage(e+1)}handlePrevPage(){const e=this.props.page-1;0!==e?this.handleSetPage(e-1):this.handleSetPage(e)}folderFilter(e){return"folder"===e.type}fileFilter(e){return"folder"!==e.type}renderPagination(){if(this.props.totalCount<=this.props.limit)return null;const e={setPage:this.handleSetPage,maxPage:Math.ceil(this.props.totalCount/this.props.limit),next:this.handleNextPage,nextText:r.default._t("AssetAdmin.NEXT","Next"),previous:this.handlePrevPage,previousText:r.default._t("AssetAdmin.PREVIOUS","Previous"),currentPage:this.props.page-1,useGriddleStyles:!1};return o.default.createElement("div",{className:"griddle-footer"},o.default.createElement(l.default.GridPagination,e))}renderItem(e){const{File:t,Folder:n,badges:r,sectionConfig:i,selectedFiles:s,selectableItems:l,selectableFolders:a}=this.props,u=r.find((t=>t.id===e.id));let d={sectionConfig:i,key:e.key,selectableKey:e.id,item:e,selectedFiles:s,onDrag:this.handleDrag,badge:u,canDrag:this.props.canDrag};if(e.queuedId&&!e.id){const{onCancelUpload:e,onRemoveErroredUpload:t}=this.props;d={...d,onCancelUpload:e,onRemoveErroredUpload:t}}else{const{onOpenFolder:t,onOpenFile:n}=this.props;d={...d,onActivate:"folder"===e.type?t:n}}if(l&&(a||"folder"!==e.type)){const e=![null,1].includes(this.props.maxFilesSelect)&&this.props.selectedFiles.length>=this.props.maxFilesSelect,t=1===this.props.maxFilesSelect?d.onActivate:this.props.onSelect;d={...d,selectable:!0,onSelect:t,maxSelected:e}}if("folder"===e.type){const{onDropFiles:e}=this.props;return d={...d,onDropFiles:e},o.default.createElement(n,d)}return o.default.createElement(t,d)}render(){return o.default.createElement("div",{className:"gallery__main-view--tile"},o.default.createElement("div",{className:"gallery__folders"},this.props.files.filter(this.folderFilter).map(this.renderItem)),o.default.createElement("div",{className:"gallery__files"},this.props.files.filter(this.fileFilter).map(this.renderItem)),0===this.props.files.length&&!this.props.loading&&o.default.createElement("p",{className:"gallery__no-item-notice"},r.default._t("AssetAdmin.NOITEMSFOUND")),o.default.createElement("div",{className:"gallery__load"},this.renderPagination()))}}t.Component=c,c.defaultProps=s.galleryViewDefaultProps,c.propTypes={...s.galleryViewPropTypes,File:a.default.elementType.isRequired,Folder:a.default.elementType.isRequired};const p=(0,i.inject)(["GalleryItemFile","GalleryItemFolder"],((e,t)=>({File:e,Folder:t})),(()=>"AssetAdmin.Gallery.ThumbnailView"));t.default=p(c)},2499:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.imageSizePresetButtons=function(e,t){return t.map((t=>function(e,t){const{name:n,width:r,text:o}=t,i=`ssmedia${n}`;e.on("init",(()=>{e.formatter.register(i,{selector:"img",attributes:{width:r?r.toString():""}})}));const s=()=>{let t=e.selection.getNode();return"IMG"!==t.tagName&&t.children.item("img")&&(t=t.children.item("img")),t&&"IMG"===t.tagName?t:void 0},l=e=>{const t=s();e.disabled(!(!t||!r)&&t.naturalWidth{if(e.formatter.match(i))return!0;const t=s();if(!r&&t){const e=t.getAttribute("width");return!e||e.toString()===t.naturalWidth.toString()}return!1},u=t=>{const n=t.target,o=()=>{n.active(a())};if(e.on("NodeChange",(()=>{l(n),o()})),l(n),e.formatter&&(e.formatter.formatChanged(i,o),a())){e.formatter.apply(i);const t=s();t&&t.setAttribute("width",r||t.naturalWidth)}},d=()=>{const t=s();t&&(t.removeAttribute("height"),t.removeAttribute("width"),e.formatter.apply(i),r?t.setAttribute("height",t.clientHeight):(t.setAttribute("width",t.naturalWidth),t.setAttribute("height",t.naturalHeight)))};return e.ui.registry.addButton(i,{text:o,onAction:d,onPostRender:u}),i}(e,t)))}},4350:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o=(r=n(6935))&&r.__esModule?r:{default:r};const i=o.default.shape({url:o.default.string,limit:o.default.number,imageRetry:o.default.shape({minRetry:o.default.number,maxRetry:o.default.number,expiry:o.default.number}),form:o.default.object,dropzoneOptions:o.default.object});t.default=i},6298:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fileInterface=t.file=void 0;t.fileInterface="\n fragment FileInterfaceFields on FileInterface {\n canDelete\n canEdit\n canView\n category\n exists\n filename\n id\n lastEdited\n name\n parentId\n title\n type\n url\n visibility\n hasRestrictedAccess\n }\n",t.file="\n fragment FileFields on File {\n draft\n extension\n published\n modified\n size\n smallThumbnail\n thumbnail\n version\n isTrackedFormUpload\n }\n"},6022:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o=(r=n(6935))&&r.__esModule?r:{default:r};const i=o.default.shape({canEdit:o.default.bool,canDelete:o.default.bool,canView:o.default.bool,exists:o.default.bool,type:o.default.string,smallThumbnail:o.default.string,thumbnail:o.default.string,width:o.default.number,height:o.default.number,category:o.default.oneOfType([o.default.bool,o.default.string]),id:o.default.number,url:o.default.string,title:o.default.string,progress:o.default.number,visibility:o.default.string,hasRestrictedAccess:o.default.bool,isTrackedFormUpload:o.default.bool});t.default=i},8268:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){let{config:{form:t},viewAction:n,folderId:r,fileId:o,type:l}=e,a=null,u=null;if(n===i)return a=t.folderCreateForm.schemaUrl,u=r,{schemaUrl:a,targetId:u};if(n===s&&o){switch(l){case"insert-media":a=t.fileInsertForm.schemaUrl;break;case"insert-link":a=t.fileEditorLinkForm.schemaUrl;break;case"select":a=t.fileSelectForm.schemaUrl;break;default:a=t.fileEditForm.schemaUrl}return u=o,{schemaUrl:a,targetId:u}}return{}};var r,o=(r=n(6379))&&r.__esModule?r:{default:r};const{CREATE_FOLDER:i,EDIT_FILE:s}=o.default.ACTIONS},9247:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(413===e)return o.default._t("AssetAdmin.ERROR_FILE_SIZE","File size limit exceeded");if(403===e&&t&&"string"==typeof t.response)return t.response;return o.default._t("AssetAdmin.ERROR_DEFAULT","Something went wrong, please try again")};var r,o=(r=n(5815))&&r.__esModule?r:{default:r}},6405:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={CONFIRM_DELETION_ASK:"CONFIRM_DELETION_ASK",CONFIRM_DELETION_CONFIRM:"CONFIRM_DELETION_CONFIRM",CONFIRM_DELETION_CANCEL:"CONFIRM_DELETION_CANCEL",CONFIRM_DELETION_RESET:"CONFIRM_DELETION_RESET",CONFIRM_DELETION_MODAL_CLOSE:"CONFIRM_DELETION_MODAL_CLOSE"}},4461:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cancel=function(){return{type:o.default.CONFIRM_DELETION_CANCEL,payload:{}}},t.confirm=function(e){return{type:o.default.CONFIRM_DELETION_ASK,payload:{files:e}}},t.deleting=function(){return{type:o.default.CONFIRM_DELETION_CONFIRM,payload:{}}},t.modalClose=function(){return{type:o.default.CONFIRM_DELETION_MODAL_CLOSE,payload:{}}},t.reset=function(){return{type:o.default.CONFIRM_DELETION_RESET,payload:{}}};var r,o=(r=n(6405))&&r.__esModule?r:{default:r}},762:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NO_TRANSITION=t.DELETING=t.CANCELING=void 0;t.NO_TRANSITION=!1,t.CANCELING="canceling",t.DELETING="deleting"},6533:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={TOGGLE_SEARCH:"TOGGLE_SEARCH",OPEN_SEARCH:"OPEN_SEARCH",CLOSE_SEARCH:"CLOSE_SEARCH"}},9517:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.closeSearch=function(){return{type:o.default.CLOSE_SEARCH,payload:null}},t.openSearch=function(){return{type:o.default.OPEN_SEARCH,payload:null}},t.toggleSearch=function(){return{type:o.default.TOGGLE_SEARCH,payload:null}};var r,o=(r=n(6533))&&r.__esModule?r:{default:r}},2310:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o=(r=n(7284))&&r.__esModule?r:{default:r},i=n(6298);t.default=e=>{const t=e.charAt(0).toUpperCase()+e.slice(1),n=o.default` - mutation ${t}($ids:[ID]!, $force:Boolean, $quiet:Boolean) { - ${e}(ids: $ids, force: $force, quiet: $quiet) { - ...on File { - __typename - ...FileInterfaceFields - ...FileFields - } - ...on PublicationNotice { - __typename - noticeType - message - ids - } - } - } - ${i.fileInterface} - ${i.file} -`,r={props:t=>{let{mutate:n,ownProps:{actions:r}}=t;return{actions:{...r,files:{...r.files,[e]:function(e){return n({variables:{ids:e,quiet:!(arguments.length>2&&void 0!==arguments[2])||arguments[2],force:arguments.length>1&&void 0!==arguments[1]&&arguments[1]}})}}}}}};return{mutation:n,config:r}}},3934:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mutation=t.default=t.config=void 0;var r=n(708),o=s(n(7284)),i=s(n(5207));function s(e){return e&&e.__esModule?e:{default:e}}const l=t.mutation=o.default`mutation DeleteFiles($ids:[ID]!) { - deleteFiles(ids: $ids) -}`,a=t.config={props:e=>{let{mutate:t,ownProps:n}=e;const{actions:r}=n;return{actions:{...r,files:{...r.files,deleteFiles:function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t({variables:{ids:e},update:t=>{const o=i.default.query.get("ReadFilesQuery"),s=o.getApolloConfig().options(n).variables;null!==r&&(s.rootFilter.id=r,s.rootFilter.anyChildId=null);const l=o.getGraphqlAST(),a=t.readQuery({query:l,variables:s});if(!a)return;const u=JSON.parse(JSON.stringify(a));if(u.readFiles.nodes){let{nodes:t}=u.readFiles.nodes[0].children;t=t.filter((t=>!e.includes(t.id))),u.readFiles.nodes[0].children.nodes=t,u.readFiles.nodes[0].children.pageInfo.totalCount=t.length}else{let{nodes:t}=u.readFiles[0].children;t=t.filter((t=>!e.includes(t.id))),u.readFiles[0].children.nodes=t,u.readFiles[0].children.pageInfo.totalCount=t.length}t.writeQuery({query:l,data:u,variables:s})}})}}}}}};t.default=(0,r.graphql)(l,a)},4064:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mutation=t.default=t.config=void 0;var r,o=n(708),i=(r=n(7284))&&r.__esModule?r:{default:r},s=n(6298);const l=t.mutation=i.default` - mutation MoveFiles($folderId:ID!, $fileIds:[ID]!) { - moveFiles(folderId: $folderId, fileIds: $fileIds) { - ...FileInterfaceFields - ...FileFields - } - } - ${s.fileInterface} - ${s.file} -`,a=t.config={props:e=>{let{mutate:t,ownProps:{actions:n={}}}=e;return{actions:Object.assign({},n,{files:Object.assign({},n.files,{moveFiles:(e,n)=>t({variables:{folderId:e,fileIds:n},update:()=>{window.ss.apolloClient.resetStore()}})})})}}};t.default=(0,o.graphql)(l,a)},5230:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mutation=t.default=t.config=void 0;var r,o=n(708),i=(r=n(2310))&&r.__esModule?r:{default:r};const{mutation:s,config:l}=(0,i.default)("publishFiles");t.config=l,t.mutation=s;t.default=(0,o.graphql)(s,l)},3929:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mutation=t.default=t.config=void 0;var r,o=n(708),i=(r=n(2310))&&r.__esModule?r:{default:r};const{mutation:s,config:l}=(0,i.default)("unpublishFiles");t.config=l,t.mutation=s;t.default=(0,o.graphql)(s,l)},4913:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=["SET_LAST_SELECTED","SET_SELECTED_FILES","DESELECT_FILES","SELECT_FILES","LOAD_FILE_REQUEST","LOAD_FILE_SUCCESS","HIGHLIGHT_FILES","UPDATE_BATCH_ACTIONS","SET_NOTICE_MESSAGE","SET_ERROR_MESSAGE","SET_ENABLE_DROPZONE","SET_FILE_BADGE","CLEAR_FILE_BADGE","ACTIVATE_MODAL","DEACTIVATE_MODAL","CONCATENATE_SELECT","SET_LOADING"].reduce(((e,t)=>Object.assign(e,{[t]:`GALLERY.${t}`})),{})},4201:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.activateModal=function(e){return t=>{t({type:o.default.ACTIVATE_MODAL,payload:e})}},t.clearFileBadge=i,t.deactivateModal=function(){return e=>{e({type:o.default.DEACTIVATE_MODAL})}},t.deselectFiles=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return t=>t({type:o.default.DESELECT_FILES,payload:{ids:e}})},t.loadFile=function(e,t){return n=>{n({type:o.default.LOAD_FILE_SUCCESS,payload:{id:e,file:t}})}},t.selectFiles=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return t=>t({type:o.default.SELECT_FILES,payload:{ids:e}})},t.setConcatenateSelect=function(e){return t=>t({type:o.default.CONCATENATE_SELECT,payload:!!e})},t.setEnableDropzone=function(e){return t=>t({type:o.default.SET_ENABLE_DROPZONE,payload:{enableDropzone:e}})},t.setErrorMessage=function(e){return t=>t({type:o.default.SET_ERROR_MESSAGE,payload:{message:e}})},t.setFileBadge=function(e,t,n,r){return(s,l)=>{const{assetAdmin:a}=l(),u=a.gallery.badges.find((t=>t.id===e));u&&u.timer&&clearTimeout(u.timer);const d=r>0?setTimeout((()=>i(e)(s)),r):null;s({type:o.default.SET_FILE_BADGE,payload:{id:e,message:t,status:n,timer:d}})}},t.setLastSelected=function(e){return t=>{t({type:o.default.SET_LAST_SELECTED,payload:{id:e}})}},t.setLoading=function(e){return t=>{t({type:o.default.SET_LOADING,payload:!!e})}},t.setNoticeMessage=function(e){return t=>t({type:o.default.SET_NOTICE_MESSAGE,payload:{message:e}})},t.setSelectedFiles=function(e){return t=>{t({type:o.default.SET_SELECTED_FILES,payload:{files:e}})}};var r,o=(r=n(4913))&&r.__esModule?r:{default:r};function i(e){return t=>{t({type:o.default.CLEAR_FILE_BADGE,payload:{id:e}})}}},423:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultImageFactory=t.default=void 0;var r=i(n(1838)),o=i(n(8632));function i(e){return e&&e.__esModule?e:{default:e}}const s={minRetry:0,maxRetry:0,expiry:0,onStatusChange:()=>null,onRetry:()=>null,onReset:()=>null,onTimeout:()=>null},l=(e,t,n)=>{const r=new Image;r.onload=t,r.onerror=n,r.src=e};t.defaultImageFactory=l;t.default=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;this.options={...s,...e},this.factory=t}loadImage(e){return this.options.minRetry&&o.default.lock(e)?this.loadImageLoop(e,this.options.minRetry):null}loadImageLoop(e,t){return this.options.onStatusChange(e,r.default.LOADING),new Promise(((t,n)=>this.factory(e,t,n))).then((()=>this.handleSuccess(e))).catch((()=>this.handleError(e,t)))}handleReset(e,t){this.options.onReset(e),t()}handleTimeout(e,t){const n=setTimeout(e,t);return this.options.onTimeout(n,t),n}handleSuccess(e){o.default.unlock(e),this.options.onStatusChange(e,r.default.SUCCESS)}handleFailure(e){return o.default.unlock(e),this.options.onStatusChange(e,r.default.FAILED),this.options.expiry?new Promise((t=>{this.handleTimeout((()=>this.handleReset(e,t)),1e3*this.options.expiry)})):null}handleError(e,t){return t>this.options.maxRetry?this.handleFailure(e):(this.options.onStatusChange(e,r.default.WAITING),this.handleRetry(e,t))}handleRetry(e,t){const n=new Promise((n=>{this.handleTimeout((()=>n(this.loadImageLoop(e,2*t))),1e3*t)}));return this.options.onRetry(e,t,n),n}setOnRetry(e){this.options.onRetry=e}setOnReset(e){this.options.onReset=e}setOnStatusChange(e){this.options.onStatusChange=e}setOnTimeout(e){this.options.onTimeout=e}}},2153:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={SET_STATUS:"IMAGE_LOAD_SET_STATUS",RESET:"IMAGE_LOAD_RESET"}},769:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loadImage=function(e,t){return(n,i)=>{if(!e)return null;if(i().assetAdmin.imageLoad.files.find((t=>t.url===e)))return null;const s={...t,onStatusChange:(e,t)=>n({type:r.default.SET_STATUS,payload:{status:t,url:e}}),onReset:e=>n({type:r.default.RESET,payload:{url:e}})};return new o.default(s).loadImage(e)}};var r=i(n(2153)),o=i(n(423));function i(e){return e&&e.__esModule?e:{default:e}}},8632:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;class n{constructor(){this.urls=[]}lock(e){return!(this.urls.indexOf(e)>=0)&&(this.urls=[...this.urls,e],!0)}unlock(e){this.urls=this.urls.filter((t=>t!==e))}}t.Component=n,window.ss=window.ss||{},window.ss.imagelocker=window.ss.imagelocker||new n;t.default=window.ss.imagelocker},1838:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={DISABLED:"DISABLED",NONE:"NONE",SUCCESS:"SUCCESS",LOADING:"LOADING",WAITING:"WAITING",FAILED:"FAILED"}},2613:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={DEFINE_IMAGE_SIZE_PRESETS:"DEFINE_IMAGE_SIZE_PRESETS",INIT_FORM_SCHEMA_STACK:"INIT_FORM_SCHEMA_STACK",POP_FORM_SCHEMA:"POP_FORM_SCHEMA",PUSH_FORM_SCHEMA:"PUSH_FORM_SCHEMA",RESET:"RESET",RESET_FORM_STACK:"RESET_FORM_STACK"}},1021:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defineImageSizePresets=function(e){return{type:i.default.DEFINE_IMAGE_SIZE_PRESETS,payload:{imageSizePresets:e}}},t.initFormStack=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return{type:i.default.INIT_FORM_SCHEMA_STACK,payload:{formSchema:{type:e,nextType:t}}}},t.popFormStackEntry=function(){return{type:i.default.POP_FORM_SCHEMA}},t.pushFormStackEntry=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return{type:i.default.PUSH_FORM_SCHEMA,payload:{formSchema:{type:e,nextType:t}}}},t.reset=function(){return{type:i.default.RESET}},t.resetFormStack=function(){return{type:i.default.RESET_FORM_STACK}},t.stashFormValues=function(e,t){return(n,i)=>{const l=i(),a=(0,r.default)(l.form.formState,`${e}.values`),u=(0,r.default)(l.form.formSchemas,`${t}.schema.fields`);if(a){const e=Object.keys(a).filter((e=>null!==a[e]&&(0,s.default)(e,u))).map((e=>({name:e,value:a[e]})));n((0,o.setSchemaStateOverrides)(t,{fields:e}))}}};var r=l(n(6104)),o=n(2811),i=l(n(2613)),s=l(n(8896));function l(e){return e&&e.__esModule?e:{default:e}}},8896:function(e,t){"use strict";function n(e,t){let r;for(r=0;rt({type:o.default.ADD_QUEUED_FILE,payload:{file:e}})},t.failUpload=function(e,t,n){return r=>{let i=t.message;return t.errors&&t.errors.length&&(i=t.errors[0]),"string"==typeof t&&(i={value:n||t,type:"error"}),r({type:o.default.FAIL_UPLOAD,payload:{queuedId:e,message:i}})}},t.purgeUploadQueue=function(){return e=>e({type:o.default.PURGE_UPLOAD_QUEUE,payload:null})},t.removeQueuedFile=function(e){return t=>t({type:o.default.REMOVE_QUEUED_FILE,payload:{queuedId:e}})},t.succeedUpload=function(e,t){return n=>n({type:o.default.SUCCEED_UPLOAD,payload:{queuedId:e,json:t}})},t.updateQueuedFile=function(e,t){return n=>n({type:o.default.UPDATE_QUEUED_FILE,payload:{queuedId:e,updates:t}})};var r,o=(r=n(5793))&&r.__esModule?r:{default:r}},1804:function(e,t,n){"use strict";var r=n(5228),o={};var i=function(e){};function s(e,t,n,r,o,s,l,a){if(i(t),!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var d=[n,r,o,s,l,a],c=0;(u=new Error(t.replace(/%s/g,(function(){return d[c++]})))).name="Invariant Violation"}throw u.framesToPop=1,u}}var l="mixins";e.exports=function(e,t,n){var i=[],a={mixins:"DEFINE_MANY",statics:"DEFINE_MANY",propTypes:"DEFINE_MANY",contextTypes:"DEFINE_MANY",childContextTypes:"DEFINE_MANY",getDefaultProps:"DEFINE_MANY_MERGED",getInitialState:"DEFINE_MANY_MERGED",getChildContext:"DEFINE_MANY_MERGED",render:"DEFINE_ONCE",componentWillMount:"DEFINE_MANY",componentDidMount:"DEFINE_MANY",componentWillReceiveProps:"DEFINE_MANY",shouldComponentUpdate:"DEFINE_ONCE",componentWillUpdate:"DEFINE_MANY",componentDidUpdate:"DEFINE_MANY",componentWillUnmount:"DEFINE_MANY",UNSAFE_componentWillMount:"DEFINE_MANY",UNSAFE_componentWillReceiveProps:"DEFINE_MANY",UNSAFE_componentWillUpdate:"DEFINE_MANY",updateComponent:"OVERRIDE_BASE"},u={getDerivedStateFromProps:"DEFINE_MANY_MERGED"},d={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var n=0;n0}},{key:"getMetadataColumnProperty",value:function(e,t,n){var r=this.getColumnMetadataByName(e);return null==r?n:r.hasOwnProperty(t)?r[t]:n}},{key:"orderColumns",value:function(e){var t=this;return l(e,(function(e){var n=s(t.columnMetadata,{columnName:e});return null==n||isNaN(n.order)?100:n.order}))}},{key:"getColumns",value:function(){var e=0===this.filteredColumns.length?this.allColumns:this.filteredColumns;return e=a(e,this.metadataColumns),e=this.orderColumns(e)}}]),e}();e.exports=u},3715:function(e,t,n){"use strict";var r=n(1594),o=n(2306)({getDefaultProps:function(){return{placeholderText:""}},render:function(){return"function"!=typeof this.props.customFilterComponent?(console.log("Couldn't find valid template."),r.createElement("div",null)):r.createElement(this.props.customFilterComponent,{changeFilter:this.props.changeFilter,results:this.props.results,currentResults:this.props.currentResults,placeholderText:this.props.placeholderText})}});e.exports=o},8465:function(e,t,n){"use strict";var r=Object.assign||function(e){for(var t=1;t0&&(e=r.createElement("button",{type:"button",onClick:this.props.previous,style:this.props.useGriddleStyles?{color:"#222",border:"none",background:"none",margin:"0 0 0 10px"}:null},this.props.previousIconComponent,this.props.previousText)),this.props.currentPage!==this.props.maxPage-1&&(t=r.createElement("button",{type:"button",onClick:this.props.next,style:this.props.useGriddleStyles?{color:"#222",border:"none",background:"none",margin:"0 10px 0 0"}:null},this.props.nextText,this.props.nextIconComponent));var n=null,o=null,s=null;if(!0===this.props.useGriddleStyles){var l={float:"left",minHeight:"1px",marginTop:"5px"};s=i({textAlign:"right",width:"34%"},l),o=i({textAlign:"center",width:"33%"},l),n=i({width:"33%"},l)}for(var a=[],u=1;u<=this.props.maxPage;u++)a.push(r.createElement("option",{value:u,key:u},u));return r.createElement("div",{style:this.props.useGriddleStyles?{minHeight:"35px"}:null},r.createElement("div",{className:this.props.previousClassName,style:n},e),r.createElement("div",{className:"griddle-page",style:o},r.createElement("select",{value:this.props.currentPage+1,onChange:this.pageChange},a)," / ",this.props.maxPage),r.createElement("div",{className:this.props.nextClassName,style:s},t))}});e.exports=s},1507:function(e,t,n){"use strict";var r=n(1594),o=n(2306),i=(n(493),n(9280)),s=n(1882),l=n(7248),a=n(6139),u=n(4684),d=n(8938),c=n(1648),p=o({getDefaultProps:function(){return{isChildRow:!1,showChildren:!1,data:{},columnSettings:null,rowSettings:null,hasChildren:!1,useGriddleStyles:!0,useGriddleIcons:!0,isSubGriddle:!1,paddingHeight:null,rowHeight:null,parentRowCollapsedClassName:"parent-row",parentRowExpandedClassName:"parent-row expanded",parentRowCollapsedComponent:"▶",parentRowExpandedComponent:"▼",onRowClick:null,multipleSelectionSettings:null,onRowMouseEnter:null,onRowMouseLeave:null,onRowWillMount:null,onRowWillUnmount:null}},componentWillMount:function(){null!==this.props.onRowWillMount&&s(this.props.onRowWillMount)&&this.props.onRowWillMount(this)},componentWillUnmount:function(){null!==this.props.onRowWillUnmount&&s(this.props.onRowWillUnmount)&&this.props.onRowWillUnmount(this)},handleClick:function(e){null!==this.props.onRowClick&&s(this.props.onRowClick)?this.props.onRowClick(this,e):this.props.hasChildren&&this.props.toggleChildren()},handleMouseEnter:function(e){null!==this.props.onRowMouseEnter&&s(this.props.onRowMouseEnter)&&this.props.onRowMouseEnter(this,e)},handleMouseLeave:function(e){null!==this.props.onRowMouseLeave&&s(this.props.onRowMouseLeave)&&this.props.onRowMouseLeave(this,e)},handleSelectionChange:function(e){},handleSelectClick:function(e){this.props.multipleSelectionSettings.isMultipleSelection&&("checkbox"===e.target.type?this.props.multipleSelectionSettings.toggleSelectRow(this.props.data,this.refs.selected.checked):this.props.multipleSelectionSettings.toggleSelectRow(this.props.data,!this.refs.selected.checked))},verifyProps:function(){null===this.props.columnSettings&&console.error("gridRow: The columnSettings prop is null and it shouldn't be")},formatData:function(e){return"boolean"==typeof e?String(e):e},render:function(){var e=this;this.verifyProps();var t=this,n=null;this.props.useGriddleStyles&&(n={margin:"0px",padding:t.props.paddingHeight+"px 5px "+t.props.paddingHeight+"px 5px",height:t.props.rowHeight?this.props.rowHeight-2*t.props.paddingHeight+"px":null,backgroundColor:"#FFF",borderTopColor:"#DDD",color:"#222"});var o=this.props.columnSettings.getColumns(),p=l(o,[]),f=a({},this.props.data);u(f,p);var h,m,g=d(i.pick(f,c(o,"children"))).map((function(t,o){var i=null,s=e.props.columnSettings.getColumnMetadataByName(t[0]),l=0===o&&e.props.hasChildren&&!1===e.props.showChildren&&e.props.useGriddleIcons?r.createElement("span",{style:e.props.useGriddleStyles?{fontSize:"10px",marginRight:"5px"}:null},e.props.parentRowCollapsedComponent):0===o&&e.props.hasChildren&&e.props.showChildren&&e.props.useGriddleIcons?r.createElement("span",{style:e.props.useGriddleStyles?{fontSize:"10px"}:null},e.props.parentRowExpandedComponent):"";if(0===o&&e.props.isChildRow&&e.props.useGriddleStyles&&(n=a(n,{paddingLeft:10})),e.props.columnSettings.hasColumnMetadata()&&null!=s)if(void 0!==s.customComponent&&null!==s.customComponent){var u=r.createElement(s.customComponent,{data:t[1],rowData:f,metadata:s});i=r.createElement("td",{onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,onMouseLeave:e.handleMouseLeave,className:s.cssClassName,key:o,style:n},u)}else i=r.createElement("td",{onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,onMouseLeave:e.handleMouseLeave,className:s.cssClassName,key:o,style:n},l,e.formatData(t[1]));return i||r.createElement("td",{onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,onMouseLeave:e.handleMouseLeave,key:o,style:n},l,t[1])}));if(null!==this.props.onRowClick&&s(this.props.onRowClick)?(h=null,m=this.handleSelectClick):this.props.multipleSelectionSettings&&this.props.multipleSelectionSettings.isMultipleSelection?(h=this.handleSelectClick,m=null):(h=null,m=null),g&&this.props.multipleSelectionSettings&&this.props.multipleSelectionSettings.isMultipleSelection){this.props.multipleSelectionSettings.getSelectedRowIds();g.unshift(r.createElement("td",{key:"selection",style:n,className:"griddle-select griddle-select-cell",onClick:m},r.createElement("input",{type:"checkbox",checked:this.props.multipleSelectionSettings.getIsRowChecked(f),onChange:this.handleSelectionChange,ref:"selected"})))}var y=t.props.rowSettings&&t.props.rowSettings.getBodyRowMetadataClass(t.props.data)||"standard-row";return t.props.isChildRow?y="child-row":t.props.hasChildren&&(y=t.props.showChildren?this.props.parentRowExpandedClassName:this.props.parentRowCollapsedClassName),r.createElement("tr",{onClick:h,className:y},g)}});e.exports=p},4734:function(e,t,n){"use strict";var r=n(1594),o=n(2306),i=(n(493),n(4383)),s=o({getDefaultProps:function(){return{useGriddleStyles:!0,useGriddleIcons:!0,isSubGriddle:!1,columnSettings:null,rowSettings:null,paddingHeight:null,rowHeight:null,parentRowCollapsedClassName:"parent-row",parentRowExpandedClassName:"parent-row expanded",parentRowCollapsedComponent:"▶",parentRowExpandedComponent:"▼",onRowClick:null,onRowMouseEnter:null,onRowMouseLeave:null,onRowWillMount:null,onRowWillUnmount:null,multipleSelectionSettings:null}},getInitialState:function(){return{data:{},showChildren:!1}},componentWillReceiveProps:function(){this.setShowChildren(!1)},toggleChildren:function(){this.setShowChildren(!1===this.state.showChildren)},setShowChildren:function(e){this.setState({showChildren:e})},verifyProps:function(){null===this.props.columnSettings&&console.error("gridRowContainer: The columnSettings prop is null and it shouldn't be")},render:function(){this.verifyProps();var e=this;if(void 0===this.props.data)return r.createElement("tbody",null);var t=[],n=this.props.columnSettings.getColumns();t.push(r.createElement(this.props.rowSettings.rowComponent,{useGriddleStyles:this.props.useGriddleStyles,isSubGriddle:this.props.isSubGriddle,data:this.props.rowSettings.isCustom?i(this.props.data,n):this.props.data,rowData:this.props.rowSettings.isCustom?this.props.data:null,columnSettings:this.props.columnSettings,rowSettings:this.props.rowSettings,hasChildren:e.props.hasChildren,toggleChildren:e.toggleChildren,showChildren:e.state.showChildren,key:e.props.uniqueId+"_base_row",useGriddleIcons:e.props.useGriddleIcons,parentRowExpandedClassName:this.props.parentRowExpandedClassName,parentRowCollapsedClassName:this.props.parentRowCollapsedClassName,parentRowExpandedComponent:this.props.parentRowExpandedComponent,parentRowCollapsedComponent:this.props.parentRowCollapsedComponent,paddingHeight:e.props.paddingHeight,rowHeight:e.props.rowHeight,onRowClick:e.props.onRowClick,onRowMouseEnter:e.props.onRowMouseEnter,onRowMouseLeave:e.props.onRowMouseLeave,multipleSelectionSettings:this.props.multipleSelectionSettings,onRowWillMount:e.props.onRowWillMount,onRowWillUnmount:e.props.onRowWillUnmount}));var o=null;return e.state.showChildren&&(o=e.props.hasChildren&&this.props.data.children.map((function(t,n){var o=e.props.rowSettings.getRowKey(t,n);if(void 0!==t.children){var i=e.constructor.Griddle;return r.createElement("tr",{key:o,style:{paddingLeft:5}},r.createElement("td",{colSpan:e.props.columnSettings.getVisibleColumnCount(),className:"griddle-parent",style:e.props.useGriddleStyles?{border:"none",padding:"0 0 0 5px"}:null},r.createElement(i,{rowMetadata:{key:"id"},isSubGriddle:!0,results:[t],columns:e.props.columnSettings.getColumns(),tableClassName:e.props.tableClassName,parentRowExpandedClassName:e.props.parentRowExpandedClassName,parentRowCollapsedClassName:e.props.parentRowCollapsedClassName,showTableHeading:!1,showPager:!1,columnMetadata:e.props.columnSettings.columnMetadata,parentRowExpandedComponent:e.props.parentRowExpandedComponent,parentRowCollapsedComponent:e.props.parentRowCollapsedComponent,paddingHeight:e.props.paddingHeight,rowHeight:e.props.rowHeight})))}return r.createElement(e.props.rowSettings.rowComponent,{useGriddleStyles:e.props.useGriddleStyles,isSubGriddle:e.props.isSubGriddle,data:t,columnSettings:e.props.columnSettings,isChildRow:!0,columnMetadata:e.props.columnSettings.columnMetadata,key:o})}))),!1===e.props.hasChildren?t[0]:r.createElement("tbody",null,e.state.showChildren?t.concat(o):t)}});e.exports=s},4376:function(e,t,n){"use strict";var r=n(1594),o=n(2306),i=n(9859),s=n(1648),l=n(7309),a=o({getDefaultProps:function(){return{columns:[],columnMetadata:[],selectedColumns:[],settingsText:"",maxRowsText:"",resultsPerPage:0,enableToggleCustom:!1,useCustomComponent:!1,useGriddleStyles:!0,toggleCustomComponent:function(){}}},setPageSize:function(e){var t=parseInt(e.target.value,10);this.props.setPageSize(t)},handleChange:function(e){var t=e.target.dataset?e.target.dataset.name:e.target.getAttribute("data-name");!0===e.target.checked&&!1===i(this.props.selectedColumns,t)?(this.props.selectedColumns.push(t),this.props.setColumns(this.props.selectedColumns)):this.props.setColumns(s(this.props.selectedColumns,t))},render:function(){var e=this,t=[];!1===e.props.useCustomComponent&&(t=this.props.columns.map((function(t,n){var o=i(e.props.selectedColumns,t),s=l(e.props.columnMetadata,{columnName:t}),a=t;return void 0!==s&&void 0!==s.displayName&&null!=s.displayName&&(a=s.displayName),void 0!==s&&null!=s&&s.locked?r.createElement("div",{className:"column checkbox"},r.createElement("label",null,r.createElement("input",{type:"checkbox",disabled:!0,name:"check",checked:o,"data-name":t}),a)):void 0!==s&&null!=s&&void 0!==s.visible&&!1===s.visible?null:r.createElement("div",{className:"griddle-column-selection checkbox",key:t,style:e.props.useGriddleStyles?{float:"left",width:"20%"}:null},r.createElement("label",null,r.createElement("input",{type:"checkbox",name:"check",onChange:e.handleChange,checked:o,"data-name":t}),a))})));var n=e.props.enableToggleCustom?r.createElement("div",{className:"form-group"},r.createElement("label",{htmlFor:"maxRows"},r.createElement("input",{type:"checkbox",checked:this.props.useCustomComponent,onChange:this.props.toggleCustomComponent})," ",this.props.enableCustomFormatText)):"",o=this.props.showSetPageSize?r.createElement("div",null,r.createElement("label",{htmlFor:"maxRows"},this.props.maxRowsText,":",r.createElement("select",{onChange:this.setPageSize,value:this.props.resultsPerPage},r.createElement("option",{value:"5"},"5"),r.createElement("option",{value:"10"},"10"),r.createElement("option",{value:"25"},"25"),r.createElement("option",{value:"50"},"50"),r.createElement("option",{value:"100"},"100")))):"";return r.createElement("div",{className:"griddle-settings",style:this.props.useGriddleStyles?{backgroundColor:"#FFF",border:"1px solid #DDD",color:"#222",padding:"10px",marginBottom:"10px"}:null},r.createElement("h6",null,this.props.settingsText),r.createElement("div",{className:"griddle-columns",style:this.props.useGriddleStyles?{clear:"both",display:"table",width:"100%",borderBottom:"1px solid #EDEDED",marginBottom:"10px"}:null},t),o,n)}});e.exports=a},2991:function(e,t,n){"use strict";var r=n(1594),o=n(2306),i=n(9593),s=n(4734),l=(n(493),n(1545),o({getDefaultProps:function(){return{data:[],columnSettings:null,rowSettings:null,sortSettings:null,multipleSelectionSettings:null,className:"",enableInfiniteScroll:!1,nextPage:null,hasMorePages:!1,useFixedHeader:!1,useFixedLayout:!0,paddingHeight:null,rowHeight:null,filterByColumn:null,infiniteScrollLoadTreshold:null,bodyHeight:null,useGriddleStyles:!0,useGriddleIcons:!0,isSubGriddle:!1,parentRowCollapsedClassName:"parent-row",parentRowExpandedClassName:"parent-row expanded",parentRowCollapsedComponent:"▶",parentRowExpandedComponent:"▼",externalLoadingComponent:null,externalIsLoading:!1,onRowClick:null,onRowMouseEnter:null,onRowMouseLeave:null,onRowWillMount:null,onRowWillUnmount:null}},getInitialState:function(){return{scrollTop:0,scrollHeight:this.props.bodyHeight,clientHeight:this.props.bodyHeight}},componentDidMount:function(){this.gridScroll()},componentDidUpdate:function(e,t){this.gridScroll()},gridScroll:function(){if(this.props.enableInfiniteScroll&&!this.props.externalIsLoading){var e=this.refs.scrollable,t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;if(null!==this.props.rowHeight&&this.state.scrollTop!==t&&Math.abs(this.state.scrollTop-t)>=this.getAdjustedRowHeight()){var o={scrollTop:t,scrollHeight:n,clientHeight:r};this.setState(o)}.6*(n-(t+r)-this.props.infiniteScrollLoadTreshold)<=this.props.infiniteScrollLoadTreshold&&this.props.nextPage()}},verifyProps:function(){null===this.props.columnSettings&&console.error("gridTable: The columnSettings prop is null and it shouldn't be"),null===this.props.rowSettings&&console.error("gridTable: The rowSettings prop is null and it shouldn't be")},getAdjustedRowHeight:function(){return this.props.rowHeight+2*this.props.paddingHeight},getNodeContent:function(){this.verifyProps();var e=this,t=!1;if(!this.props.externalIsLoading||this.props.enableInfiniteScroll){var n=e.props.data,o=null,i=null;if(this.props.enableInfiniteScroll&&null!==this.props.rowHeight&&void 0!==this.refs.scrollable){var l=e.getAdjustedRowHeight(),a=Math.ceil(e.state.clientHeight/l),u=Math.max(0,Math.floor(e.state.scrollTop/l)-.25*a),d=Math.min(u+1.25*a,this.props.data.length-1);n=n.slice(u,d+1);var c={height:u*l+"px"};o=r.createElement("tr",{key:"above-"+c.height,style:c});var p={height:(this.props.data.length-d)*l+"px"};i=r.createElement("tr",{key:"below-"+p.height,style:p})}var f=n.map((function(n,o){var i=void 0!==n.children&&n.children.length>0,l=e.props.rowSettings.getRowKey(n,o);return i&&(t=i),r.createElement(s,{useGriddleStyles:e.props.useGriddleStyles,isSubGriddle:e.props.isSubGriddle,parentRowExpandedClassName:e.props.parentRowExpandedClassName,parentRowCollapsedClassName:e.props.parentRowCollapsedClassName,parentRowExpandedComponent:e.props.parentRowExpandedComponent,parentRowCollapsedComponent:e.props.parentRowCollapsedComponent,data:n,key:l+"-container",uniqueId:l,columnSettings:e.props.columnSettings,rowSettings:e.props.rowSettings,paddingHeight:e.props.paddingHeight,multipleSelectionSettings:e.props.multipleSelectionSettings,rowHeight:e.props.rowHeight,hasChildren:i,tableClassName:e.props.className,onRowClick:e.props.onRowClick,onRowMouseEnter:e.props.onRowMouseEnter,onRowMouseLeave:e.props.onRowMouseLeave,onRowWillMount:e.props.onRowWillMount,onRowWillUnmount:e.props.onRowWillUnmount})}));if(this.props.showNoData){var h=this.props.columnSettings.getVisibleColumnCount();f.push(r.createElement("tr",{key:"no-data-section"},r.createElement("td",{colSpan:h},this.props.noDataSection)))}return o&&f.unshift(o),i&&f.push(i),{nodes:f,anyHasChildren:t}}return null},render:function(){var e=[],t=!1,n=this.getNodeContent();n&&(e=n.nodes,t=n.anyHasChildren);var o=null,s=null,l={width:"100%"};if(this.props.useFixedLayout&&(l.tableLayout="fixed"),this.props.enableInfiniteScroll&&(o={position:"relative",overflowY:"scroll",height:this.props.bodyHeight+"px",width:"100%"}),this.props.externalIsLoading){var a,u=null;this.props.useGriddleStyles&&(u={textAlign:"center",paddingBottom:"40px"}),a=this.props.columnSettings.getVisibleColumnCount();var d=this.props.externalLoadingComponent?r.createElement(this.props.externalLoadingComponent,null):r.createElement("div",null,"Loading...");s=r.createElement("tbody",null,r.createElement("tr",null,r.createElement("td",{style:u,colSpan:a},d)))}var c=this.props.showTableHeading?r.createElement(i,{useGriddleStyles:this.props.useGriddleStyles,useGriddleIcons:this.props.useGriddleIcons,sortSettings:this.props.sortSettings,multipleSelectionSettings:this.props.multipleSelectionSettings,columnSettings:this.props.columnSettings,filterByColumn:this.props.filterByColumn,rowSettings:this.props.rowSettings}):void 0;t||(e=r.createElement("tbody",null,e));var p=r.createElement("tbody",null);if(this.props.showPager){var f=this.props.useGriddleStyles?{padding:"0px",backgroundColor:"#EDEDED",border:"0px",color:"#222",height:this.props.showNoData?"20px":null}:null;p=r.createElement("tbody",null,r.createElement("tr",null,r.createElement("td",{colSpan:this.props.multipleSelectionSettings.isMultipleSelection?this.props.columnSettings.getVisibleColumnCount()+1:this.props.columnSettings.getVisibleColumnCount(),style:f,className:"footer-container"},this.props.showNoData?null:this.props.pagingContent)))}return this.props.useFixedHeader?(this.props.useGriddleStyles&&(l.tableLayout="fixed"),r.createElement("div",null,r.createElement("table",{className:this.props.className,style:this.props.useGriddleStyles&&l||null},c),r.createElement("div",{ref:"scrollable",onScroll:this.gridScroll,style:o},r.createElement("table",{className:this.props.className,style:this.props.useGriddleStyles&&l||null},e,s,p)))):r.createElement("div",{ref:"scrollable",onScroll:this.gridScroll,style:o},r.createElement("table",{className:this.props.className,style:this.props.useGriddleStyles&&l||null},c,e,s,p))}}));e.exports=l},9593:function(e,t,n){"use strict";var r=Object.assign||function(e){for(var t=1;t=0)return!0}return!1}))},defaultColumnFilter:function(e,t,n){var r=N(A(n)?n:[n],(function(e){return(e||"").toLowerCase()}));return L(b.getObjectValues(t),(function(e){return e=e.toString().toLowerCase(),L(r,(function(t){return e.indexOf(t)>=0}))}))},filterByColumnFilters:function(e){var t=this.props.columnFilterFunc||this.defaultColumnFilter,n=Object.keys(e).reduce((function(n,r){return R(n,(function(n){var o=b.getAt(n,r||""),i=e[r];return t(r||"",o,i)}))}),this.props.results),r={columnFilters:e};e?(r.filteredResults=n,r.maxPage=this.getMaxPage(r.filteredResults)):this.state.filter?r.filteredResults=this.props.useCustomFilterer?this.props.customFilterer(this.props.results,filter):this.defaultFilter(this.props.results,filter):r.filteredResults=null,this.setState(r)},filterByColumn:function(e,t){var n=this.state.columnFilters;if(n.hasOwnProperty(t)&&!e)n=M(n,t);else{var r={};r[t]=e,n=T({},n,r)}this.filterByColumnFilters(n)},setFilter:function(e){var t=arguments.length<=1||void 0===arguments[1]?null:arguments[1];if(this.props.useExternal)this.props.externalSetFilter(e);else{var n={page:0,filter:e};n.filteredResults=this.props.useCustomFilterer?this.props.customFilterer(t||this.props.results,e):this.defaultFilter(t||this.props.results,e),n.maxPage=this.getMaxPage(n.filteredResults),(D(e)||I(e)||O(e))&&(n.filter=e,n.filteredResults=null),this.setState(n),this._resetSelectedRows()}},setPageSize:function(e){if(this.props.useExternal)return this.setState({resultsPerPage:e}),void this.props.externalSetPageSize(e);this.state.resultsPerPage=e,this.setMaxPage()},toggleColumnChooser:function(){this.setState({showColumnChooser:!this.state.showColumnChooser})},isNullOrUndefined:function(e){return null==e},shouldUseCustomRowComponent:function(){return this.isNullOrUndefined(this.state.useCustomRowComponent)?this.props.useCustomRowComponent:this.state.useCustomRowComponent},shouldUseCustomGridComponent:function(){return this.isNullOrUndefined(this.state.useCustomGridComponent)?this.props.useCustomGridComponent:this.state.useCustomGridComponent},toggleCustomComponent:function(){"grid"===this.state.customComponentType?this.setState({useCustomGridComponent:!this.shouldUseCustomGridComponent()}):"row"===this.state.customComponentType&&this.setState({useCustomRowComponent:!this.shouldUseCustomRowComponent()})},getMaxPage:function(e,t){return this.props.useExternal?this.props.externalMaxPage:(t||(t=(e||this.getCurrentResults()).length),Math.ceil(t/this.state.resultsPerPage))},setMaxPage:function(e){var t=this.getMaxPage(e);this.state.maxPage!==t&&this.setState({page:0,maxPage:t,filteredColumns:this.columnSettings.filteredColumns})},setPage:function(e){if(this.props.useExternal)this.props.externalSetPage(e);else{if(e*this.state.resultsPerPage<=this.state.resultsPerPage*this.state.maxPage){var t={page:e};this.setState(t)}this.props.enableInfiniteScroll&&this.setState({isSelectAllChecked:!1})}},setColumns:function(e){this.columnSettings.filteredColumns=A(e)?e:[e],this.setState({filteredColumns:this.columnSettings.filteredColumns})},nextPage:function(){var e=this.getCurrentPage();e0&&this.setPage(e-1)},changeSort:function(e){if(!1!==this.props.enableSort){if(this.props.useExternal){var t=this.props.externalSortColumn!==e||!this.props.externalSortAscending;return this.setState({sortColumn:e,sortDirection:t?"asc":"desc"}),void this.props.externalChangeSort(e,t)}var n=S(this.props.columnMetadata,{columnName:e})||{},r=n.sortDirectionCycle?n.sortDirectionCycle:[null,"asc","desc"],o=r.indexOf(this.state.sortDirection&&e===this.state.sortColumn?this.state.sortDirection:null),i={page:0,sortColumn:e,sortDirection:r[o=(o+1)%r.length]?r[o]:null};this.setState(i)}},componentWillReceiveProps:function(e){if(e.results!==this.props.results&&this.setFilter(this.state.filter,e.results),this.setMaxPage(e.results),e.resultsPerPage!==this.props.resultsPerPage&&this.setPageSize(e.resultsPerPage),this.columnSettings.columnMetadata=e.columnMetadata,e.results.length>0){var t=b.keys(e.results[0]);this.columnSettings.allColumns.length==t.length&&this.columnSettings.allColumns.every((function(e,n){return e===t[n]}))||(this.columnSettings.allColumns=t)}else this.columnSettings.allColumns.length>0&&(this.columnSettings.allColumns=[]);if(e.selectedRowIds){var n=this.getDataForRender(this.getCurrentResults(e.results),this.columnSettings.getColumns(),!0);this.setState({isSelectAllChecked:this._getAreAllRowsChecked(e.selectedRowIds,N(n,this.props.uniqueIdentifier)),selectedRowIds:e.selectedRowIds})}},getInitialState:function(){return{maxPage:0,page:0,filteredResults:null,filteredColumns:[],filter:"",columnFilters:{},resultsPerPage:this.props.resultsPerPage||5,showColumnChooser:!1,isSelectAllChecked:!1,selectedRowIds:this.props.selectedRowIds}},componentWillMount:function(){this.verifyExternal(),this.verifyCustom(),this.columnSettings=new y(this.props.results.length>0?b.keys(this.props.results[0]):[],this.props.columns,this.props.childrenColumnName,this.props.columnMetadata,this.props.metadataColumns),this.rowSettings=new v(this.props.rowMetadata,this.props.useCustomTableRowComponent&&this.props.customTableRowComponent?this.props.customTableRowComponent:p,this.props.useCustomTableRowComponent),this.props.initialSort&&(this.props.useExternal?this.setState({sortColumn:this.props.externalSortColumn,sortDirection:this.props.externalSortAscending?"asc":"desc"}):this.changeSort(this.props.initialSort)),this.setMaxPage(),this.shouldUseCustomGridComponent()?this.setState({customComponentType:"grid"}):this.shouldUseCustomRowComponent()?this.setState({customComponentType:"row"}):this.setState({filteredColumns:this.columnSettings.filteredColumns})},componentDidMount:function(){if(this.props.componentDidMount&&"function"==typeof this.props.componentDidMount)return this.props.componentDidMount()},componentDidUpdate:function(){if(this.props.componentDidUpdate&&"function"==typeof this.props.componentDidUpdate)return this.props.componentDidUpdate(this.state)},verifyExternal:function(){!0===this.props.useExternal&&(null===this.props.externalSetPage&&console.error("useExternal is set to true but there is no externalSetPage function specified."),null===this.props.externalChangeSort&&console.error("useExternal is set to true but there is no externalChangeSort function specified."),null===this.props.externalSetFilter&&console.error("useExternal is set to true but there is no externalSetFilter function specified."),null===this.props.externalSetPageSize&&console.error("useExternal is set to true but there is no externalSetPageSize function specified."),null===this.props.externalMaxPage&&console.error("useExternal is set to true but externalMaxPage is not set."),null===this.props.externalCurrentPage&&console.error("useExternal is set to true but externalCurrentPage is not set. Griddle will not page correctly without that property when using external data."))},verifyCustom:function(){!0===this.props.useCustomGridComponent&&null===this.props.customGridComponent&&console.error("useCustomGridComponent is set to true but no custom component was specified."),!0===this.props.useCustomRowComponent&&null===this.props.customRowComponent&&console.error("useCustomRowComponent is set to true but no custom component was specified."),!0===this.props.useCustomGridComponent&&!0===this.props.useCustomRowComponent&&console.error("Cannot currently use both customGridComponent and customRowComponent."),!0===this.props.useCustomFilterer&&null===this.props.customFilterer&&console.error("useCustomFilterer is set to true but no custom filter function was specified."),!0===this.props.useCustomFilterComponent&&null===this.props.customFilterComponent&&console.error("useCustomFilterComponent is set to true but no customFilterComponent was specified.")},getDataForRender:function(e,t,n){var r=this,o=this;if(!this.props.useExternal){if(""!==this.state.sortColumn){var i,s=this.state.sortColumn,l=R(this.props.columnMetadata,{columnName:s}),a={columns:[],orders:[]};if(l.length>0&&(i=l[0].hasOwnProperty("customCompareFn")&&l[0].customCompareFn,l[0].multiSort&&(a=l[0].multiSort)),this.state.sortDirection)if("function"==typeof i)2===i.length?(e=e.sort((function(e,t){return i(k(e,s),k(t,s))})),"desc"===this.state.sortDirection&&e.reverse()):1===i.length&&(e=P(e,(function(e){return i(k(e,s))}),[this.state.sortDirection]));else{var u=[function(e){return(k(e,s)||"").toString().toLowerCase()}],d=[this.state.sortDirection];a.columns.forEach((function(e,t){u.push((function(t){return(k(t,e)||"").toString().toLowerCase()})),"asc"===a.orders[t]||"desc"===a.orders[t]?d.push(a.orders[t]):d.push(r.state.sortDirection)})),e=P(e,u,d)}}var c=this.getCurrentPage();if(!this.props.useExternal&&n&&this.state.resultsPerPage*(c+1)<=this.state.resultsPerPage*this.state.maxPage&&c>=0)if(this.isInfiniteScrollEnabled())e=_(e,(c+1)*this.state.resultsPerPage);else{var p=C(e,c*this.state.resultsPerPage);e=(E||x)(p,p.length-this.state.resultsPerPage)}}for(var f=[],h=0;h0&&(m.children=o.getDataForRender(m[o.props.childrenColumnName],t,!1),"children"!==o.props.childrenColumnName&&delete m[o.props.childrenColumnName]),f.push(m)}return f},getCurrentResults:function(e){return this.state.filteredResults||e||this.props.results},getCurrentPage:function(){return this.props.externalCurrentPage||this.state.page},getCurrentSort:function(){return this.props.useExternal?this.props.externalSortColumn:this.state.sortColumn},getCurrentSortAscending:function(){return this.props.useExternal?this.props.externalSortAscending:"asc"===this.state.sortDirection},getCurrentMaxPage:function(){return this.props.useExternal?this.props.externalMaxPage:this.state.maxPage},getSortObject:function(){return{enableSort:this.props.enableSort,changeSort:this.changeSort,sortColumn:this.getCurrentSort(),sortAscending:this.getCurrentSortAscending(),sortDirection:this.state.sortDirection,sortAscendingClassName:this.props.sortAscendingClassName,sortDescendingClassName:this.props.sortDescendingClassName,sortAscendingComponent:this.props.sortAscendingComponent,sortDescendingComponent:this.props.sortDescendingComponent,sortDefaultComponent:this.props.sortDefaultComponent}},_toggleSelectAll:function(){var e=this.getDataForRender(this.getCurrentResults(),this.columnSettings.getColumns(),!0),t=!this.state.isSelectAllChecked,n=JSON.parse(JSON.stringify(this.state.selectedRowIds)),r=this;w(e,(function(e){r._updateSelectedRowIds(e[r.props.uniqueIdentifier],n,t)}),this),this.setState({isSelectAllChecked:t,selectedRowIds:n}),this.props.onSelectionChange&&this.props.onSelectionChange(n,t)},_toggleSelectRow:function(e,t){var n=this.getDataForRender(this.getCurrentResults(),this.columnSettings.getColumns(),!0),r=JSON.parse(JSON.stringify(this.state.selectedRowIds));this._updateSelectedRowIds(e[this.props.uniqueIdentifier],r,t);var o=this._getAreAllRowsChecked(r,N(n,this.props.uniqueIdentifier));this.setState({isSelectAllChecked:o,selectedRowIds:r}),this.props.onSelectionChange&&this.props.onSelectionChange(r,o)},_updateSelectedRowIds:function(e,t,n){n?void 0===S(t,(function(t){return e===t}))&&t.push(e):t.splice(t.indexOf(e),1)},_getIsSelectAllChecked:function(){return this.state.isSelectAllChecked},_getAreAllRowsChecked:function(e,t){return t.length===F(t,e).length},_getIsRowChecked:function(e){return this.state.selectedRowIds.indexOf(e[this.props.uniqueIdentifier])>-1},getSelectedRowIds:function(){return this.state.selectedRowIds},_resetSelectedRows:function(){this.setState({isSelectAllChecked:!1,selectedRowIds:[]})},getMultipleSelectionObject:function(){return{isMultipleSelection:!S(this.props.results,(function(e){return"children"in e}))&&this.props.isMultipleSelection,toggleSelectAll:this._toggleSelectAll,getIsSelectAllChecked:this._getIsSelectAllChecked,toggleSelectRow:this._toggleSelectRow,getSelectedRowIds:this.getSelectedRowIds,getIsRowChecked:this._getIsRowChecked}},isInfiniteScrollEnabled:function(){return!this.props.useCustomPagerComponent&&this.props.enableInfiniteScroll},getClearFixStyles:function(){return{clear:"both",display:"table",width:"100%"}},getSettingsStyles:function(){return{float:"left",width:"50%",textAlign:"right"}},getFilterStyles:function(){return{float:"left",width:"50%",textAlign:"left",color:"#222",minHeight:"1px"}},getFilter:function(){return this.props.showFilter&&!1===this.shouldUseCustomGridComponent()?this.props.useCustomFilterComponent?o.createElement(g,{changeFilter:this.setFilter,placeholderText:this.props.filterPlaceholderText,customFilterComponent:this.props.customFilterComponent,results:this.props.results,currentResults:this.getCurrentResults()}):o.createElement(a,{changeFilter:this.setFilter,placeholderText:this.props.filterPlaceholderText}):""},getSettings:function(){return this.props.showSettings?o.createElement("button",{type:"button",className:this.props.settingsToggleClassName,onClick:this.toggleColumnChooser,style:this.props.useGriddleStyles?{background:"none",border:"none",padding:0,margin:0,fontSize:14}:null},this.props.settingsText,this.props.settingsIconComponent):""},getTopSection:function(e,t){if(!1===this.props.showFilter&&!1===this.props.showSettings)return"";var n=null,r=null,i=null;return this.props.useGriddleStyles&&(n=this.getFilterStyles(),r=this.getSettingsStyles(),i=this.getClearFixStyles()),o.createElement("div",{className:"top-section",style:i},o.createElement("div",{className:"griddle-filter",style:n},e),o.createElement("div",{className:"griddle-settings-toggle",style:r},t))},getPagingSection:function(e,t){if(!1!==(this.props.showPager&&!this.isInfiniteScrollEnabled()&&!this.shouldUseCustomGridComponent()))return o.createElement("div",{className:"griddle-footer"},this.props.useCustomPagerComponent?o.createElement(m,{customPagerComponentOptions:this.props.customPagerComponentOptions,next:this.nextPage,previous:this.previousPage,currentPage:e,maxPage:t,setPage:this.setPage,nextText:this.props.nextText,previousText:this.props.previousText,customPagerComponent:this.props.customPagerComponent}):o.createElement(u,{useGriddleStyles:this.props.useGriddleStyles,next:this.nextPage,previous:this.previousPage,nextClassName:this.props.nextClassName,nextIconComponent:this.props.nextIconComponent,previousClassName:this.props.previousClassName,previousIconComponent:this.props.previousIconComponent,currentPage:e,maxPage:t,setPage:this.setPage,nextText:this.props.nextText,previousText:this.props.previousText}))},getColumnSelectorSection:function(e,t){return this.state.showColumnChooser?o.createElement(d,{columns:e,selectedColumns:t,setColumns:this.setColumns,settingsText:this.props.settingsText,settingsIconComponent:this.props.settingsIconComponent,maxRowsText:this.props.maxRowsText,setPageSize:this.setPageSize,showSetPageSize:!this.shouldUseCustomGridComponent(),resultsPerPage:this.state.resultsPerPage,enableToggleCustom:this.props.enableToggleCustom,toggleCustomComponent:this.toggleCustomComponent,useCustomComponent:this.shouldUseCustomRowComponent()||this.shouldUseCustomGridComponent(),useGriddleStyles:this.props.useGriddleStyles,enableCustomFormatText:this.props.enableCustomFormatText,columnMetadata:this.props.columnMetadata}):""},getCustomGridSection:function(){return o.createElement(this.props.customGridComponent,r({data:this.props.results,className:this.props.customGridComponentClassName},this.props.gridMetadata))},getCustomRowSection:function(e,t,n,r,i){return o.createElement("div",null,o.createElement(h,{data:e,columns:t,metadataColumns:n,globalData:i,className:this.props.customRowComponentClassName,customComponent:this.props.customRowComponent,style:this.props.useGriddleStyles?this.getClearFixStyles():null}),this.props.showPager&&r)},getStandardGridSection:function(e,t,n,r,i){var s=this.getSortObject(),a=this.getMultipleSelectionObject(),u=this.shouldShowNoDataSection(e),d=this.getNoDataSection();return o.createElement("div",{className:"griddle-body"},o.createElement(l,{useGriddleStyles:this.props.useGriddleStyles,noDataSection:d,showNoData:u,columnSettings:this.columnSettings,rowSettings:this.rowSettings,sortSettings:s,multipleSelectionSettings:a,filterByColumn:this.filterByColumn,isSubGriddle:this.props.isSubGriddle,useGriddleIcons:this.props.useGriddleIcons,useFixedLayout:this.props.useFixedLayout,showPager:this.props.showPager,pagingContent:r,data:e,className:this.props.tableClassName,enableInfiniteScroll:this.isInfiniteScrollEnabled(),nextPage:this.nextPage,showTableHeading:this.props.showTableHeading,useFixedHeader:this.props.useFixedHeader,parentRowCollapsedClassName:this.props.parentRowCollapsedClassName,parentRowExpandedClassName:this.props.parentRowExpandedClassName,parentRowCollapsedComponent:this.props.parentRowCollapsedComponent,parentRowExpandedComponent:this.props.parentRowExpandedComponent,bodyHeight:this.props.bodyHeight,paddingHeight:this.props.paddingHeight,rowHeight:this.props.rowHeight,infiniteScrollLoadTreshold:this.props.infiniteScrollLoadTreshold,externalLoadingComponent:this.props.externalLoadingComponent,externalIsLoading:this.props.externalIsLoading,hasMorePages:i,onRowClick:this.props.onRowClick,onRowMouseEnter:this.props.onRowMouseEnter,onRowMouseLeave:this.props.onRowMouseLeave,onRowWillMount:this.props.onRowWillMount,onRowWillUnmount:this.props.onRowWillUnmount}))},getContentSection:function(e,t,n,r,o,i){return this.shouldUseCustomGridComponent()&&null!==this.props.customGridComponent?this.getCustomGridSection():this.shouldUseCustomRowComponent()?this.getCustomRowSection(e,t,n,r,i):this.getStandardGridSection(e,t,n,r,o)},getNoDataSection:function(){return null!=this.props.customNoDataComponent?o.createElement("div",{className:this.props.noDataClassName},o.createElement(this.props.customNoDataComponent,this.props.customNoDataComponentProps)):o.createElement(c,{noDataMessage:this.props.noDataMessage})},shouldShowNoDataSection:function(e){return!this.props.allowEmptyGrid&&(!1===this.props.useExternal&&(void 0===e||0===e.length)||!0===this.props.useExternal&&!1===this.props.externalIsLoading&&0===e.length)},render:function(){var e=this.getCurrentResults(),t=(this.props.tableClassName,this.getFilter()),n=this.getSettings(),r=this.getTopSection(t,n),i=[],s=this.columnSettings.getColumns(),l=this.getDataForRender(e,s,!0),a=this.columnSettings.getMetadataColumns();this.props.columnMetadata?w(this.props.columnMetadata,(function(e){"boolean"==typeof e.visible&&!1===e.visible||i.push(e.columnName)})):i=b.keys(M(e[0],a)),i=this.columnSettings.orderColumns(i);var u=this.getCurrentPage(),d=this.getCurrentMaxPage(),c=u+10?"griddle "+this.props.gridClassName:"griddle";return m+=this.shouldUseCustomRowComponent()?" griddle-custom":"",o.createElement("div",{className:m},r,h,o.createElement("div",{className:"griddle-container",style:this.props.useGriddleStyles&&!this.props.isSubGriddle?{border:"1px solid #DDD"}:null},f))}});f.Griddle=e.exports=j},1545:function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n-1}},9905:function(e){e.exports=function(e,t,n){for(var r=-1,o=null==e?0:e.length;++r=200&&(c=a,p=!1,t=new r(t));e:for(;++d0&&i(d)?n>1?e(d,n-1,i,s,l):r(l,d):s||(l[l.length]=d)}return l}},6649:function(e,t,n){var r=n(3221)();e.exports=r},641:function(e,t,n){var r=n(6649),o=n(5950);e.exports=function(e,t){return e&&r(e,t,o)}},7422:function(e,t,n){var r=n(1769),o=n(7797);e.exports=function(e,t){for(var n=0,i=(t=r(t,e)).length;null!=e&&n=120&&y.length>=120)?new r(f&&y):void 0}y=e[0];var v=-1,b=h[0];e:for(;++vo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(o);++rt||s&&l&&u&&!a&&!d||o&&l&&u||!n&&u||!i)return 1;if(!o&&!s&&!d&&e=a?u:u*("desc"==n[o]?-1:1)}return e.index-t.index}},3007:function(e){e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n1?n[i-1]:void 0,l=i>2?n[2]:void 0;for(s=e.length>3&&"function"==typeof s?(i--,s):void 0,l&&o(n[0],n[1],l)&&(s=i<3?void 0:s,i=1),t=Object(t);++r-1?l[a?t[u]:u]:void 0}}},2963:function(e,t,n){var r=n(1372),o=n(5861),i=n(317),s=n(799);e.exports=function(e){return function(t){var n=o(t);return"[object Map]"==n?i(t):"[object Set]"==n?s(t):r(t,e(t))}}},3138:function(e,t,n){var r=n(1331);e.exports=function(e){return r(e)?void 0:e}},3243:function(e,t,n){var r=n(6110),o=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=o},5911:function(e,t,n){var r=n(8859),o=n(4248),i=n(9219);e.exports=function(e,t,n,s,l,a){var u=1&n,d=e.length,c=t.length;if(d!=c&&!(u&&c>d))return!1;var p=a.get(e),f=a.get(t);if(p&&f)return p==t&&f==e;var h=-1,m=!0,g=2&n?new r:void 0;for(a.set(e,t),a.set(t,e);++h-1&&e%1==0&&e-1}},1175:function(e,t,n){var r=n(6025);e.exports=function(e,t){var n=this.__data__,o=r(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this}},3040:function(e,t,n){var r=n(1549),o=n(79),i=n(8223);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(i||o),string:new r}}},7670:function(e,t,n){var r=n(2651);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},289:function(e,t,n){var r=n(2651);e.exports=function(e){return r(this,e).get(e)}},4509:function(e,t,n){var r=n(2651);e.exports=function(e){return r(this,e).has(e)}},2949:function(e,t,n){var r=n(2651);e.exports=function(e,t){var n=r(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this}},317:function(e){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}},7197:function(e){e.exports=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}},2224:function(e,t,n){var r=n(104);e.exports=function(e){var t=r(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}},1042:function(e,t,n){var r=n(6110)(Object,"create");e.exports=r},3650:function(e,t,n){var r=n(4335)(Object.keys,Object);e.exports=r},181:function(e){e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},6009:function(e,t,n){e=n.nmd(e);var r=n(4840),o=t&&!t.nodeType&&t,i=o&&e&&!e.nodeType&&e,s=i&&i.exports===o&&r.process,l=function(){try{var e=i&&i.require&&i.require("util").types;return e||s&&s.binding&&s.binding("util")}catch(e){}}();e.exports=l},9350:function(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},4335:function(e){e.exports=function(e,t){return function(n){return e(t(n))}}},6757:function(e,t,n){var r=n(1033),o=Math.max;e.exports=function(e,t,n){return t=o(void 0===t?e.length-1:t,0),function(){for(var i=arguments,s=-1,l=o(i.length-t,0),a=Array(l);++s0){if(++n>=800)return arguments[0]}else n=0;return e.apply(void 0,arguments)}}},1420:function(e,t,n){var r=n(79);e.exports=function(){this.__data__=new r,this.size=0}},938:function(e){e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},3605:function(e){e.exports=function(e){return this.__data__.get(e)}},9817:function(e){e.exports=function(e){return this.__data__.has(e)}},945:function(e,t,n){var r=n(79),o=n(8223),i=n(3661);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var s=n.__data__;if(!o||s.length<199)return s.push([e,t]),this.size=++n.size,this;n=this.__data__=new i(s)}return n.set(e,t),this.size=n.size,this}},6959:function(e){e.exports=function(e,t,n){for(var r=n-1,o=e.length;++r2?t[2]:void 0;for(u&&i(t[0],t[1],u)&&(r=1);++n-1:!!d&&r(e,t,n)>-1}},3424:function(e,t,n){var r=n(5160);e.exports=function(e){return(null==e?0:e.length)?r(e,0,-1):[]}},5287:function(e,t,n){var r=n(4932),o=n(7185),i=n(9302),s=n(741),l=i((function(e){var t=r(e,s);return t.length&&t[0]===e[0]?o(t):[]}));e.exports=l},2428:function(e,t,n){var r=n(7534),o=n(346),i=Object.prototype,s=i.hasOwnProperty,l=i.propertyIsEnumerable,a=r(function(){return arguments}())?r:function(e){return o(e)&&s.call(e,"callee")&&!l.call(e,"callee")};e.exports=a},6449:function(e){var t=Array.isArray;e.exports=t},4894:function(e,t,n){var r=n(1882),o=n(294);e.exports=function(e){return null!=e&&o(e.length)&&!r(e)}},3693:function(e,t,n){var r=n(4894),o=n(346);e.exports=function(e){return o(e)&&r(e)}},3656:function(e,t,n){e=n.nmd(e);var r=n(9325),o=n(9935),i=t&&!t.nodeType&&t,s=i&&e&&!e.nodeType&&e,l=s&&s.exports===i?r.Buffer:void 0,a=(l?l.isBuffer:void 0)||o;e.exports=a},2193:function(e,t,n){var r=n(8984),o=n(5861),i=n(2428),s=n(6449),l=n(4894),a=n(3656),u=n(5527),d=n(7167),c=Object.prototype.hasOwnProperty;e.exports=function(e){if(null==e)return!0;if(l(e)&&(s(e)||"string"==typeof e||"function"==typeof e.splice||a(e)||d(e)||i(e)))return!e.length;var t=o(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(u(e))return!r(e).length;for(var n in e)if(c.call(e,n))return!1;return!0}},1882:function(e,t,n){var r=n(2552),o=n(3805);e.exports=function(e){if(!o(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},294:function(e){e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},7730:function(e,t,n){var r=n(9172),o=n(7301),i=n(6009),s=i&&i.isMap,l=s?o(s):r;e.exports=l},5187:function(e){e.exports=function(e){return null===e}},3805:function(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},346:function(e){e.exports=function(e){return null!=e&&"object"==typeof e}},1331:function(e,t,n){var r=n(2552),o=n(8879),i=n(346),s=Function.prototype,l=Object.prototype,a=s.toString,u=l.hasOwnProperty,d=a.call(Object);e.exports=function(e){if(!i(e)||"[object Object]"!=r(e))return!1;var t=o(e);if(null===t)return!0;var n=u.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&a.call(n)==d}},8440:function(e,t,n){var r=n(6038),o=n(7301),i=n(6009),s=i&&i.isSet,l=s?o(s):r;e.exports=l},5015:function(e,t,n){var r=n(2552),o=n(6449),i=n(346);e.exports=function(e){return"string"==typeof e||!o(e)&&i(e)&&"[object String]"==r(e)}},4394:function(e,t,n){var r=n(2552),o=n(346);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},7167:function(e,t,n){var r=n(4901),o=n(7301),i=n(6009),s=i&&i.isTypedArray,l=s?o(s):r;e.exports=l},2216:function(e){e.exports=function(e){return void 0===e}},5950:function(e,t,n){var r=n(695),o=n(8984),i=n(4894);e.exports=function(e){return i(e)?r(e):o(e)}},7241:function(e,t,n){var r=n(695),o=n(2903),i=n(4894);e.exports=function(e){return i(e)?r(e,!0):o(e)}},8090:function(e){e.exports=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}},5378:function(e,t,n){var r=n(4932),o=n(5389),i=n(5128),s=n(6449);e.exports=function(e,t){return(s(e)?r:i)(e,o(t,3))}},104:function(e,t,n){var r=n(3661);function o(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=e.apply(this,r);return n.cache=i.set(o,s)||i,s};return n.cache=new(o.Cache||r),n}o.Cache=r,e.exports=o},179:function(e,t,n){var r=n(4932),o=n(9999),i=n(9931),s=n(1769),l=n(1791),a=n(3138),u=n(8816),d=n(3349),c=u((function(e,t){var n={};if(null==e)return n;var u=!1;t=r(t,(function(t){return t=s(t,e),u||(u=t.length>1),t})),l(e,d(e),n),u&&(n=o(n,7,a));for(var c=t.length;c--;)i(n,t[c]);return n}));e.exports=c},2877:function(e,t,n){var r=n(6155),o=n(6449);e.exports=function(e,t,n,i){return null==e?[]:(o(t)||(t=null==t?[]:[t]),o(n=i?void 0:n)||(n=null==n?[]:[n]),r(e,t,n))}},4383:function(e,t,n){var r=n(6001),o=n(8816)((function(e,t){return null==e?{}:r(e,t)}));e.exports=o},583:function(e,t,n){var r=n(7237),o=n(7255),i=n(8586),s=n(7797);e.exports=function(e){return i(e)?r(s(e)):o(e)}},2426:function(e,t,n){var r=n(4248),o=n(5389),i=n(916),s=n(6449),l=n(6800);e.exports=function(e,t,n){var a=s(e)?r:i;return n&&l(e,t,n)&&(t=void 0),a(e,o(t,3))}},3031:function(e,t,n){var r=n(3120),o=n(6155),i=n(9302),s=n(6800),l=i((function(e,t){if(null==e)return[];var n=t.length;return n>1&&s(e,t[0],t[1])?t=[]:n>2&&s(t[0],t[1],t[2])&&(t=[t[0]]),o(e,r(t,1),[])}));e.exports=l},3345:function(e){e.exports=function(){return[]}},9935:function(e){e.exports=function(){return!1}},4921:function(e,t,n){var r=n(5160),o=n(1489);e.exports=function(e,t,n){return e&&e.length?(t=n||void 0===t?1:o(t),r(e,0,t<0?0:t)):[]}},7400:function(e,t,n){var r=n(9374),o=1/0;e.exports=function(e){return e?(e=r(e))===o||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},1489:function(e,t,n){var r=n(7400);e.exports=function(e){var t=r(e),n=t%1;return t==t?n?t-n:t:0}},9374:function(e,t,n){var r=n(4128),o=n(3805),i=n(4394),s=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,a=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=l.test(e);return n||a.test(e)?u(e.slice(2),n?2:8):s.test(e)?NaN:+e}},8938:function(e,t,n){var r=n(2963)(n(5950));e.exports=r},2072:function(e,t,n){var r=n(4932),o=n(3007),i=n(6449),s=n(4394),l=n(1802),a=n(7797),u=n(3222);e.exports=function(e){return i(e)?r(e,a):s(e)?[e]:o(l(u(e)))}},3222:function(e,t,n){var r=n(7556);e.exports=function(e){return null==e?"":r(e)}},7200:function(e,t,n){var r=n(3222),o=0;e.exports=function(e){var t=++o;return r(e)+t}},5880:function(e,t,n){var r=n(514),o=n(5950);e.exports=function(e){return null==e?[]:r(e,o(e))}},1648:function(e,t,n){var r=n(3915),o=n(9302),i=n(3693),s=o((function(e,t){return i(e)?r(e,t):[]}));e.exports=s},7248:function(e,t,n){var r=n(6547),o=n(1234);e.exports=function(e,t){return o(e||[],t||[],r)}},5228:function(e){"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,o){for(var i,s,l=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),a=1;a1)for(var n=1;n1?t-1:0),r=1;r2?n-2:0),i=2;i1&&void 0!==arguments[1]&&arguments[1],n=this.props,r=n.tolerance,o=n.onSelection,i=n.onEndSelection,s=[],l=(0,d.findDOMNode)(this.refs.selectbox);l&&(this._registry.forEach((function(e){e.domNode&&(0,g.default)(l,e.domNode,r)&&!s.includes(e.key)&&s.push(e.key)})),t?"function"==typeof i&&i(s,e):"function"==typeof o&&o(s,e))}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.enabled,r=e.fixedPosition,o=e.className,i=e.selectingClassName,s=this.state,l=s.isBoxSelecting,a=s.boxLeft,d=s.boxTop,c=s.boxWidth,f=s.boxHeight,h=this.props.component;if(!n)return u.default.createElement(h,{className:o},t);var m={left:a,top:d,width:c,height:f,zIndex:9e3,position:r?"fixed":"absolute",cursor:"default"},g={backgroundColor:"transparent",border:"1px dashed #999",width:"100%",height:"100%",float:"left"},y={position:"relative",overflow:"visible"};return u.default.createElement(h,{className:(0,p.default)(o,l?i:null),style:y},l?u.default.createElement("div",{style:m,ref:"selectbox"},u.default.createElement("span",{style:g})):null,t)}}]),t}(a.Component);v.propTypes={children:c.default.node,onBeginSelection:c.default.func,onEndSelection:c.default.func,onSelection:c.default.func,component:c.default.node,tolerance:c.default.number,fixedPosition:c.default.bool,preventDefault:c.default.bool,onNonItemClick:c.default.func,enabled:c.default.bool,className:c.default.string,selectingClassName:c.default.string},v.defaultProps={component:"div",tolerance:0,fixedPosition:!1,preventDefault:!0,enabled:!0},v.childContextTypes={selectable:c.default.object},t.default=v},function(e,t,n){"use strict";(function(t){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=n(1),i=n(2),s=n(8),l=n(15),a=n(3),u=n(16);e.exports=function(e,n){function d(e){var t=e&&(O&&e[O]||e[I]);if("function"==typeof t)return t}function c(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function p(e){this.message=e,this.stack=""}function f(e){function r(r,u,d,c,f,h,m){if(c=c||D,h=h||d,m!==a)if(n)i(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("production"!==t.env.NODE_ENV&&"undefined"!=typeof console){var g=c+":"+d;!o[g]&&l<3&&(s(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",h,c),o[g]=!0,l++)}return null==u[d]?r?new p(null===u[d]?"The "+f+" `"+h+"` is marked as required in `"+c+"`, but its value is `null`.":"The "+f+" `"+h+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:e(u,d,c,f,h)}if("production"!==t.env.NODE_ENV)var o={},l=0;var u=r.bind(null,!1);return u.isRequired=r.bind(null,!0),u}function h(e){function t(t,n,r,o,i,s){var l=t[n];return w(l)!==e?new p("Invalid "+o+" `"+i+"` of type `"+x(l)+"` supplied to `"+r+"`, expected `"+e+"`."):null}return f(t)}function m(e){function t(t,n,r,o,i){if("function"!=typeof e)return new p("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s))return new p("Invalid "+o+" `"+i+"` of type `"+w(s)+"` supplied to `"+r+"`, expected an array.");for(var l=0;ln+l||t+o-ar+s)};t.default=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=e instanceof HTMLElement?(0,r.default)(e):e,s=t instanceof HTMLElement?(0,r.default)(t):t;return o(i.top,i.left,s.top,s.left,i.offsetWidth,i.offsetHeight,s.offsetWidth,s.offsetHeight,n)}},function(e,t,n){"use strict";(function(t){function n(e,t,n){function r(t){var n=m,r=g;return m=g=void 0,w=t,v=e.apply(r,n)}function i(e){return w=e,b=setTimeout(d,t),x?r(e):v}function s(e){var n=t-(e-C);return F?S(n,y-(e-w)):n}function a(e){var n=e-C;return void 0===C||n>=t||n<0||F&&e-w>=y}function d(){var e=_();if(a(e))return c(e);b=setTimeout(d,s(e))}function c(e){return b=void 0,A&&m?r(e):(m=g=void 0,v)}function p(){void 0!==b&&clearTimeout(b),w=0,m=C=g=b=void 0}function f(){return void 0===b?v:c(_())}function h(){var e=_(),n=a(e);if(m=arguments,g=this,C=e,n){if(void 0===b)return i(C);if(F)return b=setTimeout(d,t),r(C)}return void 0===b&&(b=setTimeout(d,t)),v}var m,g,y,v,b,C,w=0,x=!1,F=!1,A=!0;if("function"!=typeof e)throw new TypeError(u);return t=l(t)||0,o(n)&&(x=!!n.leading,y=(F="maxWait"in n)?E(l(n.maxWait)||0,t):y,A="trailing"in n?!!n.trailing:A),h.cancel=p,h.flush=f,h}function r(e,t,r){var i=!0,s=!0;if("function"!=typeof e)throw new TypeError(u);return o(r)&&(i="leading"in r?!!r.leading:i,s="trailing"in r?!!r.trailing:s),n(e,t,{leading:i,maxWait:t,trailing:s})}function o(e){var t=void 0===e?"undefined":a(e);return!!e&&("object"==t||"function"==t)}function i(e){return!!e&&"object"==(void 0===e?"undefined":a(e))}function s(e){return"symbol"==(void 0===e?"undefined":a(e))||i(e)&&C.call(e)==c}function l(e){if("number"==typeof e)return e;if(s(e))return d;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(p,"");var n=h.test(e);return n||m.test(e)?g(e.slice(2),n?2:8):f.test(e)?d:+e}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u="Expected a function",d=NaN,c="[object Symbol]",p=/^\s+|\s+$/g,f=/^[-+]0x[0-9a-f]+$/i,h=/^0b[01]+$/i,m=/^0o[0-7]+$/i,g=parseInt,y="object"==(void 0===t?"undefined":a(t))&&t&&t.Object===Object&&t,v="object"==("undefined"==typeof self?"undefined":a(self))&&self&&self.Object===Object&&self,b=y||v||Function("return this")(),C=Object.prototype.toString,E=Math.max,S=Math.min,_=function(){return b.Date.now()};e.exports=r}).call(t,n(21))},function(e,t,n){"use strict";var r,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"===("undefined"==typeof window?"undefined":o(window))&&(r=window)}e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function 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)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n
'),this.element.appendChild(e));let t=e.getElementsByTagName("span")[0];return t&&(null!=t.textContent?t.textContent=this.options.dictFallbackMessage:null!=t.innerText&&(t.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize(e,t,n,r){let o={srcX:0,srcY:0,srcWidth:e.width,srcHeight:e.height},i=e.width/e.height;null==t&&null==n?(t=o.srcWidth,n=o.srcHeight):null==t?t=n*i:null==n&&(n=t/i);let s=(t=Math.min(t,o.srcWidth))/(n=Math.min(n,o.srcHeight));if(o.srcWidth>t||o.srcHeight>n)if("crop"===r)i>s?(o.srcHeight=e.height,o.srcWidth=o.srcHeight*s):(o.srcWidth=e.width,o.srcHeight=o.srcWidth/s);else{if("contain"!==r)throw new Error(`Unknown resizeMethod '${r}'`);i>s?n=t/i:t=n*i}return o.srcX=(e.width-o.srcWidth)/2,o.srcY=(e.height-o.srcHeight)/2,o.trgWidth=t,o.trgHeight=n,o},transformFile(e,t){return(this.options.resizeWidth||this.options.resizeHeight)&&e.type.match(/image.*/)?this.resizeImage(e,this.options.resizeWidth,this.options.resizeHeight,this.options.resizeMethod,t):t(e)},previewTemplate:i('
\n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n \n \n \n
\n
\n \n \n \n
\n
\n'),drop(e){return this.element.classList.remove("dz-drag-hover")},dragstart(e){},dragend(e){return this.element.classList.remove("dz-drag-hover")},dragenter(e){return this.element.classList.add("dz-drag-hover")},dragover(e){return this.element.classList.add("dz-drag-hover")},dragleave(e){return this.element.classList.remove("dz-drag-hover")},paste(e){},reset(){return this.element.classList.remove("dz-started")},addedfile(e){if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer&&!this.options.disablePreviews){for(var t of(e.previewElement=a.createElement(this.options.previewTemplate.trim()),e.previewTemplate=e.previewElement,this.previewsContainer.appendChild(e.previewElement),e.previewElement.querySelectorAll("[data-dz-name]")))t.textContent=e.name;for(t of e.previewElement.querySelectorAll("[data-dz-size]"))t.innerHTML=this.filesize(e.size);this.options.addRemoveLinks&&(e._removeLink=a.createElement(`${this.options.dictRemoveFile}`),e.previewElement.appendChild(e._removeLink));let n=t=>(t.preventDefault(),t.stopPropagation(),e.status===a.UPLOADING?a.confirm(this.options.dictCancelUploadConfirmation,(()=>this.removeFile(e))):this.options.dictRemoveFileConfirmation?a.confirm(this.options.dictRemoveFileConfirmation,(()=>this.removeFile(e))):this.removeFile(e));for(let t of e.previewElement.querySelectorAll("[data-dz-remove]"))t.addEventListener("click",n)}},removedfile(e){return null!=e.previewElement&&null!=e.previewElement.parentNode&&e.previewElement.parentNode.removeChild(e.previewElement),this._updateMaxFilesReachedClass()},thumbnail(e,t){if(e.previewElement){e.previewElement.classList.remove("dz-file-preview");for(let n of e.previewElement.querySelectorAll("[data-dz-thumbnail]"))n.alt=e.name,n.src=t;return setTimeout((()=>e.previewElement.classList.add("dz-image-preview")),1)}},error(e,t){if(e.previewElement){e.previewElement.classList.add("dz-error"),"string"!=typeof t&&t.error&&(t=t.error);for(let n of e.previewElement.querySelectorAll("[data-dz-errormessage]"))n.textContent=t}},errormultiple(){},processing(e){if(e.previewElement&&(e.previewElement.classList.add("dz-processing"),e._removeLink))return e._removeLink.innerHTML=this.options.dictCancelUpload},processingmultiple(){},uploadprogress(e,t,n){if(e.previewElement)for(let n of e.previewElement.querySelectorAll("[data-dz-uploadprogress]"))"PROGRESS"===n.nodeName?n.value=t:n.style.width=`${t}%`},totaluploadprogress(){},sending(){},sendingmultiple(){},success(e){if(e.previewElement)return e.previewElement.classList.add("dz-success")},successmultiple(){},canceled(e){return this.emit("error",e,this.options.dictUploadCanceled)},canceledmultiple(){},complete(e){if(e._removeLink&&(e._removeLink.innerHTML=this.options.dictRemoveFile),e.previewElement)return e.previewElement.classList.add("dz-complete")},completemultiple(){},maxfilesexceeded(){},maxfilesreached(){},queuecomplete(){},addedfiles(){}};class a extends s{static initClass(){this.prototype.Emitter=s,this.prototype.events=["drop","dragstart","dragend","dragenter","dragover","dragleave","addedfile","addedfiles","removedfile","thumbnail","error","errormultiple","processing","processingmultiple","uploadprogress","totaluploadprogress","sending","sendingmultiple","success","successmultiple","canceled","canceledmultiple","complete","completemultiple","reset","maxfilesexceeded","maxfilesreached","queuecomplete"],this.prototype._thumbnailQueue=[],this.prototype._processingThumbnail=!1}getAcceptedFiles(){return this.files.filter((e=>e.accepted)).map((e=>e))}getRejectedFiles(){return this.files.filter((e=>!e.accepted)).map((e=>e))}getFilesWithStatus(e){return this.files.filter((t=>t.status===e)).map((e=>e))}getQueuedFiles(){return this.getFilesWithStatus(a.QUEUED)}getUploadingFiles(){return this.getFilesWithStatus(a.UPLOADING)}getAddedFiles(){return this.getFilesWithStatus(a.ADDED)}getActiveFiles(){return this.files.filter((e=>e.status===a.UPLOADING||e.status===a.QUEUED)).map((e=>e))}init(){if("form"===this.element.tagName&&this.element.setAttribute("enctype","multipart/form-data"),this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")&&this.element.appendChild(a.createElement(`
`)),this.clickableElements.length){let e=()=>{this.hiddenFileInput&&this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=document.createElement("input"),this.hiddenFileInput.setAttribute("type","file"),(null===this.options.maxFiles||this.options.maxFiles>1)&&this.hiddenFileInput.setAttribute("multiple","multiple"),this.hiddenFileInput.className="dz-hidden-input",null!==this.options.acceptedFiles&&this.hiddenFileInput.setAttribute("accept",this.options.acceptedFiles),null!==this.options.capture&&this.hiddenFileInput.setAttribute("capture",this.options.capture),this.hiddenFileInput.setAttribute("tabindex","-1"),this.hiddenFileInput.style.visibility="hidden",this.hiddenFileInput.style.position="absolute",this.hiddenFileInput.style.top="0",this.hiddenFileInput.style.left="0",this.hiddenFileInput.style.height="0",this.hiddenFileInput.style.width="0",a.getElement(this.options.hiddenInputContainer,"hiddenInputContainer").appendChild(this.hiddenFileInput),this.hiddenFileInput.addEventListener("change",(()=>{let{files:t}=this.hiddenFileInput;if(t.length)for(let e of t)this.addFile(e);this.emit("addedfiles",t),e()}))};e()}this.URL=null!==window.URL?window.URL:window.webkitURL;for(let e of this.events)this.on(e,this.options[e]);this.on("uploadprogress",(()=>this.updateTotalUploadProgress())),this.on("removedfile",(()=>this.updateTotalUploadProgress())),this.on("canceled",(e=>this.emit("complete",e))),this.on("complete",(e=>{if(0===this.getAddedFiles().length&&0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length)return setTimeout((()=>this.emit("queuecomplete")),0)}));let e=function(e){if(function(e){if(e.dataTransfer.types)for(var t=0;tthis.emit("dragstart",e),dragenter:t=>(e(t),this.emit("dragenter",t)),dragover:t=>{let n;try{n=t.dataTransfer.effectAllowed}catch(e){}return t.dataTransfer.dropEffect="move"===n||"linkMove"===n?"move":"copy",e(t),this.emit("dragover",t)},dragleave:e=>this.emit("dragleave",e),drop:t=>(e(t),this.drop(t)),dragend:e=>this.emit("dragend",e)}}],this.clickableElements.forEach((e=>this.listeners.push({element:e,events:{click:t=>((e!==this.element||t.target===this.element||a.elementInside(t.target,this.element.querySelector(".dz-message")))&&this.hiddenFileInput.click(),!0)}}))),this.enable(),this.options.init.call(this)}destroy(){return this.disable(),this.removeAllFiles(!0),(null!=this.hiddenFileInput?this.hiddenFileInput.parentNode:void 0)&&(this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=null),delete this.element.dropzone,a.instances.splice(a.instances.indexOf(this),1)}updateTotalUploadProgress(){let e,t=0,n=0;if(this.getActiveFiles().length){for(let e of this.getActiveFiles())t+=e.upload.bytesSent,n+=e.upload.total;e=100*t/n}else e=100;return this.emit("totaluploadprogress",e,n,t)}_getParamName(e){return"function"==typeof this.options.paramName?this.options.paramName(e):`${this.options.paramName}${this.options.uploadMultiple?`[${e}]`:""}`}_renameFile(e){return"function"!=typeof this.options.renameFile?e.name:this.options.renameFile(e)}getFallbackForm(){let e,t;if(e=this.getExistingFallback())return e;let n='
';this.options.dictFallbackText&&(n+=`

${this.options.dictFallbackText}

`),n+=`
`;let r=a.createElement(n);return"FORM"!==this.element.tagName?(t=a.createElement(`
`),t.appendChild(r)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),null!=t?t:r}getExistingFallback(){let e=function(e){for(let t of e)if(/(^| )fallback($| )/.test(t.className))return t};for(let n of["div","form"]){var t;if(t=e(this.element.getElementsByTagName(n)))return t}}setupEventListeners(){return this.listeners.map((e=>(()=>{let t=[];for(let n in e.events){let r=e.events[n];t.push(e.element.addEventListener(n,r,!1))}return t})()))}removeEventListeners(){return this.listeners.map((e=>(()=>{let t=[];for(let n in e.events){let r=e.events[n];t.push(e.element.removeEventListener(n,r,!1))}return t})()))}disable(){return this.clickableElements.forEach((e=>e.classList.remove("dz-clickable"))),this.removeEventListeners(),this.disabled=!0,this.files.map((e=>this.cancelUpload(e)))}enable(){return delete this.disabled,this.clickableElements.forEach((e=>e.classList.add("dz-clickable"))),this.setupEventListeners()}filesize(e){let t=0,n="b";if(e>0){let r=["tb","gb","mb","kb","b"];for(let o=0;o=Math.pow(this.options.filesizeBase,4-o)/10){t=e/Math.pow(this.options.filesizeBase,4-o),n=i;break}}t=Math.round(10*t)/10}return`${t} ${this.options.dictFileSizeUnits[n]}`}_updateMaxFilesReachedClass(){return null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")}drop(e){if(!e.dataTransfer)return;this.emit("drop",e);let t=[];for(let n=0;ne.items,null!=t?n(t):void 0))return;var t,n;this.emit("paste",e);let{items:r}=e.clipboardData;return r.length?this._addFilesFromItems(r):void 0}handleFiles(e){for(let t of e)this.addFile(t)}_addFilesFromItems(e){return(()=>{let t=[];for(let r of e){var n;null!=r.webkitGetAsEntry&&(n=r.webkitGetAsEntry())?n.isFile?t.push(this.addFile(r.getAsFile())):n.isDirectory?t.push(this._addFilesFromDirectory(n,n.name)):t.push(void 0):null!=r.getAsFile&&(null==r.kind||"file"===r.kind)?t.push(this.addFile(r.getAsFile())):t.push(void 0)}return t})()}_addFilesFromDirectory(e,t){let n=e.createReader(),r=e=>{return t=console,n="log",r=t=>t.log(e),null!=t&&"function"==typeof t[n]?r(t,n):void 0;var t,n,r};var o=()=>n.readEntries((e=>{if(e.length>0){for(let n of e)n.isFile?n.file((e=>{if(!this.options.ignoreHiddenFiles||"."!==e.name.substring(0,1))return e.fullPath=`${t}/${e.name}`,this.addFile(e)})):n.isDirectory&&this._addFilesFromDirectory(n,`${t}/${n.name}`);o()}return null}),r);return o()}accept(e,t){this.options.maxFilesize&&e.size>1048576*this.options.maxFilesize?t(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(e.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):a.isValidFile(e,this.options.acceptedFiles)?null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(t(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",e)):this.options.accept.call(this,e,t):t(this.options.dictInvalidFileType)}addFile(e){e.upload={uuid:a.uuidv4(),progress:0,total:e.size,bytesSent:0,filename:this._renameFile(e)},this.files.push(e),e.status=a.ADDED,this.emit("addedfile",e),this._enqueueThumbnail(e),this.accept(e,(t=>{t?(e.accepted=!1,this._errorProcessing([e],t)):(e.accepted=!0,this.options.autoQueue&&this.enqueueFile(e)),this._updateMaxFilesReachedClass()}))}enqueueFiles(e){for(let t of e)this.enqueueFile(t);return null}enqueueFile(e){if(e.status!==a.ADDED||!0!==e.accepted)throw new Error("This file can't be queued because it has already been processed or was rejected.");if(e.status=a.QUEUED,this.options.autoProcessQueue)return setTimeout((()=>this.processQueue()),0)}_enqueueThumbnail(e){if(this.options.createImageThumbnails&&e.type.match(/image.*/)&&e.size<=1048576*this.options.maxThumbnailFilesize)return this._thumbnailQueue.push(e),setTimeout((()=>this._processThumbnailQueue()),0)}_processThumbnailQueue(){if(this._processingThumbnail||0===this._thumbnailQueue.length)return;this._processingThumbnail=!0;let e=this._thumbnailQueue.shift();return this.createThumbnail(e,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,!0,(t=>(this.emit("thumbnail",e,t),this._processingThumbnail=!1,this._processThumbnailQueue())))}removeFile(e){if(e.status===a.UPLOADING&&this.cancelUpload(e),this.files=u(this.files,e),this.emit("removedfile",e),0===this.files.length)return this.emit("reset")}removeAllFiles(e){null==e&&(e=!1);for(let t of this.files.slice())(t.status!==a.UPLOADING||e)&&this.removeFile(t);return null}resizeImage(e,t,n,r,o){return this.createThumbnail(e,t,n,r,!0,((t,n)=>{if(null==n)return o(e);{let{resizeMimeType:t}=this.options;null==t&&(t=e.type);let r=n.toDataURL(t,this.options.resizeQuality);return"image/jpeg"!==t&&"image/jpg"!==t||(r=p.restore(e.dataURL,r)),o(a.dataURItoBlob(r))}}))}createThumbnail(e,t,n,r,o,i){let s=new FileReader;s.onload=()=>{e.dataURL=s.result,"image/svg+xml"!==e.type?this.createThumbnailFromUrl(e,t,n,r,o,i):null!=i&&i(s.result)},s.readAsDataURL(e)}displayExistingFile(e,t,n,r,o=!0){if(this.emit("addedfile",e),this.emit("complete",e),o){let o=t=>{this.emit("thumbnail",e,t),n&&n()};e.dataURL=t,this.createThumbnailFromUrl(e,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,this.options.fixOrientation,o,r)}else this.emit("thumbnail",e,t),n&&n()}createThumbnailFromUrl(e,t,n,r,o,i,s){let l=document.createElement("img");return s&&(l.crossOrigin=s),o="from-image"!=getComputedStyle(document.body).imageOrientation&&o,l.onload=()=>{let s=e=>e(1);return"undefined"!=typeof EXIF&&null!==EXIF&&o&&(s=e=>EXIF.getData(l,(function(){return e(EXIF.getTag(this,"Orientation"))}))),s((o=>{e.width=l.width,e.height=l.height;let s=this.options.resize.call(this,e,t,n,r),a=document.createElement("canvas"),u=a.getContext("2d");switch(a.width=s.trgWidth,a.height=s.trgHeight,o>4&&(a.width=s.trgHeight,a.height=s.trgWidth),o){case 2:u.translate(a.width,0),u.scale(-1,1);break;case 3:u.translate(a.width,a.height),u.rotate(Math.PI);break;case 4:u.translate(0,a.height),u.scale(1,-1);break;case 5:u.rotate(.5*Math.PI),u.scale(1,-1);break;case 6:u.rotate(.5*Math.PI),u.translate(0,-a.width);break;case 7:u.rotate(.5*Math.PI),u.translate(a.height,-a.width),u.scale(-1,1);break;case 8:u.rotate(-.5*Math.PI),u.translate(-a.height,0)}c(u,l,null!=s.srcX?s.srcX:0,null!=s.srcY?s.srcY:0,s.srcWidth,s.srcHeight,null!=s.trgX?s.trgX:0,null!=s.trgY?s.trgY:0,s.trgWidth,s.trgHeight);let d=a.toDataURL("image/png");if(null!=i)return i(d,a)}))},null!=i&&(l.onerror=i),l.src=e.dataURL}processQueue(){let{parallelUploads:e}=this.options,t=this.getUploadingFiles().length,n=t;if(t>=e)return;let r=this.getQueuedFiles();if(r.length>0){if(this.options.uploadMultiple)return this.processFiles(r.slice(0,e-t));for(;nt.xhr===e)).map((e=>e))}cancelUpload(e){if(e.status===a.UPLOADING){let t=this._getFilesWithXhr(e.xhr);for(let e of t)e.status=a.CANCELED;void 0!==e.xhr&&e.xhr.abort();for(let e of t)this.emit("canceled",e);this.options.uploadMultiple&&this.emit("canceledmultiple",t)}else e.status!==a.ADDED&&e.status!==a.QUEUED||(e.status=a.CANCELED,this.emit("canceled",e),this.options.uploadMultiple&&this.emit("canceledmultiple",[e]));if(this.options.autoProcessQueue)return this.processQueue()}resolveOption(e,...t){return"function"==typeof e?e.apply(this,t):e}uploadFile(e){return this.uploadFiles([e])}uploadFiles(e){this._transformFiles(e,(t=>{if(this.options.chunking){let n=t[0];e[0].upload.chunked=this.options.chunking&&(this.options.forceChunking||n.size>this.options.chunkSize),e[0].upload.totalChunkCount=Math.ceil(n.size/this.options.chunkSize)}if(e[0].upload.chunked){let n=e[0],r=t[0],o=0;n.upload.chunks=[];let i=()=>{let t=0;for(;void 0!==n.upload.chunks[t];)t++;if(t>=n.upload.totalChunkCount)return;o++;let i=t*this.options.chunkSize,s=Math.min(i+this.options.chunkSize,r.size),l={name:this._getParamName(0),data:r.webkitSlice?r.webkitSlice(i,s):r.slice(i,s),filename:n.upload.filename,chunkIndex:t};n.upload.chunks[t]={file:n,index:t,dataBlock:l,status:a.UPLOADING,progress:0,retries:0},this._uploadData(e,[l])};if(n.upload.finishedChunkUpload=(t,r)=>{let o=!0;t.status=a.SUCCESS,t.dataBlock=null,t.response=t.xhr.responseText,t.responseHeaders=t.xhr.getAllResponseHeaders(),t.xhr=null;for(let e=0;e{this._finished(e,r,null)}))},this.options.parallelChunkUploads)for(let e=0;e{this._finishedUploading(e,n,t)},n.ontimeout=()=>{this._handleUploadError(e,n,`Request timedout after ${this.options.timeout/1e3} seconds`)},n.onerror=()=>{this._handleUploadError(e,n)},(null!=n.upload?n.upload:n).onprogress=t=>this._updateFilesUploadProgress(e,n,t);let s=this.options.defaultHeaders?{Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"}:{};this.options.binaryBody&&(s["Content-Type"]=e[0].type),this.options.headers&&r(s,this.options.headers);for(let e in s){let t=s[e];t&&n.setRequestHeader(e,t)}if(this.options.binaryBody){for(let t of e)this.emit("sending",t,n);this.options.uploadMultiple&&this.emit("sendingmultiple",e,n),this.submitRequest(n,null,e)}else{let r=new FormData;if(this.options.params){let t=this.options.params;"function"==typeof t&&(t=t.call(this,e,n,e[0].upload.chunked?this._getChunk(e[0],n):null));for(let e in t){let n=t[e];if(Array.isArray(n))for(let t=0;t{n[o]=i,++r===e.length&&t(n)}))}_addFormElementData(e){if("FORM"===this.element.tagName)for(let t of this.element.querySelectorAll("input, textarea, select, button")){let n=t.getAttribute("name"),r=t.getAttribute("type");if(r&&(r=r.toLowerCase()),null!=n)if("SELECT"===t.tagName&&t.hasAttribute("multiple"))for(let r of t.options)r.selected&&e.append(n,r.value);else(!r||"checkbox"!==r&&"radio"!==r||t.checked)&&e.append(n,t.value)}}_updateFilesUploadProgress(e,t,n){if(e[0].upload.chunked){let r=e[0],o=this._getChunk(r,t);n?(o.progress=100*n.loaded/n.total,o.total=n.total,o.bytesSent=n.loaded):(o.progress=100,o.bytesSent=o.total),r.upload.progress=0,r.upload.total=0,r.upload.bytesSent=0;for(let e=0;ethis.options.renameFilename.call(this,e.name,e)),"string"==typeof this.options.method&&(this.options.method=this.options.method.toUpperCase()),(n=this.getExistingFallback())&&n.parentNode&&n.parentNode.removeChild(n),!1!==this.options.previewsContainer&&(this.options.previewsContainer?this.previewsContainer=a.getElement(this.options.previewsContainer,"previewsContainer"):this.previewsContainer=this.element),this.options.clickable&&(!0===this.options.clickable?this.clickableElements=[this.element]:this.clickableElements=a.getElements(this.options.clickable,"clickable")),this.init()}}a.initClass(),a.options={},a.optionsForElement=function(e){return e.getAttribute("id")?a.options[d(e.getAttribute("id"))]:void 0},a.instances=[],a.forElement=function(e){if("string"==typeof e&&(e=document.querySelector(e)),null==(null!=e?e.dropzone:void 0))throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");return e.dropzone},a.discover=function(){let e;if(document.querySelectorAll)e=document.querySelectorAll(".dropzone");else{e=[];let t=t=>(()=>{let n=[];for(let r of t)/(^| )dropzone($| )/.test(r.className)?n.push(e.push(r)):n.push(void 0);return n})();t(document.getElementsByTagName("div")),t(document.getElementsByTagName("form"))}return(()=>{let t=[];for(let n of e)!1!==a.optionsForElement(n)?t.push(new a(n)):t.push(void 0);return t})()},a.blockedBrowsers=[/opera.*(Macintosh|Windows Phone).*version\/12/i],a.isBrowserSupported=function(){let e=!0;if(window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if("classList"in document.createElement("a")){void 0!==a.blacklistedBrowsers&&(a.blockedBrowsers=a.blacklistedBrowsers);for(let t of a.blockedBrowsers)if(t.test(navigator.userAgent)){e=!1;continue}}else e=!1;else e=!1;return e},a.dataURItoBlob=function(e){let t=atob(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],r=new ArrayBuffer(t.length),o=new Uint8Array(r);for(let e=0,n=t.length,r=0<=n;r?e<=n:e>=n;r?e++:e--)o[e]=t.charCodeAt(e);return new Blob([r],{type:n})};const u=(e,t)=>e.filter((e=>e!==t)).map((e=>e)),d=e=>e.replace(/[\-_](\w)/g,(e=>e.charAt(1).toUpperCase()));a.createElement=function(e){let t=document.createElement("div");return t.innerHTML=e,t.childNodes[0]},a.elementInside=function(e,t){if(e===t)return!0;for(;e=e.parentNode;)if(e===t)return!0;return!1},a.getElement=function(e,t){let n;if("string"==typeof e?n=document.querySelector(e):null!=e.nodeType&&(n=e),null==n)throw new Error(`Invalid \`${t}\` option provided. Please provide a CSS selector or a plain HTML element.`);return n},a.getElements=function(e,t){let n,r;if(e instanceof Array){r=[];try{for(n of e)r.push(this.getElement(n,t))}catch(e){r=null}}else if("string"==typeof e)for(n of(r=[],document.querySelectorAll(e)))r.push(n);else null!=e.nodeType&&(r=[e]);if(null==r||!r.length)throw new Error(`Invalid \`${t}\` option provided. Please provide a CSS selector, a plain HTML element or a list of those.`);return r},a.confirm=function(e,t,n){return window.confirm(e)?t():null!=n?n():void 0},a.isValidFile=function(e,t){if(!t)return!0;t=t.split(",");let n=e.type,r=n.replace(/\/.*$/,"");for(let o of t)if(o=o.trim(),"."===o.charAt(0)){if(-1!==e.name.toLowerCase().indexOf(o.toLowerCase(),e.name.length-o.length))return!0}else if(/\/\*$/.test(o)){if(r===o.replace(/\/.*$/,""))return!0}else if(n===o)return!0;return!1},"undefined"!=typeof jQuery&&null!==jQuery&&(jQuery.fn.dropzone=function(e){return this.each((function(){return new a(this,e)}))}),a.ADDED="added",a.QUEUED="queued",a.ACCEPTED=a.QUEUED,a.UPLOADING="uploading",a.PROCESSING=a.UPLOADING,a.CANCELED="canceled",a.ERROR="error",a.SUCCESS="success";var c=function(e,t,n,r,o,i,s,l,a,u){let d=function(e){e.naturalWidth;let t=e.naturalHeight,n=document.createElement("canvas");n.width=1,n.height=t;let r=n.getContext("2d");r.drawImage(e,0,0);let{data:o}=r.getImageData(1,0,1,t),i=0,s=t,l=t;for(;l>i;)0===o[4*(l-1)+3]?s=l:i=l,l=s+i>>1;let a=l/t;return 0===a?1:a}(t);return e.drawImage(t,n,r,o,i,s,l,a,u/d)};class p{static initClass(){this.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}static encode64(e){let t,n,r,o,i,s="",l="",a="",u=0;for(;t=e[u++],n=e[u++],l=e[u++],r=t>>2,o=(3&t)<<4|n>>4,i=(15&n)<<2|l>>6,a=63&l,isNaN(n)?i=a=64:isNaN(l)&&(a=64),s=s+this.KEY_STR.charAt(r)+this.KEY_STR.charAt(o)+this.KEY_STR.charAt(i)+this.KEY_STR.charAt(a),t=n=l="",r=o=i=a="",ue.length)break}return n}static decode64(e){let t,n,r,o,i,s="",l="",a=0,u=[];for(/[^A-Za-z0-9\+\/\=]/g.exec(e)&&console.warn("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\nExpect errors in decoding."),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");r=this.KEY_STR.indexOf(e.charAt(a++)),o=this.KEY_STR.indexOf(e.charAt(a++)),i=this.KEY_STR.indexOf(e.charAt(a++)),l=this.KEY_STR.indexOf(e.charAt(a++)),t=r<<2|o>>4,n=(15&o)<<4|i>>2,s=(3&i)<<6|l,u.push(t),64!==i&&u.push(n),64!==l&&u.push(s),t=n=s="",r=o=i=l="",a{const n={init(n){const r=t.default._t("AssetAdmin.INSERT_FROM_FILES","Insert from Files"),o=t.default._t("AssetAdmin.EDIT_IMAGE","Edit image"),i=t.default._t("AssetAdmin.DELETE_IMAGE","Delete image"),s=t.default._t("AssetAdmin.FILE","File");n.addCommand("ssmedia",(()=>{(0,e.default)(`#${n.id}`).entwine("ss").openMediaDialog()})),n.addCommand("ssmedia-delete",(()=>{const e=n.selection.getNode();n.dom.is(e,h)?e.remove():console.error({error:"Unexpected selection - expected image",selectedNode:e})})),n.ui.registry.addButton("ssmedia",{tooltip:r,icon:"image",onAction:()=>n.execCommand("ssmedia"),stateSelector:h}),n.ui.registry.addMenuItem("ssmedia",{text:s,icon:"image",onAction:()=>n.execCommand("ssmedia")}),n.ui.registry.addButton("ssmediaedit",{tooltip:o,icon:"edit-block",onAction:()=>n.execCommand("ssmedia")}),n.ui.registry.addButton("ssmediadelete",{tooltip:i,icon:"remove",onAction:()=>n.execCommand("ssmedia-delete")});const a=n.getParam("image_size_presets");let d=[];return a&&(d=(0,u.imageSizePresetButtons)(n,a)),n.ui.registry.addContextToolbar("ssmedia",{predicate:e=>n.dom.is(e,h),position:"node",scope:"node",items:`${d.join(" ")} | ssmediaedit ssmediadelete`}),n.on("BeforeExecCommand",(e=>{const t=e.command,r=e.ui,o=e.value;"mceEditImage"!==t&&"mceImage"!==t||(e.preventDefault(),n.execCommand("ssmedia",r,o))})),n.on("GetContent",(t=>{const n=(0,e.default)(`
${t.content}
`);n.find(h).add(n.filter(h)).each((function(){const t=(0,e.default)(this),n={src:t.attr("src"),id:t.data("id"),width:t.attr("width"),height:t.attr("height"),class:t.attr("class"),title:t.attr("title"),alt:t.attr("alt"),loading:t.data("loading")},r=l.default.serialise({name:"image",properties:(0,l.sanitiseShortCodeProperties)(n),wrapped:!1});t.replaceWith(r)})),t.content="",n.each((function(){void 0!==this.innerHTML&&(t.content+=this.innerHTML)}))})),n.on("BeforeSetContent",(t=>{let n=t.content,r=l.default.match("image",!1,n);for(;r;){const t=r.properties,o=(0,e.default)("").attr(Object.assign({},t,{id:void 0,"data-id":t.id,"data-shortcode":"image","data-loading":t.loading})).addClass("ss-htmleditorfield-file image");n=n.replace(r.original,(0,e.default)("
").append(o).html()),r=l.default.match("image",!1,n)}t.content=n})),{getMetadata(){return{name:"Silverstripe Media",url:"https://docs.silverstripe.org/en/4/developer_guides/forms/field_types/htmleditorfield"}}}}};tinymce.PluginManager.add("ssmedia",(e=>n.init(e)))})(),e.default.entwine("ss",(t=>{t(".js-injector-boot #insert-media-react__dialog-wrapper").entwine({Element:null,Data:{},ReactRoot:null,onunmatch(){this._clearModal()},_clearModal(){const e=this.getReactRoot();e&&(e.unmount(),this.setReactRoot(null))},open(){const{dispatch:e}=i.default.reducer.store;e(a.initFormStack("insert-media","admin"));const t=tinymce.activeEditor.getParam("image_size_presets");e(a.defineImageSizePresets(t)),this._renderModal(!0)},close(){const{dispatch:e}=i.default.reducer.store;e(a.reset()),this._renderModal(!1)},_renderModal(e){var t=this;const{url:n,...i}=this.getOriginalAttributes(),s=i.hasOwnProperty("ID")&&null!==i.ID,l=this.getFolderId(),a=this.getElement().getEditor(),u=a.getInstance().selection,d=a.getSelection(),c=u.getNode().tagName,p="A"!==c&&("IMG"===c||""===d.trim());let h=this.getReactRoot();h||(h=(0,o.createRoot)(this[0])),h.render(r.default.createElement(f,{title:!1,isOpen:e,folderId:l,onInsert:function(){return t._handleInsert(...arguments)},onClosed:()=>this.close(),bodyClassName:"modal__dialog",className:"insert-media-react__dialog-wrapper",requireLinkText:p,fileAttributes:i,fileSelected:s})),this.setReactRoot(h)},_handleInsert(e,t){let n=!1;this.setData(Object.assign({},e,t));try{let e=null;if(e=t?t.category:"image","image"===e)n=this.insertImage();else n=this.insertFile()}catch(e){this.statusMessage(e,"bad")}return n&&this.close(),Promise.resolve()},getFolderId(){const e=this.getElement();if(!e)return null;const t=Number(e.data("config").upload_folder_id);return isNaN(t)?null:t},getOriginalAttributes(){const e=this.getElement();if(!e)return{};const n=e.getEditor().getSelectedNode();if(!n)return{};const r=t(n),o=(r.attr("href")||"").split("#");if(o[0]){const e=l.default.match("file_link",!1,o[0]);if(e)return{ID:e.properties.id?parseInt(e.properties.id,10):0,Anchor:o[1]||"",Description:r.attr("title"),TargetBlank:!!r.attr("target")}}const i=r.parent(".captionImage").find(".caption"),s={url:r.attr("src"),AltText:r.attr("alt"),Width:r.attr("width"),Height:r.attr("height"),Loading:r.attr("data-loading"),TitleTooltip:r.attr("title"),Alignment:this.findPosition(r.attr("class")),Caption:i.text(),ID:r.attr("data-id")};return["Width","Height","ID"].forEach((e=>{s[e]="string"==typeof s[e]?parseInt(s[e],10):null})),s},findPosition(e){if("string"!=typeof e)return"";const t=e.split(" ");return["leftAlone","center","rightAlone","left","right"].find((e=>t.indexOf(e)>-1))},getAttributes(){const e=this.getData();return{src:e.url,alt:e.AltText,width:e.Width,height:e.Height,title:e.TitleTooltip,class:e.Alignment,"data-id":e.ID,"data-shortcode":"image","data-loading":e.Loading}},getExtraData(){const e=this.getData();return{CaptionText:e&&e.Caption}},insertFile(){const e=this.getData(),n=this.getElement().getEditor(),r=t(n.getSelectedNode()),o=l.default.serialise({name:"file_link",properties:{id:e.ID}},!0);let i=n.getSelection()||e.Text||e.filename;r.is("a")&&r.html()&&(i="");const s={href:o,target:e.TargetBlank?"_blank":"",title:e.Description};if(r.is("img")){i=e.Text||e.filename;const o=t("").attr(s).text(i);r.replaceWith(o),n.addUndo(),n.repaint()}else this.insertLinkInEditor(s,i);return!0},insertImage(){const e=this.getElement();if(!e)return!1;const n=e.getEditor();if(!n)return!1;const r=t(n.getSelectedNode()),o=this.getAttributes(),i=this.getExtraData();let s=r&&r.is("img,a")?r:null;s&&s.parent().is(".captionImage")&&(s=s.parent());const l=r&&r.is("img")?r:t("");l.attr(o).addClass("ss-htmleditorfield-file image");let a=l.parent(".captionImage"),u=a.find(".caption");i.CaptionText?(a.length||(a=t("
")),a.attr("class",`captionImage ${o.class}`).removeAttr("data-mce-style").width(o.width),u.length||(u=t('

').appendTo(a)),u.attr("class",`caption ${o.class}`).text(i.CaptionText)):(a=null,u=null);const d=a||l;return s&&s.not(d).length&&s.replaceWith(d),a&&a.prepend(l),s||(n.repaint(),n.insertContent(t("
").append(d).html(),{skip_undo:1})),n.addUndo(),n.repaint(),!0},statusMessage(n,r){const o=t("
").text(n).html();e.default.noticeAdd({text:o,type:r,stayTime:5e3,inEffect:{left:"0",opacity:"show"}})}})}))}()}(); \ No newline at end of file +!function(){var e={853:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=u(n(5815)),i=u(n(3724)),s=u(n(1669)),l=n(5716),a=u(n(6935));function u(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}let c=0;class p extends r.Component{constructor(e){super(e),this.dropzone=null,this.dragging=!1,this.handleAccept=this.handleAccept.bind(this),this.handleAddedFile=this.handleAddedFile.bind(this),this.handleDragEnter=this.handleDragEnter.bind(this),this.handleDragLeave=this.handleDragLeave.bind(this),this.handleDrop=this.handleDrop.bind(this),this.handleUploadProgress=this.handleUploadProgress.bind(this),this.handleUploadComplete=this.handleUploadComplete.bind(this),this.handleError=this.handleError.bind(this),this.handleSending=this.handleSending.bind(this),this.handleSuccess=this.handleSuccess.bind(this),this.handleQueueComplete=this.handleQueueComplete.bind(this),this.loadImage=this.loadImage.bind(this),this.handleMaxFilesExceeded=this.handleMaxFilesExceeded.bind(this)}componentDidMount(){this.dropzone=new i.default(this.dropzoneRef,Object.assign({},this.getDefaultOptions(),this.props.options));const{name:e}=this.props;e&&this.dropzone.hiddenFileInput&&this.dropzone.hiddenFileInput.classList.add(`dz-input-${e}`),void 0!==this.props.promptOnRemove&&this.setPromptOnRemove(this.props.promptOnRemove)}componentDidUpdate(e){const{name:t}=this.props;t&&this.dropzone.hiddenFileInput&&this.dropzone.hiddenFileInput.classList.add(`dz-input-${t}`),this.props.canUpload&&e.options!==this.props.options&&this.dropzone&&(this.dropzone.enable(),this.dropzone.options=Object.assign({},this.getDefaultOptions(),this.dropzone.options,this.props.options))}componentWillUnmount(){this.dropzone.files=[],this.dropzone.destroy()}getDefaultOptions(){let e=null,t=this.props.uploadSelector;if(!t&&this.props.uploadButton&&(t=".asset-dropzone__upload-button"),t){const n=(0,s.default)(this.dropzoneRef).find(t);n&&n.length&&(e=n.toArray())}return{accept:this.handleAccept,addedfile:this.handleAddedFile,dragenter:this.handleDragEnter,dragleave:this.handleDragLeave,drop:this.handleDrop,maxfilesexceeded:this.handleMaxFilesExceeded,uploadprogress:this.handleUploadProgress,complete:this.handleUploadComplete,dictDefaultMessage:o.default._t("AssetAdmin.DROPZONE_DEFAULT_MESSAGE","Drop files here to upload"),dictFallbackMessage:o.default._t("AssetAdmin.DROPZONE_FALLBACK_MESSAGE","Your browser does not support drag'n'drop file uploads."),dictFallbackText:o.default._t("AssetAdmin.DROPZONE_FALLBACK_TEXT","Please use the fallback form below to upload your files like in the olden days."),dictInvalidFileType:o.default._t("AssetAdmin.DROPZONE_INVALID_FILE_TYPE","You can't upload files of this type."),dictResponseError:o.default._t("AssetAdmin.DROPZONE_RESPONSE_ERROR","Server responded with an error."),dictCancelUpload:o.default._t("AssetAdmin.DROPZONE_CANCEL_UPLOAD","Cancel upload"),dictCancelUploadConfirmation:o.default._t("AssetAdmin.DROPZONE_CANCEL_UPLOAD_CONFIRMATION","Are you sure you want to cancel this upload?"),dictRemoveFile:o.default._t("AssetAdmin.DROPZONE_REMOVE_FILE","Remove file"),dictMaxFilesExceeded:o.default._t("AssetAdmin.DROPZONE_MAX_FILES_EXCEEDED","You can not upload any more files."),error:this.handleError,sending:this.handleSending,success:this.handleSuccess,queuecomplete:this.handleQueueComplete,thumbnailHeight:150,thumbnailWidth:200,timeout:0,clickable:e}}getFileCategory(e){return e.split("/")[0]}getLoadPreview(e){return new Promise((t=>{const n=new FileReader;n.onload=n=>{if("image"===this.getFileCategory(e.type)){const e=new Image;t(this.loadImage(e,n.target.result))}else t({})},n.readAsDataURL(e)}))}getFileTitle(e){return e.replace(/[.][^.]+$/,"").replace(/-_/," ")}setPromptOnRemove(e){this.dropzone.options.dictRemoveFileConfirmation=e}handleDragEnter(e){this.props.canUpload&&(this.dragging=!0,this.forceUpdate(),"function"==typeof this.props.onDragEnter&&this.props.onDragEnter(e))}handleDragLeave(e){const t=this.dropzoneRef;this.props.canUpload&&e.target===t&&(this.dragging=!1,this.forceUpdate(),"function"==typeof this.props.onDragLeave&&this.props.onDragLeave(e,t))}handleUploadProgress(e,t,n){"function"==typeof this.props.onUploadProgress&&this.props.onUploadProgress(e,t,n)}handleUploadComplete(e){"function"==typeof this.props.onUploadComplete&&this.props.onUploadComplete(e.status)}handleDrop(e){this.dragging=!1,this.forceUpdate(),"function"==typeof this.props.onDrop&&this.props.onDrop(e)}handleSending(e,t,n){"function"==typeof this.props.updateFormData&&this.props.updateFormData(n),n.append("SecurityID",this.props.securityID),n.append("ParentID",this.props.folderId);const r=Object.assign({},t,{abort:()=>{this.dropzone.cancelUpload(e),t.abort()}});"function"==typeof this.props.onSending&&this.props.onSending(e,r,n)}handleMaxFilesExceeded(e){return"function"!=typeof this.props.onMaxFilesExceeded||this.props.onMaxFilesExceeded(e)}generateQueuedId(){return c+=1,c}handleAccept(e,t){return("function"!=typeof this.props.canFileUpload||this.props.canFileUpload(e))&&this.props.canUpload?t():t(o.default._t("AssetAdmin.DROPZONE_CANNOT_UPLOAD","Uploading not permitted."))}handleAddedFile(e){e._queuedId=this.generateQueuedId();const t={category:this.getFileCategory(e.type),filename:e.name,queuedId:e._queuedId,size:e.size,title:this.getFileTitle(e.name),extension:(0,l.getFileExtension)(e.name),type:e.type,uploadedToFolderId:this.props.folderId};this.props.onAddedFile(t);return this.getLoadPreview(e).then((e=>{const n={height:e.height,width:e.width,url:e.thumbnailURL,thumbnail:e.thumbnailURL,smallThumbnail:e.thumbnailURL};return"function"==typeof this.props.onPreviewLoaded&&this.props.onPreviewLoaded(t,n),{...t,...n}}))}loadImage(e,t){return new Promise((n=>{const r=document.createElement("canvas"),o=r.getContext("2d");e.onload=()=>{const t=2*this.props.preview.width,i=2*this.props.preview.height,s=e.naturalWidth/e.naturalHeight;e.naturalWidth{this.dropzoneRef=e}},this.props.uploadButton&&r.default.createElement("button",t,o.default._t("AssetAdmin.DROPZONE_UPLOAD")),this.props.children)}}p.propTypes={folderId:a.default.number.isRequired,onAccept:a.default.func,onAddedFile:a.default.func.isRequired,onDragEnter:a.default.func,onDragLeave:a.default.func,onDrop:a.default.func,onError:a.default.func.isRequired,onPreviewLoaded:a.default.func,onSending:a.default.func,onSuccess:a.default.func.isRequired,onMaxFilesExceeded:a.default.func,updateFormData:a.default.func,canFileUpload:a.default.func,onQueueComplete:a.default.func,options:a.default.shape({url:a.default.string.isRequired}),promptOnRemove:a.default.string,securityID:a.default.string.isRequired,uploadButton:a.default.bool,uploadSelector:a.default.string,canUpload:a.default.bool.isRequired,preview:a.default.shape({width:a.default.number,height:a.default.number}),className:a.default.string},p.defaultProps={uploadButton:!0};t.default=p},3229:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=c(n(5815)),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=n(9040),s=n(5207),l=n(3556),a=c(n(6923)),u=c(n(6935));function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}function c(e){return e&&e.__esModule?e:{default:e}}class p extends o.Component{constructor(e){super(e),this.handleChangeValue=this.handleChangeValue.bind(this),this.renderChild=this.renderChild.bind(this)}getOptionByValue(e){return this.props.actions.find((t=>t.value===e))}handleChangeValue(e){let t=null;const n=this.getOptionByValue(e.target.value);return null===n?null:(t="function"==typeof n.confirm?n.confirm(this.props.items).then((()=>n.callback(e,this.props.items))).catch((e=>{if("cancelled"!==e)throw e})):n.callback(e,this.props.items)||Promise.resolve(),t)}renderChild(e,t){const n=(0,a.default)("bulk-actions__action",e.className||"font-icon-info-circled",{btn:t<2,"bulk-actions__action--more":t>2});return t<2?o.default.createElement(l.Button,{className:n,key:e.value,onClick:this.handleChangeValue,value:e.value,color:e.color},e.label):o.default.createElement(l.DropdownItem,{type:"button",className:n,key:e.value,onClick:this.handleChangeValue,value:e.value},e.label)}render(){if(!this.props.items.length)return null;let e=this.props.actions.filter((e=>!e.canApply||e.canApply(this.props.items)));if(e=e.map(this.renderChild),!e.length)return null;const{ActionMenu:t,showCount:n}=this.props,i=r.default._t("AssetAdmin.BULK_ACTIONS_SELECT_ALL","Select all"),s=r.default.sprintf(r.default._t("AssetAdmin.BULK_ACTIONS_SELECTED","%s selected"),this.props.items.length),a=r.default._t("AssetAdmin.BULK_ACTIONS_CLEAR_SELECTION","Clear selection");return o.default.createElement("div",{className:"bulk-actions fieldholder-small"},n&&o.default.createElement(o.default.Fragment,null,o.default.createElement(l.Button,{className:"bulk-actions-counter font-icon-cross-mark",onClick:this.props.onClearSelection,title:a},s),o.default.createElement("div",{className:"bulk-actions-select-all"},o.default.createElement(l.Button,{onClick:this.props.onSelectAll},i))),e.slice(0,2),e.length>2&&t?o.default.createElement(t,{id:"BulkActions",className:"bulk-actions__more-actions-menu"},e.slice(2)):e.slice(2))}}t.Component=p,p.propTypes={items:u.default.array,actions:u.default.arrayOf(u.default.shape({value:u.default.string.isRequired,label:u.default.string.isRequired,className:u.default.string,destructive:u.default.bool,callback:u.default.func,canApply:u.default.func,confirm:u.default.func})),ActionMenu:u.default.elementType,showCount:u.default.bool,onClearSelection:u.default.func.isRequired,onSelectAll:u.default.func.isRequired},p.defaultProps={items:[],actions:[],ActionMenu:null,total:null,showCount:!0,totalReachedMessage:r.default._t("")};const h=(0,i.connect)((function(e){return{gallery:e.assetAdmin.gallery}}))(p);t.default=(0,s.inject)(["ActionMenu"],(e=>({ActionMenu:e})),(()=>"BulkActions"))(h)},1037:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Folder=t.File=t.Component=void 0;var r=S(n(5815)),o=C(n(1594)),i=S(n(6923)),s=S(n(6379)),l=S(n(6022)),a=S(n(2063)),u=S(n(2932)),d=S(n(2926)),c=S(n(1990)),p=S(n(4350)),h=n(9040),f=n(9367),m=n(4172),g=C(n(769)),y=S(n(1838)),v=S(n(6935));function b(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(b=function(e){return e?n:t})(e)}function C(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=b(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function S(e){return e&&e.__esModule?e:{default:e}}function E(){return E=Object.assign?Object.assign.bind():function(e){for(var t=1;t{e.preventDefault()};class x extends o.Component{constructor(e){super(e),this.handleSelect=this.handleSelect.bind(this),this.handleActivate=this.handleActivate.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancelUpload=this.handleCancelUpload.bind(this)}componentDidUpdate(){_(this.props)&&this.props.actions.imageLoad.loadImage(this.props.item.thumbnail,this.props.sectionConfig.imageRetry)}getThumbnailStyles(){const{item:{thumbnail:e,version:t},bustCache:n}=this.props;if(!this.isImage()||!e||this.missing())return{};const r=!1===n||!t||e.startsWith("data:image/")?e:`${e}?vid=${t}`;switch(this.props.loadState){case y.default.SUCCESS:case y.default.DISABLED:return{backgroundImage:`url(${r})`};default:return{}}}getErrorMessage(){let e=null;const{item:t,loadState:n}=this.props;if(this.hasError()?e=t.message.value:this.missing()?e=r.default._t("AssetAdmin.FILE_MISSING","File cannot be found"):n===y.default.FAILED&&(e=r.default._t("AssetAdmin.FILE_LOAD_ERROR","Thumbnail not available")),null!==e){return e=this.getItemFunction("updateErrorMessage")(e,this.props),o.default.createElement("span",{className:"gallery-item__error-message"},e)}return null}getThumbnailClassNames(){const e=["gallery-item__thumbnail"];switch(this.isImageSmallerThanThumbnail()&&e.push("gallery-item__thumbnail--small"),!this.props.item.thumbnail&&this.isImage()&&e.push("gallery-item__thumbnail--no-preview"),this.props.loadState){case y.default.LOADING:case y.default.WAITING:e.push("gallery-item__thumbnail--loading");break;case y.default.FAILED:e.push("gallery-item__thumbnail--error")}return e.join(" ")}getItemClassNames(){const e=this.props.item.category||"false",t=this.props.selectable&&(this.props.item.selected||this.props.isDragging);return(0,i.default)({"gallery-item":!0,[`gallery-item--${e}`]:!0,"gallery-item--max-selected":this.props.maxSelected&&!t,"gallery-item--missing":this.missing(),"gallery-item--selectable":this.props.selectable,"gallery-item--selected":t,"gallery-item--dropping":this.props.isDropping,"gallery-item--highlighted":this.props.item.highlighted,"gallery-item--error":this.hasError(),"gallery-item--dragging":this.props.isDragging})}getItemFunction(e){const{item:t}=this.props;return"function"==typeof t[e]?t[e]:this.props[e]}getStatusFlags(){let e=[];const{item:t}=this.props;"folder"!==t.type&&(t.draft?e.push({key:"status-draft",title:r.default._t("File.DRAFT","Draft"),className:"gallery-item--draft"}):t.modified&&e.push({key:"status-modified",title:r.default._t("File.MODIFIED","Modified"),className:"gallery-item--modified"}));return e=this.getItemFunction("updateStatusFlags")(e,this.props),o.default.createElement("div",{className:"gallery-item__status-flags"},e.map((e=>o.default.createElement("span",e))))}getStatusIcons(){const{item:e}=this.props,t=[];return e.hasRestrictedAccess&&t.push({key:"status-restricted",fileID:e.id,hasRestrictedAccess:!0,placement:"top",disableTooltip:"folder"===e.type,includeBackground:"folder"!==e.type}),e.isTrackedFormUpload&&"folder"!==e.type&&t.push({key:"status-tracked-form-upload",fileID:e.id,isTrackedFormUpload:!0,hasRestrictedAccess:e.hasRestrictedAccess,placement:"top",includeBackground:!0}),o.default.createElement("div",{className:"gallery-item__status-icons"},t.map((e=>o.default.createElement(c.default,e))))}getProgressBar(){let e=null;const{item:t}=this.props,n={className:"gallery-item__progress-bar",style:{width:`${t.progress}%`}};this.hasError()||!this.uploading()||this.complete()||(e=o.default.createElement("div",{className:"gallery-item__upload-progress"},o.default.createElement("div",n)));return e=this.getItemFunction("updateProgressBar")(e,this.props),e}isImageSmallerThanThumbnail(){if(!this.isImage()||this.missing())return!1;const e=this.props.item.width,t=this.props.item.height;return t&&e&&t0}missing(){return!this.exists()&&this.saved()}uploading(){return this.props.item.queuedId&&!this.saved()}exists(){return this.props.item.exists}isImage(){return"image"===this.props.item.category}canBatchSelect(){return this.props.selectable&&this.props.item.canEdit}hasError(){let e=!1;return this.props.item.message&&(e="error"===this.props.item.message.type),e}handleActivate(e){e.stopPropagation(),"function"==typeof this.props.onActivate&&this.saved()&&this.props.onActivate(e,this.props.item)}handleSelect(e){e.stopPropagation(),e.preventDefault(),"function"==typeof this.props.onSelect&&this.props.onSelect(e,this.props.item)}handleKeyDown(e){s.default.SPACE_KEY_CODE===e.keyCode&&(e.preventDefault(),this.canBatchSelect()&&this.handleSelect(e)),s.default.RETURN_KEY_CODE===e.keyCode&&this.handleActivate(e)}handleCancelUpload(e){e.stopPropagation(),e.preventDefault(),this.hasError()?this.props.onRemoveErroredUpload(this.props.item):this.props.onCancelUpload&&this.props.onCancelUpload(this.props.item)}render(){let e=null,t=null,n=null;const{id:i,queuedId:s}=this.props.item,l=i?`item-${i}`:`queued-${s}`;if(this.props.selectable&&(this.canBatchSelect()&&(e=this.handleSelect),t="font-icon-tick"),this.uploading())e=this.handleCancelUpload,t="font-icon-cancel";else if(this.exists()){const e=r.default._t("AssetAdmin.VIEW","View");n=o.default.createElement("div",{className:"gallery-item--overlay font-icon-eye"},e)}const a=this.props.badge,u={className:"gallery-item__checkbox",type:"checkbox",title:r.default._t("AssetAdmin.SELECT","Select"),tabIndex:-1,onMouseDown:w,id:l},c=["gallery-item__checkbox-label",t];this.canBatchSelect()||(u.disabled=!0,c.push("gallery-item__checkbox-label--disabled"));const p={className:c.join(" "),onClick:e};return o.default.createElement("div",{className:this.getItemClassNames(),"data-id":this.props.item.id,tabIndex:0,role:"button",onKeyDown:this.handleKeyDown,onClick:this.handleActivate},!!a&&o.default.createElement(d.default,{className:"gallery-item__badge",status:a.status,message:a.message}),o.default.createElement("div",{ref:e=>{this.thumbnail=e},className:this.getThumbnailClassNames(),style:this.getThumbnailStyles()},n,this.getStatusFlags(),this.getStatusIcons()),this.getProgressBar(),this.getErrorMessage(),this.props.children,o.default.createElement("div",{className:"gallery-item__title",ref:e=>{this.title=e}},o.default.createElement("label",E({},p,{htmlFor:l}),o.default.createElement("input",u)),this.props.item.title))}}t.Component=x,x.propTypes={sectionConfig:p.default,item:l.default,loadState:v.default.oneOf(Object.values(y.default)),bustCache:v.default.bool,highlighted:v.default.bool,selected:v.default.bool,isDropping:v.default.bool,isDragging:v.default.bool,message:v.default.shape({value:v.default.string,type:v.default.string}),selectable:v.default.bool,onActivate:v.default.func,onSelect:v.default.func,onCancelUpload:v.default.func,onRemoveErroredUpload:v.default.func,badge:v.default.shape({status:v.default.string,message:v.default.string}),updateStatusFlags:v.default.func,updateProgressBar:v.default.func,updateErrorMessage:v.default.func},x.defaultProps={item:{},sectionConfig:{imageRetry:{}},updateStatusFlags:e=>e,updateProgressBar:e=>e,updateErrorMessage:e=>e,bustCache:!0};const F=(0,h.connect)((function(e,t){const{bustCache:n}=e.config.sections.find((e=>"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"===e.name));let r=y.default.DISABLED;if(_(t)){const n=e.assetAdmin.imageLoad.files.find((e=>t.item.thumbnail===e.url));r=n&&n.status||y.default.NONE}return{bustCache:n,loadState:r}}),(function(e){return{actions:{imageLoad:(0,f.bindActionCreators)(g,e)}}}))(x),A="GalleryItem",O=t.File=(0,m.createSelectable)((0,a.default)(A)(F));t.Folder=(0,m.createSelectable)((0,u.default)(A)(O));t.default=F},2914:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=a(n(6935)),i=n(1820),s=a(n(2926)),l=a(n(1037));function a(e){return e&&e.__esModule?e:{default:e}}function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t1?r.default.createElement("div",{key:"1",className:"gallery-item__drag-shadow"}):null,t>2?r.default.createElement("div",{key:"2",className:"gallery-item__drag-shadow gallery-item__drag-shadow--second"}):null];return r.default.createElement("div",{className:"gallery-item__drag-layer"},r.default.createElement("div",{className:"gallery-item__drag-layer-item",style:this.getOffset()},r.default.createElement("div",{className:"gallery-item__drag-layer-preview"},n,r.default.createElement(l.default,d({},e.props,{isDragging:!0}))),t>1?r.default.createElement(s.default,{className:"gallery-item__drag-layer-count",status:"info",message:`${t}`}):null))}}c.propTypes={item:o.default.object,offset:o.default.shape({x:o.default.number.isRequired,y:o.default.number.isRequired}),isDragging:o.default.bool.isRequired};t.default=(0,i.DragLayer)((e=>({item:e.getItem(),offset:e.getInitialClientOffset(),dragged:e.getDifferenceFromInitialOffset(),isDragging:e.isDragging()})))(c)},2063:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){const t={canDrag(e){return e.canDrag},beginDrag(e){const{id:t}=e.item;"function"==typeof e.onDrag&&e.onDrag(!0,t);const n=e.selectedFiles.concat([]);return n.includes(t)||n.push(t),{selected:n,props:e}},endDrag(e){const{id:t}=e.item;"function"==typeof e.onDrag&&e.onDrag(!1,t)}},n=(0,s.DragSource)(e,t,((e,t)=>({connectDragPreview:e.dragPreview(),connectDragSource:e.dragSource(),isDragging:t.isDragging()})));return e=>{class t extends o.Component{componentDidMount(){this.props.connectDragPreview((0,l.getEmptyImage)(),{captureDraggingState:!0})}render(){const{connectDragSource:t}=this.props,n=o.default.createElement(e,this.props);return"string"==typeof n.type?t(n):t(o.default.createElement("div",{className:"gallery-item__draggable"},n))}}return t.propTypes={connectDragSource:i.default.func.isRequired,connectDragPreview:i.default.func.isRequired,item:i.default.shape({id:i.default.number.isRequired}).isRequired,onDrag:i.default.func,selectedFiles:i.default.arrayOf(i.default.number)},n(t)}};var r,o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=a(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=(r=n(6935))&&r.__esModule?r:{default:r},s=n(1820),l=n(8724);function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(a=function(e){return e?n:t})(e)}},2932:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){const t={drop(e,t){if(t.canDrop()){const n=t.getItem();e.onDropFiles(e.item.id,n.selected)}},canDrop(e,t){return!t.getItem().selected.includes(e.item.id)}},n=(0,s.DropTarget)(e,t,((e,t)=>{const n=t.isOver();return{isDropping:n&&t.canDrop(),connectDropTarget:e.dropTarget(),isOver:n}}));return e=>{class t extends o.Component{render(){const{connectDropTarget:t}=this.props,n=o.default.createElement(e,this.props);return"string"==typeof n.type?t(n):t(o.default.createElement("div",{className:"gallery-item__droppable"},n))}}return t.propTypes={connectDropTarget:i.default.func.isRequired,item:i.default.shape({id:i.default.number.isRequired}).isRequired},n(t)}};var r,o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=(r=n(6935))&&r.__esModule?r:{default:r},s=n(1820);function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}},6379:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o=(r=n(5815))&&r.__esModule?r:{default:r};t.default={ACTIONS:{CREATE_FOLDER:"create-folder",EDIT_FILE:"edit"},MOVE_SUCCESS_DURATION:3e3,CSS_TRANSITION_TIME:300,SMALL_THUMBNAIL_HEIGHT:60,SMALL_THUMBNAIL_WIDTH:60,THUMBNAIL_HEIGHT:150,THUMBNAIL_WIDTH:200,BULK_ACTIONS:[{value:"delete",label:o.default._t("AssetAdmin.BULK_ACTIONS_DELETE","Delete"),className:"font-icon-trash",destructive:!0,callback:null,canApply:e=>e.every((e=>e&&e.canDelete))},{value:"archive",label:o.default._t("AssetAdmin.BULK_ACTIONS_ARCHIVE","Archive"),className:"font-icon-box",destructive:!0,callback:null,canApply:e=>e.every((e=>e&&e.canDelete))},{value:"edit",label:o.default._t("AssetAdmin.BULK_ACTIONS_EDIT","Edit"),className:"font-icon-edit",destructive:!1,canApply:e=>1===e.length,callback:null},{value:"move",label:o.default._t("AssetAdmin.BULK_ACTIONS_MOVE","Move"),className:"font-icon-folder-move",canApply:e=>e.every((e=>e&&e.canEdit)),destructive:!1,callback:null},{value:"publish",label:o.default._t("AssetAdmin.BULK_ACTIONS_PUBLISH","Publish"),className:"font-icon-rocket",destructive:!1,callback:null,canApply:e=>e.some((e=>e&&e.modified))&&e.every((e=>e.canEdit&&"folder"!==e.type)),confirm:null},{value:"unpublish",label:o.default._t("AssetAdmin.BULK_ACTIONS_UNPUBLISH","Unpublish"),className:"font-icon-cancel-circled",destructive:!1,callback:null,canApply:e=>e.some((e=>e.published))&&e.every((e=>e.canEdit&&"folder"!==e.type)),confirm:null},{value:"insert",label:o.default._t("AssetAdmin.BULK_ACTIONS_INSERT","Insert"),className:"font-icon-plus-circled btn-primary",destructive:!1,callback:null,canApply:e=>e.length,confirm:null}],BULK_ACTIONS_PLACEHOLDER:o.default._t("AssetAdmin.BULK_ACTIONS_PLACEHOLDER"),SPACE_KEY_CODE:32,RETURN_KEY_CODE:13,DEFAULT_PREVIEW:"framework/client/dist/images/app_icons/generic_92.png",MODAL_MOVE:"MODAL_MOVE"}},7917:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=I(n(1594)),o=A(n(6935)),i=n(9040),s=n(9367),l=A(n(5609)),a=A(n(5815)),u=A(n(6923)),d=I(n(4201)),c=I(n(8918)),p=I(n(1369)),h=I(n(9517)),f=A(n(1869)),m=A(n(5789)),g=A(n(2294)),y=I(n(6303)),v=A(n(6175)),b=A(n(6379)),C=A(n(4350)),S=A(n(6177)),E=I(n(4461)),_=A(n(8268)),w=A(n(4014)),x=A(n(175)),F=A(n(2308));function A(e){return e&&e.__esModule?e:{default:e}}function O(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(O=function(e){return e?n:t})(e)}function I(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=O(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}class D extends r.Component{constructor(e){super(e),this.handleOpenFile=this.handleOpenFile.bind(this),this.handleCloseFile=this.handleCloseFile.bind(this),this.handleDelete=this.handleDelete.bind(this),this.doPublish=this.doPublish.bind(this),this.doUnpublish=this.doUnpublish.bind(this),this.handleUnpublish=this.handleUnpublish.bind(this),this.handleDoSearch=this.handleDoSearch.bind(this),this.handleClearSearch=this.handleClearSearch.bind(this),this.handleSubmitEditor=this.handleSubmitEditor.bind(this),this.handleOpenFolder=this.handleOpenFolder.bind(this),this.handleSort=this.handleSort.bind(this),this.handleSetPage=this.handleSetPage.bind(this),this.createEndpoint=this.createEndpoint.bind(this),this.handleBackButtonClick=this.handleBackButtonClick.bind(this),this.handleFolderIcon=this.handleFolderIcon.bind(this),this.handleBrowse=this.handleBrowse.bind(this),this.handleViewChange=this.handleViewChange.bind(this),this.handleUpload=this.handleUpload.bind(this),this.handleUploadQueue=this.handleUploadQueue.bind(this),this.handleCreateFolder=this.handleCreateFolder.bind(this),this.handleMoveFilesSuccess=this.handleMoveFilesSuccess.bind(this),this.refetchFolder=this.refetchFolder.bind(this),this.state={loading:!1,folder:null,files:[],totalCount:0,forceRefetch:!1}}componentDidMount(){this.refetchFolder()}componentDidUpdate(e){(this.props.folderId!==e.folderId||this.props.fileId!==e.fileId&&0!==this.props.fileId||this.state.forceRefetch)&&this.refetchFolder(),this.state.forceRefetch&&this.setState({forceRefetch:!1})}getFolderId(){return null!==this.props.folderId?this.props.folderId:this.state.folder?this.state.folder.id:0}refetchFolder(){const e=this.getFolderId(),t=new URLSearchParams(window.location.search),n=[];t.forEach(((e,t)=>{"page"!==t&&"filter"!==t.substring(0,6)&&"sort"!==t.substring(0,4)||n.push(`${t}=${e}`)}));let r="";n.length&&(r=`?${n.join("&")}`);const o=`${S.default.getSection("SilverStripe\\AssetAdmin\\Controller\\AssetAdminOpen").endpoints.read.url}/${e}${r}`;l.default.get(o).then((async e=>{const t=await e.json();this.setState({loading:!1,folder:t,files:t.children.nodes,totalCount:t.children.pageInfo.totalCount})})).catch((async e=>{this.setState({loading:!1,folder:null,files:[],totalCount:0});const t=await(0,w.default)(e);this.props.actions.toasts.error(t)}))}getFiles(){const{queuedFiles:e,folderId:t}=this.props,n=this.state.files,r=[...e.items.filter((e=>!(e.id&&n.find((t=>t.id===e.id))||e.hasOwnProperty("uploadedToFolderId")&&e.uploadedToFolderId!==t))),...n],o=r.filter((e=>"folder"===e.type)),i=r.filter((e=>"folder"!==e.type));return o.concat(i)}handleBrowse(e,t,n){"function"==typeof this.props.onBrowse&&(this.props.onBrowse(e,t,n),this.setState({forceRefetch:!0})),e!==this.getFolderId()&&this.props.actions.gallery.deselectFiles()}handleSetPage(e){this.handleBrowse(this.getFolderId(),this.props.fileId,Object.assign({},this.props.query,{page:e})),this.setState({forceRefetch:!0})}handleDoSearch(e){this.props.actions.gallery.deselectFiles(),this.props.actions.queuedFiles.purgeUploadQueue(),this.handleBrowse(e.currentFolderOnly?this.getFolderId():0,null,{filter:e,view:this.props.query.view})}handleClearSearch(e){this.props.actions.displaySearch.closeSearch(),this.props.actions.gallery.deselectFiles(),this.props.actions.queuedFiles.purgeUploadQueue(),this.refetchFolder();const t=this.state.folder;this.handleOpenFolder(e,t)}handleSort(e){this.handleBrowse(this.getFolderId(),this.props.fileId,{...this.props.query,sort:e,limit:void 0,page:void 0}),this.setState({forceRefetch:!0})}handleViewChange(e){this.handleBrowse(this.getFolderId(),this.props.fileId,Object.assign({},this.props.query,{view:e}))}createEndpoint(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return l.default.createEndpointFetcher(Object.assign({},e,t?{defaultData:{SecurityID:this.props.securityId}}:{}))}handleBackButtonClick(e){e.preventDefault(),this.props.actions.gallery.deselectFiles();const t=this.state.folder;t?this.handleOpenFolder(t.parentId||0):this.handleOpenFolder(0)}resetFile(e){e.queuedId&&this.props.actions.queuedFiles.removeQueuedFile(e.queuedId),this.props.fileId===e.id&&this.props.resetFileDetails(this.getFolderId(),e.id,this.props.query)}handleFolderIcon(){this.handleOpenFile(this.getFolderId())}handleOpenFile(e){this.handleBrowse(this.getFolderId(),e,this.props.query)}handleSubmitEditor(e,t,n){let r=null;if("action_insert"===t&&"select"===this.props.type){const t=this.getFiles().find((t=>t.id===parseInt(e.ID,10)));return this.props.onInsertMany(null,[t]),this.setState({forceRefetch:!0}),Promise.resolve()}if("function"==typeof this.props.onSubmitEditor){const o=this.findFile(this.props.fileId);r=this.props.onSubmitEditor(e,t,n,o)}else r=n();if(!r)throw new Error("Promise was not returned for submitting");return this.setState({forceRefetch:!0}),r.then((e=>("action_createfolder"===t?"admin"===this.props.type?this.handleOpenFile(e.record.id):this.handleOpenFolder(this.getFolderId()):"action_save"!==t&&"action_publish"!==t||this.getFolderId()===e.record.parent.id||this.handleBrowse(e.record.parent.id,e.record.id,null),e)))}handleCloseFile(){this.handleBrowse(this.getFolderId(),null,this.props.query)}handleOpenFolder(e){const{page:t,filter:n,...r}=this.props.query;this.handleBrowse(e,null,r)}handleDelete(e){this.props.actions.confirmDeletion.deleting();const t=e.map((e=>{const t=this.findFile(e);if(!t)throw new Error(`File selected for deletion cannot be found: ${e}`);return t.queuedId&&this.props.actions.queuedFiles.removeQueuedFile(t.queuedId),t})).map((e=>e.id)),n=this.state.folder,r=n?n.id:0,o=this.props.sectionConfig.endpoints.delete.url;return l.default.post(o,{ids:t},{"X-SecurityID":S.default.get("SecurityID")}).then((()=>{this.handleBrowse(r,null,this.props.query);this.props.queuedFiles.items.filter((e=>t.includes(e.id))).forEach((e=>{e.queuedId&&this.props.actions.queuedFiles.removeQueuedFile(e.queuedId)}));let e="AssetAdmin.BULK_ACTIONS_DELETE_SUCCESS_02",n="%s folders/files were successfully deleted.";this.props.sectionConfig.filesAreVersioned&&this.props.sectionConfig.archiveFiles&&(e="AssetAdmin.BULK_ACTIONS_ARCHIVE_SUCCESS_02",n="%s folders/files were successfully archived."),this.props.actions.toasts.success(a.default.sprintf(a.default._t(e,n),t.length)),this.props.actions.gallery.deselectFiles(),this.refetchFolder()})).catch((async e=>{const t=await(0,w.default)(e);this.props.actions.toasts.error(t)})).finally((()=>this.props.actions.confirmDeletion.reset()))}doUnpublish(e){const t=e.map((e=>{const t=this.findFile(e);if(!t)throw new Error(`File selected for unpublishing cannot be found: ${e}`);if("folder"===t.type)throw new Error("Cannot unpublish folders");return t})),n=t.map((e=>e.id)),r=n.map((e=>`ids[]=${e}`)).join("&");let o=`${this.props.sectionConfig.endpoints.readLiveOwnerCounts.url}?${r}`;return l.default.get(o).then((async e=>{const t=(await e.json()).filter((e=>e.count>0)),n=t.slice(0,4).map((e=>e.message)),r=t.slice(5).length;let o="";if(r>0&&(o=a.default.inject(a.default._t("AssetAdmin.BULK_OWNED_WARNING_REMAINING","And {count} other file(s)"),{count:r})),n.length){const e=[a.default.inject(a.default._t("AssetAdmin.BULK_OWNED_WARNING_HEADING","{count} file(s) are being used by other published content."),{count:n.length}),...n,o,a.default._t("AssetAdmin.BULK_OWNED_WARNING_FOOTER","Unpublishing will only remove files from the published version of the content. They will remain on the draft version. Unpublish anyway?")].filter((e=>e)).join("\n\n");if(!confirm(e))return Promise.reject()}return Promise.resolve()})).then((()=>(o=this.props.sectionConfig.endpoints.unpublish.url,l.default.post(o,{ids:n},{"X-SecurityID":S.default.get("SecurityID")}).catch((async e=>{const t=await(0,w.default)(e);this.props.actions.toasts.error(t)}))))).then((()=>(this.refetchFolder(),t))).catch((async e=>{const t=await(0,w.default)(e);return this.props.actions.toasts.error(t),[]}))}handleUnpublish(e){return this.doUnpublish(e).then((e=>{const{fileId:t}=this.props;this.refetchFolder().then((()=>{t&&e.find((e=>e.id===t))&&this.props.resetFileDetails(this.getFolderId(),t,this.props.query)}))}))}doPublish(e){const t=e.map((e=>{const t=this.findFile(e);if(!t)throw new Error(`File selected for publishing cannot be found: ${e}`);if("folder"===t.type)throw new Error("Cannot publish folders");return t})),n=t.map((e=>e.id)),r=this.props.sectionConfig.endpoints.publish.url;return l.default.post(r,{ids:n},{"X-SecurityID":S.default.get("SecurityID")}).then((()=>(t.forEach((e=>this.resetFile(e))),this.refetchFolder(),t))).catch((async e=>{const t=await(0,w.default)(e);this.props.actions.toasts.error(t)}))}findFile(e){return this.getFiles().find((t=>t.id===parseInt(e,10)))}handleUpload(){}handleUploadQueue(){this.props.fileId&&this.refetchFolder()}handleCreateFolder(){this.props.onBrowse(this.getFolderId(),null,this.props.query,b.default.ACTIONS.CREATE_FOLDER)}handleMoveFilesSuccess(e,t){this.props.queuedFiles.items.filter((e=>t.includes(e.id))).forEach((e=>{e.queuedId&&this.props.actions.queuedFiles.removeQueuedFile(e.queuedId)})),this.props.actions.gallery.deselectFiles(),this.refetchFolder()}renderGallery(){const{GalleryComponent:e}=this.props,t=this.props.sectionConfig,n=t.endpoints.createFile.url,o=t.endpoints.createFile.method,i=this.props.query&&parseInt(this.props.query.limit||t.limit,10),s=this.props.query&&parseInt(this.props.query.page||1,10),l=this.props.query&&this.props.query.sort,a=this.props.query&&this.props.query.view,u=this.props.query.filter||{},d=this.state.folder,c=this.state.loading;return r.default.createElement(e,{files:this.getFiles(),fileId:this.props.fileId,folderId:this.getFolderId(),folder:d,type:this.props.type,limit:i,page:s,totalCount:this.state.totalCount,view:a,filters:u,createFileApiUrl:n,createFileApiMethod:o,onInsertMany:this.props.onInsertMany,onPublish:this.doPublish,onUnpublish:this.doUnpublish,onOpenFile:this.handleOpenFile,onOpenFolder:this.handleOpenFolder,onSuccessfulUpload:this.handleUpload,onSuccessfulUploadQueue:this.handleUploadQueue,onCreateFolder:this.handleCreateFolder,onMoveFilesSuccess:this.handleMoveFilesSuccess,onClearSearch:this.handleClearSearch,onSort:this.handleSort,onSetPage:this.handleSetPage,onViewChange:this.handleViewChange,sort:l,sectionConfig:t,loading:c,maxFilesSelect:this.props.maxFiles,dialog:this.props.dialog})}renderEditor(){const{sectionConfig:e,viewAction:t,type:n,fileId:o,dialog:i,requireLinkText:s,fileSelected:l,EditorComponent:a}=this.props,{schemaUrl:u,targetId:d}=(0,_.default)({config:e,viewAction:t,folderId:this.getFolderId(),type:n,fileId:o});if(!u)return null;const c=[];s&&c.push({name:"requireLinkText",value:!0}),l&&c.push({name:"fileSelected",value:!0});const p={dialog:i,fileId:d,schemaUrl:u,schemaUrlQueries:c,onClose:this.handleCloseFile,onSubmit:this.handleSubmitEditor,onUnpublish:this.handleUnpublish,addToCampaignSchemaUrl:e.form.addToCampaignForm.schemaUrl};return r.default.createElement(a,p)}render(){const{folderId:e,query:t,getUrl:n,type:o,maxFiles:i,toolbarChildren:s,SearchComponent:l,BulkDeleteConfirmationComponent:a}=this.props;if(null===this.state.folder)return null;const d=Boolean(e||(0,y.hasFilters)(t.filter)),c=this.props.sectionConfig.form.fileSearchForm.schemaUrl,p=t.filter||{},h=(0,u.default)("fill-height asset-admin","select"===o&&{"asset-admin--single-select":1===i,"asset-admin--multi-select":1!==i}),f=(0,y.hasFilters)(t.filter)||this.props.showSearch,m=this.props.actions.displaySearch?this.props.actions.displaySearch.toggleSearch:void 0,b=this.state.folder,C={folder:b,query:t,getUrl:n,onBrowse:this.handleBrowse,onFolderIcon:this.handleFolderIcon};return r.default.createElement("div",{className:h},r.default.createElement(g.default,{showBackButton:d,onBackButtonClick:this.handleBackButtonClick},b&&r.default.createElement(F.default,C),r.default.createElement("div",{className:"asset-admin__toolbar-extra pull-xs-right fill-width vertical-align-items"},r.default.createElement(v.default,{toggled:f,onToggle:m}),s)),f&&r.default.createElement(l,{onSearch:this.handleDoSearch,id:"AssetSearchForm",formSchemaUrl:c,onHide:this.handleClearSearch,displayBehavior:"HIDEABLE",filters:p,name:"name"}),r.default.createElement("div",{className:"flexbox-area-grow fill-width fill-height gallery"},this.renderGallery(),this.renderEditor()),r.default.createElement(a,{onConfirm:this.handleDelete,filesAreVersioned:this.props.sectionConfig.filesAreVersioned,archiveFiles:this.props.sectionConfig.archiveFiles}))}}t.Component=D,D.propTypes={dialog:o.default.bool,sectionConfig:C.default,fileId:o.default.number,folderId:o.default.number,resetFileDetails:o.default.func,onBrowse:o.default.func,onReplaceUrl:o.default.func,onInsertMany:o.default.func,getUrl:o.default.func,query:o.default.shape({sort:o.default.string,limit:o.default.oneOfType([o.default.number,o.default.string]),page:o.default.oneOfType([o.default.number,o.default.string]),filter:o.default.object}),onSubmitEditor:o.default.func,type:o.default.oneOf(["insert-media","insert-link","select","admin"]),queuedFiles:o.default.shape({items:o.default.array.isRequired}),filesTotalCount:o.default.number,loading:o.default.bool,actions:o.default.object,maxFiles:o.default.number,fileSelected:o.default.bool,EditorComponent:o.default.oneOfType([o.default.object,o.default.func]),GalleryComponent:o.default.oneOfType([o.default.object,o.default.func]),SearchComponent:o.default.oneOfType([o.default.object,o.default.func]),BulkDeleteConfirmationComponent:o.default.oneOfType([o.default.object,o.default.func])},D.defaultProps={type:"admin",query:{sort:"",limit:null,page:0,filter:{}},maxFiles:null,EditorComponent:f.default,GalleryComponent:m.default,SearchComponent:y.default,BulkDeleteConfirmationComponent:x.default};t.default=(0,s.compose)((0,i.connect)((function(e,t){const{formSchema:n}=e.assetAdmin.modal;return{securityId:e.config.SecurityID,queuedFiles:e.assetAdmin.queuedFiles,showSearch:e.assetAdmin.displaySearch.isOpen,type:n&&n.type||t.type}}),(function(e){return{actions:{gallery:(0,s.bindActionCreators)(d,e),toasts:(0,s.bindActionCreators)(c,e),displaySearch:(0,s.bindActionCreators)(h,e),queuedFiles:(0,s.bindActionCreators)(p,e),confirmDeletion:(0,s.bindActionCreators)(E,e)}}})))(D)},2308:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=a(n(1594)),o=a(n(6935)),i=a(n(5815)),s=n(6418),l=n(6303);function a(e){return e&&e.__esModule?e:{default:e}}const u=e=>{let{folder:t,query:n,getUrl:o,onBrowse:s,onFolderIcon:a,PlainBreadcrumbComponent:u}=e;const d=function(){for(var e=arguments.length,t=new Array(e),n=0;n{e.preventDefault(),s(...t)}},c=function(){return o&&o(...arguments)},p=[{text:i.default._t("AssetAdmin.FILES","Files"),href:c(0,null,n),onClick:d(0,null,n)}];if(t&&t.id){t.ancestors&&t.ancestors.forEach((e=>{p.push({text:e.title,href:c(e.id,null,n),onClick:d(e.id,null,n)})}));const e=[{className:"icon font-icon-edit-list",onClick:e=>{e.preventDefault(),a()}}];t.hasRestrictedAccess&&e.push({nodeName:"FileStatusIcon",hasRestrictedAccess:!0}),p.push({text:t.title,href:c(t.id,null,n),onClick:d(t.id,null,n),icons:e})}return(0,l.hasFilters)(n.filter)&&p.push({text:i.default._t("LeftAndMain.SEARCHRESULTS","Search results")}),r.default.createElement(u,{multiline:!0,crumbs:p})};u.propTypes={onBrowse:o.default.func,onFolderIcon:o.default.func,getUrl:o.default.func,query:o.default.shape({sort:o.default.string,limit:o.default.oneOfType([o.default.number,o.default.string]),page:o.default.oneOfType([o.default.number,o.default.string]),filter:o.default.object,view:o.default.string}),folder:o.default.shape({id:o.default.number,title:o.default.string,ancestors:o.default.array,parentId:o.default.number,canView:o.default.bool,canEdit:o.default.bool}),PlainBreadcrumbComponent:o.default.oneOfType([o.default.object,o.default.func])},u.defaultProps={PlainBreadcrumbComponent:s.Component};t.default=u},4736:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Component=void 0,t.buildUrl=v,t.default=void 0;var r=g(n(1594)),o=n(8926),i=n(9040),s=g(n(6478)),l=f(n(7917)),a=n(5716),u=f(n(7675)),d=f(n(6379)),c=f(n(4350)),p=n(5125),h=f(n(6935));function f(e){return e&&e.__esModule?e:{default:e}}function m(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(m=function(e){return e?n:t})(e)}function g(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=m(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}const y=Object.keys(d.default.ACTIONS).map((e=>d.default.ACTIONS[e]));function v(e){let{base:t,folderId:n,fileId:r,query:o,action:i}=e;if(i&&-1===y.indexOf(i))throw new Error(`Invalid action provided: ${i}`);let s=null;s=r?(0,p.joinUrlPaths)(t,`show/${n}/${d.default.ACTIONS.EDIT_FILE}/${r}`):n?(0,p.joinUrlPaths)(t,`show/${n}`):t,i===d.default.ACTIONS.CREATE_FOLDER&&(s=(0,p.joinUrlPaths)(t,`show/${n||0}/${i}`));return o&&Object.keys(o).length>0&&(s=`${s}?${u.default.stringify(o)}`),s}class b extends r.Component{constructor(e){super(e),this.handleBrowse=this.handleBrowse.bind(this),this.handleReplaceUrl=this.handleReplaceUrl.bind(this),this.handleResetDetails=this.handleResetDetails.bind(this),this.getUrl=this.getUrl.bind(this)}getUrl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:d.default.ACTIONS.EDIT_FILE;const o=parseInt(e||0,10),i=parseInt(t||0,10),s=o!==this.getFolderId(),l=Object.assign({},n);return(s||l.page<=1)&&delete l.page,v({base:`/${this.props.sectionConfig.reactRoutePath}`,folderId:o,fileId:i,query:l,action:r})}getFolderId(){return this.props.router.params&&this.props.router.params.folderId?parseInt(this.props.router.params.folderId,10):0}getFileId(){return this.props.router.params&&this.props.router.params.fileId?parseInt(this.props.router.params.fileId,10):0}getViewAction(){return this.props.router.params&&this.props.router.params.viewAction?this.props.router.params.viewAction:d.default.ACTIONS.EDIT_FILE}getSectionProps(){return{sectionConfig:this.props.sectionConfig,type:"admin",folderId:this.getFolderId(),viewAction:this.getViewAction(),fileId:this.getFileId(),query:this.getQuery(),getUrl:this.getUrl,onBrowse:this.handleBrowse,onReplaceUrl:this.handleReplaceUrl,resetFileDetails:this.handleResetDetails}}getQuery(){return(0,a.decodeQuery)(this.props.router.location.search)}handleBrowse(e,t,n,r){const o=this.getUrl(e,t,n,r);this.props.router.navigate(o)}handleReplaceUrl(e,t,n,r){const o=this.getUrl(e,t,n,r);this.props.router.navigate(o,{replace:!0})}handleResetDetails(e,t,n){const r=this.getUrl(e,t,n),o=this.getUrl(e,null,n);this.props.router.navigate(o,{replace:!0,state:{reset:!0,resetPath:r}})}render(){const{AssetAdminComponent:e}=this.props,t=this.props.router.location.state;return t&&t&&t.reset?r.default.createElement(o.Navigate,{to:t.resetPath,replace:!0}):this.props.sectionConfig?r.default.createElement(e,this.getSectionProps()):null}}t.Component=b,b.propTypes={sectionConfig:c.default,router:s.routerPropTypes,AssetAdminComponent:h.default.oneOfType([h.default.object,h.default.func])},b.defaultProps={AssetAdminComponent:l.default};t.default=(0,s.default)((0,i.connect)((function(e){return{sectionConfig:e.config.sections.find((e=>"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"===e.name))}}))(b))},2908:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.AssetAdminStateRouter=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=u(n(6935)),i=n(9040),s=n(4736),l=u(n(6379)),a=n(1021);function u(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}const c={folderId:null,fileId:null,query:{},action:l.default.ACTIONS.EDIT_FILE};class p extends r.Component{constructor(e){super(e),this.handleBrowse=this.handleBrowse.bind(this),this.getUrl=this.getUrl.bind(this),this.state=Object.assign({},c,{folderId:e.folderId})}getUrl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l.default.ACTIONS.EDIT_FILE;const o=parseInt(e||0,10),i=parseInt(t||0,10),a=this.getFolderId(),u=o!==a&&null!==a,d=Object.assign({},n);return(u||d.page<=1)&&delete d.page,(0,s.buildUrl)({base:this.props.sectionConfig.reactRoutePath,folderId:o,fileId:i,query:d,action:r})}getFolderId(){return null===this.state.folderId?null:parseInt(this.state.folderId||0,10)}getFileId(){return parseInt(this.state.fileId||this.props.fileId||0,10)}getViewAction(){return this.state.action||l.default.ACTIONS.EDIT_FILE}getSectionProps(){const e=Object.assign({},this.props,{folderId:this.getFolderId(),fileId:this.getFileId(),viewAction:this.getViewAction(),query:this.state.query,getUrl:this.getUrl,onBrowse:this.handleBrowse});return delete e.Component,e}handleBrowse(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l.default.ACTIONS.EDIT_FILE;if(r&&-1===Object.values(l.default.ACTIONS).indexOf(r))throw new Error(`Invalid action provided: ${r}`);this.state.fileId!==t&&this.props.actions.resetFormStack(),this.setState({folderId:e,fileId:t,query:n,action:r})}render(){const e=this.getSectionProps(),t=this.props.Component;return r.default.createElement(t,e)}}function h(e){return{actions:{resetFormStack:()=>e((0,a.resetFormStack)())}}}t.AssetAdminStateRouter=p,p.propTypes={Component:o.default.elementType,sectionConfig:o.default.shape({url:o.default.string.isRequired}).isRequired,fileId:o.default.number};t.default=function(e){return(0,i.connect)((function(t){const n=t.config.sections.find((e=>"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"===e.name));return{Component:e,sectionConfig:n}}),h)(p)}},175:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=C(n(1594)),o=n(9367),i=n(9040),s=v(n(6935)),l=n(5207),a=C(n(4461)),u=C(n(762)),d=C(n(8918)),c=v(n(5815)),p=v(n(6022)),h=v(n(5609)),f=v(n(6177)),m=v(n(4014)),g=v(n(134)),y=v(n(7871));function v(e){return e&&e.__esModule?e:{default:e}}function b(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(b=function(e){return e?n:t})(e)}function C(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=b(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function S(){return S=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{LoadingComponent:t,transition:n,files:o,onModalClose:i,onCancel:s,onConfirm:l,filesAreVersioned:a,archiveFiles:d,actions:p}=e;const[v,b]=(0,r.useState)(!0),[C,S]=(0,r.useState)({});(0,r.useEffect)((()=>{const e=f.default.getSection("SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"),t=o.map((e=>e.id)).map((e=>`ids[]=${e}`)).join("&"),n=`${e.endpoints.readDescendantCounts.url}?${t}`;b(!0),h.default.get(n).then((async e=>{const t=await e.json();b(!1),S(t)})).catch((async e=>{const t=await(0,m.default)(e);p.toasts.error(t)}))}),[o]);let E=null;const _=a&&d?"AssetAdmin.ARCHIVE":"AssetAdmin.DELETE",w=a&&d?"Archive":"Delete";let x=[{label:c.default._t(_,w),handler:()=>l(o.map((e=>{let{id:t}=e;return t}))),color:"danger"},{label:c.default._t("AssetAdmin.CANCEL","Cancel"),handler:s}];if(v)E=r.default.createElement(t,null);else{const e=C.filter((e=>"folder"===e.type)).length,t=C.filter((e=>"file"===e.type)).length,n=C.reduce(((e,t)=>e+t.count),0),i={topLevelFolderCount:e,topLevelFileCount:t,descendantFileCount:n,filesAreVersioned:a,archiveFiles:d};E=r.default.createElement(y.default,i),t+n>0&&(x=[{label:c.default._t("AssetAdmin.CANCEL","Cancel"),handler:s,color:"primary"},{label:c.default._t(_,w),handler:()=>l(o.map((e=>{let{id:t}=e;return t}))),color:"danger"}])}const F=![u.CANCELING,u.DELETING].includes(n);return r.default.createElement(g.default,{body:E,isOpen:F,actions:x,onCancel:s,onClosed:i,filesAreVersioned:a,archiveFiles:d})};t.Component=E,E.propTypes={LoadingComponent:s.default.elementType,transition:s.default.oneOf(["canceling","deleting",!1]),files:s.default.arrayOf(p.default),descendantFileCounts:s.default.object,onCancel:s.default.func.isRequired,onModalClose:s.default.func.isRequired,onConfirm:s.default.func.isRequired,filesAreVersioned:s.default.bool.isRequired,archiveFiles:s.default.bool.isRequired,actions:s.default.object.isRequired};const _=(0,o.compose)((0,l.inject)(["Loading"],(e=>({LoadingComponent:e}))))(E);t.default=(0,o.compose)((0,i.connect)((e=>{let{assetAdmin:{confirmDeletion:t}}=e;return t}),(e=>({onCancel:()=>e(a.cancel()),onModalClose:()=>e(a.modalClose()),actions:{toasts:(0,o.bindActionCreators)(d,e),confirmation:(0,o.bindActionCreators)(a,e)}}))))((e=>{let{showConfirmation:t,files:n,...o}=e;return t&&n.length>0?r.default.createElement(_,S({},o,{files:n})):null}))},7871:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=s(n(5815)),o=s(n(1594)),i=s(n(6935));function s(e){return e&&e.__esModule?e:{default:e}}const l=e=>{let{topLevelFolderCount:t,topLevelFileCount:n,descendantFileCount:i,filesAreVersioned:s,archiveFiles:l}=e,a="AssetAdmin.BULK_ACTIONS_DELETE_WARNING",u="Ensure files are removed from content areas prior to deleting them, otherwise they will appear as broken links.";s&&l&&(a="AssetAdmin.BULK_ACTIONS_ARCHIVE_WARNING",u="Ensure files are removed from content areas prior to archiving them, otherwise they will appear as broken links.");const d=((e,t,n,o,i)=>{const s=t+n;if(s>0){let e="AssetAdmin.BULK_ACTIONS_DELETE_ITEMS_CONFIRM",t=["You're about to delete %s file(s) which may be used in your site's content.","Carefully check the file usage on the files before deleting the file(s)."].join(" ");return o&&i&&(e="AssetAdmin.BULK_ACTIONS_ARCHIVE_ITEMS_CONFIRM",t=["You're about to archive %s file(s) which may be used in your site's content.","Carefully check the file usage on the files before archiving the file(s)."].join(" ")),r.default.sprintf(r.default._t(e,t),s)}if(1===e){let e="AssetAdmin.BULK_ACTIONS_DELETE_FOLDER_CONFIRM",t="Are you sure you want to delete this folder?";return o&&i&&(e="AssetAdmin.BULK_ACTIONS_ARCHIVE_FOLDER_CONFIRM",t="Are you sure you want to archive this folder?"),r.default._t(e,t)}let l="AssetAdmin.BULK_ACTIONS_DELETE_FOLDERS_CONFIRM",a="Are you sure you want to delete these folders?";return o&&i&&(l="AssetAdmin.BULK_ACTIONS_ARCHIVE_FOLDERS_CONFIRM",a="Are you sure you want to archive these folders?"),r.default._t(l,a)})(t,n,i,s,l);return o.default.createElement(o.default.Fragment,null,o.default.createElement("p",null,d),n+i>0&&o.default.createElement("p",null,r.default._t(a,u)))};l.propTypes={topLevelFolderCount:i.default.number,topLevelFileCount:i.default.number,descendantFileCount:i.default.number},l.defaultProps={topLevelFolderCount:0,topLevelFileCount:0,descendantFileCount:0};t.default=l},134:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=l(n(5815)),o=l(n(1594)),i=l(n(6935)),s=n(3556);function l(e){return e&&e.__esModule?e:{default:e}}const a=e=>{let{isOpen:t,body:n,onCancel:i,actions:l,filesAreVersioned:a,archiveFiles:u}=e,d="AssetAdmin.CONFIRM_FILE_DELETION",c="Confirm deletion";return a&&u&&(d="AssetAdmin.CONFIRM_FILE_ARCHIVE",c="Confirm archive"),o.default.createElement(s.Modal,{isOpen:t,toggle:i},o.default.createElement(s.ModalHeader,{toggle:i},r.default._t(d,c)),o.default.createElement(s.ModalBody,null,n),o.default.createElement(s.ModalFooter,null,l.map((e=>{let{label:t,handler:n,color:r}=e;return o.default.createElement(s.Button,{key:t,color:r,onClick:n},t)}))))};a.propTypes={isOpen:i.default.bool.isRequired,body:i.default.node.isRequired,onCancel:i.default.func.isRequired,actions:i.default.arrayOf(i.default.shape({label:i.default.string.isRequired,handler:i.default.func,color:i.default.string})),filesAreVersioned:i.default.bool.isRequired,archiveFiles:i.default.bool.isRequired};t.default=a},1869:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=_(n(5815)),o=n(9040),i=n(9367),s=E(n(1594)),l=_(n(6379)),a=_(n(55)),u=_(n(8737)),d=E(n(9077)),c=_(n(6935)),p=n(5207),h=_(n(6177)),f=_(n(5609)),m=E(n(4461)),g=E(n(1021)),y=_(n(6923)),v=_(n(7008)),b=_(n(7675)),C=E(n(1584));function S(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(S=function(e){return e?n:t})(e)}function E(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=S(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function _(e){return e&&e.__esModule?e:{default:e}}function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;te.json())).then((e=>{this.setState({file:e})}))}getFormSchemaUrl(){const{schemaUrlQueries:e,schemaUrl:t,fileId:n}=this.props,r=v.default.parse(t),o=e.reduce(((e,t)=>{let{name:n,value:r}=t;return{...e,[n]:r}}),{});return v.default.format({...r,pathname:`${r.path}/${n}`,search:b.default.stringify(o)})}handleAction(e){const t=this.state.file;switch(e.currentTarget.name){case"action_addtocampaign":this.openModal(),e.preventDefault();break;case"action_replacefile":this.replaceFile(),e.preventDefault();break;case"action_downloadfile":this.downloadFile(),e.preventDefault();break;case"action_delete":this.props.actions.confirmDeletion.confirm([t]),e.preventDefault()}}handleCancelKeyDown(e){e.keyCode!==l.default.SPACE_KEY_CODE&&e.keyCode!==l.default.RETURN_KEY_CODE||this.handleClose(e)}handleSubmit(e,t,n){const{showingSubForm:r,actions:o}=this.props;return"function"==typeof this.props.onSubmit?this.props.onSubmit(e,t,n).finally((()=>{r&&-1!==["action_save","action_publish"].indexOf(t)&&o.modal.popFormStackEntry()})):n()}handleClose(e){const{showingSubForm:t,onClose:n,actions:r}=this.props;t?r.modal.popFormStackEntry():(n(),this.closeModal()),e&&e.preventDefault()}openModal(){this.setState({openModal:!0})}closeModal(){this.setState({openModal:!1})}replaceFile(){const e=document.querySelector(".dz-input-PreviewImage");e&&e.click()}downloadFile(){const e=this.state.file;!function(e,t){const n=document.createElement("a");n.download=t,n.href=e,document.body.appendChild(n),n.click(),document.body.removeChild(n)}(e.url,e.name),document.getElementById("Form_fileEditForm_PopoverActions").focus()}handleLoadingError(e){this.setState({loadingForm:!1,loadingError:e.errors[0]})}handleLoadingSuccess(){this.setState({loadingForm:!1,loadingError:null})}handleFetchingSchema(){this.setState({loadingForm:!0})}editorHeader(e){let{SchemaComponent:t,...n}=e;const{dialog:r,nextType:o,showingSubForm:i,actions:l,EditorHeaderComponent:a}=this.props,u=this.getFormSchemaUrl(),d=this.state.file;let c=C.buttonStates.SWITCH;r&&d&&"folder"!==d.type&&(c=i?C.buttonStates.ALWAYS_BACK:C.buttonStates.ONLY_BACK);const{formid:p}=n,h=o&&d&&"folder"!==d.type?()=>{l.modal.stashFormValues(p,u),l.modal.pushFormStackEntry(o)}:void 0,f={onCancel:this.handleClose,showButton:c,onDetails:h};return s.default.createElement(a,f,s.default.createElement(t,n))}createFn(e,t){if("AssetEditorHeaderFieldGroup"===t.name){const n=this.editorHeader,r={key:t.id,SchemaComponent:e,...t};return s.default.createElement(n,r)}return s.default.createElement(e,w({key:t.id},t))}render(){if(!this.state.file)return null;const{FormBuilderLoaderComponent:e,FormBuilderModalComponent:t}=this.props,n=this.getFormSchemaUrl(),o=`${this.props.addToCampaignSchemaUrl}/${this.props.fileId}`,i=(0,y.default)("panel","form--no-dividers","editor",{"editor--asset-dropzone--disable":!this.props.enableDropzone},this.props.className);let l=null;if(this.state.loadingError){let e=this.state.loadingError.value;404===this.state.loadingError.code&&(e=r.default._t("AssetAdmin.FILE_MISSING","File cannot be found")),e||(e=r.default._t("Admin.UNKNOWN_ERROR","An unknown error has occurred")),l=s.default.createElement("div",{className:"editor__file-preview-message--file-missing"},e)}const a=r.default._t("Admin.ADD_TO_CAMPAIGN","Add to campaign"),u=this.props.loadingComponent;return s.default.createElement("div",{className:i},s.default.createElement("div",{className:"editor__details fill-height"},s.default.createElement(e,{identifier:"AssetAdmin.EditForm",schemaUrl:n,onSubmit:this.handleSubmit,onAction:this.handleAction,onLoadingSuccess:this.handleLoadingSuccess,onLoadingError:this.handleLoadingError,onFetchingSchema:this.handleFetchingSchema,createFn:this.createFn,file:this.state.file}),l,s.default.createElement(t,{title:a,identifier:"AssetAdmin.AddToCampaign",isOpen:this.state.openModal,onClosed:this.closeModal,schemaUrl:o,bodyClassName:"modal__dialog",responseClassBad:"modal__response modal__response--error",responseClassGood:"modal__response modal__response--good"}),this.state.loadingForm&&s.default.createElement(u,null)))}}t.Component=x,x.propTypes={className:c.default.string,fileId:c.default.number.isRequired,enableDropzone:c.default.bool,dialog:c.default.bool,onClose:c.default.func.isRequired,onSubmit:c.default.func.isRequired,schemaUrl:c.default.string.isRequired,schemaUrlQueries:c.default.arrayOf(c.default.shape({name:c.default.string,value:c.default.any})),addToCampaignSchemaUrl:c.default.string,actions:c.default.object,showingSubForm:c.default.bool,nextType:c.default.string,EditorHeaderComponent:c.default.oneOfType([c.default.object,c.default.func]),FormBuilderLoaderComponent:c.default.oneOfType([c.default.object,c.default.func]),FormBuilderModalComponent:c.default.oneOfType([c.default.object,c.default.func])},x.defaultProps={EditorHeaderComponent:C.default,FormBuilderLoaderComponent:a.default,FormBuilderModalComponent:u.default};t.default=(0,i.compose)((0,p.inject)(["Loading"],(e=>({loadingComponent:e})),(()=>"AssetAdmin.Editor")),(0,o.connect)((function(e){let{assetAdmin:{gallery:t,modal:n}}=e;return{enableDropzone:t.enableDropzone,nextType:n.formSchema&&n.formSchema.nextType,showingSubForm:n.formSchemaStack&&n.formSchemaStack.length>1}}),(function(e){return{actions:{unsavedForms:(0,i.bindActionCreators)(d,e),confirmDeletion:(0,i.bindActionCreators)(m,e),modal:(0,i.bindActionCreators)(g,e)}}})))(x)},1584:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.buttonStates=void 0;var r=u(n(1594)),o=u(n(5815)),i=u(n(551)),s=u(n(2164)),l=u(n(6935)),a=u(n(6923));function u(e){return e&&e.__esModule?e:{default:e}}const d=e=>t=>{t.preventDefault(),e&&e()},c="ALWAYS_BACK",p="ALWAYS_CANCEL",h="SWITCH",f="ONLY_BACK",m="ONLY_CANCEL",g=t.buttonStates={ALWAYS_BACK:c,ALWAYS_CANCEL:p,SWITCH:h,ONLY_BACK:f,ONLY_CANCEL:m,NONE:"NONE"},y=e=>{let{onCancel:t,onDetails:n,showButton:l,children:u}=e;const g=d(t),y=[c,h,f].indexOf(l)>=0,v=[p,h,m].indexOf(l)>=0,b=(0,a.default)("editor-header__back-button","btn--icon-xl",{"editor-header__back-button--md-below":[h,f].indexOf(l)>=0}),C=(0,a.default)("editor-header__cancel-button","btn--icon-xl",{"editor-header__cancel-button--lg-above":[h,m].indexOf(l)>=0});return r.default.createElement("div",{className:"editor-header"},y&&r.default.createElement(s.default,{className:b,onClick:g}),r.default.createElement("div",{className:"editor-header__field"},u),n&&r.default.createElement(i.default,{onClick:d(n),icon:"edit-list",className:"editor-header__edit",outline:!0},o.default._t("AssetAdmin.DETAILS","Details")),v&&r.default.createElement("div",null,r.default.createElement(i.default,{icon:"cancel",className:C,noText:!0,onClick:g},o.default._t("AssetAdmin.CANCEL"))))};y.propTypes={onCancel:l.default.func,onDetails:l.default.func,showButton:l.default.oneOf(Object.keys(g).map((e=>g[e]))),children:l.default.node};t.default=y},5789:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.galleryViewPropTypes=t.galleryViewDefaultProps=t.default=t.Component=void 0;var r=I(n(1669)),o=I(n(5815)),i=O(n(1594)),s=n(9040),l=n(9367),a=I(n(853)),u=I(n(3229)),d=I(n(2853)),c=I(n(6609)),p=I(n(6379)),h=I(n(6621)),f=O(n(4201)),m=O(n(8918)),g=O(n(1369)),y=O(n(4461)),v=n(4172),b=I(n(4350)),C=I(n(6177)),S=I(n(9247)),E=n(5207),_=I(n(6935)),w=I(n(5609)),x=I(n(5769)),F=I(n(3863));function A(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(A=function(e){return e?n:t})(e)}function O(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=A(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function I(e){return e&&e.__esModule?e:{default:e}}const D={DELETE:"delete",ARCHIVE:"archive",EDIT:"edit",MOVE:"move",PUBLISH:"publish",UNPUBLISH:"unpublish",INSERT:"insert",ADMIN:"admin",SELECT:"select"};class M extends i.Component{constructor(e){super(e),this.handleOpenFolder=this.handleOpenFolder.bind(this),this.handleOpenFile=this.handleOpenFile.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleAddedFile=this.handleAddedFile.bind(this),this.handlePreviewLoaded=this.handlePreviewLoaded.bind(this),this.handleCancelUpload=this.handleCancelUpload.bind(this),this.handleRemoveErroredUpload=this.handleRemoveErroredUpload.bind(this),this.handleUploadProgress=this.handleUploadProgress.bind(this),this.handleSending=this.handleSending.bind(this),this.handleSort=this.handleSort.bind(this),this.handleSetPage=this.handleSetPage.bind(this),this.handleSuccessfulUpload=this.handleSuccessfulUpload.bind(this),this.handleQueueComplete=this.handleQueueComplete.bind(this),this.handleFailedUpload=this.handleFailedUpload.bind(this),this.handleClearSearch=this.handleClearSearch.bind(this),this.handleEnableDropzone=this.handleEnableDropzone.bind(this),this.handleMoveFiles=this.handleMoveFiles.bind(this),this.handleBulkEdit=this.handleBulkEdit.bind(this),this.handleBulkPublish=this.handleBulkPublish.bind(this),this.handleBulkUnpublish=this.handleBulkUnpublish.bind(this),this.handleBulkMove=this.handleBulkMove.bind(this),this.handleBulkInsert=this.handleBulkInsert.bind(this),this.handleBeginSelection=this.handleBeginSelection.bind(this),this.handleGroupSelect=this.handleGroupSelect.bind(this),this.handleClearSelection=this.handleClearSelection.bind(this),this.handleSelectAll=this.handleSelectAll.bind(this),this.toggleSelectConcat=this.toggleSelectConcat.bind(this),this.getSelectableFiles=this.getSelectableFiles.bind(this)}componentDidMount(){this.initSortDropdown(),window.addEventListener("keydown",this.toggleSelectConcat),window.addEventListener("keyup",this.toggleSelectConcat)}componentDidUpdate(e){this.initSortDropdown(),this.initFlushUploadFiles(e)}componentWillUnmount(){window.removeEventListener("keydown",this.toggleSelectConcat),window.removeEventListener("keyup",this.toggleSelectConcat)}initFlushUploadFiles(e){if("tile"!==this.props.view){this.getSortElement().off("change")}e.folderId!==this.props.folderId&&this.props.actions.queuedFiles.purgeUploadQueue()}getSortElement(){return(0,r.default)(this.gallery).find(".gallery__sort .dropdown")}getSearchMessage(e){const t=[];e.name&&t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGEKEYWORDS","with keywords '{name}'")),e.lastEditedFrom&&e.lastEditedTo?t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGEEDITEDBETWEEN","last edited between '{lastEditedFrom}' and '{lastEditedTo}'")):e.lastEditedFrom?t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGEEDITEDFROM","last edited after '{lastEditedFrom}'")):e.lastEditedTo&&t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGEEDITEDTO","last edited before '{lastEditedTo}'")),e.appCategory&&t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGECATEGORY","categorised as '{appCategory}'")),e.currentFolderOnly&&this.props.folder.title&&t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGELIMIT","limited to the folder '{folder}'"));const n=[t.slice(0,-1).join(`${o.default._t("AssetAdmin.JOIN",",")} `),t.slice(-1)].filter((e=>e)).join(` ${o.default._t("AssetAdmin.JOINLAST","and")} `);if(""===n)return"";const r={parts:o.default.inject(n,Object.assign({folder:this.props.folder.title},e,{appCategory:e.appCategory?e.appCategory.toLowerCase():void 0}))};return o.default.inject(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGE","Search results {parts}"),r)}getSelection(e,t){const n=this.getSelectableFiles(),r=[e,t].map((e=>n.findIndex((t=>t.id===e)))).filter((e=>-1!==e)).sort(((e,t)=>e-t));if(2!==r.length)return r.map((e=>n[e].id));const[o,i]=r;return n.filter(((e,t)=>t>=o&&t<=i)).map((e=>e.id))}getSelectableFiles(){const e=this.props.files.filter((e=>e.id));return this.props.type===D.SELECT?e.filter((e=>"folder"!==e.type)):e}handleBulkInsert(e,t){this.props.onInsertMany(e,t)}handleBulkPublish(e,t){const n=t.map((e=>e.id));return n.length?(this.props.actions.gallery.setLoading(!0),this.props.onPublish(n).then((e=>{this.props.actions.gallery.setLoading(!1),this.props.actions.toasts.success(o.default.sprintf(o.default._t("AssetAdmin.BULK_ACTIONS_PUBLISH_SUCCESS","%s folders/files were successfully published."),e.length)),this.props.actions.gallery.deselectFiles()}))):(this.props.actions.gallery.deselectFiles(),Promise.resolve(!0))}handleBulkUnpublish(e,t){const n=t.filter((e=>e.published)).map((e=>e.id));return n.length?(this.props.actions.gallery.setLoading(!0),this.props.onUnpublish(n).then((e=>{this.props.actions.gallery.setLoading(!1),this.props.actions.toasts.success(o.default.sprintf(o.default._t("AssetAdmin.BULK_ACTIONS_UNPUBLISH_SUCCESS","%s folders/files were successfully unpublished."),e.length)),this.props.actions.gallery.deselectFiles()}))):(this.props.actions.gallery.deselectFiles(),Promise.resolve(!0))}initSortDropdown(){if("tile"===this.props.view){const e=this.getSortElement();e.chosen({allow_single_deselect:!0,disable_search_threshold:20}),e.off("change"),e.on("change",(()=>e.find(":selected")[0].click()))}}handleSort(e){this.props.actions.queuedFiles.purgeUploadQueue(),this.props.onSort(e)}handleSetPage(e){this.props.onSetPage(e)}handleCancelUpload(e){e.xhr.abort(),this.props.actions.queuedFiles.removeQueuedFile(e.queuedId)}handleRemoveErroredUpload(e){this.props.actions.queuedFiles.removeQueuedFile(e.queuedId)}handleAddedFile(e){this.props.actions.queuedFiles.addQueuedFile(e)}handlePreviewLoaded(e,t){this.props.actions.queuedFiles.updateQueuedFile(e.queuedId,t)}handleSending(e,t){this.props.actions.queuedFiles.updateQueuedFile(e._queuedId,{xhr:t})}handleUploadProgress(e,t){this.props.actions.queuedFiles.updateQueuedFile(e._queuedId,{progress:t})}handleSuccessfulUpload(e){const t=JSON.parse(e.xhr.response);if(void 0!==t[0].error)return void this.handleFailedUpload(e);this.props.actions.queuedFiles.succeedUpload(e._queuedId,t[0]),this.props.onSuccessfulUpload&&this.props.onSuccessfulUpload(t);const n=this.props.queuedFiles.items.reduce(((e,t)=>100!==t.progress?e+1:e),0);if(!this.props.fileId&&!this.props.selectedFiles.length&&0===n){const e=t.pop();this.props.onOpenFile(e.id)}}handleQueueComplete(){this.props.onSuccessfulUploadQueue&&this.props.onSuccessfulUploadQueue()}handleFailedUpload(e,t){const n=e.xhr&&e.xhr.status?(0,S.default)(e.xhr.status,e.xhr):"";this.props.actions.queuedFiles.failUpload(e._queuedId,t,n)}itemIsSelected(e){return this.props.selectedFiles.indexOf(e)>-1}toggleSelectConcat(e){this.props.actions.gallery.setConcatenateSelect(this.isConcat(e))}isConcat(e){return e.metaKey||e.ctrlKey||e.shiftKey}itemIsHighlighted(e){return this.props.fileId===e}hasOpenedItem(){return!!this.props.fileId}handleClearSearch(e){this.props.onClearSearch(e)}handleGroupSelect(e,t){const{setSelectedFiles:n,selectFiles:r}=this.props.actions.gallery,o=this.getSelectableFiles(),i=e.filter(((t,n)=>e.indexOf(t)===n&&o.find((e=>e.id===t)))),s=this.props.concatenateSelect||this.isConcat(t);if(null!==this.props.maxFilesSelect){let e=i.length;if(s){e=this.props.selectedFiles.filter((e=>!this.props.selectedFiles.includes(e))).concat(this.props.selectedFiles).length}if(e>=this.props.maxFilesSelect)return}s?r(i):n(i)}handleClearSelection(){this.props.actions.gallery.deselectFiles()}handleSelectAll(){const e=this.props.files.map((e=>e.id));this.handleGroupSelect(e,new Event("na"))}handleBeginSelection(e){let t=e.target;for(;t;){if(t.classList.contains("griddle-footer"))return!1;if(t.classList.contains("gallery__main--selectable"))break;t=t.parentNode}return!0}handleOpenFolder(e,t){e.preventDefault(),this.props.onOpenFolder(t.id)}handleOpenFile(e,t){e.preventDefault(),null!==t.created&&(this.props.selectedFiles.length&&1!==this.props.maxFilesSelect||this.props.type!==D.SELECT||this.handleSelect(e,t),this.props.onOpenFile(t.id,t))}handleSelect(e,t){const n=this.props.maxFilesSelect;let r=this.getSelectableFiles().filter((e=>e.id===t.id)).map((e=>e.id));if(1!==n)if(-1===this.props.selectedFiles.indexOf(t.id)){e.shiftKey&&(r=this.getSelection(this.props.lastSelected,t.id));if(this.props.selectedFiles.filter((e=>!r.includes(e))).concat(r).length>n&&null!==n)return;this.props.actions.gallery.selectFiles(r),this.props.actions.gallery.setLastSelected(t.id)}else this.props.actions.gallery.deselectFiles([t.id]),e.shiftKey&&this.props.actions.gallery.setLastSelected(null);else this.props.actions.gallery.setSelectedFiles(r)}handleEnableDropzone(e){this.props.actions.gallery.setEnableDropzone(e)}handleMoveFiles(e,t){const n=this.props.sectionConfig.endpoints.move.url;return w.default.post(n,{ids:t,folderID:e},{"X-SecurityID":C.default.get("SecurityID")}).then((()=>{const n=p.default.MOVE_SUCCESS_DURATION,r=`+${t.length}`;this.props.actions.gallery.setFileBadge(e,r,"success",n),"function"==typeof this.props.onMoveFilesSuccess&&this.props.onMoveFilesSuccess(e,t)})).catch((()=>{this.props.actions.toasts.error(o.default._t("AssetAdmin.FAILED_MOVE","There was an error moving the selected items."))}))}handleBulkEdit(e,t){this.handleOpenFile(e,t[0])}handleBulkMove(){this.props.actions.gallery.activateModal(p.default.MODAL_MOVE)}renderTransitionBulkActions(){return this.renderBulkActions()}renderBulkActions(){const{type:e,dialog:t,maxFilesSelect:n,files:r,selectedFiles:o,BulkActionsComponent:s,sectionConfig:l}=this.props,a=e===D.SELECT||t?e=>e.value===D.INSERT:e=>e.value!==D.INSERT,u=l.filesAreVersioned&&l.archiveFiles?e=>e.value!==D.DELETE:e=>e.value!==D.ARCHIVE,d=p.default.BULK_ACTIONS.filter(a).filter(u).map((e=>{if(e.callback)return e;switch(e.value){case D.DELETE:case D.ARCHIVE:return{...e,callback:(e,t)=>{this.props.actions.confirmDeletion.confirm(t)},confirm:void 0};case D.EDIT:return{...e,callback:this.handleBulkEdit};case D.MOVE:return{...e,callback:this.handleBulkMove};case D.PUBLISH:return{...e,callback:this.handleBulkPublish};case D.UNPUBLISH:return{...e,callback:this.handleBulkUnpublish};case D.INSERT:return{...e,callback:this.handleBulkInsert,color:"primary"};default:return e}})),c=o.map((e=>r.find((t=>t&&e===t.id)))).filter((e=>e));return c.length>0&&[D.ADMIN,D.SELECT].includes(e)?i.default.createElement(s,{actions:d,items:c,total:n,key:c.length>0,container:this.gallery,showCount:1!==n,onClearSelection:this.handleClearSelection,onSelectAll:this.handleSelectAll}):null}renderGalleryView(){const e="table"===this.props.view?c.default:d.default,t=this.props.files.map((e=>{const t=this.itemIsSelected(e.id),n=this.itemIsHighlighted(e.id),r=(e.queuedId?`queueId${e.queuedId}`:`id${e.id}`)+(t?"--selected":"");return{...e,selected:t,highlighted:n,key:r}})),{type:n,loading:r,dialog:o,page:s,totalCount:l,limit:a,sort:u,selectedFiles:p,badges:h,maxFilesSelect:f,sectionConfig:m}=this.props,g={selectableItems:n===D.SELECT||n===D.ADMIN&&(!f||f>1),selectableFolders:n!==D.SELECT&&!o,files:t,loading:r,page:s,totalCount:l,limit:a,sort:u,selectedFiles:p,badges:h,onSort:this.handleSort,onSetPage:this.handleSetPage,onOpenFile:this.handleOpenFile,onOpenFolder:this.handleOpenFolder,onSelect:this.handleSelect,onCancelUpload:this.handleCancelUpload,onDropFiles:this.handleMoveFiles,onRemoveErroredUpload:this.handleRemoveErroredUpload,onEnableDropzone:this.handleEnableDropzone,sectionConfig:m,canDrag:n===D.ADMIN,maxFilesSelect:f};return i.default.createElement(e,g)}renderToolbar(){const{GalleryToolbar:e,sort:t,view:n,folder:r,onCreateFolder:o,onOpenFolder:s,onViewChange:l}=this.props,a={onMoveFiles:this.handleMoveFiles,onSort:this.handleSort,onCreateFolder:o,onOpenFolder:s,onViewChange:l,view:n,sort:t,folder:r};return i.default.createElement(e,a)}render(){const{folder:e,loading:t,errorMessage:n,noticeMessage:r}=this.props,s=this.props.LoadingComponent;if(!e)return n?i.default.createElement("div",{className:"gallery__error flexbox-area-grow"},i.default.createElement("div",{className:"gallery__error-message"},i.default.createElement("h3",null,o.default._t("AssetAdmin.DROPZONE_RESPONSE_ERROR","Server responded with an error.")),n&&i.default.createElement("p",null,n))):t?i.default.createElement("div",{className:"flexbox-area-grow"},i.default.createElement(s,null)):i.default.createElement("div",{className:"flexbox-area-grow"},i.default.createElement("div",{className:"editor__file-preview-message--file-missing m-t-3"},o.default._t("Admin.UNKNOWN_ERROR","An unknown error has occurred")));const l=i.default.createElement("div",{className:"gallery_messages"},n&&i.default.createElement(h.default,{value:n,type:"danger"}),r&&i.default.createElement(h.default,{value:r,type:"success"})),u={height:p.default.THUMBNAIL_HEIGHT,width:p.default.THUMBNAIL_WIDTH},d={url:this.props.createFileApiUrl,method:this.props.createFileApiMethod,paramName:"Upload",clickable:"#upload-button",...this.props.sectionConfig.dropzoneOptions},c=this.props.securityId,f=this.props.folder.canEdit&&this.props.enableDropzone,m=["panel","panel--padded","panel--scrollable","gallery__main","fill-height"];this.props.type===D.INSERT&&m.push("insert-media-modal__main");const g=m;return this.hasOpenedItem()&&g.push("gallery__main--has-opened-item"),i.default.createElement("div",{className:"flexbox-area-grow gallery__outer",ref:e=>{this.gallery=e}},this.renderTransitionBulkActions(),i.default.createElement(F.default,{className:m.join(" ")},this.renderToolbar(),i.default.createElement(v.SelectableGroup,{enabled:"tile"===this.props.view&&this.props.type===D.ADMIN,className:"flexbox-area-grow fill-height gallery__main--selectable",onSelection:this.handleGroupSelect,onNonItemClick:this.handleClearSelection,onBeginSelection:this.handleBeginSelection,preventDefault:!1,fixedPosition:!0},i.default.createElement(a.default,{name:"gallery-container",className:"flexbox-area-grow",canUpload:f,onAddedFile:this.handleAddedFile,onPreviewLoaded:this.handlePreviewLoaded,onError:this.handleFailedUpload,onSuccess:this.handleSuccessfulUpload,onQueueComplete:this.handleQueueComplete,onSending:this.handleSending,onUploadProgress:this.handleUploadProgress,preview:u,folderId:this.props.folderId,options:d,securityID:c,uploadButton:!1},l,this.renderGalleryView()))),this.props.loading&&i.default.createElement(s,null),i.default.createElement(x.default,{sectionConfig:this.props.sectionConfig,folderId:this.props.folderId,onSuccess:this.props.onMoveFilesSuccess,onOpenFolder:this.props.onOpenFolder}))}}t.Component=M;const N={page:1,limit:15},R={sectionConfig:b.default,loading:_.default.bool,sort:_.default.string,files:_.default.arrayOf(_.default.shape({id:_.default.number,parent:_.default.shape({id:_.default.number})})).isRequired,selectedFiles:_.default.arrayOf(_.default.number),totalCount:_.default.number,page:_.default.number,limit:_.default.number,badges:_.default.arrayOf(_.default.shape({id:_.default.number,message:_.default.node,status:_.default.string})),onOpenFile:_.default.func.isRequired,onOpenFolder:_.default.func.isRequired,onSort:_.default.func.isRequired,onSetPage:_.default.func.isRequired,maxFilesSelect:_.default.number};t.galleryViewDefaultProps=Object.assign({},N,{selectableItems:!1}),t.galleryViewPropTypes=Object.assign({},R,{selectableItems:_.default.bool,selectableFolders:_.default.bool,onSelect:_.default.func,onCancelUpload:_.default.func,onRemoveErroredUpload:_.default.func,onEnableDropzone:_.default.func});M.defaultProps=Object.assign({},N,{type:D.ADMIN,view:"tile",enableDropzone:!0,dialog:!1,BulkActionsComponent:u.default}),M.propTypes=Object.assign({},R,{onSuccessfulUpload:_.default.func,onSuccessfulUploadQueue:_.default.func,onCreateFolder:_.default.func,onMoveFilesSuccess:_.default.func,onPublish:_.default.func,onUnpublish:_.default.func,type:_.default.oneOf(["insert-media","insert-link",D.SELECT,D.ADMIN]),view:_.default.oneOf(["tile","table"]),lastSelected:_.default.number,dialog:_.default.bool,fileId:_.default.number,folderId:_.default.number.isRequired,folder:_.default.shape({id:_.default.number,title:_.default.string,parentId:_.default.number,canView:_.default.bool,canEdit:_.default.bool}),files:_.default.array,errorMessage:_.default.string,actions:_.default.object,securityId:_.default.string,onViewChange:_.default.func.isRequired,createFileApiUrl:_.default.string,createFileApiMethod:_.default.string,search:_.default.object,enableDropzone:_.default.bool,concatenateSelect:_.default.bool,GalleryToolbar:_.default.elementType,sorters:_.default.arrayOf(_.default.shape({field:_.default.string.isRequired,direction:_.default.oneOf(["asc","desc"]).isRequired,label:_.default.string.isRequired})).isRequired,BulkActionsComponent:_.default.oneOfType([_.default.object,_.default.func])});t.default=(0,l.compose)((0,E.inject)(["GalleryToolbar","Loading"],((e,t)=>({GalleryToolbar:e,LoadingComponent:t})),(()=>"AssetAdmin.Gallery")),(0,s.connect)((function(e,t){let{sort:n}=t;const{selectedFiles:r,errorMessage:o,noticeMessage:i,enableDropzone:s,badges:l,concatenateSelect:a,loading:u,sorters:d,lastSelected:c}=e.assetAdmin.gallery;return!n&&d&&d[0]&&(n=`${d[0].field},${d[0].direction}`),{lastSelected:c,selectedFiles:r,errorMessage:o,noticeMessage:i,enableDropzone:s,badges:l,concatenateSelect:a,loading:t.loading||u,queuedFiles:e.assetAdmin.queuedFiles,securityId:e.config.SecurityID,sorters:d,sort:n}}),(function(e){return{actions:{gallery:(0,l.bindActionCreators)(f,e),toasts:(0,l.bindActionCreators)(m,e),queuedFiles:(0,l.bindActionCreators)(g,e),confirmDeletion:(0,l.bindActionCreators)(y,e)}}})))(M)},3863:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=a(n(6923)),i=a(n(2914)),s=a(n(6935)),l=a(n(5799));function a(e){return e&&e.__esModule?e:{default:e}}function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}class d extends r.Component{constructor(e){super(e),this.state={dragging:!1},this.mounted=!1,this.handleDrop=this.handleDrop.bind(this)}componentDidMount(){this.mounted=!0,window.addEventListener("drop",this.handleDrop,!0)}componentDidUpdate(){setTimeout((()=>{if(!this.mounted||!this.context.dragDropManager)return;const e=this.context.dragDropManager.monitor.isDragging();this.state.dragging!==e&&this.setState({dragging:e})}))}componentWillUnmount(){this.mounted=!1,window.removeEventListener("drop",this.handleDrop,!0)}handleDrop(){const e=this.context.dragDropManager,t=e&&e.backend;t&&t.isDraggingNativeItem()&&t.endDragNativeItem()}render(){const{className:e,children:t}=this.props;return r.default.createElement("div",{className:(0,o.default)(e,{"gallery__main--dragging":this.state.dragging})},t,r.default.createElement(i.default,null))}}d.contextTypes={dragDropManager:s.default.object},d.propTypes={className:s.default.string,children:s.default.oneOfType([s.default.arrayOf(s.default.node),s.default.node])};t.default=(0,l.default)(d)},6931:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=b(n(5815)),o=v(n(1594)),i=n(9367),s=n(9040),l=b(n(7917)),a=b(n(2908)),u=b(n(1957)),d=v(n(4201)),c=v(n(1021)),p=b(n(8737)),h=b(n(6923)),f=b(n(6935)),m=b(n(8268)),g=b(n(7675));function y(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(y=function(e){return e?n:t})(e)}function v(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=y(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function b(e){return e&&e.__esModule?e:{default:e}}class C extends o.Component{constructor(e){super(e),this.handleSubmit=this.handleSubmit.bind(this)}componentDidMount(){const{isOpen:e,onBrowse:t,setOverrides:n,fileAttributes:r,folderId:o}=this.props;e?"function"==typeof n&&r.ID&&(n(this.props),t(o,r.ID)):t(o||0)}componentDidUpdate(e){!this.props.isOpen&&e.isOpen&&(this.props.onBrowse(this.props.folderId),this.props.actions.gallery.deselectFiles()),"function"==typeof e.setOverrides&&this.props.isOpen&&!e.isOpen&&(e.setOverrides(this.props),this.props.onBrowse(this.props.folderId,this.props.fileAttributes?this.props.fileAttributes.ID:null))}getSectionProps(){return{...this.props,dialog:!0,toolbarChildren:this.renderToolbarChildren(),onSubmitEditor:this.handleSubmit,onReplaceUrl:this.props.onBrowse}}getModalProps(){const{onHide:e,onInsert:t,sectionConfig:n,schemaUrl:r,className:o,...i}=this.props;return{...i,className:(0,h.default)("insert-media-modal",o),size:"lg",showCloseButton:!1}}handleSubmit(e,t,n,r){return"action_insert"===t?this.props.onInsert(e,r):n()}renderToolbarChildren(){return o.default.createElement("button",{type:"button",className:"close modal__close-button insert-media-modal__close-button",onClick:this.props.onClosed,"aria-label":r.default._t("FormBuilderModal.CLOSE","Close")},o.default.createElement("span",{"aria-hidden":"true"},"×"))}render(){const e=this.getModalProps(),t=this.getSectionProps(),n=this.props.isOpen?o.default.createElement(l.default,t):null;return o.default.createElement(p.default,e,n)}}t.Component=C,C.propTypes={sectionConfig:f.default.shape({url:f.default.string,form:f.default.object}),type:f.default.oneOf(["insert-media","insert-link","select","admin"]),schemaUrl:f.default.string,isOpen:f.default.bool,setOverrides:f.default.func,onInsert:f.default.func.isRequired,fileAttributes:f.default.shape({ID:f.default.number,AltText:f.default.string,Width:f.default.number,Height:f.default.number,Loading:f.default.string,TitleTooltip:f.default.string,Alignment:f.default.string,Description:f.default.string,TargetBlank:f.default.bool}),requireLinkText:f.default.bool,folderId:f.default.number,fileId:f.default.number,viewAction:f.default.string,query:f.default.object,getUrl:f.default.func,onBrowse:f.default.func.isRequired,onClosed:f.default.func,className:f.default.string,actions:f.default.object,maxFiles:f.default.number,fileSelected:f.default.bool},C.defaultProps={className:"",fileAttributes:{},type:"insert-media",folderId:0,maxFiles:1};t.default=(0,i.compose)(a.default,(0,s.connect)((function(e,t){const n=t.sectionConfig;if(!n)return{};let r=0;null!==t.folderId?r=t.folderId:t.folder&&(r=t.folder.id);const o=t.fileAttributes?t.fileAttributes.ID:t.fileId,i=e.assetAdmin.modal.formSchema,s={config:n,viewAction:t.viewAction,folderId:r,type:i&&i.type,fileId:o},{schemaUrl:l,targetId:a}=(0,m.default)(s);if(!l)return{};const u={};t.requireLinkText&&(u.requireLinkText=!0),t.fileSelected&&(u.fileSelected=!0);let d=g.default.stringify(u);return d=d?`?${d}`:"",{schemaUrl:`${l}/${a}${d}`,type:i&&i.type}}),(function(e){return{actions:{gallery:(0,i.bindActionCreators)(d,e),modal:(0,i.bindActionCreators)(c,e)}}})),u.default)(C)},5769:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=m(n(1594)),o=n(9040),i=n(9367),s=m(n(5815)),l=m(n(6379)),a=m(n(6935)),u=n(4201),d=n(8918),c=m(n(8737)),p=m(n(4350)),h=m(n(6177)),f=m(n(5609));function m(e){return e&&e.__esModule?e:{default:e}}class g extends r.default.Component{constructor(e){super(e),this.handleSubmit=this.handleSubmit.bind(this),this.timeout=null}handleSubmit(e){let{FolderID:t}=e;const{selectedFiles:n,onSuccess:r,onClosed:o,setNotice:i,setError:a,setBadge:u}=this.props;let d=this.props.sectionConfig.endpoints.move.url;return f.default.post(d,{ids:n,folderID:t},{"X-SecurityID":h.default.get("SecurityID")}).then((()=>(d=`${this.props.sectionConfig.endpoints.read.url}/${t}`,f.default.get(d)))).then((e=>e.json())).then((e=>{"function"==typeof r&&r(e.id,n),u(e.id,`${n.length}`,"success",l.default.MOVE_SUCCESS_DURATION),i(s.default.sprintf(s.default._t("AssetAdmin.MOVED_ITEMS_TO","Moved %s item(s) to %s"),n.length,e.name),[{label:s.default._t("AssetAdmin.GO_TO_FOLDER","Go to folder"),onClick:()=>this.props.onOpenFolder(e.id)}]),o()})).catch((()=>{a(s.default._t("AssetAdmin.FAILED_MOVE","There was an error moving the selected items."))}))}render(){const{isOpen:e,onClosed:t,title:n,folderId:o,sectionConfig:i}=this.props,{schemaUrl:s}=i.form.moveForm;return r.default.createElement(c.default,{title:n,isOpen:e,onClosed:t,onSubmit:this.handleSubmit,identifier:"AssetAdmin.MoveForm",schemaUrl:`${s}/${o}`})}}g.propTypes={sectionConfig:p.default,folderId:a.default.number.isRequired,isOpen:a.default.bool,onClosed:a.default.func,setNotice:a.default.func,setBadge:a.default.func,setError:a.default.func,title:a.default.string,onSuccess:a.default.func,onOpenFolder:a.default.func.isRequired,selectedFiles:a.default.array.isRequired},g.defaultProps={isOpen:!1};t.default=(0,i.compose)((0,o.connect)((function(e){const{modal:t,selectedFiles:n}=e.assetAdmin.gallery;return{isOpen:t===l.default.MODAL_MOVE,selectedFiles:n,title:s.default.sprintf(s.default._t("AssetAdmin.MOVE_ITEMS_TO","Move %s item(s) to..."),n.length)}}),(function(e){return{onClosed(){e((0,u.deactivateModal)())},setNotice(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];e((0,d.display)({text:t,type:"success",actions:n}))},setError(t){e((0,d.display)({text:t,type:"error"}))},setBadge(){e((0,u.setFileBadge)(...arguments))}}})))(g)},6609:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=h(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=p(n(6935)),i=p(n(9888)),s=p(n(5815)),l=p(n(1990)),a=n(5789),u=n(5716),d=n(5207),c=n(9367);function p(e){return e&&e.__esModule?e:{default:e}}function h(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(h=function(e){return e?n:t})(e)}class f extends r.Component{constructor(e){super(e),this.getColumns=this.getColumns.bind(this),this.handleSort=this.handleSort.bind(this),this.handleSetPage=this.handleSetPage.bind(this),this.handleRowClick=this.handleRowClick.bind(this),this.renderSelect=this.renderSelect.bind(this),this.renderTitle=this.renderTitle.bind(this),this.renderStatus=this.renderStatus.bind(this),this.renderNoItemsNotice=this.renderNoItemsNotice.bind(this)}getColumns(){const e=["thumbnail","title","status","size","lastEdited"];return this.props.selectableItems&&e.unshift("selected"),e}getColumnConfig(){return[{columnName:"selected",sortable:!1,displayName:"",cssClassName:"gallery__table-column--select",customComponent:this.renderSelect},{columnName:"thumbnail",sortable:!1,displayName:"",cssClassName:"gallery__table-column--image",customComponent:this.renderThumbnail},{columnName:"title",customCompareFn:()=>0,displayName:s.default._t("File.TITLE","Title"),cssClassName:"gallery__table-column--title",customComponent:this.renderTitle},{columnName:"status",sortable:!1,cssClassName:"sort--disabled",customComponent:this.renderStatus,displayName:s.default._t("File.STATUS","Status")},{columnName:"lastEdited",displayName:s.default._t("File.MODIFIED","Modified"),customComponent:this.renderDate},{columnName:"size",sortable:!1,displayName:s.default._t("File.SIZE","Size"),cssClassName:"sort--disabled",customComponent:this.renderSize}]}getRowMetadata(e){return"gallery__table-row "+(e.highlighted?"gallery__table-row--highlighted":"")}getTableProps(){const[e,t]=this.props.sort.split(",");return{tableClassName:"gallery__table table table-hover",gridClassName:"gallery__main-view--table",rowMetadata:{bodyCssClassName:this.getRowMetadata,key:"key"},sortAscendingComponent:"",sortDescendingComponent:"",useExternal:!0,externalSetPage:this.handleSetPage,externalChangeSort:this.handleSort,externalSetFilter:()=>null,externalSetPageSize:()=>null,externalCurrentPage:this.props.page-1,externalMaxPage:Math.ceil(this.props.totalCount/this.props.limit),externalSortColumn:e,externalSortAscending:"asc"===t,initialSort:e,columns:this.getColumns(),columnMetadata:this.getColumnConfig(),useGriddleStyles:!1,onRowClick:this.handleRowClick,results:this.props.files,customNoDataComponent:this.renderNoItemsNotice}}handleActivate(e,t){"folder"===t.type?this.props.onOpenFolder(e,t):this.props.onOpenFile(e,t)}handleRowClick(e,t){const n=e.props.data;t.currentTarget.classList.contains("gallery__table-column--select")&&(t.stopPropagation(),t.preventDefault(),"function"==typeof this.props.onSelect)?this.props.onSelect(t,n):this.handleActivate(t,n)}handleSort(e,t){const n=t?"asc":"desc";this.props.onSort(`${e},${n}`)}handleSetPage(e){this.props.onSetPage(e+1)}preventFocus(e){e.preventDefault()}renderNoItemsNotice(){return 0!==this.props.files.length||this.props.loading?null:r.default.createElement("p",{className:"gallery__no-item-notice"},s.default._t("AssetAdmin.NOITEMSFOUND"))}renderSize(e){if("folder"===e.rowData.type)return null;const t=(0,u.fileSize)(e.data);return r.default.createElement("span",null,t)}renderStatus(e){let t=[];const n=e.rowData,{VersionedBadge:o}=this.props;return"folder"!==n.type&&(n.draft?t.push({key:"status-draft",status:"draft"}):n.modified&&t.push({key:"status-modified",status:"modified"})),t=t.map((e=>{let{...t}=e;return r.default.createElement(o,t)})),t?r.default.createElement("span",null,t):null}renderProgressBar(e){if(!e.queuedId||e.message&&"error"===e.message.type)return null;if(e.id>0)return r.default.createElement("div",{className:"gallery__progress-bar--complete"});const t={className:"gallery__progress-bar-progress",style:{width:`${e.progress}%`}};return r.default.createElement("div",{className:"gallery__progress-bar"},r.default.createElement("div",t))}renderRestrictedAccess(e){const{hasRestrictedAccess:t}=e,n={fileID:e.id,placement:"top",hasRestrictedAccess:t};return r.default.createElement(l.default,n)}renderTrackedFormUpload(e){const{isTrackedFormUpload:t,hasRestrictedAccess:n}=e,o={fileID:e.id,placement:"top",isTrackedFormUpload:t,hasRestrictedAccess:n};return r.default.createElement(l.default,o)}renderTitle(e){const t=this.renderProgressBar(e.rowData);return r.default.createElement("div",{className:"fill-width"},r.default.createElement("div",{className:"flexbox-area-grow"},r.default.createElement("span",null,e.data),e.rowData.hasRestrictedAccess&&this.renderRestrictedAccess(e.rowData),e.rowData.isTrackedFormUpload&&this.renderTrackedFormUpload(e.rowData)),t)}renderSelect(e){if(this.props.selectableItems&&(this.props.selectableFolders||"folder"!==e.rowData.type)){const t={type:"checkbox",title:s.default._t("AssetAdmin.SELECT"),defaultChecked:e.data,tabIndex:-1,onMouseDown:this.preventFocus};return![null,1].includes(this.props.maxFilesSelect)&&this.props.selectedFiles.length>=this.props.maxFilesSelect&&!e.data&&(t.disabled=!0),r.default.createElement("input",t)}return null}renderDate(e){return"folder"===e.rowData.type?null:(moment.locale(s.default.detectLocale()),r.default.createElement("span",null,moment(e.data).format("L LT")))}renderThumbnail(e){const t=e.data||e.rowData.url,n=e.rowData.queuedId&&!e.rowData.id,o=e.rowData.category||"false",i="gallery__table-image",s=[i],l={};return s.push(`${i}--${o}`),"image"===o&&t&&(l.backgroundImage=`url("${t}")`),n||t||"folder"===o||s.push(`${i}--error`),r.default.createElement("div",{className:s.join(" "),style:l})}render(){return r.default.createElement(i.default,this.getTableProps())}}t.Component=f,f.defaultProps=a.galleryViewDefaultProps,f.propTypes={...a.galleryViewPropTypes,sort:o.default.string.isRequired,VersionedBadge:o.default.elementType};t.default=(0,c.compose)((0,d.inject)(["VersionedBadge"],(e=>({VersionedBadge:e}))))(f)},2853:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=d(n(5815)),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=n(5207),s=n(5789),l=d(n(9888)),a=d(n(6935));function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}function d(e){return e&&e.__esModule?e:{default:e}}class c extends o.Component{constructor(e){super(e),this.renderItem=this.renderItem.bind(this),this.handleSetPage=this.handleSetPage.bind(this),this.handlePrevPage=this.handlePrevPage.bind(this),this.handleNextPage=this.handleNextPage.bind(this),this.handleDrag=this.handleDrag.bind(this)}handleDrag(e){this.props.onEnableDropzone(!e)}handleSetPage(e){this.props.onSetPage(e+1)}handleNextPage(){const e=this.props.page-1;this.handleSetPage(e+1)}handlePrevPage(){const e=this.props.page-1;0!==e?this.handleSetPage(e-1):this.handleSetPage(e)}folderFilter(e){return"folder"===e.type}fileFilter(e){return"folder"!==e.type}renderPagination(){if(this.props.totalCount<=this.props.limit)return null;const e={setPage:this.handleSetPage,maxPage:Math.ceil(this.props.totalCount/this.props.limit),next:this.handleNextPage,nextText:r.default._t("AssetAdmin.NEXT","Next"),previous:this.handlePrevPage,previousText:r.default._t("AssetAdmin.PREVIOUS","Previous"),currentPage:this.props.page-1,useGriddleStyles:!1};return o.default.createElement("div",{className:"griddle-footer"},o.default.createElement(l.default.GridPagination,e))}renderItem(e){const{File:t,Folder:n,badges:r,sectionConfig:i,selectedFiles:s,selectableItems:l,selectableFolders:a}=this.props,u=r.find((t=>t.id===e.id));let d={sectionConfig:i,key:e.key,selectableKey:e.id,item:e,selectedFiles:s,onDrag:this.handleDrag,badge:u,canDrag:this.props.canDrag};if(e.queuedId&&!e.id){const{onCancelUpload:e,onRemoveErroredUpload:t}=this.props;d={...d,onCancelUpload:e,onRemoveErroredUpload:t}}else{const{onOpenFolder:t,onOpenFile:n}=this.props;d={...d,onActivate:"folder"===e.type?t:n}}if(l&&(a||"folder"!==e.type)){const e=![null,1].includes(this.props.maxFilesSelect)&&this.props.selectedFiles.length>=this.props.maxFilesSelect,t=1===this.props.maxFilesSelect?d.onActivate:this.props.onSelect;d={...d,selectable:!0,onSelect:t,maxSelected:e}}if("folder"===e.type){const{onDropFiles:e}=this.props;return d={...d,onDropFiles:e},o.default.createElement(n,d)}return o.default.createElement(t,d)}render(){return o.default.createElement("div",{className:"gallery__main-view--tile"},o.default.createElement("div",{className:"gallery__folders"},this.props.files.filter(this.folderFilter).map(this.renderItem)),o.default.createElement("div",{className:"gallery__files"},this.props.files.filter(this.fileFilter).map(this.renderItem)),0===this.props.files.length&&!this.props.loading&&o.default.createElement("p",{className:"gallery__no-item-notice"},r.default._t("AssetAdmin.NOITEMSFOUND")),o.default.createElement("div",{className:"gallery__load"},this.renderPagination()))}}t.Component=c,c.defaultProps=s.galleryViewDefaultProps,c.propTypes={...s.galleryViewPropTypes,File:a.default.elementType.isRequired,Folder:a.default.elementType.isRequired};const p=(0,i.inject)(["GalleryItemFile","GalleryItemFolder"],((e,t)=>({File:e,Folder:t})),(()=>"AssetAdmin.Gallery.ThumbnailView"));t.default=p(c)},2499:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.imageSizePresetButtons=function(e,t){return t.map((t=>function(e,t){const{name:n,width:r,text:o}=t,i=`ssmedia${n}`;e.on("init",(()=>{e.formatter.register(i,{selector:"img",attributes:{width:r?r.toString():""}})}));const s=()=>{let t=e.selection.getNode();return"IMG"!==t.tagName&&t.children.item("img")&&(t=t.children.item("img")),t&&"IMG"===t.tagName?t:void 0},l=e=>{const t=s();e.disabled(!(!t||!r)&&t.naturalWidth{if(e.formatter.match(i))return!0;const t=s();if(!r&&t){const e=t.getAttribute("width");return!e||e.toString()===t.naturalWidth.toString()}return!1},u=t=>{const n=t.target,o=()=>{n.active(a())};if(e.on("NodeChange",(()=>{l(n),o()})),l(n),e.formatter&&(e.formatter.formatChanged(i,o),a())){e.formatter.apply(i);const t=s();t&&t.setAttribute("width",r||t.naturalWidth)}},d=()=>{const t=s();t&&(t.removeAttribute("height"),t.removeAttribute("width"),e.formatter.apply(i),r?t.setAttribute("height",t.clientHeight):(t.setAttribute("width",t.naturalWidth),t.setAttribute("height",t.naturalHeight)))};return e.ui.registry.addButton(i,{text:o,onAction:d,onPostRender:u}),i}(e,t)))}},4350:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o=(r=n(6935))&&r.__esModule?r:{default:r};const i=o.default.shape({url:o.default.string,limit:o.default.number,imageRetry:o.default.shape({minRetry:o.default.number,maxRetry:o.default.number,expiry:o.default.number}),form:o.default.object,dropzoneOptions:o.default.object});t.default=i},6022:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o=(r=n(6935))&&r.__esModule?r:{default:r};const i=o.default.shape({canEdit:o.default.bool,canDelete:o.default.bool,canView:o.default.bool,exists:o.default.bool,type:o.default.string,smallThumbnail:o.default.string,thumbnail:o.default.string,width:o.default.number,height:o.default.number,category:o.default.oneOfType([o.default.bool,o.default.string]),id:o.default.number,url:o.default.string,title:o.default.string,progress:o.default.number,visibility:o.default.string,hasRestrictedAccess:o.default.bool,isTrackedFormUpload:o.default.bool});t.default=i},8268:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){let{config:{form:t},viewAction:n,folderId:r,fileId:o,type:l}=e,a=null,u=null;if(n===i)return a=t.folderCreateForm.schemaUrl,u=r,{schemaUrl:a,targetId:u};if(n===s&&o){switch(l){case"insert-media":a=t.fileInsertForm.schemaUrl;break;case"insert-link":a=t.fileEditorLinkForm.schemaUrl;break;case"select":a=t.fileSelectForm.schemaUrl;break;default:a=t.fileEditForm.schemaUrl}return u=o,{schemaUrl:a,targetId:u}}return{}};var r,o=(r=n(6379))&&r.__esModule?r:{default:r};const{CREATE_FOLDER:i,EDIT_FILE:s}=o.default.ACTIONS},9247:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(413===e)return o.default._t("AssetAdmin.ERROR_FILE_SIZE","File size limit exceeded");if(403===e&&t&&"string"==typeof t.response)return t.response;return o.default._t("AssetAdmin.ERROR_DEFAULT","Something went wrong, please try again")};var r,o=(r=n(5815))&&r.__esModule?r:{default:r}},6405:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={CONFIRM_DELETION_ASK:"CONFIRM_DELETION_ASK",CONFIRM_DELETION_CONFIRM:"CONFIRM_DELETION_CONFIRM",CONFIRM_DELETION_CANCEL:"CONFIRM_DELETION_CANCEL",CONFIRM_DELETION_RESET:"CONFIRM_DELETION_RESET",CONFIRM_DELETION_MODAL_CLOSE:"CONFIRM_DELETION_MODAL_CLOSE"}},4461:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cancel=function(){return{type:o.default.CONFIRM_DELETION_CANCEL,payload:{}}},t.confirm=function(e){return{type:o.default.CONFIRM_DELETION_ASK,payload:{files:e}}},t.deleting=function(){return{type:o.default.CONFIRM_DELETION_CONFIRM,payload:{}}},t.modalClose=function(){return{type:o.default.CONFIRM_DELETION_MODAL_CLOSE,payload:{}}},t.reset=function(){return{type:o.default.CONFIRM_DELETION_RESET,payload:{}}};var r,o=(r=n(6405))&&r.__esModule?r:{default:r}},762:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NO_TRANSITION=t.DELETING=t.CANCELING=void 0;t.NO_TRANSITION=!1,t.CANCELING="canceling",t.DELETING="deleting"},6533:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={TOGGLE_SEARCH:"TOGGLE_SEARCH",OPEN_SEARCH:"OPEN_SEARCH",CLOSE_SEARCH:"CLOSE_SEARCH"}},9517:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.closeSearch=function(){return{type:o.default.CLOSE_SEARCH,payload:null}},t.openSearch=function(){return{type:o.default.OPEN_SEARCH,payload:null}},t.toggleSearch=function(){return{type:o.default.TOGGLE_SEARCH,payload:null}};var r,o=(r=n(6533))&&r.__esModule?r:{default:r}},4913:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=["SET_LAST_SELECTED","SET_SELECTED_FILES","DESELECT_FILES","SELECT_FILES","LOAD_FILE_REQUEST","LOAD_FILE_SUCCESS","HIGHLIGHT_FILES","UPDATE_BATCH_ACTIONS","SET_NOTICE_MESSAGE","SET_ERROR_MESSAGE","SET_ENABLE_DROPZONE","SET_FILE_BADGE","CLEAR_FILE_BADGE","ACTIVATE_MODAL","DEACTIVATE_MODAL","CONCATENATE_SELECT","SET_LOADING"].reduce(((e,t)=>Object.assign(e,{[t]:`GALLERY.${t}`})),{})},4201:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.activateModal=function(e){return t=>{t({type:o.default.ACTIVATE_MODAL,payload:e})}},t.clearFileBadge=i,t.deactivateModal=function(){return e=>{e({type:o.default.DEACTIVATE_MODAL})}},t.deselectFiles=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return t=>t({type:o.default.DESELECT_FILES,payload:{ids:e}})},t.loadFile=function(e,t){return n=>{n({type:o.default.LOAD_FILE_SUCCESS,payload:{id:e,file:t}})}},t.selectFiles=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return t=>t({type:o.default.SELECT_FILES,payload:{ids:e}})},t.setConcatenateSelect=function(e){return t=>t({type:o.default.CONCATENATE_SELECT,payload:!!e})},t.setEnableDropzone=function(e){return t=>t({type:o.default.SET_ENABLE_DROPZONE,payload:{enableDropzone:e}})},t.setErrorMessage=function(e){return t=>t({type:o.default.SET_ERROR_MESSAGE,payload:{message:e}})},t.setFileBadge=function(e,t,n,r){return(s,l)=>{const{assetAdmin:a}=l(),u=a.gallery.badges.find((t=>t.id===e));u&&u.timer&&clearTimeout(u.timer);const d=r>0?setTimeout((()=>i(e)(s)),r):null;s({type:o.default.SET_FILE_BADGE,payload:{id:e,message:t,status:n,timer:d}})}},t.setLastSelected=function(e){return t=>{t({type:o.default.SET_LAST_SELECTED,payload:{id:e}})}},t.setLoading=function(e){return t=>{t({type:o.default.SET_LOADING,payload:!!e})}},t.setNoticeMessage=function(e){return t=>t({type:o.default.SET_NOTICE_MESSAGE,payload:{message:e}})},t.setSelectedFiles=function(e){return t=>{t({type:o.default.SET_SELECTED_FILES,payload:{files:e}})}};var r,o=(r=n(4913))&&r.__esModule?r:{default:r};function i(e){return t=>{t({type:o.default.CLEAR_FILE_BADGE,payload:{id:e}})}}},423:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultImageFactory=t.default=void 0;var r=i(n(1838)),o=i(n(8632));function i(e){return e&&e.__esModule?e:{default:e}}const s={minRetry:0,maxRetry:0,expiry:0,onStatusChange:()=>null,onRetry:()=>null,onReset:()=>null,onTimeout:()=>null},l=(e,t,n)=>{const r=new Image;r.onload=t,r.onerror=n,r.src=e};t.defaultImageFactory=l;t.default=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;this.options={...s,...e},this.factory=t}loadImage(e){return this.options.minRetry&&o.default.lock(e)?this.loadImageLoop(e,this.options.minRetry):null}loadImageLoop(e,t){return this.options.onStatusChange(e,r.default.LOADING),new Promise(((t,n)=>this.factory(e,t,n))).then((()=>this.handleSuccess(e))).catch((()=>this.handleError(e,t)))}handleReset(e,t){this.options.onReset(e),t()}handleTimeout(e,t){const n=setTimeout(e,t);return this.options.onTimeout(n,t),n}handleSuccess(e){o.default.unlock(e),this.options.onStatusChange(e,r.default.SUCCESS)}handleFailure(e){return o.default.unlock(e),this.options.onStatusChange(e,r.default.FAILED),this.options.expiry?new Promise((t=>{this.handleTimeout((()=>this.handleReset(e,t)),1e3*this.options.expiry)})):null}handleError(e,t){return t>this.options.maxRetry?this.handleFailure(e):(this.options.onStatusChange(e,r.default.WAITING),this.handleRetry(e,t))}handleRetry(e,t){const n=new Promise((n=>{this.handleTimeout((()=>n(this.loadImageLoop(e,2*t))),1e3*t)}));return this.options.onRetry(e,t,n),n}setOnRetry(e){this.options.onRetry=e}setOnReset(e){this.options.onReset=e}setOnStatusChange(e){this.options.onStatusChange=e}setOnTimeout(e){this.options.onTimeout=e}}},2153:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={SET_STATUS:"IMAGE_LOAD_SET_STATUS",RESET:"IMAGE_LOAD_RESET"}},769:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loadImage=function(e,t){return(n,i)=>{if(!e)return null;if(i().assetAdmin.imageLoad.files.find((t=>t.url===e)))return null;const s={...t,onStatusChange:(e,t)=>n({type:r.default.SET_STATUS,payload:{status:t,url:e}}),onReset:e=>n({type:r.default.RESET,payload:{url:e}})};return new o.default(s).loadImage(e)}};var r=i(n(2153)),o=i(n(423));function i(e){return e&&e.__esModule?e:{default:e}}},8632:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;class n{constructor(){this.urls=[]}lock(e){return!(this.urls.indexOf(e)>=0)&&(this.urls=[...this.urls,e],!0)}unlock(e){this.urls=this.urls.filter((t=>t!==e))}}t.Component=n,window.ss=window.ss||{},window.ss.imagelocker=window.ss.imagelocker||new n;t.default=window.ss.imagelocker},1838:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={DISABLED:"DISABLED",NONE:"NONE",SUCCESS:"SUCCESS",LOADING:"LOADING",WAITING:"WAITING",FAILED:"FAILED"}},2613:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={DEFINE_IMAGE_SIZE_PRESETS:"DEFINE_IMAGE_SIZE_PRESETS",INIT_FORM_SCHEMA_STACK:"INIT_FORM_SCHEMA_STACK",POP_FORM_SCHEMA:"POP_FORM_SCHEMA",PUSH_FORM_SCHEMA:"PUSH_FORM_SCHEMA",RESET:"RESET",RESET_FORM_STACK:"RESET_FORM_STACK"}},1021:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defineImageSizePresets=function(e){return{type:i.default.DEFINE_IMAGE_SIZE_PRESETS,payload:{imageSizePresets:e}}},t.initFormStack=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return{type:i.default.INIT_FORM_SCHEMA_STACK,payload:{formSchema:{type:e,nextType:t}}}},t.popFormStackEntry=function(){return{type:i.default.POP_FORM_SCHEMA}},t.pushFormStackEntry=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return{type:i.default.PUSH_FORM_SCHEMA,payload:{formSchema:{type:e,nextType:t}}}},t.reset=function(){return{type:i.default.RESET}},t.resetFormStack=function(){return{type:i.default.RESET_FORM_STACK}},t.stashFormValues=function(e,t){return(n,i)=>{const l=i(),a=(0,r.default)(l.form.formState,`${e}.values`),u=(0,r.default)(l.form.formSchemas,`${t}.schema.fields`);if(a){const e=Object.keys(a).filter((e=>null!==a[e]&&(0,s.default)(e,u))).map((e=>({name:e,value:a[e]})));n((0,o.setSchemaStateOverrides)(t,{fields:e}))}}};var r=l(n(6104)),o=n(2811),i=l(n(2613)),s=l(n(8896));function l(e){return e&&e.__esModule?e:{default:e}}},8896:function(e,t){"use strict";function n(e,t){let r;for(r=0;rt({type:o.default.ADD_QUEUED_FILE,payload:{file:e}})},t.failUpload=function(e,t,n){return r=>{let i=t.message;return t.errors&&t.errors.length&&(i=t.errors[0]),"string"==typeof t&&(i={value:n||t,type:"error"}),r({type:o.default.FAIL_UPLOAD,payload:{queuedId:e,message:i}})}},t.purgeUploadQueue=function(){return e=>e({type:o.default.PURGE_UPLOAD_QUEUE,payload:null})},t.removeQueuedFile=function(e){return t=>t({type:o.default.REMOVE_QUEUED_FILE,payload:{queuedId:e}})},t.succeedUpload=function(e,t){return n=>n({type:o.default.SUCCEED_UPLOAD,payload:{queuedId:e,json:t}})},t.updateQueuedFile=function(e,t){return n=>n({type:o.default.UPDATE_QUEUED_FILE,payload:{queuedId:e,updates:t}})};var r,o=(r=n(5793))&&r.__esModule?r:{default:r}},1804:function(e,t,n){"use strict";var r=n(5228),o={};var i=function(e){};function s(e,t,n,r,o,s,l,a){if(i(t),!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var d=[n,r,o,s,l,a],c=0;(u=new Error(t.replace(/%s/g,(function(){return d[c++]})))).name="Invariant Violation"}throw u.framesToPop=1,u}}var l="mixins";e.exports=function(e,t,n){var i=[],a={mixins:"DEFINE_MANY",statics:"DEFINE_MANY",propTypes:"DEFINE_MANY",contextTypes:"DEFINE_MANY",childContextTypes:"DEFINE_MANY",getDefaultProps:"DEFINE_MANY_MERGED",getInitialState:"DEFINE_MANY_MERGED",getChildContext:"DEFINE_MANY_MERGED",render:"DEFINE_ONCE",componentWillMount:"DEFINE_MANY",componentDidMount:"DEFINE_MANY",componentWillReceiveProps:"DEFINE_MANY",shouldComponentUpdate:"DEFINE_ONCE",componentWillUpdate:"DEFINE_MANY",componentDidUpdate:"DEFINE_MANY",componentWillUnmount:"DEFINE_MANY",UNSAFE_componentWillMount:"DEFINE_MANY",UNSAFE_componentWillReceiveProps:"DEFINE_MANY",UNSAFE_componentWillUpdate:"DEFINE_MANY",updateComponent:"OVERRIDE_BASE"},u={getDerivedStateFromProps:"DEFINE_MANY_MERGED"},d={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var n=0;n0}},{key:"getMetadataColumnProperty",value:function(e,t,n){var r=this.getColumnMetadataByName(e);return null==r?n:r.hasOwnProperty(t)?r[t]:n}},{key:"orderColumns",value:function(e){var t=this;return l(e,(function(e){var n=s(t.columnMetadata,{columnName:e});return null==n||isNaN(n.order)?100:n.order}))}},{key:"getColumns",value:function(){var e=0===this.filteredColumns.length?this.allColumns:this.filteredColumns;return e=a(e,this.metadataColumns),e=this.orderColumns(e)}}]),e}();e.exports=u},3715:function(e,t,n){"use strict";var r=n(1594),o=n(2306)({getDefaultProps:function(){return{placeholderText:""}},render:function(){return"function"!=typeof this.props.customFilterComponent?(console.log("Couldn't find valid template."),r.createElement("div",null)):r.createElement(this.props.customFilterComponent,{changeFilter:this.props.changeFilter,results:this.props.results,currentResults:this.props.currentResults,placeholderText:this.props.placeholderText})}});e.exports=o},8465:function(e,t,n){"use strict";var r=Object.assign||function(e){for(var t=1;t0&&(e=r.createElement("button",{type:"button",onClick:this.props.previous,style:this.props.useGriddleStyles?{color:"#222",border:"none",background:"none",margin:"0 0 0 10px"}:null},this.props.previousIconComponent,this.props.previousText)),this.props.currentPage!==this.props.maxPage-1&&(t=r.createElement("button",{type:"button",onClick:this.props.next,style:this.props.useGriddleStyles?{color:"#222",border:"none",background:"none",margin:"0 10px 0 0"}:null},this.props.nextText,this.props.nextIconComponent));var n=null,o=null,s=null;if(!0===this.props.useGriddleStyles){var l={float:"left",minHeight:"1px",marginTop:"5px"};s=i({textAlign:"right",width:"34%"},l),o=i({textAlign:"center",width:"33%"},l),n=i({width:"33%"},l)}for(var a=[],u=1;u<=this.props.maxPage;u++)a.push(r.createElement("option",{value:u,key:u},u));return r.createElement("div",{style:this.props.useGriddleStyles?{minHeight:"35px"}:null},r.createElement("div",{className:this.props.previousClassName,style:n},e),r.createElement("div",{className:"griddle-page",style:o},r.createElement("select",{value:this.props.currentPage+1,onChange:this.pageChange},a)," / ",this.props.maxPage),r.createElement("div",{className:this.props.nextClassName,style:s},t))}});e.exports=s},1507:function(e,t,n){"use strict";var r=n(1594),o=n(2306),i=(n(493),n(9280)),s=n(1882),l=n(7248),a=n(6139),u=n(4684),d=n(8938),c=n(1648),p=o({getDefaultProps:function(){return{isChildRow:!1,showChildren:!1,data:{},columnSettings:null,rowSettings:null,hasChildren:!1,useGriddleStyles:!0,useGriddleIcons:!0,isSubGriddle:!1,paddingHeight:null,rowHeight:null,parentRowCollapsedClassName:"parent-row",parentRowExpandedClassName:"parent-row expanded",parentRowCollapsedComponent:"▶",parentRowExpandedComponent:"▼",onRowClick:null,multipleSelectionSettings:null,onRowMouseEnter:null,onRowMouseLeave:null,onRowWillMount:null,onRowWillUnmount:null}},componentWillMount:function(){null!==this.props.onRowWillMount&&s(this.props.onRowWillMount)&&this.props.onRowWillMount(this)},componentWillUnmount:function(){null!==this.props.onRowWillUnmount&&s(this.props.onRowWillUnmount)&&this.props.onRowWillUnmount(this)},handleClick:function(e){null!==this.props.onRowClick&&s(this.props.onRowClick)?this.props.onRowClick(this,e):this.props.hasChildren&&this.props.toggleChildren()},handleMouseEnter:function(e){null!==this.props.onRowMouseEnter&&s(this.props.onRowMouseEnter)&&this.props.onRowMouseEnter(this,e)},handleMouseLeave:function(e){null!==this.props.onRowMouseLeave&&s(this.props.onRowMouseLeave)&&this.props.onRowMouseLeave(this,e)},handleSelectionChange:function(e){},handleSelectClick:function(e){this.props.multipleSelectionSettings.isMultipleSelection&&("checkbox"===e.target.type?this.props.multipleSelectionSettings.toggleSelectRow(this.props.data,this.refs.selected.checked):this.props.multipleSelectionSettings.toggleSelectRow(this.props.data,!this.refs.selected.checked))},verifyProps:function(){null===this.props.columnSettings&&console.error("gridRow: The columnSettings prop is null and it shouldn't be")},formatData:function(e){return"boolean"==typeof e?String(e):e},render:function(){var e=this;this.verifyProps();var t=this,n=null;this.props.useGriddleStyles&&(n={margin:"0px",padding:t.props.paddingHeight+"px 5px "+t.props.paddingHeight+"px 5px",height:t.props.rowHeight?this.props.rowHeight-2*t.props.paddingHeight+"px":null,backgroundColor:"#FFF",borderTopColor:"#DDD",color:"#222"});var o=this.props.columnSettings.getColumns(),p=l(o,[]),h=a({},this.props.data);u(h,p);var f,m,g=d(i.pick(h,c(o,"children"))).map((function(t,o){var i=null,s=e.props.columnSettings.getColumnMetadataByName(t[0]),l=0===o&&e.props.hasChildren&&!1===e.props.showChildren&&e.props.useGriddleIcons?r.createElement("span",{style:e.props.useGriddleStyles?{fontSize:"10px",marginRight:"5px"}:null},e.props.parentRowCollapsedComponent):0===o&&e.props.hasChildren&&e.props.showChildren&&e.props.useGriddleIcons?r.createElement("span",{style:e.props.useGriddleStyles?{fontSize:"10px"}:null},e.props.parentRowExpandedComponent):"";if(0===o&&e.props.isChildRow&&e.props.useGriddleStyles&&(n=a(n,{paddingLeft:10})),e.props.columnSettings.hasColumnMetadata()&&null!=s)if(void 0!==s.customComponent&&null!==s.customComponent){var u=r.createElement(s.customComponent,{data:t[1],rowData:h,metadata:s});i=r.createElement("td",{onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,onMouseLeave:e.handleMouseLeave,className:s.cssClassName,key:o,style:n},u)}else i=r.createElement("td",{onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,onMouseLeave:e.handleMouseLeave,className:s.cssClassName,key:o,style:n},l,e.formatData(t[1]));return i||r.createElement("td",{onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,onMouseLeave:e.handleMouseLeave,key:o,style:n},l,t[1])}));if(null!==this.props.onRowClick&&s(this.props.onRowClick)?(f=null,m=this.handleSelectClick):this.props.multipleSelectionSettings&&this.props.multipleSelectionSettings.isMultipleSelection?(f=this.handleSelectClick,m=null):(f=null,m=null),g&&this.props.multipleSelectionSettings&&this.props.multipleSelectionSettings.isMultipleSelection){this.props.multipleSelectionSettings.getSelectedRowIds();g.unshift(r.createElement("td",{key:"selection",style:n,className:"griddle-select griddle-select-cell",onClick:m},r.createElement("input",{type:"checkbox",checked:this.props.multipleSelectionSettings.getIsRowChecked(h),onChange:this.handleSelectionChange,ref:"selected"})))}var y=t.props.rowSettings&&t.props.rowSettings.getBodyRowMetadataClass(t.props.data)||"standard-row";return t.props.isChildRow?y="child-row":t.props.hasChildren&&(y=t.props.showChildren?this.props.parentRowExpandedClassName:this.props.parentRowCollapsedClassName),r.createElement("tr",{onClick:f,className:y},g)}});e.exports=p},4734:function(e,t,n){"use strict";var r=n(1594),o=n(2306),i=(n(493),n(4383)),s=o({getDefaultProps:function(){return{useGriddleStyles:!0,useGriddleIcons:!0,isSubGriddle:!1,columnSettings:null,rowSettings:null,paddingHeight:null,rowHeight:null,parentRowCollapsedClassName:"parent-row",parentRowExpandedClassName:"parent-row expanded",parentRowCollapsedComponent:"▶",parentRowExpandedComponent:"▼",onRowClick:null,onRowMouseEnter:null,onRowMouseLeave:null,onRowWillMount:null,onRowWillUnmount:null,multipleSelectionSettings:null}},getInitialState:function(){return{data:{},showChildren:!1}},componentWillReceiveProps:function(){this.setShowChildren(!1)},toggleChildren:function(){this.setShowChildren(!1===this.state.showChildren)},setShowChildren:function(e){this.setState({showChildren:e})},verifyProps:function(){null===this.props.columnSettings&&console.error("gridRowContainer: The columnSettings prop is null and it shouldn't be")},render:function(){this.verifyProps();var e=this;if(void 0===this.props.data)return r.createElement("tbody",null);var t=[],n=this.props.columnSettings.getColumns();t.push(r.createElement(this.props.rowSettings.rowComponent,{useGriddleStyles:this.props.useGriddleStyles,isSubGriddle:this.props.isSubGriddle,data:this.props.rowSettings.isCustom?i(this.props.data,n):this.props.data,rowData:this.props.rowSettings.isCustom?this.props.data:null,columnSettings:this.props.columnSettings,rowSettings:this.props.rowSettings,hasChildren:e.props.hasChildren,toggleChildren:e.toggleChildren,showChildren:e.state.showChildren,key:e.props.uniqueId+"_base_row",useGriddleIcons:e.props.useGriddleIcons,parentRowExpandedClassName:this.props.parentRowExpandedClassName,parentRowCollapsedClassName:this.props.parentRowCollapsedClassName,parentRowExpandedComponent:this.props.parentRowExpandedComponent,parentRowCollapsedComponent:this.props.parentRowCollapsedComponent,paddingHeight:e.props.paddingHeight,rowHeight:e.props.rowHeight,onRowClick:e.props.onRowClick,onRowMouseEnter:e.props.onRowMouseEnter,onRowMouseLeave:e.props.onRowMouseLeave,multipleSelectionSettings:this.props.multipleSelectionSettings,onRowWillMount:e.props.onRowWillMount,onRowWillUnmount:e.props.onRowWillUnmount}));var o=null;return e.state.showChildren&&(o=e.props.hasChildren&&this.props.data.children.map((function(t,n){var o=e.props.rowSettings.getRowKey(t,n);if(void 0!==t.children){var i=e.constructor.Griddle;return r.createElement("tr",{key:o,style:{paddingLeft:5}},r.createElement("td",{colSpan:e.props.columnSettings.getVisibleColumnCount(),className:"griddle-parent",style:e.props.useGriddleStyles?{border:"none",padding:"0 0 0 5px"}:null},r.createElement(i,{rowMetadata:{key:"id"},isSubGriddle:!0,results:[t],columns:e.props.columnSettings.getColumns(),tableClassName:e.props.tableClassName,parentRowExpandedClassName:e.props.parentRowExpandedClassName,parentRowCollapsedClassName:e.props.parentRowCollapsedClassName,showTableHeading:!1,showPager:!1,columnMetadata:e.props.columnSettings.columnMetadata,parentRowExpandedComponent:e.props.parentRowExpandedComponent,parentRowCollapsedComponent:e.props.parentRowCollapsedComponent,paddingHeight:e.props.paddingHeight,rowHeight:e.props.rowHeight})))}return r.createElement(e.props.rowSettings.rowComponent,{useGriddleStyles:e.props.useGriddleStyles,isSubGriddle:e.props.isSubGriddle,data:t,columnSettings:e.props.columnSettings,isChildRow:!0,columnMetadata:e.props.columnSettings.columnMetadata,key:o})}))),!1===e.props.hasChildren?t[0]:r.createElement("tbody",null,e.state.showChildren?t.concat(o):t)}});e.exports=s},4376:function(e,t,n){"use strict";var r=n(1594),o=n(2306),i=n(9859),s=n(1648),l=n(7309),a=o({getDefaultProps:function(){return{columns:[],columnMetadata:[],selectedColumns:[],settingsText:"",maxRowsText:"",resultsPerPage:0,enableToggleCustom:!1,useCustomComponent:!1,useGriddleStyles:!0,toggleCustomComponent:function(){}}},setPageSize:function(e){var t=parseInt(e.target.value,10);this.props.setPageSize(t)},handleChange:function(e){var t=e.target.dataset?e.target.dataset.name:e.target.getAttribute("data-name");!0===e.target.checked&&!1===i(this.props.selectedColumns,t)?(this.props.selectedColumns.push(t),this.props.setColumns(this.props.selectedColumns)):this.props.setColumns(s(this.props.selectedColumns,t))},render:function(){var e=this,t=[];!1===e.props.useCustomComponent&&(t=this.props.columns.map((function(t,n){var o=i(e.props.selectedColumns,t),s=l(e.props.columnMetadata,{columnName:t}),a=t;return void 0!==s&&void 0!==s.displayName&&null!=s.displayName&&(a=s.displayName),void 0!==s&&null!=s&&s.locked?r.createElement("div",{className:"column checkbox"},r.createElement("label",null,r.createElement("input",{type:"checkbox",disabled:!0,name:"check",checked:o,"data-name":t}),a)):void 0!==s&&null!=s&&void 0!==s.visible&&!1===s.visible?null:r.createElement("div",{className:"griddle-column-selection checkbox",key:t,style:e.props.useGriddleStyles?{float:"left",width:"20%"}:null},r.createElement("label",null,r.createElement("input",{type:"checkbox",name:"check",onChange:e.handleChange,checked:o,"data-name":t}),a))})));var n=e.props.enableToggleCustom?r.createElement("div",{className:"form-group"},r.createElement("label",{htmlFor:"maxRows"},r.createElement("input",{type:"checkbox",checked:this.props.useCustomComponent,onChange:this.props.toggleCustomComponent})," ",this.props.enableCustomFormatText)):"",o=this.props.showSetPageSize?r.createElement("div",null,r.createElement("label",{htmlFor:"maxRows"},this.props.maxRowsText,":",r.createElement("select",{onChange:this.setPageSize,value:this.props.resultsPerPage},r.createElement("option",{value:"5"},"5"),r.createElement("option",{value:"10"},"10"),r.createElement("option",{value:"25"},"25"),r.createElement("option",{value:"50"},"50"),r.createElement("option",{value:"100"},"100")))):"";return r.createElement("div",{className:"griddle-settings",style:this.props.useGriddleStyles?{backgroundColor:"#FFF",border:"1px solid #DDD",color:"#222",padding:"10px",marginBottom:"10px"}:null},r.createElement("h6",null,this.props.settingsText),r.createElement("div",{className:"griddle-columns",style:this.props.useGriddleStyles?{clear:"both",display:"table",width:"100%",borderBottom:"1px solid #EDEDED",marginBottom:"10px"}:null},t),o,n)}});e.exports=a},2991:function(e,t,n){"use strict";var r=n(1594),o=n(2306),i=n(9593),s=n(4734),l=(n(493),n(1545),o({getDefaultProps:function(){return{data:[],columnSettings:null,rowSettings:null,sortSettings:null,multipleSelectionSettings:null,className:"",enableInfiniteScroll:!1,nextPage:null,hasMorePages:!1,useFixedHeader:!1,useFixedLayout:!0,paddingHeight:null,rowHeight:null,filterByColumn:null,infiniteScrollLoadTreshold:null,bodyHeight:null,useGriddleStyles:!0,useGriddleIcons:!0,isSubGriddle:!1,parentRowCollapsedClassName:"parent-row",parentRowExpandedClassName:"parent-row expanded",parentRowCollapsedComponent:"▶",parentRowExpandedComponent:"▼",externalLoadingComponent:null,externalIsLoading:!1,onRowClick:null,onRowMouseEnter:null,onRowMouseLeave:null,onRowWillMount:null,onRowWillUnmount:null}},getInitialState:function(){return{scrollTop:0,scrollHeight:this.props.bodyHeight,clientHeight:this.props.bodyHeight}},componentDidMount:function(){this.gridScroll()},componentDidUpdate:function(e,t){this.gridScroll()},gridScroll:function(){if(this.props.enableInfiniteScroll&&!this.props.externalIsLoading){var e=this.refs.scrollable,t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;if(null!==this.props.rowHeight&&this.state.scrollTop!==t&&Math.abs(this.state.scrollTop-t)>=this.getAdjustedRowHeight()){var o={scrollTop:t,scrollHeight:n,clientHeight:r};this.setState(o)}.6*(n-(t+r)-this.props.infiniteScrollLoadTreshold)<=this.props.infiniteScrollLoadTreshold&&this.props.nextPage()}},verifyProps:function(){null===this.props.columnSettings&&console.error("gridTable: The columnSettings prop is null and it shouldn't be"),null===this.props.rowSettings&&console.error("gridTable: The rowSettings prop is null and it shouldn't be")},getAdjustedRowHeight:function(){return this.props.rowHeight+2*this.props.paddingHeight},getNodeContent:function(){this.verifyProps();var e=this,t=!1;if(!this.props.externalIsLoading||this.props.enableInfiniteScroll){var n=e.props.data,o=null,i=null;if(this.props.enableInfiniteScroll&&null!==this.props.rowHeight&&void 0!==this.refs.scrollable){var l=e.getAdjustedRowHeight(),a=Math.ceil(e.state.clientHeight/l),u=Math.max(0,Math.floor(e.state.scrollTop/l)-.25*a),d=Math.min(u+1.25*a,this.props.data.length-1);n=n.slice(u,d+1);var c={height:u*l+"px"};o=r.createElement("tr",{key:"above-"+c.height,style:c});var p={height:(this.props.data.length-d)*l+"px"};i=r.createElement("tr",{key:"below-"+p.height,style:p})}var h=n.map((function(n,o){var i=void 0!==n.children&&n.children.length>0,l=e.props.rowSettings.getRowKey(n,o);return i&&(t=i),r.createElement(s,{useGriddleStyles:e.props.useGriddleStyles,isSubGriddle:e.props.isSubGriddle,parentRowExpandedClassName:e.props.parentRowExpandedClassName,parentRowCollapsedClassName:e.props.parentRowCollapsedClassName,parentRowExpandedComponent:e.props.parentRowExpandedComponent,parentRowCollapsedComponent:e.props.parentRowCollapsedComponent,data:n,key:l+"-container",uniqueId:l,columnSettings:e.props.columnSettings,rowSettings:e.props.rowSettings,paddingHeight:e.props.paddingHeight,multipleSelectionSettings:e.props.multipleSelectionSettings,rowHeight:e.props.rowHeight,hasChildren:i,tableClassName:e.props.className,onRowClick:e.props.onRowClick,onRowMouseEnter:e.props.onRowMouseEnter,onRowMouseLeave:e.props.onRowMouseLeave,onRowWillMount:e.props.onRowWillMount,onRowWillUnmount:e.props.onRowWillUnmount})}));if(this.props.showNoData){var f=this.props.columnSettings.getVisibleColumnCount();h.push(r.createElement("tr",{key:"no-data-section"},r.createElement("td",{colSpan:f},this.props.noDataSection)))}return o&&h.unshift(o),i&&h.push(i),{nodes:h,anyHasChildren:t}}return null},render:function(){var e=[],t=!1,n=this.getNodeContent();n&&(e=n.nodes,t=n.anyHasChildren);var o=null,s=null,l={width:"100%"};if(this.props.useFixedLayout&&(l.tableLayout="fixed"),this.props.enableInfiniteScroll&&(o={position:"relative",overflowY:"scroll",height:this.props.bodyHeight+"px",width:"100%"}),this.props.externalIsLoading){var a,u=null;this.props.useGriddleStyles&&(u={textAlign:"center",paddingBottom:"40px"}),a=this.props.columnSettings.getVisibleColumnCount();var d=this.props.externalLoadingComponent?r.createElement(this.props.externalLoadingComponent,null):r.createElement("div",null,"Loading...");s=r.createElement("tbody",null,r.createElement("tr",null,r.createElement("td",{style:u,colSpan:a},d)))}var c=this.props.showTableHeading?r.createElement(i,{useGriddleStyles:this.props.useGriddleStyles,useGriddleIcons:this.props.useGriddleIcons,sortSettings:this.props.sortSettings,multipleSelectionSettings:this.props.multipleSelectionSettings,columnSettings:this.props.columnSettings,filterByColumn:this.props.filterByColumn,rowSettings:this.props.rowSettings}):void 0;t||(e=r.createElement("tbody",null,e));var p=r.createElement("tbody",null);if(this.props.showPager){var h=this.props.useGriddleStyles?{padding:"0px",backgroundColor:"#EDEDED",border:"0px",color:"#222",height:this.props.showNoData?"20px":null}:null;p=r.createElement("tbody",null,r.createElement("tr",null,r.createElement("td",{colSpan:this.props.multipleSelectionSettings.isMultipleSelection?this.props.columnSettings.getVisibleColumnCount()+1:this.props.columnSettings.getVisibleColumnCount(),style:h,className:"footer-container"},this.props.showNoData?null:this.props.pagingContent)))}return this.props.useFixedHeader?(this.props.useGriddleStyles&&(l.tableLayout="fixed"),r.createElement("div",null,r.createElement("table",{className:this.props.className,style:this.props.useGriddleStyles&&l||null},c),r.createElement("div",{ref:"scrollable",onScroll:this.gridScroll,style:o},r.createElement("table",{className:this.props.className,style:this.props.useGriddleStyles&&l||null},e,s,p)))):r.createElement("div",{ref:"scrollable",onScroll:this.gridScroll,style:o},r.createElement("table",{className:this.props.className,style:this.props.useGriddleStyles&&l||null},c,e,s,p))}}));e.exports=l},9593:function(e,t,n){"use strict";var r=Object.assign||function(e){for(var t=1;t=0)return!0}return!1}))},defaultColumnFilter:function(e,t,n){var r=N(A(n)?n:[n],(function(e){return(e||"").toLowerCase()}));return L(b.getObjectValues(t),(function(e){return e=e.toString().toLowerCase(),L(r,(function(t){return e.indexOf(t)>=0}))}))},filterByColumnFilters:function(e){var t=this.props.columnFilterFunc||this.defaultColumnFilter,n=Object.keys(e).reduce((function(n,r){return T(n,(function(n){var o=b.getAt(n,r||""),i=e[r];return t(r||"",o,i)}))}),this.props.results),r={columnFilters:e};e?(r.filteredResults=n,r.maxPage=this.getMaxPage(r.filteredResults)):this.state.filter?r.filteredResults=this.props.useCustomFilterer?this.props.customFilterer(this.props.results,filter):this.defaultFilter(this.props.results,filter):r.filteredResults=null,this.setState(r)},filterByColumn:function(e,t){var n=this.state.columnFilters;if(n.hasOwnProperty(t)&&!e)n=M(n,t);else{var r={};r[t]=e,n=R({},n,r)}this.filterByColumnFilters(n)},setFilter:function(e){var t=arguments.length<=1||void 0===arguments[1]?null:arguments[1];if(this.props.useExternal)this.props.externalSetFilter(e);else{var n={page:0,filter:e};n.filteredResults=this.props.useCustomFilterer?this.props.customFilterer(t||this.props.results,e):this.defaultFilter(t||this.props.results,e),n.maxPage=this.getMaxPage(n.filteredResults),(D(e)||I(e)||O(e))&&(n.filter=e,n.filteredResults=null),this.setState(n),this._resetSelectedRows()}},setPageSize:function(e){if(this.props.useExternal)return this.setState({resultsPerPage:e}),void this.props.externalSetPageSize(e);this.state.resultsPerPage=e,this.setMaxPage()},toggleColumnChooser:function(){this.setState({showColumnChooser:!this.state.showColumnChooser})},isNullOrUndefined:function(e){return null==e},shouldUseCustomRowComponent:function(){return this.isNullOrUndefined(this.state.useCustomRowComponent)?this.props.useCustomRowComponent:this.state.useCustomRowComponent},shouldUseCustomGridComponent:function(){return this.isNullOrUndefined(this.state.useCustomGridComponent)?this.props.useCustomGridComponent:this.state.useCustomGridComponent},toggleCustomComponent:function(){"grid"===this.state.customComponentType?this.setState({useCustomGridComponent:!this.shouldUseCustomGridComponent()}):"row"===this.state.customComponentType&&this.setState({useCustomRowComponent:!this.shouldUseCustomRowComponent()})},getMaxPage:function(e,t){return this.props.useExternal?this.props.externalMaxPage:(t||(t=(e||this.getCurrentResults()).length),Math.ceil(t/this.state.resultsPerPage))},setMaxPage:function(e){var t=this.getMaxPage(e);this.state.maxPage!==t&&this.setState({page:0,maxPage:t,filteredColumns:this.columnSettings.filteredColumns})},setPage:function(e){if(this.props.useExternal)this.props.externalSetPage(e);else{if(e*this.state.resultsPerPage<=this.state.resultsPerPage*this.state.maxPage){var t={page:e};this.setState(t)}this.props.enableInfiniteScroll&&this.setState({isSelectAllChecked:!1})}},setColumns:function(e){this.columnSettings.filteredColumns=A(e)?e:[e],this.setState({filteredColumns:this.columnSettings.filteredColumns})},nextPage:function(){var e=this.getCurrentPage();e0&&this.setPage(e-1)},changeSort:function(e){if(!1!==this.props.enableSort){if(this.props.useExternal){var t=this.props.externalSortColumn!==e||!this.props.externalSortAscending;return this.setState({sortColumn:e,sortDirection:t?"asc":"desc"}),void this.props.externalChangeSort(e,t)}var n=E(this.props.columnMetadata,{columnName:e})||{},r=n.sortDirectionCycle?n.sortDirectionCycle:[null,"asc","desc"],o=r.indexOf(this.state.sortDirection&&e===this.state.sortColumn?this.state.sortDirection:null),i={page:0,sortColumn:e,sortDirection:r[o=(o+1)%r.length]?r[o]:null};this.setState(i)}},componentWillReceiveProps:function(e){if(e.results!==this.props.results&&this.setFilter(this.state.filter,e.results),this.setMaxPage(e.results),e.resultsPerPage!==this.props.resultsPerPage&&this.setPageSize(e.resultsPerPage),this.columnSettings.columnMetadata=e.columnMetadata,e.results.length>0){var t=b.keys(e.results[0]);this.columnSettings.allColumns.length==t.length&&this.columnSettings.allColumns.every((function(e,n){return e===t[n]}))||(this.columnSettings.allColumns=t)}else this.columnSettings.allColumns.length>0&&(this.columnSettings.allColumns=[]);if(e.selectedRowIds){var n=this.getDataForRender(this.getCurrentResults(e.results),this.columnSettings.getColumns(),!0);this.setState({isSelectAllChecked:this._getAreAllRowsChecked(e.selectedRowIds,N(n,this.props.uniqueIdentifier)),selectedRowIds:e.selectedRowIds})}},getInitialState:function(){return{maxPage:0,page:0,filteredResults:null,filteredColumns:[],filter:"",columnFilters:{},resultsPerPage:this.props.resultsPerPage||5,showColumnChooser:!1,isSelectAllChecked:!1,selectedRowIds:this.props.selectedRowIds}},componentWillMount:function(){this.verifyExternal(),this.verifyCustom(),this.columnSettings=new y(this.props.results.length>0?b.keys(this.props.results[0]):[],this.props.columns,this.props.childrenColumnName,this.props.columnMetadata,this.props.metadataColumns),this.rowSettings=new v(this.props.rowMetadata,this.props.useCustomTableRowComponent&&this.props.customTableRowComponent?this.props.customTableRowComponent:p,this.props.useCustomTableRowComponent),this.props.initialSort&&(this.props.useExternal?this.setState({sortColumn:this.props.externalSortColumn,sortDirection:this.props.externalSortAscending?"asc":"desc"}):this.changeSort(this.props.initialSort)),this.setMaxPage(),this.shouldUseCustomGridComponent()?this.setState({customComponentType:"grid"}):this.shouldUseCustomRowComponent()?this.setState({customComponentType:"row"}):this.setState({filteredColumns:this.columnSettings.filteredColumns})},componentDidMount:function(){if(this.props.componentDidMount&&"function"==typeof this.props.componentDidMount)return this.props.componentDidMount()},componentDidUpdate:function(){if(this.props.componentDidUpdate&&"function"==typeof this.props.componentDidUpdate)return this.props.componentDidUpdate(this.state)},verifyExternal:function(){!0===this.props.useExternal&&(null===this.props.externalSetPage&&console.error("useExternal is set to true but there is no externalSetPage function specified."),null===this.props.externalChangeSort&&console.error("useExternal is set to true but there is no externalChangeSort function specified."),null===this.props.externalSetFilter&&console.error("useExternal is set to true but there is no externalSetFilter function specified."),null===this.props.externalSetPageSize&&console.error("useExternal is set to true but there is no externalSetPageSize function specified."),null===this.props.externalMaxPage&&console.error("useExternal is set to true but externalMaxPage is not set."),null===this.props.externalCurrentPage&&console.error("useExternal is set to true but externalCurrentPage is not set. Griddle will not page correctly without that property when using external data."))},verifyCustom:function(){!0===this.props.useCustomGridComponent&&null===this.props.customGridComponent&&console.error("useCustomGridComponent is set to true but no custom component was specified."),!0===this.props.useCustomRowComponent&&null===this.props.customRowComponent&&console.error("useCustomRowComponent is set to true but no custom component was specified."),!0===this.props.useCustomGridComponent&&!0===this.props.useCustomRowComponent&&console.error("Cannot currently use both customGridComponent and customRowComponent."),!0===this.props.useCustomFilterer&&null===this.props.customFilterer&&console.error("useCustomFilterer is set to true but no custom filter function was specified."),!0===this.props.useCustomFilterComponent&&null===this.props.customFilterComponent&&console.error("useCustomFilterComponent is set to true but no customFilterComponent was specified.")},getDataForRender:function(e,t,n){var r=this,o=this;if(!this.props.useExternal){if(""!==this.state.sortColumn){var i,s=this.state.sortColumn,l=T(this.props.columnMetadata,{columnName:s}),a={columns:[],orders:[]};if(l.length>0&&(i=l[0].hasOwnProperty("customCompareFn")&&l[0].customCompareFn,l[0].multiSort&&(a=l[0].multiSort)),this.state.sortDirection)if("function"==typeof i)2===i.length?(e=e.sort((function(e,t){return i(k(e,s),k(t,s))})),"desc"===this.state.sortDirection&&e.reverse()):1===i.length&&(e=P(e,(function(e){return i(k(e,s))}),[this.state.sortDirection]));else{var u=[function(e){return(k(e,s)||"").toString().toLowerCase()}],d=[this.state.sortDirection];a.columns.forEach((function(e,t){u.push((function(t){return(k(t,e)||"").toString().toLowerCase()})),"asc"===a.orders[t]||"desc"===a.orders[t]?d.push(a.orders[t]):d.push(r.state.sortDirection)})),e=P(e,u,d)}}var c=this.getCurrentPage();if(!this.props.useExternal&&n&&this.state.resultsPerPage*(c+1)<=this.state.resultsPerPage*this.state.maxPage&&c>=0)if(this.isInfiniteScrollEnabled())e=_(e,(c+1)*this.state.resultsPerPage);else{var p=C(e,c*this.state.resultsPerPage);e=(S||x)(p,p.length-this.state.resultsPerPage)}}for(var h=[],f=0;f0&&(m.children=o.getDataForRender(m[o.props.childrenColumnName],t,!1),"children"!==o.props.childrenColumnName&&delete m[o.props.childrenColumnName]),h.push(m)}return h},getCurrentResults:function(e){return this.state.filteredResults||e||this.props.results},getCurrentPage:function(){return this.props.externalCurrentPage||this.state.page},getCurrentSort:function(){return this.props.useExternal?this.props.externalSortColumn:this.state.sortColumn},getCurrentSortAscending:function(){return this.props.useExternal?this.props.externalSortAscending:"asc"===this.state.sortDirection},getCurrentMaxPage:function(){return this.props.useExternal?this.props.externalMaxPage:this.state.maxPage},getSortObject:function(){return{enableSort:this.props.enableSort,changeSort:this.changeSort,sortColumn:this.getCurrentSort(),sortAscending:this.getCurrentSortAscending(),sortDirection:this.state.sortDirection,sortAscendingClassName:this.props.sortAscendingClassName,sortDescendingClassName:this.props.sortDescendingClassName,sortAscendingComponent:this.props.sortAscendingComponent,sortDescendingComponent:this.props.sortDescendingComponent,sortDefaultComponent:this.props.sortDefaultComponent}},_toggleSelectAll:function(){var e=this.getDataForRender(this.getCurrentResults(),this.columnSettings.getColumns(),!0),t=!this.state.isSelectAllChecked,n=JSON.parse(JSON.stringify(this.state.selectedRowIds)),r=this;w(e,(function(e){r._updateSelectedRowIds(e[r.props.uniqueIdentifier],n,t)}),this),this.setState({isSelectAllChecked:t,selectedRowIds:n}),this.props.onSelectionChange&&this.props.onSelectionChange(n,t)},_toggleSelectRow:function(e,t){var n=this.getDataForRender(this.getCurrentResults(),this.columnSettings.getColumns(),!0),r=JSON.parse(JSON.stringify(this.state.selectedRowIds));this._updateSelectedRowIds(e[this.props.uniqueIdentifier],r,t);var o=this._getAreAllRowsChecked(r,N(n,this.props.uniqueIdentifier));this.setState({isSelectAllChecked:o,selectedRowIds:r}),this.props.onSelectionChange&&this.props.onSelectionChange(r,o)},_updateSelectedRowIds:function(e,t,n){n?void 0===E(t,(function(t){return e===t}))&&t.push(e):t.splice(t.indexOf(e),1)},_getIsSelectAllChecked:function(){return this.state.isSelectAllChecked},_getAreAllRowsChecked:function(e,t){return t.length===F(t,e).length},_getIsRowChecked:function(e){return this.state.selectedRowIds.indexOf(e[this.props.uniqueIdentifier])>-1},getSelectedRowIds:function(){return this.state.selectedRowIds},_resetSelectedRows:function(){this.setState({isSelectAllChecked:!1,selectedRowIds:[]})},getMultipleSelectionObject:function(){return{isMultipleSelection:!E(this.props.results,(function(e){return"children"in e}))&&this.props.isMultipleSelection,toggleSelectAll:this._toggleSelectAll,getIsSelectAllChecked:this._getIsSelectAllChecked,toggleSelectRow:this._toggleSelectRow,getSelectedRowIds:this.getSelectedRowIds,getIsRowChecked:this._getIsRowChecked}},isInfiniteScrollEnabled:function(){return!this.props.useCustomPagerComponent&&this.props.enableInfiniteScroll},getClearFixStyles:function(){return{clear:"both",display:"table",width:"100%"}},getSettingsStyles:function(){return{float:"left",width:"50%",textAlign:"right"}},getFilterStyles:function(){return{float:"left",width:"50%",textAlign:"left",color:"#222",minHeight:"1px"}},getFilter:function(){return this.props.showFilter&&!1===this.shouldUseCustomGridComponent()?this.props.useCustomFilterComponent?o.createElement(g,{changeFilter:this.setFilter,placeholderText:this.props.filterPlaceholderText,customFilterComponent:this.props.customFilterComponent,results:this.props.results,currentResults:this.getCurrentResults()}):o.createElement(a,{changeFilter:this.setFilter,placeholderText:this.props.filterPlaceholderText}):""},getSettings:function(){return this.props.showSettings?o.createElement("button",{type:"button",className:this.props.settingsToggleClassName,onClick:this.toggleColumnChooser,style:this.props.useGriddleStyles?{background:"none",border:"none",padding:0,margin:0,fontSize:14}:null},this.props.settingsText,this.props.settingsIconComponent):""},getTopSection:function(e,t){if(!1===this.props.showFilter&&!1===this.props.showSettings)return"";var n=null,r=null,i=null;return this.props.useGriddleStyles&&(n=this.getFilterStyles(),r=this.getSettingsStyles(),i=this.getClearFixStyles()),o.createElement("div",{className:"top-section",style:i},o.createElement("div",{className:"griddle-filter",style:n},e),o.createElement("div",{className:"griddle-settings-toggle",style:r},t))},getPagingSection:function(e,t){if(!1!==(this.props.showPager&&!this.isInfiniteScrollEnabled()&&!this.shouldUseCustomGridComponent()))return o.createElement("div",{className:"griddle-footer"},this.props.useCustomPagerComponent?o.createElement(m,{customPagerComponentOptions:this.props.customPagerComponentOptions,next:this.nextPage,previous:this.previousPage,currentPage:e,maxPage:t,setPage:this.setPage,nextText:this.props.nextText,previousText:this.props.previousText,customPagerComponent:this.props.customPagerComponent}):o.createElement(u,{useGriddleStyles:this.props.useGriddleStyles,next:this.nextPage,previous:this.previousPage,nextClassName:this.props.nextClassName,nextIconComponent:this.props.nextIconComponent,previousClassName:this.props.previousClassName,previousIconComponent:this.props.previousIconComponent,currentPage:e,maxPage:t,setPage:this.setPage,nextText:this.props.nextText,previousText:this.props.previousText}))},getColumnSelectorSection:function(e,t){return this.state.showColumnChooser?o.createElement(d,{columns:e,selectedColumns:t,setColumns:this.setColumns,settingsText:this.props.settingsText,settingsIconComponent:this.props.settingsIconComponent,maxRowsText:this.props.maxRowsText,setPageSize:this.setPageSize,showSetPageSize:!this.shouldUseCustomGridComponent(),resultsPerPage:this.state.resultsPerPage,enableToggleCustom:this.props.enableToggleCustom,toggleCustomComponent:this.toggleCustomComponent,useCustomComponent:this.shouldUseCustomRowComponent()||this.shouldUseCustomGridComponent(),useGriddleStyles:this.props.useGriddleStyles,enableCustomFormatText:this.props.enableCustomFormatText,columnMetadata:this.props.columnMetadata}):""},getCustomGridSection:function(){return o.createElement(this.props.customGridComponent,r({data:this.props.results,className:this.props.customGridComponentClassName},this.props.gridMetadata))},getCustomRowSection:function(e,t,n,r,i){return o.createElement("div",null,o.createElement(f,{data:e,columns:t,metadataColumns:n,globalData:i,className:this.props.customRowComponentClassName,customComponent:this.props.customRowComponent,style:this.props.useGriddleStyles?this.getClearFixStyles():null}),this.props.showPager&&r)},getStandardGridSection:function(e,t,n,r,i){var s=this.getSortObject(),a=this.getMultipleSelectionObject(),u=this.shouldShowNoDataSection(e),d=this.getNoDataSection();return o.createElement("div",{className:"griddle-body"},o.createElement(l,{useGriddleStyles:this.props.useGriddleStyles,noDataSection:d,showNoData:u,columnSettings:this.columnSettings,rowSettings:this.rowSettings,sortSettings:s,multipleSelectionSettings:a,filterByColumn:this.filterByColumn,isSubGriddle:this.props.isSubGriddle,useGriddleIcons:this.props.useGriddleIcons,useFixedLayout:this.props.useFixedLayout,showPager:this.props.showPager,pagingContent:r,data:e,className:this.props.tableClassName,enableInfiniteScroll:this.isInfiniteScrollEnabled(),nextPage:this.nextPage,showTableHeading:this.props.showTableHeading,useFixedHeader:this.props.useFixedHeader,parentRowCollapsedClassName:this.props.parentRowCollapsedClassName,parentRowExpandedClassName:this.props.parentRowExpandedClassName,parentRowCollapsedComponent:this.props.parentRowCollapsedComponent,parentRowExpandedComponent:this.props.parentRowExpandedComponent,bodyHeight:this.props.bodyHeight,paddingHeight:this.props.paddingHeight,rowHeight:this.props.rowHeight,infiniteScrollLoadTreshold:this.props.infiniteScrollLoadTreshold,externalLoadingComponent:this.props.externalLoadingComponent,externalIsLoading:this.props.externalIsLoading,hasMorePages:i,onRowClick:this.props.onRowClick,onRowMouseEnter:this.props.onRowMouseEnter,onRowMouseLeave:this.props.onRowMouseLeave,onRowWillMount:this.props.onRowWillMount,onRowWillUnmount:this.props.onRowWillUnmount}))},getContentSection:function(e,t,n,r,o,i){return this.shouldUseCustomGridComponent()&&null!==this.props.customGridComponent?this.getCustomGridSection():this.shouldUseCustomRowComponent()?this.getCustomRowSection(e,t,n,r,i):this.getStandardGridSection(e,t,n,r,o)},getNoDataSection:function(){return null!=this.props.customNoDataComponent?o.createElement("div",{className:this.props.noDataClassName},o.createElement(this.props.customNoDataComponent,this.props.customNoDataComponentProps)):o.createElement(c,{noDataMessage:this.props.noDataMessage})},shouldShowNoDataSection:function(e){return!this.props.allowEmptyGrid&&(!1===this.props.useExternal&&(void 0===e||0===e.length)||!0===this.props.useExternal&&!1===this.props.externalIsLoading&&0===e.length)},render:function(){var e=this.getCurrentResults(),t=(this.props.tableClassName,this.getFilter()),n=this.getSettings(),r=this.getTopSection(t,n),i=[],s=this.columnSettings.getColumns(),l=this.getDataForRender(e,s,!0),a=this.columnSettings.getMetadataColumns();this.props.columnMetadata?w(this.props.columnMetadata,(function(e){"boolean"==typeof e.visible&&!1===e.visible||i.push(e.columnName)})):i=b.keys(M(e[0],a)),i=this.columnSettings.orderColumns(i);var u=this.getCurrentPage(),d=this.getCurrentMaxPage(),c=u+10?"griddle "+this.props.gridClassName:"griddle";return m+=this.shouldUseCustomRowComponent()?" griddle-custom":"",o.createElement("div",{className:m},r,f,o.createElement("div",{className:"griddle-container",style:this.props.useGriddleStyles&&!this.props.isSubGriddle?{border:"1px solid #DDD"}:null},h))}});h.Griddle=e.exports=j},1545:function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n-1}},9905:function(e){e.exports=function(e,t,n){for(var r=-1,o=null==e?0:e.length;++r=200&&(c=a,p=!1,t=new r(t));e:for(;++d0&&i(d)?n>1?e(d,n-1,i,s,l):r(l,d):s||(l[l.length]=d)}return l}},6649:function(e,t,n){var r=n(3221)();e.exports=r},641:function(e,t,n){var r=n(6649),o=n(5950);e.exports=function(e,t){return e&&r(e,t,o)}},7422:function(e,t,n){var r=n(1769),o=n(7797);e.exports=function(e,t){for(var n=0,i=(t=r(t,e)).length;null!=e&&n=120&&y.length>=120)?new r(h&&y):void 0}y=e[0];var v=-1,b=f[0];e:for(;++vo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(o);++rt||s&&l&&u&&!a&&!d||o&&l&&u||!n&&u||!i)return 1;if(!o&&!s&&!d&&e=a?u:u*("desc"==n[o]?-1:1)}return e.index-t.index}},3007:function(e){e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n1?n[i-1]:void 0,l=i>2?n[2]:void 0;for(s=e.length>3&&"function"==typeof s?(i--,s):void 0,l&&o(n[0],n[1],l)&&(s=i<3?void 0:s,i=1),t=Object(t);++r-1?l[a?t[u]:u]:void 0}}},2963:function(e,t,n){var r=n(1372),o=n(5861),i=n(317),s=n(799);e.exports=function(e){return function(t){var n=o(t);return"[object Map]"==n?i(t):"[object Set]"==n?s(t):r(t,e(t))}}},3138:function(e,t,n){var r=n(1331);e.exports=function(e){return r(e)?void 0:e}},3243:function(e,t,n){var r=n(6110),o=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=o},5911:function(e,t,n){var r=n(8859),o=n(4248),i=n(9219);e.exports=function(e,t,n,s,l,a){var u=1&n,d=e.length,c=t.length;if(d!=c&&!(u&&c>d))return!1;var p=a.get(e),h=a.get(t);if(p&&h)return p==t&&h==e;var f=-1,m=!0,g=2&n?new r:void 0;for(a.set(e,t),a.set(t,e);++f-1&&e%1==0&&e-1}},1175:function(e,t,n){var r=n(6025);e.exports=function(e,t){var n=this.__data__,o=r(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this}},3040:function(e,t,n){var r=n(1549),o=n(79),i=n(8223);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(i||o),string:new r}}},7670:function(e,t,n){var r=n(2651);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},289:function(e,t,n){var r=n(2651);e.exports=function(e){return r(this,e).get(e)}},4509:function(e,t,n){var r=n(2651);e.exports=function(e){return r(this,e).has(e)}},2949:function(e,t,n){var r=n(2651);e.exports=function(e,t){var n=r(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this}},317:function(e){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}},7197:function(e){e.exports=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}},2224:function(e,t,n){var r=n(104);e.exports=function(e){var t=r(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}},1042:function(e,t,n){var r=n(6110)(Object,"create");e.exports=r},3650:function(e,t,n){var r=n(4335)(Object.keys,Object);e.exports=r},181:function(e){e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},6009:function(e,t,n){e=n.nmd(e);var r=n(4840),o=t&&!t.nodeType&&t,i=o&&e&&!e.nodeType&&e,s=i&&i.exports===o&&r.process,l=function(){try{var e=i&&i.require&&i.require("util").types;return e||s&&s.binding&&s.binding("util")}catch(e){}}();e.exports=l},9350:function(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},4335:function(e){e.exports=function(e,t){return function(n){return e(t(n))}}},6757:function(e,t,n){var r=n(1033),o=Math.max;e.exports=function(e,t,n){return t=o(void 0===t?e.length-1:t,0),function(){for(var i=arguments,s=-1,l=o(i.length-t,0),a=Array(l);++s0){if(++n>=800)return arguments[0]}else n=0;return e.apply(void 0,arguments)}}},1420:function(e,t,n){var r=n(79);e.exports=function(){this.__data__=new r,this.size=0}},938:function(e){e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},3605:function(e){e.exports=function(e){return this.__data__.get(e)}},9817:function(e){e.exports=function(e){return this.__data__.has(e)}},945:function(e,t,n){var r=n(79),o=n(8223),i=n(3661);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var s=n.__data__;if(!o||s.length<199)return s.push([e,t]),this.size=++n.size,this;n=this.__data__=new i(s)}return n.set(e,t),this.size=n.size,this}},6959:function(e){e.exports=function(e,t,n){for(var r=n-1,o=e.length;++r2?t[2]:void 0;for(u&&i(t[0],t[1],u)&&(r=1);++n-1:!!d&&r(e,t,n)>-1}},3424:function(e,t,n){var r=n(5160);e.exports=function(e){return(null==e?0:e.length)?r(e,0,-1):[]}},5287:function(e,t,n){var r=n(4932),o=n(7185),i=n(9302),s=n(741),l=i((function(e){var t=r(e,s);return t.length&&t[0]===e[0]?o(t):[]}));e.exports=l},2428:function(e,t,n){var r=n(7534),o=n(346),i=Object.prototype,s=i.hasOwnProperty,l=i.propertyIsEnumerable,a=r(function(){return arguments}())?r:function(e){return o(e)&&s.call(e,"callee")&&!l.call(e,"callee")};e.exports=a},6449:function(e){var t=Array.isArray;e.exports=t},4894:function(e,t,n){var r=n(1882),o=n(294);e.exports=function(e){return null!=e&&o(e.length)&&!r(e)}},3693:function(e,t,n){var r=n(4894),o=n(346);e.exports=function(e){return o(e)&&r(e)}},3656:function(e,t,n){e=n.nmd(e);var r=n(9325),o=n(9935),i=t&&!t.nodeType&&t,s=i&&e&&!e.nodeType&&e,l=s&&s.exports===i?r.Buffer:void 0,a=(l?l.isBuffer:void 0)||o;e.exports=a},2193:function(e,t,n){var r=n(8984),o=n(5861),i=n(2428),s=n(6449),l=n(4894),a=n(3656),u=n(5527),d=n(7167),c=Object.prototype.hasOwnProperty;e.exports=function(e){if(null==e)return!0;if(l(e)&&(s(e)||"string"==typeof e||"function"==typeof e.splice||a(e)||d(e)||i(e)))return!e.length;var t=o(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(u(e))return!r(e).length;for(var n in e)if(c.call(e,n))return!1;return!0}},1882:function(e,t,n){var r=n(2552),o=n(3805);e.exports=function(e){if(!o(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},294:function(e){e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},7730:function(e,t,n){var r=n(9172),o=n(7301),i=n(6009),s=i&&i.isMap,l=s?o(s):r;e.exports=l},5187:function(e){e.exports=function(e){return null===e}},3805:function(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},346:function(e){e.exports=function(e){return null!=e&&"object"==typeof e}},1331:function(e,t,n){var r=n(2552),o=n(8879),i=n(346),s=Function.prototype,l=Object.prototype,a=s.toString,u=l.hasOwnProperty,d=a.call(Object);e.exports=function(e){if(!i(e)||"[object Object]"!=r(e))return!1;var t=o(e);if(null===t)return!0;var n=u.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&a.call(n)==d}},8440:function(e,t,n){var r=n(6038),o=n(7301),i=n(6009),s=i&&i.isSet,l=s?o(s):r;e.exports=l},5015:function(e,t,n){var r=n(2552),o=n(6449),i=n(346);e.exports=function(e){return"string"==typeof e||!o(e)&&i(e)&&"[object String]"==r(e)}},4394:function(e,t,n){var r=n(2552),o=n(346);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},7167:function(e,t,n){var r=n(4901),o=n(7301),i=n(6009),s=i&&i.isTypedArray,l=s?o(s):r;e.exports=l},2216:function(e){e.exports=function(e){return void 0===e}},5950:function(e,t,n){var r=n(695),o=n(8984),i=n(4894);e.exports=function(e){return i(e)?r(e):o(e)}},7241:function(e,t,n){var r=n(695),o=n(2903),i=n(4894);e.exports=function(e){return i(e)?r(e,!0):o(e)}},8090:function(e){e.exports=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}},5378:function(e,t,n){var r=n(4932),o=n(5389),i=n(5128),s=n(6449);e.exports=function(e,t){return(s(e)?r:i)(e,o(t,3))}},104:function(e,t,n){var r=n(3661);function o(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=e.apply(this,r);return n.cache=i.set(o,s)||i,s};return n.cache=new(o.Cache||r),n}o.Cache=r,e.exports=o},179:function(e,t,n){var r=n(4932),o=n(9999),i=n(9931),s=n(1769),l=n(1791),a=n(3138),u=n(8816),d=n(3349),c=u((function(e,t){var n={};if(null==e)return n;var u=!1;t=r(t,(function(t){return t=s(t,e),u||(u=t.length>1),t})),l(e,d(e),n),u&&(n=o(n,7,a));for(var c=t.length;c--;)i(n,t[c]);return n}));e.exports=c},2877:function(e,t,n){var r=n(6155),o=n(6449);e.exports=function(e,t,n,i){return null==e?[]:(o(t)||(t=null==t?[]:[t]),o(n=i?void 0:n)||(n=null==n?[]:[n]),r(e,t,n))}},4383:function(e,t,n){var r=n(6001),o=n(8816)((function(e,t){return null==e?{}:r(e,t)}));e.exports=o},583:function(e,t,n){var r=n(7237),o=n(7255),i=n(8586),s=n(7797);e.exports=function(e){return i(e)?r(s(e)):o(e)}},2426:function(e,t,n){var r=n(4248),o=n(5389),i=n(916),s=n(6449),l=n(6800);e.exports=function(e,t,n){var a=s(e)?r:i;return n&&l(e,t,n)&&(t=void 0),a(e,o(t,3))}},3031:function(e,t,n){var r=n(3120),o=n(6155),i=n(9302),s=n(6800),l=i((function(e,t){if(null==e)return[];var n=t.length;return n>1&&s(e,t[0],t[1])?t=[]:n>2&&s(t[0],t[1],t[2])&&(t=[t[0]]),o(e,r(t,1),[])}));e.exports=l},3345:function(e){e.exports=function(){return[]}},9935:function(e){e.exports=function(){return!1}},4921:function(e,t,n){var r=n(5160),o=n(1489);e.exports=function(e,t,n){return e&&e.length?(t=n||void 0===t?1:o(t),r(e,0,t<0?0:t)):[]}},7400:function(e,t,n){var r=n(9374),o=1/0;e.exports=function(e){return e?(e=r(e))===o||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},1489:function(e,t,n){var r=n(7400);e.exports=function(e){var t=r(e),n=t%1;return t==t?n?t-n:t:0}},9374:function(e,t,n){var r=n(4128),o=n(3805),i=n(4394),s=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,a=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=l.test(e);return n||a.test(e)?u(e.slice(2),n?2:8):s.test(e)?NaN:+e}},8938:function(e,t,n){var r=n(2963)(n(5950));e.exports=r},2072:function(e,t,n){var r=n(4932),o=n(3007),i=n(6449),s=n(4394),l=n(1802),a=n(7797),u=n(3222);e.exports=function(e){return i(e)?r(e,a):s(e)?[e]:o(l(u(e)))}},3222:function(e,t,n){var r=n(7556);e.exports=function(e){return null==e?"":r(e)}},7200:function(e,t,n){var r=n(3222),o=0;e.exports=function(e){var t=++o;return r(e)+t}},5880:function(e,t,n){var r=n(514),o=n(5950);e.exports=function(e){return null==e?[]:r(e,o(e))}},1648:function(e,t,n){var r=n(3915),o=n(9302),i=n(3693),s=o((function(e,t){return i(e)?r(e,t):[]}));e.exports=s},7248:function(e,t,n){var r=n(6547),o=n(1234);e.exports=function(e,t){return o(e||[],t||[],r)}},5228:function(e){"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,o){for(var i,s,l=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),a=1;a1)for(var n=1;n1?t-1:0),r=1;r2?n-2:0),i=2;i1&&void 0!==arguments[1]&&arguments[1],n=this.props,r=n.tolerance,o=n.onSelection,i=n.onEndSelection,s=[],l=(0,d.findDOMNode)(this.refs.selectbox);l&&(this._registry.forEach((function(e){e.domNode&&(0,g.default)(l,e.domNode,r)&&!s.includes(e.key)&&s.push(e.key)})),t?"function"==typeof i&&i(s,e):"function"==typeof o&&o(s,e))}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.enabled,r=e.fixedPosition,o=e.className,i=e.selectingClassName,s=this.state,l=s.isBoxSelecting,a=s.boxLeft,d=s.boxTop,c=s.boxWidth,h=s.boxHeight,f=this.props.component;if(!n)return u.default.createElement(f,{className:o},t);var m={left:a,top:d,width:c,height:h,zIndex:9e3,position:r?"fixed":"absolute",cursor:"default"},g={backgroundColor:"transparent",border:"1px dashed #999",width:"100%",height:"100%",float:"left"},y={position:"relative",overflow:"visible"};return u.default.createElement(f,{className:(0,p.default)(o,l?i:null),style:y},l?u.default.createElement("div",{style:m,ref:"selectbox"},u.default.createElement("span",{style:g})):null,t)}}]),t}(a.Component);v.propTypes={children:c.default.node,onBeginSelection:c.default.func,onEndSelection:c.default.func,onSelection:c.default.func,component:c.default.node,tolerance:c.default.number,fixedPosition:c.default.bool,preventDefault:c.default.bool,onNonItemClick:c.default.func,enabled:c.default.bool,className:c.default.string,selectingClassName:c.default.string},v.defaultProps={component:"div",tolerance:0,fixedPosition:!1,preventDefault:!0,enabled:!0},v.childContextTypes={selectable:c.default.object},t.default=v},function(e,t,n){"use strict";(function(t){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=n(1),i=n(2),s=n(8),l=n(15),a=n(3),u=n(16);e.exports=function(e,n){function d(e){var t=e&&(O&&e[O]||e[I]);if("function"==typeof t)return t}function c(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function p(e){this.message=e,this.stack=""}function h(e){function r(r,u,d,c,h,f,m){if(c=c||D,f=f||d,m!==a)if(n)i(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("production"!==t.env.NODE_ENV&&"undefined"!=typeof console){var g=c+":"+d;!o[g]&&l<3&&(s(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",f,c),o[g]=!0,l++)}return null==u[d]?r?new p(null===u[d]?"The "+h+" `"+f+"` is marked as required in `"+c+"`, but its value is `null`.":"The "+h+" `"+f+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:e(u,d,c,h,f)}if("production"!==t.env.NODE_ENV)var o={},l=0;var u=r.bind(null,!1);return u.isRequired=r.bind(null,!0),u}function f(e){function t(t,n,r,o,i,s){var l=t[n];return w(l)!==e?new p("Invalid "+o+" `"+i+"` of type `"+x(l)+"` supplied to `"+r+"`, expected `"+e+"`."):null}return h(t)}function m(e){function t(t,n,r,o,i){if("function"!=typeof e)return new p("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s))return new p("Invalid "+o+" `"+i+"` of type `"+w(s)+"` supplied to `"+r+"`, expected an array.");for(var l=0;ln+l||t+o-ar+s)};t.default=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=e instanceof HTMLElement?(0,r.default)(e):e,s=t instanceof HTMLElement?(0,r.default)(t):t;return o(i.top,i.left,s.top,s.left,i.offsetWidth,i.offsetHeight,s.offsetWidth,s.offsetHeight,n)}},function(e,t,n){"use strict";(function(t){function n(e,t,n){function r(t){var n=m,r=g;return m=g=void 0,w=t,v=e.apply(r,n)}function i(e){return w=e,b=setTimeout(d,t),x?r(e):v}function s(e){var n=t-(e-C);return F?E(n,y-(e-w)):n}function a(e){var n=e-C;return void 0===C||n>=t||n<0||F&&e-w>=y}function d(){var e=_();if(a(e))return c(e);b=setTimeout(d,s(e))}function c(e){return b=void 0,A&&m?r(e):(m=g=void 0,v)}function p(){void 0!==b&&clearTimeout(b),w=0,m=C=g=b=void 0}function h(){return void 0===b?v:c(_())}function f(){var e=_(),n=a(e);if(m=arguments,g=this,C=e,n){if(void 0===b)return i(C);if(F)return b=setTimeout(d,t),r(C)}return void 0===b&&(b=setTimeout(d,t)),v}var m,g,y,v,b,C,w=0,x=!1,F=!1,A=!0;if("function"!=typeof e)throw new TypeError(u);return t=l(t)||0,o(n)&&(x=!!n.leading,y=(F="maxWait"in n)?S(l(n.maxWait)||0,t):y,A="trailing"in n?!!n.trailing:A),f.cancel=p,f.flush=h,f}function r(e,t,r){var i=!0,s=!0;if("function"!=typeof e)throw new TypeError(u);return o(r)&&(i="leading"in r?!!r.leading:i,s="trailing"in r?!!r.trailing:s),n(e,t,{leading:i,maxWait:t,trailing:s})}function o(e){var t=void 0===e?"undefined":a(e);return!!e&&("object"==t||"function"==t)}function i(e){return!!e&&"object"==(void 0===e?"undefined":a(e))}function s(e){return"symbol"==(void 0===e?"undefined":a(e))||i(e)&&C.call(e)==c}function l(e){if("number"==typeof e)return e;if(s(e))return d;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(p,"");var n=f.test(e);return n||m.test(e)?g(e.slice(2),n?2:8):h.test(e)?d:+e}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u="Expected a function",d=NaN,c="[object Symbol]",p=/^\s+|\s+$/g,h=/^[-+]0x[0-9a-f]+$/i,f=/^0b[01]+$/i,m=/^0o[0-7]+$/i,g=parseInt,y="object"==(void 0===t?"undefined":a(t))&&t&&t.Object===Object&&t,v="object"==("undefined"==typeof self?"undefined":a(self))&&self&&self.Object===Object&&self,b=y||v||Function("return this")(),C=Object.prototype.toString,S=Math.max,E=Math.min,_=function(){return b.Date.now()};e.exports=r}).call(t,n(21))},function(e,t,n){"use strict";var r,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"===("undefined"==typeof window?"undefined":o(window))&&(r=window)}e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function 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)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n
'),this.element.appendChild(e));let t=e.getElementsByTagName("span")[0];return t&&(null!=t.textContent?t.textContent=this.options.dictFallbackMessage:null!=t.innerText&&(t.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize(e,t,n,r){let o={srcX:0,srcY:0,srcWidth:e.width,srcHeight:e.height},i=e.width/e.height;null==t&&null==n?(t=o.srcWidth,n=o.srcHeight):null==t?t=n*i:null==n&&(n=t/i);let s=(t=Math.min(t,o.srcWidth))/(n=Math.min(n,o.srcHeight));if(o.srcWidth>t||o.srcHeight>n)if("crop"===r)i>s?(o.srcHeight=e.height,o.srcWidth=o.srcHeight*s):(o.srcWidth=e.width,o.srcHeight=o.srcWidth/s);else{if("contain"!==r)throw new Error(`Unknown resizeMethod '${r}'`);i>s?n=t/i:t=n*i}return o.srcX=(e.width-o.srcWidth)/2,o.srcY=(e.height-o.srcHeight)/2,o.trgWidth=t,o.trgHeight=n,o},transformFile(e,t){return(this.options.resizeWidth||this.options.resizeHeight)&&e.type.match(/image.*/)?this.resizeImage(e,this.options.resizeWidth,this.options.resizeHeight,this.options.resizeMethod,t):t(e)},previewTemplate:i('
\n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n \n \n \n
\n
\n \n \n \n
\n
\n'),drop(e){return this.element.classList.remove("dz-drag-hover")},dragstart(e){},dragend(e){return this.element.classList.remove("dz-drag-hover")},dragenter(e){return this.element.classList.add("dz-drag-hover")},dragover(e){return this.element.classList.add("dz-drag-hover")},dragleave(e){return this.element.classList.remove("dz-drag-hover")},paste(e){},reset(){return this.element.classList.remove("dz-started")},addedfile(e){if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer&&!this.options.disablePreviews){for(var t of(e.previewElement=a.createElement(this.options.previewTemplate.trim()),e.previewTemplate=e.previewElement,this.previewsContainer.appendChild(e.previewElement),e.previewElement.querySelectorAll("[data-dz-name]")))t.textContent=e.name;for(t of e.previewElement.querySelectorAll("[data-dz-size]"))t.innerHTML=this.filesize(e.size);this.options.addRemoveLinks&&(e._removeLink=a.createElement(`
${this.options.dictRemoveFile}`),e.previewElement.appendChild(e._removeLink));let n=t=>(t.preventDefault(),t.stopPropagation(),e.status===a.UPLOADING?a.confirm(this.options.dictCancelUploadConfirmation,(()=>this.removeFile(e))):this.options.dictRemoveFileConfirmation?a.confirm(this.options.dictRemoveFileConfirmation,(()=>this.removeFile(e))):this.removeFile(e));for(let t of e.previewElement.querySelectorAll("[data-dz-remove]"))t.addEventListener("click",n)}},removedfile(e){return null!=e.previewElement&&null!=e.previewElement.parentNode&&e.previewElement.parentNode.removeChild(e.previewElement),this._updateMaxFilesReachedClass()},thumbnail(e,t){if(e.previewElement){e.previewElement.classList.remove("dz-file-preview");for(let n of e.previewElement.querySelectorAll("[data-dz-thumbnail]"))n.alt=e.name,n.src=t;return setTimeout((()=>e.previewElement.classList.add("dz-image-preview")),1)}},error(e,t){if(e.previewElement){e.previewElement.classList.add("dz-error"),"string"!=typeof t&&t.error&&(t=t.error);for(let n of e.previewElement.querySelectorAll("[data-dz-errormessage]"))n.textContent=t}},errormultiple(){},processing(e){if(e.previewElement&&(e.previewElement.classList.add("dz-processing"),e._removeLink))return e._removeLink.innerHTML=this.options.dictCancelUpload},processingmultiple(){},uploadprogress(e,t,n){if(e.previewElement)for(let n of e.previewElement.querySelectorAll("[data-dz-uploadprogress]"))"PROGRESS"===n.nodeName?n.value=t:n.style.width=`${t}%`},totaluploadprogress(){},sending(){},sendingmultiple(){},success(e){if(e.previewElement)return e.previewElement.classList.add("dz-success")},successmultiple(){},canceled(e){return this.emit("error",e,this.options.dictUploadCanceled)},canceledmultiple(){},complete(e){if(e._removeLink&&(e._removeLink.innerHTML=this.options.dictRemoveFile),e.previewElement)return e.previewElement.classList.add("dz-complete")},completemultiple(){},maxfilesexceeded(){},maxfilesreached(){},queuecomplete(){},addedfiles(){}};class a extends s{static initClass(){this.prototype.Emitter=s,this.prototype.events=["drop","dragstart","dragend","dragenter","dragover","dragleave","addedfile","addedfiles","removedfile","thumbnail","error","errormultiple","processing","processingmultiple","uploadprogress","totaluploadprogress","sending","sendingmultiple","success","successmultiple","canceled","canceledmultiple","complete","completemultiple","reset","maxfilesexceeded","maxfilesreached","queuecomplete"],this.prototype._thumbnailQueue=[],this.prototype._processingThumbnail=!1}getAcceptedFiles(){return this.files.filter((e=>e.accepted)).map((e=>e))}getRejectedFiles(){return this.files.filter((e=>!e.accepted)).map((e=>e))}getFilesWithStatus(e){return this.files.filter((t=>t.status===e)).map((e=>e))}getQueuedFiles(){return this.getFilesWithStatus(a.QUEUED)}getUploadingFiles(){return this.getFilesWithStatus(a.UPLOADING)}getAddedFiles(){return this.getFilesWithStatus(a.ADDED)}getActiveFiles(){return this.files.filter((e=>e.status===a.UPLOADING||e.status===a.QUEUED)).map((e=>e))}init(){if("form"===this.element.tagName&&this.element.setAttribute("enctype","multipart/form-data"),this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")&&this.element.appendChild(a.createElement(`
`)),this.clickableElements.length){let e=()=>{this.hiddenFileInput&&this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=document.createElement("input"),this.hiddenFileInput.setAttribute("type","file"),(null===this.options.maxFiles||this.options.maxFiles>1)&&this.hiddenFileInput.setAttribute("multiple","multiple"),this.hiddenFileInput.className="dz-hidden-input",null!==this.options.acceptedFiles&&this.hiddenFileInput.setAttribute("accept",this.options.acceptedFiles),null!==this.options.capture&&this.hiddenFileInput.setAttribute("capture",this.options.capture),this.hiddenFileInput.setAttribute("tabindex","-1"),this.hiddenFileInput.style.visibility="hidden",this.hiddenFileInput.style.position="absolute",this.hiddenFileInput.style.top="0",this.hiddenFileInput.style.left="0",this.hiddenFileInput.style.height="0",this.hiddenFileInput.style.width="0",a.getElement(this.options.hiddenInputContainer,"hiddenInputContainer").appendChild(this.hiddenFileInput),this.hiddenFileInput.addEventListener("change",(()=>{let{files:t}=this.hiddenFileInput;if(t.length)for(let e of t)this.addFile(e);this.emit("addedfiles",t),e()}))};e()}this.URL=null!==window.URL?window.URL:window.webkitURL;for(let e of this.events)this.on(e,this.options[e]);this.on("uploadprogress",(()=>this.updateTotalUploadProgress())),this.on("removedfile",(()=>this.updateTotalUploadProgress())),this.on("canceled",(e=>this.emit("complete",e))),this.on("complete",(e=>{if(0===this.getAddedFiles().length&&0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length)return setTimeout((()=>this.emit("queuecomplete")),0)}));let e=function(e){if(function(e){if(e.dataTransfer.types)for(var t=0;tthis.emit("dragstart",e),dragenter:t=>(e(t),this.emit("dragenter",t)),dragover:t=>{let n;try{n=t.dataTransfer.effectAllowed}catch(e){}return t.dataTransfer.dropEffect="move"===n||"linkMove"===n?"move":"copy",e(t),this.emit("dragover",t)},dragleave:e=>this.emit("dragleave",e),drop:t=>(e(t),this.drop(t)),dragend:e=>this.emit("dragend",e)}}],this.clickableElements.forEach((e=>this.listeners.push({element:e,events:{click:t=>((e!==this.element||t.target===this.element||a.elementInside(t.target,this.element.querySelector(".dz-message")))&&this.hiddenFileInput.click(),!0)}}))),this.enable(),this.options.init.call(this)}destroy(){return this.disable(),this.removeAllFiles(!0),(null!=this.hiddenFileInput?this.hiddenFileInput.parentNode:void 0)&&(this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=null),delete this.element.dropzone,a.instances.splice(a.instances.indexOf(this),1)}updateTotalUploadProgress(){let e,t=0,n=0;if(this.getActiveFiles().length){for(let e of this.getActiveFiles())t+=e.upload.bytesSent,n+=e.upload.total;e=100*t/n}else e=100;return this.emit("totaluploadprogress",e,n,t)}_getParamName(e){return"function"==typeof this.options.paramName?this.options.paramName(e):`${this.options.paramName}${this.options.uploadMultiple?`[${e}]`:""}`}_renameFile(e){return"function"!=typeof this.options.renameFile?e.name:this.options.renameFile(e)}getFallbackForm(){let e,t;if(e=this.getExistingFallback())return e;let n='
';this.options.dictFallbackText&&(n+=`

${this.options.dictFallbackText}

`),n+=`
`;let r=a.createElement(n);return"FORM"!==this.element.tagName?(t=a.createElement(`
`),t.appendChild(r)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),null!=t?t:r}getExistingFallback(){let e=function(e){for(let t of e)if(/(^| )fallback($| )/.test(t.className))return t};for(let n of["div","form"]){var t;if(t=e(this.element.getElementsByTagName(n)))return t}}setupEventListeners(){return this.listeners.map((e=>(()=>{let t=[];for(let n in e.events){let r=e.events[n];t.push(e.element.addEventListener(n,r,!1))}return t})()))}removeEventListeners(){return this.listeners.map((e=>(()=>{let t=[];for(let n in e.events){let r=e.events[n];t.push(e.element.removeEventListener(n,r,!1))}return t})()))}disable(){return this.clickableElements.forEach((e=>e.classList.remove("dz-clickable"))),this.removeEventListeners(),this.disabled=!0,this.files.map((e=>this.cancelUpload(e)))}enable(){return delete this.disabled,this.clickableElements.forEach((e=>e.classList.add("dz-clickable"))),this.setupEventListeners()}filesize(e){let t=0,n="b";if(e>0){let r=["tb","gb","mb","kb","b"];for(let o=0;o=Math.pow(this.options.filesizeBase,4-o)/10){t=e/Math.pow(this.options.filesizeBase,4-o),n=i;break}}t=Math.round(10*t)/10}return`${t} ${this.options.dictFileSizeUnits[n]}`}_updateMaxFilesReachedClass(){return null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")}drop(e){if(!e.dataTransfer)return;this.emit("drop",e);let t=[];for(let n=0;ne.items,null!=t?n(t):void 0))return;var t,n;this.emit("paste",e);let{items:r}=e.clipboardData;return r.length?this._addFilesFromItems(r):void 0}handleFiles(e){for(let t of e)this.addFile(t)}_addFilesFromItems(e){return(()=>{let t=[];for(let r of e){var n;null!=r.webkitGetAsEntry&&(n=r.webkitGetAsEntry())?n.isFile?t.push(this.addFile(r.getAsFile())):n.isDirectory?t.push(this._addFilesFromDirectory(n,n.name)):t.push(void 0):null!=r.getAsFile&&(null==r.kind||"file"===r.kind)?t.push(this.addFile(r.getAsFile())):t.push(void 0)}return t})()}_addFilesFromDirectory(e,t){let n=e.createReader(),r=e=>{return t=console,n="log",r=t=>t.log(e),null!=t&&"function"==typeof t[n]?r(t,n):void 0;var t,n,r};var o=()=>n.readEntries((e=>{if(e.length>0){for(let n of e)n.isFile?n.file((e=>{if(!this.options.ignoreHiddenFiles||"."!==e.name.substring(0,1))return e.fullPath=`${t}/${e.name}`,this.addFile(e)})):n.isDirectory&&this._addFilesFromDirectory(n,`${t}/${n.name}`);o()}return null}),r);return o()}accept(e,t){this.options.maxFilesize&&e.size>1048576*this.options.maxFilesize?t(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(e.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):a.isValidFile(e,this.options.acceptedFiles)?null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(t(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",e)):this.options.accept.call(this,e,t):t(this.options.dictInvalidFileType)}addFile(e){e.upload={uuid:a.uuidv4(),progress:0,total:e.size,bytesSent:0,filename:this._renameFile(e)},this.files.push(e),e.status=a.ADDED,this.emit("addedfile",e),this._enqueueThumbnail(e),this.accept(e,(t=>{t?(e.accepted=!1,this._errorProcessing([e],t)):(e.accepted=!0,this.options.autoQueue&&this.enqueueFile(e)),this._updateMaxFilesReachedClass()}))}enqueueFiles(e){for(let t of e)this.enqueueFile(t);return null}enqueueFile(e){if(e.status!==a.ADDED||!0!==e.accepted)throw new Error("This file can't be queued because it has already been processed or was rejected.");if(e.status=a.QUEUED,this.options.autoProcessQueue)return setTimeout((()=>this.processQueue()),0)}_enqueueThumbnail(e){if(this.options.createImageThumbnails&&e.type.match(/image.*/)&&e.size<=1048576*this.options.maxThumbnailFilesize)return this._thumbnailQueue.push(e),setTimeout((()=>this._processThumbnailQueue()),0)}_processThumbnailQueue(){if(this._processingThumbnail||0===this._thumbnailQueue.length)return;this._processingThumbnail=!0;let e=this._thumbnailQueue.shift();return this.createThumbnail(e,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,!0,(t=>(this.emit("thumbnail",e,t),this._processingThumbnail=!1,this._processThumbnailQueue())))}removeFile(e){if(e.status===a.UPLOADING&&this.cancelUpload(e),this.files=u(this.files,e),this.emit("removedfile",e),0===this.files.length)return this.emit("reset")}removeAllFiles(e){null==e&&(e=!1);for(let t of this.files.slice())(t.status!==a.UPLOADING||e)&&this.removeFile(t);return null}resizeImage(e,t,n,r,o){return this.createThumbnail(e,t,n,r,!0,((t,n)=>{if(null==n)return o(e);{let{resizeMimeType:t}=this.options;null==t&&(t=e.type);let r=n.toDataURL(t,this.options.resizeQuality);return"image/jpeg"!==t&&"image/jpg"!==t||(r=p.restore(e.dataURL,r)),o(a.dataURItoBlob(r))}}))}createThumbnail(e,t,n,r,o,i){let s=new FileReader;s.onload=()=>{e.dataURL=s.result,"image/svg+xml"!==e.type?this.createThumbnailFromUrl(e,t,n,r,o,i):null!=i&&i(s.result)},s.readAsDataURL(e)}displayExistingFile(e,t,n,r,o=!0){if(this.emit("addedfile",e),this.emit("complete",e),o){let o=t=>{this.emit("thumbnail",e,t),n&&n()};e.dataURL=t,this.createThumbnailFromUrl(e,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,this.options.fixOrientation,o,r)}else this.emit("thumbnail",e,t),n&&n()}createThumbnailFromUrl(e,t,n,r,o,i,s){let l=document.createElement("img");return s&&(l.crossOrigin=s),o="from-image"!=getComputedStyle(document.body).imageOrientation&&o,l.onload=()=>{let s=e=>e(1);return"undefined"!=typeof EXIF&&null!==EXIF&&o&&(s=e=>EXIF.getData(l,(function(){return e(EXIF.getTag(this,"Orientation"))}))),s((o=>{e.width=l.width,e.height=l.height;let s=this.options.resize.call(this,e,t,n,r),a=document.createElement("canvas"),u=a.getContext("2d");switch(a.width=s.trgWidth,a.height=s.trgHeight,o>4&&(a.width=s.trgHeight,a.height=s.trgWidth),o){case 2:u.translate(a.width,0),u.scale(-1,1);break;case 3:u.translate(a.width,a.height),u.rotate(Math.PI);break;case 4:u.translate(0,a.height),u.scale(1,-1);break;case 5:u.rotate(.5*Math.PI),u.scale(1,-1);break;case 6:u.rotate(.5*Math.PI),u.translate(0,-a.width);break;case 7:u.rotate(.5*Math.PI),u.translate(a.height,-a.width),u.scale(-1,1);break;case 8:u.rotate(-.5*Math.PI),u.translate(-a.height,0)}c(u,l,null!=s.srcX?s.srcX:0,null!=s.srcY?s.srcY:0,s.srcWidth,s.srcHeight,null!=s.trgX?s.trgX:0,null!=s.trgY?s.trgY:0,s.trgWidth,s.trgHeight);let d=a.toDataURL("image/png");if(null!=i)return i(d,a)}))},null!=i&&(l.onerror=i),l.src=e.dataURL}processQueue(){let{parallelUploads:e}=this.options,t=this.getUploadingFiles().length,n=t;if(t>=e)return;let r=this.getQueuedFiles();if(r.length>0){if(this.options.uploadMultiple)return this.processFiles(r.slice(0,e-t));for(;nt.xhr===e)).map((e=>e))}cancelUpload(e){if(e.status===a.UPLOADING){let t=this._getFilesWithXhr(e.xhr);for(let e of t)e.status=a.CANCELED;void 0!==e.xhr&&e.xhr.abort();for(let e of t)this.emit("canceled",e);this.options.uploadMultiple&&this.emit("canceledmultiple",t)}else e.status!==a.ADDED&&e.status!==a.QUEUED||(e.status=a.CANCELED,this.emit("canceled",e),this.options.uploadMultiple&&this.emit("canceledmultiple",[e]));if(this.options.autoProcessQueue)return this.processQueue()}resolveOption(e,...t){return"function"==typeof e?e.apply(this,t):e}uploadFile(e){return this.uploadFiles([e])}uploadFiles(e){this._transformFiles(e,(t=>{if(this.options.chunking){let n=t[0];e[0].upload.chunked=this.options.chunking&&(this.options.forceChunking||n.size>this.options.chunkSize),e[0].upload.totalChunkCount=Math.ceil(n.size/this.options.chunkSize)}if(e[0].upload.chunked){let n=e[0],r=t[0],o=0;n.upload.chunks=[];let i=()=>{let t=0;for(;void 0!==n.upload.chunks[t];)t++;if(t>=n.upload.totalChunkCount)return;o++;let i=t*this.options.chunkSize,s=Math.min(i+this.options.chunkSize,r.size),l={name:this._getParamName(0),data:r.webkitSlice?r.webkitSlice(i,s):r.slice(i,s),filename:n.upload.filename,chunkIndex:t};n.upload.chunks[t]={file:n,index:t,dataBlock:l,status:a.UPLOADING,progress:0,retries:0},this._uploadData(e,[l])};if(n.upload.finishedChunkUpload=(t,r)=>{let o=!0;t.status=a.SUCCESS,t.dataBlock=null,t.response=t.xhr.responseText,t.responseHeaders=t.xhr.getAllResponseHeaders(),t.xhr=null;for(let e=0;e{this._finished(e,r,null)}))},this.options.parallelChunkUploads)for(let e=0;e{this._finishedUploading(e,n,t)},n.ontimeout=()=>{this._handleUploadError(e,n,`Request timedout after ${this.options.timeout/1e3} seconds`)},n.onerror=()=>{this._handleUploadError(e,n)},(null!=n.upload?n.upload:n).onprogress=t=>this._updateFilesUploadProgress(e,n,t);let s=this.options.defaultHeaders?{Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"}:{};this.options.binaryBody&&(s["Content-Type"]=e[0].type),this.options.headers&&r(s,this.options.headers);for(let e in s){let t=s[e];t&&n.setRequestHeader(e,t)}if(this.options.binaryBody){for(let t of e)this.emit("sending",t,n);this.options.uploadMultiple&&this.emit("sendingmultiple",e,n),this.submitRequest(n,null,e)}else{let r=new FormData;if(this.options.params){let t=this.options.params;"function"==typeof t&&(t=t.call(this,e,n,e[0].upload.chunked?this._getChunk(e[0],n):null));for(let e in t){let n=t[e];if(Array.isArray(n))for(let t=0;t{n[o]=i,++r===e.length&&t(n)}))}_addFormElementData(e){if("FORM"===this.element.tagName)for(let t of this.element.querySelectorAll("input, textarea, select, button")){let n=t.getAttribute("name"),r=t.getAttribute("type");if(r&&(r=r.toLowerCase()),null!=n)if("SELECT"===t.tagName&&t.hasAttribute("multiple"))for(let r of t.options)r.selected&&e.append(n,r.value);else(!r||"checkbox"!==r&&"radio"!==r||t.checked)&&e.append(n,t.value)}}_updateFilesUploadProgress(e,t,n){if(e[0].upload.chunked){let r=e[0],o=this._getChunk(r,t);n?(o.progress=100*n.loaded/n.total,o.total=n.total,o.bytesSent=n.loaded):(o.progress=100,o.bytesSent=o.total),r.upload.progress=0,r.upload.total=0,r.upload.bytesSent=0;for(let e=0;ethis.options.renameFilename.call(this,e.name,e)),"string"==typeof this.options.method&&(this.options.method=this.options.method.toUpperCase()),(n=this.getExistingFallback())&&n.parentNode&&n.parentNode.removeChild(n),!1!==this.options.previewsContainer&&(this.options.previewsContainer?this.previewsContainer=a.getElement(this.options.previewsContainer,"previewsContainer"):this.previewsContainer=this.element),this.options.clickable&&(!0===this.options.clickable?this.clickableElements=[this.element]:this.clickableElements=a.getElements(this.options.clickable,"clickable")),this.init()}}a.initClass(),a.options={},a.optionsForElement=function(e){return e.getAttribute("id")?a.options[d(e.getAttribute("id"))]:void 0},a.instances=[],a.forElement=function(e){if("string"==typeof e&&(e=document.querySelector(e)),null==(null!=e?e.dropzone:void 0))throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");return e.dropzone},a.discover=function(){let e;if(document.querySelectorAll)e=document.querySelectorAll(".dropzone");else{e=[];let t=t=>(()=>{let n=[];for(let r of t)/(^| )dropzone($| )/.test(r.className)?n.push(e.push(r)):n.push(void 0);return n})();t(document.getElementsByTagName("div")),t(document.getElementsByTagName("form"))}return(()=>{let t=[];for(let n of e)!1!==a.optionsForElement(n)?t.push(new a(n)):t.push(void 0);return t})()},a.blockedBrowsers=[/opera.*(Macintosh|Windows Phone).*version\/12/i],a.isBrowserSupported=function(){let e=!0;if(window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if("classList"in document.createElement("a")){void 0!==a.blacklistedBrowsers&&(a.blockedBrowsers=a.blacklistedBrowsers);for(let t of a.blockedBrowsers)if(t.test(navigator.userAgent)){e=!1;continue}}else e=!1;else e=!1;return e},a.dataURItoBlob=function(e){let t=atob(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],r=new ArrayBuffer(t.length),o=new Uint8Array(r);for(let e=0,n=t.length,r=0<=n;r?e<=n:e>=n;r?e++:e--)o[e]=t.charCodeAt(e);return new Blob([r],{type:n})};const u=(e,t)=>e.filter((e=>e!==t)).map((e=>e)),d=e=>e.replace(/[\-_](\w)/g,(e=>e.charAt(1).toUpperCase()));a.createElement=function(e){let t=document.createElement("div");return t.innerHTML=e,t.childNodes[0]},a.elementInside=function(e,t){if(e===t)return!0;for(;e=e.parentNode;)if(e===t)return!0;return!1},a.getElement=function(e,t){let n;if("string"==typeof e?n=document.querySelector(e):null!=e.nodeType&&(n=e),null==n)throw new Error(`Invalid \`${t}\` option provided. Please provide a CSS selector or a plain HTML element.`);return n},a.getElements=function(e,t){let n,r;if(e instanceof Array){r=[];try{for(n of e)r.push(this.getElement(n,t))}catch(e){r=null}}else if("string"==typeof e)for(n of(r=[],document.querySelectorAll(e)))r.push(n);else null!=e.nodeType&&(r=[e]);if(null==r||!r.length)throw new Error(`Invalid \`${t}\` option provided. Please provide a CSS selector, a plain HTML element or a list of those.`);return r},a.confirm=function(e,t,n){return window.confirm(e)?t():null!=n?n():void 0},a.isValidFile=function(e,t){if(!t)return!0;t=t.split(",");let n=e.type,r=n.replace(/\/.*$/,"");for(let o of t)if(o=o.trim(),"."===o.charAt(0)){if(-1!==e.name.toLowerCase().indexOf(o.toLowerCase(),e.name.length-o.length))return!0}else if(/\/\*$/.test(o)){if(r===o.replace(/\/.*$/,""))return!0}else if(n===o)return!0;return!1},"undefined"!=typeof jQuery&&null!==jQuery&&(jQuery.fn.dropzone=function(e){return this.each((function(){return new a(this,e)}))}),a.ADDED="added",a.QUEUED="queued",a.ACCEPTED=a.QUEUED,a.UPLOADING="uploading",a.PROCESSING=a.UPLOADING,a.CANCELED="canceled",a.ERROR="error",a.SUCCESS="success";var c=function(e,t,n,r,o,i,s,l,a,u){let d=function(e){e.naturalWidth;let t=e.naturalHeight,n=document.createElement("canvas");n.width=1,n.height=t;let r=n.getContext("2d");r.drawImage(e,0,0);let{data:o}=r.getImageData(1,0,1,t),i=0,s=t,l=t;for(;l>i;)0===o[4*(l-1)+3]?s=l:i=l,l=s+i>>1;let a=l/t;return 0===a?1:a}(t);return e.drawImage(t,n,r,o,i,s,l,a,u/d)};class p{static initClass(){this.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}static encode64(e){let t,n,r,o,i,s="",l="",a="",u=0;for(;t=e[u++],n=e[u++],l=e[u++],r=t>>2,o=(3&t)<<4|n>>4,i=(15&n)<<2|l>>6,a=63&l,isNaN(n)?i=a=64:isNaN(l)&&(a=64),s=s+this.KEY_STR.charAt(r)+this.KEY_STR.charAt(o)+this.KEY_STR.charAt(i)+this.KEY_STR.charAt(a),t=n=l="",r=o=i=a="",ue.length)break}return n}static decode64(e){let t,n,r,o,i,s="",l="",a=0,u=[];for(/[^A-Za-z0-9\+\/\=]/g.exec(e)&&console.warn("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\nExpect errors in decoding."),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");r=this.KEY_STR.indexOf(e.charAt(a++)),o=this.KEY_STR.indexOf(e.charAt(a++)),i=this.KEY_STR.indexOf(e.charAt(a++)),l=this.KEY_STR.indexOf(e.charAt(a++)),t=r<<2|o>>4,n=(15&o)<<4|i>>2,s=(3&i)<<6|l,u.push(t),64!==i&&u.push(n),64!==l&&u.push(s),t=n=s="",r=o=i=l="",a{const n={init(n){const r=t.default._t("AssetAdmin.INSERT_FROM_FILES","Insert from Files"),o=t.default._t("AssetAdmin.EDIT_IMAGE","Edit image"),i=t.default._t("AssetAdmin.DELETE_IMAGE","Delete image"),s=t.default._t("AssetAdmin.FILE","File");n.addCommand("ssmedia",(()=>{(0,e.default)(`#${n.id}`).entwine("ss").openMediaDialog()})),n.addCommand("ssmedia-delete",(()=>{const e=n.selection.getNode();n.dom.is(e,f)?e.remove():console.error({error:"Unexpected selection - expected image",selectedNode:e})})),n.ui.registry.addButton("ssmedia",{tooltip:r,icon:"image",onAction:()=>n.execCommand("ssmedia"),stateSelector:f}),n.ui.registry.addMenuItem("ssmedia",{text:s,icon:"image",onAction:()=>n.execCommand("ssmedia")}),n.ui.registry.addButton("ssmediaedit",{tooltip:o,icon:"edit-block",onAction:()=>n.execCommand("ssmedia")}),n.ui.registry.addButton("ssmediadelete",{tooltip:i,icon:"remove",onAction:()=>n.execCommand("ssmedia-delete")});const a=n.getParam("image_size_presets");let d=[];return a&&(d=(0,u.imageSizePresetButtons)(n,a)),n.ui.registry.addContextToolbar("ssmedia",{predicate:e=>n.dom.is(e,f),position:"node",scope:"node",items:`${d.join(" ")} | ssmediaedit ssmediadelete`}),n.on("BeforeExecCommand",(e=>{const t=e.command,r=e.ui,o=e.value;"mceEditImage"!==t&&"mceImage"!==t||(e.preventDefault(),n.execCommand("ssmedia",r,o))})),n.on("GetContent",(t=>{const n=(0,e.default)(`
${t.content}
`);n.find(f).add(n.filter(f)).each((function(){const t=(0,e.default)(this),n={src:t.attr("src"),id:t.data("id"),width:t.attr("width"),height:t.attr("height"),class:t.attr("class"),title:t.attr("title"),alt:t.attr("alt"),loading:t.data("loading")},r=l.default.serialise({name:"image",properties:(0,l.sanitiseShortCodeProperties)(n),wrapped:!1});t.replaceWith(r)})),t.content="",n.each((function(){void 0!==this.innerHTML&&(t.content+=this.innerHTML)}))})),n.on("BeforeSetContent",(t=>{let n=t.content,r=l.default.match("image",!1,n);for(;r;){const t=r.properties,o=(0,e.default)("").attr(Object.assign({},t,{id:void 0,"data-id":t.id,"data-shortcode":"image","data-loading":t.loading})).addClass("ss-htmleditorfield-file image");n=n.replace(r.original,(0,e.default)("
").append(o).html()),r=l.default.match("image",!1,n)}t.content=n})),{getMetadata(){return{name:"Silverstripe Media",url:"https://docs.silverstripe.org/en/4/developer_guides/forms/field_types/htmleditorfield"}}}}};tinymce.PluginManager.add("ssmedia",(e=>n.init(e)))})(),e.default.entwine("ss",(t=>{t(".js-injector-boot #insert-media-react__dialog-wrapper").entwine({Element:null,Data:{},ReactRoot:null,onunmatch(){this._clearModal()},_clearModal(){const e=this.getReactRoot();e&&(e.unmount(),this.setReactRoot(null))},open(){const{dispatch:e}=i.default.reducer.store;e(a.initFormStack("insert-media","admin"));const t=tinymce.activeEditor.getParam("image_size_presets");e(a.defineImageSizePresets(t)),this._renderModal(!0)},close(){const{dispatch:e}=i.default.reducer.store;e(a.reset()),this._renderModal(!1)},_renderModal(e){var t=this;const{url:n,...i}=this.getOriginalAttributes(),s=i.hasOwnProperty("ID")&&null!==i.ID,l=this.getFolderId(),a=this.getElement().getEditor(),u=a.getInstance().selection,d=a.getSelection(),c=u.getNode().tagName,p="A"!==c&&("IMG"===c||""===d.trim());let f=this.getReactRoot();f||(f=(0,o.createRoot)(this[0])),f.render(r.default.createElement(h,{title:!1,isOpen:e,folderId:l,onInsert:function(){return t._handleInsert(...arguments)},onClosed:()=>this.close(),bodyClassName:"modal__dialog",className:"insert-media-react__dialog-wrapper",requireLinkText:p,fileAttributes:i,fileSelected:s})),this.setReactRoot(f)},_handleInsert(e,t){let n=!1;this.setData(Object.assign({},e,t));try{let e=null;if(e=t?t.category:"image","image"===e)n=this.insertImage();else n=this.insertFile()}catch(e){this.statusMessage(e,"bad")}return n&&this.close(),Promise.resolve()},getFolderId(){const e=this.getElement();if(!e)return null;const t=Number(e.data("config").upload_folder_id);return isNaN(t)?null:t},getOriginalAttributes(){const e=this.getElement();if(!e)return{};const n=e.getEditor().getSelectedNode();if(!n)return{};const r=t(n),o=(r.attr("href")||"").split("#");if(o[0]){const e=l.default.match("file_link",!1,o[0]);if(e)return{ID:e.properties.id?parseInt(e.properties.id,10):0,Anchor:o[1]||"",Description:r.attr("title"),TargetBlank:!!r.attr("target")}}const i=r.parent(".captionImage").find(".caption"),s={url:r.attr("src"),AltText:r.attr("alt"),Width:r.attr("width"),Height:r.attr("height"),Loading:r.attr("data-loading"),TitleTooltip:r.attr("title"),Alignment:this.findPosition(r.attr("class")),Caption:i.text(),ID:r.attr("data-id")};return["Width","Height","ID"].forEach((e=>{s[e]="string"==typeof s[e]?parseInt(s[e],10):null})),s},findPosition(e){if("string"!=typeof e)return"";const t=e.split(" ");return["leftAlone","center","rightAlone","left","right"].find((e=>t.indexOf(e)>-1))},getAttributes(){const e=this.getData();return{src:e.url,alt:e.AltText,width:e.Width,height:e.Height,title:e.TitleTooltip,class:e.Alignment,"data-id":e.ID,"data-shortcode":"image","data-loading":e.Loading}},getExtraData(){const e=this.getData();return{CaptionText:e&&e.Caption}},insertFile(){const e=this.getData(),n=this.getElement().getEditor(),r=t(n.getSelectedNode()),o=l.default.serialise({name:"file_link",properties:{id:e.ID}},!0);let i=n.getSelection()||e.Text||e.filename;r.is("a")&&r.html()&&(i="");const s={href:o,target:e.TargetBlank?"_blank":"",title:e.Description};if(r.is("img")){i=e.Text||e.filename;const o=t("").attr(s).text(i);r.replaceWith(o),n.addUndo(),n.repaint()}else this.insertLinkInEditor(s,i);return!0},insertImage(){const e=this.getElement();if(!e)return!1;const n=e.getEditor();if(!n)return!1;const r=t(n.getSelectedNode()),o=this.getAttributes(),i=this.getExtraData();let s=r&&r.is("img,a")?r:null;s&&s.parent().is(".captionImage")&&(s=s.parent());const l=r&&r.is("img")?r:t("");l.attr(o).addClass("ss-htmleditorfield-file image");let a=l.parent(".captionImage"),u=a.find(".caption");i.CaptionText?(a.length||(a=t("
")),a.attr("class",`captionImage ${o.class}`).removeAttr("data-mce-style").width(o.width),u.length||(u=t('

').appendTo(a)),u.attr("class",`caption ${o.class}`).text(i.CaptionText)):(a=null,u=null);const d=a||l;return s&&s.not(d).length&&s.replaceWith(d),a&&a.prepend(l),s||(n.repaint(),n.insertContent(t("
").append(d).html(),{skip_undo:1})),n.addUndo(),n.repaint(),!0},statusMessage(n,r){const o=t("
").text(n).html();e.default.noticeAdd({text:o,type:r,stayTime:5e3,inEffect:{left:"0",opacity:"show"}})}})}))}()}(); \ No newline at end of file diff --git a/client/dist/js/bundle.js b/client/dist/js/bundle.js index fba9926bb..a56ee24c5 100644 --- a/client/dist/js/bundle.js +++ b/client/dist/js/bundle.js @@ -1,30 +1 @@ -!function(){var e={9588:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=s(n(5207)),o=s(n(1991)),i=s(n(315));function s(e){return e&&e.__esModule?e:{default:e}}t.default=()=>{r.default.transform("move-form-disabled",(e=>{e.component("TreeDropdownField.AssetAdmin.MoveForm",i.default)})),r.default.transform("owner-unpublishing",(e=>{e.component("FormAction.AssetAdmin.EditForm.action_unpublish",o.default)}))}},2038:function(e,t,n){"use strict";var r=c(n(6177)),o=c(n(6194)),i=c(n(4736)),s=c(n(9588)),l=c(n(420)),a=c(n(4121)),u=c(n(2433)),d=n(5125);function c(e){return e&&e.__esModule?e:{default:e}}document.addEventListener("DOMContentLoaded",(()=>{(0,a.default)(),(0,s.default)();const e=r.default.getSection("SilverStripe\\AssetAdmin\\Controller\\AssetAdmin").reactRoutePath;o.default.add({path:"/",routes:[{path:(0,d.joinUrlPaths)(e,"show/:folderId/:viewAction/:fileId"),component:i.default},{path:(0,d.joinUrlPaths)(e,"show/:folderId/:viewAction"),component:i.default},{path:(0,d.joinUrlPaths)(e,"show/:folderId"),component:i.default},{path:e,component:i.default}]}),(0,u.default)(),(0,l.default)()}))},4121:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=f(n(5207)),o=f(n(9725)),i=f(n(3058)),s=f(n(853)),l=f(n(6931)),a=f(n(3517)),u=f(n(2397)),d=f(n(9005)),c=f(n(6493)),p=n(1037);function f(e){return e&&e.__esModule?e:{default:e}}t.default=()=>{r.default.component.registerMany({UploadField:o.default,UploadFieldItem:i.default,PreviewImageField:a.default,HistoryList:d.default,ProportionConstraintField:u.default,AssetDropzone:s.default,InsertMediaModal:l.default,GalleryToolbar:c.default,GalleryItemFile:p.File,GalleryItemFolder:p.Folder})}},2433:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=u(n(5207)),o=n(6298),i=u(n(5518)),s=u(n(6153)),l=u(n(3772)),a=u(n(5364));function u(e){return e&&e.__esModule?e:{default:e}}t.default=()=>{r.default.query.registerFragment("FileInterfaceFields",o.fileInterface),r.default.query.registerFragment("FileFields",o.file),r.default.query.register("ReadFilesQuery",i.default),r.default.query.register("readDescendantFileCountsQuery",l.default),r.default.query.register("ReadOneFileQuery",s.default),r.default.query.register("readFileUsageQuery",a.default)}},420:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=f(n(5207)),o=n(9367),i=f(n(8518)),s=f(n(8310)),l=f(n(2726)),a=f(n(7668)),u=f(n(5214)),d=f(n(2482)),c=f(n(9266)),p=f(n(8178));function f(e){return e&&e.__esModule?e:{default:e}}t.default=()=>{r.default.reducer.register("assetAdmin",(0,o.combineReducers)({gallery:i.default,queuedFiles:s.default,uploadField:l.default,previewField:a.default,imageLoad:u.default,displaySearch:d.default,confirmDeletion:c.default,modal:p.default}))}},853:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=u(n(5815)),i=u(n(3724)),s=u(n(1669)),l=n(5716),a=u(n(6935));function u(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}let c=0;class p extends r.Component{constructor(e){super(e),this.dropzone=null,this.dragging=!1,this.handleAccept=this.handleAccept.bind(this),this.handleAddedFile=this.handleAddedFile.bind(this),this.handleDragEnter=this.handleDragEnter.bind(this),this.handleDragLeave=this.handleDragLeave.bind(this),this.handleDrop=this.handleDrop.bind(this),this.handleUploadProgress=this.handleUploadProgress.bind(this),this.handleUploadComplete=this.handleUploadComplete.bind(this),this.handleError=this.handleError.bind(this),this.handleSending=this.handleSending.bind(this),this.handleSuccess=this.handleSuccess.bind(this),this.handleQueueComplete=this.handleQueueComplete.bind(this),this.loadImage=this.loadImage.bind(this),this.handleMaxFilesExceeded=this.handleMaxFilesExceeded.bind(this)}componentDidMount(){this.dropzone=new i.default(this.dropzoneRef,Object.assign({},this.getDefaultOptions(),this.props.options));const{name:e}=this.props;e&&this.dropzone.hiddenFileInput&&this.dropzone.hiddenFileInput.classList.add(`dz-input-${e}`),void 0!==this.props.promptOnRemove&&this.setPromptOnRemove(this.props.promptOnRemove)}componentDidUpdate(e){const{name:t}=this.props;t&&this.dropzone.hiddenFileInput&&this.dropzone.hiddenFileInput.classList.add(`dz-input-${t}`),this.props.canUpload&&e.options!==this.props.options&&this.dropzone&&(this.dropzone.enable(),this.dropzone.options=Object.assign({},this.getDefaultOptions(),this.dropzone.options,this.props.options))}componentWillUnmount(){this.dropzone.files=[],this.dropzone.destroy()}getDefaultOptions(){let e=null,t=this.props.uploadSelector;if(!t&&this.props.uploadButton&&(t=".asset-dropzone__upload-button"),t){const n=(0,s.default)(this.dropzoneRef).find(t);n&&n.length&&(e=n.toArray())}return{accept:this.handleAccept,addedfile:this.handleAddedFile,dragenter:this.handleDragEnter,dragleave:this.handleDragLeave,drop:this.handleDrop,maxfilesexceeded:this.handleMaxFilesExceeded,uploadprogress:this.handleUploadProgress,complete:this.handleUploadComplete,dictDefaultMessage:o.default._t("AssetAdmin.DROPZONE_DEFAULT_MESSAGE","Drop files here to upload"),dictFallbackMessage:o.default._t("AssetAdmin.DROPZONE_FALLBACK_MESSAGE","Your browser does not support drag'n'drop file uploads."),dictFallbackText:o.default._t("AssetAdmin.DROPZONE_FALLBACK_TEXT","Please use the fallback form below to upload your files like in the olden days."),dictInvalidFileType:o.default._t("AssetAdmin.DROPZONE_INVALID_FILE_TYPE","You can't upload files of this type."),dictResponseError:o.default._t("AssetAdmin.DROPZONE_RESPONSE_ERROR","Server responded with an error."),dictCancelUpload:o.default._t("AssetAdmin.DROPZONE_CANCEL_UPLOAD","Cancel upload"),dictCancelUploadConfirmation:o.default._t("AssetAdmin.DROPZONE_CANCEL_UPLOAD_CONFIRMATION","Are you sure you want to cancel this upload?"),dictRemoveFile:o.default._t("AssetAdmin.DROPZONE_REMOVE_FILE","Remove file"),dictMaxFilesExceeded:o.default._t("AssetAdmin.DROPZONE_MAX_FILES_EXCEEDED","You can not upload any more files."),error:this.handleError,sending:this.handleSending,success:this.handleSuccess,queuecomplete:this.handleQueueComplete,thumbnailHeight:150,thumbnailWidth:200,timeout:0,clickable:e}}getFileCategory(e){return e.split("/")[0]}getLoadPreview(e){return new Promise((t=>{const n=new FileReader;n.onload=n=>{if("image"===this.getFileCategory(e.type)){const e=new Image;t(this.loadImage(e,n.target.result))}else t({})},n.readAsDataURL(e)}))}getFileTitle(e){return e.replace(/[.][^.]+$/,"").replace(/-_/," ")}setPromptOnRemove(e){this.dropzone.options.dictRemoveFileConfirmation=e}handleDragEnter(e){this.props.canUpload&&(this.dragging=!0,this.forceUpdate(),"function"==typeof this.props.onDragEnter&&this.props.onDragEnter(e))}handleDragLeave(e){const t=this.dropzoneRef;this.props.canUpload&&e.target===t&&(this.dragging=!1,this.forceUpdate(),"function"==typeof this.props.onDragLeave&&this.props.onDragLeave(e,t))}handleUploadProgress(e,t,n){"function"==typeof this.props.onUploadProgress&&this.props.onUploadProgress(e,t,n)}handleUploadComplete(e){"function"==typeof this.props.onUploadComplete&&this.props.onUploadComplete(e.status)}handleDrop(e){this.dragging=!1,this.forceUpdate(),"function"==typeof this.props.onDrop&&this.props.onDrop(e)}handleSending(e,t,n){"function"==typeof this.props.updateFormData&&this.props.updateFormData(n),n.append("SecurityID",this.props.securityID),n.append("ParentID",this.props.folderId);const r=Object.assign({},t,{abort:()=>{this.dropzone.cancelUpload(e),t.abort()}});"function"==typeof this.props.onSending&&this.props.onSending(e,r,n)}handleMaxFilesExceeded(e){return"function"!=typeof this.props.onMaxFilesExceeded||this.props.onMaxFilesExceeded(e)}generateQueuedId(){return c+=1,c}handleAccept(e,t){return("function"!=typeof this.props.canFileUpload||this.props.canFileUpload(e))&&this.props.canUpload?t():t(o.default._t("AssetAdmin.DROPZONE_CANNOT_UPLOAD","Uploading not permitted."))}handleAddedFile(e){e._queuedId=this.generateQueuedId();const t={category:this.getFileCategory(e.type),filename:e.name,queuedId:e._queuedId,size:e.size,title:this.getFileTitle(e.name),extension:(0,l.getFileExtension)(e.name),type:e.type,uploadedToFolderId:this.props.folderId};this.props.onAddedFile(t);return this.getLoadPreview(e).then((e=>{const n={height:e.height,width:e.width,url:e.thumbnailURL,thumbnail:e.thumbnailURL,smallThumbnail:e.thumbnailURL};return"function"==typeof this.props.onPreviewLoaded&&this.props.onPreviewLoaded(t,n),{...t,...n}}))}loadImage(e,t){return new Promise((n=>{const r=document.createElement("canvas"),o=r.getContext("2d");e.onload=()=>{const t=2*this.props.preview.width,i=2*this.props.preview.height,s=e.naturalWidth/e.naturalHeight;e.naturalWidth{this.dropzoneRef=e}},this.props.uploadButton&&r.default.createElement("button",t,o.default._t("AssetAdmin.DROPZONE_UPLOAD")),this.props.children)}}p.propTypes={folderId:a.default.number.isRequired,onAccept:a.default.func,onAddedFile:a.default.func.isRequired,onDragEnter:a.default.func,onDragLeave:a.default.func,onDrop:a.default.func,onError:a.default.func.isRequired,onPreviewLoaded:a.default.func,onSending:a.default.func,onSuccess:a.default.func.isRequired,onMaxFilesExceeded:a.default.func,updateFormData:a.default.func,canFileUpload:a.default.func,onQueueComplete:a.default.func,options:a.default.shape({url:a.default.string.isRequired}),promptOnRemove:a.default.string,securityID:a.default.string.isRequired,uploadButton:a.default.bool,uploadSelector:a.default.string,canUpload:a.default.bool.isRequired,preview:a.default.shape({width:a.default.number,height:a.default.number}),className:a.default.string},p.defaultProps={uploadButton:!0};t.default=p},7153:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=a(n(6935)),i=a(n(2932)),s=a(n(2926)),l=a(n(5815));function a(e){return e&&e.__esModule?e:{default:e}}function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}class d extends r.Component{render(){const{isDropping:e,badge:t,onClick:n}=this.props,o=["btn","btn-secondary","btn--no-text","font-icon-level-up","btn--icon-large","gallery__back"];e&&(o.push("z-depth-1"),o.push("gallery__back--droppable-hover"));const i=t?r.default.createElement(s.default,{className:"gallery__back-badge",status:t.status,message:t.message}):null;return r.default.createElement("button",{className:o.join(" "),title:l.default._t("AssetAdmin.BACK_DESCRIPTION","Navigate up a level"),onClick:n},i)}}t.Component=d,d.propTypes={onClick:o.default.func,isDropping:o.default.bool,badge:o.default.shape(s.default.propTypes)};t.default=(0,i.default)("GalleryItem")(d)},3229:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=c(n(5815)),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=n(9040),s=n(5207),l=n(3556),a=c(n(6923)),u=c(n(6935));function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}function c(e){return e&&e.__esModule?e:{default:e}}class p extends o.Component{constructor(e){super(e),this.handleChangeValue=this.handleChangeValue.bind(this),this.renderChild=this.renderChild.bind(this)}getOptionByValue(e){return this.props.actions.find((t=>t.value===e))}handleChangeValue(e){let t=null;const n=this.getOptionByValue(e.target.value);return null===n?null:(t="function"==typeof n.confirm?n.confirm(this.props.items).then((()=>n.callback(e,this.props.items))).catch((e=>{if("cancelled"!==e)throw e})):n.callback(e,this.props.items)||Promise.resolve(),t)}renderChild(e,t){const n=(0,a.default)("bulk-actions__action",e.className||"font-icon-info-circled",{btn:t<2,"bulk-actions__action--more":t>2});return t<2?o.default.createElement(l.Button,{className:n,key:e.value,onClick:this.handleChangeValue,value:e.value,color:e.color},e.label):o.default.createElement(l.DropdownItem,{type:"button",className:n,key:e.value,onClick:this.handleChangeValue,value:e.value},e.label)}render(){if(!this.props.items.length)return null;let e=this.props.actions.filter((e=>!e.canApply||e.canApply(this.props.items)));if(e=e.map(this.renderChild),!e.length)return null;const{ActionMenu:t,showCount:n}=this.props,i=r.default._t("AssetAdmin.BULK_ACTIONS_SELECT_ALL","Select all"),s=r.default.sprintf(r.default._t("AssetAdmin.BULK_ACTIONS_SELECTED","%s selected"),this.props.items.length),a=r.default._t("AssetAdmin.BULK_ACTIONS_CLEAR_SELECTION","Clear selection");return o.default.createElement("div",{className:"bulk-actions fieldholder-small"},n&&o.default.createElement(o.default.Fragment,null,o.default.createElement(l.Button,{className:"bulk-actions-counter font-icon-cross-mark",onClick:this.props.onClearSelection,title:a},s),o.default.createElement("div",{className:"bulk-actions-select-all"},o.default.createElement(l.Button,{onClick:this.props.onSelectAll},i))),e.slice(0,2),e.length>2&&t?o.default.createElement(t,{id:"BulkActions",className:"bulk-actions__more-actions-menu"},e.slice(2)):e.slice(2))}}t.Component=p,p.propTypes={items:u.default.array,actions:u.default.arrayOf(u.default.shape({value:u.default.string.isRequired,label:u.default.string.isRequired,className:u.default.string,destructive:u.default.bool,callback:u.default.func,canApply:u.default.func,confirm:u.default.func})),ActionMenu:u.default.elementType,showCount:u.default.bool,onClearSelection:u.default.func.isRequired,onSelectAll:u.default.func.isRequired},p.defaultProps={items:[],actions:[],ActionMenu:null,total:null,showCount:!0,totalReachedMessage:r.default._t("")};const f=(0,i.connect)((function(e){return{gallery:e.assetAdmin.gallery}}))(p);t.default=(0,s.inject)(["ActionMenu"],(e=>({ActionMenu:e})),(()=>"BulkActions"))(f)},1037:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Folder=t.File=t.Component=void 0;var r=E(n(5815)),o=_(n(1594)),i=E(n(6923)),s=E(n(6379)),l=E(n(6022)),a=E(n(2063)),u=E(n(2932)),d=E(n(2926)),c=E(n(1990)),p=E(n(4350)),f=n(9040),h=n(9367),m=n(4172),g=_(n(769)),y=E(n(1838)),v=E(n(6935));function b(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(b=function(e){return e?n:t})(e)}function _(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=b(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function E(e){return e&&e.__esModule?e:{default:e}}function C(){return C=Object.assign?Object.assign.bind():function(e){for(var t=1;t{e.preventDefault()};class F extends o.Component{constructor(e){super(e),this.handleSelect=this.handleSelect.bind(this),this.handleActivate=this.handleActivate.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancelUpload=this.handleCancelUpload.bind(this)}componentDidUpdate(){S(this.props)&&this.props.actions.imageLoad.loadImage(this.props.item.thumbnail,this.props.sectionConfig.imageRetry)}getThumbnailStyles(){const{item:{thumbnail:e,version:t},bustCache:n}=this.props;if(!this.isImage()||!e||this.missing())return{};const r=!1===n||!t||e.startsWith("data:image/")?e:`${e}?vid=${t}`;switch(this.props.loadState){case y.default.SUCCESS:case y.default.DISABLED:return{backgroundImage:`url(${r})`};default:return{}}}getErrorMessage(){let e=null;const{item:t,loadState:n}=this.props;if(this.hasError()?e=t.message.value:this.missing()?e=r.default._t("AssetAdmin.FILE_MISSING","File cannot be found"):n===y.default.FAILED&&(e=r.default._t("AssetAdmin.FILE_LOAD_ERROR","Thumbnail not available")),null!==e){return e=this.getItemFunction("updateErrorMessage")(e,this.props),o.default.createElement("span",{className:"gallery-item__error-message"},e)}return null}getThumbnailClassNames(){const e=["gallery-item__thumbnail"];switch(this.isImageSmallerThanThumbnail()&&e.push("gallery-item__thumbnail--small"),!this.props.item.thumbnail&&this.isImage()&&e.push("gallery-item__thumbnail--no-preview"),this.props.loadState){case y.default.LOADING:case y.default.WAITING:e.push("gallery-item__thumbnail--loading");break;case y.default.FAILED:e.push("gallery-item__thumbnail--error")}return e.join(" ")}getItemClassNames(){const e=this.props.item.category||"false",t=this.props.selectable&&(this.props.item.selected||this.props.isDragging);return(0,i.default)({"gallery-item":!0,[`gallery-item--${e}`]:!0,"gallery-item--max-selected":this.props.maxSelected&&!t,"gallery-item--missing":this.missing(),"gallery-item--selectable":this.props.selectable,"gallery-item--selected":t,"gallery-item--dropping":this.props.isDropping,"gallery-item--highlighted":this.props.item.highlighted,"gallery-item--error":this.hasError(),"gallery-item--dragging":this.props.isDragging})}getItemFunction(e){const{item:t}=this.props;return"function"==typeof t[e]?t[e]:this.props[e]}getStatusFlags(){let e=[];const{item:t}=this.props;"folder"!==t.type&&(t.draft?e.push({key:"status-draft",title:r.default._t("File.DRAFT","Draft"),className:"gallery-item--draft"}):t.modified&&e.push({key:"status-modified",title:r.default._t("File.MODIFIED","Modified"),className:"gallery-item--modified"}));return e=this.getItemFunction("updateStatusFlags")(e,this.props),o.default.createElement("div",{className:"gallery-item__status-flags"},e.map((e=>o.default.createElement("span",e))))}getStatusIcons(){const{item:e}=this.props,t=[];return e.hasRestrictedAccess&&t.push({key:"status-restricted",fileID:e.id,hasRestrictedAccess:!0,placement:"top",disableTooltip:"folder"===e.type,includeBackground:"folder"!==e.type}),e.isTrackedFormUpload&&"folder"!==e.type&&t.push({key:"status-tracked-form-upload",fileID:e.id,isTrackedFormUpload:!0,hasRestrictedAccess:e.hasRestrictedAccess,placement:"top",includeBackground:!0}),o.default.createElement("div",{className:"gallery-item__status-icons"},t.map((e=>o.default.createElement(c.default,e))))}getProgressBar(){let e=null;const{item:t}=this.props,n={className:"gallery-item__progress-bar",style:{width:`${t.progress}%`}};this.hasError()||!this.uploading()||this.complete()||(e=o.default.createElement("div",{className:"gallery-item__upload-progress"},o.default.createElement("div",n)));return e=this.getItemFunction("updateProgressBar")(e,this.props),e}isImageSmallerThanThumbnail(){if(!this.isImage()||this.missing())return!1;const e=this.props.item.width,t=this.props.item.height;return t&&e&&t0}missing(){return!this.exists()&&this.saved()}uploading(){return this.props.item.queuedId&&!this.saved()}exists(){return this.props.item.exists}isImage(){return"image"===this.props.item.category}canBatchSelect(){return this.props.selectable&&this.props.item.canEdit}hasError(){let e=!1;return this.props.item.message&&(e="error"===this.props.item.message.type),e}handleActivate(e){e.stopPropagation(),"function"==typeof this.props.onActivate&&this.saved()&&this.props.onActivate(e,this.props.item)}handleSelect(e){e.stopPropagation(),e.preventDefault(),"function"==typeof this.props.onSelect&&this.props.onSelect(e,this.props.item)}handleKeyDown(e){s.default.SPACE_KEY_CODE===e.keyCode&&(e.preventDefault(),this.canBatchSelect()&&this.handleSelect(e)),s.default.RETURN_KEY_CODE===e.keyCode&&this.handleActivate(e)}handleCancelUpload(e){e.stopPropagation(),e.preventDefault(),this.hasError()?this.props.onRemoveErroredUpload(this.props.item):this.props.onCancelUpload&&this.props.onCancelUpload(this.props.item)}render(){let e=null,t=null,n=null;const{id:i,queuedId:s}=this.props.item,l=i?`item-${i}`:`queued-${s}`;if(this.props.selectable&&(this.canBatchSelect()&&(e=this.handleSelect),t="font-icon-tick"),this.uploading())e=this.handleCancelUpload,t="font-icon-cancel";else if(this.exists()){const e=r.default._t("AssetAdmin.VIEW","View");n=o.default.createElement("div",{className:"gallery-item--overlay font-icon-eye"},e)}const a=this.props.badge,u={className:"gallery-item__checkbox",type:"checkbox",title:r.default._t("AssetAdmin.SELECT","Select"),tabIndex:-1,onMouseDown:w,id:l},c=["gallery-item__checkbox-label",t];this.canBatchSelect()||(u.disabled=!0,c.push("gallery-item__checkbox-label--disabled"));const p={className:c.join(" "),onClick:e};return o.default.createElement("div",{className:this.getItemClassNames(),"data-id":this.props.item.id,tabIndex:0,role:"button",onKeyDown:this.handleKeyDown,onClick:this.handleActivate},!!a&&o.default.createElement(d.default,{className:"gallery-item__badge",status:a.status,message:a.message}),o.default.createElement("div",{ref:e=>{this.thumbnail=e},className:this.getThumbnailClassNames(),style:this.getThumbnailStyles()},n,this.getStatusFlags(),this.getStatusIcons()),this.getProgressBar(),this.getErrorMessage(),this.props.children,o.default.createElement("div",{className:"gallery-item__title",ref:e=>{this.title=e}},o.default.createElement("label",C({},p,{htmlFor:l}),o.default.createElement("input",u)),this.props.item.title))}}t.Component=F,F.propTypes={sectionConfig:p.default,item:l.default,loadState:v.default.oneOf(Object.values(y.default)),bustCache:v.default.bool,highlighted:v.default.bool,selected:v.default.bool,isDropping:v.default.bool,isDragging:v.default.bool,message:v.default.shape({value:v.default.string,type:v.default.string}),selectable:v.default.bool,onActivate:v.default.func,onSelect:v.default.func,onCancelUpload:v.default.func,onRemoveErroredUpload:v.default.func,badge:v.default.shape({status:v.default.string,message:v.default.string}),updateStatusFlags:v.default.func,updateProgressBar:v.default.func,updateErrorMessage:v.default.func},F.defaultProps={item:{},sectionConfig:{imageRetry:{}},updateStatusFlags:e=>e,updateProgressBar:e=>e,updateErrorMessage:e=>e,bustCache:!0};const I=(0,f.connect)((function(e,t){const{bustCache:n}=e.config.sections.find((e=>"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"===e.name));let r=y.default.DISABLED;if(S(t)){const n=e.assetAdmin.imageLoad.files.find((e=>t.item.thumbnail===e.url));r=n&&n.status||y.default.NONE}return{bustCache:n,loadState:r}}),(function(e){return{actions:{imageLoad:(0,h.bindActionCreators)(g,e)}}}))(F),O="GalleryItem",A=t.File=(0,m.createSelectable)((0,a.default)(O)(I));t.Folder=(0,m.createSelectable)((0,u.default)(O)(A));t.default=I},2914:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=a(n(6935)),i=n(1820),s=a(n(2926)),l=a(n(1037));function a(e){return e&&e.__esModule?e:{default:e}}function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t1?r.default.createElement("div",{key:"1",className:"gallery-item__drag-shadow"}):null,t>2?r.default.createElement("div",{key:"2",className:"gallery-item__drag-shadow gallery-item__drag-shadow--second"}):null];return r.default.createElement("div",{className:"gallery-item__drag-layer"},r.default.createElement("div",{className:"gallery-item__drag-layer-item",style:this.getOffset()},r.default.createElement("div",{className:"gallery-item__drag-layer-preview"},n,r.default.createElement(l.default,d({},e.props,{isDragging:!0}))),t>1?r.default.createElement(s.default,{className:"gallery-item__drag-layer-count",status:"info",message:`${t}`}):null))}}c.propTypes={item:o.default.object,offset:o.default.shape({x:o.default.number.isRequired,y:o.default.number.isRequired}),isDragging:o.default.bool.isRequired};t.default=(0,i.DragLayer)((e=>({item:e.getItem(),offset:e.getInitialClientOffset(),dragged:e.getDifferenceFromInitialOffset(),isDragging:e.isDragging()})))(c)},2063:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){const t={canDrag(e){return e.canDrag},beginDrag(e){const{id:t}=e.item;"function"==typeof e.onDrag&&e.onDrag(!0,t);const n=e.selectedFiles.concat([]);return n.includes(t)||n.push(t),{selected:n,props:e}},endDrag(e){const{id:t}=e.item;"function"==typeof e.onDrag&&e.onDrag(!1,t)}},n=(0,s.DragSource)(e,t,((e,t)=>({connectDragPreview:e.dragPreview(),connectDragSource:e.dragSource(),isDragging:t.isDragging()})));return e=>{class t extends o.Component{componentDidMount(){this.props.connectDragPreview((0,l.getEmptyImage)(),{captureDraggingState:!0})}render(){const{connectDragSource:t}=this.props,n=o.default.createElement(e,this.props);return"string"==typeof n.type?t(n):t(o.default.createElement("div",{className:"gallery-item__draggable"},n))}}return t.propTypes={connectDragSource:i.default.func.isRequired,connectDragPreview:i.default.func.isRequired,item:i.default.shape({id:i.default.number.isRequired}).isRequired,onDrag:i.default.func,selectedFiles:i.default.arrayOf(i.default.number)},n(t)}};var r,o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=a(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=(r=n(6935))&&r.__esModule?r:{default:r},s=n(1820),l=n(8724);function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(a=function(e){return e?n:t})(e)}},2932:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){const t={drop(e,t){if(t.canDrop()){const n=t.getItem();e.onDropFiles(e.item.id,n.selected)}},canDrop(e,t){return!t.getItem().selected.includes(e.item.id)}},n=(0,s.DropTarget)(e,t,((e,t)=>{const n=t.isOver();return{isDropping:n&&t.canDrop(),connectDropTarget:e.dropTarget(),isOver:n}}));return e=>{class t extends o.Component{render(){const{connectDropTarget:t}=this.props,n=o.default.createElement(e,this.props);return"string"==typeof n.type?t(n):t(o.default.createElement("div",{className:"gallery-item__droppable"},n))}}return t.propTypes={connectDropTarget:i.default.func.isRequired,item:i.default.shape({id:i.default.number.isRequired}).isRequired},n(t)}};var r,o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=(r=n(6935))&&r.__esModule?r:{default:r},s=n(1820);function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}},7847:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=s(n(6935)),i=s(n(5815));function s(e){return e&&e.__esModule?e:{default:e}}function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}class a extends r.Component{constructor(){super(),this.handleCreateFolder=this.handleCreateFolder.bind(this)}handleCreateFolder(e){const{onCreateFolder:t}=this.props;e.preventDefault(),"function"==typeof t&&t()}render(){const{canEdit:e}=this.props;return r.default.createElement("button",{id:"add-folder-button",className:"btn btn-secondary font-icon-folder-add btn--icon-xl",type:"button",onClick:this.handleCreateFolder,disabled:!e},r.default.createElement("span",{className:"btn__text btn__title"},i.default._t("AssetAdmin.ADD_FOLDER_BUTTON")))}}a.propTypes={canEdit:o.default.bool.isRequired,onCreateFolder:o.default.func.isRequired};t.default=a},3577:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=s(n(6935)),i=s(n(7153));function s(e){return e&&e.__esModule?e:{default:e}}function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}class a extends r.Component{constructor(e){super(e),this.handleBackClick=this.handleBackClick.bind(this)}handleBackClick(e){const{onOpenFolder:t,folder:n}=this.props;e.preventDefault(),"function"==typeof t&&t(n.parentId)}render(){const{folder:e,badges:t,onMoveFiles:n,BackComponent:o}=this.props,{parentId:i}=e;if(null===i)return null;const s=t.find((e=>e.id===i));return r.default.createElement("div",{className:"gallery__back-container"},r.default.createElement(o,{item:{id:i},onClick:this.handleBackClick,onDropFiles:n,badge:s}))}}a.propTypes={folder:o.default.shape({id:o.default.number,title:o.default.string,parentId:o.default.number,canView:o.default.bool,canEdit:o.default.bool}).isRequired,badges:o.default.arrayOf(o.default.shape({id:o.default.number,message:o.default.node,status:o.default.string})).isRequired,onOpenFolder:o.default.func.isRequired,onMoveFiles:o.default.func.isRequired,BackComponent:o.default.oneOfType([o.default.object,o.default.func])},a.defaultProps={BackComponent:i.default};t.default=a},1859:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=s(n(5815)),i=s(n(6935));function s(e){return e&&e.__esModule?e:{default:e}}function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}class a extends r.Component{render(){const{canEdit:e}=this.props;return r.default.createElement("button",{id:"upload-button",className:"btn btn-secondary font-icon-upload btn--icon-xl",type:"button",disabled:!e},r.default.createElement("span",{className:"btn__text btn__title"},o.default._t("AssetAdmin.DROPZONE_UPLOAD")))}}a.defaultProps={canEdit:i.default.func.isRequired};t.default=a},6493:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=u(n(6935)),i=n(9040),s=u(n(3577)),l=u(n(1859)),a=u(n(7847));function u(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}class c extends r.Component{constructor(e){super(e),this.handleSelectSort=this.handleSelectSort.bind(this),this.handleViewChange=this.handleViewChange.bind(this)}handleSelectSort(e){this.props.onSort(e.currentTarget.value)}handleViewChange(e){const t=e.currentTarget.value;this.props.onViewChange(t)}renderSort(){return"tile"!==this.props.view?null:r.default.createElement("div",{className:"gallery__sort fieldholder-small"},r.default.createElement("select",{className:"dropdown no-change-track no-chzn",tabIndex:"0",style:{width:"160px"},defaultValue:this.props.sort},this.props.sorters.map((e=>{const t=e.label.replace(/^\w|[\s\-]+\w/g,(e=>e.toUpperCase()));return r.default.createElement("option",{key:`${e.field}-${e.direction}`,onClick:this.handleSelectSort,"data-field":e.field,"data-direction":e.direction,value:`${e.field},${e.direction}`},t)}))))}renderViewChangeButtons(){return["tile","table"].map((e=>{const t="table"===e?"list":"thumbnails",n=["gallery__view-change-button","btn btn-secondary","btn--icon-sm","btn--no-text"];return e===this.props.view?null:(n.push(`font-icon-${t}`),r.default.createElement("button",{id:`button-view-${e}`,key:e,className:n.join(" "),type:"button",title:"Change view gallery/list",onClick:this.handleViewChange,value:e}))}))}render(){const{badges:e,children:t,folder:n,onMoveFiles:o,onOpenFolder:i,onCreateFolder:s,BackButton:l,UploadButton:a,AddFolderButton:u}=this.props,{canEdit:d}=n;return r.default.createElement("div",{className:"toolbar--content toolbar--space-save"},r.default.createElement("div",{className:"fill-width"},r.default.createElement("div",{className:"gallery__btn-toolbar flexbox-area-grow"},r.default.createElement("div",{className:"btn-toolbar"},r.default.createElement(l,{folder:n,badges:e,onOpenFolder:i,onMoveFiles:o}),r.default.createElement(a,{canEdit:d}),r.default.createElement(u,{canEdit:d,onCreateFolder:s}),t)),r.default.createElement("div",{className:"gallery__state-buttons"},this.renderSort(),r.default.createElement("div",{className:"btn-group",role:"group","aria-label":"View mode"},this.renderViewChangeButtons()))))}}t.Component=c,c.propTypes={onMoveFiles:o.default.func.isRequired,onCreateFolder:o.default.func.isRequired,onViewChange:o.default.func.isRequired,onOpenFolder:o.default.func.isRequired,onSort:o.default.func.isRequired,folder:o.default.shape({id:o.default.number,title:o.default.string,parentId:o.default.number,canView:o.default.bool,canEdit:o.default.bool}).isRequired,view:o.default.oneOf(["tile","table"]),sort:o.default.string,badges:o.default.arrayOf(o.default.shape({id:o.default.number,message:o.default.node,status:o.default.string})),BackButton:o.default.elementType,UploadButton:o.default.elementType,AddFolderButton:o.default.elementType},c.defaultProps={view:"tile",BackButton:s.default,UploadButton:l.default,AddFolderButton:a.default};t.default=(0,i.connect)((function(e,t){let{sort:n}=t;const{badges:r,sorters:o}=e.assetAdmin.gallery;return""===n&&(n=`${o[0].field},${o[0].direction}`),{badges:r,sorters:o,sort:n}}))(c)},4333:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=f(n(5815)),o=p(n(1594)),i=n(9367),s=n(9040),l=f(n(8737)),a=p(n(2811)),u=f(n(6935)),d=n(5125);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}function p(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function f(e){return e&&e.__esModule?e:{default:e}}class h extends o.Component{constructor(e){super(e),this.handleSubmit=this.handleSubmit.bind(this)}componentDidMount(){this.setOverrides(this.props)}componentDidUpdate(e){this.props.isOpen&&!e.isOpen&&this.setOverrides(this.props)}componentWillUnmount(){this.clearOverrides()}setOverrides(e){if(this.props.schemaUrl!==e.schemaUrl&&this.clearOverrides(),e.schemaUrl){const t=Object.assign({},e.fileAttributes);delete t.ID;const n={fields:Object.entries(t).map((e=>{const[t,n]=e;return{name:t,value:n}}))};this.props.actions.schema.setSchemaStateOverrides(e.schemaUrl,n)}}getModalProps(){const e=Object.assign({onSubmit:this.handleSubmit,onLoadingError:this.handleLoadingError,showErrorMessage:!0,responseClassBad:"alert alert-danger",identifier:"AssetAdmin.InsertEmbedModal"},this.props,{className:`insert-embed-modal ${this.props.className}`,size:"lg",onClosed:this.props.onClosed,title:this.props.targetUrl?r.default._t("AssetAdmin.EditTitle","Media from the web"):r.default._t("AssetAdmin.CreateTitle","Insert new media from the web")});return delete e.sectionConfig,delete e.onInsert,delete e.fileAttributes,e}clearOverrides(){this.props.actions.schema.setSchemaStateOverrides(this.props.schemaUrl,null)}handleLoadingError(e){"function"==typeof this.props.onLoadingError&&this.props.onLoadingError(e)}handleSubmit(e,t){switch(t){case"action_addmedia":this.props.onCreate(e);break;case"action_insertmedia":this.props.onInsert(e);break;case"action_cancel":this.props.onClosed()}return Promise.resolve()}render(){const{FormBuilderModalComponent:e}=this.props;return o.default.createElement(e,this.getModalProps())}}t.Component=h,h.propTypes={sectionConfig:u.default.shape({url:u.default.string,form:u.default.object}),isOpen:u.default.bool,onInsert:u.default.func.isRequired,onCreate:u.default.func.isRequired,fileAttributes:u.default.shape({Url:u.default.string,CaptionText:u.default.string,PreviewUrl:u.default.string,Placement:u.default.string,Width:u.default.number,Height:u.default.number}),onClosed:u.default.func.isRequired,className:u.default.string,actions:u.default.object,schemaUrl:u.default.string.isRequired,targetUrl:u.default.string,onLoadingError:u.default.func,FormBuilderModalComponent:u.default.oneOfType([u.default.object,u.default.func])},h.defaultProps={className:"",fileAttributes:{},FormBuilderModalComponent:l.default};t.default=(0,s.connect)((function(e,t){const n=e.config.sections.find((e=>"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"===e.name)),r=t.fileAttributes?t.fileAttributes.Url:"",o=n.form.remoteEditForm.schemaUrl,i=r&&(0,d.joinUrlPaths)(o,`/?embedurl=${encodeURIComponent(r)}`),s=n.form.remoteCreateForm.schemaUrl;return{sectionConfig:n,schemaUrl:i||s,targetUrl:r}}),(function(e){return{actions:{schema:(0,i.bindActionCreators)(a,e)}}}))(h)},3517:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=b(n(5815)),o=v(n(1594)),i=b(n(853)),s=b(n(6379)),l=n(9040),a=n(9367),u=n(5381),d=v(n(8795)),c=n(5716),p=b(n(3432)),f=b(n(6923)),h=b(n(6935)),m=b(n(7008)),g=b(n(7675));function y(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(y=function(e){return e?n:t})(e)}function v(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=y(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function b(e){return e&&e.__esModule?e:{default:e}}class _ extends o.Component{constructor(e){super(e),this.handleAddedFile=this.handleAddedFile.bind(this),this.handleFailedUpload=this.handleFailedUpload.bind(this),this.handleSuccessfulUpload=this.handleSuccessfulUpload.bind(this),this.handleSending=this.handleSending.bind(this),this.handleUploadProgress=this.handleUploadProgress.bind(this),this.handleUploadComplete=this.handleUploadComplete.bind(this),this.handleCancelUpload=this.handleCancelUpload.bind(this),this.handleRemoveErroredUpload=this.handleRemoveErroredUpload.bind(this),this.canFileUpload=this.canFileUpload.bind(this),this.updateFormData=this.updateFormData.bind(this),this.cacheBustUrl=this.cacheBustUrl.bind(this)}componentDidUpdate(e){(e.data.url&&this.props.data.url!==e.data.url||e.data.version&&this.props.data.version!==e.data.version)&&this.props.actions.previewField.removeFile(e.id)}componentWillUnmount(){this.props.actions.previewField.removeFile(this.props.id)}getDropzoneProps(){const e=this.props.data.uploadFileEndpoint,t=this.props.name,n={url:e&&e.url,method:e&&e.method,paramName:"Upload",clickable:!0,maxFiles:1},r={height:s.default.THUMBNAIL_HEIGHT,width:s.default.THUMBNAIL_WIDTH},o=this.props.securityID;return{name:t,className:["asset-dropzone--button","preview-image-field__container",this.props.className,this.props.extraClass].join(" "),canUpload:e&&this.canEdit(),preview:r,folderId:this.props.data.parentid,options:n,securityID:o,uploadButton:!1,onAddedFile:this.handleAddedFile,onError:this.handleFailedUpload,onSuccess:this.handleSuccessfulUpload,onSending:this.handleSending,onUploadProgress:this.handleUploadProgress,onUploadComplete:this.handleUploadComplete,canFileUpload:this.canFileUpload,updateFormData:this.updateFormData}}getButtonClasses(e){return(0,f.default)([`preview-image-field__toolbar-button--${e}`,"preview-image-field__toolbar-button"])}updateFormData(e){e.append("ID",this.props.data.id),e.append("Name",this.props.nameValue)}handleSending(e,t){this.props.actions.previewField.updateFile(this.props.id,{xhr:t})}handleSuccessfulUpload(e){const t=JSON.parse(e.xhr.response);"function"==typeof this.props.onAutofill&&(this.props.onAutofill("FileFilename",t.Filename),this.props.onAutofill("FileHash",t.Hash),this.props.onAutofill("FileVariant",t.Variant),t.Name&&this.props.onAutofill(this.props.data.nameField,t.Name))}handleFailedUpload(e,t){this.props.actions.previewField.failUpload(this.props.id,t)}handleAddedFile(e){this.props.actions.previewField.addFile(this.props.id,e)}handleRemoveErroredUpload(){if("function"==typeof this.props.onAutofill){const e=this.props.data.initialValues;this.props.onAutofill("FileFilename",e.FileFilename),this.props.onAutofill("FileHash",e.FileHash),this.props.onAutofill("FileVariant",e.FileVariant)}this.props.actions.previewField.removeFile(this.props.id)}handleCancelUpload(){this.props.upload.xhr&&this.props.upload.xhr.abort(),this.handleRemoveErroredUpload()}canFileUpload(e){const t=this.props.data.initialValues.FileFilename,n=(0,c.getFileExtension)(t),o=(0,c.getFileExtension)(e.name);if(!n||n===o)return!0;const i=r.default._t("AssetAdmin.CONFIRM_CHANGE_EXTENSION","Are you sure you want upload a file with a different extension?");return this.props.confirm(i)}preventDefault(e){e.preventDefault()}canEdit(){return!this.props.readOnly&&!this.props.disabled&&"folder"!==this.props.data.category}handleUploadProgress(e,t){this.props.actions.previewField.updateFile(this.props.id,{progress:t})}handleUploadComplete(e){this.props.actions.previewField.updateStatus(this.props.id,{status:e})}preview(e,t,n){if(e&&"image"!==e)return s.default.DEFAULT_PREVIEW;const r=t.url||n.preview||n.url;if(r){return r.startsWith("data:image/")?r:this.cacheBustUrl(r,n.version)}return null}cacheBustUrl(e){const t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"")||this.props.data.version;if(!1===this.props.bustCache||!t)return e;const n=m.default.parse(e),r={...g.default.parse(n.query),vid:t};return m.default.format({...n,search:g.default.stringify(r)})}renderImage(){const{data:e,upload:t}=this.props;if(!e.mock&&!e.exists&&!t.url)return o.default.createElement("div",{className:"editor__file-preview-message--file-missing"},r.default._t("AssetAdmin.FILE_MISSING","File cannot be found"));const{category:n,progress:i,message:s}=t,l=t.errors?t.errors[0]:null,a=t.status?t.status:null,u=this.preview(n,t,e),d=o.default.createElement("img",{alt:"preview",src:u,className:"editor__thumbnail"}),c=e.url&&!i?o.default.createElement("a",{className:"editor__file-preview-link",href:this.cacheBustUrl(e.url),target:"_blank",rel:"noopener noreferrer"},d):null,p=i>0&&i<100?o.default.createElement("div",{className:"preview-image-field__progress"},o.default.createElement("div",{className:"preview-image-field__progress-bar",style:{width:`${i}%`}})):null;let f=null;if(l||"error"===a){const e=l&&l.value?l.value:r.default._t("AssetAdmin.DROPZONE_RESPONSE_ERROR","Server responded with an error."),t=l&&l.type?l.type:"error";f=o.default.createElement("div",{className:`preview-image-field__message preview-image-field__message--${t}`},e)}else s?f=o.default.createElement("div",{className:`preview-image-field__message preview-image-field__message--${s.type}`},s.value):100===i&&"success"===a&&(f=o.default.createElement("div",{className:"preview-image-field__message preview-image-field__message--success"},r.default._t("AssetAdmin.REPlACE_FILE_SUCCESS","Upload successful, the file will be replaced when you Save."),(i||s)&&o.default.createElement("button",{onClick:this.handleCancelUpload,className:"preview-image-field__message-button btn btn-outline-light",type:"button"},r.default._t("AssetAdmin.REPLACE_FILE_UNDO","Undo"))));return o.default.createElement("div",{className:"editor__thumbnail-container"},c||d,p,f)}render(){const{AssetDropzoneComponent:e}=this.props,t=this.getDropzoneProps();if(this.canEdit())return o.default.createElement(e,t,this.renderImage());const n=["preview-image-field__container",this.props.className,this.props.extraClass];return o.default.createElement("div",{className:n.join(" ")},this.renderImage())}}t.Component=_,_.propTypes={id:h.default.string.isRequired,name:h.default.string,className:h.default.string,extraClass:h.default.string,readOnly:h.default.bool,disabled:h.default.bool,bustCache:h.default.bool,onAutofill:h.default.func,formid:h.default.string,nameValue:h.default.string,data:h.default.shape({id:h.default.number,parentid:h.default.number,version:h.default.number,url:h.default.string,mock:h.default.bool,exists:h.default.bool,preview:h.default.string,category:h.default.string,nameField:h.default.string,uploadFileEndpoint:h.default.shape({url:h.default.string.isRequired,method:h.default.string.isRequired,payloadFormat:h.default.string}),initialValues:h.default.object}).isRequired,upload:h.default.shape({url:h.default.string,progress:h.default.number,xhr:h.default.object,category:h.default.string,message:h.default.shape({type:h.default.string.isRequired,value:h.default.string.isRequired}),status:h.default.string}),actions:h.default.object,securityID:h.default.string,confirm:h.default.func,AssetDropzoneComponent:h.default.oneOfType([h.default.object,h.default.func])},_.defaultProps={extraClass:"",className:"",data:{},upload:{},confirm:e=>window.confirm(e),bustCache:!0,AssetDropzoneComponent:i.default};t.default=(0,l.connect)((function(e,t){const n=e.config.SecurityID,r=t.id,o=e.assetAdmin.previewField[r]||{},i=(0,u.formValueSelector)(t.formid,p.default),{bustCache:s}=e.config.sections.find((e=>"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"===e.name));return{securityID:n,upload:o,nameValue:i(e,"Name"),bustCache:s}}),(function(e){return{actions:{previewField:(0,a.bindActionCreators)(d,e)}}}))(_)},3965:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=l(n(1594)),o=l(n(6935)),i=n(3556),s=l(n(5815));function l(e){return e&&e.__esModule?e:{default:e}}function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{onSelect:t,currentWidth:n,originalWidth:o,width:l,text:a}=e;return r.default.createElement(i.Button,{color:"link",size:"sm",onClick:()=>t(l||o),disabled:os.default.inject(s.default._t("AssetAdmin.SET_IMAGE_SIZE_TO",'Set image size to "{preset}"'),{preset:e}))(a)),r.default.createElement("span",{"aria-hidden":"true"},a))},d=e=>{let{imageSizePresets:t,...n}=e;return t?r.default.createElement("ul",{className:"image-size-preset-list"},t.map((e=>r.default.createElement("li",{key:e.text,className:"image-size-preset-list__list-item"},r.default.createElement(u,a({},e,n)))))):null};d.propTypes={onSelect:o.default.func,imageSizePresets:o.default.arrayOf(o.default.shape({text:o.default.string,width:o.default.number})),currentWidth:o.default.number,originalWidth:o.default.number.isRequired};t.default=d},2397:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=p(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=c(n(6935)),i=n(5207),s=n(5381),l=c(n(3432)),a=n(9040),u=n(9367),d=c(n(3965));function c(e){return e&&e.__esModule?e:{default:e}}function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(p=function(e){return e?n:t})(e)}function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&this.syncFields(e,r)}syncFields(e,t){const{children:n,active:r,onAutofill:o,data:{ratio:i}}=this.props,s=0===e?1:0,l=n[e].props.name,a=n[s].props.name,u=0===e?1/i:i;o(l,t),r&&o(a,Math.round(t*u))}handlePresetSelect(e){this.syncFields(0,e);const{key:t}=this.props.children[0],n=document.getElementById(t);n&&n.focus()}handleBlur(e,t){this.setState({hasFocus:!1});const n=parseInt(t&&t.target&&t.target.value,10);(!n||n<=0)&&(t.preventDefault(),this.resetDimensions())}handleFocus(){this.setState({hasFocus:!0})}defaultWidth(){const{imageSizePresets:e,data:{originalWidth:t}}=this.props,n=e&&e.find((e=>e.default)),r=n&&n.width||t||600;return t&&t(0,r.cloneElement)(e,{onChange:(e,n)=>this.handleChange(t,e,n),onBlur:e=>this.handleBlur(t,e),onFocus:()=>this.handleFocus(),key:t},e.props.children))),!n&&r.default.createElement(d.default,{originalWidth:parseInt(t,10),currentWidth:o,imageSizePresets:i,onSelect:this.handlePresetSelect}))}}t.Component=h,h.propTypes={children:o.default.array,onAutofill:o.default.func,active:o.default.bool,data:o.default.shape({ratio:o.default.number.isRequired,isRemoteFile:o.default.bool,originalWidth:o.default.number,originalHeight:o.default.number}),current:o.default.shape({width:o.default.oneOfType([o.default.number,o.default.string]),height:o.default.oneOfType([o.default.number,o.default.string])}).isRequired,FieldGroup:o.default.elementType.isRequired,imageSizePresets:o.default.arrayOf(o.default.shape({width:o.default.number,text:o.default.string,default:o.default.bool}))},h.defaultProps={active:!0};t.default=(0,u.compose)((0,a.connect)((function(e,t){let{formid:n}=t;const r=(0,s.formValueSelector)(n,l.default),o=r(e,"Width"),i=r(e,"Height");return{current:{width:o?parseInt(o,10):void 0,heigth:i?parseInt(i,10):void 0},imageSizePresets:e.assetAdmin.modal.imageSizePresets}})),(0,i.inject)(["FieldGroup"]))(h)},9725:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.ConnectedUploadField=t.Component=void 0;var r=v(n(5815)),o=y(n(1594)),i=n(9040),s=n(9367),l=n(5207),a=v(n(6379)),u=v(n(2623)),d=v(n(6022)),c=v(n(9247)),p=y(n(1433)),f=y(n(1021)),h=v(n(6935)),m=v(n(4636));function g(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(g=function(e){return e?n:t})(e)}function y(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=g(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function v(e){return e&&e.__esModule?e:{default:e}}class b extends o.Component{constructor(e){super(e),this.getMaxFiles=this.getMaxFiles.bind(this),this.getFolderId=this.getFolderId.bind(this),this.renderChild=this.renderChild.bind(this),this.handleAddShow=this.handleAddShow.bind(this),this.handleHide=this.handleHide.bind(this),this.handleAddInsert=this.handleAddInsert.bind(this),this.handleInsertMany=this.handleInsertMany.bind(this),this.handleAddedFile=this.handleAddedFile.bind(this),this.handleSending=this.handleSending.bind(this),this.handleUploadProgress=this.handleUploadProgress.bind(this),this.handleFailedUpload=this.handleFailedUpload.bind(this),this.handleSuccessfulUpload=this.handleSuccessfulUpload.bind(this),this.handleItemRemove=this.handleItemRemove.bind(this),this.handleReplaceShow=this.handleReplaceShow.bind(this),this.handleChange=this.handleChange.bind(this),this.handleReplace=this.handleReplace.bind(this),this.canEdit=this.canEdit.bind(this),this.canAttach=this.canAttach.bind(this),this.canUpload=this.canUpload.bind(this),this.state={selecting:!1,selectingItem:null}}componentDidMount(){const{id:e,formSchemaFilesHash:t,data:n,value:r,actions:o,files:i}=this.props,s=(0,m.default)(JSON.stringify(r.Files)).toString();if(t!==s)return o.uploadField.setFormSchemaFilesHash(e,s),void o.uploadField.setFiles(e,n.files);o.uploadField.setFiles(e,i)}componentDidUpdate(e){const{id:t,formSchemaFilesHash:n,data:r,files:o,value:{Files:i},actions:{uploadField:{setFormSchemaFilesHash:s,setFiles:l}}}=this.props;(function(e,t){if(e.length!==t.length)return!0;for(let n=0;n!u.includes(e))).length)return;const d=o.map((e=>e.id));d.length===i.length&&0===d.filter((e=>!i.includes(e))).length||l(t,r.files)}getMaxFiles(){const e=this.props.data.multi?this.props.data.maxFiles:1;if(null==e)return null;const t=this.props.files.filter((e=>e.id>0&&(!e.message||"error"!==e.message.type))).length;return Math.max(e-t,0)}getMaxFilesize(){return this.props.data.maxFilesize||null}getFolderId(){const{selectingItem:e}=this.state;return e&&"object"==typeof e?e.parent.id:this.props.data.parentid||0}handleAddedFile(e){const t={...e,uploaded:!0};this.props.actions.uploadField.addFile(this.props.id,t)}handleSending(e,t){this.props.actions.uploadField.updateQueuedFile(this.props.id,e._queuedId,{xhr:t})}handleUploadProgress(e,t){this.props.actions.uploadField.updateQueuedFile(this.props.id,e._queuedId,{progress:t})}handleSuccessfulUpload(e){const t=JSON.parse(e.xhr.response);void 0===t[0].error?this.props.actions.uploadField.succeedUpload(this.props.id,e._queuedId,t[0]):this.handleFailedUpload(e)}handleFailedUpload(e,t){const n=e.xhr&&e.xhr.status?(0,c.default)(e.xhr.status,e.xhr):"";this.props.actions.uploadField.failUpload(this.props.id,e._queuedId,t,n)}handleItemRemove(e,t){this.props.actions.uploadField.removeFile(this.props.id,t)}handleReplaceShow(e,t){this.props.actions.modal.initFormStack("select","admin"),this.setState({selecting:!0,selectingItem:t})}handleChange(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.props;if("function"==typeof t.onChange){const n={Files:t.files.filter((e=>e.id)).map((e=>e.id))};t.onChange(e,{id:t.id,value:n})}}handleUploadButton(e){e.preventDefault()}handleAddShow(e){e.preventDefault(),this.props.actions.modal.initFormStack("select","admin"),this.setState({selecting:!0,selectingItem:null})}handleHide(){this.props.actions.modal.reset(),this.setState({selecting:!1,selectingItem:null})}handleAddInsert(e,t,n){return this.props.actions.uploadField.addFile(this.props.id,n),this.handleHide(),Promise.resolve({})}handleInsertMany(e,t){const{selectingItem:n}=this.state;n?this.handleReplace(e,null,t[0]):t.forEach((t=>{this.handleAddInsert(e,null,t)}))}handleReplace(e,t,n){const{selectingItem:r}=this.state,{id:o,actions:{uploadField:{addFile:i,removeFile:s}}}=this.props;if(!r)throw new Error("Tried to replace a file when none was selected.");return s(o,r),i(o,n),this.handleHide(),Promise.resolve({})}canEdit(){return!this.props.disabled&&!this.props.readOnly&&(this.props.data.canUpload||this.props.data.canAttach)}canUpload(){return this.canEdit()&&this.props.data.canUpload}canAttach(){return this.canEdit()&&this.props.data.canAttach}renderDropzone(){const{AssetDropzone:e}=this.props;if(!this.props.data.createFileEndpoint)return null;const t={height:a.default.SMALL_THUMBNAIL_HEIGHT,width:a.default.SMALL_THUMBNAIL_WIDTH},n=this.getMaxFiles(),i=this.getMaxFilesize(),s={url:this.props.data.createFileEndpoint.url,method:this.props.data.createFileEndpoint.method,paramName:"Upload",maxFiles:n,maxFilesize:i,thumbnailWidth:a.default.SMALL_THUMBNAIL_WIDTH,thumbnailHeight:a.default.SMALL_THUMBNAIL_HEIGHT},l=["uploadfield__dropzone"];if(0===n&&l.push("uploadfield__dropzone--hidden"),!this.canEdit())return this.props.files.length?null:o.default.createElement("p",null,r.default._t("AssetAdmin.EMPTY","No files"));const u=this.props.securityId,d=[];return this.canUpload()&&d.push(o.default.createElement("button",{key:"uploadbutton",type:"button",onClick:this.handleUploadButton,className:"uploadfield__upload-button"},r.default._t("AssetAdmin.UPLOADFIELD_UPLOAD_NEW","Upload new"))),this.canAttach()&&(d.length&&d.push(o.default.createElement("span",{key:"uploadjoin",className:"uploadfield__join"},r.default._t("AssetAdmin.OR","or"))),d.push(o.default.createElement("button",{key:"attachbutton",type:"button",onClick:this.handleAddShow,className:"uploadfield__add-button"},r.default._t("AssetAdmin.UPLOADFIELD_CHOOSE_EXISTING","Choose existing")))),o.default.createElement(e,{name:this.props.name,canUpload:this.canUpload(),uploadButton:!1,uploadSelector:".uploadfield__upload-button, .uploadfield__backdrop",folderId:this.props.data.parentid,onAddedFile:this.handleAddedFile,onError:this.handleFailedUpload,onSuccess:this.handleSuccessfulUpload,onSending:this.handleSending,onUploadProgress:this.handleUploadProgress,preview:t,options:s,securityID:u,className:l.join(" ")},o.default.createElement("div",{className:"uploadfield__backdrop"}),o.default.createElement("span",{className:"uploadfield__droptext"},d))}renderModal(){const{InsertMediaModal:e}=this.props,{selecting:t,selectingItem:n}=this.state,r=this.getMaxFiles(),i=this.getFolderId();return o.default.createElement(e,{title:!1,isOpen:t,onInsert:n?this.handleReplace:this.handleAddInsert,onClosed:this.handleHide,onInsertMany:this.handleInsertMany,maxFiles:n?1:r,type:"select",bodyClassName:"modal__dialog",className:"insert-media-react__dialog-wrapper",fileAttributes:n?{ID:n.id}:null,folderId:i})}renderChild(e,t){const{UploadFieldItem:n}=this.props,r={key:e.id?`file-${e.id}`:`queued-${e.queuedId}`,item:e,name:this.props.name,onRemove:this.handleItemRemove,canEdit:this.canEdit(),onView:this.handleReplaceShow},i=this.props.getItemProps(r,t,this.props);return o.default.createElement(n,i)}render(){return o.default.createElement("div",{className:"uploadfield"},this.renderDropzone(),this.props.files.map(this.renderChild),this.renderModal())}}t.Component=b,b.propTypes={id:h.default.string.isRequired,name:h.default.string.isRequired,onChange:h.default.func,value:h.default.shape({Files:h.default.arrayOf(h.default.number)}),files:h.default.arrayOf(d.default),formSchemaFilesHash:h.default.string,readOnly:h.default.bool,disabled:h.default.bool,data:h.default.shape({files:h.default.arrayOf(d.default),createFileEndpoint:h.default.shape({url:h.default.string.isRequired,method:h.default.string.isRequired,payloadFormat:h.default.string.isRequired}),multi:h.default.bool,parentid:h.default.number,canUpload:h.default.bool,canAttach:h.default.bool,maxFiles:h.default.number}),UploadFieldItem:h.default.elementType,AssetDropzone:h.default.elementType,InsertMediaModal:h.default.elementType,getItemProps:h.default.func},b.defaultProps={value:{Files:[]},className:"",getItemProps:e=>e};const _=t.ConnectedUploadField=(0,i.connect)((function(e,t){const n=t.id;let r=[],o=null;return e.assetAdmin&&e.assetAdmin.uploadField&&e.assetAdmin.uploadField.fields&&e.assetAdmin.uploadField.fields[n]&&(r=e.assetAdmin.uploadField.fields[n].files||[],o=e.assetAdmin.uploadField.fields[n].formSchemaFilesHash||null),{files:r,securityId:e.config.SecurityID,formSchemaFilesHash:o}}),(function(e){return{actions:{uploadField:(0,s.bindActionCreators)(p,e),modal:(0,s.bindActionCreators)(f,e)}}}))(b);t.default=(0,s.compose)((0,l.inject)(["UploadFieldItem","AssetDropzone","InsertMediaModal"]),u.default)(_)},3058:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=c(n(5815)),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=c(n(6379)),s=c(n(6022)),l=n(5716),a=c(n(6935)),u=c(n(1990));function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}function c(e){return e&&e.__esModule?e:{default:e}}class p extends o.Component{constructor(e){super(e),this.handleRemove=this.handleRemove.bind(this),this.handleItemClick=this.handleItemClick.bind(this),this.handleView=this.handleView.bind(this)}getThumbnailStyles(){if(this.isImage()&&(this.exists()||this.uploading())){return{backgroundImage:`url(${this.props.item.smallThumbnail||this.props.item.url||""})`}}return{}}getThumbnailClassNames(){const e=["uploadfield-item__thumbnail"];return this.isImageSmallerThanThumbnail()&&e.push("uploadfield-item__thumbnail--small"),e.join(" ")}getItemClassNames(){const e=["fill-width","uploadfield-item",`uploadfield-item--${this.props.item.category||"none"}`];return this.missing()&&e.push("uploadfield-item--missing"),this.hasError()&&e.push("uploadfield-item--error"),e.join(" ")}hasError(){return!!this.props.item.message&&"error"===this.props.item.message.type}isImage(){return"image"===this.props.item.category}exists(){return this.props.item.exists}uploading(){return this.props.item.queuedId&&!this.saved()}complete(){return this.props.item.queuedId&&this.saved()}saved(){return this.props.item.id>0}missing(){return!this.exists()&&this.saved()}isImageSmallerThanThumbnail(){if(!this.isImage()||this.missing())return!1;const e=this.props.item.width,t=this.props.item.height;return t&&e&&te.every((e=>e&&e.canDelete))},{value:"archive",label:o.default._t("AssetAdmin.BULK_ACTIONS_ARCHIVE","Archive"),className:"font-icon-box",destructive:!0,callback:null,canApply:e=>e.every((e=>e&&e.canDelete))},{value:"edit",label:o.default._t("AssetAdmin.BULK_ACTIONS_EDIT","Edit"),className:"font-icon-edit",destructive:!1,canApply:e=>1===e.length,callback:null},{value:"move",label:o.default._t("AssetAdmin.BULK_ACTIONS_MOVE","Move"),className:"font-icon-folder-move",canApply:e=>e.every((e=>e&&e.canEdit)),destructive:!1,callback:null},{value:"publish",label:o.default._t("AssetAdmin.BULK_ACTIONS_PUBLISH","Publish"),className:"font-icon-rocket",destructive:!1,callback:null,canApply:e=>e.some((e=>e&&e.modified))&&e.every((e=>e.canEdit&&"folder"!==e.type)),confirm:null},{value:"unpublish",label:o.default._t("AssetAdmin.BULK_ACTIONS_UNPUBLISH","Unpublish"),className:"font-icon-cancel-circled",destructive:!1,callback:null,canApply:e=>e.some((e=>e.published))&&e.every((e=>e.canEdit&&"folder"!==e.type)),confirm:null},{value:"insert",label:o.default._t("AssetAdmin.BULK_ACTIONS_INSERT","Insert"),className:"font-icon-plus-circled btn-primary",destructive:!1,callback:null,canApply:e=>e.length,confirm:null}],BULK_ACTIONS_PLACEHOLDER:o.default._t("AssetAdmin.BULK_ACTIONS_PLACEHOLDER"),SPACE_KEY_CODE:32,RETURN_KEY_CODE:13,DEFAULT_PREVIEW:"framework/client/dist/images/app_icons/generic_92.png",MODAL_MOVE:"MODAL_MOVE"}},7917:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=M(n(1594)),o=D(n(6935)),i=n(9040),s=n(9367),l=D(n(5609)),a=D(n(5815)),u=D(n(6923)),d=M(n(4201)),c=M(n(8918)),p=M(n(1369)),f=M(n(9517)),h=D(n(1869)),m=D(n(5789)),g=D(n(2294)),y=n(708),v=M(n(6303)),b=D(n(6175)),_=D(n(3934)),E=D(n(3929)),C=D(n(5230)),S=D(n(6379)),w=D(n(4350)),F=n(5207),I=M(n(4461)),O=D(n(8268)),A=D(n(175)),x=D(n(2308));function D(e){return e&&e.__esModule?e:{default:e}}function P(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(P=function(e){return e?n:t})(e)}function M(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=P(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}class R extends r.Component{constructor(e){super(e),this.handleOpenFile=this.handleOpenFile.bind(this),this.handleCloseFile=this.handleCloseFile.bind(this),this.handleDelete=this.handleDelete.bind(this),this.doPublish=this.doPublish.bind(this),this.doUnpublish=this.doUnpublish.bind(this),this.handleUnpublish=this.handleUnpublish.bind(this),this.handleDoSearch=this.handleDoSearch.bind(this),this.handleClearSearch=this.handleClearSearch.bind(this),this.handleSubmitEditor=this.handleSubmitEditor.bind(this),this.handleOpenFolder=this.handleOpenFolder.bind(this),this.handleSort=this.handleSort.bind(this),this.handleSetPage=this.handleSetPage.bind(this),this.createEndpoint=this.createEndpoint.bind(this),this.handleBackButtonClick=this.handleBackButtonClick.bind(this),this.handleFolderIcon=this.handleFolderIcon.bind(this),this.handleBrowse=this.handleBrowse.bind(this),this.handleViewChange=this.handleViewChange.bind(this),this.handleUpload=this.handleUpload.bind(this),this.handleUploadQueue=this.handleUploadQueue.bind(this),this.handleCreateFolder=this.handleCreateFolder.bind(this),this.handleMoveFilesSuccess=this.handleMoveFilesSuccess.bind(this)}componentDidUpdate(){"function"==typeof this.props.onReplaceUrl&&!this.props.loading&&this.props.folder&&this.props.folderId!==this.props.folder.id&&this.props.onReplaceUrl(this.props.folder.id,this.props.fileId,this.props.query,this.props.viewAction)}getFolderId(){return null!==this.props.folderId?this.props.folderId:this.props.folder?this.props.folder.id:0}getFiles(){const{files:e,queuedFiles:t,folderId:n}=this.props,r=[...t.items.filter((t=>!(t.id&&e.find((e=>e.id===t.id))||t.hasOwnProperty("uploadedToFolderId")&&t.uploadedToFolderId!==n))),...e],o=r.filter((e=>"folder"===e.type)),i=r.filter((e=>"folder"!==e.type));return o.concat(i)}handleBrowse(e,t,n){"function"==typeof this.props.onBrowse&&this.props.onBrowse(e,t,n),e!==this.getFolderId()&&this.props.actions.gallery.deselectFiles()}handleSetPage(e){this.handleBrowse(this.getFolderId(),this.props.fileId,Object.assign({},this.props.query,{page:e}))}handleDoSearch(e){this.props.actions.gallery.deselectFiles(),this.props.actions.queuedFiles.purgeUploadQueue(),this.props.actions.files.readFiles(),this.handleBrowse(e.currentFolderOnly?this.getFolderId():0,null,{filter:e,view:this.props.query.view})}handleClearSearch(e){this.props.actions.displaySearch.closeSearch(),this.props.actions.gallery.deselectFiles(),this.props.actions.queuedFiles.purgeUploadQueue(),this.props.actions.files.readFiles(),this.handleOpenFolder(e,this.props.folder)}handleSort(e){this.handleBrowse(this.getFolderId(),this.props.fileId,{...this.props.query,sort:e,limit:void 0,page:void 0})}handleViewChange(e){this.handleBrowse(this.getFolderId(),this.props.fileId,Object.assign({},this.props.query,{view:e}))}createEndpoint(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return l.default.createEndpointFetcher(Object.assign({},e,t?{defaultData:{SecurityID:this.props.securityId}}:{}))}handleBackButtonClick(e){e.preventDefault(),this.props.actions.gallery.deselectFiles(),this.props.folder?this.handleOpenFolder(this.props.folder.parentId||0):this.handleOpenFolder(0)}resetFile(e){e.queuedId&&this.props.actions.queuedFiles.removeQueuedFile(e.queuedId),this.props.fileId===e.id&&this.props.resetFileDetails(this.getFolderId(),e.id,this.props.query)}handleFolderIcon(){this.handleOpenFile(this.getFolderId())}handleOpenFile(e){this.handleBrowse(this.getFolderId(),e,this.props.query)}handleSubmitEditor(e,t,n){let r=null;if("action_insert"===t&&"select"===this.props.type){const t=this.getFiles().find((t=>t.id===parseInt(e.ID,10)));return this.props.onInsertMany(null,[t]),Promise.resolve()}if("function"==typeof this.props.onSubmitEditor){const o=this.findFile(this.props.fileId);r=this.props.onSubmitEditor(e,t,n,o)}else r=n();if(!r)throw new Error("Promise was not returned for submitting");return r.then((e=>("action_createfolder"===t&&"admin"===this.props.type&&this.handleOpenFile(e.record.id),this.props.actions.files.readFiles().then((()=>("action_createfolder"===t&&"admin"!==this.props.type&&this.handleOpenFolder(this.getFolderId()),e))))))}handleCloseFile(){this.handleBrowse(this.getFolderId(),null,this.props.query)}handleOpenFolder(e){const{page:t,filter:n,...r}=this.props.query;this.handleBrowse(e,null,r)}handleDelete(e){this.props.actions.confirmDeletion.deleting();const t=e.map((e=>{const t=this.findFile(e);if(!t)throw new Error(`File selected for deletion cannot be found: ${e}`);return t.queuedId&&this.props.actions.queuedFiles.removeQueuedFile(t.queuedId),t})).map((e=>e.id)),n=this.props.folder?this.props.folder.id:0;return this.props.actions.files.deleteFiles(t,n).then((e=>{let{data:{deleteFiles:r}}=e;this.handleBrowse(n,null,this.props.query);return this.props.queuedFiles.items.filter((e=>t.includes(e.id))).forEach((e=>{e.queuedId&&this.props.actions.queuedFiles.removeQueuedFile(e.queuedId)})),this.props.actions.files.readFiles(),r})).then((t=>{const n=t.filter((e=>e)).length,{archiveFiles:r}=this.props.sectionConfig;if(n!==e.length){let t="AssetAdmin.BULK_ACTIONS_DELETE_FAIL_02",o="%s folders/files were successfully deleted, but %s files were not able to be deleted.";r&&(t="AssetAdmin.BULK_ACTIONS_ARCHIVE_FAIL_02",o="%s folders/files were successfully archived, but %s files were not able to be archived."),this.props.actions.toasts.error(a.default.sprintf(a.default._t(t,o),n,e.length-n))}else{let e="AssetAdmin.BULK_ACTIONS_DELETE_SUCCESS_02",t="%s folders/files were successfully deleted.";r&&(e="AssetAdmin.BULK_ACTIONS_ARCHIVE_SUCCESS_02",t="%s folders/files were successfully archived."),this.props.actions.toasts.success(a.default.sprintf(a.default._t(e,t),n)),this.props.actions.gallery.deselectFiles()}return t})).finally(this.props.actions.confirmDeletion.reset)}doUnpublish(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=e.map((e=>{const t=this.findFile(e);if(!t)throw new Error(`File selected for unpublishing cannot be found: ${e}`);if("folder"===t.type)throw new Error("Cannot unpublish folders");return t})).map((e=>e.id));return this.props.actions.files.unpublishFiles(n,t).then((e=>{let{data:{unpublishFiles:t}}=e;const n=t.filter((e=>"File"===e.__typename)),r=t.filter((e=>"PublicationNotice"===e.__typename&&"HAS_OWNERS"===e.noticeType)),o=n.map((e=>(this.resetFile(e),e))),i=r.slice(0,4),s=r.slice(5),l=i.map((e=>e.message));if(s.length&&l.push(a.default.inject(a.default._t("AssetAdmin.BULK_OWNED_WARNING_REMAINING","And {count} other file(s)"),{count:s.length})),i.length){const e=[a.default.inject(a.default._t("AssetAdmin.BULK_OWNED_WARNING_HEADING","{count} file(s) are being used by other published content."),{count:r.length}),l.join("\n"),a.default._t("AssetAdmin.BULK_OWNED_WARNING_FOOTER","Unpublishing will only remove files from the published version of the content. They will remain on the draft version. Unpublish anyway?")];if(confirm(e.join("\n\n"))){const e=r.reduce(((e,t)=>e.concat(t.ids)),[]);return this.doUnpublish(e,!0).then((e=>o.concat(e)))}}return o}))}handleUnpublish(e){return this.doUnpublish(e).then((e=>{const{fileId:t}=this.props;this.props.actions.files.readFiles().then((()=>{t&&e.find((e=>e.id===t))&&this.props.resetFileDetails(this.getFolderId(),t,this.props.query)}))}))}doPublish(e){const t=e.map((e=>{const t=this.findFile(e);if(!t)throw new Error(`File selected for publishing cannot be found: ${e}`);if("folder"===t.type)throw new Error("Cannot publish folders");return t})).map((e=>e.id));return this.props.actions.files.publishFiles(t).then((e=>{let{data:{publishFiles:t}}=e;return t.filter((e=>"File"===e.__typename)).map((e=>(this.resetFile(e),e)))}))}findFile(e){return this.getFiles().find((t=>t.id===parseInt(e,10)))}handleUpload(){}handleUploadQueue(){this.props.fileId&&this.props.actions.files.readFiles()}handleCreateFolder(){this.props.onBrowse(this.getFolderId(),null,this.props.query,S.default.ACTIONS.CREATE_FOLDER)}handleMoveFilesSuccess(e,t){this.props.queuedFiles.items.filter((e=>t.includes(e.id))).forEach((e=>{e.queuedId&&this.props.actions.queuedFiles.removeQueuedFile(e.queuedId)})),this.props.actions.gallery.deselectFiles(),this.props.actions.files.readFiles()}renderGallery(){const{GalleryComponent:e}=this.props,t=this.props.sectionConfig,n=t.createFileEndpoint.url,o=t.createFileEndpoint.method,i=this.props.query&&parseInt(this.props.query.limit||t.limit,10),s=this.props.query&&parseInt(this.props.query.page||1,10),l=this.props.query&&this.props.query.sort,a=this.props.query&&this.props.query.view,u=this.props.query.filter||{};return r.default.createElement(e,{files:this.getFiles(),fileId:this.props.fileId,folderId:this.getFolderId(),folder:this.props.folder,type:this.props.type,limit:i,page:s,totalCount:this.props.filesTotalCount,view:a,filters:u,graphQLErrors:this.props.graphQLErrors,createFileApiUrl:n,createFileApiMethod:o,onInsertMany:this.props.onInsertMany,onPublish:this.doPublish,onUnpublish:this.doUnpublish,onOpenFile:this.handleOpenFile,onOpenFolder:this.handleOpenFolder,onSuccessfulUpload:this.handleUpload,onSuccessfulUploadQueue:this.handleUploadQueue,onCreateFolder:this.handleCreateFolder,onMoveFilesSuccess:this.handleMoveFilesSuccess,onClearSearch:this.handleClearSearch,onSort:this.handleSort,onSetPage:this.handleSetPage,onViewChange:this.handleViewChange,sort:l,sectionConfig:t,loading:this.props.loading,maxFilesSelect:this.props.maxFiles,dialog:this.props.dialog})}renderEditor(){const{sectionConfig:e,viewAction:t,type:n,fileId:o,dialog:i,requireLinkText:s,fileSelected:l,EditorComponent:a}=this.props,{schemaUrl:u,targetId:d}=(0,O.default)({config:e,viewAction:t,folderId:this.getFolderId(),type:n,fileId:o});if(!u)return null;const c=[];s&&c.push({name:"requireLinkText",value:!0}),l&&c.push({name:"fileSelected",value:!0});const p={dialog:i,fileId:d,schemaUrl:u,schemaUrlQueries:c,onClose:this.handleCloseFile,onSubmit:this.handleSubmitEditor,onUnpublish:this.handleUnpublish,addToCampaignSchemaUrl:e.form.addToCampaignForm.schemaUrl};return r.default.createElement(a,p)}render(){const{folder:e,folderId:t,query:n,getUrl:o,type:i,maxFiles:s,toolbarChildren:l,SearchComponent:a,BulkDeleteConfirmationComponent:d}=this.props,c=Boolean(t||(0,v.hasFilters)(n.filter)),p=this.props.sectionConfig.form.fileSearchForm.schemaUrl,f=n.filter||{},h=(0,u.default)("fill-height asset-admin","select"===i&&{"asset-admin--single-select":1===s,"asset-admin--multi-select":1!==s}),m=(0,v.hasFilters)(n.filter)||this.props.showSearch,y=this.props.actions.displaySearch?this.props.actions.displaySearch.toggleSearch:void 0,_={folder:e,query:n,getUrl:o,onBrowse:this.handleBrowse,onFolderIcon:this.handleFolderIcon};return r.default.createElement("div",{className:h},r.default.createElement(g.default,{showBackButton:c,onBackButtonClick:this.handleBackButtonClick},r.default.createElement(x.default,_),r.default.createElement("div",{className:"asset-admin__toolbar-extra pull-xs-right fill-width vertical-align-items"},r.default.createElement(b.default,{toggled:m,onToggle:y}),l)),m&&r.default.createElement(a,{onSearch:this.handleDoSearch,id:"AssetSearchForm",formSchemaUrl:p,onHide:this.handleClearSearch,displayBehavior:"HIDEABLE",filters:f,name:"name"}),r.default.createElement("div",{className:"flexbox-area-grow fill-width fill-height gallery"},this.renderGallery(),this.renderEditor()),r.default.createElement(d,{onConfirm:this.handleDelete}))}}t.Component=R,R.propTypes={dialog:o.default.bool,sectionConfig:w.default,fileId:o.default.number,folderId:o.default.number,resetFileDetails:o.default.func,onBrowse:o.default.func,onReplaceUrl:o.default.func,onInsertMany:o.default.func,graphQLErrors:o.default.arrayOf(o.default.string),getUrl:o.default.func,query:o.default.shape({sort:o.default.string,limit:o.default.oneOfType([o.default.number,o.default.string]),page:o.default.oneOfType([o.default.number,o.default.string]),filter:o.default.object}),onSubmitEditor:o.default.func,type:o.default.oneOf(["insert-media","insert-link","select","admin"]),files:o.default.array,queuedFiles:o.default.shape({items:o.default.array.isRequired}),filesTotalCount:o.default.number,folder:o.default.shape({id:o.default.number,title:o.default.string,parents:o.default.array,parentId:o.default.number,canView:o.default.bool,canEdit:o.default.bool}),loading:o.default.bool,actions:o.default.object,maxFiles:o.default.number,fileSelected:o.default.bool,EditorComponent:o.default.oneOfType([o.default.object,o.default.func]),GalleryComponent:o.default.oneOfType([o.default.object,o.default.func]),SearchComponent:o.default.oneOfType([o.default.object,o.default.func]),BulkDeleteConfirmationComponent:o.default.oneOfType([o.default.object,o.default.func])},R.defaultProps={type:"admin",query:{sort:"",limit:null,page:0,filter:{}},maxFiles:null,EditorComponent:h.default,GalleryComponent:m.default,SearchComponent:v.default,BulkDeleteConfirmationComponent:A.default};t.default=(0,s.compose)((0,i.connect)((function(e,t){const{formSchema:n}=e.assetAdmin.modal;return{securityId:e.config.SecurityID,queuedFiles:e.assetAdmin.queuedFiles,showSearch:e.assetAdmin.displaySearch.isOpen,type:n&&n.type||t.type}}),(function(e){return{actions:{gallery:(0,s.bindActionCreators)(d,e),toasts:(0,s.bindActionCreators)(c,e),displaySearch:(0,s.bindActionCreators)(f,e),queuedFiles:(0,s.bindActionCreators)(p,e),confirmDeletion:(0,s.bindActionCreators)(I,e)}}})),(0,F.injectGraphql)("ReadFilesQuery"),_.default,E.default,C.default,y.withApollo)(R)},2308:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=a(n(1594)),o=a(n(6935)),i=a(n(5815)),s=n(6418),l=n(6303);function a(e){return e&&e.__esModule?e:{default:e}}const u=e=>{let{folder:t,query:n,getUrl:o,onBrowse:s,onFolderIcon:a,PlainBreadcrumbComponent:u}=e;const d=function(){for(var e=arguments.length,t=new Array(e),n=0;n{e.preventDefault(),s(...t)}},c=function(){return o&&o(...arguments)},p=[{text:i.default._t("AssetAdmin.FILES","Files"),href:c(0,null,n),onClick:d(0,null,n)}];if(t&&t.id){t.parents&&t.parents.forEach((e=>{p.push({text:e.title,href:c(e.id,null,n),onClick:d(e.id,null,n)})}));const e=[{className:"icon font-icon-edit-list",onClick:e=>{e.preventDefault(),a()}}];t.hasRestrictedAccess&&e.push({nodeName:"FileStatusIcon",hasRestrictedAccess:!0}),p.push({text:t.title,href:c(t.id,null,n),onClick:d(t.id,null,n),icons:e})}return(0,l.hasFilters)(n.filter)&&p.push({text:i.default._t("LeftAndMain.SEARCHRESULTS","Search results")}),r.default.createElement(u,{multiline:!0,crumbs:p})};u.propTypes={onBrowse:o.default.func,onFolderIcon:o.default.func,getUrl:o.default.func,query:o.default.shape({sort:o.default.string,limit:o.default.oneOfType([o.default.number,o.default.string]),page:o.default.oneOfType([o.default.number,o.default.string]),filter:o.default.object,view:o.default.string}),folder:o.default.shape({id:o.default.number,title:o.default.string,parents:o.default.array,parentId:o.default.number,canView:o.default.bool,canEdit:o.default.bool}),PlainBreadcrumbComponent:o.default.oneOfType([o.default.object,o.default.func])},u.defaultProps={PlainBreadcrumbComponent:s.Component};t.default=u},4736:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Component=void 0,t.buildUrl=v,t.default=void 0;var r=g(n(1594)),o=n(8926),i=n(9040),s=g(n(6478)),l=h(n(7917)),a=n(5716),u=h(n(7675)),d=h(n(6379)),c=h(n(4350)),p=n(5125),f=h(n(6935));function h(e){return e&&e.__esModule?e:{default:e}}function m(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(m=function(e){return e?n:t})(e)}function g(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=m(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}const y=Object.keys(d.default.ACTIONS).map((e=>d.default.ACTIONS[e]));function v(e){let{base:t,folderId:n,fileId:r,query:o,action:i}=e;if(i&&-1===y.indexOf(i))throw new Error(`Invalid action provided: ${i}`);let s=null;s=r?(0,p.joinUrlPaths)(t,`show/${n}/${d.default.ACTIONS.EDIT_FILE}/${r}`):n?(0,p.joinUrlPaths)(t,`show/${n}`):t,i===d.default.ACTIONS.CREATE_FOLDER&&(s=(0,p.joinUrlPaths)(t,`show/${n||0}/${i}`));return o&&Object.keys(o).length>0&&(s=`${s}?${u.default.stringify(o)}`),s}class b extends r.Component{constructor(e){super(e),this.handleBrowse=this.handleBrowse.bind(this),this.handleReplaceUrl=this.handleReplaceUrl.bind(this),this.handleResetDetails=this.handleResetDetails.bind(this),this.getUrl=this.getUrl.bind(this)}getUrl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:d.default.ACTIONS.EDIT_FILE;const o=parseInt(e||0,10),i=parseInt(t||0,10),s=o!==this.getFolderId(),l=Object.assign({},n);return(s||l.page<=1)&&delete l.page,v({base:`/${this.props.sectionConfig.reactRoutePath}`,folderId:o,fileId:i,query:l,action:r})}getFolderId(){return this.props.router.params&&this.props.router.params.folderId?parseInt(this.props.router.params.folderId,10):0}getFileId(){return this.props.router.params&&this.props.router.params.fileId?parseInt(this.props.router.params.fileId,10):0}getViewAction(){return this.props.router.params&&this.props.router.params.viewAction?this.props.router.params.viewAction:d.default.ACTIONS.EDIT_FILE}getSectionProps(){return{sectionConfig:this.props.sectionConfig,type:"admin",folderId:this.getFolderId(),viewAction:this.getViewAction(),fileId:this.getFileId(),query:this.getQuery(),getUrl:this.getUrl,onBrowse:this.handleBrowse,onReplaceUrl:this.handleReplaceUrl,resetFileDetails:this.handleResetDetails}}getQuery(){return(0,a.decodeQuery)(this.props.router.location.search)}handleBrowse(e,t,n,r){const o=this.getUrl(e,t,n,r);this.props.router.navigate(o)}handleReplaceUrl(e,t,n,r){const o=this.getUrl(e,t,n,r);this.props.router.navigate(o,{replace:!0})}handleResetDetails(e,t,n){const r=this.getUrl(e,t,n),o=this.getUrl(e,null,n);this.props.router.navigate(o,{replace:!0,state:{reset:!0,resetPath:r}})}render(){const{AssetAdminComponent:e}=this.props,t=this.props.router.location.state;return t&&t&&t.reset?r.default.createElement(o.Navigate,{to:t.resetPath,replace:!0}):this.props.sectionConfig?r.default.createElement(e,this.getSectionProps()):null}}t.Component=b,b.propTypes={sectionConfig:c.default,router:s.routerPropTypes,AssetAdminComponent:f.default.oneOfType([f.default.object,f.default.func])},b.defaultProps={AssetAdminComponent:l.default};t.default=(0,s.default)((0,i.connect)((function(e){return{sectionConfig:e.config.sections.find((e=>"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"===e.name))}}))(b))},2908:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.AssetAdminStateRouter=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=u(n(6935)),i=n(9040),s=n(4736),l=u(n(6379)),a=n(1021);function u(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}const c={folderId:null,fileId:null,query:{},action:l.default.ACTIONS.EDIT_FILE};class p extends r.Component{constructor(e){super(e),this.handleBrowse=this.handleBrowse.bind(this),this.getUrl=this.getUrl.bind(this),this.state=Object.assign({},c,{folderId:e.folderId})}getUrl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l.default.ACTIONS.EDIT_FILE;const o=parseInt(e||0,10),i=parseInt(t||0,10),a=this.getFolderId(),u=o!==a&&null!==a,d=Object.assign({},n);return(u||d.page<=1)&&delete d.page,(0,s.buildUrl)({base:this.props.sectionConfig.reactRoutePath,folderId:o,fileId:i,query:d,action:r})}getFolderId(){return null===this.state.folderId?null:parseInt(this.state.folderId||0,10)}getFileId(){return parseInt(this.state.fileId||this.props.fileId||0,10)}getViewAction(){return this.state.action||l.default.ACTIONS.EDIT_FILE}getSectionProps(){const e=Object.assign({},this.props,{folderId:this.getFolderId(),fileId:this.getFileId(),viewAction:this.getViewAction(),query:this.state.query,getUrl:this.getUrl,onBrowse:this.handleBrowse});return delete e.Component,e}handleBrowse(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l.default.ACTIONS.EDIT_FILE;if(r&&-1===Object.values(l.default.ACTIONS).indexOf(r))throw new Error(`Invalid action provided: ${r}`);this.state.fileId!==t&&this.props.actions.resetFormStack(),this.setState({folderId:e,fileId:t,query:n,action:r})}render(){const e=this.getSectionProps(),t=this.props.Component;return r.default.createElement(t,e)}}function f(e){return{actions:{resetFormStack:()=>e((0,a.resetFormStack)())}}}t.AssetAdminStateRouter=p,p.propTypes={Component:o.default.elementType,sectionConfig:o.default.shape({url:o.default.string.isRequired}).isRequired,fileId:o.default.number};t.default=function(e){return(0,i.connect)((function(t){const n=t.config.sections.find((e=>"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"===e.name));return{Component:e,sectionConfig:n}}),f)(p)}},175:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=v(n(1594)),o=n(9367),i=n(9040),s=v(n(6935)),l=n(708),a=n(5207),u=y(n(4461)),d=y(n(762)),c=v(n(5815)),p=v(n(6022)),f=v(n(134)),h=v(n(7871)),m=n(60);function g(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(g=function(e){return e?n:t})(e)}function y(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=g(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function v(e){return e&&e.__esModule?e:{default:e}}function b(){return b=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{loading:t,LoadingComponent:n,transition:o,files:i,descendantFileCounts:s,onModalClose:l,onCancel:a,onConfirm:u,archiveFiles:p}=e,g=null;const y=p?"AssetAdmin.ARCHIVE":"AssetAdmin.DELETE",v=p?"Archive":"Delete";let b=[{label:c.default._t(y,v),handler:()=>u(i.map((e=>{let{id:t}=e;return t}))),color:"danger"},{label:c.default._t("AssetAdmin.CANCEL","Cancel"),handler:a}];if(t)g=r.default.createElement(n,null);else{const e=Object.keys(s).length,t=(0,m.getFolderDescendantFileTotals)(i,s),n=(0,m.getFileTotalItems)(i),o={folderCount:e,folderDescendantFileTotals:t,fileTotalItems:n,archiveFiles:p};g=r.default.createElement(h.default,o),(t.totalItems||n)&&(b=[{label:c.default._t("AssetAdmin.CANCEL","Cancel"),handler:a,color:"primary"},{label:c.default._t(y,v),handler:()=>u(i.map((e=>{let{id:t}=e;return t}))),color:"danger"}])}const _=![d.CANCELING,d.DELETING].includes(o);return r.default.createElement(f.default,{body:g,isOpen:_,actions:b,onCancel:a,onClosed:l,archiveFiles:p})};t.Component=_,_.propTypes={loading:s.default.bool.isRequired,LoadingComponent:s.default.elementType,transition:s.default.oneOf(["canceling","deleting",!1]),files:s.default.arrayOf(p.default),descendantFileCounts:s.default.object,onCancel:s.default.func.isRequired,onModalClose:s.default.func.isRequired,onConfirm:s.default.func.isRequired,archiveFiles:s.default.bool.isRequired};const E=(0,o.compose)((0,a.inject)(["Loading"],(e=>({LoadingComponent:e}))),(0,a.injectGraphql)("readDescendantFileCountsQuery"),l.withApollo)(_),C={onCancel:u.cancel,onModalClose:u.modalClose};t.default=(0,o.compose)((0,i.connect)((e=>{let{assetAdmin:{confirmDeletion:t}}=e;return t}),C))((e=>{let{showConfirmation:t,files:n,...o}=e;return t&&n.length>0?r.default.createElement(E,b({},o,{files:n})):null}))},7871:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=l(n(5815)),o=l(n(1594)),i=l(n(6935)),s=n(60);function l(e){return e&&e.__esModule?e:{default:e}}const a=e=>{let{folderCount:t,folderDescendantFileTotals:n,fileTotalItems:i,archiveFiles:s}=e,l="AssetAdmin.BULK_ACTIONS_DELETE_WARNING",a="Ensure files are removed from content areas prior to deleting them, otherwise they will appear as broken links.";s&&(l="AssetAdmin.BULK_ACTIONS_ARCHIVE_WARNING",a="Ensure files are removed from content areas prior to archiving them, otherwise they will appear as broken links.");const u=((e,t,n,o)=>{const i=t.totalCount+n;if(i>0){let e="AssetAdmin.BULK_ACTIONS_DELETE_ITEMS_CONFIRM",t=["You're about to delete %s file(s) which may be used in your site's content.","Carefully check the file usage on the files before deleting the file(s)."].join(" ");return o&&(e="AssetAdmin.BULK_ACTIONS_ARCHIVE_ITEMS_CONFIRM",t=["You're about to archive %s file(s) which may be used in your site's content.","Carefully check the file usage on the files before archiving the file(s)."].join(" ")),r.default.sprintf(r.default._t(e,t),i)}if(1===e){let e="AssetAdmin.BULK_ACTIONS_DELETE_FOLDER_CONFIRM",t="Are you sure you want to delete this folder?";return o&&(e="AssetAdmin.BULK_ACTIONS_ARCHIVE_FOLDER_CONFIRM",t="Are you sure you want to archive this folder?"),r.default._t(e,t)}let s="AssetAdmin.BULK_ACTIONS_DELETE_FOLDERS_CONFIRM",l="Are you sure you want to delete these folders?";return o&&(s="AssetAdmin.BULK_ACTIONS_ARCHIVE_FOLDERS_CONFIRM",l="Are you sure you want to archive these folders?"),r.default._t(s,l)})(t,n,i,s);return o.default.createElement(o.default.Fragment,null,o.default.createElement("p",null,u),(n.totalItems>0||i>0)&&o.default.createElement("p",null,r.default._t(l,a)))};a.propTypes={folderCount:i.default.number,folderDescendantFileTotals:s.descendantFileTotalsShape,fileTotalItems:i.default.number},a.defaultProps={folderCount:0,folderDescendantFileTotals:{totalItems:0,totalCount:0},fileTotalItems:0};t.default=a},134:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=l(n(5815)),o=l(n(1594)),i=l(n(6935)),s=n(3556);function l(e){return e&&e.__esModule?e:{default:e}}const a=e=>{let{isOpen:t,body:n,onCancel:i,actions:l,archiveFiles:a}=e,u="AssetAdmin.CONFIRM_FILE_DELETION",d="Confirm deletion";return a&&(u="AssetAdmin.CONFIRM_FILE_ARCHIVE",d="Confirm archive"),o.default.createElement(s.Modal,{isOpen:t,toggle:i},o.default.createElement(s.ModalHeader,{toggle:i},r.default._t(u,d)),o.default.createElement(s.ModalBody,null,n),o.default.createElement(s.ModalFooter,null,l.map((e=>{let{label:t,handler:n,color:r}=e;return o.default.createElement(s.Button,{key:t,color:r,onClick:n},t)}))))};a.propTypes={isOpen:i.default.bool.isRequired,body:i.default.node.isRequired,onCancel:i.default.func.isRequired,actions:i.default.arrayOf(i.default.shape({label:i.default.string.isRequired,handler:i.default.func,color:i.default.string})),archiveFiles:i.default.bool.isRequired};t.default=a},60:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getFolderDescendantFileTotals=t.getFileTotalItems=t.descendantFileTotalsShape=void 0;var r,o=(r=n(6935))&&r.__esModule?r:{default:r};const i=e=>{let{type:t}=e;return"folder"===t},s=e=>!i(e),l={totalItems:0,totalCount:0};t.descendantFileTotalsShape=o.default.shape({totalItems:o.default.number,totalCount:o.default.number});t.getFolderDescendantFileTotals=(e,t)=>{return e.filter(i).reduce((n=t,(e,t)=>{let{id:r}=t;return n[r]>0?{totalItems:e.totalItems+1,totalCount:e.totalCount+n[r]}:e}),l);var n};t.getFileTotalItems=e=>e.filter(s).length},1869:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=C(n(5815)),o=n(9040),i=n(9367),s=E(n(1594)),l=C(n(6379)),a=C(n(55)),u=C(n(8737)),d=E(n(9077)),c=C(n(6022)),p=C(n(6935)),f=n(5207),h=E(n(4461)),m=E(n(1021)),g=C(n(6923)),y=C(n(7008)),v=C(n(7675)),b=E(n(1584));function _(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(_=function(e){return e?n:t})(e)}function E(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function C(e){return e&&e.__esModule?e:{default:e}}function S(){return S=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{name:n,value:r}=t;return{...e,[n]:r}}),{});return y.default.format({...r,pathname:`${r.path}/${n}`,search:v.default.stringify(o)})}handleAction(e){switch(e.currentTarget.name){case"action_addtocampaign":this.openModal(),e.preventDefault();break;case"action_replacefile":this.replaceFile(),e.preventDefault();break;case"action_downloadfile":this.downloadFile(),e.preventDefault();break;case"action_delete":this.props.actions.confirmDeletion.confirm([this.props.file]),e.preventDefault()}}handleCancelKeyDown(e){e.keyCode!==l.default.SPACE_KEY_CODE&&e.keyCode!==l.default.RETURN_KEY_CODE||this.handleClose(e)}handleSubmit(e,t,n){const{showingSubForm:r,actions:o}=this.props;return"function"==typeof this.props.onSubmit?this.props.onSubmit(e,t,n).finally((()=>{r&&-1!==["action_save","action_publish"].indexOf(t)&&o.modal.popFormStackEntry()})):n()}handleClose(e){const{showingSubForm:t,onClose:n,actions:r}=this.props;t?r.modal.popFormStackEntry():(n(),this.closeModal()),e&&e.preventDefault()}openModal(){this.setState({openModal:!0})}closeModal(){this.setState({openModal:!1})}replaceFile(){const e=document.querySelector(".dz-input-PreviewImage");e&&e.click()}downloadFile(){!function(e,t){const n=document.createElement("a");n.download=t,n.href=e,document.body.appendChild(n),n.click(),document.body.removeChild(n)}(this.props.file.url,this.props.file.name),document.getElementById("Form_fileEditForm_PopoverActions").focus()}handleLoadingError(e){this.setState({loadingForm:!1,loadingError:e.errors[0]})}handleLoadingSuccess(){this.setState({loadingForm:!1,loadingError:null})}handleFetchingSchema(){this.setState({loadingForm:!0})}editorHeader(e){let{SchemaComponent:t,...n}=e;const{dialog:r,nextType:o,showingSubForm:i,actions:l,file:a,EditorHeaderComponent:u}=this.props,d=this.getFormSchemaUrl();let c=b.buttonStates.SWITCH;r&&a&&"folder"!==a.type&&(c=i?b.buttonStates.ALWAYS_BACK:b.buttonStates.ONLY_BACK);const{formid:p}=n,f=o&&a&&"folder"!==a.type?()=>{l.modal.stashFormValues(p,d),l.modal.pushFormStackEntry(o)}:void 0,h={onCancel:this.handleClose,showButton:c,onDetails:f};return s.default.createElement(u,h,s.default.createElement(t,n))}createFn(e,t){if("AssetEditorHeaderFieldGroup"===t.name){const n=this.editorHeader,r={key:t.id,SchemaComponent:e,...t};return s.default.createElement(n,r)}return s.default.createElement(e,S({key:t.id},t))}render(){const{FormBuilderLoaderComponent:e,FormBuilderModalComponent:t}=this.props,n=this.getFormSchemaUrl(),o=`${this.props.addToCampaignSchemaUrl}/${this.props.fileId}`,i=(0,g.default)("panel","form--no-dividers","editor",{"editor--asset-dropzone--disable":!this.props.enableDropzone},this.props.className);let l=null;if(this.state.loadingError){let e=this.state.loadingError.value;404===this.state.loadingError.code&&(e=r.default._t("AssetAdmin.FILE_MISSING","File cannot be found")),e||(e=r.default._t("Admin.UNKNOWN_ERROR","An unknown error has occurred")),l=s.default.createElement("div",{className:"editor__file-preview-message--file-missing"},e)}const a=r.default._t("Admin.ADD_TO_CAMPAIGN","Add to campaign"),u=this.props.loadingComponent,{file:d}=this.props;return s.default.createElement("div",{className:i},s.default.createElement("div",{className:"editor__details fill-height"},s.default.createElement(e,{identifier:"AssetAdmin.EditForm",schemaUrl:n,onSubmit:this.handleSubmit,onAction:this.handleAction,onLoadingSuccess:this.handleLoadingSuccess,onLoadingError:this.handleLoadingError,onFetchingSchema:this.handleFetchingSchema,createFn:this.createFn,file:d}),l,s.default.createElement(t,{title:a,identifier:"AssetAdmin.AddToCampaign",isOpen:this.state.openModal,onClosed:this.closeModal,schemaUrl:o,bodyClassName:"modal__dialog",responseClassBad:"modal__response modal__response--error",responseClassGood:"modal__response modal__response--good"}),this.state.loadingForm&&s.default.createElement(u,null)))}}t.Component=w,w.propTypes={file:c.default,className:p.default.string,fileId:p.default.number.isRequired,enableDropzone:p.default.bool,dialog:p.default.bool,onClose:p.default.func.isRequired,onSubmit:p.default.func.isRequired,schemaUrl:p.default.string.isRequired,schemaUrlQueries:p.default.arrayOf(p.default.shape({name:p.default.string,value:p.default.any})),addToCampaignSchemaUrl:p.default.string,actions:p.default.object,showingSubForm:p.default.bool,nextType:p.default.string,EditorHeaderComponent:p.default.oneOfType([p.default.object,p.default.func]),FormBuilderLoaderComponent:p.default.oneOfType([p.default.object,p.default.func]),FormBuilderModalComponent:p.default.oneOfType([p.default.object,p.default.func])},w.defaultProps={EditorHeaderComponent:b.default,FormBuilderLoaderComponent:a.default,FormBuilderModalComponent:u.default};t.default=(0,i.compose)((0,f.inject)(["Loading"],(e=>({loadingComponent:e})),(()=>"AssetAdmin.Editor")),(0,o.connect)((function(e){let{assetAdmin:{gallery:t,modal:n}}=e;return{enableDropzone:t.enableDropzone,nextType:n.formSchema&&n.formSchema.nextType,showingSubForm:n.formSchemaStack&&n.formSchemaStack.length>1}}),(function(e){return{actions:{unsavedForms:(0,i.bindActionCreators)(d,e),confirmDeletion:(0,i.bindActionCreators)(h,e),modal:(0,i.bindActionCreators)(m,e)}}})),(0,f.injectGraphql)("ReadOneFileQuery"))(w)},1584:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.buttonStates=void 0;var r=u(n(1594)),o=u(n(5815)),i=u(n(551)),s=u(n(2164)),l=u(n(6935)),a=u(n(6923));function u(e){return e&&e.__esModule?e:{default:e}}const d=e=>t=>{t.preventDefault(),e&&e()},c="ALWAYS_BACK",p="ALWAYS_CANCEL",f="SWITCH",h="ONLY_BACK",m="ONLY_CANCEL",g=t.buttonStates={ALWAYS_BACK:c,ALWAYS_CANCEL:p,SWITCH:f,ONLY_BACK:h,ONLY_CANCEL:m,NONE:"NONE"},y=e=>{let{onCancel:t,onDetails:n,showButton:l,children:u}=e;const g=d(t),y=[c,f,h].indexOf(l)>=0,v=[p,f,m].indexOf(l)>=0,b=(0,a.default)("editor-header__back-button","btn--icon-xl",{"editor-header__back-button--md-below":[f,h].indexOf(l)>=0}),_=(0,a.default)("editor-header__cancel-button","btn--icon-xl",{"editor-header__cancel-button--lg-above":[f,m].indexOf(l)>=0});return r.default.createElement("div",{className:"editor-header"},y&&r.default.createElement(s.default,{className:b,onClick:g}),r.default.createElement("div",{className:"editor-header__field"},u),n&&r.default.createElement(i.default,{onClick:d(n),icon:"edit-list",className:"editor-header__edit",outline:!0},o.default._t("AssetAdmin.DETAILS","Details")),v&&r.default.createElement("div",null,r.default.createElement(i.default,{icon:"cancel",className:_,noText:!0,onClick:g},o.default._t("AssetAdmin.CANCEL"))))};y.propTypes={onCancel:l.default.func,onDetails:l.default.func,showButton:l.default.oneOf(Object.keys(g).map((e=>g[e]))),children:l.default.node};t.default=y},5789:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.galleryViewPropTypes=t.galleryViewDefaultProps=t.default=t.Component=void 0;var r=x(n(1669)),o=x(n(5815)),i=A(n(1594)),s=n(9040),l=n(9367),a=x(n(853)),u=x(n(3229)),d=x(n(2853)),c=x(n(6609)),p=x(n(6379)),f=x(n(6621)),h=A(n(4201)),m=A(n(8918)),g=A(n(1369)),y=A(n(4461)),v=x(n(4064)),b=n(708),_=n(4172),E=x(n(4350)),C=x(n(9247)),S=n(5207),w=x(n(6935)),F=x(n(5769)),I=x(n(3863));function O(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(O=function(e){return e?n:t})(e)}function A(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=O(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function x(e){return e&&e.__esModule?e:{default:e}}const D={DELETE:"delete",ARCHIVE:"archive",EDIT:"edit",MOVE:"move",PUBLISH:"publish",UNPUBLISH:"unpublish",INSERT:"insert",ADMIN:"admin",SELECT:"select"};class P extends i.Component{constructor(e){super(e),this.handleOpenFolder=this.handleOpenFolder.bind(this),this.handleOpenFile=this.handleOpenFile.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleAddedFile=this.handleAddedFile.bind(this),this.handlePreviewLoaded=this.handlePreviewLoaded.bind(this),this.handleCancelUpload=this.handleCancelUpload.bind(this),this.handleRemoveErroredUpload=this.handleRemoveErroredUpload.bind(this),this.handleUploadProgress=this.handleUploadProgress.bind(this),this.handleSending=this.handleSending.bind(this),this.handleSort=this.handleSort.bind(this),this.handleSetPage=this.handleSetPage.bind(this),this.handleSuccessfulUpload=this.handleSuccessfulUpload.bind(this),this.handleQueueComplete=this.handleQueueComplete.bind(this),this.handleFailedUpload=this.handleFailedUpload.bind(this),this.handleClearSearch=this.handleClearSearch.bind(this),this.handleEnableDropzone=this.handleEnableDropzone.bind(this),this.handleMoveFiles=this.handleMoveFiles.bind(this),this.handleBulkEdit=this.handleBulkEdit.bind(this),this.handleBulkPublish=this.handleBulkPublish.bind(this),this.handleBulkUnpublish=this.handleBulkUnpublish.bind(this),this.handleBulkMove=this.handleBulkMove.bind(this),this.handleBulkInsert=this.handleBulkInsert.bind(this),this.handleBeginSelection=this.handleBeginSelection.bind(this),this.handleGroupSelect=this.handleGroupSelect.bind(this),this.handleClearSelection=this.handleClearSelection.bind(this),this.handleSelectAll=this.handleSelectAll.bind(this),this.toggleSelectConcat=this.toggleSelectConcat.bind(this),this.getSelectableFiles=this.getSelectableFiles.bind(this)}componentDidMount(){this.initSortDropdown(),window.addEventListener("keydown",this.toggleSelectConcat),window.addEventListener("keyup",this.toggleSelectConcat)}componentDidUpdate(e){this.initSortDropdown(),this.initFlushUploadFiles(e)}componentWillUnmount(){window.removeEventListener("keydown",this.toggleSelectConcat),window.removeEventListener("keyup",this.toggleSelectConcat)}initFlushUploadFiles(e){if("tile"!==this.props.view){this.getSortElement().off("change")}e.folderId!==this.props.folderId&&this.props.actions.queuedFiles.purgeUploadQueue()}getSortElement(){return(0,r.default)(this.gallery).find(".gallery__sort .dropdown")}getSearchMessage(e){const t=[];e.name&&t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGEKEYWORDS","with keywords '{name}'")),e.lastEditedFrom&&e.lastEditedTo?t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGEEDITEDBETWEEN","last edited between '{lastEditedFrom}' and '{lastEditedTo}'")):e.lastEditedFrom?t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGEEDITEDFROM","last edited after '{lastEditedFrom}'")):e.lastEditedTo&&t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGEEDITEDTO","last edited before '{lastEditedTo}'")),e.appCategory&&t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGECATEGORY","categorised as '{appCategory}'")),e.currentFolderOnly&&this.props.folder.title&&t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGELIMIT","limited to the folder '{folder}'"));const n=[t.slice(0,-1).join(`${o.default._t("AssetAdmin.JOIN",",")} `),t.slice(-1)].filter((e=>e)).join(` ${o.default._t("AssetAdmin.JOINLAST","and")} `);if(""===n)return"";const r={parts:o.default.inject(n,Object.assign({folder:this.props.folder.title},e,{appCategory:e.appCategory?e.appCategory.toLowerCase():void 0}))};return o.default.inject(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGE","Search results {parts}"),r)}getSelection(e,t){const n=this.getSelectableFiles(),r=[e,t].map((e=>n.findIndex((t=>t.id===e)))).filter((e=>-1!==e)).sort(((e,t)=>e-t));if(2!==r.length)return r.map((e=>n[e].id));const[o,i]=r;return n.filter(((e,t)=>t>=o&&t<=i)).map((e=>e.id))}getSelectableFiles(){const e=this.props.files.filter((e=>e.id));return this.props.type===D.SELECT?e.filter((e=>"folder"!==e.type)):e}handleBulkInsert(e,t){this.props.onInsertMany(e,t)}handleBulkPublish(e,t){const n=t.map((e=>e.id));return n.length?(this.props.actions.gallery.setLoading(!0),this.props.onPublish(n).then((e=>{this.props.actions.gallery.setLoading(!1),this.props.actions.toasts.success(o.default.sprintf(o.default._t("AssetAdmin.BULK_ACTIONS_PUBLISH_SUCCESS","%s folders/files were successfully published."),e.length)),this.props.actions.gallery.deselectFiles()}))):(this.props.actions.gallery.deselectFiles(),Promise.resolve(!0))}handleBulkUnpublish(e,t){const n=t.filter((e=>e.published)).map((e=>e.id));return n.length?(this.props.actions.gallery.setLoading(!0),this.props.onUnpublish(n).then((e=>{this.props.actions.gallery.setLoading(!1),this.props.actions.toasts.success(o.default.sprintf(o.default._t("AssetAdmin.BULK_ACTIONS_UNPUBLISH_SUCCESS","%s folders/files were successfully unpublished."),e.length)),this.props.actions.gallery.deselectFiles()}))):(this.props.actions.gallery.deselectFiles(),Promise.resolve(!0))}initSortDropdown(){if("tile"===this.props.view){const e=this.getSortElement();e.chosen({allow_single_deselect:!0,disable_search_threshold:20}),e.off("change"),e.on("change",(()=>e.find(":selected")[0].click()))}}handleSort(e){this.props.actions.queuedFiles.purgeUploadQueue(),this.props.onSort(e)}handleSetPage(e){this.props.onSetPage(e)}handleCancelUpload(e){e.xhr.abort(),this.props.actions.queuedFiles.removeQueuedFile(e.queuedId)}handleRemoveErroredUpload(e){this.props.actions.queuedFiles.removeQueuedFile(e.queuedId)}handleAddedFile(e){this.props.actions.queuedFiles.addQueuedFile(e)}handlePreviewLoaded(e,t){this.props.actions.queuedFiles.updateQueuedFile(e.queuedId,t)}handleSending(e,t){this.props.actions.queuedFiles.updateQueuedFile(e._queuedId,{xhr:t})}handleUploadProgress(e,t){this.props.actions.queuedFiles.updateQueuedFile(e._queuedId,{progress:t})}handleSuccessfulUpload(e){const t=JSON.parse(e.xhr.response);if(void 0!==t[0].error)return void this.handleFailedUpload(e);this.props.actions.queuedFiles.succeedUpload(e._queuedId,t[0]),this.props.onSuccessfulUpload&&this.props.onSuccessfulUpload(t);const n=this.props.queuedFiles.items.reduce(((e,t)=>100!==t.progress?e+1:e),0);if(!this.props.fileId&&!this.props.selectedFiles.length&&0===n){const e=t.pop();this.props.onOpenFile(e.id)}}handleQueueComplete(){this.props.onSuccessfulUploadQueue&&this.props.onSuccessfulUploadQueue()}handleFailedUpload(e,t){const n=e.xhr&&e.xhr.status?(0,C.default)(e.xhr.status,e.xhr):"";this.props.actions.queuedFiles.failUpload(e._queuedId,t,n)}itemIsSelected(e){return this.props.selectedFiles.indexOf(e)>-1}toggleSelectConcat(e){this.props.actions.gallery.setConcatenateSelect(this.isConcat(e))}isConcat(e){return e.metaKey||e.ctrlKey||e.shiftKey}itemIsHighlighted(e){return this.props.fileId===e}hasOpenedItem(){return!!this.props.fileId}handleClearSearch(e){this.props.onClearSearch(e)}handleGroupSelect(e,t){const{setSelectedFiles:n,selectFiles:r}=this.props.actions.gallery,o=this.getSelectableFiles(),i=e.filter(((t,n)=>e.indexOf(t)===n&&o.find((e=>e.id===t)))),s=this.props.concatenateSelect||this.isConcat(t);if(null!==this.props.maxFilesSelect){let e=i.length;if(s){e=this.props.selectedFiles.filter((e=>!this.props.selectedFiles.includes(e))).concat(this.props.selectedFiles).length}if(e>=this.props.maxFilesSelect)return}s?r(i):n(i)}handleClearSelection(){this.props.actions.gallery.deselectFiles()}handleSelectAll(){const e=this.props.files.map((e=>e.id));this.handleGroupSelect(e,new Event("na"))}handleBeginSelection(e){let t=e.target;for(;t;){if(t.classList.contains("griddle-footer"))return!1;if(t.classList.contains("gallery__main--selectable"))break;t=t.parentNode}return!0}handleOpenFolder(e,t){e.preventDefault(),this.props.onOpenFolder(t.id)}handleOpenFile(e,t){e.preventDefault(),null!==t.created&&(this.props.selectedFiles.length&&1!==this.props.maxFilesSelect||this.props.type!==D.SELECT||this.handleSelect(e,t),this.props.onOpenFile(t.id,t))}handleSelect(e,t){const n=this.props.maxFilesSelect;let r=this.getSelectableFiles().filter((e=>e.id===t.id)).map((e=>e.id));if(1!==n)if(-1===this.props.selectedFiles.indexOf(t.id)){e.shiftKey&&(r=this.getSelection(this.props.lastSelected,t.id));if(this.props.selectedFiles.filter((e=>!r.includes(e))).concat(r).length>n&&null!==n)return;this.props.actions.gallery.selectFiles(r),this.props.actions.gallery.setLastSelected(t.id)}else this.props.actions.gallery.deselectFiles([t.id]),e.shiftKey&&this.props.actions.gallery.setLastSelected(null);else this.props.actions.gallery.setSelectedFiles(r)}handleEnableDropzone(e){this.props.actions.gallery.setEnableDropzone(e)}handleMoveFiles(e,t){this.props.actions.files.moveFiles(e,t).then((()=>{const n=p.default.MOVE_SUCCESS_DURATION,r=`+${t.length}`;this.props.actions.gallery.setFileBadge(e,r,"success",n),"function"==typeof this.props.onMoveFilesSuccess&&this.props.onMoveFilesSuccess(e,t)})).catch((()=>{this.props.actions.toasts.error(o.default._t("AssetAdmin.FAILED_MOVE","There was an error moving the selected items."))}))}handleBulkEdit(e,t){this.handleOpenFile(e,t[0])}handleBulkMove(){this.props.actions.gallery.activateModal(p.default.MODAL_MOVE)}renderTransitionBulkActions(){return this.renderBulkActions()}renderBulkActions(){const{type:e,dialog:t,maxFilesSelect:n,files:r,selectedFiles:o,BulkActionsComponent:s,sectionConfig:l}=this.props,a=e===D.SELECT||t?e=>e.value===D.INSERT:e=>e.value!==D.INSERT,u=l.archiveFiles?e=>e.value!==D.DELETE:e=>e.value!==D.ARCHIVE,d=p.default.BULK_ACTIONS.filter(a).filter(u).map((e=>{if(e.callback)return e;switch(e.value){case D.DELETE:case D.ARCHIVE:return{...e,callback:(e,t)=>{this.props.actions.confirmDeletion.confirm(t)},confirm:void 0};case D.EDIT:return{...e,callback:this.handleBulkEdit};case D.MOVE:return{...e,callback:this.handleBulkMove};case D.PUBLISH:return{...e,callback:this.handleBulkPublish};case D.UNPUBLISH:return{...e,callback:this.handleBulkUnpublish};case D.INSERT:return{...e,callback:this.handleBulkInsert,color:"primary"};default:return e}})),c=o.map((e=>r.find((t=>t&&e===t.id)))).filter((e=>e));return c.length>0&&[D.ADMIN,D.SELECT].includes(e)?i.default.createElement(s,{actions:d,items:c,total:n,key:c.length>0,container:this.gallery,showCount:1!==n,onClearSelection:this.handleClearSelection,onSelectAll:this.handleSelectAll}):null}renderGalleryView(){const e="table"===this.props.view?c.default:d.default,t=this.props.files.map((e=>{const t=this.itemIsSelected(e.id),n=this.itemIsHighlighted(e.id),r=(e.queuedId?`queueId${e.queuedId}`:`id${e.id}`)+(t?"--selected":"");return{...e,selected:t,highlighted:n,key:r}})),{type:n,loading:r,dialog:o,page:s,totalCount:l,limit:a,sort:u,selectedFiles:p,badges:f,maxFilesSelect:h,sectionConfig:m}=this.props,g={selectableItems:n===D.SELECT||n===D.ADMIN&&(!h||h>1),selectableFolders:n!==D.SELECT&&!o,files:t,loading:r,page:s,totalCount:l,limit:a,sort:u,selectedFiles:p,badges:f,onSort:this.handleSort,onSetPage:this.handleSetPage,onOpenFile:this.handleOpenFile,onOpenFolder:this.handleOpenFolder,onSelect:this.handleSelect,onCancelUpload:this.handleCancelUpload,onDropFiles:this.handleMoveFiles,onRemoveErroredUpload:this.handleRemoveErroredUpload,onEnableDropzone:this.handleEnableDropzone,sectionConfig:m,canDrag:n===D.ADMIN,maxFilesSelect:h};return i.default.createElement(e,g)}renderToolbar(){const{GalleryToolbar:e,sort:t,view:n,folder:r,onCreateFolder:o,onOpenFolder:s,onViewChange:l}=this.props,a={onMoveFiles:this.handleMoveFiles,onSort:this.handleSort,onCreateFolder:o,onOpenFolder:s,onViewChange:l,view:n,sort:t,folder:r};return i.default.createElement(e,a)}render(){const{folder:e,loading:t,errorMessage:n,graphQLErrors:r,noticeMessage:s}=this.props,l=this.props.LoadingComponent,u=r&&r.length>0;if(!e)return n||u?i.default.createElement("div",{className:"gallery__error flexbox-area-grow"},i.default.createElement("div",{className:"gallery__error-message"},i.default.createElement("h3",null,o.default._t("AssetAdmin.DROPZONE_RESPONSE_ERROR","Server responded with an error.")),n&&i.default.createElement("p",null,n),u&&r.map(((e,t)=>i.default.createElement("p",{key:t},e))))):t?i.default.createElement("div",{className:"flexbox-area-grow"},i.default.createElement(l,null)):i.default.createElement("div",{className:"flexbox-area-grow"},i.default.createElement("div",{className:"editor__file-preview-message--file-missing m-t-3"},o.default._t("Admin.UNKNOWN_ERROR","An unknown error has occurred")));const d=i.default.createElement("div",{className:"gallery_messages"},n&&i.default.createElement(f.default,{value:n,type:"danger"}),s&&i.default.createElement(f.default,{value:s,type:"success"})),c={height:p.default.THUMBNAIL_HEIGHT,width:p.default.THUMBNAIL_WIDTH},h={url:this.props.createFileApiUrl,method:this.props.createFileApiMethod,paramName:"Upload",clickable:"#upload-button",...this.props.sectionConfig.dropzoneOptions},m=this.props.securityId,g=this.props.folder.canEdit&&this.props.enableDropzone,y=["panel","panel--padded","panel--scrollable","gallery__main","fill-height"];this.props.type===D.INSERT&&y.push("insert-media-modal__main");const v=y;return this.hasOpenedItem()&&v.push("gallery__main--has-opened-item"),i.default.createElement("div",{className:"flexbox-area-grow gallery__outer",ref:e=>{this.gallery=e}},this.renderTransitionBulkActions(),i.default.createElement(I.default,{className:y.join(" ")},this.renderToolbar(),i.default.createElement(_.SelectableGroup,{enabled:"tile"===this.props.view&&this.props.type===D.ADMIN,className:"flexbox-area-grow fill-height gallery__main--selectable",onSelection:this.handleGroupSelect,onNonItemClick:this.handleClearSelection,onBeginSelection:this.handleBeginSelection,preventDefault:!1,fixedPosition:!0},i.default.createElement(a.default,{name:"gallery-container",className:"flexbox-area-grow",canUpload:g,onAddedFile:this.handleAddedFile,onPreviewLoaded:this.handlePreviewLoaded,onError:this.handleFailedUpload,onSuccess:this.handleSuccessfulUpload,onQueueComplete:this.handleQueueComplete,onSending:this.handleSending,onUploadProgress:this.handleUploadProgress,preview:c,folderId:this.props.folderId,options:h,securityID:m,uploadButton:!1},d,this.renderGalleryView()))),this.props.loading&&i.default.createElement(l,null),i.default.createElement(F.default,{sectionConfig:this.props.sectionConfig,folderId:this.props.folderId,onSuccess:this.props.onMoveFilesSuccess,onOpenFolder:this.props.onOpenFolder}))}}t.Component=P;const M={page:1,limit:15},R={sectionConfig:E.default,loading:w.default.bool,sort:w.default.string,files:w.default.arrayOf(w.default.shape({id:w.default.number,parent:w.default.shape({id:w.default.number})})).isRequired,selectedFiles:w.default.arrayOf(w.default.number),totalCount:w.default.number,page:w.default.number,limit:w.default.number,badges:w.default.arrayOf(w.default.shape({id:w.default.number,message:w.default.node,status:w.default.string})),onOpenFile:w.default.func.isRequired,onOpenFolder:w.default.func.isRequired,onSort:w.default.func.isRequired,onSetPage:w.default.func.isRequired,maxFilesSelect:w.default.number};t.galleryViewDefaultProps=Object.assign({},M,{selectableItems:!1}),t.galleryViewPropTypes=Object.assign({},R,{selectableItems:w.default.bool,selectableFolders:w.default.bool,onSelect:w.default.func,onCancelUpload:w.default.func,onRemoveErroredUpload:w.default.func,onEnableDropzone:w.default.func});P.defaultProps=Object.assign({},M,{type:D.ADMIN,view:"tile",enableDropzone:!0,dialog:!1,BulkActionsComponent:u.default}),P.propTypes=Object.assign({},R,{onSuccessfulUpload:w.default.func,onSuccessfulUploadQueue:w.default.func,onCreateFolder:w.default.func,onMoveFilesSuccess:w.default.func,onPublish:w.default.func,onUnpublish:w.default.func,type:w.default.oneOf(["insert-media","insert-link",D.SELECT,D.ADMIN]),view:w.default.oneOf(["tile","table"]),lastSelected:w.default.number,dialog:w.default.bool,fileId:w.default.number,folderId:w.default.number.isRequired,folder:w.default.shape({id:w.default.number,title:w.default.string,parentId:w.default.number,canView:w.default.bool,canEdit:w.default.bool}),files:w.default.array,errorMessage:w.default.string,graphQLErrors:w.default.arrayOf(w.default.string),actions:w.default.object,securityId:w.default.string,onViewChange:w.default.func.isRequired,createFileApiUrl:w.default.string,createFileApiMethod:w.default.string,search:w.default.object,enableDropzone:w.default.bool,concatenateSelect:w.default.bool,GalleryToolbar:w.default.elementType,sorters:w.default.arrayOf(w.default.shape({field:w.default.string.isRequired,direction:w.default.oneOf(["asc","desc"]).isRequired,label:w.default.string.isRequired})).isRequired,BulkActionsComponent:w.default.oneOfType([w.default.object,w.default.func])});t.default=(0,l.compose)((0,S.inject)(["GalleryToolbar","Loading"],((e,t)=>({GalleryToolbar:e,LoadingComponent:t})),(()=>"AssetAdmin.Gallery")),(0,s.connect)((function(e,t){let{sort:n}=t;const{selectedFiles:r,errorMessage:o,noticeMessage:i,enableDropzone:s,badges:l,concatenateSelect:a,loading:u,sorters:d,lastSelected:c}=e.assetAdmin.gallery;return!n&&d&&d[0]&&(n=`${d[0].field},${d[0].direction}`),{lastSelected:c,selectedFiles:r,errorMessage:o,noticeMessage:i,enableDropzone:s,badges:l,concatenateSelect:a,loading:t.loading||u,queuedFiles:e.assetAdmin.queuedFiles,securityId:e.config.SecurityID,sorters:d,sort:n}}),(function(e){return{actions:{gallery:(0,l.bindActionCreators)(h,e),toasts:(0,l.bindActionCreators)(m,e),queuedFiles:(0,l.bindActionCreators)(g,e),confirmDeletion:(0,l.bindActionCreators)(y,e)}}})),v.default,(e=>(0,b.withApollo)(e)))(P)},3863:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=a(n(6923)),i=a(n(2914)),s=a(n(6935)),l=a(n(5799));function a(e){return e&&e.__esModule?e:{default:e}}function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}class d extends r.Component{constructor(e){super(e),this.state={dragging:!1},this.mounted=!1,this.handleDrop=this.handleDrop.bind(this)}componentDidMount(){this.mounted=!0,window.addEventListener("drop",this.handleDrop,!0)}componentDidUpdate(){setTimeout((()=>{if(!this.mounted||!this.context.dragDropManager)return;const e=this.context.dragDropManager.monitor.isDragging();this.state.dragging!==e&&this.setState({dragging:e})}))}componentWillUnmount(){this.mounted=!1,window.removeEventListener("drop",this.handleDrop,!0)}handleDrop(){const e=this.context.dragDropManager,t=e&&e.backend;t&&t.isDraggingNativeItem()&&t.endDragNativeItem()}render(){const{className:e,children:t}=this.props;return r.default.createElement("div",{className:(0,o.default)(e,{"gallery__main--dragging":this.state.dragging})},t,r.default.createElement(i.default,null))}}d.contextTypes={dragDropManager:s.default.object},d.propTypes={className:s.default.string,children:s.default.oneOfType([s.default.arrayOf(s.default.node),s.default.node])};t.default=(0,l.default)(d)},9478:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=s(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var l=o?Object.getOwnPropertyDescriptor(e,i):null;l&&(l.get||l.set)?Object.defineProperty(r,i,l):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=(r=n(6935))&&r.__esModule?r:{default:r};function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(s=function(e){return e?n:t})(e)}class l extends o.Component{constructor(e){super(e),this.handleClick=this.handleClick.bind(this)}handleClick(e){e.preventDefault(),"function"==typeof this.props.onClick&&this.props.onClick(this.props.versionid)}render(){let e=null;return"Published"===this.props.status&&(e=o.default.createElement("p",null,o.default.createElement("span",{className:"history-item__status-flag"},this.props.status)," at ",this.props.date_formatted)),o.default.createElement("li",{className:"list-group-item history-item",onClick:this.handleClick},o.default.createElement("p",null,o.default.createElement("span",{className:"history-item__version"},"v.",this.props.versionid),o.default.createElement("span",{className:"history-item__date"},this.props.date_ago," ",this.props.author),this.props.summary),e)}}l.propTypes={versionid:i.default.number.isRequired,summary:i.default.oneOfType([i.default.bool,i.default.string]).isRequired,status:i.default.string,author:i.default.string,date_formatted:i.default.string,date_ago:i.default.string,onClick:i.default.func};t.default=l},9005:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=n(9040),i=d(n(5609)),s=d(n(6177)),l=d(n(9478)),a=d(n(55)),u=d(n(6935));function d(e){return e&&e.__esModule?e:{default:e}}function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t1&&void 0!==arguments[1])||arguments[1];return i.default.createEndpointFetcher(Object.assign({},e,t?{defaultData:{SecurityID:s.default.get("SecurityID")}}:{}))}(e.sectionConfig.historyEndpoint)}componentDidMount(){this.refreshHistoryIfNeeded()}componentDidUpdate(e){this.refreshHistoryIfNeeded(e)}componentWillUnmount(){clearTimeout(this.timer),this.timer=null}refreshHistoryIfNeeded(e){if(!e&&!this.state.loadedDetails||this.props.data.fileId!==e.data.fileId||this.props.data.latestVersionId!==e.data.latestVersionId){this.setState({loadedDetails:!1});const t=this.props?this.props.data.fileId:e.data.fileId;clearTimeout(this.timer),this.timer=setTimeout((()=>{this.api({fileId:t}).then((e=>{this.timer&&this.setState({history:e,loadedDetails:!0})}))}),250)}}handleClick(e){this.setState({viewDetails:e})}handleBack(e){e.preventDefault(),this.setState({viewDetails:null})}render(){if(!this.state.loadedDetails)return r.default.createElement("div",{className:"history-list history-list--loading"},"Loading...");if(this.state.viewDetails){const e=[this.props.historySchemaUrl,this.props.data.fileId,this.state.viewDetails].join("/"),t=["btn","btn-secondary","btn--icon-xl","btn--no-text","font-icon-left-open-big","history-list__back"].join(" ");return r.default.createElement("div",{className:"history-list"},r.default.createElement("a",{href:"#",className:t,onClick:this.handleBack}),r.default.createElement(a.default,{identifier:"AssetAdmin.HistoryList",schemaUrl:e,formTag:"div"}))}const e=this.state.history||[];return r.default.createElement("div",{className:"history-list"},r.default.createElement("ul",{className:"list-group list-group-flush history-list__list"},e.map((e=>r.default.createElement(l.default,p({key:e.versionid},e,{onClick:this.handleClick}))))))}}t.Component=f,f.propTypes={sectionConfig:u.default.shape({form:u.default.object,historyEndpoint:u.default.shape({url:u.default.string,method:u.default.string,responseFormat:u.default.string})}),historySchemaUrl:u.default.string,data:u.default.object},f.defaultProps={data:{fieldId:0}};t.default=(0,o.connect)((function(e){const t=e.config.sections.find((e=>"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"===e.name));return{sectionConfig:t,historySchemaUrl:t.form.fileHistoryForm.schemaUrl}}))(f)},6931:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=b(n(5815)),o=v(n(1594)),i=n(9367),s=n(9040),l=b(n(7917)),a=b(n(2908)),u=b(n(1957)),d=v(n(4201)),c=v(n(1021)),p=b(n(8737)),f=b(n(6923)),h=b(n(6935)),m=b(n(8268)),g=b(n(7675));function y(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(y=function(e){return e?n:t})(e)}function v(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=y(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function b(e){return e&&e.__esModule?e:{default:e}}class _ extends o.Component{constructor(e){super(e),this.handleSubmit=this.handleSubmit.bind(this)}componentDidMount(){const{isOpen:e,onBrowse:t,setOverrides:n,fileAttributes:r,folderId:o}=this.props;e?"function"==typeof n&&r.ID&&(n(this.props),t(o,r.ID)):t(o||0)}componentDidUpdate(e){!this.props.isOpen&&e.isOpen&&(this.props.onBrowse(this.props.folderId),this.props.actions.gallery.deselectFiles()),"function"==typeof e.setOverrides&&this.props.isOpen&&!e.isOpen&&(e.setOverrides(this.props),this.props.onBrowse(this.props.folderId,this.props.fileAttributes?this.props.fileAttributes.ID:null))}getSectionProps(){return{...this.props,dialog:!0,toolbarChildren:this.renderToolbarChildren(),onSubmitEditor:this.handleSubmit,onReplaceUrl:this.props.onBrowse}}getModalProps(){const{onHide:e,onInsert:t,sectionConfig:n,schemaUrl:r,className:o,...i}=this.props;return{...i,className:(0,f.default)("insert-media-modal",o),size:"lg",showCloseButton:!1}}handleSubmit(e,t,n,r){return"action_insert"===t?this.props.onInsert(e,r):n()}renderToolbarChildren(){return o.default.createElement("button",{type:"button",className:"close modal__close-button insert-media-modal__close-button",onClick:this.props.onClosed,"aria-label":r.default._t("FormBuilderModal.CLOSE","Close")},o.default.createElement("span",{"aria-hidden":"true"},"×"))}render(){const e=this.getModalProps(),t=this.getSectionProps(),n=this.props.isOpen?o.default.createElement(l.default,t):null;return o.default.createElement(p.default,e,n)}}t.Component=_,_.propTypes={sectionConfig:h.default.shape({url:h.default.string,form:h.default.object}),type:h.default.oneOf(["insert-media","insert-link","select","admin"]),schemaUrl:h.default.string,isOpen:h.default.bool,setOverrides:h.default.func,onInsert:h.default.func.isRequired,fileAttributes:h.default.shape({ID:h.default.number,AltText:h.default.string,Width:h.default.number,Height:h.default.number,Loading:h.default.string,TitleTooltip:h.default.string,Alignment:h.default.string,Description:h.default.string,TargetBlank:h.default.bool}),requireLinkText:h.default.bool,folderId:h.default.number,fileId:h.default.number,viewAction:h.default.string,query:h.default.object,getUrl:h.default.func,onBrowse:h.default.func.isRequired,onClosed:h.default.func,className:h.default.string,actions:h.default.object,maxFiles:h.default.number,fileSelected:h.default.bool},_.defaultProps={className:"",fileAttributes:{},type:"insert-media",folderId:0,maxFiles:1};t.default=(0,i.compose)(a.default,(0,s.connect)((function(e,t){const n=t.sectionConfig;if(!n)return{};let r=0;null!==t.folderId?r=t.folderId:t.folder&&(r=t.folder.id);const o=t.fileAttributes?t.fileAttributes.ID:t.fileId,i=e.assetAdmin.modal.formSchema,s={config:n,viewAction:t.viewAction,folderId:r,type:i&&i.type,fileId:o},{schemaUrl:l,targetId:a}=(0,m.default)(s);if(!l)return{};const u={};t.requireLinkText&&(u.requireLinkText=!0),t.fileSelected&&(u.fileSelected=!0);let d=g.default.stringify(u);return d=d?`?${d}`:"",{schemaUrl:`${l}/${a}${d}`,type:i&&i.type}}),(function(e){return{actions:{gallery:(0,i.bindActionCreators)(d,e),modal:(0,i.bindActionCreators)(c,e)}}})),u.default)(_)},5769:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=h(n(1594)),o=n(9040),i=n(9367),s=h(n(5815)),l=h(n(6379)),a=h(n(6935)),u=n(4201),d=n(8918),c=h(n(8737)),p=h(n(4350)),f=h(n(4064));function h(e){return e&&e.__esModule?e:{default:e}}class m extends r.default.Component{constructor(e){super(e),this.handleSubmit=this.handleSubmit.bind(this),this.timeout=null}handleSubmit(e){let{FolderID:t}=e;const{moveFiles:n}=this.props.actions.files,{selectedFiles:r,onSuccess:o,onClosed:i,setNotice:a,setError:u,setBadge:d}=this.props;return n(t||0,r).then((e=>{let{data:{moveFiles:{id:n,filename:u}}}=e;"function"==typeof o&&o(t,r),d(n,`${r.length}`,"success",l.default.MOVE_SUCCESS_DURATION),a(s.default.sprintf(s.default._t("AssetAdmin.MOVED_ITEMS_TO","Moved %s item(s) to %s"),r.length,u),[{label:s.default._t("AssetAdmin.GO_TO_FOLDER","Go to folder"),onClick:()=>this.props.onOpenFolder(n)}]),i()})).catch((()=>{u(s.default._t("AssetAdmin.FAILED_MOVE","There was an error moving the selected items."))}))}render(){const{isOpen:e,onClosed:t,title:n,folderId:o,sectionConfig:i}=this.props,{schemaUrl:s}=i.form.moveForm;return r.default.createElement(c.default,{title:n,isOpen:e,onClosed:t,onSubmit:this.handleSubmit,identifier:"AssetAdmin.MoveForm",schemaUrl:`${s}/${o}`})}}m.propTypes={sectionConfig:p.default,folderId:a.default.number.isRequired,isOpen:a.default.bool,onClosed:a.default.func,setNotice:a.default.func,setBadge:a.default.func,setError:a.default.func,title:a.default.string,onSuccess:a.default.func,onOpenFolder:a.default.func.isRequired,selectedFiles:a.default.array.isRequired,actions:a.default.shape({files:a.default.shape({moveFiles:a.default.func})}).isRequired},m.defaultProps={isOpen:!1};t.default=(0,i.compose)((0,o.connect)((function(e){const{modal:t,selectedFiles:n}=e.assetAdmin.gallery;return{isOpen:t===l.default.MODAL_MOVE,selectedFiles:n,title:s.default.sprintf(s.default._t("AssetAdmin.MOVE_ITEMS_TO","Move %s item(s) to..."),n.length)}}),(function(e){return{onClosed(){e((0,u.deactivateModal)())},setNotice(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];e((0,d.display)({text:t,type:"success",actions:n}))},setError(t){e((0,d.display)({text:t,type:"error"}))},setBadge(){e((0,u.setFileBadge)(...arguments))}}})),f.default)(m)},6609:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=f(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=p(n(6935)),i=p(n(9888)),s=p(n(5815)),l=p(n(1990)),a=n(5789),u=n(5716),d=n(5207),c=n(9367);function p(e){return e&&e.__esModule?e:{default:e}}function f(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(f=function(e){return e?n:t})(e)}class h extends r.Component{constructor(e){super(e),this.getColumns=this.getColumns.bind(this),this.handleSort=this.handleSort.bind(this),this.handleSetPage=this.handleSetPage.bind(this),this.handleRowClick=this.handleRowClick.bind(this),this.renderSelect=this.renderSelect.bind(this),this.renderTitle=this.renderTitle.bind(this),this.renderStatus=this.renderStatus.bind(this),this.renderNoItemsNotice=this.renderNoItemsNotice.bind(this)}getColumns(){const e=["thumbnail","title","status","size","lastEdited"];return this.props.selectableItems&&e.unshift("selected"),e}getColumnConfig(){return[{columnName:"selected",sortable:!1,displayName:"",cssClassName:"gallery__table-column--select",customComponent:this.renderSelect},{columnName:"thumbnail",sortable:!1,displayName:"",cssClassName:"gallery__table-column--image",customComponent:this.renderThumbnail},{columnName:"title",customCompareFn:()=>0,displayName:s.default._t("File.TITLE","Title"),cssClassName:"gallery__table-column--title",customComponent:this.renderTitle},{columnName:"status",sortable:!1,cssClassName:"sort--disabled",customComponent:this.renderStatus,displayName:s.default._t("File.STATUS","Status")},{columnName:"lastEdited",displayName:s.default._t("File.MODIFIED","Modified"),customComponent:this.renderDate},{columnName:"size",sortable:!1,displayName:s.default._t("File.SIZE","Size"),cssClassName:"sort--disabled",customComponent:this.renderSize}]}getRowMetadata(e){return"gallery__table-row "+(e.highlighted?"gallery__table-row--highlighted":"")}getTableProps(){const[e,t]=this.props.sort.split(",");return{tableClassName:"gallery__table table table-hover",gridClassName:"gallery__main-view--table",rowMetadata:{bodyCssClassName:this.getRowMetadata,key:"key"},sortAscendingComponent:"",sortDescendingComponent:"",useExternal:!0,externalSetPage:this.handleSetPage,externalChangeSort:this.handleSort,externalSetFilter:()=>null,externalSetPageSize:()=>null,externalCurrentPage:this.props.page-1,externalMaxPage:Math.ceil(this.props.totalCount/this.props.limit),externalSortColumn:e,externalSortAscending:"asc"===t,initialSort:e,columns:this.getColumns(),columnMetadata:this.getColumnConfig(),useGriddleStyles:!1,onRowClick:this.handleRowClick,results:this.props.files,customNoDataComponent:this.renderNoItemsNotice}}handleActivate(e,t){"folder"===t.type?this.props.onOpenFolder(e,t):this.props.onOpenFile(e,t)}handleRowClick(e,t){const n=e.props.data;t.currentTarget.classList.contains("gallery__table-column--select")&&(t.stopPropagation(),t.preventDefault(),"function"==typeof this.props.onSelect)?this.props.onSelect(t,n):this.handleActivate(t,n)}handleSort(e,t){const n=t?"asc":"desc";this.props.onSort(`${e},${n}`)}handleSetPage(e){this.props.onSetPage(e+1)}preventFocus(e){e.preventDefault()}renderNoItemsNotice(){return 0!==this.props.files.length||this.props.loading?null:r.default.createElement("p",{className:"gallery__no-item-notice"},s.default._t("AssetAdmin.NOITEMSFOUND"))}renderSize(e){if("folder"===e.rowData.type)return null;const t=(0,u.fileSize)(e.data);return r.default.createElement("span",null,t)}renderStatus(e){let t=[];const n=e.rowData,{VersionedBadge:o}=this.props;return"folder"!==n.type&&(n.draft?t.push({key:"status-draft",status:"draft"}):n.modified&&t.push({key:"status-modified",status:"modified"})),t=t.map((e=>{let{...t}=e;return r.default.createElement(o,t)})),t?r.default.createElement("span",null,t):null}renderProgressBar(e){if(!e.queuedId||e.message&&"error"===e.message.type)return null;if(e.id>0)return r.default.createElement("div",{className:"gallery__progress-bar--complete"});const t={className:"gallery__progress-bar-progress",style:{width:`${e.progress}%`}};return r.default.createElement("div",{className:"gallery__progress-bar"},r.default.createElement("div",t))}renderRestrictedAccess(e){const{hasRestrictedAccess:t}=e,n={fileID:e.id,placement:"top",hasRestrictedAccess:t};return r.default.createElement(l.default,n)}renderTrackedFormUpload(e){const{isTrackedFormUpload:t,hasRestrictedAccess:n}=e,o={fileID:e.id,placement:"top",isTrackedFormUpload:t,hasRestrictedAccess:n};return r.default.createElement(l.default,o)}renderTitle(e){const t=this.renderProgressBar(e.rowData);return r.default.createElement("div",{className:"fill-width"},r.default.createElement("div",{className:"flexbox-area-grow"},r.default.createElement("span",null,e.data),e.rowData.hasRestrictedAccess&&this.renderRestrictedAccess(e.rowData),e.rowData.isTrackedFormUpload&&this.renderTrackedFormUpload(e.rowData)),t)}renderSelect(e){if(this.props.selectableItems&&(this.props.selectableFolders||"folder"!==e.rowData.type)){const t={type:"checkbox",title:s.default._t("AssetAdmin.SELECT"),defaultChecked:e.data,tabIndex:-1,onMouseDown:this.preventFocus};return![null,1].includes(this.props.maxFilesSelect)&&this.props.selectedFiles.length>=this.props.maxFilesSelect&&!e.data&&(t.disabled=!0),r.default.createElement("input",t)}return null}renderDate(e){return"folder"===e.rowData.type?null:(moment.locale(s.default.detectLocale()),r.default.createElement("span",null,moment(e.data).format("L LT")))}renderThumbnail(e){const t=e.data||e.rowData.url,n=e.rowData.queuedId&&!e.rowData.id,o=e.rowData.category||"false",i="gallery__table-image",s=[i],l={};return s.push(`${i}--${o}`),"image"===o&&t&&(l.backgroundImage=`url("${t}")`),n||t||"folder"===o||s.push(`${i}--error`),r.default.createElement("div",{className:s.join(" "),style:l})}render(){return r.default.createElement(i.default,this.getTableProps())}}t.Component=h,h.defaultProps=a.galleryViewDefaultProps,h.propTypes={...a.galleryViewPropTypes,sort:o.default.string.isRequired,VersionedBadge:o.default.elementType};t.default=(0,c.compose)((0,d.inject)(["VersionedBadge"],(e=>({VersionedBadge:e}))))(h)},2853:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=d(n(5815)),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=n(5207),s=n(5789),l=d(n(9888)),a=d(n(6935));function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}function d(e){return e&&e.__esModule?e:{default:e}}class c extends o.Component{constructor(e){super(e),this.renderItem=this.renderItem.bind(this),this.handleSetPage=this.handleSetPage.bind(this),this.handlePrevPage=this.handlePrevPage.bind(this),this.handleNextPage=this.handleNextPage.bind(this),this.handleDrag=this.handleDrag.bind(this)}handleDrag(e){this.props.onEnableDropzone(!e)}handleSetPage(e){this.props.onSetPage(e+1)}handleNextPage(){const e=this.props.page-1;this.handleSetPage(e+1)}handlePrevPage(){const e=this.props.page-1;0!==e?this.handleSetPage(e-1):this.handleSetPage(e)}folderFilter(e){return"folder"===e.type}fileFilter(e){return"folder"!==e.type}renderPagination(){if(this.props.totalCount<=this.props.limit)return null;const e={setPage:this.handleSetPage,maxPage:Math.ceil(this.props.totalCount/this.props.limit),next:this.handleNextPage,nextText:r.default._t("AssetAdmin.NEXT","Next"),previous:this.handlePrevPage,previousText:r.default._t("AssetAdmin.PREVIOUS","Previous"),currentPage:this.props.page-1,useGriddleStyles:!1};return o.default.createElement("div",{className:"griddle-footer"},o.default.createElement(l.default.GridPagination,e))}renderItem(e){const{File:t,Folder:n,badges:r,sectionConfig:i,selectedFiles:s,selectableItems:l,selectableFolders:a}=this.props,u=r.find((t=>t.id===e.id));let d={sectionConfig:i,key:e.key,selectableKey:e.id,item:e,selectedFiles:s,onDrag:this.handleDrag,badge:u,canDrag:this.props.canDrag};if(e.queuedId&&!e.id){const{onCancelUpload:e,onRemoveErroredUpload:t}=this.props;d={...d,onCancelUpload:e,onRemoveErroredUpload:t}}else{const{onOpenFolder:t,onOpenFile:n}=this.props;d={...d,onActivate:"folder"===e.type?t:n}}if(l&&(a||"folder"!==e.type)){const e=![null,1].includes(this.props.maxFilesSelect)&&this.props.selectedFiles.length>=this.props.maxFilesSelect,t=1===this.props.maxFilesSelect?d.onActivate:this.props.onSelect;d={...d,selectable:!0,onSelect:t,maxSelected:e}}if("folder"===e.type){const{onDropFiles:e}=this.props;return d={...d,onDropFiles:e},o.default.createElement(n,d)}return o.default.createElement(t,d)}render(){return o.default.createElement("div",{className:"gallery__main-view--tile"},o.default.createElement("div",{className:"gallery__folders"},this.props.files.filter(this.folderFilter).map(this.renderItem)),o.default.createElement("div",{className:"gallery__files"},this.props.files.filter(this.fileFilter).map(this.renderItem)),0===this.props.files.length&&!this.props.loading&&o.default.createElement("p",{className:"gallery__no-item-notice"},r.default._t("AssetAdmin.NOITEMSFOUND")),o.default.createElement("div",{className:"gallery__load"},this.renderPagination()))}}t.Component=c,c.defaultProps=s.galleryViewDefaultProps,c.propTypes={...s.galleryViewPropTypes,File:a.default.elementType.isRequired,Folder:a.default.elementType.isRequired};const p=(0,i.inject)(["GalleryItemFile","GalleryItemFolder"],((e,t)=>({File:e,Folder:t})),(()=>"AssetAdmin.Gallery.ThumbnailView"));t.default=p(c)},9329:function(e,t,n){"use strict";var r=a(n(1669)),o=a(n(1594)),i=n(5145),s=n(3398),l=n(5207);function a(e){return e&&e.__esModule?e:{default:e}}function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t{e(".js-injector-boot input.entwine-uploadfield").entwine({Component:null,ReactRoot:null,getContainer(){let t=this.siblings(".uploadfield-holder")[0];if(!t){const n=e('
');this.before(n),t=n[0]}return t},onunmatch(){this._super();const e=this.getReactRoot();e&&(e.unmount(),this.setReactRoot(null))},onmatch(){const e=this.closest(".cms-content").attr("id"),t=e?{context:e}:{},n=(0,l.loadComponent)("UploadField",t);this.setComponent(n),this._super(),this.hide(),this.refresh()},onclick(e){e.preventDefault()},refresh(){const t=this.getAttributes(),n=e(this).closest("form"),r=this.getComponent();let s=this.getReactRoot();s||(s=(0,i.createRoot)(this.getContainer()),this.setReactRoot(s)),s.render(o.default.createElement(r,u({},t,{onChange:()=>{setTimeout((()=>{n.trigger("change")}),0)},noHolder:!0})))},getAttributes(){const t=e(this).data("state"),n=e(this).data("schema");return(0,s.schemaMerge)(n,t)}})}))},4350:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o=(r=n(6935))&&r.__esModule?r:{default:r};const i=o.default.shape({url:o.default.string,limit:o.default.number,imageRetry:o.default.shape({minRetry:o.default.number,maxRetry:o.default.number,expiry:o.default.number}),form:o.default.object,dropzoneOptions:o.default.object});t.default=i},6298:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fileInterface=t.file=void 0;t.fileInterface="\n fragment FileInterfaceFields on FileInterface {\n canDelete\n canEdit\n canView\n category\n exists\n filename\n id\n lastEdited\n name\n parentId\n title\n type\n url\n visibility\n hasRestrictedAccess\n }\n",t.file="\n fragment FileFields on File {\n draft\n extension\n published\n modified\n size\n smallThumbnail\n thumbnail\n version\n isTrackedFormUpload\n }\n"},6022:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o=(r=n(6935))&&r.__esModule?r:{default:r};const i=o.default.shape({canEdit:o.default.bool,canDelete:o.default.bool,canView:o.default.bool,exists:o.default.bool,type:o.default.string,smallThumbnail:o.default.string,thumbnail:o.default.string,width:o.default.number,height:o.default.number,category:o.default.oneOfType([o.default.bool,o.default.string]),id:o.default.number,url:o.default.string,title:o.default.string,progress:o.default.number,visibility:o.default.string,hasRestrictedAccess:o.default.bool,isTrackedFormUpload:o.default.bool});t.default=i},4886:function(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;const o=(0,((r=n(2923))&&r.__esModule?r:{default:r}).default)({name:null,canDelete:!1,canEdit:!1,category:null,created:null,extension:null,filename:null,id:0,lastEdited:null,messages:null,owner:{id:0,title:null},parent:{filename:null,id:0,title:null},queuedId:null,size:null,title:null,type:null,url:null,xhr:null,thumbnail:null,smallThumbnail:null,height:null,width:null});t.default=o},8268:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){let{config:{form:t},viewAction:n,folderId:r,fileId:o,type:l}=e,a=null,u=null;if(n===i)return a=t.folderCreateForm.schemaUrl,u=r,{schemaUrl:a,targetId:u};if(n===s&&o){switch(l){case"insert-media":a=t.fileInsertForm.schemaUrl;break;case"insert-link":a=t.fileEditorLinkForm.schemaUrl;break;case"select":a=t.fileSelectForm.schemaUrl;break;default:a=t.fileEditForm.schemaUrl}return u=o,{schemaUrl:a,targetId:u}}return{}};var r,o=(r=n(6379))&&r.__esModule?r:{default:r};const{CREATE_FOLDER:i,EDIT_FILE:s}=o.default.ACTIONS},9247:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(413===e)return o.default._t("AssetAdmin.ERROR_FILE_SIZE","File size limit exceeded");if(403===e&&t&&"string"==typeof t.response)return t.response;return o.default._t("AssetAdmin.ERROR_DEFAULT","Something went wrong, please try again")};var r,o=(r=n(5815))&&r.__esModule?r:{default:r}},6405:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={CONFIRM_DELETION_ASK:"CONFIRM_DELETION_ASK",CONFIRM_DELETION_CONFIRM:"CONFIRM_DELETION_CONFIRM",CONFIRM_DELETION_CANCEL:"CONFIRM_DELETION_CANCEL",CONFIRM_DELETION_RESET:"CONFIRM_DELETION_RESET",CONFIRM_DELETION_MODAL_CLOSE:"CONFIRM_DELETION_MODAL_CLOSE"}},4461:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cancel=function(){return{type:o.default.CONFIRM_DELETION_CANCEL,payload:{}}},t.confirm=function(e){return{type:o.default.CONFIRM_DELETION_ASK,payload:{files:e}}},t.deleting=function(){return{type:o.default.CONFIRM_DELETION_CONFIRM,payload:{}}},t.modalClose=function(){return{type:o.default.CONFIRM_DELETION_MODAL_CLOSE,payload:{}}},t.reset=function(){return{type:o.default.CONFIRM_DELETION_RESET,payload:{}}};var r,o=(r=n(6405))&&r.__esModule?r:{default:r}},9266:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.initialState=t.default=void 0;var r,o=(r=n(6405))&&r.__esModule?r:{default:r},i=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=s(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var l=o?Object.getOwnPropertyDescriptor(e,i):null;l&&(l.get||l.set)?Object.defineProperty(r,i,l):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(762));function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(s=function(e){return e?n:t})(e)}const l=t.initialState={showConfirmation:!1,files:[],transition:i.NO_TRANSITION};t.default=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case o.default.CONFIRM_DELETION_ASK:return{...l,showConfirmation:!0,files:t.payload.files};case o.default.CONFIRM_DELETION_CANCEL:if(e.showConfirmation)return{...e,transition:i.CANCELING};break;case o.default.CONFIRM_DELETION_CONFIRM:if(e.showConfirmation)return{...e,transition:i.DELETING};break;case o.default.CONFIRM_DELETION_MODAL_CLOSE:return{...e,showConfirmation:!1,transition:i.NO_TRANSITION};case o.default.CONFIRM_DELETION_RESET:return l}return e}},762:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NO_TRANSITION=t.DELETING=t.CANCELING=void 0;t.NO_TRANSITION=!1,t.CANCELING="canceling",t.DELETING="deleting"},6533:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={TOGGLE_SEARCH:"TOGGLE_SEARCH",OPEN_SEARCH:"OPEN_SEARCH",CLOSE_SEARCH:"CLOSE_SEARCH"}},9517:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.closeSearch=function(){return{type:o.default.CLOSE_SEARCH,payload:null}},t.openSearch=function(){return{type:o.default.OPEN_SEARCH,payload:null}},t.toggleSearch=function(){return{type:o.default.TOGGLE_SEARCH,payload:null}};var r,o=(r=n(6533))&&r.__esModule?r:{default:r}},2482:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(2923)),o=i(n(6533));function i(e){return e&&e.__esModule?e:{default:e}}const s={isOpen:!1};t.default=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s;switch((arguments.length>1?arguments[1]:void 0).type){case o.default.TOGGLE_SEARCH:return(0,r.default)({...e,isOpen:!e.isOpen});case o.default.OPEN_SEARCH:return(0,r.default)({...e,isOpen:!0});case o.default.CLOSE_SEARCH:return(0,r.default)({...e,isOpen:!1});default:return e}}},2310:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o=(r=n(7284))&&r.__esModule?r:{default:r},i=n(6298);t.default=e=>{const t=e.charAt(0).toUpperCase()+e.slice(1),n=o.default` - mutation ${t}($ids:[ID]!, $force:Boolean, $quiet:Boolean) { - ${e}(ids: $ids, force: $force, quiet: $quiet) { - ...on File { - __typename - ...FileInterfaceFields - ...FileFields - } - ...on PublicationNotice { - __typename - noticeType - message - ids - } - } - } - ${i.fileInterface} - ${i.file} -`,r={props:t=>{let{mutate:n,ownProps:{actions:r}}=t;return{actions:{...r,files:{...r.files,[e]:function(e){return n({variables:{ids:e,quiet:!(arguments.length>2&&void 0!==arguments[2])||arguments[2],force:arguments.length>1&&void 0!==arguments[1]&&arguments[1]}})}}}}}};return{mutation:n,config:r}}},3934:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mutation=t.default=t.config=void 0;var r=n(708),o=s(n(7284)),i=s(n(5207));function s(e){return e&&e.__esModule?e:{default:e}}const l=t.mutation=o.default`mutation DeleteFiles($ids:[ID]!) { - deleteFiles(ids: $ids) -}`,a=t.config={props:e=>{let{mutate:t,ownProps:n}=e;const{actions:r}=n;return{actions:{...r,files:{...r.files,deleteFiles:function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t({variables:{ids:e},update:t=>{const o=i.default.query.get("ReadFilesQuery"),s=o.getApolloConfig().options(n).variables;null!==r&&(s.rootFilter.id=r,s.rootFilter.anyChildId=null);const l=o.getGraphqlAST(),a=t.readQuery({query:l,variables:s});if(!a)return;const u=JSON.parse(JSON.stringify(a));if(u.readFiles.nodes){let{nodes:t}=u.readFiles.nodes[0].children;t=t.filter((t=>!e.includes(t.id))),u.readFiles.nodes[0].children.nodes=t,u.readFiles.nodes[0].children.pageInfo.totalCount=t.length}else{let{nodes:t}=u.readFiles[0].children;t=t.filter((t=>!e.includes(t.id))),u.readFiles[0].children.nodes=t,u.readFiles[0].children.pageInfo.totalCount=t.length}t.writeQuery({query:l,data:u,variables:s})}})}}}}}};t.default=(0,r.graphql)(l,a)},4064:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mutation=t.default=t.config=void 0;var r,o=n(708),i=(r=n(7284))&&r.__esModule?r:{default:r},s=n(6298);const l=t.mutation=i.default` - mutation MoveFiles($folderId:ID!, $fileIds:[ID]!) { - moveFiles(folderId: $folderId, fileIds: $fileIds) { - ...FileInterfaceFields - ...FileFields - } - } - ${s.fileInterface} - ${s.file} -`,a=t.config={props:e=>{let{mutate:t,ownProps:{actions:n={}}}=e;return{actions:Object.assign({},n,{files:Object.assign({},n.files,{moveFiles:(e,n)=>t({variables:{folderId:e,fileIds:n},update:()=>{window.ss.apolloClient.resetStore()}})})})}}};t.default=(0,o.graphql)(l,a)},5230:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mutation=t.default=t.config=void 0;var r,o=n(708),i=(r=n(2310))&&r.__esModule?r:{default:r};const{mutation:s,config:l}=(0,i.default)("publishFiles");t.config=l,t.mutation=s;t.default=(0,o.graphql)(s,l)},3772:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=n(5207);const o={options(e){let{files:t}=e;return{variables:{ids:t.map((e=>e.id))}}},props(e){const{data:{error:t,readDescendantFileCounts:n,loading:r}}=e,o=t&&t.graphQLErrors&&t.graphQLErrors.map((e=>e.message));return{loading:r,descendantFileCounts:n?n.reduce(((e,t)=>{let{id:n,count:r}=t;return{...e,[n]:r}}),{}):{},graphQLErrors:o}}},{READ:i}=r.graphqlTemplates,s={apolloConfig:o,templateName:i,pluralName:"DescendantFileCounts",pagination:!1,params:{ids:"[ID]!"},args:{root:{ids:"ids"}},fields:["id","count"]};t.default=s},5364:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=n(5207);const o={options(e){let{files:t}=e;return{variables:{ids:t.map((e=>e.id))}}},props(e){const{data:{error:t,readFileUsage:n,loading:r}}=e,o=t&&t.graphQLErrors&&t.graphQLErrors.map((e=>e.message));return{loading:r,fileUsage:n?n.reduce(((e,t)=>{let{id:n,inUseCount:r}=t;return{...e,[n]:r}}),{}):{},graphQLErrors:o}}},{READ:i}=r.graphqlTemplates,s={apolloConfig:o,templateName:i,pluralName:"FileUsage",pagination:!1,params:{ids:"[ID]!"},args:{root:{ids:"ids"}},fields:["id","inUseCount"]};t.default=s},5518:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=n(6303),o=n(5207);const i={options(e){let{sectionConfig:t,folderId:n,fileId:o,query:i}=e;const s=Object.assign({},i.filter),l=Object.assign({},s,{parentId:void 0,recursive:(0,r.hasFilters)(s),currentFolderOnly:void 0}),a=(0,r.hasFilters)(s)?null:o||null,u={id:a?null:n||0,anyChildId:a},[d,c]=i.sort?i.sort.split(","):["",""],p=i.limit||t.limit;return{variables:{rootFilter:u,childrenFilter:l,limit:p,offset:((i.page||1)-1)*p,sortBy:d&&c?{[d]:c.toUpperCase()}:void 0}}},props(e){let{data:{error:t,refetch:n,readFiles:r,loading:o},ownProps:{actions:i}}=e;const s=r?r[0]:null,l=s&&s.children?s.children.nodes.filter((e=>e)):[],a=s&&s.children?s.children.pageInfo.totalCount:0,u=s&&!s.children;return{loading:o||u,folder:s,files:l,filesTotalCount:a,graphQLErrors:t&&t.graphQLErrors&&t.graphQLErrors.map((e=>e.message)),actions:Object.assign({},i,{files:Object.assign({},i.files,{readFiles:n})})}}},{READ:s}=o.graphqlTemplates,l={apolloConfig:i,templateName:s,pluralName:"Files",pagination:!1,params:{limit:"Int!",offset:"Int!",rootFilter:"FileFilterInput",childrenFilter:"FileFilterInput",sortBy:"FolderChildrenSortFields"},args:{root:{filter:"rootFilter"},"root/...on Folder/children":{limit:"limit",offset:"offset",filter:"childrenFilter",sort:"sortBy"}},fragments:["FileInterfaceFields","FileFields"],fields:["...FileInterfaceFields","...FileFields","...on Folder",["children",["pageInfo",["totalCount"],"nodes",["...FileInterfaceFields","...FileFields"]],"parents",["id","title"]]]};t.default=l},6153:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=n(5207);const o={options(e){let{fileId:t}=e;return{variables:{rootFilter:{id:t}}}},props(e){let{data:{error:t,readFiles:n,loading:r}}=e;return{loading:r,file:n?n[0]:null,graphQLErrors:t&&t.graphQLErrors&&t.graphQLErrors.map((e=>e.message))}}},{READ:i}=r.graphqlTemplates,s={apolloConfig:o,templateName:i,pluralName:"Files",pagination:!1,params:{rootFilter:"FileFilterInput"},args:{root:{filter:"rootFilter"}},fragments:["FileInterfaceFields","FileFields"],fields:["...FileInterfaceFields","...FileFields"]};t.default=s},3929:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mutation=t.default=t.config=void 0;var r,o=n(708),i=(r=n(2310))&&r.__esModule?r:{default:r};const{mutation:s,config:l}=(0,i.default)("unpublishFiles");t.config=l,t.mutation=s;t.default=(0,o.graphql)(s,l)},4913:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=["SET_LAST_SELECTED","SET_SELECTED_FILES","DESELECT_FILES","SELECT_FILES","LOAD_FILE_REQUEST","LOAD_FILE_SUCCESS","HIGHLIGHT_FILES","UPDATE_BATCH_ACTIONS","SET_NOTICE_MESSAGE","SET_ERROR_MESSAGE","SET_ENABLE_DROPZONE","SET_FILE_BADGE","CLEAR_FILE_BADGE","ACTIVATE_MODAL","DEACTIVATE_MODAL","CONCATENATE_SELECT","SET_LOADING"].reduce(((e,t)=>Object.assign(e,{[t]:`GALLERY.${t}`})),{})},4201:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.activateModal=function(e){return t=>{t({type:o.default.ACTIVATE_MODAL,payload:e})}},t.clearFileBadge=i,t.deactivateModal=function(){return e=>{e({type:o.default.DEACTIVATE_MODAL})}},t.deselectFiles=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return t=>t({type:o.default.DESELECT_FILES,payload:{ids:e}})},t.loadFile=function(e,t){return n=>{n({type:o.default.LOAD_FILE_SUCCESS,payload:{id:e,file:t}})}},t.selectFiles=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return t=>t({type:o.default.SELECT_FILES,payload:{ids:e}})},t.setConcatenateSelect=function(e){return t=>t({type:o.default.CONCATENATE_SELECT,payload:!!e})},t.setEnableDropzone=function(e){return t=>t({type:o.default.SET_ENABLE_DROPZONE,payload:{enableDropzone:e}})},t.setErrorMessage=function(e){return t=>t({type:o.default.SET_ERROR_MESSAGE,payload:{message:e}})},t.setFileBadge=function(e,t,n,r){return(s,l)=>{const{assetAdmin:a}=l(),u=a.gallery.badges.find((t=>t.id===e));u&&u.timer&&clearTimeout(u.timer);const d=r>0?setTimeout((()=>i(e)(s)),r):null;s({type:o.default.SET_FILE_BADGE,payload:{id:e,message:t,status:n,timer:d}})}},t.setLastSelected=function(e){return t=>{t({type:o.default.SET_LAST_SELECTED,payload:{id:e}})}},t.setLoading=function(e){return t=>{t({type:o.default.SET_LOADING,payload:!!e})}},t.setNoticeMessage=function(e){return t=>t({type:o.default.SET_NOTICE_MESSAGE,payload:{message:e}})},t.setSelectedFiles=function(e){return t=>{t({type:o.default.SET_SELECTED_FILES,payload:{files:e}})}};var r,o=(r=n(4913))&&r.__esModule?r:{default:r};function i(e){return t=>{t({type:o.default.CLEAR_FILE_BADGE,payload:{id:e}})}}},8518:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l,{type:t,payload:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(t){case i.default.SET_LAST_SELECTED:return{...e,lastSelected:n.id};case i.default.SET_FILE_BADGE:return{...e,badges:e.badges.filter((e=>e.id!==n.id)).concat([n])};case i.default.CLEAR_FILE_BADGE:return{...e,badges:e.badges.filter((e=>e.id!==n.id))};case i.default.SET_ENABLE_DROPZONE:return{...e,enableDropzone:n.enableDropzone};case i.default.SET_NOTICE_MESSAGE:return{...e,noticeMessage:n.message};case i.default.SET_ERROR_MESSAGE:return{...e,errorMessage:n.message};case i.default.LOAD_FILE_SUCCESS:{const t=e.files.find((e=>e.id===n.id));if(t){const o={...t,...n.file};return(0,r.default)({...e,files:e.files.map((e=>e.id===o.id?o:e))})}return e.folder.id===n.id?(0,r.default)({...e,folder:{...e.folder,...n.file}}):e}case i.default.SET_SELECTED_FILES:return(0,r.default)({...e,selectedFiles:Array.isArray(n.files)?n.files:[]});case i.default.SELECT_FILES:{let t=null;return t=null===n.ids?e.files.map((e=>e.id)):e.selectedFiles.concat(n.ids.filter((t=>-1===e.selectedFiles.indexOf(t)))),(0,r.default)({...e,selectedFiles:t})}case i.default.DESELECT_FILES:{let t=null;return t=null===n.ids?[]:e.selectedFiles.filter((e=>-1===n.ids.indexOf(e))),(0,r.default)({...e,selectedFiles:t})}case i.default.ACTIVATE_MODAL:return(0,r.default)({...e,modal:n});case i.default.DEACTIVATE_MODAL:return(0,r.default)({...e,modal:null});case i.default.CONCATENATE_SELECT:return(0,r.default)({...e,concatenateSelect:n});case i.default.SET_LOADING:return(0,r.default)({...e,loading:n});default:return e}};var r=s(n(2923)),o=s(n(5815)),i=s(n(4913));function s(e){return e&&e.__esModule?e:{default:e}}const l={selectedFiles:[],errorMessage:null,noticeMessage:null,enableDropzone:!0,modal:null,badges:[],concatenateSelect:!1,loading:!1,sorters:[{field:"title",direction:"asc",label:o.default._t("AssetAdmin.FILTER_TITLE_ASC","title a-z")},{field:"title",direction:"desc",label:o.default._t("AssetAdmin.FILTER_TITLE_DESC","title z-a")},{field:"lastEdited",direction:"desc",label:o.default._t("AssetAdmin.FILTER_DATE_DESC","newest")},{field:"lastEdited",direction:"asc",label:o.default._t("AssetAdmin.FILTER_DATE_ASC","oldest")}],lastSelected:null}},423:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultImageFactory=t.default=void 0;var r=i(n(1838)),o=i(n(8632));function i(e){return e&&e.__esModule?e:{default:e}}const s={minRetry:0,maxRetry:0,expiry:0,onStatusChange:()=>null,onRetry:()=>null,onReset:()=>null,onTimeout:()=>null},l=(e,t,n)=>{const r=new Image;r.onload=t,r.onerror=n,r.src=e};t.defaultImageFactory=l;t.default=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;this.options={...s,...e},this.factory=t}loadImage(e){return this.options.minRetry&&o.default.lock(e)?this.loadImageLoop(e,this.options.minRetry):null}loadImageLoop(e,t){return this.options.onStatusChange(e,r.default.LOADING),new Promise(((t,n)=>this.factory(e,t,n))).then((()=>this.handleSuccess(e))).catch((()=>this.handleError(e,t)))}handleReset(e,t){this.options.onReset(e),t()}handleTimeout(e,t){const n=setTimeout(e,t);return this.options.onTimeout(n,t),n}handleSuccess(e){o.default.unlock(e),this.options.onStatusChange(e,r.default.SUCCESS)}handleFailure(e){return o.default.unlock(e),this.options.onStatusChange(e,r.default.FAILED),this.options.expiry?new Promise((t=>{this.handleTimeout((()=>this.handleReset(e,t)),1e3*this.options.expiry)})):null}handleError(e,t){return t>this.options.maxRetry?this.handleFailure(e):(this.options.onStatusChange(e,r.default.WAITING),this.handleRetry(e,t))}handleRetry(e,t){const n=new Promise((n=>{this.handleTimeout((()=>n(this.loadImageLoop(e,2*t))),1e3*t)}));return this.options.onRetry(e,t,n),n}setOnRetry(e){this.options.onRetry=e}setOnReset(e){this.options.onReset=e}setOnStatusChange(e){this.options.onStatusChange=e}setOnTimeout(e){this.options.onTimeout=e}}},2153:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={SET_STATUS:"IMAGE_LOAD_SET_STATUS",RESET:"IMAGE_LOAD_RESET"}},769:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loadImage=function(e,t){return(n,i)=>{if(!e)return null;if(i().assetAdmin.imageLoad.files.find((t=>t.url===e)))return null;const s={...t,onStatusChange:(e,t)=>n({type:r.default.SET_STATUS,payload:{status:t,url:e}}),onReset:e=>n({type:r.default.RESET,payload:{url:e}})};return new o.default(s).loadImage(e)}};var r=i(n(2153)),o=i(n(423));function i(e){return e&&e.__esModule?e:{default:e}}},8632:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;class n{constructor(){this.urls=[]}lock(e){return!(this.urls.indexOf(e)>=0)&&(this.urls=[...this.urls,e],!0)}unlock(e){this.urls=this.urls.filter((t=>t!==e))}}t.Component=n,window.ss=window.ss||{},window.ss.imagelocker=window.ss.imagelocker||new n;t.default=window.ss.imagelocker},5214:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i,{type:t,payload:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(t){case o.default.SET_STATUS:return{...e,files:[...e.files.filter((e=>e.url!==n.url)),n]};case o.default.RESET:return{...e,files:[...e.files.filter((e=>e.url!==n.url))]};default:return e}};var r,o=(r=n(2153))&&r.__esModule?r:{default:r};const i={files:[]}},1838:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={DISABLED:"DISABLED",NONE:"NONE",SUCCESS:"SUCCESS",LOADING:"LOADING",WAITING:"WAITING",FAILED:"FAILED"}},2613:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={DEFINE_IMAGE_SIZE_PRESETS:"DEFINE_IMAGE_SIZE_PRESETS",INIT_FORM_SCHEMA_STACK:"INIT_FORM_SCHEMA_STACK",POP_FORM_SCHEMA:"POP_FORM_SCHEMA",PUSH_FORM_SCHEMA:"PUSH_FORM_SCHEMA",RESET:"RESET",RESET_FORM_STACK:"RESET_FORM_STACK"}},1021:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defineImageSizePresets=function(e){return{type:i.default.DEFINE_IMAGE_SIZE_PRESETS,payload:{imageSizePresets:e}}},t.initFormStack=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return{type:i.default.INIT_FORM_SCHEMA_STACK,payload:{formSchema:{type:e,nextType:t}}}},t.popFormStackEntry=function(){return{type:i.default.POP_FORM_SCHEMA}},t.pushFormStackEntry=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return{type:i.default.PUSH_FORM_SCHEMA,payload:{formSchema:{type:e,nextType:t}}}},t.reset=function(){return{type:i.default.RESET}},t.resetFormStack=function(){return{type:i.default.RESET_FORM_STACK}},t.stashFormValues=function(e,t){return(n,i)=>{const l=i(),a=(0,r.default)(l.form.formState,`${e}.values`),u=(0,r.default)(l.form.formSchemas,`${t}.schema.fields`);if(a){const e=Object.keys(a).filter((e=>null!==a[e]&&(0,s.default)(e,u))).map((e=>({name:e,value:a[e]})));n((0,o.setSchemaStateOverrides)(t,{fields:e}))}}};var r=l(n(6104)),o=n(2811),i=l(n(2613)),s=l(n(8896));function l(e){return e&&e.__esModule?e:{default:e}}},8178:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.initialState=t.default=void 0;var r,o=(r=n(2613))&&r.__esModule?r:{default:r};const i=t.initialState={imageSizePresets:[],formSchemaStack:[],formSchema:void 0};t.default=function(){return e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i,{type:t,payload:n}=arguments.length>1?arguments[1]:void 0;const{formSchemaStack:r}=e;switch(t){case o.default.DEFINE_IMAGE_SIZE_PRESETS:return{...e,imageSizePresets:n.imageSizePresets};case o.default.PUSH_FORM_SCHEMA:return{...e,formSchemaStack:[...r,n.formSchema]};case o.default.INIT_FORM_SCHEMA_STACK:return{...e,formSchemaStack:[n.formSchema]};case o.default.POP_FORM_SCHEMA:return{...e,formSchemaStack:r.slice(0,-1)};case o.default.RESET:return i;case o.default.RESET_FORM_STACK:return{...e,formSchemaStack:r.slice(0,1)};default:return e}}(...arguments),{...e,formSchema:e.formSchemaStack.slice(-1).pop()};var e}},8896:function(e,t){"use strict";function n(e,t){let r;for(r=0;r0&&void 0!==arguments[0]?arguments[0]:s,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case o.default.PREVIEWFIELD_ADD_FILE:return(0,r.default)(Object.assign({},e,{[t.payload.id]:t.payload.file}));case o.default.PREVIEWFIELD_FAIL_UPLOAD:return(0,r.default)(Object.assign({},e,{[t.payload.id]:Object.assign({},e[t.payload.id],t.payload.message)}));case o.default.PREVIEWFIELD_REMOVE_FILE:return(0,r.default)(Object.assign({},e,{[t.payload.id]:void 0}));case o.default.PREVIEWFIELD_UPDATE_FILE:return(0,r.default)(Object.assign({},e,{[t.payload.id]:Object.assign({},e[t.payload.id],t.payload.data)}));case o.default.PREVIEWFIELD_UPDATE_STATUS:return(0,r.default)(Object.assign({},e,{[t.payload.id]:Object.assign({},e[t.payload.id],t.payload.status)}));default:return e}}},5793:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={ADD_QUEUED_FILE:"ADD_QUEUED_FILE",FAIL_UPLOAD:"FAIL_UPLOAD",PURGE_UPLOAD_QUEUE:"PURGE_UPLOAD_QUEUE",REMOVE_QUEUED_FILE:"REMOVE_QUEUED_FILE",SUCCEED_UPLOAD:"SUCCEED_UPLOAD",UPDATE_QUEUED_FILE:"UPDATE_QUEUED_FILE"}},1369:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addQueuedFile=function(e){return t=>t({type:o.default.ADD_QUEUED_FILE,payload:{file:e}})},t.failUpload=function(e,t,n){return r=>{let i=t.message;return t.errors&&t.errors.length&&(i=t.errors[0]),"string"==typeof t&&(i={value:n||t,type:"error"}),r({type:o.default.FAIL_UPLOAD,payload:{queuedId:e,message:i}})}},t.purgeUploadQueue=function(){return e=>e({type:o.default.PURGE_UPLOAD_QUEUE,payload:null})},t.removeQueuedFile=function(e){return t=>t({type:o.default.REMOVE_QUEUED_FILE,payload:{queuedId:e}})},t.succeedUpload=function(e,t){return n=>n({type:o.default.SUCCEED_UPLOAD,payload:{queuedId:e,json:t}})},t.updateQueuedFile=function(e,t){return n=>n({type:o.default.UPDATE_QUEUED_FILE,payload:{queuedId:e,updates:t}})};var r,o=(r=n(5793))&&r.__esModule?r:{default:r}},8310:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=l(n(2923)),o=l(n(4886)),i=l(n(5815)),s=l(n(5793));function l(e){return e&&e.__esModule?e:{default:e}}const a={items:[]};t.default=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case s.default.ADD_QUEUED_FILE:return(0,r.default)({...e,items:[...e.items,{...o.default,...t.payload.file}]});case s.default.FAIL_UPLOAD:return(0,r.default)({...e,items:e.items.map((e=>e.queuedId===t.payload.queuedId?{...e,message:t.payload.message}:e))});case s.default.PURGE_UPLOAD_QUEUE:return(0,r.default)({...e,items:e.items.filter((e=>!e.id))});case s.default.REMOVE_QUEUED_FILE:return(0,r.default)({...e,items:e.items.filter((e=>e.queuedId!==t.payload.queuedId))});case s.default.SUCCEED_UPLOAD:return(0,r.default)({...e,items:e.items.map((e=>e.queuedId===t.payload.queuedId?{...e,...t.payload.json,messages:[{value:i.default._t("AssetAdmin.DROPZONE_SUCCESS_UPLOAD"),type:"success",extraClass:"success"}]}:e))});case s.default.UPDATE_QUEUED_FILE:return(0,r.default)({...e,items:e.items.map((e=>e.queuedId===t.payload.queuedId?{...e,...t.payload.updates}:e))});default:return e}}},9918:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={UPLOADFIELD_SET_FORM_SCHEMA_FILES_HASH:"UPLOADFIELD_SET_FORM_SCHEMA_FILES_HASH",UPLOADFIELD_ADD_FILE:"UPLOADFIELD_ADD_FILE",UPLOADFIELD_SET_FILES:"UPLOADFIELD_SET_FILES",UPLOADFIELD_REMOVE_FILE:"UPLOADFIELD_REMOVE_FILE",UPLOADFIELD_UPLOAD_FAILURE:"UPLOADFIELD_UPLOAD_FAILURE",UPLOADFIELD_UPLOAD_SUCCESS:"UPLOADFIELD_UPLOAD_SUCCESS",UPLOADFIELD_UPDATE_QUEUED_FILE:"UPLOADFIELD_UPDATE_QUEUED_FILE"}},1433:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addFile=function(e,t){return n=>n({type:o.default.UPLOADFIELD_ADD_FILE,payload:{fieldId:e,file:t}})},t.failUpload=function(e,t,n,r){return i=>{let s=n.message;return"string"==typeof n&&(s={value:r||n,type:"error"}),i({type:o.default.UPLOADFIELD_UPLOAD_FAILURE,payload:{fieldId:e,queuedId:t,message:s}})}},t.removeFile=function(e,t){return n=>n({type:o.default.UPLOADFIELD_REMOVE_FILE,payload:{fieldId:e,file:t}})},t.setFiles=function(e,t){return n=>n({type:o.default.UPLOADFIELD_SET_FILES,payload:{fieldId:e,files:t}})},t.setFormSchemaFilesHash=function(e,t){return n=>n({type:o.default.UPLOADFIELD_SET_FORM_SCHEMA_FILES_HASH,payload:{fieldId:e,hash:t}})},t.succeedUpload=function(e,t,n){return r=>r({type:o.default.UPLOADFIELD_UPLOAD_SUCCESS,payload:{fieldId:e,queuedId:t,json:n}})},t.updateQueuedFile=function(e,t,n){return r=>r({type:o.default.UPLOADFIELD_UPDATE_QUEUED_FILE,payload:{fieldId:e,queuedId:t,updates:n}})};var r,o=(r=n(9918))&&r.__esModule?r:{default:r}},2726:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=s(n(4886)),o=s(n(6595)),i=s(n(9918));function s(e){return e&&e.__esModule?e:{default:e}}const l={fields:{}},a={formSchemaFilesHash:null,files:[]};t.default=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l,t=arguments.length>1?arguments[1]:void 0;const n=(0,o.default)(e,t,a);switch(t.type){case i.default.UPLOADFIELD_SET_FORM_SCHEMA_FILES_HASH:return n((()=>({formSchemaFilesHash:t.payload.hash})));case i.default.UPLOADFIELD_ADD_FILE:return n((e=>e.files.find((e=>e.id===t.payload.file.id))?e:{...e,files:[...e.files,{...r.default,...t.payload.file}]}));case i.default.UPLOADFIELD_SET_FILES:return n((()=>({files:t.payload.files})));case i.default.UPLOADFIELD_UPLOAD_FAILURE:return n((e=>({files:e.files.map((e=>e.queuedId===t.payload.queuedId?Object.assign({},e,{message:t.payload.message}):e))})));case i.default.UPLOADFIELD_REMOVE_FILE:return n((e=>({files:e.files.filter((e=>!(t.payload.file.queuedId&&e.queuedId===t.payload.file.queuedId||t.payload.file.id&&e.id===t.payload.file.id)))})));case i.default.UPLOADFIELD_UPLOAD_SUCCESS:return n((e=>({files:e.files.map((e=>e.queuedId===t.payload.queuedId?Object.assign({},e,t.payload.json):e))})));case i.default.UPLOADFIELD_UPDATE_QUEUED_FILE:return n((e=>({files:e.files.map((e=>e.queuedId===t.payload.queuedId?Object.assign({},e,t.payload.updates):e))})));default:return e}}},1991:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(1594)),o=i(n(5815));function i(e){return e&&e.__esModule?e:{default:e}}t.default=e=>t=>{const n=t.onClick,i={...t,onClick(e,r){const{owners:i}=t.data;let s=null;s=i&&parseInt(i,10)>0?[o.default.inject(o.default._t("AssetAdmin.SINGLE_OWNED_WARNING_1","This file is being used in {count} other published section(s)."),{count:i}),o.default._t("AssetAdmin.SINGLE_OWNED_WARNING_2","Ensure files are removed from content areas prior to unpublishing them. Otherwise, they will appear as broken links."),o.default._t("AssetAdmin.SINGLE_OWNED_WARNING_3","Do you want to unpublish this file anyway?")].join("\n\n"):o.default._t("AssetAdmin.CONFIRMUNPUBLISH","Are you sure you want to unpublish this record?"),confirm(s)?n(e,r):e.preventDefault()}};return r.default.createElement(e,i)}},315:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.disabledTreeDropdownField=t.default=void 0;var r,o=(r=n(1594))&&r.__esModule?r:{default:r},i=n(9040),s=n(9367),l=n(7818);const a=e=>t=>{const{disabledIDs:n}=t,r=t.findTreeByPath||l.findTreeByPath,i={...t,findTreeByPath(e,t){const o=r(e,t),i=t.some((e=>n.includes(e)));return o?{...o,children:o.children.map((e=>({...e,disabled:i||n.includes(e.id)})))}:null}};return o.default.createElement(e,i)};t.disabledTreeDropdownField=a;const u=(0,s.compose)((0,i.connect)((e=>({disabledIDs:e.assetAdmin.gallery.selectedFiles}))),a);t.default=u},1804:function(e,t,n){"use strict";var r=n(5228),o={};var i=function(e){};function s(e,t,n,r,o,s,l,a){if(i(t),!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var d=[n,r,o,s,l,a],c=0;(u=new Error(t.replace(/%s/g,(function(){return d[c++]})))).name="Invariant Violation"}throw u.framesToPop=1,u}}var l="mixins";e.exports=function(e,t,n){var i=[],a={mixins:"DEFINE_MANY",statics:"DEFINE_MANY",propTypes:"DEFINE_MANY",contextTypes:"DEFINE_MANY",childContextTypes:"DEFINE_MANY",getDefaultProps:"DEFINE_MANY_MERGED",getInitialState:"DEFINE_MANY_MERGED",getChildContext:"DEFINE_MANY_MERGED",render:"DEFINE_ONCE",componentWillMount:"DEFINE_MANY",componentDidMount:"DEFINE_MANY",componentWillReceiveProps:"DEFINE_MANY",shouldComponentUpdate:"DEFINE_ONCE",componentWillUpdate:"DEFINE_MANY",componentDidUpdate:"DEFINE_MANY",componentWillUnmount:"DEFINE_MANY",UNSAFE_componentWillMount:"DEFINE_MANY",UNSAFE_componentWillReceiveProps:"DEFINE_MANY",UNSAFE_componentWillUpdate:"DEFINE_MANY",updateComponent:"OVERRIDE_BASE"},u={getDerivedStateFromProps:"DEFINE_MANY_MERGED"},d={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var n=0;n>>2]>>>24-i%4*8&255;t[r+i>>>2]|=s<<24-(r+i)%4*8}else for(var l=0;l>>2]=n[l>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new u.init(n,t/2)}},p=d.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new u.init(n,t)}},f=d.Utf8={stringify:function(e){try{return decodeURIComponent(escape(p.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return p.parse(unescape(encodeURIComponent(e)))}},h=l.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,r=this._data,o=r.words,i=r.sigBytes,s=this.blockSize,l=i/(4*s),a=(l=t?e.ceil(l):e.max((0|l)-this._minBufferSize,0))*s,d=e.min(4*a,i);if(a){for(var c=0;c>>24)|4278255360&(o<<24|o>>>8)}var i=this._hash.words,s=e[t+0],a=e[t+1],f=e[t+2],h=e[t+3],m=e[t+4],g=e[t+5],y=e[t+6],v=e[t+7],b=e[t+8],_=e[t+9],E=e[t+10],C=e[t+11],S=e[t+12],w=e[t+13],F=e[t+14],I=e[t+15],O=i[0],A=i[1],x=i[2],D=i[3];O=u(O,A,x,D,s,7,l[0]),D=u(D,O,A,x,a,12,l[1]),x=u(x,D,O,A,f,17,l[2]),A=u(A,x,D,O,h,22,l[3]),O=u(O,A,x,D,m,7,l[4]),D=u(D,O,A,x,g,12,l[5]),x=u(x,D,O,A,y,17,l[6]),A=u(A,x,D,O,v,22,l[7]),O=u(O,A,x,D,b,7,l[8]),D=u(D,O,A,x,_,12,l[9]),x=u(x,D,O,A,E,17,l[10]),A=u(A,x,D,O,C,22,l[11]),O=u(O,A,x,D,S,7,l[12]),D=u(D,O,A,x,w,12,l[13]),x=u(x,D,O,A,F,17,l[14]),O=d(O,A=u(A,x,D,O,I,22,l[15]),x,D,a,5,l[16]),D=d(D,O,A,x,y,9,l[17]),x=d(x,D,O,A,C,14,l[18]),A=d(A,x,D,O,s,20,l[19]),O=d(O,A,x,D,g,5,l[20]),D=d(D,O,A,x,E,9,l[21]),x=d(x,D,O,A,I,14,l[22]),A=d(A,x,D,O,m,20,l[23]),O=d(O,A,x,D,_,5,l[24]),D=d(D,O,A,x,F,9,l[25]),x=d(x,D,O,A,h,14,l[26]),A=d(A,x,D,O,b,20,l[27]),O=d(O,A,x,D,w,5,l[28]),D=d(D,O,A,x,f,9,l[29]),x=d(x,D,O,A,v,14,l[30]),O=c(O,A=d(A,x,D,O,S,20,l[31]),x,D,g,4,l[32]),D=c(D,O,A,x,b,11,l[33]),x=c(x,D,O,A,C,16,l[34]),A=c(A,x,D,O,F,23,l[35]),O=c(O,A,x,D,a,4,l[36]),D=c(D,O,A,x,m,11,l[37]),x=c(x,D,O,A,v,16,l[38]),A=c(A,x,D,O,E,23,l[39]),O=c(O,A,x,D,w,4,l[40]),D=c(D,O,A,x,s,11,l[41]),x=c(x,D,O,A,h,16,l[42]),A=c(A,x,D,O,y,23,l[43]),O=c(O,A,x,D,_,4,l[44]),D=c(D,O,A,x,S,11,l[45]),x=c(x,D,O,A,I,16,l[46]),O=p(O,A=c(A,x,D,O,f,23,l[47]),x,D,s,6,l[48]),D=p(D,O,A,x,v,10,l[49]),x=p(x,D,O,A,F,15,l[50]),A=p(A,x,D,O,g,21,l[51]),O=p(O,A,x,D,S,6,l[52]),D=p(D,O,A,x,h,10,l[53]),x=p(x,D,O,A,E,15,l[54]),A=p(A,x,D,O,a,21,l[55]),O=p(O,A,x,D,b,6,l[56]),D=p(D,O,A,x,I,10,l[57]),x=p(x,D,O,A,y,15,l[58]),A=p(A,x,D,O,w,21,l[59]),O=p(O,A,x,D,m,6,l[60]),D=p(D,O,A,x,C,10,l[61]),x=p(x,D,O,A,f,15,l[62]),A=p(A,x,D,O,_,21,l[63]),i[0]=i[0]+O|0,i[1]=i[1]+A|0,i[2]=i[2]+x|0,i[3]=i[3]+D|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,o=8*t.sigBytes;n[o>>>5]|=128<<24-o%32;var i=e.floor(r/4294967296),s=r;n[15+(o+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),n[14+(o+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),t.sigBytes=4*(n.length+1),this._process();for(var l=this._hash,a=l.words,u=0;u<4;u++){var d=a[u];a[u]=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8)}return l},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,n,r,o,i,s){var l=e+(t&n|~t&r)+o+s;return(l<>>32-i)+t}function d(e,t,n,r,o,i,s){var l=e+(t&r|n&~r)+o+s;return(l<>>32-i)+t}function c(e,t,n,r,o,i,s){var l=e+(t^n^r)+o+s;return(l<>>32-i)+t}function p(e,t,n,r,o,i,s){var l=e+(n^(t|~r))+o+s;return(l<>>32-i)+t}t.MD5=i._createHelper(a),t.HmacMD5=i._createHmacHelper(a)}(Math),r.MD5)},4639:function(e,t,n){var r=n(4333),o=n(4160);void 0===o.InsertEmbedModal&&(o.InsertEmbedModal=r),e.exports=r},6166:function(e,t,n){var r=n(6931),o=n(4160);void 0===o.InsertMediaModal&&(o.InsertMediaModal=r),e.exports=r},4160:function(e,t,n){"use strict";e.exports=function(){if("object"==typeof globalThis)return globalThis;var e;try{e=this||new Function("return this")()}catch(e){if("object"==typeof window)return window;if("object"==typeof self)return self;if(void 0!==n.g)return n.g}return e}()},493:function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n0}},{key:"getMetadataColumnProperty",value:function(e,t,n){var r=this.getColumnMetadataByName(e);return null==r?n:r.hasOwnProperty(t)?r[t]:n}},{key:"orderColumns",value:function(e){var t=this;return l(e,(function(e){var n=s(t.columnMetadata,{columnName:e});return null==n||isNaN(n.order)?100:n.order}))}},{key:"getColumns",value:function(){var e=0===this.filteredColumns.length?this.allColumns:this.filteredColumns;return e=a(e,this.metadataColumns),e=this.orderColumns(e)}}]),e}();e.exports=u},3715:function(e,t,n){"use strict";var r=n(1594),o=n(2306)({getDefaultProps:function(){return{placeholderText:""}},render:function(){return"function"!=typeof this.props.customFilterComponent?(console.log("Couldn't find valid template."),r.createElement("div",null)):r.createElement(this.props.customFilterComponent,{changeFilter:this.props.changeFilter,results:this.props.results,currentResults:this.props.currentResults,placeholderText:this.props.placeholderText})}});e.exports=o},8465:function(e,t,n){"use strict";var r=Object.assign||function(e){for(var t=1;t0&&(e=r.createElement("button",{type:"button",onClick:this.props.previous,style:this.props.useGriddleStyles?{color:"#222",border:"none",background:"none",margin:"0 0 0 10px"}:null},this.props.previousIconComponent,this.props.previousText)),this.props.currentPage!==this.props.maxPage-1&&(t=r.createElement("button",{type:"button",onClick:this.props.next,style:this.props.useGriddleStyles?{color:"#222",border:"none",background:"none",margin:"0 10px 0 0"}:null},this.props.nextText,this.props.nextIconComponent));var n=null,o=null,s=null;if(!0===this.props.useGriddleStyles){var l={float:"left",minHeight:"1px",marginTop:"5px"};s=i({textAlign:"right",width:"34%"},l),o=i({textAlign:"center",width:"33%"},l),n=i({width:"33%"},l)}for(var a=[],u=1;u<=this.props.maxPage;u++)a.push(r.createElement("option",{value:u,key:u},u));return r.createElement("div",{style:this.props.useGriddleStyles?{minHeight:"35px"}:null},r.createElement("div",{className:this.props.previousClassName,style:n},e),r.createElement("div",{className:"griddle-page",style:o},r.createElement("select",{value:this.props.currentPage+1,onChange:this.pageChange},a)," / ",this.props.maxPage),r.createElement("div",{className:this.props.nextClassName,style:s},t))}});e.exports=s},1507:function(e,t,n){"use strict";var r=n(1594),o=n(2306),i=(n(493),n(9280)),s=n(1882),l=n(7248),a=n(6139),u=n(4684),d=n(8938),c=n(1648),p=o({getDefaultProps:function(){return{isChildRow:!1,showChildren:!1,data:{},columnSettings:null,rowSettings:null,hasChildren:!1,useGriddleStyles:!0,useGriddleIcons:!0,isSubGriddle:!1,paddingHeight:null,rowHeight:null,parentRowCollapsedClassName:"parent-row",parentRowExpandedClassName:"parent-row expanded",parentRowCollapsedComponent:"â–¶",parentRowExpandedComponent:"â–¼",onRowClick:null,multipleSelectionSettings:null,onRowMouseEnter:null,onRowMouseLeave:null,onRowWillMount:null,onRowWillUnmount:null}},componentWillMount:function(){null!==this.props.onRowWillMount&&s(this.props.onRowWillMount)&&this.props.onRowWillMount(this)},componentWillUnmount:function(){null!==this.props.onRowWillUnmount&&s(this.props.onRowWillUnmount)&&this.props.onRowWillUnmount(this)},handleClick:function(e){null!==this.props.onRowClick&&s(this.props.onRowClick)?this.props.onRowClick(this,e):this.props.hasChildren&&this.props.toggleChildren()},handleMouseEnter:function(e){null!==this.props.onRowMouseEnter&&s(this.props.onRowMouseEnter)&&this.props.onRowMouseEnter(this,e)},handleMouseLeave:function(e){null!==this.props.onRowMouseLeave&&s(this.props.onRowMouseLeave)&&this.props.onRowMouseLeave(this,e)},handleSelectionChange:function(e){},handleSelectClick:function(e){this.props.multipleSelectionSettings.isMultipleSelection&&("checkbox"===e.target.type?this.props.multipleSelectionSettings.toggleSelectRow(this.props.data,this.refs.selected.checked):this.props.multipleSelectionSettings.toggleSelectRow(this.props.data,!this.refs.selected.checked))},verifyProps:function(){null===this.props.columnSettings&&console.error("gridRow: The columnSettings prop is null and it shouldn't be")},formatData:function(e){return"boolean"==typeof e?String(e):e},render:function(){var e=this;this.verifyProps();var t=this,n=null;this.props.useGriddleStyles&&(n={margin:"0px",padding:t.props.paddingHeight+"px 5px "+t.props.paddingHeight+"px 5px",height:t.props.rowHeight?this.props.rowHeight-2*t.props.paddingHeight+"px":null,backgroundColor:"#FFF",borderTopColor:"#DDD",color:"#222"});var o=this.props.columnSettings.getColumns(),p=l(o,[]),f=a({},this.props.data);u(f,p);var h,m,g=d(i.pick(f,c(o,"children"))).map((function(t,o){var i=null,s=e.props.columnSettings.getColumnMetadataByName(t[0]),l=0===o&&e.props.hasChildren&&!1===e.props.showChildren&&e.props.useGriddleIcons?r.createElement("span",{style:e.props.useGriddleStyles?{fontSize:"10px",marginRight:"5px"}:null},e.props.parentRowCollapsedComponent):0===o&&e.props.hasChildren&&e.props.showChildren&&e.props.useGriddleIcons?r.createElement("span",{style:e.props.useGriddleStyles?{fontSize:"10px"}:null},e.props.parentRowExpandedComponent):"";if(0===o&&e.props.isChildRow&&e.props.useGriddleStyles&&(n=a(n,{paddingLeft:10})),e.props.columnSettings.hasColumnMetadata()&&null!=s)if(void 0!==s.customComponent&&null!==s.customComponent){var u=r.createElement(s.customComponent,{data:t[1],rowData:f,metadata:s});i=r.createElement("td",{onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,onMouseLeave:e.handleMouseLeave,className:s.cssClassName,key:o,style:n},u)}else i=r.createElement("td",{onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,onMouseLeave:e.handleMouseLeave,className:s.cssClassName,key:o,style:n},l,e.formatData(t[1]));return i||r.createElement("td",{onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,onMouseLeave:e.handleMouseLeave,key:o,style:n},l,t[1])}));if(null!==this.props.onRowClick&&s(this.props.onRowClick)?(h=null,m=this.handleSelectClick):this.props.multipleSelectionSettings&&this.props.multipleSelectionSettings.isMultipleSelection?(h=this.handleSelectClick,m=null):(h=null,m=null),g&&this.props.multipleSelectionSettings&&this.props.multipleSelectionSettings.isMultipleSelection){this.props.multipleSelectionSettings.getSelectedRowIds();g.unshift(r.createElement("td",{key:"selection",style:n,className:"griddle-select griddle-select-cell",onClick:m},r.createElement("input",{type:"checkbox",checked:this.props.multipleSelectionSettings.getIsRowChecked(f),onChange:this.handleSelectionChange,ref:"selected"})))}var y=t.props.rowSettings&&t.props.rowSettings.getBodyRowMetadataClass(t.props.data)||"standard-row";return t.props.isChildRow?y="child-row":t.props.hasChildren&&(y=t.props.showChildren?this.props.parentRowExpandedClassName:this.props.parentRowCollapsedClassName),r.createElement("tr",{onClick:h,className:y},g)}});e.exports=p},4734:function(e,t,n){"use strict";var r=n(1594),o=n(2306),i=(n(493),n(4383)),s=o({getDefaultProps:function(){return{useGriddleStyles:!0,useGriddleIcons:!0,isSubGriddle:!1,columnSettings:null,rowSettings:null,paddingHeight:null,rowHeight:null,parentRowCollapsedClassName:"parent-row",parentRowExpandedClassName:"parent-row expanded",parentRowCollapsedComponent:"â–¶",parentRowExpandedComponent:"â–¼",onRowClick:null,onRowMouseEnter:null,onRowMouseLeave:null,onRowWillMount:null,onRowWillUnmount:null,multipleSelectionSettings:null}},getInitialState:function(){return{data:{},showChildren:!1}},componentWillReceiveProps:function(){this.setShowChildren(!1)},toggleChildren:function(){this.setShowChildren(!1===this.state.showChildren)},setShowChildren:function(e){this.setState({showChildren:e})},verifyProps:function(){null===this.props.columnSettings&&console.error("gridRowContainer: The columnSettings prop is null and it shouldn't be")},render:function(){this.verifyProps();var e=this;if(void 0===this.props.data)return r.createElement("tbody",null);var t=[],n=this.props.columnSettings.getColumns();t.push(r.createElement(this.props.rowSettings.rowComponent,{useGriddleStyles:this.props.useGriddleStyles,isSubGriddle:this.props.isSubGriddle,data:this.props.rowSettings.isCustom?i(this.props.data,n):this.props.data,rowData:this.props.rowSettings.isCustom?this.props.data:null,columnSettings:this.props.columnSettings,rowSettings:this.props.rowSettings,hasChildren:e.props.hasChildren,toggleChildren:e.toggleChildren,showChildren:e.state.showChildren,key:e.props.uniqueId+"_base_row",useGriddleIcons:e.props.useGriddleIcons,parentRowExpandedClassName:this.props.parentRowExpandedClassName,parentRowCollapsedClassName:this.props.parentRowCollapsedClassName,parentRowExpandedComponent:this.props.parentRowExpandedComponent,parentRowCollapsedComponent:this.props.parentRowCollapsedComponent,paddingHeight:e.props.paddingHeight,rowHeight:e.props.rowHeight,onRowClick:e.props.onRowClick,onRowMouseEnter:e.props.onRowMouseEnter,onRowMouseLeave:e.props.onRowMouseLeave,multipleSelectionSettings:this.props.multipleSelectionSettings,onRowWillMount:e.props.onRowWillMount,onRowWillUnmount:e.props.onRowWillUnmount}));var o=null;return e.state.showChildren&&(o=e.props.hasChildren&&this.props.data.children.map((function(t,n){var o=e.props.rowSettings.getRowKey(t,n);if(void 0!==t.children){var i=e.constructor.Griddle;return r.createElement("tr",{key:o,style:{paddingLeft:5}},r.createElement("td",{colSpan:e.props.columnSettings.getVisibleColumnCount(),className:"griddle-parent",style:e.props.useGriddleStyles?{border:"none",padding:"0 0 0 5px"}:null},r.createElement(i,{rowMetadata:{key:"id"},isSubGriddle:!0,results:[t],columns:e.props.columnSettings.getColumns(),tableClassName:e.props.tableClassName,parentRowExpandedClassName:e.props.parentRowExpandedClassName,parentRowCollapsedClassName:e.props.parentRowCollapsedClassName,showTableHeading:!1,showPager:!1,columnMetadata:e.props.columnSettings.columnMetadata,parentRowExpandedComponent:e.props.parentRowExpandedComponent,parentRowCollapsedComponent:e.props.parentRowCollapsedComponent,paddingHeight:e.props.paddingHeight,rowHeight:e.props.rowHeight})))}return r.createElement(e.props.rowSettings.rowComponent,{useGriddleStyles:e.props.useGriddleStyles,isSubGriddle:e.props.isSubGriddle,data:t,columnSettings:e.props.columnSettings,isChildRow:!0,columnMetadata:e.props.columnSettings.columnMetadata,key:o})}))),!1===e.props.hasChildren?t[0]:r.createElement("tbody",null,e.state.showChildren?t.concat(o):t)}});e.exports=s},4376:function(e,t,n){"use strict";var r=n(1594),o=n(2306),i=n(9859),s=n(1648),l=n(7309),a=o({getDefaultProps:function(){return{columns:[],columnMetadata:[],selectedColumns:[],settingsText:"",maxRowsText:"",resultsPerPage:0,enableToggleCustom:!1,useCustomComponent:!1,useGriddleStyles:!0,toggleCustomComponent:function(){}}},setPageSize:function(e){var t=parseInt(e.target.value,10);this.props.setPageSize(t)},handleChange:function(e){var t=e.target.dataset?e.target.dataset.name:e.target.getAttribute("data-name");!0===e.target.checked&&!1===i(this.props.selectedColumns,t)?(this.props.selectedColumns.push(t),this.props.setColumns(this.props.selectedColumns)):this.props.setColumns(s(this.props.selectedColumns,t))},render:function(){var e=this,t=[];!1===e.props.useCustomComponent&&(t=this.props.columns.map((function(t,n){var o=i(e.props.selectedColumns,t),s=l(e.props.columnMetadata,{columnName:t}),a=t;return void 0!==s&&void 0!==s.displayName&&null!=s.displayName&&(a=s.displayName),void 0!==s&&null!=s&&s.locked?r.createElement("div",{className:"column checkbox"},r.createElement("label",null,r.createElement("input",{type:"checkbox",disabled:!0,name:"check",checked:o,"data-name":t}),a)):void 0!==s&&null!=s&&void 0!==s.visible&&!1===s.visible?null:r.createElement("div",{className:"griddle-column-selection checkbox",key:t,style:e.props.useGriddleStyles?{float:"left",width:"20%"}:null},r.createElement("label",null,r.createElement("input",{type:"checkbox",name:"check",onChange:e.handleChange,checked:o,"data-name":t}),a))})));var n=e.props.enableToggleCustom?r.createElement("div",{className:"form-group"},r.createElement("label",{htmlFor:"maxRows"},r.createElement("input",{type:"checkbox",checked:this.props.useCustomComponent,onChange:this.props.toggleCustomComponent})," ",this.props.enableCustomFormatText)):"",o=this.props.showSetPageSize?r.createElement("div",null,r.createElement("label",{htmlFor:"maxRows"},this.props.maxRowsText,":",r.createElement("select",{onChange:this.setPageSize,value:this.props.resultsPerPage},r.createElement("option",{value:"5"},"5"),r.createElement("option",{value:"10"},"10"),r.createElement("option",{value:"25"},"25"),r.createElement("option",{value:"50"},"50"),r.createElement("option",{value:"100"},"100")))):"";return r.createElement("div",{className:"griddle-settings",style:this.props.useGriddleStyles?{backgroundColor:"#FFF",border:"1px solid #DDD",color:"#222",padding:"10px",marginBottom:"10px"}:null},r.createElement("h6",null,this.props.settingsText),r.createElement("div",{className:"griddle-columns",style:this.props.useGriddleStyles?{clear:"both",display:"table",width:"100%",borderBottom:"1px solid #EDEDED",marginBottom:"10px"}:null},t),o,n)}});e.exports=a},2991:function(e,t,n){"use strict";var r=n(1594),o=n(2306),i=n(9593),s=n(4734),l=(n(493),n(1545),o({getDefaultProps:function(){return{data:[],columnSettings:null,rowSettings:null,sortSettings:null,multipleSelectionSettings:null,className:"",enableInfiniteScroll:!1,nextPage:null,hasMorePages:!1,useFixedHeader:!1,useFixedLayout:!0,paddingHeight:null,rowHeight:null,filterByColumn:null,infiniteScrollLoadTreshold:null,bodyHeight:null,useGriddleStyles:!0,useGriddleIcons:!0,isSubGriddle:!1,parentRowCollapsedClassName:"parent-row",parentRowExpandedClassName:"parent-row expanded",parentRowCollapsedComponent:"â–¶",parentRowExpandedComponent:"â–¼",externalLoadingComponent:null,externalIsLoading:!1,onRowClick:null,onRowMouseEnter:null,onRowMouseLeave:null,onRowWillMount:null,onRowWillUnmount:null}},getInitialState:function(){return{scrollTop:0,scrollHeight:this.props.bodyHeight,clientHeight:this.props.bodyHeight}},componentDidMount:function(){this.gridScroll()},componentDidUpdate:function(e,t){this.gridScroll()},gridScroll:function(){if(this.props.enableInfiniteScroll&&!this.props.externalIsLoading){var e=this.refs.scrollable,t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;if(null!==this.props.rowHeight&&this.state.scrollTop!==t&&Math.abs(this.state.scrollTop-t)>=this.getAdjustedRowHeight()){var o={scrollTop:t,scrollHeight:n,clientHeight:r};this.setState(o)}.6*(n-(t+r)-this.props.infiniteScrollLoadTreshold)<=this.props.infiniteScrollLoadTreshold&&this.props.nextPage()}},verifyProps:function(){null===this.props.columnSettings&&console.error("gridTable: The columnSettings prop is null and it shouldn't be"),null===this.props.rowSettings&&console.error("gridTable: The rowSettings prop is null and it shouldn't be")},getAdjustedRowHeight:function(){return this.props.rowHeight+2*this.props.paddingHeight},getNodeContent:function(){this.verifyProps();var e=this,t=!1;if(!this.props.externalIsLoading||this.props.enableInfiniteScroll){var n=e.props.data,o=null,i=null;if(this.props.enableInfiniteScroll&&null!==this.props.rowHeight&&void 0!==this.refs.scrollable){var l=e.getAdjustedRowHeight(),a=Math.ceil(e.state.clientHeight/l),u=Math.max(0,Math.floor(e.state.scrollTop/l)-.25*a),d=Math.min(u+1.25*a,this.props.data.length-1);n=n.slice(u,d+1);var c={height:u*l+"px"};o=r.createElement("tr",{key:"above-"+c.height,style:c});var p={height:(this.props.data.length-d)*l+"px"};i=r.createElement("tr",{key:"below-"+p.height,style:p})}var f=n.map((function(n,o){var i=void 0!==n.children&&n.children.length>0,l=e.props.rowSettings.getRowKey(n,o);return i&&(t=i),r.createElement(s,{useGriddleStyles:e.props.useGriddleStyles,isSubGriddle:e.props.isSubGriddle,parentRowExpandedClassName:e.props.parentRowExpandedClassName,parentRowCollapsedClassName:e.props.parentRowCollapsedClassName,parentRowExpandedComponent:e.props.parentRowExpandedComponent,parentRowCollapsedComponent:e.props.parentRowCollapsedComponent,data:n,key:l+"-container",uniqueId:l,columnSettings:e.props.columnSettings,rowSettings:e.props.rowSettings,paddingHeight:e.props.paddingHeight,multipleSelectionSettings:e.props.multipleSelectionSettings,rowHeight:e.props.rowHeight,hasChildren:i,tableClassName:e.props.className,onRowClick:e.props.onRowClick,onRowMouseEnter:e.props.onRowMouseEnter,onRowMouseLeave:e.props.onRowMouseLeave,onRowWillMount:e.props.onRowWillMount,onRowWillUnmount:e.props.onRowWillUnmount})}));if(this.props.showNoData){var h=this.props.columnSettings.getVisibleColumnCount();f.push(r.createElement("tr",{key:"no-data-section"},r.createElement("td",{colSpan:h},this.props.noDataSection)))}return o&&f.unshift(o),i&&f.push(i),{nodes:f,anyHasChildren:t}}return null},render:function(){var e=[],t=!1,n=this.getNodeContent();n&&(e=n.nodes,t=n.anyHasChildren);var o=null,s=null,l={width:"100%"};if(this.props.useFixedLayout&&(l.tableLayout="fixed"),this.props.enableInfiniteScroll&&(o={position:"relative",overflowY:"scroll",height:this.props.bodyHeight+"px",width:"100%"}),this.props.externalIsLoading){var a,u=null;this.props.useGriddleStyles&&(u={textAlign:"center",paddingBottom:"40px"}),a=this.props.columnSettings.getVisibleColumnCount();var d=this.props.externalLoadingComponent?r.createElement(this.props.externalLoadingComponent,null):r.createElement("div",null,"Loading...");s=r.createElement("tbody",null,r.createElement("tr",null,r.createElement("td",{style:u,colSpan:a},d)))}var c=this.props.showTableHeading?r.createElement(i,{useGriddleStyles:this.props.useGriddleStyles,useGriddleIcons:this.props.useGriddleIcons,sortSettings:this.props.sortSettings,multipleSelectionSettings:this.props.multipleSelectionSettings,columnSettings:this.props.columnSettings,filterByColumn:this.props.filterByColumn,rowSettings:this.props.rowSettings}):void 0;t||(e=r.createElement("tbody",null,e));var p=r.createElement("tbody",null);if(this.props.showPager){var f=this.props.useGriddleStyles?{padding:"0px",backgroundColor:"#EDEDED",border:"0px",color:"#222",height:this.props.showNoData?"20px":null}:null;p=r.createElement("tbody",null,r.createElement("tr",null,r.createElement("td",{colSpan:this.props.multipleSelectionSettings.isMultipleSelection?this.props.columnSettings.getVisibleColumnCount()+1:this.props.columnSettings.getVisibleColumnCount(),style:f,className:"footer-container"},this.props.showNoData?null:this.props.pagingContent)))}return this.props.useFixedHeader?(this.props.useGriddleStyles&&(l.tableLayout="fixed"),r.createElement("div",null,r.createElement("table",{className:this.props.className,style:this.props.useGriddleStyles&&l||null},c),r.createElement("div",{ref:"scrollable",onScroll:this.gridScroll,style:o},r.createElement("table",{className:this.props.className,style:this.props.useGriddleStyles&&l||null},e,s,p)))):r.createElement("div",{ref:"scrollable",onScroll:this.gridScroll,style:o},r.createElement("table",{className:this.props.className,style:this.props.useGriddleStyles&&l||null},c,e,s,p))}}));e.exports=l},9593:function(e,t,n){"use strict";var r=Object.assign||function(e){for(var t=1;t=0)return!0}return!1}))},defaultColumnFilter:function(e,t,n){var r=M(O(n)?n:[n],(function(e){return(e||"").toLowerCase()}));return U(b.getObjectValues(t),(function(e){return e=e.toString().toLowerCase(),U(r,(function(t){return e.indexOf(t)>=0}))}))},filterByColumnFilters:function(e){var t=this.props.columnFilterFunc||this.defaultColumnFilter,n=Object.keys(e).reduce((function(n,r){return T(n,(function(n){var o=b.getAt(n,r||""),i=e[r];return t(r||"",o,i)}))}),this.props.results),r={columnFilters:e};e?(r.filteredResults=n,r.maxPage=this.getMaxPage(r.filteredResults)):this.state.filter?r.filteredResults=this.props.useCustomFilterer?this.props.customFilterer(this.props.results,filter):this.defaultFilter(this.props.results,filter):r.filteredResults=null,this.setState(r)},filterByColumn:function(e,t){var n=this.state.columnFilters;if(n.hasOwnProperty(t)&&!e)n=P(n,t);else{var r={};r[t]=e,n=R({},n,r)}this.filterByColumnFilters(n)},setFilter:function(e){var t=arguments.length<=1||void 0===arguments[1]?null:arguments[1];if(this.props.useExternal)this.props.externalSetFilter(e);else{var n={page:0,filter:e};n.filteredResults=this.props.useCustomFilterer?this.props.customFilterer(t||this.props.results,e):this.defaultFilter(t||this.props.results,e),n.maxPage=this.getMaxPage(n.filteredResults),(D(e)||x(e)||A(e))&&(n.filter=e,n.filteredResults=null),this.setState(n),this._resetSelectedRows()}},setPageSize:function(e){if(this.props.useExternal)return this.setState({resultsPerPage:e}),void this.props.externalSetPageSize(e);this.state.resultsPerPage=e,this.setMaxPage()},toggleColumnChooser:function(){this.setState({showColumnChooser:!this.state.showColumnChooser})},isNullOrUndefined:function(e){return null==e},shouldUseCustomRowComponent:function(){return this.isNullOrUndefined(this.state.useCustomRowComponent)?this.props.useCustomRowComponent:this.state.useCustomRowComponent},shouldUseCustomGridComponent:function(){return this.isNullOrUndefined(this.state.useCustomGridComponent)?this.props.useCustomGridComponent:this.state.useCustomGridComponent},toggleCustomComponent:function(){"grid"===this.state.customComponentType?this.setState({useCustomGridComponent:!this.shouldUseCustomGridComponent()}):"row"===this.state.customComponentType&&this.setState({useCustomRowComponent:!this.shouldUseCustomRowComponent()})},getMaxPage:function(e,t){return this.props.useExternal?this.props.externalMaxPage:(t||(t=(e||this.getCurrentResults()).length),Math.ceil(t/this.state.resultsPerPage))},setMaxPage:function(e){var t=this.getMaxPage(e);this.state.maxPage!==t&&this.setState({page:0,maxPage:t,filteredColumns:this.columnSettings.filteredColumns})},setPage:function(e){if(this.props.useExternal)this.props.externalSetPage(e);else{if(e*this.state.resultsPerPage<=this.state.resultsPerPage*this.state.maxPage){var t={page:e};this.setState(t)}this.props.enableInfiniteScroll&&this.setState({isSelectAllChecked:!1})}},setColumns:function(e){this.columnSettings.filteredColumns=O(e)?e:[e],this.setState({filteredColumns:this.columnSettings.filteredColumns})},nextPage:function(){var e=this.getCurrentPage();e0&&this.setPage(e-1)},changeSort:function(e){if(!1!==this.props.enableSort){if(this.props.useExternal){var t=this.props.externalSortColumn!==e||!this.props.externalSortAscending;return this.setState({sortColumn:e,sortDirection:t?"asc":"desc"}),void this.props.externalChangeSort(e,t)}var n=C(this.props.columnMetadata,{columnName:e})||{},r=n.sortDirectionCycle?n.sortDirectionCycle:[null,"asc","desc"],o=r.indexOf(this.state.sortDirection&&e===this.state.sortColumn?this.state.sortDirection:null),i={page:0,sortColumn:e,sortDirection:r[o=(o+1)%r.length]?r[o]:null};this.setState(i)}},componentWillReceiveProps:function(e){if(e.results!==this.props.results&&this.setFilter(this.state.filter,e.results),this.setMaxPage(e.results),e.resultsPerPage!==this.props.resultsPerPage&&this.setPageSize(e.resultsPerPage),this.columnSettings.columnMetadata=e.columnMetadata,e.results.length>0){var t=b.keys(e.results[0]);this.columnSettings.allColumns.length==t.length&&this.columnSettings.allColumns.every((function(e,n){return e===t[n]}))||(this.columnSettings.allColumns=t)}else this.columnSettings.allColumns.length>0&&(this.columnSettings.allColumns=[]);if(e.selectedRowIds){var n=this.getDataForRender(this.getCurrentResults(e.results),this.columnSettings.getColumns(),!0);this.setState({isSelectAllChecked:this._getAreAllRowsChecked(e.selectedRowIds,M(n,this.props.uniqueIdentifier)),selectedRowIds:e.selectedRowIds})}},getInitialState:function(){return{maxPage:0,page:0,filteredResults:null,filteredColumns:[],filter:"",columnFilters:{},resultsPerPage:this.props.resultsPerPage||5,showColumnChooser:!1,isSelectAllChecked:!1,selectedRowIds:this.props.selectedRowIds}},componentWillMount:function(){this.verifyExternal(),this.verifyCustom(),this.columnSettings=new y(this.props.results.length>0?b.keys(this.props.results[0]):[],this.props.columns,this.props.childrenColumnName,this.props.columnMetadata,this.props.metadataColumns),this.rowSettings=new v(this.props.rowMetadata,this.props.useCustomTableRowComponent&&this.props.customTableRowComponent?this.props.customTableRowComponent:p,this.props.useCustomTableRowComponent),this.props.initialSort&&(this.props.useExternal?this.setState({sortColumn:this.props.externalSortColumn,sortDirection:this.props.externalSortAscending?"asc":"desc"}):this.changeSort(this.props.initialSort)),this.setMaxPage(),this.shouldUseCustomGridComponent()?this.setState({customComponentType:"grid"}):this.shouldUseCustomRowComponent()?this.setState({customComponentType:"row"}):this.setState({filteredColumns:this.columnSettings.filteredColumns})},componentDidMount:function(){if(this.props.componentDidMount&&"function"==typeof this.props.componentDidMount)return this.props.componentDidMount()},componentDidUpdate:function(){if(this.props.componentDidUpdate&&"function"==typeof this.props.componentDidUpdate)return this.props.componentDidUpdate(this.state)},verifyExternal:function(){!0===this.props.useExternal&&(null===this.props.externalSetPage&&console.error("useExternal is set to true but there is no externalSetPage function specified."),null===this.props.externalChangeSort&&console.error("useExternal is set to true but there is no externalChangeSort function specified."),null===this.props.externalSetFilter&&console.error("useExternal is set to true but there is no externalSetFilter function specified."),null===this.props.externalSetPageSize&&console.error("useExternal is set to true but there is no externalSetPageSize function specified."),null===this.props.externalMaxPage&&console.error("useExternal is set to true but externalMaxPage is not set."),null===this.props.externalCurrentPage&&console.error("useExternal is set to true but externalCurrentPage is not set. Griddle will not page correctly without that property when using external data."))},verifyCustom:function(){!0===this.props.useCustomGridComponent&&null===this.props.customGridComponent&&console.error("useCustomGridComponent is set to true but no custom component was specified."),!0===this.props.useCustomRowComponent&&null===this.props.customRowComponent&&console.error("useCustomRowComponent is set to true but no custom component was specified."),!0===this.props.useCustomGridComponent&&!0===this.props.useCustomRowComponent&&console.error("Cannot currently use both customGridComponent and customRowComponent."),!0===this.props.useCustomFilterer&&null===this.props.customFilterer&&console.error("useCustomFilterer is set to true but no custom filter function was specified."),!0===this.props.useCustomFilterComponent&&null===this.props.customFilterComponent&&console.error("useCustomFilterComponent is set to true but no customFilterComponent was specified.")},getDataForRender:function(e,t,n){var r=this,o=this;if(!this.props.useExternal){if(""!==this.state.sortColumn){var i,s=this.state.sortColumn,l=T(this.props.columnMetadata,{columnName:s}),a={columns:[],orders:[]};if(l.length>0&&(i=l[0].hasOwnProperty("customCompareFn")&&l[0].customCompareFn,l[0].multiSort&&(a=l[0].multiSort)),this.state.sortDirection)if("function"==typeof i)2===i.length?(e=e.sort((function(e,t){return i(L(e,s),L(t,s))})),"desc"===this.state.sortDirection&&e.reverse()):1===i.length&&(e=N(e,(function(e){return i(L(e,s))}),[this.state.sortDirection]));else{var u=[function(e){return(L(e,s)||"").toString().toLowerCase()}],d=[this.state.sortDirection];a.columns.forEach((function(e,t){u.push((function(t){return(L(t,e)||"").toString().toLowerCase()})),"asc"===a.orders[t]||"desc"===a.orders[t]?d.push(a.orders[t]):d.push(r.state.sortDirection)})),e=N(e,u,d)}}var c=this.getCurrentPage();if(!this.props.useExternal&&n&&this.state.resultsPerPage*(c+1)<=this.state.resultsPerPage*this.state.maxPage&&c>=0)if(this.isInfiniteScrollEnabled())e=S(e,(c+1)*this.state.resultsPerPage);else{var p=_(e,c*this.state.resultsPerPage);e=(E||F)(p,p.length-this.state.resultsPerPage)}}for(var f=[],h=0;h0&&(m.children=o.getDataForRender(m[o.props.childrenColumnName],t,!1),"children"!==o.props.childrenColumnName&&delete m[o.props.childrenColumnName]),f.push(m)}return f},getCurrentResults:function(e){return this.state.filteredResults||e||this.props.results},getCurrentPage:function(){return this.props.externalCurrentPage||this.state.page},getCurrentSort:function(){return this.props.useExternal?this.props.externalSortColumn:this.state.sortColumn},getCurrentSortAscending:function(){return this.props.useExternal?this.props.externalSortAscending:"asc"===this.state.sortDirection},getCurrentMaxPage:function(){return this.props.useExternal?this.props.externalMaxPage:this.state.maxPage},getSortObject:function(){return{enableSort:this.props.enableSort,changeSort:this.changeSort,sortColumn:this.getCurrentSort(),sortAscending:this.getCurrentSortAscending(),sortDirection:this.state.sortDirection,sortAscendingClassName:this.props.sortAscendingClassName,sortDescendingClassName:this.props.sortDescendingClassName,sortAscendingComponent:this.props.sortAscendingComponent,sortDescendingComponent:this.props.sortDescendingComponent,sortDefaultComponent:this.props.sortDefaultComponent}},_toggleSelectAll:function(){var e=this.getDataForRender(this.getCurrentResults(),this.columnSettings.getColumns(),!0),t=!this.state.isSelectAllChecked,n=JSON.parse(JSON.stringify(this.state.selectedRowIds)),r=this;w(e,(function(e){r._updateSelectedRowIds(e[r.props.uniqueIdentifier],n,t)}),this),this.setState({isSelectAllChecked:t,selectedRowIds:n}),this.props.onSelectionChange&&this.props.onSelectionChange(n,t)},_toggleSelectRow:function(e,t){var n=this.getDataForRender(this.getCurrentResults(),this.columnSettings.getColumns(),!0),r=JSON.parse(JSON.stringify(this.state.selectedRowIds));this._updateSelectedRowIds(e[this.props.uniqueIdentifier],r,t);var o=this._getAreAllRowsChecked(r,M(n,this.props.uniqueIdentifier));this.setState({isSelectAllChecked:o,selectedRowIds:r}),this.props.onSelectionChange&&this.props.onSelectionChange(r,o)},_updateSelectedRowIds:function(e,t,n){n?void 0===C(t,(function(t){return e===t}))&&t.push(e):t.splice(t.indexOf(e),1)},_getIsSelectAllChecked:function(){return this.state.isSelectAllChecked},_getAreAllRowsChecked:function(e,t){return t.length===I(t,e).length},_getIsRowChecked:function(e){return this.state.selectedRowIds.indexOf(e[this.props.uniqueIdentifier])>-1},getSelectedRowIds:function(){return this.state.selectedRowIds},_resetSelectedRows:function(){this.setState({isSelectAllChecked:!1,selectedRowIds:[]})},getMultipleSelectionObject:function(){return{isMultipleSelection:!C(this.props.results,(function(e){return"children"in e}))&&this.props.isMultipleSelection,toggleSelectAll:this._toggleSelectAll,getIsSelectAllChecked:this._getIsSelectAllChecked,toggleSelectRow:this._toggleSelectRow,getSelectedRowIds:this.getSelectedRowIds,getIsRowChecked:this._getIsRowChecked}},isInfiniteScrollEnabled:function(){return!this.props.useCustomPagerComponent&&this.props.enableInfiniteScroll},getClearFixStyles:function(){return{clear:"both",display:"table",width:"100%"}},getSettingsStyles:function(){return{float:"left",width:"50%",textAlign:"right"}},getFilterStyles:function(){return{float:"left",width:"50%",textAlign:"left",color:"#222",minHeight:"1px"}},getFilter:function(){return this.props.showFilter&&!1===this.shouldUseCustomGridComponent()?this.props.useCustomFilterComponent?o.createElement(g,{changeFilter:this.setFilter,placeholderText:this.props.filterPlaceholderText,customFilterComponent:this.props.customFilterComponent,results:this.props.results,currentResults:this.getCurrentResults()}):o.createElement(a,{changeFilter:this.setFilter,placeholderText:this.props.filterPlaceholderText}):""},getSettings:function(){return this.props.showSettings?o.createElement("button",{type:"button",className:this.props.settingsToggleClassName,onClick:this.toggleColumnChooser,style:this.props.useGriddleStyles?{background:"none",border:"none",padding:0,margin:0,fontSize:14}:null},this.props.settingsText,this.props.settingsIconComponent):""},getTopSection:function(e,t){if(!1===this.props.showFilter&&!1===this.props.showSettings)return"";var n=null,r=null,i=null;return this.props.useGriddleStyles&&(n=this.getFilterStyles(),r=this.getSettingsStyles(),i=this.getClearFixStyles()),o.createElement("div",{className:"top-section",style:i},o.createElement("div",{className:"griddle-filter",style:n},e),o.createElement("div",{className:"griddle-settings-toggle",style:r},t))},getPagingSection:function(e,t){if(!1!==(this.props.showPager&&!this.isInfiniteScrollEnabled()&&!this.shouldUseCustomGridComponent()))return o.createElement("div",{className:"griddle-footer"},this.props.useCustomPagerComponent?o.createElement(m,{customPagerComponentOptions:this.props.customPagerComponentOptions,next:this.nextPage,previous:this.previousPage,currentPage:e,maxPage:t,setPage:this.setPage,nextText:this.props.nextText,previousText:this.props.previousText,customPagerComponent:this.props.customPagerComponent}):o.createElement(u,{useGriddleStyles:this.props.useGriddleStyles,next:this.nextPage,previous:this.previousPage,nextClassName:this.props.nextClassName,nextIconComponent:this.props.nextIconComponent,previousClassName:this.props.previousClassName,previousIconComponent:this.props.previousIconComponent,currentPage:e,maxPage:t,setPage:this.setPage,nextText:this.props.nextText,previousText:this.props.previousText}))},getColumnSelectorSection:function(e,t){return this.state.showColumnChooser?o.createElement(d,{columns:e,selectedColumns:t,setColumns:this.setColumns,settingsText:this.props.settingsText,settingsIconComponent:this.props.settingsIconComponent,maxRowsText:this.props.maxRowsText,setPageSize:this.setPageSize,showSetPageSize:!this.shouldUseCustomGridComponent(),resultsPerPage:this.state.resultsPerPage,enableToggleCustom:this.props.enableToggleCustom,toggleCustomComponent:this.toggleCustomComponent,useCustomComponent:this.shouldUseCustomRowComponent()||this.shouldUseCustomGridComponent(),useGriddleStyles:this.props.useGriddleStyles,enableCustomFormatText:this.props.enableCustomFormatText,columnMetadata:this.props.columnMetadata}):""},getCustomGridSection:function(){return o.createElement(this.props.customGridComponent,r({data:this.props.results,className:this.props.customGridComponentClassName},this.props.gridMetadata))},getCustomRowSection:function(e,t,n,r,i){return o.createElement("div",null,o.createElement(h,{data:e,columns:t,metadataColumns:n,globalData:i,className:this.props.customRowComponentClassName,customComponent:this.props.customRowComponent,style:this.props.useGriddleStyles?this.getClearFixStyles():null}),this.props.showPager&&r)},getStandardGridSection:function(e,t,n,r,i){var s=this.getSortObject(),a=this.getMultipleSelectionObject(),u=this.shouldShowNoDataSection(e),d=this.getNoDataSection();return o.createElement("div",{className:"griddle-body"},o.createElement(l,{useGriddleStyles:this.props.useGriddleStyles,noDataSection:d,showNoData:u,columnSettings:this.columnSettings,rowSettings:this.rowSettings,sortSettings:s,multipleSelectionSettings:a,filterByColumn:this.filterByColumn,isSubGriddle:this.props.isSubGriddle,useGriddleIcons:this.props.useGriddleIcons,useFixedLayout:this.props.useFixedLayout,showPager:this.props.showPager,pagingContent:r,data:e,className:this.props.tableClassName,enableInfiniteScroll:this.isInfiniteScrollEnabled(),nextPage:this.nextPage,showTableHeading:this.props.showTableHeading,useFixedHeader:this.props.useFixedHeader,parentRowCollapsedClassName:this.props.parentRowCollapsedClassName,parentRowExpandedClassName:this.props.parentRowExpandedClassName,parentRowCollapsedComponent:this.props.parentRowCollapsedComponent,parentRowExpandedComponent:this.props.parentRowExpandedComponent,bodyHeight:this.props.bodyHeight,paddingHeight:this.props.paddingHeight,rowHeight:this.props.rowHeight,infiniteScrollLoadTreshold:this.props.infiniteScrollLoadTreshold,externalLoadingComponent:this.props.externalLoadingComponent,externalIsLoading:this.props.externalIsLoading,hasMorePages:i,onRowClick:this.props.onRowClick,onRowMouseEnter:this.props.onRowMouseEnter,onRowMouseLeave:this.props.onRowMouseLeave,onRowWillMount:this.props.onRowWillMount,onRowWillUnmount:this.props.onRowWillUnmount}))},getContentSection:function(e,t,n,r,o,i){return this.shouldUseCustomGridComponent()&&null!==this.props.customGridComponent?this.getCustomGridSection():this.shouldUseCustomRowComponent()?this.getCustomRowSection(e,t,n,r,i):this.getStandardGridSection(e,t,n,r,o)},getNoDataSection:function(){return null!=this.props.customNoDataComponent?o.createElement("div",{className:this.props.noDataClassName},o.createElement(this.props.customNoDataComponent,this.props.customNoDataComponentProps)):o.createElement(c,{noDataMessage:this.props.noDataMessage})},shouldShowNoDataSection:function(e){return!this.props.allowEmptyGrid&&(!1===this.props.useExternal&&(void 0===e||0===e.length)||!0===this.props.useExternal&&!1===this.props.externalIsLoading&&0===e.length)},render:function(){var e=this.getCurrentResults(),t=(this.props.tableClassName,this.getFilter()),n=this.getSettings(),r=this.getTopSection(t,n),i=[],s=this.columnSettings.getColumns(),l=this.getDataForRender(e,s,!0),a=this.columnSettings.getMetadataColumns();this.props.columnMetadata?w(this.props.columnMetadata,(function(e){"boolean"==typeof e.visible&&!1===e.visible||i.push(e.columnName)})):i=b.keys(P(e[0],a)),i=this.columnSettings.orderColumns(i);var u=this.getCurrentPage(),d=this.getCurrentMaxPage(),c=u+10?"griddle "+this.props.gridClassName:"griddle";return m+=this.shouldUseCustomRowComponent()?" griddle-custom":"",o.createElement("div",{className:m},r,h,o.createElement("div",{className:"griddle-container",style:this.props.useGriddleStyles&&!this.props.isSubGriddle?{border:"1px solid #DDD"}:null},f))}});f.Griddle=e.exports=k},1545:function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n-1}},9905:function(e){e.exports=function(e,t,n){for(var r=-1,o=null==e?0:e.length;++r=200&&(c=a,p=!1,t=new r(t));e:for(;++d0&&i(d)?n>1?e(d,n-1,i,s,l):r(l,d):s||(l[l.length]=d)}return l}},6649:function(e,t,n){var r=n(3221)();e.exports=r},641:function(e,t,n){var r=n(6649),o=n(5950);e.exports=function(e,t){return e&&r(e,t,o)}},7422:function(e,t,n){var r=n(1769),o=n(7797);e.exports=function(e,t){for(var n=0,i=(t=r(t,e)).length;null!=e&&n=120&&y.length>=120)?new r(f&&y):void 0}y=e[0];var v=-1,b=h[0];e:for(;++vo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(o);++rt||s&&l&&u&&!a&&!d||o&&l&&u||!n&&u||!i)return 1;if(!o&&!s&&!d&&e=a?u:u*("desc"==n[o]?-1:1)}return e.index-t.index}},3007:function(e){e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n1?n[i-1]:void 0,l=i>2?n[2]:void 0;for(s=e.length>3&&"function"==typeof s?(i--,s):void 0,l&&o(n[0],n[1],l)&&(s=i<3?void 0:s,i=1),t=Object(t);++r-1?l[a?t[u]:u]:void 0}}},2963:function(e,t,n){var r=n(1372),o=n(5861),i=n(317),s=n(799);e.exports=function(e){return function(t){var n=o(t);return"[object Map]"==n?i(t):"[object Set]"==n?s(t):r(t,e(t))}}},3138:function(e,t,n){var r=n(1331);e.exports=function(e){return r(e)?void 0:e}},3243:function(e,t,n){var r=n(6110),o=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=o},5911:function(e,t,n){var r=n(8859),o=n(4248),i=n(9219);e.exports=function(e,t,n,s,l,a){var u=1&n,d=e.length,c=t.length;if(d!=c&&!(u&&c>d))return!1;var p=a.get(e),f=a.get(t);if(p&&f)return p==t&&f==e;var h=-1,m=!0,g=2&n?new r:void 0;for(a.set(e,t),a.set(t,e);++h-1&&e%1==0&&e-1}},1175:function(e,t,n){var r=n(6025);e.exports=function(e,t){var n=this.__data__,o=r(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this}},3040:function(e,t,n){var r=n(1549),o=n(79),i=n(8223);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(i||o),string:new r}}},7670:function(e,t,n){var r=n(2651);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},289:function(e,t,n){var r=n(2651);e.exports=function(e){return r(this,e).get(e)}},4509:function(e,t,n){var r=n(2651);e.exports=function(e){return r(this,e).has(e)}},2949:function(e,t,n){var r=n(2651);e.exports=function(e,t){var n=r(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this}},317:function(e){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}},7197:function(e){e.exports=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}},2224:function(e,t,n){var r=n(104);e.exports=function(e){var t=r(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}},1042:function(e,t,n){var r=n(6110)(Object,"create");e.exports=r},3650:function(e,t,n){var r=n(4335)(Object.keys,Object);e.exports=r},181:function(e){e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},6009:function(e,t,n){e=n.nmd(e);var r=n(4840),o=t&&!t.nodeType&&t,i=o&&e&&!e.nodeType&&e,s=i&&i.exports===o&&r.process,l=function(){try{var e=i&&i.require&&i.require("util").types;return e||s&&s.binding&&s.binding("util")}catch(e){}}();e.exports=l},9350:function(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},4335:function(e){e.exports=function(e,t){return function(n){return e(t(n))}}},6757:function(e,t,n){var r=n(1033),o=Math.max;e.exports=function(e,t,n){return t=o(void 0===t?e.length-1:t,0),function(){for(var i=arguments,s=-1,l=o(i.length-t,0),a=Array(l);++s0){if(++n>=800)return arguments[0]}else n=0;return e.apply(void 0,arguments)}}},1420:function(e,t,n){var r=n(79);e.exports=function(){this.__data__=new r,this.size=0}},938:function(e){e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},3605:function(e){e.exports=function(e){return this.__data__.get(e)}},9817:function(e){e.exports=function(e){return this.__data__.has(e)}},945:function(e,t,n){var r=n(79),o=n(8223),i=n(3661);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var s=n.__data__;if(!o||s.length<199)return s.push([e,t]),this.size=++n.size,this;n=this.__data__=new i(s)}return n.set(e,t),this.size=n.size,this}},6959:function(e){e.exports=function(e,t,n){for(var r=n-1,o=e.length;++r2?t[2]:void 0;for(u&&i(t[0],t[1],u)&&(r=1);++n-1:!!d&&r(e,t,n)>-1}},3424:function(e,t,n){var r=n(5160);e.exports=function(e){return(null==e?0:e.length)?r(e,0,-1):[]}},5287:function(e,t,n){var r=n(4932),o=n(7185),i=n(9302),s=n(741),l=i((function(e){var t=r(e,s);return t.length&&t[0]===e[0]?o(t):[]}));e.exports=l},2428:function(e,t,n){var r=n(7534),o=n(346),i=Object.prototype,s=i.hasOwnProperty,l=i.propertyIsEnumerable,a=r(function(){return arguments}())?r:function(e){return o(e)&&s.call(e,"callee")&&!l.call(e,"callee")};e.exports=a},6449:function(e){var t=Array.isArray;e.exports=t},4894:function(e,t,n){var r=n(1882),o=n(294);e.exports=function(e){return null!=e&&o(e.length)&&!r(e)}},3693:function(e,t,n){var r=n(4894),o=n(346);e.exports=function(e){return o(e)&&r(e)}},3656:function(e,t,n){e=n.nmd(e);var r=n(9325),o=n(9935),i=t&&!t.nodeType&&t,s=i&&e&&!e.nodeType&&e,l=s&&s.exports===i?r.Buffer:void 0,a=(l?l.isBuffer:void 0)||o;e.exports=a},2193:function(e,t,n){var r=n(8984),o=n(5861),i=n(2428),s=n(6449),l=n(4894),a=n(3656),u=n(5527),d=n(7167),c=Object.prototype.hasOwnProperty;e.exports=function(e){if(null==e)return!0;if(l(e)&&(s(e)||"string"==typeof e||"function"==typeof e.splice||a(e)||d(e)||i(e)))return!e.length;var t=o(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(u(e))return!r(e).length;for(var n in e)if(c.call(e,n))return!1;return!0}},1882:function(e,t,n){var r=n(2552),o=n(3805);e.exports=function(e){if(!o(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},294:function(e){e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},7730:function(e,t,n){var r=n(9172),o=n(7301),i=n(6009),s=i&&i.isMap,l=s?o(s):r;e.exports=l},5187:function(e){e.exports=function(e){return null===e}},3805:function(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},346:function(e){e.exports=function(e){return null!=e&&"object"==typeof e}},1331:function(e,t,n){var r=n(2552),o=n(8879),i=n(346),s=Function.prototype,l=Object.prototype,a=s.toString,u=l.hasOwnProperty,d=a.call(Object);e.exports=function(e){if(!i(e)||"[object Object]"!=r(e))return!1;var t=o(e);if(null===t)return!0;var n=u.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&a.call(n)==d}},8440:function(e,t,n){var r=n(6038),o=n(7301),i=n(6009),s=i&&i.isSet,l=s?o(s):r;e.exports=l},5015:function(e,t,n){var r=n(2552),o=n(6449),i=n(346);e.exports=function(e){return"string"==typeof e||!o(e)&&i(e)&&"[object String]"==r(e)}},4394:function(e,t,n){var r=n(2552),o=n(346);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},7167:function(e,t,n){var r=n(4901),o=n(7301),i=n(6009),s=i&&i.isTypedArray,l=s?o(s):r;e.exports=l},2216:function(e){e.exports=function(e){return void 0===e}},5950:function(e,t,n){var r=n(695),o=n(8984),i=n(4894);e.exports=function(e){return i(e)?r(e):o(e)}},7241:function(e,t,n){var r=n(695),o=n(2903),i=n(4894);e.exports=function(e){return i(e)?r(e,!0):o(e)}},8090:function(e){e.exports=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}},5378:function(e,t,n){var r=n(4932),o=n(5389),i=n(5128),s=n(6449);e.exports=function(e,t){return(s(e)?r:i)(e,o(t,3))}},104:function(e,t,n){var r=n(3661);function o(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=e.apply(this,r);return n.cache=i.set(o,s)||i,s};return n.cache=new(o.Cache||r),n}o.Cache=r,e.exports=o},179:function(e,t,n){var r=n(4932),o=n(9999),i=n(9931),s=n(1769),l=n(1791),a=n(3138),u=n(8816),d=n(3349),c=u((function(e,t){var n={};if(null==e)return n;var u=!1;t=r(t,(function(t){return t=s(t,e),u||(u=t.length>1),t})),l(e,d(e),n),u&&(n=o(n,7,a));for(var c=t.length;c--;)i(n,t[c]);return n}));e.exports=c},2877:function(e,t,n){var r=n(6155),o=n(6449);e.exports=function(e,t,n,i){return null==e?[]:(o(t)||(t=null==t?[]:[t]),o(n=i?void 0:n)||(n=null==n?[]:[n]),r(e,t,n))}},4383:function(e,t,n){var r=n(6001),o=n(8816)((function(e,t){return null==e?{}:r(e,t)}));e.exports=o},583:function(e,t,n){var r=n(7237),o=n(7255),i=n(8586),s=n(7797);e.exports=function(e){return i(e)?r(s(e)):o(e)}},2426:function(e,t,n){var r=n(4248),o=n(5389),i=n(916),s=n(6449),l=n(6800);e.exports=function(e,t,n){var a=s(e)?r:i;return n&&l(e,t,n)&&(t=void 0),a(e,o(t,3))}},3031:function(e,t,n){var r=n(3120),o=n(6155),i=n(9302),s=n(6800),l=i((function(e,t){if(null==e)return[];var n=t.length;return n>1&&s(e,t[0],t[1])?t=[]:n>2&&s(t[0],t[1],t[2])&&(t=[t[0]]),o(e,r(t,1),[])}));e.exports=l},3345:function(e){e.exports=function(){return[]}},9935:function(e){e.exports=function(){return!1}},4921:function(e,t,n){var r=n(5160),o=n(1489);e.exports=function(e,t,n){return e&&e.length?(t=n||void 0===t?1:o(t),r(e,0,t<0?0:t)):[]}},7400:function(e,t,n){var r=n(9374),o=1/0;e.exports=function(e){return e?(e=r(e))===o||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},1489:function(e,t,n){var r=n(7400);e.exports=function(e){var t=r(e),n=t%1;return t==t?n?t-n:t:0}},9374:function(e,t,n){var r=n(4128),o=n(3805),i=n(4394),s=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,a=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=l.test(e);return n||a.test(e)?u(e.slice(2),n?2:8):s.test(e)?NaN:+e}},8938:function(e,t,n){var r=n(2963)(n(5950));e.exports=r},2072:function(e,t,n){var r=n(4932),o=n(3007),i=n(6449),s=n(4394),l=n(1802),a=n(7797),u=n(3222);e.exports=function(e){return i(e)?r(e,a):s(e)?[e]:o(l(u(e)))}},3222:function(e,t,n){var r=n(7556);e.exports=function(e){return null==e?"":r(e)}},7200:function(e,t,n){var r=n(3222),o=0;e.exports=function(e){var t=++o;return r(e)+t}},5880:function(e,t,n){var r=n(514),o=n(5950);e.exports=function(e){return null==e?[]:r(e,o(e))}},1648:function(e,t,n){var r=n(3915),o=n(9302),i=n(3693),s=o((function(e,t){return i(e)?r(e,t):[]}));e.exports=s},7248:function(e,t,n){var r=n(6547),o=n(1234);e.exports=function(e,t){return o(e||[],t||[],r)}},5228:function(e){"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,o){for(var i,s,l=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),a=1;a1)for(var n=1;n1?t-1:0),r=1;r2?n-2:0),i=2;i1&&void 0!==arguments[1]&&arguments[1],n=this.props,r=n.tolerance,o=n.onSelection,i=n.onEndSelection,s=[],l=(0,d.findDOMNode)(this.refs.selectbox);l&&(this._registry.forEach((function(e){e.domNode&&(0,g.default)(l,e.domNode,r)&&!s.includes(e.key)&&s.push(e.key)})),t?"function"==typeof i&&i(s,e):"function"==typeof o&&o(s,e))}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.enabled,r=e.fixedPosition,o=e.className,i=e.selectingClassName,s=this.state,l=s.isBoxSelecting,a=s.boxLeft,d=s.boxTop,c=s.boxWidth,f=s.boxHeight,h=this.props.component;if(!n)return u.default.createElement(h,{className:o},t);var m={left:a,top:d,width:c,height:f,zIndex:9e3,position:r?"fixed":"absolute",cursor:"default"},g={backgroundColor:"transparent",border:"1px dashed #999",width:"100%",height:"100%",float:"left"},y={position:"relative",overflow:"visible"};return u.default.createElement(h,{className:(0,p.default)(o,l?i:null),style:y},l?u.default.createElement("div",{style:m,ref:"selectbox"},u.default.createElement("span",{style:g})):null,t)}}]),t}(a.Component);v.propTypes={children:c.default.node,onBeginSelection:c.default.func,onEndSelection:c.default.func,onSelection:c.default.func,component:c.default.node,tolerance:c.default.number,fixedPosition:c.default.bool,preventDefault:c.default.bool,onNonItemClick:c.default.func,enabled:c.default.bool,className:c.default.string,selectingClassName:c.default.string},v.defaultProps={component:"div",tolerance:0,fixedPosition:!1,preventDefault:!0,enabled:!0},v.childContextTypes={selectable:c.default.object},t.default=v},function(e,t,n){"use strict";(function(t){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=n(1),i=n(2),s=n(8),l=n(15),a=n(3),u=n(16);e.exports=function(e,n){function d(e){var t=e&&(A&&e[A]||e[x]);if("function"==typeof t)return t}function c(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function p(e){this.message=e,this.stack=""}function f(e){function r(r,u,d,c,f,h,m){if(c=c||D,h=h||d,m!==a)if(n)i(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("production"!==t.env.NODE_ENV&&"undefined"!=typeof console){var g=c+":"+d;!o[g]&&l<3&&(s(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",h,c),o[g]=!0,l++)}return null==u[d]?r?new p(null===u[d]?"The "+f+" `"+h+"` is marked as required in `"+c+"`, but its value is `null`.":"The "+f+" `"+h+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:e(u,d,c,f,h)}if("production"!==t.env.NODE_ENV)var o={},l=0;var u=r.bind(null,!1);return u.isRequired=r.bind(null,!0),u}function h(e){function t(t,n,r,o,i,s){var l=t[n];return w(l)!==e?new p("Invalid "+o+" `"+i+"` of type `"+F(l)+"` supplied to `"+r+"`, expected `"+e+"`."):null}return f(t)}function m(e){function t(t,n,r,o,i){if("function"!=typeof e)return new p("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s))return new p("Invalid "+o+" `"+i+"` of type `"+w(s)+"` supplied to `"+r+"`, expected an array.");for(var l=0;ln+l||t+o-ar+s)};t.default=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=e instanceof HTMLElement?(0,r.default)(e):e,s=t instanceof HTMLElement?(0,r.default)(t):t;return o(i.top,i.left,s.top,s.left,i.offsetWidth,i.offsetHeight,s.offsetWidth,s.offsetHeight,n)}},function(e,t,n){"use strict";(function(t){function n(e,t,n){function r(t){var n=m,r=g;return m=g=void 0,w=t,v=e.apply(r,n)}function i(e){return w=e,b=setTimeout(d,t),F?r(e):v}function s(e){var n=t-(e-_);return I?C(n,y-(e-w)):n}function a(e){var n=e-_;return void 0===_||n>=t||n<0||I&&e-w>=y}function d(){var e=S();if(a(e))return c(e);b=setTimeout(d,s(e))}function c(e){return b=void 0,O&&m?r(e):(m=g=void 0,v)}function p(){void 0!==b&&clearTimeout(b),w=0,m=_=g=b=void 0}function f(){return void 0===b?v:c(S())}function h(){var e=S(),n=a(e);if(m=arguments,g=this,_=e,n){if(void 0===b)return i(_);if(I)return b=setTimeout(d,t),r(_)}return void 0===b&&(b=setTimeout(d,t)),v}var m,g,y,v,b,_,w=0,F=!1,I=!1,O=!0;if("function"!=typeof e)throw new TypeError(u);return t=l(t)||0,o(n)&&(F=!!n.leading,y=(I="maxWait"in n)?E(l(n.maxWait)||0,t):y,O="trailing"in n?!!n.trailing:O),h.cancel=p,h.flush=f,h}function r(e,t,r){var i=!0,s=!0;if("function"!=typeof e)throw new TypeError(u);return o(r)&&(i="leading"in r?!!r.leading:i,s="trailing"in r?!!r.trailing:s),n(e,t,{leading:i,maxWait:t,trailing:s})}function o(e){var t=void 0===e?"undefined":a(e);return!!e&&("object"==t||"function"==t)}function i(e){return!!e&&"object"==(void 0===e?"undefined":a(e))}function s(e){return"symbol"==(void 0===e?"undefined":a(e))||i(e)&&_.call(e)==c}function l(e){if("number"==typeof e)return e;if(s(e))return d;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(p,"");var n=h.test(e);return n||m.test(e)?g(e.slice(2),n?2:8):f.test(e)?d:+e}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u="Expected a function",d=NaN,c="[object Symbol]",p=/^\s+|\s+$/g,f=/^[-+]0x[0-9a-f]+$/i,h=/^0b[01]+$/i,m=/^0o[0-7]+$/i,g=parseInt,y="object"==(void 0===t?"undefined":a(t))&&t&&t.Object===Object&&t,v="object"==("undefined"==typeof self?"undefined":a(self))&&self&&self.Object===Object&&self,b=y||v||Function("return this")(),_=Object.prototype.toString,E=Math.max,C=Math.min,S=function(){return b.Date.now()};e.exports=r}).call(t,n(21))},function(e,t,n){"use strict";var r,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"===("undefined"==typeof window?"undefined":o(window))&&(r=window)}e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function 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)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n
'),this.element.appendChild(e));let t=e.getElementsByTagName("span")[0];return t&&(null!=t.textContent?t.textContent=this.options.dictFallbackMessage:null!=t.innerText&&(t.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize(e,t,n,r){let o={srcX:0,srcY:0,srcWidth:e.width,srcHeight:e.height},i=e.width/e.height;null==t&&null==n?(t=o.srcWidth,n=o.srcHeight):null==t?t=n*i:null==n&&(n=t/i);let s=(t=Math.min(t,o.srcWidth))/(n=Math.min(n,o.srcHeight));if(o.srcWidth>t||o.srcHeight>n)if("crop"===r)i>s?(o.srcHeight=e.height,o.srcWidth=o.srcHeight*s):(o.srcWidth=e.width,o.srcHeight=o.srcWidth/s);else{if("contain"!==r)throw new Error(`Unknown resizeMethod '${r}'`);i>s?n=t/i:t=n*i}return o.srcX=(e.width-o.srcWidth)/2,o.srcY=(e.height-o.srcHeight)/2,o.trgWidth=t,o.trgHeight=n,o},transformFile(e,t){return(this.options.resizeWidth||this.options.resizeHeight)&&e.type.match(/image.*/)?this.resizeImage(e,this.options.resizeWidth,this.options.resizeHeight,this.options.resizeMethod,t):t(e)},previewTemplate:i('
\n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n \n \n \n
\n
\n \n \n \n
\n
\n'),drop(e){return this.element.classList.remove("dz-drag-hover")},dragstart(e){},dragend(e){return this.element.classList.remove("dz-drag-hover")},dragenter(e){return this.element.classList.add("dz-drag-hover")},dragover(e){return this.element.classList.add("dz-drag-hover")},dragleave(e){return this.element.classList.remove("dz-drag-hover")},paste(e){},reset(){return this.element.classList.remove("dz-started")},addedfile(e){if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer&&!this.options.disablePreviews){for(var t of(e.previewElement=a.createElement(this.options.previewTemplate.trim()),e.previewTemplate=e.previewElement,this.previewsContainer.appendChild(e.previewElement),e.previewElement.querySelectorAll("[data-dz-name]")))t.textContent=e.name;for(t of e.previewElement.querySelectorAll("[data-dz-size]"))t.innerHTML=this.filesize(e.size);this.options.addRemoveLinks&&(e._removeLink=a.createElement(`
${this.options.dictRemoveFile}`),e.previewElement.appendChild(e._removeLink));let n=t=>(t.preventDefault(),t.stopPropagation(),e.status===a.UPLOADING?a.confirm(this.options.dictCancelUploadConfirmation,(()=>this.removeFile(e))):this.options.dictRemoveFileConfirmation?a.confirm(this.options.dictRemoveFileConfirmation,(()=>this.removeFile(e))):this.removeFile(e));for(let t of e.previewElement.querySelectorAll("[data-dz-remove]"))t.addEventListener("click",n)}},removedfile(e){return null!=e.previewElement&&null!=e.previewElement.parentNode&&e.previewElement.parentNode.removeChild(e.previewElement),this._updateMaxFilesReachedClass()},thumbnail(e,t){if(e.previewElement){e.previewElement.classList.remove("dz-file-preview");for(let n of e.previewElement.querySelectorAll("[data-dz-thumbnail]"))n.alt=e.name,n.src=t;return setTimeout((()=>e.previewElement.classList.add("dz-image-preview")),1)}},error(e,t){if(e.previewElement){e.previewElement.classList.add("dz-error"),"string"!=typeof t&&t.error&&(t=t.error);for(let n of e.previewElement.querySelectorAll("[data-dz-errormessage]"))n.textContent=t}},errormultiple(){},processing(e){if(e.previewElement&&(e.previewElement.classList.add("dz-processing"),e._removeLink))return e._removeLink.innerHTML=this.options.dictCancelUpload},processingmultiple(){},uploadprogress(e,t,n){if(e.previewElement)for(let n of e.previewElement.querySelectorAll("[data-dz-uploadprogress]"))"PROGRESS"===n.nodeName?n.value=t:n.style.width=`${t}%`},totaluploadprogress(){},sending(){},sendingmultiple(){},success(e){if(e.previewElement)return e.previewElement.classList.add("dz-success")},successmultiple(){},canceled(e){return this.emit("error",e,this.options.dictUploadCanceled)},canceledmultiple(){},complete(e){if(e._removeLink&&(e._removeLink.innerHTML=this.options.dictRemoveFile),e.previewElement)return e.previewElement.classList.add("dz-complete")},completemultiple(){},maxfilesexceeded(){},maxfilesreached(){},queuecomplete(){},addedfiles(){}};class a extends s{static initClass(){this.prototype.Emitter=s,this.prototype.events=["drop","dragstart","dragend","dragenter","dragover","dragleave","addedfile","addedfiles","removedfile","thumbnail","error","errormultiple","processing","processingmultiple","uploadprogress","totaluploadprogress","sending","sendingmultiple","success","successmultiple","canceled","canceledmultiple","complete","completemultiple","reset","maxfilesexceeded","maxfilesreached","queuecomplete"],this.prototype._thumbnailQueue=[],this.prototype._processingThumbnail=!1}getAcceptedFiles(){return this.files.filter((e=>e.accepted)).map((e=>e))}getRejectedFiles(){return this.files.filter((e=>!e.accepted)).map((e=>e))}getFilesWithStatus(e){return this.files.filter((t=>t.status===e)).map((e=>e))}getQueuedFiles(){return this.getFilesWithStatus(a.QUEUED)}getUploadingFiles(){return this.getFilesWithStatus(a.UPLOADING)}getAddedFiles(){return this.getFilesWithStatus(a.ADDED)}getActiveFiles(){return this.files.filter((e=>e.status===a.UPLOADING||e.status===a.QUEUED)).map((e=>e))}init(){if("form"===this.element.tagName&&this.element.setAttribute("enctype","multipart/form-data"),this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")&&this.element.appendChild(a.createElement(`
`)),this.clickableElements.length){let e=()=>{this.hiddenFileInput&&this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=document.createElement("input"),this.hiddenFileInput.setAttribute("type","file"),(null===this.options.maxFiles||this.options.maxFiles>1)&&this.hiddenFileInput.setAttribute("multiple","multiple"),this.hiddenFileInput.className="dz-hidden-input",null!==this.options.acceptedFiles&&this.hiddenFileInput.setAttribute("accept",this.options.acceptedFiles),null!==this.options.capture&&this.hiddenFileInput.setAttribute("capture",this.options.capture),this.hiddenFileInput.setAttribute("tabindex","-1"),this.hiddenFileInput.style.visibility="hidden",this.hiddenFileInput.style.position="absolute",this.hiddenFileInput.style.top="0",this.hiddenFileInput.style.left="0",this.hiddenFileInput.style.height="0",this.hiddenFileInput.style.width="0",a.getElement(this.options.hiddenInputContainer,"hiddenInputContainer").appendChild(this.hiddenFileInput),this.hiddenFileInput.addEventListener("change",(()=>{let{files:t}=this.hiddenFileInput;if(t.length)for(let e of t)this.addFile(e);this.emit("addedfiles",t),e()}))};e()}this.URL=null!==window.URL?window.URL:window.webkitURL;for(let e of this.events)this.on(e,this.options[e]);this.on("uploadprogress",(()=>this.updateTotalUploadProgress())),this.on("removedfile",(()=>this.updateTotalUploadProgress())),this.on("canceled",(e=>this.emit("complete",e))),this.on("complete",(e=>{if(0===this.getAddedFiles().length&&0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length)return setTimeout((()=>this.emit("queuecomplete")),0)}));let e=function(e){if(function(e){if(e.dataTransfer.types)for(var t=0;tthis.emit("dragstart",e),dragenter:t=>(e(t),this.emit("dragenter",t)),dragover:t=>{let n;try{n=t.dataTransfer.effectAllowed}catch(e){}return t.dataTransfer.dropEffect="move"===n||"linkMove"===n?"move":"copy",e(t),this.emit("dragover",t)},dragleave:e=>this.emit("dragleave",e),drop:t=>(e(t),this.drop(t)),dragend:e=>this.emit("dragend",e)}}],this.clickableElements.forEach((e=>this.listeners.push({element:e,events:{click:t=>((e!==this.element||t.target===this.element||a.elementInside(t.target,this.element.querySelector(".dz-message")))&&this.hiddenFileInput.click(),!0)}}))),this.enable(),this.options.init.call(this)}destroy(){return this.disable(),this.removeAllFiles(!0),(null!=this.hiddenFileInput?this.hiddenFileInput.parentNode:void 0)&&(this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=null),delete this.element.dropzone,a.instances.splice(a.instances.indexOf(this),1)}updateTotalUploadProgress(){let e,t=0,n=0;if(this.getActiveFiles().length){for(let e of this.getActiveFiles())t+=e.upload.bytesSent,n+=e.upload.total;e=100*t/n}else e=100;return this.emit("totaluploadprogress",e,n,t)}_getParamName(e){return"function"==typeof this.options.paramName?this.options.paramName(e):`${this.options.paramName}${this.options.uploadMultiple?`[${e}]`:""}`}_renameFile(e){return"function"!=typeof this.options.renameFile?e.name:this.options.renameFile(e)}getFallbackForm(){let e,t;if(e=this.getExistingFallback())return e;let n='
';this.options.dictFallbackText&&(n+=`

${this.options.dictFallbackText}

`),n+=`
`;let r=a.createElement(n);return"FORM"!==this.element.tagName?(t=a.createElement(`
`),t.appendChild(r)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),null!=t?t:r}getExistingFallback(){let e=function(e){for(let t of e)if(/(^| )fallback($| )/.test(t.className))return t};for(let n of["div","form"]){var t;if(t=e(this.element.getElementsByTagName(n)))return t}}setupEventListeners(){return this.listeners.map((e=>(()=>{let t=[];for(let n in e.events){let r=e.events[n];t.push(e.element.addEventListener(n,r,!1))}return t})()))}removeEventListeners(){return this.listeners.map((e=>(()=>{let t=[];for(let n in e.events){let r=e.events[n];t.push(e.element.removeEventListener(n,r,!1))}return t})()))}disable(){return this.clickableElements.forEach((e=>e.classList.remove("dz-clickable"))),this.removeEventListeners(),this.disabled=!0,this.files.map((e=>this.cancelUpload(e)))}enable(){return delete this.disabled,this.clickableElements.forEach((e=>e.classList.add("dz-clickable"))),this.setupEventListeners()}filesize(e){let t=0,n="b";if(e>0){let r=["tb","gb","mb","kb","b"];for(let o=0;o=Math.pow(this.options.filesizeBase,4-o)/10){t=e/Math.pow(this.options.filesizeBase,4-o),n=i;break}}t=Math.round(10*t)/10}return`${t} ${this.options.dictFileSizeUnits[n]}`}_updateMaxFilesReachedClass(){return null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")}drop(e){if(!e.dataTransfer)return;this.emit("drop",e);let t=[];for(let n=0;ne.items,null!=t?n(t):void 0))return;var t,n;this.emit("paste",e);let{items:r}=e.clipboardData;return r.length?this._addFilesFromItems(r):void 0}handleFiles(e){for(let t of e)this.addFile(t)}_addFilesFromItems(e){return(()=>{let t=[];for(let r of e){var n;null!=r.webkitGetAsEntry&&(n=r.webkitGetAsEntry())?n.isFile?t.push(this.addFile(r.getAsFile())):n.isDirectory?t.push(this._addFilesFromDirectory(n,n.name)):t.push(void 0):null!=r.getAsFile&&(null==r.kind||"file"===r.kind)?t.push(this.addFile(r.getAsFile())):t.push(void 0)}return t})()}_addFilesFromDirectory(e,t){let n=e.createReader(),r=e=>{return t=console,n="log",r=t=>t.log(e),null!=t&&"function"==typeof t[n]?r(t,n):void 0;var t,n,r};var o=()=>n.readEntries((e=>{if(e.length>0){for(let n of e)n.isFile?n.file((e=>{if(!this.options.ignoreHiddenFiles||"."!==e.name.substring(0,1))return e.fullPath=`${t}/${e.name}`,this.addFile(e)})):n.isDirectory&&this._addFilesFromDirectory(n,`${t}/${n.name}`);o()}return null}),r);return o()}accept(e,t){this.options.maxFilesize&&e.size>1048576*this.options.maxFilesize?t(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(e.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):a.isValidFile(e,this.options.acceptedFiles)?null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(t(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",e)):this.options.accept.call(this,e,t):t(this.options.dictInvalidFileType)}addFile(e){e.upload={uuid:a.uuidv4(),progress:0,total:e.size,bytesSent:0,filename:this._renameFile(e)},this.files.push(e),e.status=a.ADDED,this.emit("addedfile",e),this._enqueueThumbnail(e),this.accept(e,(t=>{t?(e.accepted=!1,this._errorProcessing([e],t)):(e.accepted=!0,this.options.autoQueue&&this.enqueueFile(e)),this._updateMaxFilesReachedClass()}))}enqueueFiles(e){for(let t of e)this.enqueueFile(t);return null}enqueueFile(e){if(e.status!==a.ADDED||!0!==e.accepted)throw new Error("This file can't be queued because it has already been processed or was rejected.");if(e.status=a.QUEUED,this.options.autoProcessQueue)return setTimeout((()=>this.processQueue()),0)}_enqueueThumbnail(e){if(this.options.createImageThumbnails&&e.type.match(/image.*/)&&e.size<=1048576*this.options.maxThumbnailFilesize)return this._thumbnailQueue.push(e),setTimeout((()=>this._processThumbnailQueue()),0)}_processThumbnailQueue(){if(this._processingThumbnail||0===this._thumbnailQueue.length)return;this._processingThumbnail=!0;let e=this._thumbnailQueue.shift();return this.createThumbnail(e,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,!0,(t=>(this.emit("thumbnail",e,t),this._processingThumbnail=!1,this._processThumbnailQueue())))}removeFile(e){if(e.status===a.UPLOADING&&this.cancelUpload(e),this.files=u(this.files,e),this.emit("removedfile",e),0===this.files.length)return this.emit("reset")}removeAllFiles(e){null==e&&(e=!1);for(let t of this.files.slice())(t.status!==a.UPLOADING||e)&&this.removeFile(t);return null}resizeImage(e,t,n,r,o){return this.createThumbnail(e,t,n,r,!0,((t,n)=>{if(null==n)return o(e);{let{resizeMimeType:t}=this.options;null==t&&(t=e.type);let r=n.toDataURL(t,this.options.resizeQuality);return"image/jpeg"!==t&&"image/jpg"!==t||(r=p.restore(e.dataURL,r)),o(a.dataURItoBlob(r))}}))}createThumbnail(e,t,n,r,o,i){let s=new FileReader;s.onload=()=>{e.dataURL=s.result,"image/svg+xml"!==e.type?this.createThumbnailFromUrl(e,t,n,r,o,i):null!=i&&i(s.result)},s.readAsDataURL(e)}displayExistingFile(e,t,n,r,o=!0){if(this.emit("addedfile",e),this.emit("complete",e),o){let o=t=>{this.emit("thumbnail",e,t),n&&n()};e.dataURL=t,this.createThumbnailFromUrl(e,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,this.options.fixOrientation,o,r)}else this.emit("thumbnail",e,t),n&&n()}createThumbnailFromUrl(e,t,n,r,o,i,s){let l=document.createElement("img");return s&&(l.crossOrigin=s),o="from-image"!=getComputedStyle(document.body).imageOrientation&&o,l.onload=()=>{let s=e=>e(1);return"undefined"!=typeof EXIF&&null!==EXIF&&o&&(s=e=>EXIF.getData(l,(function(){return e(EXIF.getTag(this,"Orientation"))}))),s((o=>{e.width=l.width,e.height=l.height;let s=this.options.resize.call(this,e,t,n,r),a=document.createElement("canvas"),u=a.getContext("2d");switch(a.width=s.trgWidth,a.height=s.trgHeight,o>4&&(a.width=s.trgHeight,a.height=s.trgWidth),o){case 2:u.translate(a.width,0),u.scale(-1,1);break;case 3:u.translate(a.width,a.height),u.rotate(Math.PI);break;case 4:u.translate(0,a.height),u.scale(1,-1);break;case 5:u.rotate(.5*Math.PI),u.scale(1,-1);break;case 6:u.rotate(.5*Math.PI),u.translate(0,-a.width);break;case 7:u.rotate(.5*Math.PI),u.translate(a.height,-a.width),u.scale(-1,1);break;case 8:u.rotate(-.5*Math.PI),u.translate(-a.height,0)}c(u,l,null!=s.srcX?s.srcX:0,null!=s.srcY?s.srcY:0,s.srcWidth,s.srcHeight,null!=s.trgX?s.trgX:0,null!=s.trgY?s.trgY:0,s.trgWidth,s.trgHeight);let d=a.toDataURL("image/png");if(null!=i)return i(d,a)}))},null!=i&&(l.onerror=i),l.src=e.dataURL}processQueue(){let{parallelUploads:e}=this.options,t=this.getUploadingFiles().length,n=t;if(t>=e)return;let r=this.getQueuedFiles();if(r.length>0){if(this.options.uploadMultiple)return this.processFiles(r.slice(0,e-t));for(;nt.xhr===e)).map((e=>e))}cancelUpload(e){if(e.status===a.UPLOADING){let t=this._getFilesWithXhr(e.xhr);for(let e of t)e.status=a.CANCELED;void 0!==e.xhr&&e.xhr.abort();for(let e of t)this.emit("canceled",e);this.options.uploadMultiple&&this.emit("canceledmultiple",t)}else e.status!==a.ADDED&&e.status!==a.QUEUED||(e.status=a.CANCELED,this.emit("canceled",e),this.options.uploadMultiple&&this.emit("canceledmultiple",[e]));if(this.options.autoProcessQueue)return this.processQueue()}resolveOption(e,...t){return"function"==typeof e?e.apply(this,t):e}uploadFile(e){return this.uploadFiles([e])}uploadFiles(e){this._transformFiles(e,(t=>{if(this.options.chunking){let n=t[0];e[0].upload.chunked=this.options.chunking&&(this.options.forceChunking||n.size>this.options.chunkSize),e[0].upload.totalChunkCount=Math.ceil(n.size/this.options.chunkSize)}if(e[0].upload.chunked){let n=e[0],r=t[0],o=0;n.upload.chunks=[];let i=()=>{let t=0;for(;void 0!==n.upload.chunks[t];)t++;if(t>=n.upload.totalChunkCount)return;o++;let i=t*this.options.chunkSize,s=Math.min(i+this.options.chunkSize,r.size),l={name:this._getParamName(0),data:r.webkitSlice?r.webkitSlice(i,s):r.slice(i,s),filename:n.upload.filename,chunkIndex:t};n.upload.chunks[t]={file:n,index:t,dataBlock:l,status:a.UPLOADING,progress:0,retries:0},this._uploadData(e,[l])};if(n.upload.finishedChunkUpload=(t,r)=>{let o=!0;t.status=a.SUCCESS,t.dataBlock=null,t.response=t.xhr.responseText,t.responseHeaders=t.xhr.getAllResponseHeaders(),t.xhr=null;for(let e=0;e{this._finished(e,r,null)}))},this.options.parallelChunkUploads)for(let e=0;e{this._finishedUploading(e,n,t)},n.ontimeout=()=>{this._handleUploadError(e,n,`Request timedout after ${this.options.timeout/1e3} seconds`)},n.onerror=()=>{this._handleUploadError(e,n)},(null!=n.upload?n.upload:n).onprogress=t=>this._updateFilesUploadProgress(e,n,t);let s=this.options.defaultHeaders?{Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"}:{};this.options.binaryBody&&(s["Content-Type"]=e[0].type),this.options.headers&&r(s,this.options.headers);for(let e in s){let t=s[e];t&&n.setRequestHeader(e,t)}if(this.options.binaryBody){for(let t of e)this.emit("sending",t,n);this.options.uploadMultiple&&this.emit("sendingmultiple",e,n),this.submitRequest(n,null,e)}else{let r=new FormData;if(this.options.params){let t=this.options.params;"function"==typeof t&&(t=t.call(this,e,n,e[0].upload.chunked?this._getChunk(e[0],n):null));for(let e in t){let n=t[e];if(Array.isArray(n))for(let t=0;t{n[o]=i,++r===e.length&&t(n)}))}_addFormElementData(e){if("FORM"===this.element.tagName)for(let t of this.element.querySelectorAll("input, textarea, select, button")){let n=t.getAttribute("name"),r=t.getAttribute("type");if(r&&(r=r.toLowerCase()),null!=n)if("SELECT"===t.tagName&&t.hasAttribute("multiple"))for(let r of t.options)r.selected&&e.append(n,r.value);else(!r||"checkbox"!==r&&"radio"!==r||t.checked)&&e.append(n,t.value)}}_updateFilesUploadProgress(e,t,n){if(e[0].upload.chunked){let r=e[0],o=this._getChunk(r,t);n?(o.progress=100*n.loaded/n.total,o.total=n.total,o.bytesSent=n.loaded):(o.progress=100,o.bytesSent=o.total),r.upload.progress=0,r.upload.total=0,r.upload.bytesSent=0;for(let e=0;ethis.options.renameFilename.call(this,e.name,e)),"string"==typeof this.options.method&&(this.options.method=this.options.method.toUpperCase()),(n=this.getExistingFallback())&&n.parentNode&&n.parentNode.removeChild(n),!1!==this.options.previewsContainer&&(this.options.previewsContainer?this.previewsContainer=a.getElement(this.options.previewsContainer,"previewsContainer"):this.previewsContainer=this.element),this.options.clickable&&(!0===this.options.clickable?this.clickableElements=[this.element]:this.clickableElements=a.getElements(this.options.clickable,"clickable")),this.init()}}a.initClass(),a.options={},a.optionsForElement=function(e){return e.getAttribute("id")?a.options[d(e.getAttribute("id"))]:void 0},a.instances=[],a.forElement=function(e){if("string"==typeof e&&(e=document.querySelector(e)),null==(null!=e?e.dropzone:void 0))throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");return e.dropzone},a.discover=function(){let e;if(document.querySelectorAll)e=document.querySelectorAll(".dropzone");else{e=[];let t=t=>(()=>{let n=[];for(let r of t)/(^| )dropzone($| )/.test(r.className)?n.push(e.push(r)):n.push(void 0);return n})();t(document.getElementsByTagName("div")),t(document.getElementsByTagName("form"))}return(()=>{let t=[];for(let n of e)!1!==a.optionsForElement(n)?t.push(new a(n)):t.push(void 0);return t})()},a.blockedBrowsers=[/opera.*(Macintosh|Windows Phone).*version\/12/i],a.isBrowserSupported=function(){let e=!0;if(window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if("classList"in document.createElement("a")){void 0!==a.blacklistedBrowsers&&(a.blockedBrowsers=a.blacklistedBrowsers);for(let t of a.blockedBrowsers)if(t.test(navigator.userAgent)){e=!1;continue}}else e=!1;else e=!1;return e},a.dataURItoBlob=function(e){let t=atob(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],r=new ArrayBuffer(t.length),o=new Uint8Array(r);for(let e=0,n=t.length,r=0<=n;r?e<=n:e>=n;r?e++:e--)o[e]=t.charCodeAt(e);return new Blob([r],{type:n})};const u=(e,t)=>e.filter((e=>e!==t)).map((e=>e)),d=e=>e.replace(/[\-_](\w)/g,(e=>e.charAt(1).toUpperCase()));a.createElement=function(e){let t=document.createElement("div");return t.innerHTML=e,t.childNodes[0]},a.elementInside=function(e,t){if(e===t)return!0;for(;e=e.parentNode;)if(e===t)return!0;return!1},a.getElement=function(e,t){let n;if("string"==typeof e?n=document.querySelector(e):null!=e.nodeType&&(n=e),null==n)throw new Error(`Invalid \`${t}\` option provided. Please provide a CSS selector or a plain HTML element.`);return n},a.getElements=function(e,t){let n,r;if(e instanceof Array){r=[];try{for(n of e)r.push(this.getElement(n,t))}catch(e){r=null}}else if("string"==typeof e)for(n of(r=[],document.querySelectorAll(e)))r.push(n);else null!=e.nodeType&&(r=[e]);if(null==r||!r.length)throw new Error(`Invalid \`${t}\` option provided. Please provide a CSS selector, a plain HTML element or a list of those.`);return r},a.confirm=function(e,t,n){return window.confirm(e)?t():null!=n?n():void 0},a.isValidFile=function(e,t){if(!t)return!0;t=t.split(",");let n=e.type,r=n.replace(/\/.*$/,"");for(let o of t)if(o=o.trim(),"."===o.charAt(0)){if(-1!==e.name.toLowerCase().indexOf(o.toLowerCase(),e.name.length-o.length))return!0}else if(/\/\*$/.test(o)){if(r===o.replace(/\/.*$/,""))return!0}else if(n===o)return!0;return!1},"undefined"!=typeof jQuery&&null!==jQuery&&(jQuery.fn.dropzone=function(e){return this.each((function(){return new a(this,e)}))}),a.ADDED="added",a.QUEUED="queued",a.ACCEPTED=a.QUEUED,a.UPLOADING="uploading",a.PROCESSING=a.UPLOADING,a.CANCELED="canceled",a.ERROR="error",a.SUCCESS="success";var c=function(e,t,n,r,o,i,s,l,a,u){let d=function(e){e.naturalWidth;let t=e.naturalHeight,n=document.createElement("canvas");n.width=1,n.height=t;let r=n.getContext("2d");r.drawImage(e,0,0);let{data:o}=r.getImageData(1,0,1,t),i=0,s=t,l=t;for(;l>i;)0===o[4*(l-1)+3]?s=l:i=l,l=s+i>>1;let a=l/t;return 0===a?1:a}(t);return e.drawImage(t,n,r,o,i,s,l,a,u/d)};class p{static initClass(){this.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}static encode64(e){let t,n,r,o,i,s="",l="",a="",u=0;for(;t=e[u++],n=e[u++],l=e[u++],r=t>>2,o=(3&t)<<4|n>>4,i=(15&n)<<2|l>>6,a=63&l,isNaN(n)?i=a=64:isNaN(l)&&(a=64),s=s+this.KEY_STR.charAt(r)+this.KEY_STR.charAt(o)+this.KEY_STR.charAt(i)+this.KEY_STR.charAt(a),t=n=l="",r=o=i=a="",ue.length)break}return n}static decode64(e){let t,n,r,o,i,s="",l="",a=0,u=[];for(/[^A-Za-z0-9\+\/\=]/g.exec(e)&&console.warn("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\nExpect errors in decoding."),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");r=this.KEY_STR.indexOf(e.charAt(a++)),o=this.KEY_STR.indexOf(e.charAt(a++)),i=this.KEY_STR.indexOf(e.charAt(a++)),l=this.KEY_STR.indexOf(e.charAt(a++)),t=r<<2|o>>4,n=(15&o)<<4|i>>2,s=(3&i)<<6|l,u.push(t),64!==i&&u.push(n),64!==l&&u.push(s),t=n=s="",r=o=i=l="",a{r.default.transform("move-form-disabled",(e=>{e.component("TreeDropdownField.AssetAdmin.MoveForm",i.default)})),r.default.transform("owner-unpublishing",(e=>{e.component("FormAction.AssetAdmin.EditForm.action_unpublish",o.default)}))}},2038:function(e,t,n){"use strict";var r=d(n(6177)),o=d(n(6194)),i=d(n(4736)),s=d(n(9588)),l=d(n(420)),a=d(n(4121)),u=n(5125);function d(e){return e&&e.__esModule?e:{default:e}}document.addEventListener("DOMContentLoaded",(()=>{(0,a.default)(),(0,s.default)();const e=r.default.getSection("SilverStripe\\AssetAdmin\\Controller\\AssetAdmin").reactRoutePath;o.default.add({path:"/",routes:[{path:(0,u.joinUrlPaths)(e,"show/:folderId/:viewAction/:fileId"),component:i.default},{path:(0,u.joinUrlPaths)(e,"show/:folderId/:viewAction"),component:i.default},{path:(0,u.joinUrlPaths)(e,"show/:folderId"),component:i.default},{path:e,component:i.default}]}),(0,l.default)()}))},4121:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=f(n(5207)),o=f(n(9725)),i=f(n(3058)),s=f(n(853)),l=f(n(6931)),a=f(n(3517)),u=f(n(2397)),d=f(n(9005)),c=f(n(6493)),p=n(1037);function f(e){return e&&e.__esModule?e:{default:e}}t.default=()=>{r.default.component.registerMany({UploadField:o.default,UploadFieldItem:i.default,PreviewImageField:a.default,HistoryList:d.default,ProportionConstraintField:u.default,AssetDropzone:s.default,InsertMediaModal:l.default,GalleryToolbar:c.default,GalleryItemFile:p.File,GalleryItemFolder:p.Folder})}},420:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=f(n(5207)),o=n(9367),i=f(n(8518)),s=f(n(8310)),l=f(n(2726)),a=f(n(7668)),u=f(n(5214)),d=f(n(2482)),c=f(n(9266)),p=f(n(8178));function f(e){return e&&e.__esModule?e:{default:e}}t.default=()=>{r.default.reducer.register("assetAdmin",(0,o.combineReducers)({gallery:i.default,queuedFiles:s.default,uploadField:l.default,previewField:a.default,imageLoad:u.default,displaySearch:d.default,confirmDeletion:c.default,modal:p.default}))}},853:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=u(n(5815)),i=u(n(3724)),s=u(n(1669)),l=n(5716),a=u(n(6935));function u(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}let c=0;class p extends r.Component{constructor(e){super(e),this.dropzone=null,this.dragging=!1,this.handleAccept=this.handleAccept.bind(this),this.handleAddedFile=this.handleAddedFile.bind(this),this.handleDragEnter=this.handleDragEnter.bind(this),this.handleDragLeave=this.handleDragLeave.bind(this),this.handleDrop=this.handleDrop.bind(this),this.handleUploadProgress=this.handleUploadProgress.bind(this),this.handleUploadComplete=this.handleUploadComplete.bind(this),this.handleError=this.handleError.bind(this),this.handleSending=this.handleSending.bind(this),this.handleSuccess=this.handleSuccess.bind(this),this.handleQueueComplete=this.handleQueueComplete.bind(this),this.loadImage=this.loadImage.bind(this),this.handleMaxFilesExceeded=this.handleMaxFilesExceeded.bind(this)}componentDidMount(){this.dropzone=new i.default(this.dropzoneRef,Object.assign({},this.getDefaultOptions(),this.props.options));const{name:e}=this.props;e&&this.dropzone.hiddenFileInput&&this.dropzone.hiddenFileInput.classList.add(`dz-input-${e}`),void 0!==this.props.promptOnRemove&&this.setPromptOnRemove(this.props.promptOnRemove)}componentDidUpdate(e){const{name:t}=this.props;t&&this.dropzone.hiddenFileInput&&this.dropzone.hiddenFileInput.classList.add(`dz-input-${t}`),this.props.canUpload&&e.options!==this.props.options&&this.dropzone&&(this.dropzone.enable(),this.dropzone.options=Object.assign({},this.getDefaultOptions(),this.dropzone.options,this.props.options))}componentWillUnmount(){this.dropzone.files=[],this.dropzone.destroy()}getDefaultOptions(){let e=null,t=this.props.uploadSelector;if(!t&&this.props.uploadButton&&(t=".asset-dropzone__upload-button"),t){const n=(0,s.default)(this.dropzoneRef).find(t);n&&n.length&&(e=n.toArray())}return{accept:this.handleAccept,addedfile:this.handleAddedFile,dragenter:this.handleDragEnter,dragleave:this.handleDragLeave,drop:this.handleDrop,maxfilesexceeded:this.handleMaxFilesExceeded,uploadprogress:this.handleUploadProgress,complete:this.handleUploadComplete,dictDefaultMessage:o.default._t("AssetAdmin.DROPZONE_DEFAULT_MESSAGE","Drop files here to upload"),dictFallbackMessage:o.default._t("AssetAdmin.DROPZONE_FALLBACK_MESSAGE","Your browser does not support drag'n'drop file uploads."),dictFallbackText:o.default._t("AssetAdmin.DROPZONE_FALLBACK_TEXT","Please use the fallback form below to upload your files like in the olden days."),dictInvalidFileType:o.default._t("AssetAdmin.DROPZONE_INVALID_FILE_TYPE","You can't upload files of this type."),dictResponseError:o.default._t("AssetAdmin.DROPZONE_RESPONSE_ERROR","Server responded with an error."),dictCancelUpload:o.default._t("AssetAdmin.DROPZONE_CANCEL_UPLOAD","Cancel upload"),dictCancelUploadConfirmation:o.default._t("AssetAdmin.DROPZONE_CANCEL_UPLOAD_CONFIRMATION","Are you sure you want to cancel this upload?"),dictRemoveFile:o.default._t("AssetAdmin.DROPZONE_REMOVE_FILE","Remove file"),dictMaxFilesExceeded:o.default._t("AssetAdmin.DROPZONE_MAX_FILES_EXCEEDED","You can not upload any more files."),error:this.handleError,sending:this.handleSending,success:this.handleSuccess,queuecomplete:this.handleQueueComplete,thumbnailHeight:150,thumbnailWidth:200,timeout:0,clickable:e}}getFileCategory(e){return e.split("/")[0]}getLoadPreview(e){return new Promise((t=>{const n=new FileReader;n.onload=n=>{if("image"===this.getFileCategory(e.type)){const e=new Image;t(this.loadImage(e,n.target.result))}else t({})},n.readAsDataURL(e)}))}getFileTitle(e){return e.replace(/[.][^.]+$/,"").replace(/-_/," ")}setPromptOnRemove(e){this.dropzone.options.dictRemoveFileConfirmation=e}handleDragEnter(e){this.props.canUpload&&(this.dragging=!0,this.forceUpdate(),"function"==typeof this.props.onDragEnter&&this.props.onDragEnter(e))}handleDragLeave(e){const t=this.dropzoneRef;this.props.canUpload&&e.target===t&&(this.dragging=!1,this.forceUpdate(),"function"==typeof this.props.onDragLeave&&this.props.onDragLeave(e,t))}handleUploadProgress(e,t,n){"function"==typeof this.props.onUploadProgress&&this.props.onUploadProgress(e,t,n)}handleUploadComplete(e){"function"==typeof this.props.onUploadComplete&&this.props.onUploadComplete(e.status)}handleDrop(e){this.dragging=!1,this.forceUpdate(),"function"==typeof this.props.onDrop&&this.props.onDrop(e)}handleSending(e,t,n){"function"==typeof this.props.updateFormData&&this.props.updateFormData(n),n.append("SecurityID",this.props.securityID),n.append("ParentID",this.props.folderId);const r=Object.assign({},t,{abort:()=>{this.dropzone.cancelUpload(e),t.abort()}});"function"==typeof this.props.onSending&&this.props.onSending(e,r,n)}handleMaxFilesExceeded(e){return"function"!=typeof this.props.onMaxFilesExceeded||this.props.onMaxFilesExceeded(e)}generateQueuedId(){return c+=1,c}handleAccept(e,t){return("function"!=typeof this.props.canFileUpload||this.props.canFileUpload(e))&&this.props.canUpload?t():t(o.default._t("AssetAdmin.DROPZONE_CANNOT_UPLOAD","Uploading not permitted."))}handleAddedFile(e){e._queuedId=this.generateQueuedId();const t={category:this.getFileCategory(e.type),filename:e.name,queuedId:e._queuedId,size:e.size,title:this.getFileTitle(e.name),extension:(0,l.getFileExtension)(e.name),type:e.type,uploadedToFolderId:this.props.folderId};this.props.onAddedFile(t);return this.getLoadPreview(e).then((e=>{const n={height:e.height,width:e.width,url:e.thumbnailURL,thumbnail:e.thumbnailURL,smallThumbnail:e.thumbnailURL};return"function"==typeof this.props.onPreviewLoaded&&this.props.onPreviewLoaded(t,n),{...t,...n}}))}loadImage(e,t){return new Promise((n=>{const r=document.createElement("canvas"),o=r.getContext("2d");e.onload=()=>{const t=2*this.props.preview.width,i=2*this.props.preview.height,s=e.naturalWidth/e.naturalHeight;e.naturalWidth{this.dropzoneRef=e}},this.props.uploadButton&&r.default.createElement("button",t,o.default._t("AssetAdmin.DROPZONE_UPLOAD")),this.props.children)}}p.propTypes={folderId:a.default.number.isRequired,onAccept:a.default.func,onAddedFile:a.default.func.isRequired,onDragEnter:a.default.func,onDragLeave:a.default.func,onDrop:a.default.func,onError:a.default.func.isRequired,onPreviewLoaded:a.default.func,onSending:a.default.func,onSuccess:a.default.func.isRequired,onMaxFilesExceeded:a.default.func,updateFormData:a.default.func,canFileUpload:a.default.func,onQueueComplete:a.default.func,options:a.default.shape({url:a.default.string.isRequired}),promptOnRemove:a.default.string,securityID:a.default.string.isRequired,uploadButton:a.default.bool,uploadSelector:a.default.string,canUpload:a.default.bool.isRequired,preview:a.default.shape({width:a.default.number,height:a.default.number}),className:a.default.string},p.defaultProps={uploadButton:!0};t.default=p},7153:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=a(n(6935)),i=a(n(2932)),s=a(n(2926)),l=a(n(5815));function a(e){return e&&e.__esModule?e:{default:e}}function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}class d extends r.Component{render(){const{isDropping:e,badge:t,onClick:n}=this.props,o=["btn","btn-secondary","btn--no-text","font-icon-level-up","btn--icon-large","gallery__back"];e&&(o.push("z-depth-1"),o.push("gallery__back--droppable-hover"));const i=t?r.default.createElement(s.default,{className:"gallery__back-badge",status:t.status,message:t.message}):null;return r.default.createElement("button",{className:o.join(" "),title:l.default._t("AssetAdmin.BACK_DESCRIPTION","Navigate up a level"),onClick:n},i)}}t.Component=d,d.propTypes={onClick:o.default.func,isDropping:o.default.bool,badge:o.default.shape(s.default.propTypes)};t.default=(0,i.default)("GalleryItem")(d)},3229:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=c(n(5815)),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=n(9040),s=n(5207),l=n(3556),a=c(n(6923)),u=c(n(6935));function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}function c(e){return e&&e.__esModule?e:{default:e}}class p extends o.Component{constructor(e){super(e),this.handleChangeValue=this.handleChangeValue.bind(this),this.renderChild=this.renderChild.bind(this)}getOptionByValue(e){return this.props.actions.find((t=>t.value===e))}handleChangeValue(e){let t=null;const n=this.getOptionByValue(e.target.value);return null===n?null:(t="function"==typeof n.confirm?n.confirm(this.props.items).then((()=>n.callback(e,this.props.items))).catch((e=>{if("cancelled"!==e)throw e})):n.callback(e,this.props.items)||Promise.resolve(),t)}renderChild(e,t){const n=(0,a.default)("bulk-actions__action",e.className||"font-icon-info-circled",{btn:t<2,"bulk-actions__action--more":t>2});return t<2?o.default.createElement(l.Button,{className:n,key:e.value,onClick:this.handleChangeValue,value:e.value,color:e.color},e.label):o.default.createElement(l.DropdownItem,{type:"button",className:n,key:e.value,onClick:this.handleChangeValue,value:e.value},e.label)}render(){if(!this.props.items.length)return null;let e=this.props.actions.filter((e=>!e.canApply||e.canApply(this.props.items)));if(e=e.map(this.renderChild),!e.length)return null;const{ActionMenu:t,showCount:n}=this.props,i=r.default._t("AssetAdmin.BULK_ACTIONS_SELECT_ALL","Select all"),s=r.default.sprintf(r.default._t("AssetAdmin.BULK_ACTIONS_SELECTED","%s selected"),this.props.items.length),a=r.default._t("AssetAdmin.BULK_ACTIONS_CLEAR_SELECTION","Clear selection");return o.default.createElement("div",{className:"bulk-actions fieldholder-small"},n&&o.default.createElement(o.default.Fragment,null,o.default.createElement(l.Button,{className:"bulk-actions-counter font-icon-cross-mark",onClick:this.props.onClearSelection,title:a},s),o.default.createElement("div",{className:"bulk-actions-select-all"},o.default.createElement(l.Button,{onClick:this.props.onSelectAll},i))),e.slice(0,2),e.length>2&&t?o.default.createElement(t,{id:"BulkActions",className:"bulk-actions__more-actions-menu"},e.slice(2)):e.slice(2))}}t.Component=p,p.propTypes={items:u.default.array,actions:u.default.arrayOf(u.default.shape({value:u.default.string.isRequired,label:u.default.string.isRequired,className:u.default.string,destructive:u.default.bool,callback:u.default.func,canApply:u.default.func,confirm:u.default.func})),ActionMenu:u.default.elementType,showCount:u.default.bool,onClearSelection:u.default.func.isRequired,onSelectAll:u.default.func.isRequired},p.defaultProps={items:[],actions:[],ActionMenu:null,total:null,showCount:!0,totalReachedMessage:r.default._t("")};const f=(0,i.connect)((function(e){return{gallery:e.assetAdmin.gallery}}))(p);t.default=(0,s.inject)(["ActionMenu"],(e=>({ActionMenu:e})),(()=>"BulkActions"))(f)},1037:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Folder=t.File=t.Component=void 0;var r=E(n(5815)),o=_(n(1594)),i=E(n(6923)),s=E(n(6379)),l=E(n(6022)),a=E(n(2063)),u=E(n(2932)),d=E(n(2926)),c=E(n(1990)),p=E(n(4350)),f=n(9040),h=n(9367),m=n(4172),g=_(n(769)),y=E(n(1838)),v=E(n(6935));function b(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(b=function(e){return e?n:t})(e)}function _(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=b(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function E(e){return e&&e.__esModule?e:{default:e}}function C(){return C=Object.assign?Object.assign.bind():function(e){for(var t=1;t{e.preventDefault()};class F extends o.Component{constructor(e){super(e),this.handleSelect=this.handleSelect.bind(this),this.handleActivate=this.handleActivate.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancelUpload=this.handleCancelUpload.bind(this)}componentDidUpdate(){S(this.props)&&this.props.actions.imageLoad.loadImage(this.props.item.thumbnail,this.props.sectionConfig.imageRetry)}getThumbnailStyles(){const{item:{thumbnail:e,version:t},bustCache:n}=this.props;if(!this.isImage()||!e||this.missing())return{};const r=!1===n||!t||e.startsWith("data:image/")?e:`${e}?vid=${t}`;switch(this.props.loadState){case y.default.SUCCESS:case y.default.DISABLED:return{backgroundImage:`url(${r})`};default:return{}}}getErrorMessage(){let e=null;const{item:t,loadState:n}=this.props;if(this.hasError()?e=t.message.value:this.missing()?e=r.default._t("AssetAdmin.FILE_MISSING","File cannot be found"):n===y.default.FAILED&&(e=r.default._t("AssetAdmin.FILE_LOAD_ERROR","Thumbnail not available")),null!==e){return e=this.getItemFunction("updateErrorMessage")(e,this.props),o.default.createElement("span",{className:"gallery-item__error-message"},e)}return null}getThumbnailClassNames(){const e=["gallery-item__thumbnail"];switch(this.isImageSmallerThanThumbnail()&&e.push("gallery-item__thumbnail--small"),!this.props.item.thumbnail&&this.isImage()&&e.push("gallery-item__thumbnail--no-preview"),this.props.loadState){case y.default.LOADING:case y.default.WAITING:e.push("gallery-item__thumbnail--loading");break;case y.default.FAILED:e.push("gallery-item__thumbnail--error")}return e.join(" ")}getItemClassNames(){const e=this.props.item.category||"false",t=this.props.selectable&&(this.props.item.selected||this.props.isDragging);return(0,i.default)({"gallery-item":!0,[`gallery-item--${e}`]:!0,"gallery-item--max-selected":this.props.maxSelected&&!t,"gallery-item--missing":this.missing(),"gallery-item--selectable":this.props.selectable,"gallery-item--selected":t,"gallery-item--dropping":this.props.isDropping,"gallery-item--highlighted":this.props.item.highlighted,"gallery-item--error":this.hasError(),"gallery-item--dragging":this.props.isDragging})}getItemFunction(e){const{item:t}=this.props;return"function"==typeof t[e]?t[e]:this.props[e]}getStatusFlags(){let e=[];const{item:t}=this.props;"folder"!==t.type&&(t.draft?e.push({key:"status-draft",title:r.default._t("File.DRAFT","Draft"),className:"gallery-item--draft"}):t.modified&&e.push({key:"status-modified",title:r.default._t("File.MODIFIED","Modified"),className:"gallery-item--modified"}));return e=this.getItemFunction("updateStatusFlags")(e,this.props),o.default.createElement("div",{className:"gallery-item__status-flags"},e.map((e=>o.default.createElement("span",e))))}getStatusIcons(){const{item:e}=this.props,t=[];return e.hasRestrictedAccess&&t.push({key:"status-restricted",fileID:e.id,hasRestrictedAccess:!0,placement:"top",disableTooltip:"folder"===e.type,includeBackground:"folder"!==e.type}),e.isTrackedFormUpload&&"folder"!==e.type&&t.push({key:"status-tracked-form-upload",fileID:e.id,isTrackedFormUpload:!0,hasRestrictedAccess:e.hasRestrictedAccess,placement:"top",includeBackground:!0}),o.default.createElement("div",{className:"gallery-item__status-icons"},t.map((e=>o.default.createElement(c.default,e))))}getProgressBar(){let e=null;const{item:t}=this.props,n={className:"gallery-item__progress-bar",style:{width:`${t.progress}%`}};this.hasError()||!this.uploading()||this.complete()||(e=o.default.createElement("div",{className:"gallery-item__upload-progress"},o.default.createElement("div",n)));return e=this.getItemFunction("updateProgressBar")(e,this.props),e}isImageSmallerThanThumbnail(){if(!this.isImage()||this.missing())return!1;const e=this.props.item.width,t=this.props.item.height;return t&&e&&t0}missing(){return!this.exists()&&this.saved()}uploading(){return this.props.item.queuedId&&!this.saved()}exists(){return this.props.item.exists}isImage(){return"image"===this.props.item.category}canBatchSelect(){return this.props.selectable&&this.props.item.canEdit}hasError(){let e=!1;return this.props.item.message&&(e="error"===this.props.item.message.type),e}handleActivate(e){e.stopPropagation(),"function"==typeof this.props.onActivate&&this.saved()&&this.props.onActivate(e,this.props.item)}handleSelect(e){e.stopPropagation(),e.preventDefault(),"function"==typeof this.props.onSelect&&this.props.onSelect(e,this.props.item)}handleKeyDown(e){s.default.SPACE_KEY_CODE===e.keyCode&&(e.preventDefault(),this.canBatchSelect()&&this.handleSelect(e)),s.default.RETURN_KEY_CODE===e.keyCode&&this.handleActivate(e)}handleCancelUpload(e){e.stopPropagation(),e.preventDefault(),this.hasError()?this.props.onRemoveErroredUpload(this.props.item):this.props.onCancelUpload&&this.props.onCancelUpload(this.props.item)}render(){let e=null,t=null,n=null;const{id:i,queuedId:s}=this.props.item,l=i?`item-${i}`:`queued-${s}`;if(this.props.selectable&&(this.canBatchSelect()&&(e=this.handleSelect),t="font-icon-tick"),this.uploading())e=this.handleCancelUpload,t="font-icon-cancel";else if(this.exists()){const e=r.default._t("AssetAdmin.VIEW","View");n=o.default.createElement("div",{className:"gallery-item--overlay font-icon-eye"},e)}const a=this.props.badge,u={className:"gallery-item__checkbox",type:"checkbox",title:r.default._t("AssetAdmin.SELECT","Select"),tabIndex:-1,onMouseDown:w,id:l},c=["gallery-item__checkbox-label",t];this.canBatchSelect()||(u.disabled=!0,c.push("gallery-item__checkbox-label--disabled"));const p={className:c.join(" "),onClick:e};return o.default.createElement("div",{className:this.getItemClassNames(),"data-id":this.props.item.id,tabIndex:0,role:"button",onKeyDown:this.handleKeyDown,onClick:this.handleActivate},!!a&&o.default.createElement(d.default,{className:"gallery-item__badge",status:a.status,message:a.message}),o.default.createElement("div",{ref:e=>{this.thumbnail=e},className:this.getThumbnailClassNames(),style:this.getThumbnailStyles()},n,this.getStatusFlags(),this.getStatusIcons()),this.getProgressBar(),this.getErrorMessage(),this.props.children,o.default.createElement("div",{className:"gallery-item__title",ref:e=>{this.title=e}},o.default.createElement("label",C({},p,{htmlFor:l}),o.default.createElement("input",u)),this.props.item.title))}}t.Component=F,F.propTypes={sectionConfig:p.default,item:l.default,loadState:v.default.oneOf(Object.values(y.default)),bustCache:v.default.bool,highlighted:v.default.bool,selected:v.default.bool,isDropping:v.default.bool,isDragging:v.default.bool,message:v.default.shape({value:v.default.string,type:v.default.string}),selectable:v.default.bool,onActivate:v.default.func,onSelect:v.default.func,onCancelUpload:v.default.func,onRemoveErroredUpload:v.default.func,badge:v.default.shape({status:v.default.string,message:v.default.string}),updateStatusFlags:v.default.func,updateProgressBar:v.default.func,updateErrorMessage:v.default.func},F.defaultProps={item:{},sectionConfig:{imageRetry:{}},updateStatusFlags:e=>e,updateProgressBar:e=>e,updateErrorMessage:e=>e,bustCache:!0};const A=(0,f.connect)((function(e,t){const{bustCache:n}=e.config.sections.find((e=>"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"===e.name));let r=y.default.DISABLED;if(S(t)){const n=e.assetAdmin.imageLoad.files.find((e=>t.item.thumbnail===e.url));r=n&&n.status||y.default.NONE}return{bustCache:n,loadState:r}}),(function(e){return{actions:{imageLoad:(0,h.bindActionCreators)(g,e)}}}))(F),O="GalleryItem",I=t.File=(0,m.createSelectable)((0,a.default)(O)(A));t.Folder=(0,m.createSelectable)((0,u.default)(O)(I));t.default=A},2914:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=a(n(6935)),i=n(1820),s=a(n(2926)),l=a(n(1037));function a(e){return e&&e.__esModule?e:{default:e}}function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t1?r.default.createElement("div",{key:"1",className:"gallery-item__drag-shadow"}):null,t>2?r.default.createElement("div",{key:"2",className:"gallery-item__drag-shadow gallery-item__drag-shadow--second"}):null];return r.default.createElement("div",{className:"gallery-item__drag-layer"},r.default.createElement("div",{className:"gallery-item__drag-layer-item",style:this.getOffset()},r.default.createElement("div",{className:"gallery-item__drag-layer-preview"},n,r.default.createElement(l.default,d({},e.props,{isDragging:!0}))),t>1?r.default.createElement(s.default,{className:"gallery-item__drag-layer-count",status:"info",message:`${t}`}):null))}}c.propTypes={item:o.default.object,offset:o.default.shape({x:o.default.number.isRequired,y:o.default.number.isRequired}),isDragging:o.default.bool.isRequired};t.default=(0,i.DragLayer)((e=>({item:e.getItem(),offset:e.getInitialClientOffset(),dragged:e.getDifferenceFromInitialOffset(),isDragging:e.isDragging()})))(c)},2063:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){const t={canDrag(e){return e.canDrag},beginDrag(e){const{id:t}=e.item;"function"==typeof e.onDrag&&e.onDrag(!0,t);const n=e.selectedFiles.concat([]);return n.includes(t)||n.push(t),{selected:n,props:e}},endDrag(e){const{id:t}=e.item;"function"==typeof e.onDrag&&e.onDrag(!1,t)}},n=(0,s.DragSource)(e,t,((e,t)=>({connectDragPreview:e.dragPreview(),connectDragSource:e.dragSource(),isDragging:t.isDragging()})));return e=>{class t extends o.Component{componentDidMount(){this.props.connectDragPreview((0,l.getEmptyImage)(),{captureDraggingState:!0})}render(){const{connectDragSource:t}=this.props,n=o.default.createElement(e,this.props);return"string"==typeof n.type?t(n):t(o.default.createElement("div",{className:"gallery-item__draggable"},n))}}return t.propTypes={connectDragSource:i.default.func.isRequired,connectDragPreview:i.default.func.isRequired,item:i.default.shape({id:i.default.number.isRequired}).isRequired,onDrag:i.default.func,selectedFiles:i.default.arrayOf(i.default.number)},n(t)}};var r,o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=a(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=(r=n(6935))&&r.__esModule?r:{default:r},s=n(1820),l=n(8724);function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(a=function(e){return e?n:t})(e)}},2932:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){const t={drop(e,t){if(t.canDrop()){const n=t.getItem();e.onDropFiles(e.item.id,n.selected)}},canDrop(e,t){return!t.getItem().selected.includes(e.item.id)}},n=(0,s.DropTarget)(e,t,((e,t)=>{const n=t.isOver();return{isDropping:n&&t.canDrop(),connectDropTarget:e.dropTarget(),isOver:n}}));return e=>{class t extends o.Component{render(){const{connectDropTarget:t}=this.props,n=o.default.createElement(e,this.props);return"string"==typeof n.type?t(n):t(o.default.createElement("div",{className:"gallery-item__droppable"},n))}}return t.propTypes={connectDropTarget:i.default.func.isRequired,item:i.default.shape({id:i.default.number.isRequired}).isRequired},n(t)}};var r,o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=(r=n(6935))&&r.__esModule?r:{default:r},s=n(1820);function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}},7847:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=s(n(6935)),i=s(n(5815));function s(e){return e&&e.__esModule?e:{default:e}}function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}class a extends r.Component{constructor(){super(),this.handleCreateFolder=this.handleCreateFolder.bind(this)}handleCreateFolder(e){const{onCreateFolder:t}=this.props;e.preventDefault(),"function"==typeof t&&t()}render(){const{canEdit:e}=this.props;return r.default.createElement("button",{id:"add-folder-button",className:"btn btn-secondary font-icon-folder-add btn--icon-xl",type:"button",onClick:this.handleCreateFolder,disabled:!e},r.default.createElement("span",{className:"btn__text btn__title"},i.default._t("AssetAdmin.ADD_FOLDER_BUTTON")))}}a.propTypes={canEdit:o.default.bool.isRequired,onCreateFolder:o.default.func.isRequired};t.default=a},3577:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=s(n(6935)),i=s(n(7153));function s(e){return e&&e.__esModule?e:{default:e}}function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}class a extends r.Component{constructor(e){super(e),this.handleBackClick=this.handleBackClick.bind(this)}handleBackClick(e){const{onOpenFolder:t,folder:n}=this.props;e.preventDefault(),"function"==typeof t&&t(n.parentId)}render(){const{folder:e,badges:t,onMoveFiles:n,BackComponent:o}=this.props,{parentId:i}=e;if(null===i)return null;const s=t.find((e=>e.id===i));return r.default.createElement("div",{className:"gallery__back-container"},r.default.createElement(o,{item:{id:i},onClick:this.handleBackClick,onDropFiles:n,badge:s}))}}a.propTypes={folder:o.default.shape({id:o.default.number,title:o.default.string,parentId:o.default.number,canView:o.default.bool,canEdit:o.default.bool}).isRequired,badges:o.default.arrayOf(o.default.shape({id:o.default.number,message:o.default.node,status:o.default.string})).isRequired,onOpenFolder:o.default.func.isRequired,onMoveFiles:o.default.func.isRequired,BackComponent:o.default.oneOfType([o.default.object,o.default.func])},a.defaultProps={BackComponent:i.default};t.default=a},1859:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=s(n(5815)),i=s(n(6935));function s(e){return e&&e.__esModule?e:{default:e}}function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}class a extends r.Component{render(){const{canEdit:e}=this.props;return r.default.createElement("button",{id:"upload-button",className:"btn btn-secondary font-icon-upload btn--icon-xl",type:"button",disabled:!e},r.default.createElement("span",{className:"btn__text btn__title"},o.default._t("AssetAdmin.DROPZONE_UPLOAD")))}}a.defaultProps={canEdit:i.default.func.isRequired};t.default=a},6493:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=u(n(6935)),i=n(9040),s=u(n(3577)),l=u(n(1859)),a=u(n(7847));function u(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}class c extends r.Component{constructor(e){super(e),this.handleSelectSort=this.handleSelectSort.bind(this),this.handleViewChange=this.handleViewChange.bind(this)}handleSelectSort(e){this.props.onSort(e.currentTarget.value)}handleViewChange(e){const t=e.currentTarget.value;this.props.onViewChange(t)}renderSort(){return"tile"!==this.props.view?null:r.default.createElement("div",{className:"gallery__sort fieldholder-small"},r.default.createElement("select",{className:"dropdown no-change-track no-chzn",tabIndex:"0",style:{width:"160px"},defaultValue:this.props.sort},this.props.sorters.map((e=>{const t=e.label.replace(/^\w|[\s\-]+\w/g,(e=>e.toUpperCase()));return r.default.createElement("option",{key:`${e.field}-${e.direction}`,onClick:this.handleSelectSort,"data-field":e.field,"data-direction":e.direction,value:`${e.field},${e.direction}`},t)}))))}renderViewChangeButtons(){return["tile","table"].map((e=>{const t="table"===e?"list":"thumbnails",n=["gallery__view-change-button","btn btn-secondary","btn--icon-sm","btn--no-text"];return e===this.props.view?null:(n.push(`font-icon-${t}`),r.default.createElement("button",{id:`button-view-${e}`,key:e,className:n.join(" "),type:"button",title:"Change view gallery/list",onClick:this.handleViewChange,value:e}))}))}render(){const{badges:e,children:t,folder:n,onMoveFiles:o,onOpenFolder:i,onCreateFolder:s,BackButton:l,UploadButton:a,AddFolderButton:u}=this.props,{canEdit:d}=n;return r.default.createElement("div",{className:"toolbar--content toolbar--space-save"},r.default.createElement("div",{className:"fill-width"},r.default.createElement("div",{className:"gallery__btn-toolbar flexbox-area-grow"},r.default.createElement("div",{className:"btn-toolbar"},r.default.createElement(l,{folder:n,badges:e,onOpenFolder:i,onMoveFiles:o}),r.default.createElement(a,{canEdit:d}),r.default.createElement(u,{canEdit:d,onCreateFolder:s}),t)),r.default.createElement("div",{className:"gallery__state-buttons"},this.renderSort(),r.default.createElement("div",{className:"btn-group",role:"group","aria-label":"View mode"},this.renderViewChangeButtons()))))}}t.Component=c,c.propTypes={onMoveFiles:o.default.func.isRequired,onCreateFolder:o.default.func.isRequired,onViewChange:o.default.func.isRequired,onOpenFolder:o.default.func.isRequired,onSort:o.default.func.isRequired,folder:o.default.shape({id:o.default.number,title:o.default.string,parentId:o.default.number,canView:o.default.bool,canEdit:o.default.bool}).isRequired,view:o.default.oneOf(["tile","table"]),sort:o.default.string,badges:o.default.arrayOf(o.default.shape({id:o.default.number,message:o.default.node,status:o.default.string})),BackButton:o.default.elementType,UploadButton:o.default.elementType,AddFolderButton:o.default.elementType},c.defaultProps={view:"tile",BackButton:s.default,UploadButton:l.default,AddFolderButton:a.default};t.default=(0,i.connect)((function(e,t){let{sort:n}=t;const{badges:r,sorters:o}=e.assetAdmin.gallery;return""===n&&(n=`${o[0].field},${o[0].direction}`),{badges:r,sorters:o,sort:n}}))(c)},4333:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=f(n(5815)),o=p(n(1594)),i=n(9367),s=n(9040),l=f(n(8737)),a=p(n(2811)),u=f(n(6935)),d=n(5125);function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}function p(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function f(e){return e&&e.__esModule?e:{default:e}}class h extends o.Component{constructor(e){super(e),this.handleSubmit=this.handleSubmit.bind(this)}componentDidMount(){this.setOverrides(this.props)}componentDidUpdate(e){this.props.isOpen&&!e.isOpen&&this.setOverrides(this.props)}componentWillUnmount(){this.clearOverrides()}setOverrides(e){if(this.props.schemaUrl!==e.schemaUrl&&this.clearOverrides(),e.schemaUrl){const t=Object.assign({},e.fileAttributes);delete t.ID;const n={fields:Object.entries(t).map((e=>{const[t,n]=e;return{name:t,value:n}}))};this.props.actions.schema.setSchemaStateOverrides(e.schemaUrl,n)}}getModalProps(){const e=Object.assign({onSubmit:this.handleSubmit,onLoadingError:this.handleLoadingError,showErrorMessage:!0,responseClassBad:"alert alert-danger",identifier:"AssetAdmin.InsertEmbedModal"},this.props,{className:`insert-embed-modal ${this.props.className}`,size:"lg",onClosed:this.props.onClosed,title:this.props.targetUrl?r.default._t("AssetAdmin.EditTitle","Media from the web"):r.default._t("AssetAdmin.CreateTitle","Insert new media from the web")});return delete e.sectionConfig,delete e.onInsert,delete e.fileAttributes,e}clearOverrides(){this.props.actions.schema.setSchemaStateOverrides(this.props.schemaUrl,null)}handleLoadingError(e){"function"==typeof this.props.onLoadingError&&this.props.onLoadingError(e)}handleSubmit(e,t){switch(t){case"action_addmedia":this.props.onCreate(e);break;case"action_insertmedia":this.props.onInsert(e);break;case"action_cancel":this.props.onClosed()}return Promise.resolve()}render(){const{FormBuilderModalComponent:e}=this.props;return o.default.createElement(e,this.getModalProps())}}t.Component=h,h.propTypes={sectionConfig:u.default.shape({url:u.default.string,form:u.default.object}),isOpen:u.default.bool,onInsert:u.default.func.isRequired,onCreate:u.default.func.isRequired,fileAttributes:u.default.shape({Url:u.default.string,CaptionText:u.default.string,PreviewUrl:u.default.string,Placement:u.default.string,Width:u.default.number,Height:u.default.number}),onClosed:u.default.func.isRequired,className:u.default.string,actions:u.default.object,schemaUrl:u.default.string.isRequired,targetUrl:u.default.string,onLoadingError:u.default.func,FormBuilderModalComponent:u.default.oneOfType([u.default.object,u.default.func])},h.defaultProps={className:"",fileAttributes:{},FormBuilderModalComponent:l.default};t.default=(0,s.connect)((function(e,t){const n=e.config.sections.find((e=>"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"===e.name)),r=t.fileAttributes?t.fileAttributes.Url:"",o=n.form.remoteEditForm.schemaUrl,i=r&&(0,d.joinUrlPaths)(o,`/?embedurl=${encodeURIComponent(r)}`),s=n.form.remoteCreateForm.schemaUrl;return{sectionConfig:n,schemaUrl:i||s,targetUrl:r}}),(function(e){return{actions:{schema:(0,i.bindActionCreators)(a,e)}}}))(h)},3517:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=b(n(5815)),o=v(n(1594)),i=b(n(853)),s=b(n(6379)),l=n(9040),a=n(9367),u=n(5381),d=v(n(8795)),c=n(5716),p=b(n(3432)),f=b(n(6923)),h=b(n(6935)),m=b(n(7008)),g=b(n(7675));function y(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(y=function(e){return e?n:t})(e)}function v(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=y(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function b(e){return e&&e.__esModule?e:{default:e}}class _ extends o.Component{constructor(e){super(e),this.handleAddedFile=this.handleAddedFile.bind(this),this.handleFailedUpload=this.handleFailedUpload.bind(this),this.handleSuccessfulUpload=this.handleSuccessfulUpload.bind(this),this.handleSending=this.handleSending.bind(this),this.handleUploadProgress=this.handleUploadProgress.bind(this),this.handleUploadComplete=this.handleUploadComplete.bind(this),this.handleCancelUpload=this.handleCancelUpload.bind(this),this.handleRemoveErroredUpload=this.handleRemoveErroredUpload.bind(this),this.canFileUpload=this.canFileUpload.bind(this),this.updateFormData=this.updateFormData.bind(this),this.cacheBustUrl=this.cacheBustUrl.bind(this)}componentDidUpdate(e){(e.data.url&&this.props.data.url!==e.data.url||e.data.version&&this.props.data.version!==e.data.version)&&this.props.actions.previewField.removeFile(e.id)}componentWillUnmount(){this.props.actions.previewField.removeFile(this.props.id)}getDropzoneProps(){const e=this.props.data.uploadFileEndpoint,t=this.props.name,n={url:e&&e.url,method:e&&e.method,paramName:"Upload",clickable:!0,maxFiles:1},r={height:s.default.THUMBNAIL_HEIGHT,width:s.default.THUMBNAIL_WIDTH},o=this.props.securityID;return{name:t,className:["asset-dropzone--button","preview-image-field__container",this.props.className,this.props.extraClass].join(" "),canUpload:e&&this.canEdit(),preview:r,folderId:this.props.data.parentid,options:n,securityID:o,uploadButton:!1,onAddedFile:this.handleAddedFile,onError:this.handleFailedUpload,onSuccess:this.handleSuccessfulUpload,onSending:this.handleSending,onUploadProgress:this.handleUploadProgress,onUploadComplete:this.handleUploadComplete,canFileUpload:this.canFileUpload,updateFormData:this.updateFormData}}getButtonClasses(e){return(0,f.default)([`preview-image-field__toolbar-button--${e}`,"preview-image-field__toolbar-button"])}updateFormData(e){e.append("ID",this.props.data.id),e.append("Name",this.props.nameValue)}handleSending(e,t){this.props.actions.previewField.updateFile(this.props.id,{xhr:t})}handleSuccessfulUpload(e){const t=JSON.parse(e.xhr.response);"function"==typeof this.props.onAutofill&&(this.props.onAutofill("FileFilename",t.Filename),this.props.onAutofill("FileHash",t.Hash),this.props.onAutofill("FileVariant",t.Variant),t.Name&&this.props.onAutofill(this.props.data.nameField,t.Name))}handleFailedUpload(e,t){this.props.actions.previewField.failUpload(this.props.id,t)}handleAddedFile(e){this.props.actions.previewField.addFile(this.props.id,e)}handleRemoveErroredUpload(){if("function"==typeof this.props.onAutofill){const e=this.props.data.initialValues;this.props.onAutofill("FileFilename",e.FileFilename),this.props.onAutofill("FileHash",e.FileHash),this.props.onAutofill("FileVariant",e.FileVariant)}this.props.actions.previewField.removeFile(this.props.id)}handleCancelUpload(){this.props.upload.xhr&&this.props.upload.xhr.abort(),this.handleRemoveErroredUpload()}canFileUpload(e){const t=this.props.data.initialValues.FileFilename,n=(0,c.getFileExtension)(t),o=(0,c.getFileExtension)(e.name);if(!n||n===o)return!0;const i=r.default._t("AssetAdmin.CONFIRM_CHANGE_EXTENSION","Are you sure you want upload a file with a different extension?");return this.props.confirm(i)}preventDefault(e){e.preventDefault()}canEdit(){return!this.props.readOnly&&!this.props.disabled&&"folder"!==this.props.data.category}handleUploadProgress(e,t){this.props.actions.previewField.updateFile(this.props.id,{progress:t})}handleUploadComplete(e){this.props.actions.previewField.updateStatus(this.props.id,{status:e})}preview(e,t,n){if(e&&"image"!==e)return s.default.DEFAULT_PREVIEW;const r=t.url||n.preview||n.url;if(r){return r.startsWith("data:image/")?r:this.cacheBustUrl(r,n.version)}return null}cacheBustUrl(e){const t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"")||this.props.data.version;if(!1===this.props.bustCache||!t)return e;const n=m.default.parse(e),r={...g.default.parse(n.query),vid:t};return m.default.format({...n,search:g.default.stringify(r)})}renderImage(){const{data:e,upload:t}=this.props;if(!e.mock&&!e.exists&&!t.url)return o.default.createElement("div",{className:"editor__file-preview-message--file-missing"},r.default._t("AssetAdmin.FILE_MISSING","File cannot be found"));const{category:n,progress:i,message:s}=t,l=t.errors?t.errors[0]:null,a=t.status?t.status:null,u=this.preview(n,t,e),d=o.default.createElement("img",{alt:"preview",src:u,className:"editor__thumbnail"}),c=e.url&&!i?o.default.createElement("a",{className:"editor__file-preview-link",href:this.cacheBustUrl(e.url),target:"_blank",rel:"noopener noreferrer"},d):null,p=i>0&&i<100?o.default.createElement("div",{className:"preview-image-field__progress"},o.default.createElement("div",{className:"preview-image-field__progress-bar",style:{width:`${i}%`}})):null;let f=null;if(l||"error"===a){const e=l&&l.value?l.value:r.default._t("AssetAdmin.DROPZONE_RESPONSE_ERROR","Server responded with an error."),t=l&&l.type?l.type:"error";f=o.default.createElement("div",{className:`preview-image-field__message preview-image-field__message--${t}`},e)}else s?f=o.default.createElement("div",{className:`preview-image-field__message preview-image-field__message--${s.type}`},s.value):100===i&&"success"===a&&(f=o.default.createElement("div",{className:"preview-image-field__message preview-image-field__message--success"},r.default._t("AssetAdmin.REPlACE_FILE_SUCCESS","Upload successful, the file will be replaced when you Save."),(i||s)&&o.default.createElement("button",{onClick:this.handleCancelUpload,className:"preview-image-field__message-button btn btn-outline-light",type:"button"},r.default._t("AssetAdmin.REPLACE_FILE_UNDO","Undo"))));return o.default.createElement("div",{className:"editor__thumbnail-container"},c||d,p,f)}render(){const{AssetDropzoneComponent:e}=this.props,t=this.getDropzoneProps();if(this.canEdit())return o.default.createElement(e,t,this.renderImage());const n=["preview-image-field__container",this.props.className,this.props.extraClass];return o.default.createElement("div",{className:n.join(" ")},this.renderImage())}}t.Component=_,_.propTypes={id:h.default.string.isRequired,name:h.default.string,className:h.default.string,extraClass:h.default.string,readOnly:h.default.bool,disabled:h.default.bool,bustCache:h.default.bool,onAutofill:h.default.func,formid:h.default.string,nameValue:h.default.string,data:h.default.shape({id:h.default.number,parentid:h.default.number,version:h.default.number,url:h.default.string,mock:h.default.bool,exists:h.default.bool,preview:h.default.string,category:h.default.string,nameField:h.default.string,uploadFileEndpoint:h.default.shape({url:h.default.string.isRequired,method:h.default.string.isRequired,payloadFormat:h.default.string}),initialValues:h.default.object}).isRequired,upload:h.default.shape({url:h.default.string,progress:h.default.number,xhr:h.default.object,category:h.default.string,message:h.default.shape({type:h.default.string.isRequired,value:h.default.string.isRequired}),status:h.default.string}),actions:h.default.object,securityID:h.default.string,confirm:h.default.func,AssetDropzoneComponent:h.default.oneOfType([h.default.object,h.default.func])},_.defaultProps={extraClass:"",className:"",data:{},upload:{},confirm:e=>window.confirm(e),bustCache:!0,AssetDropzoneComponent:i.default};t.default=(0,l.connect)((function(e,t){const n=e.config.SecurityID,r=t.id,o=e.assetAdmin.previewField[r]||{},i=(0,u.formValueSelector)(t.formid,p.default),{bustCache:s}=e.config.sections.find((e=>"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"===e.name));return{securityID:n,upload:o,nameValue:i(e,"Name"),bustCache:s}}),(function(e){return{actions:{previewField:(0,a.bindActionCreators)(d,e)}}}))(_)},3965:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=l(n(1594)),o=l(n(6935)),i=n(3556),s=l(n(5815));function l(e){return e&&e.__esModule?e:{default:e}}function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{onSelect:t,currentWidth:n,originalWidth:o,width:l,text:a}=e;return r.default.createElement(i.Button,{color:"link",size:"sm",onClick:()=>t(l||o),disabled:os.default.inject(s.default._t("AssetAdmin.SET_IMAGE_SIZE_TO",'Set image size to "{preset}"'),{preset:e}))(a)),r.default.createElement("span",{"aria-hidden":"true"},a))},d=e=>{let{imageSizePresets:t,...n}=e;return t?r.default.createElement("ul",{className:"image-size-preset-list"},t.map((e=>r.default.createElement("li",{key:e.text,className:"image-size-preset-list__list-item"},r.default.createElement(u,a({},e,n)))))):null};d.propTypes={onSelect:o.default.func,imageSizePresets:o.default.arrayOf(o.default.shape({text:o.default.string,width:o.default.number})),currentWidth:o.default.number,originalWidth:o.default.number.isRequired};t.default=d},2397:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=p(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=c(n(6935)),i=n(5207),s=n(5381),l=c(n(3432)),a=n(9040),u=n(9367),d=c(n(3965));function c(e){return e&&e.__esModule?e:{default:e}}function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(p=function(e){return e?n:t})(e)}function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&this.syncFields(e,r)}syncFields(e,t){const{children:n,active:r,onAutofill:o,data:{ratio:i}}=this.props,s=0===e?1:0,l=n[e].props.name,a=n[s].props.name,u=0===e?1/i:i;o(l,t),r&&o(a,Math.round(t*u))}handlePresetSelect(e){this.syncFields(0,e);const{key:t}=this.props.children[0],n=document.getElementById(t);n&&n.focus()}handleBlur(e,t){this.setState({hasFocus:!1});const n=parseInt(t&&t.target&&t.target.value,10);(!n||n<=0)&&(t.preventDefault(),this.resetDimensions())}handleFocus(){this.setState({hasFocus:!0})}defaultWidth(){const{imageSizePresets:e,data:{originalWidth:t}}=this.props,n=e&&e.find((e=>e.default)),r=n&&n.width||t||600;return t&&t(0,r.cloneElement)(e,{onChange:(e,n)=>this.handleChange(t,e,n),onBlur:e=>this.handleBlur(t,e),onFocus:()=>this.handleFocus(),key:t},e.props.children))),!n&&r.default.createElement(d.default,{originalWidth:parseInt(t,10),currentWidth:o,imageSizePresets:i,onSelect:this.handlePresetSelect}))}}t.Component=h,h.propTypes={children:o.default.array,onAutofill:o.default.func,active:o.default.bool,data:o.default.shape({ratio:o.default.number.isRequired,isRemoteFile:o.default.bool,originalWidth:o.default.number,originalHeight:o.default.number}),current:o.default.shape({width:o.default.oneOfType([o.default.number,o.default.string]),height:o.default.oneOfType([o.default.number,o.default.string])}).isRequired,FieldGroup:o.default.elementType.isRequired,imageSizePresets:o.default.arrayOf(o.default.shape({width:o.default.number,text:o.default.string,default:o.default.bool}))},h.defaultProps={active:!0};t.default=(0,u.compose)((0,a.connect)((function(e,t){let{formid:n}=t;const r=(0,s.formValueSelector)(n,l.default),o=r(e,"Width"),i=r(e,"Height");return{current:{width:o?parseInt(o,10):void 0,heigth:i?parseInt(i,10):void 0},imageSizePresets:e.assetAdmin.modal.imageSizePresets}})),(0,i.inject)(["FieldGroup"]))(h)},9725:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.ConnectedUploadField=t.Component=void 0;var r=v(n(5815)),o=y(n(1594)),i=n(9040),s=n(9367),l=n(5207),a=v(n(6379)),u=v(n(2623)),d=v(n(6022)),c=v(n(9247)),p=y(n(1433)),f=y(n(1021)),h=v(n(6935)),m=v(n(4636));function g(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(g=function(e){return e?n:t})(e)}function y(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=g(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function v(e){return e&&e.__esModule?e:{default:e}}class b extends o.Component{constructor(e){super(e),this.getMaxFiles=this.getMaxFiles.bind(this),this.getFolderId=this.getFolderId.bind(this),this.renderChild=this.renderChild.bind(this),this.handleAddShow=this.handleAddShow.bind(this),this.handleHide=this.handleHide.bind(this),this.handleAddInsert=this.handleAddInsert.bind(this),this.handleInsertMany=this.handleInsertMany.bind(this),this.handleAddedFile=this.handleAddedFile.bind(this),this.handleSending=this.handleSending.bind(this),this.handleUploadProgress=this.handleUploadProgress.bind(this),this.handleFailedUpload=this.handleFailedUpload.bind(this),this.handleSuccessfulUpload=this.handleSuccessfulUpload.bind(this),this.handleItemRemove=this.handleItemRemove.bind(this),this.handleReplaceShow=this.handleReplaceShow.bind(this),this.handleChange=this.handleChange.bind(this),this.handleReplace=this.handleReplace.bind(this),this.canEdit=this.canEdit.bind(this),this.canAttach=this.canAttach.bind(this),this.canUpload=this.canUpload.bind(this),this.state={selecting:!1,selectingItem:null}}componentDidMount(){const{id:e,formSchemaFilesHash:t,data:n,value:r,actions:o,files:i}=this.props,s=(0,m.default)(JSON.stringify(r.Files)).toString();if(t!==s)return o.uploadField.setFormSchemaFilesHash(e,s),void o.uploadField.setFiles(e,n.files);o.uploadField.setFiles(e,i)}componentDidUpdate(e){const{id:t,formSchemaFilesHash:n,data:r,files:o,value:{Files:i},actions:{uploadField:{setFormSchemaFilesHash:s,setFiles:l}}}=this.props;(function(e,t){if(e.length!==t.length)return!0;for(let n=0;n!u.includes(e))).length)return;const d=o.map((e=>e.id));d.length===i.length&&0===d.filter((e=>!i.includes(e))).length||l(t,r.files)}getMaxFiles(){const e=this.props.data.multi?this.props.data.maxFiles:1;if(null==e)return null;const t=this.props.files.filter((e=>e.id>0&&(!e.message||"error"!==e.message.type))).length;return Math.max(e-t,0)}getMaxFilesize(){return this.props.data.maxFilesize||null}getFolderId(){const{selectingItem:e}=this.state;return e&&"object"==typeof e?e.parent.id:this.props.data.parentid||0}handleAddedFile(e){const t={...e,uploaded:!0};this.props.actions.uploadField.addFile(this.props.id,t)}handleSending(e,t){this.props.actions.uploadField.updateQueuedFile(this.props.id,e._queuedId,{xhr:t})}handleUploadProgress(e,t){this.props.actions.uploadField.updateQueuedFile(this.props.id,e._queuedId,{progress:t})}handleSuccessfulUpload(e){const t=JSON.parse(e.xhr.response);void 0===t[0].error?this.props.actions.uploadField.succeedUpload(this.props.id,e._queuedId,t[0]):this.handleFailedUpload(e)}handleFailedUpload(e,t){const n=e.xhr&&e.xhr.status?(0,c.default)(e.xhr.status,e.xhr):"";this.props.actions.uploadField.failUpload(this.props.id,e._queuedId,t,n)}handleItemRemove(e,t){this.props.actions.uploadField.removeFile(this.props.id,t)}handleReplaceShow(e,t){this.props.actions.modal.initFormStack("select","admin"),this.setState({selecting:!0,selectingItem:t})}handleChange(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.props;if("function"==typeof t.onChange){const n={Files:t.files.filter((e=>e.id)).map((e=>e.id))};t.onChange(e,{id:t.id,value:n})}}handleUploadButton(e){e.preventDefault()}handleAddShow(e){e.preventDefault(),this.props.actions.modal.initFormStack("select","admin"),this.setState({selecting:!0,selectingItem:null})}handleHide(){this.props.actions.modal.reset(),this.setState({selecting:!1,selectingItem:null})}handleAddInsert(e,t,n){return this.props.actions.uploadField.addFile(this.props.id,n),this.handleHide(),Promise.resolve({})}handleInsertMany(e,t){const{selectingItem:n}=this.state;n?this.handleReplace(e,null,t[0]):t.forEach((t=>{this.handleAddInsert(e,null,t)}))}handleReplace(e,t,n){const{selectingItem:r}=this.state,{id:o,actions:{uploadField:{addFile:i,removeFile:s}}}=this.props;if(!r)throw new Error("Tried to replace a file when none was selected.");return s(o,r),i(o,n),this.handleHide(),Promise.resolve({})}canEdit(){return!this.props.disabled&&!this.props.readOnly&&(this.props.data.canUpload||this.props.data.canAttach)}canUpload(){return this.canEdit()&&this.props.data.canUpload}canAttach(){return this.canEdit()&&this.props.data.canAttach}renderDropzone(){const{AssetDropzone:e}=this.props;if(!this.props.data.endpoints.createFile)return null;const t={height:a.default.SMALL_THUMBNAIL_HEIGHT,width:a.default.SMALL_THUMBNAIL_WIDTH},n=this.getMaxFiles(),i=this.getMaxFilesize(),s={url:this.props.data.endpoints.createFile.url,method:this.props.data.endpoints.createFile.method,paramName:"Upload",maxFiles:n,maxFilesize:i,thumbnailWidth:a.default.SMALL_THUMBNAIL_WIDTH,thumbnailHeight:a.default.SMALL_THUMBNAIL_HEIGHT},l=["uploadfield__dropzone"];if(0===n&&l.push("uploadfield__dropzone--hidden"),!this.canEdit())return this.props.files.length?null:o.default.createElement("p",null,r.default._t("AssetAdmin.EMPTY","No files"));const u=this.props.securityId,d=[];return this.canUpload()&&d.push(o.default.createElement("button",{key:"uploadbutton",type:"button",onClick:this.handleUploadButton,className:"uploadfield__upload-button"},r.default._t("AssetAdmin.UPLOADFIELD_UPLOAD_NEW","Upload new"))),this.canAttach()&&(d.length&&d.push(o.default.createElement("span",{key:"uploadjoin",className:"uploadfield__join"},r.default._t("AssetAdmin.OR","or"))),d.push(o.default.createElement("button",{key:"attachbutton",type:"button",onClick:this.handleAddShow,className:"uploadfield__add-button"},r.default._t("AssetAdmin.UPLOADFIELD_CHOOSE_EXISTING","Choose existing")))),o.default.createElement(e,{name:this.props.name,canUpload:this.canUpload(),uploadButton:!1,uploadSelector:".uploadfield__upload-button, .uploadfield__backdrop",folderId:this.props.data.parentid,onAddedFile:this.handleAddedFile,onError:this.handleFailedUpload,onSuccess:this.handleSuccessfulUpload,onSending:this.handleSending,onUploadProgress:this.handleUploadProgress,preview:t,options:s,securityID:u,className:l.join(" ")},o.default.createElement("div",{className:"uploadfield__backdrop"}),o.default.createElement("span",{className:"uploadfield__droptext"},d))}renderModal(){const{InsertMediaModal:e}=this.props,{selecting:t,selectingItem:n}=this.state,r=this.getMaxFiles(),i=this.getFolderId();return o.default.createElement(e,{title:!1,isOpen:t,onInsert:n?this.handleReplace:this.handleAddInsert,onClosed:this.handleHide,onInsertMany:this.handleInsertMany,maxFiles:n?1:r,type:"select",bodyClassName:"modal__dialog",className:"insert-media-react__dialog-wrapper",fileAttributes:n?{ID:n.id}:null,folderId:i})}renderChild(e,t){const{UploadFieldItem:n}=this.props,r={key:e.id?`file-${e.id}`:`queued-${e.queuedId}`,item:e,name:this.props.name,onRemove:this.handleItemRemove,canEdit:this.canEdit(),onView:this.handleReplaceShow},i=this.props.getItemProps(r,t,this.props);return o.default.createElement(n,i)}render(){return o.default.createElement("div",{className:"uploadfield"},this.renderDropzone(),this.props.files.map(this.renderChild),this.renderModal())}}t.Component=b,b.propTypes={id:h.default.string.isRequired,name:h.default.string.isRequired,onChange:h.default.func,value:h.default.shape({Files:h.default.arrayOf(h.default.number)}),files:h.default.arrayOf(d.default),formSchemaFilesHash:h.default.string,readOnly:h.default.bool,disabled:h.default.bool,data:h.default.shape({files:h.default.arrayOf(d.default),multi:h.default.bool,parentid:h.default.number,canUpload:h.default.bool,canAttach:h.default.bool,maxFiles:h.default.number,endpoints:h.default.object}),UploadFieldItem:h.default.elementType,AssetDropzone:h.default.elementType,InsertMediaModal:h.default.elementType,getItemProps:h.default.func},b.defaultProps={value:{Files:[]},className:"",getItemProps:e=>e};const _=t.ConnectedUploadField=(0,i.connect)((function(e,t){const n=t.id;let r=[],o=null;return e.assetAdmin&&e.assetAdmin.uploadField&&e.assetAdmin.uploadField.fields&&e.assetAdmin.uploadField.fields[n]&&(r=e.assetAdmin.uploadField.fields[n].files||[],o=e.assetAdmin.uploadField.fields[n].formSchemaFilesHash||null),{files:r,securityId:e.config.SecurityID,formSchemaFilesHash:o}}),(function(e){return{actions:{uploadField:(0,s.bindActionCreators)(p,e),modal:(0,s.bindActionCreators)(f,e)}}}))(b);t.default=(0,s.compose)((0,l.inject)(["UploadFieldItem","AssetDropzone","InsertMediaModal"]),u.default)(_)},3058:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=c(n(5815)),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=c(n(6379)),s=c(n(6022)),l=n(5716),a=c(n(6935)),u=c(n(1990));function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}function c(e){return e&&e.__esModule?e:{default:e}}class p extends o.Component{constructor(e){super(e),this.handleRemove=this.handleRemove.bind(this),this.handleItemClick=this.handleItemClick.bind(this),this.handleView=this.handleView.bind(this)}getThumbnailStyles(){if(this.isImage()&&(this.exists()||this.uploading())){return{backgroundImage:`url(${this.props.item.smallThumbnail||this.props.item.url||""})`}}return{}}getThumbnailClassNames(){const e=["uploadfield-item__thumbnail"];return this.isImageSmallerThanThumbnail()&&e.push("uploadfield-item__thumbnail--small"),e.join(" ")}getItemClassNames(){const e=["fill-width","uploadfield-item",`uploadfield-item--${this.props.item.category||"none"}`];return this.missing()&&e.push("uploadfield-item--missing"),this.hasError()&&e.push("uploadfield-item--error"),e.join(" ")}hasError(){return!!this.props.item.message&&"error"===this.props.item.message.type}isImage(){return"image"===this.props.item.category}exists(){return this.props.item.exists}uploading(){return this.props.item.queuedId&&!this.saved()}complete(){return this.props.item.queuedId&&this.saved()}saved(){return this.props.item.id>0}missing(){return!this.exists()&&this.saved()}isImageSmallerThanThumbnail(){if(!this.isImage()||this.missing())return!1;const e=this.props.item.width,t=this.props.item.height;return t&&e&&te.every((e=>e&&e.canDelete))},{value:"archive",label:o.default._t("AssetAdmin.BULK_ACTIONS_ARCHIVE","Archive"),className:"font-icon-box",destructive:!0,callback:null,canApply:e=>e.every((e=>e&&e.canDelete))},{value:"edit",label:o.default._t("AssetAdmin.BULK_ACTIONS_EDIT","Edit"),className:"font-icon-edit",destructive:!1,canApply:e=>1===e.length,callback:null},{value:"move",label:o.default._t("AssetAdmin.BULK_ACTIONS_MOVE","Move"),className:"font-icon-folder-move",canApply:e=>e.every((e=>e&&e.canEdit)),destructive:!1,callback:null},{value:"publish",label:o.default._t("AssetAdmin.BULK_ACTIONS_PUBLISH","Publish"),className:"font-icon-rocket",destructive:!1,callback:null,canApply:e=>e.some((e=>e&&e.modified))&&e.every((e=>e.canEdit&&"folder"!==e.type)),confirm:null},{value:"unpublish",label:o.default._t("AssetAdmin.BULK_ACTIONS_UNPUBLISH","Unpublish"),className:"font-icon-cancel-circled",destructive:!1,callback:null,canApply:e=>e.some((e=>e.published))&&e.every((e=>e.canEdit&&"folder"!==e.type)),confirm:null},{value:"insert",label:o.default._t("AssetAdmin.BULK_ACTIONS_INSERT","Insert"),className:"font-icon-plus-circled btn-primary",destructive:!1,callback:null,canApply:e=>e.length,confirm:null}],BULK_ACTIONS_PLACEHOLDER:o.default._t("AssetAdmin.BULK_ACTIONS_PLACEHOLDER"),SPACE_KEY_CODE:32,RETURN_KEY_CODE:13,DEFAULT_PREVIEW:"framework/client/dist/images/app_icons/generic_92.png",MODAL_MOVE:"MODAL_MOVE"}},7917:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=x(n(1594)),o=O(n(6935)),i=n(9040),s=n(9367),l=O(n(5609)),a=O(n(5815)),u=O(n(6923)),d=x(n(4201)),c=x(n(8918)),p=x(n(1369)),f=x(n(9517)),h=O(n(1869)),m=O(n(5789)),g=O(n(2294)),y=x(n(6303)),v=O(n(6175)),b=O(n(6379)),_=O(n(4350)),E=O(n(6177)),C=x(n(4461)),S=O(n(8268)),w=O(n(4014)),F=O(n(175)),A=O(n(2308));function O(e){return e&&e.__esModule?e:{default:e}}function I(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(I=function(e){return e?n:t})(e)}function x(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=I(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}class D extends r.Component{constructor(e){super(e),this.handleOpenFile=this.handleOpenFile.bind(this),this.handleCloseFile=this.handleCloseFile.bind(this),this.handleDelete=this.handleDelete.bind(this),this.doPublish=this.doPublish.bind(this),this.doUnpublish=this.doUnpublish.bind(this),this.handleUnpublish=this.handleUnpublish.bind(this),this.handleDoSearch=this.handleDoSearch.bind(this),this.handleClearSearch=this.handleClearSearch.bind(this),this.handleSubmitEditor=this.handleSubmitEditor.bind(this),this.handleOpenFolder=this.handleOpenFolder.bind(this),this.handleSort=this.handleSort.bind(this),this.handleSetPage=this.handleSetPage.bind(this),this.createEndpoint=this.createEndpoint.bind(this),this.handleBackButtonClick=this.handleBackButtonClick.bind(this),this.handleFolderIcon=this.handleFolderIcon.bind(this),this.handleBrowse=this.handleBrowse.bind(this),this.handleViewChange=this.handleViewChange.bind(this),this.handleUpload=this.handleUpload.bind(this),this.handleUploadQueue=this.handleUploadQueue.bind(this),this.handleCreateFolder=this.handleCreateFolder.bind(this),this.handleMoveFilesSuccess=this.handleMoveFilesSuccess.bind(this),this.refetchFolder=this.refetchFolder.bind(this),this.state={loading:!1,folder:null,files:[],totalCount:0,forceRefetch:!1}}componentDidMount(){this.refetchFolder()}componentDidUpdate(e){(this.props.folderId!==e.folderId||this.props.fileId!==e.fileId&&0!==this.props.fileId||this.state.forceRefetch)&&this.refetchFolder(),this.state.forceRefetch&&this.setState({forceRefetch:!1})}getFolderId(){return null!==this.props.folderId?this.props.folderId:this.state.folder?this.state.folder.id:0}refetchFolder(){const e=this.getFolderId(),t=new URLSearchParams(window.location.search),n=[];t.forEach(((e,t)=>{"page"!==t&&"filter"!==t.substring(0,6)&&"sort"!==t.substring(0,4)||n.push(`${t}=${e}`)}));let r="";n.length&&(r=`?${n.join("&")}`);const o=`${E.default.getSection("SilverStripe\\AssetAdmin\\Controller\\AssetAdminOpen").endpoints.read.url}/${e}${r}`;l.default.get(o).then((async e=>{const t=await e.json();this.setState({loading:!1,folder:t,files:t.children.nodes,totalCount:t.children.pageInfo.totalCount})})).catch((async e=>{this.setState({loading:!1,folder:null,files:[],totalCount:0});const t=await(0,w.default)(e);this.props.actions.toasts.error(t)}))}getFiles(){const{queuedFiles:e,folderId:t}=this.props,n=this.state.files,r=[...e.items.filter((e=>!(e.id&&n.find((t=>t.id===e.id))||e.hasOwnProperty("uploadedToFolderId")&&e.uploadedToFolderId!==t))),...n],o=r.filter((e=>"folder"===e.type)),i=r.filter((e=>"folder"!==e.type));return o.concat(i)}handleBrowse(e,t,n){"function"==typeof this.props.onBrowse&&(this.props.onBrowse(e,t,n),this.setState({forceRefetch:!0})),e!==this.getFolderId()&&this.props.actions.gallery.deselectFiles()}handleSetPage(e){this.handleBrowse(this.getFolderId(),this.props.fileId,Object.assign({},this.props.query,{page:e})),this.setState({forceRefetch:!0})}handleDoSearch(e){this.props.actions.gallery.deselectFiles(),this.props.actions.queuedFiles.purgeUploadQueue(),this.handleBrowse(e.currentFolderOnly?this.getFolderId():0,null,{filter:e,view:this.props.query.view})}handleClearSearch(e){this.props.actions.displaySearch.closeSearch(),this.props.actions.gallery.deselectFiles(),this.props.actions.queuedFiles.purgeUploadQueue(),this.refetchFolder();const t=this.state.folder;this.handleOpenFolder(e,t)}handleSort(e){this.handleBrowse(this.getFolderId(),this.props.fileId,{...this.props.query,sort:e,limit:void 0,page:void 0}),this.setState({forceRefetch:!0})}handleViewChange(e){this.handleBrowse(this.getFolderId(),this.props.fileId,Object.assign({},this.props.query,{view:e}))}createEndpoint(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return l.default.createEndpointFetcher(Object.assign({},e,t?{defaultData:{SecurityID:this.props.securityId}}:{}))}handleBackButtonClick(e){e.preventDefault(),this.props.actions.gallery.deselectFiles();const t=this.state.folder;t?this.handleOpenFolder(t.parentId||0):this.handleOpenFolder(0)}resetFile(e){e.queuedId&&this.props.actions.queuedFiles.removeQueuedFile(e.queuedId),this.props.fileId===e.id&&this.props.resetFileDetails(this.getFolderId(),e.id,this.props.query)}handleFolderIcon(){this.handleOpenFile(this.getFolderId())}handleOpenFile(e){this.handleBrowse(this.getFolderId(),e,this.props.query)}handleSubmitEditor(e,t,n){let r=null;if("action_insert"===t&&"select"===this.props.type){const t=this.getFiles().find((t=>t.id===parseInt(e.ID,10)));return this.props.onInsertMany(null,[t]),this.setState({forceRefetch:!0}),Promise.resolve()}if("function"==typeof this.props.onSubmitEditor){const o=this.findFile(this.props.fileId);r=this.props.onSubmitEditor(e,t,n,o)}else r=n();if(!r)throw new Error("Promise was not returned for submitting");return this.setState({forceRefetch:!0}),r.then((e=>("action_createfolder"===t?"admin"===this.props.type?this.handleOpenFile(e.record.id):this.handleOpenFolder(this.getFolderId()):"action_save"!==t&&"action_publish"!==t||this.getFolderId()===e.record.parent.id||this.handleBrowse(e.record.parent.id,e.record.id,null),e)))}handleCloseFile(){this.handleBrowse(this.getFolderId(),null,this.props.query)}handleOpenFolder(e){const{page:t,filter:n,...r}=this.props.query;this.handleBrowse(e,null,r)}handleDelete(e){this.props.actions.confirmDeletion.deleting();const t=e.map((e=>{const t=this.findFile(e);if(!t)throw new Error(`File selected for deletion cannot be found: ${e}`);return t.queuedId&&this.props.actions.queuedFiles.removeQueuedFile(t.queuedId),t})).map((e=>e.id)),n=this.state.folder,r=n?n.id:0,o=this.props.sectionConfig.endpoints.delete.url;return l.default.post(o,{ids:t},{"X-SecurityID":E.default.get("SecurityID")}).then((()=>{this.handleBrowse(r,null,this.props.query);this.props.queuedFiles.items.filter((e=>t.includes(e.id))).forEach((e=>{e.queuedId&&this.props.actions.queuedFiles.removeQueuedFile(e.queuedId)}));let e="AssetAdmin.BULK_ACTIONS_DELETE_SUCCESS_02",n="%s folders/files were successfully deleted.";this.props.sectionConfig.filesAreVersioned&&this.props.sectionConfig.archiveFiles&&(e="AssetAdmin.BULK_ACTIONS_ARCHIVE_SUCCESS_02",n="%s folders/files were successfully archived."),this.props.actions.toasts.success(a.default.sprintf(a.default._t(e,n),t.length)),this.props.actions.gallery.deselectFiles(),this.refetchFolder()})).catch((async e=>{const t=await(0,w.default)(e);this.props.actions.toasts.error(t)})).finally((()=>this.props.actions.confirmDeletion.reset()))}doUnpublish(e){const t=e.map((e=>{const t=this.findFile(e);if(!t)throw new Error(`File selected for unpublishing cannot be found: ${e}`);if("folder"===t.type)throw new Error("Cannot unpublish folders");return t})),n=t.map((e=>e.id)),r=n.map((e=>`ids[]=${e}`)).join("&");let o=`${this.props.sectionConfig.endpoints.readLiveOwnerCounts.url}?${r}`;return l.default.get(o).then((async e=>{const t=(await e.json()).filter((e=>e.count>0)),n=t.slice(0,4).map((e=>e.message)),r=t.slice(5).length;let o="";if(r>0&&(o=a.default.inject(a.default._t("AssetAdmin.BULK_OWNED_WARNING_REMAINING","And {count} other file(s)"),{count:r})),n.length){const e=[a.default.inject(a.default._t("AssetAdmin.BULK_OWNED_WARNING_HEADING","{count} file(s) are being used by other published content."),{count:n.length}),...n,o,a.default._t("AssetAdmin.BULK_OWNED_WARNING_FOOTER","Unpublishing will only remove files from the published version of the content. They will remain on the draft version. Unpublish anyway?")].filter((e=>e)).join("\n\n");if(!confirm(e))return Promise.reject()}return Promise.resolve()})).then((()=>(o=this.props.sectionConfig.endpoints.unpublish.url,l.default.post(o,{ids:n},{"X-SecurityID":E.default.get("SecurityID")}).catch((async e=>{const t=await(0,w.default)(e);this.props.actions.toasts.error(t)}))))).then((()=>(this.refetchFolder(),t))).catch((async e=>{const t=await(0,w.default)(e);return this.props.actions.toasts.error(t),[]}))}handleUnpublish(e){return this.doUnpublish(e).then((e=>{const{fileId:t}=this.props;this.refetchFolder().then((()=>{t&&e.find((e=>e.id===t))&&this.props.resetFileDetails(this.getFolderId(),t,this.props.query)}))}))}doPublish(e){const t=e.map((e=>{const t=this.findFile(e);if(!t)throw new Error(`File selected for publishing cannot be found: ${e}`);if("folder"===t.type)throw new Error("Cannot publish folders");return t})),n=t.map((e=>e.id)),r=this.props.sectionConfig.endpoints.publish.url;return l.default.post(r,{ids:n},{"X-SecurityID":E.default.get("SecurityID")}).then((()=>(t.forEach((e=>this.resetFile(e))),this.refetchFolder(),t))).catch((async e=>{const t=await(0,w.default)(e);this.props.actions.toasts.error(t)}))}findFile(e){return this.getFiles().find((t=>t.id===parseInt(e,10)))}handleUpload(){}handleUploadQueue(){this.props.fileId&&this.refetchFolder()}handleCreateFolder(){this.props.onBrowse(this.getFolderId(),null,this.props.query,b.default.ACTIONS.CREATE_FOLDER)}handleMoveFilesSuccess(e,t){this.props.queuedFiles.items.filter((e=>t.includes(e.id))).forEach((e=>{e.queuedId&&this.props.actions.queuedFiles.removeQueuedFile(e.queuedId)})),this.props.actions.gallery.deselectFiles(),this.refetchFolder()}renderGallery(){const{GalleryComponent:e}=this.props,t=this.props.sectionConfig,n=t.endpoints.createFile.url,o=t.endpoints.createFile.method,i=this.props.query&&parseInt(this.props.query.limit||t.limit,10),s=this.props.query&&parseInt(this.props.query.page||1,10),l=this.props.query&&this.props.query.sort,a=this.props.query&&this.props.query.view,u=this.props.query.filter||{},d=this.state.folder,c=this.state.loading;return r.default.createElement(e,{files:this.getFiles(),fileId:this.props.fileId,folderId:this.getFolderId(),folder:d,type:this.props.type,limit:i,page:s,totalCount:this.state.totalCount,view:a,filters:u,createFileApiUrl:n,createFileApiMethod:o,onInsertMany:this.props.onInsertMany,onPublish:this.doPublish,onUnpublish:this.doUnpublish,onOpenFile:this.handleOpenFile,onOpenFolder:this.handleOpenFolder,onSuccessfulUpload:this.handleUpload,onSuccessfulUploadQueue:this.handleUploadQueue,onCreateFolder:this.handleCreateFolder,onMoveFilesSuccess:this.handleMoveFilesSuccess,onClearSearch:this.handleClearSearch,onSort:this.handleSort,onSetPage:this.handleSetPage,onViewChange:this.handleViewChange,sort:l,sectionConfig:t,loading:c,maxFilesSelect:this.props.maxFiles,dialog:this.props.dialog})}renderEditor(){const{sectionConfig:e,viewAction:t,type:n,fileId:o,dialog:i,requireLinkText:s,fileSelected:l,EditorComponent:a}=this.props,{schemaUrl:u,targetId:d}=(0,S.default)({config:e,viewAction:t,folderId:this.getFolderId(),type:n,fileId:o});if(!u)return null;const c=[];s&&c.push({name:"requireLinkText",value:!0}),l&&c.push({name:"fileSelected",value:!0});const p={dialog:i,fileId:d,schemaUrl:u,schemaUrlQueries:c,onClose:this.handleCloseFile,onSubmit:this.handleSubmitEditor,onUnpublish:this.handleUnpublish,addToCampaignSchemaUrl:e.form.addToCampaignForm.schemaUrl};return r.default.createElement(a,p)}render(){const{folderId:e,query:t,getUrl:n,type:o,maxFiles:i,toolbarChildren:s,SearchComponent:l,BulkDeleteConfirmationComponent:a}=this.props;if(null===this.state.folder)return null;const d=Boolean(e||(0,y.hasFilters)(t.filter)),c=this.props.sectionConfig.form.fileSearchForm.schemaUrl,p=t.filter||{},f=(0,u.default)("fill-height asset-admin","select"===o&&{"asset-admin--single-select":1===i,"asset-admin--multi-select":1!==i}),h=(0,y.hasFilters)(t.filter)||this.props.showSearch,m=this.props.actions.displaySearch?this.props.actions.displaySearch.toggleSearch:void 0,b=this.state.folder,_={folder:b,query:t,getUrl:n,onBrowse:this.handleBrowse,onFolderIcon:this.handleFolderIcon};return r.default.createElement("div",{className:f},r.default.createElement(g.default,{showBackButton:d,onBackButtonClick:this.handleBackButtonClick},b&&r.default.createElement(A.default,_),r.default.createElement("div",{className:"asset-admin__toolbar-extra pull-xs-right fill-width vertical-align-items"},r.default.createElement(v.default,{toggled:h,onToggle:m}),s)),h&&r.default.createElement(l,{onSearch:this.handleDoSearch,id:"AssetSearchForm",formSchemaUrl:c,onHide:this.handleClearSearch,displayBehavior:"HIDEABLE",filters:p,name:"name"}),r.default.createElement("div",{className:"flexbox-area-grow fill-width fill-height gallery"},this.renderGallery(),this.renderEditor()),r.default.createElement(a,{onConfirm:this.handleDelete,filesAreVersioned:this.props.sectionConfig.filesAreVersioned,archiveFiles:this.props.sectionConfig.archiveFiles}))}}t.Component=D,D.propTypes={dialog:o.default.bool,sectionConfig:_.default,fileId:o.default.number,folderId:o.default.number,resetFileDetails:o.default.func,onBrowse:o.default.func,onReplaceUrl:o.default.func,onInsertMany:o.default.func,getUrl:o.default.func,query:o.default.shape({sort:o.default.string,limit:o.default.oneOfType([o.default.number,o.default.string]),page:o.default.oneOfType([o.default.number,o.default.string]),filter:o.default.object}),onSubmitEditor:o.default.func,type:o.default.oneOf(["insert-media","insert-link","select","admin"]),queuedFiles:o.default.shape({items:o.default.array.isRequired}),filesTotalCount:o.default.number,loading:o.default.bool,actions:o.default.object,maxFiles:o.default.number,fileSelected:o.default.bool,EditorComponent:o.default.oneOfType([o.default.object,o.default.func]),GalleryComponent:o.default.oneOfType([o.default.object,o.default.func]),SearchComponent:o.default.oneOfType([o.default.object,o.default.func]),BulkDeleteConfirmationComponent:o.default.oneOfType([o.default.object,o.default.func])},D.defaultProps={type:"admin",query:{sort:"",limit:null,page:0,filter:{}},maxFiles:null,EditorComponent:h.default,GalleryComponent:m.default,SearchComponent:y.default,BulkDeleteConfirmationComponent:F.default};t.default=(0,s.compose)((0,i.connect)((function(e,t){const{formSchema:n}=e.assetAdmin.modal;return{securityId:e.config.SecurityID,queuedFiles:e.assetAdmin.queuedFiles,showSearch:e.assetAdmin.displaySearch.isOpen,type:n&&n.type||t.type}}),(function(e){return{actions:{gallery:(0,s.bindActionCreators)(d,e),toasts:(0,s.bindActionCreators)(c,e),displaySearch:(0,s.bindActionCreators)(f,e),queuedFiles:(0,s.bindActionCreators)(p,e),confirmDeletion:(0,s.bindActionCreators)(C,e)}}})))(D)},2308:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=a(n(1594)),o=a(n(6935)),i=a(n(5815)),s=n(6418),l=n(6303);function a(e){return e&&e.__esModule?e:{default:e}}const u=e=>{let{folder:t,query:n,getUrl:o,onBrowse:s,onFolderIcon:a,PlainBreadcrumbComponent:u}=e;const d=function(){for(var e=arguments.length,t=new Array(e),n=0;n{e.preventDefault(),s(...t)}},c=function(){return o&&o(...arguments)},p=[{text:i.default._t("AssetAdmin.FILES","Files"),href:c(0,null,n),onClick:d(0,null,n)}];if(t&&t.id){t.ancestors&&t.ancestors.forEach((e=>{p.push({text:e.title,href:c(e.id,null,n),onClick:d(e.id,null,n)})}));const e=[{className:"icon font-icon-edit-list",onClick:e=>{e.preventDefault(),a()}}];t.hasRestrictedAccess&&e.push({nodeName:"FileStatusIcon",hasRestrictedAccess:!0}),p.push({text:t.title,href:c(t.id,null,n),onClick:d(t.id,null,n),icons:e})}return(0,l.hasFilters)(n.filter)&&p.push({text:i.default._t("LeftAndMain.SEARCHRESULTS","Search results")}),r.default.createElement(u,{multiline:!0,crumbs:p})};u.propTypes={onBrowse:o.default.func,onFolderIcon:o.default.func,getUrl:o.default.func,query:o.default.shape({sort:o.default.string,limit:o.default.oneOfType([o.default.number,o.default.string]),page:o.default.oneOfType([o.default.number,o.default.string]),filter:o.default.object,view:o.default.string}),folder:o.default.shape({id:o.default.number,title:o.default.string,ancestors:o.default.array,parentId:o.default.number,canView:o.default.bool,canEdit:o.default.bool}),PlainBreadcrumbComponent:o.default.oneOfType([o.default.object,o.default.func])},u.defaultProps={PlainBreadcrumbComponent:s.Component};t.default=u},4736:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Component=void 0,t.buildUrl=v,t.default=void 0;var r=g(n(1594)),o=n(8926),i=n(9040),s=g(n(6478)),l=h(n(7917)),a=n(5716),u=h(n(7675)),d=h(n(6379)),c=h(n(4350)),p=n(5125),f=h(n(6935));function h(e){return e&&e.__esModule?e:{default:e}}function m(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(m=function(e){return e?n:t})(e)}function g(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=m(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}const y=Object.keys(d.default.ACTIONS).map((e=>d.default.ACTIONS[e]));function v(e){let{base:t,folderId:n,fileId:r,query:o,action:i}=e;if(i&&-1===y.indexOf(i))throw new Error(`Invalid action provided: ${i}`);let s=null;s=r?(0,p.joinUrlPaths)(t,`show/${n}/${d.default.ACTIONS.EDIT_FILE}/${r}`):n?(0,p.joinUrlPaths)(t,`show/${n}`):t,i===d.default.ACTIONS.CREATE_FOLDER&&(s=(0,p.joinUrlPaths)(t,`show/${n||0}/${i}`));return o&&Object.keys(o).length>0&&(s=`${s}?${u.default.stringify(o)}`),s}class b extends r.Component{constructor(e){super(e),this.handleBrowse=this.handleBrowse.bind(this),this.handleReplaceUrl=this.handleReplaceUrl.bind(this),this.handleResetDetails=this.handleResetDetails.bind(this),this.getUrl=this.getUrl.bind(this)}getUrl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:d.default.ACTIONS.EDIT_FILE;const o=parseInt(e||0,10),i=parseInt(t||0,10),s=o!==this.getFolderId(),l=Object.assign({},n);return(s||l.page<=1)&&delete l.page,v({base:`/${this.props.sectionConfig.reactRoutePath}`,folderId:o,fileId:i,query:l,action:r})}getFolderId(){return this.props.router.params&&this.props.router.params.folderId?parseInt(this.props.router.params.folderId,10):0}getFileId(){return this.props.router.params&&this.props.router.params.fileId?parseInt(this.props.router.params.fileId,10):0}getViewAction(){return this.props.router.params&&this.props.router.params.viewAction?this.props.router.params.viewAction:d.default.ACTIONS.EDIT_FILE}getSectionProps(){return{sectionConfig:this.props.sectionConfig,type:"admin",folderId:this.getFolderId(),viewAction:this.getViewAction(),fileId:this.getFileId(),query:this.getQuery(),getUrl:this.getUrl,onBrowse:this.handleBrowse,onReplaceUrl:this.handleReplaceUrl,resetFileDetails:this.handleResetDetails}}getQuery(){return(0,a.decodeQuery)(this.props.router.location.search)}handleBrowse(e,t,n,r){const o=this.getUrl(e,t,n,r);this.props.router.navigate(o)}handleReplaceUrl(e,t,n,r){const o=this.getUrl(e,t,n,r);this.props.router.navigate(o,{replace:!0})}handleResetDetails(e,t,n){const r=this.getUrl(e,t,n),o=this.getUrl(e,null,n);this.props.router.navigate(o,{replace:!0,state:{reset:!0,resetPath:r}})}render(){const{AssetAdminComponent:e}=this.props,t=this.props.router.location.state;return t&&t&&t.reset?r.default.createElement(o.Navigate,{to:t.resetPath,replace:!0}):this.props.sectionConfig?r.default.createElement(e,this.getSectionProps()):null}}t.Component=b,b.propTypes={sectionConfig:c.default,router:s.routerPropTypes,AssetAdminComponent:f.default.oneOfType([f.default.object,f.default.func])},b.defaultProps={AssetAdminComponent:l.default};t.default=(0,s.default)((0,i.connect)((function(e){return{sectionConfig:e.config.sections.find((e=>"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"===e.name))}}))(b))},2908:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.AssetAdminStateRouter=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=u(n(6935)),i=n(9040),s=n(4736),l=u(n(6379)),a=n(1021);function u(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}const c={folderId:null,fileId:null,query:{},action:l.default.ACTIONS.EDIT_FILE};class p extends r.Component{constructor(e){super(e),this.handleBrowse=this.handleBrowse.bind(this),this.getUrl=this.getUrl.bind(this),this.state=Object.assign({},c,{folderId:e.folderId})}getUrl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l.default.ACTIONS.EDIT_FILE;const o=parseInt(e||0,10),i=parseInt(t||0,10),a=this.getFolderId(),u=o!==a&&null!==a,d=Object.assign({},n);return(u||d.page<=1)&&delete d.page,(0,s.buildUrl)({base:this.props.sectionConfig.reactRoutePath,folderId:o,fileId:i,query:d,action:r})}getFolderId(){return null===this.state.folderId?null:parseInt(this.state.folderId||0,10)}getFileId(){return parseInt(this.state.fileId||this.props.fileId||0,10)}getViewAction(){return this.state.action||l.default.ACTIONS.EDIT_FILE}getSectionProps(){const e=Object.assign({},this.props,{folderId:this.getFolderId(),fileId:this.getFileId(),viewAction:this.getViewAction(),query:this.state.query,getUrl:this.getUrl,onBrowse:this.handleBrowse});return delete e.Component,e}handleBrowse(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l.default.ACTIONS.EDIT_FILE;if(r&&-1===Object.values(l.default.ACTIONS).indexOf(r))throw new Error(`Invalid action provided: ${r}`);this.state.fileId!==t&&this.props.actions.resetFormStack(),this.setState({folderId:e,fileId:t,query:n,action:r})}render(){const e=this.getSectionProps(),t=this.props.Component;return r.default.createElement(t,e)}}function f(e){return{actions:{resetFormStack:()=>e((0,a.resetFormStack)())}}}t.AssetAdminStateRouter=p,p.propTypes={Component:o.default.elementType,sectionConfig:o.default.shape({url:o.default.string.isRequired}).isRequired,fileId:o.default.number};t.default=function(e){return(0,i.connect)((function(t){const n=t.config.sections.find((e=>"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"===e.name));return{Component:e,sectionConfig:n}}),f)(p)}},175:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=_(n(1594)),o=n(9367),i=n(9040),s=v(n(6935)),l=n(5207),a=_(n(4461)),u=_(n(762)),d=_(n(8918)),c=v(n(5815)),p=v(n(6022)),f=v(n(5609)),h=v(n(6177)),m=v(n(4014)),g=v(n(134)),y=v(n(7871));function v(e){return e&&e.__esModule?e:{default:e}}function b(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(b=function(e){return e?n:t})(e)}function _(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=b(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function E(){return E=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{LoadingComponent:t,transition:n,files:o,onModalClose:i,onCancel:s,onConfirm:l,filesAreVersioned:a,archiveFiles:d,actions:p}=e;const[v,b]=(0,r.useState)(!0),[_,E]=(0,r.useState)({});(0,r.useEffect)((()=>{const e=h.default.getSection("SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"),t=o.map((e=>e.id)).map((e=>`ids[]=${e}`)).join("&"),n=`${e.endpoints.readDescendantCounts.url}?${t}`;b(!0),f.default.get(n).then((async e=>{const t=await e.json();b(!1),E(t)})).catch((async e=>{const t=await(0,m.default)(e);p.toasts.error(t)}))}),[o]);let C=null;const S=a&&d?"AssetAdmin.ARCHIVE":"AssetAdmin.DELETE",w=a&&d?"Archive":"Delete";let F=[{label:c.default._t(S,w),handler:()=>l(o.map((e=>{let{id:t}=e;return t}))),color:"danger"},{label:c.default._t("AssetAdmin.CANCEL","Cancel"),handler:s}];if(v)C=r.default.createElement(t,null);else{const e=_.filter((e=>"folder"===e.type)).length,t=_.filter((e=>"file"===e.type)).length,n=_.reduce(((e,t)=>e+t.count),0),i={topLevelFolderCount:e,topLevelFileCount:t,descendantFileCount:n,filesAreVersioned:a,archiveFiles:d};C=r.default.createElement(y.default,i),t+n>0&&(F=[{label:c.default._t("AssetAdmin.CANCEL","Cancel"),handler:s,color:"primary"},{label:c.default._t(S,w),handler:()=>l(o.map((e=>{let{id:t}=e;return t}))),color:"danger"}])}const A=![u.CANCELING,u.DELETING].includes(n);return r.default.createElement(g.default,{body:C,isOpen:A,actions:F,onCancel:s,onClosed:i,filesAreVersioned:a,archiveFiles:d})};t.Component=C,C.propTypes={LoadingComponent:s.default.elementType,transition:s.default.oneOf(["canceling","deleting",!1]),files:s.default.arrayOf(p.default),descendantFileCounts:s.default.object,onCancel:s.default.func.isRequired,onModalClose:s.default.func.isRequired,onConfirm:s.default.func.isRequired,filesAreVersioned:s.default.bool.isRequired,archiveFiles:s.default.bool.isRequired,actions:s.default.object.isRequired};const S=(0,o.compose)((0,l.inject)(["Loading"],(e=>({LoadingComponent:e}))))(C);t.default=(0,o.compose)((0,i.connect)((e=>{let{assetAdmin:{confirmDeletion:t}}=e;return t}),(e=>({onCancel:()=>e(a.cancel()),onModalClose:()=>e(a.modalClose()),actions:{toasts:(0,o.bindActionCreators)(d,e),confirmation:(0,o.bindActionCreators)(a,e)}}))))((e=>{let{showConfirmation:t,files:n,...o}=e;return t&&n.length>0?r.default.createElement(S,E({},o,{files:n})):null}))},7871:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=s(n(5815)),o=s(n(1594)),i=s(n(6935));function s(e){return e&&e.__esModule?e:{default:e}}const l=e=>{let{topLevelFolderCount:t,topLevelFileCount:n,descendantFileCount:i,filesAreVersioned:s,archiveFiles:l}=e,a="AssetAdmin.BULK_ACTIONS_DELETE_WARNING",u="Ensure files are removed from content areas prior to deleting them, otherwise they will appear as broken links.";s&&l&&(a="AssetAdmin.BULK_ACTIONS_ARCHIVE_WARNING",u="Ensure files are removed from content areas prior to archiving them, otherwise they will appear as broken links.");const d=((e,t,n,o,i)=>{const s=t+n;if(s>0){let e="AssetAdmin.BULK_ACTIONS_DELETE_ITEMS_CONFIRM",t=["You're about to delete %s file(s) which may be used in your site's content.","Carefully check the file usage on the files before deleting the file(s)."].join(" ");return o&&i&&(e="AssetAdmin.BULK_ACTIONS_ARCHIVE_ITEMS_CONFIRM",t=["You're about to archive %s file(s) which may be used in your site's content.","Carefully check the file usage on the files before archiving the file(s)."].join(" ")),r.default.sprintf(r.default._t(e,t),s)}if(1===e){let e="AssetAdmin.BULK_ACTIONS_DELETE_FOLDER_CONFIRM",t="Are you sure you want to delete this folder?";return o&&i&&(e="AssetAdmin.BULK_ACTIONS_ARCHIVE_FOLDER_CONFIRM",t="Are you sure you want to archive this folder?"),r.default._t(e,t)}let l="AssetAdmin.BULK_ACTIONS_DELETE_FOLDERS_CONFIRM",a="Are you sure you want to delete these folders?";return o&&i&&(l="AssetAdmin.BULK_ACTIONS_ARCHIVE_FOLDERS_CONFIRM",a="Are you sure you want to archive these folders?"),r.default._t(l,a)})(t,n,i,s,l);return o.default.createElement(o.default.Fragment,null,o.default.createElement("p",null,d),n+i>0&&o.default.createElement("p",null,r.default._t(a,u)))};l.propTypes={topLevelFolderCount:i.default.number,topLevelFileCount:i.default.number,descendantFileCount:i.default.number},l.defaultProps={topLevelFolderCount:0,topLevelFileCount:0,descendantFileCount:0};t.default=l},134:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=l(n(5815)),o=l(n(1594)),i=l(n(6935)),s=n(3556);function l(e){return e&&e.__esModule?e:{default:e}}const a=e=>{let{isOpen:t,body:n,onCancel:i,actions:l,filesAreVersioned:a,archiveFiles:u}=e,d="AssetAdmin.CONFIRM_FILE_DELETION",c="Confirm deletion";return a&&u&&(d="AssetAdmin.CONFIRM_FILE_ARCHIVE",c="Confirm archive"),o.default.createElement(s.Modal,{isOpen:t,toggle:i},o.default.createElement(s.ModalHeader,{toggle:i},r.default._t(d,c)),o.default.createElement(s.ModalBody,null,n),o.default.createElement(s.ModalFooter,null,l.map((e=>{let{label:t,handler:n,color:r}=e;return o.default.createElement(s.Button,{key:t,color:r,onClick:n},t)}))))};a.propTypes={isOpen:i.default.bool.isRequired,body:i.default.node.isRequired,onCancel:i.default.func.isRequired,actions:i.default.arrayOf(i.default.shape({label:i.default.string.isRequired,handler:i.default.func,color:i.default.string})),filesAreVersioned:i.default.bool.isRequired,archiveFiles:i.default.bool.isRequired};t.default=a},1869:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=S(n(5815)),o=n(9040),i=n(9367),s=C(n(1594)),l=S(n(6379)),a=S(n(55)),u=S(n(8737)),d=C(n(9077)),c=S(n(6935)),p=n(5207),f=S(n(6177)),h=S(n(5609)),m=C(n(4461)),g=C(n(1021)),y=S(n(6923)),v=S(n(7008)),b=S(n(7675)),_=C(n(1584));function E(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(E=function(e){return e?n:t})(e)}function C(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=E(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function S(e){return e&&e.__esModule?e:{default:e}}function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;te.json())).then((e=>{this.setState({file:e})}))}getFormSchemaUrl(){const{schemaUrlQueries:e,schemaUrl:t,fileId:n}=this.props,r=v.default.parse(t),o=e.reduce(((e,t)=>{let{name:n,value:r}=t;return{...e,[n]:r}}),{});return v.default.format({...r,pathname:`${r.path}/${n}`,search:b.default.stringify(o)})}handleAction(e){const t=this.state.file;switch(e.currentTarget.name){case"action_addtocampaign":this.openModal(),e.preventDefault();break;case"action_replacefile":this.replaceFile(),e.preventDefault();break;case"action_downloadfile":this.downloadFile(),e.preventDefault();break;case"action_delete":this.props.actions.confirmDeletion.confirm([t]),e.preventDefault()}}handleCancelKeyDown(e){e.keyCode!==l.default.SPACE_KEY_CODE&&e.keyCode!==l.default.RETURN_KEY_CODE||this.handleClose(e)}handleSubmit(e,t,n){const{showingSubForm:r,actions:o}=this.props;return"function"==typeof this.props.onSubmit?this.props.onSubmit(e,t,n).finally((()=>{r&&-1!==["action_save","action_publish"].indexOf(t)&&o.modal.popFormStackEntry()})):n()}handleClose(e){const{showingSubForm:t,onClose:n,actions:r}=this.props;t?r.modal.popFormStackEntry():(n(),this.closeModal()),e&&e.preventDefault()}openModal(){this.setState({openModal:!0})}closeModal(){this.setState({openModal:!1})}replaceFile(){const e=document.querySelector(".dz-input-PreviewImage");e&&e.click()}downloadFile(){const e=this.state.file;!function(e,t){const n=document.createElement("a");n.download=t,n.href=e,document.body.appendChild(n),n.click(),document.body.removeChild(n)}(e.url,e.name),document.getElementById("Form_fileEditForm_PopoverActions").focus()}handleLoadingError(e){this.setState({loadingForm:!1,loadingError:e.errors[0]})}handleLoadingSuccess(){this.setState({loadingForm:!1,loadingError:null})}handleFetchingSchema(){this.setState({loadingForm:!0})}editorHeader(e){let{SchemaComponent:t,...n}=e;const{dialog:r,nextType:o,showingSubForm:i,actions:l,EditorHeaderComponent:a}=this.props,u=this.getFormSchemaUrl(),d=this.state.file;let c=_.buttonStates.SWITCH;r&&d&&"folder"!==d.type&&(c=i?_.buttonStates.ALWAYS_BACK:_.buttonStates.ONLY_BACK);const{formid:p}=n,f=o&&d&&"folder"!==d.type?()=>{l.modal.stashFormValues(p,u),l.modal.pushFormStackEntry(o)}:void 0,h={onCancel:this.handleClose,showButton:c,onDetails:f};return s.default.createElement(a,h,s.default.createElement(t,n))}createFn(e,t){if("AssetEditorHeaderFieldGroup"===t.name){const n=this.editorHeader,r={key:t.id,SchemaComponent:e,...t};return s.default.createElement(n,r)}return s.default.createElement(e,w({key:t.id},t))}render(){if(!this.state.file)return null;const{FormBuilderLoaderComponent:e,FormBuilderModalComponent:t}=this.props,n=this.getFormSchemaUrl(),o=`${this.props.addToCampaignSchemaUrl}/${this.props.fileId}`,i=(0,y.default)("panel","form--no-dividers","editor",{"editor--asset-dropzone--disable":!this.props.enableDropzone},this.props.className);let l=null;if(this.state.loadingError){let e=this.state.loadingError.value;404===this.state.loadingError.code&&(e=r.default._t("AssetAdmin.FILE_MISSING","File cannot be found")),e||(e=r.default._t("Admin.UNKNOWN_ERROR","An unknown error has occurred")),l=s.default.createElement("div",{className:"editor__file-preview-message--file-missing"},e)}const a=r.default._t("Admin.ADD_TO_CAMPAIGN","Add to campaign"),u=this.props.loadingComponent;return s.default.createElement("div",{className:i},s.default.createElement("div",{className:"editor__details fill-height"},s.default.createElement(e,{identifier:"AssetAdmin.EditForm",schemaUrl:n,onSubmit:this.handleSubmit,onAction:this.handleAction,onLoadingSuccess:this.handleLoadingSuccess,onLoadingError:this.handleLoadingError,onFetchingSchema:this.handleFetchingSchema,createFn:this.createFn,file:this.state.file}),l,s.default.createElement(t,{title:a,identifier:"AssetAdmin.AddToCampaign",isOpen:this.state.openModal,onClosed:this.closeModal,schemaUrl:o,bodyClassName:"modal__dialog",responseClassBad:"modal__response modal__response--error",responseClassGood:"modal__response modal__response--good"}),this.state.loadingForm&&s.default.createElement(u,null)))}}t.Component=F,F.propTypes={className:c.default.string,fileId:c.default.number.isRequired,enableDropzone:c.default.bool,dialog:c.default.bool,onClose:c.default.func.isRequired,onSubmit:c.default.func.isRequired,schemaUrl:c.default.string.isRequired,schemaUrlQueries:c.default.arrayOf(c.default.shape({name:c.default.string,value:c.default.any})),addToCampaignSchemaUrl:c.default.string,actions:c.default.object,showingSubForm:c.default.bool,nextType:c.default.string,EditorHeaderComponent:c.default.oneOfType([c.default.object,c.default.func]),FormBuilderLoaderComponent:c.default.oneOfType([c.default.object,c.default.func]),FormBuilderModalComponent:c.default.oneOfType([c.default.object,c.default.func])},F.defaultProps={EditorHeaderComponent:_.default,FormBuilderLoaderComponent:a.default,FormBuilderModalComponent:u.default};t.default=(0,i.compose)((0,p.inject)(["Loading"],(e=>({loadingComponent:e})),(()=>"AssetAdmin.Editor")),(0,o.connect)((function(e){let{assetAdmin:{gallery:t,modal:n}}=e;return{enableDropzone:t.enableDropzone,nextType:n.formSchema&&n.formSchema.nextType,showingSubForm:n.formSchemaStack&&n.formSchemaStack.length>1}}),(function(e){return{actions:{unsavedForms:(0,i.bindActionCreators)(d,e),confirmDeletion:(0,i.bindActionCreators)(m,e),modal:(0,i.bindActionCreators)(g,e)}}})))(F)},1584:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.buttonStates=void 0;var r=u(n(1594)),o=u(n(5815)),i=u(n(551)),s=u(n(2164)),l=u(n(6935)),a=u(n(6923));function u(e){return e&&e.__esModule?e:{default:e}}const d=e=>t=>{t.preventDefault(),e&&e()},c="ALWAYS_BACK",p="ALWAYS_CANCEL",f="SWITCH",h="ONLY_BACK",m="ONLY_CANCEL",g=t.buttonStates={ALWAYS_BACK:c,ALWAYS_CANCEL:p,SWITCH:f,ONLY_BACK:h,ONLY_CANCEL:m,NONE:"NONE"},y=e=>{let{onCancel:t,onDetails:n,showButton:l,children:u}=e;const g=d(t),y=[c,f,h].indexOf(l)>=0,v=[p,f,m].indexOf(l)>=0,b=(0,a.default)("editor-header__back-button","btn--icon-xl",{"editor-header__back-button--md-below":[f,h].indexOf(l)>=0}),_=(0,a.default)("editor-header__cancel-button","btn--icon-xl",{"editor-header__cancel-button--lg-above":[f,m].indexOf(l)>=0});return r.default.createElement("div",{className:"editor-header"},y&&r.default.createElement(s.default,{className:b,onClick:g}),r.default.createElement("div",{className:"editor-header__field"},u),n&&r.default.createElement(i.default,{onClick:d(n),icon:"edit-list",className:"editor-header__edit",outline:!0},o.default._t("AssetAdmin.DETAILS","Details")),v&&r.default.createElement("div",null,r.default.createElement(i.default,{icon:"cancel",className:_,noText:!0,onClick:g},o.default._t("AssetAdmin.CANCEL"))))};y.propTypes={onCancel:l.default.func,onDetails:l.default.func,showButton:l.default.oneOf(Object.keys(g).map((e=>g[e]))),children:l.default.node};t.default=y},5789:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.galleryViewPropTypes=t.galleryViewDefaultProps=t.default=t.Component=void 0;var r=x(n(1669)),o=x(n(5815)),i=I(n(1594)),s=n(9040),l=n(9367),a=x(n(853)),u=x(n(3229)),d=x(n(2853)),c=x(n(6609)),p=x(n(6379)),f=x(n(6621)),h=I(n(4201)),m=I(n(8918)),g=I(n(1369)),y=I(n(4461)),v=n(4172),b=x(n(4350)),_=x(n(6177)),E=x(n(9247)),C=n(5207),S=x(n(6935)),w=x(n(5609)),F=x(n(5769)),A=x(n(3863));function O(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(O=function(e){return e?n:t})(e)}function I(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=O(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function x(e){return e&&e.__esModule?e:{default:e}}const D={DELETE:"delete",ARCHIVE:"archive",EDIT:"edit",MOVE:"move",PUBLISH:"publish",UNPUBLISH:"unpublish",INSERT:"insert",ADMIN:"admin",SELECT:"select"};class P extends i.Component{constructor(e){super(e),this.handleOpenFolder=this.handleOpenFolder.bind(this),this.handleOpenFile=this.handleOpenFile.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleAddedFile=this.handleAddedFile.bind(this),this.handlePreviewLoaded=this.handlePreviewLoaded.bind(this),this.handleCancelUpload=this.handleCancelUpload.bind(this),this.handleRemoveErroredUpload=this.handleRemoveErroredUpload.bind(this),this.handleUploadProgress=this.handleUploadProgress.bind(this),this.handleSending=this.handleSending.bind(this),this.handleSort=this.handleSort.bind(this),this.handleSetPage=this.handleSetPage.bind(this),this.handleSuccessfulUpload=this.handleSuccessfulUpload.bind(this),this.handleQueueComplete=this.handleQueueComplete.bind(this),this.handleFailedUpload=this.handleFailedUpload.bind(this),this.handleClearSearch=this.handleClearSearch.bind(this),this.handleEnableDropzone=this.handleEnableDropzone.bind(this),this.handleMoveFiles=this.handleMoveFiles.bind(this),this.handleBulkEdit=this.handleBulkEdit.bind(this),this.handleBulkPublish=this.handleBulkPublish.bind(this),this.handleBulkUnpublish=this.handleBulkUnpublish.bind(this),this.handleBulkMove=this.handleBulkMove.bind(this),this.handleBulkInsert=this.handleBulkInsert.bind(this),this.handleBeginSelection=this.handleBeginSelection.bind(this),this.handleGroupSelect=this.handleGroupSelect.bind(this),this.handleClearSelection=this.handleClearSelection.bind(this),this.handleSelectAll=this.handleSelectAll.bind(this),this.toggleSelectConcat=this.toggleSelectConcat.bind(this),this.getSelectableFiles=this.getSelectableFiles.bind(this)}componentDidMount(){this.initSortDropdown(),window.addEventListener("keydown",this.toggleSelectConcat),window.addEventListener("keyup",this.toggleSelectConcat)}componentDidUpdate(e){this.initSortDropdown(),this.initFlushUploadFiles(e)}componentWillUnmount(){window.removeEventListener("keydown",this.toggleSelectConcat),window.removeEventListener("keyup",this.toggleSelectConcat)}initFlushUploadFiles(e){if("tile"!==this.props.view){this.getSortElement().off("change")}e.folderId!==this.props.folderId&&this.props.actions.queuedFiles.purgeUploadQueue()}getSortElement(){return(0,r.default)(this.gallery).find(".gallery__sort .dropdown")}getSearchMessage(e){const t=[];e.name&&t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGEKEYWORDS","with keywords '{name}'")),e.lastEditedFrom&&e.lastEditedTo?t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGEEDITEDBETWEEN","last edited between '{lastEditedFrom}' and '{lastEditedTo}'")):e.lastEditedFrom?t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGEEDITEDFROM","last edited after '{lastEditedFrom}'")):e.lastEditedTo&&t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGEEDITEDTO","last edited before '{lastEditedTo}'")),e.appCategory&&t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGECATEGORY","categorised as '{appCategory}'")),e.currentFolderOnly&&this.props.folder.title&&t.push(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGELIMIT","limited to the folder '{folder}'"));const n=[t.slice(0,-1).join(`${o.default._t("AssetAdmin.JOIN",",")} `),t.slice(-1)].filter((e=>e)).join(` ${o.default._t("AssetAdmin.JOINLAST","and")} `);if(""===n)return"";const r={parts:o.default.inject(n,Object.assign({folder:this.props.folder.title},e,{appCategory:e.appCategory?e.appCategory.toLowerCase():void 0}))};return o.default.inject(o.default._t("AssetAdmin.SEARCHRESULTSMESSAGE","Search results {parts}"),r)}getSelection(e,t){const n=this.getSelectableFiles(),r=[e,t].map((e=>n.findIndex((t=>t.id===e)))).filter((e=>-1!==e)).sort(((e,t)=>e-t));if(2!==r.length)return r.map((e=>n[e].id));const[o,i]=r;return n.filter(((e,t)=>t>=o&&t<=i)).map((e=>e.id))}getSelectableFiles(){const e=this.props.files.filter((e=>e.id));return this.props.type===D.SELECT?e.filter((e=>"folder"!==e.type)):e}handleBulkInsert(e,t){this.props.onInsertMany(e,t)}handleBulkPublish(e,t){const n=t.map((e=>e.id));return n.length?(this.props.actions.gallery.setLoading(!0),this.props.onPublish(n).then((e=>{this.props.actions.gallery.setLoading(!1),this.props.actions.toasts.success(o.default.sprintf(o.default._t("AssetAdmin.BULK_ACTIONS_PUBLISH_SUCCESS","%s folders/files were successfully published."),e.length)),this.props.actions.gallery.deselectFiles()}))):(this.props.actions.gallery.deselectFiles(),Promise.resolve(!0))}handleBulkUnpublish(e,t){const n=t.filter((e=>e.published)).map((e=>e.id));return n.length?(this.props.actions.gallery.setLoading(!0),this.props.onUnpublish(n).then((e=>{this.props.actions.gallery.setLoading(!1),this.props.actions.toasts.success(o.default.sprintf(o.default._t("AssetAdmin.BULK_ACTIONS_UNPUBLISH_SUCCESS","%s folders/files were successfully unpublished."),e.length)),this.props.actions.gallery.deselectFiles()}))):(this.props.actions.gallery.deselectFiles(),Promise.resolve(!0))}initSortDropdown(){if("tile"===this.props.view){const e=this.getSortElement();e.chosen({allow_single_deselect:!0,disable_search_threshold:20}),e.off("change"),e.on("change",(()=>e.find(":selected")[0].click()))}}handleSort(e){this.props.actions.queuedFiles.purgeUploadQueue(),this.props.onSort(e)}handleSetPage(e){this.props.onSetPage(e)}handleCancelUpload(e){e.xhr.abort(),this.props.actions.queuedFiles.removeQueuedFile(e.queuedId)}handleRemoveErroredUpload(e){this.props.actions.queuedFiles.removeQueuedFile(e.queuedId)}handleAddedFile(e){this.props.actions.queuedFiles.addQueuedFile(e)}handlePreviewLoaded(e,t){this.props.actions.queuedFiles.updateQueuedFile(e.queuedId,t)}handleSending(e,t){this.props.actions.queuedFiles.updateQueuedFile(e._queuedId,{xhr:t})}handleUploadProgress(e,t){this.props.actions.queuedFiles.updateQueuedFile(e._queuedId,{progress:t})}handleSuccessfulUpload(e){const t=JSON.parse(e.xhr.response);if(void 0!==t[0].error)return void this.handleFailedUpload(e);this.props.actions.queuedFiles.succeedUpload(e._queuedId,t[0]),this.props.onSuccessfulUpload&&this.props.onSuccessfulUpload(t);const n=this.props.queuedFiles.items.reduce(((e,t)=>100!==t.progress?e+1:e),0);if(!this.props.fileId&&!this.props.selectedFiles.length&&0===n){const e=t.pop();this.props.onOpenFile(e.id)}}handleQueueComplete(){this.props.onSuccessfulUploadQueue&&this.props.onSuccessfulUploadQueue()}handleFailedUpload(e,t){const n=e.xhr&&e.xhr.status?(0,E.default)(e.xhr.status,e.xhr):"";this.props.actions.queuedFiles.failUpload(e._queuedId,t,n)}itemIsSelected(e){return this.props.selectedFiles.indexOf(e)>-1}toggleSelectConcat(e){this.props.actions.gallery.setConcatenateSelect(this.isConcat(e))}isConcat(e){return e.metaKey||e.ctrlKey||e.shiftKey}itemIsHighlighted(e){return this.props.fileId===e}hasOpenedItem(){return!!this.props.fileId}handleClearSearch(e){this.props.onClearSearch(e)}handleGroupSelect(e,t){const{setSelectedFiles:n,selectFiles:r}=this.props.actions.gallery,o=this.getSelectableFiles(),i=e.filter(((t,n)=>e.indexOf(t)===n&&o.find((e=>e.id===t)))),s=this.props.concatenateSelect||this.isConcat(t);if(null!==this.props.maxFilesSelect){let e=i.length;if(s){e=this.props.selectedFiles.filter((e=>!this.props.selectedFiles.includes(e))).concat(this.props.selectedFiles).length}if(e>=this.props.maxFilesSelect)return}s?r(i):n(i)}handleClearSelection(){this.props.actions.gallery.deselectFiles()}handleSelectAll(){const e=this.props.files.map((e=>e.id));this.handleGroupSelect(e,new Event("na"))}handleBeginSelection(e){let t=e.target;for(;t;){if(t.classList.contains("griddle-footer"))return!1;if(t.classList.contains("gallery__main--selectable"))break;t=t.parentNode}return!0}handleOpenFolder(e,t){e.preventDefault(),this.props.onOpenFolder(t.id)}handleOpenFile(e,t){e.preventDefault(),null!==t.created&&(this.props.selectedFiles.length&&1!==this.props.maxFilesSelect||this.props.type!==D.SELECT||this.handleSelect(e,t),this.props.onOpenFile(t.id,t))}handleSelect(e,t){const n=this.props.maxFilesSelect;let r=this.getSelectableFiles().filter((e=>e.id===t.id)).map((e=>e.id));if(1!==n)if(-1===this.props.selectedFiles.indexOf(t.id)){e.shiftKey&&(r=this.getSelection(this.props.lastSelected,t.id));if(this.props.selectedFiles.filter((e=>!r.includes(e))).concat(r).length>n&&null!==n)return;this.props.actions.gallery.selectFiles(r),this.props.actions.gallery.setLastSelected(t.id)}else this.props.actions.gallery.deselectFiles([t.id]),e.shiftKey&&this.props.actions.gallery.setLastSelected(null);else this.props.actions.gallery.setSelectedFiles(r)}handleEnableDropzone(e){this.props.actions.gallery.setEnableDropzone(e)}handleMoveFiles(e,t){const n=this.props.sectionConfig.endpoints.move.url;return w.default.post(n,{ids:t,folderID:e},{"X-SecurityID":_.default.get("SecurityID")}).then((()=>{const n=p.default.MOVE_SUCCESS_DURATION,r=`+${t.length}`;this.props.actions.gallery.setFileBadge(e,r,"success",n),"function"==typeof this.props.onMoveFilesSuccess&&this.props.onMoveFilesSuccess(e,t)})).catch((()=>{this.props.actions.toasts.error(o.default._t("AssetAdmin.FAILED_MOVE","There was an error moving the selected items."))}))}handleBulkEdit(e,t){this.handleOpenFile(e,t[0])}handleBulkMove(){this.props.actions.gallery.activateModal(p.default.MODAL_MOVE)}renderTransitionBulkActions(){return this.renderBulkActions()}renderBulkActions(){const{type:e,dialog:t,maxFilesSelect:n,files:r,selectedFiles:o,BulkActionsComponent:s,sectionConfig:l}=this.props,a=e===D.SELECT||t?e=>e.value===D.INSERT:e=>e.value!==D.INSERT,u=l.filesAreVersioned&&l.archiveFiles?e=>e.value!==D.DELETE:e=>e.value!==D.ARCHIVE,d=p.default.BULK_ACTIONS.filter(a).filter(u).map((e=>{if(e.callback)return e;switch(e.value){case D.DELETE:case D.ARCHIVE:return{...e,callback:(e,t)=>{this.props.actions.confirmDeletion.confirm(t)},confirm:void 0};case D.EDIT:return{...e,callback:this.handleBulkEdit};case D.MOVE:return{...e,callback:this.handleBulkMove};case D.PUBLISH:return{...e,callback:this.handleBulkPublish};case D.UNPUBLISH:return{...e,callback:this.handleBulkUnpublish};case D.INSERT:return{...e,callback:this.handleBulkInsert,color:"primary"};default:return e}})),c=o.map((e=>r.find((t=>t&&e===t.id)))).filter((e=>e));return c.length>0&&[D.ADMIN,D.SELECT].includes(e)?i.default.createElement(s,{actions:d,items:c,total:n,key:c.length>0,container:this.gallery,showCount:1!==n,onClearSelection:this.handleClearSelection,onSelectAll:this.handleSelectAll}):null}renderGalleryView(){const e="table"===this.props.view?c.default:d.default,t=this.props.files.map((e=>{const t=this.itemIsSelected(e.id),n=this.itemIsHighlighted(e.id),r=(e.queuedId?`queueId${e.queuedId}`:`id${e.id}`)+(t?"--selected":"");return{...e,selected:t,highlighted:n,key:r}})),{type:n,loading:r,dialog:o,page:s,totalCount:l,limit:a,sort:u,selectedFiles:p,badges:f,maxFilesSelect:h,sectionConfig:m}=this.props,g={selectableItems:n===D.SELECT||n===D.ADMIN&&(!h||h>1),selectableFolders:n!==D.SELECT&&!o,files:t,loading:r,page:s,totalCount:l,limit:a,sort:u,selectedFiles:p,badges:f,onSort:this.handleSort,onSetPage:this.handleSetPage,onOpenFile:this.handleOpenFile,onOpenFolder:this.handleOpenFolder,onSelect:this.handleSelect,onCancelUpload:this.handleCancelUpload,onDropFiles:this.handleMoveFiles,onRemoveErroredUpload:this.handleRemoveErroredUpload,onEnableDropzone:this.handleEnableDropzone,sectionConfig:m,canDrag:n===D.ADMIN,maxFilesSelect:h};return i.default.createElement(e,g)}renderToolbar(){const{GalleryToolbar:e,sort:t,view:n,folder:r,onCreateFolder:o,onOpenFolder:s,onViewChange:l}=this.props,a={onMoveFiles:this.handleMoveFiles,onSort:this.handleSort,onCreateFolder:o,onOpenFolder:s,onViewChange:l,view:n,sort:t,folder:r};return i.default.createElement(e,a)}render(){const{folder:e,loading:t,errorMessage:n,noticeMessage:r}=this.props,s=this.props.LoadingComponent;if(!e)return n?i.default.createElement("div",{className:"gallery__error flexbox-area-grow"},i.default.createElement("div",{className:"gallery__error-message"},i.default.createElement("h3",null,o.default._t("AssetAdmin.DROPZONE_RESPONSE_ERROR","Server responded with an error.")),n&&i.default.createElement("p",null,n))):t?i.default.createElement("div",{className:"flexbox-area-grow"},i.default.createElement(s,null)):i.default.createElement("div",{className:"flexbox-area-grow"},i.default.createElement("div",{className:"editor__file-preview-message--file-missing m-t-3"},o.default._t("Admin.UNKNOWN_ERROR","An unknown error has occurred")));const l=i.default.createElement("div",{className:"gallery_messages"},n&&i.default.createElement(f.default,{value:n,type:"danger"}),r&&i.default.createElement(f.default,{value:r,type:"success"})),u={height:p.default.THUMBNAIL_HEIGHT,width:p.default.THUMBNAIL_WIDTH},d={url:this.props.createFileApiUrl,method:this.props.createFileApiMethod,paramName:"Upload",clickable:"#upload-button",...this.props.sectionConfig.dropzoneOptions},c=this.props.securityId,h=this.props.folder.canEdit&&this.props.enableDropzone,m=["panel","panel--padded","panel--scrollable","gallery__main","fill-height"];this.props.type===D.INSERT&&m.push("insert-media-modal__main");const g=m;return this.hasOpenedItem()&&g.push("gallery__main--has-opened-item"),i.default.createElement("div",{className:"flexbox-area-grow gallery__outer",ref:e=>{this.gallery=e}},this.renderTransitionBulkActions(),i.default.createElement(A.default,{className:m.join(" ")},this.renderToolbar(),i.default.createElement(v.SelectableGroup,{enabled:"tile"===this.props.view&&this.props.type===D.ADMIN,className:"flexbox-area-grow fill-height gallery__main--selectable",onSelection:this.handleGroupSelect,onNonItemClick:this.handleClearSelection,onBeginSelection:this.handleBeginSelection,preventDefault:!1,fixedPosition:!0},i.default.createElement(a.default,{name:"gallery-container",className:"flexbox-area-grow",canUpload:h,onAddedFile:this.handleAddedFile,onPreviewLoaded:this.handlePreviewLoaded,onError:this.handleFailedUpload,onSuccess:this.handleSuccessfulUpload,onQueueComplete:this.handleQueueComplete,onSending:this.handleSending,onUploadProgress:this.handleUploadProgress,preview:u,folderId:this.props.folderId,options:d,securityID:c,uploadButton:!1},l,this.renderGalleryView()))),this.props.loading&&i.default.createElement(s,null),i.default.createElement(F.default,{sectionConfig:this.props.sectionConfig,folderId:this.props.folderId,onSuccess:this.props.onMoveFilesSuccess,onOpenFolder:this.props.onOpenFolder}))}}t.Component=P;const M={page:1,limit:15},R={sectionConfig:b.default,loading:S.default.bool,sort:S.default.string,files:S.default.arrayOf(S.default.shape({id:S.default.number,parent:S.default.shape({id:S.default.number})})).isRequired,selectedFiles:S.default.arrayOf(S.default.number),totalCount:S.default.number,page:S.default.number,limit:S.default.number,badges:S.default.arrayOf(S.default.shape({id:S.default.number,message:S.default.node,status:S.default.string})),onOpenFile:S.default.func.isRequired,onOpenFolder:S.default.func.isRequired,onSort:S.default.func.isRequired,onSetPage:S.default.func.isRequired,maxFilesSelect:S.default.number};t.galleryViewDefaultProps=Object.assign({},M,{selectableItems:!1}),t.galleryViewPropTypes=Object.assign({},R,{selectableItems:S.default.bool,selectableFolders:S.default.bool,onSelect:S.default.func,onCancelUpload:S.default.func,onRemoveErroredUpload:S.default.func,onEnableDropzone:S.default.func});P.defaultProps=Object.assign({},M,{type:D.ADMIN,view:"tile",enableDropzone:!0,dialog:!1,BulkActionsComponent:u.default}),P.propTypes=Object.assign({},R,{onSuccessfulUpload:S.default.func,onSuccessfulUploadQueue:S.default.func,onCreateFolder:S.default.func,onMoveFilesSuccess:S.default.func,onPublish:S.default.func,onUnpublish:S.default.func,type:S.default.oneOf(["insert-media","insert-link",D.SELECT,D.ADMIN]),view:S.default.oneOf(["tile","table"]),lastSelected:S.default.number,dialog:S.default.bool,fileId:S.default.number,folderId:S.default.number.isRequired,folder:S.default.shape({id:S.default.number,title:S.default.string,parentId:S.default.number,canView:S.default.bool,canEdit:S.default.bool}),files:S.default.array,errorMessage:S.default.string,actions:S.default.object,securityId:S.default.string,onViewChange:S.default.func.isRequired,createFileApiUrl:S.default.string,createFileApiMethod:S.default.string,search:S.default.object,enableDropzone:S.default.bool,concatenateSelect:S.default.bool,GalleryToolbar:S.default.elementType,sorters:S.default.arrayOf(S.default.shape({field:S.default.string.isRequired,direction:S.default.oneOf(["asc","desc"]).isRequired,label:S.default.string.isRequired})).isRequired,BulkActionsComponent:S.default.oneOfType([S.default.object,S.default.func])});t.default=(0,l.compose)((0,C.inject)(["GalleryToolbar","Loading"],((e,t)=>({GalleryToolbar:e,LoadingComponent:t})),(()=>"AssetAdmin.Gallery")),(0,s.connect)((function(e,t){let{sort:n}=t;const{selectedFiles:r,errorMessage:o,noticeMessage:i,enableDropzone:s,badges:l,concatenateSelect:a,loading:u,sorters:d,lastSelected:c}=e.assetAdmin.gallery;return!n&&d&&d[0]&&(n=`${d[0].field},${d[0].direction}`),{lastSelected:c,selectedFiles:r,errorMessage:o,noticeMessage:i,enableDropzone:s,badges:l,concatenateSelect:a,loading:t.loading||u,queuedFiles:e.assetAdmin.queuedFiles,securityId:e.config.SecurityID,sorters:d,sort:n}}),(function(e){return{actions:{gallery:(0,l.bindActionCreators)(h,e),toasts:(0,l.bindActionCreators)(m,e),queuedFiles:(0,l.bindActionCreators)(g,e),confirmDeletion:(0,l.bindActionCreators)(y,e)}}})))(P)},3863:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=a(n(6923)),i=a(n(2914)),s=a(n(6935)),l=a(n(5799));function a(e){return e&&e.__esModule?e:{default:e}}function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}class d extends r.Component{constructor(e){super(e),this.state={dragging:!1},this.mounted=!1,this.handleDrop=this.handleDrop.bind(this)}componentDidMount(){this.mounted=!0,window.addEventListener("drop",this.handleDrop,!0)}componentDidUpdate(){setTimeout((()=>{if(!this.mounted||!this.context.dragDropManager)return;const e=this.context.dragDropManager.monitor.isDragging();this.state.dragging!==e&&this.setState({dragging:e})}))}componentWillUnmount(){this.mounted=!1,window.removeEventListener("drop",this.handleDrop,!0)}handleDrop(){const e=this.context.dragDropManager,t=e&&e.backend;t&&t.isDraggingNativeItem()&&t.endDragNativeItem()}render(){const{className:e,children:t}=this.props;return r.default.createElement("div",{className:(0,o.default)(e,{"gallery__main--dragging":this.state.dragging})},t,r.default.createElement(i.default,null))}}d.contextTypes={dragDropManager:s.default.object},d.propTypes={className:s.default.string,children:s.default.oneOfType([s.default.arrayOf(s.default.node),s.default.node])};t.default=(0,l.default)(d)},9478:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=s(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var l=o?Object.getOwnPropertyDescriptor(e,i):null;l&&(l.get||l.set)?Object.defineProperty(r,i,l):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=(r=n(6935))&&r.__esModule?r:{default:r};function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(s=function(e){return e?n:t})(e)}class l extends o.Component{constructor(e){super(e),this.handleClick=this.handleClick.bind(this)}handleClick(e){e.preventDefault(),"function"==typeof this.props.onClick&&this.props.onClick(this.props.versionid)}render(){let e=null;return"Published"===this.props.status&&(e=o.default.createElement("p",null,o.default.createElement("span",{className:"history-item__status-flag"},this.props.status)," at ",this.props.date_formatted)),o.default.createElement("li",{className:"list-group-item history-item",onClick:this.handleClick},o.default.createElement("p",null,o.default.createElement("span",{className:"history-item__version"},"v.",this.props.versionid),o.default.createElement("span",{className:"history-item__date"},this.props.date_ago," ",this.props.author),this.props.summary),e)}}l.propTypes={versionid:i.default.number.isRequired,summary:i.default.oneOfType([i.default.bool,i.default.string]).isRequired,status:i.default.string,author:i.default.string,date_formatted:i.default.string,date_ago:i.default.string,onClick:i.default.func};t.default=l},9005:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=n(9040),i=d(n(5609)),s=d(n(6177)),l=d(n(9478)),a=d(n(55)),u=d(n(6935));function d(e){return e&&e.__esModule?e:{default:e}}function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t1&&void 0!==arguments[1])||arguments[1];return i.default.createEndpointFetcher(Object.assign({},e,t?{defaultData:{SecurityID:s.default.get("SecurityID")}}:{}))}(e.sectionConfig.endpoints.history)}componentDidMount(){this.refreshHistoryIfNeeded()}componentDidUpdate(e){this.refreshHistoryIfNeeded(e)}componentWillUnmount(){clearTimeout(this.timer),this.timer=null}refreshHistoryIfNeeded(e){if(!e&&!this.state.loadedDetails||this.props.data.fileId!==e.data.fileId||this.props.data.latestVersionId!==e.data.latestVersionId){this.setState({loadedDetails:!1});const t=this.props?this.props.data.fileId:e.data.fileId;clearTimeout(this.timer),this.timer=setTimeout((()=>{this.api({fileId:t}).then((e=>{this.timer&&this.setState({history:e,loadedDetails:!0})}))}),250)}}handleClick(e){this.setState({viewDetails:e})}handleBack(e){e.preventDefault(),this.setState({viewDetails:null})}render(){if(!this.state.loadedDetails)return r.default.createElement("div",{className:"history-list history-list--loading"},"Loading...");if(this.state.viewDetails){const e=[this.props.historySchemaUrl,this.props.data.fileId,this.state.viewDetails].join("/"),t=["btn","btn-secondary","btn--icon-xl","btn--no-text","font-icon-left-open-big","history-list__back"].join(" ");return r.default.createElement("div",{className:"history-list"},r.default.createElement("a",{href:"#",className:t,onClick:this.handleBack}),r.default.createElement(a.default,{identifier:"AssetAdmin.HistoryList",schemaUrl:e,formTag:"div"}))}const e=this.state.history||[];return r.default.createElement("div",{className:"history-list"},r.default.createElement("ul",{className:"list-group list-group-flush history-list__list"},e.map((e=>r.default.createElement(l.default,p({key:e.versionid},e,{onClick:this.handleClick}))))))}}t.Component=f,f.propTypes={sectionConfig:u.default.shape({form:u.default.object,historyEndpoint:u.default.shape({url:u.default.string,method:u.default.string,responseFormat:u.default.string})}),historySchemaUrl:u.default.string,data:u.default.object},f.defaultProps={data:{fieldId:0}};t.default=(0,o.connect)((function(e){const t=e.config.sections.find((e=>"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"===e.name));return{sectionConfig:t,historySchemaUrl:t.form.fileHistoryForm.schemaUrl}}))(f)},6931:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=b(n(5815)),o=v(n(1594)),i=n(9367),s=n(9040),l=b(n(7917)),a=b(n(2908)),u=b(n(1957)),d=v(n(4201)),c=v(n(1021)),p=b(n(8737)),f=b(n(6923)),h=b(n(6935)),m=b(n(8268)),g=b(n(7675));function y(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(y=function(e){return e?n:t})(e)}function v(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=y(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function b(e){return e&&e.__esModule?e:{default:e}}class _ extends o.Component{constructor(e){super(e),this.handleSubmit=this.handleSubmit.bind(this)}componentDidMount(){const{isOpen:e,onBrowse:t,setOverrides:n,fileAttributes:r,folderId:o}=this.props;e?"function"==typeof n&&r.ID&&(n(this.props),t(o,r.ID)):t(o||0)}componentDidUpdate(e){!this.props.isOpen&&e.isOpen&&(this.props.onBrowse(this.props.folderId),this.props.actions.gallery.deselectFiles()),"function"==typeof e.setOverrides&&this.props.isOpen&&!e.isOpen&&(e.setOverrides(this.props),this.props.onBrowse(this.props.folderId,this.props.fileAttributes?this.props.fileAttributes.ID:null))}getSectionProps(){return{...this.props,dialog:!0,toolbarChildren:this.renderToolbarChildren(),onSubmitEditor:this.handleSubmit,onReplaceUrl:this.props.onBrowse}}getModalProps(){const{onHide:e,onInsert:t,sectionConfig:n,schemaUrl:r,className:o,...i}=this.props;return{...i,className:(0,f.default)("insert-media-modal",o),size:"lg",showCloseButton:!1}}handleSubmit(e,t,n,r){return"action_insert"===t?this.props.onInsert(e,r):n()}renderToolbarChildren(){return o.default.createElement("button",{type:"button",className:"close modal__close-button insert-media-modal__close-button",onClick:this.props.onClosed,"aria-label":r.default._t("FormBuilderModal.CLOSE","Close")},o.default.createElement("span",{"aria-hidden":"true"},"×"))}render(){const e=this.getModalProps(),t=this.getSectionProps(),n=this.props.isOpen?o.default.createElement(l.default,t):null;return o.default.createElement(p.default,e,n)}}t.Component=_,_.propTypes={sectionConfig:h.default.shape({url:h.default.string,form:h.default.object}),type:h.default.oneOf(["insert-media","insert-link","select","admin"]),schemaUrl:h.default.string,isOpen:h.default.bool,setOverrides:h.default.func,onInsert:h.default.func.isRequired,fileAttributes:h.default.shape({ID:h.default.number,AltText:h.default.string,Width:h.default.number,Height:h.default.number,Loading:h.default.string,TitleTooltip:h.default.string,Alignment:h.default.string,Description:h.default.string,TargetBlank:h.default.bool}),requireLinkText:h.default.bool,folderId:h.default.number,fileId:h.default.number,viewAction:h.default.string,query:h.default.object,getUrl:h.default.func,onBrowse:h.default.func.isRequired,onClosed:h.default.func,className:h.default.string,actions:h.default.object,maxFiles:h.default.number,fileSelected:h.default.bool},_.defaultProps={className:"",fileAttributes:{},type:"insert-media",folderId:0,maxFiles:1};t.default=(0,i.compose)(a.default,(0,s.connect)((function(e,t){const n=t.sectionConfig;if(!n)return{};let r=0;null!==t.folderId?r=t.folderId:t.folder&&(r=t.folder.id);const o=t.fileAttributes?t.fileAttributes.ID:t.fileId,i=e.assetAdmin.modal.formSchema,s={config:n,viewAction:t.viewAction,folderId:r,type:i&&i.type,fileId:o},{schemaUrl:l,targetId:a}=(0,m.default)(s);if(!l)return{};const u={};t.requireLinkText&&(u.requireLinkText=!0),t.fileSelected&&(u.fileSelected=!0);let d=g.default.stringify(u);return d=d?`?${d}`:"",{schemaUrl:`${l}/${a}${d}`,type:i&&i.type}}),(function(e){return{actions:{gallery:(0,i.bindActionCreators)(d,e),modal:(0,i.bindActionCreators)(c,e)}}})),u.default)(_)},5769:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=m(n(1594)),o=n(9040),i=n(9367),s=m(n(5815)),l=m(n(6379)),a=m(n(6935)),u=n(4201),d=n(8918),c=m(n(8737)),p=m(n(4350)),f=m(n(6177)),h=m(n(5609));function m(e){return e&&e.__esModule?e:{default:e}}class g extends r.default.Component{constructor(e){super(e),this.handleSubmit=this.handleSubmit.bind(this),this.timeout=null}handleSubmit(e){let{FolderID:t}=e;const{selectedFiles:n,onSuccess:r,onClosed:o,setNotice:i,setError:a,setBadge:u}=this.props;let d=this.props.sectionConfig.endpoints.move.url;return h.default.post(d,{ids:n,folderID:t},{"X-SecurityID":f.default.get("SecurityID")}).then((()=>(d=`${this.props.sectionConfig.endpoints.read.url}/${t}`,h.default.get(d)))).then((e=>e.json())).then((e=>{"function"==typeof r&&r(e.id,n),u(e.id,`${n.length}`,"success",l.default.MOVE_SUCCESS_DURATION),i(s.default.sprintf(s.default._t("AssetAdmin.MOVED_ITEMS_TO","Moved %s item(s) to %s"),n.length,e.name),[{label:s.default._t("AssetAdmin.GO_TO_FOLDER","Go to folder"),onClick:()=>this.props.onOpenFolder(e.id)}]),o()})).catch((()=>{a(s.default._t("AssetAdmin.FAILED_MOVE","There was an error moving the selected items."))}))}render(){const{isOpen:e,onClosed:t,title:n,folderId:o,sectionConfig:i}=this.props,{schemaUrl:s}=i.form.moveForm;return r.default.createElement(c.default,{title:n,isOpen:e,onClosed:t,onSubmit:this.handleSubmit,identifier:"AssetAdmin.MoveForm",schemaUrl:`${s}/${o}`})}}g.propTypes={sectionConfig:p.default,folderId:a.default.number.isRequired,isOpen:a.default.bool,onClosed:a.default.func,setNotice:a.default.func,setBadge:a.default.func,setError:a.default.func,title:a.default.string,onSuccess:a.default.func,onOpenFolder:a.default.func.isRequired,selectedFiles:a.default.array.isRequired},g.defaultProps={isOpen:!1};t.default=(0,i.compose)((0,o.connect)((function(e){const{modal:t,selectedFiles:n}=e.assetAdmin.gallery;return{isOpen:t===l.default.MODAL_MOVE,selectedFiles:n,title:s.default.sprintf(s.default._t("AssetAdmin.MOVE_ITEMS_TO","Move %s item(s) to..."),n.length)}}),(function(e){return{onClosed(){e((0,u.deactivateModal)())},setNotice(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];e((0,d.display)({text:t,type:"success",actions:n}))},setError(t){e((0,d.display)({text:t,type:"error"}))},setBadge(){e((0,u.setFileBadge)(...arguments))}}})))(g)},6609:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=f(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),o=p(n(6935)),i=p(n(9888)),s=p(n(5815)),l=p(n(1990)),a=n(5789),u=n(5716),d=n(5207),c=n(9367);function p(e){return e&&e.__esModule?e:{default:e}}function f(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(f=function(e){return e?n:t})(e)}class h extends r.Component{constructor(e){super(e),this.getColumns=this.getColumns.bind(this),this.handleSort=this.handleSort.bind(this),this.handleSetPage=this.handleSetPage.bind(this),this.handleRowClick=this.handleRowClick.bind(this),this.renderSelect=this.renderSelect.bind(this),this.renderTitle=this.renderTitle.bind(this),this.renderStatus=this.renderStatus.bind(this),this.renderNoItemsNotice=this.renderNoItemsNotice.bind(this)}getColumns(){const e=["thumbnail","title","status","size","lastEdited"];return this.props.selectableItems&&e.unshift("selected"),e}getColumnConfig(){return[{columnName:"selected",sortable:!1,displayName:"",cssClassName:"gallery__table-column--select",customComponent:this.renderSelect},{columnName:"thumbnail",sortable:!1,displayName:"",cssClassName:"gallery__table-column--image",customComponent:this.renderThumbnail},{columnName:"title",customCompareFn:()=>0,displayName:s.default._t("File.TITLE","Title"),cssClassName:"gallery__table-column--title",customComponent:this.renderTitle},{columnName:"status",sortable:!1,cssClassName:"sort--disabled",customComponent:this.renderStatus,displayName:s.default._t("File.STATUS","Status")},{columnName:"lastEdited",displayName:s.default._t("File.MODIFIED","Modified"),customComponent:this.renderDate},{columnName:"size",sortable:!1,displayName:s.default._t("File.SIZE","Size"),cssClassName:"sort--disabled",customComponent:this.renderSize}]}getRowMetadata(e){return"gallery__table-row "+(e.highlighted?"gallery__table-row--highlighted":"")}getTableProps(){const[e,t]=this.props.sort.split(",");return{tableClassName:"gallery__table table table-hover",gridClassName:"gallery__main-view--table",rowMetadata:{bodyCssClassName:this.getRowMetadata,key:"key"},sortAscendingComponent:"",sortDescendingComponent:"",useExternal:!0,externalSetPage:this.handleSetPage,externalChangeSort:this.handleSort,externalSetFilter:()=>null,externalSetPageSize:()=>null,externalCurrentPage:this.props.page-1,externalMaxPage:Math.ceil(this.props.totalCount/this.props.limit),externalSortColumn:e,externalSortAscending:"asc"===t,initialSort:e,columns:this.getColumns(),columnMetadata:this.getColumnConfig(),useGriddleStyles:!1,onRowClick:this.handleRowClick,results:this.props.files,customNoDataComponent:this.renderNoItemsNotice}}handleActivate(e,t){"folder"===t.type?this.props.onOpenFolder(e,t):this.props.onOpenFile(e,t)}handleRowClick(e,t){const n=e.props.data;t.currentTarget.classList.contains("gallery__table-column--select")&&(t.stopPropagation(),t.preventDefault(),"function"==typeof this.props.onSelect)?this.props.onSelect(t,n):this.handleActivate(t,n)}handleSort(e,t){const n=t?"asc":"desc";this.props.onSort(`${e},${n}`)}handleSetPage(e){this.props.onSetPage(e+1)}preventFocus(e){e.preventDefault()}renderNoItemsNotice(){return 0!==this.props.files.length||this.props.loading?null:r.default.createElement("p",{className:"gallery__no-item-notice"},s.default._t("AssetAdmin.NOITEMSFOUND"))}renderSize(e){if("folder"===e.rowData.type)return null;const t=(0,u.fileSize)(e.data);return r.default.createElement("span",null,t)}renderStatus(e){let t=[];const n=e.rowData,{VersionedBadge:o}=this.props;return"folder"!==n.type&&(n.draft?t.push({key:"status-draft",status:"draft"}):n.modified&&t.push({key:"status-modified",status:"modified"})),t=t.map((e=>{let{...t}=e;return r.default.createElement(o,t)})),t?r.default.createElement("span",null,t):null}renderProgressBar(e){if(!e.queuedId||e.message&&"error"===e.message.type)return null;if(e.id>0)return r.default.createElement("div",{className:"gallery__progress-bar--complete"});const t={className:"gallery__progress-bar-progress",style:{width:`${e.progress}%`}};return r.default.createElement("div",{className:"gallery__progress-bar"},r.default.createElement("div",t))}renderRestrictedAccess(e){const{hasRestrictedAccess:t}=e,n={fileID:e.id,placement:"top",hasRestrictedAccess:t};return r.default.createElement(l.default,n)}renderTrackedFormUpload(e){const{isTrackedFormUpload:t,hasRestrictedAccess:n}=e,o={fileID:e.id,placement:"top",isTrackedFormUpload:t,hasRestrictedAccess:n};return r.default.createElement(l.default,o)}renderTitle(e){const t=this.renderProgressBar(e.rowData);return r.default.createElement("div",{className:"fill-width"},r.default.createElement("div",{className:"flexbox-area-grow"},r.default.createElement("span",null,e.data),e.rowData.hasRestrictedAccess&&this.renderRestrictedAccess(e.rowData),e.rowData.isTrackedFormUpload&&this.renderTrackedFormUpload(e.rowData)),t)}renderSelect(e){if(this.props.selectableItems&&(this.props.selectableFolders||"folder"!==e.rowData.type)){const t={type:"checkbox",title:s.default._t("AssetAdmin.SELECT"),defaultChecked:e.data,tabIndex:-1,onMouseDown:this.preventFocus};return![null,1].includes(this.props.maxFilesSelect)&&this.props.selectedFiles.length>=this.props.maxFilesSelect&&!e.data&&(t.disabled=!0),r.default.createElement("input",t)}return null}renderDate(e){return"folder"===e.rowData.type?null:(moment.locale(s.default.detectLocale()),r.default.createElement("span",null,moment(e.data).format("L LT")))}renderThumbnail(e){const t=e.data||e.rowData.url,n=e.rowData.queuedId&&!e.rowData.id,o=e.rowData.category||"false",i="gallery__table-image",s=[i],l={};return s.push(`${i}--${o}`),"image"===o&&t&&(l.backgroundImage=`url("${t}")`),n||t||"folder"===o||s.push(`${i}--error`),r.default.createElement("div",{className:s.join(" "),style:l})}render(){return r.default.createElement(i.default,this.getTableProps())}}t.Component=h,h.defaultProps=a.galleryViewDefaultProps,h.propTypes={...a.galleryViewPropTypes,sort:o.default.string.isRequired,VersionedBadge:o.default.elementType};t.default=(0,c.compose)((0,d.inject)(["VersionedBadge"],(e=>({VersionedBadge:e}))))(h)},2853:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=d(n(5815)),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(1594)),i=n(5207),s=n(5789),l=d(n(9888)),a=d(n(6935));function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}function d(e){return e&&e.__esModule?e:{default:e}}class c extends o.Component{constructor(e){super(e),this.renderItem=this.renderItem.bind(this),this.handleSetPage=this.handleSetPage.bind(this),this.handlePrevPage=this.handlePrevPage.bind(this),this.handleNextPage=this.handleNextPage.bind(this),this.handleDrag=this.handleDrag.bind(this)}handleDrag(e){this.props.onEnableDropzone(!e)}handleSetPage(e){this.props.onSetPage(e+1)}handleNextPage(){const e=this.props.page-1;this.handleSetPage(e+1)}handlePrevPage(){const e=this.props.page-1;0!==e?this.handleSetPage(e-1):this.handleSetPage(e)}folderFilter(e){return"folder"===e.type}fileFilter(e){return"folder"!==e.type}renderPagination(){if(this.props.totalCount<=this.props.limit)return null;const e={setPage:this.handleSetPage,maxPage:Math.ceil(this.props.totalCount/this.props.limit),next:this.handleNextPage,nextText:r.default._t("AssetAdmin.NEXT","Next"),previous:this.handlePrevPage,previousText:r.default._t("AssetAdmin.PREVIOUS","Previous"),currentPage:this.props.page-1,useGriddleStyles:!1};return o.default.createElement("div",{className:"griddle-footer"},o.default.createElement(l.default.GridPagination,e))}renderItem(e){const{File:t,Folder:n,badges:r,sectionConfig:i,selectedFiles:s,selectableItems:l,selectableFolders:a}=this.props,u=r.find((t=>t.id===e.id));let d={sectionConfig:i,key:e.key,selectableKey:e.id,item:e,selectedFiles:s,onDrag:this.handleDrag,badge:u,canDrag:this.props.canDrag};if(e.queuedId&&!e.id){const{onCancelUpload:e,onRemoveErroredUpload:t}=this.props;d={...d,onCancelUpload:e,onRemoveErroredUpload:t}}else{const{onOpenFolder:t,onOpenFile:n}=this.props;d={...d,onActivate:"folder"===e.type?t:n}}if(l&&(a||"folder"!==e.type)){const e=![null,1].includes(this.props.maxFilesSelect)&&this.props.selectedFiles.length>=this.props.maxFilesSelect,t=1===this.props.maxFilesSelect?d.onActivate:this.props.onSelect;d={...d,selectable:!0,onSelect:t,maxSelected:e}}if("folder"===e.type){const{onDropFiles:e}=this.props;return d={...d,onDropFiles:e},o.default.createElement(n,d)}return o.default.createElement(t,d)}render(){return o.default.createElement("div",{className:"gallery__main-view--tile"},o.default.createElement("div",{className:"gallery__folders"},this.props.files.filter(this.folderFilter).map(this.renderItem)),o.default.createElement("div",{className:"gallery__files"},this.props.files.filter(this.fileFilter).map(this.renderItem)),0===this.props.files.length&&!this.props.loading&&o.default.createElement("p",{className:"gallery__no-item-notice"},r.default._t("AssetAdmin.NOITEMSFOUND")),o.default.createElement("div",{className:"gallery__load"},this.renderPagination()))}}t.Component=c,c.defaultProps=s.galleryViewDefaultProps,c.propTypes={...s.galleryViewPropTypes,File:a.default.elementType.isRequired,Folder:a.default.elementType.isRequired};const p=(0,i.inject)(["GalleryItemFile","GalleryItemFolder"],((e,t)=>({File:e,Folder:t})),(()=>"AssetAdmin.Gallery.ThumbnailView"));t.default=p(c)},9329:function(e,t,n){"use strict";var r=a(n(1669)),o=a(n(1594)),i=n(5145),s=n(3398),l=n(5207);function a(e){return e&&e.__esModule?e:{default:e}}function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t{e(".js-injector-boot input.entwine-uploadfield").entwine({Component:null,ReactRoot:null,getContainer(){let t=this.siblings(".uploadfield-holder")[0];if(!t){const n=e('
');this.before(n),t=n[0]}return t},onunmatch(){this._super();const e=this.getReactRoot();e&&(e.unmount(),this.setReactRoot(null))},onmatch(){const e=this.closest(".cms-content").attr("id"),t=e?{context:e}:{},n=(0,l.loadComponent)("UploadField",t);this.setComponent(n),this._super(),this.hide(),this.refresh()},onclick(e){e.preventDefault()},refresh(){const t=this.getAttributes(),n=e(this).closest("form"),r=this.getComponent();let s=this.getReactRoot();s||(s=(0,i.createRoot)(this.getContainer()),this.setReactRoot(s)),s.render(o.default.createElement(r,u({},t,{onChange:()=>{setTimeout((()=>{n.trigger("change")}),0)},noHolder:!0})))},getAttributes(){const t=e(this).data("state"),n=e(this).data("schema");return(0,s.schemaMerge)(n,t)}})}))},4350:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o=(r=n(6935))&&r.__esModule?r:{default:r};const i=o.default.shape({url:o.default.string,limit:o.default.number,imageRetry:o.default.shape({minRetry:o.default.number,maxRetry:o.default.number,expiry:o.default.number}),form:o.default.object,dropzoneOptions:o.default.object});t.default=i},6022:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,o=(r=n(6935))&&r.__esModule?r:{default:r};const i=o.default.shape({canEdit:o.default.bool,canDelete:o.default.bool,canView:o.default.bool,exists:o.default.bool,type:o.default.string,smallThumbnail:o.default.string,thumbnail:o.default.string,width:o.default.number,height:o.default.number,category:o.default.oneOfType([o.default.bool,o.default.string]),id:o.default.number,url:o.default.string,title:o.default.string,progress:o.default.number,visibility:o.default.string,hasRestrictedAccess:o.default.bool,isTrackedFormUpload:o.default.bool});t.default=i},4886:function(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;const o=(0,((r=n(2923))&&r.__esModule?r:{default:r}).default)({name:null,canDelete:!1,canEdit:!1,category:null,created:null,extension:null,filename:null,id:0,lastEdited:null,messages:null,owner:{id:0,title:null},parent:{filename:null,id:0,title:null},queuedId:null,size:null,title:null,type:null,url:null,xhr:null,thumbnail:null,smallThumbnail:null,height:null,width:null});t.default=o},8268:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){let{config:{form:t},viewAction:n,folderId:r,fileId:o,type:l}=e,a=null,u=null;if(n===i)return a=t.folderCreateForm.schemaUrl,u=r,{schemaUrl:a,targetId:u};if(n===s&&o){switch(l){case"insert-media":a=t.fileInsertForm.schemaUrl;break;case"insert-link":a=t.fileEditorLinkForm.schemaUrl;break;case"select":a=t.fileSelectForm.schemaUrl;break;default:a=t.fileEditForm.schemaUrl}return u=o,{schemaUrl:a,targetId:u}}return{}};var r,o=(r=n(6379))&&r.__esModule?r:{default:r};const{CREATE_FOLDER:i,EDIT_FILE:s}=o.default.ACTIONS},9247:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(413===e)return o.default._t("AssetAdmin.ERROR_FILE_SIZE","File size limit exceeded");if(403===e&&t&&"string"==typeof t.response)return t.response;return o.default._t("AssetAdmin.ERROR_DEFAULT","Something went wrong, please try again")};var r,o=(r=n(5815))&&r.__esModule?r:{default:r}},6405:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={CONFIRM_DELETION_ASK:"CONFIRM_DELETION_ASK",CONFIRM_DELETION_CONFIRM:"CONFIRM_DELETION_CONFIRM",CONFIRM_DELETION_CANCEL:"CONFIRM_DELETION_CANCEL",CONFIRM_DELETION_RESET:"CONFIRM_DELETION_RESET",CONFIRM_DELETION_MODAL_CLOSE:"CONFIRM_DELETION_MODAL_CLOSE"}},4461:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cancel=function(){return{type:o.default.CONFIRM_DELETION_CANCEL,payload:{}}},t.confirm=function(e){return{type:o.default.CONFIRM_DELETION_ASK,payload:{files:e}}},t.deleting=function(){return{type:o.default.CONFIRM_DELETION_CONFIRM,payload:{}}},t.modalClose=function(){return{type:o.default.CONFIRM_DELETION_MODAL_CLOSE,payload:{}}},t.reset=function(){return{type:o.default.CONFIRM_DELETION_RESET,payload:{}}};var r,o=(r=n(6405))&&r.__esModule?r:{default:r}},9266:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.initialState=t.default=void 0;var r,o=(r=n(6405))&&r.__esModule?r:{default:r},i=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=s(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var l=o?Object.getOwnPropertyDescriptor(e,i):null;l&&(l.get||l.set)?Object.defineProperty(r,i,l):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(762));function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(s=function(e){return e?n:t})(e)}const l=t.initialState={showConfirmation:!1,files:[],transition:i.NO_TRANSITION};t.default=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case o.default.CONFIRM_DELETION_ASK:return{...l,showConfirmation:!0,files:t.payload.files};case o.default.CONFIRM_DELETION_CANCEL:if(e.showConfirmation)return{...e,transition:i.CANCELING};break;case o.default.CONFIRM_DELETION_CONFIRM:if(e.showConfirmation)return{...e,transition:i.DELETING};break;case o.default.CONFIRM_DELETION_MODAL_CLOSE:return{...e,showConfirmation:!1,transition:i.NO_TRANSITION};case o.default.CONFIRM_DELETION_RESET:return l}return e}},762:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NO_TRANSITION=t.DELETING=t.CANCELING=void 0;t.NO_TRANSITION=!1,t.CANCELING="canceling",t.DELETING="deleting"},6533:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={TOGGLE_SEARCH:"TOGGLE_SEARCH",OPEN_SEARCH:"OPEN_SEARCH",CLOSE_SEARCH:"CLOSE_SEARCH"}},9517:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.closeSearch=function(){return{type:o.default.CLOSE_SEARCH,payload:null}},t.openSearch=function(){return{type:o.default.OPEN_SEARCH,payload:null}},t.toggleSearch=function(){return{type:o.default.TOGGLE_SEARCH,payload:null}};var r,o=(r=n(6533))&&r.__esModule?r:{default:r}},2482:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(2923)),o=i(n(6533));function i(e){return e&&e.__esModule?e:{default:e}}const s={isOpen:!1};t.default=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s;switch((arguments.length>1?arguments[1]:void 0).type){case o.default.TOGGLE_SEARCH:return(0,r.default)({...e,isOpen:!e.isOpen});case o.default.OPEN_SEARCH:return(0,r.default)({...e,isOpen:!0});case o.default.CLOSE_SEARCH:return(0,r.default)({...e,isOpen:!1});default:return e}}},4913:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=["SET_LAST_SELECTED","SET_SELECTED_FILES","DESELECT_FILES","SELECT_FILES","LOAD_FILE_REQUEST","LOAD_FILE_SUCCESS","HIGHLIGHT_FILES","UPDATE_BATCH_ACTIONS","SET_NOTICE_MESSAGE","SET_ERROR_MESSAGE","SET_ENABLE_DROPZONE","SET_FILE_BADGE","CLEAR_FILE_BADGE","ACTIVATE_MODAL","DEACTIVATE_MODAL","CONCATENATE_SELECT","SET_LOADING"].reduce(((e,t)=>Object.assign(e,{[t]:`GALLERY.${t}`})),{})},4201:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.activateModal=function(e){return t=>{t({type:o.default.ACTIVATE_MODAL,payload:e})}},t.clearFileBadge=i,t.deactivateModal=function(){return e=>{e({type:o.default.DEACTIVATE_MODAL})}},t.deselectFiles=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return t=>t({type:o.default.DESELECT_FILES,payload:{ids:e}})},t.loadFile=function(e,t){return n=>{n({type:o.default.LOAD_FILE_SUCCESS,payload:{id:e,file:t}})}},t.selectFiles=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return t=>t({type:o.default.SELECT_FILES,payload:{ids:e}})},t.setConcatenateSelect=function(e){return t=>t({type:o.default.CONCATENATE_SELECT,payload:!!e})},t.setEnableDropzone=function(e){return t=>t({type:o.default.SET_ENABLE_DROPZONE,payload:{enableDropzone:e}})},t.setErrorMessage=function(e){return t=>t({type:o.default.SET_ERROR_MESSAGE,payload:{message:e}})},t.setFileBadge=function(e,t,n,r){return(s,l)=>{const{assetAdmin:a}=l(),u=a.gallery.badges.find((t=>t.id===e));u&&u.timer&&clearTimeout(u.timer);const d=r>0?setTimeout((()=>i(e)(s)),r):null;s({type:o.default.SET_FILE_BADGE,payload:{id:e,message:t,status:n,timer:d}})}},t.setLastSelected=function(e){return t=>{t({type:o.default.SET_LAST_SELECTED,payload:{id:e}})}},t.setLoading=function(e){return t=>{t({type:o.default.SET_LOADING,payload:!!e})}},t.setNoticeMessage=function(e){return t=>t({type:o.default.SET_NOTICE_MESSAGE,payload:{message:e}})},t.setSelectedFiles=function(e){return t=>{t({type:o.default.SET_SELECTED_FILES,payload:{files:e}})}};var r,o=(r=n(4913))&&r.__esModule?r:{default:r};function i(e){return t=>{t({type:o.default.CLEAR_FILE_BADGE,payload:{id:e}})}}},8518:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l,{type:t,payload:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(t){case i.default.SET_LAST_SELECTED:return{...e,lastSelected:n.id};case i.default.SET_FILE_BADGE:return{...e,badges:e.badges.filter((e=>e.id!==n.id)).concat([n])};case i.default.CLEAR_FILE_BADGE:return{...e,badges:e.badges.filter((e=>e.id!==n.id))};case i.default.SET_ENABLE_DROPZONE:return{...e,enableDropzone:n.enableDropzone};case i.default.SET_NOTICE_MESSAGE:return{...e,noticeMessage:n.message};case i.default.SET_ERROR_MESSAGE:return{...e,errorMessage:n.message};case i.default.LOAD_FILE_SUCCESS:{const t=e.files.find((e=>e.id===n.id));if(t){const o={...t,...n.file};return(0,r.default)({...e,files:e.files.map((e=>e.id===o.id?o:e))})}return e.folder.id===n.id?(0,r.default)({...e,folder:{...e.folder,...n.file}}):e}case i.default.SET_SELECTED_FILES:return(0,r.default)({...e,selectedFiles:Array.isArray(n.files)?n.files:[]});case i.default.SELECT_FILES:{let t=null;return t=null===n.ids?e.files.map((e=>e.id)):e.selectedFiles.concat(n.ids.filter((t=>-1===e.selectedFiles.indexOf(t)))),(0,r.default)({...e,selectedFiles:t})}case i.default.DESELECT_FILES:{let t=null;return t=null===n.ids?[]:e.selectedFiles.filter((e=>-1===n.ids.indexOf(e))),(0,r.default)({...e,selectedFiles:t})}case i.default.ACTIVATE_MODAL:return(0,r.default)({...e,modal:n});case i.default.DEACTIVATE_MODAL:return(0,r.default)({...e,modal:null});case i.default.CONCATENATE_SELECT:return(0,r.default)({...e,concatenateSelect:n});case i.default.SET_LOADING:return(0,r.default)({...e,loading:n});default:return e}};var r=s(n(2923)),o=s(n(5815)),i=s(n(4913));function s(e){return e&&e.__esModule?e:{default:e}}const l={selectedFiles:[],errorMessage:null,noticeMessage:null,enableDropzone:!0,modal:null,badges:[],concatenateSelect:!1,loading:!1,sorters:[{field:"title",direction:"asc",label:o.default._t("AssetAdmin.FILTER_TITLE_ASC","title a-z")},{field:"title",direction:"desc",label:o.default._t("AssetAdmin.FILTER_TITLE_DESC","title z-a")},{field:"lastEdited",direction:"desc",label:o.default._t("AssetAdmin.FILTER_DATE_DESC","newest")},{field:"lastEdited",direction:"asc",label:o.default._t("AssetAdmin.FILTER_DATE_ASC","oldest")}],lastSelected:null}},423:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultImageFactory=t.default=void 0;var r=i(n(1838)),o=i(n(8632));function i(e){return e&&e.__esModule?e:{default:e}}const s={minRetry:0,maxRetry:0,expiry:0,onStatusChange:()=>null,onRetry:()=>null,onReset:()=>null,onTimeout:()=>null},l=(e,t,n)=>{const r=new Image;r.onload=t,r.onerror=n,r.src=e};t.defaultImageFactory=l;t.default=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;this.options={...s,...e},this.factory=t}loadImage(e){return this.options.minRetry&&o.default.lock(e)?this.loadImageLoop(e,this.options.minRetry):null}loadImageLoop(e,t){return this.options.onStatusChange(e,r.default.LOADING),new Promise(((t,n)=>this.factory(e,t,n))).then((()=>this.handleSuccess(e))).catch((()=>this.handleError(e,t)))}handleReset(e,t){this.options.onReset(e),t()}handleTimeout(e,t){const n=setTimeout(e,t);return this.options.onTimeout(n,t),n}handleSuccess(e){o.default.unlock(e),this.options.onStatusChange(e,r.default.SUCCESS)}handleFailure(e){return o.default.unlock(e),this.options.onStatusChange(e,r.default.FAILED),this.options.expiry?new Promise((t=>{this.handleTimeout((()=>this.handleReset(e,t)),1e3*this.options.expiry)})):null}handleError(e,t){return t>this.options.maxRetry?this.handleFailure(e):(this.options.onStatusChange(e,r.default.WAITING),this.handleRetry(e,t))}handleRetry(e,t){const n=new Promise((n=>{this.handleTimeout((()=>n(this.loadImageLoop(e,2*t))),1e3*t)}));return this.options.onRetry(e,t,n),n}setOnRetry(e){this.options.onRetry=e}setOnReset(e){this.options.onReset=e}setOnStatusChange(e){this.options.onStatusChange=e}setOnTimeout(e){this.options.onTimeout=e}}},2153:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={SET_STATUS:"IMAGE_LOAD_SET_STATUS",RESET:"IMAGE_LOAD_RESET"}},769:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loadImage=function(e,t){return(n,i)=>{if(!e)return null;if(i().assetAdmin.imageLoad.files.find((t=>t.url===e)))return null;const s={...t,onStatusChange:(e,t)=>n({type:r.default.SET_STATUS,payload:{status:t,url:e}}),onReset:e=>n({type:r.default.RESET,payload:{url:e}})};return new o.default(s).loadImage(e)}};var r=i(n(2153)),o=i(n(423));function i(e){return e&&e.__esModule?e:{default:e}}},8632:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;class n{constructor(){this.urls=[]}lock(e){return!(this.urls.indexOf(e)>=0)&&(this.urls=[...this.urls,e],!0)}unlock(e){this.urls=this.urls.filter((t=>t!==e))}}t.Component=n,window.ss=window.ss||{},window.ss.imagelocker=window.ss.imagelocker||new n;t.default=window.ss.imagelocker},5214:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i,{type:t,payload:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(t){case o.default.SET_STATUS:return{...e,files:[...e.files.filter((e=>e.url!==n.url)),n]};case o.default.RESET:return{...e,files:[...e.files.filter((e=>e.url!==n.url))]};default:return e}};var r,o=(r=n(2153))&&r.__esModule?r:{default:r};const i={files:[]}},1838:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={DISABLED:"DISABLED",NONE:"NONE",SUCCESS:"SUCCESS",LOADING:"LOADING",WAITING:"WAITING",FAILED:"FAILED"}},2613:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={DEFINE_IMAGE_SIZE_PRESETS:"DEFINE_IMAGE_SIZE_PRESETS",INIT_FORM_SCHEMA_STACK:"INIT_FORM_SCHEMA_STACK",POP_FORM_SCHEMA:"POP_FORM_SCHEMA",PUSH_FORM_SCHEMA:"PUSH_FORM_SCHEMA",RESET:"RESET",RESET_FORM_STACK:"RESET_FORM_STACK"}},1021:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defineImageSizePresets=function(e){return{type:i.default.DEFINE_IMAGE_SIZE_PRESETS,payload:{imageSizePresets:e}}},t.initFormStack=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return{type:i.default.INIT_FORM_SCHEMA_STACK,payload:{formSchema:{type:e,nextType:t}}}},t.popFormStackEntry=function(){return{type:i.default.POP_FORM_SCHEMA}},t.pushFormStackEntry=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return{type:i.default.PUSH_FORM_SCHEMA,payload:{formSchema:{type:e,nextType:t}}}},t.reset=function(){return{type:i.default.RESET}},t.resetFormStack=function(){return{type:i.default.RESET_FORM_STACK}},t.stashFormValues=function(e,t){return(n,i)=>{const l=i(),a=(0,r.default)(l.form.formState,`${e}.values`),u=(0,r.default)(l.form.formSchemas,`${t}.schema.fields`);if(a){const e=Object.keys(a).filter((e=>null!==a[e]&&(0,s.default)(e,u))).map((e=>({name:e,value:a[e]})));n((0,o.setSchemaStateOverrides)(t,{fields:e}))}}};var r=l(n(6104)),o=n(2811),i=l(n(2613)),s=l(n(8896));function l(e){return e&&e.__esModule?e:{default:e}}},8178:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.initialState=t.default=void 0;var r,o=(r=n(2613))&&r.__esModule?r:{default:r};const i=t.initialState={imageSizePresets:[],formSchemaStack:[],formSchema:void 0};t.default=function(){return e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i,{type:t,payload:n}=arguments.length>1?arguments[1]:void 0;const{formSchemaStack:r}=e;switch(t){case o.default.DEFINE_IMAGE_SIZE_PRESETS:return{...e,imageSizePresets:n.imageSizePresets};case o.default.PUSH_FORM_SCHEMA:return{...e,formSchemaStack:[...r,n.formSchema]};case o.default.INIT_FORM_SCHEMA_STACK:return{...e,formSchemaStack:[n.formSchema]};case o.default.POP_FORM_SCHEMA:return{...e,formSchemaStack:r.slice(0,-1)};case o.default.RESET:return i;case o.default.RESET_FORM_STACK:return{...e,formSchemaStack:r.slice(0,1)};default:return e}}(...arguments),{...e,formSchema:e.formSchemaStack.slice(-1).pop()};var e}},8896:function(e,t){"use strict";function n(e,t){let r;for(r=0;r0&&void 0!==arguments[0]?arguments[0]:s,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case o.default.PREVIEWFIELD_ADD_FILE:return(0,r.default)(Object.assign({},e,{[t.payload.id]:t.payload.file}));case o.default.PREVIEWFIELD_FAIL_UPLOAD:return(0,r.default)(Object.assign({},e,{[t.payload.id]:Object.assign({},e[t.payload.id],t.payload.message)}));case o.default.PREVIEWFIELD_REMOVE_FILE:return(0,r.default)(Object.assign({},e,{[t.payload.id]:void 0}));case o.default.PREVIEWFIELD_UPDATE_FILE:return(0,r.default)(Object.assign({},e,{[t.payload.id]:Object.assign({},e[t.payload.id],t.payload.data)}));case o.default.PREVIEWFIELD_UPDATE_STATUS:return(0,r.default)(Object.assign({},e,{[t.payload.id]:Object.assign({},e[t.payload.id],t.payload.status)}));default:return e}}},5793:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={ADD_QUEUED_FILE:"ADD_QUEUED_FILE",FAIL_UPLOAD:"FAIL_UPLOAD",PURGE_UPLOAD_QUEUE:"PURGE_UPLOAD_QUEUE",REMOVE_QUEUED_FILE:"REMOVE_QUEUED_FILE",SUCCEED_UPLOAD:"SUCCEED_UPLOAD",UPDATE_QUEUED_FILE:"UPDATE_QUEUED_FILE"}},1369:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addQueuedFile=function(e){return t=>t({type:o.default.ADD_QUEUED_FILE,payload:{file:e}})},t.failUpload=function(e,t,n){return r=>{let i=t.message;return t.errors&&t.errors.length&&(i=t.errors[0]),"string"==typeof t&&(i={value:n||t,type:"error"}),r({type:o.default.FAIL_UPLOAD,payload:{queuedId:e,message:i}})}},t.purgeUploadQueue=function(){return e=>e({type:o.default.PURGE_UPLOAD_QUEUE,payload:null})},t.removeQueuedFile=function(e){return t=>t({type:o.default.REMOVE_QUEUED_FILE,payload:{queuedId:e}})},t.succeedUpload=function(e,t){return n=>n({type:o.default.SUCCEED_UPLOAD,payload:{queuedId:e,json:t}})},t.updateQueuedFile=function(e,t){return n=>n({type:o.default.UPDATE_QUEUED_FILE,payload:{queuedId:e,updates:t}})};var r,o=(r=n(5793))&&r.__esModule?r:{default:r}},8310:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=l(n(2923)),o=l(n(4886)),i=l(n(5815)),s=l(n(5793));function l(e){return e&&e.__esModule?e:{default:e}}const a={items:[]};t.default=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case s.default.ADD_QUEUED_FILE:return(0,r.default)({...e,items:[...e.items,{...o.default,...t.payload.file}]});case s.default.FAIL_UPLOAD:return(0,r.default)({...e,items:e.items.map((e=>e.queuedId===t.payload.queuedId?{...e,message:t.payload.message}:e))});case s.default.PURGE_UPLOAD_QUEUE:return(0,r.default)({...e,items:e.items.filter((e=>!e.id))});case s.default.REMOVE_QUEUED_FILE:return(0,r.default)({...e,items:e.items.filter((e=>e.queuedId!==t.payload.queuedId))});case s.default.SUCCEED_UPLOAD:return(0,r.default)({...e,items:e.items.map((e=>e.queuedId===t.payload.queuedId?{...e,...t.payload.json,messages:[{value:i.default._t("AssetAdmin.DROPZONE_SUCCESS_UPLOAD"),type:"success",extraClass:"success"}]}:e))});case s.default.UPDATE_QUEUED_FILE:return(0,r.default)({...e,items:e.items.map((e=>e.queuedId===t.payload.queuedId?{...e,...t.payload.updates}:e))});default:return e}}},9918:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={UPLOADFIELD_SET_FORM_SCHEMA_FILES_HASH:"UPLOADFIELD_SET_FORM_SCHEMA_FILES_HASH",UPLOADFIELD_ADD_FILE:"UPLOADFIELD_ADD_FILE",UPLOADFIELD_SET_FILES:"UPLOADFIELD_SET_FILES",UPLOADFIELD_REMOVE_FILE:"UPLOADFIELD_REMOVE_FILE",UPLOADFIELD_UPLOAD_FAILURE:"UPLOADFIELD_UPLOAD_FAILURE",UPLOADFIELD_UPLOAD_SUCCESS:"UPLOADFIELD_UPLOAD_SUCCESS",UPLOADFIELD_UPDATE_QUEUED_FILE:"UPLOADFIELD_UPDATE_QUEUED_FILE"}},1433:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addFile=function(e,t){return n=>n({type:o.default.UPLOADFIELD_ADD_FILE,payload:{fieldId:e,file:t}})},t.failUpload=function(e,t,n,r){return i=>{let s=n.message;return"string"==typeof n&&(s={value:r||n,type:"error"}),i({type:o.default.UPLOADFIELD_UPLOAD_FAILURE,payload:{fieldId:e,queuedId:t,message:s}})}},t.removeFile=function(e,t){return n=>n({type:o.default.UPLOADFIELD_REMOVE_FILE,payload:{fieldId:e,file:t}})},t.setFiles=function(e,t){return n=>n({type:o.default.UPLOADFIELD_SET_FILES,payload:{fieldId:e,files:t}})},t.setFormSchemaFilesHash=function(e,t){return n=>n({type:o.default.UPLOADFIELD_SET_FORM_SCHEMA_FILES_HASH,payload:{fieldId:e,hash:t}})},t.succeedUpload=function(e,t,n){return r=>r({type:o.default.UPLOADFIELD_UPLOAD_SUCCESS,payload:{fieldId:e,queuedId:t,json:n}})},t.updateQueuedFile=function(e,t,n){return r=>r({type:o.default.UPLOADFIELD_UPDATE_QUEUED_FILE,payload:{fieldId:e,queuedId:t,updates:n}})};var r,o=(r=n(9918))&&r.__esModule?r:{default:r}},2726:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=s(n(4886)),o=s(n(6595)),i=s(n(9918));function s(e){return e&&e.__esModule?e:{default:e}}const l={fields:{}},a={formSchemaFilesHash:null,files:[]};t.default=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l,t=arguments.length>1?arguments[1]:void 0;const n=(0,o.default)(e,t,a);switch(t.type){case i.default.UPLOADFIELD_SET_FORM_SCHEMA_FILES_HASH:return n((()=>({formSchemaFilesHash:t.payload.hash})));case i.default.UPLOADFIELD_ADD_FILE:return n((e=>e.files.find((e=>e.id===t.payload.file.id))?e:{...e,files:[...e.files,{...r.default,...t.payload.file}]}));case i.default.UPLOADFIELD_SET_FILES:return n((()=>({files:t.payload.files})));case i.default.UPLOADFIELD_UPLOAD_FAILURE:return n((e=>({files:e.files.map((e=>e.queuedId===t.payload.queuedId?Object.assign({},e,{message:t.payload.message}):e))})));case i.default.UPLOADFIELD_REMOVE_FILE:return n((e=>({files:e.files.filter((e=>!(t.payload.file.queuedId&&e.queuedId===t.payload.file.queuedId||t.payload.file.id&&e.id===t.payload.file.id)))})));case i.default.UPLOADFIELD_UPLOAD_SUCCESS:return n((e=>({files:e.files.map((e=>e.queuedId===t.payload.queuedId?Object.assign({},e,t.payload.json):e))})));case i.default.UPLOADFIELD_UPDATE_QUEUED_FILE:return n((e=>({files:e.files.map((e=>e.queuedId===t.payload.queuedId?Object.assign({},e,t.payload.updates):e))})));default:return e}}},1991:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(1594)),o=i(n(5815));function i(e){return e&&e.__esModule?e:{default:e}}t.default=e=>t=>{const n=t.onClick,i={...t,onClick(e,r){const{owners:i}=t.data;let s=null;s=i&&parseInt(i,10)>0?[o.default.inject(o.default._t("AssetAdmin.SINGLE_OWNED_WARNING_1","This file is being used in {count} other published section(s)."),{count:i}),o.default._t("AssetAdmin.SINGLE_OWNED_WARNING_2","Ensure files are removed from content areas prior to unpublishing them. Otherwise, they will appear as broken links."),o.default._t("AssetAdmin.SINGLE_OWNED_WARNING_3","Do you want to unpublish this file anyway?")].join("\n\n"):o.default._t("AssetAdmin.CONFIRMUNPUBLISH","Are you sure you want to unpublish this record?"),confirm(s)?n(e,r):e.preventDefault()}};return r.default.createElement(e,i)}},315:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.disabledTreeDropdownField=t.default=void 0;var r,o=(r=n(1594))&&r.__esModule?r:{default:r},i=n(9040),s=n(9367),l=n(7818);const a=e=>t=>{const{disabledIDs:n}=t,r=t.findTreeByPath||l.findTreeByPath,i={...t,findTreeByPath(e,t){const o=r(e,t),i=t.some((e=>n.includes(e)));return o?{...o,children:o.children.map((e=>({...e,disabled:i||n.includes(e.id)})))}:null}};return o.default.createElement(e,i)};t.disabledTreeDropdownField=a;const u=(0,s.compose)((0,i.connect)((e=>({disabledIDs:e.assetAdmin.gallery.selectedFiles}))),a);t.default=u},1804:function(e,t,n){"use strict";var r=n(5228),o={};var i=function(e){};function s(e,t,n,r,o,s,l,a){if(i(t),!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var d=[n,r,o,s,l,a],c=0;(u=new Error(t.replace(/%s/g,(function(){return d[c++]})))).name="Invariant Violation"}throw u.framesToPop=1,u}}var l="mixins";e.exports=function(e,t,n){var i=[],a={mixins:"DEFINE_MANY",statics:"DEFINE_MANY",propTypes:"DEFINE_MANY",contextTypes:"DEFINE_MANY",childContextTypes:"DEFINE_MANY",getDefaultProps:"DEFINE_MANY_MERGED",getInitialState:"DEFINE_MANY_MERGED",getChildContext:"DEFINE_MANY_MERGED",render:"DEFINE_ONCE",componentWillMount:"DEFINE_MANY",componentDidMount:"DEFINE_MANY",componentWillReceiveProps:"DEFINE_MANY",shouldComponentUpdate:"DEFINE_ONCE",componentWillUpdate:"DEFINE_MANY",componentDidUpdate:"DEFINE_MANY",componentWillUnmount:"DEFINE_MANY",UNSAFE_componentWillMount:"DEFINE_MANY",UNSAFE_componentWillReceiveProps:"DEFINE_MANY",UNSAFE_componentWillUpdate:"DEFINE_MANY",updateComponent:"OVERRIDE_BASE"},u={getDerivedStateFromProps:"DEFINE_MANY_MERGED"},d={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var n=0;n>>2]>>>24-i%4*8&255;t[r+i>>>2]|=s<<24-(r+i)%4*8}else for(var l=0;l>>2]=n[l>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new u.init(n,t/2)}},p=d.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new u.init(n,t)}},f=d.Utf8={stringify:function(e){try{return decodeURIComponent(escape(p.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return p.parse(unescape(encodeURIComponent(e)))}},h=l.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,r=this._data,o=r.words,i=r.sigBytes,s=this.blockSize,l=i/(4*s),a=(l=t?e.ceil(l):e.max((0|l)-this._minBufferSize,0))*s,d=e.min(4*a,i);if(a){for(var c=0;c>>24)|4278255360&(o<<24|o>>>8)}var i=this._hash.words,s=e[t+0],a=e[t+1],f=e[t+2],h=e[t+3],m=e[t+4],g=e[t+5],y=e[t+6],v=e[t+7],b=e[t+8],_=e[t+9],E=e[t+10],C=e[t+11],S=e[t+12],w=e[t+13],F=e[t+14],A=e[t+15],O=i[0],I=i[1],x=i[2],D=i[3];O=u(O,I,x,D,s,7,l[0]),D=u(D,O,I,x,a,12,l[1]),x=u(x,D,O,I,f,17,l[2]),I=u(I,x,D,O,h,22,l[3]),O=u(O,I,x,D,m,7,l[4]),D=u(D,O,I,x,g,12,l[5]),x=u(x,D,O,I,y,17,l[6]),I=u(I,x,D,O,v,22,l[7]),O=u(O,I,x,D,b,7,l[8]),D=u(D,O,I,x,_,12,l[9]),x=u(x,D,O,I,E,17,l[10]),I=u(I,x,D,O,C,22,l[11]),O=u(O,I,x,D,S,7,l[12]),D=u(D,O,I,x,w,12,l[13]),x=u(x,D,O,I,F,17,l[14]),O=d(O,I=u(I,x,D,O,A,22,l[15]),x,D,a,5,l[16]),D=d(D,O,I,x,y,9,l[17]),x=d(x,D,O,I,C,14,l[18]),I=d(I,x,D,O,s,20,l[19]),O=d(O,I,x,D,g,5,l[20]),D=d(D,O,I,x,E,9,l[21]),x=d(x,D,O,I,A,14,l[22]),I=d(I,x,D,O,m,20,l[23]),O=d(O,I,x,D,_,5,l[24]),D=d(D,O,I,x,F,9,l[25]),x=d(x,D,O,I,h,14,l[26]),I=d(I,x,D,O,b,20,l[27]),O=d(O,I,x,D,w,5,l[28]),D=d(D,O,I,x,f,9,l[29]),x=d(x,D,O,I,v,14,l[30]),O=c(O,I=d(I,x,D,O,S,20,l[31]),x,D,g,4,l[32]),D=c(D,O,I,x,b,11,l[33]),x=c(x,D,O,I,C,16,l[34]),I=c(I,x,D,O,F,23,l[35]),O=c(O,I,x,D,a,4,l[36]),D=c(D,O,I,x,m,11,l[37]),x=c(x,D,O,I,v,16,l[38]),I=c(I,x,D,O,E,23,l[39]),O=c(O,I,x,D,w,4,l[40]),D=c(D,O,I,x,s,11,l[41]),x=c(x,D,O,I,h,16,l[42]),I=c(I,x,D,O,y,23,l[43]),O=c(O,I,x,D,_,4,l[44]),D=c(D,O,I,x,S,11,l[45]),x=c(x,D,O,I,A,16,l[46]),O=p(O,I=c(I,x,D,O,f,23,l[47]),x,D,s,6,l[48]),D=p(D,O,I,x,v,10,l[49]),x=p(x,D,O,I,F,15,l[50]),I=p(I,x,D,O,g,21,l[51]),O=p(O,I,x,D,S,6,l[52]),D=p(D,O,I,x,h,10,l[53]),x=p(x,D,O,I,E,15,l[54]),I=p(I,x,D,O,a,21,l[55]),O=p(O,I,x,D,b,6,l[56]),D=p(D,O,I,x,A,10,l[57]),x=p(x,D,O,I,y,15,l[58]),I=p(I,x,D,O,w,21,l[59]),O=p(O,I,x,D,m,6,l[60]),D=p(D,O,I,x,C,10,l[61]),x=p(x,D,O,I,f,15,l[62]),I=p(I,x,D,O,_,21,l[63]),i[0]=i[0]+O|0,i[1]=i[1]+I|0,i[2]=i[2]+x|0,i[3]=i[3]+D|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,o=8*t.sigBytes;n[o>>>5]|=128<<24-o%32;var i=e.floor(r/4294967296),s=r;n[15+(o+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),n[14+(o+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),t.sigBytes=4*(n.length+1),this._process();for(var l=this._hash,a=l.words,u=0;u<4;u++){var d=a[u];a[u]=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8)}return l},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,n,r,o,i,s){var l=e+(t&n|~t&r)+o+s;return(l<>>32-i)+t}function d(e,t,n,r,o,i,s){var l=e+(t&r|n&~r)+o+s;return(l<>>32-i)+t}function c(e,t,n,r,o,i,s){var l=e+(t^n^r)+o+s;return(l<>>32-i)+t}function p(e,t,n,r,o,i,s){var l=e+(n^(t|~r))+o+s;return(l<>>32-i)+t}t.MD5=i._createHelper(a),t.HmacMD5=i._createHmacHelper(a)}(Math),r.MD5)},4639:function(e,t,n){var r=n(4333),o=n(4160);void 0===o.InsertEmbedModal&&(o.InsertEmbedModal=r),e.exports=r},6166:function(e,t,n){var r=n(6931),o=n(4160);void 0===o.InsertMediaModal&&(o.InsertMediaModal=r),e.exports=r},4160:function(e,t,n){"use strict";e.exports=function(){if("object"==typeof globalThis)return globalThis;var e;try{e=this||new Function("return this")()}catch(e){if("object"==typeof window)return window;if("object"==typeof self)return self;if(void 0!==n.g)return n.g}return e}()},493:function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n0}},{key:"getMetadataColumnProperty",value:function(e,t,n){var r=this.getColumnMetadataByName(e);return null==r?n:r.hasOwnProperty(t)?r[t]:n}},{key:"orderColumns",value:function(e){var t=this;return l(e,(function(e){var n=s(t.columnMetadata,{columnName:e});return null==n||isNaN(n.order)?100:n.order}))}},{key:"getColumns",value:function(){var e=0===this.filteredColumns.length?this.allColumns:this.filteredColumns;return e=a(e,this.metadataColumns),e=this.orderColumns(e)}}]),e}();e.exports=u},3715:function(e,t,n){"use strict";var r=n(1594),o=n(2306)({getDefaultProps:function(){return{placeholderText:""}},render:function(){return"function"!=typeof this.props.customFilterComponent?(console.log("Couldn't find valid template."),r.createElement("div",null)):r.createElement(this.props.customFilterComponent,{changeFilter:this.props.changeFilter,results:this.props.results,currentResults:this.props.currentResults,placeholderText:this.props.placeholderText})}});e.exports=o},8465:function(e,t,n){"use strict";var r=Object.assign||function(e){for(var t=1;t0&&(e=r.createElement("button",{type:"button",onClick:this.props.previous,style:this.props.useGriddleStyles?{color:"#222",border:"none",background:"none",margin:"0 0 0 10px"}:null},this.props.previousIconComponent,this.props.previousText)),this.props.currentPage!==this.props.maxPage-1&&(t=r.createElement("button",{type:"button",onClick:this.props.next,style:this.props.useGriddleStyles?{color:"#222",border:"none",background:"none",margin:"0 10px 0 0"}:null},this.props.nextText,this.props.nextIconComponent));var n=null,o=null,s=null;if(!0===this.props.useGriddleStyles){var l={float:"left",minHeight:"1px",marginTop:"5px"};s=i({textAlign:"right",width:"34%"},l),o=i({textAlign:"center",width:"33%"},l),n=i({width:"33%"},l)}for(var a=[],u=1;u<=this.props.maxPage;u++)a.push(r.createElement("option",{value:u,key:u},u));return r.createElement("div",{style:this.props.useGriddleStyles?{minHeight:"35px"}:null},r.createElement("div",{className:this.props.previousClassName,style:n},e),r.createElement("div",{className:"griddle-page",style:o},r.createElement("select",{value:this.props.currentPage+1,onChange:this.pageChange},a)," / ",this.props.maxPage),r.createElement("div",{className:this.props.nextClassName,style:s},t))}});e.exports=s},1507:function(e,t,n){"use strict";var r=n(1594),o=n(2306),i=(n(493),n(9280)),s=n(1882),l=n(7248),a=n(6139),u=n(4684),d=n(8938),c=n(1648),p=o({getDefaultProps:function(){return{isChildRow:!1,showChildren:!1,data:{},columnSettings:null,rowSettings:null,hasChildren:!1,useGriddleStyles:!0,useGriddleIcons:!0,isSubGriddle:!1,paddingHeight:null,rowHeight:null,parentRowCollapsedClassName:"parent-row",parentRowExpandedClassName:"parent-row expanded",parentRowCollapsedComponent:"â–¶",parentRowExpandedComponent:"â–¼",onRowClick:null,multipleSelectionSettings:null,onRowMouseEnter:null,onRowMouseLeave:null,onRowWillMount:null,onRowWillUnmount:null}},componentWillMount:function(){null!==this.props.onRowWillMount&&s(this.props.onRowWillMount)&&this.props.onRowWillMount(this)},componentWillUnmount:function(){null!==this.props.onRowWillUnmount&&s(this.props.onRowWillUnmount)&&this.props.onRowWillUnmount(this)},handleClick:function(e){null!==this.props.onRowClick&&s(this.props.onRowClick)?this.props.onRowClick(this,e):this.props.hasChildren&&this.props.toggleChildren()},handleMouseEnter:function(e){null!==this.props.onRowMouseEnter&&s(this.props.onRowMouseEnter)&&this.props.onRowMouseEnter(this,e)},handleMouseLeave:function(e){null!==this.props.onRowMouseLeave&&s(this.props.onRowMouseLeave)&&this.props.onRowMouseLeave(this,e)},handleSelectionChange:function(e){},handleSelectClick:function(e){this.props.multipleSelectionSettings.isMultipleSelection&&("checkbox"===e.target.type?this.props.multipleSelectionSettings.toggleSelectRow(this.props.data,this.refs.selected.checked):this.props.multipleSelectionSettings.toggleSelectRow(this.props.data,!this.refs.selected.checked))},verifyProps:function(){null===this.props.columnSettings&&console.error("gridRow: The columnSettings prop is null and it shouldn't be")},formatData:function(e){return"boolean"==typeof e?String(e):e},render:function(){var e=this;this.verifyProps();var t=this,n=null;this.props.useGriddleStyles&&(n={margin:"0px",padding:t.props.paddingHeight+"px 5px "+t.props.paddingHeight+"px 5px",height:t.props.rowHeight?this.props.rowHeight-2*t.props.paddingHeight+"px":null,backgroundColor:"#FFF",borderTopColor:"#DDD",color:"#222"});var o=this.props.columnSettings.getColumns(),p=l(o,[]),f=a({},this.props.data);u(f,p);var h,m,g=d(i.pick(f,c(o,"children"))).map((function(t,o){var i=null,s=e.props.columnSettings.getColumnMetadataByName(t[0]),l=0===o&&e.props.hasChildren&&!1===e.props.showChildren&&e.props.useGriddleIcons?r.createElement("span",{style:e.props.useGriddleStyles?{fontSize:"10px",marginRight:"5px"}:null},e.props.parentRowCollapsedComponent):0===o&&e.props.hasChildren&&e.props.showChildren&&e.props.useGriddleIcons?r.createElement("span",{style:e.props.useGriddleStyles?{fontSize:"10px"}:null},e.props.parentRowExpandedComponent):"";if(0===o&&e.props.isChildRow&&e.props.useGriddleStyles&&(n=a(n,{paddingLeft:10})),e.props.columnSettings.hasColumnMetadata()&&null!=s)if(void 0!==s.customComponent&&null!==s.customComponent){var u=r.createElement(s.customComponent,{data:t[1],rowData:f,metadata:s});i=r.createElement("td",{onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,onMouseLeave:e.handleMouseLeave,className:s.cssClassName,key:o,style:n},u)}else i=r.createElement("td",{onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,onMouseLeave:e.handleMouseLeave,className:s.cssClassName,key:o,style:n},l,e.formatData(t[1]));return i||r.createElement("td",{onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,onMouseLeave:e.handleMouseLeave,key:o,style:n},l,t[1])}));if(null!==this.props.onRowClick&&s(this.props.onRowClick)?(h=null,m=this.handleSelectClick):this.props.multipleSelectionSettings&&this.props.multipleSelectionSettings.isMultipleSelection?(h=this.handleSelectClick,m=null):(h=null,m=null),g&&this.props.multipleSelectionSettings&&this.props.multipleSelectionSettings.isMultipleSelection){this.props.multipleSelectionSettings.getSelectedRowIds();g.unshift(r.createElement("td",{key:"selection",style:n,className:"griddle-select griddle-select-cell",onClick:m},r.createElement("input",{type:"checkbox",checked:this.props.multipleSelectionSettings.getIsRowChecked(f),onChange:this.handleSelectionChange,ref:"selected"})))}var y=t.props.rowSettings&&t.props.rowSettings.getBodyRowMetadataClass(t.props.data)||"standard-row";return t.props.isChildRow?y="child-row":t.props.hasChildren&&(y=t.props.showChildren?this.props.parentRowExpandedClassName:this.props.parentRowCollapsedClassName),r.createElement("tr",{onClick:h,className:y},g)}});e.exports=p},4734:function(e,t,n){"use strict";var r=n(1594),o=n(2306),i=(n(493),n(4383)),s=o({getDefaultProps:function(){return{useGriddleStyles:!0,useGriddleIcons:!0,isSubGriddle:!1,columnSettings:null,rowSettings:null,paddingHeight:null,rowHeight:null,parentRowCollapsedClassName:"parent-row",parentRowExpandedClassName:"parent-row expanded",parentRowCollapsedComponent:"â–¶",parentRowExpandedComponent:"â–¼",onRowClick:null,onRowMouseEnter:null,onRowMouseLeave:null,onRowWillMount:null,onRowWillUnmount:null,multipleSelectionSettings:null}},getInitialState:function(){return{data:{},showChildren:!1}},componentWillReceiveProps:function(){this.setShowChildren(!1)},toggleChildren:function(){this.setShowChildren(!1===this.state.showChildren)},setShowChildren:function(e){this.setState({showChildren:e})},verifyProps:function(){null===this.props.columnSettings&&console.error("gridRowContainer: The columnSettings prop is null and it shouldn't be")},render:function(){this.verifyProps();var e=this;if(void 0===this.props.data)return r.createElement("tbody",null);var t=[],n=this.props.columnSettings.getColumns();t.push(r.createElement(this.props.rowSettings.rowComponent,{useGriddleStyles:this.props.useGriddleStyles,isSubGriddle:this.props.isSubGriddle,data:this.props.rowSettings.isCustom?i(this.props.data,n):this.props.data,rowData:this.props.rowSettings.isCustom?this.props.data:null,columnSettings:this.props.columnSettings,rowSettings:this.props.rowSettings,hasChildren:e.props.hasChildren,toggleChildren:e.toggleChildren,showChildren:e.state.showChildren,key:e.props.uniqueId+"_base_row",useGriddleIcons:e.props.useGriddleIcons,parentRowExpandedClassName:this.props.parentRowExpandedClassName,parentRowCollapsedClassName:this.props.parentRowCollapsedClassName,parentRowExpandedComponent:this.props.parentRowExpandedComponent,parentRowCollapsedComponent:this.props.parentRowCollapsedComponent,paddingHeight:e.props.paddingHeight,rowHeight:e.props.rowHeight,onRowClick:e.props.onRowClick,onRowMouseEnter:e.props.onRowMouseEnter,onRowMouseLeave:e.props.onRowMouseLeave,multipleSelectionSettings:this.props.multipleSelectionSettings,onRowWillMount:e.props.onRowWillMount,onRowWillUnmount:e.props.onRowWillUnmount}));var o=null;return e.state.showChildren&&(o=e.props.hasChildren&&this.props.data.children.map((function(t,n){var o=e.props.rowSettings.getRowKey(t,n);if(void 0!==t.children){var i=e.constructor.Griddle;return r.createElement("tr",{key:o,style:{paddingLeft:5}},r.createElement("td",{colSpan:e.props.columnSettings.getVisibleColumnCount(),className:"griddle-parent",style:e.props.useGriddleStyles?{border:"none",padding:"0 0 0 5px"}:null},r.createElement(i,{rowMetadata:{key:"id"},isSubGriddle:!0,results:[t],columns:e.props.columnSettings.getColumns(),tableClassName:e.props.tableClassName,parentRowExpandedClassName:e.props.parentRowExpandedClassName,parentRowCollapsedClassName:e.props.parentRowCollapsedClassName,showTableHeading:!1,showPager:!1,columnMetadata:e.props.columnSettings.columnMetadata,parentRowExpandedComponent:e.props.parentRowExpandedComponent,parentRowCollapsedComponent:e.props.parentRowCollapsedComponent,paddingHeight:e.props.paddingHeight,rowHeight:e.props.rowHeight})))}return r.createElement(e.props.rowSettings.rowComponent,{useGriddleStyles:e.props.useGriddleStyles,isSubGriddle:e.props.isSubGriddle,data:t,columnSettings:e.props.columnSettings,isChildRow:!0,columnMetadata:e.props.columnSettings.columnMetadata,key:o})}))),!1===e.props.hasChildren?t[0]:r.createElement("tbody",null,e.state.showChildren?t.concat(o):t)}});e.exports=s},4376:function(e,t,n){"use strict";var r=n(1594),o=n(2306),i=n(9859),s=n(1648),l=n(7309),a=o({getDefaultProps:function(){return{columns:[],columnMetadata:[],selectedColumns:[],settingsText:"",maxRowsText:"",resultsPerPage:0,enableToggleCustom:!1,useCustomComponent:!1,useGriddleStyles:!0,toggleCustomComponent:function(){}}},setPageSize:function(e){var t=parseInt(e.target.value,10);this.props.setPageSize(t)},handleChange:function(e){var t=e.target.dataset?e.target.dataset.name:e.target.getAttribute("data-name");!0===e.target.checked&&!1===i(this.props.selectedColumns,t)?(this.props.selectedColumns.push(t),this.props.setColumns(this.props.selectedColumns)):this.props.setColumns(s(this.props.selectedColumns,t))},render:function(){var e=this,t=[];!1===e.props.useCustomComponent&&(t=this.props.columns.map((function(t,n){var o=i(e.props.selectedColumns,t),s=l(e.props.columnMetadata,{columnName:t}),a=t;return void 0!==s&&void 0!==s.displayName&&null!=s.displayName&&(a=s.displayName),void 0!==s&&null!=s&&s.locked?r.createElement("div",{className:"column checkbox"},r.createElement("label",null,r.createElement("input",{type:"checkbox",disabled:!0,name:"check",checked:o,"data-name":t}),a)):void 0!==s&&null!=s&&void 0!==s.visible&&!1===s.visible?null:r.createElement("div",{className:"griddle-column-selection checkbox",key:t,style:e.props.useGriddleStyles?{float:"left",width:"20%"}:null},r.createElement("label",null,r.createElement("input",{type:"checkbox",name:"check",onChange:e.handleChange,checked:o,"data-name":t}),a))})));var n=e.props.enableToggleCustom?r.createElement("div",{className:"form-group"},r.createElement("label",{htmlFor:"maxRows"},r.createElement("input",{type:"checkbox",checked:this.props.useCustomComponent,onChange:this.props.toggleCustomComponent})," ",this.props.enableCustomFormatText)):"",o=this.props.showSetPageSize?r.createElement("div",null,r.createElement("label",{htmlFor:"maxRows"},this.props.maxRowsText,":",r.createElement("select",{onChange:this.setPageSize,value:this.props.resultsPerPage},r.createElement("option",{value:"5"},"5"),r.createElement("option",{value:"10"},"10"),r.createElement("option",{value:"25"},"25"),r.createElement("option",{value:"50"},"50"),r.createElement("option",{value:"100"},"100")))):"";return r.createElement("div",{className:"griddle-settings",style:this.props.useGriddleStyles?{backgroundColor:"#FFF",border:"1px solid #DDD",color:"#222",padding:"10px",marginBottom:"10px"}:null},r.createElement("h6",null,this.props.settingsText),r.createElement("div",{className:"griddle-columns",style:this.props.useGriddleStyles?{clear:"both",display:"table",width:"100%",borderBottom:"1px solid #EDEDED",marginBottom:"10px"}:null},t),o,n)}});e.exports=a},2991:function(e,t,n){"use strict";var r=n(1594),o=n(2306),i=n(9593),s=n(4734),l=(n(493),n(1545),o({getDefaultProps:function(){return{data:[],columnSettings:null,rowSettings:null,sortSettings:null,multipleSelectionSettings:null,className:"",enableInfiniteScroll:!1,nextPage:null,hasMorePages:!1,useFixedHeader:!1,useFixedLayout:!0,paddingHeight:null,rowHeight:null,filterByColumn:null,infiniteScrollLoadTreshold:null,bodyHeight:null,useGriddleStyles:!0,useGriddleIcons:!0,isSubGriddle:!1,parentRowCollapsedClassName:"parent-row",parentRowExpandedClassName:"parent-row expanded",parentRowCollapsedComponent:"â–¶",parentRowExpandedComponent:"â–¼",externalLoadingComponent:null,externalIsLoading:!1,onRowClick:null,onRowMouseEnter:null,onRowMouseLeave:null,onRowWillMount:null,onRowWillUnmount:null}},getInitialState:function(){return{scrollTop:0,scrollHeight:this.props.bodyHeight,clientHeight:this.props.bodyHeight}},componentDidMount:function(){this.gridScroll()},componentDidUpdate:function(e,t){this.gridScroll()},gridScroll:function(){if(this.props.enableInfiniteScroll&&!this.props.externalIsLoading){var e=this.refs.scrollable,t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;if(null!==this.props.rowHeight&&this.state.scrollTop!==t&&Math.abs(this.state.scrollTop-t)>=this.getAdjustedRowHeight()){var o={scrollTop:t,scrollHeight:n,clientHeight:r};this.setState(o)}.6*(n-(t+r)-this.props.infiniteScrollLoadTreshold)<=this.props.infiniteScrollLoadTreshold&&this.props.nextPage()}},verifyProps:function(){null===this.props.columnSettings&&console.error("gridTable: The columnSettings prop is null and it shouldn't be"),null===this.props.rowSettings&&console.error("gridTable: The rowSettings prop is null and it shouldn't be")},getAdjustedRowHeight:function(){return this.props.rowHeight+2*this.props.paddingHeight},getNodeContent:function(){this.verifyProps();var e=this,t=!1;if(!this.props.externalIsLoading||this.props.enableInfiniteScroll){var n=e.props.data,o=null,i=null;if(this.props.enableInfiniteScroll&&null!==this.props.rowHeight&&void 0!==this.refs.scrollable){var l=e.getAdjustedRowHeight(),a=Math.ceil(e.state.clientHeight/l),u=Math.max(0,Math.floor(e.state.scrollTop/l)-.25*a),d=Math.min(u+1.25*a,this.props.data.length-1);n=n.slice(u,d+1);var c={height:u*l+"px"};o=r.createElement("tr",{key:"above-"+c.height,style:c});var p={height:(this.props.data.length-d)*l+"px"};i=r.createElement("tr",{key:"below-"+p.height,style:p})}var f=n.map((function(n,o){var i=void 0!==n.children&&n.children.length>0,l=e.props.rowSettings.getRowKey(n,o);return i&&(t=i),r.createElement(s,{useGriddleStyles:e.props.useGriddleStyles,isSubGriddle:e.props.isSubGriddle,parentRowExpandedClassName:e.props.parentRowExpandedClassName,parentRowCollapsedClassName:e.props.parentRowCollapsedClassName,parentRowExpandedComponent:e.props.parentRowExpandedComponent,parentRowCollapsedComponent:e.props.parentRowCollapsedComponent,data:n,key:l+"-container",uniqueId:l,columnSettings:e.props.columnSettings,rowSettings:e.props.rowSettings,paddingHeight:e.props.paddingHeight,multipleSelectionSettings:e.props.multipleSelectionSettings,rowHeight:e.props.rowHeight,hasChildren:i,tableClassName:e.props.className,onRowClick:e.props.onRowClick,onRowMouseEnter:e.props.onRowMouseEnter,onRowMouseLeave:e.props.onRowMouseLeave,onRowWillMount:e.props.onRowWillMount,onRowWillUnmount:e.props.onRowWillUnmount})}));if(this.props.showNoData){var h=this.props.columnSettings.getVisibleColumnCount();f.push(r.createElement("tr",{key:"no-data-section"},r.createElement("td",{colSpan:h},this.props.noDataSection)))}return o&&f.unshift(o),i&&f.push(i),{nodes:f,anyHasChildren:t}}return null},render:function(){var e=[],t=!1,n=this.getNodeContent();n&&(e=n.nodes,t=n.anyHasChildren);var o=null,s=null,l={width:"100%"};if(this.props.useFixedLayout&&(l.tableLayout="fixed"),this.props.enableInfiniteScroll&&(o={position:"relative",overflowY:"scroll",height:this.props.bodyHeight+"px",width:"100%"}),this.props.externalIsLoading){var a,u=null;this.props.useGriddleStyles&&(u={textAlign:"center",paddingBottom:"40px"}),a=this.props.columnSettings.getVisibleColumnCount();var d=this.props.externalLoadingComponent?r.createElement(this.props.externalLoadingComponent,null):r.createElement("div",null,"Loading...");s=r.createElement("tbody",null,r.createElement("tr",null,r.createElement("td",{style:u,colSpan:a},d)))}var c=this.props.showTableHeading?r.createElement(i,{useGriddleStyles:this.props.useGriddleStyles,useGriddleIcons:this.props.useGriddleIcons,sortSettings:this.props.sortSettings,multipleSelectionSettings:this.props.multipleSelectionSettings,columnSettings:this.props.columnSettings,filterByColumn:this.props.filterByColumn,rowSettings:this.props.rowSettings}):void 0;t||(e=r.createElement("tbody",null,e));var p=r.createElement("tbody",null);if(this.props.showPager){var f=this.props.useGriddleStyles?{padding:"0px",backgroundColor:"#EDEDED",border:"0px",color:"#222",height:this.props.showNoData?"20px":null}:null;p=r.createElement("tbody",null,r.createElement("tr",null,r.createElement("td",{colSpan:this.props.multipleSelectionSettings.isMultipleSelection?this.props.columnSettings.getVisibleColumnCount()+1:this.props.columnSettings.getVisibleColumnCount(),style:f,className:"footer-container"},this.props.showNoData?null:this.props.pagingContent)))}return this.props.useFixedHeader?(this.props.useGriddleStyles&&(l.tableLayout="fixed"),r.createElement("div",null,r.createElement("table",{className:this.props.className,style:this.props.useGriddleStyles&&l||null},c),r.createElement("div",{ref:"scrollable",onScroll:this.gridScroll,style:o},r.createElement("table",{className:this.props.className,style:this.props.useGriddleStyles&&l||null},e,s,p)))):r.createElement("div",{ref:"scrollable",onScroll:this.gridScroll,style:o},r.createElement("table",{className:this.props.className,style:this.props.useGriddleStyles&&l||null},c,e,s,p))}}));e.exports=l},9593:function(e,t,n){"use strict";var r=Object.assign||function(e){for(var t=1;t=0)return!0}return!1}))},defaultColumnFilter:function(e,t,n){var r=M(O(n)?n:[n],(function(e){return(e||"").toLowerCase()}));return k(b.getObjectValues(t),(function(e){return e=e.toString().toLowerCase(),k(r,(function(t){return e.indexOf(t)>=0}))}))},filterByColumnFilters:function(e){var t=this.props.columnFilterFunc||this.defaultColumnFilter,n=Object.keys(e).reduce((function(n,r){return N(n,(function(n){var o=b.getAt(n,r||""),i=e[r];return t(r||"",o,i)}))}),this.props.results),r={columnFilters:e};e?(r.filteredResults=n,r.maxPage=this.getMaxPage(r.filteredResults)):this.state.filter?r.filteredResults=this.props.useCustomFilterer?this.props.customFilterer(this.props.results,filter):this.defaultFilter(this.props.results,filter):r.filteredResults=null,this.setState(r)},filterByColumn:function(e,t){var n=this.state.columnFilters;if(n.hasOwnProperty(t)&&!e)n=P(n,t);else{var r={};r[t]=e,n=R({},n,r)}this.filterByColumnFilters(n)},setFilter:function(e){var t=arguments.length<=1||void 0===arguments[1]?null:arguments[1];if(this.props.useExternal)this.props.externalSetFilter(e);else{var n={page:0,filter:e};n.filteredResults=this.props.useCustomFilterer?this.props.customFilterer(t||this.props.results,e):this.defaultFilter(t||this.props.results,e),n.maxPage=this.getMaxPage(n.filteredResults),(D(e)||x(e)||I(e))&&(n.filter=e,n.filteredResults=null),this.setState(n),this._resetSelectedRows()}},setPageSize:function(e){if(this.props.useExternal)return this.setState({resultsPerPage:e}),void this.props.externalSetPageSize(e);this.state.resultsPerPage=e,this.setMaxPage()},toggleColumnChooser:function(){this.setState({showColumnChooser:!this.state.showColumnChooser})},isNullOrUndefined:function(e){return null==e},shouldUseCustomRowComponent:function(){return this.isNullOrUndefined(this.state.useCustomRowComponent)?this.props.useCustomRowComponent:this.state.useCustomRowComponent},shouldUseCustomGridComponent:function(){return this.isNullOrUndefined(this.state.useCustomGridComponent)?this.props.useCustomGridComponent:this.state.useCustomGridComponent},toggleCustomComponent:function(){"grid"===this.state.customComponentType?this.setState({useCustomGridComponent:!this.shouldUseCustomGridComponent()}):"row"===this.state.customComponentType&&this.setState({useCustomRowComponent:!this.shouldUseCustomRowComponent()})},getMaxPage:function(e,t){return this.props.useExternal?this.props.externalMaxPage:(t||(t=(e||this.getCurrentResults()).length),Math.ceil(t/this.state.resultsPerPage))},setMaxPage:function(e){var t=this.getMaxPage(e);this.state.maxPage!==t&&this.setState({page:0,maxPage:t,filteredColumns:this.columnSettings.filteredColumns})},setPage:function(e){if(this.props.useExternal)this.props.externalSetPage(e);else{if(e*this.state.resultsPerPage<=this.state.resultsPerPage*this.state.maxPage){var t={page:e};this.setState(t)}this.props.enableInfiniteScroll&&this.setState({isSelectAllChecked:!1})}},setColumns:function(e){this.columnSettings.filteredColumns=O(e)?e:[e],this.setState({filteredColumns:this.columnSettings.filteredColumns})},nextPage:function(){var e=this.getCurrentPage();e0&&this.setPage(e-1)},changeSort:function(e){if(!1!==this.props.enableSort){if(this.props.useExternal){var t=this.props.externalSortColumn!==e||!this.props.externalSortAscending;return this.setState({sortColumn:e,sortDirection:t?"asc":"desc"}),void this.props.externalChangeSort(e,t)}var n=C(this.props.columnMetadata,{columnName:e})||{},r=n.sortDirectionCycle?n.sortDirectionCycle:[null,"asc","desc"],o=r.indexOf(this.state.sortDirection&&e===this.state.sortColumn?this.state.sortDirection:null),i={page:0,sortColumn:e,sortDirection:r[o=(o+1)%r.length]?r[o]:null};this.setState(i)}},componentWillReceiveProps:function(e){if(e.results!==this.props.results&&this.setFilter(this.state.filter,e.results),this.setMaxPage(e.results),e.resultsPerPage!==this.props.resultsPerPage&&this.setPageSize(e.resultsPerPage),this.columnSettings.columnMetadata=e.columnMetadata,e.results.length>0){var t=b.keys(e.results[0]);this.columnSettings.allColumns.length==t.length&&this.columnSettings.allColumns.every((function(e,n){return e===t[n]}))||(this.columnSettings.allColumns=t)}else this.columnSettings.allColumns.length>0&&(this.columnSettings.allColumns=[]);if(e.selectedRowIds){var n=this.getDataForRender(this.getCurrentResults(e.results),this.columnSettings.getColumns(),!0);this.setState({isSelectAllChecked:this._getAreAllRowsChecked(e.selectedRowIds,M(n,this.props.uniqueIdentifier)),selectedRowIds:e.selectedRowIds})}},getInitialState:function(){return{maxPage:0,page:0,filteredResults:null,filteredColumns:[],filter:"",columnFilters:{},resultsPerPage:this.props.resultsPerPage||5,showColumnChooser:!1,isSelectAllChecked:!1,selectedRowIds:this.props.selectedRowIds}},componentWillMount:function(){this.verifyExternal(),this.verifyCustom(),this.columnSettings=new y(this.props.results.length>0?b.keys(this.props.results[0]):[],this.props.columns,this.props.childrenColumnName,this.props.columnMetadata,this.props.metadataColumns),this.rowSettings=new v(this.props.rowMetadata,this.props.useCustomTableRowComponent&&this.props.customTableRowComponent?this.props.customTableRowComponent:p,this.props.useCustomTableRowComponent),this.props.initialSort&&(this.props.useExternal?this.setState({sortColumn:this.props.externalSortColumn,sortDirection:this.props.externalSortAscending?"asc":"desc"}):this.changeSort(this.props.initialSort)),this.setMaxPage(),this.shouldUseCustomGridComponent()?this.setState({customComponentType:"grid"}):this.shouldUseCustomRowComponent()?this.setState({customComponentType:"row"}):this.setState({filteredColumns:this.columnSettings.filteredColumns})},componentDidMount:function(){if(this.props.componentDidMount&&"function"==typeof this.props.componentDidMount)return this.props.componentDidMount()},componentDidUpdate:function(){if(this.props.componentDidUpdate&&"function"==typeof this.props.componentDidUpdate)return this.props.componentDidUpdate(this.state)},verifyExternal:function(){!0===this.props.useExternal&&(null===this.props.externalSetPage&&console.error("useExternal is set to true but there is no externalSetPage function specified."),null===this.props.externalChangeSort&&console.error("useExternal is set to true but there is no externalChangeSort function specified."),null===this.props.externalSetFilter&&console.error("useExternal is set to true but there is no externalSetFilter function specified."),null===this.props.externalSetPageSize&&console.error("useExternal is set to true but there is no externalSetPageSize function specified."),null===this.props.externalMaxPage&&console.error("useExternal is set to true but externalMaxPage is not set."),null===this.props.externalCurrentPage&&console.error("useExternal is set to true but externalCurrentPage is not set. Griddle will not page correctly without that property when using external data."))},verifyCustom:function(){!0===this.props.useCustomGridComponent&&null===this.props.customGridComponent&&console.error("useCustomGridComponent is set to true but no custom component was specified."),!0===this.props.useCustomRowComponent&&null===this.props.customRowComponent&&console.error("useCustomRowComponent is set to true but no custom component was specified."),!0===this.props.useCustomGridComponent&&!0===this.props.useCustomRowComponent&&console.error("Cannot currently use both customGridComponent and customRowComponent."),!0===this.props.useCustomFilterer&&null===this.props.customFilterer&&console.error("useCustomFilterer is set to true but no custom filter function was specified."),!0===this.props.useCustomFilterComponent&&null===this.props.customFilterComponent&&console.error("useCustomFilterComponent is set to true but no customFilterComponent was specified.")},getDataForRender:function(e,t,n){var r=this,o=this;if(!this.props.useExternal){if(""!==this.state.sortColumn){var i,s=this.state.sortColumn,l=N(this.props.columnMetadata,{columnName:s}),a={columns:[],orders:[]};if(l.length>0&&(i=l[0].hasOwnProperty("customCompareFn")&&l[0].customCompareFn,l[0].multiSort&&(a=l[0].multiSort)),this.state.sortDirection)if("function"==typeof i)2===i.length?(e=e.sort((function(e,t){return i(L(e,s),L(t,s))})),"desc"===this.state.sortDirection&&e.reverse()):1===i.length&&(e=T(e,(function(e){return i(L(e,s))}),[this.state.sortDirection]));else{var u=[function(e){return(L(e,s)||"").toString().toLowerCase()}],d=[this.state.sortDirection];a.columns.forEach((function(e,t){u.push((function(t){return(L(t,e)||"").toString().toLowerCase()})),"asc"===a.orders[t]||"desc"===a.orders[t]?d.push(a.orders[t]):d.push(r.state.sortDirection)})),e=T(e,u,d)}}var c=this.getCurrentPage();if(!this.props.useExternal&&n&&this.state.resultsPerPage*(c+1)<=this.state.resultsPerPage*this.state.maxPage&&c>=0)if(this.isInfiniteScrollEnabled())e=S(e,(c+1)*this.state.resultsPerPage);else{var p=_(e,c*this.state.resultsPerPage);e=(E||F)(p,p.length-this.state.resultsPerPage)}}for(var f=[],h=0;h0&&(m.children=o.getDataForRender(m[o.props.childrenColumnName],t,!1),"children"!==o.props.childrenColumnName&&delete m[o.props.childrenColumnName]),f.push(m)}return f},getCurrentResults:function(e){return this.state.filteredResults||e||this.props.results},getCurrentPage:function(){return this.props.externalCurrentPage||this.state.page},getCurrentSort:function(){return this.props.useExternal?this.props.externalSortColumn:this.state.sortColumn},getCurrentSortAscending:function(){return this.props.useExternal?this.props.externalSortAscending:"asc"===this.state.sortDirection},getCurrentMaxPage:function(){return this.props.useExternal?this.props.externalMaxPage:this.state.maxPage},getSortObject:function(){return{enableSort:this.props.enableSort,changeSort:this.changeSort,sortColumn:this.getCurrentSort(),sortAscending:this.getCurrentSortAscending(),sortDirection:this.state.sortDirection,sortAscendingClassName:this.props.sortAscendingClassName,sortDescendingClassName:this.props.sortDescendingClassName,sortAscendingComponent:this.props.sortAscendingComponent,sortDescendingComponent:this.props.sortDescendingComponent,sortDefaultComponent:this.props.sortDefaultComponent}},_toggleSelectAll:function(){var e=this.getDataForRender(this.getCurrentResults(),this.columnSettings.getColumns(),!0),t=!this.state.isSelectAllChecked,n=JSON.parse(JSON.stringify(this.state.selectedRowIds)),r=this;w(e,(function(e){r._updateSelectedRowIds(e[r.props.uniqueIdentifier],n,t)}),this),this.setState({isSelectAllChecked:t,selectedRowIds:n}),this.props.onSelectionChange&&this.props.onSelectionChange(n,t)},_toggleSelectRow:function(e,t){var n=this.getDataForRender(this.getCurrentResults(),this.columnSettings.getColumns(),!0),r=JSON.parse(JSON.stringify(this.state.selectedRowIds));this._updateSelectedRowIds(e[this.props.uniqueIdentifier],r,t);var o=this._getAreAllRowsChecked(r,M(n,this.props.uniqueIdentifier));this.setState({isSelectAllChecked:o,selectedRowIds:r}),this.props.onSelectionChange&&this.props.onSelectionChange(r,o)},_updateSelectedRowIds:function(e,t,n){n?void 0===C(t,(function(t){return e===t}))&&t.push(e):t.splice(t.indexOf(e),1)},_getIsSelectAllChecked:function(){return this.state.isSelectAllChecked},_getAreAllRowsChecked:function(e,t){return t.length===A(t,e).length},_getIsRowChecked:function(e){return this.state.selectedRowIds.indexOf(e[this.props.uniqueIdentifier])>-1},getSelectedRowIds:function(){return this.state.selectedRowIds},_resetSelectedRows:function(){this.setState({isSelectAllChecked:!1,selectedRowIds:[]})},getMultipleSelectionObject:function(){return{isMultipleSelection:!C(this.props.results,(function(e){return"children"in e}))&&this.props.isMultipleSelection,toggleSelectAll:this._toggleSelectAll,getIsSelectAllChecked:this._getIsSelectAllChecked,toggleSelectRow:this._toggleSelectRow,getSelectedRowIds:this.getSelectedRowIds,getIsRowChecked:this._getIsRowChecked}},isInfiniteScrollEnabled:function(){return!this.props.useCustomPagerComponent&&this.props.enableInfiniteScroll},getClearFixStyles:function(){return{clear:"both",display:"table",width:"100%"}},getSettingsStyles:function(){return{float:"left",width:"50%",textAlign:"right"}},getFilterStyles:function(){return{float:"left",width:"50%",textAlign:"left",color:"#222",minHeight:"1px"}},getFilter:function(){return this.props.showFilter&&!1===this.shouldUseCustomGridComponent()?this.props.useCustomFilterComponent?o.createElement(g,{changeFilter:this.setFilter,placeholderText:this.props.filterPlaceholderText,customFilterComponent:this.props.customFilterComponent,results:this.props.results,currentResults:this.getCurrentResults()}):o.createElement(a,{changeFilter:this.setFilter,placeholderText:this.props.filterPlaceholderText}):""},getSettings:function(){return this.props.showSettings?o.createElement("button",{type:"button",className:this.props.settingsToggleClassName,onClick:this.toggleColumnChooser,style:this.props.useGriddleStyles?{background:"none",border:"none",padding:0,margin:0,fontSize:14}:null},this.props.settingsText,this.props.settingsIconComponent):""},getTopSection:function(e,t){if(!1===this.props.showFilter&&!1===this.props.showSettings)return"";var n=null,r=null,i=null;return this.props.useGriddleStyles&&(n=this.getFilterStyles(),r=this.getSettingsStyles(),i=this.getClearFixStyles()),o.createElement("div",{className:"top-section",style:i},o.createElement("div",{className:"griddle-filter",style:n},e),o.createElement("div",{className:"griddle-settings-toggle",style:r},t))},getPagingSection:function(e,t){if(!1!==(this.props.showPager&&!this.isInfiniteScrollEnabled()&&!this.shouldUseCustomGridComponent()))return o.createElement("div",{className:"griddle-footer"},this.props.useCustomPagerComponent?o.createElement(m,{customPagerComponentOptions:this.props.customPagerComponentOptions,next:this.nextPage,previous:this.previousPage,currentPage:e,maxPage:t,setPage:this.setPage,nextText:this.props.nextText,previousText:this.props.previousText,customPagerComponent:this.props.customPagerComponent}):o.createElement(u,{useGriddleStyles:this.props.useGriddleStyles,next:this.nextPage,previous:this.previousPage,nextClassName:this.props.nextClassName,nextIconComponent:this.props.nextIconComponent,previousClassName:this.props.previousClassName,previousIconComponent:this.props.previousIconComponent,currentPage:e,maxPage:t,setPage:this.setPage,nextText:this.props.nextText,previousText:this.props.previousText}))},getColumnSelectorSection:function(e,t){return this.state.showColumnChooser?o.createElement(d,{columns:e,selectedColumns:t,setColumns:this.setColumns,settingsText:this.props.settingsText,settingsIconComponent:this.props.settingsIconComponent,maxRowsText:this.props.maxRowsText,setPageSize:this.setPageSize,showSetPageSize:!this.shouldUseCustomGridComponent(),resultsPerPage:this.state.resultsPerPage,enableToggleCustom:this.props.enableToggleCustom,toggleCustomComponent:this.toggleCustomComponent,useCustomComponent:this.shouldUseCustomRowComponent()||this.shouldUseCustomGridComponent(),useGriddleStyles:this.props.useGriddleStyles,enableCustomFormatText:this.props.enableCustomFormatText,columnMetadata:this.props.columnMetadata}):""},getCustomGridSection:function(){return o.createElement(this.props.customGridComponent,r({data:this.props.results,className:this.props.customGridComponentClassName},this.props.gridMetadata))},getCustomRowSection:function(e,t,n,r,i){return o.createElement("div",null,o.createElement(h,{data:e,columns:t,metadataColumns:n,globalData:i,className:this.props.customRowComponentClassName,customComponent:this.props.customRowComponent,style:this.props.useGriddleStyles?this.getClearFixStyles():null}),this.props.showPager&&r)},getStandardGridSection:function(e,t,n,r,i){var s=this.getSortObject(),a=this.getMultipleSelectionObject(),u=this.shouldShowNoDataSection(e),d=this.getNoDataSection();return o.createElement("div",{className:"griddle-body"},o.createElement(l,{useGriddleStyles:this.props.useGriddleStyles,noDataSection:d,showNoData:u,columnSettings:this.columnSettings,rowSettings:this.rowSettings,sortSettings:s,multipleSelectionSettings:a,filterByColumn:this.filterByColumn,isSubGriddle:this.props.isSubGriddle,useGriddleIcons:this.props.useGriddleIcons,useFixedLayout:this.props.useFixedLayout,showPager:this.props.showPager,pagingContent:r,data:e,className:this.props.tableClassName,enableInfiniteScroll:this.isInfiniteScrollEnabled(),nextPage:this.nextPage,showTableHeading:this.props.showTableHeading,useFixedHeader:this.props.useFixedHeader,parentRowCollapsedClassName:this.props.parentRowCollapsedClassName,parentRowExpandedClassName:this.props.parentRowExpandedClassName,parentRowCollapsedComponent:this.props.parentRowCollapsedComponent,parentRowExpandedComponent:this.props.parentRowExpandedComponent,bodyHeight:this.props.bodyHeight,paddingHeight:this.props.paddingHeight,rowHeight:this.props.rowHeight,infiniteScrollLoadTreshold:this.props.infiniteScrollLoadTreshold,externalLoadingComponent:this.props.externalLoadingComponent,externalIsLoading:this.props.externalIsLoading,hasMorePages:i,onRowClick:this.props.onRowClick,onRowMouseEnter:this.props.onRowMouseEnter,onRowMouseLeave:this.props.onRowMouseLeave,onRowWillMount:this.props.onRowWillMount,onRowWillUnmount:this.props.onRowWillUnmount}))},getContentSection:function(e,t,n,r,o,i){return this.shouldUseCustomGridComponent()&&null!==this.props.customGridComponent?this.getCustomGridSection():this.shouldUseCustomRowComponent()?this.getCustomRowSection(e,t,n,r,i):this.getStandardGridSection(e,t,n,r,o)},getNoDataSection:function(){return null!=this.props.customNoDataComponent?o.createElement("div",{className:this.props.noDataClassName},o.createElement(this.props.customNoDataComponent,this.props.customNoDataComponentProps)):o.createElement(c,{noDataMessage:this.props.noDataMessage})},shouldShowNoDataSection:function(e){return!this.props.allowEmptyGrid&&(!1===this.props.useExternal&&(void 0===e||0===e.length)||!0===this.props.useExternal&&!1===this.props.externalIsLoading&&0===e.length)},render:function(){var e=this.getCurrentResults(),t=(this.props.tableClassName,this.getFilter()),n=this.getSettings(),r=this.getTopSection(t,n),i=[],s=this.columnSettings.getColumns(),l=this.getDataForRender(e,s,!0),a=this.columnSettings.getMetadataColumns();this.props.columnMetadata?w(this.props.columnMetadata,(function(e){"boolean"==typeof e.visible&&!1===e.visible||i.push(e.columnName)})):i=b.keys(P(e[0],a)),i=this.columnSettings.orderColumns(i);var u=this.getCurrentPage(),d=this.getCurrentMaxPage(),c=u+10?"griddle "+this.props.gridClassName:"griddle";return m+=this.shouldUseCustomRowComponent()?" griddle-custom":"",o.createElement("div",{className:m},r,h,o.createElement("div",{className:"griddle-container",style:this.props.useGriddleStyles&&!this.props.isSubGriddle?{border:"1px solid #DDD"}:null},f))}});f.Griddle=e.exports=U},1545:function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n-1}},9905:function(e){e.exports=function(e,t,n){for(var r=-1,o=null==e?0:e.length;++r=200&&(c=a,p=!1,t=new r(t));e:for(;++d0&&i(d)?n>1?e(d,n-1,i,s,l):r(l,d):s||(l[l.length]=d)}return l}},6649:function(e,t,n){var r=n(3221)();e.exports=r},641:function(e,t,n){var r=n(6649),o=n(5950);e.exports=function(e,t){return e&&r(e,t,o)}},7422:function(e,t,n){var r=n(1769),o=n(7797);e.exports=function(e,t){for(var n=0,i=(t=r(t,e)).length;null!=e&&n=120&&y.length>=120)?new r(f&&y):void 0}y=e[0];var v=-1,b=h[0];e:for(;++vo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(o);++rt||s&&l&&u&&!a&&!d||o&&l&&u||!n&&u||!i)return 1;if(!o&&!s&&!d&&e=a?u:u*("desc"==n[o]?-1:1)}return e.index-t.index}},3007:function(e){e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n1?n[i-1]:void 0,l=i>2?n[2]:void 0;for(s=e.length>3&&"function"==typeof s?(i--,s):void 0,l&&o(n[0],n[1],l)&&(s=i<3?void 0:s,i=1),t=Object(t);++r-1?l[a?t[u]:u]:void 0}}},2963:function(e,t,n){var r=n(1372),o=n(5861),i=n(317),s=n(799);e.exports=function(e){return function(t){var n=o(t);return"[object Map]"==n?i(t):"[object Set]"==n?s(t):r(t,e(t))}}},3138:function(e,t,n){var r=n(1331);e.exports=function(e){return r(e)?void 0:e}},3243:function(e,t,n){var r=n(6110),o=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=o},5911:function(e,t,n){var r=n(8859),o=n(4248),i=n(9219);e.exports=function(e,t,n,s,l,a){var u=1&n,d=e.length,c=t.length;if(d!=c&&!(u&&c>d))return!1;var p=a.get(e),f=a.get(t);if(p&&f)return p==t&&f==e;var h=-1,m=!0,g=2&n?new r:void 0;for(a.set(e,t),a.set(t,e);++h-1&&e%1==0&&e-1}},1175:function(e,t,n){var r=n(6025);e.exports=function(e,t){var n=this.__data__,o=r(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this}},3040:function(e,t,n){var r=n(1549),o=n(79),i=n(8223);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(i||o),string:new r}}},7670:function(e,t,n){var r=n(2651);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},289:function(e,t,n){var r=n(2651);e.exports=function(e){return r(this,e).get(e)}},4509:function(e,t,n){var r=n(2651);e.exports=function(e){return r(this,e).has(e)}},2949:function(e,t,n){var r=n(2651);e.exports=function(e,t){var n=r(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this}},317:function(e){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}},7197:function(e){e.exports=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}},2224:function(e,t,n){var r=n(104);e.exports=function(e){var t=r(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}},1042:function(e,t,n){var r=n(6110)(Object,"create");e.exports=r},3650:function(e,t,n){var r=n(4335)(Object.keys,Object);e.exports=r},181:function(e){e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},6009:function(e,t,n){e=n.nmd(e);var r=n(4840),o=t&&!t.nodeType&&t,i=o&&e&&!e.nodeType&&e,s=i&&i.exports===o&&r.process,l=function(){try{var e=i&&i.require&&i.require("util").types;return e||s&&s.binding&&s.binding("util")}catch(e){}}();e.exports=l},9350:function(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},4335:function(e){e.exports=function(e,t){return function(n){return e(t(n))}}},6757:function(e,t,n){var r=n(1033),o=Math.max;e.exports=function(e,t,n){return t=o(void 0===t?e.length-1:t,0),function(){for(var i=arguments,s=-1,l=o(i.length-t,0),a=Array(l);++s0){if(++n>=800)return arguments[0]}else n=0;return e.apply(void 0,arguments)}}},1420:function(e,t,n){var r=n(79);e.exports=function(){this.__data__=new r,this.size=0}},938:function(e){e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},3605:function(e){e.exports=function(e){return this.__data__.get(e)}},9817:function(e){e.exports=function(e){return this.__data__.has(e)}},945:function(e,t,n){var r=n(79),o=n(8223),i=n(3661);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var s=n.__data__;if(!o||s.length<199)return s.push([e,t]),this.size=++n.size,this;n=this.__data__=new i(s)}return n.set(e,t),this.size=n.size,this}},6959:function(e){e.exports=function(e,t,n){for(var r=n-1,o=e.length;++r2?t[2]:void 0;for(u&&i(t[0],t[1],u)&&(r=1);++n-1:!!d&&r(e,t,n)>-1}},3424:function(e,t,n){var r=n(5160);e.exports=function(e){return(null==e?0:e.length)?r(e,0,-1):[]}},5287:function(e,t,n){var r=n(4932),o=n(7185),i=n(9302),s=n(741),l=i((function(e){var t=r(e,s);return t.length&&t[0]===e[0]?o(t):[]}));e.exports=l},2428:function(e,t,n){var r=n(7534),o=n(346),i=Object.prototype,s=i.hasOwnProperty,l=i.propertyIsEnumerable,a=r(function(){return arguments}())?r:function(e){return o(e)&&s.call(e,"callee")&&!l.call(e,"callee")};e.exports=a},6449:function(e){var t=Array.isArray;e.exports=t},4894:function(e,t,n){var r=n(1882),o=n(294);e.exports=function(e){return null!=e&&o(e.length)&&!r(e)}},3693:function(e,t,n){var r=n(4894),o=n(346);e.exports=function(e){return o(e)&&r(e)}},3656:function(e,t,n){e=n.nmd(e);var r=n(9325),o=n(9935),i=t&&!t.nodeType&&t,s=i&&e&&!e.nodeType&&e,l=s&&s.exports===i?r.Buffer:void 0,a=(l?l.isBuffer:void 0)||o;e.exports=a},2193:function(e,t,n){var r=n(8984),o=n(5861),i=n(2428),s=n(6449),l=n(4894),a=n(3656),u=n(5527),d=n(7167),c=Object.prototype.hasOwnProperty;e.exports=function(e){if(null==e)return!0;if(l(e)&&(s(e)||"string"==typeof e||"function"==typeof e.splice||a(e)||d(e)||i(e)))return!e.length;var t=o(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(u(e))return!r(e).length;for(var n in e)if(c.call(e,n))return!1;return!0}},1882:function(e,t,n){var r=n(2552),o=n(3805);e.exports=function(e){if(!o(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},294:function(e){e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},7730:function(e,t,n){var r=n(9172),o=n(7301),i=n(6009),s=i&&i.isMap,l=s?o(s):r;e.exports=l},5187:function(e){e.exports=function(e){return null===e}},3805:function(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},346:function(e){e.exports=function(e){return null!=e&&"object"==typeof e}},1331:function(e,t,n){var r=n(2552),o=n(8879),i=n(346),s=Function.prototype,l=Object.prototype,a=s.toString,u=l.hasOwnProperty,d=a.call(Object);e.exports=function(e){if(!i(e)||"[object Object]"!=r(e))return!1;var t=o(e);if(null===t)return!0;var n=u.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&a.call(n)==d}},8440:function(e,t,n){var r=n(6038),o=n(7301),i=n(6009),s=i&&i.isSet,l=s?o(s):r;e.exports=l},5015:function(e,t,n){var r=n(2552),o=n(6449),i=n(346);e.exports=function(e){return"string"==typeof e||!o(e)&&i(e)&&"[object String]"==r(e)}},4394:function(e,t,n){var r=n(2552),o=n(346);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},7167:function(e,t,n){var r=n(4901),o=n(7301),i=n(6009),s=i&&i.isTypedArray,l=s?o(s):r;e.exports=l},2216:function(e){e.exports=function(e){return void 0===e}},5950:function(e,t,n){var r=n(695),o=n(8984),i=n(4894);e.exports=function(e){return i(e)?r(e):o(e)}},7241:function(e,t,n){var r=n(695),o=n(2903),i=n(4894);e.exports=function(e){return i(e)?r(e,!0):o(e)}},8090:function(e){e.exports=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}},5378:function(e,t,n){var r=n(4932),o=n(5389),i=n(5128),s=n(6449);e.exports=function(e,t){return(s(e)?r:i)(e,o(t,3))}},104:function(e,t,n){var r=n(3661);function o(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=e.apply(this,r);return n.cache=i.set(o,s)||i,s};return n.cache=new(o.Cache||r),n}o.Cache=r,e.exports=o},179:function(e,t,n){var r=n(4932),o=n(9999),i=n(9931),s=n(1769),l=n(1791),a=n(3138),u=n(8816),d=n(3349),c=u((function(e,t){var n={};if(null==e)return n;var u=!1;t=r(t,(function(t){return t=s(t,e),u||(u=t.length>1),t})),l(e,d(e),n),u&&(n=o(n,7,a));for(var c=t.length;c--;)i(n,t[c]);return n}));e.exports=c},2877:function(e,t,n){var r=n(6155),o=n(6449);e.exports=function(e,t,n,i){return null==e?[]:(o(t)||(t=null==t?[]:[t]),o(n=i?void 0:n)||(n=null==n?[]:[n]),r(e,t,n))}},4383:function(e,t,n){var r=n(6001),o=n(8816)((function(e,t){return null==e?{}:r(e,t)}));e.exports=o},583:function(e,t,n){var r=n(7237),o=n(7255),i=n(8586),s=n(7797);e.exports=function(e){return i(e)?r(s(e)):o(e)}},2426:function(e,t,n){var r=n(4248),o=n(5389),i=n(916),s=n(6449),l=n(6800);e.exports=function(e,t,n){var a=s(e)?r:i;return n&&l(e,t,n)&&(t=void 0),a(e,o(t,3))}},3031:function(e,t,n){var r=n(3120),o=n(6155),i=n(9302),s=n(6800),l=i((function(e,t){if(null==e)return[];var n=t.length;return n>1&&s(e,t[0],t[1])?t=[]:n>2&&s(t[0],t[1],t[2])&&(t=[t[0]]),o(e,r(t,1),[])}));e.exports=l},3345:function(e){e.exports=function(){return[]}},9935:function(e){e.exports=function(){return!1}},4921:function(e,t,n){var r=n(5160),o=n(1489);e.exports=function(e,t,n){return e&&e.length?(t=n||void 0===t?1:o(t),r(e,0,t<0?0:t)):[]}},7400:function(e,t,n){var r=n(9374),o=1/0;e.exports=function(e){return e?(e=r(e))===o||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},1489:function(e,t,n){var r=n(7400);e.exports=function(e){var t=r(e),n=t%1;return t==t?n?t-n:t:0}},9374:function(e,t,n){var r=n(4128),o=n(3805),i=n(4394),s=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,a=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=l.test(e);return n||a.test(e)?u(e.slice(2),n?2:8):s.test(e)?NaN:+e}},8938:function(e,t,n){var r=n(2963)(n(5950));e.exports=r},2072:function(e,t,n){var r=n(4932),o=n(3007),i=n(6449),s=n(4394),l=n(1802),a=n(7797),u=n(3222);e.exports=function(e){return i(e)?r(e,a):s(e)?[e]:o(l(u(e)))}},3222:function(e,t,n){var r=n(7556);e.exports=function(e){return null==e?"":r(e)}},7200:function(e,t,n){var r=n(3222),o=0;e.exports=function(e){var t=++o;return r(e)+t}},5880:function(e,t,n){var r=n(514),o=n(5950);e.exports=function(e){return null==e?[]:r(e,o(e))}},1648:function(e,t,n){var r=n(3915),o=n(9302),i=n(3693),s=o((function(e,t){return i(e)?r(e,t):[]}));e.exports=s},7248:function(e,t,n){var r=n(6547),o=n(1234);e.exports=function(e,t){return o(e||[],t||[],r)}},5228:function(e){"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,o){for(var i,s,l=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),a=1;a1)for(var n=1;n1?t-1:0),r=1;r2?n-2:0),i=2;i1&&void 0!==arguments[1]&&arguments[1],n=this.props,r=n.tolerance,o=n.onSelection,i=n.onEndSelection,s=[],l=(0,d.findDOMNode)(this.refs.selectbox);l&&(this._registry.forEach((function(e){e.domNode&&(0,g.default)(l,e.domNode,r)&&!s.includes(e.key)&&s.push(e.key)})),t?"function"==typeof i&&i(s,e):"function"==typeof o&&o(s,e))}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.enabled,r=e.fixedPosition,o=e.className,i=e.selectingClassName,s=this.state,l=s.isBoxSelecting,a=s.boxLeft,d=s.boxTop,c=s.boxWidth,f=s.boxHeight,h=this.props.component;if(!n)return u.default.createElement(h,{className:o},t);var m={left:a,top:d,width:c,height:f,zIndex:9e3,position:r?"fixed":"absolute",cursor:"default"},g={backgroundColor:"transparent",border:"1px dashed #999",width:"100%",height:"100%",float:"left"},y={position:"relative",overflow:"visible"};return u.default.createElement(h,{className:(0,p.default)(o,l?i:null),style:y},l?u.default.createElement("div",{style:m,ref:"selectbox"},u.default.createElement("span",{style:g})):null,t)}}]),t}(a.Component);v.propTypes={children:c.default.node,onBeginSelection:c.default.func,onEndSelection:c.default.func,onSelection:c.default.func,component:c.default.node,tolerance:c.default.number,fixedPosition:c.default.bool,preventDefault:c.default.bool,onNonItemClick:c.default.func,enabled:c.default.bool,className:c.default.string,selectingClassName:c.default.string},v.defaultProps={component:"div",tolerance:0,fixedPosition:!1,preventDefault:!0,enabled:!0},v.childContextTypes={selectable:c.default.object},t.default=v},function(e,t,n){"use strict";(function(t){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=n(1),i=n(2),s=n(8),l=n(15),a=n(3),u=n(16);e.exports=function(e,n){function d(e){var t=e&&(I&&e[I]||e[x]);if("function"==typeof t)return t}function c(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function p(e){this.message=e,this.stack=""}function f(e){function r(r,u,d,c,f,h,m){if(c=c||D,h=h||d,m!==a)if(n)i(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("production"!==t.env.NODE_ENV&&"undefined"!=typeof console){var g=c+":"+d;!o[g]&&l<3&&(s(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",h,c),o[g]=!0,l++)}return null==u[d]?r?new p(null===u[d]?"The "+f+" `"+h+"` is marked as required in `"+c+"`, but its value is `null`.":"The "+f+" `"+h+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:e(u,d,c,f,h)}if("production"!==t.env.NODE_ENV)var o={},l=0;var u=r.bind(null,!1);return u.isRequired=r.bind(null,!0),u}function h(e){function t(t,n,r,o,i,s){var l=t[n];return w(l)!==e?new p("Invalid "+o+" `"+i+"` of type `"+F(l)+"` supplied to `"+r+"`, expected `"+e+"`."):null}return f(t)}function m(e){function t(t,n,r,o,i){if("function"!=typeof e)return new p("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s))return new p("Invalid "+o+" `"+i+"` of type `"+w(s)+"` supplied to `"+r+"`, expected an array.");for(var l=0;ln+l||t+o-ar+s)};t.default=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=e instanceof HTMLElement?(0,r.default)(e):e,s=t instanceof HTMLElement?(0,r.default)(t):t;return o(i.top,i.left,s.top,s.left,i.offsetWidth,i.offsetHeight,s.offsetWidth,s.offsetHeight,n)}},function(e,t,n){"use strict";(function(t){function n(e,t,n){function r(t){var n=m,r=g;return m=g=void 0,w=t,v=e.apply(r,n)}function i(e){return w=e,b=setTimeout(d,t),F?r(e):v}function s(e){var n=t-(e-_);return A?C(n,y-(e-w)):n}function a(e){var n=e-_;return void 0===_||n>=t||n<0||A&&e-w>=y}function d(){var e=S();if(a(e))return c(e);b=setTimeout(d,s(e))}function c(e){return b=void 0,O&&m?r(e):(m=g=void 0,v)}function p(){void 0!==b&&clearTimeout(b),w=0,m=_=g=b=void 0}function f(){return void 0===b?v:c(S())}function h(){var e=S(),n=a(e);if(m=arguments,g=this,_=e,n){if(void 0===b)return i(_);if(A)return b=setTimeout(d,t),r(_)}return void 0===b&&(b=setTimeout(d,t)),v}var m,g,y,v,b,_,w=0,F=!1,A=!1,O=!0;if("function"!=typeof e)throw new TypeError(u);return t=l(t)||0,o(n)&&(F=!!n.leading,y=(A="maxWait"in n)?E(l(n.maxWait)||0,t):y,O="trailing"in n?!!n.trailing:O),h.cancel=p,h.flush=f,h}function r(e,t,r){var i=!0,s=!0;if("function"!=typeof e)throw new TypeError(u);return o(r)&&(i="leading"in r?!!r.leading:i,s="trailing"in r?!!r.trailing:s),n(e,t,{leading:i,maxWait:t,trailing:s})}function o(e){var t=void 0===e?"undefined":a(e);return!!e&&("object"==t||"function"==t)}function i(e){return!!e&&"object"==(void 0===e?"undefined":a(e))}function s(e){return"symbol"==(void 0===e?"undefined":a(e))||i(e)&&_.call(e)==c}function l(e){if("number"==typeof e)return e;if(s(e))return d;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(p,"");var n=h.test(e);return n||m.test(e)?g(e.slice(2),n?2:8):f.test(e)?d:+e}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u="Expected a function",d=NaN,c="[object Symbol]",p=/^\s+|\s+$/g,f=/^[-+]0x[0-9a-f]+$/i,h=/^0b[01]+$/i,m=/^0o[0-7]+$/i,g=parseInt,y="object"==(void 0===t?"undefined":a(t))&&t&&t.Object===Object&&t,v="object"==("undefined"==typeof self?"undefined":a(self))&&self&&self.Object===Object&&self,b=y||v||Function("return this")(),_=Object.prototype.toString,E=Math.max,C=Math.min,S=function(){return b.Date.now()};e.exports=r}).call(t,n(21))},function(e,t,n){"use strict";var r,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"===("undefined"==typeof window?"undefined":o(window))&&(r=window)}e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function 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)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n
'),this.element.appendChild(e));let t=e.getElementsByTagName("span")[0];return t&&(null!=t.textContent?t.textContent=this.options.dictFallbackMessage:null!=t.innerText&&(t.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize(e,t,n,r){let o={srcX:0,srcY:0,srcWidth:e.width,srcHeight:e.height},i=e.width/e.height;null==t&&null==n?(t=o.srcWidth,n=o.srcHeight):null==t?t=n*i:null==n&&(n=t/i);let s=(t=Math.min(t,o.srcWidth))/(n=Math.min(n,o.srcHeight));if(o.srcWidth>t||o.srcHeight>n)if("crop"===r)i>s?(o.srcHeight=e.height,o.srcWidth=o.srcHeight*s):(o.srcWidth=e.width,o.srcHeight=o.srcWidth/s);else{if("contain"!==r)throw new Error(`Unknown resizeMethod '${r}'`);i>s?n=t/i:t=n*i}return o.srcX=(e.width-o.srcWidth)/2,o.srcY=(e.height-o.srcHeight)/2,o.trgWidth=t,o.trgHeight=n,o},transformFile(e,t){return(this.options.resizeWidth||this.options.resizeHeight)&&e.type.match(/image.*/)?this.resizeImage(e,this.options.resizeWidth,this.options.resizeHeight,this.options.resizeMethod,t):t(e)},previewTemplate:i('
\n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n \n \n \n
\n
\n \n \n \n
\n
\n'),drop(e){return this.element.classList.remove("dz-drag-hover")},dragstart(e){},dragend(e){return this.element.classList.remove("dz-drag-hover")},dragenter(e){return this.element.classList.add("dz-drag-hover")},dragover(e){return this.element.classList.add("dz-drag-hover")},dragleave(e){return this.element.classList.remove("dz-drag-hover")},paste(e){},reset(){return this.element.classList.remove("dz-started")},addedfile(e){if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer&&!this.options.disablePreviews){for(var t of(e.previewElement=a.createElement(this.options.previewTemplate.trim()),e.previewTemplate=e.previewElement,this.previewsContainer.appendChild(e.previewElement),e.previewElement.querySelectorAll("[data-dz-name]")))t.textContent=e.name;for(t of e.previewElement.querySelectorAll("[data-dz-size]"))t.innerHTML=this.filesize(e.size);this.options.addRemoveLinks&&(e._removeLink=a.createElement(`${this.options.dictRemoveFile}`),e.previewElement.appendChild(e._removeLink));let n=t=>(t.preventDefault(),t.stopPropagation(),e.status===a.UPLOADING?a.confirm(this.options.dictCancelUploadConfirmation,(()=>this.removeFile(e))):this.options.dictRemoveFileConfirmation?a.confirm(this.options.dictRemoveFileConfirmation,(()=>this.removeFile(e))):this.removeFile(e));for(let t of e.previewElement.querySelectorAll("[data-dz-remove]"))t.addEventListener("click",n)}},removedfile(e){return null!=e.previewElement&&null!=e.previewElement.parentNode&&e.previewElement.parentNode.removeChild(e.previewElement),this._updateMaxFilesReachedClass()},thumbnail(e,t){if(e.previewElement){e.previewElement.classList.remove("dz-file-preview");for(let n of e.previewElement.querySelectorAll("[data-dz-thumbnail]"))n.alt=e.name,n.src=t;return setTimeout((()=>e.previewElement.classList.add("dz-image-preview")),1)}},error(e,t){if(e.previewElement){e.previewElement.classList.add("dz-error"),"string"!=typeof t&&t.error&&(t=t.error);for(let n of e.previewElement.querySelectorAll("[data-dz-errormessage]"))n.textContent=t}},errormultiple(){},processing(e){if(e.previewElement&&(e.previewElement.classList.add("dz-processing"),e._removeLink))return e._removeLink.innerHTML=this.options.dictCancelUpload},processingmultiple(){},uploadprogress(e,t,n){if(e.previewElement)for(let n of e.previewElement.querySelectorAll("[data-dz-uploadprogress]"))"PROGRESS"===n.nodeName?n.value=t:n.style.width=`${t}%`},totaluploadprogress(){},sending(){},sendingmultiple(){},success(e){if(e.previewElement)return e.previewElement.classList.add("dz-success")},successmultiple(){},canceled(e){return this.emit("error",e,this.options.dictUploadCanceled)},canceledmultiple(){},complete(e){if(e._removeLink&&(e._removeLink.innerHTML=this.options.dictRemoveFile),e.previewElement)return e.previewElement.classList.add("dz-complete")},completemultiple(){},maxfilesexceeded(){},maxfilesreached(){},queuecomplete(){},addedfiles(){}};class a extends s{static initClass(){this.prototype.Emitter=s,this.prototype.events=["drop","dragstart","dragend","dragenter","dragover","dragleave","addedfile","addedfiles","removedfile","thumbnail","error","errormultiple","processing","processingmultiple","uploadprogress","totaluploadprogress","sending","sendingmultiple","success","successmultiple","canceled","canceledmultiple","complete","completemultiple","reset","maxfilesexceeded","maxfilesreached","queuecomplete"],this.prototype._thumbnailQueue=[],this.prototype._processingThumbnail=!1}getAcceptedFiles(){return this.files.filter((e=>e.accepted)).map((e=>e))}getRejectedFiles(){return this.files.filter((e=>!e.accepted)).map((e=>e))}getFilesWithStatus(e){return this.files.filter((t=>t.status===e)).map((e=>e))}getQueuedFiles(){return this.getFilesWithStatus(a.QUEUED)}getUploadingFiles(){return this.getFilesWithStatus(a.UPLOADING)}getAddedFiles(){return this.getFilesWithStatus(a.ADDED)}getActiveFiles(){return this.files.filter((e=>e.status===a.UPLOADING||e.status===a.QUEUED)).map((e=>e))}init(){if("form"===this.element.tagName&&this.element.setAttribute("enctype","multipart/form-data"),this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")&&this.element.appendChild(a.createElement(`
`)),this.clickableElements.length){let e=()=>{this.hiddenFileInput&&this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=document.createElement("input"),this.hiddenFileInput.setAttribute("type","file"),(null===this.options.maxFiles||this.options.maxFiles>1)&&this.hiddenFileInput.setAttribute("multiple","multiple"),this.hiddenFileInput.className="dz-hidden-input",null!==this.options.acceptedFiles&&this.hiddenFileInput.setAttribute("accept",this.options.acceptedFiles),null!==this.options.capture&&this.hiddenFileInput.setAttribute("capture",this.options.capture),this.hiddenFileInput.setAttribute("tabindex","-1"),this.hiddenFileInput.style.visibility="hidden",this.hiddenFileInput.style.position="absolute",this.hiddenFileInput.style.top="0",this.hiddenFileInput.style.left="0",this.hiddenFileInput.style.height="0",this.hiddenFileInput.style.width="0",a.getElement(this.options.hiddenInputContainer,"hiddenInputContainer").appendChild(this.hiddenFileInput),this.hiddenFileInput.addEventListener("change",(()=>{let{files:t}=this.hiddenFileInput;if(t.length)for(let e of t)this.addFile(e);this.emit("addedfiles",t),e()}))};e()}this.URL=null!==window.URL?window.URL:window.webkitURL;for(let e of this.events)this.on(e,this.options[e]);this.on("uploadprogress",(()=>this.updateTotalUploadProgress())),this.on("removedfile",(()=>this.updateTotalUploadProgress())),this.on("canceled",(e=>this.emit("complete",e))),this.on("complete",(e=>{if(0===this.getAddedFiles().length&&0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length)return setTimeout((()=>this.emit("queuecomplete")),0)}));let e=function(e){if(function(e){if(e.dataTransfer.types)for(var t=0;tthis.emit("dragstart",e),dragenter:t=>(e(t),this.emit("dragenter",t)),dragover:t=>{let n;try{n=t.dataTransfer.effectAllowed}catch(e){}return t.dataTransfer.dropEffect="move"===n||"linkMove"===n?"move":"copy",e(t),this.emit("dragover",t)},dragleave:e=>this.emit("dragleave",e),drop:t=>(e(t),this.drop(t)),dragend:e=>this.emit("dragend",e)}}],this.clickableElements.forEach((e=>this.listeners.push({element:e,events:{click:t=>((e!==this.element||t.target===this.element||a.elementInside(t.target,this.element.querySelector(".dz-message")))&&this.hiddenFileInput.click(),!0)}}))),this.enable(),this.options.init.call(this)}destroy(){return this.disable(),this.removeAllFiles(!0),(null!=this.hiddenFileInput?this.hiddenFileInput.parentNode:void 0)&&(this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=null),delete this.element.dropzone,a.instances.splice(a.instances.indexOf(this),1)}updateTotalUploadProgress(){let e,t=0,n=0;if(this.getActiveFiles().length){for(let e of this.getActiveFiles())t+=e.upload.bytesSent,n+=e.upload.total;e=100*t/n}else e=100;return this.emit("totaluploadprogress",e,n,t)}_getParamName(e){return"function"==typeof this.options.paramName?this.options.paramName(e):`${this.options.paramName}${this.options.uploadMultiple?`[${e}]`:""}`}_renameFile(e){return"function"!=typeof this.options.renameFile?e.name:this.options.renameFile(e)}getFallbackForm(){let e,t;if(e=this.getExistingFallback())return e;let n='
';this.options.dictFallbackText&&(n+=`

${this.options.dictFallbackText}

`),n+=`
`;let r=a.createElement(n);return"FORM"!==this.element.tagName?(t=a.createElement(`
`),t.appendChild(r)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),null!=t?t:r}getExistingFallback(){let e=function(e){for(let t of e)if(/(^| )fallback($| )/.test(t.className))return t};for(let n of["div","form"]){var t;if(t=e(this.element.getElementsByTagName(n)))return t}}setupEventListeners(){return this.listeners.map((e=>(()=>{let t=[];for(let n in e.events){let r=e.events[n];t.push(e.element.addEventListener(n,r,!1))}return t})()))}removeEventListeners(){return this.listeners.map((e=>(()=>{let t=[];for(let n in e.events){let r=e.events[n];t.push(e.element.removeEventListener(n,r,!1))}return t})()))}disable(){return this.clickableElements.forEach((e=>e.classList.remove("dz-clickable"))),this.removeEventListeners(),this.disabled=!0,this.files.map((e=>this.cancelUpload(e)))}enable(){return delete this.disabled,this.clickableElements.forEach((e=>e.classList.add("dz-clickable"))),this.setupEventListeners()}filesize(e){let t=0,n="b";if(e>0){let r=["tb","gb","mb","kb","b"];for(let o=0;o=Math.pow(this.options.filesizeBase,4-o)/10){t=e/Math.pow(this.options.filesizeBase,4-o),n=i;break}}t=Math.round(10*t)/10}return`${t} ${this.options.dictFileSizeUnits[n]}`}_updateMaxFilesReachedClass(){return null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")}drop(e){if(!e.dataTransfer)return;this.emit("drop",e);let t=[];for(let n=0;ne.items,null!=t?n(t):void 0))return;var t,n;this.emit("paste",e);let{items:r}=e.clipboardData;return r.length?this._addFilesFromItems(r):void 0}handleFiles(e){for(let t of e)this.addFile(t)}_addFilesFromItems(e){return(()=>{let t=[];for(let r of e){var n;null!=r.webkitGetAsEntry&&(n=r.webkitGetAsEntry())?n.isFile?t.push(this.addFile(r.getAsFile())):n.isDirectory?t.push(this._addFilesFromDirectory(n,n.name)):t.push(void 0):null!=r.getAsFile&&(null==r.kind||"file"===r.kind)?t.push(this.addFile(r.getAsFile())):t.push(void 0)}return t})()}_addFilesFromDirectory(e,t){let n=e.createReader(),r=e=>{return t=console,n="log",r=t=>t.log(e),null!=t&&"function"==typeof t[n]?r(t,n):void 0;var t,n,r};var o=()=>n.readEntries((e=>{if(e.length>0){for(let n of e)n.isFile?n.file((e=>{if(!this.options.ignoreHiddenFiles||"."!==e.name.substring(0,1))return e.fullPath=`${t}/${e.name}`,this.addFile(e)})):n.isDirectory&&this._addFilesFromDirectory(n,`${t}/${n.name}`);o()}return null}),r);return o()}accept(e,t){this.options.maxFilesize&&e.size>1048576*this.options.maxFilesize?t(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(e.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):a.isValidFile(e,this.options.acceptedFiles)?null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(t(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",e)):this.options.accept.call(this,e,t):t(this.options.dictInvalidFileType)}addFile(e){e.upload={uuid:a.uuidv4(),progress:0,total:e.size,bytesSent:0,filename:this._renameFile(e)},this.files.push(e),e.status=a.ADDED,this.emit("addedfile",e),this._enqueueThumbnail(e),this.accept(e,(t=>{t?(e.accepted=!1,this._errorProcessing([e],t)):(e.accepted=!0,this.options.autoQueue&&this.enqueueFile(e)),this._updateMaxFilesReachedClass()}))}enqueueFiles(e){for(let t of e)this.enqueueFile(t);return null}enqueueFile(e){if(e.status!==a.ADDED||!0!==e.accepted)throw new Error("This file can't be queued because it has already been processed or was rejected.");if(e.status=a.QUEUED,this.options.autoProcessQueue)return setTimeout((()=>this.processQueue()),0)}_enqueueThumbnail(e){if(this.options.createImageThumbnails&&e.type.match(/image.*/)&&e.size<=1048576*this.options.maxThumbnailFilesize)return this._thumbnailQueue.push(e),setTimeout((()=>this._processThumbnailQueue()),0)}_processThumbnailQueue(){if(this._processingThumbnail||0===this._thumbnailQueue.length)return;this._processingThumbnail=!0;let e=this._thumbnailQueue.shift();return this.createThumbnail(e,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,!0,(t=>(this.emit("thumbnail",e,t),this._processingThumbnail=!1,this._processThumbnailQueue())))}removeFile(e){if(e.status===a.UPLOADING&&this.cancelUpload(e),this.files=u(this.files,e),this.emit("removedfile",e),0===this.files.length)return this.emit("reset")}removeAllFiles(e){null==e&&(e=!1);for(let t of this.files.slice())(t.status!==a.UPLOADING||e)&&this.removeFile(t);return null}resizeImage(e,t,n,r,o){return this.createThumbnail(e,t,n,r,!0,((t,n)=>{if(null==n)return o(e);{let{resizeMimeType:t}=this.options;null==t&&(t=e.type);let r=n.toDataURL(t,this.options.resizeQuality);return"image/jpeg"!==t&&"image/jpg"!==t||(r=p.restore(e.dataURL,r)),o(a.dataURItoBlob(r))}}))}createThumbnail(e,t,n,r,o,i){let s=new FileReader;s.onload=()=>{e.dataURL=s.result,"image/svg+xml"!==e.type?this.createThumbnailFromUrl(e,t,n,r,o,i):null!=i&&i(s.result)},s.readAsDataURL(e)}displayExistingFile(e,t,n,r,o=!0){if(this.emit("addedfile",e),this.emit("complete",e),o){let o=t=>{this.emit("thumbnail",e,t),n&&n()};e.dataURL=t,this.createThumbnailFromUrl(e,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,this.options.fixOrientation,o,r)}else this.emit("thumbnail",e,t),n&&n()}createThumbnailFromUrl(e,t,n,r,o,i,s){let l=document.createElement("img");return s&&(l.crossOrigin=s),o="from-image"!=getComputedStyle(document.body).imageOrientation&&o,l.onload=()=>{let s=e=>e(1);return"undefined"!=typeof EXIF&&null!==EXIF&&o&&(s=e=>EXIF.getData(l,(function(){return e(EXIF.getTag(this,"Orientation"))}))),s((o=>{e.width=l.width,e.height=l.height;let s=this.options.resize.call(this,e,t,n,r),a=document.createElement("canvas"),u=a.getContext("2d");switch(a.width=s.trgWidth,a.height=s.trgHeight,o>4&&(a.width=s.trgHeight,a.height=s.trgWidth),o){case 2:u.translate(a.width,0),u.scale(-1,1);break;case 3:u.translate(a.width,a.height),u.rotate(Math.PI);break;case 4:u.translate(0,a.height),u.scale(1,-1);break;case 5:u.rotate(.5*Math.PI),u.scale(1,-1);break;case 6:u.rotate(.5*Math.PI),u.translate(0,-a.width);break;case 7:u.rotate(.5*Math.PI),u.translate(a.height,-a.width),u.scale(-1,1);break;case 8:u.rotate(-.5*Math.PI),u.translate(-a.height,0)}c(u,l,null!=s.srcX?s.srcX:0,null!=s.srcY?s.srcY:0,s.srcWidth,s.srcHeight,null!=s.trgX?s.trgX:0,null!=s.trgY?s.trgY:0,s.trgWidth,s.trgHeight);let d=a.toDataURL("image/png");if(null!=i)return i(d,a)}))},null!=i&&(l.onerror=i),l.src=e.dataURL}processQueue(){let{parallelUploads:e}=this.options,t=this.getUploadingFiles().length,n=t;if(t>=e)return;let r=this.getQueuedFiles();if(r.length>0){if(this.options.uploadMultiple)return this.processFiles(r.slice(0,e-t));for(;nt.xhr===e)).map((e=>e))}cancelUpload(e){if(e.status===a.UPLOADING){let t=this._getFilesWithXhr(e.xhr);for(let e of t)e.status=a.CANCELED;void 0!==e.xhr&&e.xhr.abort();for(let e of t)this.emit("canceled",e);this.options.uploadMultiple&&this.emit("canceledmultiple",t)}else e.status!==a.ADDED&&e.status!==a.QUEUED||(e.status=a.CANCELED,this.emit("canceled",e),this.options.uploadMultiple&&this.emit("canceledmultiple",[e]));if(this.options.autoProcessQueue)return this.processQueue()}resolveOption(e,...t){return"function"==typeof e?e.apply(this,t):e}uploadFile(e){return this.uploadFiles([e])}uploadFiles(e){this._transformFiles(e,(t=>{if(this.options.chunking){let n=t[0];e[0].upload.chunked=this.options.chunking&&(this.options.forceChunking||n.size>this.options.chunkSize),e[0].upload.totalChunkCount=Math.ceil(n.size/this.options.chunkSize)}if(e[0].upload.chunked){let n=e[0],r=t[0],o=0;n.upload.chunks=[];let i=()=>{let t=0;for(;void 0!==n.upload.chunks[t];)t++;if(t>=n.upload.totalChunkCount)return;o++;let i=t*this.options.chunkSize,s=Math.min(i+this.options.chunkSize,r.size),l={name:this._getParamName(0),data:r.webkitSlice?r.webkitSlice(i,s):r.slice(i,s),filename:n.upload.filename,chunkIndex:t};n.upload.chunks[t]={file:n,index:t,dataBlock:l,status:a.UPLOADING,progress:0,retries:0},this._uploadData(e,[l])};if(n.upload.finishedChunkUpload=(t,r)=>{let o=!0;t.status=a.SUCCESS,t.dataBlock=null,t.response=t.xhr.responseText,t.responseHeaders=t.xhr.getAllResponseHeaders(),t.xhr=null;for(let e=0;e{this._finished(e,r,null)}))},this.options.parallelChunkUploads)for(let e=0;e{this._finishedUploading(e,n,t)},n.ontimeout=()=>{this._handleUploadError(e,n,`Request timedout after ${this.options.timeout/1e3} seconds`)},n.onerror=()=>{this._handleUploadError(e,n)},(null!=n.upload?n.upload:n).onprogress=t=>this._updateFilesUploadProgress(e,n,t);let s=this.options.defaultHeaders?{Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"}:{};this.options.binaryBody&&(s["Content-Type"]=e[0].type),this.options.headers&&r(s,this.options.headers);for(let e in s){let t=s[e];t&&n.setRequestHeader(e,t)}if(this.options.binaryBody){for(let t of e)this.emit("sending",t,n);this.options.uploadMultiple&&this.emit("sendingmultiple",e,n),this.submitRequest(n,null,e)}else{let r=new FormData;if(this.options.params){let t=this.options.params;"function"==typeof t&&(t=t.call(this,e,n,e[0].upload.chunked?this._getChunk(e[0],n):null));for(let e in t){let n=t[e];if(Array.isArray(n))for(let t=0;t{n[o]=i,++r===e.length&&t(n)}))}_addFormElementData(e){if("FORM"===this.element.tagName)for(let t of this.element.querySelectorAll("input, textarea, select, button")){let n=t.getAttribute("name"),r=t.getAttribute("type");if(r&&(r=r.toLowerCase()),null!=n)if("SELECT"===t.tagName&&t.hasAttribute("multiple"))for(let r of t.options)r.selected&&e.append(n,r.value);else(!r||"checkbox"!==r&&"radio"!==r||t.checked)&&e.append(n,t.value)}}_updateFilesUploadProgress(e,t,n){if(e[0].upload.chunked){let r=e[0],o=this._getChunk(r,t);n?(o.progress=100*n.loaded/n.total,o.total=n.total,o.bytesSent=n.loaded):(o.progress=100,o.bytesSent=o.total),r.upload.progress=0,r.upload.total=0,r.upload.bytesSent=0;for(let e=0;ethis.options.renameFilename.call(this,e.name,e)),"string"==typeof this.options.method&&(this.options.method=this.options.method.toUpperCase()),(n=this.getExistingFallback())&&n.parentNode&&n.parentNode.removeChild(n),!1!==this.options.previewsContainer&&(this.options.previewsContainer?this.previewsContainer=a.getElement(this.options.previewsContainer,"previewsContainer"):this.previewsContainer=this.element),this.options.clickable&&(!0===this.options.clickable?this.clickableElements=[this.element]:this.clickableElements=a.getElements(this.options.clickable,"clickable")),this.init()}}a.initClass(),a.options={},a.optionsForElement=function(e){return e.getAttribute("id")?a.options[d(e.getAttribute("id"))]:void 0},a.instances=[],a.forElement=function(e){if("string"==typeof e&&(e=document.querySelector(e)),null==(null!=e?e.dropzone:void 0))throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");return e.dropzone},a.discover=function(){let e;if(document.querySelectorAll)e=document.querySelectorAll(".dropzone");else{e=[];let t=t=>(()=>{let n=[];for(let r of t)/(^| )dropzone($| )/.test(r.className)?n.push(e.push(r)):n.push(void 0);return n})();t(document.getElementsByTagName("div")),t(document.getElementsByTagName("form"))}return(()=>{let t=[];for(let n of e)!1!==a.optionsForElement(n)?t.push(new a(n)):t.push(void 0);return t})()},a.blockedBrowsers=[/opera.*(Macintosh|Windows Phone).*version\/12/i],a.isBrowserSupported=function(){let e=!0;if(window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if("classList"in document.createElement("a")){void 0!==a.blacklistedBrowsers&&(a.blockedBrowsers=a.blacklistedBrowsers);for(let t of a.blockedBrowsers)if(t.test(navigator.userAgent)){e=!1;continue}}else e=!1;else e=!1;return e},a.dataURItoBlob=function(e){let t=atob(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],r=new ArrayBuffer(t.length),o=new Uint8Array(r);for(let e=0,n=t.length,r=0<=n;r?e<=n:e>=n;r?e++:e--)o[e]=t.charCodeAt(e);return new Blob([r],{type:n})};const u=(e,t)=>e.filter((e=>e!==t)).map((e=>e)),d=e=>e.replace(/[\-_](\w)/g,(e=>e.charAt(1).toUpperCase()));a.createElement=function(e){let t=document.createElement("div");return t.innerHTML=e,t.childNodes[0]},a.elementInside=function(e,t){if(e===t)return!0;for(;e=e.parentNode;)if(e===t)return!0;return!1},a.getElement=function(e,t){let n;if("string"==typeof e?n=document.querySelector(e):null!=e.nodeType&&(n=e),null==n)throw new Error(`Invalid \`${t}\` option provided. Please provide a CSS selector or a plain HTML element.`);return n},a.getElements=function(e,t){let n,r;if(e instanceof Array){r=[];try{for(n of e)r.push(this.getElement(n,t))}catch(e){r=null}}else if("string"==typeof e)for(n of(r=[],document.querySelectorAll(e)))r.push(n);else null!=e.nodeType&&(r=[e]);if(null==r||!r.length)throw new Error(`Invalid \`${t}\` option provided. Please provide a CSS selector, a plain HTML element or a list of those.`);return r},a.confirm=function(e,t,n){return window.confirm(e)?t():null!=n?n():void 0},a.isValidFile=function(e,t){if(!t)return!0;t=t.split(",");let n=e.type,r=n.replace(/\/.*$/,"");for(let o of t)if(o=o.trim(),"."===o.charAt(0)){if(-1!==e.name.toLowerCase().indexOf(o.toLowerCase(),e.name.length-o.length))return!0}else if(/\/\*$/.test(o)){if(r===o.replace(/\/.*$/,""))return!0}else if(n===o)return!0;return!1},"undefined"!=typeof jQuery&&null!==jQuery&&(jQuery.fn.dropzone=function(e){return this.each((function(){return new a(this,e)}))}),a.ADDED="added",a.QUEUED="queued",a.ACCEPTED=a.QUEUED,a.UPLOADING="uploading",a.PROCESSING=a.UPLOADING,a.CANCELED="canceled",a.ERROR="error",a.SUCCESS="success";var c=function(e,t,n,r,o,i,s,l,a,u){let d=function(e){e.naturalWidth;let t=e.naturalHeight,n=document.createElement("canvas");n.width=1,n.height=t;let r=n.getContext("2d");r.drawImage(e,0,0);let{data:o}=r.getImageData(1,0,1,t),i=0,s=t,l=t;for(;l>i;)0===o[4*(l-1)+3]?s=l:i=l,l=s+i>>1;let a=l/t;return 0===a?1:a}(t);return e.drawImage(t,n,r,o,i,s,l,a,u/d)};class p{static initClass(){this.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}static encode64(e){let t,n,r,o,i,s="",l="",a="",u=0;for(;t=e[u++],n=e[u++],l=e[u++],r=t>>2,o=(3&t)<<4|n>>4,i=(15&n)<<2|l>>6,a=63&l,isNaN(n)?i=a=64:isNaN(l)&&(a=64),s=s+this.KEY_STR.charAt(r)+this.KEY_STR.charAt(o)+this.KEY_STR.charAt(i)+this.KEY_STR.charAt(a),t=n=l="",r=o=i=a="",ue.length)break}return n}static decode64(e){let t,n,r,o,i,s="",l="",a=0,u=[];for(/[^A-Za-z0-9\+\/\=]/g.exec(e)&&console.warn("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\nExpect errors in decoding."),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");r=this.KEY_STR.indexOf(e.charAt(a++)),o=this.KEY_STR.indexOf(e.charAt(a++)),i=this.KEY_STR.indexOf(e.charAt(a++)),l=this.KEY_STR.indexOf(e.charAt(a++)),t=r<<2|o>>4,n=(15&o)<<4|i>>2,s=(3&i)<<6|l,u.push(t),64!==i&&u.push(n),64!==l&&u.push(s),t=n=s="",r=o=i=l="",a { @@ -37,7 +36,5 @@ document.addEventListener('DOMContentLoaded', () => { ], }); - registerQueries(); - registerReducers(); }); diff --git a/client/src/boot/registerQueries.js b/client/src/boot/registerQueries.js deleted file mode 100644 index dde2510b7..000000000 --- a/client/src/boot/registerQueries.js +++ /dev/null @@ -1,16 +0,0 @@ -import Injector from 'lib/Injector'; -import { fileInterface, file } from 'lib/fileFragments'; -import readFilesQuery from 'state/files/readFilesQuery'; -import readOneFileQuery from 'state/files/readOneFileQuery'; -import readDescendantFileCountsQuery from 'state/files/readDescendantFileCountsQuery'; -import readFileUsageQuery from 'state/files/readFileUsageQuery'; - -const registerQueries = () => { - Injector.query.registerFragment('FileInterfaceFields', fileInterface); - Injector.query.registerFragment('FileFields', file); - Injector.query.register('ReadFilesQuery', readFilesQuery); - Injector.query.register('readDescendantFileCountsQuery', readDescendantFileCountsQuery); - Injector.query.register('ReadOneFileQuery', readOneFileQuery); - Injector.query.register('readFileUsageQuery', readFileUsageQuery); -}; -export default registerQueries; diff --git a/client/src/components/BulkActions/tests/BulkActions-test.js b/client/src/components/BulkActions/tests/BulkActions-test.js index 92946e025..5a6d32eb1 100644 --- a/client/src/components/BulkActions/tests/BulkActions-test.js +++ b/client/src/components/BulkActions/tests/BulkActions-test.js @@ -33,7 +33,9 @@ test('BulkActions canApply() shows an action button when canApply returns true', callback: () => true, }, ], - items: [{ applies: true }] + items: [{ applies: true }], + onClearSelection: () => {}, + onSelectAll: () => {}, }} /> ); @@ -59,7 +61,9 @@ test('BulkActions canApply() shows an action button when canApply returns false' callback: () => true, }, ], - items: [{ applies: false }] + items: [{ applies: false }], + onClearSelection: () => {}, + onSelectAll: () => {}, }} /> ); @@ -83,6 +87,8 @@ test('BulkActions getOptionsByValue() should return the option which matches the }, ], items: [{ applies: true }], + onClearSelection: () => {}, + onSelectAll: () => {}, }} /> ); diff --git a/client/src/components/GalleryItem/tests/GalleryItem-test.js b/client/src/components/GalleryItem/tests/GalleryItem-test.js index e32689313..1dc4f01eb 100644 --- a/client/src/components/GalleryItem/tests/GalleryItem-test.js +++ b/client/src/components/GalleryItem/tests/GalleryItem-test.js @@ -166,7 +166,7 @@ test('GalleryItem getThumbnailStyles() should return backgroundImage with the co expect(thumbnail.classList).toContain('gallery-item__thumbnail--small'); }); -test('GalleryItem getThumbnailStyles() should return backgroundImage with the correct data-url when thumbnail is included in graphql body', () => { +test('GalleryItem getThumbnailStyles() should return backgroundImage with the correct data-url when thumbnail is included in json response', () => { const { container } = render( { render( diff --git a/client/src/containers/AssetAdmin/AssetAdmin.js b/client/src/containers/AssetAdmin/AssetAdmin.js index 4bb24ed71..f57b4d37a 100644 --- a/client/src/containers/AssetAdmin/AssetAdmin.js +++ b/client/src/containers/AssetAdmin/AssetAdmin.js @@ -13,17 +13,14 @@ import * as displaySearchActions from 'state/displaySearch/DisplaySearchActions' import Editor from 'containers/Editor/Editor'; import Gallery from 'containers/Gallery/Gallery'; import Toolbar from 'components/Toolbar/Toolbar'; -import { withApollo } from '@apollo/client/react/hoc'; import Search, { hasFilters } from 'components/Search/Search'; import SearchToggle from 'components/Search/SearchToggle'; -import deleteFilesMutation from 'state/files/deleteFilesMutation'; -import unpublishFilesMutation from 'state/files/unpublishFilesMutation'; -import publishFilesMutation from 'state/files/publishFilesMutation'; import CONSTANTS from 'constants/index'; import configShape from 'lib/configShape'; -import { injectGraphql } from 'lib/Injector'; +import Config from 'lib/Config'; import * as confirmDeletionActions from 'state/confirmDeletion/ConfirmDeletionActions'; import getFormSchema from 'lib/getFormSchema'; +import getJsonErrorMessage from 'lib/getJsonErrorMessage'; import BulkDeleteConfirmation from '../BulkDeleteConfirmation/BulkDeleteConfirmation'; import AssetAdminBreadcrumb from './AssetAdminBreadcrumb'; @@ -52,11 +49,32 @@ class AssetAdmin extends Component { this.handleUploadQueue = this.handleUploadQueue.bind(this); this.handleCreateFolder = this.handleCreateFolder.bind(this); this.handleMoveFilesSuccess = this.handleMoveFilesSuccess.bind(this); + this.refetchFolder = this.refetchFolder.bind(this); + + this.state = { + loading: false, + folder: null, + files: [], + totalCount: 0, + forceRefetch: false, + }; + } + + componentDidMount() { + this.refetchFolder(); } - componentDidUpdate() { - if ((typeof this.props.onReplaceUrl === 'function') && !this.props.loading && this.props.folder && this.props.folderId !== this.props.folder.id) { - this.props.onReplaceUrl(this.props.folder.id, this.props.fileId, this.props.query, this.props.viewAction); + componentDidUpdate(prevProps) { + if ((this.props.folderId !== prevProps.folderId) + || ((this.props.fileId !== prevProps.fileId) && this.props.fileId !== 0) + || this.state.forceRefetch + ) { + this.refetchFolder(); + } + if (this.state.forceRefetch) { + this.setState({ + forceRefetch: false + }); } } @@ -67,21 +85,65 @@ class AssetAdmin extends Component { if (this.props.folderId !== null) { return this.props.folderId; } - if (this.props.folder) { - return this.props.folder.id; + if (this.state.folder) { + return this.state.folder.id; } return 0; } + refetchFolder() { + const folderId = this.getFolderId(); + // Fetch child files in the folder + const urlParams = new URLSearchParams(window.location.search); + const qsParams = []; + urlParams.forEach((value, key) => { + // "page" is pagination + // "filter" is for search + // "sort" is for sort e.g. "title,desc" + if (key === 'page' || key.substring(0, 6) === 'filter' || key.substring(0, 4) === 'sort') { + qsParams.push(`${key}=${value}`); + } + }); + let qs = ''; + if (qsParams.length) { + qs = `?${qsParams.join('&')}`; + } + // do not set loading state to true here, because it will cause an ugly flicker + const sectionConfig = Config.getSection('SilverStripe\\AssetAdmin\\Controller\\AssetAdminOpen'); + const url = `${sectionConfig.endpoints.read.url}/${folderId}${qs}`; + + backend.get(url) + .then(async (response) => { + const responseJson = await response.json(); + this.setState({ + loading: false, + folder: responseJson, + files: responseJson.children.nodes, + totalCount: responseJson.children.pageInfo.totalCount, + }); + }) + .catch(async (err) => { + this.setState({ + loading: false, + folder: null, + files: [], + totalCount: 0, + }); + const message = await getJsonErrorMessage(err); + this.props.actions.toasts.error(message); + }); + } + getFiles() { const { - files, queuedFiles, folderId } = this.props; + const files = this.state.files; + const combinedFilesList = [ - // Exclude uploaded files that have been reloaded via graphql + // Exclude uploaded files that have been reloaded from the server ...queuedFiles .items .filter(item => @@ -108,6 +170,9 @@ class AssetAdmin extends Component { if (typeof this.props.onBrowse === 'function') { // for Higher-order component with a router handler this.props.onBrowse(folderId, fileId, query); + this.setState({ + forceRefetch: true, + }); } if (folderId !== this.getFolderId()) { this.props.actions.gallery.deselectFiles(); @@ -125,6 +190,9 @@ class AssetAdmin extends Component { this.props.fileId, Object.assign({}, this.props.query, { page }) ); + this.setState({ + forceRefetch: true, + }); } /** @@ -135,7 +203,6 @@ class AssetAdmin extends Component { handleDoSearch(data) { this.props.actions.gallery.deselectFiles(); this.props.actions.queuedFiles.purgeUploadQueue(); - this.props.actions.files.readFiles(); this.handleBrowse( data.currentFolderOnly ? this.getFolderId() : 0, null, @@ -153,8 +220,9 @@ class AssetAdmin extends Component { this.props.actions.displaySearch.closeSearch(); this.props.actions.gallery.deselectFiles(); this.props.actions.queuedFiles.purgeUploadQueue(); - this.props.actions.files.readFiles(); - this.handleOpenFolder(event, this.props.folder); + this.refetchFolder(); + const folder = this.state.folder; + this.handleOpenFolder(event, folder); } /** @@ -174,6 +242,9 @@ class AssetAdmin extends Component { page: undefined, } ); + this.setState({ + forceRefetch: true + }); } /** @@ -212,8 +283,9 @@ class AssetAdmin extends Component { handleBackButtonClick(event) { event.preventDefault(); this.props.actions.gallery.deselectFiles(); - if (this.props.folder) { - this.handleOpenFolder(this.props.folder.parentId || 0); + const folder = this.state.folder; + if (folder) { + this.handleOpenFolder(folder.parentId || 0); } else { this.handleOpenFolder(0); } @@ -262,6 +334,9 @@ class AssetAdmin extends Component { const file = files.find(item => item.id === parseInt(data.ID, 10)); this.props.onInsertMany(null, [file]); + this.setState({ + forceRefetch: true + }); return Promise.resolve(); } @@ -276,21 +351,25 @@ class AssetAdmin extends Component { if (!promise) { throw new Error('Promise was not returned for submitting'); } + this.setState({ + forceRefetch: true + }); return promise .then((response) => { - if (action === 'action_createfolder' && this.props.type === 'admin') { - // open the new folder in edit mode after save completes - this.handleOpenFile(response.record.id); - } - - return this.props.actions.files.readFiles() - .then(() => { + if (action === 'action_createfolder') { + if (this.props.type === 'admin') { + // open the new folder in edit mode after save completes + this.handleOpenFile(response.record.id); + } else { // open the containing folder, since folder edit mode isn't desired - if (action === 'action_createfolder' && this.props.type !== 'admin') { - this.handleOpenFolder(this.getFolderId()); - } - return response; - }); + this.handleOpenFolder(this.getFolderId()); + } + } else if ((action === 'action_save' || action === 'action_publish') + && this.getFolderId() !== response.record.parent.id) { + // If the file was moved, open the folder containing the file was moved to + this.handleBrowse(response.record.parent.id, response.record.id, null); + } + return response; }); } @@ -332,72 +411,54 @@ class AssetAdmin extends Component { }); const fileIDs = files.map(file => file.id); - const parentId = this.props.folder ? this.props.folder.id : 0; - - return this.props.actions.files.deleteFiles(fileIDs, parentId) - .then(({ data: { deleteFiles } }) => { + const folder = this.state.folder; + const parentId = folder ? folder.id : 0; + + const url = this.props.sectionConfig.endpoints.delete.url; + return backend.post(url, { + ids: fileIDs, + }, { + 'X-SecurityID': Config.get('SecurityID') + }) + .then(() => { this.handleBrowse(parentId, null, this.props.query); - const queuedFiles = this.props.queuedFiles.items.filter((file) => ( fileIDs.includes(file.id) )); - queuedFiles.forEach((file) => { if (file.queuedId) { this.props.actions.queuedFiles.removeQueuedFile(file.queuedId); } }); - - this.props.actions.files.readFiles(); - - return deleteFiles; - }) - .then((resultItems) => { - const successes = resultItems.filter((result) => result).length; - const { archiveFiles } = this.props.sectionConfig; - if (successes !== ids.length) { - let transKey = 'AssetAdmin.BULK_ACTIONS_DELETE_FAIL_02'; - let transDefault = '%s folders/files were successfully deleted, but %s files were not able to be deleted.'; - if (archiveFiles) { - transKey = 'AssetAdmin.BULK_ACTIONS_ARCHIVE_FAIL_02'; - transDefault = '%s folders/files were successfully archived, but %s files were not able to be archived.'; - } - this.props.actions.toasts.error( - i18n.sprintf( - i18n._t(transKey, transDefault), - successes, - ids.length - successes - ) - ); - } else { - let transKey = 'AssetAdmin.BULK_ACTIONS_DELETE_SUCCESS_02'; - let transDefault = '%s folders/files were successfully deleted.'; - if (archiveFiles) { - transKey = 'AssetAdmin.BULK_ACTIONS_ARCHIVE_SUCCESS_02'; - transDefault = '%s folders/files were successfully archived.'; - } - this.props.actions.toasts.success( - i18n.sprintf( - i18n._t(transKey, transDefault), - successes - ) - ); - this.props.actions.gallery.deselectFiles(); + let transKey = 'AssetAdmin.BULK_ACTIONS_DELETE_SUCCESS_02'; + let transDefault = '%s folders/files were successfully deleted.'; + if (this.props.sectionConfig.filesAreVersioned && this.props.sectionConfig.archiveFiles) { + transKey = 'AssetAdmin.BULK_ACTIONS_ARCHIVE_SUCCESS_02'; + transDefault = '%s folders/files were successfully archived.'; } - - return resultItems; + this.props.actions.toasts.success( + i18n.sprintf( + i18n._t(transKey, transDefault), + fileIDs.length + ) + ); + this.props.actions.gallery.deselectFiles(); + this.refetchFolder(); + }) + .catch(async (err) => { + const message = await getJsonErrorMessage(err); + this.props.actions.toasts.error(message); }) - .finally(this.props.actions.confirmDeletion.reset); + .finally(() => this.props.actions.confirmDeletion.reset()); } /** * Unpublish files * * @param {array} ids - * @param {boolean} force * @return {Promise} */ - doUnpublish(ids, force = false) { + doUnpublish(ids) { const files = ids.map(id => { const result = this.findFile(id); if (!result) { @@ -408,63 +469,73 @@ class AssetAdmin extends Component { return result; }); - const fileIDs = files.map(file => file.id); - return this.props.actions.files.unpublishFiles(fileIDs, force) - - .then(({ data: { unpublishFiles } }) => { - const successes = unpublishFiles.filter(result => result.__typename === 'File'); - const confirmationRequired = unpublishFiles.filter(result => ( - result.__typename === 'PublicationNotice' && result.noticeType === 'HAS_OWNERS' - )); - const successful = successes.map(file => { - this.resetFile(file); - return file; - }); - const displayedMessages = confirmationRequired.slice(0, 4); - const rest = confirmationRequired.slice(5); - const body = displayedMessages.map(warning => warning.message); - if (rest.length) { - body.push( - i18n.inject( - i18n._t( - 'AssetAdmin.BULK_OWNED_WARNING_REMAINING', - 'And {count} other file(s)' - ), - { count: rest.length }, - ) + // First make a call to api/readLiveOwnerCounts to check if any of the files are being used by other published content + // If they are, display a confirmation to the user + // If the user confirms, make a second call to api/unpublish to actually unpublish the files + const qs = fileIDs.map(id => `ids[]=${id}`).join('&'); + let url = `${this.props.sectionConfig.endpoints.readLiveOwnerCounts.url}?${qs}`; + return backend.get(url) + .then(async (response) => { + const responseJson = await response.json(); + // Display a maximum of 4 messages about individual file usage, any beyond that are 'the rest' + // Note that if there are no live owners then this logic will be largely skipped + const filesWithLiveUsage = responseJson.filter(fileObj => fileObj.count > 0); + const displayedMessages = filesWithLiveUsage.slice(0, 4).map(fileObj => fileObj.message); + const theRestLength = filesWithLiveUsage.slice(5).length; + let theRestMessage = ''; + if (theRestLength > 0) { + theRestMessage = i18n.inject( + i18n._t( + 'AssetAdmin.BULK_OWNED_WARNING_REMAINING', + 'And {count} other file(s)' + ), + { count: theRestLength }, ); } if (displayedMessages.length) { - const alertMessage = [ + const confirmationMessage = [ i18n.inject( i18n._t( 'AssetAdmin.BULK_OWNED_WARNING_HEADING', '{count} file(s) are being used by other published content.' ), - { count: confirmationRequired.length }, + { count: displayedMessages.length }, ), - - body.join('\n'), - + ...displayedMessages, + theRestMessage, i18n._t( 'AssetAdmin.BULK_OWNED_WARNING_FOOTER', 'Unpublishing will only remove files from the published version of the content. They will remain on the draft version. Unpublish anyway?' ) - ]; - + ].filter(s => s).join('\n\n'); // eslint-disable-next-line no-alert - if (confirm(alertMessage.join('\n\n'))) { - const secondPassIDs = confirmationRequired.reduce( - (acc, curr) => acc.concat(curr.ids), - [] - ); - return this.doUnpublish(secondPassIDs, true) - .then(next => successful.concat(next)); + if (!confirm(confirmationMessage)) { + return Promise.reject(); } } - - return successful; + return Promise.resolve(); + }) + .then(() => { + url = this.props.sectionConfig.endpoints.unpublish.url; + return backend.post(url, { + ids: fileIDs, + }, { + 'X-SecurityID': Config.get('SecurityID') + }) + .catch(async (err) => { + const message = await getJsonErrorMessage(err); + this.props.actions.toasts.error(message); + }); + }) + .then(() => { + this.refetchFolder(); + return files; + }) + .catch(async (err) => { + const message = await getJsonErrorMessage(err); + this.props.actions.toasts.error(message); + return []; }); } @@ -474,11 +545,11 @@ class AssetAdmin extends Component { * @param {array} fileIds */ handleUnpublish(fileIds) { - return this.doUnpublish(fileIds).then((response) => { + return this.doUnpublish(fileIds).then((files) => { const { fileId } = this.props; - this.props.actions.files.readFiles() + this.refetchFolder() .then(() => { - if (fileId && response.find(file => file.id === fileId)) { + if (fileId && files.find(file => file.id === fileId)) { this.props.resetFileDetails(this.getFolderId(), fileId, this.props.query); } }); @@ -504,17 +575,20 @@ class AssetAdmin extends Component { }); const fileIDs = files.map(file => file.id); - - return this.props.actions.files.publishFiles(fileIDs) - .then(({ data: { publishFiles } }) => { - const successes = publishFiles.filter(result => result.__typename === 'File'); - - const successful = successes.map(file => { - this.resetFile(file); - return file; - }); - - return successful; + const url = this.props.sectionConfig.endpoints.publish.url; + return backend.post(url, { + ids: fileIDs, + }, { + 'X-SecurityID': Config.get('SecurityID') + }) + .then(() => { + files.forEach(file => this.resetFile(file)); + this.refetchFolder(); + return files; + }) + .catch(async (err) => { + const message = await getJsonErrorMessage(err); + this.props.actions.toasts.error(message); }); } @@ -538,7 +612,7 @@ class AssetAdmin extends Component { // A bit of coupling. If the editor isn't open, the gallery will automatically // open a file and force a refresh, so we have to guard against a double refresh. if (this.props.fileId) { - this.props.actions.files.readFiles(); + this.refetchFolder(); } } @@ -563,7 +637,7 @@ class AssetAdmin extends Component { }); this.props.actions.gallery.deselectFiles(); - this.props.actions.files.readFiles(); + this.refetchFolder(); } /** @@ -574,8 +648,8 @@ class AssetAdmin extends Component { renderGallery() { const { GalleryComponent } = this.props; const config = this.props.sectionConfig; - const createFileApiUrl = config.createFileEndpoint.url; - const createFileApiMethod = config.createFileEndpoint.method; + const createFileApiUrl = config.endpoints.createFile.url; + const createFileApiMethod = config.endpoints.createFile.method; const limit = this.props.query && parseInt(this.props.query.limit || config.limit, 10); const page = this.props.query && parseInt(this.props.query.page || 1, 10); @@ -584,19 +658,21 @@ class AssetAdmin extends Component { const view = this.props.query && this.props.query.view; const filters = this.props.query.filter || {}; + const folder = this.state.folder; + const loading = this.state.loading; + return ( @@ -673,7 +749,11 @@ class AssetAdmin extends Component { } render() { - const { folder, folderId, query, getUrl, type, maxFiles, toolbarChildren, SearchComponent, BulkDeleteConfirmationComponent } = this.props; + const { folderId, query, getUrl, type, maxFiles, toolbarChildren, SearchComponent, BulkDeleteConfirmationComponent } = this.props; + + if (this.state.folder === null) { + return null; + } const showBackButton = Boolean(folderId || hasFilters(query.filter)); const searchFormSchemaUrl = this.props.sectionConfig.form.fileSearchForm.schemaUrl; @@ -690,6 +770,8 @@ class AssetAdmin extends Component { this.props.actions.displaySearch.toggleSearch : undefined; + const folder = this.state.folder; + const breadcrumbProps = { folder, query, @@ -704,7 +786,7 @@ class AssetAdmin extends Component { showBackButton={showBackButton} onBackButtonClick={this.handleBackButtonClick} > - + {folder && }
{toolbarChildren} @@ -723,7 +805,11 @@ class AssetAdmin extends Component { {this.renderGallery()} {this.renderEditor()}
- +
); } @@ -738,7 +824,6 @@ AssetAdmin.propTypes = { onBrowse: PropTypes.func, onReplaceUrl: PropTypes.func, onInsertMany: PropTypes.func, - graphQLErrors: PropTypes.arrayOf(PropTypes.string), getUrl: PropTypes.func, query: PropTypes.shape({ sort: PropTypes.string, @@ -748,19 +833,10 @@ AssetAdmin.propTypes = { }), onSubmitEditor: PropTypes.func, type: PropTypes.oneOf(['insert-media', 'insert-link', 'select', 'admin']), - files: PropTypes.array, queuedFiles: PropTypes.shape({ items: PropTypes.array.isRequired, }), filesTotalCount: PropTypes.number, - folder: PropTypes.shape({ - id: PropTypes.number, - title: PropTypes.string, - parents: PropTypes.array, - parentId: PropTypes.number, - canView: PropTypes.bool, - canEdit: PropTypes.bool, - }), loading: PropTypes.bool, actions: PropTypes.object, maxFiles: PropTypes.number, @@ -783,7 +859,7 @@ AssetAdmin.defaultProps = { EditorComponent: Editor, GalleryComponent: Gallery, SearchComponent: Search, - BulkDeleteConfirmationComponent: BulkDeleteConfirmation + BulkDeleteConfirmationComponent: BulkDeleteConfirmation, }; function mapStateToProps(state, ownProps) { @@ -812,9 +888,4 @@ export { AssetAdmin as Component }; export default compose( connect(mapStateToProps, mapDispatchToProps), - injectGraphql('ReadFilesQuery'), - deleteFilesMutation, - unpublishFilesMutation, - publishFilesMutation, - withApollo )(AssetAdmin); diff --git a/client/src/containers/AssetAdmin/AssetAdminBreadcrumb.js b/client/src/containers/AssetAdmin/AssetAdminBreadcrumb.js index 23651fc50..a8626758f 100644 --- a/client/src/containers/AssetAdmin/AssetAdminBreadcrumb.js +++ b/client/src/containers/AssetAdmin/AssetAdminBreadcrumb.js @@ -32,9 +32,9 @@ const AssetAdminBreadcrumb = ({ folder, query, getUrl, onBrowse, onFolderIcon, P }]; if (folder && folder.id) { - // Add parent folders - if (folder.parents) { - folder.parents.forEach((parent) => { + // Add ancestor folders + if (folder.ancestors) { + folder.ancestors.forEach((parent) => { breadcrumbs.push({ text: parent.title, href: hrefBuilder(parent.id, null, query), @@ -70,6 +70,7 @@ const AssetAdminBreadcrumb = ({ folder, query, getUrl, onBrowse, onFolderIcon, P icons }); } + // Search leaf if there was a search entered if (hasFilters(query.filter)) { breadcrumbs.push({ @@ -94,7 +95,7 @@ AssetAdminBreadcrumb.propTypes = { folder: PropTypes.shape({ id: PropTypes.number, title: PropTypes.string, - parents: PropTypes.array, + ancestors: PropTypes.array, parentId: PropTypes.number, canView: PropTypes.bool, canEdit: PropTypes.bool, diff --git a/client/src/containers/AssetAdmin/tests/AssetAdmin-test.js b/client/src/containers/AssetAdmin/tests/AssetAdmin-test.js index 418a4c14e..65ace9883 100644 --- a/client/src/containers/AssetAdmin/tests/AssetAdmin-test.js +++ b/client/src/containers/AssetAdmin/tests/AssetAdmin-test.js @@ -15,12 +15,71 @@ jest.mock('lib/getFormSchema', () => ({ }) })); +let resolveBackendGet; +let rejectBackendGet; +let resolveBackendPost; +let rejectBackendPost; +let lastBackendGetEndpoint; +let lastBackendPostEndpoint; +let lastBackendPostData; + +jest.mock('lib/Backend', () => ({ + get: (endpoint) => new Promise((resolve, reject) => { + resolveBackendGet = resolve; + rejectBackendGet = reject; + lastBackendGetEndpoint = endpoint; + }), + post: (endpoint, data) => new Promise((resolve, reject) => { + resolveBackendPost = resolve; + rejectBackendPost = reject; + lastBackendPostEndpoint = endpoint; + lastBackendPostData = data; + }), +})); + +window.ss.config = { + SecurityID: 1234567890, + sections: [ + { + name: 'SilverStripe\\AssetAdmin\\Controller\\AssetAdminOpen', + endpoints: { + read: 'test/endpoint/read', + } + }, + ], +}; + +function makeReadFileResponse() { + return { + json: () => ({ + children: { + pageInfo: { + totalCount: 2, + }, + nodes: [ + { + id: 1, + }, + { + id: 2, + }, + ], + }, + }), + }; +} + let lastReturn; let nextAction; let nextParams; +let lastToastErrorMessage; let consoleErrorFn; beforeEach(() => { + lastBackendGetEndpoint = undefined; + lastBackendPostEndpoint = undefined; + lastBackendPostData = undefined; + lastToastErrorMessage = undefined; lastReturn = undefined; nextAction = undefined; nextParams = []; @@ -32,10 +91,17 @@ afterEach(() => { consoleErrorFn.mockRestore(); }); -function getMockFile(id) { +function createJsonError(message) { return { - id, - __typename: 'File', + response: { + json: () => Promise.resolve({ + errors: [ + { + value: message + } + ], + }), + }, }; } @@ -43,14 +109,31 @@ function makeProps(obj = {}) { return { client: { dataId: () => null - .mockReturnValue(getMockFile(1)), + .mockReturnValue({ id: 1 }), }, dialog: true, sectionConfig: { url: '', limit: 10, - createFileEndpoint: { - url: '', + endpoints: { + createFile: { + url: '', + }, + read: { + url: 'test/endpoint/read', + }, + delete: { + url: 'test/endpoint/delete', + }, + publish: { + url: 'test/endpoint/publish', + }, + unpublish: { + url: 'test/endpoint/unpublish', + }, + readLiveOwnerCounts: { + url: 'test/endpoint/readLiveOwnerCounts', + }, }, form: { fileEditForm: { @@ -81,7 +164,7 @@ function makeProps(obj = {}) { folder: { id: 0, title: '', - parents: [], + ancestors: [], parentId: 0, canView: true, canEdit: true, @@ -99,18 +182,21 @@ function makeProps(obj = {}) { }, files: { deleteFiles: () => Promise.resolve({ data: { deleteFiles: [] } }), - readFiles: () => Promise.resolve(), - publishFiles: () => Promise.resolve({ data: { publishFiles: [] } }), - unpublishFiles: () => Promise.resolve({ data: { unpublishFiles: [] } }), + read: () => Promise.resolve(), + publish: () => Promise.resolve({ data: { publish: [] } }), + unpublish: () => Promise.resolve({ data: { unpublish: [] } }), }, confirmDeletion: { deleting: () => null, + reset: () => null, }, toasts: { display: () => null, success: () => null, - error: () => null, - } + error: (message) => { + lastToastErrorMessage = message; + }, + }, }, showSearch: true, EditorComponent: ({ onSubmit }) =>
onSubmit(...nextParams)}/>, @@ -134,6 +220,26 @@ function makeProps(obj = {}) { }; } +test('AssetAdmin refetchFolder reject known error', async () => { + render( + + ); + rejectBackendGet(createJsonError('Cannot read files')); + // sleep for 0 seconds to get the next tick + await new Promise(resolve => setTimeout(resolve, 0)); + expect(lastToastErrorMessage).toBe('Cannot read files'); +}); + +test('AssetAdmin refetchFolder reject unknown error', async () => { + render( + + ); + rejectBackendGet(); + // sleep for 0 seconds to get the next tick + await new Promise(resolve => setTimeout(resolve, 0)); + expect(lastToastErrorMessage).toBe('An unknown error has occurred.'); +}); + test('AssetAdmin handleSubmitEditor should call the onSubmitEditor property when that is supplied', async () => { const onSubmitEditor = jest.fn(() => Promise.resolve(null)); const paramSubmit = jest.fn(() => Promise.resolve(null)); @@ -143,6 +249,7 @@ test('AssetAdmin handleSubmitEditor should call the onSubmitEditor property when })} /> ); + resolveBackendGet(makeReadFileResponse()); const editor = await screen.findByTestId('test-editor'); nextParams = [{}, 'action_test', paramSubmit]; fireEvent.click(editor); @@ -155,6 +262,7 @@ test('AssetAdmin handleSubmitEditor should call the paramSubmit given when no on render( ); + resolveBackendGet(makeReadFileResponse()); const editor = await screen.findByTestId('test-editor'); nextParams = [{}, 'action_test', paramSubmit]; fireEvent.click(editor); @@ -175,6 +283,7 @@ test('AssetAdmin handleBrowse should clear selected files when folder changes', })} /> ); + resolveBackendGet(makeReadFileResponse()); const search = await screen.findByTestId('test-search'); nextParams = [{ currentFolderOnly: false @@ -197,6 +306,7 @@ test('AssetAdmin handleBrowse should not clear selected', async () => { })} /> ); + resolveBackendGet(makeReadFileResponse()); const search = await screen.findByTestId('test-search'); nextParams = [{ currentFolderOnly: true @@ -205,51 +315,47 @@ test('AssetAdmin handleBrowse should not clear selected', async () => { expect(deselectFiles.mock.calls.length).toBe(1); }); -test('AssetAdmin handleDelete should delete a file', async () => { - const deleteFiles = jest.fn(() => Promise.resolve({ data: { deleteFiles: [] } })); - const files = [ - getMockFile(1) - ]; +const setupHandleDeleteTest = async () => { render( - + ); + resolveBackendGet(makeReadFileResponse()); const confirmation = await screen.findByTestId('test-bulk-delete-confirmation'); - nextParams = [[files[0].id]]; + nextParams = [[1]]; fireEvent.click(confirmation); - expect(deleteFiles.mock.calls.length).toBe(1); - expect(deleteFiles.mock.calls[0][0]).toEqual([files[0].id]); +}; + +test('AssetAdmin handleDelete should delete a file', async () => { + await setupHandleDeleteTest(); + resolveBackendPost(); + expect(lastBackendPostEndpoint).toBe('test/endpoint/delete'); + expect(lastBackendPostData).toEqual({ ids: [1] }); +}); + +test('AssetAdmin handleDelete reject known error', async () => { + await setupHandleDeleteTest(); + rejectBackendPost(createJsonError('Cannot delete files')); + // sleep for 0 seconds to get the next tick + await new Promise(resolve => setTimeout(resolve, 0)); + expect(lastToastErrorMessage).toBe('Cannot delete files'); +}); + +test('AssetAdmin handleDelete reject unknown error', async () => { + await setupHandleDeleteTest(); + rejectBackendPost(); + // sleep for 0 seconds to get the next tick + await new Promise(resolve => setTimeout(resolve, 0)); + expect(lastToastErrorMessage).toBe('An unknown error has occurred.'); }); test('AssetAdmin handleDelete should remove the file from the queued files list', async () => { const removeQueuedFile = jest.fn(); - const files = [ - getMockFile(1) - ]; render( ); + resolveBackendGet(makeReadFileResponse()); const confirmation = await screen.findByTestId('test-bulk-delete-confirmation'); nextParams = [[2]]; fireEvent.click(confirmation); + resolveBackendPost(); + // wait for the next tick to ensure that the post request has completed + await new Promise(resolve => setTimeout(resolve, 0)); expect(removeQueuedFile.mock.calls.length).toBe(1); expect(removeQueuedFile.mock.calls[0][0]).toEqual(2); }); -test('AssetAdmin doPublish should publish a file', async () => { - const publishFiles = jest.fn(() => Promise.resolve({ data: { publishFiles: [] } })); - const files = [ - getMockFile(1) - ]; +const setupDoPublishTest = async () => { render( - + ); + resolveBackendGet(makeReadFileResponse()); const gallery = await screen.findByTestId('test-gallery'); nextAction = 'publish'; - nextParams = [[files[0].id]]; + nextParams = [[1]]; fireEvent.click(gallery); - expect(publishFiles.mock.calls.length).toBe(1); - expect(publishFiles.mock.calls[0][0]).toEqual([files[0].id]); +}; + +test('AssetAdmin doPublish should publish a file', async () => { + await setupDoPublishTest(); + resolveBackendPost(); + expect(lastBackendPostEndpoint).toBe('test/endpoint/publish'); + expect(lastBackendPostData).toEqual({ ids: [1] }); }); -test('AssetAdmin doUnpublish should unpublish a file', async () => { - const unpublishFiles = jest.fn(() => Promise.resolve({ data: { unpublishFiles: [] } })); - const files = [ - getMockFile(1) - ]; +test('AssetAdmin doPublish reject known error', async () => { + await setupDoPublishTest(); + rejectBackendPost(createJsonError('Cannot publish files')); + // sleep for 0 seconds to get the next tick + await new Promise(resolve => setTimeout(resolve, 0)); + expect(lastToastErrorMessage).toBe('Cannot publish files'); +}); + +test('AssetAdmin doPublish reject unknown error', async () => { + await setupDoPublishTest(); + rejectBackendPost(); + // sleep for 0 seconds to get the next tick + await new Promise(resolve => setTimeout(resolve, 0)); + expect(lastToastErrorMessage).toBe('An unknown error has occurred.'); +}); + +const setupReadLiveOwnerCountsTest = async () => { + // simulate confirming window.confirm() dialog + global.confirm = jest.fn(() => true); render( - + ); + resolveBackendGet(makeReadFileResponse()); const gallery = await screen.findByTestId('test-gallery'); nextAction = 'unpublish'; - nextParams = [[files[0].id]]; + nextParams = [[1, 2]]; fireEvent.click(gallery); - expect(unpublishFiles.mock.calls.length).toBe(1); - expect(unpublishFiles.mock.calls[0][0]).toEqual([files[0].id]); +}; + +test('AssetAdmin readLiveOwnerCounts reject known error', async () => { + await setupReadLiveOwnerCountsTest(); + rejectBackendGet(createJsonError('Cannot read live owner counts')); + // sleep for 0 seconds to get the next tick + await new Promise(resolve => setTimeout(resolve, 0)); + expect(lastToastErrorMessage).toBe('Cannot read live owner counts'); +}); + +test('AssetAdmin readLiveOwnerCounts reject unknown error', async () => { + await setupReadLiveOwnerCountsTest(); + rejectBackendGet(); + // sleep for 0 seconds to get the next tick + await new Promise(resolve => setTimeout(resolve, 0)); + expect(lastToastErrorMessage).toBe('An unknown error has occurred.'); +}); + +// This also doubles as testing readLiveOwnerCounts success +const setupDoUnpublishTest = async () => { + await setupReadLiveOwnerCountsTest(); + resolveBackendGet({ + json: () => [ + { + id: 1, + count: 1, + message: 'lorem', + }, + { + id: 2, + count: 1, + message: 'ipsum', + } + ] + }); + expect(lastBackendGetEndpoint).toBe('test/endpoint/readLiveOwnerCounts?ids[]=1&ids[]=2'); + // wait for the next tick to ensure that the post request has fired + await new Promise(resolve => setTimeout(resolve, 0)); +}; + +test('AssetAdmin doUnpublish should unpublish a file', async () => { + await setupDoUnpublishTest(); + resolveBackendPost(); + expect(lastBackendPostEndpoint).toBe('test/endpoint/unpublish'); + expect(lastBackendPostData).toEqual({ ids: [1, 2] }); +}); + +test('AssetAdmin doUnpublish reject known error', async () => { + await setupDoUnpublishTest(); + rejectBackendPost(createJsonError('Cannot unpublish files')); + // sleep for 0 seconds to get the next tick + await new Promise(resolve => setTimeout(resolve, 0)); + expect(lastToastErrorMessage).toBe('Cannot unpublish files'); +}); + +test('AssetAdmin doUnpublish reject unknown error', async () => { + await setupDoUnpublishTest(); + rejectBackendPost(); + // sleep for 0 seconds to get the next tick + await new Promise(resolve => setTimeout(resolve, 0)); + expect(lastToastErrorMessage).toBe('An unknown error has occurred.'); }); test('AssetAdmin handleUploadQueue should not refresh if no file is open', async () => { - const readFiles = jest.fn(); + const read = jest.fn(); render( ); + resolveBackendGet(makeReadFileResponse()); const gallery = await screen.findByTestId('test-gallery'); nextAction = 'successfulupload'; fireEvent.click(gallery); - expect(readFiles.mock.calls.length).toBe(0); + expect(read.mock.calls.length).toBe(0); }); test('AssetAdmin getFiles no files provided', async () => { render( { })} /> ); + resolveBackendGet({ + json: () => ({ + children: { + pageInfo: { + totalCount: 0, + }, + nodes: [], + }, + }), + }); const gallery = await screen.findByTestId('test-gallery'); nextAction = 'files'; fireEvent.click(gallery); @@ -391,6 +551,7 @@ test('AssetAdmin getFiles some files in a folder', async () => { })} /> ); + resolveBackendGet(makeReadFileResponse()); const gallery = await screen.findByTestId('test-gallery'); nextAction = 'files'; fireEvent.click(gallery); @@ -400,10 +561,6 @@ test('AssetAdmin getFiles some files in a folder', async () => { test('AssetAdmin getFiles some files in a folder', async () => { render( { })} /> ); + resolveBackendGet(makeReadFileResponse()); const gallery = await screen.findByTestId('test-gallery'); nextAction = 'files'; fireEvent.click(gallery); @@ -423,9 +581,6 @@ test('AssetAdmin getFiles some files in a folder', async () => { test('AssetAdmin getFiles upload error e.g. invalid file extension', async () => { render( })} /> ); + resolveBackendGet(makeReadFileResponse()); const gallery = await screen.findByTestId('test-gallery'); nextAction = 'files'; fireEvent.click(gallery); - expect(lastReturn.map(f => f.id)).toStrictEqual([0, 1]); + expect(lastReturn.map(f => f.id)).toStrictEqual([0, 1, 2]); }); test('AssetAdmin getFiles upload in progress', async () => { render( { })} /> ); + resolveBackendGet(makeReadFileResponse()); const gallery = await screen.findByTestId('test-gallery'); nextAction = 'files'; fireEvent.click(gallery); - expect(lastReturn.map(f => f.id)).toStrictEqual([0, 1]); + expect(lastReturn.map(f => f.id)).toStrictEqual([0, 1, 2]); }); test('AssetAdmin getFiles upload in progress to root folder', async () => { render( { })} /> ); + resolveBackendGet(makeReadFileResponse()); const gallery = await screen.findByTestId('test-gallery'); nextAction = 'files'; fireEvent.click(gallery); - expect(lastReturn.map(f => f.id)).toStrictEqual([0, 1]); + expect(lastReturn.map(f => f.id)).toStrictEqual([0, 1, 2]); }); test('AssetAdmin viewing a folder after uploading to a different folder', async () => { render( ); + resolveBackendGet(makeReadFileResponse()); const gallery = await screen.findByTestId('test-gallery'); nextAction = 'files'; fireEvent.click(gallery); - expect(lastReturn.map(f => f.id)).toStrictEqual([1]); + expect(lastReturn.map(f => f.id)).toStrictEqual([1, 2]); }); diff --git a/client/src/containers/AssetAdmin/tests/AssetAdminBreadcrumb-test.js b/client/src/containers/AssetAdmin/tests/AssetAdminBreadcrumb-test.js index 17e47feaf..a8bfe2ed4 100644 --- a/client/src/containers/AssetAdmin/tests/AssetAdminBreadcrumb-test.js +++ b/client/src/containers/AssetAdmin/tests/AssetAdminBreadcrumb-test.js @@ -6,7 +6,7 @@ import Breadcrumb from '../AssetAdminBreadcrumb'; const folder = { id: 3, title: 'Three', - parents: [ + ancestors: [ { id: 1, title: 'One' }, { id: 2, title: 'Two' }, ] @@ -77,7 +77,7 @@ test('AssetAdminBreadcrumb With top folder', async () => { const onBrowse = jest.fn(); render( diff --git a/client/src/containers/BulkDeleteConfirmation/BulkDeleteConfirmation.js b/client/src/containers/BulkDeleteConfirmation/BulkDeleteConfirmation.js index 69bd7abc5..1b5397815 100644 --- a/client/src/containers/BulkDeleteConfirmation/BulkDeleteConfirmation.js +++ b/client/src/containers/BulkDeleteConfirmation/BulkDeleteConfirmation.js @@ -1,29 +1,59 @@ -import React from 'react'; -import { compose } from 'redux'; +import React, { useState, useEffect } from 'react'; +import { bindActionCreators, compose } from 'redux'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; -import { withApollo } from '@apollo/client/react/hoc'; -import { inject, injectGraphql } from 'lib/Injector'; +import { inject } from 'lib/Injector'; import * as confirmDeletionActions from 'state/confirmDeletion/ConfirmDeletionActions'; import * as TRANSITIONS from 'state/confirmDeletion/ConfirmDeletionTransitions'; +import * as toastsActions from 'state/toasts/ToastsActions'; import i18n from 'i18n'; import fileShape from 'lib/fileShape'; +import backend from 'lib/Backend'; +import Config from 'lib/Config'; +import getJsonErrorMessage from 'lib/getJsonErrorMessage'; import DeletionModal from './DeletionModal'; import BulkDeleteMessage from './BulkDeleteMessage'; -import { getFolderDescendantFileTotals, getFileTotalItems } from './helpers'; /** - * Wires the Redux store and Apollo result set with the DeletionModal. + * Wires the Redux store set with the DeletionModal component. */ const BulkDeleteConfirmation = ({ - loading, LoadingComponent, transition, - files, descendantFileCounts, - onModalClose, onCancel, onConfirm, archiveFiles + LoadingComponent, + transition, + files, + onModalClose, + onCancel, + onConfirm, + filesAreVersioned, + archiveFiles, + actions, }) => { + const [isLoading, setIsLoading] = useState(true); + const [fileCounts, setFileCounts] = useState({}); + + useEffect(() => { + const sectionKey = 'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin'; + const config = Config.getSection(sectionKey); + const fileIDs = files.map(fild => fild.id); + const qs = fileIDs.map(id => `ids[]=${id}`).join('&'); + const url = `${config.endpoints.readDescendantCounts.url}?${qs}`; + setIsLoading(true); + backend.get(url) + .then(async (response) => { + const responseJson = await response.json(); + setIsLoading(false); + setFileCounts(responseJson); + }) + .catch(async (err) => { + const message = await getJsonErrorMessage(err); + actions.toasts.error(message); + }); + }, [files]); + let body = null; - const transKey = archiveFiles ? 'AssetAdmin.ARCHIVE' : 'AssetAdmin.DELETE'; - const transDefault = archiveFiles ? 'Archive' : 'Delete'; - let actions = [ + const transKey = filesAreVersioned && archiveFiles ? 'AssetAdmin.ARCHIVE' : 'AssetAdmin.DELETE'; + const transDefault = filesAreVersioned && archiveFiles ? 'Archive' : 'Delete'; + let deleteModalActions = [ { label: i18n._t(transKey, transDefault), handler: () => onConfirm(files.map(({ id }) => id)), @@ -36,19 +66,18 @@ const BulkDeleteConfirmation = ({ ]; // Decide what message and action to show users - if (loading) { - // We're still waiting for results from GraphQL + if (isLoading) { body = ; } else { - const folderCount = Object.keys(descendantFileCounts).length; - const folderDescendantFileTotals = getFolderDescendantFileTotals(files, descendantFileCounts); - const fileTotalItems = getFileTotalItems(files); + const topLevelFolderCount = fileCounts.filter(r => r.type === 'folder').length; + const topLevelFileCount = fileCounts.filter(r => r.type === 'file').length; + const descendantFileCount = fileCounts.reduce((t, r) => t + r.count, 0); - const bodyProps = { folderCount, folderDescendantFileTotals, fileTotalItems, archiveFiles }; + const bodyProps = { topLevelFolderCount, topLevelFileCount, descendantFileCount, filesAreVersioned, archiveFiles }; body = ; - if (folderDescendantFileTotals.totalItems || fileTotalItems) { - actions = [ + if (topLevelFileCount + descendantFileCount > 0) { + deleteModalActions = [ { label: i18n._t('AssetAdmin.CANCEL', 'Cancel'), handler: onCancel, @@ -71,15 +100,15 @@ const BulkDeleteConfirmation = ({ return (); }; BulkDeleteConfirmation.propTypes = { - loading: PropTypes.bool.isRequired, LoadingComponent: PropTypes.elementType, transition: PropTypes.oneOf(['canceling', 'deleting', false]), files: PropTypes.arrayOf(fileShape), @@ -87,11 +116,13 @@ BulkDeleteConfirmation.propTypes = { onCancel: PropTypes.func.isRequired, onModalClose: PropTypes.func.isRequired, onConfirm: PropTypes.func.isRequired, + filesAreVersioned: PropTypes.bool.isRequired, archiveFiles: PropTypes.bool.isRequired, + actions: PropTypes.object.isRequired, }; /** - * Wires the Modal with the the GraphQL File Count Query. Results will be provided via a + * Wires the Modal with the the XHR File Count Query. Results will be provided via a * `fileCount` prop containing a map of file/folder IDs to the number of nested non-folder Files * within the folder . e.g.: If you're trying to delete Folder ID 1234 and it has 10 nested Files * you will get `['1234': 10]`. @@ -101,23 +132,25 @@ const ConnectedModal = compose( ['Loading'], (Loading) => ({ LoadingComponent: Loading }), ), - injectGraphql('readDescendantFileCountsQuery'), - withApollo )(BulkDeleteConfirmation); /** * Decide whether to render the Deletion Modal based on the information in the redux store. - * This avoid firing off a GraphQL query for nothing. + * This avoid firing off an XHR request for nothing. */ const ConditionalModal = ({ showConfirmation, files, ...props }) => ( showConfirmation && files.length > 0 ? : null ); const mapStateToProps = ({ assetAdmin: { confirmDeletion } }) => confirmDeletion; -const mapDispatchToProps = { - onCancel: confirmDeletionActions.cancel, - onModalClose: confirmDeletionActions.modalClose -}; +const mapDispatchToProps = (dispatch) => ({ + onCancel: () => dispatch(confirmDeletionActions.cancel()), + onModalClose: () => dispatch(confirmDeletionActions.modalClose()), + actions: { + toasts: bindActionCreators(toastsActions, dispatch), + confirmation: bindActionCreators(confirmDeletionActions, dispatch), + }, +}); export default compose( connect(mapStateToProps, mapDispatchToProps), diff --git a/client/src/containers/BulkDeleteConfirmation/BulkDeleteMessage.js b/client/src/containers/BulkDeleteConfirmation/BulkDeleteMessage.js index a04f59bd6..39973b070 100644 --- a/client/src/containers/BulkDeleteConfirmation/BulkDeleteMessage.js +++ b/client/src/containers/BulkDeleteConfirmation/BulkDeleteMessage.js @@ -1,28 +1,25 @@ import i18n from 'i18n'; import React from 'react'; import PropTypes from 'prop-types'; -import { descendantFileTotalsShape } from './helpers'; /** * Choose which message to delete confirmation message to display. - * @param {object} folderDescendantFileTotals - * @param {object} fileTotalItems - * @returns {string} */ const confirmationMessage = ( - folderCount, - folderDescendantFileTotals, - fileTotalItems, - archiveFiles + topLevelFolderCount, + topLevelFileCount, + descendantFileCount, + filesAreVersioned, + archiveFiles, ) => { - const fileCount = folderDescendantFileTotals.totalCount + fileTotalItems; + const fileCount = topLevelFileCount + descendantFileCount; if (fileCount > 0) { let transKey = 'AssetAdmin.BULK_ACTIONS_DELETE_ITEMS_CONFIRM'; let transDefault = [ "You're about to delete %s file(s) which may be used in your site's content.", 'Carefully check the file usage on the files before deleting the file(s).' ].join(' '); - if (archiveFiles) { + if (filesAreVersioned && archiveFiles) { transKey = 'AssetAdmin.BULK_ACTIONS_ARCHIVE_ITEMS_CONFIRM'; transDefault = [ "You're about to archive %s file(s) which may be used in your site's content.", @@ -33,10 +30,10 @@ const confirmationMessage = ( i18n._t(transKey, transDefault), fileCount ); - } else if (folderCount === 1) { + } else if (topLevelFolderCount === 1) { let transKey = 'AssetAdmin.BULK_ACTIONS_DELETE_FOLDER_CONFIRM'; let transDefault = 'Are you sure you want to delete this folder?'; - if (archiveFiles) { + if (filesAreVersioned && archiveFiles) { transKey = 'AssetAdmin.BULK_ACTIONS_ARCHIVE_FOLDER_CONFIRM'; transDefault = 'Are you sure you want to archive this folder?'; } @@ -44,7 +41,7 @@ const confirmationMessage = ( } let transKey = 'AssetAdmin.BULK_ACTIONS_DELETE_FOLDERS_CONFIRM'; let transDefault = 'Are you sure you want to delete these folders?'; - if (archiveFiles) { + if (filesAreVersioned && archiveFiles) { transKey = 'AssetAdmin.BULK_ACTIONS_ARCHIVE_FOLDERS_CONFIRM'; transDefault = 'Are you sure you want to archive these folders?'; } @@ -55,44 +52,46 @@ const confirmationMessage = ( * Display a context dependent confirmation message. */ const BulkDeleteMessage = ({ - folderCount, - folderDescendantFileTotals, - fileTotalItems, - archiveFiles + topLevelFolderCount, + topLevelFileCount, + descendantFileCount, + filesAreVersioned, + archiveFiles, }) => { let transKey = 'AssetAdmin.BULK_ACTIONS_DELETE_WARNING'; let transDefault = 'Ensure files are removed from content areas prior to deleting them, otherwise they will ' + 'appear as broken links.'; - if (archiveFiles) { + if (filesAreVersioned && archiveFiles) { transKey = 'AssetAdmin.BULK_ACTIONS_ARCHIVE_WARNING'; transDefault = 'Ensure files are removed from content areas prior to archiving them, otherwise they will ' + 'appear as broken links.'; } const message = confirmationMessage( - folderCount, - folderDescendantFileTotals, - fileTotalItems, - archiveFiles + topLevelFolderCount, + topLevelFileCount, + descendantFileCount, + filesAreVersioned, + archiveFiles, ); return ( <>

{message}

- {(folderDescendantFileTotals.totalItems > 0 || fileTotalItems > 0) && + {(topLevelFileCount + descendantFileCount > 0) &&

{i18n._t(transKey, transDefault)}

} ); }; BulkDeleteMessage.propTypes = { - folderCount: PropTypes.number, - folderDescendantFileTotals: descendantFileTotalsShape, - fileTotalItems: PropTypes.number, + topLevelFolderCount: PropTypes.number, + topLevelFileCount: PropTypes.number, + descendantFileCount: PropTypes.number, }; BulkDeleteMessage.defaultProps = { - folderCount: 0, - folderDescendantFileTotals: { totalItems: 0, totalCount: 0 }, - fileTotalItems: 0 + topLevelFolderCount: 0, + topLevelFileCount: 0, + descendantFileCount: 0, }; export default BulkDeleteMessage; diff --git a/client/src/containers/BulkDeleteConfirmation/DeletionModal.js b/client/src/containers/BulkDeleteConfirmation/DeletionModal.js index 6d4009cbc..3faa2f834 100644 --- a/client/src/containers/BulkDeleteConfirmation/DeletionModal.js +++ b/client/src/containers/BulkDeleteConfirmation/DeletionModal.js @@ -3,10 +3,10 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Modal, ModalHeader, ModalBody, ModalFooter, Button } from 'reactstrap'; -const DeletionModal = ({ isOpen, body, onCancel, actions, archiveFiles }) => { +const DeletionModal = ({ isOpen, body, onCancel, actions, filesAreVersioned, archiveFiles }) => { let transKey = 'AssetAdmin.CONFIRM_FILE_DELETION'; let transDefault = 'Confirm deletion'; - if (archiveFiles) { + if (filesAreVersioned && archiveFiles) { transKey = 'AssetAdmin.CONFIRM_FILE_ARCHIVE'; transDefault = 'Confirm archive'; } @@ -34,6 +34,7 @@ DeletionModal.propTypes = { handler: PropTypes.func, color: PropTypes.string })), + filesAreVersioned: PropTypes.bool.isRequired, archiveFiles: PropTypes.bool.isRequired, }; diff --git a/client/src/containers/BulkDeleteConfirmation/helpers.js b/client/src/containers/BulkDeleteConfirmation/helpers.js deleted file mode 100644 index f4b405a88..000000000 --- a/client/src/containers/BulkDeleteConfirmation/helpers.js +++ /dev/null @@ -1,64 +0,0 @@ -import PropTypes from 'prop-types'; - -/** - * Check if the provided file entry is a folder - * @param {Object} file - * @return {boolean} - */ -const isFolder = (({ type }) => (type === 'folder')); - -/** - * Check if the provided file entry is a file - * @param {Object} file - * @return {boolean} - */ -const isFile = (file => (!isFolder(file))); - -/** - * Given a fileCount map, creates a reducer callback that produces an object containing: - * - totalItems, number of files - * - totalCount, total count of nests non-folders across files - * @param {Object} descendentFileCount - */ -const descendantFileCountsReducer = (descendentFileCount) => - (accumulator, { id }) => ( - (descendentFileCount[id] > 0) ? - { - totalItems: accumulator.totalItems + 1, - totalCount: accumulator.totalCount + descendentFileCount[id] - } : accumulator - ); - -/** - * Initial accumulator to use with `fileCountReducer`. - * @type {{totalItems: number, totalCount: number}} - */ -const descendantFileCountsInitAccumulator = { totalItems: 0, totalCount: 0 }; - -/** - * PropType shape for the file count object - */ -export const descendantFileTotalsShape = PropTypes.shape({ - totalItems: PropTypes.number, - totalCount: PropTypes.number, -}); - -/** - * Count the number of folders that are currently in use and the number of places where they are - * in use. - * @param {Object[]} files - * @param {Object} descendantFileCounts - * @return {Object} - * @note Not part of the public API - */ -export const getFolderDescendantFileTotals = (files, descendantFileCounts) => ( - files.filter(isFolder) - .reduce(descendantFileCountsReducer(descendantFileCounts), descendantFileCountsInitAccumulator) -); -/** - * Count the number of files - * @param {Object[]} files - * @return {number} - * @note Not part of the public API - */ -export const getFileTotalItems = (files) => files.filter(isFile).length; diff --git a/client/src/containers/BulkDeleteConfirmation/tests/BulkDeleteConfirmation-test.js b/client/src/containers/BulkDeleteConfirmation/tests/BulkDeleteConfirmation-test.js index 4ceb76577..8524d3a2e 100644 --- a/client/src/containers/BulkDeleteConfirmation/tests/BulkDeleteConfirmation-test.js +++ b/client/src/containers/BulkDeleteConfirmation/tests/BulkDeleteConfirmation-test.js @@ -4,6 +4,45 @@ import React from 'react'; import { render, screen, fireEvent } from '@testing-library/react'; import { Component as BulkDeleteConfirmation } from '../BulkDeleteConfirmation'; +let resolveBackendGet; +let rejectBackendGet; + +jest.mock('lib/Backend', () => ({ + get: () => new Promise((resolve, reject) => { + resolveBackendGet = resolve; + rejectBackendGet = reject; + }), +})); + +const sectionConfigKey = 'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin'; +window.ss.config = { + SecurityID: 1234567890, + sections: [ + { + name: sectionConfigKey, + endpoints: { + readDescendantCounts: { + url: 'test/endpoint/readDescendantCounts', + } + } + }, + ], +}; + +function createJsonError(message) { + return { + response: { + json: () => Promise.resolve({ + errors: [ + { + value: message + } + ], + }), + }, + }; +} + const FOLDER = 'folder'; const FILE = 'file'; @@ -14,6 +53,16 @@ const files = [ { id: 4, title: 'document.pdf', type: FILE }, ]; +let onConfirm; +let onCancel; +let lastToastErrorMessage; + +beforeEach(() => { + onConfirm = undefined; + onCancel = undefined; + lastToastErrorMessage = undefined; +}); + function makeProps(obj = {}) { return { loading: false, @@ -23,73 +72,98 @@ function makeProps(obj = {}) { onCancel: () => null, onModalClose: () => null, onConfirm: () => null, + filesAreVersioned: false, + archiveFiles: false, + actions: { + toasts: { + error: (message) => { + lastToastErrorMessage = message; + }, + }, + }, ...obj }; } -test('BulkDeleteConfirmation Nothing in use', async () => { - const onConfirm = jest.fn(); - const onCancel = jest.fn(); +const setupTest = () => { + onConfirm = jest.fn(); + onCancel = jest.fn(); render( ); +}; + +const expectSuccess = async (buttonZeroText, buttonOneText, onConfirmCalls, onCancelCalls) => { const modal = await screen.findByRole('dialog'); + // Wait a tick for the the modal to re-render + await new Promise(resolve => setTimeout(resolve, 0)); expect(modal.style.display).toBe('block'); // render().container() doesn't render anything, and queryByRole('button') doesn't find anything const buttons = screen.getByText('Delete').parentNode.querySelectorAll('button'); expect(buttons.length).toBe(2); - expect(buttons[0].textContent).toBe('Delete'); - expect(buttons[1].textContent).toBe('Cancel'); + expect(buttons[0].textContent).toBe(buttonZeroText); + expect(buttons[1].textContent).toBe(buttonOneText); fireEvent.click(buttons[0]); - expect(onConfirm.mock.calls.length).toBe(1); - expect(onCancel.mock.calls.length).toBe(0); + expect(onConfirm.mock.calls.length).toBe(onConfirmCalls); + expect(onCancel.mock.calls.length).toBe(onCancelCalls); + return Promise.resolve(); +}; + +test('BulkDeleteConfirmation Nothing in use', async () => { + setupTest(); + resolveBackendGet({ + json: () => [], + }); + await expectSuccess('Delete', 'Cancel', 1, 0); }); test('BulkDeleteConfirmation Folder in use', async () => { - const onConfirm = jest.fn(); - const onCancel = jest.fn(); - render( - - ); - await screen.findByRole('dialog'); - const buttons = screen.getByText('Delete').parentNode.querySelectorAll('button'); - expect(buttons.length).toBe(2); - expect(buttons[0].textContent).toBe('Cancel'); - expect(buttons[1].textContent).toBe('Delete'); - fireEvent.click(buttons[0]); - expect(onConfirm.mock.calls.length).toBe(0); - expect(onCancel.mock.calls.length).toBe(1); + setupTest(); + resolveBackendGet({ + json: () => [ + { + id: 1, + type: 'folder', + count: 10, + }, + ], + }); + await expectSuccess('Cancel', 'Delete', 0, 1); }); test('BulkDeleteConfirmation Files in use', async () => { - const onConfirm = jest.fn(); - const onCancel = jest.fn(); - render( - - ); + setupTest(); + resolveBackendGet({ + json: () => [ + { + id: 3, + type: 'file', + count: 5, + }, + ], + }); + await expectSuccess('Cancel', 'Delete', 0, 1); +}); + +test('BulkDeleteConfirmation reject known error', async () => { + setupTest(); + rejectBackendGet(createJsonError('Unable to read descendant counts')); await screen.findByRole('dialog'); - const buttons = screen.getByText('Delete').parentNode.querySelectorAll('button'); - expect(buttons.length).toBe(2); - expect(buttons[0].textContent).toBe('Cancel'); - expect(buttons[1].textContent).toBe('Delete'); - fireEvent.click(buttons[0]); - expect(onConfirm.mock.calls.length).toBe(0); - expect(onCancel.mock.calls.length).toBe(1); + // sleep for 0 seconds to get the next tick + await new Promise(resolve => setTimeout(resolve, 0)); + expect(lastToastErrorMessage).toBe('Unable to read descendant counts'); +}); + +test('BulkDeleteConfirmation reject unknown error', async () => { + setupTest(); + rejectBackendGet(); + await screen.findByRole('dialog'); + // sleep for 0 seconds to get the next tick + await new Promise(resolve => setTimeout(resolve, 0)); + expect(lastToastErrorMessage).toBe('An unknown error has occurred.'); }); diff --git a/client/src/containers/BulkDeleteConfirmation/tests/BulkDeleteMessage-test.js b/client/src/containers/BulkDeleteConfirmation/tests/BulkDeleteMessage-test.js index fa9ee601d..70cc37072 100644 --- a/client/src/containers/BulkDeleteConfirmation/tests/BulkDeleteMessage-test.js +++ b/client/src/containers/BulkDeleteConfirmation/tests/BulkDeleteMessage-test.js @@ -7,40 +7,40 @@ import BulkDeleteMessage from '../BulkDeleteMessage'; const unlinkFileWarning = 'Ensure files are removed from content areas prior to deleting them, otherwise they will appear as broken links.'; const noFoldersProps = { - folderCount: 0, - folderDescendantFileTotals: { totalItems: 0, totalCount: 0 }, + topLevelFolderCount: 0, + descendantFileCount: 0, }; const oneEmptyFolder = { - folderCount: 1, - folderDescendantFileTotals: { totalItems: 0, totalCount: 0 }, + topLevelFolderCount: 1, + descendantFileCount: 0, }; const manyEmptyFolders = { - folderCount: 2, - folderDescendantFileTotals: { totalItems: 0, totalCount: 0 }, + topLevelFolderCount: 2, + descendantFileCount: 0, }; const oneFolderProps = { - folderCount: 1, - folderDescendantFileTotals: { totalItems: 1, totalCount: 5 }, + topLevelFolderCount: 1, + descendantFileCount: 5, }; const manyfolderProps = { - folderCount: 2, - folderDescendantFileTotals: { totalItems: 2, totalCount: 10 }, + topLevelFolderCount: 2, + descendantFileCount: 10, }; const noFilesProps = { - fileTotalItems: 0, + topLevelFileCount: 0, }; const oneFileProps = { - fileTotalItems: 1, + topLevelFileCount: 1, }; const manyFilesProps = { - fileTotalItems: 2, + topLevelFileCount: 2, }; const getMessage = (count) => [ @@ -63,7 +63,7 @@ function makeProps(obj = {}) { }; } -test('BulkDeleteMessage Deleting a file and a folder file in use', () => { +test('BulkDeleteMessage Deleting a file and a folder file in use', async () => { const { container } = render( { - describe('getFolderInUseCounts', () => { - const testCases = [ - ['one folder in use', { 1: 1 }, 1, 1], - ['many folders in use', { 1: 1, 2: 2 }, 2, 3], - ['nothing in use', { 3: 0, 4: 0, 1: 0, 2: 0 }, 0, 0], - ['one file in use', { 4: 1 }, 0, 0], - ['many files in use', { 3: 2, 4: 1 }, 0, 0], - ['missing file use entries', {}, 0, 0], - ['unknown file IDs', { 123456: 1 }, 0, 0], - ['file and folder in use', { 3: 2, 1: 3 }, 1, 3], - ]; - - testCases.forEach((testCaseData) => { - const [ - description, - descendantFileCounts, - expectedTotalItems, - expectedTotalCount - ] = testCaseData; - - it(description, () => { - const { totalItems, totalCount } = - getFolderDescendantFileTotals(files, descendantFileCounts); - expect(totalItems).toBe(expectedTotalItems); - expect(totalCount).toBe(expectedTotalCount); - }); - }); - }); - - describe('getFileTotalItems', () => { - expect(getFileTotalItems(files)).toBe(2); - }); -}); diff --git a/client/src/containers/Editor/Editor.js b/client/src/containers/Editor/Editor.js index 42da72aee..dd2106184 100644 --- a/client/src/containers/Editor/Editor.js +++ b/client/src/containers/Editor/Editor.js @@ -7,9 +7,10 @@ import CONSTANTS from 'constants/index'; import FormBuilderLoader from 'containers/FormBuilderLoader/FormBuilderLoader'; import FormBuilderModal from 'components/FormBuilderModal/FormBuilderModal'; import * as UnsavedFormsActions from 'state/unsavedForms/UnsavedFormsActions'; -import fileShape from 'lib/fileShape'; import PropTypes from 'prop-types'; -import { inject, injectGraphql } from 'lib/Injector'; +import { inject } from 'lib/Injector'; +import Config from 'lib/Config'; +import backend from 'lib/Backend'; import * as confirmDeletionActions from 'state/confirmDeletion/ConfirmDeletionActions'; import * as modalActions from 'state/modal/ModalActions'; import classnames from 'classnames'; @@ -40,9 +41,32 @@ class Editor extends Component { openModal: false, loadingForm: false, loadingError: null, + file: null, }; } + componentDidMount() { + this.refetchFile(); + } + + componentDidUpdate(prevProps) { + if ((prevProps.fileId !== this.props.fileId) && prevProps.fileId !== null) { + this.refetchFile(); + } + } + + refetchFile() { + const sectionConfig = Config.getSection('SilverStripe\\AssetAdmin\\Controller\\AssetAdminOpen'); + const endpointUrl = `${sectionConfig.endpoints.read.url}/${this.props.fileId}`; + backend.get(endpointUrl) + .then(response => response.json()) + .then(responseJson => { + this.setState({ + file: responseJson, + }); + }); + } + /** * Build the form schema URL to pass to the Form Builder Loader * @returns {string} @@ -65,6 +89,7 @@ class Editor extends Component { } handleAction(event) { + const file = this.state.file; switch (event.currentTarget.name) { // intercept the Add to Campaign submit and open the modal dialog instead case 'action_addtocampaign': @@ -83,7 +108,7 @@ class Editor extends Component { break; case 'action_delete': - this.props.actions.confirmDeletion.confirm([this.props.file]); + this.props.actions.confirmDeletion.confirm([file]); event.preventDefault(); break; @@ -172,7 +197,8 @@ class Editor extends Component { document.body.removeChild(link); } - downloadURI(this.props.file.url, this.props.file.name); + const file = this.state.file; + downloadURI(file.url, file.name); document.getElementById('Form_fileEditForm_PopoverActions').focus(); } @@ -202,8 +228,9 @@ class Editor extends Component { * @param {Object} fieldProps */ editorHeader({ SchemaComponent, ...fieldProps }) { - const { dialog, nextType, showingSubForm, actions, file, EditorHeaderComponent } = this.props; + const { dialog, nextType, showingSubForm, actions, EditorHeaderComponent } = this.props; const schemaUrl = this.getFormSchemaUrl(); + const file = this.state.file; let showButton = buttonStates.SWITCH; @@ -259,6 +286,9 @@ class Editor extends Component { } render() { + if (!this.state.file) { + return null; + } const { FormBuilderLoaderComponent, FormBuilderModalComponent } = this.props; const formSchemaUrl = this.getFormSchemaUrl(); const modalSchemaUrl = `${this.props.addToCampaignSchemaUrl}/${this.props.fileId}`; @@ -268,7 +298,6 @@ class Editor extends Component { }, this.props.className ); - let error = null; if (this.state.loadingError) { let message = this.state.loadingError.value; @@ -285,13 +314,6 @@ class Editor extends Component { const campaignTitle = i18n._t('Admin.ADD_TO_CAMPAIGN', 'Add to campaign'); const Loading = this.props.loadingComponent; - // Most of the the time, the GraphQL data comes back first and the selected file data gets - // passed down to the Editor in time for the EditorHeader to be rendered correctly. - // Occasionnaly the FormSchema comes back first and the EditorHeader gets rendered without the - // necessary file data. Passing `file` to FormBuilderLoader will force a re-render when the - // GraphQL file data is filled in later on, which will cause a re-render of the EditorHeader. - const { file } = this.props; - return (
{error} 'AssetAdmin.Editor', ), connect(mapStateToProps, mapDispatchToProps), - injectGraphql('ReadOneFileQuery') )(Editor); diff --git a/client/src/containers/Editor/tests/Editor-test.js b/client/src/containers/Editor/tests/Editor-test.js index 46b2463a2..4a5ad9df9 100644 --- a/client/src/containers/Editor/tests/Editor-test.js +++ b/client/src/containers/Editor/tests/Editor-test.js @@ -5,6 +5,23 @@ import { render, screen, fireEvent } from '@testing-library/react'; import { Component as Editor } from '../Editor'; import { buttonStates } from '../EditorHeader'; +let resolveBackendGet; + +jest.mock('lib/Backend', () => ({ + get: () => new Promise(resolve => { + resolveBackendGet = resolve; + }) +})); + +function makeReadFileResponse() { + return { + json: () => ({ + id: 1, + type: 'file', + }) + }; +} + let consoleErrorFn; let nextAction; let nextParams; @@ -20,6 +37,19 @@ afterEach(() => { consoleErrorFn.mockRestore(); }); +const sectionConfigKey = 'SilverStripe\\AssetAdmin\\Controller\\AssetAdminOpen'; +window.ss.config = { + SecurityID: 1234567890, + sections: [ + { + name: sectionConfigKey, + endpoints: { + read: 'test/endpoint/read', + } + }, + ], +}; + function makeProps(obj = {}) { return { schemaUrlQueries: [], @@ -34,9 +64,6 @@ function makeProps(obj = {}) { stashFormValues: () => null, } }, - file: { - type: 'image' - }, EditorHeaderComponent: ({ onCancel, onDetails, showButton }) =>
{ @@ -89,6 +116,7 @@ test('Editor handleClose Closing editor', async () => { })} /> ); + resolveBackendGet(makeReadFileResponse()); openModal(); let modal = await screen.findByTestId('test-form-builder-modal'); expect(modal.getAttribute('data-is-open')).toBe('true'); @@ -118,6 +146,7 @@ test('Editor handleClose Closing sub form', async () => { })} /> ); + resolveBackendGet(makeReadFileResponse()); openModal(); let modal = await screen.findByTestId('test-form-builder-modal'); expect(modal.getAttribute('data-is-open')).toBe('true'); @@ -136,6 +165,7 @@ test('Editor editorHeader Top Form without detail', async () => { render( ); + resolveBackendGet(makeReadFileResponse()); const loader = await screen.findByTestId('test-form-builder-loader'); expect(loader.querySelectorAll('div[formid="myFormName"]').length).toBe(1); }); @@ -158,6 +188,7 @@ test('Editor editorHeader Top Form with detail in dialog', async () => { })} /> ); + resolveBackendGet(makeReadFileResponse()); openModal(); const header = await screen.findByTestId('test-editor-header'); nextAction = 'details'; @@ -176,6 +207,7 @@ test('Editor editorHeader Sub form in dialog', async () => { })} /> ); + resolveBackendGet(makeReadFileResponse()); openModal(); const header = await screen.findByTestId('test-editor-header'); expect(header.getAttribute('data-show-button')).toBe(buttonStates.ALWAYS_BACK); @@ -187,10 +219,15 @@ test('Editor editorHeader Form for folder', async () => { ); + resolveBackendGet({ + json: () => ({ + id: 1, + type: 'folder', + }) + }); openModal(); const header = await screen.findByTestId('test-editor-header'); expect(header.getAttribute('data-show-button')).toBe(buttonStates.SWITCH); @@ -204,6 +241,7 @@ test('Editor getFormSchemaUrl Plain URL', async () => { })} /> ); + resolveBackendGet(makeReadFileResponse()); openModal(); const loader = await screen.findByTestId('test-form-builder-loader'); expect(loader.getAttribute('data-schema-url')).toBe('edit/file/123'); @@ -217,6 +255,7 @@ test('Editor getFormSchemaUrl Plain URL', async () => { })} /> ); + resolveBackendGet(makeReadFileResponse()); openModal(); const loader = await screen.findByTestId('test-form-builder-loader'); expect(loader.getAttribute('data-schema-url')).toBe('edit/file/123?q=search'); @@ -233,6 +272,7 @@ test('Editor getFormSchemaUrl Plain URL', async () => { })} /> ); + resolveBackendGet(makeReadFileResponse()); openModal(); const loader = await screen.findByTestId('test-form-builder-loader'); expect(loader.getAttribute('data-schema-url')).toBe('edit/file/123?q=search&foo=bar'); diff --git a/client/src/containers/Gallery/Gallery.js b/client/src/containers/Gallery/Gallery.js index dd3711675..a55879ef2 100644 --- a/client/src/containers/Gallery/Gallery.js +++ b/client/src/containers/Gallery/Gallery.js @@ -14,13 +14,13 @@ import * as galleryActions from 'state/gallery/GalleryActions'; import * as toastsActions from 'state/toasts/ToastsActions'; import * as queuedFilesActions from 'state/queuedFiles/QueuedFilesActions'; import * as confirmDeletionActions from 'state/confirmDeletion/ConfirmDeletionActions'; -import moveFilesMutation from 'state/files/moveFilesMutation'; -import { withApollo } from '@apollo/client/react/hoc'; import { SelectableGroup } from 'react-selectable'; import configShape from 'lib/configShape'; +import Config from 'lib/Config'; import getStatusCodeMessage from 'lib/getStatusCodeMessage'; import { inject } from 'lib/Injector'; import PropTypes from 'prop-types'; +import backend from 'lib/Backend'; import MoveModal from '../MoveModal/MoveModal'; import GalleryDND from './GalleryDND'; @@ -654,7 +654,13 @@ class Gallery extends Component { } handleMoveFiles(folderId, fileIds) { - this.props.actions.files.moveFiles(folderId, fileIds) + const url = this.props.sectionConfig.endpoints.move.url; + return backend.post(url, { + ids: fileIds, + folderID: folderId, + }, { + 'X-SecurityID': Config.get('SecurityID') + }) .then(() => { const duration = CONSTANTS.MOVE_SUCCESS_DURATION; const message = `+${fileIds.length}`; @@ -709,7 +715,7 @@ class Gallery extends Component { : action => action.value !== ACTION_TYPES.INSERT; // Used to choose whether the text should be "Delete" or "Archive" - const deleteButtonFilter = (sectionConfig.archiveFiles) + const deleteButtonFilter = (sectionConfig.filesAreVersioned && sectionConfig.archiveFiles) ? action => action.value !== ACTION_TYPES.DELETE : action => action.value !== ACTION_TYPES.ARCHIVE; @@ -870,12 +876,11 @@ class Gallery extends Component { } render() { - const { folder, loading, errorMessage, graphQLErrors, noticeMessage } = this.props; + const { folder, loading, errorMessage, noticeMessage } = this.props; const Loading = this.props.LoadingComponent; - const hasGraphQLErrors = graphQLErrors && graphQLErrors.length > 0; if (!folder) { - if (errorMessage || hasGraphQLErrors) { + if (errorMessage) { return (
@@ -883,10 +888,6 @@ class Gallery extends Component { {i18n._t('AssetAdmin.DROPZONE_RESPONSE_ERROR', 'Server responded with an error.')} {errorMessage &&

{errorMessage}

} - {hasGraphQLErrors && graphQLErrors.map((error, index) => ( - // eslint-disable-next-line react/no-array-index-key -

{error}

- ))}
); @@ -1071,7 +1072,6 @@ Gallery.propTypes = Object.assign({}, sharedPropTypes, { // Combined queuedFiles + files files: PropTypes.array, errorMessage: PropTypes.string, - graphQLErrors: PropTypes.arrayOf(PropTypes.string), actions: PropTypes.object, securityId: PropTypes.string, onViewChange: PropTypes.func.isRequired, @@ -1151,6 +1151,4 @@ export default compose( () => 'AssetAdmin.Gallery', ), connect(mapStateToProps, mapDispatchToProps), - moveFilesMutation, - (component) => withApollo(component) )(Gallery); diff --git a/client/src/containers/Gallery/tests/Gallery-test.js b/client/src/containers/Gallery/tests/Gallery-test.js index 7ef7fbd26..608dc8372 100644 --- a/client/src/containers/Gallery/tests/Gallery-test.js +++ b/client/src/containers/Gallery/tests/Gallery-test.js @@ -61,10 +61,6 @@ function makeProps(obj = {}) { removeQueuedFile: () => null, succeedUpload: () => null, }, - mutate: { - moveFiles: () => ({}), - createFolder: () => ({}), - }, toasts: { display: jest.fn(), success: jest.fn(), diff --git a/client/src/containers/HistoryList/HistoryList.js b/client/src/containers/HistoryList/HistoryList.js index d1e614618..e20c8ebf4 100644 --- a/client/src/containers/HistoryList/HistoryList.js +++ b/client/src/containers/HistoryList/HistoryList.js @@ -37,7 +37,7 @@ class HistoryList extends Component { this.timer = null; - this.api = createEndpoint(props.sectionConfig.historyEndpoint); + this.api = createEndpoint(props.sectionConfig.endpoints.history); } componentDidMount() { diff --git a/client/src/containers/MoveModal/MoveModal.js b/client/src/containers/MoveModal/MoveModal.js index 439b7a878..d30bf06f2 100644 --- a/client/src/containers/MoveModal/MoveModal.js +++ b/client/src/containers/MoveModal/MoveModal.js @@ -11,7 +11,8 @@ import { import { display as displayToast } from 'state/toasts/ToastsActions'; import FormBuilderModal from 'components/FormBuilderModal/FormBuilderModal'; import configShape from 'lib/configShape'; -import moveFilesMutation from 'state/files/moveFilesMutation'; +import Config from 'lib/Config'; +import backend from 'lib/Backend'; class MoveModal extends React.Component { constructor(props) { @@ -21,28 +22,35 @@ class MoveModal extends React.Component { } handleSubmit({ FolderID }) { - const { moveFiles } = this.props.actions.files; const { selectedFiles, onSuccess, onClosed, setNotice, setError, setBadge } = this.props; - return moveFiles(FolderID || 0, selectedFiles) - .then(({ data: { moveFiles: { id, filename } } }) => { + let url = this.props.sectionConfig.endpoints.move.url; + return backend.post(url, { + ids: selectedFiles, + folderID: FolderID, + }, { + 'X-SecurityID': Config.get('SecurityID') + }) + .then(() => { + url = `${this.props.sectionConfig.endpoints.read.url}/${FolderID}`; + return backend.get(url); + }) + .then(response => response.json()) + .then(responseJson => { if (typeof onSuccess === 'function') { - onSuccess(FolderID, selectedFiles); + onSuccess(responseJson.id, selectedFiles); } - - setBadge(id, `${selectedFiles.length}`, 'success', CONSTANTS.MOVE_SUCCESS_DURATION); - + setBadge(responseJson.id, `${selectedFiles.length}`, 'success', CONSTANTS.MOVE_SUCCESS_DURATION); setNotice( i18n.sprintf( i18n._t('AssetAdmin.MOVED_ITEMS_TO', 'Moved %s item(s) to %s'), selectedFiles.length, - filename + responseJson.name ), [{ label: i18n._t('AssetAdmin.GO_TO_FOLDER', 'Go to folder'), - onClick: () => this.props.onOpenFolder(id) + onClick: () => this.props.onOpenFolder(responseJson.id) }] ); - onClosed(); }) .catch(() => { @@ -78,11 +86,6 @@ MoveModal.propTypes = { onSuccess: PropTypes.func, onOpenFolder: PropTypes.func.isRequired, selectedFiles: PropTypes.array.isRequired, - actions: PropTypes.shape({ - files: PropTypes.shape({ - moveFiles: PropTypes.func, - }), - }).isRequired, }; MoveModal.defaultProps = { @@ -120,5 +123,4 @@ function mapDispatchToProps(dispatch) { export default compose( connect(mapStateToProps, mapDispatchToProps), - moveFilesMutation )(MoveModal); diff --git a/client/src/lib/fileFragments.js b/client/src/lib/fileFragments.js deleted file mode 100644 index 388887ec4..000000000 --- a/client/src/lib/fileFragments.js +++ /dev/null @@ -1,35 +0,0 @@ -const fileInterface = ` - fragment FileInterfaceFields on FileInterface { - canDelete - canEdit - canView - category - exists - filename - id - lastEdited - name - parentId - title - type - url - visibility - hasRestrictedAccess - } -`; - -const file = ` - fragment FileFields on File { - draft - extension - published - modified - size - smallThumbnail - thumbnail - version - isTrackedFormUpload - } -`; - -export { fileInterface, file }; diff --git a/client/src/state/confirmDeletion/ConfirmDeletionActions.js b/client/src/state/confirmDeletion/ConfirmDeletionActions.js index d31faa31e..9ba1cb0d5 100644 --- a/client/src/state/confirmDeletion/ConfirmDeletionActions.js +++ b/client/src/state/confirmDeletion/ConfirmDeletionActions.js @@ -13,7 +13,7 @@ export function confirm(files) { } /** - * The GraphQL request for deleting files has started. + * The request for deleting files has started. * */ export function deleting() { diff --git a/client/src/state/files/buildPublicationMutation.js b/client/src/state/files/buildPublicationMutation.js deleted file mode 100644 index 56724c89f..000000000 --- a/client/src/state/files/buildPublicationMutation.js +++ /dev/null @@ -1,52 +0,0 @@ -import gql from 'graphql-tag'; -import { fileInterface, file } from 'lib/fileFragments'; - -const buildPublicationMutation = (mutationName) => { - const operationName = mutationName.charAt(0).toUpperCase() + mutationName.slice(1); - const mutation = gql` - mutation ${operationName}($ids:[ID]!, $force:Boolean, $quiet:Boolean) { - ${mutationName}(ids: $ids, force: $force, quiet: $quiet) { - ...on File { - __typename - ...FileInterfaceFields - ...FileFields - } - ...on PublicationNotice { - __typename - noticeType - message - ids - } - } - } - ${fileInterface} - ${file} -`; - - const isProd = process.env.NODE_ENV === 'production'; - const config = { - props: ({ mutate, ownProps: { actions } }) => { - const mutationAction = (ids, force = false, quiet = isProd) => mutate({ - variables: { - ids, - quiet, - force - }, - }); - - return { - actions: { - ...actions, - files: { - ...actions.files, - [mutationName]: mutationAction, - }, - }, - }; - }, - }; - - return { mutation, config }; -}; - -export default buildPublicationMutation; diff --git a/client/src/state/files/createFolderMutation.js b/client/src/state/files/createFolderMutation.js deleted file mode 100644 index ba355919d..000000000 --- a/client/src/state/files/createFolderMutation.js +++ /dev/null @@ -1,43 +0,0 @@ -const config = { - props: ({ mutate, ownProps: { errors, actions = {}, errorMessage } }) => { - const createFolder = (parentId, name) => mutate({ - variables: { - folder: { - parentId, - name, - }, - }, - }); - const files = actions.files || {}; - - return { - errorMessage: errorMessage || (errors && errors[0].message), - actions: { - ...actions, - files: { - ...files, - createFolder, - }, - }, - }; - }, -}; - -const buildQueryConfig = () => ({ - apolloConfig: { ...config }, - templateName: 'scaffoldCreate', - singularName: 'Folder', - params: { - folder: 'FolderInput!', - }, - fields: [ - '...FileInterfaceFields', - '...FileFields', - ], - fragments: [ - 'FileInterfaceFields', - 'FileFields', - ], -}); - -export { config, buildQueryConfig }; diff --git a/client/src/state/files/deleteFilesMutation.js b/client/src/state/files/deleteFilesMutation.js deleted file mode 100644 index 4eeb5da14..000000000 --- a/client/src/state/files/deleteFilesMutation.js +++ /dev/null @@ -1,67 +0,0 @@ -import { graphql } from '@apollo/client/react/hoc'; -import gql from 'graphql-tag'; -import Injector from 'lib/Injector'; - -const mutation = gql`mutation DeleteFiles($ids:[ID]!) { - deleteFiles(ids: $ids) -}`; - -const config = { - props: ({ mutate, ownProps }) => { - const { actions } = ownProps; - const deleteFiles = (ids, parentId = null) => mutate({ - variables: { - ids, - }, - update: (store) => { - const readFilesQuery = Injector.query.get('ReadFilesQuery'); - const readFilesConfig = readFilesQuery.getApolloConfig(); - const variables = readFilesConfig.options(ownProps).variables; - if (parentId !== null) { - variables.rootFilter.id = parentId; - variables.rootFilter.anyChildId = null; - } - const query = readFilesQuery.getGraphqlAST(); - const data = store.readQuery({ query, variables }); - - // When loading for example /show/0/edit/14 directly (instead of letting react routing - // get you there) this tends to be null. Returning here avoids errors. - if (!data) { - return; - } - - // Query returns a deeply nested object. Explicit reconstruction via spreads is too verbose. - // This is an alternative, relatively efficient way to deep clone - const newData = JSON.parse(JSON.stringify(data)); - - // GraphQL backward compat hack - if (newData.readFiles.nodes) { - let { nodes } = newData.readFiles.nodes[0].children; - nodes = nodes.filter(node => !ids.includes(node.id)); - newData.readFiles.nodes[0].children.nodes = nodes; - newData.readFiles.nodes[0].children.pageInfo.totalCount = nodes.length; - } else { - let { nodes } = newData.readFiles[0].children; - nodes = nodes.filter(node => !ids.includes(node.id)); - newData.readFiles[0].children.nodes = nodes; - newData.readFiles[0].children.pageInfo.totalCount = nodes.length; - } - store.writeQuery({ query, data: newData, variables }); - } - }); - - return { - actions: { - ...actions, - files: { - ...actions.files, - deleteFiles, - }, - }, - }; - }, -}; - -export { mutation, config }; - -export default graphql(mutation, config); diff --git a/client/src/state/files/moveFilesMutation.js b/client/src/state/files/moveFilesMutation.js deleted file mode 100644 index e82f0588f..000000000 --- a/client/src/state/files/moveFilesMutation.js +++ /dev/null @@ -1,36 +0,0 @@ -import { graphql } from '@apollo/client/react/hoc'; -import gql from 'graphql-tag'; -import { fileInterface, file } from 'lib/fileFragments'; - -const mutation = gql` - mutation MoveFiles($folderId:ID!, $fileIds:[ID]!) { - moveFiles(folderId: $folderId, fileIds: $fileIds) { - ...FileInterfaceFields - ...FileFields - } - } - ${fileInterface} - ${file} -`; - -const config = { - props: ({ mutate, ownProps: { actions = {} } }) => ({ - actions: Object.assign({}, actions, { - files: Object.assign({}, actions.files, { - moveFiles: (folderId, fileIds) => mutate({ - variables: { - folderId, - fileIds, - }, - update: () => { - window.ss.apolloClient.resetStore(); - } - }), - }), - }), - }), -}; - -export { mutation, config }; - -export default graphql(mutation, config); diff --git a/client/src/state/files/publishFilesMutation.js b/client/src/state/files/publishFilesMutation.js deleted file mode 100644 index 9006b305a..000000000 --- a/client/src/state/files/publishFilesMutation.js +++ /dev/null @@ -1,7 +0,0 @@ -import { graphql } from '@apollo/client/react/hoc'; -import buildPublicationMutation from './buildPublicationMutation'; - -const { mutation, config } = buildPublicationMutation('publishFiles'); - -export { mutation, config }; -export default graphql(mutation, config); diff --git a/client/src/state/files/readDescendantFileCountsQuery.js b/client/src/state/files/readDescendantFileCountsQuery.js deleted file mode 100644 index 548e58850..000000000 --- a/client/src/state/files/readDescendantFileCountsQuery.js +++ /dev/null @@ -1,54 +0,0 @@ -import { graphqlTemplates } from 'lib/Injector'; - -const apolloConfig = { - options({ files }) { - return { - variables: { - ids: files.map((file) => file.id) - }, - }; - }, - props( - props - ) { - const { - data: { - error, - readDescendantFileCounts, - loading: networkLoading, - }, - } = props; - const errors = error && error.graphQLErrors && - error.graphQLErrors.map((graphQLError) => graphQLError.message); - - const descendantFileCounts = readDescendantFileCounts ? - readDescendantFileCounts.reduce((accumulator, { id, count }) => ( - { ...accumulator, [id]: count } - ), {}) : - {}; - - return { - loading: networkLoading, - descendantFileCounts, - graphQLErrors: errors, - }; - }, -}; - -const { READ } = graphqlTemplates; -const query = { - apolloConfig, - templateName: READ, - pluralName: 'DescendantFileCounts', - pagination: false, - params: { - ids: '[ID]!' - }, - args: { - root: { - ids: 'ids' - } - }, - fields: ['id', 'count'], -}; -export default query; diff --git a/client/src/state/files/readFileUsageQuery.js b/client/src/state/files/readFileUsageQuery.js deleted file mode 100644 index 7a9ca89e6..000000000 --- a/client/src/state/files/readFileUsageQuery.js +++ /dev/null @@ -1,54 +0,0 @@ -import { graphqlTemplates } from 'lib/Injector'; - -const apolloConfig = { - options({ files }) { - return { - variables: { - ids: files.map((file) => file.id) - }, - }; - }, - props( - props - ) { - const { - data: { - error, - readFileUsage, - loading: networkLoading, - }, - } = props; - const errors = error && error.graphQLErrors && - error.graphQLErrors.map((graphQLError) => graphQLError.message); - - const fileUsage = readFileUsage ? - readFileUsage.reduce((accumulator, { id, inUseCount }) => ( - { ...accumulator, [id]: inUseCount } - ), {}) : - {}; - - return { - loading: networkLoading, - fileUsage, - graphQLErrors: errors, - }; - }, -}; - -const { READ } = graphqlTemplates; -const query = { - apolloConfig, - templateName: READ, - pluralName: 'FileUsage', - pagination: false, - params: { - ids: '[ID]!' - }, - args: { - root: { - ids: 'ids' - } - }, - fields: ['id', 'inUseCount'], -}; -export default query; diff --git a/client/src/state/files/readFilesQuery.js b/client/src/state/files/readFilesQuery.js deleted file mode 100644 index d8dbe7697..000000000 --- a/client/src/state/files/readFilesQuery.js +++ /dev/null @@ -1,138 +0,0 @@ -import { hasFilters } from 'components/Search/Search'; -import { graphqlTemplates } from 'lib/Injector'; - -const apolloConfig = { - options({ sectionConfig, folderId, fileId, query: params }) { - const filter = Object.assign({}, params.filter); - const childrenFilter = Object.assign( - {}, - filter, - { - // Unset key, taken from rootFilter - parentId: undefined, - // Currently all searches are recursive, and only filtered by a ParentID - recursive: hasFilters(filter), - // Unset this key since it's not a valid GraphQL argument - currentFolderOnly: undefined, - } - ); - - // only populate anyChildId param if no search is applied - const anyChildId = (hasFilters(filter)) ? null : (fileId || null); - const id = (anyChildId) ? null : (folderId || 0); - - const rootFilter = { - // can be 0 (root) - id, - // treat 0 as null - anyChildId, - }; - - // Covers a few variations: - // - Display the root folder with its direct children - // - Display the root folder with its recursive children and filters (a full "search") - // - Display a folder with its direct children, without any filters - // - Display a folder with its direct children and filters (a "search" in the current folder) - const [sortField, sortDir] = params.sort ? params.sort.split(',') : ['', '']; - const limit = params.limit || sectionConfig.limit; - return { - variables: { - rootFilter, - childrenFilter, - limit, - offset: ((params.page || 1) - 1) * limit, - sortBy: (sortField && sortDir) - ? { [sortField]: sortDir.toUpperCase() } - : undefined, - }, - }; - }, - props( - { - data: { - error, - refetch, - readFiles, - loading: networkLoading, - }, - ownProps: { actions }, - } - ) { - // Uses same query as search and file list to return a single result (the containing folder) - const folder = readFiles ? readFiles[0] : null; - const files = (folder && folder.children) - // Filter nodes because the DELETE resultBehaviour doesn't delete the edge, only the node - ? folder.children.nodes.filter((file) => file) - : []; - const filesTotalCount = (folder && folder.children) - ? folder.children.pageInfo.totalCount - : 0; - - const filesLoading = (folder && !folder.children); - const errors = error && error.graphQLErrors && - error.graphQLErrors.map((graphQLError) => graphQLError.message); - return { - loading: networkLoading || filesLoading, - folder, - files, - filesTotalCount, - graphQLErrors: errors, - actions: Object.assign({}, actions, { - files: Object.assign({}, actions.files, { - readFiles: refetch, - }), - }), - }; - }, -}; - -const { READ } = graphqlTemplates; -const query = { - apolloConfig, - templateName: READ, - pluralName: 'Files', - pagination: false, - params: { - limit: 'Int!', - offset: 'Int!', - rootFilter: 'FileFilterInput', - childrenFilter: 'FileFilterInput', - sortBy: 'FolderChildrenSortFields', - }, - args: { - root: { - filter: 'rootFilter' - }, - 'root/...on Folder/children': { - limit: 'limit', - offset: 'offset', - filter: 'childrenFilter', - sort: 'sortBy', - }, - }, - fragments: [ - 'FileInterfaceFields', - 'FileFields', - ], - fields: [ - '...FileInterfaceFields', - '...FileFields', - '...on Folder', [ - 'children', [ - 'pageInfo', [ - 'totalCount', - ], - 'nodes', [ - '...FileInterfaceFields', - '...FileFields', - ] - ], - 'parents', [ - 'id', - 'title', - ], - ], - ], -}; - -export default query; diff --git a/client/src/state/files/readOneFileQuery.js b/client/src/state/files/readOneFileQuery.js deleted file mode 100644 index 141dedaf0..000000000 --- a/client/src/state/files/readOneFileQuery.js +++ /dev/null @@ -1,53 +0,0 @@ -import { graphqlTemplates } from 'lib/Injector'; - -/** - * Query to fetch a single file by its ID. The resulting file will be pass to your component - * under a `file` prop. `null` will be pass if the specified ID does not exist. - */ -const apolloConfig = { - options({ fileId }) { - return { - variables: { - rootFilter: { - id: fileId - }, - }, - }; - }, - props({ data: { error, readFiles, loading: networkLoading } }) { - const file = readFiles ? readFiles[0] : null; - const errors = error && error.graphQLErrors && - error.graphQLErrors.map((graphQLError) => graphQLError.message); - return { - loading: networkLoading, - file, - graphQLErrors: errors, - }; - }, -}; - -const { READ } = graphqlTemplates; -const query = { - apolloConfig, - templateName: READ, - pluralName: 'Files', - pagination: false, - params: { - rootFilter: 'FileFilterInput', - }, - args: { - root: { - filter: 'rootFilter' - } - }, - fragments: [ - 'FileInterfaceFields', - 'FileFields', - ], - fields: [ - '...FileInterfaceFields', - '...FileFields', - ], -}; - -export default query; diff --git a/client/src/state/files/tests/readFilesQuery-test.js b/client/src/state/files/tests/readFilesQuery-test.js deleted file mode 100644 index 9c58ec622..000000000 --- a/client/src/state/files/tests/readFilesQuery-test.js +++ /dev/null @@ -1,79 +0,0 @@ -/* global jest, describe, it, pit, expect, beforeEach */ - -import query from '../readFilesQuery'; - -describe('readFilesQuery', () => { - const config = query.apolloConfig; - let graphqlData = null; - let child1 = null; - let child2 = null; - let folder = null; - - beforeEach(() => { - child1 = { id: 2 }; - child2 = { id: 3 }; - folder = { - id: 1, - children: { - pageInfo: { totalCount: 2 }, - nodes: [child1, child2], - }, - }; - graphqlData = { - data: { - refetch: jest.fn(), - readFiles: [folder], - }, - ownProps: { - actions: {}, - }, - }; - }); - - it('should map the readFiles data to props', () => { - const newProps = config.props(graphqlData); - - expect(newProps.files).toContain(child1); - expect(newProps.files).toContain(child2); - expect(newProps.filesTotalCount).toBe(2); - expect(typeof newProps.actions.files.readFiles).toBe('function'); - - newProps.actions.files.readFiles(); - expect(graphqlData.data.refetch).toBeCalled(); - }); - - it('should calculate pagination info in options', () => { - const ownProps = { - sectionConfig: {}, - folderId: 1, - query: { - limit: 10, - page: 3, - sort: 'title desc', - }, - }; - - const newOptions = config.options(ownProps); - - expect(newOptions.variables.limit).toBe(10); - expect(newOptions.variables.offset).toBe(20); - }); - - it('should calculate pagination info on defaults in options', () => { - const ownProps = { - sectionConfig: { - limit: 10, - }, - folderId: 1, - query: { - limit: null, - page: 4, - sort: 'title desc', - }, - }; - const newOptions = config.options(ownProps); - - expect(newOptions.variables.limit).toBe(10); - expect(newOptions.variables.offset).toBe(30); - }); -}); diff --git a/client/src/state/files/unpublishFilesMutation.js b/client/src/state/files/unpublishFilesMutation.js deleted file mode 100644 index d25f351c6..000000000 --- a/client/src/state/files/unpublishFilesMutation.js +++ /dev/null @@ -1,7 +0,0 @@ -import { graphql } from '@apollo/client/react/hoc'; -import buildPublicationMutation from './buildPublicationMutation'; - -const { mutation, config } = buildPublicationMutation('unpublishFiles'); - -export { mutation, config }; -export default graphql(mutation, config); diff --git a/code/Controller/AssetAdmin.php b/code/Controller/AssetAdmin.php index 5be50322f..824389ca1 100644 --- a/code/Controller/AssetAdmin.php +++ b/code/Controller/AssetAdmin.php @@ -32,7 +32,6 @@ use SilverStripe\Forms\FormFactory; use SilverStripe\ORM\ArrayList; use SilverStripe\ORM\DataObject; -use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\ORM\ValidationResult; use SilverStripe\Security\Member; use SilverStripe\Security\Permission; @@ -43,12 +42,17 @@ use SilverStripe\View\Requirements; use SilverStripe\View\SSViewer; use SilverStripe\VersionedAdmin\Extensions\FileArchiveExtension; +use SilverStripe\AssetAdmin\Controller\AssetAdminFile; +use stdClass; +use SilverStripe\ORM\DataList; +use SilverStripe\Forms\DateField; +use SilverStripe\ORM\DataQuery; /** * AssetAdmin is the 'file store' section of the CMS. * It provides an interface for manipulating the File and Folder objects in the system. */ -class AssetAdmin extends LeftAndMain implements PermissionProvider +class AssetAdmin extends AssetAdminOpen implements PermissionProvider { private static $url_segment = 'assets'; @@ -65,10 +69,6 @@ class AssetAdmin extends LeftAndMain implements PermissionProvider 'EditForm/field/File/item/$FileID/$Action' => 'legacyRedirectForEditView', // Pass all URLs to the index, for React to unpack 'show/$FolderID/edit/$FileID' => 'index', - // API access points with structured data - 'POST api/createFile' => 'apiCreateFile', - 'POST api/uploadFile' => 'apiUploadFile', - 'GET api/history' => 'apiHistory', 'fileEditForm/$ID' => 'fileEditForm', 'fileInsertForm/$ID' => 'fileInsertForm', 'fileEditorLinkForm/$ID' => 'fileEditorLinkForm', @@ -76,6 +76,43 @@ class AssetAdmin extends LeftAndMain implements PermissionProvider 'folderCreateForm/$ParentID' => 'folderCreateForm', 'fileSelectForm/$ID' => 'fileSelectForm', 'moveForm/$ID' => 'moveForm', + 'GET api/history' => 'apiHistory', + 'GET api/readDescendantCounts' => 'apiReadDescendantCounts', + 'GET api/readLiveOwnerCounts' => 'apiReadLiveOwnerCounts', + 'GET api/readUsage/$ID!' => 'apiReadUsage', + 'POST api/delete' => 'apiDelete', + 'POST api/createFile' => 'apiCreateFile', + 'POST api/move' => 'apiMove', + 'POST api/publish' => 'apiPublish', + 'POST api/unpublish' => 'apiUnpublish', + 'POST api/uploadFile' => 'apiUploadFile', + ]; + + /** + * @var array + */ + private static array $allowed_actions = [ + 'legacyRedirectForEditView', + 'folderCreateForm', + 'fileEditForm', + 'fileHistoryForm', + 'addToCampaignForm', + 'fileInsertForm', + 'fileEditorLinkForm', + 'schema', + 'fileSelectForm', + 'fileSearchForm', + 'moveForm', + 'apiCreateFile', + 'apiDelete', + 'apiHistory', + 'apiReadDescendantCounts', + 'apiReadLiveOwnerCounts', + 'apiReadUsage', + 'apiMove', + 'apiPublish', + 'apiUnpublish', + 'apiUploadFile', ]; /** @@ -127,27 +164,6 @@ class AssetAdmin extends LeftAndMain implements PermissionProvider */ private static $image_retry_failure_expiry = 300; - - /** - * @var array - */ - private static $allowed_actions = array( - 'legacyRedirectForEditView', - 'apiCreateFile', - 'apiUploadFile', - 'apiHistory', - 'folderCreateForm', - 'fileEditForm', - 'fileHistoryForm', - 'addToCampaignForm', - 'fileInsertForm', - 'fileEditorLinkForm', - 'schema', - 'fileSelectForm', - 'fileSearchForm', - 'moveForm', - ); - private static $required_permission_codes = 'CMS_ACCESS_AssetAdmin'; /** @@ -166,7 +182,6 @@ class AssetAdmin extends LeftAndMain implements PermissionProvider */ private static $thumbnail_height = 264; - /** * Whatever the front end should try to bust cache by appending the version id to the image URL. * @config @@ -175,9 +190,9 @@ class AssetAdmin extends LeftAndMain implements PermissionProvider private static $bust_cache = true; /** - * @var ThumbnailGenerator + * Show this controller in the CMS menu */ - protected $thumbnailGenerator; + private static $ignore_menuitem = false; /** * Set up the controller @@ -185,43 +200,80 @@ class AssetAdmin extends LeftAndMain implements PermissionProvider public function init() { parent::init(); - - Requirements::add_i18n_javascript('silverstripe/asset-admin:client/lang', false); - Requirements::javascript('silverstripe/asset-admin:client/dist/js/bundle.js'); - Requirements::css('silverstripe/asset-admin:client/dist/styles/bundle.css'); - CMSBatchActionHandler::register('delete', DeleteAssets::class, Folder::class); } + /** + * Returns configuration required by the client app + */ public function getClientConfig() { $baseLink = $this->Link(); $validator = $this->getUpload()->getValidator(); - return array_merge(parent::getClientConfig(), [ + $parentClientConfig = parent::getClientConfig(); + return array_merge($parentClientConfig, [ 'reactRouter' => true, 'bustCache' => static::config()->get('bust_cache'), - 'createFileEndpoint' => [ - 'url' => Controller::join_links($baseLink, 'api/createFile'), - 'method' => 'post', - 'payloadFormat' => 'urlencoded', - ], - 'uploadFileEndpoint' => [ - 'url' => Controller::join_links($baseLink, 'api/uploadFile'), - 'method' => 'post', - 'payloadFormat' => 'urlencoded', - ], - 'historyEndpoint' => [ - 'url' => Controller::join_links($baseLink, 'api/history'), - 'method' => 'get', - 'responseFormat' => 'json', - ], + 'endpoints' => array_merge($parentClientConfig['endpoints'], [ + 'createFile' => [ + 'url' => Controller::join_links($baseLink, 'api/createFile'), + 'method' => 'post', + 'payloadFormat' => 'urlencoded', + ], + 'delete' => [ + 'url' => Controller::join_links($baseLink, 'api/delete'), + 'method' => 'post', + 'payloadFormat' => 'json', + ], + 'history' => [ + 'url' => Controller::join_links($baseLink, 'api/history'), + 'method' => 'get', + 'responseFormat' => 'json', + ], + 'move' => [ + 'url' => Controller::join_links($baseLink, 'api/move'), + 'method' => 'post', + 'payloadFormat' => 'json', + ], + 'publish' => [ + 'url' => Controller::join_links($baseLink, 'api/publish'), + 'method' => 'post', + 'payloadFormat' => 'json', + ], + 'readDescendantCounts' => [ + 'url' => Controller::join_links($baseLink, 'api/readDescendantCounts'), + 'method' => 'get', + 'responseFormat' => 'json', + ], + 'readLiveOwnerCounts' => [ + 'url' => Controller::join_links($baseLink, 'api/readLiveOwnerCounts'), + 'method' => 'get', + 'responseFormat' => 'json', + ], + 'readUsage' => [ + 'url' => Controller::join_links($baseLink, 'api/readUsage'), + 'method' => 'get', + 'responseFormat' => 'json', + ], + 'unpublish' => [ + 'url' => Controller::join_links($baseLink, 'api/unpublish'), + 'method' => 'post', + 'payloadFormat' => 'json', + ], + 'uploadFile' => [ + 'url' => Controller::join_links($baseLink, 'api/uploadFile'), + 'method' => 'post', + 'payloadFormat' => 'urlencoded', + ], + ]), 'limit' => $this->config()->page_length, 'imageRetry' => [ 'minRetry' => $this->config()->image_retry_min, 'maxRetry' => $this->config()->image_retry_max, 'expiry' => $this->config()->image_retry_failure_expiry, ], + 'filesAreVersioned' => File::singleton()->has_extension(Versioned::class), 'form' => [ 'fileEditForm' => [ 'schemaUrl' => $this->Link('schema/fileEditForm') @@ -273,13 +325,183 @@ public function getClientConfig() ]); } + /** + * JSON endpoint to get a count of decentant files for multiple folders + */ + public function apiReadDescendantCounts(HTTPRequest $request): HTTPResponse + { + $data = []; + $ids = $this->getQueryStringValue($request, 'ids'); + foreach ($ids as $id) { + $id = (int) $id; + /* @var File&AssetAdminFile $file */ + $file = $this->getFileByID($id, false, 404); + if (!$file->canView()) { + $this->jsonError(403); + } + $count = 0; + $type = 'file'; + if (is_a($file, Folder::class)) { + $count = $file->getDescendantFileCount(); + $type = 'folder'; + } + $data[] = [ + 'id' => $id, + 'type' => $type, + 'count' => $count + ]; + } + $this->extend('updateApiReadDescendantCounts', $data, $request); + return $this->jsonSuccess(200, $data); + } + + /** + * JSON endpoint to get a count of live owners for multiple files + */ + public function apiReadLiveOwnerCounts(HTTPRequest $request): HTTPResponse + { + $ids = $this->getQueryStringValue($request, 'ids'); + $data = []; + $files = $this->getFilesByIDs($ids, true, 404); + $fileIDs = $files->column('ID'); + if (count($fileIDs) > 0) { + $liveFiles = Versioned::get_by_stage(File::class, Versioned::LIVE) + ->filter(['ID' => $fileIDs]); + /** @var Versioned|File $liveFile */ + foreach ($liveFiles as $liveFile) { + $count = $liveFile->findOwners(false)->count(); + $data[] = [ + 'id' => $liveFile->ID, + 'count' => $count, + 'message' => _t( + AssetAdmin::class . '.OWNER_WARNING', + 'File "{file}" is used in {count} place|File "{file}" is used in {count} places.', + [ + 'file' => $liveFile->Title, + 'count' => $count + ] + ), + ]; + } + } + $this->extend('updateApiReadLiveOwnerCounts', $data, $request); + return $this->jsonSuccess(200, $data); + } + + /** + * JSON endpoint to get a count of file usage for a single file + */ + public function apiReadUsage(HTTPRequest $request): HTTPResponse + { + $id = (int) $request->param('ID'); + /* @var File&AssetAdminFile $file */ + $file = $this->getFileByID($id, false, 404); + if (!$file->canView()) { + $this->jsonError(403); + } + $count = $file->getFilesInUse()->count(); + $data = ['count' => $count]; + $this->extend('updateApiReadUsage', $data, $request); + return $this->jsonSuccess(200, $data); + } + + /** + * JSON endpoint to delete multiple files + */ + public function apiDelete(HTTPRequest $request): HTTPResponse + { + if (!SecurityToken::inst()->checkRequest($request)) { + $this->jsonError(400); + } + $ids = $this->getPostedJsonValue($request, 'ids'); + $files = $this->getFilesByIDs($ids, true, 400); + foreach ($files as $file) { + if (!$file->canDelete()) { + $this->jsonError(403); + } + } + foreach ($files as $file) { + if ($file->has_extension(Versioned::class)) { + $file->doArchive(); + } else { + $file->delete(); + } + } + return $this->jsonSuccess(204); + } + + /** + * JSON endpoint to multiple files to a new folder + */ + public function apiMove(HTTPRequest $request): HTTPResponse + { + if (!SecurityToken::inst()->checkRequest($request)) { + $this->jsonError(400); + } + $ids = $this->getPostedJsonValue($request, 'ids'); + $folderID = $this->getPostedJsonValue($request, 'folderID'); + $folder = $this->getFileByID($folderID, true, 400); + $files = $this->getFilesByIDs($ids, true, 400); + foreach ($files as $file) { + if (!$file->canEdit()) { + $this->jsonError(403); + } + } + foreach ($files as $file) { + $file->ParentID = $folder->ID; + $file->write(); + } + return $this->jsonSuccess(204); + } + + /** + * JSON endpoint that publishes multiple files + */ + public function apiPublish(HTTPRequest $request): HTTPResponse + { + if (!SecurityToken::inst()->checkRequest($request)) { + $this->jsonError(400); + } + $ids = $this->getPostedJsonValue($request, 'ids'); + $files = $this->getFilesByIDs($ids, false, 400); + foreach ($files as $file) { + if (!$file->canPublish()) { + $this->jsonError(403); + } + } + foreach ($files as $file) { + $file->publishRecursive(); + } + return $this->jsonSuccess(204); + } + + /** + * JSON endpoint that unpublishes multiple files + */ + public function apiUnpublish(HTTPRequest $request): HTTPResponse + { + if (!SecurityToken::inst()->checkRequest($request)) { + $this->jsonError(400); + } + $ids = $this->getPostedJsonValue($request, 'ids'); + $files = $this->getFilesByIDs($ids, false, 400); + foreach ($files as $file) { + if (!$file->canUnpublish()) { + $this->jsonError(403); + } + } + foreach ($files as $file) { + $file->doUnpublish(); + } + return $this->jsonSuccess(204); + } + /** * Creates a single file based on a form-urlencoded upload. * * @param HTTPRequest $request - * @return HTTPRequest|HTTPResponse */ - public function apiCreateFile(HTTPRequest $request) + public function apiCreateFile(HTTPRequest $request): HTTPResponse { $data = $request->postVars(); @@ -287,11 +509,10 @@ public function apiCreateFile(HTTPRequest $request) $upload = $this->getUpload(); $upload->setReplaceFile(false); - // CSRF check + // CSRF check - note that token is sent in POST body, not header $token = SecurityToken::inst(); if (empty($data[$token->getName()]) || !$token->check($data[$token->getName()])) { $this->jsonError(400); - return null; } // Check parent record @@ -306,7 +527,6 @@ public function apiCreateFile(HTTPRequest $request) $errors = $upload->getErrors(); $message = array_shift($errors); $this->jsonError(400, $message); - return null; } $fileClass = File::get_class_for_file_extension(File::get_file_extension($tmpFile['name'])); @@ -319,7 +539,6 @@ public function apiCreateFile(HTTPRequest $request) 403, _t(__CLASS__.'.CreatePermissionDenied', 'You do not have permission to add files') ); - return null; } $uploadResult = $upload->loadIntoFile($tmpFile, $file, $parentRecord ? $parentRecord->getFilename() : '/'); @@ -328,7 +547,6 @@ public function apiCreateFile(HTTPRequest $request) 400, _t(__CLASS__.'.LoadIntoFileFailed', 'Failed to load file') ); - return null; } $file->ParentID = $parentRecord ? $parentRecord->ID : 0; @@ -353,9 +571,8 @@ public function apiCreateFile(HTTPRequest $request) * * @param HTTPRequest $request Request containing vars 'ID' of parent record ID, * and 'Name' as form filename value - * @return HTTPRequest|HTTPResponse */ - public function apiUploadFile(HTTPRequest $request) + public function apiUploadFile(HTTPRequest $request): HTTPResponse { $data = $request->postVars(); @@ -363,23 +580,21 @@ public function apiUploadFile(HTTPRequest $request) $upload = $this->getUpload(); $upload->setReplaceFile(true); - // CSRF check + // CSRF check - note that token is sent in POST body, not header $token = SecurityToken::inst(); if (empty($data[$token->getName()]) || !$token->check($data[$token->getName()])) { $this->jsonError(400); - return null; } + $tmpFile = $data['Upload']; if (empty($data['ID']) || empty($tmpFile['name']) || !array_key_exists('Name', $data ?? [])) { $this->jsonError(400, _t(__CLASS__.'.INVALID_REQUEST', 'Invalid request')); - return null; } // Check parent record $file = File::get()->byID($data['ID']); if (!$file) { $this->jsonError(404, _t(__CLASS__.'.FILE_NOT_FOUND', 'File not found')); - return null; } $folder = $file->ParentID ? $file->Parent()->getFilename() : '/'; @@ -403,20 +618,17 @@ public function apiUploadFile(HTTPRequest $request) $errors = $upload->getErrors(); $message = array_shift($errors); $this->jsonError(400, $message); - return null; } try { $tuple = $upload->load($tmpFile, $folder); } catch (Exception $e) { $this->jsonError(400, $e->getMessage()); - return null; } if ($upload->isError()) { $errors = implode(' ' . PHP_EOL, $upload->getErrors()); $this->jsonError(400, $errors); - return null; } $tuple['Name'] = basename($tuple['Filename'] ?? ''); @@ -426,18 +638,13 @@ public function apiUploadFile(HTTPRequest $request) /** * Returns a JSON array for history of a given file ID. Returns a list of all the history. - * - * @param HTTPRequest $request - * @return HTTPResponse */ - public function apiHistory(HTTPRequest $request) + public function apiHistory(HTTPRequest $request): HTTPResponse { - // CSRF check not required as the GET request has no side effects. $fileId = $request->getVar('fileId'); if (!$fileId || !is_numeric($fileId)) { $this->jsonError(400); - return null; } $class = File::class; @@ -445,12 +652,10 @@ public function apiHistory(HTTPRequest $request) if (!$file) { $this->jsonError(404); - return null; } if (!$file->canView()) { $this->jsonError(403); - return null; } $versions = Versioned::get_all_versions($class, $fileId) @@ -522,6 +727,40 @@ public function apiHistory(HTTPRequest $request) return $response->addHeader('Content-Type', 'application/json'); } + /** + * Retrieves a list of files by their IDs + */ + private function getFilesByIDs(array $ids, bool $includeFolders, int $missingFileErrorCode): ArrayList + { + $files = File::get()->filter(['ID' => $ids]); + if ($files->count() !== count($ids)) { + $this->jsonError($missingFileErrorCode); + } + return $files->filterByCallback(function (File $file) use ($includeFolders) { + if (!$includeFolders && is_a($file, Folder::class)) { + return false; + } + if (!$file->canView()) { + $this->jsonError(403); + } + return true; + }); + } + + /** + * Get a data value from the POST request, ensuring it exists and is valid + */ + protected function getPostedJsonValue(HTTPRequest $request, string $key): mixed + { + $value = parent::getPostedJsonValue($request, $key); + if ($key === 'ids') { + if (!is_array($value) || empty($value)) { + $this->jsonError(400); + } + } + return $value; + } + /** * Redirects 3.x style detail links to new 4.x style routing. */ @@ -1071,7 +1310,7 @@ public function getObjectFromData(File $file, $thumbnailLinks = true) { $object = $this->getMinimalistObjectFromData($file, $thumbnailLinks); - // Slightly more accurate than graphql bulk-usage lookup, but more expensive + // Slightly more accurate than bulk-usage lookup, but more expensive $object['inUseCount'] = ($file->hasMethod('findOwners')) ? $file->findOwners()->count() : 0; $object['created'] = $file->Created; $object['lastUpdated'] = $file->LastEdited; @@ -1329,7 +1568,6 @@ public function getFolderCreateForm($parentId = 0) /** * Scaffold a search form. * Note: This form does not submit to itself, but rather uses the apiReadFolder endpoint - * (to be replaced with graphql) * * @return Form */ @@ -1349,24 +1587,6 @@ public function getFileSearchform() return $this->fileSearchForm(); } - /** - * @return ThumbnailGenerator - */ - public function getThumbnailGenerator() - { - return $this->thumbnailGenerator; - } - - /** - * @param ThumbnailGenerator $generator - * @return $this - */ - public function setThumbnailGenerator(ThumbnailGenerator $generator) - { - $this->thumbnailGenerator = $generator; - return $this; - } - public function canView($member = null) { // Since admin/assets is used as the endpoint for various other CMS modals, diff --git a/code/Controller/AssetAdminOpen.php b/code/Controller/AssetAdminOpen.php new file mode 100644 index 000000000..3640ec3a7 --- /dev/null +++ b/code/Controller/AssetAdminOpen.php @@ -0,0 +1,422 @@ + 'apiRead', + ]; + + private static array $allowed_actions = [ + 'apiRead', + ]; + + /** + * Amount of results showing on a single page. + */ + private static int $page_length = 50; + + /** + * Allow any authenticated CMS user access to this controller + * + * This must be false, not 'CMS_ACCESS' or else this will not work with silverstripe/subsites + * for users with limited permissions e.g. 'CMS_ACCESS_AssetAdmin' only + */ + private static bool $required_permission_codes = false; + + /** + * Do not show this controller in the CMS menu + */ + private static bool $ignore_menuitem = true; + + protected ThumbnailGenerator $thumbnailGenerator; + + /** + * Set up the controller + */ + public function init() + { + parent::init(); + Requirements::add_i18n_javascript('silverstripe/asset-admin:client/lang', false); + Requirements::javascript('silverstripe/asset-admin:client/dist/js/bundle.js'); + Requirements::css('silverstripe/asset-admin:client/dist/styles/bundle.css'); + } + + /** + * Returns configuration required by the client app + */ + public function getClientConfig() + { + return array_merge(parent::getClientConfig(), [ + 'reactRouter' => true, + 'endpoints' => [ + 'read' => [ + 'url' => $this->Link('api/read'), + 'method' => 'get', + 'responseFormat' => 'json', + ], + ], + ]); + } + + /** + * JSON endpoint that shows data for a single file or folder including ancestor and child data + */ + public function apiRead(HTTPRequest $request): HTTPResponse + { + $id = $this->getIDParam($request); + $file = null; + if ($id === 0) { + // The root folder has an ID of 0 + $data = $this->getFileData(Folder::singleton(), $request, false, false); + $tmp = $this->getFileData(null, $request, false, true); + $data['children'] = $tmp['children']; + } else { + $file = $this->getFileByID($id, false, 404); + $data = $this->getFileData($file, $request, true, true); + } + $this->extend('updateApiRead', $data, $file, $request); + return $this->jsonSuccess(200, $data); + } + + public function getThumbnailGenerator(): ThumbnailGenerator + { + return $this->thumbnailGenerator; + } + + public function setThumbnailGenerator(ThumbnailGenerator $generator): static + { + $this->thumbnailGenerator = $generator; + return $this; + } + + /** + * Get data for a single file or folder including ancestor and child data + * + * @param File|Versioned $file + */ + protected function getFileData( + ?File $file, + HTTPRequest $request, + bool $includeAncestors, + bool $includeChildren, + ): array { + // Ancestors - used for breadcrumbs + $ancestors = []; + if ($includeAncestors) { + /** @var File|Hierarchy $file */ + foreach ($file->getAncestors() as $ancestor) { + $ancestors[] = $this->getFileData($ancestor, $request, false, false); + } + $ancestors = array_reverse($ancestors); + } + // Children + $children = []; + $totalCount = 0; + if ($includeChildren) { + $childFiles = $this->getFilteredChildFiles($file, $request); + $limit = static::config()->get('page_length'); + $offset = 0; + $page = $this->getQueryStringValue($request, 'page', true); + if ($page) { + $offset = $limit * ($page - 1); + } + $totalCount = $childFiles->count(); + // Folders show first in paginated results, no matter the sort order + // it's assumed that no one will every subclass a Folder + $childFiles = $childFiles->alterDataQuery(function (DataQuery $query) { + $query->selectField('CASE WHEN "File"."ClassName" = \'SilverStripe\\\\Assets\\\\Folder\' THEN 1 ELSE 0 END AS "IsFolderTmp"'); + $query->sort('"IsFolderTmp" DESC', null, true); + }); + $childFiles = $childFiles->limit($limit, $offset); + foreach ($childFiles as $childFile) { + if (!$childFile->canView()) { + continue; + } + $children[] = $this->getFileData($childFile, $request, false, false); + } + // Sorting + $sort = $this->getQueryStringValue($request, 'sort', true); + if (!$sort) { + $sort = 'title,asc'; + } + [$field, $dir] = explode(',', $sort); + if (!in_array($field, ['title', 'lastEdited']) || !in_array($dir, ['asc', 'desc'])) { + $this->jsonError(404); + } + $d = $dir === 'asc' ? 1 : -1; + usort($children, function ($a, $b) use ($field, $d) { + if ($field === 'title') { + return strcasecmp($a['title'], $b['title']) * $d; + } elseif ($field === 'lastEdited') { + return (strtotime($a['lastEdited']) <=> strtotime($b['lastEdited'])) * $d; + } + }); + } + $childObj = new stdClass; + $childObj->pageInfo = new stdClass; + $childObj->pageInfo->totalCount = $totalCount; + $childObj->nodes = $children; + // This is purely for the root folder + if (!$file) { + return [ + 'children' => $childObj + ]; + } + // Values + return [ + 'canDelete' => $file->canDelete(), + 'canEdit' => $file->canEdit(), + 'canView' => $file->canView(), + 'category' => $file instanceof Folder ? 'folder' : $file->appCategory(), + 'exists' => $file->exists(), + 'filename' => $file->getFilename(), + 'id' => $file->ID, + 'lastEdited' => $file->LastEdited, + 'name' => $file->Name, + 'parentId' => $file->ParentID, + 'title' => $file->Title, + 'type' => $file instanceof Folder ? 'folder' : 'file', + 'url' => $file->getURL(), + 'visibility' => $file->getVisibility(), + 'hasRestrictedAccess' => $file->hasRestrictedAccess(), + 'children' => $childObj, + 'ancestors' => $ancestors, + 'draft' => $file->isOnDraftOnly(), + 'extension' => $file->getExtension(), + 'published' => $file->isPublished(), + 'modified' => $file->isModifiedOnDraft(), + 'size' => $file->getSize(), + 'smallThumbnail' => $this->getSmallThumbnailUrl($file), + 'thumbnail' => $this->getThumbnailUrl($file), + 'version' => $file->Version, + 'isTrackedFormUpload' => $file->isTrackedFormUpload(), + ]; + } + + /** + * Get a file by ID, ensuring it exists and the user has permission to view it + */ + protected function getFileByID(int $id, bool $mustBeFolder, int $missingFileErrorCode): ?File + { + if ($id === 0) { + $this->jsonError($missingFileErrorCode); + } + if ($mustBeFolder) { + $file = Folder::get()->byID($id); + } else { + $file = File::get()->byID($id); + } + if (!$file) { + $this->jsonError($missingFileErrorCode); + } + if (!$file->canView()) { + $this->jsonError(403); + } + return $file; + } + + /** + * Get a data value from the GET request, ensuring it exists and is valid + */ + protected function getQueryStringValue(HTTPRequest $request, string $key, bool $allowMissing = false): mixed + { + $getVars = $request->getVars(); + if (!array_key_exists($key, $getVars)) { + if ($allowMissing) { + return null; + } + $this->jsonError(404); + } + $value = $getVars[$key]; + if ($key === 'ids') { + if (!is_array($value) + || count(array_filter($value, 'ctype_digit')) !== count($value) + || count(array_filter($value, fn($id) => (int) $id > 0)) !== count($value) + ) { + $this->jsonError(404); + } + } + if ($key === 'page') { + if (!ctype_digit($value) || (int) $value != $value) { + $this->jsonError(404); + } + } + if ($key === 'filter') { + if (!is_array($value)) { + $this->jsonError(404); + } + } + return $value; + } + + private function getFilteredChildFiles(?File $file, HTTPRequest $request): DataList + { + // Scenarios for children/childFiles: + // a) No filter - child files + // b) Filter - all files + // c) Filter with currentFolderOnly - descendant files + $childFiles = File::get(); + $filter = $this->getQueryStringValue($request, 'filter', true); + $parentID = $file ? $file->ID : 0; + if ($filter) { + if (isset($filter['currentFolderOnly']) && $filter['currentFolderOnly']) { + $filter['recursive'] = true; + unset($filter['currentFolderOnly']); + $filter['parentId'] = $parentID; + } + return $this->filterFiles($childFiles, $filter); + } else { + return $childFiles->filter('ParentID', $parentID); + } + } + + /** + * Get the ID parameter from the request, ensuring it exists and is valid + */ + private function getIDParam(HTTPRequest $request): int + { + $id = $request->param('ID'); + // When passing in an ID of 0, Silverstripe routing will have an ID value of + // "read", presumbably because 0 is falsey. + // Unlike most endpoints, we want to allow 0 as a valid ID here. + if ($id === 'read') { + $id = '0'; + } + if (!ctype_digit($id)) { + $this->jsonError(404); + } + return (int) $id; + } + + private function getSmallThumbnailUrl(File $file): ?string + { + $width = UploadField::config()->uninherited('thumbnail_width'); + $height = UploadField::config()->uninherited('thumbnail_height'); + return $this->getThumbnailGenerator()->generateThumbnailLink($file, $width, $height); + } + + private function getThumbnailUrl(File $file): ?string + { + $width = AssetAdmin::config()->uninherited('thumbnail_width'); + $height = AssetAdmin::config()->uninherited('thumbnail_height'); + return $this->getThumbnailGenerator()->generateThumbnailLink($file, $width, $height); + } + + private function filterFiles(DataList $list, array $filter): DataList + { + // ID filtering + if (isset($filter['id']) && !ctype_digit($filter['id'])) { + $this->jsonError(404); + } + if (isset($filter['id']) && (int) $filter['id'] > 0) { + $list = $list->filter('ID', $filter['id']); + if ($list->count() === 0) { + $this->httpError(404); + } + } elseif (isset($filter['id']) && (int) $filter['id'] === 0) { + // Special case for root folder + $list = ArrayList::create([Folder::create([ + 'ID' => 0, + ])]); + } + // track if search is being applied + $search = false; + // Optionally limit search to a folder, supporting recursion + if (isset($filter['parentId'])) { + $recursive = !empty($filter['recursive']); + if (!$recursive) { + $list = $list->filter('ParentID', $filter['parentId']); + } elseif ($filter['parentId']) { + // Note: Simplify parentID = 0 && recursive to no filter at all + $parents = AssetAdminFile::nestedFolderIDs($filter['parentId']); + $list = $list->filter('ParentID', $parents); + } + $search = true; + } + if (!empty($filter['name'])) { + $list = $list->filterAny(array( + 'Name:PartialMatch' => $filter['name'], + 'Title:PartialMatch' => $filter['name'] + )); + $search = true; + } + // Date filtering last edited + if (!empty($filter['lastEditedFrom'])) { + $fromDate = DateField::create(null, null, $filter['lastEditedFrom']); + $list = $list->filter("LastEdited:GreaterThanOrEqual", $fromDate->dataValue().' 00:00:00'); + $search = true; + } + if (!empty($filter['lastEditedTo'])) { + $toDate = DateField::create(null, null, $filter['lastEditedTo']); + $list = $list->filter("LastEdited:LessThanOrEqual", $toDate->dataValue().' 23:59:59'); + $search = true; + } + // Date filtering created + if (!empty($filter['createdFrom'])) { + $fromDate = DateField::create(null, null, $filter['createdFrom']); + $list = $list->filter("Created:GreaterThanOrEqual", $fromDate->dataValue().' 00:00:00'); + $search = true; + } + if (!empty($filter['createdTo'])) { + $toDate = DateField::create(null, null, $filter['createdTo']); + $list = $list->filter("Created:LessThanOrEqual", $toDate->dataValue().' 23:59:59'); + $search = true; + } + // Categories (mapped to extensions through the enum type automatically) + if (!empty($filter['appCategory'])) { + $list = $list->filter('Name:EndsWith', $filter['appCategory']); + $search = true; + } + // Filter unknown id by known child if search is not applied + if (!$search && isset($filter['anyChildId'])) { + $child = File::get()->byID($filter['anyChildId']); + $id = $child ? ($child->ParentID ?: 0) : 0; + if ($id) { + $list = $list->filter('ID', $id); + } else { + // Special case for root folder, since filter by ID = 0 will return an empty list + $list = ArrayList::create([Folder::create([ + 'ID' => 0, + ])]); + } + } + return $list; + } +} diff --git a/code/Forms/UploadField.php b/code/Forms/UploadField.php index 7f5e95f92..040e94107 100644 --- a/code/Forms/UploadField.php +++ b/code/Forms/UploadField.php @@ -108,7 +108,7 @@ public function getSchemaDataDefaults() { $defaults = parent::getSchemaDataDefaults(); $uploadLink = $this->Link('upload'); - $defaults['data']['createFileEndpoint'] = [ + $defaults['data']['endpoints']['createFile'] = [ 'url' => $uploadLink, 'method' => 'post', 'payloadFormat' => 'urlencoded', diff --git a/code/GraphQL/FileFilter.php b/code/GraphQL/FileFilter.php deleted file mode 100644 index 0638feb53..000000000 --- a/code/GraphQL/FileFilter.php +++ /dev/null @@ -1,125 +0,0 @@ - 0) { - $list = $list->filter('ID', $filter['id']); - - if ($list->count() === 0) { - throw new HTTPResponse_Exception(_t( - __CLASS__ . '.FileNotFound', - 'File or Folder could not be found' - )); - } - } elseif (isset($filter['id']) && (int)$filter['id'] === 0) { - // Special case for root folder - $list = new ArrayList([new Folder([ - 'ID' => 0, - ])]); - } - - // track if search is being applied - $search = false; - - // Optionally limit search to a folder, supporting recursion - if (isset($filter['parentId'])) { - $recursive = !empty($filter['recursive']); - - if (!$recursive) { - $list = $list->filter('ParentID', $filter['parentId']); - } elseif ($filter['parentId']) { - // Note: Simplify parentID = 0 && recursive to no filter at all - $parents = AssetAdminFile::nestedFolderIDs($filter['parentId']); - $list = $list->filter('ParentID', $parents); - } - $search = true; - } - - if (!empty($filter['name'])) { - $list = $list->filterAny(array( - 'Name:PartialMatch' => $filter['name'], - 'Title:PartialMatch' => $filter['name'] - )); - $search = true; - } - - // Date filtering last edited - if (!empty($filter['lastEditedFrom'])) { - $fromDate = new DateField(null, null, $filter['lastEditedFrom']); - $list = $list->filter("LastEdited:GreaterThanOrEqual", $fromDate->dataValue().' 00:00:00'); - $search = true; - } - if (!empty($filter['lastEditedTo'])) { - $toDate = new DateField(null, null, $filter['lastEditedTo']); - $list = $list->filter("LastEdited:LessThanOrEqual", $toDate->dataValue().' 23:59:59'); - $search = true; - } - - // Date filtering created - if (!empty($filter['createdFrom'])) { - $fromDate = new DateField(null, null, $filter['createdFrom']); - $list = $list->filter("Created:GreaterThanOrEqual", $fromDate->dataValue().' 00:00:00'); - $search = true; - } - if (!empty($filter['createdTo'])) { - $toDate = new DateField(null, null, $filter['createdTo']); - $list = $list->filter("Created:LessThanOrEqual", $toDate->dataValue().' 23:59:59'); - $search = true; - } - - // Categories (mapped to extensions through the enum type automatically) - if (!empty($filter['appCategory'])) { - $list = $list->filter('Name:EndsWith', $filter['appCategory']); - $search = true; - } - - // Filter unknown id by known child if search is not applied - if (!$search && isset($filter['anyChildId'])) { - $child = File::get()->byID($filter['anyChildId']); - $id = $child ? ($child->ParentID ?: 0) : 0; - if ($id) { - $list = $list->filter('ID', $id); - } else { - // Special case for root folder, since filter by ID = 0 will return an empty list - $list = new ArrayList([new Folder([ - 'ID' => 0, - ])]); - } - } - - return $list; - } -} diff --git a/code/GraphQL/Notice.php b/code/GraphQL/Notice.php deleted file mode 100644 index 6e7567b0f..000000000 --- a/code/GraphQL/Notice.php +++ /dev/null @@ -1,105 +0,0 @@ -message = $message; - $this->noticeType = $noticeType; - $this->ids = $ids; - } - - /** - * @return string - */ - public function getNoticeType() - { - return $this->noticeType; - } - - /** - * @param string $noticeType - * @return $this - */ - public function setNoticeType($noticeType) - { - $this->noticeType = $noticeType; - - return $this; - } - - /** - * @return array - */ - public function getIDs() - { - return $this->ids; - } - - /** - * @param array $ids - * @return $this - */ - public function setIDs($ids) - { - $this->ids = $ids; - - return $this; - } - - /** - * @return string - */ - public function getMessage() - { - return $this->message; - } - - /** - * @param string $message - * @return $this - */ - public function setMessage($message) - { - $this->message = $message; - - return $this; - } -} diff --git a/code/GraphQL/Resolvers/AssetAdminResolver.php b/code/GraphQL/Resolvers/AssetAdminResolver.php deleted file mode 100644 index ae41440cf..000000000 --- a/code/GraphQL/Resolvers/AssetAdminResolver.php +++ /dev/null @@ -1,338 +0,0 @@ -byID($parentID); - if (!$parent) { - throw new InvalidArgumentException(sprintf( - '%s#%s not found', - Folder::class, - $parentID - )); - } - } - - $canCreateContext = []; - foreach ($args['file'] as $name => $val) { - $canCreateContext[$accessor->normaliseField(File::singleton(), $name)] = $val; - } - $member = UserContextProvider::get($context); - if (!File::singleton()->canCreate($member, $canCreateContext)) { - throw new InvalidArgumentException(sprintf( - '%s# create not allowed', - File::class - )); - } - - $file = File::create(); - foreach ($args['file'] as $name => $val) { - $field = $accessor->normaliseField($file, $name); - $file->$field = $val; - } - - $file->writeToStage(Versioned::DRAFT); - - return $file; - } - - public static function resolveCreateFolder($object, array $args, $context, ResolveInfo $info) - { - $accessor = FieldAccessor::singleton(); - $parentID = isset($args['folder']['parentId']) ? intval($args['folder']['parentId']) : 0; - if ($parentID) { - $parent = Versioned::get_by_stage(Folder::class, Versioned::DRAFT)->byID($parentID); - if (!$parent) { - throw new InvalidArgumentException(sprintf( - '%s#%s not found', - Folder::class, - $parentID - )); - } - } - - // Check permission - $canCreateContext = []; - foreach ($args['folder'] as $name => $val) { - $canCreateContext[$accessor->normaliseField(Folder::singleton(), $name)] = $val; - } - if (!Folder::singleton()->canCreate($context['currentUser'] ?? null, $canCreateContext)) { - throw new InvalidArgumentException(sprintf( - '%s create not allowed', - Folder::class - )); - } - - $folder = Folder::create(); - foreach ($args['folder'] as $name => $val) { - $field = $accessor->normaliseField($folder, $name); - $folder->$field = $val; - } - - $folder->writeToStage(Versioned::DRAFT); - - return $folder; - } - - public static function resolveDeleteFiles($object, array $args, $context, ResolveInfo $info) - { - if (!isset($args['ids']) || !is_array($args['ids'])) { - throw new InvalidArgumentException('ids must be an array'); - } - $idList = $args['ids']; - - $files = Versioned::get_by_stage(File::class, Versioned::DRAFT)->byIDs($idList); - if ($files->count() < count($idList ?? [])) { - // Find out which files count not be found - $missingIds = array_diff($idList ?? [], $files->column('ID')); - throw new InvalidArgumentException(sprintf( - '%s items %s are not found', - File::class, - implode(', ', $missingIds) - )); - } - - $deletedIDs = []; - $member = UserContextProvider::get($context); - foreach ($files as $file) { - if ($file->canDelete($member)) { - $file->doArchive(); - $deletedIDs[] = $file->ID; - } - } - - return $deletedIDs; - } - - public static function resolveMoveFiles($object, array $args, $context) - { - $folderId = (isset($args['folderId'])) ? $args['folderId'] : 0; - $member = UserContextProvider::get($context); - - if ($folderId) { - $folder = Versioned::get_by_stage(Folder::class, Versioned::DRAFT) - ->byID($folderId); - if (!$folder) { - throw new InvalidArgumentException(sprintf( - '%s#%s not found', - Folder::class, - $folderId - )); - } - - // Check permission - if (!$folder->canEdit($member)) { - throw new InvalidArgumentException(sprintf( - '%s edit not allowed', - Folder::class - )); - } - } - $files = Versioned::get_by_stage(File::class, Versioned::DRAFT) - ->byIDs($args['fileIds']); - $errorFiles = []; - foreach ($files as $file) { - if ($file->canEdit($member)) { - $file->ParentID = $folderId; - $file->writeToStage(Versioned::DRAFT); - } else { - $errorFiles[] = $file->ID; - } - } - - if ($errorFiles) { - throw new InvalidArgumentException(sprintf( - '%s (%s) edit not allowed', - File::class, - implode(', ', $errorFiles) - )); - } - - if (!isset($folder)) { - return Folder::singleton(); - } - return $folder; - } - - - public static function resolvePublicationNotice($value, array $args, array $context, ResolveInfo $info) - { - $fieldName = $info->fieldName; - $method = 'get'.$fieldName; - if (method_exists($value, $method ?? '')) { - return $value->$method(); - } - - throw new \Exception(sprintf( - 'Invalid field %s on %s', - $fieldName, - get_class($value) - )); - } - - /** - * @param $value - * @return string - */ - public static function resolvePublicationResultUnion($value): string - { - if ($value instanceof File) { - return 'File'; - } - if ($value instanceof Notice) { - return 'PublicationNotice'; - } - } - - public static function resolveReadDescendantFileCounts($object, array $args, $context, ResolveInfo $info): array - { - if (!isset($args['ids']) || !is_array($args['ids'])) { - throw new \InvalidArgumentException('ids must be an array'); - } - $ids = $args['ids']; - - $files = Versioned::get_by_stage(File::class, Versioned::DRAFT)->byIDs($ids); - if ($files->count() < count($ids ?? [])) { - $class = File::class; - $missingIds = implode(', ', array_diff($ids ?? [], $files->column('ID'))); - throw new \InvalidArgumentException("{$class} items {$missingIds} are not found"); - } - - $data = []; - foreach ($files as $file) { - if (!$file->canView($context['currentUser'])) { - continue; - } - $data[] = [ - 'id' => $file->ID, - 'count' => $file->getDescendantFileCount() - ]; - } - return $data; - } - - public static function resolveReadFileUsage($object, array $args, $context, ResolveInfo $info): array - { - if (!isset($args['ids']) || !is_array($args['ids'])) { - throw new InvalidArgumentException('ids must be an array'); - } - $idList = $args['ids']; - - $files = Versioned::get_by_stage(File::class, Versioned::DRAFT)->byIDs($idList); - if ($files->count() < count($idList ?? [])) { - // Find out which files count not be found - $missingIds = array_diff($idList ?? [], $files->column('ID')); - throw new InvalidArgumentException(sprintf( - '%s items %s are not found', - File::class, - implode(', ', $missingIds) - )); - } - - $usage = []; - $member = UserContextProvider::get($context); - foreach ($files as $file) { - if ($file->canView($member)) { - $useEntry = ['id' => $file->ID]; - $useEntry['inUseCount'] = $file instanceof Folder ? - $file->getFilesInUse()->count(): - $file->BackLinkTrackingCount(); - $usage[] = $useEntry; - } - } - - return $usage; - } - - /** - * @param $object - * @param array $args - * @param $context - * @param $info - * @return DataList - * @throws HTTPResponse_Exception - */ - public static function resolveReadFiles($object, array $args = [], $context = [], $info = null) - { - $filter = (!empty($args['filter'])) ? $args['filter'] : []; - $member = UserContextProvider::get($context); - - // Permission checks - $parent = Folder::singleton(); - if (isset($filter['parentId']) && $filter['parentId'] !== 0) { - $parent = Folder::get()->byID($filter['parentId']); - if (!$parent) { - throw new InvalidArgumentException(sprintf( - '%s#%s not found', - Folder::class, - $filter['parentId'] - )); - } - } - if (!$parent->canView($member)) { - throw new InvalidArgumentException(sprintf( - '%s#%s view access not permitted', - Folder::class, - $parent->ID - )); - } - - if (isset($filter['recursive']) && $filter['recursive']) { - throw new InvalidArgumentException(( - 'The "recursive" flag can only be used for the "children" field' - )); - } - - // Filter list - $list = Versioned::get_by_stage(File::class, Versioned::DRAFT); - $list = FileFilter::filterList($list, $filter); - - // Permission checks - $list = $list->filterByCallback(function (File $file) use ($context, $member) { - return $file->canView($member); - }); - - return $list; - } -} diff --git a/code/GraphQL/Resolvers/FieldResolver.php b/code/GraphQL/Resolvers/FieldResolver.php deleted file mode 100644 index 34b7a4b47..000000000 --- a/code/GraphQL/Resolvers/FieldResolver.php +++ /dev/null @@ -1,31 +0,0 @@ -fieldName; - if ($obj->hasMethod($field)) { - return $obj->$field(); - } - $fieldName = FieldAccessor::singleton()->normaliseField($obj, $field); - return $obj->$fieldName; - } -} diff --git a/code/GraphQL/Resolvers/FileTypeResolver.php b/code/GraphQL/Resolvers/FileTypeResolver.php deleted file mode 100644 index a2e04a82f..000000000 --- a/code/GraphQL/Resolvers/FileTypeResolver.php +++ /dev/null @@ -1,200 +0,0 @@ - '%$SilverStripe\AssetAdmin\Model\ThumbnailGenerator.graphql' - ]; - - /** - * @var ThumbnailGenerator - */ - private $thumbnailGenerator; - - /** - * @param $object - * @return mixed - */ - public static function resolveFileType($object) - { - return $object->FileType; - } - - /** - * @return string - */ - public static function resolveFolderType(): string - { - return 'folder'; - } - - /** - * @param File $object - * @return string - */ - public static function resolveFileCategory($object) - { - return $object->appCategory(); - } - - /** - * @return string - */ - public static function resolveFolderCategory(): string - { - return 'folder'; - } - - public static function resolveFileUrl($object) - { - return $object->AbsoluteURL; - } - - public static function resolveFileSize($object) - { - return $object->AbsoluteSize; - } - - /** - * @param File $object - * @return string|null - */ - public static function resolveFileSmallThumbnail($object) - { - // Make small thumbnail - $width = UploadField::config()->uninherited('thumbnail_width'); - $height = UploadField::config()->uninherited('thumbnail_height'); - return static::singleton() - ->getThumbnailGenerator() - ->generateThumbnailLink($object, $width, $height); - } - - /** - * @param File $object - * @return string|null - */ - public static function resolveFileThumbnail($object) - { - // Make large thumbnail - $width = AssetAdmin::config()->uninherited('thumbnail_width'); - $height = AssetAdmin::config()->uninherited('thumbnail_height'); - return static::singleton() - ->getThumbnailGenerator() - ->generateThumbnailLink($object, $width, $height); - } - - /** - * @param File $object - * @return string|null - */ - public static function resolveFileDraft($object) - { - return $object->isOnDraftOnly(); - } - - /** - * @param File $object - * @return string|null - */ - public static function resolveFilePublished($object) - { - return $object->isPublished(); - } - - /** - * @param File $object - * @return string|null` - */ - public static function resolveFileModified($object) - { - return $object->isModifiedOnDraft(); - } - - /** - * @param File|AssetAdminFile $object - * @return int - */ - public static function resolveFileDescendantFileCount($object) - { - return 0; - } - - /** - * @param File $object - * @return int - */ - public static function resolveFileInUseCount($object) - { - return $object->BackLinkTrackingCount(); - } - - /** - * @param AssetContainer $object - * @return string|null - */ - public static function resolveFileThumbnailFieldGraceful(AssetContainer $object): ?string - { - $width = AssetAdmin::config()->uninherited('thumbnail_width'); - $height = AssetAdmin::config()->uninherited('thumbnail_height'); - return static::singleton() - ->getThumbnailGenerator() - ->generateThumbnailLink($object, $width, $height, true); - } - - /** - * @param AssetContainer $object - * @return string|null - */ - public static function resolveFileSmallThumbnailFieldGraceful(AssetContainer $object): ?string - { - $width = UploadField::config()->uninherited('thumbnail_width'); - $height = UploadField::config()->uninherited('thumbnail_height'); - return static::singleton() - ->getThumbnailGenerator() - ->generateThumbnailLink($object, $width, $height, true); - } - - /** - * @return ThumbnailGenerator - */ - public function getThumbnailGenerator() - { - return $this->thumbnailGenerator; - } - - /** - * @param ThumbnailGenerator $generator - * @return $this - */ - public function setThumbnailGenerator(ThumbnailGenerator $generator) - { - $this->thumbnailGenerator = $generator; - return $this; - } -} diff --git a/code/GraphQL/Resolvers/FolderTypeResolver.php b/code/GraphQL/Resolvers/FolderTypeResolver.php deleted file mode 100644 index 971e251b3..000000000 --- a/code/GraphQL/Resolvers/FolderTypeResolver.php +++ /dev/null @@ -1,195 +0,0 @@ -ID) { - throw new InvalidArgumentException(sprintf( - 'The "parentId" value (#%d) needs to match the current object id (#%d)', - (int)$filter['parentId'], - (int)$object->ID - )); - } - - $list = Versioned::get_by_stage(File::class, 'Stage'); - $filter['parentId'] = $object->ID; - $list = FileFilter::filterList($list, $filter); - - // Filter by permission - // DataQuery::column ignores surrogate sorting fields - // see https://github.com/silverstripe/silverstripe-framework/issues/8926 - // the following line is a workaround for `$ids = $list->column('ID');` - $ids = $list->dataQuery()->execute()->column('ID'); - - $permissionChecker = File::singleton()->getPermissionChecker(); - $member = UserContextProvider::get($context); - $canViewIDs = array_keys(array_filter($permissionChecker->canViewMultiple( - $ids, - $member - ) ?? [])); - // Filter by visible IDs (or force empty set if none are visible) - // Remove the limit as it no longer applies. We've already filtered down to the exact - // IDs we need. - $canViewList = $list->filter('ID', $canViewIDs ?: 0) - ->limit(null); - - return $canViewList; - } - - /** - * @param Folder|AssetAdminFile $object - * @param array $args - * @param array $context - * @param ResolveInfo $info - * @return int - */ - public static function resolveFolderDescendantFileCount($object, array $args, $context, ResolveInfo $info) - { - return $object->getDescendantFileCount(); - } - - /** - * @param Folder|AssetAdminFile $object - * @param array $args - * @param array $context - * @param ResolveInfo $info - * @return int - */ - public static function resolveFolderFilesInUseCount($object, array $args, $context, ResolveInfo $info) - { - return $object->getFilesInUse()->count(); - } - - /** - * @param File $object - * @param array $args - * @param array $context - * @param ResolveInfo $info - * @return File[] - */ - public static function resolveFolderParents($object, array $args, $context, ResolveInfo $info) - { - $parents = []; - $next = $object->Parent(); - while ($next && $next->isInDB()) { - array_unshift($parents, $next); - if ($next->ParentID) { - $next = $next->Parent(); - } else { - break; - } - } - - return $parents; - } - - /** - * @param array $context - * @return Closure - */ - public static function sortChildren(array $context): Closure - { - $fieldName = $context['fieldName']; - return function (?DataList $list, array $args) use ($fieldName) { - if ($list === null) { - return null; - } - - $sortArgs = $args[$fieldName] ?? []; - - $list = $list->alterDataQuery(static function (DataQuery $dataQuery) use ($sortArgs) { - $query = $dataQuery->query(); - $existingOrderBys = []; - foreach ($query->getOrderBy() as $field => $direction) { - if (strpos($field, '.') === false) { - // some fields may be surrogates added by extending augmentSQL - // we have to preserve those expressions rather than auto-generated names - // that SQLSelect::addOrderBy leaves for them (e.g. _SortColumn0) - $field = $query->expressionForField(trim($field, '"')) ?: $field; - } - $existingOrderBys[$field] = $direction; - } - - // Folders always go first - $dataQuery->sort( - sprintf( - '(CASE WHEN "ClassName"=%s THEN 1 ELSE 0 END)', - DB::get_conn()->quoteString(Folder::class) - ), - 'DESC', - true - ); - - foreach ($sortArgs as $field => $dir) { - $normalised = FieldAccessor::singleton()->normaliseField(File::singleton(), $field); - Schema::invariant( - $normalised, - 'Could not find field %s on %s', - $field, - File::class - ); - $dataQuery->sort($normalised, $dir, false); - } - - // respect default_sort - foreach ($existingOrderBys as $field => $dir) { - $dataQuery->sort($field, $dir, false); - } - - return $dataQuery; - }); - return $list; - }; - } -} diff --git a/code/GraphQL/Resolvers/PublicationResolver.php b/code/GraphQL/Resolvers/PublicationResolver.php deleted file mode 100644 index 18790a634..000000000 --- a/code/GraphQL/Resolvers/PublicationResolver.php +++ /dev/null @@ -1,176 +0,0 @@ -byIds($idList); - - // If warning suppression is not on, bundle up all the warnings into a single exception - if (!$quiet && $files->count() < count($idList ?? [])) { - $missingIds = array_diff($idList ?? [], $files->column('ID')); - foreach ($missingIds as $id) { - $warningMessages[] = sprintf( - 'File #%s either does not exist or is not on stage %s.', - $id, - $sourceStage - ); - } - } - $allowedFiles = []; - // Check permissions - foreach ($files as $file) { - $permissionMethod = $isPublish ? 'canPublish' : 'canUnpublish'; - $member = UserContextProvider::get($context); - if ($file->$permissionMethod($member)) { - $allowedFiles[] = $file; - } elseif (!$quiet) { - $warningMessages[] = sprintf( - 'User does not have permission to perform this operation on file "%s"', - $file->Title - ); - } - } - - if (!empty($warningMessages)) { - throw new InvalidArgumentException(implode('\n', $warningMessages)); - } - - foreach ($allowedFiles as $file) { - $result[] = $isPublish - ? PublicationResolver::publishFile($file, $force) - : PublicationResolver::unpublishFile($file, $force); - } - - return $result; - } - - /** - * @param File $file - * @param boolean $force - * @return File|Notice - */ - private static function publishFile(File $file, $force = false) - { - $file->publishRecursive(); - - return $file; - } - - - /** - * @param File|RecursivePublishable $file - * @param boolean $force - * @return Notice|File - */ - private static function unpublishFile(File $file, $force = false) - { - // If not forcing, make sure we aren't interfering with any owners - if (!$force) { - $ownersCount = PublicationResolver::countLiveOwners($file); - if ($ownersCount) { - return new Notice( - _t( - __CLASS__ . '.OWNER_WARNING', - 'File "{file}" is used in {count} place|File "{file}" is used in {count} places.', - [ - 'file' => $file->Title, - 'count' => $ownersCount - ] - ), - 'HAS_OWNERS', - [$file->ID] - ); - } - } - - $file->doUnpublish(); - return $file; - } - - /** - * Count number of live owners this file uses - * - * @param File $file - * @return int Number of live owners - */ - private static function countLiveOwners(File $file): int - { - // In case no versioning - if (!$file->hasExtension(RecursivePublishable::class)) { - return 0; - } - - // Query live record - /** @var Versioned|RecursivePublishable $liveRecord */ - $liveRecord = Versioned::get_by_stage(File::class, Versioned::LIVE)->byID($file->ID); - if ($liveRecord) { - return $liveRecord - ->findOwners(false) - ->count(); - } - - // No live record, no live owners - return 0; - } -} diff --git a/code/GraphQL/Schema/Builder.php b/code/GraphQL/Schema/Builder.php deleted file mode 100644 index c9fe99f81..000000000 --- a/code/GraphQL/Schema/Builder.php +++ /dev/null @@ -1,44 +0,0 @@ - $category]; - }, File::config()->get('app_categories') ?? []); - - // Sanitise GraphQL Enum aliases (some contain slashes) - foreach ($categoryValues as $key => $v) { - unset($categoryValues[$key]); - $newKey = strtoupper(preg_replace('/[^[[:alnum:]]]*/', '', $key ?? '') ?? ''); - $categoryValues[$newKey] = $v; - } - - $schema->addEnum(Enum::create('AppCategory', $categoryValues)); - } -} diff --git a/composer.json b/composer.json index 6448722aa..cf4c4d108 100644 --- a/composer.json +++ b/composer.json @@ -6,8 +6,7 @@ "require": { "php": "^8.3", "silverstripe/framework": "^6", - "silverstripe/admin": "^3", - "silverstripe/graphql": "^6" + "silverstripe/admin": "^3" }, "require-dev": { "phpunit/phpunit": "^9.6", diff --git a/lang/en.yml b/lang/en.yml index b07cf3350..cfbe71efb 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -2,6 +2,7 @@ en: AssetAdmin: INSERT_FILE: 'Insert file' UPDATE_FILE: 'Update file' + OWNER_WARNING: 'File "{file}" is used in {count} place|File "{file}" is used in {count} places' SilverStripe\Admin\FileStatusIcon: ACCESS_RESTRICTED: 'Restricted access' TRACKED_FORM_UPLOAD_RESTRICTED: 'Form submission' diff --git a/package.json b/package.json index 2bb8108f2..a5230d533 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ }, "devDependencies": { "@silverstripe/eslint-config": "^1.3.0", - "@silverstripe/webpack-config": "^2.1.0", + "@silverstripe/webpack-config": "^3.0.0-alpha2", "@storybook/addon-actions": "^7.0.18", "@testing-library/react": "^14.0.0", "babel-core": "^6.26.3", @@ -63,7 +63,6 @@ "webpack-cli": "^5.0.0" }, "dependencies": { - "@apollo/client": "^3.7.1", "@popperjs/core": "^2.11.6", "bootstrap": "^4.6.2", "classnames": "^2.3.2", @@ -72,9 +71,6 @@ "crypto-js": "^4.1.1", "deep-freeze-strict": "^1.1.1", "dropzone": "^6.0.0-beta.2", - "graphql": "^16.8.1", - "graphql-fragments": "^0.1.0", - "graphql-tag": "^2.12.6", "griddle-react": "^0.8.2", "merge": "^2.1.1", "modernizr": "^3.12.0", diff --git a/tests/behat/features/manage-files.feature b/tests/behat/features/manage-files.feature index e11ce8e00..96b2f35d1 100644 --- a/tests/behat/features/manage-files.feature +++ b/tests/behat/features/manage-files.feature @@ -101,6 +101,30 @@ Feature: Manage files And I press the Delete button inside the modal Then I should not see the file named "file1" in the gallery + Scenario: I can cancel deleting a file + When I click on the file named "folder1" in the gallery + And I click on the file named "file1" in the gallery + Then I should see the "Form_fileEditForm" form + When I press the "Other actions" button + And I press the "Delete" button + Then I should see a modal titled "Confirm deletion" + And I press the Cancel button inside the modal + And I wait for 1 second + Then I should not see a modal titled "Confirm deletion" + And I should see the file named "file1" in the gallery + + Scenario: I can close the file deletion modal + When I click on the file named "folder1" in the gallery + And I click on the file named "file1" in the gallery + Then I should see the "Form_fileEditForm" form + When I press the "Other actions" button + And I press the "Delete" button + Then I should see a modal titled "Confirm deletion" + And I click on the ".modal-header .close" element + And I wait for 1 second + Then I should not see a modal titled "Confirm deletion" + And I should see the file named "file1" in the gallery + Scenario: I can delete multiple files Given a "image" "assets/folder1/file2.jpg" was created "2012-01-02 12:00:00" When I click on the file named "folder1" in the gallery @@ -142,7 +166,7 @@ Feature: Manage files Then I should not see the file named "file1" in the gallery And I should not see the file named "file2" in the gallery And I should not see the file named "testfile" in the gallery - And I should see a "Moved 3 item(s) to folder2/" success toast with these actions: Go to folder + And I should see a "Moved 3 item(s) to folder2" success toast with these actions: Go to folder When I click the "Go to folder" toast action Then I should see the file named "file1" in the gallery And I should see the file named "file2" in the gallery diff --git a/tests/behat/src/FixtureContext.php b/tests/behat/src/FixtureContext.php index 2e7656038..67f769ac2 100644 --- a/tests/behat/src/FixtureContext.php +++ b/tests/behat/src/FixtureContext.php @@ -380,15 +380,26 @@ public function aPageContaining($page, $image) } /** - * @Then I should see a modal titled :title + * @Then /^I should (not |)see a modal titled "([^"]*)"$/ * @param string $title */ - public function iShouldSeeAModalTitled($title) + public function iShouldSeeAModalTitled($not, $title) { $page = $this->getMainContext()->getSession()->getPage(); $modalTitle = $page->find('css', '[role=dialog] .modal-header > .modal-title'); - Assert::assertNotNull($modalTitle, 'No modal on the page'); - Assert::assertTrue($modalTitle->getText() == $title); + if ($not) { + if ($modalTitle && $modalTitle->getText() == $title) { + // Modal found, but should not be visible + Assert::assertFalse($modalTitle->isVisible()); + } else { + // Modal not found, which is also a pass + Assert::assertTrue(true); + } + } else { + // Modal should be visible and have the correct title + Assert::assertTrue($modalTitle->getText() == $title); + Assert::assertTrue($modalTitle->isVisible()); + } } /** diff --git a/tests/php/Controller/AssetAdminOpenTest.php b/tests/php/Controller/AssetAdminOpenTest.php new file mode 100644 index 000000000..2160e0387 --- /dev/null +++ b/tests/php/Controller/AssetAdminOpenTest.php @@ -0,0 +1,306 @@ +logInWithPermission('ADMIN'); + + // Create a test folders for each of the fixture references + foreach (Folder::get() as $folder) { + $folder->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE); + } + + // Create a test files for each of the fixture references + $content = str_repeat('x', 100); + foreach (File::get()->exclude('ClassName', [Folder::class]) as $file) { + $file->setFromString($content, $file->generateFilename()); + $file->write(); + $file->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE); + } + } + + protected function tearDown(): void + { + TestAssetStore::reset(); + parent::tearDown(); + } + + public function provideApiRead(): array + { + return [ + 'Valid' => [ + 'idType' => 'existing', + 'fail' => '', + 'filter' => '', + 'page' => 0, + 'pageLength' => 0, + 'expectedCode' => 200, + ], + 'Valid new record ID' => [ + 'idType' => 'new-record', + 'fail' => '', + 'filter' => '', + 'page' => 0, + 'pageLength' => 0, + 'expectedCode' => 200, + ], + 'Valid filtered' => [ + 'idType' => 'folder-three', + 'fail' => '', + 'filter' => 'filter[name]=ApiTestFile', + 'page' => 0, + 'pageLength' => 0, + 'expectedCode' => 200, + ], + 'Valid filterered pagination' => [ + 'idType' => 'folder-three', + 'fail' => '', + 'filter' => 'filter[name]=ApiTestFile', + 'page' => 0, + 'pageLength' => 2, + 'expectedCode' => 200, + ], + 'Valid filterered pagination page two' => [ + 'idType' => 'folder-three', + 'fail' => '', + 'filter' => 'filter[name]=ApiTestFile', + 'page' => 2, + 'pageLength' => 2, + 'expectedCode' => 200, + ], + 'Valid filtered current folder only' => [ + 'idType' => 'folder-three', + 'fail' => '', + 'filter' => 'filter[name]=ApiTestFile&filter[currentFolderOnly]=1', + 'page' => 0, + 'pageLength' => 0, + 'expectedCode' => 200, + ], + 'Reject invalid page' => [ + 'idType' => 'folder-three', + 'fail' => '', + 'filter' => 'filter[name]=ApiTestFile', + 'page' => 'food', + 'pageLength' => 2, + 'expectedCode' => 404, + ], + 'Reject invalid filter' => [ + 'idType' => 'folder-three', + 'fail' => '', + 'filter' => 'filter=ApiTestFile', + 'page' => 0, + 'pageLength' => 0, + 'expectedCode' => 404, + ], + 'Reject fail canView()' => [ + 'idType' => 'existing', + 'fail' => 'can-view', + 'filter' => '', + 'page' => 0, + 'pageLength' => 0, + 'expectedCode' => 403, + ], + 'Reject invalid ID' => [ + 'idType' => 'invalid', + 'fail' => '', + 'filter' => '', + 'page' => 0, + 'pageLength' => 0, + 'expectedCode' => 404, + ], + 'Reject non-numeric ID' => [ + 'idType' => 'non-numeric', + 'fail' => '', + 'filter' => '', + 'page' => 0, + 'pageLength' => 0, + 'expectedCode' => 404, + ], + ]; + } + + /** + * @dataProvider provideApiRead + */ + public function testApiRead( + string $idType, + string $fail, + string $filter, + int|string $page, + int $pageLength, + int $expectedCode + ): void { + TestFile::$fail = $fail; + $id = $this->getID($idType); + $url = "/admin/assets-open/api/read/$id"; + if ($pageLength) { + AssetAdminOpen::config()->set('page_length', $pageLength); + } + if ($filter) { + $url .= "?$filter"; + } + if ($page) { + $url .= '&page=' . $page; + } + $response = $this->mainSession->sendRequest('GET', $url, []); + $this->assertSame('application/json', $response->getHeader('Content-type')); + $this->assertSame($expectedCode, $response->getStatusCode()); + if ($expectedCode === 200) { + $data = json_decode($response->getBody(), true); + if ($idType === 'new-record') { + $children = [ + 'pageInfo' => [ + 'totalCount' => 3, + ], + 'nodes' => [ + $this->getFileData('ApiFolder01'), + $this->getFileData('ApiFolder02'), + $this->getFileData('ApiTestFile01'), + ], + ]; + $expected = $this->getFileData('ApiFolder01', [], $children); + $expected['exists'] = false; + $expected['filename'] = '/'; + $expected['id'] = 0; + $expected['lastEdited'] = null; + $expected['published'] = false; + $expected['name'] = null; + $expected['parentId'] = null; + $expected['title'] = null; + $expected['version'] = null; + } elseif (str_contains($filter, 'filter[name]=ApiTestFile')) { + $ancestors = [$this->getFileData('ApiFolder01')]; + $totalCount = 6; + if ($pageLength === 2) { + if ($page === 2) { + $nodes = [ + $this->getFileData('ApiTestFile03'), + $this->getFileData('ApiTestFile04'), + ]; + } else { + $nodes = [ + $this->getFileData('ApiTestFile01'), + $this->getFileData('ApiTestFile02'), + ]; + } + } elseif (str_contains($filter, 'filter[currentFolderOnly]=1')) { + $totalCount = 2; + $nodes = [ + $this->getFileData('ApiTestFile05'), + $this->getFileData('ApiTestFile06'), + ]; + } else { + $nodes = [ + $this->getFileData('ApiTestFile01'), + $this->getFileData('ApiTestFile02'), + $this->getFileData('ApiTestFile03'), + $this->getFileData('ApiTestFile04'), + $this->getFileData('ApiTestFile05'), + $this->getFileData('ApiTestFile06'), + ]; + } + $children = [ + 'pageInfo' => [ + 'totalCount' => $totalCount, + ], + 'nodes' => $nodes, + ]; + $expected = $this->getFileData('ApiFolder03', $ancestors, $children); + } else { + $ancestors = [$this->getFileData('ApiFolder01')]; + $expected = $this->getFileData('ApiTestFile02', $ancestors); + } + $this->assertSame($expected, $data); + } + } + + private function getFileData(string $title, array $ancestors = [], array $children = []): array + { + $file = File::get()->find('Title', $title); + $filenames = [ + 'ApiFolder01' => 'ApiFolder01/', + 'ApiFolder02' => 'ApiFolder02/', + 'ApiFolder03' => 'ApiFolder01/ApiFolder03/', + 'ApiFolder04' => 'ApiFolder01/ApiFolder03/ApiFolder04/', + 'ApiTestFile01' => 'ApiTestFile01', + 'ApiTestFile02' => 'ApiFolder01/ApiTestFile02', + 'ApiTestFile03' => 'ApiFolder01/ApiTestFile03', + 'ApiTestFile04' => 'ApiFolder02/ApiTestFile04', + 'ApiTestFile05' => 'ApiFolder01/ApiFolder03/ApiTestFile05', + 'ApiTestFile06' => 'ApiFolder01/ApiFolder03/ApiFolder04/ApiTestFile06', + ]; + $type = is_a($file, Folder::class) ? 'folder' : 'file'; + $category = $type === 'folder' ? 'folder' : false; + $url = $type === 'folder' ? null : '/assets/AssetAdminOpenTest/' . $filenames[$title]; + $visibility = $type === 'folder' ? null : 'public'; + $size = $type === 'folder' ? null : '100 bytes'; + $version = $file->Version; + $children = !empty($children) ? $children : [ + 'pageInfo' => [ + 'totalCount' => 0, + ], + 'nodes' => [], + ]; + return [ + 'canDelete' => true, + 'canEdit' => true, + 'canView' => true, + 'category' => $category, + 'exists' => true, + 'filename' => $filenames[$title], + 'id' => $file->ID, + 'lastEdited' => $file->LastEdited, + 'name' => $title, + 'parentId' => $file->ParentID, + 'title' => $title, + 'type' => $type, + 'url' => $url, + 'visibility' => $visibility, + 'hasRestrictedAccess' => false, + 'children' => $children, + 'ancestors' => $ancestors, + 'draft' => false, + 'extension' => '', + 'published' => true, + 'modified' => false, + 'size' => $size, + 'smallThumbnail' => null, + 'thumbnail' => null, + 'version' => $version, + 'isTrackedFormUpload' => false, + ]; + } + + private function getID(string $idType): mixed + { + if ($idType === 'folder-three') { + return $this->idFromFixture(Folder::class, 'ApiFolder03'); + } + $id = $this->idFromFixture(TestFile::class, 'ApiTestFile02'); + return match ($idType) { + 'existing' => $id, + 'invalid' => $id + 99999, + 'non-numeric' => 'fish', + 'new-record' => 0, + }; + } +} diff --git a/tests/php/Controller/AssetAdminOpenTest.yml b/tests/php/Controller/AssetAdminOpenTest.yml new file mode 100644 index 000000000..e4a081c61 --- /dev/null +++ b/tests/php/Controller/AssetAdminOpenTest.yml @@ -0,0 +1,29 @@ +SilverStripe\Assets\Folder: + ApiFolder01: + Title: ApiFolder01 + ApiFolder02: + Title: ApiFolder02 + ApiFolder03: + Title: ApiFolder03 + Parent: =>SilverStripe\Assets\Folder.ApiFolder01 + ApiFolder04: + Title: ApiFolder04 + Parent: =>SilverStripe\Assets\Folder.ApiFolder03 +SilverStripe\AssetAdmin\Tests\Controller\AssetAdminTest\TestFile: + ApiTestFile01: + Title: ApiTestFile01 + ApiTestFile02: + Title: ApiTestFile02 + Parent: =>SilverStripe\Assets\Folder.ApiFolder01 + ApiTestFile03: + Title: ApiTestFile03 + Parent: =>SilverStripe\Assets\Folder.ApiFolder01 + ApiTestFile04: + Title: ApiTestFile04 + Parent: =>SilverStripe\Assets\Folder.ApiFolder02 + ApiTestFile05: + Title: ApiTestFile05 + Parent: =>SilverStripe\Assets\Folder.ApiFolder03 + ApiTestFile06: + Title: ApiTestFile06 + Parent: =>SilverStripe\Assets\Folder.ApiFolder04 diff --git a/tests/php/Controller/AssetAdminTest.php b/tests/php/Controller/AssetAdminTest.php index 67dfd292f..cac758ea5 100644 --- a/tests/php/Controller/AssetAdminTest.php +++ b/tests/php/Controller/AssetAdminTest.php @@ -6,6 +6,8 @@ use SilverStripe\AssetAdmin\Controller\AssetAdmin; use SilverStripe\AssetAdmin\Tests\Controller\AssetAdminTest\FileExtension; use SilverStripe\AssetAdmin\Tests\Controller\AssetAdminTest\FolderExtension; +use SilverStripe\AssetAdmin\Tests\Controller\AssetAdminTest\TestFile; +use SilverStripe\AssetAdmin\Tests\Controller\AssetAdminTest\TestObject; use SilverStripe\Assets\File; use SilverStripe\Assets\Folder; use Silverstripe\Assets\Dev\TestAssetStore; @@ -17,12 +19,17 @@ use SilverStripe\Versioned\Versioned; use SilverStripe\Security\SecurityToken; use SilverStripe\Core\Config\Config; +use SilverStripe\AssetAdmin\Tests\Controller\AssetAdminTest\FilesInUseFileExtension; /** * Tests {@see AssetAdmin} */ class AssetAdminTest extends FunctionalTest { + protected static $extra_dataobjects = [ + TestFile::class, + TestObject::class, + ]; protected static $fixture_file = '../fixtures.yml'; @@ -52,11 +59,12 @@ protected function setUp(): void $folder->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE); } - // Create a test files for each of the fixture references - $content = str_repeat('x', 1000000); - foreach (File::get()->exclude('ClassName', Folder::class) as $file) { + // Create a test files for each of the fixture references, excluding Folders the TestFile class + $content = str_repeat('x', 100); + foreach (File::get()->exclude('ClassName', [Folder::class, TestFile::class]) as $file) { /** @var File $file */ $file->setFromString($content, $file->generateFilename()); + $file->write(); $file->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE); } @@ -464,4 +472,690 @@ public function testGetClientConfigExtensions() ); }); } + + public function provideApiReadDescendantCounts(): array + { + return [ + 'Valid' => [ + 'idsType' => 'existing', + 'fail' => '', + 'expectedCode' => 200, + ], + 'Reject fail canView()' => [ + 'idsType' => 'existing', + 'fail' => 'can-view', + 'expectedCode' => 403, + ], + 'Reject ids not passed' => [ + 'idsType' => 'existing', + 'fail' => 'ids-not-passed', + 'expectedCode' => 404, + ], + 'Reject ids is not array' => [ + 'idsType' => 'existing', + 'fail' => 'ids-not-array', + 'expectedCode' => 404, + ], + 'Reject invalid ID' => [ + 'idsType' => 'second-is-invalid', + 'fail' => '', + 'expectedCode' => 404, + ], + 'Reject non-numeric ID' => [ + 'idsType' => 'second-is-non-numeric', + 'fail' => '', + 'expectedCode' => 404, + ], + 'Reject new record ID' => [ + 'idsType' => 'second-is-new-record', + 'fail' => '', + 'expectedCode' => 404, + ], + ]; + } + + /** + * @dataProvider provideApiReadDescendantCounts + */ + public function testApiReadDescendantCounts( + string $idsType, + string $fail, + int $expectedCode + ): void { + TestFile::$fail = $fail; + $ids = $this->getIDs($idsType); + // swap out the first ID with a Folder fixture that contains a nested folder + // which contains a file + $ids[0] = $this->idFromFixture(Folder::class, 'ApiFolder02'); + $url = '/admin/assets/api/readDescendantCounts'; + if ($fail !== 'ids-not-passed') { + if ($fail === 'ids-not-array') { + $url .= '?ids=' . implode(',', $ids); + } else { + $qsa = array_map(fn($id) => "ids[]=$id", $ids); + $url .= '?' . implode('&', $qsa); + } + } + $response = $this->mainSession->sendRequest('GET', $url, []); + $this->assertSame('application/json', $response->getHeader('Content-type')); + $this->assertSame($expectedCode, $response->getStatusCode()); + if ($expectedCode === 200) { + $data = json_decode($response->getBody(), true); + $this->assertSame([ + [ + 'id' => $ids[0], + 'type' => 'folder', + 'count' => 1, + ], + [ + 'id' => $ids[1], + 'type' => 'file', + 'count' => 0, + ] + ], $data); + } + } + + public function provideApiReadLiveOwnerCounts(): array + { + return [ + 'Valid' => [ + 'idsType' => 'existing', + 'fail' => '', + 'expectedCode' => 200, + ], + 'Reject fail canView()' => [ + 'idsType' => 'existing', + 'fail' => 'can-view', + 'expectedCode' => 403, + ], + 'Reject ids not passed' => [ + 'idsType' => 'existing', + 'fail' => 'ids-not-passed', + 'expectedCode' => 404, + ], + 'Reject ids is not array' => [ + 'idsType' => 'existing', + 'fail' => 'ids-not-array', + 'expectedCode' => 404, + ], + 'Reject invalid ID' => [ + 'idsType' => 'second-is-invalid', + 'fail' => '', + 'expectedCode' => 404, + ], + 'Reject non-numeric ID' => [ + 'idsType' => 'second-is-non-numeric', + 'fail' => '', + 'expectedCode' => 404, + ], + 'Reject new record ID' => [ + 'idsType' => 'second-is-new-record', + 'fail' => '', + 'expectedCode' => 404, + ], + ]; + } + + /** + * @dataProvider provideApiReadLiveOwnerCounts + */ + public function testApiReadLiveOwnerCounts( + string $idsType, + string $fail, + int $expectedCode + ): void { + foreach (TestFile::get() as $file) { + $file->publishSingle(); + } + foreach (TestObject::get() as $file) { + $file->publishSingle(); + } + try { + TestFile::$fail = $fail; + $ids = $this->getIDs($idsType); + $url = '/admin/assets/api/readLiveOwnerCounts'; + if ($fail !== 'ids-not-passed') { + if ($fail === 'ids-not-array') { + $url .= '?ids=' . implode(',', $ids); + } else { + $qsa = array_map(fn($id) => "ids[]=$id", $ids); + $url .= '?' . implode('&', $qsa); + } + } + $response = $this->mainSession->sendRequest('GET', $url, []); + $this->assertSame('application/json', $response->getHeader('Content-type')); + $this->assertSame($expectedCode, $response->getStatusCode()); + if ($expectedCode === 200) { + $data = json_decode($response->getBody(), true); + $this->assertSame([ + [ + 'id' => $ids[0], + 'count' => 2, + 'message' => 'File "ApiTestFile01" is used in 2 places.' + ], + [ + 'id' => $ids[1], + 'count' => 1, + 'message' => 'File "ApiTestFile02" is used in 1 place' + ] + ], $data); + } + } finally { + foreach (TestFile::get() as $file) { + $file->doUnpublish(); + } + foreach (TestObject::get() as $file) { + $file->doUnpublish(); + } + } + } + + public function provideApiReadUsage(): array + { + return [ + 'Valid' => [ + 'idType' => 'existing', + 'fail' => '', + 'expectedCode' => 200, + ], + 'Reject fail canView()' => [ + 'idType' => 'existing', + 'fail' => 'can-view', + 'expectedCode' => 403, + ], + 'Reject invalid ID' => [ + 'idType' => 'invalid', + 'fail' => '', + 'expectedCode' => 404, + ], + 'Reject non-numeric ID' => [ + 'idType' => 'non-numeric', + 'fail' => '', + 'expectedCode' => 404, + ], + 'Reject new record ID' => [ + 'idType' => 'new-record', + 'fail' => '', + 'expectedCode' => 404, + ], + ]; + } + + /** + * @dataProvider provideApiReadUsage + */ + public function testApiReadUsage( + string $idType, + string $fail, + int $expectedCode + ): void { + File::add_extension(FilesInUseFileExtension::class); + try { + TestFile::$fail = $fail; + $id = $this->getID($idType); + $url = "/admin/assets/api/readUsage/$id"; + $response = $this->mainSession->sendRequest('GET', $url, []); + $this->assertSame('application/json', $response->getHeader('Content-type')); + $this->assertSame($expectedCode, $response->getStatusCode()); + if ($expectedCode === 200) { + // data is defined in FilesInUseFileExtension + $data = json_decode($response->getBody(), true); + $this->assertSame(['count' => 5], $data); + } + } finally { + File::remove_extension(FilesInUseFileExtension::class); + } + } + + public function provideApiDelete(): array + { + return [ + 'Valid' => [ + 'idsType' => 'existing', + 'fail' => '', + 'expectedCode' => 204, + ], + 'Reject fail canDelete()' => [ + 'idsType' => 'existing', + 'fail' => 'can-delete', + 'expectedCode' => 403, + ], + 'Reject fail csrf-token' => [ + 'idsType' => 'existing', + 'fail' => 'csrf-token', + 'expectedCode' => 400, + ], + 'Reject ids not passed' => [ + 'idsType' => 'existing', + 'fail' => 'ids-not-passed', + 'expectedCode' => 400, + ], + 'Reject ids is not array' => [ + 'idsType' => 'existing', + 'fail' => 'ids-not-array', + 'expectedCode' => 400, + ], + 'Reject ids is empty' => [ + 'idsType' => 'existing', + 'fail' => 'ids-is-empty', + 'expectedCode' => 400, + ], + 'Reject invalid ID' => [ + 'idsType' => 'second-is-invalid', + 'fail' => '', + 'expectedCode' => 400, + ], + 'Reject non-numeric ID' => [ + 'idsType' => 'second-is-non-numeric', + 'fail' => '', + 'expectedCode' => 400, + ], + 'Reject new record ID' => [ + 'idsType' => 'second-is-new-record', + 'fail' => '', + 'expectedCode' => 400, + ], + ]; + } + + /** + * @dataProvider provideApiDelete + */ + public function testApiDelete( + string $idsType, + string $fail, + int $expectedCode + ): void { + $ids = $this->getIDs($idsType); + $existingIDs = $this->getIDs('existing'); + TestFile::$fail = $fail; + $url = '/admin/assets/api/delete'; + $headers = []; + if ($fail !== 'csrf-token') { + $headers = array_merge($headers, $this->getCsrfTokenheader()); + } + $data = []; + if ($fail !== 'ids-not-passed') { + $data['ids'] = $ids; + } + if ($fail === 'ids-not-array') { + $data['ids'] = implode(',', $ids); + } elseif ($fail === 'ids-is-empty') { + $data['ids'] = []; + } + $body = json_encode($data); + $response = $this->mainSession->sendRequest('POST', $url, [], $headers, null, $body); + $this->assertSame('application/json', $response->getHeader('Content-type')); + $this->assertSame($expectedCode, $response->getStatusCode()); + if ($expectedCode >= 400) { + $count = TestFile::get()->filter('ID', $existingIDs)->count(); + $this->assertSame(count($existingIDs), $count); + } else { + $count = TestFile::get()->filter('ID', $existingIDs)->count(); + $this->assertSame(0, $count); + } + } + + public function provideApiMove(): array + { + return [ + 'Valid' => [ + 'idsType' => 'existing', + 'fail' => '', + 'expectedCode' => 204, + ], + 'Reject fail canEdit()' => [ + 'idsType' => 'existing', + 'fail' => 'can-edit', + 'expectedCode' => 403, + ], + 'Reject fail csrf-token' => [ + 'idsType' => 'existing', + 'fail' => 'csrf-token', + 'expectedCode' => 400, + ], + 'Reject ids not passed' => [ + 'idsType' => 'existing', + 'fail' => 'ids-not-passed', + 'expectedCode' => 400, + ], + 'Reject ids is not array' => [ + 'idsType' => 'existing', + 'fail' => 'ids-not-array', + 'expectedCode' => 400, + ], + 'Reject ids is empty' => [ + 'idsType' => 'existing', + 'fail' => 'ids-is-empty', + 'expectedCode' => 400, + ], + 'Reject invalid ID' => [ + 'idsType' => 'second-is-invalid', + 'fail' => '', + 'expectedCode' => 400, + ], + 'Reject non-numeric ID' => [ + 'idsType' => 'second-is-non-numeric', + 'fail' => '', + 'expectedCode' => 400, + ], + 'Reject new record ID' => [ + 'idsType' => 'second-is-new-record', + 'fail' => '', + 'expectedCode' => 400, + ], + 'Reject folderID not passed' => [ + 'idsType' => 'existing', + 'fail' => 'folder-id-not-passed', + 'expectedCode' => 400, + ], + 'Reject folder does not exist' => [ + 'idsType' => 'existing', + 'fail' => 'folder-not-exist', + 'expectedCode' => 400, + ], + ]; + } + + /** + * @dataProvider provideApiMove + */ + public function testApiMove( + string $idsType, + string $fail, + int $expectedCode + ): void { + $ids = $this->getIDs($idsType); + $folderIDs = [ + $this->idFromFixture(Folder::class, 'ApiFolder01'), + $this->idFromFixture(Folder::class, 'ApiFolder02'), + ]; + $existingIDs = $this->getIDs('existing'); + TestFile::$fail = $fail; + $url = '/admin/assets/api/move'; + $headers = []; + if ($fail !== 'csrf-token') { + $headers = array_merge($headers, $this->getCsrfTokenheader()); + } + $data = []; + if ($fail !== 'folder-id-not-passed') { + $data['folderID'] = $folderIDs[1]; + } + if ($fail === 'folder-not-exist') { + $data['folderID'] = Folder::get()->max('ID') + 1; + } + if ($fail !== 'ids-not-passed') { + $data['ids'] = $ids; + } + if ($fail === 'ids-not-array') { + $data['ids'] = implode(',', $ids); + } elseif ($fail === 'ids-is-empty') { + $data['ids'] = []; + } + $body = json_encode($data); + $response = $this->mainSession->sendRequest('POST', $url, [], $headers, null, $body); + $this->assertSame('application/json', $response->getHeader('Content-type')); + $this->assertSame($expectedCode, $response->getStatusCode()); + if ($expectedCode >= 400) { + foreach ($existingIDs as $id) { + $file = TestFile::get()->byID($id); + $this->assertSame($folderIDs[0], $file->ParentID); + } + } else { + foreach ($existingIDs as $id) { + $file = TestFile::get()->byID($id); + $this->assertSame($folderIDs[1], $file->ParentID); + } + } + } + + public function provideApiPublish(): array + { + return [ + 'Valid' => [ + 'idsType' => 'existing', + 'fail' => '', + 'expectedCode' => 204, + ], + 'Reject fail canPublish()' => [ + 'idsType' => 'existing', + 'fail' => 'can-publish', + 'expectedCode' => 403, + ], + 'Reject fail csrf-token' => [ + 'idsType' => 'existing', + 'fail' => 'csrf-token', + 'expectedCode' => 400, + ], + 'Reject ids not passed' => [ + 'idsType' => 'existing', + 'fail' => 'ids-not-passed', + 'expectedCode' => 400, + ], + 'Reject ids is not array' => [ + 'idsType' => 'existing', + 'fail' => 'ids-not-array', + 'expectedCode' => 400, + ], + 'Reject ids is empty' => [ + 'idsType' => 'existing', + 'fail' => 'ids-is-empty', + 'expectedCode' => 400, + ], + 'Reject invalid ID' => [ + 'idsType' => 'second-is-invalid', + 'fail' => '', + 'expectedCode' => 400, + ], + 'Reject non-numeric ID' => [ + 'idsType' => 'second-is-non-numeric', + 'fail' => '', + 'expectedCode' => 400, + ], + 'Reject new record ID' => [ + 'idsType' => 'second-is-new-record', + 'fail' => '', + 'expectedCode' => 400, + ], + ]; + } + + /** + * @dataProvider provideApiPublish + */ + public function testApiPublish( + string $idsType, + string $fail, + int $expectedCode + ): void { + $ids = $this->getIDs($idsType); + $existingIDs = $this->getIDs('existing'); + try { + TestFile::$fail = $fail; + $url = '/admin/assets/api/publish'; + $headers = []; + if ($fail !== 'csrf-token') { + $headers = array_merge($headers, $this->getCsrfTokenheader()); + } + $data = []; + if ($fail !== 'ids-not-passed') { + $data['ids'] = $ids; + } + if ($fail === 'ids-not-array') { + $data['ids'] = implode(',', $ids); + } elseif ($fail === 'ids-is-empty') { + $data['ids'] = []; + } + $body = json_encode($data); + $response = $this->mainSession->sendRequest('POST', $url, [], $headers, null, $body); + $this->assertSame('application/json', $response->getHeader('Content-type')); + $this->assertSame($expectedCode, $response->getStatusCode()); + if ($expectedCode >= 400) { + foreach ($existingIDs as $id) { + $file = TestFile::get()->byID($id); + $this->assertFalse($file->isPublished()); + } + } else { + foreach ($existingIDs as $id) { + $file = TestFile::get()->byID($id); + $this->assertTrue($file->isPublished()); + } + } + } finally { + // fixtures will remain published between tests, fixtures are normally unpublished + foreach ($existingIDs as $id) { + $file = TestFile::get()->byID($id); + if ($file->isPublished()) { + $file->doUnpublish(); + } + } + } + } + + public function provideApiUnpublish(): array + { + return [ + 'Valid' => [ + 'idsType' => 'existing', + 'fail' => '', + 'expectedCode' => 204, + ], + 'Reject fail canUnpublish()' => [ + 'idsType' => 'existing', + 'fail' => 'can-unpublish', + 'expectedCode' => 403, + ], + 'Reject fail csrf-token' => [ + 'idsType' => 'existing', + 'fail' => 'csrf-token', + 'expectedCode' => 400, + ], + 'Reject ids not passed' => [ + 'idsType' => 'existing', + 'fail' => 'ids-not-passed', + 'expectedCode' => 400, + ], + 'Reject ids is not array' => [ + 'idsType' => 'existing', + 'fail' => 'ids-not-array', + 'expectedCode' => 400, + ], + 'Reject ids is empty' => [ + 'idsType' => 'existing', + 'fail' => 'ids-is-empty', + 'expectedCode' => 400, + ], + 'Reject invalid ID' => [ + 'idsType' => 'second-is-invalid', + 'fail' => '', + 'expectedCode' => 400, + ], + 'Reject non-numeric ID' => [ + 'idsType' => 'second-is-non-numeric', + 'fail' => '', + 'expectedCode' => 400, + ], + 'Reject new record ID' => [ + 'idsType' => 'second-is-new-record', + 'fail' => '', + 'expectedCode' => 400, + ], + ]; + } + + /** + * @dataProvider provideApiUnpublish + */ + public function testApiUnpublish( + string $idsType, + string $fail, + int $expectedCode + ): void { + $ids = $this->getIDs($idsType); + $existingIDs = $this->getIDs('existing'); + foreach ($existingIDs as $id) { + $file = TestFile::get()->byID($id); + $file->publishSingle(); + } + try { + TestFile::$fail = $fail; + $url = '/admin/assets/api/unpublish'; + $headers = []; + if ($fail !== 'csrf-token') { + $headers = array_merge($headers, $this->getCsrfTokenheader()); + } + $data = []; + if ($fail !== 'ids-not-passed') { + $data['ids'] = $ids; + } + if ($fail === 'ids-not-array') { + $data['ids'] = implode(',', $ids); + } elseif ($fail === 'ids-is-empty') { + $data['ids'] = []; + } + $body = json_encode($data); + $response = $this->mainSession->sendRequest('POST', $url, [], $headers, null, $body); + $this->assertSame('application/json', $response->getHeader('Content-type')); + $this->assertSame($expectedCode, $response->getStatusCode()); + if ($expectedCode >= 400) { + foreach ($existingIDs as $id) { + $file = TestFile::get()->byID($id); + $this->assertTrue($file->isPublished()); + } + } else { + foreach ($existingIDs as $id) { + $file = TestFile::get()->byID($id); + $this->assertFalse($file->isPublished()); + } + } + } finally { + // fixtures will remain published between tests, fixtures are normally unpublished + foreach ($existingIDs as $id) { + $file = TestFile::get()->byID($id); + if ($file->isPublished()) { + $file->doUnpublish(); + } + } + } + } + + private function getFileFixtures(): array + { + return [ + $this->objFromFixture(TestFile::class, 'ApiTestFile01'), + $this->objFromFixture(TestFile::class, 'ApiTestFile02'), + ]; + } + + private function getID(string $idType): mixed + { + $objs = $this->getFileFixtures(); + return match ($idType) { + 'existing' => $objs[0]->ID, + 'invalid' => $objs[0]->ID + 99999, + 'non-numeric' => 'fish', + 'new-record' => 0, + }; + } + + private function getIDs(string $idsType): mixed + { + $objs = $this->getFileFixtures(); + return match ($idsType) { + 'existing' => [$objs[0]->ID, $objs[1]->ID], + 'second-is-invalid' => [$objs[0]->ID, $objs[1]->ID + 99999], + 'second-is-non-numeric' => [$objs[0]->ID, 'fish'], + 'second-is-new-record' => [$objs[0]->ID, 0], + 'ids-is-not-passed' => [], + }; + } + + private function getCsrfTokenheader(): array + { + $securityToken = SecurityToken::inst(); + return [ + 'X-' . $securityToken->getName() => $securityToken->getSecurityID() + ]; + } } diff --git a/tests/php/Controller/AssetAdminTest/FilesInUseFileExtension.php b/tests/php/Controller/AssetAdminTest/FilesInUseFileExtension.php new file mode 100644 index 000000000..71458721a --- /dev/null +++ b/tests/php/Controller/AssetAdminTest/FilesInUseFileExtension.php @@ -0,0 +1,23 @@ + 10001], + ['ID' => 10002], + ['ID' => 10003], + ['ID' => 10004], + ['ID' => 10005], + ]); + } +} diff --git a/tests/php/Controller/AssetAdminTest/TestFile.php b/tests/php/Controller/AssetAdminTest/TestFile.php new file mode 100644 index 000000000..647a076e5 --- /dev/null +++ b/tests/php/Controller/AssetAdminTest/TestFile.php @@ -0,0 +1,48 @@ + 'Varchar', + ]; + + public static $fail = ''; + + public function canCreate($member = null, $context = []) + { + return self::$fail !== 'can-create'; + } + + public function canDelete($member = null, $context = []) + { + return self::$fail !== 'can-delete'; + } + + public function canEdit($member = null, $context = []) + { + return self::$fail !== 'can-edit'; + } + + public function canView($member = null) + { + return self::$fail !== 'can-view'; + } + + public function canPublish($member = null) + { + return self::$fail !== 'can-publish'; + } + + public function canUnpublish($member = null) + { + return self::$fail !== 'can-unpublish'; + } +} diff --git a/tests/php/Controller/AssetAdminTest/TestObject.php b/tests/php/Controller/AssetAdminTest/TestObject.php new file mode 100644 index 000000000..1e1e6c442 --- /dev/null +++ b/tests/php/Controller/AssetAdminTest/TestObject.php @@ -0,0 +1,25 @@ + TestFile::class, + ]; + + private static array $owns = [ + 'TestFile', + ]; + + private static array $extensions = [ + Versioned::class, + ]; +} diff --git a/tests/php/Forms/UploadFieldTest.php b/tests/php/Forms/UploadFieldTest.php index 37689253c..7ba65c160 100644 --- a/tests/php/Forms/UploadFieldTest.php +++ b/tests/php/Forms/UploadFieldTest.php @@ -108,10 +108,12 @@ public function testGetAttributes() 'validation' => [], 'attributes' => [], 'data' => [ - 'createFileEndpoint' => [ - 'url' => 'admin/assets/MyForm/field/MyField/upload', - 'method' => 'post', - 'payloadFormat' => 'urlencoded', + 'endpoints' => [ + 'createFile' => [ + 'url' => 'admin/assets/MyForm/field/MyField/upload', + 'method' => 'post', + 'payloadFormat' => 'urlencoded', + ], ], 'multi' => false, 'parentid' => 0, diff --git a/tests/php/GraphQL/CreateFolderMutationCreatorTest.php b/tests/php/GraphQL/CreateFolderMutationCreatorTest.php deleted file mode 100644 index b5214ad00..000000000 --- a/tests/php/GraphQL/CreateFolderMutationCreatorTest.php +++ /dev/null @@ -1,68 +0,0 @@ -markTestSkipped('GraphQL 4 test ' . __CLASS__ . ' skipped'); - } - File::add_extension(FileExtension::class); - Folder::add_extension(FolderExtension::class); - } - - protected function tearDown(): void - { - File::remove_extension(FileExtension::class); - Folder::remove_extension(FolderExtension::class); - - parent::tearDown(); - } - - public function testItCreatesFolder() - { - $folder1 = $this->objFromFixture(Folder::class, 'folder1'); - - $args = [ - 'folder' => [ - 'parentID' => $folder1->ID, - 'name' => 'testItCreatesFolder', - ] - ]; - $newFolder = AssetAdminResolver::resolveCreateFolder(null, $args, null, new FakeResolveInfo()); - $this->assertNotNull($newFolder); - $this->assertEquals($folder1->ID, $newFolder->ParentID); - $this->assertEquals('testItCreatesFolder', $newFolder->Name); - } - - public function testItRestrictsCreateFolderByCanCreate() - { - $this->expectException(\InvalidArgumentException::class); - $this->expectExceptionMessage('create not allowed'); - $folder1 = $this->objFromFixture(Folder::class, 'folder1'); - - $args = [ - 'folder' => [ - 'parentID' => $folder1->ID, - 'name' => 'disallowCanCreate', - ] - ]; - AssetAdminResolver::resolveCreateFolder(null, $args, null, new FakeResolveInfo()); - } -} diff --git a/tests/php/GraphQL/FakeResolveInfo.php b/tests/php/GraphQL/FakeResolveInfo.php deleted file mode 100644 index 76fdbc465..000000000 --- a/tests/php/GraphQL/FakeResolveInfo.php +++ /dev/null @@ -1,28 +0,0 @@ - 'fake', 'type' => Type::string()]), - new \ArrayObject(), - new ObjectType(['name' => 'fake']), - [], - new Schema([]), - [], - '', - new OperationDefinitionNode([]), - [] - ); - } -} diff --git a/tests/php/GraphQL/FileFilterInputTypeCreatorTest.php b/tests/php/GraphQL/FileFilterInputTypeCreatorTest.php deleted file mode 100644 index 26e2e6c44..000000000 --- a/tests/php/GraphQL/FileFilterInputTypeCreatorTest.php +++ /dev/null @@ -1,283 +0,0 @@ -markTestSkipped('GraphQL 4 test ' . __CLASS__ . ' skipped'); - } - - TestAssetStore::activate('AssetAdminTest'); - - File::add_extension(FileExtension::class); - Folder::add_extension(FolderExtension::class); - } - - protected function tearDown(): void - { - File::remove_extension(FileExtension::class); - Folder::remove_extension(FolderExtension::class); - - TestAssetStore::reset(); - parent::tearDown(); - } - - public function testItFiltersByCreated() - { - $folder = new Folder([ - 'name' => 'folder' - ]); - $folder->write(); - - $file1 = new File([ - 'Created' => '2014-01-05 23:11:39', - 'ParentID' => $folder->ID, - ]); - $file1->write(); - - $file2 = new File([ - 'Created' => '2014-01-06 12:00:00', - 'ParentID' => $folder->ID, - ]); - $file2->write(); - - $baseList = $folder->stageChildren(); - - // Mock searches for 4th Jan - $list = FileFilter::filterList($baseList, [ - 'lastEditedFrom' => '2014-01-04', - 'lastEditedTo' => '2014-01-04', - ]); - $this->assertEquals(0, $list->Count()); - - // Mock searches for 5th Jan - $list = FileFilter::filterList($baseList, [ - 'lastEditedFrom' => date('Y-m-d'), - 'lastEditedTo' => date('Y-m-d'), - ]); - $this->assertEquals(2, $list->Count()); - $this->assertContains($file1->ID, $list->column('ID')); - - - // Mock searches for 5th-6th Jan - $list = FileFilter::filterList($baseList, [ - 'createdFrom' => '2014-01-05', - 'createdTo' => '2014-01-06', - ]); - $this->assertEquals(2, $list->Count()); - $this->assertContains($file1->ID, $list->column('ID')); - $this->assertContains($file2->ID, $list->column('ID')); - - // Mock searches for 6th Jan - $list = FileFilter::filterList($baseList, [ - 'createdFrom' => '2014-01-06', - 'createdTo' => '2014-01-06', - ]); - $this->assertEquals(1, $list->Count()); - $this->assertContains($file2->ID, $list->column('ID')); - - // Mock searches for 7th Jan - $list = FileFilter::filterList($baseList, [ - 'lastEditedFrom' => '2014-01-07', - 'lastEditedTo' => '2014-01-07', - ]); - $this->assertEquals(0, $list->Count()); - } - - public function testItFiltersByParentId() - { - $folder1 = new Folder([ - 'name' => 'folder1' - ]); - $folder1->write(); - - $folder2 = new Folder([ - 'name' => 'folder2' - ]); - $folder2->write(); - - $file1 = new File([ - 'ParentID' => $folder1->ID, - ]); - $file1->write(); - - $file2 = new File([ - 'ParentID' => $folder2->ID, - ]); - $file2->write(); - - $baseList = File::get(); - $list = FileFilter::filterList($baseList, [ - 'parentId' => $folder1->ID - ]); - $this->assertContains( - $file1->ID, - $list->column('ID'), - 'Contains file in folder' - ); - $this->assertNotContains( - $file2->ID, - $list->column('ID'), - 'Does not contain file in another folder' - ); - } - - public function testItFiltersById() - { - $file1 = new File([ - ]); - $file1->write(); - - $file2 = new File([ - ]); - $file2->write(); - - $baseList = File::get(); - - $list = FileFilter::filterList($baseList, [ - 'id' => $file1->ID - ]); - $this->assertContains( - $file1->ID, - $list->column('ID'), - 'Contains file matched by ID' - ); - $this->assertNotContains( - $file2->ID, - $list->column('ID'), - 'Does not contain other files' - ); - } - - public function testItFiltersByChildId() - { - $folder1 = new Folder([ - 'name' => 'folder1' - ]); - $folder1->write(); - - $folder2 = new Folder([ - 'name' => 'folder2' - ]); - $folder2->write(); - - $file1 = new File([ - 'ParentID' => $folder1->ID, - ]); - $file1->write(); - - $file2 = new File([ - 'ParentID' => $folder2->ID, - ]); - $file2->write(); - - $baseList = File::get(); - - $list = FileFilter::filterList($baseList, [ - 'anyChildId' => $file2->ID - ]); - $this->assertContains( - $folder2->ID, - $list->column('ID'), - 'Finds parent folder' - ); - $this->assertNotContains( - $folder1->ID, - $list->column('ID'), - 'Does not find non-parent folder' - ); - } - - public function testItFiltersByName() - { - $folder = new Folder([ - 'Name' => 'FooFolderName', - 'Title' => 'FooFolderTitle' - ]); - $folder->write(); - - $file1 = new File([ - 'Name' => 'FooFileName', - 'Title' => 'FooFileTitle' - ]); - $file1->write(); - - $file2 = new File([ - 'Name' => 'BarFileName', - 'Title' => 'BarFileTitle', - ]); - $file2->write(); - - $baseList = File::get(); - $listByName = FileFilter::filterList($baseList, [ - 'name' => 'Foo', - ]); - - $this->assertEquals( - [$file1->ID, $folder->ID], - $listByName->column('ID'), - 'Finds files and folders by name' - ); - - $baseList = File::get(); - $listByTitle = FileFilter::filterList($baseList, [ - 'name' => 'FooFileTitle', - ]); - - $this->assertEquals( - [$file1->ID], - $listByTitle->column('ID'), - 'Finds files and folders by title' - ); - } - - public function testItFiltersByAppCategory() - { - $image = new File([ - 'Name' => 'image.jpg', - ]); - $image->write(); - - $archive = new File([ - 'Name' => 'archive.zip', - ]); - $archive->write(); - - $baseList = File::get(); - $listImages = FileFilter::filterList($baseList, [ - 'appCategory' => ['jpg'], - ]); - $this->assertEquals( - [$image->ID], - $listImages->column('ID'), - 'Finds images by appCategory' - ); - - $baseList = File::get(); - $listArchives = FileFilter::filterList($baseList, [ - 'appCategory' => ['zip'], - ]); - $this->assertEquals( - [$archive->ID], - $listArchives->column('ID'), - 'Finds archives by appCategory' - ); - } -} diff --git a/tests/php/GraphQL/FileTypeCreatorTest.php b/tests/php/GraphQL/FileTypeCreatorTest.php deleted file mode 100644 index 009e5d126..000000000 --- a/tests/php/GraphQL/FileTypeCreatorTest.php +++ /dev/null @@ -1,84 +0,0 @@ -markTestSkipped('GraphQL 4 test ' . __CLASS__ . ' skipped'); - } - - TestAssetStore::activate('FileTypeCreatorTest'); - } - - protected function tearDown(): void - { - TestAssetStore::reset(); - parent::tearDown(); - } - - public function testThumbnail() - { - $this->logInWithPermission('ADMIN'); - ThumbnailGenerator::config()->set('thumbnail_links', [ - AssetStore::VISIBILITY_PROTECTED => ThumbnailGenerator::INLINE, - AssetStore::VISIBILITY_PUBLIC => ThumbnailGenerator::URL, - ]); - - $assetAdmin = AssetAdmin::create(); - - // Build image - $image = new Image(); - $image->setFromLocalFile(__DIR__.'/../Forms/fixtures/largeimage.png', 'TestImage.png'); - $image->write(); - - // Image original is unset - $thumbnail = FileTypeResolver::resolveFileThumbnail($image, [], [], null); - $this->assertNull($thumbnail); - - // Generate thumbnails by viewing this file's data - $assetAdmin->getObjectFromData($image, false); - - // protected image should have inline thumbnail - $thumbnail = FileTypeResolver::resolveFileThumbnail($image, [], [], null); - $this->assertStringStartsWith('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAWAAAADr', $thumbnail); - - // public image should have url - $image->publishSingle(); - $thumbnail = FileTypeResolver::resolveFileThumbnail($image, [], [], null); - $this->assertEquals('/assets/FileTypeCreatorTest/TestImage__FitMaxWzM1MiwyNjRd.png', $thumbnail); - - // Public assets can be set to inline - ThumbnailGenerator::config()->merge('thumbnail_links', [ - AssetStore::VISIBILITY_PUBLIC => ThumbnailGenerator::INLINE, - ]); - $thumbnail = FileTypeResolver::resolveFileThumbnail($image, [], [], null); - $this->assertStringStartsWith('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAWAAAADr', $thumbnail); - - // Protected assets can be set to url - // This uses protected asset adapter, so not direct asset link - ThumbnailGenerator::config()->merge('thumbnail_links', [ - AssetStore::VISIBILITY_PROTECTED => ThumbnailGenerator::URL, - ]); - $image->doUnpublish(); - $thumbnail = FileTypeResolver::resolveFileThumbnail($image, [], [], null); - $this->assertEquals('/assets/8cf6c65fa7/TestImage__FitMaxWzM1MiwyNjRd.png', $thumbnail); - } -} diff --git a/tests/php/GraphQL/FolderTypeCreatorTest.php b/tests/php/GraphQL/FolderTypeCreatorTest.php deleted file mode 100644 index e3dd9b867..000000000 --- a/tests/php/GraphQL/FolderTypeCreatorTest.php +++ /dev/null @@ -1,142 +0,0 @@ -markTestSkipped('GraphQL 4 test ' . __CLASS__ . ' skipped'); - } - } - - public function testItDoesNotFilterByParentIdWithRecursiveFlag() - { - $rootFolder = Folder::singleton(); - - $folder = Folder::create(['Name' => 'folder']); - $folder->write(); - - $nestedFile = File::create([ - 'Name' => 'myNestedFile', - 'ParentID' => $folder->ID, - ]); - $nestedFile->write(); - - $rootFile = File::create([ - 'Name' => 'myRootFile', - 'ParentID' => 0, - ]); - $rootFile->write(); - - $listWithoutRecursive = $this->resolveChildrenConnection( - $rootFolder, - ['filter' => [ - 'recursive' => false - ]] - ); - $this->assertEquals( - [ - $folder->Name, - $rootFile->Name, - ], - $listWithoutRecursive->column('Name') - ); - - $listWithRecursive = $this->resolveChildrenConnection( - $rootFolder, - ['filter' => [ - 'recursive' => true - ]] - ); - $this->assertEquals( - [ - $folder->Name, - $nestedFile->Name, - $rootFile->Name, - ], - $listWithRecursive->column('Name') - ); - - // Test with partial tree search - $listWithPartialTreeRecursive = $this->resolveChildrenConnection( - $folder, - ['filter' => [ - 'recursive' => true - ]] - ); - $this->assertEquals( - [ - $nestedFile->Name, - ], - $listWithPartialTreeRecursive->column('Name') - ); - } - - public function testItShowsParents() - { - $folder1 = Folder::create(['Name' => 'folder1', 'ParentID' => 0]); - $folder1->write(); - - $folder1_1 = Folder::create(['Name' => 'folder1_1', 'ParentID' => $folder1->ID]); - $folder1_1->write(); - - $folder1_1_1 = Folder::create(['Name' => 'folder1_1_1', 'ParentID' => $folder1_1->ID]); - $folder1_1_1->write(); - - $folder2 = Folder::create(['Name' => 'folder2', 'ParentID' => 0]); - $folder2->write(); - - $parents = FolderTypeResolver::resolveFolderParents( - $folder1_1_1, - [], - $this->getContext(), - new FakeResolveInfo() - ); - $this->assertEquals( - [ - $folder1->Name, - $folder1_1->Name - ], - array_map(function ($folder) { - return $folder->Name; - }, $parents ?? []) - ); - } - - protected function getContext() - { - return [ - 'currentUser' => null - ]; - } - - protected function resolveChildrenConnection($object, $args, $context = null) - { - $context = $context ? $context : $this->getContext(); - return FolderTypeResolver::resolveFolderChildren( - $object, - $args, - $context, - new FakeResolveInfo() - ); - } -} diff --git a/tests/php/GraphQL/ReadFileQueryCreatorTest.php b/tests/php/GraphQL/ReadFileQueryCreatorTest.php deleted file mode 100644 index d421c537b..000000000 --- a/tests/php/GraphQL/ReadFileQueryCreatorTest.php +++ /dev/null @@ -1,95 +0,0 @@ -markTestSkipped('GraphQL 4 test ' . __CLASS__ . ' skipped'); - } - - TestAssetStore::activate('AssetAdminTest'); - - File::add_extension(FileExtension::class); - Folder::add_extension(FolderExtension::class); - } - - protected function tearDown(): void - { - File::remove_extension(FileExtension::class); - Folder::remove_extension(FolderExtension::class); - - TestAssetStore::reset(); - parent::tearDown(); - } - - public function testItRestrictsParentByCanView() - { - $this->expectException(\InvalidArgumentException::class); - $this->expectExceptionMessage('view access not permitted'); - $folder = new Folder(['Name' => 'disallowCanView']); - $folder->write(); - - $this->getResultsForSearch([ - 'filter' => ['parentId' => $folder->ID], - ]); - } - - public function testItFiltersResultsByCanView() - { - $allowedFolder = new Folder(['Name' => 'allowedFolder']); - $allowedFolder->write(); - - $disallowedFolder = new Folder(['Name' => 'disallowCanView']); - $disallowedFolder->write(); - - $allowedFile = new File(['Name' => 'allowedFile']); - $allowedFile->write(); - - $disallowedFile = new File(['Name' => 'disallowCanView.txt']); - $disallowedFile->write(); - - $list = $this->getResultsForSearch([ - 'filter' => ['parentId' => 0], - ]); - - $this->assertEquals( - [ - $allowedFile->Name, - $allowedFolder->Name, - ], - $list->column('Name') - ); - } - - /** - * @param array $args - * @param array $context - * @return \SilverStripe\ORM\DataList|\SilverStripe\ORM\Filterable - */ - protected function getResultsForSearch($args, $context = null) - { - $context = $context ? $context : ['currentUser' => null]; - - return AssetAdminResolver::resolveReadFiles(null, $args, $context, new FakeResolveInfo()); - } -} diff --git a/tests/php/GraphQL/ReadFileUsageQueryCreatorTest.php b/tests/php/GraphQL/ReadFileUsageQueryCreatorTest.php deleted file mode 100644 index 83625ea45..000000000 --- a/tests/php/GraphQL/ReadFileUsageQueryCreatorTest.php +++ /dev/null @@ -1,105 +0,0 @@ -markTestSkipped('GraphQL 4 test ' . __CLASS__ . ' skipped'); - } - - TestAssetStore::activate('AssetAdminTest'); - - File::add_extension(FileExtension::class); - Folder::add_extension(FolderExtension::class); - } - - protected function tearDown(): void - { - File::remove_extension(FileExtension::class); - Folder::remove_extension(FolderExtension::class); - - TestAssetStore::reset(); - parent::tearDown(); - } - - public function fileUsageDataProvider() - { - return [ - [File::class, 'rootfile', 2, 'rootfile file is used twice'], - [File::class, 'file2', 0, 'file2 is not used'], - [File::class, 'disallowCanView', false, 'disallowCanView should provide file usage data'], - [Folder::class, 'folder1', 2, 'folder1 contains files used 2 times'], - [Folder::class, 'folder1.1', 0, 'folder1.1 does not contained any used files'], - ]; - } - - /** - * @dataProvider fileUsageDataProvider - * @param string $class - * @param string $fixture - * @param int|false $expectedCount - * @param $message - */ - public function testUsageCount(string $class, string $fixture, $expectedCount, $message) - { - $id = $this->idFromFixture($class, $fixture); - $this->assertUsageCount($id, $expectedCount, $message); - } - - public function testUsageCountForNonExistentFile() - { - $this->expectException('InvalidArgumentException'); - $this->assertUsageCount(999, false, 'File 999 should throw an exception because it does not exists.'); - } - - /** - * @param array $args - * @param array $context - * @return array - */ - protected function getResultsForSearch($args, $context = null) - { - $context = $context ? $context : ['currentUser' => null]; - return AssetAdminResolver::resolveReadFileUsage(null, $args, $context, new FakeResolveInfo()); - } - - /** - * Assert the file usage of the provided file ID. - * @param string $fixture - * @param int|false $expectedCount $expectedCount or false, if no result should be returned - */ - private function assertUsageCount($id, $expectedCount, $message) - { - $actual = $this->getResultsForSearch(['ids' => [$id]]); - if ($expectedCount === false) { - $this->assertEmpty($actual, $message); - } else { - $expected = [[ - 'id' => $id, - 'inUseCount' => $expectedCount - ]]; - $this->assertEquals($expected, $actual, $message); - } - } -} diff --git a/tests/php/GraphQL/UnpublishFileMutationCreatorTest.php b/tests/php/GraphQL/UnpublishFileMutationCreatorTest.php deleted file mode 100644 index 5d7a9912d..000000000 --- a/tests/php/GraphQL/UnpublishFileMutationCreatorTest.php +++ /dev/null @@ -1,70 +0,0 @@ -markTestSkipped('GraphQL 4 test ' . __CLASS__ . ' skipped'); - } - // Dynamically assign fileowner as owner (otherwise it pollutes other tests) - UnpublishFileMutationCreatorTest\FileOwner::config()->set('owns', ['OwnedFile']); - } - - public function testUnpublishWithOwners() - { - // Bootstrap test - $this->logInWithPermission('ADMIN'); - $member = Security::getCurrentUser(); - $context = ['currentUser' => $member]; - $resolveInfo = new FakeResolveInfo(); - - /** @var File $file */ - $file = $this->objFromFixture(File::class, 'file1'); - $file->publishSingle(); - - // 4 owners, 3 published owners - for ($i = 1; $i <= 4; $i++) { - $owner = new UnpublishFileMutationCreatorTest\FileOwner(); - $owner->OwnedFileID = $file->ID; - $owner->Title = "My Owner {$i}"; - $owner->write(); - // Only 3 of these are published - if ($i !== 4) { - $owner->publishSingle(); - } - } - - // Test unpublish without force - $result = PublicationResolver::resolveUnpublishFiles(null, ['ids' => [$file->ID]], $context, $resolveInfo); - $this->assertCount(1, $result); - /** @var Notice $notice */ - $notice = $result[0]; - $this->assertInstanceOf(Notice::class, $notice); - $this->assertEquals('File "The First File" is used in 3 places.', $notice->getMessage()); - $this->assertTrue($file->isPublished()); - - // Unpublish with force - $result = PublicationResolver::resolveUnpublishFiles(null, ['ids' => [$file->ID], 'force' => true], $context, $resolveInfo); - $this->assertCount(1, $result); - $fileResult = $result[0]; - $this->assertInstanceOf(File::class, $fileResult); - $this->assertFalse($file->isPublished()); - } -} diff --git a/tests/php/GraphQL/UnpublishFileMutationCreatorTest.yml b/tests/php/GraphQL/UnpublishFileMutationCreatorTest.yml deleted file mode 100644 index 7d679606a..000000000 --- a/tests/php/GraphQL/UnpublishFileMutationCreatorTest.yml +++ /dev/null @@ -1,51 +0,0 @@ -SilverStripe\Security\Member: - member1: - FirstName: Christopher - Surname: Pitt - member2: - FirstName: Damian - Surname: Mooyman -SilverStripe\Assets\Folder: - folder1: - Title: folder1 - folder2: - Title: folder2 - folder1.1: - Title: folder1.1 - Parent: =>SilverStripe\Assets\Folder.folder1 - disallowCanAddChildren: - Title: disallowCanAddChildren -SilverStripe\Assets\File: - rootfile: - Name: rootfile.jpg - Title: rootfile - file1: - Created: '2015-08-19 00:00:00' - LastUpdated: '2015-08-27 00:00:00' - Owner: =>SilverStripe\Security\Member.member1 - Parent: =>SilverStripe\Assets\Folder.folder1 - Name: file1.jpg - Title: The First File - file2: - Created: '2015-08-20 00:00:00' - LastUpdated: '2015-08-28 00:00:00' - Owner: =>SilverStripe\Security\Member.member2 - Parent: =>SilverStripe\Assets\Folder.folder2 - Name: file2.jpg - Title: The Second File - file3: - Created: '2015-08-21 00:00:00' - LastUpdated: '2015-08-29 00:00:00' - Owner: =>SilverStripe\Security\Member.member2 - Parent: =>SilverStripe\Assets\Folder.folder2 - Name: file3.jpg - Title: The Third File - disallowCanView: - Parent: =>SilverStripe\Assets\Folder.folder1 - Name: disallowCanView.txt - disallowCanEdit: - Parent: =>SilverStripe\Assets\Folder.folder1 - Name: disallowCanEdit.txt - disallowCanDelete: - Parent: =>SilverStripe\Assets\Folder.folder1 - Name: disallowCanDelete.txt diff --git a/tests/php/GraphQL/UnpublishFileMutationCreatorTest/FileOwner.php b/tests/php/GraphQL/UnpublishFileMutationCreatorTest/FileOwner.php deleted file mode 100644 index f0f7527de..000000000 --- a/tests/php/GraphQL/UnpublishFileMutationCreatorTest/FileOwner.php +++ /dev/null @@ -1,31 +0,0 @@ - 'Varchar', - ]; - - private static $has_one = [ - 'OwnedFile' => File::class, - ]; -} diff --git a/tests/php/fixtures.yml b/tests/php/fixtures.yml index e99e81a87..e61084543 100644 --- a/tests/php/fixtures.yml +++ b/tests/php/fixtures.yml @@ -15,6 +15,13 @@ SilverStripe\Assets\Folder: Parent: =>SilverStripe\Assets\Folder.folder1 disallowCanAddChildren: Title: disallowCanAddChildren + ApiFolder01: + Title: ApiFolder01 + ApiFolder02: + Title: ApiFolder02 + ApiFolder03: + Title: ApiFolder03 + ParentID: =>SilverStripe\Assets\Folder.ApiFolder02 SilverStripe\Assets\File: rootfile: Name: rootfile.jpg @@ -58,3 +65,24 @@ SilverStripe\Assets\Shortcodes\FileLink: Linked: =>SilverStripe\Assets\File.file1 usingreadonlyfile: Linked: =>SilverStripe\Assets\File.disallowCanView +SilverStripe\AssetAdmin\Tests\Controller\AssetAdminTest\TestFile: + ApiTestFile01: + Title: ApiTestFile01 + Parent: =>SilverStripe\Assets\Folder.ApiFolder01 + ApiTestFile02: + Title: ApiTestFile02 + Parent: =>SilverStripe\Assets\Folder.ApiFolder01 + ApiTestFile03: + Title: ApiTestFile03 + Parent: =>SilverStripe\Assets\Folder.ApiFolder03 +SilverStripe\AssetAdmin\Tests\Controller\AssetAdminTest\TestObject: + ApiTestObject01: + Title: ApiTestObject01 + TestFileID: =>SilverStripe\AssetAdmin\Tests\Controller\AssetAdminTest\TestFile.ApiTestFile01 + ApiTestObject02: + Title: ApiTestObject02 + TestFileID: =>SilverStripe\AssetAdmin\Tests\Controller\AssetAdminTest\TestFile.ApiTestFile01 + ApiTestObject03: + Title: ApiTestObject03 + TestFileID: =>SilverStripe\AssetAdmin\Tests\Controller\AssetAdminTest\TestFile.ApiTestFile02 + diff --git a/yarn.lock b/yarn.lock index 250ece2e8..3a53a1fae 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15,26 +15,6 @@ "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.24" -"@apollo/client@^3.7.1": - version "3.9.10" - resolved "https://registry.yarnpkg.com/@apollo/client/-/client-3.9.10.tgz#f381f67f3559cb5f5b66ce9183f84f49616acbe4" - integrity sha512-w8i/Lk1P0vvWZF0Xb00XPonn79/0rgRJ1vopBlVudVuy9QP29/NZXK0rI2xJIN6VrKuEqJZaVGJC+7k23I2sfA== - dependencies: - "@graphql-typed-document-node/core" "^3.1.1" - "@wry/caches" "^1.0.0" - "@wry/equality" "^0.5.6" - "@wry/trie" "^0.5.0" - graphql-tag "^2.12.6" - hoist-non-react-statics "^3.3.2" - optimism "^0.18.0" - prop-types "^15.7.2" - rehackt "0.0.6" - response-iterator "^0.2.6" - symbol-observable "^4.0.0" - ts-invariant "^0.10.3" - tslib "^2.3.0" - zen-observable-ts "^1.2.5" - "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.23.5", "@babel/code-frame@^7.24.1", "@babel/code-frame@^7.24.2": version "7.24.2" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.24.2.tgz#718b4b19841809a58b29b68cde80bc5e1aa6d9ae" @@ -1110,11 +1090,6 @@ resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6" integrity sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw== -"@graphql-typed-document-node/core@^3.1.1": - version "3.2.0" - resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.2.0.tgz#5f3d96ec6b2354ad6d8a28bf216a1d97b5426861" - integrity sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ== - "@humanwhocodes/config-array@^0.11.14": version "0.11.14" resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.14.tgz#d78e481a039f7566ecc9660b4ea7fe6b1fec442b" @@ -1627,10 +1602,10 @@ stylelint-config-standard "^36.0.0" stylelint-scss "^6.2.1" -"@silverstripe/webpack-config@^2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@silverstripe/webpack-config/-/webpack-config-2.1.0.tgz#9d6409498126db766299fa40f209f618515932a4" - integrity sha512-8rE2K3AXkIP6crDTBXdHz/3hiNVp2XpINkWGDBKzvMS6sGRcVTluPs12BdOXYo1aUZEeqDk9QYOLLGGgZxnOdw== +"@silverstripe/webpack-config@^3.0.0-alpha2": + version "3.0.0-alpha2" + resolved "https://registry.yarnpkg.com/@silverstripe/webpack-config/-/webpack-config-3.0.0-alpha2.tgz#ea2c50a953e5de4e53dacfc42501c9b3c88835f2" + integrity sha512-KsqwAxKLvutDnYf755Z16gUO4EeRH6GnAgl1qaejFRN+6bRI2wTnPuiGZz0OLKvH8Fz+/zEmL1WFLmm5iQIk5A== dependencies: "@babel/core" "^7.19.6" "@babel/preset-env" "^7.19.4" @@ -2046,41 +2021,6 @@ resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-2.0.5.tgz#325db42395cd49fe6c14057f9a900e427df8810e" integrity sha512-lqaoKnRYBdo1UgDX8uF24AfGMifWK19TxPmM5FHc2vAGxrJ/qtyUyFBWoY1tISZdelsQ5fBcOusifo5o5wSJxQ== -"@wry/caches@^1.0.0": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@wry/caches/-/caches-1.0.1.tgz#8641fd3b6e09230b86ce8b93558d44cf1ece7e52" - integrity sha512-bXuaUNLVVkD20wcGBWRyo7j9N3TxePEWFZj2Y+r9OoUzfqmavM84+mFykRicNsBqatba5JLay1t48wxaXaWnlA== - dependencies: - tslib "^2.3.0" - -"@wry/context@^0.7.0": - version "0.7.4" - resolved "https://registry.yarnpkg.com/@wry/context/-/context-0.7.4.tgz#e32d750fa075955c4ab2cfb8c48095e1d42d5990" - integrity sha512-jmT7Sb4ZQWI5iyu3lobQxICu2nC/vbUhP0vIdd6tHC9PTfenmRmuIFqktc6GH9cgi+ZHnsLWPvfSvc4DrYmKiQ== - dependencies: - tslib "^2.3.0" - -"@wry/equality@^0.5.6": - version "0.5.7" - resolved "https://registry.yarnpkg.com/@wry/equality/-/equality-0.5.7.tgz#72ec1a73760943d439d56b7b1e9985aec5d497bb" - integrity sha512-BRFORjsTuQv5gxcXsuDXx6oGRhuVsEGwZy6LOzRRfgu+eSfxbhUQ9L9YtSEIuIjY/o7g3iWFjrc5eSY1GXP2Dw== - dependencies: - tslib "^2.3.0" - -"@wry/trie@^0.4.3": - version "0.4.3" - resolved "https://registry.yarnpkg.com/@wry/trie/-/trie-0.4.3.tgz#077d52c22365871bf3ffcbab8e95cb8bc5689af4" - integrity sha512-I6bHwH0fSf6RqQcnnXLJKhkSXG45MFral3GxPaY4uAl0LYDZM+YDVDAiU9bYwjTuysy1S0IeecWtmq1SZA3M1w== - dependencies: - tslib "^2.3.0" - -"@wry/trie@^0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@wry/trie/-/trie-0.5.0.tgz#11e783f3a53f6e4cd1d42d2d1323f5bc3fa99c94" - integrity sha512-FNoYzHawTMk/6KMQoEG5O4PuioX19UbwdQKF44yw0nLfOypfQdjtfZzo/UIJWAJ23sNIFbD1Ug9lbaDGMwbqQA== - dependencies: - tslib "^2.3.0" - "@xtuc/ieee754@^1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790" @@ -4446,48 +4386,6 @@ graphemer@^1.4.0: resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== -graphql-anywhere@^0.2.4: - version "0.2.4" - resolved "https://registry.yarnpkg.com/graphql-anywhere/-/graphql-anywhere-0.2.4.tgz#700d5106dc7fbd39a08084d81a6f543475589774" - integrity sha512-3lINZxEALPEdSm1VuhMuEj9vQzOFMuJ7ge/RO+V21PxFWRYFu/XMvsjmUUNxawQQftQjBJLML3YTPAd4pSWY5Q== - dependencies: - lodash.assign "^4.0.8" - lodash.clonedeep "^4.3.2" - lodash.countby "^4.4.0" - lodash.flatten "^4.2.0" - lodash.forown "^4.1.0" - lodash.has "^4.3.1" - lodash.identity "^3.0.0" - lodash.includes "^4.1.2" - lodash.isequal "^4.2.0" - lodash.isnull "^3.0.0" - lodash.isnumber "^3.0.3" - lodash.isobject "^3.0.2" - lodash.isstring "^4.0.1" - lodash.isundefined "^3.0.1" - lodash.mapvalues "^4.4.0" - lodash.merge "^4.6.0" - lodash.pick "^4.2.0" - -graphql-fragments@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/graphql-fragments/-/graphql-fragments-0.1.0.tgz#21e04a3913f7cc8cfbc42c3e1d8b323a5847655e" - integrity sha512-asK6Bk8EYyJvwXFPvlWHMAuu7bcDwKCGQuRS1m0l6oXcUtycRIIeiFf1vnnYtSNKtRrdk3hRpkiQPsl/+SirCQ== - dependencies: - graphql-anywhere "^0.2.4" - -graphql-tag@^2.12.6: - version "2.12.6" - resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.12.6.tgz#d441a569c1d2537ef10ca3d1633b48725329b5f1" - integrity sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg== - dependencies: - tslib "^2.1.0" - -graphql@^16.8.1: - version "16.8.1" - resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.8.1.tgz#1930a965bef1170603702acdb68aedd3f3cf6f07" - integrity sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw== - griddle-react@^0.8.2: version "0.8.2" resolved "https://registry.yarnpkg.com/griddle-react/-/griddle-react-0.8.2.tgz#5bfe00b6680c571229916557c2f48ebc0798217a" @@ -5892,96 +5790,16 @@ locate-path@^7.1.0: dependencies: p-locate "^6.0.0" -lodash.assign@^4.0.8: - version "4.2.0" - resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7" - integrity sha512-hFuH8TY+Yji7Eja3mGiuAxBqLagejScbG8GbG0j6o9vzn0YL14My+ktnqtZgFTosKymC9/44wP6s7xyuLfnClw== - -lodash.clonedeep@^4.3.2: - version "4.5.0" - resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" - integrity sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ== - -lodash.countby@^4.4.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/lodash.countby/-/lodash.countby-4.6.0.tgz#5351f24de16724a0059b561f920b0d80af78a33c" - integrity sha512-RhdqSKPeVL9zWY5jSYHA2PHrV+lm2x/NfZd1uCUMEJXZoqFJ14MlSjnm+otBVdmlrkJ3trLKM07wuMszZ5GIbA== - lodash.debounce@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow== -lodash.flatten@^4.2.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/lodash.flatten/-/lodash.flatten-4.4.0.tgz#f31c22225a9632d2bbf8e4addbef240aa765a61f" - integrity sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g== - -lodash.forown@^4.1.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/lodash.forown/-/lodash.forown-4.4.0.tgz#85115cf04f73ef966eced52511d3893cc46683af" - integrity sha512-xcpca6BCshoe5SFSrQOoV8FBEbNzcBa6QQYmtv48eEFNzdwQLkHkcWSaBlecHhyHb1BUk1xqFdXoiSLJkt/w5w== - -lodash.has@^4.3.1: - version "4.5.2" - resolved "https://registry.yarnpkg.com/lodash.has/-/lodash.has-4.5.2.tgz#d19f4dc1095058cccbe2b0cdf4ee0fe4aa37c862" - integrity sha512-rnYUdIo6xRCJnQmbVFEwcxF144erlD+M3YcJUVesflU9paQaE8p+fJDcIQrlMYbxoANFL+AB9hZrzSBBk5PL+g== - -lodash.identity@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/lodash.identity/-/lodash.identity-3.0.0.tgz#ad7bc6a4e647d79c972e1b80feef7af156267876" - integrity sha512-AupTIzdLQxJS5wIYUQlgGyk2XRTfGXA+MCghDHqZk0pzUNYvd3EESS6dkChNauNYVIutcb0dfHw1ri9Q1yPV8Q== - -lodash.includes@^4.1.2: - version "4.3.0" - resolved "https://registry.yarnpkg.com/lodash.includes/-/lodash.includes-4.3.0.tgz#60bb98a87cb923c68ca1e51325483314849f553f" - integrity sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w== - -lodash.isequal@^4.2.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" - integrity sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ== - -lodash.isnull@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/lodash.isnull/-/lodash.isnull-3.0.0.tgz#fafbe59ea1dca27eed786534039dd84c2e07c56e" - integrity sha512-9D6/H5PSHfhyPwZerI9J5hKBaXayxhVy7gt6OBAsXv8XBm+i107KqG99AoeIJObC6uCnVwp1LM7Ww1DKYYIKog== - -lodash.isnumber@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz#3ce76810c5928d03352301ac287317f11c0b1ffc" - integrity sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw== - -lodash.isobject@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/lodash.isobject/-/lodash.isobject-3.0.2.tgz#3c8fb8d5b5bf4bf90ae06e14f2a530a4ed935e1d" - integrity sha512-3/Qptq2vr7WeJbB4KHUSKlq8Pl7ASXi3UG6CMbBm8WRtXi8+GHm7mKaU3urfpSEzWe2wCIChs6/sdocUsTKJiA== - -lodash.isstring@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451" - integrity sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw== - -lodash.isundefined@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/lodash.isundefined/-/lodash.isundefined-3.0.1.tgz#23ef3d9535565203a66cefd5b830f848911afb48" - integrity sha512-MXB1is3s899/cD8jheYYE2V9qTHwKvt+npCwpD+1Sxm3Q3cECXCiYHjeHWXNwr6Q0SOBPrYUDxendrO6goVTEA== - -lodash.mapvalues@^4.4.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/lodash.mapvalues/-/lodash.mapvalues-4.6.0.tgz#1bafa5005de9dd6f4f26668c30ca37230cc9689c" - integrity sha512-JPFqXFeZQ7BfS00H58kClY7SPVeHertPE0lNuCyZ26/XlN8TvakYD7b9bGyNmXbT/D3BbtPAAmq90gPWqLkxlQ== - -lodash.merge@^4.6.0, lodash.merge@^4.6.2: +lodash.merge@^4.6.2: version "4.6.2" resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== -lodash.pick@^4.2.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/lodash.pick/-/lodash.pick-4.4.0.tgz#52f05610fff9ded422611441ed1fc123a03001b3" - integrity sha512-hXt6Ul/5yWjfklSGvLQl8vM//l3FtyHZeuelpzK6mm99pNvN9yTDruNZPEJZD1oWrqo+izBmB7oUfWgcCX7s4Q== - lodash.truncate@^4.4.2: version "4.4.2" resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" @@ -6666,16 +6484,6 @@ opener@^1.5.2: resolved "https://registry.yarnpkg.com/opener/-/opener-1.5.2.tgz#5d37e1f35077b9dcac4301372271afdeb2a13598" integrity sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A== -optimism@^0.18.0: - version "0.18.0" - resolved "https://registry.yarnpkg.com/optimism/-/optimism-0.18.0.tgz#e7bb38b24715f3fdad8a9a7fc18e999144bbfa63" - integrity sha512-tGn8+REwLRNFnb9WmcY5IfpOqeX2kpaYJ1s6Ae3mn12AeydLkR3j+jSCmVQFoXqU8D41PAJ1RG1rCRNWmNZVmQ== - dependencies: - "@wry/caches" "^1.0.0" - "@wry/context" "^0.7.0" - "@wry/trie" "^0.4.3" - tslib "^2.3.0" - optionator@^0.9.3: version "0.9.3" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64" @@ -7073,7 +6881,7 @@ promzard@^0.3.0: dependencies: read "1" -prop-types@^15.5.8, prop-types@^15.6.1, prop-types@^15.6.2, prop-types@^15.7.2, prop-types@^15.8.1: +prop-types@^15.5.8, prop-types@^15.6.1, prop-types@^15.6.2, prop-types@^15.8.1: version "15.8.1" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5" integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg== @@ -7438,11 +7246,6 @@ regjsparser@^0.9.1: dependencies: jsesc "~0.5.0" -rehackt@0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/rehackt/-/rehackt-0.0.6.tgz#7a0a2247f2295e7548915417e44fbbf03bf004f4" - integrity sha512-l3WEzkt4ntlEc/IB3/mF6SRgNHA6zfQR7BlGOgBTOmx7IJJXojDASav+NsgXHFjHn+6RmwqsGPFgZpabWpeOdw== - repeating@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" @@ -7526,11 +7329,6 @@ resolve@^2.0.0-next.5: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" -response-iterator@^0.2.6: - version "0.2.6" - resolved "https://registry.yarnpkg.com/response-iterator/-/response-iterator-0.2.6.tgz#249005fb14d2e4eeb478a3f735a28fd8b4c9f3da" - integrity sha512-pVzEEzrsg23Sh053rmDUvLSkGXluZio0qu8VT6ukrYuvtjVfCbDZH9d6PGXb8HZfzdNZt8feXv/jvUzlhRgLnw== - retry@^0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b" @@ -8142,11 +7940,6 @@ symbol-observable@^1.0.4: resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" integrity sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ== -symbol-observable@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-4.0.0.tgz#5b425f192279e87f2f9b937ac8540d1984b39205" - integrity sha512-b19dMThMV4HVFynSAM1++gBHAbk2Tc/osgLIBZMKsyqh34jb2e8Os7T6ZW/Bt3pJFdBTd2JwAnAAEQV7rSNvcQ== - symbol-tree@^3.2.4: version "3.2.4" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" @@ -8279,13 +8072,6 @@ ts-dedent@^2.0.0: resolved "https://registry.yarnpkg.com/ts-dedent/-/ts-dedent-2.2.0.tgz#39e4bd297cd036292ae2394eb3412be63f563bb5" integrity sha512-q5W7tVM71e2xjHZTlgfTDoPF/SmqKG5hddq9SzR49CH2hayqRKJtQ4mtRlSxKaJlR/+9rEM+mnBHf7I2/BQcpQ== -ts-invariant@^0.10.3: - version "0.10.3" - resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.10.3.tgz#3e048ff96e91459ffca01304dbc7f61c1f642f6c" - integrity sha512-uivwYcQaxAucv1CzRp2n/QdYPo4ILf9VXgH19zEIjFx2EJufV16P0JtJVpYHy89DItG6Kwj2oIUjrcK5au+4tQ== - dependencies: - tslib "^2.1.0" - tsconfig-paths@^3.15.0: version "3.15.0" resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz#5299ec605e55b1abb23ec939ef15edaf483070d4" @@ -8296,11 +8082,6 @@ tsconfig-paths@^3.15.0: minimist "^1.2.6" strip-bom "^3.0.0" -tslib@^2.1.0, tslib@^2.3.0: - version "2.6.2" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" - integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== - type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" @@ -8879,15 +8660,3 @@ yocto-queue@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.0.0.tgz#7f816433fb2cbc511ec8bf7d263c3b58a1a3c251" integrity sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g== - -zen-observable-ts@^1.2.5: - version "1.2.5" - resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-1.2.5.tgz#6c6d9ea3d3a842812c6e9519209365a122ba8b58" - integrity sha512-QZWQekv6iB72Naeake9hS1KxHlotfRpe+WGNbNx5/ta+R3DNjVO2bswf63gXlWDcs+EMd7XY8HfVQyP1X6T4Zg== - dependencies: - zen-observable "0.8.15" - -zen-observable@0.8.15: - version "0.8.15" - resolved "https://registry.yarnpkg.com/zen-observable/-/zen-observable-0.8.15.tgz#96415c512d8e3ffd920afd3889604e30b9eaac15" - integrity sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ==