@scbt-ecom/ui 0.115.5 → 0.115.7
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/dist/lib/exports/widget.js +1 -1
- package/dist/lib/shared/ui/brandLogos/BrandLogos.js +1 -1
- package/dist/lib/shared/ui/brandLogos/BrandLogos.js.map +1 -1
- package/dist/lib/shared/ui/calendar/Calendar.js +1 -1
- package/dist/lib/shared/ui/calendar/Calendar.js.map +1 -1
- package/dist/lib/shared/ui/calendar/ui/Navigation.js +1 -1
- package/dist/lib/shared/ui/calendar/ui/Navigation.js.map +1 -1
- package/dist/lib/shared/ui/calendar/ui/selectDate/ui/Trigger.js +1 -1
- package/dist/lib/shared/ui/calendar/ui/selectDate/ui/Trigger.js.map +1 -1
- package/dist/lib/shared/ui/dialog/Dialog.js +1 -1
- package/dist/lib/shared/ui/dialog/Dialog.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/autocomplete/Autocomplete.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/autocomplete/Autocomplete.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/checkbox/CheckboxControl.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/checkbox/CheckboxControl.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/combobox/ComboboxControl.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/combobox/ComboboxControl.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/dadata/address/DadataAddress.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/dadata/address/DadataAddress.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/dadata/auto/DadataAuto.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/dadata/auto/DadataAuto.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/dadata/country/DadataCountry.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/dadata/country/DadataCountry.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/dadata/fio/DadataFio.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/dadata/fio/DadataFio.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/dadata/party/DadataOrganization.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/dadata/party/DadataOrganization.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/dayPickerControl/dayPickerControl.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/dayPickerControl/dayPickerControl.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/dayPickerControl/model/utils.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/dayPickerControl/model/utils.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/dayPickerControl/range.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/dayPickerControl/range.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/dayPickerControl/single.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/dayPickerControl/single.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/editor/EditorControl.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/editor/EditorControl.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/editor/model/helper.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/editor/model/helper.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/editor/ui/Editor.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/editor/ui/Editor.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/editor/ui/commands/SetColor.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/editor/ui/commands/SetColor.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/editor/ui/commands/SetCoreCommands.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/editor/ui/commands/SetCoreCommands.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/editor/ui/commands/SetFontSize.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/editor/ui/commands/SetFontSize.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/editor/ui/commands/setCustomLink.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/editor/ui/commands/setCustomLink.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/input/InputControl.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/input/InputControl.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/input/MaskInputControl.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/input/MaskInputControl.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/inputCurrency/InputCurrencyControl.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/inputCurrency/InputCurrencyControl.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/inputOtp/InputOtpControl.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/inputOtp/InputOtpControl.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/radio/RadioGroupControl.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/radio/RadioGroupControl.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/slider/SliderControl.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/slider/SliderControl.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/switch/SwitchControl.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/switch/SwitchControl.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/textarea/TextareaControl.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/textarea/TextareaControl.js.map +1 -1
- package/dist/lib/shared/ui/formElements/controlled/uploader/UploaderControl.js +1 -1
- package/dist/lib/shared/ui/formElements/controlled/uploader/UploaderControl.js.map +1 -1
- package/dist/lib/shared/ui/formElements/ui/fieldAttachment/ui/ValidateSlot.js +1 -1
- package/dist/lib/shared/ui/formElements/ui/fieldAttachment/ui/ValidateSlot.js.map +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/autocomplete/Autocomplete.js +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/autocomplete/Autocomplete.js.map +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/checkbox/Checkbox.js +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/checkbox/Checkbox.js.map +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/combobox/combobox.js +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/combobox/combobox.js.map +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/dayPicker/DayPicker.js +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/dayPicker/DayPicker.js.map +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/inputCurrency/ui/CurrencyIcon.js +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/inputCurrency/ui/CurrencyIcon.js.map +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/maskInput/MaskInput.js +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/maskInput/MaskInput.js.map +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/maskInput/model/mask/utils.js.map +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/slider/ui/sliderAlgorithmic/SliderAlgorithmic.js +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/slider/ui/sliderAlgorithmic/SliderAlgorithmic.js.map +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/slider/ui/sliderMarks/SliderMarks.js +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/slider/ui/sliderMarks/SliderMarks.js.map +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/slider/ui/sliderStep/SliderStep.js +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/slider/ui/sliderStep/SliderStep.js.map +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/uploader/UploaderBase.js +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/uploader/UploaderBase.js.map +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/uploader/model/hooks/useUploader.js +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/uploader/model/hooks/useUploader.js.map +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/uploader/ui/UploaderFile.js +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/uploader/ui/UploaderFile.js.map +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/uploader/ui/UploaderFilename.js +1 -1
- package/dist/lib/shared/ui/formElements/uncontrolled/uploader/ui/UploaderFilename.js.map +1 -1
- package/dist/lib/shared/ui/modal/ui/ModalHeader.js +1 -1
- package/dist/lib/shared/ui/modal/ui/ModalHeader.js.map +1 -1
- package/dist/lib/shared/ui/popover/Popover.js +1 -1
- package/dist/lib/shared/ui/popover/Popover.js.map +1 -1
- package/dist/lib/shared/validation/base/base.constants.js +1 -1
- package/dist/lib/shared/validation/base/base.constants.js.map +1 -1
- package/dist/lib/shared/validation/base/date.validators.js +1 -1
- package/dist/lib/shared/validation/base/date.validators.js.map +1 -1
- package/dist/lib/shared/validation/base/regex.validators.js +1 -1
- package/dist/lib/shared/validation/base/regex.validators.js.map +1 -1
- package/dist/lib/widgets/authProvider/AuthProvider.js +1 -1
- package/dist/lib/widgets/authProvider/AuthProvider.js.map +1 -1
- package/dist/lib/widgets/authProvider/ui/Esia.js +1 -1
- package/dist/lib/widgets/authProvider/ui/Esia.js.map +1 -1
- package/dist/lib/widgets/authProvider/ui/MobileId.js +1 -1
- package/dist/lib/widgets/authProvider/ui/MobileId.js.map +1 -1
- package/dist/lib/widgets/authProvider/ui/ui/AuthWrapper.js +1 -1
- package/dist/lib/widgets/authProvider/ui/ui/AuthWrapper.js.map +1 -1
- package/dist/lib/widgets/authProvider/ui/ui/Links.js +1 -1
- package/dist/lib/widgets/authProvider/ui/ui/Links.js.map +1 -1
- package/dist/lib/widgets/banner/index.js +1 -1
- package/dist/lib/widgets/banner/ui/banners/BannerImageFull.js +1 -1
- package/dist/lib/widgets/banner/ui/banners/BannerImageFull.js.map +1 -1
- package/dist/lib/widgets/banner/ui/banners/BannerWithSeparateImg.js +1 -1
- package/dist/lib/widgets/banner/ui/banners/BannerWithSeparateImg.js.map +1 -1
- package/dist/lib/widgets/banner/ui/banners/ui/Advantages.js +1 -1
- package/dist/lib/widgets/banner/ui/banners/ui/Advantages.js.map +1 -1
- package/dist/lib/widgets/benefit/Benefit.js +1 -1
- package/dist/lib/widgets/benefit/Benefit.js.map +1 -1
- package/dist/lib/widgets/breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/lib/widgets/breadcrumbs/Breadcrumbs.js.map +1 -1
- package/dist/lib/widgets/buttonWithHandlers/ButtonWithHandlers.js +1 -1
- package/dist/lib/widgets/buttonWithHandlers/ButtonWithHandlers.js.map +1 -1
- package/dist/lib/widgets/calculator/Calculator.js +1 -1
- package/dist/lib/widgets/calculator/Calculator.js.map +1 -1
- package/dist/lib/widgets/calculator/CalculatorView.js +1 -1
- package/dist/lib/widgets/calculator/CalculatorView.js.map +1 -1
- package/dist/lib/widgets/calculator/ui/calculatorFields/ui/AdditionalSlider.js +1 -1
- package/dist/lib/widgets/calculator/ui/calculatorFields/ui/AdditionalSlider.js.map +1 -1
- package/dist/lib/widgets/calculator/ui/calculatorFields/ui/CalculatorModal.js +1 -1
- package/dist/lib/widgets/calculator/ui/calculatorFields/ui/CalculatorModal.js.map +1 -1
- package/dist/lib/widgets/calculator/ui/calculatorInfo/CalculatorInfo.js +1 -1
- package/dist/lib/widgets/calculator/ui/calculatorInfo/CalculatorInfo.js.map +1 -1
- package/dist/lib/widgets/calculator/ui/calculatorInfo/ui/AssistHint.js +1 -1
- package/dist/lib/widgets/calculator/ui/calculatorInfo/ui/AssistHint.js.map +1 -1
- package/dist/lib/widgets/calculator/ui/calculatorInfo/ui/CalculatorInfoHead.js +1 -1
- package/dist/lib/widgets/calculator/ui/calculatorInfo/ui/CalculatorInfoHead.js.map +1 -1
- package/dist/lib/widgets/calculator/ui/calculatorInfo/ui/InfoListItem.js +1 -1
- package/dist/lib/widgets/calculator/ui/calculatorInfo/ui/InfoListItem.js.map +1 -1
- package/dist/lib/widgets/dynamicForm/DynamicForm.js +1 -1
- package/dist/lib/widgets/dynamicForm/DynamicForm.js.map +1 -1
- package/dist/lib/widgets/dynamicFormDialog/DynamicFormDialog.js +1 -1
- package/dist/lib/widgets/dynamicFormDialog/DynamicFormDialog.js.map +1 -1
- package/dist/lib/widgets/fallbacksView/FallbacksView.js +1 -1
- package/dist/lib/widgets/fallbacksView/FallbacksView.js.map +1 -1
- package/dist/lib/widgets/fallbacksView/model/helpers.js +1 -1
- package/dist/lib/widgets/fallbacksView/model/helpers.js.map +1 -1
- package/dist/lib/widgets/fieldMapper/FieldMapper.js +1 -1
- package/dist/lib/widgets/fieldMapper/FieldMapper.js.map +1 -1
- package/dist/lib/widgets/footer/Footer.js +1 -1
- package/dist/lib/widgets/footer/Footer.js.map +1 -1
- package/dist/lib/widgets/footer/ui/FooterLogo.js +1 -1
- package/dist/lib/widgets/footer/ui/FooterLogo.js.map +1 -1
- package/dist/lib/widgets/footer/ui/NavLinks.js +1 -1
- package/dist/lib/widgets/footer/ui/NavLinks.js.map +1 -1
- package/dist/lib/widgets/footer/ui/PhonesBlock.js +1 -1
- package/dist/lib/widgets/footer/ui/PhonesBlock.js.map +1 -1
- package/dist/lib/widgets/footer/ui/SiteMap.js +1 -1
- package/dist/lib/widgets/footer/ui/SiteMap.js.map +1 -1
- package/dist/lib/widgets/footer/ui/SocialLinks.js +1 -1
- package/dist/lib/widgets/footer/ui/SocialLinks.js.map +1 -1
- package/dist/lib/widgets/header/Header.js +1 -1
- package/dist/lib/widgets/header/Header.js.map +1 -1
- package/dist/lib/widgets/header/model/helpers.js +1 -1
- package/dist/lib/widgets/header/model/helpers.js.map +1 -1
- package/dist/lib/widgets/index.js +1 -1
- package/dist/lib/widgets/infoBlock/InfoBlock.js +1 -1
- package/dist/lib/widgets/infoBlock/InfoBlock.js.map +1 -1
- package/dist/lib/widgets/infoBlock/ui/LinksList.js +1 -1
- package/dist/lib/widgets/infoBlock/ui/LinksList.js.map +1 -1
- package/dist/lib/widgets/infoBlock/ui/RootContent.js +1 -1
- package/dist/lib/widgets/infoBlock/ui/RootContent.js.map +1 -1
- package/dist/lib/widgets/interLinking/InterLinking.js +1 -1
- package/dist/lib/widgets/interLinking/InterLinking.js.map +1 -1
- package/dist/lib/widgets/interLinking/ui/ColumnGroup.js +1 -1
- package/dist/lib/widgets/interLinking/ui/ColumnGroup.js.map +1 -1
- package/dist/lib/widgets/interLinking/ui/LinksList.js +1 -1
- package/dist/lib/widgets/interLinking/ui/LinksList.js.map +1 -1
- package/dist/lib/widgets/longBanner/LongBanner.js +1 -1
- package/dist/lib/widgets/longBanner/LongBanner.js.map +1 -1
- package/dist/lib/widgets/longBanner/ui/TextItem.js +1 -1
- package/dist/lib/widgets/longBanner/ui/TextItem.js.map +1 -1
- package/dist/lib/widgets/model/helpers.js +2 -2
- package/dist/lib/widgets/model/helpers.js.map +1 -1
- package/dist/lib/widgets/queryClientProvider/QueryClientProvider.js +1 -1
- package/dist/lib/widgets/seoHeader/SeoHeader.js +1 -1
- package/dist/lib/widgets/seoHeader/SeoHeader.js.map +1 -1
- package/dist/lib/widgets/seoHeader/ui/desktop/CategoriesDesktop.js +1 -1
- package/dist/lib/widgets/seoHeader/ui/desktop/CategoriesDesktop.js.map +1 -1
- package/dist/lib/widgets/seoHeader/ui/desktop/CategoryTabs.js +1 -1
- package/dist/lib/widgets/seoHeader/ui/desktop/CategoryTabs.js.map +1 -1
- package/dist/lib/widgets/seoHeader/ui/desktop/tab/ui/content/TabContent.js +1 -1
- package/dist/lib/widgets/seoHeader/ui/desktop/tab/ui/content/TabContent.js.map +1 -1
- package/dist/lib/widgets/seoHeader/ui/mobile/CategoriesMobile.js +1 -1
- package/dist/lib/widgets/seoHeader/ui/mobile/CategoriesMobile.js.map +1 -1
- package/dist/lib/widgets/seoHeader/ui/mobile/menu/Menu.js +1 -1
- package/dist/lib/widgets/seoHeader/ui/mobile/menu/Menu.js.map +1 -1
- package/dist/lib/widgets/seoHeader/ui/mobile/menu/MenuItem.js +1 -1
- package/dist/lib/widgets/seoHeader/ui/mobile/menu/MenuItem.js.map +1 -1
- package/dist/lib/widgets/stepper/Stepper.js +1 -1
- package/dist/lib/widgets/stepper/Stepper.js.map +1 -1
- package/dist/lib/widgets/stepper/ui/StepperCarousel.js +1 -1
- package/dist/lib/widgets/stepper/ui/StepperCarousel.js.map +1 -1
- package/dist/lib/widgets/table/Table.js +1 -1
- package/dist/lib/widgets/table/Table.js.map +1 -1
- package/dist/lib/widgets/usefulInfo/UsefulInfo.js +1 -1
- package/dist/lib/widgets/usefulInfo/UsefulInfo.js.map +1 -1
- package/dist/lib/widgets/usefulInfo/ui/subEntities/documents/Documents.js +1 -1
- package/dist/lib/widgets/usefulInfo/ui/subEntities/documents/Documents.js.map +1 -1
- package/dist/lib/widgets/usefulInfo/ui/subEntities/documents/ui/document/Document.js +1 -1
- package/dist/lib/widgets/usefulInfo/ui/subEntities/documents/ui/document/Document.js.map +1 -1
- package/dist/lib/widgets/usefulInfo/ui/subEntities/experts/Experts.js +1 -1
- package/dist/lib/widgets/usefulInfo/ui/subEntities/experts/Experts.js.map +1 -1
- package/dist/lib/widgets/usefulInfo/ui/subEntities/html/Html.js +1 -1
- package/dist/lib/widgets/usefulInfo/ui/subEntities/html/Html.js.map +1 -1
- package/dist/lib/widgets/usefulInfo/ui/subEntities/table/Table.js +1 -1
- package/dist/lib/widgets/usefulInfo/ui/subEntities/table/Table.js.map +1 -1
- package/dist/lib/widgets/userFeedback/UserFeedback.js +1 -1
- package/dist/lib/widgets/userFeedback/UserFeedback.js.map +1 -1
- package/dist/lib/widgets/userFeedback/ui/FeedbackTrigger.js +1 -1
- package/dist/lib/widgets/userFeedback/ui/FeedbackTrigger.js.map +1 -1
- package/dist/lib/widgets/userFeedback/ui/Finally.js +1 -1
- package/dist/lib/widgets/userFeedback/ui/Finally.js.map +1 -1
- package/dist/lib/widgets/userFeedback/ui/SelectRating.js +1 -1
- package/dist/lib/widgets/userFeedback/ui/SelectRating.js.map +1 -1
- package/dist/lib/widgets/userFeedback/ui/UserReview.js +1 -1
- package/dist/lib/widgets/userFeedback/ui/UserReview.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-checkbox/dist/index.js +1 -1
- package/dist/node_modules/@radix-ui/react-popover/dist/index.js +1 -1
- package/dist/node_modules/@radix-ui/react-radio-group/dist/index.js +1 -1
- package/dist/node_modules/@radix-ui/react-switch/dist/index.js +1 -1
- package/dist/node_modules/@radix-ui/react-tabs/dist/index.js +1 -1
- package/dist/node_modules/@radix-ui/react-tooltip/dist/index.js +1 -1
- package/dist/node_modules/@radix-ui/react-tooltip/dist/index.js.map +1 -1
- package/dist/node_modules/@tanstack/query-core/build/modern/query.js +1 -1
- package/dist/node_modules/@tanstack/query-core/build/modern/query.js.map +1 -1
- package/dist/node_modules/prosemirror-view/dist/index.js +4 -4
- package/dist/node_modules/prosemirror-view/dist/index.js.map +1 -1
- package/dist/src/configs/api.js +2 -0
- package/dist/src/configs/api.js.map +1 -0
- package/dist/stats.html +1 -1
- package/dist/types/lib/next/utils/hideWidgetsWithQueryParams.d.ts +1 -1
- package/dist/types/lib/next/utils/isEmptyWidgetList.d.ts +1 -1
- package/dist/types/lib/next/utils/orderWidgetWithQueryParams.d.ts +1 -1
- package/dist/types/lib/shared/hooks/useObserverWidgets.d.ts +1 -1
- package/dist/types/lib/shared/ui/carousel/model/helpers.d.ts +1 -1
- package/dist/types/lib/shared/ui/carousel/ui/CarouselSlide.d.ts +1 -1
- package/dist/types/lib/shared/ui/formElements/controlled/autocomplete/Autocomplete.d.ts +1 -1
- package/dist/types/lib/shared/ui/formElements/controlled/combobox/hooks/useComboboxControl.d.ts +1 -1
- package/dist/types/lib/shared/ui/formElements/controlled/dadata/address/DadataAddress.d.ts +1 -1
- package/dist/types/lib/shared/ui/formElements/controlled/dadata/auto/DadataAuto.d.ts +1 -1
- package/dist/types/lib/shared/ui/formElements/controlled/dadata/country/DadataCountry.d.ts +1 -1
- package/dist/types/lib/shared/ui/formElements/controlled/dadata/fio/DadataFio.d.ts +1 -1
- package/dist/types/lib/shared/ui/formElements/controlled/dadata/party/DadataOrganization.d.ts +1 -1
- package/dist/types/lib/shared/ui/formElements/controlled/dayPickerControl/dayPickerControl.d.ts +1 -1
- package/dist/types/lib/shared/ui/formElements/controlled/dayPickerControl/range.d.ts +1 -1
- package/dist/types/lib/shared/ui/formElements/controlled/dayPickerControl/single.d.ts +1 -1
- package/dist/types/lib/shared/ui/formElements/controlled/inputOtp/InputOtpControl.d.ts +1 -1
- package/dist/types/lib/shared/ui/formElements/controlled/radio/RadioGroupControl.d.ts +1 -1
- package/dist/types/lib/shared/ui/formElements/controlled/radio/RadioGroupTabControl.d.ts +1 -1
- package/dist/types/lib/shared/ui/formElements/controlled/switch/SwitchControl.d.ts +1 -1
- package/dist/types/lib/shared/ui/formElements/controlled/textarea/TextareaControl.d.ts +1 -1
- package/dist/types/lib/shared/ui/formElements/uncontrolled/autocomplete/Autocomplete.d.ts +1 -1
- package/dist/types/lib/shared/ui/formElements/uncontrolled/combobox/combobox.d.ts +4 -4
- package/dist/types/lib/shared/ui/formElements/uncontrolled/dayPicker/DayPicker.d.ts +1 -1
- package/dist/types/lib/shared/ui/formElements/uncontrolled/index.d.ts +1 -2
- package/dist/types/lib/shared/ui/formElements/uncontrolled/input/Input.d.ts +1 -1
- package/dist/types/lib/shared/ui/formElements/uncontrolled/inputCurrency/hooks/useCurrencyControl.d.ts +1 -1
- package/dist/types/lib/shared/ui/formElements/uncontrolled/inputCurrency/ui/CurrencyIcon.d.ts +1 -1
- package/dist/types/lib/shared/ui/formElements/uncontrolled/maskInput/MaskInput.d.ts +3 -16
- package/dist/types/lib/shared/ui/formElements/uncontrolled/maskInput/model/mask/utils.d.ts +1 -1
- package/dist/types/lib/shared/ui/formElements/uncontrolled/maskInput/model/types.d.ts +11 -2
- package/dist/types/lib/shared/ui/formElements/uncontrolled/textarea/Textarea.d.ts +1 -1
- package/dist/types/lib/shared/ui/formElements/uncontrolled/uploader/ui/UploaderFiles.d.ts +1 -1
- package/dist/types/lib/shared/utils/scrollToElement.d.ts +1 -1
- package/dist/types/lib/shared/validation/base/currency.validators.d.ts +1 -1
- package/dist/types/lib/widgets/authProvider/model/types.d.ts +2 -1
- package/dist/types/lib/widgets/authProvider/ui/ui/AuthWrapper.d.ts +1 -1
- package/dist/types/lib/widgets/banner/Banner.d.ts +1 -1
- package/dist/types/lib/widgets/banner/ui/banners/BannerImageFull.d.ts +1 -1
- package/dist/types/lib/widgets/banner/ui/banners/BannerWithSeparateImg.d.ts +1 -1
- package/dist/types/lib/widgets/benefit/model/types.d.ts +2 -2
- package/dist/types/lib/widgets/buttonWithHandlers/ButtonWithHandlers.d.ts +1 -1
- package/dist/types/lib/widgets/calculator/ui/calculatorFields/ui/CalculatorModal.d.ts +1 -1
- package/dist/types/lib/widgets/calculator/ui/calculatorFields/ui/FieldsGroup.d.ts +2 -2
- package/dist/types/lib/widgets/calculator/ui/calculatorInfo/ui/AssistHint.d.ts +1 -1
- package/dist/types/lib/widgets/dynamicForm/DynamicForm.d.ts +3 -3
- package/dist/types/lib/widgets/dynamicForm/model/getFieldsProgress.d.ts +2 -2
- package/dist/types/lib/widgets/dynamicForm/model/types.d.ts +1 -1
- package/dist/types/lib/widgets/dynamicFormDialog/DynamicFormDialog.d.ts +3 -3
- package/dist/types/lib/widgets/fieldMapper/model/types.d.ts +1 -1
- package/dist/types/lib/widgets/footer/model/types.d.ts +1 -1
- package/dist/types/lib/widgets/header/model/types.d.ts +1 -1
- package/dist/types/lib/widgets/infoBlock/InfoBlock.d.ts +1 -1
- package/dist/types/lib/widgets/infoBlock/ui/LinksList.d.ts +1 -1
- package/dist/types/lib/widgets/interLinking/InterLinking.d.ts +1 -1
- package/dist/types/lib/widgets/interLinking/ui/Column.d.ts +1 -1
- package/dist/types/lib/widgets/interLinking/ui/ColumnGroup.d.ts +1 -1
- package/dist/types/lib/widgets/seoHeader/model/types.d.ts +1 -1
- package/dist/types/lib/widgets/stepper/ui/StepperCarousel.d.ts +1 -1
- package/dist/types/lib/widgets/usefulInfo/model/types.d.ts +1 -1
- package/dist/types/lib/widgets/userFeedback/UserFeedback.d.ts +1 -1
- package/dist/types/lib/widgets/userFeedback/ui/UserReview.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{NodeSelection as D,Selection as he,TextSelection as x,AllSelection as Sn}from"../../prosemirror-state/dist/index.js";import{Slice as J,DOMSerializer as Re,Fragment as _,DOMParser as qt,Mark as Cn}from"../../prosemirror-model/dist/index.js";import{dropPoint as On}from"../../prosemirror-transform/dist/index.js";const C=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},ue=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let He=null;const K=function(t,e,n){let o=He||(He=document.createRange());return o.setEnd(t,n??t.nodeValue.length),o.setStart(t,e||0),o},Mn=function(){He=null},re=function(t,e,n,o){return n&&(rt(t,e,n,o,-1)||rt(t,e,n,o,1))},xn=/^(img|br|input|textarea|hr)$/i;function rt(t,e,n,o,i){for(var s;;){if(t==n&&e==o)return!0;if(e==(i<0?0:B(t))){let r=t.parentNode;if(!r||r.nodeType!=1||Ce(t)||xn.test(t.nodeName)||t.contentEditable=="false")return!1;e=C(t)+(i<0?0:1),t=r}else if(t.nodeType==1){let r=t.childNodes[e+(i<0?-1:0)];if(r.nodeType==1&&r.contentEditable=="false")if(!((s=r.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=r,e=i<0?B(t):0}else return!1}}function B(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function kn(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=B(t)}else if(t.parentNode&&!Ce(t))e=C(t),t=t.parentNode;else return null}}function Tn(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Ce(t))e=C(t)+1,t=t.parentNode;else return null}}function An(t,e,n){for(let o=e==0,i=e==B(t);o||i;){if(t==n)return!0;let s=C(t);if(t=t.parentNode,!t)return!1;o=o&&s==0,i=i&&s==B(t)}}function Ce(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Be=function(t){return t.focusNode&&re(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function te(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function En(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Pn(t,e,n){if(t.caretPositionFromPoint)try{let o=t.caretPositionFromPoint(e,n);if(o)return{node:o.offsetNode,offset:Math.min(B(o.offsetNode),o.offset)}}catch{}if(t.caretRangeFromPoint){let o=t.caretRangeFromPoint(e,n);if(o)return{node:o.startContainer,offset:Math.min(B(o.startContainer),o.startOffset)}}}const L=typeof navigator<"u"?navigator:null,lt=typeof document<"u"?document:null,v=L&&L.userAgent||"",We=/Edge\/(\d+)/.exec(v),Kt=/MSIE \d/.exec(v),_e=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(v),P=!!(Kt||_e||We),Z=Kt?document.documentMode:_e?+_e[1]:We?+We[1]:0,z=!P&&/gecko\/(\d+)/i.test(v);z&&+(/Firefox\/(\d+)/.exec(v)||[0,0])[1];const je=!P&&/Chrome\/(\d+)/.exec(v),M=!!je,Ht=je?+je[1]:0,k=!P&&!!L&&/Apple Computer/.test(L.vendor),pe=k&&(/Mobile\/\w+/.test(v)||!!L&&L.maxTouchPoints>2),R=pe||(L?/Mac/.test(L.platform):!1),Vn=L?/Win/.test(L.platform):!1,H=/Android \d/.test(v),Oe=!!lt&&"webkitFontSmoothing"in lt.documentElement.style,Rn=Oe?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Bn(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function q(t,e){return typeof t=="number"?t:t[e]}function In(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,o=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*o}}function at(t,e,n){let o=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let r=n||t.dom;r;){if(r.nodeType!=1){r=ue(r);continue}let l=r,a=l==s.body,c=a?Bn(s):In(l),d=0,f=0;if(e.top<c.top+q(o,"top")?f=-(c.top-e.top+q(i,"top")):e.bottom>c.bottom-q(o,"bottom")&&(f=e.bottom-e.top>c.bottom-c.top?e.top+q(i,"top")-c.top:e.bottom-c.bottom+q(i,"bottom")),e.left<c.left+q(o,"left")?d=-(c.left-e.left+q(i,"left")):e.right>c.right-q(o,"right")&&(d=e.right-c.right+q(i,"right")),d||f)if(a)s.defaultView.scrollBy(d,f);else{let p=l.scrollLeft,h=l.scrollTop;f&&(l.scrollTop+=f),d&&(l.scrollLeft+=d);let g=l.scrollLeft-p,m=l.scrollTop-h;e={left:e.left-g,top:e.top-m,right:e.right-g,bottom:e.bottom-m}}let u=a?"fixed":getComputedStyle(r).position;if(/^(fixed|sticky)$/.test(u))break;r=u=="absolute"?r.offsetParent:ue(r)}}function Fn(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),o,i;for(let s=(e.left+e.right)/2,r=n+1;r<Math.min(innerHeight,e.bottom);r+=5){let l=t.root.elementFromPoint(s,r);if(!l||l==t.dom||!t.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){o=l,i=a.top;break}}return{refDOM:o,refTop:i,stack:Wt(t.dom)}}function Wt(t){let e=[],n=t.ownerDocument;for(let o=t;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),t!=n);o=ue(o));return e}function zn({refDOM:t,refTop:e,stack:n}){let o=t?t.getBoundingClientRect().top:0;_t(n,o==0?0:o-e)}function _t(t,e){for(let n=0;n<t.length;n++){let{dom:o,top:i,left:s}=t[n];o.scrollTop!=i+e&&(o.scrollTop=i+e),o.scrollLeft!=s&&(o.scrollLeft=s)}}let ae=null;function Ln(t){if(t.setActive)return t.setActive();if(ae)return t.focus(ae);let e=Wt(t);t.focus(ae==null?{get preventScroll(){return ae={preventScroll:!0},!0}}:void 0),ae||(ae=!1,_t(e,0))}function jt(t,e){let n,o=2e8,i,s=0,r=e.top,l=e.top,a,c;for(let d=t.firstChild,f=0;d;d=d.nextSibling,f++){let u;if(d.nodeType==1)u=d.getClientRects();else if(d.nodeType==3)u=K(d).getClientRects();else continue;for(let p=0;p<u.length;p++){let h=u[p];if(h.top<=r&&h.bottom>=l){r=Math.max(h.bottom,r),l=Math.min(h.top,l);let g=h.left>e.left?h.left-e.left:h.right<e.left?e.left-h.right:0;if(g<o){n=d,o=g,i=g&&n.nodeType==3?{left:h.right<e.left?h.right:h.left,top:e.top}:e,d.nodeType==1&&g&&(s=f+(e.left>=(h.left+h.right)/2?1:0));continue}}else h.top>e.top&&!a&&h.left<=e.left&&h.right>=e.left&&(a=d,c={left:Math.max(h.left,Math.min(h.right,e.left)),top:h.top});!n&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(s=f+1)}}return!n&&a&&(n=a,i=c,o=0),n&&n.nodeType==3?$n(n,i):!n||o&&n.nodeType==1?{node:t,offset:s}:jt(n,i)}function $n(t,e){let n=t.nodeValue.length,o=document.createRange();for(let i=0;i<n;i++){o.setEnd(t,i+1),o.setStart(t,i);let s=U(o,1);if(s.top!=s.bottom&&Qe(e,s))return{node:t,offset:i+(e.left>=(s.left+s.right)/2?1:0)}}return{node:t,offset:0}}function Qe(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function qn(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Kn(t,e,n){let{node:o,offset:i}=jt(e,n),s=-1;if(o.nodeType==1&&!o.firstChild){let r=o.getBoundingClientRect();s=r.left!=r.right&&n.left>(r.left+r.right)/2?1:-1}return t.docView.posFromDOM(o,i,s)}function Hn(t,e,n,o){let i=-1;for(let s=e,r=!1;s!=t.dom;){let l=t.docView.nearestDesc(s,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!r&&a.left>o.left||a.top>o.top?i=l.posBefore:(!r&&a.right<o.left||a.bottom<o.top)&&(i=l.posAfter),r=!0),!l.contentDOM&&i<0&&!l.node.isText))return(l.node.isBlock?o.top<(a.top+a.bottom)/2:o.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;s=l.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function Ut(t,e,n){let o=t.childNodes.length;if(o&&n.top<n.bottom)for(let i=Math.max(0,Math.min(o-1,Math.floor(o*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let r=t.childNodes[s];if(r.nodeType==1){let l=r.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(Qe(e,c))return Ut(r,e,c)}}if((s=(s+1)%o)==i)break}return t}function Wn(t,e){let n=t.dom.ownerDocument,o,i=0,s=Pn(n,e.left,e.top);s&&({node:o,offset:i}=s);let r=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!r||!t.dom.contains(r.nodeType!=1?r.parentNode:r)){let c=t.dom.getBoundingClientRect();if(!Qe(e,c)||(r=Ut(t.dom,e,c),!r))return null}if(k)for(let c=r;o&&c;c=ue(c))c.draggable&&(o=void 0);if(r=qn(r,e),o){if(z&&o.nodeType==1&&(i=Math.min(i,o.childNodes.length),i<o.childNodes.length)){let d=o.childNodes[i],f;d.nodeName=="IMG"&&(f=d.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}let c;Oe&&i&&o.nodeType==1&&(c=o.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,o==t.dom&&i==o.childNodes.length-1&&o.lastChild.nodeType==1&&e.top>o.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(i==0||o.nodeType!=1||o.childNodes[i-1].nodeName!="BR")&&(l=Hn(t,o,i,e))}l==null&&(l=Kn(t,r,e));let a=t.docView.nearestDesc(r,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function ct(t){return t.top<t.bottom||t.left<t.right}function U(t,e){let n=t.getClientRects();if(n.length){let o=n[e<0?0:n.length-1];if(ct(o))return o}return Array.prototype.find.call(n,ct)||t.getBoundingClientRect()}const _n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Yt(t,e,n){let{node:o,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),r=Oe||z;if(o.nodeType==3)if(r&&(_n.test(o.nodeValue)||(n<0?!i:i==o.nodeValue.length))){let a=U(K(o,i,i),n);if(z&&i&&/\s/.test(o.nodeValue[i-1])&&i<o.nodeValue.length){let c=U(K(o,i-1,i-1),-1);if(c.top==a.top){let d=U(K(o,i,i+1),-1);if(d.top!=a.top)return ge(d,d.left<c.left)}}return a}else{let a=i,c=i,d=n<0?1:-1;return n<0&&!i?(c++,d=-1):n>=0&&i==o.nodeValue.length?(a--,d=1):n<0?a--:c++,ge(U(K(o,a,c),d),d<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==B(o))){let a=o.childNodes[i-1];if(a.nodeType==1)return ze(a.getBoundingClientRect(),!1)}if(s==null&&i<B(o)){let a=o.childNodes[i];if(a.nodeType==1)return ze(a.getBoundingClientRect(),!0)}return ze(o.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==B(o))){let a=o.childNodes[i-1],c=a.nodeType==3?K(a,B(a)-(r?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return ge(U(c,1),!1)}if(s==null&&i<B(o)){let a=o.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?K(a,0,r?0:1):a.nodeType==1?a:null:null;if(c)return ge(U(c,-1),!0)}return ge(U(o.nodeType==3?K(o):o,-n),n>=0)}function ge(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function ze(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Gt(t,e,n){let o=t.state,i=t.root.activeElement;o!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{o!=e&&t.updateState(o),i!=t.dom&&i&&i.focus()}}function jn(t,e,n){let o=e.selection,i=n=="up"?o.$from:o.$to;return Gt(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let r=Yt(t,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=K(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let d=a[c];if(d.bottom>d.top+1&&(n=="up"?r.top-d.top>(d.bottom-r.top)*2:d.bottom-r.bottom>(r.bottom-d.top)*2))return!1}}return!0})}const Un=/[\u0590-\u08ac]/;function Yn(t,e,n){let{$head:o}=e.selection;if(!o.parent.isTextblock)return!1;let i=o.parentOffset,s=!i,r=i==o.parent.content.size,l=t.domSelection();return l?!Un.test(o.parent.textContent)||!l.modify?n=="left"||n=="backward"?s:r:Gt(t,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:d,anchorOffset:f}=t.domSelectionRange(),u=l.caretBidiLevel;l.modify("move",n,"character");let p=o.depth?t.docView.domAfterPos(o.before()):t.dom,{focusNode:h,focusOffset:g}=t.domSelectionRange(),m=h&&!p.contains(h.nodeType==1?h:h.parentNode)||a==h&&c==g;try{l.collapse(d,f),a&&(a!=d||c!=f)&&l.extend&&l.extend(a,c)}catch{}return u!=null&&(l.caretBidiLevel=u),m}):o.pos==o.start()||o.pos==o.end()}let dt=null,ft=null,ht=!1;function Gn(t,e,n){return dt==e&&ft==n?ht:(dt=e,ft=n,ht=n=="up"||n=="down"?jn(t,e,n):Yn(t,e,n))}const I=0,ut=1,ne=2,$=3;class Me{constructor(e,n,o,i){this.parent=e,this.children=n,this.dom=o,this.contentDOM=i,this.dirty=I,o.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,o){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,o=this.posAtStart;;n++){let i=this.children[n];if(i==e)return o;o+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,o){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(o<0){let s,r;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((r=s.pmViewDesc)&&r.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(r)+r.size:this.posAtStart}else{let s,r;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((r=s.pmViewDesc)&&r.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(r):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>C(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??o>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let o=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),r;if(s&&(!n||s.node))if(o&&(r=s.nodeDOM)&&!(r.nodeType==1?r.contains(e.nodeType==1?e:e.parentNode):r==e))o=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let o=n;o;o=o.parent)if(o==this)return n}posFromDOM(e,n,o){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,o)}return-1}descAt(e){for(let n=0,o=0;n<this.children.length;n++){let i=this.children[n],s=o+i.size;if(o==e&&s!=o){for(;!i.border&&i.children.length;)for(let r=0;r<i.children.length;r++){let l=i.children[r];if(l.size){i=l;break}}return i}if(e<s)return i.descAt(e-o-i.border);o=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let o=0,i=0;for(let s=0;o<this.children.length;o++){let r=this.children[o],l=s+r.size;if(l>e||r instanceof Jt){i=e-s;break}s=l}if(i)return this.children[o].domFromPos(i-this.children[o].border,n);for(let s;o&&!(s=this.children[o-1]).size&&s instanceof Xt&&s.side>=0;o--);if(n<=0){let s,r=!0;for(;s=o?this.children[o-1]:null,!(!s||s.dom.parentNode==this.contentDOM);o--,r=!1);return s&&n&&r&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?C(s.dom)+1:0}}else{let s,r=!0;for(;s=o<this.children.length?this.children[o]:null,!(!s||s.dom.parentNode==this.contentDOM);o++,r=!1);return s&&r&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?C(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,o=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let r=o,l=0;;l++){let a=this.children[l],c=r+a.size;if(i==-1&&e<=c){let d=r+a.border;if(e>=d&&n<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,n,d);e=r;for(let f=l;f>0;f--){let u=this.children[f-1];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(1)){i=C(u.dom)+1;break}e-=u.size}i==-1&&(i=0)}if(i>-1&&(c>n||l==this.children.length-1)){n=c;for(let d=l+1;d<this.children.length;d++){let f=this.children[d];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){s=C(f.dom);break}n+=f.size}s==-1&&(s=this.contentDOM.childNodes.length);break}r=c}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:o}=this.domFromPos(e,0);if(n.nodeType!=1||o==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[o]}setSelection(e,n,o,i=!1){let s=Math.min(e,n),r=Math.max(e,n);for(let p=0,h=0;p<this.children.length;p++){let g=this.children[p],m=h+g.size;if(s>h&&r<m)return g.setSelection(e-h-g.border,n-h-g.border,o,i);h=m}let l=this.domFromPos(e,e?-1:1),a=n==e?l:this.domFromPos(n,n?-1:1),c=o.root.getSelection(),d=o.domSelectionRange(),f=!1;if((z||k)&&e==n){let{node:p,offset:h}=l;if(p.nodeType==3){if(f=!!(h&&p.nodeValue[h-1]==`
|
|
2
|
-
`),f&&h==p.nodeValue.length)for(let g=p,m;g;g=g.parentNode){if(m=g.nextSibling){m.nodeName=="BR"&&(l=a={node:m.parentNode,offset:C(m)+1});break}let y=g.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let g=p.childNodes[h-1];f=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(z&&d.focusNode&&d.focusNode!=a.node&&d.focusNode.nodeType==1){let p=d.focusNode.childNodes[d.focusOffset];p&&p.contentEditable=="false"&&(i=!0)}if(!(i||f&&k)&&re(l.node,l.offset,d.anchorNode,d.anchorOffset)&&re(a.node,a.offset,d.focusNode,d.focusOffset))return;let u=!1;if((c.extend||e==n)&&!f){c.collapse(l.node,l.offset);try{e!=n&&c.extend(a.node,a.offset),u=!0}catch{}}if(!u){if(e>n){let h=l;l=a,a=h}let p=document.createRange();p.setEnd(a.node,a.offset),p.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let o=0,i=0;i<this.children.length;i++){let s=this.children[i],r=o+s.size;if(o==r?e<=r&&n>=o:e<r&&n>o){let l=o+s.border,a=r-s.border;if(e>=l&&n<=a){this.dirty=e==o||n==r?ne:ut,e==l&&n==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=$:s.markDirty(e-l,n-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?ne:$}o=r}this.dirty=ne}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let o=e==1?ne:ut;n.dirty<o&&(n.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Xt extends Me{constructor(e,n,o,i){let s,r=n.type.toDOM;if(typeof r=="function"&&(r=r(o,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(r.nodeType!=1){let l=document.createElement("span");l.appendChild(r),r=l}r.contentEditable="false",r.classList.add("ProseMirror-widget")}super(e,[],r,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==I&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Xn extends Me{constructor(e,n,o,i){super(e,[],n,null),this.textDOM=o,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class le extends Me{constructor(e,n,o,i,s){super(e,[],o,i),this.mark=n,this.spec=s}static create(e,n,o,i){let s=i.nodeViews[n.type.name],r=s&&s(n,i,o);return(!r||!r.dom)&&(r=Re.renderSpec(document,n.type.spec.toDOM(n,o),null,n.attrs)),new le(e,n,r.dom,r.contentDOM||r.dom,r)}parseRule(){return this.dirty&$||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=$&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=I){let o=this.parent;for(;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=I}}slice(e,n,o){let i=le.create(this.parent,this.mark,!0,o),s=this.children,r=this.size;n<r&&(s=Ye(s,n,r,o)),e>0&&(s=Ye(s,0,e,o));for(let l=0;l<s.length;l++)s[l].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Q extends Me{constructor(e,n,o,i,s,r,l,a,c){super(e,[],s,r),this.node=n,this.outerDeco=o,this.innerDeco=i,this.nodeDOM=l}static create(e,n,o,i,s,r){let l=s.nodeViews[n.type.name],a,c=l&&l(n,s,()=>{if(!a)return r;if(a.parent)return a.parent.posBeforeChild(a)},o,i),d=c&&c.dom,f=c&&c.contentDOM;if(n.isText){if(!d)d=document.createTextNode(n.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:f}=Re.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!f&&!n.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),n.type.spec.draggable&&(d.draggable=!0));let u=d;return d=wt(d,o,n),c?a=new Jn(e,n,o,i,d,f||null,u,c,s,r+1):n.isText?new Ie(e,n,o,i,d,u,s):new Q(e,n,o,i,d,f||null,u,s,r+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let o=this.children[n];if(this.dom.contains(o.dom.parentNode)){e.contentElement=o.dom.parentNode;break}}e.contentElement||(e.getContent=()=>_.empty)}return e}matchesNode(e,n,o){return this.dirty==I&&e.eq(this.node)&&Te(n,this.outerDeco)&&o.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let o=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,r=s&&s.pos>-1?s:null,l=s&&s.pos<0,a=new Qn(this,r&&r.node,e);eo(this.node,this.innerDeco,(c,d,f)=>{c.spec.marks?a.syncToMarks(c.spec.marks,o,e):c.type.side>=0&&!f&&a.syncToMarks(d==this.node.childCount?Cn.none:this.node.child(d).marks,o,e),a.placeWidget(c,e,i)},(c,d,f,u)=>{a.syncToMarks(c.marks,o,e);let p;a.findNodeMatch(c,d,f,u)||l&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(p=a.findIndexWithChild(s.node))>-1&&a.updateNodeAt(c,d,f,p,e)||a.updateNextNode(c,d,f,e,u,i)||a.addNode(c,d,f,e,i),i+=c.nodeSize}),a.syncToMarks([],o,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==ne)&&(r&&this.protectLocalComposition(e,r),Zt(this.contentDOM,this.children,e),pe&&to(this.dom))}localCompositionInfo(e,n){let{from:o,to:i}=e.state.selection;if(!(e.state.selection instanceof x)||o<n||i>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let r=s.nodeValue,l=no(this.node.content,r,o-n,i-n);return l<0?null:{node:s,pos:l,text:r}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:o,text:i}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let r=new Xn(this,s,n,i);e.input.compositionNodes.push(r),this.children=Ye(this.children,o,o+i.length,e,r)}update(e,n,o,i){return this.dirty==$||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,o,i),!0)}updateInner(e,n,o,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=o,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=I}updateOuterDeco(e){if(Te(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,o=this.dom;this.dom=Qt(this.dom,this.nodeDOM,Ue(this.outerDeco,this.node,n),Ue(e,this.node,n)),this.dom!=o&&(o.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function pt(t,e,n,o,i){wt(o,e,t);let s=new Q(void 0,t,e,n,o,o,o,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Ie extends Q{constructor(e,n,o,i,s,r,l){super(e,n,o,i,s,null,r,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,o,i){return this.dirty==$||this.dirty!=I&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=I||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=I,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,o){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,o)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,o){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new Ie(this.parent,i,this.outerDeco,this.innerDeco,s,s,o)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=$)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Jt extends Me{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==I&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Jn extends Q{constructor(e,n,o,i,s,r,l,a,c,d){super(e,n,o,i,s,r,l,c,d),this.spec=a}update(e,n,o,i){if(this.dirty==$)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,o);return s&&this.updateInner(e,n,o,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,o,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,o,i){this.spec.setSelection?this.spec.setSelection(e,n,o.root):super.setSelection(e,n,o,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Zt(t,e,n){let o=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let r=e[s],l=r.dom;if(l.parentNode==t){for(;l!=o;)o=mt(o),i=!0;o=o.nextSibling}else i=!0,t.insertBefore(l,o);if(r instanceof le){let a=o?o.previousSibling:t.lastChild;Zt(r.contentDOM,r.children,n),o=a?a.nextSibling:t.firstChild}}for(;o;)o=mt(o),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const ye=function(t){t&&(this.nodeName=t)};ye.prototype=Object.create(null);const oe=[new ye];function Ue(t,e,n){if(t.length==0)return oe;let o=n?oe[0]:new ye,i=[o];for(let s=0;s<t.length;s++){let r=t[s].type.attrs;if(r){r.nodeName&&i.push(o=new ye(r.nodeName));for(let l in r){let a=r[l];a!=null&&(n&&i.length==1&&i.push(o=new ye(e.isInline?"span":"div")),l=="class"?o.class=(o.class?o.class+" ":"")+a:l=="style"?o.style=(o.style?o.style+";":"")+a:l!="nodeName"&&(o[l]=a))}}}return i}function Qt(t,e,n,o){if(n==oe&&o==oe)return e;let i=e;for(let s=0;s<o.length;s++){let r=o[s],l=n[s];if(s){let a;l&&l.nodeName==r.nodeName&&i!=t&&(a=i.parentNode)&&a.nodeName.toLowerCase()==r.nodeName||(a=document.createElement(r.nodeName),a.pmIsDeco=!0,a.appendChild(i),l=oe[0]),i=a}Zn(i,l||oe[0],r)}return i}function Zn(t,e,n){for(let o in e)o!="class"&&o!="style"&&o!="nodeName"&&!(o in n)&&t.removeAttribute(o);for(let o in n)o!="class"&&o!="style"&&o!="nodeName"&&n[o]!=e[o]&&t.setAttribute(o,n[o]);if(e.class!=n.class){let o=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<o.length;s++)i.indexOf(o[s])==-1&&t.classList.remove(o[s]);for(let s=0;s<i.length;s++)o.indexOf(i[s])==-1&&t.classList.add(i[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let o=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=o.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function wt(t,e,n){return Qt(t,t,oe,Ue(e,n,t.nodeType!=1))}function Te(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function mt(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Qn{constructor(e,n,o){this.lock=n,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=wn(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let o=e;o<n;o++)this.top.children[o].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,o){let i=0,s=this.stack.length>>1,r=Math.min(s,e.length);for(;i<r&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=I,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){let c=this.top.children[a];if(c.matchesMark(e[s])&&!this.isLocked(c.dom)){l=a;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=le.create(this.top,e[s],n,o);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,o,i){let s=-1,r;if(i>=this.preMatch.index&&(r=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&r.matchesNode(e,n,o))s=this.top.children.indexOf(r,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,n,o)&&!this.preMatch.matched.has(c)){s=l;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,o,i,s){let r=this.top.children[i];return r.dirty==$&&r.dom==r.contentDOM&&(r.dirty=ne),r.update(e,n,o,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let o=e.pmViewDesc;if(o){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==o)return i}return-1}e=n}}updateNextNode(e,n,o,i,s,r){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof Q){let c=this.preMatch.matched.get(a);if(c!=null&&c!=s)return!1;let d=a.dom,f,u=this.isLocked(d)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=$&&Te(n,a.outerDeco));if(!u&&a.update(e,n,o,i))return this.destroyBetween(this.index,l),a.dom!=d&&(this.changed=!0),this.index++,!0;if(!u&&(f=this.recreateWrapper(a,e,n,o,i,r)))return this.destroyBetween(this.index,l),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=ne,f.updateChildren(i,r+1),f.dirty=I),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,o,i,s,r){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Te(o,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=Q.create(this.top,n,o,i,s,r);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,n,o,i,s){let r=Q.create(this.top,e,n,o,i,s);r.contentDOM&&r.updateChildren(i,s+1),this.top.children.splice(this.index++,0,r),this.changed=!0}placeWidget(e,n,o){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new Xt(this.top,e,n,o);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof le;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Ie)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((k||M)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let o=document.createElement(e);e=="IMG"&&(o.className="ProseMirror-separator",o.alt=""),e=="BR"&&(o.className="ProseMirror-trailingBreak");let i=new Jt(this.top,[],o,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function wn(t,e){let n=e,o=n.children.length,i=t.childCount,s=new Map,r=[];e:for(;i>0;){let l;for(;;)if(o){let c=n.children[o-1];if(c instanceof le)n=c,o=c.children.length;else{l=c,o--;break}}else{if(n==e)break e;o=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=t.child(i-1))break;--i,s.set(l,i),r.push(l)}}return{index:i,matched:s,matches:r.reverse()}}function vn(t,e){return t.type.side-e.type.side}function eo(t,e,n,o){let i=e.locals(t),s=0;if(i.length==0){for(let c=0;c<t.childCount;c++){let d=t.child(c);o(d,i,e.forChild(s,d),c),s+=d.nodeSize}return}let r=0,l=[],a=null;for(let c=0;;){let d,f;for(;r<i.length&&i[r].to==s;){let m=i[r++];m.widget&&(d?(f||(f=[d])).push(m):d=m)}if(d)if(f){f.sort(vn);for(let m=0;m<f.length;m++)n(f[m],c,!!a)}else n(d,c,!!a);let u,p;if(a)p=-1,u=a,a=null;else if(c<t.childCount)p=c,u=t.child(c++);else break;for(let m=0;m<l.length;m++)l[m].to<=s&&l.splice(m--,1);for(;r<i.length&&i[r].from<=s&&i[r].to>s;)l.push(i[r++]);let h=s+u.nodeSize;if(u.isText){let m=h;r<i.length&&i[r].from<m&&(m=i[r].from);for(let y=0;y<l.length;y++)l[y].to<m&&(m=l[y].to);m<h&&(a=u.cut(m-s),u=u.cut(0,m-s),h=m,p=-1)}else for(;r<i.length&&i[r].to<h;)r++;let g=u.isInline&&!u.isLeaf?l.filter(m=>!m.inline):l.slice();o(u,g,e.forChild(s,u),p),s=h}}function to(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function no(t,e,n,o){for(let i=0,s=0;i<t.childCount&&s<=o;){let r=t.child(i++),l=s;if(s+=r.nodeSize,!r.isText)continue;let a=r.text;for(;i<t.childCount;){let c=t.child(i++);if(s+=c.nodeSize,!c.isText)break;a+=c.text}if(s>=n){if(s>=o&&a.slice(o-e.length-l,o-l)==e)return o-e.length;let c=l<o?a.lastIndexOf(e,o-l-1):-1;if(c>=0&&c+e.length+l>=n)return l+c;if(n==o&&a.length>=o+e.length-l&&a.slice(o-l,o-l+e.length)==e)return o}}return-1}function Ye(t,e,n,o,i){let s=[];for(let r=0,l=0;r<t.length;r++){let a=t[r],c=l,d=l+=a.size;c>=n||d<=e?s.push(a):(c<e&&s.push(a.slice(0,e-c,o)),i&&(s.push(i),i=void 0),d>n&&s.push(a.slice(n-c,a.size,o)))}return s}function we(t,e=null){let n=t.domSelectionRange(),o=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,r=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(r<0)return null;let l=o.resolve(r),a,c;if(Be(n)){for(a=r;i&&!i.node;)i=i.parent;let f=i.node;if(i&&f.isAtom&&D.isSelectable(f)&&i.parent&&!(f.isInline&&An(n.focusNode,n.focusOffset,i.dom))){let u=i.posBefore;c=new D(r==u?l:o.resolve(u))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let f=r,u=r;for(let p=0;p<n.rangeCount;p++){let h=n.getRangeAt(p);f=Math.min(f,t.docView.posFromDOM(h.startContainer,h.startOffset,1)),u=Math.max(u,t.docView.posFromDOM(h.endContainer,h.endOffset,-1))}if(f<0)return null;[a,r]=u==t.state.selection.anchor?[u,f]:[f,u],l=o.resolve(r)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let d=o.resolve(a);if(!c){let f=e=="pointer"||t.state.selection.head<l.pos&&!s?1:-1;c=ve(t,d,l,f)}return c}function vt(t){return t.editable?t.hasFocus():tn(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function W(t,e=!1){let n=t.state.selection;if(en(t,n),!!vt(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&M){let o=t.domSelectionRange(),i=t.domObserver.currentSelection;if(o.anchorNode&&i.anchorNode&&re(o.anchorNode,o.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)io(t);else{let{anchor:o,head:i}=n,s,r;gt&&!(n instanceof x)&&(n.$from.parent.inlineContent||(s=yt(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(r=yt(t,n.to))),t.docView.setSelection(o,i,t,e),gt&&(s&&bt(s),r&&bt(r)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&oo(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const gt=k||M&&Ht<63;function yt(t,e){let{node:n,offset:o}=t.docView.domFromPos(e,0),i=o<n.childNodes.length?n.childNodes[o]:null,s=o?n.childNodes[o-1]:null;if(k&&i&&i.contentEditable=="false")return Le(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Le(i);if(s)return Le(s)}}function Le(t){return t.contentEditable="true",k&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function bt(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function oo(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),o=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=o||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!vt(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function io(t){let e=t.domSelection(),n=document.createRange();if(!e)return;let o=t.cursorWrapper.dom,i=o.nodeName=="IMG";i?n.setStart(o.parentNode,C(o)+1):n.setStart(o,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!i&&!t.state.selection.visible&&P&&Z<=11&&(o.disabled=!0,o.disabled=!1)}function en(t,e){if(e instanceof D){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Dt(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Dt(t)}function Dt(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function ve(t,e,n,o){return t.someProp("createSelectionBetween",i=>i(t,e,n))||x.between(e,n,o)}function Nt(t){return t.editable&&!t.hasFocus()?!1:tn(t)}function tn(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function so(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return re(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Ge(t,e){let{$anchor:n,$head:o}=t.selection,i=e>0?n.max(o):n.min(o),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&he.findFrom(s,e)}function Y(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function St(t,e,n){let o=t.state.selection;if(o instanceof x)if(n.indexOf("s")>-1){let{$head:i}=o,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let r=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Y(t,new x(o.$anchor,r))}else if(o.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Ge(t.state,e);return i&&i instanceof D?Y(t,i):!1}else if(!(R&&n.indexOf("m")>-1)){let i=o.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,r;if(!s||s.isText)return!1;let l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(r=t.docView.descAt(l))&&!r.contentDOM?D.isSelectable(s)?Y(t,new D(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):Oe?Y(t,new x(t.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(o instanceof D&&o.node.isInline)return Y(t,new x(e>0?o.$to:o.$from));{let i=Ge(t.state,e);return i?Y(t,i):!1}}}function Ae(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function be(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function ce(t,e){return e<0?ro(t):lo(t)}function ro(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let i,s,r=!1;for(z&&n.nodeType==1&&o<Ae(n)&&be(n.childNodes[o],-1)&&(r=!0);;)if(o>0){if(n.nodeType!=1)break;{let l=n.childNodes[o-1];if(be(l,-1))i=n,s=--o;else if(l.nodeType==3)n=l,o=n.nodeValue.length;else break}}else{if(nn(n))break;{let l=n.previousSibling;for(;l&&be(l,-1);)i=n.parentNode,s=C(l),l=l.previousSibling;if(l)n=l,o=Ae(n);else{if(n=n.parentNode,n==t.dom)break;o=0}}}r?Xe(t,n,o):i&&Xe(t,i,s)}function lo(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let i=Ae(n),s,r;for(;;)if(o<i){if(n.nodeType!=1)break;let l=n.childNodes[o];if(be(l,1))s=n,r=++o;else break}else{if(nn(n))break;{let l=n.nextSibling;for(;l&&be(l,1);)s=l.parentNode,r=C(l)+1,l=l.nextSibling;if(l)n=l,o=0,i=Ae(n);else{if(n=n.parentNode,n==t.dom)break;o=i=0}}}s&&Xe(t,s,r)}function nn(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function ao(t,e){for(;t&&e==t.childNodes.length&&!Ce(t);)e=C(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function co(t,e){for(;t&&!e&&!Ce(t);)e=C(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Xe(t,e,n){if(e.nodeType!=3){let s,r;(r=ao(e,n))?(e=r,n=0):(s=co(e,n))&&(e=s,n=s.nodeValue.length)}let o=t.domSelection();if(!o)return;if(Be(o)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),o.removeAllRanges(),o.addRange(s)}else o.extend&&o.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&W(t)},50)}function Ct(t,e){let n=t.state.doc.resolve(e);if(!(M||Vn)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),r=(s.top+s.bottom)/2;if(r>i.top&&r<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),r=(s.top+s.bottom)/2;if(r>i.top&&r<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Ot(t,e,n){let o=t.state.selection;if(o instanceof x&&!o.empty||n.indexOf("s")>-1||R&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=o;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let r=Ge(t.state,e);if(r&&r instanceof D)return Y(t,r)}if(!i.parent.inlineContent){let r=e<0?i:s,l=o instanceof Sn?he.near(r,e):he.findFrom(r,e);return l?Y(t,l):!1}return!1}function Mt(t,e){if(!(t.state.selection instanceof x))return!0;let{$head:n,$anchor:o,empty:i}=t.state.selection;if(!n.sameParent(o))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let r=t.state.tr;return e<0?r.delete(n.pos-s.nodeSize,n.pos):r.delete(n.pos,n.pos+s.nodeSize),t.dispatch(r),!0}return!1}function xt(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function fo(t){if(!k||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let o=e.firstChild;xt(t,o,"true"),setTimeout(()=>xt(t,o,"false"),20)}return!1}function ho(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function uo(t,e){let n=e.keyCode,o=ho(e);if(n==8||R&&n==72&&o=="c")return Mt(t,-1)||ce(t,-1);if(n==46&&!e.shiftKey||R&&n==68&&o=="c")return Mt(t,1)||ce(t,1);if(n==13||n==27)return!0;if(n==37||R&&n==66&&o=="c"){let i=n==37?Ct(t,t.state.selection.from)=="ltr"?-1:1:-1;return St(t,i,o)||ce(t,i)}else if(n==39||R&&n==70&&o=="c"){let i=n==39?Ct(t,t.state.selection.from)=="ltr"?1:-1:1;return St(t,i,o)||ce(t,i)}else{if(n==38||R&&n==80&&o=="c")return Ot(t,-1,o)||ce(t,-1);if(n==40||R&&n==78&&o=="c")return fo(t)||Ot(t,1,o)||ce(t,1);if(o==(R?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function et(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:o,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&o.childCount==1&&o.firstChild.childCount==1;){i--,s--;let p=o.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),o=p.content}let r=t.someProp("clipboardSerializer")||Re.fromSchema(t.state.schema),l=cn(),a=l.createElement("div");a.appendChild(r.serializeFragment(o,{document:l}));let c=a.firstChild,d,f=0;for(;c&&c.nodeType==1&&(d=an[c.nodeName.toLowerCase()]);){for(let p=d.length-1;p>=0;p--){let h=l.createElement(d[p]);for(;a.firstChild;)h.appendChild(a.firstChild);a.appendChild(h),f++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${f?` -${f}`:""} ${JSON.stringify(n)}`);let u=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,`
|
|
1
|
+
import{NodeSelection as D,Selection as he,TextSelection as M,AllSelection as Sn}from"../../prosemirror-state/dist/index.js";import{Slice as se,DOMSerializer as Re,Fragment as _,DOMParser as qt,Mark as Cn}from"../../prosemirror-model/dist/index.js";import{dropPoint as On}from"../../prosemirror-transform/dist/index.js";const C=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},ue=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let He=null;const K=function(t,e,n){let o=He||(He=document.createRange());return o.setEnd(t,n??t.nodeValue.length),o.setStart(t,e||0),o},xn=function(){He=null},re=function(t,e,n,o){return n&&(rt(t,e,n,o,-1)||rt(t,e,n,o,1))},Mn=/^(img|br|input|textarea|hr)$/i;function rt(t,e,n,o,i){for(var s;;){if(t==n&&e==o)return!0;if(e==(i<0?0:B(t))){let r=t.parentNode;if(!r||r.nodeType!=1||Ce(t)||Mn.test(t.nodeName)||t.contentEditable=="false")return!1;e=C(t)+(i<0?0:1),t=r}else if(t.nodeType==1){let r=t.childNodes[e+(i<0?-1:0)];if(r.nodeType==1&&r.contentEditable=="false")if(!((s=r.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=r,e=i<0?B(t):0}else return!1}}function B(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function kn(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=B(t)}else if(t.parentNode&&!Ce(t))e=C(t),t=t.parentNode;else return null}}function Tn(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Ce(t))e=C(t)+1,t=t.parentNode;else return null}}function Pn(t,e,n){for(let o=e==0,i=e==B(t);o||i;){if(t==n)return!0;let s=C(t);if(t=t.parentNode,!t)return!1;o=o&&s==0,i=i&&s==B(t)}}function Ce(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Be=function(t){return t.focusNode&&re(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function ee(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function An(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function En(t,e,n){if(t.caretPositionFromPoint)try{let o=t.caretPositionFromPoint(e,n);if(o)return{node:o.offsetNode,offset:Math.min(B(o.offsetNode),o.offset)}}catch{}if(t.caretRangeFromPoint){let o=t.caretRangeFromPoint(e,n);if(o)return{node:o.startContainer,offset:Math.min(B(o.startContainer),o.startOffset)}}}const L=typeof navigator<"u"?navigator:null,lt=typeof document<"u"?document:null,w=L&&L.userAgent||"",We=/Edge\/(\d+)/.exec(w),Kt=/MSIE \d/.exec(w),_e=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(w),E=!!(Kt||_e||We),J=Kt?document.documentMode:_e?+_e[1]:We?+We[1]:0,I=!E&&/gecko\/(\d+)/i.test(w);I&&+(/Firefox\/(\d+)/.exec(w)||[0,0])[1];const je=!E&&/Chrome\/(\d+)/.exec(w),x=!!je,Ht=je?+je[1]:0,k=!E&&!!L&&/Apple Computer/.test(L.vendor),pe=k&&(/Mobile\/\w+/.test(w)||!!L&&L.maxTouchPoints>2),R=pe||(L?/Mac/.test(L.platform):!1),Vn=L?/Win/.test(L.platform):!1,H=/Android \d/.test(w),Oe=!!lt&&"webkitFontSmoothing"in lt.documentElement.style,Rn=Oe?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Bn(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function q(t,e){return typeof t=="number"?t:t[e]}function In(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,o=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*o}}function at(t,e,n){let o=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let r=n||t.dom;r;){if(r.nodeType!=1){r=ue(r);continue}let l=r,a=l==s.body,c=a?Bn(s):In(l),d=0,f=0;if(e.top<c.top+q(o,"top")?f=-(c.top-e.top+q(i,"top")):e.bottom>c.bottom-q(o,"bottom")&&(f=e.bottom-e.top>c.bottom-c.top?e.top+q(i,"top")-c.top:e.bottom-c.bottom+q(i,"bottom")),e.left<c.left+q(o,"left")?d=-(c.left-e.left+q(i,"left")):e.right>c.right-q(o,"right")&&(d=e.right-c.right+q(i,"right")),d||f)if(a)s.defaultView.scrollBy(d,f);else{let p=l.scrollLeft,h=l.scrollTop;f&&(l.scrollTop+=f),d&&(l.scrollLeft+=d);let g=l.scrollLeft-p,m=l.scrollTop-h;e={left:e.left-g,top:e.top-m,right:e.right-g,bottom:e.bottom-m}}let u=a?"fixed":getComputedStyle(r).position;if(/^(fixed|sticky)$/.test(u))break;r=u=="absolute"?r.offsetParent:ue(r)}}function Fn(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),o,i;for(let s=(e.left+e.right)/2,r=n+1;r<Math.min(innerHeight,e.bottom);r+=5){let l=t.root.elementFromPoint(s,r);if(!l||l==t.dom||!t.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){o=l,i=a.top;break}}return{refDOM:o,refTop:i,stack:Wt(t.dom)}}function Wt(t){let e=[],n=t.ownerDocument;for(let o=t;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),t!=n);o=ue(o));return e}function zn({refDOM:t,refTop:e,stack:n}){let o=t?t.getBoundingClientRect().top:0;_t(n,o==0?0:o-e)}function _t(t,e){for(let n=0;n<t.length;n++){let{dom:o,top:i,left:s}=t[n];o.scrollTop!=i+e&&(o.scrollTop=i+e),o.scrollLeft!=s&&(o.scrollLeft=s)}}let ae=null;function Ln(t){if(t.setActive)return t.setActive();if(ae)return t.focus(ae);let e=Wt(t);t.focus(ae==null?{get preventScroll(){return ae={preventScroll:!0},!0}}:void 0),ae||(ae=!1,_t(e,0))}function jt(t,e){let n,o=2e8,i,s=0,r=e.top,l=e.top,a,c;for(let d=t.firstChild,f=0;d;d=d.nextSibling,f++){let u;if(d.nodeType==1)u=d.getClientRects();else if(d.nodeType==3)u=K(d).getClientRects();else continue;for(let p=0;p<u.length;p++){let h=u[p];if(h.top<=r&&h.bottom>=l){r=Math.max(h.bottom,r),l=Math.min(h.top,l);let g=h.left>e.left?h.left-e.left:h.right<e.left?e.left-h.right:0;if(g<o){n=d,o=g,i=g&&n.nodeType==3?{left:h.right<e.left?h.right:h.left,top:e.top}:e,d.nodeType==1&&g&&(s=f+(e.left>=(h.left+h.right)/2?1:0));continue}}else h.top>e.top&&!a&&h.left<=e.left&&h.right>=e.left&&(a=d,c={left:Math.max(h.left,Math.min(h.right,e.left)),top:h.top});!n&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(s=f+1)}}return!n&&a&&(n=a,i=c,o=0),n&&n.nodeType==3?$n(n,i):!n||o&&n.nodeType==1?{node:t,offset:s}:jt(n,i)}function $n(t,e){let n=t.nodeValue.length,o=document.createRange();for(let i=0;i<n;i++){o.setEnd(t,i+1),o.setStart(t,i);let s=U(o,1);if(s.top!=s.bottom&&Qe(e,s))return{node:t,offset:i+(e.left>=(s.left+s.right)/2?1:0)}}return{node:t,offset:0}}function Qe(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function qn(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Kn(t,e,n){let{node:o,offset:i}=jt(e,n),s=-1;if(o.nodeType==1&&!o.firstChild){let r=o.getBoundingClientRect();s=r.left!=r.right&&n.left>(r.left+r.right)/2?1:-1}return t.docView.posFromDOM(o,i,s)}function Hn(t,e,n,o){let i=-1;for(let s=e,r=!1;s!=t.dom;){let l=t.docView.nearestDesc(s,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!r&&a.left>o.left||a.top>o.top?i=l.posBefore:(!r&&a.right<o.left||a.bottom<o.top)&&(i=l.posAfter),r=!0),!l.contentDOM&&i<0&&!l.node.isText))return(l.node.isBlock?o.top<(a.top+a.bottom)/2:o.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;s=l.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function Ut(t,e,n){let o=t.childNodes.length;if(o&&n.top<n.bottom)for(let i=Math.max(0,Math.min(o-1,Math.floor(o*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let r=t.childNodes[s];if(r.nodeType==1){let l=r.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(Qe(e,c))return Ut(r,e,c)}}if((s=(s+1)%o)==i)break}return t}function Wn(t,e){let n=t.dom.ownerDocument,o,i=0,s=En(n,e.left,e.top);s&&({node:o,offset:i}=s);let r=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!r||!t.dom.contains(r.nodeType!=1?r.parentNode:r)){let c=t.dom.getBoundingClientRect();if(!Qe(e,c)||(r=Ut(t.dom,e,c),!r))return null}if(k)for(let c=r;o&&c;c=ue(c))c.draggable&&(o=void 0);if(r=qn(r,e),o){if(I&&o.nodeType==1&&(i=Math.min(i,o.childNodes.length),i<o.childNodes.length)){let d=o.childNodes[i],f;d.nodeName=="IMG"&&(f=d.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}let c;Oe&&i&&o.nodeType==1&&(c=o.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,o==t.dom&&i==o.childNodes.length-1&&o.lastChild.nodeType==1&&e.top>o.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(i==0||o.nodeType!=1||o.childNodes[i-1].nodeName!="BR")&&(l=Hn(t,o,i,e))}l==null&&(l=Kn(t,r,e));let a=t.docView.nearestDesc(r,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function ct(t){return t.top<t.bottom||t.left<t.right}function U(t,e){let n=t.getClientRects();if(n.length){let o=n[e<0?0:n.length-1];if(ct(o))return o}return Array.prototype.find.call(n,ct)||t.getBoundingClientRect()}const _n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Yt(t,e,n){let{node:o,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),r=Oe||I;if(o.nodeType==3)if(r&&(_n.test(o.nodeValue)||(n<0?!i:i==o.nodeValue.length))){let a=U(K(o,i,i),n);if(I&&i&&/\s/.test(o.nodeValue[i-1])&&i<o.nodeValue.length){let c=U(K(o,i-1,i-1),-1);if(c.top==a.top){let d=U(K(o,i,i+1),-1);if(d.top!=a.top)return ge(d,d.left<c.left)}}return a}else{let a=i,c=i,d=n<0?1:-1;return n<0&&!i?(c++,d=-1):n>=0&&i==o.nodeValue.length?(a--,d=1):n<0?a--:c++,ge(U(K(o,a,c),d),d<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==B(o))){let a=o.childNodes[i-1];if(a.nodeType==1)return ze(a.getBoundingClientRect(),!1)}if(s==null&&i<B(o)){let a=o.childNodes[i];if(a.nodeType==1)return ze(a.getBoundingClientRect(),!0)}return ze(o.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==B(o))){let a=o.childNodes[i-1],c=a.nodeType==3?K(a,B(a)-(r?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return ge(U(c,1),!1)}if(s==null&&i<B(o)){let a=o.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?K(a,0,r?0:1):a.nodeType==1?a:null:null;if(c)return ge(U(c,-1),!0)}return ge(U(o.nodeType==3?K(o):o,-n),n>=0)}function ge(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function ze(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Gt(t,e,n){let o=t.state,i=t.root.activeElement;o!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{o!=e&&t.updateState(o),i!=t.dom&&i&&i.focus()}}function jn(t,e,n){let o=e.selection,i=n=="up"?o.$from:o.$to;return Gt(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let r=Yt(t,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=K(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let d=a[c];if(d.bottom>d.top+1&&(n=="up"?r.top-d.top>(d.bottom-r.top)*2:d.bottom-r.bottom>(r.bottom-d.top)*2))return!1}}return!0})}const Un=/[\u0590-\u08ac]/;function Yn(t,e,n){let{$head:o}=e.selection;if(!o.parent.isTextblock)return!1;let i=o.parentOffset,s=!i,r=i==o.parent.content.size,l=t.domSelection();return l?!Un.test(o.parent.textContent)||!l.modify?n=="left"||n=="backward"?s:r:Gt(t,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:d,anchorOffset:f}=t.domSelectionRange(),u=l.caretBidiLevel;l.modify("move",n,"character");let p=o.depth?t.docView.domAfterPos(o.before()):t.dom,{focusNode:h,focusOffset:g}=t.domSelectionRange(),m=h&&!p.contains(h.nodeType==1?h:h.parentNode)||a==h&&c==g;try{l.collapse(d,f),a&&(a!=d||c!=f)&&l.extend&&l.extend(a,c)}catch{}return u!=null&&(l.caretBidiLevel=u),m}):o.pos==o.start()||o.pos==o.end()}let dt=null,ft=null,ht=!1;function Gn(t,e,n){return dt==e&&ft==n?ht:(dt=e,ft=n,ht=n=="up"||n=="down"?jn(t,e,n):Yn(t,e,n))}const F=0,ut=1,te=2,$=3;class xe{constructor(e,n,o,i){this.parent=e,this.children=n,this.dom=o,this.contentDOM=i,this.dirty=F,o.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,o){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,o=this.posAtStart;;n++){let i=this.children[n];if(i==e)return o;o+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,o){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(o<0){let s,r;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((r=s.pmViewDesc)&&r.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(r)+r.size:this.posAtStart}else{let s,r;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((r=s.pmViewDesc)&&r.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(r):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>C(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??o>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let o=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),r;if(s&&(!n||s.node))if(o&&(r=s.nodeDOM)&&!(r.nodeType==1?r.contains(e.nodeType==1?e:e.parentNode):r==e))o=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let o=n;o;o=o.parent)if(o==this)return n}posFromDOM(e,n,o){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,o)}return-1}descAt(e){for(let n=0,o=0;n<this.children.length;n++){let i=this.children[n],s=o+i.size;if(o==e&&s!=o){for(;!i.border&&i.children.length;)for(let r=0;r<i.children.length;r++){let l=i.children[r];if(l.size){i=l;break}}return i}if(e<s)return i.descAt(e-o-i.border);o=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let o=0,i=0;for(let s=0;o<this.children.length;o++){let r=this.children[o],l=s+r.size;if(l>e||r instanceof Jt){i=e-s;break}s=l}if(i)return this.children[o].domFromPos(i-this.children[o].border,n);for(let s;o&&!(s=this.children[o-1]).size&&s instanceof Xt&&s.side>=0;o--);if(n<=0){let s,r=!0;for(;s=o?this.children[o-1]:null,!(!s||s.dom.parentNode==this.contentDOM);o--,r=!1);return s&&n&&r&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?C(s.dom)+1:0}}else{let s,r=!0;for(;s=o<this.children.length?this.children[o]:null,!(!s||s.dom.parentNode==this.contentDOM);o++,r=!1);return s&&r&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?C(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,o=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let r=o,l=0;;l++){let a=this.children[l],c=r+a.size;if(i==-1&&e<=c){let d=r+a.border;if(e>=d&&n<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,n,d);e=r;for(let f=l;f>0;f--){let u=this.children[f-1];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(1)){i=C(u.dom)+1;break}e-=u.size}i==-1&&(i=0)}if(i>-1&&(c>n||l==this.children.length-1)){n=c;for(let d=l+1;d<this.children.length;d++){let f=this.children[d];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){s=C(f.dom);break}n+=f.size}s==-1&&(s=this.contentDOM.childNodes.length);break}r=c}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:o}=this.domFromPos(e,0);if(n.nodeType!=1||o==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[o]}setSelection(e,n,o,i=!1){let s=Math.min(e,n),r=Math.max(e,n);for(let p=0,h=0;p<this.children.length;p++){let g=this.children[p],m=h+g.size;if(s>h&&r<m)return g.setSelection(e-h-g.border,n-h-g.border,o,i);h=m}let l=this.domFromPos(e,e?-1:1),a=n==e?l:this.domFromPos(n,n?-1:1),c=o.root.getSelection(),d=o.domSelectionRange(),f=!1;if((I||k)&&e==n){let{node:p,offset:h}=l;if(p.nodeType==3){if(f=!!(h&&p.nodeValue[h-1]==`
|
|
2
|
+
`),f&&h==p.nodeValue.length)for(let g=p,m;g;g=g.parentNode){if(m=g.nextSibling){m.nodeName=="BR"&&(l=a={node:m.parentNode,offset:C(m)+1});break}let y=g.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let g=p.childNodes[h-1];f=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(I&&d.focusNode&&d.focusNode!=a.node&&d.focusNode.nodeType==1){let p=d.focusNode.childNodes[d.focusOffset];p&&p.contentEditable=="false"&&(i=!0)}if(!(i||f&&k)&&re(l.node,l.offset,d.anchorNode,d.anchorOffset)&&re(a.node,a.offset,d.focusNode,d.focusOffset))return;let u=!1;if((c.extend||e==n)&&!(f&&I)){c.collapse(l.node,l.offset);try{e!=n&&c.extend(a.node,a.offset),u=!0}catch{}}if(!u){if(e>n){let h=l;l=a,a=h}let p=document.createRange();p.setEnd(a.node,a.offset),p.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let o=0,i=0;i<this.children.length;i++){let s=this.children[i],r=o+s.size;if(o==r?e<=r&&n>=o:e<r&&n>o){let l=o+s.border,a=r-s.border;if(e>=l&&n<=a){this.dirty=e==o||n==r?te:ut,e==l&&n==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=$:s.markDirty(e-l,n-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?te:$}o=r}this.dirty=te}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let o=e==1?te:ut;n.dirty<o&&(n.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Xt extends xe{constructor(e,n,o,i){let s,r=n.type.toDOM;if(typeof r=="function"&&(r=r(o,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(r.nodeType!=1){let l=document.createElement("span");l.appendChild(r),r=l}r.contentEditable="false",r.classList.add("ProseMirror-widget")}super(e,[],r,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==F&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Xn extends xe{constructor(e,n,o,i){super(e,[],n,null),this.textDOM=o,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class le extends xe{constructor(e,n,o,i,s){super(e,[],o,i),this.mark=n,this.spec=s}static create(e,n,o,i){let s=i.nodeViews[n.type.name],r=s&&s(n,i,o);return(!r||!r.dom)&&(r=Re.renderSpec(document,n.type.spec.toDOM(n,o),null,n.attrs)),new le(e,n,r.dom,r.contentDOM||r.dom,r)}parseRule(){return this.dirty&$||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=$&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=F){let o=this.parent;for(;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=F}}slice(e,n,o){let i=le.create(this.parent,this.mark,!0,o),s=this.children,r=this.size;n<r&&(s=Ye(s,n,r,o)),e>0&&(s=Ye(s,0,e,o));for(let l=0;l<s.length;l++)s[l].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Z extends xe{constructor(e,n,o,i,s,r,l,a,c){super(e,[],s,r),this.node=n,this.outerDeco=o,this.innerDeco=i,this.nodeDOM=l}static create(e,n,o,i,s,r){let l=s.nodeViews[n.type.name],a,c=l&&l(n,s,()=>{if(!a)return r;if(a.parent)return a.parent.posBeforeChild(a)},o,i),d=c&&c.dom,f=c&&c.contentDOM;if(n.isText){if(!d)d=document.createTextNode(n.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:f}=Re.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!f&&!n.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),n.type.spec.draggable&&(d.draggable=!0));let u=d;return d=wt(d,o,n),c?a=new Jn(e,n,o,i,d,f||null,u,c,s,r+1):n.isText?new Ie(e,n,o,i,d,u,s):new Z(e,n,o,i,d,f||null,u,s,r+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let o=this.children[n];if(this.dom.contains(o.dom.parentNode)){e.contentElement=o.dom.parentNode;break}}e.contentElement||(e.getContent=()=>_.empty)}return e}matchesNode(e,n,o){return this.dirty==F&&e.eq(this.node)&&Te(n,this.outerDeco)&&o.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let o=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,r=s&&s.pos>-1?s:null,l=s&&s.pos<0,a=new Qn(this,r&&r.node,e);eo(this.node,this.innerDeco,(c,d,f)=>{c.spec.marks?a.syncToMarks(c.spec.marks,o,e):c.type.side>=0&&!f&&a.syncToMarks(d==this.node.childCount?Cn.none:this.node.child(d).marks,o,e),a.placeWidget(c,e,i)},(c,d,f,u)=>{a.syncToMarks(c.marks,o,e);let p;a.findNodeMatch(c,d,f,u)||l&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(p=a.findIndexWithChild(s.node))>-1&&a.updateNodeAt(c,d,f,p,e)||a.updateNextNode(c,d,f,e,u,i)||a.addNode(c,d,f,e,i),i+=c.nodeSize}),a.syncToMarks([],o,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==te)&&(r&&this.protectLocalComposition(e,r),Zt(this.contentDOM,this.children,e),pe&&to(this.dom))}localCompositionInfo(e,n){let{from:o,to:i}=e.state.selection;if(!(e.state.selection instanceof M)||o<n||i>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let r=s.nodeValue,l=no(this.node.content,r,o-n,i-n);return l<0?null:{node:s,pos:l,text:r}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:o,text:i}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let r=new Xn(this,s,n,i);e.input.compositionNodes.push(r),this.children=Ye(this.children,o,o+i.length,e,r)}update(e,n,o,i){return this.dirty==$||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,o,i),!0)}updateInner(e,n,o,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=o,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=F}updateOuterDeco(e){if(Te(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,o=this.dom;this.dom=Qt(this.dom,this.nodeDOM,Ue(this.outerDeco,this.node,n),Ue(e,this.node,n)),this.dom!=o&&(o.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function pt(t,e,n,o,i){wt(o,e,t);let s=new Z(void 0,t,e,n,o,o,o,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Ie extends Z{constructor(e,n,o,i,s,r,l){super(e,n,o,i,s,null,r,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,o,i){return this.dirty==$||this.dirty!=F&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=F||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=F,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,o){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,o)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,o){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new Ie(this.parent,i,this.outerDeco,this.innerDeco,s,s,o)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=$)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Jt extends xe{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==F&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Jn extends Z{constructor(e,n,o,i,s,r,l,a,c,d){super(e,n,o,i,s,r,l,c,d),this.spec=a}update(e,n,o,i){if(this.dirty==$)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,o);return s&&this.updateInner(e,n,o,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,o,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,o,i){this.spec.setSelection?this.spec.setSelection(e,n,o.root):super.setSelection(e,n,o,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Zt(t,e,n){let o=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let r=e[s],l=r.dom;if(l.parentNode==t){for(;l!=o;)o=mt(o),i=!0;o=o.nextSibling}else i=!0,t.insertBefore(l,o);if(r instanceof le){let a=o?o.previousSibling:t.lastChild;Zt(r.contentDOM,r.children,n),o=a?a.nextSibling:t.firstChild}}for(;o;)o=mt(o),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const ye=function(t){t&&(this.nodeName=t)};ye.prototype=Object.create(null);const ne=[new ye];function Ue(t,e,n){if(t.length==0)return ne;let o=n?ne[0]:new ye,i=[o];for(let s=0;s<t.length;s++){let r=t[s].type.attrs;if(r){r.nodeName&&i.push(o=new ye(r.nodeName));for(let l in r){let a=r[l];a!=null&&(n&&i.length==1&&i.push(o=new ye(e.isInline?"span":"div")),l=="class"?o.class=(o.class?o.class+" ":"")+a:l=="style"?o.style=(o.style?o.style+";":"")+a:l!="nodeName"&&(o[l]=a))}}}return i}function Qt(t,e,n,o){if(n==ne&&o==ne)return e;let i=e;for(let s=0;s<o.length;s++){let r=o[s],l=n[s];if(s){let a;l&&l.nodeName==r.nodeName&&i!=t&&(a=i.parentNode)&&a.nodeName.toLowerCase()==r.nodeName||(a=document.createElement(r.nodeName),a.pmIsDeco=!0,a.appendChild(i),l=ne[0]),i=a}Zn(i,l||ne[0],r)}return i}function Zn(t,e,n){for(let o in e)o!="class"&&o!="style"&&o!="nodeName"&&!(o in n)&&t.removeAttribute(o);for(let o in n)o!="class"&&o!="style"&&o!="nodeName"&&n[o]!=e[o]&&t.setAttribute(o,n[o]);if(e.class!=n.class){let o=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<o.length;s++)i.indexOf(o[s])==-1&&t.classList.remove(o[s]);for(let s=0;s<i.length;s++)o.indexOf(i[s])==-1&&t.classList.add(i[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let o=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=o.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function wt(t,e,n){return Qt(t,t,ne,Ue(e,n,t.nodeType!=1))}function Te(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function mt(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Qn{constructor(e,n,o){this.lock=n,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=wn(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let o=e;o<n;o++)this.top.children[o].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,o){let i=0,s=this.stack.length>>1,r=Math.min(s,e.length);for(;i<r&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=F,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){let c=this.top.children[a];if(c.matchesMark(e[s])&&!this.isLocked(c.dom)){l=a;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=le.create(this.top,e[s],n,o);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,o,i){let s=-1,r;if(i>=this.preMatch.index&&(r=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&r.matchesNode(e,n,o))s=this.top.children.indexOf(r,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,n,o)&&!this.preMatch.matched.has(c)){s=l;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,o,i,s){let r=this.top.children[i];return r.dirty==$&&r.dom==r.contentDOM&&(r.dirty=te),r.update(e,n,o,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let o=e.pmViewDesc;if(o){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==o)return i}return-1}e=n}}updateNextNode(e,n,o,i,s,r){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof Z){let c=this.preMatch.matched.get(a);if(c!=null&&c!=s)return!1;let d=a.dom,f,u=this.isLocked(d)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=$&&Te(n,a.outerDeco));if(!u&&a.update(e,n,o,i))return this.destroyBetween(this.index,l),a.dom!=d&&(this.changed=!0),this.index++,!0;if(!u&&(f=this.recreateWrapper(a,e,n,o,i,r)))return this.destroyBetween(this.index,l),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=te,f.updateChildren(i,r+1),f.dirty=F),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,o,i,s,r){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Te(o,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=Z.create(this.top,n,o,i,s,r);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,n,o,i,s){let r=Z.create(this.top,e,n,o,i,s);r.contentDOM&&r.updateChildren(i,s+1),this.top.children.splice(this.index++,0,r),this.changed=!0}placeWidget(e,n,o){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new Xt(this.top,e,n,o);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof le;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Ie)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((k||x)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let o=document.createElement(e);e=="IMG"&&(o.className="ProseMirror-separator",o.alt=""),e=="BR"&&(o.className="ProseMirror-trailingBreak");let i=new Jt(this.top,[],o,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function wn(t,e){let n=e,o=n.children.length,i=t.childCount,s=new Map,r=[];e:for(;i>0;){let l;for(;;)if(o){let c=n.children[o-1];if(c instanceof le)n=c,o=c.children.length;else{l=c,o--;break}}else{if(n==e)break e;o=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=t.child(i-1))break;--i,s.set(l,i),r.push(l)}}return{index:i,matched:s,matches:r.reverse()}}function vn(t,e){return t.type.side-e.type.side}function eo(t,e,n,o){let i=e.locals(t),s=0;if(i.length==0){for(let c=0;c<t.childCount;c++){let d=t.child(c);o(d,i,e.forChild(s,d),c),s+=d.nodeSize}return}let r=0,l=[],a=null;for(let c=0;;){let d,f;for(;r<i.length&&i[r].to==s;){let m=i[r++];m.widget&&(d?(f||(f=[d])).push(m):d=m)}if(d)if(f){f.sort(vn);for(let m=0;m<f.length;m++)n(f[m],c,!!a)}else n(d,c,!!a);let u,p;if(a)p=-1,u=a,a=null;else if(c<t.childCount)p=c,u=t.child(c++);else break;for(let m=0;m<l.length;m++)l[m].to<=s&&l.splice(m--,1);for(;r<i.length&&i[r].from<=s&&i[r].to>s;)l.push(i[r++]);let h=s+u.nodeSize;if(u.isText){let m=h;r<i.length&&i[r].from<m&&(m=i[r].from);for(let y=0;y<l.length;y++)l[y].to<m&&(m=l[y].to);m<h&&(a=u.cut(m-s),u=u.cut(0,m-s),h=m,p=-1)}else for(;r<i.length&&i[r].to<h;)r++;let g=u.isInline&&!u.isLeaf?l.filter(m=>!m.inline):l.slice();o(u,g,e.forChild(s,u),p),s=h}}function to(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function no(t,e,n,o){for(let i=0,s=0;i<t.childCount&&s<=o;){let r=t.child(i++),l=s;if(s+=r.nodeSize,!r.isText)continue;let a=r.text;for(;i<t.childCount;){let c=t.child(i++);if(s+=c.nodeSize,!c.isText)break;a+=c.text}if(s>=n){if(s>=o&&a.slice(o-e.length-l,o-l)==e)return o-e.length;let c=l<o?a.lastIndexOf(e,o-l-1):-1;if(c>=0&&c+e.length+l>=n)return l+c;if(n==o&&a.length>=o+e.length-l&&a.slice(o-l,o-l+e.length)==e)return o}}return-1}function Ye(t,e,n,o,i){let s=[];for(let r=0,l=0;r<t.length;r++){let a=t[r],c=l,d=l+=a.size;c>=n||d<=e?s.push(a):(c<e&&s.push(a.slice(0,e-c,o)),i&&(s.push(i),i=void 0),d>n&&s.push(a.slice(n-c,a.size,o)))}return s}function we(t,e=null){let n=t.domSelectionRange(),o=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,r=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(r<0)return null;let l=o.resolve(r),a,c;if(Be(n)){for(a=r;i&&!i.node;)i=i.parent;let f=i.node;if(i&&f.isAtom&&D.isSelectable(f)&&i.parent&&!(f.isInline&&Pn(n.focusNode,n.focusOffset,i.dom))){let u=i.posBefore;c=new D(r==u?l:o.resolve(u))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let f=r,u=r;for(let p=0;p<n.rangeCount;p++){let h=n.getRangeAt(p);f=Math.min(f,t.docView.posFromDOM(h.startContainer,h.startOffset,1)),u=Math.max(u,t.docView.posFromDOM(h.endContainer,h.endOffset,-1))}if(f<0)return null;[a,r]=u==t.state.selection.anchor?[u,f]:[f,u],l=o.resolve(r)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let d=o.resolve(a);if(!c){let f=e=="pointer"||t.state.selection.head<l.pos&&!s?1:-1;c=ve(t,d,l,f)}return c}function vt(t){return t.editable?t.hasFocus():tn(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function W(t,e=!1){let n=t.state.selection;if(en(t,n),!!vt(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&x){let o=t.domSelectionRange(),i=t.domObserver.currentSelection;if(o.anchorNode&&i.anchorNode&&re(o.anchorNode,o.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)io(t);else{let{anchor:o,head:i}=n,s,r;gt&&!(n instanceof M)&&(n.$from.parent.inlineContent||(s=yt(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(r=yt(t,n.to))),t.docView.setSelection(o,i,t,e),gt&&(s&&bt(s),r&&bt(r)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&oo(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const gt=k||x&&Ht<63;function yt(t,e){let{node:n,offset:o}=t.docView.domFromPos(e,0),i=o<n.childNodes.length?n.childNodes[o]:null,s=o?n.childNodes[o-1]:null;if(k&&i&&i.contentEditable=="false")return Le(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Le(i);if(s)return Le(s)}}function Le(t){return t.contentEditable="true",k&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function bt(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function oo(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),o=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=o||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!vt(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function io(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,o=n.nodeName=="IMG";o?e.collapse(n.parentNode,C(n)+1):e.collapse(n,0),!o&&!t.state.selection.visible&&E&&J<=11&&(n.disabled=!0,n.disabled=!1)}function en(t,e){if(e instanceof D){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Dt(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Dt(t)}function Dt(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function ve(t,e,n,o){return t.someProp("createSelectionBetween",i=>i(t,e,n))||M.between(e,n,o)}function Nt(t){return t.editable&&!t.hasFocus()?!1:tn(t)}function tn(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function so(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return re(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Ge(t,e){let{$anchor:n,$head:o}=t.selection,i=e>0?n.max(o):n.min(o),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&he.findFrom(s,e)}function Y(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function St(t,e,n){let o=t.state.selection;if(o instanceof M)if(n.indexOf("s")>-1){let{$head:i}=o,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let r=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Y(t,new M(o.$anchor,r))}else if(o.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Ge(t.state,e);return i&&i instanceof D?Y(t,i):!1}else if(!(R&&n.indexOf("m")>-1)){let i=o.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,r;if(!s||s.isText)return!1;let l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(r=t.docView.descAt(l))&&!r.contentDOM?D.isSelectable(s)?Y(t,new D(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):Oe?Y(t,new M(t.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(o instanceof D&&o.node.isInline)return Y(t,new M(e>0?o.$to:o.$from));{let i=Ge(t.state,e);return i?Y(t,i):!1}}}function Pe(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function be(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function ce(t,e){return e<0?ro(t):lo(t)}function ro(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let i,s,r=!1;for(I&&n.nodeType==1&&o<Pe(n)&&be(n.childNodes[o],-1)&&(r=!0);;)if(o>0){if(n.nodeType!=1)break;{let l=n.childNodes[o-1];if(be(l,-1))i=n,s=--o;else if(l.nodeType==3)n=l,o=n.nodeValue.length;else break}}else{if(nn(n))break;{let l=n.previousSibling;for(;l&&be(l,-1);)i=n.parentNode,s=C(l),l=l.previousSibling;if(l)n=l,o=Pe(n);else{if(n=n.parentNode,n==t.dom)break;o=0}}}r?Xe(t,n,o):i&&Xe(t,i,s)}function lo(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let i=Pe(n),s,r;for(;;)if(o<i){if(n.nodeType!=1)break;let l=n.childNodes[o];if(be(l,1))s=n,r=++o;else break}else{if(nn(n))break;{let l=n.nextSibling;for(;l&&be(l,1);)s=l.parentNode,r=C(l)+1,l=l.nextSibling;if(l)n=l,o=0,i=Pe(n);else{if(n=n.parentNode,n==t.dom)break;o=i=0}}}s&&Xe(t,s,r)}function nn(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function ao(t,e){for(;t&&e==t.childNodes.length&&!Ce(t);)e=C(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function co(t,e){for(;t&&!e&&!Ce(t);)e=C(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Xe(t,e,n){if(e.nodeType!=3){let s,r;(r=ao(e,n))?(e=r,n=0):(s=co(e,n))&&(e=s,n=s.nodeValue.length)}let o=t.domSelection();if(!o)return;if(Be(o)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),o.removeAllRanges(),o.addRange(s)}else o.extend&&o.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&W(t)},50)}function Ct(t,e){let n=t.state.doc.resolve(e);if(!(x||Vn)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),r=(s.top+s.bottom)/2;if(r>i.top&&r<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),r=(s.top+s.bottom)/2;if(r>i.top&&r<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Ot(t,e,n){let o=t.state.selection;if(o instanceof M&&!o.empty||n.indexOf("s")>-1||R&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=o;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let r=Ge(t.state,e);if(r&&r instanceof D)return Y(t,r)}if(!i.parent.inlineContent){let r=e<0?i:s,l=o instanceof Sn?he.near(r,e):he.findFrom(r,e);return l?Y(t,l):!1}return!1}function xt(t,e){if(!(t.state.selection instanceof M))return!0;let{$head:n,$anchor:o,empty:i}=t.state.selection;if(!n.sameParent(o))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let r=t.state.tr;return e<0?r.delete(n.pos-s.nodeSize,n.pos):r.delete(n.pos,n.pos+s.nodeSize),t.dispatch(r),!0}return!1}function Mt(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function fo(t){if(!k||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let o=e.firstChild;Mt(t,o,"true"),setTimeout(()=>Mt(t,o,"false"),20)}return!1}function ho(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function uo(t,e){let n=e.keyCode,o=ho(e);if(n==8||R&&n==72&&o=="c")return xt(t,-1)||ce(t,-1);if(n==46&&!e.shiftKey||R&&n==68&&o=="c")return xt(t,1)||ce(t,1);if(n==13||n==27)return!0;if(n==37||R&&n==66&&o=="c"){let i=n==37?Ct(t,t.state.selection.from)=="ltr"?-1:1:-1;return St(t,i,o)||ce(t,i)}else if(n==39||R&&n==70&&o=="c"){let i=n==39?Ct(t,t.state.selection.from)=="ltr"?1:-1:1;return St(t,i,o)||ce(t,i)}else{if(n==38||R&&n==80&&o=="c")return Ot(t,-1,o)||ce(t,-1);if(n==40||R&&n==78&&o=="c")return fo(t)||Ot(t,1,o)||ce(t,1);if(o==(R?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function et(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:o,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&o.childCount==1&&o.firstChild.childCount==1;){i--,s--;let p=o.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),o=p.content}let r=t.someProp("clipboardSerializer")||Re.fromSchema(t.state.schema),l=cn(),a=l.createElement("div");a.appendChild(r.serializeFragment(o,{document:l}));let c=a.firstChild,d,f=0;for(;c&&c.nodeType==1&&(d=an[c.nodeName.toLowerCase()]);){for(let p=d.length-1;p>=0;p--){let h=l.createElement(d[p]);for(;a.firstChild;)h.appendChild(a.firstChild);a.appendChild(h),f++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${f?` -${f}`:""} ${JSON.stringify(n)}`);let u=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,`
|
|
3
3
|
|
|
4
|
-
`);return{dom:a,text:u,slice:e}}function on(t,e,n,o,i){let s=i.parent.type.spec.code,r,l;if(!n&&!e)return null;let a
|
|
5
|
-
`))),0,0):J.empty;let f=t.someProp("clipboardTextParser",u=>u(e,i,o,t));if(f)l=f;else{let u=i.marks(),{schema:p}=t.state,h=Re.fromSchema(p);r=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let m=r.appendChild(document.createElement("p"));g&&m.appendChild(h.serializeNode(p.text(g,u)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),r=yo(n),Oe&&bo(r);let c=r&&r.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let f=+d[3];f>0;f--){let u=r.firstChild;for(;u&&u.nodeType!=1;)u=u.nextSibling;if(!u)break;r=u}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||qt.fromSchema(t.state.schema)).parseSlice(r,{preserveWhitespace:!!(a||d),context:i,ruleFromNode(u){return u.nodeName=="BR"&&!u.nextSibling&&u.parentNode&&!po.test(u.parentNode.nodeName)?{ignore:!0}:null}})),d)l=Do(kt(l,+d[1],+d[2]),d[4]);else if(l=J.maxOpen(mo(l.content,i),!0),l.openStart||l.openEnd){let f=0,u=0;for(let p=l.content.firstChild;f<l.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=l.content.lastChild;u<l.openEnd&&!p.type.spec.isolating;u++,p=p.lastChild);l=kt(l,f,u)}return t.someProp("transformPasted",f=>{l=f(l,t)}),l}const po=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function mo(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,r=[];if(t.forEach(l=>{if(!r)return;let a=i.findWrapping(l.type),c;if(!a)return r=null;if(c=r.length&&s.length&&rn(a,s,l,r[r.length-1],0))r[r.length-1]=c;else{r.length&&(r[r.length-1]=ln(r[r.length-1],s.length));let d=sn(l,a);r.push(d),i=i.matchType(d.type),s=a}}),r)return _.from(r)}return t}function sn(t,e,n=0){for(let o=e.length-1;o>=n;o--)t=e[o].create(null,_.from(t));return t}function rn(t,e,n,o,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=rn(t,e,n,o.lastChild,i+1);if(s)return o.copy(o.content.replaceChild(o.childCount-1,s));if(o.contentMatchAt(o.childCount).matchType(i==t.length-1?n.type:t[i+1]))return o.copy(o.content.append(_.from(sn(n,t,i+1))))}}function ln(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,ln(t.lastChild,e-1)),o=t.contentMatchAt(t.childCount).fillBefore(_.empty,!0);return t.copy(n.append(o))}function Je(t,e,n,o,i,s){let r=e<0?t.firstChild:t.lastChild,l=r.content;return t.childCount>1&&(s=0),i<o-1&&(l=Je(l,e,n,o,i+1,s)),i>=n&&(l=e<0?r.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(r.contentMatchAt(r.childCount).fillBefore(_.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,r.copy(l))}function kt(t,e,n){return e<t.openStart&&(t=new J(Je(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new J(Je(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const an={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Tt=null;function cn(){return Tt||(Tt=document.implementation.createHTMLDocument("title"))}let $e=null;function go(t){let e=window.trustedTypes;return e?($e||($e=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),$e.createHTML(t)):t}function yo(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=cn().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t),i;if((i=o&&an[o[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=go(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function bo(t){let e=t.querySelectorAll(M?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let o=e[n];o.childNodes.length==1&&o.textContent==" "&&o.parentNode&&o.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),o)}}function Do(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,o;try{o=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:r}=t;for(let l=o.length-2;l>=0;l-=2){let a=n.nodes[o[l]];if(!a||a.hasRequiredAttrs())break;i=_.from(a.create(o[l+1],i)),s++,r++}return new J(i,s,r)}const T={},A={},No={touchstart:!0,touchmove:!0};class So{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Co(t){for(let e in T){let n=T[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=o=>{Mo(t,o)&&!tt(t,o)&&(t.editable||!(o.type in A))&&n(t,o)},No[e]?{passive:!0}:void 0)}k&&t.dom.addEventListener("input",()=>null),Ze(t)}function X(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Oo(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Ze(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=o=>tt(t,o))})}function tt(t,e){return t.someProp("handleDOMEvents",n=>{let o=n[e.type];return o?o(t,e)||e.defaultPrevented:!1})}function Mo(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function xo(t,e){!tt(t,e)&&T[e.type]&&(t.editable||!(e.type in A))&&T[e.type](t,e)}A.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!fn(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(H&&M&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),pe&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let o=Date.now();t.input.lastIOSEnter=o,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==o&&(t.someProp("handleKeyDown",i=>i(t,te(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",o=>o(t,n))||uo(t,n)?n.preventDefault():X(t,"key")};A.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};A.keypress=(t,e)=>{let n=e;if(fn(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||R&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let o=t.state.selection;if(!(o instanceof x)||!o.$from.sameParent(o.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",r=>r(t,o.$from.pos,o.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function Fe(t){return{left:t.clientX,top:t.clientY}}function ko(t,e){let n=e.x-t.clientX,o=e.y-t.clientY;return n*n+o*o<100}function nt(t,e,n,o,i){if(o==-1)return!1;let s=t.state.doc.resolve(o);for(let r=s.depth+1;r>0;r--)if(t.someProp(e,l=>r>s.depth?l(t,n,s.nodeAfter,s.before(r),i,!0):l(t,n,s.node(r),s.before(r),i,!1)))return!0;return!1}function fe(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let o=t.state.tr.setSelection(e);o.setMeta("pointer",!0),t.dispatch(o)}function To(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),o=n.nodeAfter;return o&&o.isAtom&&D.isSelectable(o)?(fe(t,new D(n)),!0):!1}function Ao(t,e){if(e==-1)return!1;let n=t.state.selection,o,i;n instanceof D&&(o=n.node);let s=t.state.doc.resolve(e);for(let r=s.depth+1;r>0;r--){let l=r>s.depth?s.nodeAfter:s.node(r);if(D.isSelectable(l)){o&&n.$from.depth>0&&r>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(r);break}}return i!=null?(fe(t,D.create(t.state.doc,i)),!0):!1}function Eo(t,e,n,o,i){return nt(t,"handleClickOn",e,n,o)||t.someProp("handleClick",s=>s(t,e,o))||(i?Ao(t,n):To(t,n))}function Po(t,e,n,o){return nt(t,"handleDoubleClickOn",e,n,o)||t.someProp("handleDoubleClick",i=>i(t,e,o))}function Vo(t,e,n,o){return nt(t,"handleTripleClickOn",e,n,o)||t.someProp("handleTripleClick",i=>i(t,e,o))||Ro(t,n,o)}function Ro(t,e,n){if(n.button!=0)return!1;let o=t.state.doc;if(e==-1)return o.inlineContent?(fe(t,x.create(o,0,o.content.size)),!0):!1;let i=o.resolve(e);for(let s=i.depth+1;s>0;s--){let r=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(r.inlineContent)fe(t,x.create(o,l+1,l+1+r.content.size));else if(D.isSelectable(r))fe(t,D.create(o,l));else continue;return!0}}function ot(t){return Ee(t)}const dn=R?"metaKey":"ctrlKey";T.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let o=ot(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&ko(n,t.input.lastClick)&&!n[dn]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let r=t.posAtCoords(Fe(n));r&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Bo(t,r,n,!!o)):(s=="doubleClick"?Po:Vo)(t,r.pos,r.inside,n)?n.preventDefault():X(t,"pointer"))};class Bo{constructor(e,n,o,i){this.view=e,this.pos=n,this.event=o,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!o[dn],this.allowDefault=o.shiftKey;let s,r;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),r=n.inside;else{let d=e.state.doc.resolve(n.pos);s=d.parent,r=d.depth?d.before():0}const l=i?null:o.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.dom.nodeType==1?a.dom:null;let{selection:c}=e.state;(o.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof D&&c.from<=r&&c.to>r)&&(this.mightDrag={node:s,pos:r,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&z&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),X(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>W(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Fe(e))),this.updateAllowDefault(e),this.allowDefault||!n?X(this.view,"pointer"):Eo(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||k&&this.mightDrag&&!this.mightDrag.node.isAtom||M&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(fe(this.view,he.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):X(this.view,"pointer")}move(e){this.updateAllowDefault(e),X(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}T.touchstart=t=>{t.input.lastTouch=Date.now(),ot(t),X(t,"pointer")};T.touchmove=t=>{t.input.lastTouch=Date.now(),X(t,"pointer")};T.contextmenu=t=>ot(t);function fn(t,e){return t.composing?!0:k&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Io=H?5e3:-1;A.compositionstart=A.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof x&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),Ee(t,!0),t.markCursor=null;else if(Ee(t,!e.selection.empty),z&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let o=t.domSelectionRange();for(let i=o.focusNode,s=o.focusOffset;i&&i.nodeType==1&&s!=0;){let r=s<0?i.lastChild:i.childNodes[s-1];if(!r)break;if(r.nodeType==3){let l=t.domSelection();l&&l.collapse(r,r.nodeValue.length);break}else i=r,s=-1}}t.input.composing=!0}hn(t,Io)};A.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,hn(t,20))};function hn(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Ee(t),e))}function un(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=zo());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Fo(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=kn(e.focusNode,e.focusOffset),o=Tn(e.focusNode,e.focusOffset);if(n&&o&&n!=o){let i=o.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||o==s)return s;if(!i||!i.isText(o.nodeValue))return o;if(t.input.compositionNode==o){let r=n.pmViewDesc;if(!(!r||!r.isText(n.nodeValue)))return o}}return n||o}function zo(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Ee(t,e=!1){if(!(H&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),un(t),e||t.docView&&t.docView.dirty){let n=we(t),o=t.state.selection;return n&&!n.eq(o)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!o.$from.node(o.$from.sharedDepth(o.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function Lo(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let o=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),o.removeAllRanges(),o.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const De=P&&Z<15||pe&&Rn<604;T.copy=A.cut=(t,e)=>{let n=e,o=t.state.selection,i=n.type=="cut";if(o.empty)return;let s=De?null:n.clipboardData,r=o.content(),{dom:l,text:a}=et(t,r);s?(n.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):Lo(t,l),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function $o(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function qo(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,o=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),o.parentNode&&o.parentNode.removeChild(o),n?Ne(t,o.value,null,i,e):Ne(t,o.textContent,o.innerHTML,i,e)},50)}function Ne(t,e,n,o,i){let s=on(t,e,n,o,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,i,s||J.empty)))return!0;if(!s)return!1;let r=$o(s),l=r?t.state.tr.replaceSelectionWith(r,o):t.state.tr.replaceSelection(s);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function pn(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}A.paste=(t,e)=>{let n=e;if(t.composing&&!H)return;let o=De?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;o&&Ne(t,pn(o),o.getData("text/html"),i,n)?n.preventDefault():qo(t,n)};class mn{constructor(e,n,o){this.slice=e,this.move=n,this.node=o}}const Ko=R?"altKey":"ctrlKey";function gn(t,e){let n=t.someProp("dragCopies",o=>!o(e));return n??!e[Ko]}T.dragstart=(t,e)=>{let n=e,o=t.input.mouseDown;if(o&&o.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(Fe(n)),r;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof D?i.to-1:i.to))){if(o&&o.mightDrag)r=D.create(t.state.doc,o.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(r=D.create(t.state.doc,f.posBefore))}}let l=(r||t.state.selection).content(),{dom:a,text:c,slice:d}=et(t,l);(!n.dataTransfer.files.length||!M||Ht>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(De?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",De||n.dataTransfer.setData("text/plain",c),t.dragging=new mn(d,gn(t,n),r)};T.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};A.dragover=A.dragenter=(t,e)=>e.preventDefault();A.drop=(t,e)=>{let n=e,o=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let i=t.posAtCoords(Fe(n));if(!i)return;let s=t.state.doc.resolve(i.pos),r=o&&o.slice;r?t.someProp("transformPasted",h=>{r=h(r,t)}):r=on(t,pn(n.dataTransfer),De?null:n.dataTransfer.getData("text/html"),!1,s);let l=!!(o&&gn(t,n));if(t.someProp("handleDrop",h=>h(t,n,r||J.empty,l))){n.preventDefault();return}if(!r)return;n.preventDefault();let a=r?On(t.state.doc,s.pos,r):s.pos;a==null&&(a=s.pos);let c=t.state.tr;if(l){let{node:h}=o;h?h.replace(c):c.deleteSelection()}let d=c.mapping.map(a),f=r.openStart==0&&r.openEnd==0&&r.content.childCount==1,u=c.doc;if(f?c.replaceRangeWith(d,d,r.content.firstChild):c.replaceRange(d,d,r),c.doc.eq(u))return;let p=c.doc.resolve(d);if(f&&D.isSelectable(r.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(r.content.firstChild))c.setSelection(new D(p));else{let h=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((g,m,y,V)=>h=V),c.setSelection(ve(t,p,c.doc.resolve(h)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))};T.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&W(t)},20))};T.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};T.beforeinput=(t,e)=>{if(M&&H&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:o}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=o||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,te(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in A)T[t]=A[t];function Se(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Pe{constructor(e,n){this.toDOM=e,this.spec=n||ie,this.side=this.spec.side||0}map(e,n,o,i){let{pos:s,deleted:r}=e.mapResult(n.from+i,this.side<0?-1:1);return r?null:new F(s-o,s-o,this)}valid(){return!0}eq(e){return this==e||e instanceof Pe&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Se(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class w{constructor(e,n){this.attrs=e,this.spec=n||ie}map(e,n,o,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-o,r=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-o;return s>=r?null:new F(s,r,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof w&&Se(this.attrs,e.attrs)&&Se(this.spec,e.spec)}static is(e){return e.type instanceof w}destroy(){}}class it{constructor(e,n){this.attrs=e,this.spec=n||ie}map(e,n,o,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let r=e.mapResult(n.to+i,-1);return r.deleted||r.pos<=s.pos?null:new F(s.pos-o,r.pos-o,this)}valid(e,n){let{index:o,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(o)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof it&&Se(this.attrs,e.attrs)&&Se(this.spec,e.spec)}destroy(){}}class F{constructor(e,n,o){this.from=e,this.to=n,this.type=o}copy(e,n){return new F(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,o){return this.type.map(e,this,n,o)}static widget(e,n,o){return new F(e,e,new Pe(n,o))}static inline(e,n,o,i){return new F(e,n,new w(o,i))}static node(e,n,o,i){return new F(e,n,new it(o,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof w}get widget(){return this.type instanceof Pe}}const de=[],ie={};class S{constructor(e,n){this.local=e.length?e:de,this.children=n.length?n:de}static create(e,n){return n.length?Ve(n,e,0,ie):O}find(e,n,o){let i=[];return this.findInner(e??0,n??1e9,i,0,o),i}findInner(e,n,o,i,s){for(let r=0;r<this.local.length;r++){let l=this.local[r];l.from<=n&&l.to>=e&&(!s||s(l.spec))&&o.push(l.copy(l.from+i,l.to+i))}for(let r=0;r<this.children.length;r+=3)if(this.children[r]<n&&this.children[r+1]>e){let l=this.children[r]+1;this.children[r+2].findInner(e-l,n-l,o,i+l,s)}}map(e,n,o){return this==O||e.maps.length==0?this:this.mapInner(e,n,0,0,o||ie)}mapInner(e,n,o,i,s){let r;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,o,i);a&&a.type.valid(n,a)?(r||(r=[])).push(a):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?Ho(this.children,r||[],e,n,o,i,s):r?new S(r.sort(se),de):O}add(e,n){return n.length?this==O?S.create(e,n):this.addInner(e,n,0):this}addInner(e,n,o){let i,s=0;e.forEach((l,a)=>{let c=a+o,d;if(d=bn(n,l,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<a;)s+=3;i[s]==a?i[s+2]=i[s+2].addInner(l,d,c+1):i.splice(s,0,a,a+l.nodeSize,Ve(d,l,c+1,ie)),s+=3}});let r=yn(s?Dn(n):n,-o);for(let l=0;l<r.length;l++)r[l].type.valid(e,r[l])||r.splice(l--,1);return new S(r.length?this.local.concat(r).sort(se):this.local,i||this.children)}remove(e){return e.length==0||this==O?this:this.removeInner(e,0)}removeInner(e,n){let o=this.children,i=this.local;for(let s=0;s<o.length;s+=3){let r,l=o[s]+n,a=o[s+1]+n;for(let d=0,f;d<e.length;d++)(f=e[d])&&f.from>l&&f.to<a&&(e[d]=null,(r||(r=[])).push(f));if(!r)continue;o==this.children&&(o=this.children.slice());let c=o[s+2].removeInner(r,l+1);c!=O?o[s+2]=c:(o.splice(s,3),s-=3)}if(i.length){for(let s=0,r;s<e.length;s++)if(r=e[s])for(let l=0;l<i.length;l++)i[l].eq(r,n)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return o==this.children&&i==this.local?this:i.length||o.length?new S(i,o):O}forChild(e,n){if(this==O)return this;if(n.isLeaf)return S.empty;let o,i;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(o=this.children[l+2]);break}let s=e+1,r=s+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<r&&a.to>s&&a.type instanceof w){let c=Math.max(s,a.from)-s,d=Math.min(r,a.to)-s;c<d&&(i||(i=[])).push(a.copy(c,d))}}if(i){let l=new S(i.sort(se),de);return o?new G([l,o]):l}return o||O}eq(e){if(this==e)return!0;if(!(e instanceof S)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return st(this.localsInner(e))}localsInner(e){if(this==O)return de;if(e.inlineContent||!this.local.some(w.is))return this.local;let n=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof w||n.push(this.local[o]);return n}forEachSet(e){e(this)}}S.empty=new S([],[]);S.removeOverlap=st;const O=S.empty;class G{constructor(e){this.members=e}map(e,n){const o=this.members.map(i=>i.map(e,n,ie));return G.from(o)}forChild(e,n){if(n.isLeaf)return S.empty;let o=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=O&&(s instanceof G?o=o.concat(s.members):o.push(s))}return G.from(o)}eq(e){if(!(e instanceof G)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,o=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{o&&(n=n.slice(),o=!1);for(let r=0;r<s.length;r++)n.push(s[r])}}return n?st(o?n:n.sort(se)):de}static from(e){switch(e.length){case 0:return O;case 1:return e[0];default:return new G(e.every(n=>n instanceof S)?e:e.reduce((n,o)=>n.concat(o instanceof S?o:o.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function Ho(t,e,n,o,i,s,r){let l=t.slice();for(let c=0,d=s;c<n.maps.length;c++){let f=0;n.maps[c].forEach((u,p,h,g)=>{let m=g-h-(p-u);for(let y=0;y<l.length;y+=3){let V=l[y+1];if(V<0||u>V+d-f)continue;let me=l[y]+d-f;p>=me?l[y+1]=u<=me?-2:-1:u>=d&&m&&(l[y]+=m,l[y+1]+=m)}f+=m}),d=n.maps[c].map(d,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let d=n.map(t[c]+s),f=d-i;if(f<0||f>=o.content.size){a=!0;continue}let u=n.map(t[c+1]+s,-1),p=u-i,{index:h,offset:g}=o.content.findIndex(f),m=o.maybeChild(h);if(m&&g==f&&g+m.nodeSize==p){let y=l[c+2].mapInner(n,m,d+1,t[c]+s+1,r);y!=O?(l[c]=f,l[c+1]=p,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=Wo(l,t,e,n,i,s,r),d=Ve(c,o,0,r);e=d.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,u=0;f<d.children.length;f+=3){let p=d.children[f];for(;u<l.length&&l[u]<p;)u+=3;l.splice(u,0,d.children[f],d.children[f+1],d.children[f+2])}}return new S(e.sort(se),l)}function yn(t,e){if(!e||!t.length)return t;let n=[];for(let o=0;o<t.length;o++){let i=t[o];n.push(new F(i.from+e,i.to+e,i.type))}return n}function Wo(t,e,n,o,i,s,r){function l(a,c){for(let d=0;d<a.local.length;d++){let f=a.local[d].map(o,i,c);f?n.push(f):r.onRemove&&r.onRemove(a.local[d].spec)}for(let d=0;d<a.children.length;d+=3)l(a.children[d+2],a.children[d]+c+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+s+1);return n}function bn(t,e,n){if(e.isLeaf)return null;let o=n+e.nodeSize,i=null;for(let s=0,r;s<t.length;s++)(r=t[s])&&r.from>n&&r.to<o&&((i||(i=[])).push(r),t[s]=null);return i}function Dn(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Ve(t,e,n,o){let i=[],s=!1;e.forEach((l,a)=>{let c=bn(t,l,a+n);if(c){s=!0;let d=Ve(c,l,n+a+1,o);d!=O&&i.push(a,a+l.nodeSize,d)}});let r=yn(s?Dn(t):t,-n).sort(se);for(let l=0;l<r.length;l++)r[l].type.valid(e,r[l])||(o.onRemove&&o.onRemove(r[l].spec),r.splice(l--,1));return r.length||i.length?new S(r,i):O}function se(t,e){return t.from-e.from||t.to-e.to}function st(t){let e=t;for(let n=0;n<e.length-1;n++){let o=e[n];if(o.from!=o.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==o.from){s.to!=o.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,o.to),At(e,i+1,s.copy(o.to,s.to)));continue}else{s.from<o.to&&(e==t&&(e=t.slice()),e[n]=o.copy(o.from,s.from),At(e,i,o.copy(s.from,o.to)));break}}}return e}function At(t,e,n){for(;e<t.length&&se(n,t[e])>0;)e++;t.splice(e,0,n)}function qe(t){let e=[];return t.someProp("decorations",n=>{let o=n(t.state);o&&o!=O&&e.push(o)}),t.cursorWrapper&&e.push(S.create(t.state.doc,[t.cursorWrapper.deco])),G.from(e)}const _o={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},jo=P&&Z<=11;class Uo{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Yo{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Uo,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(o=>{for(let i=0;i<o.length;i++)this.queue.push(o[i]);P&&Z<=11&&o.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),jo&&(this.onCharData=o=>{this.queue.push({target:o.target,type:"characterData",oldValue:o.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,_o)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Nt(this.view)){if(this.suppressingSelectionUpdates)return W(this.view);if(P&&Z<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&re(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,o;for(let s=e.focusNode;s;s=ue(s))n.add(s);for(let s=e.anchorNode;s;s=ue(s))if(n.has(s)){o=s;break}let i=o&&this.view.docView.nearestDesc(o);if(i&&i.ignoreMutation({type:"selection",target:o.nodeType==3?o.parentNode:o}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let o=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(o)&&Nt(e)&&!this.ignoreSelectionChange(o),s=-1,r=-1,l=!1,a=[];if(e.editable)for(let d=0;d<n.length;d++){let f=this.registerMutation(n[d],a);f&&(s=s<0?f.from:Math.min(f.from,s),r=r<0?f.to:Math.max(f.to,r),f.typeOver&&(l=!0))}if(z&&a.length){let d=a.filter(f=>f.nodeName=="BR");if(d.length==2){let[f,u]=d;f.parentNode&&f.parentNode.parentNode==u.parentNode?u.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let u of d){let p=u.parentNode;p&&p.nodeName=="LI"&&(!f||Jo(e,f)!=p)&&u.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Be(o)&&(c=we(e))&&c.eq(he.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,W(e),this.currentSelection.set(o),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,r),Go(e)),this.handleDOMChange(s,r,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||W(e),this.currentSelection.set(o))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let o=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(o==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!o||o.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let f=e.addedNodes[d];n.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(o.contentDOM&&o.contentDOM!=o.dom&&!o.contentDOM.contains(e.target))return{from:o.posBefore,to:o.posAfter};let i=e.previousSibling,s=e.nextSibling;if(P&&Z<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:f,nextSibling:u}=e.addedNodes[d];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f),(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(s=u)}let r=i&&i.parentNode==e.target?C(i)+1:0,l=o.localPosFromDOM(e.target,r,-1),a=s&&s.parentNode==e.target?C(s):e.target.childNodes.length,c=o.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:o.posAtStart-o.border,to:o.posAtEnd+o.border}:(this.lastChangedTextNode=e.target,{from:o.posAtStart,to:o.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Et=new WeakMap,Pt=!1;function Go(t){if(!Et.has(t)&&(Et.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=z,Pt)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Pt=!0}}function Vt(t,e){let n=e.startContainer,o=e.startOffset,i=e.endContainer,s=e.endOffset,r=t.domAtPos(t.state.selection.anchor);return re(r.node,r.offset,i,s)&&([n,o,i,s]=[i,s,n,o]),{anchorNode:n,anchorOffset:o,focusNode:i,focusOffset:s}}function Xo(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Vt(t,i)}let n;function o(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",o,!0),n?Vt(t,n):null}function Jo(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let o=t.docView.nearestDesc(n,!0);if(o&&o.node.isBlock)return n}return null}function Zo(t,e,n){let{node:o,fromOffset:i,toOffset:s,from:r,to:l}=t.docView.parseRange(e,n),a=t.domSelectionRange(),c,d=a.anchorNode;if(d&&t.dom.contains(d.nodeType==1?d:d.parentNode)&&(c=[{node:d,offset:a.anchorOffset}],Be(a)||c.push({node:a.focusNode,offset:a.focusOffset})),M&&t.input.lastKeyCode===8)for(let m=s;m>i;m--){let y=o.childNodes[m-1],V=y.pmViewDesc;if(y.nodeName=="BR"&&!V){s=m;break}if(!V||V.size)break}let f=t.state.doc,u=t.someProp("domParser")||qt.fromSchema(t.state.schema),p=f.resolve(r),h=null,g=u.parse(o,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:s,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Qo,context:p});if(c&&c[0].pos!=null){let m=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=m),h={anchor:m+r,head:y+r}}return{doc:g,sel:h,from:r,to:l}}function Qo(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(k&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||k&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const wo=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function vo(t,e,n,o,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let b=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,N=we(t,b);if(N&&!t.state.selection.eq(N)){if(M&&H&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",Nn=>Nn(t,te(13,"Enter"))))return;let E=t.state.tr.setSelection(N);b=="pointer"?E.setMeta("pointer",!0):b=="key"&&E.scrollIntoView(),s&&E.setMeta("composition",s),t.dispatch(E)}return}let r=t.state.doc.resolve(e),l=r.sharedDepth(n);e=r.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,c=Zo(t,e,n),d=t.state.doc,f=d.slice(c.from,c.to),u,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(u=t.state.selection.to,p="end"):(u=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let h=ni(f.content,c.doc.content,c.from,u,p);if(h&&t.input.domChangeCount++,(pe&&t.input.lastIOSEnter>Date.now()-225||H)&&i.some(b=>b.nodeType==1&&!wo.test(b.nodeName))&&(!h||h.endA>=h.endB)&&t.someProp("handleKeyDown",b=>b(t,te(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!h)if(o&&a instanceof x&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))h={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let b=Rt(t,t.state.doc,c.sel);if(b&&!b.eq(t.state.selection)){let N=t.state.tr.setSelection(b);s&&N.setMeta("composition",s),t.dispatch(N)}}return}t.state.selection.from<t.state.selection.to&&h.start==h.endB&&t.state.selection instanceof x&&(h.start>t.state.selection.from&&h.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?h.start=t.state.selection.from:h.endA<t.state.selection.to&&h.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(h.endB+=t.state.selection.to-h.endA,h.endA=t.state.selection.to)),P&&Z<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>c.from&&c.doc.textBetween(h.start-c.from-1,h.start-c.from+1)==" "&&(h.start--,h.endA--,h.endB--);let g=c.doc.resolveNoCache(h.start-c.from),m=c.doc.resolveNoCache(h.endB-c.from),y=d.resolve(h.start),V=g.sameParent(m)&&g.parent.inlineContent&&y.end()>=h.endA,me;if((pe&&t.input.lastIOSEnter>Date.now()-225&&(!V||i.some(b=>b.nodeName=="DIV"||b.nodeName=="P"))||!V&&g.pos<c.doc.content.size&&(!g.sameParent(m)||!g.parent.inlineContent)&&!/\S/.test(c.doc.textBetween(g.pos,m.pos,"",""))&&(me=he.findFrom(c.doc.resolve(g.pos+1),1,!0))&&me.head>g.pos)&&t.someProp("handleKeyDown",b=>b(t,te(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>h.start&&ti(d,h.start,h.endA,g,m)&&t.someProp("handleKeyDown",b=>b(t,te(8,"Backspace")))){H&&M&&t.domObserver.suppressSelectionUpdates();return}M&&h.endB==h.start&&(t.input.lastChromeDelete=Date.now()),H&&!V&&g.start()!=m.start()&&m.parentOffset==0&&g.depth==m.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==h.endA&&(h.endB-=2,m=c.doc.resolveNoCache(h.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(b){return b(t,te(13,"Enter"))})},20));let j=h.start,ee=h.endA,xe=b=>{let N=b||t.state.tr.replace(j,ee,c.doc.slice(h.start-c.from,h.endB-c.from));if(c.sel){let E=Rt(t,N.doc,c.sel);E&&!(M&&t.composing&&E.empty&&(h.start!=h.endB||t.input.lastChromeDelete<Date.now()-100)&&(E.head==j||E.head==N.mapping.map(ee)-1)||P&&E.empty&&E.head==j)&&N.setSelection(E)}return s&&N.setMeta("composition",s),N.scrollIntoView()},ke;if(V){if(g.pos==m.pos){P&&Z<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>W(t),20));let b=xe(t.state.tr.delete(j,ee)),N=d.resolve(h.start).marksAcross(d.resolve(h.endA));N&&b.ensureMarks(N),t.dispatch(b)}else if(h.endA==h.endB&&(ke=ei(g.parent.content.cut(g.parentOffset,m.parentOffset),y.parent.content.cut(y.parentOffset,h.endA-y.start())))){let b=xe(t.state.tr);ke.type=="add"?b.addMark(j,ee,ke.mark):b.removeMark(j,ee,ke.mark),t.dispatch(b)}else if(g.parent.child(g.index()).isText&&g.index()==m.index()-(m.textOffset?0:1)){let b=g.parent.textBetween(g.parentOffset,m.parentOffset),N=()=>xe(t.state.tr.insertText(b,j,ee));t.someProp("handleTextInput",E=>E(t,j,ee,b,N))||t.dispatch(N())}}else t.dispatch(xe())}function Rt(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:ve(t,e.resolve(n.anchor),e.resolve(n.head))}function ei(t,e){let n=t.firstChild.marks,o=e.firstChild.marks,i=n,s=o,r,l,a;for(let d=0;d<o.length;d++)i=o[d].removeFromSet(i);for(let d=0;d<n.length;d++)s=n[d].removeFromSet(s);if(i.length==1&&s.length==0)l=i[0],r="add",a=d=>d.mark(l.addToSet(d.marks));else if(i.length==0&&s.length==1)l=s[0],r="remove",a=d=>d.mark(l.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<e.childCount;d++)c.push(a(e.child(d)));if(_.from(c).eq(t))return{mark:l,type:r}}function ti(t,e,n,o,i){if(n-e<=i.pos-o.pos||Ke(o,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!o.parent.isTextblock){let l=s.nodeAfter;return l!=null&&n==e+l.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let r=t.resolve(Ke(s,!0,!0));return!r.parent.isTextblock||r.pos>n||Ke(r,!0,!1)<n?!1:o.parent.content.cut(o.parentOffset).eq(r.parent.content)}function Ke(t,e,n){let o=t.depth,i=e?t.end():t.pos;for(;o>0&&(e||t.indexAfter(o)==t.node(o).childCount);)o--,i++,e=!1;if(n){let s=t.node(o).maybeChild(t.indexAfter(o));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function ni(t,e,n,o,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:r,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let a=Math.max(0,s-Math.min(r,l));o-=r+a-s}if(r<s&&t.size<e.size){let a=o<=s&&o>=r?s-o:0;s-=a,s&&s<e.size&&Bt(e.textBetween(s-1,s+1))&&(s+=a?1:-1),l=s+(l-r),r=s}else if(l<s){let a=o<=s&&o>=l?s-o:0;s-=a,s&&s<t.size&&Bt(t.textBetween(s-1,s+1))&&(s+=a?1:-1),r=s+(r-l),l=s}return{start:s,endA:r,endB:l}}function Bt(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class oi{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new So,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach($t),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=zt(this),Ft(this),this.nodeViews=Lt(this),this.docView=pt(this.state.doc,It(this),qe(this),this.dom,this),this.domObserver=new Yo(this,(o,i,s,r)=>vo(this,o,i,s,r)),this.domObserver.start(),Co(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ze(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach($t),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let o in this._props)n[o]=this._props[o];n.state=this.state;for(let o in e)n[o]=e[o];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var o;let i=this.state,s=!1,r=!1;e.storedMarks&&this.composing&&(un(this),r=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=Lt(this);si(p,this.nodeViews)&&(this.nodeViews=p,s=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Ze(this),this.editable=zt(this),Ft(this);let a=qe(this),c=It(this),d=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=s||!this.docView.matchesNode(e.doc,c,a);(f||!e.selection.eq(i.selection))&&(r=!0);let u=d=="preserve"&&r&&this.dom.style.overflowAnchor==null&&Fn(this);if(r){this.domObserver.stop();let p=f&&(P||M)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&ii(i.selection,e.selection);if(f){let h=M?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Fo(this)),(s||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=pt(e.doc,c,a,this.dom,this)),h&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&so(this))?W(this,p):(en(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((o=this.dragging)===null||o===void 0)&&o.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():u&&zn(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof D){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&at(this,n.getBoundingClientRect(),e)}else at(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let o=this.directPlugins[n];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let o=this.state.plugins[n];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let o=this.pluginViews[n];o.update&&o.update(this,e)}}updateDraggedNode(e,n){let o=e.node,i=-1;if(this.state.doc.nodeAt(o.from)==o.node)i=o.from;else{let s=o.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==o.node&&(i=s)}this.dragging=new mn(e.slice,e.move,i<0?void 0:D.create(this.state.doc,i))}someProp(e,n){let o=this._props&&this._props[e],i;if(o!=null&&(i=n?n(o):o))return i;for(let r=0;r<this.directPlugins.length;r++){let l=this.directPlugins[r].props[e];if(l!=null&&(i=n?n(l):l))return i}let s=this.state.plugins;if(s)for(let r=0;r<s.length;r++){let l=s[r].props[e];if(l!=null&&(i=n?n(l):l))return i}}hasFocus(){if(P){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Ln(this.dom),W(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Wn(this,e)}coordsAtPos(e,n=1){return Yt(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,o=-1){let i=this.docView.posFromDOM(e,n,o);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return Gn(this,n||this.state,e)}pasteHTML(e,n){return Ne(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Ne(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return et(this,e)}destroy(){this.docView&&(Oo(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],qe(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Mn())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return xo(this,e)}domSelectionRange(){let e=this.domSelection();return e?k&&this.root.nodeType===11&&En(this.dom.ownerDocument)==this.dom&&Xo(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}oi.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function It(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let o in n)o=="class"?e.class+=" "+n[o]:o=="style"?e.style=(e.style?e.style+";":"")+n[o]:!e[o]&&o!="contenteditable"&&o!="nodeName"&&(e[o]=String(n[o]))}),e.translate||(e.translate="no"),[F.node(0,t.state.doc.content.size,e)]}function Ft(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:F.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function zt(t){return!t.someProp("editable",e=>e(t.state)===!1)}function ii(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Lt(t){let e=Object.create(null);function n(o){for(let i in o)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=o[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function si(t,e){let n=0,o=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)o++;return n!=o}function $t(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}export{F as Decoration,S as DecorationSet,oi as EditorView};
|
|
4
|
+
`);return{dom:a,text:u,slice:e}}function on(t,e,n,o,i){let s=i.parent.type.spec.code,r,l;if(!n&&!e)return null;let a=!!e&&(o||s||!n);if(a){if(t.someProp("transformPastedText",u=>{e=u(e,s||o,t)}),s)return l=new se(_.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
5
|
+
`))),0,0),t.someProp("transformPasted",u=>{l=u(l,t,!0)}),l;let f=t.someProp("clipboardTextParser",u=>u(e,i,o,t));if(f)l=f;else{let u=i.marks(),{schema:p}=t.state,h=Re.fromSchema(p);r=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let m=r.appendChild(document.createElement("p"));g&&m.appendChild(h.serializeNode(p.text(g,u)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),r=yo(n),Oe&&bo(r);let c=r&&r.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let f=+d[3];f>0;f--){let u=r.firstChild;for(;u&&u.nodeType!=1;)u=u.nextSibling;if(!u)break;r=u}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||qt.fromSchema(t.state.schema)).parseSlice(r,{preserveWhitespace:!!(a||d),context:i,ruleFromNode(u){return u.nodeName=="BR"&&!u.nextSibling&&u.parentNode&&!po.test(u.parentNode.nodeName)?{ignore:!0}:null}})),d)l=Do(kt(l,+d[1],+d[2]),d[4]);else if(l=se.maxOpen(mo(l.content,i),!0),l.openStart||l.openEnd){let f=0,u=0;for(let p=l.content.firstChild;f<l.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=l.content.lastChild;u<l.openEnd&&!p.type.spec.isolating;u++,p=p.lastChild);l=kt(l,f,u)}return t.someProp("transformPasted",f=>{l=f(l,t,a)}),l}const po=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function mo(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,r=[];if(t.forEach(l=>{if(!r)return;let a=i.findWrapping(l.type),c;if(!a)return r=null;if(c=r.length&&s.length&&rn(a,s,l,r[r.length-1],0))r[r.length-1]=c;else{r.length&&(r[r.length-1]=ln(r[r.length-1],s.length));let d=sn(l,a);r.push(d),i=i.matchType(d.type),s=a}}),r)return _.from(r)}return t}function sn(t,e,n=0){for(let o=e.length-1;o>=n;o--)t=e[o].create(null,_.from(t));return t}function rn(t,e,n,o,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=rn(t,e,n,o.lastChild,i+1);if(s)return o.copy(o.content.replaceChild(o.childCount-1,s));if(o.contentMatchAt(o.childCount).matchType(i==t.length-1?n.type:t[i+1]))return o.copy(o.content.append(_.from(sn(n,t,i+1))))}}function ln(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,ln(t.lastChild,e-1)),o=t.contentMatchAt(t.childCount).fillBefore(_.empty,!0);return t.copy(n.append(o))}function Je(t,e,n,o,i,s){let r=e<0?t.firstChild:t.lastChild,l=r.content;return t.childCount>1&&(s=0),i<o-1&&(l=Je(l,e,n,o,i+1,s)),i>=n&&(l=e<0?r.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(r.contentMatchAt(r.childCount).fillBefore(_.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,r.copy(l))}function kt(t,e,n){return e<t.openStart&&(t=new se(Je(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new se(Je(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const an={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Tt=null;function cn(){return Tt||(Tt=document.implementation.createHTMLDocument("title"))}let $e=null;function go(t){let e=window.trustedTypes;return e?($e||($e=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),$e.createHTML(t)):t}function yo(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=cn().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t),i;if((i=o&&an[o[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=go(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function bo(t){let e=t.querySelectorAll(x?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let o=e[n];o.childNodes.length==1&&o.textContent==" "&&o.parentNode&&o.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),o)}}function Do(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,o;try{o=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:r}=t;for(let l=o.length-2;l>=0;l-=2){let a=n.nodes[o[l]];if(!a||a.hasRequiredAttrs())break;i=_.from(a.create(o[l+1],i)),s++,r++}return new se(i,s,r)}const T={},P={},No={touchstart:!0,touchmove:!0};class So{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Co(t){for(let e in T){let n=T[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=o=>{xo(t,o)&&!tt(t,o)&&(t.editable||!(o.type in P))&&n(t,o)},No[e]?{passive:!0}:void 0)}k&&t.dom.addEventListener("input",()=>null),Ze(t)}function X(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Oo(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Ze(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=o=>tt(t,o))})}function tt(t,e){return t.someProp("handleDOMEvents",n=>{let o=n[e.type];return o?o(t,e)||e.defaultPrevented:!1})}function xo(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function Mo(t,e){!tt(t,e)&&T[e.type]&&(t.editable||!(e.type in P))&&T[e.type](t,e)}P.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!fn(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(H&&x&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),pe&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let o=Date.now();t.input.lastIOSEnter=o,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==o&&(t.someProp("handleKeyDown",i=>i(t,ee(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",o=>o(t,n))||uo(t,n)?n.preventDefault():X(t,"key")};P.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};P.keypress=(t,e)=>{let n=e;if(fn(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||R&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let o=t.state.selection;if(!(o instanceof M)||!o.$from.sameParent(o.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",r=>r(t,o.$from.pos,o.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function Fe(t){return{left:t.clientX,top:t.clientY}}function ko(t,e){let n=e.x-t.clientX,o=e.y-t.clientY;return n*n+o*o<100}function nt(t,e,n,o,i){if(o==-1)return!1;let s=t.state.doc.resolve(o);for(let r=s.depth+1;r>0;r--)if(t.someProp(e,l=>r>s.depth?l(t,n,s.nodeAfter,s.before(r),i,!0):l(t,n,s.node(r),s.before(r),i,!1)))return!0;return!1}function fe(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let o=t.state.tr.setSelection(e);o.setMeta("pointer",!0),t.dispatch(o)}function To(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),o=n.nodeAfter;return o&&o.isAtom&&D.isSelectable(o)?(fe(t,new D(n)),!0):!1}function Po(t,e){if(e==-1)return!1;let n=t.state.selection,o,i;n instanceof D&&(o=n.node);let s=t.state.doc.resolve(e);for(let r=s.depth+1;r>0;r--){let l=r>s.depth?s.nodeAfter:s.node(r);if(D.isSelectable(l)){o&&n.$from.depth>0&&r>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(r);break}}return i!=null?(fe(t,D.create(t.state.doc,i)),!0):!1}function Ao(t,e,n,o,i){return nt(t,"handleClickOn",e,n,o)||t.someProp("handleClick",s=>s(t,e,o))||(i?Po(t,n):To(t,n))}function Eo(t,e,n,o){return nt(t,"handleDoubleClickOn",e,n,o)||t.someProp("handleDoubleClick",i=>i(t,e,o))}function Vo(t,e,n,o){return nt(t,"handleTripleClickOn",e,n,o)||t.someProp("handleTripleClick",i=>i(t,e,o))||Ro(t,n,o)}function Ro(t,e,n){if(n.button!=0)return!1;let o=t.state.doc;if(e==-1)return o.inlineContent?(fe(t,M.create(o,0,o.content.size)),!0):!1;let i=o.resolve(e);for(let s=i.depth+1;s>0;s--){let r=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(r.inlineContent)fe(t,M.create(o,l+1,l+1+r.content.size));else if(D.isSelectable(r))fe(t,D.create(o,l));else continue;return!0}}function ot(t){return Ae(t)}const dn=R?"metaKey":"ctrlKey";T.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let o=ot(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&ko(n,t.input.lastClick)&&!n[dn]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let r=t.posAtCoords(Fe(n));r&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Bo(t,r,n,!!o)):(s=="doubleClick"?Eo:Vo)(t,r.pos,r.inside,n)?n.preventDefault():X(t,"pointer"))};class Bo{constructor(e,n,o,i){this.view=e,this.pos=n,this.event=o,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!o[dn],this.allowDefault=o.shiftKey;let s,r;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),r=n.inside;else{let d=e.state.doc.resolve(n.pos);s=d.parent,r=d.depth?d.before():0}const l=i?null:o.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.dom.nodeType==1?a.dom:null;let{selection:c}=e.state;(o.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof D&&c.from<=r&&c.to>r)&&(this.mightDrag={node:s,pos:r,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&I&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),X(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>W(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Fe(e))),this.updateAllowDefault(e),this.allowDefault||!n?X(this.view,"pointer"):Ao(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||k&&this.mightDrag&&!this.mightDrag.node.isAtom||x&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(fe(this.view,he.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):X(this.view,"pointer")}move(e){this.updateAllowDefault(e),X(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}T.touchstart=t=>{t.input.lastTouch=Date.now(),ot(t),X(t,"pointer")};T.touchmove=t=>{t.input.lastTouch=Date.now(),X(t,"pointer")};T.contextmenu=t=>ot(t);function fn(t,e){return t.composing?!0:k&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Io=H?5e3:-1;P.compositionstart=P.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof M&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),Ae(t,!0),t.markCursor=null;else if(Ae(t,!e.selection.empty),I&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let o=t.domSelectionRange();for(let i=o.focusNode,s=o.focusOffset;i&&i.nodeType==1&&s!=0;){let r=s<0?i.lastChild:i.childNodes[s-1];if(!r)break;if(r.nodeType==3){let l=t.domSelection();l&&l.collapse(r,r.nodeValue.length);break}else i=r,s=-1}}t.input.composing=!0}hn(t,Io)};P.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,hn(t,20))};function hn(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Ae(t),e))}function un(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=zo());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Fo(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=kn(e.focusNode,e.focusOffset),o=Tn(e.focusNode,e.focusOffset);if(n&&o&&n!=o){let i=o.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||o==s)return s;if(!i||!i.isText(o.nodeValue))return o;if(t.input.compositionNode==o){let r=n.pmViewDesc;if(!(!r||!r.isText(n.nodeValue)))return o}}return n||o}function zo(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Ae(t,e=!1){if(!(H&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),un(t),e||t.docView&&t.docView.dirty){let n=we(t),o=t.state.selection;return n&&!n.eq(o)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!o.$from.node(o.$from.sharedDepth(o.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function Lo(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let o=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),o.removeAllRanges(),o.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const De=E&&J<15||pe&&Rn<604;T.copy=P.cut=(t,e)=>{let n=e,o=t.state.selection,i=n.type=="cut";if(o.empty)return;let s=De?null:n.clipboardData,r=o.content(),{dom:l,text:a}=et(t,r);s?(n.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):Lo(t,l),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function $o(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function qo(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,o=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),o.parentNode&&o.parentNode.removeChild(o),n?Ne(t,o.value,null,i,e):Ne(t,o.textContent,o.innerHTML,i,e)},50)}function Ne(t,e,n,o,i){let s=on(t,e,n,o,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,i,s||se.empty)))return!0;if(!s)return!1;let r=$o(s),l=r?t.state.tr.replaceSelectionWith(r,o):t.state.tr.replaceSelection(s);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function pn(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}P.paste=(t,e)=>{let n=e;if(t.composing&&!H)return;let o=De?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;o&&Ne(t,pn(o),o.getData("text/html"),i,n)?n.preventDefault():qo(t,n)};class mn{constructor(e,n,o){this.slice=e,this.move=n,this.node=o}}const Ko=R?"altKey":"ctrlKey";function gn(t,e){let n=t.someProp("dragCopies",o=>!o(e));return n??!e[Ko]}T.dragstart=(t,e)=>{let n=e,o=t.input.mouseDown;if(o&&o.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(Fe(n)),r;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof D?i.to-1:i.to))){if(o&&o.mightDrag)r=D.create(t.state.doc,o.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(r=D.create(t.state.doc,f.posBefore))}}let l=(r||t.state.selection).content(),{dom:a,text:c,slice:d}=et(t,l);(!n.dataTransfer.files.length||!x||Ht>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(De?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",De||n.dataTransfer.setData("text/plain",c),t.dragging=new mn(d,gn(t,n),r)};T.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};P.dragover=P.dragenter=(t,e)=>e.preventDefault();P.drop=(t,e)=>{let n=e,o=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let i=t.posAtCoords(Fe(n));if(!i)return;let s=t.state.doc.resolve(i.pos),r=o&&o.slice;r?t.someProp("transformPasted",h=>{r=h(r,t,!1)}):r=on(t,pn(n.dataTransfer),De?null:n.dataTransfer.getData("text/html"),!1,s);let l=!!(o&&gn(t,n));if(t.someProp("handleDrop",h=>h(t,n,r||se.empty,l))){n.preventDefault();return}if(!r)return;n.preventDefault();let a=r?On(t.state.doc,s.pos,r):s.pos;a==null&&(a=s.pos);let c=t.state.tr;if(l){let{node:h}=o;h?h.replace(c):c.deleteSelection()}let d=c.mapping.map(a),f=r.openStart==0&&r.openEnd==0&&r.content.childCount==1,u=c.doc;if(f?c.replaceRangeWith(d,d,r.content.firstChild):c.replaceRange(d,d,r),c.doc.eq(u))return;let p=c.doc.resolve(d);if(f&&D.isSelectable(r.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(r.content.firstChild))c.setSelection(new D(p));else{let h=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((g,m,y,V)=>h=V),c.setSelection(ve(t,p,c.doc.resolve(h)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))};T.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&W(t)},20))};T.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};T.beforeinput=(t,e)=>{if(x&&H&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:o}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=o||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,ee(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in P)T[t]=P[t];function Se(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Ee{constructor(e,n){this.toDOM=e,this.spec=n||oe,this.side=this.spec.side||0}map(e,n,o,i){let{pos:s,deleted:r}=e.mapResult(n.from+i,this.side<0?-1:1);return r?null:new z(s-o,s-o,this)}valid(){return!0}eq(e){return this==e||e instanceof Ee&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Se(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Q{constructor(e,n){this.attrs=e,this.spec=n||oe}map(e,n,o,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-o,r=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-o;return s>=r?null:new z(s,r,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Q&&Se(this.attrs,e.attrs)&&Se(this.spec,e.spec)}static is(e){return e.type instanceof Q}destroy(){}}class it{constructor(e,n){this.attrs=e,this.spec=n||oe}map(e,n,o,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let r=e.mapResult(n.to+i,-1);return r.deleted||r.pos<=s.pos?null:new z(s.pos-o,r.pos-o,this)}valid(e,n){let{index:o,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(o)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof it&&Se(this.attrs,e.attrs)&&Se(this.spec,e.spec)}destroy(){}}class z{constructor(e,n,o){this.from=e,this.to=n,this.type=o}copy(e,n){return new z(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,o){return this.type.map(e,this,n,o)}static widget(e,n,o){return new z(e,e,new Ee(n,o))}static inline(e,n,o,i){return new z(e,n,new Q(o,i))}static node(e,n,o,i){return new z(e,n,new it(o,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Q}get widget(){return this.type instanceof Ee}}const de=[],oe={};class S{constructor(e,n){this.local=e.length?e:de,this.children=n.length?n:de}static create(e,n){return n.length?Ve(n,e,0,oe):O}find(e,n,o){let i=[];return this.findInner(e??0,n??1e9,i,0,o),i}findInner(e,n,o,i,s){for(let r=0;r<this.local.length;r++){let l=this.local[r];l.from<=n&&l.to>=e&&(!s||s(l.spec))&&o.push(l.copy(l.from+i,l.to+i))}for(let r=0;r<this.children.length;r+=3)if(this.children[r]<n&&this.children[r+1]>e){let l=this.children[r]+1;this.children[r+2].findInner(e-l,n-l,o,i+l,s)}}map(e,n,o){return this==O||e.maps.length==0?this:this.mapInner(e,n,0,0,o||oe)}mapInner(e,n,o,i,s){let r;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,o,i);a&&a.type.valid(n,a)?(r||(r=[])).push(a):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?Ho(this.children,r||[],e,n,o,i,s):r?new S(r.sort(ie),de):O}add(e,n){return n.length?this==O?S.create(e,n):this.addInner(e,n,0):this}addInner(e,n,o){let i,s=0;e.forEach((l,a)=>{let c=a+o,d;if(d=bn(n,l,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<a;)s+=3;i[s]==a?i[s+2]=i[s+2].addInner(l,d,c+1):i.splice(s,0,a,a+l.nodeSize,Ve(d,l,c+1,oe)),s+=3}});let r=yn(s?Dn(n):n,-o);for(let l=0;l<r.length;l++)r[l].type.valid(e,r[l])||r.splice(l--,1);return new S(r.length?this.local.concat(r).sort(ie):this.local,i||this.children)}remove(e){return e.length==0||this==O?this:this.removeInner(e,0)}removeInner(e,n){let o=this.children,i=this.local;for(let s=0;s<o.length;s+=3){let r,l=o[s]+n,a=o[s+1]+n;for(let d=0,f;d<e.length;d++)(f=e[d])&&f.from>l&&f.to<a&&(e[d]=null,(r||(r=[])).push(f));if(!r)continue;o==this.children&&(o=this.children.slice());let c=o[s+2].removeInner(r,l+1);c!=O?o[s+2]=c:(o.splice(s,3),s-=3)}if(i.length){for(let s=0,r;s<e.length;s++)if(r=e[s])for(let l=0;l<i.length;l++)i[l].eq(r,n)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return o==this.children&&i==this.local?this:i.length||o.length?new S(i,o):O}forChild(e,n){if(this==O)return this;if(n.isLeaf)return S.empty;let o,i;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(o=this.children[l+2]);break}let s=e+1,r=s+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<r&&a.to>s&&a.type instanceof Q){let c=Math.max(s,a.from)-s,d=Math.min(r,a.to)-s;c<d&&(i||(i=[])).push(a.copy(c,d))}}if(i){let l=new S(i.sort(ie),de);return o?new G([l,o]):l}return o||O}eq(e){if(this==e)return!0;if(!(e instanceof S)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return st(this.localsInner(e))}localsInner(e){if(this==O)return de;if(e.inlineContent||!this.local.some(Q.is))return this.local;let n=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof Q||n.push(this.local[o]);return n}forEachSet(e){e(this)}}S.empty=new S([],[]);S.removeOverlap=st;const O=S.empty;class G{constructor(e){this.members=e}map(e,n){const o=this.members.map(i=>i.map(e,n,oe));return G.from(o)}forChild(e,n){if(n.isLeaf)return S.empty;let o=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=O&&(s instanceof G?o=o.concat(s.members):o.push(s))}return G.from(o)}eq(e){if(!(e instanceof G)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,o=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{o&&(n=n.slice(),o=!1);for(let r=0;r<s.length;r++)n.push(s[r])}}return n?st(o?n:n.sort(ie)):de}static from(e){switch(e.length){case 0:return O;case 1:return e[0];default:return new G(e.every(n=>n instanceof S)?e:e.reduce((n,o)=>n.concat(o instanceof S?o:o.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function Ho(t,e,n,o,i,s,r){let l=t.slice();for(let c=0,d=s;c<n.maps.length;c++){let f=0;n.maps[c].forEach((u,p,h,g)=>{let m=g-h-(p-u);for(let y=0;y<l.length;y+=3){let V=l[y+1];if(V<0||u>V+d-f)continue;let me=l[y]+d-f;p>=me?l[y+1]=u<=me?-2:-1:u>=d&&m&&(l[y]+=m,l[y+1]+=m)}f+=m}),d=n.maps[c].map(d,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let d=n.map(t[c]+s),f=d-i;if(f<0||f>=o.content.size){a=!0;continue}let u=n.map(t[c+1]+s,-1),p=u-i,{index:h,offset:g}=o.content.findIndex(f),m=o.maybeChild(h);if(m&&g==f&&g+m.nodeSize==p){let y=l[c+2].mapInner(n,m,d+1,t[c]+s+1,r);y!=O?(l[c]=f,l[c+1]=p,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=Wo(l,t,e,n,i,s,r),d=Ve(c,o,0,r);e=d.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,u=0;f<d.children.length;f+=3){let p=d.children[f];for(;u<l.length&&l[u]<p;)u+=3;l.splice(u,0,d.children[f],d.children[f+1],d.children[f+2])}}return new S(e.sort(ie),l)}function yn(t,e){if(!e||!t.length)return t;let n=[];for(let o=0;o<t.length;o++){let i=t[o];n.push(new z(i.from+e,i.to+e,i.type))}return n}function Wo(t,e,n,o,i,s,r){function l(a,c){for(let d=0;d<a.local.length;d++){let f=a.local[d].map(o,i,c);f?n.push(f):r.onRemove&&r.onRemove(a.local[d].spec)}for(let d=0;d<a.children.length;d+=3)l(a.children[d+2],a.children[d]+c+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+s+1);return n}function bn(t,e,n){if(e.isLeaf)return null;let o=n+e.nodeSize,i=null;for(let s=0,r;s<t.length;s++)(r=t[s])&&r.from>n&&r.to<o&&((i||(i=[])).push(r),t[s]=null);return i}function Dn(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Ve(t,e,n,o){let i=[],s=!1;e.forEach((l,a)=>{let c=bn(t,l,a+n);if(c){s=!0;let d=Ve(c,l,n+a+1,o);d!=O&&i.push(a,a+l.nodeSize,d)}});let r=yn(s?Dn(t):t,-n).sort(ie);for(let l=0;l<r.length;l++)r[l].type.valid(e,r[l])||(o.onRemove&&o.onRemove(r[l].spec),r.splice(l--,1));return r.length||i.length?new S(r,i):O}function ie(t,e){return t.from-e.from||t.to-e.to}function st(t){let e=t;for(let n=0;n<e.length-1;n++){let o=e[n];if(o.from!=o.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==o.from){s.to!=o.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,o.to),Pt(e,i+1,s.copy(o.to,s.to)));continue}else{s.from<o.to&&(e==t&&(e=t.slice()),e[n]=o.copy(o.from,s.from),Pt(e,i,o.copy(s.from,o.to)));break}}}return e}function Pt(t,e,n){for(;e<t.length&&ie(n,t[e])>0;)e++;t.splice(e,0,n)}function qe(t){let e=[];return t.someProp("decorations",n=>{let o=n(t.state);o&&o!=O&&e.push(o)}),t.cursorWrapper&&e.push(S.create(t.state.doc,[t.cursorWrapper.deco])),G.from(e)}const _o={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},jo=E&&J<=11;class Uo{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Yo{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Uo,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(o=>{for(let i=0;i<o.length;i++)this.queue.push(o[i]);E&&J<=11&&o.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),jo&&(this.onCharData=o=>{this.queue.push({target:o.target,type:"characterData",oldValue:o.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,_o)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Nt(this.view)){if(this.suppressingSelectionUpdates)return W(this.view);if(E&&J<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&re(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,o;for(let s=e.focusNode;s;s=ue(s))n.add(s);for(let s=e.anchorNode;s;s=ue(s))if(n.has(s)){o=s;break}let i=o&&this.view.docView.nearestDesc(o);if(i&&i.ignoreMutation({type:"selection",target:o.nodeType==3?o.parentNode:o}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let o=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(o)&&Nt(e)&&!this.ignoreSelectionChange(o),s=-1,r=-1,l=!1,a=[];if(e.editable)for(let d=0;d<n.length;d++){let f=this.registerMutation(n[d],a);f&&(s=s<0?f.from:Math.min(f.from,s),r=r<0?f.to:Math.max(f.to,r),f.typeOver&&(l=!0))}if(I&&a.length){let d=a.filter(f=>f.nodeName=="BR");if(d.length==2){let[f,u]=d;f.parentNode&&f.parentNode.parentNode==u.parentNode?u.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let u of d){let p=u.parentNode;p&&p.nodeName=="LI"&&(!f||Jo(e,f)!=p)&&u.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Be(o)&&(c=we(e))&&c.eq(he.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,W(e),this.currentSelection.set(o),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,r),Go(e)),this.handleDOMChange(s,r,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||W(e),this.currentSelection.set(o))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let o=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(o==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!o||o.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let f=e.addedNodes[d];n.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(o.contentDOM&&o.contentDOM!=o.dom&&!o.contentDOM.contains(e.target))return{from:o.posBefore,to:o.posAfter};let i=e.previousSibling,s=e.nextSibling;if(E&&J<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:f,nextSibling:u}=e.addedNodes[d];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f),(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(s=u)}let r=i&&i.parentNode==e.target?C(i)+1:0,l=o.localPosFromDOM(e.target,r,-1),a=s&&s.parentNode==e.target?C(s):e.target.childNodes.length,c=o.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:o.posAtStart-o.border,to:o.posAtEnd+o.border}:(this.lastChangedTextNode=e.target,{from:o.posAtStart,to:o.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let At=new WeakMap,Et=!1;function Go(t){if(!At.has(t)&&(At.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=I,Et)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Et=!0}}function Vt(t,e){let n=e.startContainer,o=e.startOffset,i=e.endContainer,s=e.endOffset,r=t.domAtPos(t.state.selection.anchor);return re(r.node,r.offset,i,s)&&([n,o,i,s]=[i,s,n,o]),{anchorNode:n,anchorOffset:o,focusNode:i,focusOffset:s}}function Xo(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Vt(t,i)}let n;function o(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",o,!0),n?Vt(t,n):null}function Jo(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let o=t.docView.nearestDesc(n,!0);if(o&&o.node.isBlock)return n}return null}function Zo(t,e,n){let{node:o,fromOffset:i,toOffset:s,from:r,to:l}=t.docView.parseRange(e,n),a=t.domSelectionRange(),c,d=a.anchorNode;if(d&&t.dom.contains(d.nodeType==1?d:d.parentNode)&&(c=[{node:d,offset:a.anchorOffset}],Be(a)||c.push({node:a.focusNode,offset:a.focusOffset})),x&&t.input.lastKeyCode===8)for(let m=s;m>i;m--){let y=o.childNodes[m-1],V=y.pmViewDesc;if(y.nodeName=="BR"&&!V){s=m;break}if(!V||V.size)break}let f=t.state.doc,u=t.someProp("domParser")||qt.fromSchema(t.state.schema),p=f.resolve(r),h=null,g=u.parse(o,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:s,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Qo,context:p});if(c&&c[0].pos!=null){let m=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=m),h={anchor:m+r,head:y+r}}return{doc:g,sel:h,from:r,to:l}}function Qo(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(k&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||k&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const wo=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function vo(t,e,n,o,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let b=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,N=we(t,b);if(N&&!t.state.selection.eq(N)){if(x&&H&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",Nn=>Nn(t,ee(13,"Enter"))))return;let A=t.state.tr.setSelection(N);b=="pointer"?A.setMeta("pointer",!0):b=="key"&&A.scrollIntoView(),s&&A.setMeta("composition",s),t.dispatch(A)}return}let r=t.state.doc.resolve(e),l=r.sharedDepth(n);e=r.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,c=Zo(t,e,n),d=t.state.doc,f=d.slice(c.from,c.to),u,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(u=t.state.selection.to,p="end"):(u=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let h=ni(f.content,c.doc.content,c.from,u,p);if(h&&t.input.domChangeCount++,(pe&&t.input.lastIOSEnter>Date.now()-225||H)&&i.some(b=>b.nodeType==1&&!wo.test(b.nodeName))&&(!h||h.endA>=h.endB)&&t.someProp("handleKeyDown",b=>b(t,ee(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!h)if(o&&a instanceof M&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))h={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let b=Rt(t,t.state.doc,c.sel);if(b&&!b.eq(t.state.selection)){let N=t.state.tr.setSelection(b);s&&N.setMeta("composition",s),t.dispatch(N)}}return}t.state.selection.from<t.state.selection.to&&h.start==h.endB&&t.state.selection instanceof M&&(h.start>t.state.selection.from&&h.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?h.start=t.state.selection.from:h.endA<t.state.selection.to&&h.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(h.endB+=t.state.selection.to-h.endA,h.endA=t.state.selection.to)),E&&J<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>c.from&&c.doc.textBetween(h.start-c.from-1,h.start-c.from+1)==" "&&(h.start--,h.endA--,h.endB--);let g=c.doc.resolveNoCache(h.start-c.from),m=c.doc.resolveNoCache(h.endB-c.from),y=d.resolve(h.start),V=g.sameParent(m)&&g.parent.inlineContent&&y.end()>=h.endA,me;if((pe&&t.input.lastIOSEnter>Date.now()-225&&(!V||i.some(b=>b.nodeName=="DIV"||b.nodeName=="P"))||!V&&g.pos<c.doc.content.size&&(!g.sameParent(m)||!g.parent.inlineContent)&&!/\S/.test(c.doc.textBetween(g.pos,m.pos,"",""))&&(me=he.findFrom(c.doc.resolve(g.pos+1),1,!0))&&me.head>g.pos)&&t.someProp("handleKeyDown",b=>b(t,ee(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>h.start&&ti(d,h.start,h.endA,g,m)&&t.someProp("handleKeyDown",b=>b(t,ee(8,"Backspace")))){H&&x&&t.domObserver.suppressSelectionUpdates();return}x&&h.endB==h.start&&(t.input.lastChromeDelete=Date.now()),H&&!V&&g.start()!=m.start()&&m.parentOffset==0&&g.depth==m.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==h.endA&&(h.endB-=2,m=c.doc.resolveNoCache(h.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(b){return b(t,ee(13,"Enter"))})},20));let j=h.start,v=h.endA,Me=b=>{let N=b||t.state.tr.replace(j,v,c.doc.slice(h.start-c.from,h.endB-c.from));if(c.sel){let A=Rt(t,N.doc,c.sel);A&&!(x&&t.composing&&A.empty&&(h.start!=h.endB||t.input.lastChromeDelete<Date.now()-100)&&(A.head==j||A.head==N.mapping.map(v)-1)||E&&A.empty&&A.head==j)&&N.setSelection(A)}return s&&N.setMeta("composition",s),N.scrollIntoView()},ke;if(V){if(g.pos==m.pos){E&&J<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>W(t),20));let b=Me(t.state.tr.delete(j,v)),N=d.resolve(h.start).marksAcross(d.resolve(h.endA));N&&b.ensureMarks(N),t.dispatch(b)}else if(h.endA==h.endB&&(ke=ei(g.parent.content.cut(g.parentOffset,m.parentOffset),y.parent.content.cut(y.parentOffset,h.endA-y.start())))){let b=Me(t.state.tr);ke.type=="add"?b.addMark(j,v,ke.mark):b.removeMark(j,v,ke.mark),t.dispatch(b)}else if(g.parent.child(g.index()).isText&&g.index()==m.index()-(m.textOffset?0:1)){let b=g.parent.textBetween(g.parentOffset,m.parentOffset),N=()=>Me(t.state.tr.insertText(b,j,v));t.someProp("handleTextInput",A=>A(t,j,v,b,N))||t.dispatch(N())}}else t.dispatch(Me())}function Rt(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:ve(t,e.resolve(n.anchor),e.resolve(n.head))}function ei(t,e){let n=t.firstChild.marks,o=e.firstChild.marks,i=n,s=o,r,l,a;for(let d=0;d<o.length;d++)i=o[d].removeFromSet(i);for(let d=0;d<n.length;d++)s=n[d].removeFromSet(s);if(i.length==1&&s.length==0)l=i[0],r="add",a=d=>d.mark(l.addToSet(d.marks));else if(i.length==0&&s.length==1)l=s[0],r="remove",a=d=>d.mark(l.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<e.childCount;d++)c.push(a(e.child(d)));if(_.from(c).eq(t))return{mark:l,type:r}}function ti(t,e,n,o,i){if(n-e<=i.pos-o.pos||Ke(o,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!o.parent.isTextblock){let l=s.nodeAfter;return l!=null&&n==e+l.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let r=t.resolve(Ke(s,!0,!0));return!r.parent.isTextblock||r.pos>n||Ke(r,!0,!1)<n?!1:o.parent.content.cut(o.parentOffset).eq(r.parent.content)}function Ke(t,e,n){let o=t.depth,i=e?t.end():t.pos;for(;o>0&&(e||t.indexAfter(o)==t.node(o).childCount);)o--,i++,e=!1;if(n){let s=t.node(o).maybeChild(t.indexAfter(o));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function ni(t,e,n,o,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:r,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let a=Math.max(0,s-Math.min(r,l));o-=r+a-s}if(r<s&&t.size<e.size){let a=o<=s&&o>=r?s-o:0;s-=a,s&&s<e.size&&Bt(e.textBetween(s-1,s+1))&&(s+=a?1:-1),l=s+(l-r),r=s}else if(l<s){let a=o<=s&&o>=l?s-o:0;s-=a,s&&s<t.size&&Bt(t.textBetween(s-1,s+1))&&(s+=a?1:-1),r=s+(r-l),l=s}return{start:s,endA:r,endB:l}}function Bt(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class oi{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new So,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach($t),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=zt(this),Ft(this),this.nodeViews=Lt(this),this.docView=pt(this.state.doc,It(this),qe(this),this.dom,this),this.domObserver=new Yo(this,(o,i,s,r)=>vo(this,o,i,s,r)),this.domObserver.start(),Co(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ze(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach($t),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let o in this._props)n[o]=this._props[o];n.state=this.state;for(let o in e)n[o]=e[o];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var o;let i=this.state,s=!1,r=!1;e.storedMarks&&this.composing&&(un(this),r=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=Lt(this);si(p,this.nodeViews)&&(this.nodeViews=p,s=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Ze(this),this.editable=zt(this),Ft(this);let a=qe(this),c=It(this),d=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=s||!this.docView.matchesNode(e.doc,c,a);(f||!e.selection.eq(i.selection))&&(r=!0);let u=d=="preserve"&&r&&this.dom.style.overflowAnchor==null&&Fn(this);if(r){this.domObserver.stop();let p=f&&(E||x)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&ii(i.selection,e.selection);if(f){let h=x?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Fo(this)),(s||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=pt(e.doc,c,a,this.dom,this)),h&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&so(this))?W(this,p):(en(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((o=this.dragging)===null||o===void 0)&&o.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():u&&zn(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof D){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&at(this,n.getBoundingClientRect(),e)}else at(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let o=this.directPlugins[n];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let o=this.state.plugins[n];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let o=this.pluginViews[n];o.update&&o.update(this,e)}}updateDraggedNode(e,n){let o=e.node,i=-1;if(this.state.doc.nodeAt(o.from)==o.node)i=o.from;else{let s=o.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==o.node&&(i=s)}this.dragging=new mn(e.slice,e.move,i<0?void 0:D.create(this.state.doc,i))}someProp(e,n){let o=this._props&&this._props[e],i;if(o!=null&&(i=n?n(o):o))return i;for(let r=0;r<this.directPlugins.length;r++){let l=this.directPlugins[r].props[e];if(l!=null&&(i=n?n(l):l))return i}let s=this.state.plugins;if(s)for(let r=0;r<s.length;r++){let l=s[r].props[e];if(l!=null&&(i=n?n(l):l))return i}}hasFocus(){if(E){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Ln(this.dom),W(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Wn(this,e)}coordsAtPos(e,n=1){return Yt(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,o=-1){let i=this.docView.posFromDOM(e,n,o);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return Gn(this,n||this.state,e)}pasteHTML(e,n){return Ne(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Ne(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return et(this,e)}destroy(){this.docView&&(Oo(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],qe(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,xn())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Mo(this,e)}domSelectionRange(){let e=this.domSelection();return e?k&&this.root.nodeType===11&&An(this.dom.ownerDocument)==this.dom&&Xo(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}oi.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function It(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let o in n)o=="class"?e.class+=" "+n[o]:o=="style"?e.style=(e.style?e.style+";":"")+n[o]:!e[o]&&o!="contenteditable"&&o!="nodeName"&&(e[o]=String(n[o]))}),e.translate||(e.translate="no"),[z.node(0,t.state.doc.content.size,e)]}function Ft(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:z.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function zt(t){return!t.someProp("editable",e=>e(t.state)===!1)}function ii(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Lt(t){let e=Object.create(null);function n(o){for(let i in o)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=o[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function si(t,e){let n=0,o=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)o++;return n!=o}function $t(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}export{z as Decoration,S as DecorationSet,oi as EditorView};
|
|
6
6
|
//# sourceMappingURL=index.js.map
|