jodit-pro 4.12.40 → 4.13.2
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/config.js +1 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.css +1 -1
- package/es2015/jodit.fat.min.js +30 -30
- package/es2015/jodit.js +127 -54
- package/es2015/jodit.min.js +5 -5
- package/es2015/plugins/ai-assistant-pro/ai-assistant-pro.css +1 -1
- package/es2015/plugins/ai-assistant-pro/ai-assistant-pro.js +1 -1
- package/es2015/plugins/ai-assistant-pro/ai-assistant-pro.min.js +1 -1
- package/es2015/plugins/autocomplete/autocomplete.css +1 -1
- package/es2015/plugins/autocomplete/autocomplete.js +1 -1
- package/es2015/plugins/autocomplete/autocomplete.min.js +1 -1
- package/es2015/plugins/backup/backup.css +1 -1
- package/es2015/plugins/backup/backup.js +1 -1
- package/es2015/plugins/backup/backup.min.js +1 -1
- package/es2015/plugins/button-generator/button-generator.css +1 -1
- package/es2015/plugins/button-generator/button-generator.js +1 -1
- package/es2015/plugins/button-generator/button-generator.min.js +1 -1
- package/es2015/plugins/change-case/change-case.js +1 -1
- package/es2015/plugins/change-case/change-case.min.js +1 -1
- package/es2015/plugins/color-picker/color-picker.css +1 -1
- package/es2015/plugins/color-picker/color-picker.js +1 -1
- package/es2015/plugins/color-picker/color-picker.min.js +1 -1
- package/es2015/plugins/emoji/emoji.css +1 -1
- package/es2015/plugins/emoji/emoji.js +1 -1
- package/es2015/plugins/emoji/emoji.min.js +1 -1
- package/es2015/plugins/export-docs/export-docs.js +1 -1
- package/es2015/plugins/export-docs/export-docs.min.js +1 -1
- package/es2015/plugins/finder/finder.css +47 -4
- package/es2015/plugins/finder/finder.js +48 -3
- package/es2015/plugins/finder/finder.min.css +1 -1
- package/es2015/plugins/finder/finder.min.js +4 -4
- package/es2015/plugins/google-maps/google-maps.css +1 -1
- package/es2015/plugins/google-maps/google-maps.js +1 -1
- package/es2015/plugins/google-maps/google-maps.min.js +1 -1
- package/es2015/plugins/google-search/google-search.js +1 -1
- package/es2015/plugins/google-search/google-search.min.js +1 -1
- package/es2015/plugins/highlight-signature/highlight-signature.js +1 -1
- package/es2015/plugins/highlight-signature/highlight-signature.min.js +1 -1
- package/es2015/plugins/iframe-editor/iframe-editor.css +1 -1
- package/es2015/plugins/iframe-editor/iframe-editor.js +1 -1
- package/es2015/plugins/iframe-editor/iframe-editor.min.js +1 -1
- package/es2015/plugins/image-editor-pro/image-editor-pro.css +52 -0
- package/es2015/plugins/image-editor-pro/image-editor-pro.js +3969 -0
- package/es2015/plugins/image-editor-pro/image-editor-pro.min.css +1 -0
- package/es2015/plugins/image-editor-pro/image-editor-pro.min.js +8 -0
- package/es2015/plugins/keyboard/keyboard.css +1 -1
- package/es2015/plugins/keyboard/keyboard.js +1 -1
- package/es2015/plugins/keyboard/keyboard.min.js +1 -1
- package/es2015/plugins/mobile-view/mobile-view.js +1 -1
- package/es2015/plugins/mobile-view/mobile-view.min.js +1 -1
- package/es2015/plugins/page-break/page-break.js +1 -1
- package/es2015/plugins/page-break/page-break.min.js +1 -1
- package/es2015/plugins/paste-code/paste-code.css +1 -1
- package/es2015/plugins/paste-code/paste-code.js +1 -1
- package/es2015/plugins/paste-code/paste-code.min.js +1 -1
- package/es2015/plugins/paste-from-word/paste-from-word.js +1 -1
- package/es2015/plugins/paste-from-word/paste-from-word.min.js +1 -1
- package/es2015/plugins/show-blocks/show-blocks.js +1 -1
- package/es2015/plugins/show-blocks/show-blocks.min.js +1 -1
- package/es2015/plugins/style/style.css +1 -1
- package/es2015/plugins/style/style.js +1 -1
- package/es2015/plugins/style/style.min.js +1 -1
- package/es2015/plugins/templates/templates.css +1 -1
- package/es2015/plugins/templates/templates.js +1 -1
- package/es2015/plugins/templates/templates.min.js +1 -1
- package/es2015/plugins/todo-list/todo-list.css +1 -1
- package/es2015/plugins/todo-list/todo-list.js +1 -1
- package/es2015/plugins/todo-list/todo-list.min.js +1 -1
- package/es2015/plugins/translate/translate.css +1 -1
- package/es2015/plugins/translate/translate.js +1 -1
- package/es2015/plugins/translate/translate.min.js +1 -1
- package/es2015/plugins/tune-block/tune-block.css +1 -1
- package/es2015/plugins/tune-block/tune-block.js +1 -1
- package/es2015/plugins/tune-block/tune-block.min.js +1 -1
- package/es2018/jodit.fat.min.css +1 -1
- package/es2018/jodit.fat.min.js +31 -31
- package/es2018/jodit.min.js +5 -5
- package/es2018/plugins/ai-assistant-pro/ai-assistant-pro.min.js +1 -1
- package/es2018/plugins/autocomplete/autocomplete.min.js +1 -1
- package/es2018/plugins/backup/backup.min.js +1 -1
- package/es2018/plugins/button-generator/button-generator.min.js +1 -1
- package/es2018/plugins/change-case/change-case.min.js +1 -1
- package/es2018/plugins/color-picker/color-picker.min.js +1 -1
- package/es2018/plugins/emoji/emoji.min.js +1 -1
- package/es2018/plugins/export-docs/export-docs.min.js +1 -1
- package/es2018/plugins/finder/finder.min.css +1 -1
- package/es2018/plugins/finder/finder.min.js +4 -4
- package/es2018/plugins/google-maps/google-maps.min.js +1 -1
- package/es2018/plugins/google-search/google-search.min.js +1 -1
- package/es2018/plugins/highlight-signature/highlight-signature.min.js +1 -1
- package/es2018/plugins/iframe-editor/iframe-editor.min.js +1 -1
- package/es2018/plugins/image-editor-pro/image-editor-pro.min.css +1 -0
- package/es2018/plugins/image-editor-pro/image-editor-pro.min.js +8 -0
- package/es2018/plugins/keyboard/keyboard.min.js +1 -1
- package/es2018/plugins/mobile-view/mobile-view.min.js +1 -1
- package/es2018/plugins/page-break/page-break.min.js +1 -1
- package/es2018/plugins/paste-code/paste-code.min.js +1 -1
- package/es2018/plugins/paste-from-word/paste-from-word.min.js +1 -1
- package/es2018/plugins/show-blocks/show-blocks.min.js +1 -1
- package/es2018/plugins/style/style.min.js +1 -1
- package/es2018/plugins/templates/templates.min.js +1 -1
- package/es2018/plugins/todo-list/todo-list.min.js +1 -1
- package/es2018/plugins/translate/translate.min.js +1 -1
- package/es2018/plugins/tune-block/tune-block.min.js +1 -1
- package/es2021/jodit.css +1 -1
- package/es2021/jodit.fat.min.css +1 -1
- package/es2021/jodit.fat.min.js +823 -39
- package/es2021/jodit.js +127 -54
- package/es2021/jodit.min.js +6 -6
- package/es2021/plugins/ai-assistant-pro/ai-assistant-pro.css +1 -1
- package/es2021/plugins/ai-assistant-pro/ai-assistant-pro.js +1 -1
- package/es2021/plugins/ai-assistant-pro/ai-assistant-pro.min.js +1 -1
- package/es2021/plugins/autocomplete/autocomplete.css +1 -1
- package/es2021/plugins/autocomplete/autocomplete.js +1 -1
- package/es2021/plugins/autocomplete/autocomplete.min.js +1 -1
- package/es2021/plugins/backup/backup.css +1 -1
- package/es2021/plugins/backup/backup.js +1 -1
- package/es2021/plugins/backup/backup.min.js +1 -1
- package/es2021/plugins/button-generator/button-generator.css +1 -1
- package/es2021/plugins/button-generator/button-generator.js +1 -1
- package/es2021/plugins/button-generator/button-generator.min.js +1 -1
- package/es2021/plugins/change-case/change-case.js +1 -1
- package/es2021/plugins/change-case/change-case.min.js +1 -1
- package/es2021/plugins/color-picker/color-picker.css +1 -1
- package/es2021/plugins/color-picker/color-picker.js +1 -1
- package/es2021/plugins/color-picker/color-picker.min.js +1 -1
- package/es2021/plugins/emoji/emoji.css +1 -1
- package/es2021/plugins/emoji/emoji.js +1 -1
- package/es2021/plugins/emoji/emoji.min.js +1 -1
- package/es2021/plugins/export-docs/export-docs.js +1 -1
- package/es2021/plugins/export-docs/export-docs.min.js +1 -1
- package/es2021/plugins/finder/finder.css +47 -4
- package/es2021/plugins/finder/finder.js +48 -3
- package/es2021/plugins/finder/finder.min.css +1 -1
- package/es2021/plugins/finder/finder.min.js +12 -12
- package/es2021/plugins/google-maps/google-maps.css +1 -1
- package/es2021/plugins/google-maps/google-maps.js +1 -1
- package/es2021/plugins/google-maps/google-maps.min.js +1 -1
- package/es2021/plugins/google-search/google-search.js +1 -1
- package/es2021/plugins/google-search/google-search.min.js +1 -1
- package/es2021/plugins/highlight-signature/highlight-signature.js +1 -1
- package/es2021/plugins/highlight-signature/highlight-signature.min.js +1 -1
- package/es2021/plugins/iframe-editor/iframe-editor.css +1 -1
- package/es2021/plugins/iframe-editor/iframe-editor.js +1 -1
- package/es2021/plugins/iframe-editor/iframe-editor.min.js +1 -1
- package/es2021/plugins/image-editor-pro/image-editor-pro.css +52 -0
- package/es2021/plugins/image-editor-pro/image-editor-pro.js +3870 -0
- package/es2021/plugins/image-editor-pro/image-editor-pro.min.css +1 -0
- package/es2021/plugins/image-editor-pro/image-editor-pro.min.js +792 -0
- package/es2021/plugins/keyboard/keyboard.css +1 -1
- package/es2021/plugins/keyboard/keyboard.js +1 -1
- package/es2021/plugins/keyboard/keyboard.min.js +1 -1
- package/es2021/plugins/mobile-view/mobile-view.js +1 -1
- package/es2021/plugins/mobile-view/mobile-view.min.js +1 -1
- package/es2021/plugins/page-break/page-break.js +1 -1
- package/es2021/plugins/page-break/page-break.min.js +1 -1
- package/es2021/plugins/paste-code/paste-code.css +1 -1
- package/es2021/plugins/paste-code/paste-code.js +1 -1
- package/es2021/plugins/paste-code/paste-code.min.js +1 -1
- package/es2021/plugins/paste-from-word/paste-from-word.js +1 -1
- package/es2021/plugins/paste-from-word/paste-from-word.min.js +1 -1
- package/es2021/plugins/show-blocks/show-blocks.js +1 -1
- package/es2021/plugins/show-blocks/show-blocks.min.js +1 -1
- package/es2021/plugins/style/style.css +1 -1
- package/es2021/plugins/style/style.js +1 -1
- package/es2021/plugins/style/style.min.js +1 -1
- package/es2021/plugins/templates/templates.css +1 -1
- package/es2021/plugins/templates/templates.js +1 -1
- package/es2021/plugins/templates/templates.min.js +1 -1
- package/es2021/plugins/todo-list/todo-list.css +1 -1
- package/es2021/plugins/todo-list/todo-list.js +1 -1
- package/es2021/plugins/todo-list/todo-list.min.js +1 -1
- package/es2021/plugins/translate/translate.css +1 -1
- package/es2021/plugins/translate/translate.js +1 -1
- package/es2021/plugins/translate/translate.min.js +1 -1
- package/es2021/plugins/tune-block/tune-block.css +1 -1
- package/es2021/plugins/tune-block/tune-block.js +1 -1
- package/es2021/plugins/tune-block/tune-block.min.js +1 -1
- package/es2021.en/jodit.css +1 -1
- package/es2021.en/jodit.fat.min.css +1 -1
- package/es2021.en/jodit.fat.min.js +865 -81
- package/es2021.en/jodit.js +127 -54
- package/es2021.en/jodit.min.js +6 -6
- package/es2021.en/plugins/ai-assistant-pro/ai-assistant-pro.css +1 -1
- package/es2021.en/plugins/ai-assistant-pro/ai-assistant-pro.js +1 -1
- package/es2021.en/plugins/ai-assistant-pro/ai-assistant-pro.min.js +1 -1
- package/es2021.en/plugins/autocomplete/autocomplete.css +1 -1
- package/es2021.en/plugins/autocomplete/autocomplete.js +1 -1
- package/es2021.en/plugins/autocomplete/autocomplete.min.js +1 -1
- package/es2021.en/plugins/backup/backup.css +1 -1
- package/es2021.en/plugins/backup/backup.js +1 -1
- package/es2021.en/plugins/backup/backup.min.js +1 -1
- package/es2021.en/plugins/button-generator/button-generator.css +1 -1
- package/es2021.en/plugins/button-generator/button-generator.js +1 -1
- package/es2021.en/plugins/button-generator/button-generator.min.js +1 -1
- package/es2021.en/plugins/change-case/change-case.js +1 -1
- package/es2021.en/plugins/change-case/change-case.min.js +1 -1
- package/es2021.en/plugins/color-picker/color-picker.css +1 -1
- package/es2021.en/plugins/color-picker/color-picker.js +1 -1
- package/es2021.en/plugins/color-picker/color-picker.min.js +1 -1
- package/es2021.en/plugins/emoji/emoji.css +1 -1
- package/es2021.en/plugins/emoji/emoji.js +1 -1
- package/es2021.en/plugins/emoji/emoji.min.js +1 -1
- package/es2021.en/plugins/export-docs/export-docs.js +1 -1
- package/es2021.en/plugins/export-docs/export-docs.min.js +1 -1
- package/es2021.en/plugins/finder/finder.css +47 -4
- package/es2021.en/plugins/finder/finder.js +48 -3
- package/es2021.en/plugins/finder/finder.min.css +1 -1
- package/es2021.en/plugins/finder/finder.min.js +4 -4
- package/es2021.en/plugins/google-maps/google-maps.css +1 -1
- package/es2021.en/plugins/google-maps/google-maps.js +1 -1
- package/es2021.en/plugins/google-maps/google-maps.min.js +1 -1
- package/es2021.en/plugins/google-search/google-search.js +1 -1
- package/es2021.en/plugins/google-search/google-search.min.js +1 -1
- package/es2021.en/plugins/highlight-signature/highlight-signature.js +1 -1
- package/es2021.en/plugins/highlight-signature/highlight-signature.min.js +1 -1
- package/es2021.en/plugins/iframe-editor/iframe-editor.css +1 -1
- package/es2021.en/plugins/iframe-editor/iframe-editor.js +1 -1
- package/es2021.en/plugins/iframe-editor/iframe-editor.min.js +1 -1
- package/es2021.en/plugins/image-editor-pro/image-editor-pro.css +52 -0
- package/es2021.en/plugins/image-editor-pro/image-editor-pro.js +3870 -0
- package/es2021.en/plugins/image-editor-pro/image-editor-pro.min.css +1 -0
- package/es2021.en/plugins/image-editor-pro/image-editor-pro.min.js +792 -0
- package/es2021.en/plugins/keyboard/keyboard.css +1 -1
- package/es2021.en/plugins/keyboard/keyboard.js +1 -1
- package/es2021.en/plugins/keyboard/keyboard.min.js +1 -1
- package/es2021.en/plugins/mobile-view/mobile-view.js +1 -1
- package/es2021.en/plugins/mobile-view/mobile-view.min.js +1 -1
- package/es2021.en/plugins/page-break/page-break.js +1 -1
- package/es2021.en/plugins/page-break/page-break.min.js +1 -1
- package/es2021.en/plugins/paste-code/paste-code.css +1 -1
- package/es2021.en/plugins/paste-code/paste-code.js +1 -1
- package/es2021.en/plugins/paste-code/paste-code.min.js +1 -1
- package/es2021.en/plugins/paste-from-word/paste-from-word.js +1 -1
- package/es2021.en/plugins/paste-from-word/paste-from-word.min.js +1 -1
- package/es2021.en/plugins/show-blocks/show-blocks.js +1 -1
- package/es2021.en/plugins/show-blocks/show-blocks.min.js +1 -1
- package/es2021.en/plugins/style/style.css +1 -1
- package/es2021.en/plugins/style/style.js +1 -1
- package/es2021.en/plugins/style/style.min.js +1 -1
- package/es2021.en/plugins/templates/templates.css +1 -1
- package/es2021.en/plugins/templates/templates.js +1 -1
- package/es2021.en/plugins/templates/templates.min.js +1 -1
- package/es2021.en/plugins/todo-list/todo-list.css +1 -1
- package/es2021.en/plugins/todo-list/todo-list.js +1 -1
- package/es2021.en/plugins/todo-list/todo-list.min.js +1 -1
- package/es2021.en/plugins/translate/translate.css +1 -1
- package/es2021.en/plugins/translate/translate.js +1 -1
- package/es2021.en/plugins/translate/translate.min.js +1 -1
- package/es2021.en/plugins/tune-block/tune-block.css +1 -1
- package/es2021.en/plugins/tune-block/tune-block.js +1 -1
- package/es2021.en/plugins/tune-block/tune-block.min.js +1 -1
- package/es5/jodit.css +2 -2
- package/es5/jodit.fat.min.css +1 -1
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +137 -53
- package/es5/jodit.min.css +2 -2
- package/es5/jodit.min.js +2 -2
- package/es5/plugins/ai-assistant-pro/ai-assistant-pro.css +1 -1
- package/es5/plugins/ai-assistant-pro/ai-assistant-pro.js +1 -1
- package/es5/plugins/ai-assistant-pro/ai-assistant-pro.min.js +1 -1
- package/es5/plugins/autocomplete/autocomplete.css +1 -1
- package/es5/plugins/autocomplete/autocomplete.js +1 -1
- package/es5/plugins/autocomplete/autocomplete.min.js +1 -1
- package/es5/plugins/backup/backup.css +1 -1
- package/es5/plugins/backup/backup.js +1 -1
- package/es5/plugins/backup/backup.min.js +1 -1
- package/es5/plugins/button-generator/button-generator.css +1 -1
- package/es5/plugins/button-generator/button-generator.js +1 -1
- package/es5/plugins/button-generator/button-generator.min.js +1 -1
- package/es5/plugins/change-case/change-case.js +1 -1
- package/es5/plugins/change-case/change-case.min.js +1 -1
- package/es5/plugins/color-picker/color-picker.css +1 -1
- package/es5/plugins/color-picker/color-picker.js +1 -1
- package/es5/plugins/color-picker/color-picker.min.js +1 -1
- package/es5/plugins/emoji/emoji.css +1 -1
- package/es5/plugins/emoji/emoji.js +1 -1
- package/es5/plugins/emoji/emoji.min.js +1 -1
- package/es5/plugins/export-docs/export-docs.js +1 -1
- package/es5/plugins/export-docs/export-docs.min.js +1 -1
- package/es5/plugins/finder/finder.css +47 -4
- package/es5/plugins/finder/finder.js +93 -28
- package/es5/plugins/finder/finder.min.css +1 -1
- package/es5/plugins/finder/finder.min.js +2 -2
- package/es5/plugins/google-maps/google-maps.css +1 -1
- package/es5/plugins/google-maps/google-maps.js +1 -1
- package/es5/plugins/google-maps/google-maps.min.js +1 -1
- package/es5/plugins/google-search/google-search.js +1 -1
- package/es5/plugins/google-search/google-search.min.js +1 -1
- package/es5/plugins/highlight-signature/highlight-signature.js +1 -1
- package/es5/plugins/highlight-signature/highlight-signature.min.js +1 -1
- package/es5/plugins/iframe-editor/iframe-editor.css +1 -1
- package/es5/plugins/iframe-editor/iframe-editor.js +1 -1
- package/es5/plugins/iframe-editor/iframe-editor.min.js +1 -1
- package/es5/plugins/image-editor-pro/image-editor-pro.css +52 -0
- package/es5/plugins/image-editor-pro/image-editor-pro.js +5469 -0
- package/es5/plugins/image-editor-pro/image-editor-pro.min.css +1 -0
- package/es5/plugins/image-editor-pro/image-editor-pro.min.js +8 -0
- package/es5/plugins/keyboard/keyboard.css +1 -1
- package/es5/plugins/keyboard/keyboard.js +1 -1
- package/es5/plugins/keyboard/keyboard.min.js +1 -1
- package/es5/plugins/mobile-view/mobile-view.js +1 -1
- package/es5/plugins/mobile-view/mobile-view.min.js +1 -1
- package/es5/plugins/page-break/page-break.js +1 -1
- package/es5/plugins/page-break/page-break.min.js +1 -1
- package/es5/plugins/paste-code/paste-code.css +1 -1
- package/es5/plugins/paste-code/paste-code.js +1 -1
- package/es5/plugins/paste-code/paste-code.min.js +1 -1
- package/es5/plugins/paste-from-word/paste-from-word.js +1 -1
- package/es5/plugins/paste-from-word/paste-from-word.min.js +1 -1
- package/es5/plugins/show-blocks/show-blocks.js +1 -1
- package/es5/plugins/show-blocks/show-blocks.min.js +1 -1
- package/es5/plugins/style/style.css +1 -1
- package/es5/plugins/style/style.js +1 -1
- package/es5/plugins/style/style.min.js +1 -1
- package/es5/plugins/templates/templates.css +1 -1
- package/es5/plugins/templates/templates.js +1 -1
- package/es5/plugins/templates/templates.min.js +1 -1
- package/es5/plugins/todo-list/todo-list.css +1 -1
- package/es5/plugins/todo-list/todo-list.js +1 -1
- package/es5/plugins/todo-list/todo-list.min.js +1 -1
- package/es5/plugins/translate/translate.css +1 -1
- package/es5/plugins/translate/translate.js +1 -1
- package/es5/plugins/translate/translate.min.js +1 -1
- package/es5/plugins/tune-block/tune-block.css +1 -1
- package/es5/plugins/tune-block/tune-block.js +1 -1
- package/es5/plugins/tune-block/tune-block.min.js +1 -1
- package/es5/polyfills.fat.min.js +1 -1
- package/es5/polyfills.js +1 -1
- package/es5/polyfills.min.js +1 -1
- package/esm/config.d.ts +9 -0
- package/esm/plugins/all.js +1 -1
- package/esm/plugins/finder/ui/lightboox/lightbox.js +2 -2
- package/esm/plugins/finder/ui/virtual-scroll/virtual-scroll.d.ts +11 -1
- package/esm/plugins/finder/ui/virtual-scroll/virtual-scroll.js +2 -2
- package/esm/plugins/image-editor-pro/adapter.d.ts +98 -0
- package/esm/plugins/image-editor-pro/adapter.js +1 -0
- package/esm/plugins/image-editor-pro/config.d.ts +17 -0
- package/esm/plugins/image-editor-pro/config.js +1 -0
- package/esm/plugins/image-editor-pro/image-editor-pro.d.ts +26 -0
- package/esm/plugins/image-editor-pro/image-editor-pro.js +1 -0
- package/package.json +2 -1
- package/types/config.d.ts +9 -0
- package/types/plugins/finder/ui/virtual-scroll/virtual-scroll.d.ts +11 -1
- package/types/plugins/image-editor-pro/adapter.d.ts +98 -0
- package/types/plugins/image-editor-pro/config.d.ts +17 -0
- package/types/plugins/image-editor-pro/image-editor-pro.d.ts +26 -0
|
@@ -0,0 +1,792 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* jodit-pro - PRO Version of Jodit Editor
|
|
3
|
+
* Author: Chupurnov Valerii <chupurnov@gmail.com>
|
|
4
|
+
* Version: v4.13.2
|
|
5
|
+
* Url: https://xdsoft.net/jodit/pro/
|
|
6
|
+
* License(s): SEE LICENSE IN LICENSE.md
|
|
7
|
+
*/
|
|
8
|
+
"use strict";!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var i=t();for(var r in i)("object"==typeof exports?exports:e)[r]=i[r]}}(self,function(){return(self.webpackChunkjodit_pro=self.webpackChunkjodit_pro||[]).push([[918],{76542:function(e,t,i){i.d(t,{ProImageEditor:function(){return d}});var r=i(82749),a=i(85013),o=i(6441),n=i(91907),s=i(10830),l=i(78584);class d extends n.ViewComponent{className(){return"ImageEditorPro"}async open(e,t){let i=this.j,r=o.Config.defaultOptions.imageEditorPro,n=i.c.div("jodit-image-editor-pro");n.style.width="100%",n.style.height="100%";let s=new l.Dialog({language:i.o.language});s.setSize(r.dialog.width,r.dialog.height),s.setContent(n),s.open();let d=null,h=null,c=()=>{h?.(),h=null,d?.destroy(),d=null,s.close()};s.e.on("beforeClose",()=>{h?.(),h=null,d?.destroy(),d=null}),d=new a.ImageEditor({container:n,state:{showToolbar:!1,status:"loading"},onSave:i=>{this.persist(d,e,void 0,i,t,c)},onSaveAs:i=>{this.saveAs(d,e,i,t,c)}}),h=this.mountToolbar(s,d);try{let t=await this.loadImage(e);await d.fromBlob(t)}catch(e){d?.update({status:"error",error:e instanceof Error?e.message:e+""}),this.error(e)}}mountToolbar(e,t){let i=this.j,r=(0,s.Button)(i,{icon:{name:"save"},text:i.i18n("Save")},"primary"),o=(0,s.Button)(i,{icon:{name:"save"},name:"save-as",text:i.i18n("Save as")}),n=i.c.span("jodit-image-editor-pro__size"),l=(0,s.Button)(i,a.ICONS.minus),d=i.c.span("jodit-image-editor-pro__zoom"),h=(0,s.Button)(i,a.ICONS.plus),c=(0,s.Button)(i,"update",i.i18n("Reset")),u=(0,s.Button)(i,"undo",i.i18n("Undo")),p=(0,s.Button)(i,"redo",i.i18n("Redo"));l.setState({tooltip:"Zoom out"}),h.setState({tooltip:"Zoom in"});let g=null;r.onAction(()=>{g=r,t.save()}),o.onAction(()=>{g=o,t.saveAs()}),l.onAction(()=>t.update({zoom:t.state.zoom/1.2})),h.onAction(()=>t.update({zoom:1.2*t.state.zoom})),c.onAction(()=>t.reset()),u.onAction(()=>t.update({history:{step:-1}})),p.onAction(()=>t.update({history:{step:1}}));let f=(...e)=>{let t=i.c.div("jodit-image-editor-pro__group");return t.style.display="flex",t.style.alignItems="center",t.style.gap="4px",e.forEach(e=>t.appendChild(e)),t},m=i.c.div("jodit-image-editor-pro__toolbar");m.style.display="flex",m.style.alignItems="center",m.style.gap="12px",m.style.width="100%",n.style.opacity="0.75",d.style.minWidth="3.5em",d.style.textAlign="center",m.appendChild(f(r.container,o.container)),m.appendChild(f(n,l.container,d,h.container));let b=f(c.container,u.container,p.container);b.style.marginLeft="auto",m.appendChild(b),e.setHeader(m);let x="jodit-image-editor-pro__button_busy",y=e=>{let t=a.selectors.selectOutputSize(e),i="exporting"===e.status,s=i||"loading"===e.status,l=e.busyVisible,h=i&&(l??!0);i||(g=null),r.setState({disabled:!e.source||s}),o.setState({disabled:!e.source||s}),r.container.classList.toggle(x,h&&g!==o),o.container.classList.toggle(x,h&&g===o),c.setState({disabled:!a.selectors.selectIsDirty(e)}),u.setState({disabled:!a.selectors.selectCanUndo(e)}),p.setState({disabled:!a.selectors.selectCanRedo(e)}),n.textContent=t?`${t.width} \xd7 ${t.height}`:"";let f=a.selectors.selectViewportFit(e),m=f?Math.round(100*f.scale):Math.round(100*e.zoom);d.textContent=`${m}%`};y(t.state);let w=t.store.subscribe(y);return()=>{w(),[r,o,l,h,c,u,p].forEach(e=>e.destruct())}}saveAs(e,t,i,r,a){this.j.prompt("Enter new name","Save in new file",o=>{let n=(o||"").trim();if(!n)return this.j.alert("The name should not be empty"),!1;this.persist(e,t,n,i,r,a)})}async persist(e,t,i,r,a,o){e?.update({status:"exporting"});try{let{w:e,h:n}=await this.blobSize(r),s=await this.uploadEdited(t,r,i),l=()=>{o(),this.j.e.fire("update.filebrowser")};a(i,this.coreSupportsSaved()?{action:"saved",box:{w:e,h:n},newPath:s||void 0}:{action:"resize",box:{w:e,h:n}},l,e=>{o(),this.error(e)})}catch(e){o(),this.error(e)}}async uploadEdited(e,t,i){let{source:r,path:a,name:o}=await this.j.dataProvider.getPathByUrl(e),n=this.connectorUrl();if(!n)throw Error("No connector configured for imageSave");let s=(i||o||"image.png")+"",l=new FormData;l.append("action","imageSave"),l.append("source",(r??"")+""),l.append("path",(a??"")+""),l.append("name",s),l.append("files[0]",t,s);let d=n.includes("?")?"&":"?",h=await fetch(`${n}${d}action=imageSave`,{method:"POST",body:l,credentials:"include"}),c=await h.json();if(!c.success)throw Error(c.message||"Failed to save the edited image");return c.data?.newPath??""}coreSupportsSaved(){let[e=0,t=0,i=0]=(this.j.getVersion?this.j.getVersion():"").split(".").map(e=>parseInt(e,10)||0);return e>4||4===e&&(t>12||12===t&&i>=34)}connectorUrl(){let e=this.j.o.ajax?.url,t=this.j.o.uploader?.url;return"string"==typeof e&&e?e:"string"==typeof t&&t?t:""}async loadImage(e){let t=this.connectorUrl();if(t)try{return await this.loadViaConnector(t,e)}catch{}let i=e.includes("?")?"&":"?",r=await fetch(`${e}${i}_tst=${Date.now()}`,{credentials:"include"});if(!r.ok)throw Error(`Failed to load image (${r.status})`);return r.blob()}async loadViaConnector(e,t){let{source:i,path:r,name:a}=await this.j.dataProvider.getPathByUrl(t),o=new FormData;o.append("action","imageLoad"),o.append("source",(i??"")+""),o.append("path",(r??"")+""),o.append("name",(a??"")+"");let n=e.includes("?")?"&":"?",s=await fetch(`${e}${n}action=imageLoad`,{method:"POST",body:o,credentials:"include"}),l=await s.json();if(!l.success||!l.data?.content)throw Error(l.message||"Failed to load the image");return(await fetch(l.data.content)).blob()}async blobSize(e){let t=await createImageBitmap(e),i={w:t.width,h:t.height};return t.close(),i}error(e){this.j.e.fire("errorMessage",e.message)}constructor(...e){super(...e),(0,r._)(this,"isProImageEditor",!0)}}},45719:function(e,t,i){i(6441).Config.prototype.imageEditorPro={dialog:{width:"90%",height:"90%"}}},98270:function(e,t,i){i.r(t),i.d(t,{imageEditorPro:function(){return s}});var r=i(82749);i(45719);var a=i(76542),o=i(50911),n=i(2692);class s extends o.Plugin{afterInit(e){n.JoditPro.modules.ImageEditor=a.ProImageEditor}beforeDestruct(e){}}(0,r._)(s,"requires",["license"]),n.JoditPro.plugins.add("imageEditorPro",s)},85013:function(e,t,i){function r(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}i.d(t,{ICONS:function(){return eS},ImageEditor:function(){return eq},selectors:function(){return R}});try{if("u">typeof document){var a=document.createElement("style");a.appendChild(document.createTextNode(`/*
|
|
9
|
+
* Jodit Image Editor — design system & layout.
|
|
10
|
+
*
|
|
11
|
+
* Everything is scoped under \`.jie\` so the stylesheet can be injected into any
|
|
12
|
+
* page without leaking. Tokens are CSS custom properties; switching \`data-theme\`
|
|
13
|
+
* re-themes the whole tree. PostCSS handles nesting + autoprefixing.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
.jie {
|
|
17
|
+
/* palette */
|
|
18
|
+
--jie-accent: #5b5fc7;
|
|
19
|
+
--jie-accent-soft: #eceefb;
|
|
20
|
+
--jie-bg: #ffffff;
|
|
21
|
+
--jie-surface: #ffffff;
|
|
22
|
+
--jie-stage: #f3f4f8;
|
|
23
|
+
--jie-border: #e6e8ef;
|
|
24
|
+
--jie-text: #1f2430;
|
|
25
|
+
--jie-text-dim: #8a90a2;
|
|
26
|
+
--jie-danger: #e0533d;
|
|
27
|
+
--jie-shadow: 0 1px 2px rgba(20, 24, 40, 0.06), 0 8px 24px rgba(20, 24, 40, 0.06);
|
|
28
|
+
|
|
29
|
+
/* sizing scale — one system for every control */
|
|
30
|
+
--jie-control-h: 38px; /* shared height: buttons, inputs, selects, color, slider row */
|
|
31
|
+
--jie-control-px: 12px; /* horizontal padding inside controls */
|
|
32
|
+
--jie-icon: 20px; /* inline icon size (rail icons override to 24) */
|
|
33
|
+
--jie-radius: 12px; /* cards / panels */
|
|
34
|
+
--jie-radius-sm: 8px; /* controls */
|
|
35
|
+
--jie-gap: 16px; /* between groups */
|
|
36
|
+
--jie-gap-sm: 8px; /* between controls in a row */
|
|
37
|
+
--jie-font-sm: 13px;
|
|
38
|
+
--jie-font-md: 14px;
|
|
39
|
+
--jie-rail-w: 92px;
|
|
40
|
+
--jie-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
41
|
+
|
|
42
|
+
position: relative;
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
width: 100%;
|
|
46
|
+
height: 100%;
|
|
47
|
+
min-height: 420px;
|
|
48
|
+
box-sizing: border-box;
|
|
49
|
+
font-family: var(--jie-font);
|
|
50
|
+
color: var(--jie-text);
|
|
51
|
+
background: var(--jie-bg);
|
|
52
|
+
border: 1px solid var(--jie-border);
|
|
53
|
+
border-radius: var(--jie-radius);
|
|
54
|
+
overflow: hidden;
|
|
55
|
+
-webkit-user-select: none;
|
|
56
|
+
user-select: none;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.jie *,.jie *::before,.jie *::after {
|
|
60
|
+
box-sizing: border-box;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.jie[data-theme='dark'] {
|
|
64
|
+
--jie-accent: #8a8df0;
|
|
65
|
+
--jie-accent-soft: #2a2d44;
|
|
66
|
+
--jie-bg: #14161f;
|
|
67
|
+
--jie-surface: #1b1e2a;
|
|
68
|
+
--jie-stage: #0f1118;
|
|
69
|
+
--jie-border: #2a2e3d;
|
|
70
|
+
--jie-text: #e7e9f3;
|
|
71
|
+
--jie-text-dim: #8b91a7;
|
|
72
|
+
--jie-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.4);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* ---- top bar ------------------------------------------------------------ */
|
|
76
|
+
.jie-topbar {
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
gap: var(--jie-gap);
|
|
80
|
+
padding: 12px 16px;
|
|
81
|
+
border-bottom: 1px solid var(--jie-border);
|
|
82
|
+
background: var(--jie-surface);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.jie-topbar__save {
|
|
86
|
+
display: flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
gap: 8px;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.jie-topbar__meta {
|
|
92
|
+
display: flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
gap: 12px;
|
|
95
|
+
margin: 0 auto;
|
|
96
|
+
color: var(--jie-text-dim);
|
|
97
|
+
font-size: 14px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.jie-zoom {
|
|
101
|
+
display: flex;
|
|
102
|
+
align-items: center;
|
|
103
|
+
gap: 6px;
|
|
104
|
+
font-variant-numeric: tabular-nums;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.jie-topbar__actions {
|
|
108
|
+
display: flex;
|
|
109
|
+
align-items: center;
|
|
110
|
+
gap: 4px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* ---- buttons ------------------------------------------------------------ */
|
|
114
|
+
.jie-btn {
|
|
115
|
+
display: inline-flex;
|
|
116
|
+
align-items: center;
|
|
117
|
+
justify-content: center;
|
|
118
|
+
gap: 6px;
|
|
119
|
+
height: var(--jie-control-h);
|
|
120
|
+
min-width: var(--jie-control-h); /* single-char buttons (B / I) stay square */
|
|
121
|
+
padding: 0 var(--jie-control-px);
|
|
122
|
+
font: inherit;
|
|
123
|
+
font-size: var(--jie-font-md);
|
|
124
|
+
font-weight: 600;
|
|
125
|
+
line-height: 1;
|
|
126
|
+
white-space: nowrap;
|
|
127
|
+
color: var(--jie-text);
|
|
128
|
+
background: transparent;
|
|
129
|
+
border: 1px solid transparent;
|
|
130
|
+
border-radius: var(--jie-radius-sm);
|
|
131
|
+
cursor: pointer;
|
|
132
|
+
transition:
|
|
133
|
+
background 0.12s ease,
|
|
134
|
+
color 0.12s ease,
|
|
135
|
+
border-color 0.12s ease;
|
|
136
|
+
}
|
|
137
|
+
.jie-btn:hover:not(:disabled) {
|
|
138
|
+
background: var(--jie-accent-soft);
|
|
139
|
+
}
|
|
140
|
+
.jie-btn:disabled {
|
|
141
|
+
opacity: 0.4;
|
|
142
|
+
cursor: default;
|
|
143
|
+
}
|
|
144
|
+
/* inline icons are smaller than the standalone rail icons */
|
|
145
|
+
.jie-btn .jie-icon {
|
|
146
|
+
width: var(--jie-icon);
|
|
147
|
+
height: var(--jie-icon);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.jie-btn--primary {
|
|
151
|
+
color: #fff;
|
|
152
|
+
background: var(--jie-accent);
|
|
153
|
+
padding-inline: 18px;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.jie-btn--primary:hover:not(:disabled) {
|
|
157
|
+
background: color-mix(in srgb, var(--jie-accent) 88%, #000);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.jie-btn--icon {
|
|
161
|
+
width: var(--jie-control-h);
|
|
162
|
+
padding: 0;
|
|
163
|
+
color: var(--jie-text-dim);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.jie-btn--icon:hover:not(:disabled) {
|
|
167
|
+
color: var(--jie-text);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.jie-btn--active {
|
|
171
|
+
color: var(--jie-accent);
|
|
172
|
+
background: var(--jie-accent-soft);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/* text-style modifiers (the B / I annotation toggles) */
|
|
176
|
+
.jie-btn--bold {
|
|
177
|
+
font-weight: 800;
|
|
178
|
+
}
|
|
179
|
+
.jie-btn--italic {
|
|
180
|
+
font-style: italic;
|
|
181
|
+
font-family: Georgia, 'Times New Roman', serif;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.jie-icon {
|
|
185
|
+
display: inline-flex;
|
|
186
|
+
width: 24px;
|
|
187
|
+
height: 24px;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.jie-icon svg {
|
|
191
|
+
width: 100%;
|
|
192
|
+
height: 100%;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* ---- body / rail -------------------------------------------------------- */
|
|
196
|
+
.jie-body {
|
|
197
|
+
display: flex;
|
|
198
|
+
flex: 1;
|
|
199
|
+
min-height: 0;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.jie-rail {
|
|
203
|
+
display: flex;
|
|
204
|
+
flex-direction: column;
|
|
205
|
+
gap: 6px;
|
|
206
|
+
width: var(--jie-rail-w);
|
|
207
|
+
padding: 14px 10px;
|
|
208
|
+
border-right: 1px solid var(--jie-border);
|
|
209
|
+
background: var(--jie-surface);
|
|
210
|
+
overflow-y: auto;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.jie-tab {
|
|
214
|
+
display: flex;
|
|
215
|
+
flex-direction: column;
|
|
216
|
+
align-items: center;
|
|
217
|
+
gap: 6px;
|
|
218
|
+
padding: 12px 6px;
|
|
219
|
+
font-size: 12px;
|
|
220
|
+
font-weight: 600;
|
|
221
|
+
color: var(--jie-text-dim);
|
|
222
|
+
background: transparent;
|
|
223
|
+
border: 0;
|
|
224
|
+
border-radius: var(--jie-radius-sm);
|
|
225
|
+
cursor: pointer;
|
|
226
|
+
transition:
|
|
227
|
+
background 0.12s ease,
|
|
228
|
+
color 0.12s ease;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.jie-tab:hover {
|
|
232
|
+
background: var(--jie-accent-soft);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.jie-tab[aria-selected='true'] {
|
|
236
|
+
color: var(--jie-accent);
|
|
237
|
+
background: var(--jie-accent-soft);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/* ---- stage / preview ---------------------------------------------------- */
|
|
241
|
+
.jie-stage {
|
|
242
|
+
display: flex;
|
|
243
|
+
flex: 1;
|
|
244
|
+
flex-direction: column;
|
|
245
|
+
min-width: 0;
|
|
246
|
+
background: var(--jie-bg);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.jie-canvas-wrap {
|
|
250
|
+
position: relative;
|
|
251
|
+
flex: 1;
|
|
252
|
+
margin: 16px;
|
|
253
|
+
border-radius: var(--jie-radius);
|
|
254
|
+
background: var(--jie-stage);
|
|
255
|
+
overflow: hidden;
|
|
256
|
+
touch-action: none;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.jie-canvas {
|
|
260
|
+
position: absolute;
|
|
261
|
+
inset: 0;
|
|
262
|
+
width: 100%;
|
|
263
|
+
height: 100%;
|
|
264
|
+
display: block;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/* ---- transient status (loading / saving / error) ------------------------- */
|
|
268
|
+
|
|
269
|
+
.jie-spinner {
|
|
270
|
+
display: inline-block;
|
|
271
|
+
flex: 0 0 auto;
|
|
272
|
+
width: var(--jie-icon);
|
|
273
|
+
height: var(--jie-icon);
|
|
274
|
+
border: 2px solid currentColor;
|
|
275
|
+
border-right-color: transparent;
|
|
276
|
+
border-radius: 50%;
|
|
277
|
+
animation: jie-spin 0.8s linear infinite;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
@keyframes jie-spin {
|
|
281
|
+
to {
|
|
282
|
+
transform: rotate(360deg);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/* Covers the canvas while the image is loading, or shows the load error. */
|
|
287
|
+
.jie-overlay {
|
|
288
|
+
position: absolute;
|
|
289
|
+
inset: 0;
|
|
290
|
+
z-index: 2;
|
|
291
|
+
display: flex;
|
|
292
|
+
flex-direction: column;
|
|
293
|
+
align-items: center;
|
|
294
|
+
justify-content: center;
|
|
295
|
+
gap: var(--jie-gap-sm);
|
|
296
|
+
font-size: var(--jie-font-md);
|
|
297
|
+
color: var(--jie-text-dim);
|
|
298
|
+
background: var(--jie-stage);
|
|
299
|
+
}
|
|
300
|
+
.jie-overlay .jie-spinner {
|
|
301
|
+
width: 32px;
|
|
302
|
+
height: 32px;
|
|
303
|
+
border-width: 3px;
|
|
304
|
+
color: var(--jie-accent);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.jie-overlay--error {
|
|
308
|
+
color: var(--jie-danger);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.jie-overlay__detail {
|
|
312
|
+
max-width: 80%;
|
|
313
|
+
font-size: var(--jie-font-sm);
|
|
314
|
+
text-align: center;
|
|
315
|
+
color: var(--jie-text-dim);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/* crop overlay */
|
|
319
|
+
.jie-crop {
|
|
320
|
+
position: absolute;
|
|
321
|
+
border: 1.5px dashed var(--jie-accent);
|
|
322
|
+
box-shadow: 0 0 0 100vmax var(--jie-scrim, rgba(17, 24, 39, 0.45));
|
|
323
|
+
transform-origin: center;
|
|
324
|
+
cursor: move;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/*
|
|
328
|
+
* Rotation knob, centred *above* the frame and connected by a short stem. The
|
|
329
|
+
* preview keeps \`VIEWPORT_PADDING\` around the image, so the knob has room and is
|
|
330
|
+
* never clipped — even for a full-image crop.
|
|
331
|
+
*/
|
|
332
|
+
.jie-crop__rotate {
|
|
333
|
+
position: absolute;
|
|
334
|
+
left: 50%;
|
|
335
|
+
top: -34px;
|
|
336
|
+
width: 18px;
|
|
337
|
+
height: 18px;
|
|
338
|
+
margin-left: -9px;
|
|
339
|
+
background: var(--jie-bg);
|
|
340
|
+
border: 2px solid var(--jie-accent);
|
|
341
|
+
border-radius: 50%;
|
|
342
|
+
box-shadow: 0 1px 3px rgba(20, 24, 40, 0.3);
|
|
343
|
+
cursor: grab;
|
|
344
|
+
touch-action: none;
|
|
345
|
+
|
|
346
|
+
/* stem runs from the knob's bottom (-16px) toward the frame, stopping ~5px
|
|
347
|
+
short of the edge so it never touches/overlaps the dashed border */
|
|
348
|
+
}
|
|
349
|
+
.jie-crop__rotate::before {
|
|
350
|
+
content: '';
|
|
351
|
+
position: absolute;
|
|
352
|
+
left: 50%;
|
|
353
|
+
top: 18px;
|
|
354
|
+
width: 2px;
|
|
355
|
+
height: 11px;
|
|
356
|
+
margin-left: -1px;
|
|
357
|
+
background: var(--jie-accent);
|
|
358
|
+
}
|
|
359
|
+
.jie-crop__rotate:active {
|
|
360
|
+
cursor: grabbing;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.jie-crop__handle {
|
|
364
|
+
position: absolute;
|
|
365
|
+
width: 14px;
|
|
366
|
+
height: 14px;
|
|
367
|
+
background: var(--jie-bg);
|
|
368
|
+
border: 2px solid var(--jie-accent);
|
|
369
|
+
border-radius: 50%;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.jie-crop__handle[data-h='nw'] {
|
|
373
|
+
top: -7px;
|
|
374
|
+
left: -7px;
|
|
375
|
+
cursor: nwse-resize;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.jie-crop__handle[data-h='ne'] {
|
|
379
|
+
top: -7px;
|
|
380
|
+
right: -7px;
|
|
381
|
+
cursor: nesw-resize;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.jie-crop__handle[data-h='sw'] {
|
|
385
|
+
bottom: -7px;
|
|
386
|
+
left: -7px;
|
|
387
|
+
cursor: nesw-resize;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.jie-crop__handle[data-h='se'] {
|
|
391
|
+
bottom: -7px;
|
|
392
|
+
right: -7px;
|
|
393
|
+
cursor: nwse-resize;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/* ---- bottom panel ------------------------------------------------------- */
|
|
397
|
+
.jie-panel {
|
|
398
|
+
display: flex;
|
|
399
|
+
flex-direction: column;
|
|
400
|
+
gap: 14px;
|
|
401
|
+
align-items: center;
|
|
402
|
+
padding: 14px 16px 20px;
|
|
403
|
+
border-top: 1px solid var(--jie-border);
|
|
404
|
+
background: var(--jie-surface);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/* a row of equal-height controls, centred on a shared baseline */
|
|
408
|
+
.jie-toolrow {
|
|
409
|
+
display: flex;
|
|
410
|
+
flex-wrap: wrap;
|
|
411
|
+
gap: var(--jie-gap-sm);
|
|
412
|
+
align-items: center;
|
|
413
|
+
justify-content: center;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/* a row of labelled (label-above) fields; inputs and buttons share a height,
|
|
417
|
+
so aligning their bottoms keeps everything tidy */
|
|
418
|
+
.jie-fieldrow {
|
|
419
|
+
display: flex;
|
|
420
|
+
flex-wrap: wrap;
|
|
421
|
+
gap: var(--jie-gap);
|
|
422
|
+
align-items: flex-end;
|
|
423
|
+
justify-content: center;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
.jie-field {
|
|
427
|
+
display: flex;
|
|
428
|
+
flex-direction: column;
|
|
429
|
+
gap: 4px;
|
|
430
|
+
font-size: var(--jie-font-sm);
|
|
431
|
+
color: var(--jie-text-dim);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
.jie-input,
|
|
435
|
+
.jie-select {
|
|
436
|
+
height: var(--jie-control-h);
|
|
437
|
+
width: 120px;
|
|
438
|
+
padding: 0 var(--jie-control-px);
|
|
439
|
+
font: inherit;
|
|
440
|
+
font-size: var(--jie-font-md);
|
|
441
|
+
color: var(--jie-text);
|
|
442
|
+
background: var(--jie-bg);
|
|
443
|
+
border: 1px solid var(--jie-border);
|
|
444
|
+
border-radius: var(--jie-radius-sm);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
:is(.jie-input,.jie-select):focus {
|
|
448
|
+
outline: 2px solid var(--jie-accent-soft);
|
|
449
|
+
border-color: var(--jie-accent);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/* native colour input, normalised to the control height as a rounded swatch */
|
|
453
|
+
/* colour picker: a swatch button that opens a popover of preset swatches */
|
|
454
|
+
.jie-colorpicker {
|
|
455
|
+
position: relative;
|
|
456
|
+
display: inline-flex;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/* the trigger swatch (shows the current colour via inline \`background\`) */
|
|
460
|
+
.jie-color {
|
|
461
|
+
width: var(--jie-control-h);
|
|
462
|
+
height: var(--jie-control-h);
|
|
463
|
+
padding: 0;
|
|
464
|
+
border: 1px solid var(--jie-border);
|
|
465
|
+
border-radius: var(--jie-radius-sm);
|
|
466
|
+
box-shadow: inset 0 0 0 2px var(--jie-bg);
|
|
467
|
+
cursor: pointer;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.jie-popover__backdrop {
|
|
471
|
+
position: fixed;
|
|
472
|
+
inset: 0;
|
|
473
|
+
z-index: 50;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.jie-popover {
|
|
477
|
+
position: absolute;
|
|
478
|
+
bottom: calc(100% + 8px);
|
|
479
|
+
left: 50%;
|
|
480
|
+
transform: translateX(-50%);
|
|
481
|
+
z-index: 51;
|
|
482
|
+
padding: 10px;
|
|
483
|
+
background: var(--jie-surface);
|
|
484
|
+
border: 1px solid var(--jie-border);
|
|
485
|
+
border-radius: var(--jie-radius);
|
|
486
|
+
box-shadow: var(--jie-shadow);
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
.jie-swatches {
|
|
490
|
+
display: grid;
|
|
491
|
+
grid-template-columns: repeat(6, 1fr);
|
|
492
|
+
gap: 8px;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/* 3\xd73 position anchor grid */
|
|
496
|
+
.jie-posgrid {
|
|
497
|
+
display: grid;
|
|
498
|
+
grid-template-columns: repeat(3, 1fr);
|
|
499
|
+
gap: 2px;
|
|
500
|
+
padding: 3px;
|
|
501
|
+
background: var(--jie-bg);
|
|
502
|
+
border: 1px solid var(--jie-border);
|
|
503
|
+
border-radius: var(--jie-radius-sm);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.jie-posgrid__cell {
|
|
507
|
+
display: inline-flex;
|
|
508
|
+
align-items: center;
|
|
509
|
+
justify-content: center;
|
|
510
|
+
width: 22px;
|
|
511
|
+
height: 22px;
|
|
512
|
+
padding: 0;
|
|
513
|
+
color: var(--jie-text-dim);
|
|
514
|
+
background: transparent;
|
|
515
|
+
border: 0;
|
|
516
|
+
border-radius: 5px;
|
|
517
|
+
cursor: pointer;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
.jie-posgrid__cell .jie-icon {
|
|
521
|
+
width: 16px;
|
|
522
|
+
height: 16px;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
.jie-posgrid__cell:hover {
|
|
526
|
+
background: var(--jie-accent-soft);
|
|
527
|
+
color: var(--jie-text);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
.jie-posgrid__cell[aria-pressed='true'] {
|
|
531
|
+
background: var(--jie-accent);
|
|
532
|
+
color: #fff;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/* font selector */
|
|
536
|
+
.jie-fontselect {
|
|
537
|
+
position: relative;
|
|
538
|
+
display: inline-flex;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
.jie-fontselect__trigger {
|
|
542
|
+
display: inline-flex;
|
|
543
|
+
align-items: center;
|
|
544
|
+
gap: 6px;
|
|
545
|
+
height: var(--jie-control-h);
|
|
546
|
+
min-width: 130px;
|
|
547
|
+
padding: 0 10px;
|
|
548
|
+
font: inherit;
|
|
549
|
+
font-size: var(--jie-font-md);
|
|
550
|
+
color: var(--jie-text);
|
|
551
|
+
background: var(--jie-bg);
|
|
552
|
+
border: 1px solid var(--jie-border);
|
|
553
|
+
border-radius: var(--jie-radius-sm);
|
|
554
|
+
cursor: pointer;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
.jie-fontselect__trigger > span {
|
|
558
|
+
flex: 1;
|
|
559
|
+
text-align: left;
|
|
560
|
+
white-space: nowrap;
|
|
561
|
+
overflow: hidden;
|
|
562
|
+
text-overflow: ellipsis;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
.jie-fontselect__trigger .jie-icon {
|
|
566
|
+
width: 16px;
|
|
567
|
+
height: 16px;
|
|
568
|
+
color: var(--jie-text-dim);
|
|
569
|
+
flex: none;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
.jie-fontlist {
|
|
573
|
+
min-width: 180px;
|
|
574
|
+
max-height: 260px;
|
|
575
|
+
overflow-y: auto;
|
|
576
|
+
padding: 6px;
|
|
577
|
+
display: flex;
|
|
578
|
+
flex-direction: column;
|
|
579
|
+
gap: 2px;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
.jie-fontlist__item {
|
|
583
|
+
padding: 8px 10px;
|
|
584
|
+
font-size: 15px;
|
|
585
|
+
text-align: left;
|
|
586
|
+
color: var(--jie-text);
|
|
587
|
+
background: transparent;
|
|
588
|
+
border: 0;
|
|
589
|
+
border-radius: var(--jie-radius-sm);
|
|
590
|
+
cursor: pointer;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
.jie-fontlist__item:hover {
|
|
594
|
+
background: var(--jie-accent-soft);
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
.jie-fontlist__item[aria-pressed='true'] {
|
|
598
|
+
color: var(--jie-accent);
|
|
599
|
+
background: var(--jie-accent-soft);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
.jie-swatch {
|
|
603
|
+
width: 28px;
|
|
604
|
+
height: 28px;
|
|
605
|
+
padding: 0;
|
|
606
|
+
border: 1px solid var(--jie-border);
|
|
607
|
+
border-radius: var(--jie-radius-sm);
|
|
608
|
+
box-shadow: inset 0 0 0 2px var(--jie-surface);
|
|
609
|
+
cursor: pointer;
|
|
610
|
+
transition:
|
|
611
|
+
transform 0.1s ease,
|
|
612
|
+
box-shadow 0.1s ease;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
.jie-swatch:hover {
|
|
616
|
+
transform: scale(1.08);
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
.jie-swatch[aria-pressed='true'] {
|
|
620
|
+
box-shadow:
|
|
621
|
+
inset 0 0 0 2px var(--jie-surface),
|
|
622
|
+
0 0 0 2px var(--jie-accent);
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
/* slider — the whole control occupies the shared height and centres its track */
|
|
626
|
+
.jie-slider {
|
|
627
|
+
display: flex;
|
|
628
|
+
align-items: center;
|
|
629
|
+
gap: 10px;
|
|
630
|
+
height: var(--jie-control-h);
|
|
631
|
+
width: clamp(180px, 28vw, 300px);
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
.jie-slider__label {
|
|
635
|
+
font-size: var(--jie-font-sm);
|
|
636
|
+
color: var(--jie-text-dim);
|
|
637
|
+
white-space: nowrap;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
.jie-slider__value {
|
|
641
|
+
min-width: 2.5ch;
|
|
642
|
+
text-align: right;
|
|
643
|
+
font-variant-numeric: tabular-nums;
|
|
644
|
+
font-weight: 600;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
/*
|
|
648
|
+
* Fully custom range so it looks identical across evergreen browsers (the
|
|
649
|
+
* native \`accent-color\` only themes the colour, not the track/thumb shapes).
|
|
650
|
+
* The filled portion is driven by \`--jie-range-fill\` (set per render by the
|
|
651
|
+
* slider component) on WebKit, and by the native \`::-moz-range-progress\` on
|
|
652
|
+
* Firefox.
|
|
653
|
+
*/
|
|
654
|
+
.jie-range {
|
|
655
|
+
--jie-range-fill: 50%;
|
|
656
|
+
appearance: none;
|
|
657
|
+
flex: 1;
|
|
658
|
+
min-width: 0;
|
|
659
|
+
height: 16px; /* hit area */
|
|
660
|
+
background: transparent;
|
|
661
|
+
cursor: pointer;
|
|
662
|
+
}
|
|
663
|
+
.jie-range::-webkit-slider-runnable-track {
|
|
664
|
+
height: 4px;
|
|
665
|
+
border-radius: 999px;
|
|
666
|
+
background: linear-gradient(
|
|
667
|
+
to right,
|
|
668
|
+
var(--jie-accent) var(--jie-range-fill),
|
|
669
|
+
var(--jie-border) var(--jie-range-fill)
|
|
670
|
+
);
|
|
671
|
+
}
|
|
672
|
+
.jie-range::-webkit-slider-thumb {
|
|
673
|
+
appearance: none;
|
|
674
|
+
margin-top: -6px; /* centre the 16px thumb on the 4px track */
|
|
675
|
+
width: 16px;
|
|
676
|
+
height: 16px;
|
|
677
|
+
border-radius: 50%;
|
|
678
|
+
background: var(--jie-accent);
|
|
679
|
+
border: 2px solid var(--jie-bg);
|
|
680
|
+
box-shadow: 0 1px 3px rgba(20, 24, 40, 0.25);
|
|
681
|
+
}
|
|
682
|
+
.jie-range::-moz-range-track {
|
|
683
|
+
height: 4px;
|
|
684
|
+
border-radius: 999px;
|
|
685
|
+
background: var(--jie-border);
|
|
686
|
+
}
|
|
687
|
+
.jie-range::-moz-range-progress {
|
|
688
|
+
height: 4px;
|
|
689
|
+
border-radius: 999px;
|
|
690
|
+
background: var(--jie-accent);
|
|
691
|
+
}
|
|
692
|
+
.jie-range::-moz-range-thumb {
|
|
693
|
+
width: 16px;
|
|
694
|
+
height: 16px;
|
|
695
|
+
border-radius: 50%;
|
|
696
|
+
background: var(--jie-accent);
|
|
697
|
+
border: 2px solid var(--jie-bg);
|
|
698
|
+
box-shadow: 0 1px 3px rgba(20, 24, 40, 0.25);
|
|
699
|
+
}
|
|
700
|
+
.jie-range:focus-visible {
|
|
701
|
+
outline: none;
|
|
702
|
+
}
|
|
703
|
+
.jie-range:focus-visible::-webkit-slider-thumb {
|
|
704
|
+
box-shadow: 0 0 0 4px var(--jie-accent-soft);
|
|
705
|
+
}
|
|
706
|
+
.jie-range:focus-visible::-moz-range-thumb {
|
|
707
|
+
box-shadow: 0 0 0 4px var(--jie-accent-soft);
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
/* filter thumbnails */
|
|
711
|
+
.jie-thumbs {
|
|
712
|
+
display: flex;
|
|
713
|
+
gap: 12px;
|
|
714
|
+
width: 100%;
|
|
715
|
+
padding-bottom: 4px;
|
|
716
|
+
overflow-x: auto;
|
|
717
|
+
justify-content: flex-start;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
.jie-thumb {
|
|
721
|
+
display: flex;
|
|
722
|
+
flex-direction: column;
|
|
723
|
+
gap: 6px;
|
|
724
|
+
align-items: center;
|
|
725
|
+
padding: 4px;
|
|
726
|
+
font-size: 12px;
|
|
727
|
+
color: var(--jie-text-dim);
|
|
728
|
+
background: transparent;
|
|
729
|
+
border: 0;
|
|
730
|
+
cursor: pointer;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
.jie-thumb canvas,.jie-thumb .jie-thumb__swatch {
|
|
734
|
+
width: 76px;
|
|
735
|
+
height: 56px;
|
|
736
|
+
border-radius: var(--jie-radius-sm);
|
|
737
|
+
border: 2px solid transparent;
|
|
738
|
+
object-fit: cover;
|
|
739
|
+
background: var(--jie-stage);
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
.jie-thumb[aria-pressed='true'] {
|
|
743
|
+
color: var(--jie-accent);
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
.jie-thumb[aria-pressed='true'] canvas,.jie-thumb[aria-pressed='true'] .jie-thumb__swatch {
|
|
747
|
+
border-color: var(--jie-accent);
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/* ---- responsive / mobile ------------------------------------------------ */
|
|
751
|
+
@media (max-width: 720px) {
|
|
752
|
+
.jie {
|
|
753
|
+
--jie-rail-w: 100%;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
.jie-topbar__meta {
|
|
757
|
+
display: none;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
.jie-body {
|
|
761
|
+
flex-direction: column-reverse;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
.jie-rail {
|
|
765
|
+
flex-direction: row;
|
|
766
|
+
width: 100%;
|
|
767
|
+
border-right: 0;
|
|
768
|
+
border-top: 1px solid var(--jie-border);
|
|
769
|
+
overflow-x: auto;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
.jie-tab {
|
|
773
|
+
flex: 0 0 auto;
|
|
774
|
+
min-width: 72px;
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
.jie-canvas-wrap {
|
|
778
|
+
margin: 10px;
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
.jie-input {
|
|
782
|
+
width: 100px;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
@media (hover: none) {
|
|
787
|
+
.jie-crop__handle {
|
|
788
|
+
width: 22px;
|
|
789
|
+
height: 22px;
|
|
790
|
+
}
|
|
791
|
+
}`)),document.head.appendChild(a)}}catch(e){}let o=Object.freeze([{label:"Arial",value:"Arial, Helvetica, sans-serif"},{label:"Helvetica",value:"Helvetica, Arial, sans-serif"},{label:"Verdana",value:"Verdana, Geneva, sans-serif"},{label:"Tahoma",value:"Tahoma, Geneva, sans-serif"},{label:"Trebuchet MS",value:'"Trebuchet MS", Helvetica, sans-serif'},{label:"Times New Roman",value:'"Times New Roman", Times, serif'},{label:"Georgia",value:'Georgia, "Times New Roman", serif'},{label:"Courier New",value:'"Courier New", Courier, monospace'},{label:"Impact",value:"Impact, Haettenschweiler, sans-serif"}]),n=Object.freeze({brightness:0,contrast:0,saturation:0,warmth:0,blur:0}),s=Object.freeze(["#ffffff","#1a1a1a","#9e9689","#4a90e2","#54b98a","#f2c94c","#eb5757","#a29bfe","#8b5cf6","#f178b6","#f2994a","#b8e454","#7ec8f0","#5b6470","#d8d2c8","#eeeeee"]);function l(){return{flip:{horizontal:!1,vertical:!1},rotate:0,angle:0,crop:null,resize:null,finetune:{...n},filter:"original",annotations:[],focus:null}}function d(){return{source:null,status:"idle",busyVisible:!1,error:null,activeTab:"adjust",activeTool:"crop",zoom:1,history:{entries:[l()],index:0},selectedAnnotationId:null,theme:"light",showToolbar:!0,locale:"en",minCropSize:8,minResizeSize:1,palette:[...s],fonts:o.map(e=>({...e})),activePopover:null,viewport:null}}function h(e){let t=e.entries[e.index];if(void 0===t)throw RangeError(`history index ${e.index} is out of bounds`);return t}function c(e,t){let i=e.entries.slice(0,e.index+1);i.push(t);let r=Math.max(0,i.length-100),a=r>0?i.slice(r):i;return{entries:a,index:a.length-1}}function u(e,t){let i=Math.min(Math.max(t,0),e.entries.length-1);return i===e.index?e:{...e,index:i}}function p(e,t){var i,r,a,o,n,s;let d=e;if(void 0!==t.activeTab&&(d=g(d,{activeTab:t.activeTab})),void 0!==t.activeTool&&(d=g(d,{activeTool:t.activeTool})),void 0!==t.zoom&&(d=g(d,{zoom:!Number.isFinite(o=t.zoom)||o<=0?1:Math.min(Math.max(o,.01),64)})),void 0!==t.theme&&(d=g(d,{theme:t.theme})),void 0!==t.showToolbar&&(d=g(d,{showToolbar:t.showToolbar})),void 0!==t.locale&&(d=g(d,{locale:t.locale})),void 0!==t.minCropSize&&(d=g(d,{minCropSize:Math.max(1,t.minCropSize)})),void 0!==t.minResizeSize&&(d=g(d,{minResizeSize:Math.max(1,t.minResizeSize)})),void 0!==t.palette&&(d=g(d,{palette:t.palette})),void 0!==t.fonts&&(d=g(d,{fonts:t.fonts})),void 0!==t.activePopover&&(d=g(d,{activePopover:t.activePopover})),void 0!==t.status&&(d=g(d,{status:t.status}),"exporting"!==t.status&&d.busyVisible&&(d=g(d,{busyVisible:!1}))),void 0!==t.busyVisible&&(d=g(d,{busyVisible:t.busyVisible})),void 0!==t.error&&(d=g(d,{error:t.error})),void 0!==t.source&&(d=g(d,{source:t.source})),void 0!==t.viewport&&(d=g(d,{viewport:t.viewport})),void 0!==t.selectedAnnotationId&&(d=g(d,{selectedAnnotationId:t.selectedAnnotationId})),t.resetHistory&&(d=g(d,{history:{entries:[l()],index:0}})),t.resetDesign&&(d=g(d,{history:c(d.history,l())})),void 0!==t.design){let e,r=(n=h(d.history),s=t.design,{...n,...s,flip:s.flip?{...n.flip,...s.flip}:n.flip,finetune:s.finetune?{...n.finetune,...s.finetune}:n.finetune,rotate:void 0!==s.rotate?(90*Math.round(s.rotate/90)%360+360)%360:n.rotate}),a=!1===t.commit?((e=(i=d.history).entries.slice())[i.index]=r,{entries:e,index:i.index}):c(d.history,r);d=g(d,{history:a})}if(void 0!==t.history){let e=t.history,i="step"in e?(r=d.history,a=e.step,u(r,r.index+a)):u(d.history,e.index);d=g(d,{history:i})}return d}function g(e,t){for(let i of Object.keys(t))if(e[i]!==t[i])return{...e,...t};return e}class f{request(e){this.pending=e,null===this.handle&&(this.handle=this.schedule(()=>this.flush()))}flush(){null!==this.handle&&(this.clear(this.handle),this.handle=null);let e=this.pending;this.pending=null,e&&e()}cancel(){null!==this.handle&&(this.clear(this.handle),this.handle=null),this.pending=null}constructor(e,t){r(this,"pending",null),r(this,"handle",null),this.schedule=e,this.clear=t}}class m{request(e){this.pending=e,this.flush()}flush(){let e=this.pending;this.pending=null,e&&e()}cancel(){this.pending=null}constructor(){r(this,"pending",null)}}class b{getState(){return this.state}update(e){let t=this.reducer(this.state,e);return t!==this.state&&(this.state=t,this.scheduler.request(()=>this.notify())),this.state}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}flush(){this.scheduler.flush()}destroy(){this.scheduler.cancel(),this.listeners.clear()}notify(){if(!this.notifying){this.notifying=!0;try{for(let e of this.listeners)e(this.state)}finally{this.notifying=!1}}}constructor(e={}){r(this,"state",void 0),r(this,"reducer",void 0),r(this,"scheduler",void 0),r(this,"listeners",new Set),r(this,"notifying",!1),this.state=e.initialState??d(),this.reducer=e.reducer??p,this.scheduler=e.scheduler??new m}}function x(e,t,i){return Math.min(Math.max(e,t),i)}function y(e,t){let i=x(e.width,1,t.width),r=x(e.height,1,t.height);return{x:x(e.x,0,t.width-i),y:x(e.y,0,t.height-r),width:i,height:r}}function w(e){return h(e.history)}function j(e){return"adjust"===e.activeTab&&"crop"===e.activeTool}function M(e){let t=w(e);return j(e)?{...t,crop:null,angle:0}:t}function k(e){return e.history.index>0}function S(e){var t;return(t=e.history).index<t.entries.length-1}function z(e){return e.history.index>0||e.history.entries.length>1}function C(e){if(!e.source)return null;let t=w(e),{width:i,height:r}=e.source;return 90===t.rotate||270===t.rotate?{width:r,height:i}:{width:i,height:r}}function _(e){let t=w(e);return t.resize?t.resize:t.crop?{width:Math.round(t.crop.width),height:Math.round(t.crop.height)}:C(e)}function T(e){return j(e)?C(e):_(e)}function P(e){let t,i,r,a=T(e);if(!a||!e.viewport)return null;let o={width:Math.max(1,e.viewport.width-88),height:Math.max(1,e.viewport.height-88)},n=(t=Math.min(o.width/a.width,o.height/a.height)||0,i=a.width*t,r=a.height*t,{scale:t,width:i,height:r,offsetX:(o.width-i)/2,offsetY:(o.height-r)/2}).scale*e.zoom,s=a.width*n,l=a.height*n;return{scale:n,width:s,height:l,offsetX:(e.viewport.width-s)/2,offsetY:(e.viewport.height-l)/2,content:a}}function E(e){return w(e).angle}function A(e){let t=w(e);if(t.crop)return t.crop;let i=C(e);return i?{x:0,y:0,width:i.width,height:i.height}:null}let R=Object.freeze(Object.defineProperty({__proto__:null,VIEWPORT_PADDING:44,selectCanRedo:S,selectCanUndo:k,selectCropAngle:E,selectDesign:w,selectEffectiveCrop:A,selectIsCropping:j,selectIsDirty:z,selectOrientedSize:C,selectOutputSize:_,selectPreviewContentSize:T,selectPreviewDesign:M,selectViewportFit:P},Symbol.toStringTag,{value:"Module"})),I=Math.PI/180,B={nw:[-1,-1],ne:[1,-1],sw:[-1,1],se:[1,1]};function $(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function O(e,t,i,r){let a=$(e),o=t*I,n=Math.cos(o),s=Math.sin(o),l=i*e.width/2,d=r*e.height/2;return{x:a.x+l*n-d*s,y:a.y+l*s+d*n}}function D(e,t,i,r){return Math.atan2(r-t,i-e)/I}function L(e,t,i){F(e,"width"),F(t,"height");let r=e*t*4;if(i&&i.length!==r)throw RangeError(`data length ${i.length} does not match ${e}x${t} (${r})`);return{width:e,height:t,data:i??new Uint8ClampedArray(r)}}function V(e,t,i){return(i*e.width+t)*4}function F(e,t){if(!Number.isInteger(e)||e<=0)throw RangeError(`${t} must be a positive integer, got ${e}`)}function N(e,t){let i=L(e.width,e.height),{width:r,height:a}=e;for(let o=0;o<a;o++)for(let n=0;n<r;n++)q(e,V(e,"horizontal"===t?r-1-n:n,"vertical"===t?a-1-o:o),i,V(i,n,o));return i}function U(e,t){let i=Math.max(1,Math.round(t.width)),r=Math.max(1,Math.round(t.height));if(i===e.width&&r===e.height)return L(i,r,new Uint8ClampedArray(e.data));let a=e;for(;a.width>=2*i;)a=function(e){let t=Math.ceil(e.width/2),i=L(t,e.height);for(let r=0;r<e.height;r++)for(let a=0;a<t;a++){let t=V(e,2*a,r),o=V(e,Math.min(2*a+1,e.width-1),r),n=V(i,a,r);for(let r=0;r<4;r++)i.data[n+r]=(e.data[t+r]+e.data[o+r])/2}return i}(a);for(;a.height>=2*r;)a=function(e){let t=Math.ceil(e.height/2),i=L(e.width,t);for(let r=0;r<t;r++)for(let t=0;t<e.width;t++){let a=V(e,t,2*r),o=V(e,t,Math.min(2*r+1,e.height-1)),n=V(i,t,r);for(let t=0;t<4;t++)i.data[n+t]=(e.data[a+t]+e.data[o+t])/2}return i}(a);return a.width===i&&a.height===r?L(i,r,new Uint8ClampedArray(a.data)):function(e,t,i){let r=L(t,i),a=e.width/t,o=e.height/i;for(let c=0;c<i;c++){let i=(c+.5)*o-.5,u=Math.floor(i),p=i-u,g=H(u,e.height),f=H(u+1,e.height);for(let i=0;i<t;i++){let t=(i+.5)*a-.5,o=Math.floor(t),u=t-o,m=H(o,e.width),b=H(o+1,e.width),x=V(e,m,g),y=V(e,b,g),w=V(e,m,f),j=V(e,b,f),M=V(r,i,c);for(let t=0;t<4;t++){var n,s,l,d,h;let i=(n=e.data[x+t],s=e.data[y+t],n+(s-n)*u),a=(l=e.data[w+t],d=e.data[j+t],l+(d-l)*u);r.data[M+t]=(h=i)+(a-h)*p}}}return r}(a,i,r)}function q(e,t,i,r){i.data[r]=e.data[t],i.data[r+1]=e.data[t+1],i.data[r+2]=e.data[t+2],i.data[r+3]=e.data[t+3]}function H(e,t){return e<0?0:e>=t?t-1:e}function X(e,t){let i=L(e.width,e.height,new Uint8ClampedArray(e.data));for(let e=0;e<i.data.length;e+=4)i.data[e]=t(i.data[e],0),i.data[e+1]=t(i.data[e+1],1),i.data[e+2]=t(i.data[e+2],2);return i}function Y(e,t){if(0===t)return et(e);let i=t/100*255;return X(e,e=>e+i)}function Z(e,t){if(0===t)return et(e);let i=t/100*255,r=259*(i+255)/(255*(259-i));return X(e,e=>r*(e-128)+128)}function W(e,t){if(0===t)return et(e);let i=1+t/100,r=L(e.width,e.height,new Uint8ClampedArray(e.data));for(let e=0;e<r.data.length;e+=4){let t=r.data[e],a=r.data[e+1],o=r.data[e+2],n=.299*t+.587*a+.114*o;r.data[e]=n+(t-n)*i,r.data[e+1]=n+(a-n)*i,r.data[e+2]=n+(o-n)*i}return r}function G(e,t){if(0===t)return et(e);let i=t/100*40;return X(e,(e,t)=>0===t?e+i:2===t?e-i:e)}function K(e,t,i=20){let r=Math.round(Math.max(0,Math.min(100,t))/100*i);return r<=0?et(e):Q(Q(e,r,"horizontal"),r,"vertical")}function J(e,t){let i=e;return K(i=G(i=W(i=Z(i=Y(i,t.brightness),t.contrast),t.saturation),t.warmth),t.blur)}function Q(e,t,i){let r=L(e.width,e.height),{width:a,height:o,data:n}=e,s="horizontal"===i,l=s?o:a,d=s?a:o,h=2*t+1;for(let e=0;l>e;e++)for(let i=0;i<4;i++){let l=0;for(let r=-t;t>=r;r++)l+=ee(n,a,o,s,e,r,i);for(let c=0;d>c;c++){let d=(s?e*a+c:c*a+e)*4+i;r.data[d]=l/h;let u=ee(n,a,o,s,e,c-t,i);l+=ee(n,a,o,s,e,c+t+1,i)-u}}return r}function ee(e,t,i,r,a,o,n){let s=(r?t:i)-1,l=o<0?0:o>s?s:o;return e[(r?a*t+l:l*t+a)*4+n]}function et(e){return L(e.width,e.height,new Uint8ClampedArray(e.data))}function ei(e,t){let i=L(e.width,e.height,new Uint8ClampedArray(e.data));for(let e=0;e<i.data.length;e+=4){let[r,a,o]=t(i.data[e],i.data[e+1],i.data[e+2]);i.data[e]=r,i.data[e+1]=a,i.data[e+2]=o}return i}Object.freeze(Object.defineProperty({__proto__:null,applyFinetune:J,blur:K,brightness:Y,contrast:Z,saturation:W,warmth:G},Symbol.toStringTag,{value:"Module"}));let er=e=>L(e.width,e.height,new Uint8ClampedArray(e.data)),ea=new Map;function eo(e){return ea.set(e.id,e),()=>{ea.get(e.id)===e&&ea.delete(e.id)}}function en(e,t){let i=ea.get(t);return i?i.apply(e):er(e)}function es(e){return new ImageData(e.data,e.width,e.height)}[{id:"original",label:"Original",apply:er},{id:"invert",label:"Invert",apply:e=>ei(e,(e,t,i)=>[255-e,255-t,255-i])},{id:"grayscale",label:"Black & White",apply:e=>ei(e,(e,t,i)=>{let r=.299*e+.587*t+.114*i;return[r,r,r]})},{id:"sepia",label:"Sepia",apply:e=>ei(e,(e,t,i)=>[.393*e+.769*t+.189*i,.349*e+.686*t+.168*i,.272*e+.534*t+.131*i])},{id:"solarize",label:"Solarize",apply:e=>ei(e,(e,t,i)=>[e<128?e:255-e,t<128?t:255-t,i<128?i:255-i])},{id:"clarendon",label:"Clarendon",apply:e=>G(W(Z(e,20),25),-10)},{id:"gingham",label:"Gingham",apply:e=>G(W(Z(e,-10),-15),12)}].forEach(eo);class el{register(e){let t=this.locales.get(e.id);return this.locales.set(e.id,{...t??{},...e.messages}),()=>{t?this.locales.set(e.id,t):this.locales.delete(e.id)}}has(e){return this.locales.has(e)}get(e){return this.locales.get(e)}list(){return[...this.locales.keys()]}translator(e){return function(e={},t={}){return(i,r)=>{let a=e[i]??t[i]??i;return r?a.replace(/\{(\w+)\}/g,(e,t)=>t in r?r[t]+"":e):a}}(this.locales.get(e)??{})}constructor(){r(this,"locales",new Map)}}let ed=new Set(["value","checked","disabled","selected","innerHTML"]);function eh(e,t={},i=[]){return{kind:"element",tag:e,key:t.key,props:t,children:function(e){let t=Array.isArray(e)?e:[e],i=[];for(let e of t)null!=e&&!1!==e&&!0!==e&&i.push("object"==typeof e?e:{kind:"text",text:e+""});return i}(i)}}function ec(e){return"element"===e.kind}let eu={};class ep{render(e){if(null===this.prev){let t=this.mount(e);this.host.insert(this.container,t,null)}else if(eg(this.prev,e))this.patch(this.prev,e);else{let t=this.mount(e),i=this.prev.node;this.host.insert(this.container,t,this.host.nextSibling(i)),this.host.remove(this.container,i)}this.prev=e}unmount(){this.prev&&(this.host.remove(this.container,this.prev.node),this.prev=null)}mount(e){if(!ec(e)){let t=this.host.createText(e.text);return e.node=t,t}let t=this.host.createElement(e.tag);for(let i of(e.node=t,this.applyProps(t,eu,e.props),e.children))this.host.insert(t,this.mount(i),null);return t}patch(e,t){let i=e.node;return(t.node=i,ec(t)&&ec(e))?(this.applyProps(i,e.props,t.props),this.patchChildren(i,e.children,t.children)):ec(t)||t.text===e.text||this.host.setText(i,t.text),i}applyProps(e,t,i){for(let r of(this.applyClass(e,t.class,i.class),this.applyStyle(e,t.style??{},i.style??{}),this.applyEvents(e,t.on??{},i.on??{}),Object.keys(i))){if(ef(r))continue;let a=i[r];a!==t[r]&&this.applyAttr(e,r,a)}for(let r of Object.keys(t))ef(r)||r in i||(ed.has(r)?this.host.setProperty(e,r,""):this.host.removeAttribute(e,r))}applyAttr(e,t,i){ed.has(t)?this.host.setProperty(e,t,i):!1===i||null==i?this.host.removeAttribute(e,t):this.host.setAttribute(e,t,!0===i?"":"string"==typeof i?i:"number"==typeof i||"boolean"==typeof i||"bigint"==typeof i?i+"":JSON.stringify(i)??"")}applyClass(e,t,i){t!==i&&(i?this.host.setAttribute(e,"class",i):this.host.removeAttribute(e,"class"))}applyStyle(e,t,i){for(let r of Object.keys(i))i[r]!==t[r]&&this.host.setStyle(e,r,i[r]+"");for(let r of Object.keys(t))r in i||this.host.removeStyle(e,r)}applyEvents(e,t,i){let r=this.events.get(e);for(let a of Object.keys(t))!(a in i)&&r?.has(a)&&(this.host.removeEventListener(e,a,r.get(a).wrapper),r.delete(a));for(let t of Object.keys(i)){let a=i[t],o=r?.get(t);if(o){o.handler=a;continue}r||(r=new Map,this.events.set(e,r));let n={handler:a,wrapper:e=>n.handler(e)};r.set(t,n),this.host.addEventListener(e,t,n.wrapper)}}patchChildren(e,t,i){let r=0,a=t.length-1,o=0,n=i.length-1,s=null;for(;r<=a&&o<=n;){let l=t[r],d=t[a],h=i[o],c=i[n];if(eg(l,h)){this.patch(l,h),r++,o++;continue}if(eg(d,c)){this.patch(d,c),a--,n--;continue}if(eg(l,c)){this.patch(l,c),this.host.insert(e,l.node,this.host.nextSibling(d.node)),r++,n--;continue}if(eg(d,h)){this.patch(d,h),this.host.insert(e,d.node,l.node),a--,o++;continue}s??=function(e,t,i){let r=new Map;for(let a=t;a<=i;a++){let t=e[a].key;void 0!==t&&r.set(t,a)}return r}(t,r,a);let u=void 0!==h.key?s.get(h.key):void 0;if(void 0===u)this.host.insert(e,this.mount(h),l.node);else{let i=t[u];this.patch(i,h),i.node=void 0,this.host.insert(e,h.node,l.node)}o++}if(r>a){let t=i[n+1]?.node??null;for(let r=o;n>=r;r++)this.host.insert(e,this.mount(i[r]),t)}else if(o>n)for(let i=r;a>=i;i++){let r=t[i].node;r&&this.host.remove(e,r)}}constructor(e,t){r(this,"events",new WeakMap),r(this,"prev",null),this.host=e,this.container=t}}function eg(e,t){return e.kind===t.kind&&("text"===e.kind||e.tag===t.tag&&e.key===t.key)}function ef(e){return"key"===e||"class"===e||"style"===e||"on"===e}class ev{createElement(e){return this.doc.createElement(e)}createText(e){return this.doc.createTextNode(e)}setText(e,t){e.textContent=t}insert(e,t,i){e.insertBefore(t,i)}remove(e,t){t.parentNode===e&&e.removeChild(t)}parent(e){return e.parentNode}nextSibling(e){return e.nextSibling}setAttribute(e,t,i){e.setAttribute(t,i)}removeAttribute(e,t){e.removeAttribute(t)}setProperty(e,t,i){e[t]=i}setStyle(e,t,i){e.style.setProperty(t,i)}removeStyle(e,t){e.style.removeProperty(t)}addEventListener(e,t,i){e.addEventListener(t,i)}removeEventListener(e,t,i){e.removeEventListener(t,i)}constructor(e=document){this.doc=e}}class em{register(e){return this.tools.set(e.id,e),this.order.set(e.id,e.order??em.UNORDERED_BASE+this.seq++),()=>{this.tools.get(e.id)===e&&(this.tools.delete(e.id),this.order.delete(e.id))}}get(e){return this.tools.get(e)}has(e){return this.tools.has(e)}list(){return[...this.tools.values()].sort((e,t)=>(this.order.get(e.id)??0)-(this.order.get(t.id)??0))}first(){return this.list()[0]}constructor(){r(this,"tools",new Map),r(this,"seq",0),r(this,"order",new Map)}}function eb(e){return eh("span",{class:"jie-icon",innerHTML:e})}function ex(){return eh("span",{class:"jie-spinner"})}function ey(e){let t=["jie-btn"];"primary"===e.variant&&t.push("jie-btn--primary"),"icon"===e.variant&&t.push("jie-btn--icon"),e.active&&t.push("jie-btn--active"),e.busy&&t.push("jie-btn--busy"),e.className&&t.push(e.className);let i=[];return e.busy?i.push(ex()):e.icon&&i.push(eb(e.icon)),e.label&&i.push(eh("span",{},e.label)),eh("button",{key:e.key,class:t.join(" "),type:"button",disabled:e.disabled??!1,title:e.title??e.label??"",on:{click:e.onClick}},i)}function ew(e){let t=e.onStart,i={input:t=>e.onInput(Number(t.target.value))};t&&(i.pointerdown=()=>t());let r=e.max-e.min||1,a=Math.min(100,Math.max(0,(e.value-e.min)/r*100));return eh("div",{class:"jie-slider"},[eh("span",{class:"jie-slider__label"},e.label),eh("input",{class:"jie-range",type:"range",min:e.min+"",max:e.max+"",step:(e.step??1)+"",value:e.value+"",style:{"--jie-range-fill":`${a}%`},on:i}),eh("span",{class:"jie-slider__value"},Math.round(e.value)+"")])}function ej(e){return eh("label",{class:"jie-field"},[eh("span",{},e.label),eh("span",{style:{display:"flex","align-items":"center",gap:"6px"}},[eh("input",{class:"jie-input",type:"number",value:e.value+"",on:{change(t){let i=Number(t.target.value);Number.isFinite(i)&&e.onChange(i)}}}),e.suffix?eh("span",{},e.suffix):null])])}function eM(e,t,i){return eh("div",{class:"jie-toolrow"},e.map(e=>ey({key:e.id,label:e.label,icon:e.icon,active:e.id===t,onClick:()=>i(e.id)})))}r(em,"UNORDERED_BASE",1e6);let ek=e=>`<svg viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${e}</svg>`,eS={adjust:ek('<path d="M4 8h2M9 8h11M4 16h11M18 16h2"/><circle cx="7.5" cy="8" r="1.6"/><circle cx="16.5" cy="16" r="1.6"/>'),finetune:ek('<path d="M4 7h12M4 12h16M4 17h8"/><circle cx="18" cy="7" r="1.6"/><circle cx="12" cy="17" r="1.6"/>'),filters:ek('<circle cx="9" cy="9" r="5"/><circle cx="15" cy="9" r="5"/><circle cx="12" cy="15" r="5"/>'),watermark:ek('<rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 15l5-4 4 3 3-2 6 4"/><circle cx="8.5" cy="9.5" r="1.4"/>'),annotate:ek('<path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"/>'),resize:ek('<path d="M9 3H5a2 2 0 0 0-2 2v4M21 15v4a2 2 0 0 1-2 2h-4"/><path d="M8 16l8-8M16 8h-4M16 8v4"/>'),crop:ek('<path d="M6 2v14a2 2 0 0 0 2 2h14"/><path d="M2 6h14a2 2 0 0 1 2 2v14"/>'),rotate:ek('<path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/>'),flipX:ek('<path d="M12 3v18"/><path d="M8 7 4 12l4 5Z"/><path d="M16 7l4 5-4 5Z"/>'),flipY:ek('<path d="M3 12h18"/><path d="M7 8 12 4l5 4Z"/><path d="M7 16l5 4 5-4Z"/>'),undo:ek('<path d="M9 7 4 12l5 5"/><path d="M4 12h11a5 5 0 0 1 0 10h-1"/>'),redo:ek('<path d="m15 7 5 5-5 5"/><path d="M20 12H9a5 5 0 0 0 0 10h1"/>'),reset:ek('<path d="M3 12a9 9 0 1 1 2.6 6.3"/><path d="M3 21v-5h5"/>'),trash:ek('<path d="M4 7h16M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2M6 7l1 13a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1l1-13M10 11v6M14 11v6"/>'),plus:ek('<path d="M12 5v14M5 12h14"/>'),minus:ek('<path d="M5 12h14"/>'),zoomIn:ek('<circle cx="10.5" cy="10.5" r="7.5"/><path d="M21 21l-5.2-5.2M10.5 7.5v6M7.5 10.5h6"/>'),zoomOut:ek('<circle cx="10.5" cy="10.5" r="7.5"/><path d="M21 21l-5.2-5.2M7.5 10.5h6"/>'),posTopLeft:ek('<path d="M17 17 7 7M7 13V7h6"/>'),posTop:ek('<path d="M12 19V6M7 11l5-5 5 5"/>'),posTopRight:ek('<path d="M7 17 17 7M11 7h6v6"/>'),posLeft:ek('<path d="M19 12H6M11 7l-5 5 5 5"/>'),posCenter:ek('<circle cx="12" cy="12" r="6.5"/><circle cx="12" cy="12" r="2" fill="currentColor" stroke="none"/>'),posRight:ek('<path d="M5 12h13M13 7l5 5-5 5"/>'),posBottomLeft:ek('<path d="M17 7 7 17M7 11v6h6"/>'),posBottom:ek('<path d="M12 5v13M7 13l5 5 5-5"/>'),posBottomRight:ek('<path d="M7 7l10 10M17 11v6h-6"/>'),font:ek('<path d="M4 20 9.5 6h1L16 20M6 15h8M17 20l3-9h.5l3 9M18 17h4"/>'),focus:ek('<circle cx="12" cy="12" r="9"/><circle cx="12" cy="12" r="3.5"/>'),lock:ek('<rect x="5" y="11" width="14" height="9" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/>'),unlock:ek('<rect x="5" y="11" width="14" height="9" rx="2"/><path d="M8 11V7a4 4 0 0 1 7.5-2"/>'),text:ek('<path d="M5 5h14M12 5v14M9 19h6"/>'),brightness:ek('<circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M2 12h2M20 12h2M5 5l1.5 1.5M17.5 17.5 19 19M19 5l-1.5 1.5M6.5 17.5 5 19"/>'),contrast:ek('<circle cx="12" cy="12" r="9"/><path d="M12 3a9 9 0 0 0 0 18Z" fill="currentColor" stroke="none"/>'),blur:ek('<path d="M12 3s6 6.5 6 11a6 6 0 0 1-12 0c0-4.5 6-11 6-11Z"/>'),book:ek('<path d="M4 5a2 2 0 0 1 2-2h5v18H6a2 2 0 0 1-2-2Z"/><path d="M20 5a2 2 0 0 0-2-2h-5v18h5a2 2 0 0 0 2-2Z"/>')},ez={id:"adjust",label:"Adjust",icon:eS.adjust,order:0,defaultTool:"crop",renderPanel({state:e,update:t,t:i}){let r=w(e),a=j(e);return eh("div",{class:"jie-toolrow"},[ey({label:i("Crop"),icon:eS.crop,active:a,onClick:()=>t({activeTab:"adjust",activeTool:a?null:"crop"})}),ey({label:i("Rotate"),icon:eS.rotate,onClick:()=>t({design:{rotate:r.rotate+90}})}),ey({label:i("Flip X"),icon:eS.flipX,onClick:()=>t({design:{flip:{horizontal:!r.flip.horizontal}}})}),ey({label:i("Flip Y"),icon:eS.flipY,onClick:()=>t({design:{flip:{vertical:!r.flip.vertical}}})})])}},eC=[{id:"brightness",label:"Brightness",icon:eS.brightness,min:-100,max:100},{id:"contrast",label:"Contrast",icon:eS.contrast,min:-100,max:100},{id:"saturation",label:"Saturation",icon:eS.filters,min:-100,max:100},{id:"blur",label:"Blur",icon:eS.blur,min:0,max:100},{id:"warmth",label:"Warmth",icon:eS.brightness,min:-100,max:100}],e_={id:"finetune",label:"Finetune",icon:eS.finetune,order:1,defaultTool:"brightness",renderPanel({state:e,update:t,t:i}){var r;let a=(r=e.activeTool,eC.find(e=>e.id===r)??eC[0]),o=w(e).finetune[a.id],n=(e,i)=>{t({design:{finetune:{[a.id]:e}},commit:i})};return eh("div",{class:"jie-panel-stack",style:{display:"contents"}},[ew({label:i(a.label),value:o,min:a.min,max:a.max,onStart:()=>n(o,!0),onInput:e=>n(e,!1)}),eM(eC.map(e=>({id:e.id,label:i(e.label),icon:e.icon})),a.id,e=>t({activeTab:"finetune",activeTool:e}))])}},eT={id:"filters",label:"Filters",icon:eS.filters,order:2,renderPanel({state:e,update:t,t:i}){let r=w(e).filter;return eh("div",{class:"jie-thumbs"},[...ea.values()].map(e=>eh("button",{key:e.id,class:"jie-thumb",type:"button","aria-pressed":(e.id===r)+"",on:{click:()=>t({design:{filter:e.id}})}},[eh("canvas",{class:"jie-thumb__swatch","data-jie-filter-thumb":e.id}),eh("span",{},i(e.label))])))}},eP={id:"focus",label:"Focus",icon:eS.focus,order:3,defaultTool:"radial",renderPanel({state:e,update:t,t:i}){let r=w(e).focus??{shape:"radial",x:.5,y:.5,radius:.28,angle:0,amount:60},a=null!==w(e).focus,o=(e,i)=>t({design:{focus:{...r,...e}},commit:i});return eh("div",{class:"jie-panel-stack",style:{display:"contents"}},[eh("div",{class:"jie-toolrow"},[ew({label:i("Intensity"),value:r.amount,min:0,max:100,onStart:()=>o({amount:r.amount},!0),onInput:e=>o({amount:e},!1)}),ew({label:i("Radius"),value:Math.round(100*r.radius),min:5,max:90,onStart:()=>o({radius:r.radius},!0),onInput:e=>o({radius:e/100},!1)}),a?ey({variant:"icon",icon:eS.trash,title:i("Reset"),onClick:()=>t({design:{focus:null}})}):null]),eM([{id:"radial",label:i("Radial")},{id:"linear",label:i("Linear")}],r.shape,e=>o({shape:e},!0))])}},eE=[{align:"left",valign:"top",icon:eS.posTopLeft},{align:"center",valign:"top",icon:eS.posTop},{align:"right",valign:"top",icon:eS.posTopRight},{align:"left",valign:"middle",icon:eS.posLeft},{align:"center",valign:"middle",icon:eS.posCenter},{align:"right",valign:"middle",icon:eS.posRight},{align:"left",valign:"bottom",icon:eS.posBottomLeft},{align:"center",valign:"bottom",icon:eS.posBottom},{align:"right",valign:"bottom",icon:eS.posBottomRight}],eA=function(e="id"){let t=0;return()=>`${e}-${++t}`}("jie"),eR="text-color",eI="text-font",eB={id:"annotate",label:"Text",icon:eS.text,order:4,defaultTool:"text",renderPanel({state:e,update:t,t:i}){var r,a,n;let s,l,d,h=w(e),c=h.annotations[0];if(!c)return eh("div",{class:"jie-toolrow"},[ey({label:i("Add text"),icon:eS.text,variant:"primary",onClick(){let e=function(e,t={}){return{id:e,type:"text",text:"Text",x:.5,y:.5,fontSize:.06,fontFamily:o[0].value,color:"#eb5757",bold:!1,italic:!1,align:"center",valign:"middle",...t}}(eA());t({design:{annotations:[e]},selectedAnnotationId:e.id})}})]);let u=e=>{var i,r;return t({design:{annotations:(i=h.annotations,r=c.id,i.map(t=>t.id===r?{...t,...e}:t))}})};return eh("div",{class:"jie-toolrow"},[eh("input",{class:"jie-input",type:"text",value:c.text,on:{input:e=>u({text:e.target.value})}}),(s=(r={value:c.fontFamily,fonts:e.fonts,title:i("Font"),open:e.activePopover===eI,onToggle:()=>t({activePopover:e.activePopover===eI?null:eI}),onPick(e){u({fontFamily:e}),t({activePopover:null})}}).fonts.find(e=>e.value===r.value),l=[eh("button",{class:"jie-fontselect__trigger",type:"button",title:r.title??"Font","aria-haspopup":"listbox","aria-expanded":r.open+"",on:{click:()=>r.onToggle()}},[eb(eS.font),eh("span",{style:{"font-family":r.value}},s?.label??"Font"),eb(eS.book)])],r.open&&l.push(eh("div",{class:"jie-popover__backdrop",on:{click:()=>r.onToggle()}}),eh("div",{class:"jie-popover jie-fontlist",role:"listbox"},r.fonts.map(e=>eh("button",{key:e.value,class:"jie-fontlist__item",type:"button","aria-pressed":(e.value===r.value)+"",style:{"font-family":e.value},on:{click:()=>r.onPick(e.value)}},e.label)))),eh("div",{class:"jie-fontselect"},l)),(d=[eh("button",{class:"jie-color",type:"button",title:(a={value:c.color,palette:e.palette,title:i("Colour"),open:e.activePopover===eR,onToggle:()=>t({activePopover:e.activePopover===eR?null:eR}),onPick(e){u({color:e}),t({activePopover:null})}}).title??"Colour",style:{background:a.value},"aria-haspopup":"true","aria-expanded":a.open+"",on:{click:()=>a.onToggle()}})],a.open&&d.push(eh("div",{class:"jie-popover__backdrop",on:{click:()=>a.onToggle()}}),eh("div",{class:"jie-popover jie-swatches",role:"listbox"},a.palette.map(e=>eh("button",{key:e,class:"jie-swatch",type:"button",title:e,style:{background:e},"aria-pressed":(e.toLowerCase()===a.value.toLowerCase())+"",on:{click:()=>a.onPick(e)}})))),eh("div",{class:"jie-colorpicker"},d)),ey({label:"B",className:"jie-btn--bold",active:c.bold,onClick:()=>u({bold:!c.bold})}),ey({label:"I",className:"jie-btn--italic",active:c.italic,onClick:()=>u({italic:!c.italic})}),ew({label:i("Size"),value:Math.round(100*c.fontSize),min:1,max:40,onInput:e=>u({fontSize:e/100})}),(n={align:c.align,valign:c.valign,onPick:(e,t)=>u({align:e,valign:t,x:"left"===e?.04:"right"===e?.96:.5,y:"top"===t?.04:"bottom"===t?.96:.5})},eh("div",{class:"jie-posgrid",role:"group"},eE.map(e=>eh("button",{key:`${e.valign}-${e.align}`,class:"jie-posgrid__cell",type:"button","data-pos":`${e.valign}-${e.align}`,"aria-pressed":(e.align===n.align&&e.valign===n.valign)+"",on:{click:()=>n.onPick(e.align,e.valign)}},[eb(e.icon)])))),ey({variant:"icon",icon:eS.trash,title:i("Delete"),onClick(){var e,i;return t({design:{annotations:(e=h.annotations,i=c.id,e.filter(e=>e.id!==i))},selectedAnnotationId:null})}})])}},e$={id:"resize",label:"Resize",icon:eS.resize,order:5,renderPanel({state:e,update:t,t:i}){let r=_(e);if(!r)return null;let a="unlocked"!==e.activeTool,o=i=>t({design:{resize:function(e,t,i,r=1){let a=e.width/e.height;if(!i)return{width:Math.max(r,Math.round(t.width??e.width)),height:Math.max(r,Math.round(t.height??e.height))};if(void 0!==t.width){let e=Math.max(r,Math.round(t.width));return{width:e,height:Math.max(r,Math.round(e/a))}}if(void 0!==t.height){let e=Math.max(r,Math.round(t.height));return{width:Math.max(r,Math.round(e*a)),height:e}}return{...e}}(r,i,a,e.minResizeSize)}});return eh("div",{class:"jie-fieldrow"},[ej({label:i("Width"),value:r.width,suffix:i("px"),onChange:e=>o({width:e})}),ey({variant:"icon",icon:a?eS.lock:eS.unlock,title:a?i("Aspect ratio locked"):i("Aspect ratio unlocked"),onClick:()=>t({activeTab:"resize",activeTool:a?"unlocked":"locked"})}),ej({label:i("Height"),value:r.height,suffix:i("px"),onChange:e=>o({height:e})}),ey({variant:"icon",icon:eS.reset,title:i("Reset size"),onClick:()=>t({design:{resize:null}})})])}};function eO(e){return parseInt(e+e,16)}function eD(e,t){return parseInt(e.slice(t,t+2),16)}let eL=/image\/(jpe?g|bmp)/i;function eV(e,t){if("u"<typeof document)throw Error("No DOM available: provide a CanvasFactory to the codec");let i=document.createElement("canvas");return i.width=e,i.height=t,{get width(){return i.width},set width(v){i.width=v},get height(){return i.height},set height(v){i.height=v},getContext:e=>i.getContext(e),toBlobAsync:(e,t)=>new Promise((r,a)=>{i.toBlob(e=>e?r(e):a(Error("canvas.toBlob returned null")),e,t)})}}class eF{async decode(e){var t,i,r;let a,o=await this.toBitmap(e),n=(t=o.width,i=o.height,r={maxSize:this.maxSize,maxPixels:this.maxPixels},a=1,r.maxSize&&r.maxSize>0&&(a=Math.min(a,r.maxSize/Math.max(t,i))),r.maxPixels&&r.maxPixels>0&&(a=Math.min(a,Math.sqrt(r.maxPixels/(t*i)))),Math.min(1,a)),s=Math.max(1,Math.round(o.width*n)),l=Math.max(1,Math.round(o.height*n)),d=this.createCanvas(s,l),h=this.context(d);h.imageSmoothingEnabled=!0,h.imageSmoothingQuality="high",h.drawImage(o,0,0,s,l),"close"in o&&"function"==typeof o.close&&o.close();let c=h.getImageData(0,0,s,l);return L(c.width,c.height,c.data)}async encode(e,t={}){let i,{type:r="image/png",quality:a=.92,background:o}=t,n=void 0!==o||eL.test(r)?function(e,[t,i,r]){let a=L(e.width,e.height);for(let o=0;o<e.data.length;o+=4){let n=e.data[o+3]/255,s=1-n;a.data[o]=e.data[o]*n+t*s,a.data[o+1]=e.data[o+1]*n+i*s,a.data[o+2]=e.data[o+2]*n+r*s,a.data[o+3]=255}return a}(e,(i=(o??"#ffffff").trim().replace(/^#/,""),/^[0-9a-f]{3}$/i.test(i)?[eO(i[0]),eO(i[1]),eO(i[2])]:/^[0-9a-f]{6}$/i.test(i)?[eD(i,0),eD(i,2),eD(i,4)]:[255,255,255])):e,s=this.createCanvas(n.width,n.height);return this.context(s).putImageData(es(n),0,0),s.toBlobAsync(r,a)}context(e){let t=e.getContext("2d");if(!t)throw Error("Unable to acquire a 2D canvas context");return t}async toBitmap(e){return"function"==typeof createImageBitmap?createImageBitmap(e,{imageOrientation:"from-image"}):new Promise((t,i)=>{let r=URL.createObjectURL(e),a=new Image;a.style.imageOrientation="from-image",a.onload=()=>{URL.revokeObjectURL(r),t(a)},a.onerror=()=>{URL.revokeObjectURL(r),i(Error("Failed to decode image blob"))},a.src=r})}constructor(e=eV,t={}){r(this,"maxPixels",void 0),r(this,"maxSize",void 0),this.createCanvas=e,this.maxPixels=t.maxPixels??0x1000000,this.maxSize=t.maxSize}}class eN{decode(e){return this.codec.decode(e)}render(e,t){let i=function(e,t){let i=e;if(t.flip.horizontal&&(i=N(i,"horizontal")),t.flip.vertical&&(i=N(i,"vertical")),0!==t.rotate&&(i=function(e,t){let i=(Math.round(t/90)%4+4)%4;if(0===i)return L(e.width,e.height,new Uint8ClampedArray(e.data));let{width:r,height:a}=e,o=1===i||3===i,n=L(o?a:r,o?r:a);for(let t=0;t<a;t++)for(let o=0;o<r;o++){let s,l;1===i?(s=a-1-t,l=o):2===i?(s=r-1-o,l=a-1-t):(s=t,l=r-1-o),q(e,V(e,o,t),n,V(n,s,l))}return n}(i,t.rotate)),0!==t.angle){let e=t.crop??{x:0,y:0,width:i.width,height:i.height};i=function(e,t,i){let r=Math.max(1,Math.round(t.width)),a=Math.max(1,Math.round(t.height)),o=L(r,a),n=t.x+t.width/2,s=t.y+t.height/2,l=i*Math.PI/180,d=Math.cos(l),h=Math.sin(l);for(let t=0;t<a;t++){let i=t+.5-a/2;for(let a=0;r>a;a++){let l=a+.5-r/2;!function(e,t,i,r,a){if(t<=-1||i<=-1||t>=e.width||i>=e.height){r.data[a]=0,r.data[a+1]=0,r.data[a+2]=0,r.data[a+3]=0;return}let o=Math.floor(t),n=Math.floor(i),s=t-o,l=i-n,d=H(o,e.width),h=H(o+1,e.width),c=H(n,e.height),u=H(n+1,e.height),p=V(e,d,c),g=V(e,h,c),f=V(e,d,u),m=V(e,h,u);for(let t=0;t<4;t++){var b,x;let i=(b=e.data[p+t],b+(e.data[g+t]-b)*s),o=(x=e.data[f+t],x+(e.data[m+t]-x)*s);r.data[a+t]=i+(o-i)*l}}(e,n+l*d-i*h-.5,s+l*h+i*d-.5,o,V(o,a,t))}}return o}(i,e,t.angle)}else t.crop&&(i=function(e,t){let i,r,a=y({x:i=Math.round(t.x),y:r=Math.round(t.y),width:Math.round(t.x+t.width)-i,height:Math.round(t.y+t.height)-r},e),o=L(a.width,a.height);for(let t=0;t<a.height;t++){let i=V(e,a.x,a.y+t),r=V(o,0,t);o.data.set(e.data.subarray(i,i+4*a.width),r)}return o}(i,t.crop));return t.resize&&(i=U(i,t.resize)),i=en(i=J(i,t.finetune),t.filter),t.focus&&(i=function(e,t){if(t.amount<=0)return L(e.width,e.height,new Uint8ClampedArray(e.data));let i=K(e,t.amount,32),{width:r,height:a}=e,o=L(r,a),n=Math.min(r,a),s=t.x*r,l=t.y*a,d=t.radius*n,h=Math.max(.06*n,.9*d),c=t.angle*Math.PI/180,u=-Math.sin(c),p=Math.cos(c);for(let n=0;n<a;n++)for(let a=0;a<r;a++){let r=a-s,c=n-l,g=function(e,t,i){if(t<=e)return+(i>=t);let r=Math.min(1,Math.max(0,(i-e)/(t-e)));return r*r*(3-2*r)}(d,d+h,"radial"===t.shape?Math.hypot(r,c):Math.abs(r*u+c*p)),f=V(o,a,n);for(let t=0;t<4;t++)o.data[f+t]=e.data[f+t]+(i.data[f+t]-e.data[f+t])*g}return o}(i,t.focus)),i}(e,t);return function(e,t,i){if(0===i.length)return t;let r=e(t.width,t.height).getContext("2d");if(!r)throw Error("Unable to acquire a 2D canvas context");for(let e of(r.putImageData(es(t),0,0),i)){if("text"!==e.type)continue;let i=function(e,t){let i=Math.max(1,Math.round(e.fontSize*t.height)),r=e.bold?"bold":"normal",a=e.italic?"italic":"normal";return{text:e.text,x:Math.round(e.x*t.width),y:Math.round(e.y*t.height),fontPx:i,font:`${a} ${r} ${i}px ${e.fontFamily}`,color:e.color,align:e.align,baseline:e.valign}}(e,t);r.font=i.font,r.fillStyle=i.color,r.textAlign=i.align,r.textBaseline=i.baseline,function(e,t){let i=t.text.split(`
|
|
792
|
+
`),r=1.2*t.fontPx,a=(i.length-1)*r,o="middle"===t.baseline?t.y-a/2:"bottom"===t.baseline?t.y-a:t.y;i.forEach((i,a)=>e.fillText(i,t.x,o+a*r))}(r,i)}let a=r.getImageData(0,0,t.width,t.height);return L(a.width,a.height,a.data)}(this.createCanvas,i,t.annotations)}async toBlob(e,t,i){return this.codec.encode(this.render(e,t),i)}constructor(e){r(this,"codec",void 0),r(this,"createCanvas",void 0),this.codec=e.codec,this.createCanvas=e.createCanvas}}function eU(e,t,i){e.update({zoom:t.zoom*i})}class eq{get state(){return this.store.getState()}update(e){return this.store.update(e),this}async save(){return this.handleSave()}async saveAs(){return this.handleSaveAs()}reset(){return this.handleReset(),this}use(e){let t=e.setup(this.api());return"function"==typeof t&&this.disposers.push(t),this}async fromBlob(e){this.store.update({status:"loading",error:null});try{let t=await this.processor.decode(e);if(this.destroyed)return this;this.source=t,this.previewSource=eH(t,this.previewMaxSize),this.thumbSource=eH(t,160),this.thumbVersion++,this.store.update({source:{width:t.width,height:t.height,name:e instanceof File?e.name:null,mimeType:e.type||"image/png"},resetHistory:!0,status:"ready"})}catch(e){this.store.update({status:"error",error:e instanceof Error?e.message:e+""})}return this}async toBlob(e){if(!this.source)throw Error("No image loaded — call fromBlob() first");let t=w(this.store.getState());this.store.update({status:"exporting"});try{return t.annotations.length>0&&"u">typeof document&&document.fonts&&await document.fonts.ready,await this.processor.toBlob(this.source,t,e)}finally{this.store.update({status:"ready"})}}destroy(){if(!this.destroyed){for(let e of(this.destroyed=!0,this.clearBusyTimer(),this.dragCleanup?.(),this.resizeObserver?.disconnect(),this.disposers.splice(0)))e();this.renderer.unmount(),this.store.destroy()}}api(){return{registerTool:e=>this.registry.register(e),registerFilter:e=>eo(e),registerLocale:e=>this.locales.register(e),getState:()=>this.store.getState(),update:e=>this.store.update(e)}}translator(){return this.locales.translator(this.store.getState().locale)}appContext(){return{update:e=>this.store.update(e),tools:this.registry.list(),t:this.translator(),onSave:()=>void this.handleSave(),onSaveAs:()=>void this.handleSaveAs(),onReset:()=>this.handleReset(),beginCropDrag:(e,t)=>this.beginCropDrag(e,t),beginCropRotate:e=>this.beginCropRotate(e)}}handleReset(){z(this.store.getState())&&this.confirm(this.translator()("Reset all changes? You can still undo afterwards."))&&this.store.update({resetDesign:!0})}render(){if(!this.destroyed){var e,t;let i,r,a,o,n,s,l,d;this.renderer.render((e=this.store.getState(),t=this.appContext(),eh("div",{class:"jie","data-theme":e.theme},[e.showToolbar?(i=_(e),a=(r=P(e))?Math.round(100*r.scale):Math.round(100*e.zoom),o=t.t,n="loading"===e.status||"exporting"===e.status,s="exporting"===e.status&&e.busyVisible,eh("header",{class:"jie-topbar"},[eh("div",{class:"jie-topbar__save"},[ey({label:o("Save"),variant:"primary",onClick:()=>t.onSave(),disabled:!e.source||n,busy:s}),ey({label:o("Save as"),onClick:()=>t.onSaveAs(),disabled:!e.source||n,busy:s})]),eh("div",{class:"jie-topbar__meta"},[i?eh("span",{},`${i.width} x ${i.height} px`):null,eb(eS.book),eh("div",{class:"jie-zoom"},[ey({variant:"icon",icon:eS.zoomOut,title:o("Zoom out"),onClick:()=>eU(t,e,1/1.2)}),eh("span",{},`${a}%`),ey({variant:"icon",icon:eS.zoomIn,title:o("Zoom in"),onClick:()=>eU(t,e,1.2)})])]),eh("div",{class:"jie-topbar__actions"},[ey({variant:"icon",icon:eS.reset,title:o("Reset"),disabled:!z(e),onClick:()=>t.onReset()}),ey({variant:"icon",icon:eS.undo,title:o("Undo"),disabled:!k(e),onClick:()=>t.update({history:{step:-1}})}),ey({variant:"icon",icon:eS.redo,title:o("Redo"),disabled:!S(e),onClick:()=>t.update({history:{step:1}})})])])):null,eh("div",{class:"jie-body"},[eh("nav",{class:"jie-rail"},t.tools.map(i=>eh("button",{key:i.id,class:"jie-tab",type:"button","aria-selected":(e.activeTab===i.id)+"",on:{click:()=>t.update({activeTab:i.id,activeTool:i.defaultTool??null})}},[eb(i.icon),eh("span",{},t.t(i.label))]))),(l=t.tools.find(t=>t.id===e.activeTab)??t.tools[0],d=l?.renderPanel({state:e,update:t.update,t:t.t})??null,eh("div",{class:"jie-stage"},[eh("div",{class:"jie-canvas-wrap","data-jie-canvas-wrap":""},[eh("canvas",{class:"jie-canvas","data-jie-canvas":""}),function(e,t){if(!j(e))return null;let i=P(e),r=A(e);if(!i||!r)return null;let a=E(e);return eh("div",{class:"jie-crop",style:{left:`${i.offsetX+r.x*i.scale}px`,top:`${i.offsetY+r.y*i.scale}px`,width:`${r.width*i.scale}px`,height:`${r.height*i.scale}px`,transform:`rotate(${a}deg)`},on:{pointerdown:e=>t.beginCropDrag("move",e)}},[eh("div",{key:"rotate",class:"jie-crop__rotate",title:"Rotate",on:{pointerdown(e){e.stopPropagation(),t.beginCropRotate(e)}}}),...["nw","ne","sw","se"].map(e=>eh("div",{key:e,class:"jie-crop__handle","data-h":e,on:{pointerdown(i){i.stopPropagation(),t.beginCropDrag(e,i)}}}))])}(e,t),"loading"===e.status?eh("div",{class:"jie-overlay","data-jie-loading":""},[ex()]):"error"===e.status&&e.error?eh("div",{class:"jie-overlay jie-overlay--error","data-jie-error":""},[eh("span",{},t.t("Failed to load the image")),eh("span",{class:"jie-overlay__detail"},e.error)]):null]),d?eh("div",{class:"jie-panel"},[d]):null]))])]))),this.ensureViewportObserver(),this.paint(),this.paintFilterThumbs()}}async handleSave(){if(!this.canExport())return;let e=await this.toBlob();this.onSaveCb?.(e,this),this.container.dispatchEvent(new CustomEvent("jie:save",{detail:{blob:e},bubbles:!0}))}async handleSaveAs(){if(!this.canExport())return;let e=await this.toBlob();this.onSaveAsCb?.(e,this),this.container.dispatchEvent(new CustomEvent("jie:saveas",{detail:{blob:e},bubbles:!0}))}canExport(){let{status:e}=this.store.getState();return null!==this.source&&"exporting"!==e&&"loading"!==e}syncBusyTimer(e){"exporting"!==e.status?this.clearBusyTimer():e.busyVisible||null!==this.busyTimer||(this.busyTimer=setTimeout(()=>{this.busyTimer=null,this.destroyed||"exporting"!==this.store.getState().status||this.store.update({busyVisible:!0})},this.spinnerDelay))}clearBusyTimer(){null!==this.busyTimer&&(clearTimeout(this.busyTimer),this.busyTimer=null)}ensureViewportObserver(){let e=this.container.querySelector("[data-jie-canvas-wrap]");if(e&&e!==this.observedWrap){if(this.resizeObserver?.disconnect(),this.observedWrap=e,"u"<typeof ResizeObserver)return void this.measureViewport(e);this.resizeObserver=new ResizeObserver(()=>this.measureViewport(e)),this.resizeObserver.observe(e),this.measureViewport(e)}}measureViewport(e){let{clientWidth:t,clientHeight:i}=e,r=this.store.getState().viewport;t<=0||i<=0||r&&r.width===t&&r.height===i||this.store.update({viewport:{width:t,height:i}})}paint(){let e=this.store.getState(),t=this.container.querySelector("[data-jie-canvas]");if(!t||!this.previewSource||!e.viewport)return;let i=P(e);if(!i)return;let r=M(e),a=`${this.thumbVersion}:${JSON.stringify(r)}`;a===this.cachedRasterKey&&this.cachedRaster||(this.cachedRaster=this.processor.render(this.previewSource,r),this.cachedRasterKey=a);let o=`${a}@${e.viewport.width}x${e.viewport.height}:${i.scale}:${i.offsetX},${i.offsetY}`;o!==this.lastPaintKey&&(this.lastPaintKey=o,function(e,t,i,r){let a="u">typeof window&&window.devicePixelRatio||1;e.width=Math.max(1,Math.round(i.width*a)),e.height=Math.max(1,Math.round(i.height*a));let o=e.getContext("2d");if(!o)return;o.setTransform(a,0,0,a,0,0),o.clearRect(0,0,i.width,i.height);let n=document.createElement("canvas");n.width=t.width,n.height=t.height;let s=n.getContext("2d");s&&(s.putImageData(es(t),0,0),o.imageSmoothingEnabled=!0,o.imageSmoothingQuality="high",o.drawImage(n,r.offsetX,r.offsetY,r.width,r.height))}(t,this.cachedRaster,e.viewport,i))}paintFilterThumbs(){let e=this.thumbSource;if(e)for(let t of this.container.querySelectorAll("canvas[data-jie-filter-thumb]")){let i=t.dataset.jieFilterThumb;if(!i)continue;let r=`${this.thumbVersion}:${i}`;if(t.dataset.key===r)continue;let a=en(e,i);t.width=a.width,t.height=a.height;let o=t.getContext("2d");o&&(o.putImageData(es(a),0,0),t.dataset.key=r)}}beginCropDrag(e,t){let i=this.store.getState(),r=P(i),a=A(i),o=C(i);if(!r||!a||!o)return;let n=E(i),s=i.minCropSize,l=t.clientX,d=t.clientY;this.runPointerGesture(t,t=>{let i=(t.clientX-l)/r.scale,h=(t.clientY-d)/r.scale;return{crop:0!==n?function(e,t,i,r,a,o=8){if("move"===i)return{...e,x:e.x+r,y:e.y+a};let[n,s]=B[i],l=O(e,t,n,s),d=O(e,t,-n,-s),h={x:l.x+r,y:l.y+a},c=(h.x+d.x)/2,u=(h.y+d.y)/2,p=t*I,g=Math.cos(p),f=Math.sin(p),m=h.x-d.x,b=h.y-d.y,x=Math.max(o,Math.abs(m*g+b*f)),y=Math.max(o,Math.abs(-(m*f)+b*g));return{x:c-x/2,y:u-y/2,width:x,height:y}}(a,n,e,i,h,s):function(e,t,i,r,a,o=null,n=8){var s;let l,d;if("move"===t)return y({...e,x:e.x+i,y:e.y+r},a);let{x:h,y:c,width:u,height:p}=e;if("nw"===t||"sw"===t){let e=x(h+i,0,h+u-n);u+=h-e,h=e}else u=x(u+i,n,a.width-h);if("nw"===t||"ne"===t){let e=x(c+r,0,c+p-n);p+=c-e,c=e}else p=x(p+r,n,a.height-c);let g={x:h,y:c,width:u,height:p};return null!==o&&o>0&&(l=(s=g).width/o,d="sw"===t||"se"===t?s.y:s.y+s.height-l,g={...s,height:l,y:d}),y(g,a)}(a,e,i,h,o,null,s)}})}beginCropRotate(e){let t=this.store.getState(),i=P(t),r=A(t),a=this.observedWrap??this.container.querySelector("[data-jie-canvas-wrap]");if(!i||!r||!a)return;let o=a.getBoundingClientRect(),n=$(r),s=o.left+i.offsetX+n.x*i.scale,l=o.top+i.offsetY+n.y*i.scale,d=E(t),h=D(s,l,e.clientX,e.clientY);this.runPointerGesture(e,e=>{let t=d+(D(s,l,e.clientX,e.clientY)-h);return 2>Math.abs(t)&&(t=0),{angle:Math.round(10*t)/10}})}runPointerGesture(e,t){e.preventDefault();let i=!1,r=e=>{this.store.update({design:t(e),commit:!i}),i=!0},a=()=>{window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",a),this.dragCleanup=null};window.addEventListener("pointermove",r),window.addEventListener("pointerup",a),this.dragCleanup=a}constructor(e){for(const t of(r(this,"store",void 0),r(this,"container",void 0),r(this,"renderer",void 0),r(this,"registry",new em),r(this,"locales",new el),r(this,"processor",void 0),r(this,"previewMaxSize",void 0),r(this,"spinnerDelay",void 0),r(this,"busyTimer",null),r(this,"onSaveCb",void 0),r(this,"onSaveAsCb",void 0),r(this,"confirm",void 0),r(this,"source",null),r(this,"previewSource",null),r(this,"thumbSource",null),r(this,"thumbVersion",0),r(this,"cachedRaster",null),r(this,"cachedRasterKey",""),r(this,"lastPaintKey",""),r(this,"disposers",[]),r(this,"resizeObserver",null),r(this,"observedWrap",null),r(this,"dragCleanup",null),r(this,"destroyed",!1),this.container=function(e){if("string"!=typeof e)return e;let t=document.querySelector(e);if(!t)throw Error("Container not found: "+e);return t}(e.container),this.processor=e.processor??function(e=eV,t){return new eN({codec:new eF(e,t),createCanvas:e})}(void 0,{maxPixels:e.maxSourcePixels,maxSize:e.maxSourceSize}),this.previewMaxSize=e.previewMaxSize??1600,this.spinnerDelay=Math.max(0,e.spinnerDelay??250),this.onSaveCb=e.onSave,this.onSaveAsCb=e.onSaveAs,this.confirm=e.confirm??(e=>"u"<typeof window||window.confirm(e)),e.locales??[]))this.locales.register(t);for(const t of(this.store=new b({scheduler:e.scheduler??function(){if("function"!=typeof requestAnimationFrame)return new f(e=>setTimeout(e,16),e=>clearTimeout(e));let e=e=>{cancelAnimationFrame(e.raf),null!==e.timer&&(clearTimeout(e.timer),e.timer=null)};return new f(t=>{let i={raf:0,timer:null},r=()=>{e(i),t()};return i.raf=requestAnimationFrame(r),i.timer=setTimeout(r,100),i},e)}(),initialState:{...d(),...e.state,...e.locale?{locale:e.locale}:{},...void 0!==e.minCropSize?{minCropSize:Math.max(1,e.minCropSize)}:{},...void 0!==e.minResizeSize?{minResizeSize:Math.max(1,e.minResizeSize)}:{},...e.palette?{palette:e.palette}:{},...e.fonts?{fonts:e.fonts}:{}}}),e.tools??[ez,e_,eT,eP,eB,e$]))this.registry.register(t);for(const t of e.plugins??[])this.use(t);this.renderer=new ep(new ev(document),this.container),this.disposers.push(this.store.subscribe(()=>this.render())),this.disposers.push(this.store.subscribe(e=>this.syncBusyTimer(e))),this.render(),e.image&&this.fromBlob(e.image)}}function eH(e,t){let i=Math.max(e.width,e.height);if(t>=i)return e;let r=t/i;return U(e,{width:Math.round(e.width*r),height:Math.round(e.height*r)})}}},function(e){return e(e.s=98270)}])});
|