@edifice.io/react 2.0.0-develop-rc.4 → 2.0.0-develop-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -88
- package/dist/audience.js +15 -14
- package/dist/audience.js.map +1 -0
- package/dist/components/ActionBar/ActionBar.js +8 -7
- package/dist/components/ActionBar/ActionBar.js.map +1 -0
- package/dist/components/Alert/Alert.js +62 -61
- package/dist/components/Alert/Alert.js.map +1 -0
- package/dist/components/AppHeader/AppHeader.js +19 -18
- package/dist/components/AppHeader/AppHeader.js.map +1 -0
- package/dist/components/AppIcon/AppIcon.d.ts +1 -1
- package/dist/components/AppIcon/AppIcon.js +45 -44
- package/dist/components/AppIcon/AppIcon.js.map +1 -0
- package/dist/components/Attachment/Attachment.js +14 -13
- package/dist/components/Attachment/Attachment.js.map +1 -0
- package/dist/components/Avatar/Avatar.js +28 -27
- package/dist/components/Avatar/Avatar.js.map +1 -0
- package/dist/components/Badge/Badge.js +21 -20
- package/dist/components/Badge/Badge.js.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.js +24 -23
- package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -0
- package/dist/components/Breadcrumb/BreadcrumbItem.js +12 -11
- package/dist/components/Breadcrumb/BreadcrumbItem.js.map +1 -0
- package/dist/components/Breadcrumb/BreadcrumbList.js +11 -10
- package/dist/components/Breadcrumb/BreadcrumbList.js.map +1 -0
- package/dist/components/Breadcrumb/BreadcrumbNav.d.ts +1 -1
- package/dist/components/Breadcrumb/BreadcrumbNav.js +16 -15
- package/dist/components/Breadcrumb/BreadcrumbNav.js.map +1 -0
- package/dist/components/Button/Button.js +33 -32
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Button/IconButton.js +16 -15
- package/dist/components/Button/IconButton.js.map +1 -0
- package/dist/components/Button/SearchButton.js +16 -15
- package/dist/components/Button/SearchButton.js.map +1 -0
- package/dist/components/Card/Card.d.ts +1 -1
- package/dist/components/Card/Card.js +48 -47
- package/dist/components/Card/Card.js.map +1 -0
- package/dist/components/Card/CardBody.js +14 -13
- package/dist/components/Card/CardBody.js.map +1 -0
- package/dist/components/Card/CardContext.d.ts +1 -1
- package/dist/components/Card/CardContext.js +8 -7
- package/dist/components/Card/CardContext.js.map +1 -0
- package/dist/components/Card/CardFooter.js +6 -5
- package/dist/components/Card/CardFooter.js.map +1 -0
- package/dist/components/Card/CardHeader.js +15 -14
- package/dist/components/Card/CardHeader.js.map +1 -0
- package/dist/components/Card/CardImage.js +14 -13
- package/dist/components/Card/CardImage.js.map +1 -0
- package/dist/components/Card/CardText.js +9 -8
- package/dist/components/Card/CardText.js.map +1 -0
- package/dist/components/Card/CardTitle.js +9 -8
- package/dist/components/Card/CardTitle.js.map +1 -0
- package/dist/components/Card/CardUser.js +9 -8
- package/dist/components/Card/CardUser.js.map +1 -0
- package/dist/components/Checkbox/Checkbox.js +31 -30
- package/dist/components/Checkbox/Checkbox.js.map +1 -0
- package/dist/components/ColorPicker/ColorPalette.js +5 -4
- package/dist/components/ColorPicker/ColorPalette.js.map +1 -0
- package/dist/components/ColorPicker/ColorPicker.js +29 -28
- package/dist/components/ColorPicker/ColorPicker.js.map +1 -0
- package/dist/components/ColorPicker/ColorPickerItem.js +12 -11
- package/dist/components/ColorPicker/ColorPickerItem.js.map +1 -0
- package/dist/components/Combobox/Combobox.js +36 -35
- package/dist/components/Combobox/Combobox.js.map +1 -0
- package/dist/components/Combobox/ComboboxTrigger.js +22 -21
- package/dist/components/Combobox/ComboboxTrigger.js.map +1 -0
- package/dist/components/Dropdown/Dropdown.js +56 -55
- package/dist/components/Dropdown/Dropdown.js.map +1 -0
- package/dist/components/Dropdown/DropdownCheckboxItem.js +27 -26
- package/dist/components/Dropdown/DropdownCheckboxItem.js.map +1 -0
- package/dist/components/Dropdown/DropdownContext.js +8 -7
- package/dist/components/Dropdown/DropdownContext.js.map +1 -0
- package/dist/components/Dropdown/DropdownItem.js +28 -27
- package/dist/components/Dropdown/DropdownItem.js.map +1 -0
- package/dist/components/Dropdown/DropdownMenu.js +22 -21
- package/dist/components/Dropdown/DropdownMenu.js.map +1 -0
- package/dist/components/Dropdown/DropdownMenuGroup.js +10 -9
- package/dist/components/Dropdown/DropdownMenuGroup.js.map +1 -0
- package/dist/components/Dropdown/DropdownRadioItem.js +27 -26
- package/dist/components/Dropdown/DropdownRadioItem.js.map +1 -0
- package/dist/components/Dropdown/DropdownSeparator.js +4 -3
- package/dist/components/Dropdown/DropdownSeparator.js.map +1 -0
- package/dist/components/Dropdown/DropdownTrigger.js +29 -28
- package/dist/components/Dropdown/DropdownTrigger.js.map +1 -0
- package/dist/components/Dropzone/Dropzone.js +48 -47
- package/dist/components/Dropzone/Dropzone.js.map +1 -0
- package/dist/components/Dropzone/DropzoneContext.js +9 -8
- package/dist/components/Dropzone/DropzoneContext.js.map +1 -0
- package/dist/components/Dropzone/DropzoneDrag.js +8 -7
- package/dist/components/Dropzone/DropzoneDrag.js.map +1 -0
- package/dist/components/Dropzone/DropzoneFile.js +26 -25
- package/dist/components/Dropzone/DropzoneFile.js.map +1 -0
- package/dist/components/Dropzone/DropzoneImport.js +21 -20
- package/dist/components/Dropzone/DropzoneImport.js.map +1 -0
- package/dist/components/EmptyScreen/EmptyScreen.js +17 -16
- package/dist/components/EmptyScreen/EmptyScreen.js.map +1 -0
- package/dist/components/FileCard/FileCard.d.ts +1 -1
- package/dist/components/FileCard/FileCard.js +38 -37
- package/dist/components/FileCard/FileCard.js.map +1 -0
- package/dist/components/FileCard/FileIcon.d.ts +1 -1
- package/dist/components/FileCard/FileIcon.js +12 -11
- package/dist/components/FileCard/FileIcon.js.map +1 -0
- package/dist/components/Form/FormContext.js +8 -7
- package/dist/components/Form/FormContext.js.map +1 -0
- package/dist/components/Form/FormControl.js +31 -30
- package/dist/components/Form/FormControl.js.map +1 -0
- package/dist/components/Form/FormText.js +13 -12
- package/dist/components/Form/FormText.js.map +1 -0
- package/dist/components/Grid/Grid.js +28 -27
- package/dist/components/Grid/Grid.js.map +1 -0
- package/dist/components/Heading/Heading.js +15 -14
- package/dist/components/Heading/Heading.js.map +1 -0
- package/dist/components/Icon/Icon.js +9 -8
- package/dist/components/Icon/Icon.js.map +1 -0
- package/dist/components/Image/Image.js +40 -39
- package/dist/components/Image/Image.js.map +1 -0
- package/dist/components/ImagePicker/ImagePicker.d.ts +1 -1
- package/dist/components/ImagePicker/ImagePicker.js +52 -51
- package/dist/components/ImagePicker/ImagePicker.js.map +1 -0
- package/dist/components/Input/Input.js +29 -28
- package/dist/components/Input/Input.js.map +1 -0
- package/dist/components/Label/Label.js +31 -30
- package/dist/components/Label/Label.js.map +1 -0
- package/dist/components/Loading/Loading.js +24 -23
- package/dist/components/Loading/Loading.js.map +1 -0
- package/dist/components/LoadingScreen/LoadingScreen.js +21 -20
- package/dist/components/LoadingScreen/LoadingScreen.js.map +1 -0
- package/dist/components/Logo/Logo.js +13 -12
- package/dist/components/Logo/Logo.js.map +1 -0
- package/dist/components/Menu/Menu.js +40 -39
- package/dist/components/Menu/Menu.js.map +1 -0
- package/dist/components/Menu/MenuButton.js +18 -17
- package/dist/components/Menu/MenuButton.js.map +1 -0
- package/dist/components/Menu/MenuContext.js +9 -8
- package/dist/components/Menu/MenuContext.js.map +1 -0
- package/dist/components/Menu/MenuItem.js +15 -14
- package/dist/components/Menu/MenuItem.js.map +1 -0
- package/dist/components/Modal/Modal.js +50 -49
- package/dist/components/Modal/Modal.js.map +1 -0
- package/dist/components/Modal/ModalBody.js +12 -11
- package/dist/components/Modal/ModalBody.js.map +1 -0
- package/dist/components/Modal/ModalContext.js +9 -8
- package/dist/components/Modal/ModalContext.js.map +1 -0
- package/dist/components/Modal/ModalFooter.js +4 -3
- package/dist/components/Modal/ModalFooter.js.map +1 -0
- package/dist/components/Modal/ModalHeader.js +23 -22
- package/dist/components/Modal/ModalHeader.js.map +1 -0
- package/dist/components/Modal/ModalSubtitle.js +4 -3
- package/dist/components/Modal/ModalSubtitle.js.map +1 -0
- package/dist/components/Popover/Popover.js +34 -33
- package/dist/components/Popover/Popover.js.map +1 -0
- package/dist/components/Radio/Radio.js +27 -26
- package/dist/components/Radio/Radio.js.map +1 -0
- package/dist/components/SearchBar/SearchBar.js +30 -29
- package/dist/components/SearchBar/SearchBar.js.map +1 -0
- package/dist/components/Select/Select.js +32 -31
- package/dist/components/Select/Select.js.map +1 -0
- package/dist/components/Select/SelectTrigger.js +5 -4
- package/dist/components/Select/SelectTrigger.js.map +1 -0
- package/dist/components/Table/TableExplorer.js +8 -7
- package/dist/components/Table/TableExplorer.js.map +1 -0
- package/dist/components/Tabs/Tabs.js +59 -58
- package/dist/components/Tabs/Tabs.js.map +1 -0
- package/dist/components/Tabs/TabsContext.js +9 -8
- package/dist/components/Tabs/TabsContext.js.map +1 -0
- package/dist/components/Tabs/TabsItem.js +21 -20
- package/dist/components/Tabs/TabsItem.js.map +1 -0
- package/dist/components/Tabs/TabsList.js +19 -18
- package/dist/components/Tabs/TabsList.js.map +1 -0
- package/dist/components/Tabs/TabsPanel.js +10 -9
- package/dist/components/Tabs/TabsPanel.js.map +1 -0
- package/dist/components/TextArea/TextArea.js +32 -31
- package/dist/components/TextArea/TextArea.js.map +1 -0
- package/dist/components/TextArea/TextareaCounter.js +7 -6
- package/dist/components/TextArea/TextareaCounter.js.map +1 -0
- package/dist/components/Toolbar/Toolbar.js +61 -60
- package/dist/components/Toolbar/Toolbar.js.map +1 -0
- package/dist/components/Tooltip/Tooltip.js +29 -28
- package/dist/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/components/TreeView/TreeItem.js +47 -46
- package/dist/components/TreeView/TreeItem.js.map +1 -0
- package/dist/components/TreeView/TreeView.js +34 -33
- package/dist/components/TreeView/TreeView.js.map +1 -0
- package/dist/components/TreeView/hooks/useTreeItemEvents.js +19 -18
- package/dist/components/TreeView/hooks/useTreeItemEvents.js.map +1 -0
- package/dist/components/UploadCard/UploadCard.js +53 -52
- package/dist/components/UploadCard/UploadCard.js.map +1 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.js +8 -7
- package/dist/components/VisuallyHidden/VisuallyHidden.js.map +1 -0
- package/dist/core/OdeClientProvider/OdeClientProvider.d.ts +1 -1
- package/dist/core/OdeClientProvider/OdeClientProvider.js +45 -44
- package/dist/core/OdeClientProvider/OdeClientProvider.js.map +1 -0
- package/dist/core/ThemeProvider/ThemeProvider.d.ts +1 -1
- package/dist/core/ThemeProvider/ThemeProvider.js +36 -35
- package/dist/core/ThemeProvider/ThemeProvider.js.map +1 -0
- package/dist/core/useAvatar/useAvatar.d.ts +1 -1
- package/dist/core/useAvatar/useAvatar.js +22 -21
- package/dist/core/useAvatar/useAvatar.js.map +1 -0
- package/dist/core/useBookmark/useBookmark.d.ts +1 -1
- package/dist/core/useBookmark/useBookmark.js +10 -9
- package/dist/core/useBookmark/useBookmark.js.map +1 -0
- package/dist/core/useConf/useConf.d.ts +1 -1
- package/dist/core/useConf/useConf.js +8 -7
- package/dist/core/useConf/useConf.js.map +1 -0
- package/dist/core/useConversation/useConversation.js +30 -29
- package/dist/core/useConversation/useConversation.js.map +1 -0
- package/dist/core/useCookiesConsent/useCookiesConsent.js +17 -16
- package/dist/core/useCookiesConsent/useCookiesConsent.js.map +1 -0
- package/dist/core/useDate/useDate.js +36 -35
- package/dist/core/useDate/useDate.js.map +1 -0
- package/dist/core/useHasWorkflow/useHasWorkflow.js +16 -15
- package/dist/core/useHasWorkflow/useHasWorkflow.js.map +1 -0
- package/dist/core/useHeader/useHeader.d.ts +1 -1
- package/dist/core/useHeader/useHeader.js +42 -41
- package/dist/core/useHeader/useHeader.js.map +1 -0
- package/dist/core/useHttpErrorToast/useHttpErrorToast.js +18 -17
- package/dist/core/useHttpErrorToast/useHttpErrorToast.js.map +1 -0
- package/dist/core/useIsAdml/useIsAdml.js +12 -11
- package/dist/core/useIsAdml/useIsAdml.js.map +1 -0
- package/dist/core/useLibraryUrl/useLibraryUrl.js +17 -16
- package/dist/core/useLibraryUrl/useLibraryUrl.js.map +1 -0
- package/dist/core/useMediaLibrary/useMediaLibrary.d.ts +1 -1
- package/dist/core/useMediaLibrary/useMediaLibrary.js +33 -32
- package/dist/core/useMediaLibrary/useMediaLibrary.js.map +1 -0
- package/dist/core/useOdeIcons/useOdeIcons.d.ts +1 -1
- package/dist/core/useOdeIcons/useOdeIcons.js +38 -37
- package/dist/core/useOdeIcons/useOdeIcons.js.map +1 -0
- package/dist/core/usePaths/usePaths.js +3 -2
- package/dist/core/usePaths/usePaths.js.map +1 -0
- package/dist/core/usePreferences/usePreferences.js +6 -5
- package/dist/core/usePreferences/usePreferences.js.map +1 -0
- package/dist/core/useResource/useResource.d.ts +1 -1
- package/dist/core/useResource/useResource.js +15 -14
- package/dist/core/useResource/useResource.js.map +1 -0
- package/dist/core/useResourceSearch/useResourceSearch.d.ts +1 -1
- package/dist/core/useResourceSearch/useResourceSearch.js +23 -22
- package/dist/core/useResourceSearch/useResourceSearch.js.map +1 -0
- package/dist/core/useSession/useSession.js +7 -6
- package/dist/core/useSession/useSession.js.map +1 -0
- package/dist/core/useTrashedResource/useTrashedResource.js +19 -18
- package/dist/core/useTrashedResource/useTrashedResource.js.map +1 -0
- package/dist/core/useUpload/useUpload.d.ts +1 -1
- package/dist/core/useUpload/useUpload.js +69 -68
- package/dist/core/useUpload/useUpload.js.map +1 -0
- package/dist/core/useUploadFiles/useUploadFiles.d.ts +1 -1
- package/dist/core/useUploadFiles/useUploadFiles.js +83 -82
- package/dist/core/useUploadFiles/useUploadFiles.js.map +1 -0
- package/dist/core/useUser/useUser.d.ts +1 -1
- package/dist/core/useUser/useUser.js +16 -15
- package/dist/core/useUser/useUser.js.map +1 -0
- package/dist/core/useWorkspaceFile/useWorkspaceFile.d.ts +1 -1
- package/dist/core/useWorkspaceFile/useWorkspaceFile.js +32 -31
- package/dist/core/useWorkspaceFile/useWorkspaceFile.js.map +1 -0
- package/dist/core/useWorkspaceSearch/useWorkspaceSearch.d.ts +1 -1
- package/dist/core/useWorkspaceSearch/useWorkspaceSearch.js +42 -41
- package/dist/core/useWorkspaceSearch/useWorkspaceSearch.js.map +1 -0
- package/dist/core/useXitiTrackPageLoad/useXitiTrackPageLoad.js +18 -17
- package/dist/core/useXitiTrackPageLoad/useXitiTrackPageLoad.js.map +1 -0
- package/dist/core/useZendeskGuide/useZendeskGuide.js +47 -46
- package/dist/core/useZendeskGuide/useZendeskGuide.js.map +1 -0
- package/dist/editor.js +57 -56
- package/dist/editor.js.map +1 -0
- package/dist/hooks/useBrowserInfo/useBrowserInfo.js +12 -11
- package/dist/hooks/useBrowserInfo/useBrowserInfo.js.map +1 -0
- package/dist/hooks/useClickOutside/useClickOutside.js +19 -18
- package/dist/hooks/useClickOutside/useClickOutside.js.map +1 -0
- package/dist/hooks/useDebounce/useDebounce.js +11 -10
- package/dist/hooks/useDebounce/useDebounce.js.map +1 -0
- package/dist/hooks/useDropdown/useDropdown.d.ts +1 -1
- package/dist/hooks/useDropdown/useDropdown.js +97 -96
- package/dist/hooks/useDropdown/useDropdown.js.map +1 -0
- package/dist/hooks/useDropzone/useDropzone.js +54 -53
- package/dist/hooks/useDropzone/useDropzone.js.map +1 -0
- package/dist/hooks/useHover/useHover.js +15 -14
- package/dist/hooks/useHover/useHover.js.map +1 -0
- package/dist/hooks/useImage/useImage.js +14 -13
- package/dist/hooks/useImage/useImage.js.map +1 -0
- package/dist/hooks/useImageResizer/useImageResizer.js +32 -31
- package/dist/hooks/useImageResizer/useImageResizer.js.map +1 -0
- package/dist/hooks/useKeyPress/useKeyPress.js +11 -10
- package/dist/hooks/useKeyPress/useKeyPress.js.map +1 -0
- package/dist/hooks/useScrollToTop/useScrollToTop.js +5 -4
- package/dist/hooks/useScrollToTop/useScrollToTop.js.map +1 -0
- package/dist/hooks/useThumbnail/useThumbnail.js +22 -21
- package/dist/hooks/useThumbnail/useThumbnail.js.map +1 -0
- package/dist/hooks/useTitle/useTitle.js +8 -7
- package/dist/hooks/useTitle/useTitle.js.map +1 -0
- package/dist/hooks/useToast/useToast.js +26 -25
- package/dist/hooks/useToast/useToast.js.map +1 -0
- package/dist/hooks/useToggle/useToggle.js +7 -6
- package/dist/hooks/useToggle/useToggle.js.map +1 -0
- package/dist/hooks/useTrapFocus/useTrapFocus.js +12 -11
- package/dist/hooks/useTrapFocus/useTrapFocus.js.map +1 -0
- package/dist/index.js +226 -225
- package/dist/index.js.map +1 -0
- package/dist/modals.js +15 -14
- package/dist/modals.js.map +1 -0
- package/dist/modules/audience/ReactionChoice.d.ts +1 -1
- package/dist/modules/audience/ReactionChoice.js +25 -24
- package/dist/modules/audience/ReactionChoice.js.map +1 -0
- package/dist/modules/audience/ReactionModal.Card.d.ts +1 -1
- package/dist/modules/audience/ReactionModal.Card.js +26 -25
- package/dist/modules/audience/ReactionModal.Card.js.map +1 -0
- package/dist/modules/audience/ReactionModal.d.ts +1 -1
- package/dist/modules/audience/ReactionModal.js +59 -59
- package/dist/modules/audience/ReactionModal.js.map +1 -0
- package/dist/modules/audience/ReactionSummary.d.ts +1 -1
- package/dist/modules/audience/ReactionSummary.js +20 -19
- package/dist/modules/audience/ReactionSummary.js.map +1 -0
- package/dist/modules/audience/ViewsByProfileCard.d.ts +1 -1
- package/dist/modules/audience/ViewsByProfileCard.js +23 -22
- package/dist/modules/audience/ViewsByProfileCard.js.map +1 -0
- package/dist/modules/audience/ViewsCounter.js +15 -14
- package/dist/modules/audience/ViewsCounter.js.map +1 -0
- package/dist/modules/audience/ViewsModal.d.ts +1 -1
- package/dist/modules/audience/ViewsModal.js +33 -32
- package/dist/modules/audience/ViewsModal.js.map +1 -0
- package/dist/modules/audience/hooks/useReactionIcons.d.ts +1 -1
- package/dist/modules/audience/hooks/useReactionIcons.js +14 -13
- package/dist/modules/audience/hooks/useReactionIcons.js.map +1 -0
- package/dist/modules/audience/hooks/useReactions.d.ts +3 -3
- package/dist/modules/audience/hooks/useReactions.js +25 -24
- package/dist/modules/audience/hooks/useReactions.js.map +1 -0
- package/dist/modules/audience/hooks/useViews.d.ts +2 -2
- package/dist/modules/editor/components/BubbleMenuEditImage/BubbleMenuEditImage.js +60 -59
- package/dist/modules/editor/components/BubbleMenuEditImage/BubbleMenuEditImage.js.map +1 -0
- package/dist/modules/editor/components/Editor/Editor.d.ts +1 -1
- package/dist/modules/editor/components/Editor/Editor.js +71 -70
- package/dist/modules/editor/components/Editor/Editor.js.map +1 -0
- package/dist/modules/editor/components/Editor/MathsModal.d.ts +0 -1
- package/dist/modules/editor/components/Editor/MathsModal.js +38 -37
- package/dist/modules/editor/components/Editor/MathsModal.js.map +1 -0
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.DropdownMenu.js +15 -14
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.DropdownMenu.js.map +1 -0
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.Emoji.js +38 -37
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.Emoji.js.map +1 -0
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.HighlightColor.js +34 -33
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.HighlightColor.js.map +1 -0
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.PlusMenu.js +13 -12
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.PlusMenu.js.map +1 -0
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.TextColor.js +37 -36
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.TextColor.js.map +1 -0
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.TextSize.js +36 -35
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.TextSize.js.map +1 -0
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.Typography.js +31 -30
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.Typography.js.map +1 -0
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.js +96 -95
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.js.map +1 -0
- package/dist/modules/editor/components/NodeView/AttachmentNodeView.js +7 -6
- package/dist/modules/editor/components/NodeView/AttachmentNodeView.js.map +1 -0
- package/dist/modules/editor/components/NodeView/AudioNodeView.js +7 -6
- package/dist/modules/editor/components/NodeView/AudioNodeView.js.map +1 -0
- package/dist/modules/editor/components/NodeView/ImageNodeView.js +7 -6
- package/dist/modules/editor/components/NodeView/ImageNodeView.js.map +1 -0
- package/dist/modules/editor/components/NodeView/LinkerNodeView.js +7 -6
- package/dist/modules/editor/components/NodeView/LinkerNodeView.js.map +1 -0
- package/dist/modules/editor/components/NodeView/VideoNodeView.js +7 -6
- package/dist/modules/editor/components/NodeView/VideoNodeView.js.map +1 -0
- package/dist/modules/editor/components/Renderer/AttachmentRenderer.js +25 -24
- package/dist/modules/editor/components/Renderer/AttachmentRenderer.js.map +1 -0
- package/dist/modules/editor/components/Renderer/AudioRenderer.js +8 -7
- package/dist/modules/editor/components/Renderer/AudioRenderer.js.map +1 -0
- package/dist/modules/editor/components/Renderer/LinkerRenderer.js +27 -26
- package/dist/modules/editor/components/Renderer/LinkerRenderer.js.map +1 -0
- package/dist/modules/editor/components/Renderer/MediaRenderer.js +38 -37
- package/dist/modules/editor/components/Renderer/MediaRenderer.js.map +1 -0
- package/dist/modules/editor/components/Toolbar/LinkToolbar.TippyOptions.js +3 -2
- package/dist/modules/editor/components/Toolbar/LinkToolbar.TippyOptions.js.map +1 -0
- package/dist/modules/editor/components/Toolbar/LinkToolbar.d.ts +1 -1
- package/dist/modules/editor/components/Toolbar/LinkToolbar.js +33 -32
- package/dist/modules/editor/components/Toolbar/LinkToolbar.js.map +1 -0
- package/dist/modules/editor/components/Toolbar/TableToolbar.AddMenu.js +22 -21
- package/dist/modules/editor/components/Toolbar/TableToolbar.AddMenu.js.map +1 -0
- package/dist/modules/editor/components/Toolbar/TableToolbar.CellColor.js +31 -30
- package/dist/modules/editor/components/Toolbar/TableToolbar.CellColor.js.map +1 -0
- package/dist/modules/editor/components/Toolbar/TableToolbar.DelMenu.js +21 -20
- package/dist/modules/editor/components/Toolbar/TableToolbar.DelMenu.js.map +1 -0
- package/dist/modules/editor/components/Toolbar/TableToolbar.d.ts +1 -1
- package/dist/modules/editor/components/Toolbar/TableToolbar.js +42 -41
- package/dist/modules/editor/components/Toolbar/TableToolbar.js.map +1 -0
- package/dist/modules/editor/hooks/useActionOptions.js +48 -47
- package/dist/modules/editor/hooks/useActionOptions.js.map +1 -0
- package/dist/modules/editor/hooks/useCommentEditor.js +28 -27
- package/dist/modules/editor/hooks/useCommentEditor.js.map +1 -0
- package/dist/modules/editor/hooks/useEditorContext.js +9 -8
- package/dist/modules/editor/hooks/useEditorContext.js.map +1 -0
- package/dist/modules/editor/hooks/useImageModal.d.ts +1 -1
- package/dist/modules/editor/hooks/useImageModal.js +33 -32
- package/dist/modules/editor/hooks/useImageModal.js.map +1 -0
- package/dist/modules/editor/hooks/useImageSelection.js +32 -31
- package/dist/modules/editor/hooks/useImageSelection.js.map +1 -0
- package/dist/modules/editor/hooks/useLinkToolbar.js +25 -24
- package/dist/modules/editor/hooks/useLinkToolbar.js.map +1 -0
- package/dist/modules/editor/hooks/useMathsModal.js +10 -9
- package/dist/modules/editor/hooks/useMathsModal.js.map +1 -0
- package/dist/modules/editor/hooks/useMathsStyles.js +14 -13
- package/dist/modules/editor/hooks/useMathsStyles.js.map +1 -0
- package/dist/modules/editor/hooks/useMediaLibraryEditor.d.ts +1 -1
- package/dist/modules/editor/hooks/useMediaLibraryEditor.js +97 -96
- package/dist/modules/editor/hooks/useMediaLibraryEditor.js.map +1 -0
- package/dist/modules/editor/hooks/useResizeMedia.js +32 -31
- package/dist/modules/editor/hooks/useResizeMedia.js.map +1 -0
- package/dist/modules/editor/hooks/useSpeechRecognition.js +13 -12
- package/dist/modules/editor/hooks/useSpeechRecognition.js.map +1 -0
- package/dist/modules/editor/hooks/useSpeechSynthetisis.js +14 -13
- package/dist/modules/editor/hooks/useSpeechSynthetisis.js.map +1 -0
- package/dist/modules/editor/hooks/useTipTapEditor.js +58 -57
- package/dist/modules/editor/hooks/useTipTapEditor.js.map +1 -0
- package/dist/modules/editor/utils/has-extension.js +3 -2
- package/dist/modules/editor/utils/has-extension.js.map +1 -0
- package/dist/modules/editor/utils/has-mark.js +3 -2
- package/dist/modules/editor/utils/has-mark.js.map +1 -0
- package/dist/modules/editor/utils/has-text-style.js +4 -3
- package/dist/modules/editor/utils/has-text-style.js.map +1 -0
- package/dist/modules/modals/OnboardingModal/OnboardingModal.d.ts +0 -1
- package/dist/modules/modals/OnboardingModal/OnboardingModal.js +50 -49
- package/dist/modules/modals/OnboardingModal/OnboardingModal.js.map +1 -0
- package/dist/modules/modals/OnboardingModal/useOnboardingModal.js +19 -18
- package/dist/modules/modals/OnboardingModal/useOnboardingModal.js.map +1 -0
- package/dist/modules/modals/PublishModal/PublishModal.d.ts +1 -1
- package/dist/modules/modals/PublishModal/PublishModal.js +98 -97
- package/dist/modules/modals/PublishModal/PublishModal.js.map +1 -0
- package/dist/modules/modals/PublishModal/components/ActivitiesDropdown.js +20 -19
- package/dist/modules/modals/PublishModal/components/ActivitiesDropdown.js.map +1 -0
- package/dist/modules/modals/PublishModal/components/AgeSelect.js +15 -14
- package/dist/modules/modals/PublishModal/components/AgeSelect.js.map +1 -0
- package/dist/modules/modals/PublishModal/components/LangSelect.js +12 -11
- package/dist/modules/modals/PublishModal/components/LangSelect.js.map +1 -0
- package/dist/modules/modals/PublishModal/components/PublishModalFooter.js +17 -16
- package/dist/modules/modals/PublishModal/components/PublishModalFooter.js.map +1 -0
- package/dist/modules/modals/PublishModal/components/SubjectsDropdown.js +20 -19
- package/dist/modules/modals/PublishModal/components/SubjectsDropdown.js.map +1 -0
- package/dist/modules/modals/PublishModal/components/ToastError.js +18 -17
- package/dist/modules/modals/PublishModal/components/ToastError.js.map +1 -0
- package/dist/modules/modals/PublishModal/components/ToastSuccess.d.ts +1 -1
- package/dist/modules/modals/PublishModal/components/ToastSuccess.js +13 -12
- package/dist/modules/modals/PublishModal/components/ToastSuccess.js.map +1 -0
- package/dist/modules/modals/PublishModal/constants/ageOptions.js +3 -2
- package/dist/modules/modals/PublishModal/constants/ageOptions.js.map +1 -0
- package/dist/modules/modals/PublishModal/hooks/useActivitiesOptions.js +5 -4
- package/dist/modules/modals/PublishModal/hooks/useActivitiesOptions.js.map +1 -0
- package/dist/modules/modals/PublishModal/hooks/useLanguageOptions.js +17 -16
- package/dist/modules/modals/PublishModal/hooks/useLanguageOptions.js.map +1 -0
- package/dist/modules/modals/PublishModal/hooks/usePublishModal.d.ts +1 -1
- package/dist/modules/modals/PublishModal/hooks/usePublishModal.js +80 -79
- package/dist/modules/modals/PublishModal/hooks/usePublishModal.js.map +1 -0
- package/dist/modules/modals/PublishModal/hooks/useSubjectsOptions.js +42 -41
- package/dist/modules/modals/PublishModal/hooks/useSubjectsOptions.js.map +1 -0
- package/dist/modules/modals/ResourceModal/ResourceModal.d.ts +1 -1
- package/dist/modules/modals/ResourceModal/ResourceModal.js +116 -115
- package/dist/modules/modals/ResourceModal/ResourceModal.js.map +1 -0
- package/dist/modules/modals/ResourceModal/apps/BlogPublic.d.ts +1 -1
- package/dist/modules/modals/ResourceModal/apps/BlogPublic.js +48 -47
- package/dist/modules/modals/ResourceModal/apps/BlogPublic.js.map +1 -0
- package/dist/modules/modals/ResourceModal/hooks/useSlug.d.ts +1 -1
- package/dist/modules/modals/ResourceModal/hooks/useSlug.js +33 -32
- package/dist/modules/modals/ResourceModal/hooks/useSlug.js.map +1 -0
- package/dist/modules/modals/ResourceModal/hooks/useThumb.d.ts +1 -1
- package/dist/modules/modals/ResourceModal/hooks/useThumb.js +13 -12
- package/dist/modules/modals/ResourceModal/hooks/useThumb.js.map +1 -0
- package/dist/modules/modals/ResourceModal/hooks/useUpdateMutation.d.ts +1 -1
- package/dist/modules/modals/ResourceModal/hooks/useUpdateMutation.js +11 -10
- package/dist/modules/modals/ResourceModal/hooks/useUpdateMutation.js.map +1 -0
- package/dist/modules/modals/ShareModal/ShareBookmarkLine.d.ts +1 -1
- package/dist/modules/modals/ShareModal/ShareModal.d.ts +1 -1
- package/dist/modules/modals/ShareModal/apps/ShareBlog.d.ts +1 -1
- package/dist/modules/modals/ShareModal/apps/ShareBlog.js +34 -33
- package/dist/modules/modals/ShareModal/apps/ShareBlog.js.map +1 -0
- package/dist/modules/modals/ShareModal/hooks/useSearch.d.ts +1 -1
- package/dist/modules/modals/ShareModal/hooks/useShare.d.ts +1 -1
- package/dist/modules/modals/ShareModal/hooks/useShareBookmark.d.ts +1 -1
- package/dist/modules/modals/ShareModal/hooks/useShareMutation.d.ts +1 -1
- package/dist/modules/modals/ShareModal/hooks/useShareMutation.js +13 -12
- package/dist/modules/modals/ShareModal/hooks/useShareMutation.js.map +1 -0
- package/dist/modules/modals/ShareModal/utils/hasRight.d.ts +1 -1
- package/dist/modules/modals/ShareModal/utils/showShareRightLine.d.ts +1 -1
- package/dist/modules/multimedia/AudioRecorder/AudioRecorder.d.ts +1 -1
- package/dist/modules/multimedia/AudioRecorder/AudioRecorder.js +44 -43
- package/dist/modules/multimedia/AudioRecorder/AudioRecorder.js.map +1 -0
- package/dist/modules/multimedia/AudioRecorder/AudioRecorderTimer.js +19 -18
- package/dist/modules/multimedia/AudioRecorder/AudioRecorderTimer.js.map +1 -0
- package/dist/modules/multimedia/AudioRecorder/useAudioRecorder.d.ts +1 -1
- package/dist/modules/multimedia/AudioRecorder/useAudioRecorder.js +158 -157
- package/dist/modules/multimedia/AudioRecorder/useAudioRecorder.js.map +1 -0
- package/dist/modules/multimedia/Embed/Embed.js +23 -22
- package/dist/modules/multimedia/Embed/Embed.js.map +1 -0
- package/dist/modules/multimedia/ImageEditor/components/ImageEditor.js +80 -79
- package/dist/modules/multimedia/ImageEditor/components/ImageEditor.js.map +1 -0
- package/dist/modules/multimedia/ImageEditor/components/ImageEditorToolbar.js +38 -37
- package/dist/modules/multimedia/ImageEditor/components/ImageEditorToolbar.js.map +1 -0
- package/dist/modules/multimedia/ImageEditor/effects/blur.js +50 -49
- package/dist/modules/multimedia/ImageEditor/effects/blur.js.map +1 -0
- package/dist/modules/multimedia/ImageEditor/effects/crop.js +100 -99
- package/dist/modules/multimedia/ImageEditor/effects/crop.js.map +1 -0
- package/dist/modules/multimedia/ImageEditor/effects/misc.js +108 -107
- package/dist/modules/multimedia/ImageEditor/effects/misc.js.map +1 -0
- package/dist/modules/multimedia/ImageEditor/effects/resize.js +97 -96
- package/dist/modules/multimedia/ImageEditor/effects/resize.js.map +1 -0
- package/dist/modules/multimedia/ImageEditor/effects/rotate.js +26 -25
- package/dist/modules/multimedia/ImageEditor/effects/rotate.js.map +1 -0
- package/dist/modules/multimedia/ImageEditor/hooks/useHistoryTool.js +56 -57
- package/dist/modules/multimedia/ImageEditor/hooks/useHistoryTool.js.map +1 -0
- package/dist/modules/multimedia/ImageEditor/hooks/useImageEditor.js +57 -56
- package/dist/modules/multimedia/ImageEditor/hooks/useImageEditor.js.map +1 -0
- package/dist/modules/multimedia/ImageEditor/hooks/useImageEffects.js +29 -28
- package/dist/modules/multimedia/ImageEditor/hooks/useImageEffects.js.map +1 -0
- package/dist/modules/multimedia/ImageEditor/utils/aggregate.js +10 -9
- package/dist/modules/multimedia/ImageEditor/utils/aggregate.js.map +1 -0
- package/dist/modules/multimedia/ImagePickerWorkspace/ImagePickerWorkspace.d.ts +1 -1
- package/dist/modules/multimedia/ImagePickerWorkspace/ImagePickerWorkspace.js +34 -33
- package/dist/modules/multimedia/ImagePickerWorkspace/ImagePickerWorkspace.js.map +1 -0
- package/dist/modules/multimedia/Linker/ExternalLinker.js +37 -36
- package/dist/modules/multimedia/Linker/ExternalLinker.js.map +1 -0
- package/dist/modules/multimedia/Linker/InternalLinker.d.ts +1 -1
- package/dist/modules/multimedia/Linker/InternalLinker.js +89 -88
- package/dist/modules/multimedia/Linker/InternalLinker.js.map +1 -0
- package/dist/modules/multimedia/LinkerCard/LinkerCard.d.ts +1 -1
- package/dist/modules/multimedia/LinkerCard/LinkerCard.js +32 -31
- package/dist/modules/multimedia/LinkerCard/LinkerCard.js.map +1 -0
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.d.ts +1 -1
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +119 -118
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js.map +1 -0
- package/dist/modules/multimedia/MediaLibrary/MediaLibraryContext.d.ts +2 -2
- package/dist/modules/multimedia/MediaLibrary/MediaLibraryContext.js +9 -8
- package/dist/modules/multimedia/MediaLibrary/MediaLibraryContext.js.map +1 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/Audio.js +16 -15
- package/dist/modules/multimedia/MediaLibrary/innertabs/Audio.js.map +1 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/ExternalLink.js +13 -12
- package/dist/modules/multimedia/MediaLibrary/innertabs/ExternalLink.js.map +1 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/Iframe.js +10 -9
- package/dist/modules/multimedia/MediaLibrary/innertabs/Iframe.js.map +1 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/InternalLink.d.ts +1 -1
- package/dist/modules/multimedia/MediaLibrary/innertabs/InternalLink.js +29 -28
- package/dist/modules/multimedia/MediaLibrary/innertabs/InternalLink.js.map +1 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/Upload.js +23 -22
- package/dist/modules/multimedia/MediaLibrary/innertabs/Upload.js.map +1 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/Video.js +18 -17
- package/dist/modules/multimedia/MediaLibrary/innertabs/Video.js.map +1 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/VideoEmbedder.js +10 -9
- package/dist/modules/multimedia/MediaLibrary/innertabs/VideoEmbedder.js.map +1 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/Workspace.js +17 -16
- package/dist/modules/multimedia/MediaLibrary/innertabs/Workspace.js.map +1 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/index.js +19 -18
- package/dist/modules/multimedia/MediaLibrary/innertabs/index.js.map +1 -0
- package/dist/modules/multimedia/UploadFiles/UploadFiles.d.ts +1 -1
- package/dist/modules/multimedia/UploadFiles/UploadFiles.js +42 -41
- package/dist/modules/multimedia/UploadFiles/UploadFiles.js.map +1 -0
- package/dist/modules/multimedia/VideoEmbed/VideoEmbed.js +60 -59
- package/dist/modules/multimedia/VideoEmbed/VideoEmbed.js.map +1 -0
- package/dist/modules/multimedia/VideoRecorder/VideoRecorder.d.ts +1 -1
- package/dist/modules/multimedia/VideoRecorder/VideoRecorder.js +154 -153
- package/dist/modules/multimedia/VideoRecorder/VideoRecorder.js.map +1 -0
- package/dist/modules/multimedia/Workspace/Workspace.d.ts +1 -1
- package/dist/modules/multimedia/Workspace/Workspace.js +113 -112
- package/dist/modules/multimedia/Workspace/Workspace.js.map +1 -0
- package/dist/multimedia.js +19 -18
- package/dist/multimedia.js.map +1 -0
- package/dist/portal/Header/Badge.js +6 -5
- package/dist/portal/Header/Badge.js.map +1 -0
- package/dist/portal/Header/Header.js +138 -137
- package/dist/portal/Header/Header.js.map +1 -0
- package/dist/portal/Header/NavItem.js +12 -11
- package/dist/portal/Header/NavItem.js.map +1 -0
- package/dist/portal/Header/NavLink.js +15 -14
- package/dist/portal/Header/NavLink.js.map +1 -0
- package/dist/portal/Header/Navbar.js +10 -9
- package/dist/portal/Header/Navbar.js.map +1 -0
- package/dist/portal/Header/NavbarNav.js +10 -9
- package/dist/portal/Header/NavbarNav.js.map +1 -0
- package/dist/portal/Header/WidgetApps.d.ts +1 -1
- package/dist/portal/Header/WidgetApps.js +17 -16
- package/dist/portal/Header/WidgetApps.js.map +1 -0
- package/dist/portal/Help/Help.d.ts +0 -1
- package/dist/portal/Help/Help.js +19 -18
- package/dist/portal/Help/Help.js.map +1 -0
- package/dist/portal/Help/hooks/useHelp.js +64 -63
- package/dist/portal/Help/hooks/useHelp.js.map +1 -0
- package/dist/portal/Layout/Layout.js +36 -35
- package/dist/portal/Layout/Layout.js.map +1 -0
- package/dist/portal/SearchEngine/SearchEngine.js +26 -25
- package/dist/portal/SearchEngine/SearchEngine.js.map +1 -0
- package/dist/utils/MockedDataProvider/MockedDataProvider.d.ts +1 -1
- package/dist/utils/MockedDataProvider/MockedDataProvider.js +22 -21
- package/dist/utils/MockedDataProvider/MockedDataProvider.js.map +1 -0
- package/dist/utils/StringUtils.js +9 -8
- package/dist/utils/StringUtils.js.map +1 -0
- package/dist/utils/addTimestampToUrl.js +5 -4
- package/dist/utils/addTimestampToUrl.js.map +1 -0
- package/dist/utils/blob.js +10 -9
- package/dist/utils/blob.js.map +1 -0
- package/dist/utils/checkUserRight.d.ts +1 -1
- package/dist/utils/checkUserRight.js +28 -27
- package/dist/utils/checkUserRight.js.map +1 -0
- package/dist/utils/fileSize.js +6 -5
- package/dist/utils/fileSize.js.map +1 -0
- package/dist/utils/findTreeNode.js +8 -7
- package/dist/utils/findTreeNode.js.map +1 -0
- package/dist/utils/isActionAvailable.d.ts +1 -1
- package/dist/utils/isActionAvailable.js +5 -4
- package/dist/utils/isActionAvailable.js.map +1 -0
- package/dist/utils/libraryMaps.js +3 -2
- package/dist/utils/libraryMaps.js.map +1 -0
- package/dist/utils/noop.js +3 -2
- package/dist/utils/noop.js.map +1 -0
- package/dist/utils/ref.js +9 -8
- package/dist/utils/ref.js.map +1 -0
- package/dist/utils/thumbnail.js +4 -3
- package/dist/utils/thumbnail.js.map +1 -0
- package/dist/utils/time.js +8 -7
- package/dist/utils/time.js.map +1 -0
- package/dist/utils/treeview.d.ts +1 -1
- package/dist/utils/treeview.js +97 -96
- package/dist/utils/treeview.js.map +1 -0
- package/dist/utils/video.js +3 -2
- package/dist/utils/video.js.map +1 -0
- package/dist/widgets/BookmarkedApps/BookmarkedApps.d.ts +1 -1
- package/dist/widgets/BookmarkedApps/BookmarkedApps.js +7 -6
- package/dist/widgets/BookmarkedApps/BookmarkedApps.js.map +1 -0
- package/dist/widgets/Widget/Widget.js +19 -18
- package/dist/widgets/Widget/Widget.js.map +1 -0
- package/package.json +19 -28
|
@@ -1,155 +1,156 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { getApplicationScale } from "./misc.js";
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
return "CROP_CORNER_" +
|
|
1
|
+
import * as d from "pixi.js";
|
|
2
|
+
import { getApplicationScale as _ } from "./misc.js";
|
|
3
|
+
const B = ["TOP_LEFT", "TOP_RIGHT", "BOTTOM_LEFT", "BOTTOM_RIGHT"], u = 0, R = 20, y = "CROP_BACKGROUND_NAME", a = "CROP_MASK_NAME";
|
|
4
|
+
function x(e) {
|
|
5
|
+
return "CROP_CORNER_" + e;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
spriteName
|
|
7
|
+
function v(e, {
|
|
8
|
+
spriteName: t
|
|
9
9
|
}) {
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
10
|
+
P(e);
|
|
11
|
+
const r = e.stage.getChildByName(t);
|
|
12
|
+
if (r == null) return;
|
|
13
|
+
const n = r.getBounds(), i = e.renderer.generateTexture(e.stage).clone(), s = new d.Sprite(i);
|
|
14
|
+
s.height = n.height, s.width = n.width, s.position = new d.Point(0, 0);
|
|
15
|
+
const o = new d.Graphics();
|
|
16
|
+
o.beginFill(16777215, 0.5), o.drawRect(0, 0, n.width, n.height), o.endFill(), o.name = y, o.position = new d.Point(n.x, n.y);
|
|
17
|
+
const g = new d.Graphics();
|
|
18
|
+
g.beginFill(0, 1), g.drawRect(0, 0, n.width - 2 * u, n.height - 2 * u), g.endFill(), g.position = new d.Point(u, u), g.name = a, s.mask = g, e.stage.addChild(o), o.addChild(g), o.addChild(s);
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
const
|
|
22
|
-
|
|
20
|
+
function P(e) {
|
|
21
|
+
const t = e.stage.getChildByName(y, !0);
|
|
22
|
+
t == null || t.removeFromParent();
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
switch (
|
|
24
|
+
function f(e, t) {
|
|
25
|
+
switch (e) {
|
|
26
26
|
case "TOP_LEFT":
|
|
27
27
|
return {
|
|
28
|
-
x:
|
|
29
|
-
y:
|
|
28
|
+
x: t.x,
|
|
29
|
+
y: t.y,
|
|
30
30
|
start: 0,
|
|
31
31
|
end: Math.PI / 2
|
|
32
32
|
};
|
|
33
33
|
case "TOP_RIGHT":
|
|
34
34
|
return {
|
|
35
|
-
x:
|
|
36
|
-
y:
|
|
35
|
+
x: t.x + t.width,
|
|
36
|
+
y: t.y,
|
|
37
37
|
start: Math.PI / 2,
|
|
38
38
|
end: Math.PI
|
|
39
39
|
};
|
|
40
40
|
case "BOTTOM_LEFT":
|
|
41
41
|
return {
|
|
42
|
-
x:
|
|
43
|
-
y:
|
|
42
|
+
x: t.x,
|
|
43
|
+
y: t.y + t.height,
|
|
44
44
|
start: 3 * Math.PI / 2,
|
|
45
45
|
end: 2 * Math.PI
|
|
46
46
|
};
|
|
47
47
|
case "BOTTOM_RIGHT":
|
|
48
48
|
return {
|
|
49
|
-
x:
|
|
50
|
-
y:
|
|
49
|
+
x: t.x + t.width,
|
|
50
|
+
y: t.y + t.height,
|
|
51
51
|
start: Math.PI,
|
|
52
52
|
end: 3 * Math.PI / 2
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
61
|
-
const
|
|
62
|
-
height:
|
|
63
|
-
width:
|
|
64
|
-
x:
|
|
65
|
-
y:
|
|
56
|
+
function I(e) {
|
|
57
|
+
const t = e.stage.getChildByName(a, !0);
|
|
58
|
+
t != null && B.forEach((r) => {
|
|
59
|
+
const n = e.stage.getChildByName(x(r), !0);
|
|
60
|
+
if (n == null) return;
|
|
61
|
+
const i = f(r, {
|
|
62
|
+
height: t.height,
|
|
63
|
+
width: t.width,
|
|
64
|
+
x: t.x,
|
|
65
|
+
y: t.y
|
|
66
66
|
});
|
|
67
|
-
|
|
67
|
+
n.position = new d.Point(i.x, i.y);
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
spriteName
|
|
70
|
+
function l(e, t, {
|
|
71
|
+
spriteName: r
|
|
72
72
|
}) {
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
73
|
+
const n = e.stage.getChildByName(x(t), !0), i = _(e);
|
|
74
|
+
n == null || n.removeFromParent();
|
|
75
|
+
const s = e.stage.getChildByName(y, !0), o = e.stage.getChildByName(a, !0), g = e.stage.getChildByName(r);
|
|
76
|
+
if (g == null || s === null || s === void 0 || o === void 0 || o === null)
|
|
77
77
|
return;
|
|
78
|
-
const
|
|
79
|
-
height:
|
|
80
|
-
width:
|
|
81
|
-
x:
|
|
82
|
-
y:
|
|
83
|
-
}),
|
|
84
|
-
|
|
85
|
-
let
|
|
86
|
-
|
|
87
|
-
if (
|
|
88
|
-
const
|
|
89
|
-
|
|
78
|
+
const c = f(t, {
|
|
79
|
+
height: o.height,
|
|
80
|
+
width: o.width,
|
|
81
|
+
x: o.x,
|
|
82
|
+
y: o.y
|
|
83
|
+
}), h = new d.Graphics();
|
|
84
|
+
h.beginFill(4960213, 1), h.arc(0, 0, R / i, c.start, c.end), h.lineTo(0, 0), h.endFill(), h.position = new d.Point(c.x, c.y), h.name = x(t), h.interactive = !0;
|
|
85
|
+
let T = !1;
|
|
86
|
+
e.stage.on("pointermove", (M) => {
|
|
87
|
+
if (T === !1) return;
|
|
88
|
+
const w = s.toLocal(M.global);
|
|
89
|
+
h.position.x = w.x, h.position.y = w.y, E(e, t, w);
|
|
90
90
|
});
|
|
91
|
-
const
|
|
92
|
-
|
|
91
|
+
const C = () => {
|
|
92
|
+
T = !0;
|
|
93
93
|
};
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
|
|
94
|
+
h.on("pointerdown", C);
|
|
95
|
+
const O = () => {
|
|
96
|
+
T = !1;
|
|
97
97
|
};
|
|
98
|
-
globalThis.addEventListener("pointerup",
|
|
99
|
-
|
|
100
|
-
}),
|
|
98
|
+
globalThis.addEventListener("pointerup", O), h.once("destroyed", () => {
|
|
99
|
+
h.off("pointerdown"), globalThis.removeEventListener("pointerup", O);
|
|
100
|
+
}), s.addChild(h);
|
|
101
101
|
}
|
|
102
|
-
function
|
|
103
|
-
const
|
|
104
|
-
if (
|
|
105
|
-
const
|
|
106
|
-
switch (
|
|
102
|
+
function E(e, t, r) {
|
|
103
|
+
const n = e.stage.getChildByName(a, !0);
|
|
104
|
+
if (n == null) return;
|
|
105
|
+
const i = n.position.x + n.width, s = n.position.y + n.height;
|
|
106
|
+
switch (t) {
|
|
107
107
|
case "TOP_LEFT": {
|
|
108
|
-
|
|
108
|
+
n.position.x = r.x, n.position.y = r.y, n.width = i - r.x, n.height = s - r.y;
|
|
109
109
|
break;
|
|
110
110
|
}
|
|
111
111
|
case "TOP_RIGHT": {
|
|
112
|
-
|
|
112
|
+
n.position.y = r.y, n.width = r.x - n.position.x, n.height = s - r.y;
|
|
113
113
|
break;
|
|
114
114
|
}
|
|
115
115
|
case "BOTTOM_LEFT": {
|
|
116
|
-
|
|
116
|
+
n.position.x = r.x, n.width = i - r.x, n.height = r.y - n.position.y;
|
|
117
117
|
break;
|
|
118
118
|
}
|
|
119
119
|
case "BOTTOM_RIGHT": {
|
|
120
|
-
|
|
120
|
+
n.width = r.x - n.position.x, n.height = r.y - n.position.y;
|
|
121
121
|
break;
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
|
|
124
|
+
I(e);
|
|
125
125
|
}
|
|
126
|
-
function
|
|
127
|
-
spriteName
|
|
126
|
+
function k(e, {
|
|
127
|
+
spriteName: t
|
|
128
128
|
}) {
|
|
129
|
-
|
|
130
|
-
spriteName
|
|
131
|
-
}),
|
|
132
|
-
spriteName
|
|
133
|
-
}),
|
|
134
|
-
spriteName
|
|
135
|
-
}),
|
|
136
|
-
spriteName
|
|
137
|
-
}),
|
|
138
|
-
spriteName
|
|
129
|
+
m(e), e.stage.interactive = !0, e.stage.interactiveChildren = !0, v(e, {
|
|
130
|
+
spriteName: t
|
|
131
|
+
}), l(e, "BOTTOM_LEFT", {
|
|
132
|
+
spriteName: t
|
|
133
|
+
}), l(e, "BOTTOM_RIGHT", {
|
|
134
|
+
spriteName: t
|
|
135
|
+
}), l(e, "TOP_LEFT", {
|
|
136
|
+
spriteName: t
|
|
137
|
+
}), l(e, "TOP_RIGHT", {
|
|
138
|
+
spriteName: t
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
|
-
function
|
|
142
|
-
|
|
141
|
+
function m(e) {
|
|
142
|
+
P(e), e.stage.off("pointermove"), e.render();
|
|
143
143
|
}
|
|
144
|
-
function
|
|
145
|
-
const
|
|
146
|
-
if (
|
|
147
|
-
|
|
148
|
-
const
|
|
149
|
-
return new
|
|
144
|
+
function F(e) {
|
|
145
|
+
const t = e.stage.getChildByName(a, !0);
|
|
146
|
+
if (t == null) return;
|
|
147
|
+
m(e);
|
|
148
|
+
const r = e.renderer.generateTexture(e.stage).clone(), n = new d.Sprite(r), i = t.getBounds(), s = new d.Rectangle(Math.floor(i.x), Math.floor(i.y), Math.floor(i.width), Math.floor(i.height)), o = new d.Texture(n.texture.baseTexture, s);
|
|
149
|
+
return new d.Sprite(o);
|
|
150
150
|
}
|
|
151
151
|
export {
|
|
152
|
-
save,
|
|
153
|
-
start,
|
|
154
|
-
stop
|
|
152
|
+
F as save,
|
|
153
|
+
k as start,
|
|
154
|
+
m as stop
|
|
155
155
|
};
|
|
156
|
+
//# sourceMappingURL=crop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crop.js","sources":["../../../../../src/modules/multimedia/ImageEditor/effects/crop.ts"],"sourcesContent":["import * as PIXI from 'pixi.js';\n\nimport { getApplicationScale } from './misc';\n\n//\n// Global constants used for crop effects\n//\n\n// Union type to identify corners\nexport type CornerType =\n | 'TOP_LEFT'\n | 'TOP_RIGHT'\n | 'BOTTOM_LEFT'\n | 'BOTTOM_RIGHT';\n// List of available corners\nconst CORNERS: Array<CornerType> = [\n 'TOP_LEFT',\n 'TOP_RIGHT',\n 'BOTTOM_LEFT',\n 'BOTTOM_RIGHT',\n];\n// Define initial padding (pixel) between anchors and image corners\nconst PADDING = 0;\n// Define the radius (pixel) of the corner control\nconst POINT_RADIUS = 20;\n// Define the name of the background backdrop applied while we are cropping\nconst CROP_BACKGROUND_NAME = 'CROP_BACKGROUND_NAME';\n// Define the name of the mask (crop) applied to the final image\nconst CROP_MASK_NAME = 'CROP_MASK_NAME';\n\n//\n// Implementation\n//\n\n/**\n * This function generate names for corner objects\n * @param corner COrnerType identifying one corner\n * @returns A name identifying the corner object\n */\nfunction getCornerName(corner: CornerType) {\n return 'CROP_CORNER_' + corner;\n}\n/**\n * This function draw background having:\n * - a backdrop with 0.5 opacity over the initial image\n * - a duplicate texture of the initial stage\n * - a rectangle/mask applied to the cloned texture\n *\n * If the sprite does not exists in this context this function do nothing\n *\n * @param application The PIXI.Application context\n * @param {spriteName:string} {spriteName} The name of the sprite in the context\n */\nfunction drawBackground(\n application: PIXI.Application,\n { spriteName }: { spriteName: string },\n): void {\n removeBackground(application);\n const sprite = application.stage.getChildByName(\n spriteName,\n ) as PIXI.Sprite | null;\n if (sprite === null || sprite === undefined) return;\n const spriteBounds = sprite.getBounds();\n // Clone the stage\n const stageTexture = application.renderer\n .generateTexture(application.stage)\n .clone();\n const clonedStage = new PIXI.Sprite(stageTexture);\n clonedStage.height = spriteBounds.height;\n clonedStage.width = spriteBounds.width;\n clonedStage.position = new PIXI.Point(0, 0);\n // Draw the background\n const background = new PIXI.Graphics();\n background.beginFill(0xffffff, 0.5);\n background.drawRect(0, 0, spriteBounds.width, spriteBounds.height);\n background.endFill();\n background.name = CROP_BACKGROUND_NAME;\n background.position = new PIXI.Point(spriteBounds.x, spriteBounds.y);\n // Draw the mask to apply to the cloned stage\n const rectMask = new PIXI.Graphics();\n rectMask.beginFill(0x000000, 1);\n rectMask.drawRect(\n 0,\n 0,\n spriteBounds.width - 2 * PADDING,\n spriteBounds.height - 2 * PADDING,\n );\n rectMask.endFill();\n rectMask.position = new PIXI.Point(PADDING, PADDING);\n rectMask.name = CROP_MASK_NAME;\n // Apply the mask to the cloned stage and add children\n clonedStage.mask = rectMask;\n application.stage.addChild(background);\n background.addChild(rectMask);\n background.addChild(clonedStage);\n}\n/**\n * This function remove the background with all his children (corners, backdrop and cloned stage)\n * If the background does not exists this function do nothing\n *\n * @param application The PIXI.Application context\n */\nfunction removeBackground(application: PIXI.Application): void {\n const child = application.stage.getChildByName(CROP_BACKGROUND_NAME, true);\n child?.removeFromParent();\n}\n/**\n * This function compute coordinate (x,y) and angles (start,end) of a corner according to the CornerType\n * - (x,y) are coordinate of the corner in pixel relative to the parent\n * - (start, end) are angles between 0 and 2PI used to draw the corner relative using the Arc tool\n *\n * @param cornerType a CornerType for which we want to compute angles and coordinates\n * @param bounds bounds of the Cropped Texture (which is also the parent of the corner)\n * @returns the coordinates and the angles\n */\nfunction computeCornerPosition(\n cornerType: CornerType,\n bounds: { x: number; y: number; width: number; height: number },\n): { x: number; y: number; start: number; end: number } {\n switch (cornerType) {\n case 'TOP_LEFT': {\n return { x: bounds.x, y: bounds.y, start: 0, end: Math.PI / 2 };\n }\n case 'TOP_RIGHT': {\n return {\n x: bounds.x + bounds.width,\n y: bounds.y,\n start: Math.PI / 2,\n end: Math.PI,\n };\n }\n case 'BOTTOM_LEFT': {\n return {\n x: bounds.x,\n y: bounds.y + bounds.height,\n start: (3 * Math.PI) / 2,\n end: 2 * Math.PI,\n };\n }\n case 'BOTTOM_RIGHT': {\n return {\n x: bounds.x + bounds.width,\n y: bounds.y + bounds.height,\n start: Math.PI,\n end: (3 * Math.PI) / 2,\n };\n }\n }\n}\n/**\n * This function reposition all corners according the bounds of the mask\n * If the mask has not been found in this context this function do nothing\n *\n * @param application The PIXI.Application context\n */\nfunction refreshCorners(application: PIXI.Application): void {\n const mask = application.stage.getChildByName(\n CROP_MASK_NAME,\n true,\n ) as PIXI.Graphics | null;\n if (mask === undefined || mask === null) return;\n CORNERS.forEach((cornerType) => {\n const corner = application.stage.getChildByName(\n getCornerName(cornerType),\n true,\n );\n if (corner === undefined || corner === null) return;\n const position = computeCornerPosition(cornerType, {\n height: mask.height,\n width: mask.width,\n x: mask.x,\n y: mask.y,\n });\n corner.position = new PIXI.Point(position.x, position.y);\n });\n}\n/**\n * This function draw one corner according to his type.\n * It also binds mouse events to move mask according when the corner move\n *\n * @param application The PIXI.Application context\n * @param cornerType The cornerType identifying the corner we are drawing\n * @param { spriteName:string } {spriteName} The sprite name identifying the original image\n */\nfunction drawCorner(\n application: PIXI.Application,\n cornerType: CornerType,\n { spriteName }: { spriteName: string },\n): void {\n // Delete corner if exists before redrawing\n const previous = application.stage.getChildByName(\n getCornerName(cornerType),\n true,\n );\n const scale = getApplicationScale(application);\n previous?.removeFromParent();\n // Search for background\n const background = application.stage.getChildByName(\n CROP_BACKGROUND_NAME,\n true,\n ) as PIXI.Graphics | null;\n // Search for mask\n const mask = application.stage.getChildByName(\n CROP_MASK_NAME,\n true,\n ) as PIXI.Graphics | null;\n // Search for sprite\n const sprite = application.stage.getChildByName(\n spriteName,\n ) as PIXI.Sprite | null;\n if (\n sprite === null ||\n sprite === undefined ||\n background === null ||\n background === undefined ||\n mask === undefined ||\n mask === null\n ) {\n return;\n }\n // Compute corner position\n const position = computeCornerPosition(cornerType, {\n height: mask.height,\n width: mask.width,\n x: mask.x,\n y: mask.y,\n });\n //Draw corner\n const corner = new PIXI.Graphics();\n corner.beginFill(0x4bafd5, 1);\n corner.arc(0, 0, POINT_RADIUS / scale, position.start, position.end);\n corner.lineTo(0, 0);\n corner.endFill();\n corner.position = new PIXI.Point(position.x, position.y);\n corner.name = getCornerName(cornerType);\n corner.interactive = true;\n // Add mouse event move => on corner move redraw mask\n let enable = false;\n application.stage.on('pointermove', (event: PIXI.FederatedMouseEvent) => {\n if (enable === false) return;\n const localPosition = background.toLocal(event.global);\n corner.position.x = localPosition.x;\n corner.position.y = localPosition.y;\n moveMask(application, cornerType, localPosition);\n });\n // Add mouse down event => on pointer down start moving mask\n const handlePointerDown = () => {\n enable = true;\n };\n corner.on('pointerdown', handlePointerDown);\n // Add mouse up event => on pointer down stop moving mask\n const handlePointerUp = () => {\n enable = false;\n };\n globalThis.addEventListener('pointerup', handlePointerUp);\n // Remove listeners when corner destroyed\n corner.once('destroyed', () => {\n // cancel listener\n corner.off('pointerdown');\n globalThis.removeEventListener('pointerup', handlePointerUp);\n });\n // Add corner\n background.addChild(corner);\n}\n/**\n * This function move the rectangle mask used to crop the image\n * If the mask does not exists in this context the function do nothing\n *\n * @param application the PIXI.Application context\n * @param cornerType The cornerType identifying the corner that changed position\n * @param position The coordinate (x,y) of the corner that moved\n */\nfunction moveMask(\n application: PIXI.Application,\n cornerType: CornerType,\n position: { x: number; y: number },\n): void {\n const mask = application.stage.getChildByName(\n CROP_MASK_NAME,\n true,\n ) as PIXI.Graphics | null;\n if (mask === undefined || mask === null) return;\n const right = mask.position.x + mask.width;\n const bottom = mask.position.y + mask.height;\n switch (cornerType) {\n case 'TOP_LEFT': {\n mask.position.x = position.x;\n mask.position.y = position.y;\n mask.width = right - position.x;\n mask.height = bottom - position.y;\n break;\n }\n case 'TOP_RIGHT': {\n mask.position.y = position.y;\n mask.width = position.x - mask.position.x;\n mask.height = bottom - position.y;\n break;\n }\n case 'BOTTOM_LEFT': {\n mask.position.x = position.x;\n mask.width = right - position.x;\n mask.height = position.y - mask.position.y;\n break;\n }\n case 'BOTTOM_RIGHT': {\n mask.width = position.x - mask.position.x;\n mask.height = position.y - mask.position.y;\n break;\n }\n }\n refreshCorners(application);\n}\n/**\n * This function draw all graphics controls used to crop an image:\n * - 4 corners to select the cropped area\n * - A background with an transparent backdrop effect\n * - A mask applied to the original image\n *\n * @param application The PIXI.Application context\n * @param {spriteName:string} {spriteName} The sprite name identifying the original image\n */\nexport function start(\n application: PIXI.Application,\n { spriteName }: { spriteName: string },\n): void {\n // Remove controls before redrawing if exists\n stop(application);\n application.stage.interactive = true;\n application.stage.interactiveChildren = true;\n drawBackground(application, { spriteName });\n drawCorner(application, 'BOTTOM_LEFT', { spriteName });\n drawCorner(application, 'BOTTOM_RIGHT', { spriteName });\n drawCorner(application, 'TOP_LEFT', { spriteName });\n drawCorner(application, 'TOP_RIGHT', { spriteName });\n}\n/**\n * This function remove all graphics controls if exists. And it also remove any mouse event on this stage\n *\n * @param application The PIXI.Application context\n */\nexport function stop(application: PIXI.Application) {\n removeBackground(application);\n application.stage.off('pointermove');\n application.render();\n}\n/**\n * This function apply a crop to the imageSrc and return the result as a PIXI.Sprite object\n *\n * @param application\n * @param imageSrc a string URI of the image to crop\n * @returns a PIXI.Sprite with a imageSrc cropped or undefined if the image has not been cropped\n */\nexport function save(application: PIXI.Application): PIXI.Sprite | undefined {\n // Search for mask in this context\n const mask = application.stage.getChildByName(\n CROP_MASK_NAME,\n true,\n ) as PIXI.Graphics | null;\n // Stop if mask does not exists\n if (mask === undefined || mask === null) return;\n // Remove controls before cloning stage\n stop(application);\n // Clone stage\n const stageTexture = application.renderer\n .generateTexture(application.stage)\n .clone();\n const clonedStage = new PIXI.Sprite(stageTexture);\n // Compute bounds and round lower to avoid overflow\n const maskBounds = mask.getBounds();\n const bounds = new PIXI.Rectangle(\n Math.floor(maskBounds.x),\n Math.floor(maskBounds.y),\n Math.floor(maskBounds.width),\n Math.floor(maskBounds.height),\n );\n // Apply crop to the cloned stage\n const cropped = new PIXI.Texture(clonedStage.texture.baseTexture, bounds);\n const sprite = new PIXI.Sprite(cropped);\n return sprite;\n}\n"],"names":["CORNERS","PADDING","POINT_RADIUS","CROP_BACKGROUND_NAME","CROP_MASK_NAME","getCornerName","corner","drawBackground","application","spriteName","removeBackground","sprite","stage","getChildByName","spriteBounds","getBounds","stageTexture","renderer","generateTexture","clone","clonedStage","PIXI","Sprite","height","width","position","Point","background","Graphics","beginFill","drawRect","endFill","name","x","y","rectMask","mask","addChild","child","removeFromParent","computeCornerPosition","cornerType","bounds","start","end","Math","PI","refreshCorners","forEach","drawCorner","previous","scale","getApplicationScale","undefined","arc","lineTo","interactive","enable","on","event","localPosition","toLocal","global","handlePointerDown","handlePointerUp","addEventListener","once","off","removeEventListener","moveMask","right","bottom","stop","interactiveChildren","render","save","maskBounds","Rectangle","floor","cropped","Texture","texture","baseTexture"],"mappings":";;AAeA,MAAMA,IAA6B,CACjC,YACA,aACA,eACA,cAAc,GAGVC,IAAU,GAEVC,IAAe,IAEfC,IAAuB,wBAEvBC,IAAiB;AAWvB,SAASC,EAAcC,GAAoB;AACzC,SAAO,iBAAiBA;AAC1B;AAYA,SAASC,EACPC,GACA;AAAA,EAAEC,YAAAA;AAAmC,GAC/B;AACNC,EAAAA,EAAiBF,CAAW;AAC5B,QAAMG,IAASH,EAAYI,MAAMC,eAC/BJ,CACF;AACIE,MAAAA,KAAW,KAA8B;AACvCG,QAAAA,IAAeH,EAAOI,aAEtBC,IAAeR,EAAYS,SAC9BC,gBAAgBV,EAAYI,KAAK,EACjCO,SACGC,IAAc,IAAIC,EAAKC,OAAON,CAAY;AAChDI,EAAAA,EAAYG,SAAST,EAAaS,QAClCH,EAAYI,QAAQV,EAAaU,OACjCJ,EAAYK,WAAW,IAAIJ,EAAKK,MAAM,GAAG,CAAC;AAEpCC,QAAAA,IAAa,IAAIN,EAAKO;AACjBC,EAAAA,EAAAA,UAAU,UAAU,GAAG,GAClCF,EAAWG,SAAS,GAAG,GAAGhB,EAAaU,OAAOV,EAAaS,MAAM,GACjEI,EAAWI,QAAQ,GACnBJ,EAAWK,OAAO7B,GAClBwB,EAAWF,WAAW,IAAIJ,EAAKK,MAAMZ,EAAamB,GAAGnB,EAAaoB,CAAC;AAE7DC,QAAAA,IAAW,IAAId,EAAKO;AACjBC,EAAAA,EAAAA,UAAU,GAAU,CAAC,GACrBC,EAAAA,SACP,GACA,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E3E,QAAM4B,IAAO5B,EAAYI,MAAMC,eAC7BT,GACA,EACF;AAEIgC,MAAsBA,KAAS,KAAM;AAEzCoC,EAAAA,EAAKhE,CAAW;AAEhB,QAAMQ,IAAeR,EAAYS,SAC9BC,gBAAgBV,EAAYI,KAAK,EACjCO,SACGC,IAAc,IAAIC,EAAKC,OAAON,CAAY,GAE1C4D,IAAaxC,EAAKrB,aAClB2B,IAAS,IAAIrB,EAAKwD,UACtBhC,KAAKiC,MAAMF,EAAW3C,CAAC,GACvBY,KAAKiC,MAAMF,EAAW1C,CAAC,GACvBW,KAAKiC,MAAMF,EAAWpD,KAAK,GAC3BqB,KAAKiC,MAAMF,EAAWrD,MAAM,CAC9B,GAEMwD,IAAU,IAAI1D,EAAK2D,QAAQ5D,EAAY6D,QAAQC,aAAaxC,CAAM;AAEjE/B,SADQ,IAAIU,EAAKC,OAAOyD,CAAO;AAExC;"}
|
|
@@ -1,162 +1,163 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
spriteName,
|
|
5
|
-
imgDatasource,
|
|
6
|
-
settings
|
|
1
|
+
import * as d from "pixi.js";
|
|
2
|
+
const u = 100, x = 100, y = 450, I = 64, A = 0.5, R = "image";
|
|
3
|
+
function z(e, {
|
|
4
|
+
spriteName: t,
|
|
5
|
+
imgDatasource: i,
|
|
6
|
+
settings: h
|
|
7
7
|
}) {
|
|
8
|
-
const
|
|
9
|
-
return
|
|
10
|
-
|
|
11
|
-
await
|
|
12
|
-
spriteName,
|
|
13
|
-
imgDatasource:
|
|
14
|
-
settings
|
|
8
|
+
const s = URL.createObjectURL(i), o = new Image();
|
|
9
|
+
return o.src = s, new Promise((n) => {
|
|
10
|
+
o.onload = async () => {
|
|
11
|
+
await T(e, {
|
|
12
|
+
spriteName: t,
|
|
13
|
+
imgDatasource: o,
|
|
14
|
+
settings: h
|
|
15
15
|
});
|
|
16
|
-
const
|
|
17
|
-
|
|
16
|
+
const r = e == null ? void 0 : e.stage.getChildByName(t, !0);
|
|
17
|
+
n(r);
|
|
18
18
|
};
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
async function
|
|
22
|
-
spriteName,
|
|
23
|
-
imgDatasource,
|
|
24
|
-
settings
|
|
21
|
+
async function T(e, {
|
|
22
|
+
spriteName: t,
|
|
23
|
+
imgDatasource: i,
|
|
24
|
+
settings: h
|
|
25
25
|
}) {
|
|
26
|
-
if (
|
|
26
|
+
if (e === void 0 || e.stage === null)
|
|
27
27
|
return;
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
if (
|
|
28
|
+
const s = e.stage.getChildByName(t, !0);
|
|
29
|
+
s == null || s.removeFromParent();
|
|
30
|
+
const o = i instanceof HTMLImageElement ? d.Texture.from(i) : i instanceof d.Sprite ? i : await d.Texture.fromURL(i), n = o instanceof d.Sprite ? o : d.Sprite.from(o, {});
|
|
31
|
+
if (n.interactive = !0, n.name = t, h) {
|
|
32
32
|
const {
|
|
33
33
|
sprite: {
|
|
34
|
-
anchor,
|
|
35
|
-
position,
|
|
36
|
-
scale,
|
|
37
|
-
size:
|
|
38
|
-
rotation
|
|
34
|
+
anchor: r,
|
|
35
|
+
position: g,
|
|
36
|
+
scale: c,
|
|
37
|
+
size: w,
|
|
38
|
+
rotation: f
|
|
39
39
|
},
|
|
40
40
|
stage: {
|
|
41
|
-
size:
|
|
41
|
+
size: m
|
|
42
42
|
}
|
|
43
|
-
} =
|
|
44
|
-
|
|
43
|
+
} = h, a = f % Math.PI !== 0;
|
|
44
|
+
n.anchor.x = r.x, n.anchor.y = r.y, n.position.x = g.x, n.position.y = g.y, n.scale.x = c.x, n.scale.y = c.y, n.width = a ? w.height : w.width, n.height = a ? w.width : w.height, e.stage.height = m.height, e.stage.width = m.width, e.renderer.resize(m.width, m.height), e.stage.addChild(n);
|
|
45
45
|
} else
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
e.stage.addChild(n), e.renderer.resize(n.width, n.height);
|
|
47
|
+
L(e, n);
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
var
|
|
51
|
-
const
|
|
52
|
-
width:
|
|
53
|
-
height:
|
|
49
|
+
function L(e, t) {
|
|
50
|
+
var g;
|
|
51
|
+
const i = e.view.parentNode, h = window.innerWidth - I, s = Math.max((i == null ? void 0 : i.offsetWidth) ?? 0, x), o = v({
|
|
52
|
+
width: t.width,
|
|
53
|
+
height: t.height
|
|
54
54
|
}, {
|
|
55
55
|
width: {
|
|
56
|
-
max: Math.min(
|
|
57
|
-
min:
|
|
56
|
+
max: Math.min(s, h),
|
|
57
|
+
min: x
|
|
58
58
|
},
|
|
59
59
|
height: {
|
|
60
|
-
min:
|
|
61
|
-
max: window.innerHeight -
|
|
60
|
+
min: u,
|
|
61
|
+
max: window.innerHeight - y
|
|
62
62
|
}
|
|
63
63
|
}), {
|
|
64
|
-
height:
|
|
65
|
-
width:
|
|
66
|
-
} =
|
|
67
|
-
(
|
|
64
|
+
height: n,
|
|
65
|
+
width: r
|
|
66
|
+
} = o;
|
|
67
|
+
(g = e.view) != null && g.style && (e.view.style.width = `${r}px`, e.view.style.height = `${n}px`);
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function v(e, t) {
|
|
70
70
|
const {
|
|
71
|
-
height,
|
|
72
|
-
width
|
|
73
|
-
} =
|
|
74
|
-
height:
|
|
75
|
-
width:
|
|
76
|
-
} =
|
|
77
|
-
let
|
|
78
|
-
return
|
|
79
|
-
width:
|
|
80
|
-
height:
|
|
71
|
+
height: i,
|
|
72
|
+
width: h
|
|
73
|
+
} = e, s = h / i, {
|
|
74
|
+
height: o,
|
|
75
|
+
width: n
|
|
76
|
+
} = t;
|
|
77
|
+
let r = n.max, g = n.max / s;
|
|
78
|
+
return h > n.max && (r = n.max, g = r / s), g > o.max && (g = o.max, r = g * s), r < n.min && (r = n.min, g = r / s), g < o.min && (g = o.min, r = g * s), {
|
|
79
|
+
width: r,
|
|
80
|
+
height: g
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
return new Promise((
|
|
85
|
-
var
|
|
86
|
-
(
|
|
87
|
-
|
|
88
|
-
}, "image/jpeg",
|
|
83
|
+
function E(e) {
|
|
84
|
+
return new Promise((t, i) => {
|
|
85
|
+
var h;
|
|
86
|
+
(h = e == null ? void 0 : e.view) != null && h.toBlob ? e.view.toBlob((s) => {
|
|
87
|
+
s ? t(s) : i("EXTRACT_FAILED");
|
|
88
|
+
}, "image/jpeg", A) : i("EXTRACT_FAILED");
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
var
|
|
93
|
-
return (
|
|
91
|
+
function S(e) {
|
|
92
|
+
var t, i;
|
|
93
|
+
return (i = (t = e.view).toDataURL) == null ? void 0 : i.call(t);
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
return
|
|
95
|
+
function _(e) {
|
|
96
|
+
return e.view.getBoundingClientRect ? e.view.getBoundingClientRect().width / e.view.width : 1;
|
|
97
97
|
}
|
|
98
|
-
function
|
|
99
|
-
return new Promise((
|
|
100
|
-
var
|
|
101
|
-
(
|
|
102
|
-
|
|
98
|
+
function B(e) {
|
|
99
|
+
return new Promise((t, i) => {
|
|
100
|
+
var h, s;
|
|
101
|
+
(s = (h = e.view).toBlob) == null || s.call(h, (o) => {
|
|
102
|
+
o ? t(o) : i("EXTRACT_FAIL");
|
|
103
103
|
}, "image/png", 1);
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
application,
|
|
108
|
-
sprite
|
|
106
|
+
function C({
|
|
107
|
+
application: e,
|
|
108
|
+
sprite: t
|
|
109
109
|
}) {
|
|
110
110
|
return {
|
|
111
111
|
sprite: {
|
|
112
|
-
rotation:
|
|
112
|
+
rotation: t.rotation,
|
|
113
113
|
size: {
|
|
114
|
-
width:
|
|
115
|
-
height:
|
|
114
|
+
width: t.width,
|
|
115
|
+
height: t.height
|
|
116
116
|
},
|
|
117
117
|
position: {
|
|
118
|
-
x:
|
|
119
|
-
y:
|
|
118
|
+
x: t.position.x,
|
|
119
|
+
y: t.position.y
|
|
120
120
|
},
|
|
121
121
|
scale: {
|
|
122
|
-
x:
|
|
123
|
-
y:
|
|
122
|
+
x: t.scale.x,
|
|
123
|
+
y: t.scale.y
|
|
124
124
|
},
|
|
125
125
|
anchor: {
|
|
126
|
-
x:
|
|
127
|
-
y:
|
|
126
|
+
x: t.anchor.x,
|
|
127
|
+
y: t.anchor.y
|
|
128
128
|
}
|
|
129
129
|
},
|
|
130
130
|
stage: {
|
|
131
131
|
size: {
|
|
132
|
-
width:
|
|
133
|
-
height:
|
|
132
|
+
width: e.stage.width,
|
|
133
|
+
height: e.stage.height
|
|
134
134
|
},
|
|
135
135
|
scale: {
|
|
136
|
-
x:
|
|
137
|
-
y:
|
|
136
|
+
x: e.stage.scale.x,
|
|
137
|
+
y: e.stage.scale.y
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
|
-
function
|
|
143
|
-
application,
|
|
144
|
-
sprite,
|
|
145
|
-
newHeight,
|
|
146
|
-
newWidth
|
|
142
|
+
function D({
|
|
143
|
+
application: e,
|
|
144
|
+
sprite: t,
|
|
145
|
+
newHeight: i,
|
|
146
|
+
newWidth: h
|
|
147
147
|
}) {
|
|
148
|
-
|
|
148
|
+
t.anchor.x = 0.5, t.anchor.y = 0.5, t.position = new d.Point(h / 2, i / 2), e.stage.height = i, e.stage.width = h, e.renderer.resize(h, i);
|
|
149
149
|
}
|
|
150
150
|
export {
|
|
151
|
-
DEFAULT_SPRITE_NAME,
|
|
152
|
-
autoResize,
|
|
153
|
-
constraintSize,
|
|
154
|
-
createImageSettings,
|
|
155
|
-
getApplicationScale,
|
|
156
|
-
resizeStage,
|
|
157
|
-
saveAsBlob,
|
|
158
|
-
saveAsDataURL,
|
|
159
|
-
toBlob,
|
|
160
|
-
updateImage,
|
|
161
|
-
updateImageFromBlob
|
|
151
|
+
R as DEFAULT_SPRITE_NAME,
|
|
152
|
+
L as autoResize,
|
|
153
|
+
v as constraintSize,
|
|
154
|
+
C as createImageSettings,
|
|
155
|
+
_ as getApplicationScale,
|
|
156
|
+
D as resizeStage,
|
|
157
|
+
E as saveAsBlob,
|
|
158
|
+
S as saveAsDataURL,
|
|
159
|
+
B as toBlob,
|
|
160
|
+
T as updateImage,
|
|
161
|
+
z as updateImageFromBlob
|
|
162
162
|
};
|
|
163
|
+
//# sourceMappingURL=misc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"misc.js","sources":["../../../../../src/modules/multimedia/ImageEditor/effects/misc.ts"],"sourcesContent":["import * as PIXI from 'pixi.js';\n\n// Define (in pixel) the minimal height the sprite should have\nconst MIN_HEIGHT = 100;\n// Define (in pixel) the minimal width the sprite should have\nconst MIN_WIDTH = 100;\n// Modal padding\nconst MODAL_VERTICAL_PADDING = 450;\nconst MODAL_HORIZONTAL_PADDING = 64;\n\n// Using canvas to download the image increase the file size so to keep the same we need to apply a quality\nconst DEFAULT_QUALITY = 0.5;\n\n// Define the default name of the sprite in the PIXI.Application context\nexport const DEFAULT_SPRITE_NAME = 'image';\n\n/**\n * A structure that define all setting of an image\n * - positon\n * - scale\n * - size\n * - size of the stage\n */\nexport interface ImageSettings {\n stage: {\n size: { width: number; height: number };\n scale: { x: number; y: number };\n };\n sprite: {\n rotation: number;\n size: { width: number; height: number };\n scale: { x: number; y: number };\n position: { x: number; y: number };\n anchor: { x: number; y: number };\n };\n}\n/**\n * This function update the image content using Blob datasource\n *\n * @param application the PIXI.Application context\n * @param param.spriteName the name of the sprite in the context\n * @param param.imgDatasource the img data could be one of: string url, HTMLImageElement, PIXI.Sprite\n * @param param.stageSize?: { width: number; height: number };\n * @param param.spriteSize?: { width: number; height: number };\n */\nexport function updateImageFromBlob(\n application: PIXI.Application,\n {\n spriteName,\n imgDatasource,\n settings,\n }: {\n spriteName: string;\n imgDatasource: Blob;\n settings?: ImageSettings;\n },\n): Promise<PIXI.Sprite | null> {\n const imageUrl = URL.createObjectURL(imgDatasource);\n const image = new Image();\n image.src = imageUrl;\n return new Promise<PIXI.Sprite | null>((resolve) => {\n image.onload = async () => {\n await updateImage(application, {\n spriteName,\n imgDatasource: image,\n settings,\n });\n\n // get new sprite\n const newSprite = application?.stage.getChildByName(\n spriteName,\n true,\n ) as PIXI.Sprite | null;\n resolve(newSprite);\n };\n });\n}\n/**\n * This function update the image content for the sprite in the PIXI.Application context\n *\n * @param application the PIXI.Application context\n * @param param.spriteName the name of the sprite in the context\n * @param param.imgDatasource the img data could be one of: string url, HTMLImageElement, PIXI.Sprite\n * @param param.spriteSize\n * @param param.stageSize\n */\nexport async function updateImage(\n application: PIXI.Application,\n {\n spriteName,\n imgDatasource,\n settings,\n }: {\n spriteName: string;\n imgDatasource: string | HTMLImageElement | PIXI.Sprite;\n settings?: ImageSettings;\n },\n): Promise<void> {\n if (application === undefined || application.stage === null) {\n return;\n }\n // Remove previous sprite if exists\n const previous = application.stage.getChildByName(spriteName, true);\n previous?.removeFromParent();\n // Create texture from datasource\n const texture =\n imgDatasource instanceof HTMLImageElement\n ? PIXI.Texture.from(imgDatasource)\n : imgDatasource instanceof PIXI.Sprite\n ? imgDatasource\n : await PIXI.Texture.fromURL(imgDatasource);\n // Create sprite from texture and set name\n const sprite =\n texture instanceof PIXI.Sprite ? texture : PIXI.Sprite.from(texture, {});\n sprite.interactive = true;\n sprite.name = spriteName;\n // If settings are defined => resize accordingly\n if (settings) {\n const {\n sprite: { anchor, position, scale, size: spriteSize, rotation },\n stage: { size: stageSize },\n } = settings;\n // Check whether sprite has been rotated\n const isRotated = rotation % Math.PI !== 0;\n //Config sprite\n sprite.anchor.x = anchor.x;\n sprite.anchor.y = anchor.y;\n sprite.position.x = position.x;\n sprite.position.y = position.y;\n sprite.scale.x = scale.x;\n sprite.scale.y = scale.y;\n // If sprite is rotated a multiple of 90°=>width and height are swapped\n sprite.width = isRotated ? spriteSize.height : spriteSize.width;\n sprite.height = isRotated ? spriteSize.width : spriteSize.height;\n // Resize stage\n application.stage.height = stageSize.height;\n application.stage.width = stageSize.width;\n application.renderer.resize(stageSize.width, stageSize.height);\n // Add sprite to context\n application.stage.addChild(sprite);\n } else {\n // Add sprite to context\n application.stage.addChild(sprite);\n // Resize the sprite\n application.renderer.resize(sprite.width, sprite.height);\n }\n // Resize the view in css to keep img quality\n autoResize(application, sprite);\n}\n\n/**\n * This function resize the sprite according to the container width\n *\n * @param application The PIXI.Application context\n * @param sprite The sprite object representing the image to resize\n */\nexport function autoResize(\n application: PIXI.Application,\n sprite: PIXI.Sprite,\n): void {\n // Get parent html object\n const parent = application.view.parentNode as HTMLElement | undefined;\n const maxMobileWidth = window.innerWidth - MODAL_HORIZONTAL_PADDING;\n const parentWidth = Math.max(parent?.offsetWidth ?? 0, MIN_WIDTH);\n const newSize = constraintSize(\n {\n width: sprite.width,\n height: sprite.height,\n },\n {\n width: {\n max: Math.min(parentWidth, maxMobileWidth),\n min: MIN_WIDTH,\n },\n height: {\n min: MIN_HEIGHT,\n max: window.innerHeight - MODAL_VERTICAL_PADDING,\n },\n },\n );\n // Define the new width to the parentWidth\n const { height: newHeight, width: newWidth } = newSize;\n\n // Anchor the sprite to the middle (for rotation)\n if (application.view?.style) {\n application.view.style.width = `${newWidth}px`;\n application.view.style.height = `${newHeight}px`;\n }\n}\n\nexport function constraintSize(\n size: { width: number; height: number },\n constraints: {\n width: { max: number; min: number };\n height: { max: number; min: number };\n },\n) {\n const { height, width } = size;\n const ratio = width / height;\n const { height: constraintHeight, width: constraintWidth } = constraints;\n // set max size\n let newWidth = constraintWidth.max;\n let newHeight = constraintWidth.max / ratio;\n // constraint width max\n if (width > constraintWidth.max) {\n newWidth = constraintWidth.max;\n newHeight = newWidth / ratio;\n }\n // constraint height max\n if (newHeight > constraintHeight.max) {\n newHeight = constraintHeight.max;\n newWidth = newHeight * ratio;\n }\n // constraint width min\n if (newWidth < constraintWidth.min) {\n newWidth = constraintWidth.min;\n newHeight = newWidth / ratio;\n }\n // constraint height max\n if (newHeight < constraintHeight.min) {\n newHeight = constraintHeight.min;\n newWidth = newHeight * ratio;\n }\n return { width: newWidth, height: newHeight };\n}\n\n/**\n * This function transform the stage into a blob\n *\n * @param application the PIXI.Application context\n * @returns A promise of the generated blob\n */\nexport function saveAsBlob(application: PIXI.Application): Promise<Blob> {\n return new Promise<Blob>((resolve, reject) => {\n if (application?.view?.toBlob) {\n application.view.toBlob(\n (blob) => {\n blob ? resolve(blob) : reject('EXTRACT_FAILED');\n },\n 'image/jpeg',\n DEFAULT_QUALITY,\n );\n } else {\n reject('EXTRACT_FAILED');\n }\n });\n}\n/**\n * This function transform the stage into a data URL encoded image\n *\n * @param application the PIXI.Application context\n * @returns the generated image as Data URL or undefined if failed\n */\nexport function saveAsDataURL(\n application: PIXI.Application,\n): string | undefined {\n return application.view.toDataURL?.();\n}\n\n/**\n * Calculates the scale percentage for a PIXI.Sprite or the application view based on the parent container's dimensions.\n * @param application - The PIXI.Application instance.\n * @param sprite - The PIXI.Sprite instance (optional).\n * @returns The scale percentage.\n */\nexport function getApplicationScale(application: PIXI.Application) {\n if (application.view.getBoundingClientRect) {\n return (\n application.view.getBoundingClientRect()!.width / application.view.width\n );\n }\n return 1;\n}\n\nexport function toBlob(application: PIXI.Application) {\n return new Promise<Blob>((resolve, reject) => {\n application.view.toBlob?.(\n (blob) => {\n if (blob) {\n resolve(blob);\n } else {\n reject('EXTRACT_FAIL');\n }\n },\n 'image/png',\n 1,\n );\n });\n}\n\nexport function createImageSettings({\n application,\n sprite,\n}: {\n sprite: PIXI.Sprite;\n application: PIXI.Application;\n}) {\n return {\n sprite: {\n rotation: sprite.rotation,\n size: { width: sprite.width, height: sprite.height },\n position: { x: sprite.position.x, y: sprite.position.y },\n scale: { x: sprite.scale.x, y: sprite.scale.y },\n anchor: { x: sprite.anchor.x, y: sprite.anchor.y },\n },\n stage: {\n size: {\n width: application.stage.width,\n height: application.stage.height,\n },\n scale: { x: application.stage.scale.x, y: application.stage.scale.y },\n },\n };\n}\n\nexport function trimStage(application: PIXI.Application, sprite: PIXI.Sprite) {\n application.renderer.resize(sprite.width, sprite.height);\n}\nexport function resizeStage({\n application,\n sprite,\n newHeight,\n newWidth,\n}: {\n newHeight: number;\n newWidth: number;\n application: PIXI.Application;\n sprite: PIXI.Sprite;\n}) {\n // Anchor the sprite to the middle (for rotation)\n sprite.anchor.x = 0.5;\n sprite.anchor.y = 0.5;\n // Position the sprite to the middle\n sprite.position = new PIXI.Point(newWidth / 2, newHeight / 2);\n // Resize the stage\n application.stage.height = newHeight;\n application.stage.width = newWidth;\n application.renderer.resize(newWidth, newHeight);\n}\n"],"names":["MIN_HEIGHT","MIN_WIDTH","MODAL_VERTICAL_PADDING","MODAL_HORIZONTAL_PADDING","DEFAULT_QUALITY","DEFAULT_SPRITE_NAME","updateImageFromBlob","application","spriteName","imgDatasource","settings","imageUrl","URL","createObjectURL","image","Image","src","Promise","resolve","onload","updateImage","newSprite","stage","getChildByName","undefined","previous","removeFromParent","texture","HTMLImageElement","PIXI","Texture","from","Sprite","fromURL","sprite","interactive","name","anchor","position","scale","size","spriteSize","rotation","stageSize","isRotated","Math","PI","x","y","width","height","renderer","resize","addChild","autoResize","parent","view","parentNode","maxMobileWidth","window","innerWidth","parentWidth","max","offsetWidth","newSize","constraintSize","min","innerHeight","newHeight","newWidth","style","constraints","ratio","constraintHeight","constraintWidth","saveAsBlob","reject","toBlob","blob","saveAsDataURL","toDataURL","getApplicationScale","getBoundingClientRect","createImageSettings","resizeStage","Point"],"mappings":";AAGA,MAAMA,IAAa,KAEbC,IAAY,KAEZC,IAAyB,KACzBC,IAA2B,IAG3BC,IAAkB,KAGXC,IAAsB;AA+B5B,SAASC,EACdC,GACA;AAAA,EACEC,YAAAA;AAAAA,EACAC,eAAAA;AAAAA,EACAC,UAAAA;AAKF,GAC6B;AACvBC,QAAAA,IAAWC,IAAIC,gBAAgBJ,CAAa,GAC5CK,IAAQ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