{"version":3,"file":"liteModelCms-DhP_5P3Y.js","sources":["../../../app/javascript/src/components/Theme/H2.vue","../../../app/assets/images/cms/dashboard_check.png","../../../app/assets/images/cms/dashboard_cross.png","../../../app/javascript/src/modules/LiteCMS/PlanTrip/PlanTripComparisonItem.vue","../../../app/javascript/src/modules/LiteCMS/PlanTrip/PlanTrip.vue","../../../app/assets/images/heroDashboard/upcoming_cover.png","../../../app/assets/images/cms/lightbulb.png","../../../app/javascript/src/modules/LiteCMS/Common/BackButton.vue","../../../app/assets/images/cms/default_avatar.svg?component","../../../app/javascript/src/stores/liteCMS/cmsData.ts","../../../app/assets/images/cms/map.svg?component","../../../node_modules/.pnpm/object-to-formdata@4.5.1/node_modules/object-to-formdata/src/index.js","../../../app/javascript/src/stores/liteCMS/cmsEssentialsStore.ts","../../../app/javascript/src/stores/liteCMS/cmsAccommodationStore.ts","../../../app/javascript/src/stores/liteCMS/cmsItineraryStore.ts","../../../app/javascript/src/stores/liteCMS/cmsPricingStore.ts","../../../app/javascript/src/stores/liteCMS/cmsAddonsStore.ts","../../../app/javascript/src/stores/liteCMS/cmsPoliciesStore.ts","../../../app/javascript/src/stores/liteCMS/cmsMarketingStore.ts","../../../app/javascript/src/stores/liteCMS/cmsMetaStore.ts","../../../app/javascript/src/stores/liteCMS/cmsIndexStore.ts","../../../app/javascript/src/helpers/dataHelpers.js","../../../app/assets/images/operatorDashboard/edit.svg?component","../../../app/assets/images/operatorDashboard/delete.svg?component","../../../app/javascript/src/components/ConfirmationDialog/StatefulConfirmationDialog.ts","../../../app/javascript/src/components/ConfirmationDialog/StatefulConfirmationDialog.vue","../../../app/javascript/src/modules/LiteCMS/Dashboard.vue","../../../app/javascript/src/modules/LiteCMS/Dashboard/DraftItineraryCard.vue","../../../app/javascript/src/modules/LiteCMS/Dashboard/HowItWorks.vue","../../../app/javascript/src/modules/LiteCMS/HeroDashboard.vue","../../../app/javascript/src/modules/LiteCMS/Common/ProgressItem.vue","../../../app/assets/images/cms/circling_arrow.svg?component","../../../app/javascript/src/modules/LiteCMS/Common/PageBody.vue","../../../app/javascript/src/modules/LiteCMS/Common/SelectInput.vue","../../../app/javascript/src/modules/LiteCMS/Common/SearchApiInput.vue","../../../app/javascript/src/modules/LiteCMS/Essentials/SearchDestination.vue","../../../app/javascript/src/modules/LiteCMS/Common/DateRangeInput.vue","../../../app/assets/images/cms/activity_level_1.svg?component","../../../app/assets/images/cms/activity_level_2.svg?component","../../../app/assets/images/cms/activity_level_3.svg?component","../../../app/javascript/src/modules/LiteCMS/Essentials/ActivitySelector.vue","../../../app/assets/images/cms/profile_image.svg?component","../../../app/assets/images/common/trash.svg?component","../../../app/javascript/src/modules/LiteCMS/Common/CmsInputValidation.vue","../../../app/javascript/src/modules/LiteCMS/Essentials/SupplierProfileEditor.vue","../../../app/assets/images/common/pencil.svg?component","../../../app/javascript/src/modules/LiteCMS/Common/ItineraryTitle.vue","../../../app/javascript/src/modules/LiteCMS/Common/NumberInput.vue","../../../app/javascript/src/modules/HeroDashboard/ProfileSetup/SocialInput.vue","../../../app/javascript/src/modules/LiteCMS/Essentials/SocialMediaInput.vue","../../../app/javascript/src/modules/LiteCMS/Essentials/HeroProfileEditor.vue","../../../app/javascript/src/modules/LiteCMS/Essentials/SearchCountry.vue","../../../app/javascript/src/modules/LiteCMS/Essentials.vue","../../../app/javascript/src/modules/LiteCMS/Accommodation/SearchAccommodation.vue","../../../app/assets/images/operatorDashboard/upload.svg?component","../../../app/javascript/src/components/Form/Upload/UploadFileIntro.vue","../../../app/javascript/src/modules/LiteCMS/Common/AddImages/ImageUploader.vue","../../../app/javascript/src/modules/LiteCMS/Common/AddImages/ItineraryImage.vue","../../../app/javascript/src/modules/LiteCMS/Common/AddImages/UnsplashSearchImage.vue","../../../app/javascript/src/modules/LiteCMS/Common/AddImages/ImageSelector.vue","../../../app/javascript/src/modules/LiteCMS/Accommodation.vue","../../../app/javascript/src/modules/LiteCMS/Common/SelectNumber.vue","../../../app/javascript/src/modules/LiteCMS/Itinerary/TagInput.vue","../../../node_modules/.pnpm/@milkdown+exception@7.7.0/node_modules/@milkdown/exception/lib/index.es.js","../../../node_modules/.pnpm/@milkdown+ctx@7.7.0/node_modules/@milkdown/ctx/lib/index.es.js","../../../node_modules/.pnpm/orderedmap@2.1.1/node_modules/orderedmap/dist/index.js","../../../node_modules/.pnpm/prosemirror-model@1.25.0/node_modules/prosemirror-model/dist/index.js","../../../node_modules/.pnpm/mdast-util-to-string@4.0.0/node_modules/mdast-util-to-string/lib/index.js","../../../node_modules/.pnpm/decode-named-character-reference@1.1.0/node_modules/decode-named-character-reference/index.dom.js","../../../node_modules/.pnpm/micromark-util-chunked@2.0.1/node_modules/micromark-util-chunked/index.js","../../../node_modules/.pnpm/micromark-util-combine-extensions@2.0.1/node_modules/micromark-util-combine-extensions/index.js","../../../node_modules/.pnpm/micromark-util-decode-numeric-character-reference@2.0.2/node_modules/micromark-util-decode-numeric-character-reference/index.js","../../../node_modules/.pnpm/micromark-util-normalize-identifier@2.0.1/node_modules/micromark-util-normalize-identifier/index.js","../../../node_modules/.pnpm/micromark-util-character@2.1.1/node_modules/micromark-util-character/index.js","../../../node_modules/.pnpm/micromark-factory-space@2.0.1/node_modules/micromark-factory-space/index.js","../../../node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/initialize/content.js","../../../node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/initialize/document.js","../../../node_modules/.pnpm/micromark-util-classify-character@2.0.1/node_modules/micromark-util-classify-character/index.js","../../../node_modules/.pnpm/micromark-util-resolve-all@2.0.1/node_modules/micromark-util-resolve-all/index.js","../../../node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/attention.js","../../../node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/autolink.js","../../../node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/blank-line.js","../../../node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/block-quote.js","../../../node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/character-escape.js","../../../node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/character-reference.js","../../../node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/code-fenced.js","../../../node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/code-indented.js","../../../node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/code-text.js","../../../node_modules/.pnpm/micromark-util-subtokenize@2.1.0/node_modules/micromark-util-subtokenize/lib/splice-buffer.js","../../../node_modules/.pnpm/micromark-util-subtokenize@2.1.0/node_modules/micromark-util-subtokenize/index.js","../../../node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/content.js","../../../node_modules/.pnpm/micromark-factory-destination@2.0.1/node_modules/micromark-factory-destination/index.js","../../../node_modules/.pnpm/micromark-factory-label@2.0.1/node_modules/micromark-factory-label/index.js","../../../node_modules/.pnpm/micromark-factory-title@2.0.1/node_modules/micromark-factory-title/index.js","../../../node_modules/.pnpm/micromark-factory-whitespace@2.0.1/node_modules/micromark-factory-whitespace/index.js","../../../node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/definition.js","../../../node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/hard-break-escape.js","../../../node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/heading-atx.js","../../../node_modules/.pnpm/micromark-util-html-tag-name@2.0.1/node_modules/micromark-util-html-tag-name/index.js","../../../node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/html-flow.js","../../../node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/html-text.js","../../../node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/label-end.js","../../../node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/label-start-image.js","../../../node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/label-start-link.js","../../../node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/line-ending.js","../../../node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/thematic-break.js","../../../node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/list.js","../../../node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/setext-underline.js","../../../node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/initialize/flow.js","../../../node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/initialize/text.js","../../../node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/constructs.js","../../../node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/create-tokenizer.js","../../../node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/parse.js","../../../node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/postprocess.js","../../../node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/preprocess.js","../../../node_modules/.pnpm/micromark-util-decode-string@2.0.1/node_modules/micromark-util-decode-string/index.js","../../../node_modules/.pnpm/unist-util-stringify-position@4.0.0/node_modules/unist-util-stringify-position/lib/index.js","../../../node_modules/.pnpm/mdast-util-from-markdown@2.0.2/node_modules/mdast-util-from-markdown/lib/index.js","../../../node_modules/.pnpm/remark-parse@11.0.0/node_modules/remark-parse/lib/index.js","../../../node_modules/.pnpm/zwitch@2.0.4/node_modules/zwitch/index.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/configure.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/blockquote.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/break.js","../../../node_modules/.pnpm/longest-streak@3.1.0/node_modules/longest-streak/index.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-fence.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/code.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-quote.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/definition.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/encode-info.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/emphasis.js","../../../node_modules/.pnpm/unist-util-is@6.0.0/node_modules/unist-util-is/lib/index.js","../../../node_modules/.pnpm/unist-util-visit-parents@6.0.1/node_modules/unist-util-visit-parents/lib/index.js","../../../node_modules/.pnpm/unist-util-visit@5.0.0/node_modules/unist-util-visit/lib/index.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/heading.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/html.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/image.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/image-reference.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/inline-code.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/link.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/link-reference.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-bullet.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-rule.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/list.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/list-item.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/paragraph.js","../../../node_modules/.pnpm/mdast-util-phrasing@4.1.0/node_modules/mdast-util-phrasing/lib/index.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/root.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-strong.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/strong.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/text.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/index.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/join.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/unsafe.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/association.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/compile-pattern.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/container-flow.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/indent-lines.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/safe.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/track.js","../../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/index.js","../../../node_modules/.pnpm/remark-stringify@11.0.0/node_modules/remark-stringify/lib/index.js","../../../node_modules/.pnpm/bail@2.0.2/node_modules/bail/index.js","../../../node_modules/.pnpm/extend@3.0.2/node_modules/extend/index.js","../../../node_modules/.pnpm/is-plain-obj@4.1.0/node_modules/is-plain-obj/index.js","../../../node_modules/.pnpm/trough@2.2.0/node_modules/trough/lib/index.js","../../../node_modules/.pnpm/vfile-message@4.0.2/node_modules/vfile-message/lib/index.js","../../../node_modules/.pnpm/vfile@6.0.3/node_modules/vfile/lib/minpath.browser.js","../../../node_modules/.pnpm/vfile@6.0.3/node_modules/vfile/lib/minproc.browser.js","../../../node_modules/.pnpm/vfile@6.0.3/node_modules/vfile/lib/minurl.shared.js","../../../node_modules/.pnpm/vfile@6.0.3/node_modules/vfile/lib/minurl.browser.js","../../../node_modules/.pnpm/vfile@6.0.3/node_modules/vfile/lib/index.js","../../../node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/callable-instance.js","../../../node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.js","../../../node_modules/.pnpm/@milkdown+transformer@7.7.0_@milkdown+prose@7.7.0/node_modules/@milkdown/transformer/lib/index.es.js","../../../node_modules/.pnpm/prosemirror-transform@1.10.3/node_modules/prosemirror-transform/dist/index.js","../../../node_modules/.pnpm/prosemirror-state@1.4.3/node_modules/prosemirror-state/dist/index.js","../../../node_modules/.pnpm/prosemirror-inputrules@1.5.0/node_modules/prosemirror-inputrules/dist/index.js","../../../node_modules/.pnpm/@milkdown+prose@7.7.0/node_modules/@milkdown/prose/lib/index.js","../../../node_modules/.pnpm/prosemirror-commands@1.7.0/node_modules/prosemirror-commands/dist/index.js","../../../node_modules/.pnpm/w3c-keyname@2.2.8/node_modules/w3c-keyname/index.js","../../../node_modules/.pnpm/prosemirror-keymap@1.2.2/node_modules/prosemirror-keymap/dist/index.js","../../../node_modules/.pnpm/prosemirror-view@1.38.1/node_modules/prosemirror-view/dist/index.js","../../../node_modules/.pnpm/@milkdown+core@7.7.0_@milkdown+ctx@7.7.0_@milkdown+prose@7.7.0_@milkdown+transformer@7.7.0_@milkdown+prose@7.7.0_/node_modules/@milkdown/core/lib/index.es.js","../../../node_modules/.pnpm/@milkdown+vue@7.7.0_@codemirror+language@6.11.0_@codemirror+state@6.5.2_@codemirror+view@6.36_da2lb5ttl7gipuoebbhq6daluu/node_modules/@milkdown/vue/lib/index.es.js","../../../node_modules/.pnpm/@milkdown+utils@7.7.0_@milkdown+core@7.7.0_@milkdown+ctx@7.7.0_@milkdown+prose@7.7.0_@milkdow_6s3m4bj2dpvl73ipy3b6ozvknu/node_modules/@milkdown/utils/lib/index.es.js","../../../node_modules/.pnpm/prosemirror-schema-list@1.5.1/node_modules/prosemirror-schema-list/dist/index.js","../../../node_modules/.pnpm/mdast-util-definitions@6.0.0/node_modules/mdast-util-definitions/lib/index.js","../../../node_modules/.pnpm/remark-inline-links@7.0.0/node_modules/remark-inline-links/lib/index.js","../../../node_modules/.pnpm/@milkdown+preset-commonmark@7.7.0_@milkdown+core@7.7.0_@milkdown+ctx@7.7.0_@milkdown+prose@7._vukh4k2pbktxn3hdt2dfengfdq/node_modules/@milkdown/preset-commonmark/lib/index.es.js","../../../node_modules/.pnpm/rope-sequence@1.3.4/node_modules/rope-sequence/dist/index.js","../../../node_modules/.pnpm/prosemirror-history@1.4.1/node_modules/prosemirror-history/dist/index.js","../../../node_modules/.pnpm/@milkdown+plugin-history@7.7.0_@milkdown+core@7.7.0_@milkdown+ctx@7.7.0_@milkdown+prose@7.7.0_a7tcmokmrhhwizboz5mndab3km/node_modules/@milkdown/plugin-history/lib/index.es.js","../../../node_modules/.pnpm/lodash.debounce@4.0.8/node_modules/lodash.debounce/index.js","../../../node_modules/.pnpm/@milkdown+plugin-listener@7.7.0_@milkdown+core@7.7.0_@milkdown+ctx@7.7.0_@milkdown+prose@7.7._tp6wimzd7tabn4jjim54vaf73u/node_modules/@milkdown/plugin-listener/lib/index.es.js","../../../app/javascript/src/utils/milkdown.js","../../../app/javascript/src/components/Milkdown/Milkdown.vue","../../../app/assets/images/common/undo.svg?component","../../../app/assets/images/common/redo.svg?component","../../../app/assets/images/common/bold.svg?component","../../../app/assets/images/common/italic.svg?component","../../../app/assets/images/common/link.svg?component","../../../app/assets/images/common/unlink.svg?component","../../../app/assets/images/common/bullet-list.svg?component","../../../app/assets/images/common/ordered-list.svg?component","../../../app/javascript/src/components/Milkdown/MarkdownEditor.vue","../../../app/assets/images/common/movable.svg?component","../../../app/javascript/src/components/Form/TimeInput.vue","../../../app/javascript/src/modules/LiteCMS/Common/TimeInputV2.vue","../../../app/javascript/src/modules/LiteCMS/Itinerary/ActivityTimelineDayItem.vue","../../../app/javascript/src/modules/LiteCMS/Itinerary/ActivityTimelineTransportItem.vue","../../../node_modules/.pnpm/sortablejs@1.15.6/node_modules/sortablejs/modular/sortable.esm.js","../../../app/javascript/src/modules/LiteCMS/Itinerary/ActivityTimelineDayOverview.vue","../../../app/javascript/src/modules/LiteCMS/Itinerary/ActivityTimelineDay.vue","../../../app/assets/images/common/expand-vertical.svg?component","../../../app/assets/images/common/collapse-vertical.svg?component","../../../app/javascript/src/modules/LiteCMS/Common/ExpandAllToggle.vue","../../../app/javascript/src/modules/LiteCMS/Itinerary/ActivityTimeline.vue","../../../app/javascript/src/modules/LiteCMS/Itinerary.vue","../../../app/javascript/src/modules/LiteCMS/Pricing/FeeSummary.vue","../../../app/javascript/src/modules/LiteCMS/Pricing/LineitemList.vue","../../../app/javascript/src/modules/LiteCMS/Common/MoneyInput.vue","../../../app/javascript/src/modules/LiteCMS/Common/DatePicker.vue","../../../app/javascript/src/modules/LiteCMS/Pricing/PaymentPlans.vue","../../../app/javascript/src/modules/LiteCMS/Common/ShowFirst.vue","../../../app/javascript/src/modules/LiteCMS/Pricing.vue","../../../app/javascript/src/modules/LiteCMS/Common/DateTimeCombinedInput.vue","../../../app/javascript/src/modules/LiteCMS/Addons.vue","../../../app/assets/images/operatorDashboard/circle-left.svg?component","../../../app/javascript/src/modules/LiteCMS/Policies/TimelineBreakdown.vue","../../../app/javascript/src/modules/LiteCMS/Policies/PercentageInput.vue","../../../app/javascript/src/modules/LiteCMS/Policies/CancellationFeeDeadlines.vue","../../../app/javascript/src/modules/LiteCMS/Policies/PartialRefundTimeline.vue","../../../app/javascript/src/modules/LiteCMS/Policies/CancellationPolicySection.vue","../../../app/javascript/src/modules/LiteCMS/Policies/FaqSection.vue","../../../app/javascript/src/modules/LiteCMS/Policies.vue","../../../app/javascript/src/modules/LiteCMS/Marketing/CouponCodeForm.vue","../../../app/javascript/src/modules/LiteCMS/Marketing/FeatureImageForm.vue","../../../app/javascript/src/modules/LiteCMS/Marketing.vue","../../../app/javascript/src/routers/children/liteModelCms.js"],"sourcesContent":["<template>\n  <div class=\"theme-h2\">\n    <slot></slot>\n  </div>\n</template>\n\n<style lang=\"scss\" scoped>\n.theme-h2 {\n  font-size: $text-4xl;\n  font-weight: $font-bold;\n}\n</style>\n","export default \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAHnSURBVHgBxZQ/SAJRHMffneJ/E0wDC6EIg4YQW4omIVAMlEAIKhyCoFpqiIYQoUREzKEa3ASFEIcmF8cWGxobhCJBGxqu1cUD074Xd/IwtTiDvnD+fve78/O+7/3ePUL+WAwZQR6PZ4JhmMNOp7OoUCgqpVLpRElkyu/363iefwBsWrg3m801IbJEpgDbRJgWcrVa3bbb7RcjAaGwlOh0uptEIlGXDcTabSPMCLlKpSJarTYmPZPrsOtOo9EUstnsi2yg1+sNIswLuVKpJHq9PkY/p4FMIBCYDIVC+mFAdDVCubvN5XKVb0CMuoXrqdlsvnEc9+zz+cb6wbB26whOyZ3RaDzrfYcVR73GNSfWplqt1hHpr6iUoLOFXnddIHb7FV3E/bHb7bbQNcxgA2FByIXOmkymSL8Rv4DYmJcIHFU34U9R+kXMIC7laEQ2k8lUBwKLxWIDrk57XO5hzZZEd7sIs6I73maznZMBog8HBoAy4gpVe0Qn19CseyJ+ZhaLJZ7P58ODgPS26bAsewBnPFVz4pu9k2AGg6HucrniZIgU9E21WuUcDscH1muVKo8LP3DaxoniSSaTr78GitAyoLOAOqUaYA3U9tPpdIn8oEEHLBMMBncw/WV0tGa1WjOpVOqd/Ic+AR+4i/wKYuJfAAAAAElFTkSuQmCC\"","export default \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAF2SURBVHgBlZRdSsNQEIUnoUvoQ56lmxBXVl9aFyToGkREi0gRH3yr1PyURq3WWmLEeM41CZPQpDcDh05nzvm43DQVySsdDIap542lYyEzYrY6xCDp9bLEcbIEBlsYvSaDbAlls8VgK/IvSyg99JY5HojQR9cdbzD40qKxBcodPTpDxgNYxjAVGa8x+NRqgHLGnfYyew9GxUjoBxYVIbhRUPac1X3TOkxDVzC8awGwBohir3erNlhRdzC8wvimBZCRmtFzuw9WFI0vCLTJGlbUBIElgnFNhE1aYG7T4sDzsgyfdf06jtlJl1riASxwZwswdgq7pe0bRWOEQIRgoVD1pWygNIQwhjmECqAr3BkVqLlRG5SLAIYgh1B+Dis87H21N+LV1KEc+Fj4OaTQ5Y6nSehzzedraIj/QFvYPui83x+511H0/ZNVfwUzkZOjFuAhdnN4dCoF4yaOU/PlXGT4ZHGyppPOoFOR48qS0IuurxOKBzhTsD+dyn9onLrDbwAAAABJRU5ErkJggg==\"","<template>\n\n  <div class=\"headline\" v-if=\"mobile\">\n    {{ title }}\n    <i class=\"icon icon-information-circle\" @click=\"expand = !expand\"></i>\n  </div>\n\n  <div class=\"item one\" :class=\"{ first, last }\">\n    <img :src=\"DashboardCheckImage\">\n    <div class=\"headline\" v-if=\"desktop\">\n      {{ title }}\n      <i class=\"icon icon-information-circle\" @click=\"expand = !expand\"></i>\n    </div>\n    <div class=\"text\" v-show=\"expand\">{{ one }}</div>\n  </div>\n\n  <div class=\"item two\" :class=\"{ first, last }\">\n    <img :src=\"diff ? DashboardCrossImage : DashboardCheckImage\">\n    <div class=\"headline\" v-if=\"desktop\">\n      {{ title }}\n      <i class=\"icon icon-information-circle\" @click=\"expand = !expand\"></i>\n    </div>\n    <div class=\"text\" v-show=\"expand\">{{ two }}</div>\n  </div>\n</template>\n\n<script setup>\nimport DashboardCheckImage from 'app/assets/images/cms/dashboard_check.png';\nimport DashboardCrossImage from 'app/assets/images/cms/dashboard_cross.png';\nimport { ref } from \"vue\";\nimport { useShared } from \"@/helpers/vueHelpers.js\";\n\ndefineProps({\n  first: Boolean,\n  last: Boolean,\n  diff: Boolean,\n  title: String,\n  one: String,\n  two: String\n});\n\nconst expand = ref(false);\nconst {mobile, desktop} = useShared();\n</script>\n\n<style lang=\"scss\" scoped>\n.item {\n  background: white;\n  padding: $spacing-3 $spacing-8;\n  display: grid;\n  grid-template-columns: auto 1fr;\n  grid-template-rows: auto 1fr;\n  gap: $spacing-3;\n\n  @media (max-width: $breakpoint-m) {\n    background: transparent;\n    padding: $spacing-4 $spacing-2;\n    @include flex-column;\n    align-items: start;\n  }\n\n  &.first {\n    padding-top: $spacing-8;\n\n    @media (max-width: $breakpoint-m) {\n      padding-top: $spacing-4;\n    }\n  }\n\n  &.last {\n    padding-bottom: $spacing-8;\n    border-bottom-left-radius: $rounded;\n    border-bottom-right-radius: $rounded;\n\n    @media (max-width: $breakpoint-m) {\n      padding-bottom: $spacing-4;\n    }\n  }\n\n  .text {\n    grid-column: 2;\n    color: $gray;\n  }\n}\n\n.headline {\n  display: flex;\n  align-items: center;\n  gap: $spacing-1;\n\n  @media (max-width: $breakpoint-m) {\n    margin-top: $spacing-4;\n    grid-column: 1/-1;\n  }\n\n  .icon-information-circle {\n    cursor: pointer;\n    color: $brand-tertiary;\n  }\n}\n\n@media (max-width: $breakpoint-m) {\n  .one {\n    margin-right: $spacing-1;\n  }\n  .two {\n    margin-left: $spacing-1;\n  }\n}\n</style>","<template>\n  <div class=\"dashboard\">\n    <H2 class=\"page-title\">Plan a trip</H2>\n    <p class=\"page-subtitle\">Choose one that best matches your needs</p>\n\n    <div class=\"table\">\n      <div class=\"header\">\n        <H3 class=\"title\">Plan with us</H3>\n        <div>Let our team help you design the perfect trip from start to finish</div>\n        <Button color=\"primary\" color-filled>Continue</Button>\n      </div>\n\n      <div class=\"header\">\n        <H3 class=\"title\">Plan your own</H3>\n        <div>Take your ideas and create your own itinerary on our platform</div>\n        <Button color=\"primary\" color-filled @click=\"proceed()\">Continue</Button>\n      </div>\n\n      <div><div class=\"line\"></div></div>\n      <div><div class=\"line\"></div></div>\n\n      <DashboardComparisonItem\n        first diff\n        title=\"Finding an operator\"\n        one=\"An operator takes care of travel arrangements on the ground, including airport transfers, accommodations, meals, tours, and guides. Using our extensive list of vetted operators, we’ll find the perfect match to partner with you and help you create your ideal getaway.\"\n        two=\"An operator takes care of travel arrangements on the ground, including airport transfers, accommodations, meals, tours, and guides. Using our extensive list of vetted operators, we’ll find the perfect match to partner with you and help you create your ideal getaway.\"\n      />\n      <DashboardComparisonItem\n        diff\n        title=\"Logistical help\"\n        one=\"You tell us what you want, and we handle the rest! From working with the operator and finalizing itinerary details to gathering traveler information and managing payments, we’re on it. All you have to do is focus on packing.\"\n        two=\"While our platform offers booking and payment services, it will be your responsibility to take care of most tasks, such as managing your travelers, working with your operator, and finalizing pricing.\"\n      />\n      <DashboardComparisonItem\n        diff\n        title=\"Content support from our word wizards\"\n        one=\"Our writers are ready to help you make your dream trip come to life! They’ll match your vibe and write out the entire itinerary page so you don’t have to. They’re also available to make any changes you may need, along with creating some pre-departure literature for your adventure.\"\n        two=\"If you’re choosing the Plan your own, you will have to create all of your own content for your itinerary page.\"\n      />\n      <DashboardComparisonItem\n        title=\"Custom itinerary page\"\n        one=\"Once we have all the details about your trip, our team will create a custom itinerary page that showcases pictures of the location, a timeline, daily breakdown of activities, inclusions section, and so much more. This page will also act as your private booking and payment portal for you and your guests.\"\n        two=\"Using our platform, you will create your own itinerary page, including adding relevant information into the timeline, adding your own photos, and verifying inclusions. This page will also act as your private booking and payment portal for you and your guests.\"\n      />\n      <DashboardComparisonItem\n        title=\"Payout support\"\n        one=\"You never have to worry about missing a payment to your operator or an accommodation. We handle payments to the operator and your selected accommodation(s) based on their deadlines, along with personal payouts if you’re earning income from your trip. We can also help negotiate better payment terms for you and your group due to our long-standing partnerships with our operators.\"\n        two=\"You’ll be responsible for all financial aspects of your trip. This means you’ll budget out the entire trip, then make a request for us to disperse the money to your operator, your selected accommodation(s), and any other expenses accumulated, ensuring all deadlines you negotiate are met.\"\n      />\n      <DashboardComparisonItem\n        title=\"Payment processing platform\"\n        one=\"Bookings and payments are taken care of on your personal itinerary page. We collect traveler information and payment so you don’t have to worry about it.\"\n        two=\"Bookings and payments are taken care of on your personal itinerary page. We collect traveler information and payment so you don’t have to worry about it.\"\n      />\n      <DashboardComparisonItem\n        title=\"Flexible payment plans\"\n        one=\"We know paying for a trip up front can be a burden. You don’t have to worry about that on our platform. We offer a flexible payment plan option, so you and your guests can budget accordingly and pay per month until departure.\"\n        two=\"We know paying for a trip up front can be a burden. You don’t have to worry about that on our platform. We offer a flexible payment plan option, so you and your guests can budget and pay per month until departure.\"\n      />\n      <DashboardComparisonItem\n        last\n        title=\"Manage travelers and bookings in one place\"\n        one=\"Once your itinerary page is completed and you approve the trip, the page will go live so your friends, family, peers, and others can book a spot on your adventure. All of your bookings, including add-ons, will be together in one place, so you can easily keep track of traveler and trip information.\"\n        two=\"Once your itinerary page is completed and you approve the trip, the page will go live so your friends, family, peers, and others can book a spot on your adventure. All of your bookings, including add-ons, will be together in one place, so you can easily keep track of traveler and trip information.\"\n      />\n    </div>\n  </div>\n</template>\n\n<script setup>\nimport { useBodyClass } from \"@/helpers/vueHelpers.js\";\nimport { H2, Button, H3 } from \"@/components/Theme/index.js\";\nimport DashboardComparisonItem from \"@/modules/LiteCMS/PlanTrip/PlanTripComparisonItem.vue\";\n\nuseBodyClass('color-bg');\n</script>\n\n<style lang=\"scss\" scoped>\n.dashboard {\n  font-size: $text-base;\n  line-height: $leading-snug;\n  font-weight: $font-medium;\n  margin: 54px auto;\n  width: 100%;\n  max-width: 928px;\n\n  @media (max-width: $breakpoint-m) {\n    margin: $spacing-6 auto;\n  }\n}\n\n.page-title {\n  text-align: center;\n  margin-bottom: $spacing-8;\n  line-height: 1.111;\n\n  @media (max-width: $breakpoint-m) {\n    font-size: 24px;\n    line-height: 28px;\n    margin-bottom: $spacing-6;\n  }\n}\n\n.page-subtitle {\n  text-align: center;\n  margin-bottom: $spacing-8;\n\n  @media (max-width: $breakpoint-m) {\n    margin-bottom: $spacing-6;\n  }\n}\n\n.table {\n  display: grid;\n  grid-template-columns: 1fr 1fr;\n  column-gap: $spacing-6;\n\n  @media (max-width: $breakpoint-m) {\n    padding: 0 $spacing-5;\n    column-gap: 0;\n  }\n\n  & > div {\n    background: white;\n\n    @media (max-width: $breakpoint-m) {\n      background: transparent;\n    }\n  }\n\n  .header {\n    padding: $spacing-8;\n    border-top-left-radius: $rounded;\n    border-top-right-radius: $rounded;\n    @include flex-column;\n    align-items: start;\n    gap: $spacing-6;\n\n    @media (max-width: $breakpoint-m) {\n      padding: $spacing-2 $spacing-3;\n      margin-bottom: $spacing-4;\n    }\n\n    Button {\n      margin-top: auto;\n    }\n\n    .title {\n      text-align: left;\n      line-height: 1.166;\n    }\n  }\n\n  .line {\n    margin: 0 $spacing-8;\n    border-bottom: 1px solid $gray-lighter;\n\n    @media (max-width: $breakpoint-m) {\n      margin: 0;\n    }\n  }\n}\n</style>","export default \"__VITE_ASSET__DUjsb$pl__\"","export default \"__VITE_ASSET__BPBg3up4__\"","<template>\n  <div class=\"top-navigation\">\n    <button class=\"top-navigation__body\" @click=\"$emit('back')\">\n      <i class=\"icon icon-arrow-left-1\"/>\n      <H5 class=\"top-navigation__label\">{{ t('back') }}</H5>\n    </button>\n  </div>\n</template>\n\n<script setup>\nimport { H5 } from \"@/components/Theme/index.js\";\nimport { useShared } from \"@/helpers/vueHelpers.js\";\n\nconst { t } = useShared();\ndefineEmits(['back'])\n</script>\n\n<style lang=\"scss\" scoped>\n.top-navigation {\n  display: flex;\n\n  :deep(.theme-h5) {\n    font-size: $text-xl;\n    line-height: 1.3;\n  }\n}\n\n.top-navigation__body {\n  display: flex;\n  gap: $spacing-1;\n  align-items: center;\n  cursor: pointer;\n\n  .top-navigation__label {\n    color: initial;\n  }\n\n  .icon {\n    color: $brand-tertiary;\n  }\n}\n</style>\n\n<i18n lang=\"yaml\">\nen:\n  back: Back\n</i18n>\n","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = {\n  viewBox: \"0 0 48 48\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createElementVNode(\"path\", {\n      \"fill-rule\": \"evenodd\",\n      \"clip-rule\": \"evenodd\",\n      d: \"M6.22768 40.1293C2.35812 35.8681 0 30.2094 0 24C0 10.7452 10.7452 0 24 0C37.2548 0 48 10.7452 48 24C48 30.2094 45.6419 35.8681 41.7723 40.1293C40.6611 33.1958 35.5901 27.5852 28.952 25.6898C31.9675 23.9676 34 20.7212 34 17C34 11.4772 29.5228 7 24 7C18.4772 7 14 11.4772 14 17C14 20.7212 16.0325 23.9676 19.048 25.6898C12.4099 27.5852 7.33893 33.1958 6.22768 40.1293Z\",\n      fill: \"#E6E6E6\"\n    }, null, -1)\n  ])))\n}\nexport default { render: render }","export const steps = [\n  { step: 1, key: 'essentials', route: \"cms_essentials\", name: 'Essentials' },\n  { step: 2, key: 'accommodation', route: \"cms_accommodation\", name: 'Accommodation' },\n  { step: 3, key: 'itinerary', route: \"cms_itinerary\", name: 'Itinerary' },\n  { step: 4, key: 'pricing', route: \"cms_pricing\", name: 'Pricing' },\n  { step: 5, key: 'addons', route: \"cms_addons\", name: 'Add-ons' },\n  { step: 6, key: 'policies_and_faqs', route: \"cms_policies\", name: 'Policies and FAQs' },\n  { step: 7, key: 'marketing', route: \"cms_marketing\", name: 'Marketing and promotion' },\n] as Step[];\n\nexport interface DraftItinerary {\n  id: string,\n  version: string,\n  title: string\n  all_images: CoverImage[],\n  destinations: Destination[]\n  target_country_code: string\n  base_timezone: string\n  base_currency: string\n  commission: number,\n  start_date: string\n  end_date: string\n  min_group_size: string\n  max_group_size: string\n  activity_level: string,\n  itinerary_accommodations: Place[],\n  min_traveler_age: number,\n  max_traveler_age: number,\n  traveler_interests: string[],\n  prelude: string,\n  itinerary_days: ItineraryDay[],\n  payment_date: string,\n  payment_types: string[],\n  refund_due_at: string,\n  transfer_due_at: string,\n  cancellation_due_at: string,\n  allow_deposit_refund: boolean,\n  allow_spot_transfer: boolean,\n  allow_cancellation: boolean,\n  allow_collect_cancellation_fee: boolean,\n  cancellation_fee: number,\n  cancellation_fee_type: string,\n  passport_required: boolean,\n  itinerary_faqs: Faq[],\n  visibility: string | null,\n  steps_done: StepsDone,\n  notified_admin_at: string,\n  product: any,\n  meta: {\n    timezones: Timezone[]\n  }\n}\n\nexport interface Timezone {\n  name: string,\n  identifier: string,\n  label: string,\n}\n\nexport interface Step {\n  key: string,\n  step: number,\n  route: string,\n  name: string\n}\n\nexport interface StepsDone {\n  [key: string]: boolean\n}\n\nexport interface Destination {\n  city?: string,\n  country: string,\n  country_code: string,\n  timezones?: any[],\n}\n\nexport interface SupplierProfile {\n  title: string,\n  image: string,\n  description: string,\n  reviews: SupplierReview[],\n}\n\nexport interface SupplierReview {\n  author: string,\n  message: string,\n  platform: string,\n  deleted?: boolean,\n}\n\nexport interface Place {\n  id: string,\n  name: string,\n  address: string,\n  draft_media: Medium[],\n  show: boolean\n}\n\nexport interface KeyedFunction {\n  [key: string]: Function;\n}\n\nexport interface ItineraryDay {\n  id: string,\n  title: string,\n  overview: string,\n  description: string,\n  itinerary_accommodation?: any,\n  iitnerary_accommodation_id: string,\n  day?: number,\n  date?: string,\n  activities: ItineraryDayActivities[],\n  draft_media: Medium[],\n}\n\nexport interface ItineraryDayActivities {\n  key: string,\n  title?: string,\n  time?: string,\n  transportation_type?: string,\n  duration_length?: number,\n}\n\nexport interface Medium {\n  id: string,\n  key: string,\n  file: File | null,\n  external_url: string | null,\n  title: string,\n  description: string,\n  author_name: string,\n  author_url: string\n  platform: string,\n  platform_url: string,\n  image: {\n    filename: string,\n    url: string,\n  },\n  is_draft: bool | null\n}\n\nexport interface Currency {\n  currency: string,\n  name: string\n}\n\nexport interface Event {\n  id?: string,\n  name: string,\n  starts_at: string | null,\n  ends_at: string | null,\n  min_guest_count: number | null,\n  max_guest_count: number | null,\n  package: {\n    included_in_price: string[],\n    excluded_in_price: string[]\n  },\n  amount_cents: number | null,\n  deposit_amount_cents: number | null,\n  installment_amount_cents: number | null,\n  commission: number | null,\n  draft_media: Medium[],\n  show: boolean\n}\n\nexport interface Addon {\n  id?: string,\n  title: string,\n  description: string,\n  day: number | null,\n  price_cents: number | null,\n  max_guest_count: number | null,\n  draft_media: Medium[],\n  start_at: DateTime,\n  end_at: DateTime,\n  transfer_due_at: DateTime,\n  cancellation_due_at: DateTime,\n  // frontend only\n  show: boolean,\n  allowTransfer?: boolean,\n  allowCancellation?: boolean,\n}\n\nexport interface Faq {\n  id?: string,\n  title: string,\n  description: string,\n  expand?: boolean,\n  editable?: boolean,\n  deleted?: boolean,\n}\n\nexport interface Coupon {\n  id?: string,\n  code: string,\n  discount_percentage: number | null,\n  discount_amount_cents: number | null,\n  max_usage: number | null,\n  is_early_bird: boolean,\n  validity_starts_at: DateTime\n  validity_ends_at: DateTime\n}\n\nexport interface DateTime {\n  date: string | null, // YYYY-MM-DD\n  time: string | null // HH:mm:ss\n}\n\nexport interface CoverImage {\n  id: number,\n  is_cover: boolean,\n  image: {\n    filename: string,\n    url: string\n  }\n}\n\nexport interface CoverImageUpload {\n  id: null,\n  file: File,\n  title: string,\n  description: string,\n  author_name: string,\n  author_url: string,\n  platform: string,\n  platform_url: string,\n}\n\nexport interface HeroProfile {\n  name: string,\n  bio: string,\n  instagram: string,\n  tiktok: string\n}\n","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createStaticVNode as _createStaticVNode } from \"vue\"\n\nconst _hoisted_1 = {\n  viewBox: \"0 0 25 24\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createStaticVNode(\"<g clip-path=\\\"url(#clip0_6376_41025)\\\"><path d=\\\"M23.75 7.75C23.75 9.45 21.213 13.428 20.313 14.786C20.2788 14.8376 20.2324 14.8799 20.1778 14.9091C20.1233 14.9384 20.0624 14.9537 20.0005 14.9537C19.9386 14.9537 19.8777 14.9384 19.8232 14.9091C19.7686 14.8799 19.7222 14.8376 19.688 14.786C18.788 13.429 16.25 9.454 16.25 7.75C16.25 6.75544 16.6451 5.80161 17.3483 5.09835C18.0516 4.39509 19.0054 4 20 4C20.9946 4 21.9484 4.39509 22.6517 5.09835C23.3549 5.80161 23.75 6.75544 23.75 7.75Z\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M20 7.375C20.0995 7.375 20.1948 7.41451 20.2652 7.48484C20.3355 7.55516 20.375 7.65054 20.375 7.75\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M19.625 7.75C19.625 7.65054 19.6645 7.55516 19.7348 7.48484C19.8052 7.41451 19.9005 7.375 20 7.375\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M20 8.125C19.9005 8.125 19.8052 8.08549 19.7348 8.01517C19.6645 7.94484 19.625 7.84946 19.625 7.75\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M20.375 7.75C20.375 7.84946 20.3355 7.94484 20.2652 8.01517C20.1948 8.08549 20.0995 8.125 20 8.125\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M9.5 4.375C9.59946 4.375 9.69484 4.41451 9.76517 4.48484C9.83549 4.55516 9.875 4.65054 9.875 4.75\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M9.125 4.75C9.125 4.65054 9.16451 4.55516 9.23483 4.48484C9.30516 4.41451 9.40054 4.375 9.5 4.375\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M9.5 5.125C9.40054 5.125 9.30516 5.08549 9.23483 5.01516C9.16451 4.94484 9.125 4.84946 9.125 4.75\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M9.875 4.75C9.875 4.84946 9.83549 4.94484 9.76517 5.01516C9.69484 5.08549 9.59946 5.125 9.5 5.125\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M7.25 22.75L23 17.5\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M14.0547 12.9131L16.2417 14.0341\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M5.75 12.625C5.84946 12.625 5.94484 12.6645 6.01516 12.7348C6.08549 12.8052 6.125 12.9005 6.125 13\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M5.375 13C5.375 12.9005 5.41451 12.8052 5.48484 12.7348C5.55516 12.6645 5.65054 12.625 5.75 12.625\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M5.75 13.375C5.65054 13.375 5.55516 13.3355 5.48484 13.2652C5.41451 13.1948 5.375 13.0995 5.375 13\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M6.125 13C6.125 13.0995 6.08549 13.1948 6.01516 13.2652C5.94484 13.3355 5.84946 13.375 5.75 13.375\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M5.75 8.5C6.94347 8.5 8.08807 8.97411 8.93198 9.81802C9.77589 10.6619 10.25 11.8065 10.25 13C10.25 14.921 7.562 18.577 6.341 20.138C6.27085 20.2278 6.18118 20.3004 6.07877 20.3503C5.97637 20.4003 5.86393 20.4262 5.75 20.4262C5.63607 20.4262 5.52363 20.4003 5.42123 20.3503C5.31882 20.3004 5.22915 20.2278 5.159 20.138C3.938 18.576 1.25 14.921 1.25 13C1.25 11.8065 1.72411 10.6619 2.56802 9.81802C3.41193 8.97411 4.55653 8.5 5.75 8.5Z\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M5.865 5.5C5.79523 5.25584 5.75659 5.00385 5.75 4.75C5.75 3.75544 6.14509 2.80161 6.84835 2.09835C7.55161 1.39509 8.50544 1 9.5 1C10.4946 1 11.4484 1.39509 12.1517 2.09835C12.8549 2.80161 13.25 3.75544 13.25 4.75C13.0146 6.12569 12.5045 7.43984 11.75 8.614\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path></g><defs><clipPath id=\\\"clip0_6376_41025\\\"><rect width=\\\"24\\\" height=\\\"24\\\" fill=\\\"white\\\" transform=\\\"translate(0.5)\\\"></rect></clipPath></defs>\", 2)\n  ])))\n}\nexport default { render: render }","function isUndefined(value) {\n  return value === undefined;\n}\n\nfunction isNull(value) {\n  return value === null;\n}\n\nfunction isBoolean(value) {\n  return typeof value === 'boolean';\n}\n\nfunction isObject(value) {\n  return value === Object(value);\n}\n\nfunction isArray(value) {\n  return Array.isArray(value);\n}\n\nfunction isDate(value) {\n  return value instanceof Date;\n}\n\nfunction isBlob(value, isReactNative) {\n  return isReactNative\n    ? isObject(value) && !isUndefined(value.uri)\n    : isObject(value) &&\n        typeof value.size === 'number' &&\n        typeof value.type === 'string' &&\n        typeof value.slice === 'function';\n}\n\nfunction isFile(value, isReactNative) {\n  return (\n    isBlob(value, isReactNative) &&\n    typeof value.name === 'string' &&\n    (isObject(value.lastModifiedDate) || typeof value.lastModified === 'number')\n  );\n}\n\nfunction initCfg(value) {\n  return isUndefined(value) ? false : value;\n}\n\nfunction serialize(obj, cfg, fd, pre) {\n  cfg = cfg || {};\n  fd = fd || new FormData();\n\n  cfg.indices = initCfg(cfg.indices);\n  cfg.nullsAsUndefineds = initCfg(cfg.nullsAsUndefineds);\n  cfg.booleansAsIntegers = initCfg(cfg.booleansAsIntegers);\n  cfg.allowEmptyArrays = initCfg(cfg.allowEmptyArrays);\n  cfg.noAttributesWithArrayNotation = initCfg(\n    cfg.noAttributesWithArrayNotation,\n  );\n  cfg.noFilesWithArrayNotation = initCfg(cfg.noFilesWithArrayNotation);\n  cfg.dotsForObjectNotation = initCfg(cfg.dotsForObjectNotation);\n\n  const isReactNative = typeof fd.getParts === 'function';\n\n  if (isUndefined(obj)) {\n    return fd;\n  } else if (isNull(obj)) {\n    if (!cfg.nullsAsUndefineds) {\n      fd.append(pre, '');\n    }\n  } else if (isBoolean(obj)) {\n    if (cfg.booleansAsIntegers) {\n      fd.append(pre, obj ? 1 : 0);\n    } else {\n      fd.append(pre, obj);\n    }\n  } else if (isArray(obj)) {\n    if (obj.length) {\n      obj.forEach((value, index) => {\n        let key = pre + '[' + (cfg.indices ? index : '') + ']';\n\n        if (\n          cfg.noAttributesWithArrayNotation ||\n          (cfg.noFilesWithArrayNotation && isFile(value, isReactNative))\n        ) {\n          key = pre;\n        }\n\n        serialize(value, cfg, fd, key);\n      });\n    } else if (cfg.allowEmptyArrays) {\n      fd.append(cfg.noAttributesWithArrayNotation ? pre : pre + '[]', '');\n    }\n  } else if (isDate(obj)) {\n    fd.append(pre, obj.toISOString());\n  } else if (isObject(obj) && !isBlob(obj, isReactNative)) {\n    Object.keys(obj).forEach((prop) => {\n      const value = obj[prop];\n\n      if (isArray(value)) {\n        while (prop.length > 2 && prop.lastIndexOf('[]') === prop.length - 2) {\n          prop = prop.substring(0, prop.length - 2);\n        }\n      }\n\n      const key = pre\n        ? cfg.dotsForObjectNotation\n          ? pre + '.' + prop\n          : pre + '[' + prop + ']'\n        : prop;\n\n      serialize(value, cfg, fd, key);\n    });\n  } else {\n    fd.append(pre, obj);\n  }\n\n  return fd;\n}\n\nmodule.exports = {\n  serialize,\n};\n","import { defineStore } from \"pinia\";\nimport { first, last, remove } from 'lodash';\nimport moment from \"moment-timezone\";\nimport { formatUnit } from \"@/utils/stringUtils\";\nimport { Destination, SupplierProfile, Timezone, HeroProfile } from \"@/stores/liteCMS/cmsData\";\nimport { ymd } from \"@/utils/dateUtils\";\n\nexport const useCmsEssentialStore = defineStore('cms_essential', {\n  state: () => ({\n    destinations: [] as Destination[],\n    country: '',\n    countryName: '',\n    timezone: '',\n    tripDates: {\n      startDate: null as string | null,\n      endDate: null as string | null\n    },\n    groupMin: null as number | null,\n    groupMax: null as number | null,\n    activityLevel: '',\n    supplierProfile: null as SupplierProfile | null,\n    heroProfile: null as HeroProfile | null,\n    countryTimezones: [] as Timezone[]\n  }),\n\n  getters: {\n    firstDestination: state => first(state.destinations),\n    lastDestination: state => last(state.destinations),\n    destTimezones: state => state.countryTimezones.map(tz => ({ value: tz.identifier, label: tz.label })),\n    destTimezone: function(state) {\n      const timezones = this.destTimezones as any[];\n      return timezones.find(tz => tz.value === state.timezone);\n    },\n    supplierReviews: state => state.supplierProfile?.reviews.filter(r => !r.deleted) ?? [],\n    tripDuration: state => {\n      const { startDate, endDate } = state.tripDates;\n      if (startDate && endDate) {\n        const days = moment(endDate).diff(moment(startDate), 'days') + 1;\n        return `${formatUnit(days, 'day')} · ${formatUnit(days - 1, 'night')}`\n      }\n      return '';\n    },\n    dayBeforeTrip: state => state.tripDates.startDate ? ymd(moment(state.tripDates.startDate).subtract(1, 'day')) : null,\n  },\n\n  actions: {\n    setup() {\n      if (this.destinations.length === 0) {\n        this.newDestination();\n      }\n    },\n\n    newDestination() {\n      this.destinations.push({ city: '', country: '', country_code: '' });\n    },\n\n    removeDestination(dest: Destination) {\n      this.destinations = this.destinations.filter(x => x !== dest);\n    },\n\n    newSupplierView() {\n      this.supplierProfile?.reviews.push({ author: '', message: '', platform: '' });\n    },\n\n    removeSupplierView(review) {\n      if (review.id) {\n        review.deleted = true;\n        return;\n      }\n      if (this.supplierProfile) {\n        remove(this.supplierProfile.reviews, r => r === review);\n      }\n    },\n\n    defaultItineraryTitle() {\n      let title = `Explore ${this.countryName}`;\n\n      if (this.supplierProfile) {\n        title += ` with ${this.supplierProfile.title}`;\n      }\n\n      return title;\n    }\n  }\n});\n","import { defineStore } from \"pinia\";\nimport { Place } from \"@/stores/liteCMS/cmsData\";\nimport { first, last } from 'lodash';\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore\";\n\nexport const useCmsAccommodationStore = defineStore('cms_accommodation', {\n  state: () => ({\n    places: [] as Place[]\n  }),\n\n  getters: {\n    firstPlace: state => first(state.places),\n    lastPlace: state => last(state.places),\n  },\n\n  actions: {\n    setup() {\n      if (this.places.length === 0) {\n        this.newPlace();\n        this.openLastPlace();\n      }\n    },\n\n    newPlace() {\n      this.places.push({ id: '', name: '', address: '', draft_media: [], show: false });\n    },\n\n    removePlace(place: Place) {\n      const { queueFn, metaStore } = useCmsIndexStore();\n      if (place.id) {\n        queueFn(() => metaStore.apiDelete('accommodations', place.id));\n      }\n      this.places = this.places.filter(x => x !== place);\n    },\n\n    openLastPlace() {\n      this.places.forEach(p => p.show = false);\n      if (this.lastPlace) {\n        this.lastPlace.show = true;\n      }\n    }\n  }\n});","import { defineStore } from \"pinia\";\nimport { ItineraryDay } from '@/stores/liteCMS/cmsData';\nimport { useCmsEssentialStore } from \"@/stores/liteCMS/cmsEssentialsStore\";\nimport { listDays } from \"@/utils/dateUtils\";\nimport { first, last, pullAt } from 'lodash';\nimport { randomKey } from \"@/utils/stringUtils\";\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore\";\n\nexport const useCmsItineraryStore = defineStore('cms_itinerary', {\n  state: () => ({\n    ageMin: null as number | null,\n    ageMax: null as number | null,\n    interests: [] as string[],\n    highlight: '',\n    itineraryDays: [] as ItineraryDay[],\n  }),\n  actions: {\n    setup() {\n      const { tripDates: { startDate, endDate } } = useCmsEssentialStore();\n      const dates = listDays(startDate, endDate);\n      this.itineraryDays.forEach(x => delete (x.day)); // remove day to re-assign\n      for (const [i, date] of dates.entries()) {\n        const isFirst = first(dates) === date;\n        const isLast = last(dates) === date;\n        const defaultTitle = isFirst ? 'Arrival' : isLast ? 'Departure' : '';\n        const day = this.itineraryDays[i];\n        this.itineraryDays[i] = {\n          id: day?.id ?? '',\n          day: i + 1,\n          date: date.format('MMM D, YYYY'),\n          title: day?.title || defaultTitle,\n          overview: day?.overview || '',\n            itinerary_accommodation_id: day?.itinerary_accommodation_id || '',\n              description: day?.description || '',\n                activities: day?.activities ?? [],\n                  draft_media: day?.draft_media ?? [],\n        }\n      if (this.itineraryDays[i].activities.length === 0) {\n        this.addActivity(this.itineraryDays[i]);\n      }\n    }\n      this.removeExtraItineraryDays();\n  },\n  addActivity(day: ItineraryDay) {\n    day.activities.push({ key: randomKey(), title: '', time: '' });\n  },\n  addTransportation(day: ItineraryDay) {\n    day.activities.push({ key: randomKey(), transportation_type: 'self-drive', duration_length: 0 });\n  },\n  onActivityItemMoved({ from, to, oldIndex, newIndex }) {\n    const fromGrp = this.itineraryDays.find(grp => grp.day == from.dataset.day);\n    const toGrp = this.itineraryDays.find(grp => grp.day == to.dataset.day);\n    if (fromGrp && toGrp) {\n      const pulled = pullAt(fromGrp.activities, [oldIndex])[0];\n      toGrp.activities.splice(newIndex, 0, pulled);\n    }\n  },\n  hasAtLeastOneActivityPerDay() {\n    return this.itineraryDays.every(day => day.activities?.[0]?.title || day.activities?.[0]?.transportation_type);\n  },\n  itineraryDayDetailsAreFilled() {\n    return this.itineraryDays.every(day => {\n      const isLast = day === last(this.itineraryDays);\n      return day.overview && day.description && (isLast || day.itinerary_accommodation_id);\n    });\n  },\n  removeExtraItineraryDays() {\n    const { queueFn, metaStore } = useCmsIndexStore();\n    const tobeRemoved = this.itineraryDays.filter(x => !x.day);\n    this.itineraryDays = this.itineraryDays.filter(x => !tobeRemoved.includes(x));\n    tobeRemoved.filter(x => x.id).forEach(x => queueFn(() => metaStore.apiDelete('itinerary_days', x.id)));\n  }\n},\n});\n","import { defineStore } from \"pinia\";\nimport { Event } from \"@/stores/liteCMS/cmsData\";\nimport { useCmsMetaStore } from \"@/stores/liteCMS/cmsMetaStore\";\nimport { xor } from 'lodash';\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore\";\n\nexport const useCmsPricingStore = defineStore('cms_pricing', {\n  state: () => ({\n    currency: '',\n    commission: 0,\n    packages: [] as Event[],\n    paymentTypes: [] as string[], // full, deposit, installment\n    paymentDate: null as string | null,\n  }),\n  getters: {\n    currencyInfo(state) {\n      const metaStore = useCmsMetaStore();\n      if (metaStore.currencies.length > 0 && state.currency) {\n        return metaStore.currencies.find(c => c.currency === state.currency) ?? {};\n      }\n      return {};\n    }\n  },\n  actions: {\n    setup() {\n      if (this.packages.length === 0) {\n        this.newPackage();\n        this.openLastPackage();\n      }\n    },\n\n    newPackage() {\n      this.packages.push({\n        name: '',\n        starts_at: null,\n        ends_at: null,\n        min_guest_count: null,\n        max_guest_count: null,\n        amount_cents: null,\n        deposit_amount_cents: null,\n        installment_amount_cents: null,\n        package: {\n          included_in_price: [],\n          excluded_in_price: []\n        },\n        commission: this.commission,\n        draft_media: [],\n        show: false,\n      });\n    },\n\n    removePackage(event: Event) {\n      const { queueFn, metaStore } = useCmsIndexStore();\n      if (event.id) {\n        queueFn(() => metaStore.apiDelete('events', event.id));\n      }\n      this.packages = this.packages.filter(x => x !== event);\n    },\n\n    togglePaymentType(type: string) {\n      this.paymentTypes = xor(this.paymentTypes, [type]);\n    },\n\n    openLastPackage() {\n      this.packages.forEach(p => p.show = false);\n      const lastPackage = this.packages.at(-1);\n      if (lastPackage) {\n        lastPackage.show = true;\n      }\n    }\n  }\n});\n\n","import { defineStore } from \"pinia\";\nimport { Addon } from \"@/stores/liteCMS/cmsData\";\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore\";\n\nexport const useCmsAddonsStore = defineStore('cms_addons', {\n  state: () => ({\n    addons: [] as Addon[],\n    skipAddon: false,\n  }),\n  getters: {\n    itineraryDays() {\n      const { itineraryStore } = useCmsIndexStore();\n\n      return itineraryStore.itineraryDays.map(x => ({\n        value: x.day,\n        label: [`Day ${x.day}`, x.date, x.title].filter(Boolean).join(' · '),\n      }));\n    }\n  },\n  actions: {\n    setup() {},\n\n    newAddon() {\n      this.addons.push({\n        title: '',\n        description: '',\n        day: null,\n        start_at: { date: null, time: null }, // datetime\n        end_at: { date: null, time: null }, // datetime\n        price_cents: null,\n        max_guest_count: null,\n        transfer_due_at: { date: null, time: null }, // datetime\n        cancellation_due_at: { date: null, time: null }, // datetime\n        draft_media: [],\n        allowTransfer: false,\n        allowCancellation: false,\n        show: false,\n      });\n    },\n\n    removeAddon(addon: Addon) {\n      const { queueFn, metaStore } = useCmsIndexStore();\n      if (addon.id) {\n        queueFn(() => metaStore.apiDelete('addons', addon.id));\n      }\n      this.addons = this.addons.filter(x => x !== addon);\n    },\n\n    openLastAddon() {\n      this.addons.forEach(a => a.show = false);\n      const lastAddon = this.addons.at(-1);\n      if (lastAddon) {\n        lastAddon.show = true;\n      }\n    }\n  }\n});","import { defineStore } from \"pinia\";\nimport { Faq } from \"@/stores/liteCMS/cmsData\";\nimport { sortById } from \"@/utils/arrayUtils\";\nimport { useCmsMetaStore } from \"@/stores/liteCMS/cmsMetaStore\";\n\nexport const useCmsPoliciesStore = defineStore('cms_policies', {\n  state: () => ({\n    cancellation_policy: {\n      no_deposit_refund: false,\n      allow_deposit_refund: false,\n      allow_remaining_refund: false,\n      allow_collect_cancellation_fee: false,\n      allow_spot_transfer: false,\n      use_extra_text: false,\n      refund_due_at: null as string | null,\n      transfer_due_at: null as string | null,\n      cancellation_due_at: null as string | null,\n      cancellation_fees_deadlines: [] as object[],\n      extra_text: '',\n    },\n    passport_required: false,\n    faqs: [] as Faq[],\n    previews: {\n      deposit_policy: '',\n      fully_paid_policy: '',\n      transfer_spot_policy: '',\n      additional_text: '',\n    },\n  }),\n  actions: {\n    setup() {\n      if (this.faqs.length === 0) {\n        this.faqs = this.standardFaqs();\n      }\n    },\n    setFaqsFromApi(data: any[]) {\n      this.faqs = sortById(data).map((f, i) => ({\n        id: f.id, title: f.title, description: f.description, expand: false, editable: i > 3,\n      }));\n    },\n    setCancellationPolicy(data: any) {\n      this.cancellation_policy = {\n        no_deposit_refund: data?.no_deposit_refund || false,\n        allow_deposit_refund: data?.allow_deposit_refund || false,\n        allow_remaining_refund: data?.allow_remaining_refund || false,\n        allow_collect_cancellation_fee: data?.allow_collect_cancellation_fee || false,\n        allow_spot_transfer: data?.allow_spot_transfer || false,\n        use_extra_text: data?.use_extra_text || false,\n        refund_due_at: data?.refund_due_at || null,\n        transfer_due_at: data?.transfer_due_at || null,\n        cancellation_due_at: data?.cancellation_due_at || null,\n        cancellation_fees_deadlines: data?.cancellation_fees_deadlines || [],\n        extra_text: data?.extra_text || '',\n      };\n    },\n    addFeeDeadline() {\n      if (this.cancellation_policy.cancellation_fees_deadlines.length < 3) {\n        this.cancellation_policy.cancellation_fees_deadlines.push({\n          'due_at': null, // YYYY-MM-DD\n          'option': 'cancellation_fee', // cancellation_fee, partial_refund\n          'fee': null, // integer\n          'fee_type': 'fixed', // fixed, percentage\n        });\n      }\n    },\n    standardFaqs() {\n      return [\n        {\n          title: `What happens if I need to cancel my trip?`,\n          description: `Please check the <a href=\"#cancellation-policy\">cancellation policy section</a> on this itinerary page for specific details.`\n        },\n        {\n          title: `Will TourHero or the operator take care of my visa (if applicable)?`,\n          description: `Travelers are responsible for researching visa requirements and obtaining a visa if needed. Please check government websites to ensure you have the necessary documents, along with passport requirements, before your departure date. This includes necessary transit visas, permits, and vaccinations required prior to travel and any required reciprocity fees for the destination. TourHero will provide a booking confirmation document after purchase, which may be needed to obtain a visa.\\n\\nIf your visa is denied for any reason, TourHero will issue a refund based on the cancellation policy. However, we are unable to provide a refund after the cancellation due date has passed.`\n        },\n        {\n          title: `Do I need a passport for this trip?`,\n          description: `A full and valid passport is required for all persons traveling to any destination outside of one’s home country. Most international tours require a passport that's valid for at least six (6) months beyond the scheduled end of your itinerary. TourHero will not issue refunds based on passport issues such as renewals or lost passports.`\n        },\n        {\n          title: `What's included in the price?`,\n          description: `Please check the inclusion and exclusion sections above. You'll find information about included meals, transfers, flights, and activities. If you have any questions or need support, please contact hello@tourhero.com.`\n        },\n      ] as Faq[];\n    },\n    async updatePolicyPreviews() {\n      const metaStore = useCmsMetaStore();\n      this.previews = await metaStore.apiGetPolicyPreivews(this.cancellation_policy);\n    }\n  }\n});\n","import { defineStore } from \"pinia\";\nimport { Coupon } from \"@/stores/liteCMS/cmsData\";\nimport { remove } from \"lodash\";\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore\";\n\nconst coupon = {\n  code: '',\n  discount_percentage: null,\n  discount_amount_cents: null,\n  validity_starts_at: { date: null, time: null },\n  validity_ends_at: { date: null, time: null },\n  max_usage: null,\n};\n\nexport const useCmsMarketingStore = defineStore('cms_marketing', {\n  state: () => ({\n    coupons: [] as Coupon[],\n    addCoupon: false,\n    visibility: null as string | null,\n  }),\n  actions: {\n    setup() {\n      if (this.coupons.length === 0) {\n        this.addCoupon = true;\n      }\n    },\n    createStandardCoupon() {\n      this.coupons.push({ ...coupon, is_early_bird: false });\n      this.addCoupon = false;\n    },\n    createEarlyBirdCoupon() {\n      this.coupons.push({ ...coupon, is_early_bird: true });\n      this.addCoupon = false;\n    },\n    removeCoupon(coupon: Coupon) {\n      const { queueFn, metaStore } = useCmsIndexStore();\n      if (coupon.id) {\n        queueFn(() => metaStore.apiDelete('coupons', coupon.id));\n      }\n      remove(this.coupons, x => x === coupon);\n      this.setup();\n    }\n  }\n});","import { apiWithRetry as api } from \"@/utils/api\";\nimport { defineStore } from \"pinia\";\nimport { steps, Step, Currency, StepsDone, DraftItinerary, CoverImage, CoverImageUpload } from \"@/stores/liteCMS/cmsData\";\nimport { deserializeJsonApi } from \"@/utils/jsonApiDeserializer\";\nimport { nullableInt } from \"@/utils/numberUtils\";\nimport { useCmsEssentialStore } from \"@/stores/liteCMS/cmsEssentialsStore\";\nimport { useCmsAccommodationStore } from \"@/stores/liteCMS/cmsAccommodationStore\";\nimport { useCmsItineraryStore } from \"@/stores/liteCMS/cmsItineraryStore\";\nimport { useCmsPricingStore } from \"@/stores/liteCMS/cmsPricingStore\";\nimport { useCmsAddonsStore } from \"@/stores/liteCMS/cmsAddonsStore\";\nimport { useCmsPoliciesStore } from \"@/stores/liteCMS/cmsPoliciesStore\";\nimport { useCmsMarketingStore } from \"@/stores/liteCMS/cmsMarketingStore\";\nimport { AxiosError } from \"axios\";\nimport { redirectTo } from \"@/utils/functions\";\nimport { nextTick } from \"vue\";\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore\";\nimport { RouteRecordNameGeneric } from \"vue-router\";\nimport moment from \"moment-timezone\";\n\nconst API_VERSION_DIFF_THRESHOLD = 5; // seconds\n\nexport const useCmsMetaStore = defineStore('cms_meta', {\n  state: () => ({\n    id: null as number | null,\n    version: '',\n    title: '',\n    saved: true,\n    progress: 1,\n    stepsDone: {} as StepsDone,\n    validating: null as string | null, // full, basic\n    errors: {} as { [key: string]: boolean | null },\n    currencies: [] as Currency[],\n    productId: '',\n    previewUrl: '',\n    allImages: [] as CoverImage[],\n    featuredImage: null as CoverImage | CoverImageUpload | null,\n    entryRoute: '' as RouteRecordNameGeneric,\n    agreedUpload: false,\n  }),\n\n  getters: {\n    hasNextStep: state => state.progress < 7,\n    prevStep: state => steps.find(s => s.step === state.progress - 1) as Step,\n    nextStep: state => steps.find(s => s.step === state.progress + 1) as Step,\n    currentStep: state => steps.find(s => s.step === state.progress) as Step,\n    currentStepDone: function (state) {\n      return state.stepsDone[this.currentStep.key];\n    },\n    currencyList: state => state.currencies.map(x => ({ value: x.currency, label: `${x.currency} - ${x.name}` })),\n    allStepsDone: state => Object.values(state.stepsDone).every(Boolean),\n  },\n\n  actions: {\n    setup() {\n      const route = this.router.currentRoute.value.name as string;\n      this.setProgress(route);\n      this.setCurrencies();\n    },\n\n    setCurrencies() {\n      const currencyJson = document.getElementById('currencies-json')?.innerHTML || '[]';\n      this.currencies = JSON.parse(currencyJson);\n    },\n\n    isOperator() {\n      return this.router.currentRoute.value.path.includes('/operators/')\n    },\n\n    isTourHero() {\n      return this.router.currentRoute.value.path.includes('/tourhero/')\n    },\n\n    isAdmin() {\n      return this.router.currentRoute.value.path.includes('/admin/')\n    },\n\n    planTripLabel() {\n      return this.isOperator() ? 'Create new itinerary' : 'Plan a trip';\n    },\n\n    apiUrl() {\n      if (this.isOperator()) {\n        return '/api/operator/draft_itineraries';\n      }\n\n      if (this.isTourHero()) {\n        return '/api/hero/draft_itineraries';\n      }\n\n      if (this.isAdmin()) {\n        return '/api/admin/draft_itineraries';\n      }\n    },\n\n    validationCompleted() {\n      return Object.values(this.errors).every(e => typeof e === 'boolean');\n    },\n\n    errorCount() {\n      return Object.values(this.errors).filter(Boolean).length;\n    },\n\n    findRoute(routeName: string) {\n      return steps.find(s => s.route === routeName) as Step;\n    },\n\n    goStep(routeName: string) {\n      if (this.canAccess(routeName)) {\n        const route = { name: routeName } as any;\n        if (this.id) {\n          route.query = { id: this.id };\n        }\n        this.router.push(route);\n        this.setProgress(routeName);\n        this.onStep(routeName);\n      }\n    },\n\n    onStep(routeName: string) {\n      const saved = this.saved;\n      if (routeName === 'cms_essentials') useCmsEssentialStore().setup();\n      if (routeName === 'cms_accommodation') useCmsAccommodationStore().setup();\n      if (routeName === 'cms_itinerary') useCmsItineraryStore().setup();\n      if (routeName === 'cms_pricing') useCmsPricingStore().setup();\n      if (routeName === 'cms_addons') useCmsAddonsStore().setup();\n      if (routeName === 'cms_policies') useCmsPoliciesStore().setup();\n      if (routeName === 'cms_marketing') useCmsMarketingStore().setup();\n      nextTick(() => this.saved = saved);\n    },\n\n    back() {\n      if (this.prevStep) {\n        return this.goStep(this.prevStep.route);\n      }\n      return this.router.push({ name: this.entryRoute || 'cms_dashboard' });\n    },\n\n    next() {\n      if (this.nextStep) {\n        return this.goStep(this.nextStep.route);\n      }\n      alert('There is no next step!');\n    },\n\n    goHome() {\n      const routeName = this.isOperator() ? 'dashboard' : 'home';\n\n      return this.router.push({ name: routeName });\n    },\n\n    goDashboard() {\n      this.router.push({ name: 'cms_dashboard' });\n    },\n\n    async goNewItinerary() {\n      const { bootstrapDraft } = useCmsIndexStore();\n      await bootstrapDraft(null);\n      this.entryRoute = this.router.currentRoute.value.name;\n      this.goStep('cms_essentials');\n    },\n\n    previewItinerary() {\n      if (this.previewUrl) {\n        redirectTo(this.previewUrl, '_blank');\n      } else window.alert('Preview URL missing!');\n    },\n\n    setId(id: any) {\n      this.id = nullableInt(id);\n    },\n\n    addIdToRouteQuery() {\n      const query = { ...this.router.query, id: this.id };\n      const route = { query, meta: { preserveScroll: true } } as any;\n      this.router.replace(route);\n    },\n\n    canAccess(routeName: string): boolean {\n      const route = this.findRoute(routeName);\n      if (!this.id && route.step > 1) {\n        return false; // when no id, only can access essential\n      }\n\n      const prevStep = steps.find(s => s.step === route.step - 1);\n      if (prevStep) {\n        const done = this.stepsDone[route.key];\n        const prevDone = this.stepsDone[prevStep.key];\n        if (!done && !prevDone) {\n          return false; // can only access done step + 1, can not skip ahead.\n        }\n      }\n\n      return true;\n    },\n\n    setProgress(routeName: string = '') {\n      this.progress = this.findRoute(routeName)?.step || 1;\n    },\n\n    onStepsDoneUpdated() {\n      const addonStore = useCmsAddonsStore();\n      addonStore.skipAddon = addonStore.addons.length === 0 && this.stepsDone['addons'];\n    },\n\n    apiResourceUrl(resource = '', resourceId = '', query = {}) {\n      const qs = new URLSearchParams(query).toString();\n      return [this.apiUrl(), this.id, resource, resourceId].filter(Boolean).join('/') + (qs ? `?${qs}` : '');\n    },\n\n    async apiIndex() {\n      const { data } = await api.get(this.apiUrl());\n      return await deserializeJsonApi(data, 'snake_case');\n    },\n\n    async apiGet(resource = '', resourceId = '') {\n      const url = this.apiResourceUrl(resource, resourceId);\n      try {\n        const { data } = await api.get(url);\n        return await deserializeJsonApi(data, 'snake_case');\n      } catch (err) {\n        if (err instanceof AxiosError && err?.response?.status === 422) {\n          return null; // 422 in a get request seems to imply empty content\n        }\n        if (err instanceof AxiosError && err?.response?.status === 403 && resource === '') {\n          return this.goDashboard(); // 403 on the /api/{userType}/draft_itineraries/{id}\n        }\n        throw err;\n      }\n    },\n\n    async apiGetPolicyPreivews(cancellation_policy: any) {\n      const url = this.apiResourceUrl('preview_cancellation_policy');\n      const { data } = await api.post(url, { cancellation_policy });\n      return data;\n    },\n\n    async apiSave(payload: object | FormData, resource = '', resourceId = '', query = {}) {\n      const url = this.apiResourceUrl(resource, resourceId, { version: now(), ...query });\n      const isUpdate = (this.id && !resource) || (this.id && resourceId);\n      const { data } = await (isUpdate ? api.put(url, payload) : api.post(url, payload));\n      return data ? await deserializeJsonApi(data, 'snake_case') : {};\n    },\n\n    async apiSavePool(list: any[], resource: string, payloadMaker: Function, callback = async (_: any) => {\n    }) {\n      const pool = [] as any[];\n      for (const item of list) {\n        const payload = payloadMaker(item);\n        const promise = this.apiSave(payload, resource, item.id).then((res) => {\n          item.id = res.id;\n          return callback(item);\n        });\n        if (item.id) {\n          pool.push(promise); // resource with id can be saved asynchronously\n        } else {\n          await promise; // resource without id save synchronously to preserve order\n        }\n      }\n      await Promise.all(pool);\n    },\n\n    async apiDelete(resource = '', resourceId = '', query = {}) {\n      const url = this.apiResourceUrl(resource, resourceId, { version: now(), ...query });\n      return api.delete(url);\n    },\n\n    async apiSaveDraft(payload: object | FormData, action = '') {\n      return this.apiSave(payload, action);\n    },\n\n    async apiDeleteDraft(itinerary: DraftItinerary) {\n      return this.apiDelete(itinerary.id, '', { version: itinerary.version });\n    },\n\n    async apiConvert() {\n      if (this.previewUrl) {\n        this.apiSaveDraft({}, 'convert');\n      }\n    },\n\n    async apiNotify() {\n      if (this.allStepsDone) {\n        this.apiSaveDraft({}, 'notify');\n      }\n    },\n\n    async apiVersion() {\n      const url = this.apiResourceUrl('ping');\n      const { data } = await api.get(url);\n      return data.version;\n    },\n\n    async validateVersion() {\n      if (this.id && this.version) {\n        const version = await this.apiVersion();\n        const diff = moment(version).diff(this.version, 'seconds');\n        if (diff > API_VERSION_DIFF_THRESHOLD) {\n          throw new Error(\"You are viewing an oudated version, please refresh the page!\");\n        }\n      }\n    }\n  }\n});\n\nconst now = () => moment().utc().format('YYYY-MM-DDTHH:mm:ss[Z]');\n","import { nextTick, ref } from \"vue\";\nimport { defineStore } from \"pinia\";\nimport { nullableInt } from \"@/utils/numberUtils\";\nimport { ymd, hms, datetime } from \"@/utils/dateUtils\";\nimport { serialize } from 'object-to-formdata';\nimport { randomKey } from \"@/utils/stringUtils\";\nimport { DraftItinerary, ItineraryDay, KeyedFunction, Event, Addon, Coupon } from \"@/stores/liteCMS/cmsData\";\nimport { useCmsMetaStore } from \"@/stores/liteCMS/cmsMetaStore\";\nimport { useCmsEssentialStore } from \"@/stores/liteCMS/cmsEssentialsStore\";\nimport { useCmsAccommodationStore } from \"@/stores/liteCMS/cmsAccommodationStore\";\nimport { useCmsItineraryStore } from \"@/stores/liteCMS/cmsItineraryStore\";\nimport { useCmsPricingStore } from \"@/stores/liteCMS/cmsPricingStore\";\nimport { useCmsAddonsStore } from \"@/stores/liteCMS/cmsAddonsStore\";\nimport { useCmsPoliciesStore } from \"@/stores/liteCMS/cmsPoliciesStore\";\nimport { useCmsMarketingStore } from \"@/stores/liteCMS/cmsMarketingStore\";\nimport { apiGet, cachedApiGet } from \"@/utils/api\";\nimport { sortById } from \"@/utils/arrayUtils\";\nimport { until, useDebounceFn, watchIgnorable, watchImmediate } from \"@vueuse/core\";\nimport { useCmsPusher } from \"app/javascript/src/utils/pusher/useCmsPusher\";\n\nexport const useCmsIndexStore = defineStore('cms_index', () => {\n  const bootstrapped = ref(false);\n  const metaStore = useCmsMetaStore();\n  const essentialStore = useCmsEssentialStore();\n  const accommodationStore = useCmsAccommodationStore();\n  const itineraryStore = useCmsItineraryStore();\n  const pricingStore = useCmsPricingStore();\n  const addonsStore = useCmsAddonsStore();\n  const policiesStore = useCmsPoliciesStore();\n  const marketingStore = useCmsMarketingStore();\n\n  let onSaveJobQueue = {} as KeyedFunction;\n  let postSaveJobQueue = {} as KeyedFunction;\n\n  const draftId = new URLSearchParams(location.search).get('id');\n  bootstrapDraft(draftId, false);\n\n  const { ignoreUpdates: cleanUpdate } = watchIgnorable(() => [\n    metaStore.title,\n    metaStore.featuredImage,\n    essentialStore.$state,\n    accommodationStore.$state,\n    itineraryStore.$state,\n    pricingStore.$state,\n    addonsStore.$state,\n    policiesStore.$state,\n    marketingStore.$state,\n  ], () => {\n    if (bootstrapped.value) {\n      metaStore.saved = false;\n    }\n  }, { deep: true });\n\n  watchImmediate(() => metaStore.id, setupPusher);\n\n  function resetAll() {\n    metaStore.$reset();\n    essentialStore.$reset();\n    accommodationStore.$reset();\n    itineraryStore.$reset();\n    pricingStore.$reset();\n    addonsStore.$reset();\n    policiesStore.$reset();\n    marketingStore.$reset();\n  }\n\n  function queueFn(fn: Function, key: string = '') {\n    const fnKey = key || randomKey();\n    if (key.startsWith('post:')) {\n      postSaveJobQueue[fnKey] = fn;\n    } else {\n      onSaveJobQueue[fnKey] = fn;\n    }\n  }\n\n  async function bootstrapDraft(draftId: string | number | null = null, refresh: boolean = true) {\n    if (refresh || !bootstrapped.value) {\n      bootstrapped.value = false;\n      resetAll();\n      if (draftId) {\n        metaStore.setId(draftId);\n        await Promise.all([retrieveDraft(), retrieveEvents(), retrieveAddons(), retrieveCoupons(), setupSupplierOrHeroProfile()]);\n      } else {\n        await Promise.all([setupSupplierOrHeroProfile()]);\n      }\n      metaStore.setup();\n      essentialStore.setup();\n      accommodationStore.setup();\n      itineraryStore.setup();\n      pricingStore.setup();\n      addonsStore.setup();\n      policiesStore.setup();\n      marketingStore.setup();\n      nextTick(() => bootstrapped.value = true);\n    }\n  }\n\n  const saveFn = (callback: Function) => async (validationMode: string) => {\n    // Validation...\n    metaStore.validating = validationMode;\n    await until(() => metaStore.validationCompleted()).toBe(true, { timeout: 1000 });\n    if (metaStore.errorCount() > 0) {\n      return 'VALIDATION_ERRORS';\n    }\n    metaStore.validating = null;\n    // Save to API...\n    try {\n      await metaStore.validateVersion();\n      await Promise.all([callback, ...Object.values(onSaveJobQueue)].map(fn => fn()));\n      await Promise.all(Object.values(postSaveJobQueue).map(fn => fn()));\n      await runPostSaveHooks(); // run on all page saves\n      onSaveJobQueue = {};\n      postSaveJobQueue = {};\n      return true;\n    } catch (err) {\n      return err;\n    }\n  }\n\n  async function fetchDraft() {\n    const api = await metaStore.apiGet() as DraftItinerary;\n    updateImages(api);\n    metaStore.version = api.version;\n    metaStore.title = api.title;\n    metaStore.stepsDone = api.steps_done;\n    metaStore.productId = api.product?.id || '';\n    metaStore.previewUrl = api.product?.meta?.link || '';\n    pricingStore.commission = api.commission || 0;\n    metaStore.onStepsDoneUpdated();\n    return api;\n  }\n\n  async function updateImages(api: DraftItinerary | null = null) {\n    api ??= await metaStore.apiGet() as DraftItinerary;\n    cleanUpdate(() => {\n      metaStore.allImages = api.all_images;\n      metaStore.featuredImage = (api.all_images ?? []).find(x => x.is_cover) ?? null;\n    });\n  }\n\n  async function setupPusher() {\n    if (metaStore.id) {\n      const channel = useCmsPusher().subscribeToDraftItineraryChannel(metaStore.id);\n      channel.bind('image-downloaded', useDebounceFn(() => updateImages(), 3000));\n    }\n  }\n\n  async function runPostSaveHooks() {\n    const api = await fetchDraft();\n    metaStore.apiConvert();\n    if (!api.notified_admin_at) {\n      metaStore.apiNotify();\n    }\n  }\n\n  async function retrieveDraft() {\n    const api = await fetchDraft();\n    essentialStore.groupMin = nullableInt(api.min_group_size);\n    essentialStore.groupMax = nullableInt(api.max_group_size);\n    essentialStore.destinations = api.destinations;\n    essentialStore.country = api.target_country_code;\n    essentialStore.timezone = api.base_timezone;\n    essentialStore.countryTimezones = api.meta.timezones;\n    essentialStore.tripDates = { startDate: api.start_date, endDate: api.end_date }; // YYYY-MM-DD\n    essentialStore.activityLevel = api.activity_level\n    accommodationStore.places = sortById(api.itinerary_accommodations).map(item => ({\n      ...item,\n      draft_media: sortById(item.draft_media),\n      show: true\n    }));\n    itineraryStore.ageMin = api.min_traveler_age;\n    itineraryStore.ageMax = api.max_traveler_age;\n    itineraryStore.interests = api.traveler_interests;\n    itineraryStore.highlight = api.prelude || '';\n\n    itineraryStore.itineraryDays = sortById(api.itinerary_days).map(item => ({\n      ...item,\n      draft_media: sortById(item.draft_media),\n      itinerary_accommodation_id: item.itinerary_accommodation?.id,\n      activities: item.activities.map((act: any) => ({ key: randomKey(), title: act.title, time: act.time, transportation_type: act.transportation_type, duration_length: act.duration_length })),\n    }));\n    pricingStore.currency = api.base_currency;\n    pricingStore.commission = api.commission || 0;\n    pricingStore.paymentTypes = api.payment_types;\n    pricingStore.paymentDate = api.payment_date;\n    policiesStore.passport_required = api.passport_required;\n    policiesStore.setCancellationPolicy(api.product?.cancellation_policy);\n    policiesStore.setFaqsFromApi(api.itinerary_faqs);\n    marketingStore.visibility = api.visibility;\n  }\n\n  async function retrieveEvents() {\n    const api = await metaStore.apiGet('events') ?? [];\n    pricingStore.packages = api.map((evt: any) => ({\n      id: evt.id,\n      name: evt.name,\n      starts_at: ymd(evt.starts_at, evt.timezone),\n      ends_at: ymd(evt.ends_at, evt.timezone),\n      min_guest_count: evt.min_guest_count,\n      max_guest_count: evt.max_guest_count,\n      amount_cents: evt.price.tier_pricing_cents,\n      deposit_amount_cents: evt.price.deposit_price_cents,\n      installment_amount_cents: evt.price.installment_first_period_price_cents,\n      commission: evt.price.commission,\n      package: {\n        included_in_price: evt.included_in_price,\n        excluded_in_price: evt.excluded_in_price,\n      },\n      draft_media: sortById(evt.draft_media),\n      show: true\n    }));\n  }\n\n  async function retrieveAddons() {\n    const api = await metaStore.apiGet('addons') ?? [];\n    addonsStore.addons = api.map((a: any) => ({\n      id: a.id,\n      title: a.title,\n      description: a.description,\n      day: a.day,\n      price_cents: a.price_cents,\n      max_guest_count: a.max_guest_count,\n      draft_media: sortById(a.draft_media),\n      start_at: { date: ymd(a.start_at, a.timezone), time: hms(a.start_at, a.timezone) },\n      end_at: { date: ymd(a.end_at, a.timezone), time: hms(a.end_at, a.timezone) },\n      transfer_due_at: { date: ymd(a.transfer_due_at, a.timezone), time: hms(a.transfer_due_at, a.timezone) },\n      cancellation_due_at: { date: ymd(a.cancellation_due_at, a.timezone), time: hms(a.cancellation_due_at, a.timezone) },\n      allowTransfer: Boolean(a.transfer_due_at),\n      allowCancellation: Boolean(a.cancellation_due_at),\n      show: true\n    }));\n  }\n\n  async function retrieveCoupons() {\n    const api = await metaStore.apiGet('coupons') ?? [];\n    marketingStore.coupons = api.map((c: any) => ({\n      id: c.id,\n      code: c.code,\n      max_usage: c.max_usage,\n      is_early_bird: c.is_early_bird,\n      discount_percentage: c.discount_percentage,\n      discount_amount_cents: c.discount_amount_cents,\n      validity_starts_at: { date: ymd(c.validity_starts_at_local), time: hms(c.validity_starts_at_local) },\n      validity_ends_at: { date: ymd(c.validity_ends_at_local), time: hms(c.validity_ends_at_local) },\n    }));\n  }\n\n  async function setupSupplierOrHeroProfile() {\n    const metaStore = useCmsMetaStore();\n\n    if (metaStore.isOperator() && essentialStore.supplierProfile === null) {\n      essentialStore.supplierProfile = await retrieveSupplierProfile(true);\n    }\n\n    if (metaStore.isTourHero() && essentialStore.heroProfile === null) {\n      essentialStore.heroProfile = await retrieveHeroProfile(true);\n    }\n  }\n\n  async function retrieveSupplierProfile(cached = false) {\n    const url = '/api/operator/supplier';\n    const supplier = cached ? await cachedApiGet(url) : await apiGet(url);\n    return {\n      title: supplier.title,\n      description: supplier.description,\n      image: supplier.image?.url || '',\n      reviews: sortById(supplier.supplierReviews).map(r => ({\n        id: r.id,\n        author: r.author,\n        message: r.message,\n        platform: r.platformLogo\n      }))\n    };\n  }\n\n  async function retrieveHeroProfile(cached = false) {\n    const url = '/api/hero/profile';\n    const hero = cached ? await cachedApiGet(url) : await apiGet(url);\n    return {\n      name: hero.name,\n      bio: hero.bio,\n      instagram: hero.instagramUsername,\n      tiktok: hero.tiktokUsername,\n      image: hero.image?.url || '',\n    };\n  }\n\n  async function saveOnEssentialPage() {\n    metaStore.title ||= essentialStore.defaultItineraryTitle();\n    const draft_itinerary = {\n      title: metaStore.title,\n      min_group_size: essentialStore.groupMin,\n      max_group_size: essentialStore.groupMax,\n      destinations: essentialStore.destinations,\n      target_country_code: essentialStore.country,\n      base_timezone: essentialStore.timezone,\n      start_date: essentialStore.tripDates.startDate,\n      end_date: essentialStore.tripDates.endDate,\n      activity_level: essentialStore.activityLevel,\n    };\n    const res = await metaStore.apiSaveDraft({ draft_itinerary });\n    metaStore.setId(res.id);\n    metaStore.addIdToRouteQuery();\n  }\n\n  async function saveOnAccommodationPage() {\n    await metaStore.apiSavePool(\n      accommodationStore.places,\n      'accommodations',\n      (place: any) => ({ accommodation: { name: place.name, address: place.address } }),\n      (place: any) => metaStore.apiSavePool(place.draft_media, 'media', (medium: any) => serialize({ itinerary_accommodation_id: place.id, medium }))\n    );\n  }\n\n  async function saveOnItineraryPage() {\n    const draft_itinerary = {\n      min_traveler_age: itineraryStore.ageMin,\n      max_traveler_age: itineraryStore.ageMax,\n      traveler_interests: itineraryStore.interests,\n      prelude: itineraryStore.highlight,\n    };\n\n    const saveMain = metaStore.apiSaveDraft({ draft_itinerary });\n    const saveDays = metaStore.apiSavePool(\n      itineraryStore.itineraryDays,\n      'itinerary_days',\n      (day: ItineraryDay) => ({\n        itinerary_day: {\n          title: day.title,\n          overview: day.overview,\n          description: day.description,\n          itinerary_accommodation_id: day.itinerary_accommodation_id,\n          activities: day.activities.filter(act => act.title || act.transportation_type)\n        }\n      }),\n      (day: any) => metaStore.apiSavePool(day.draft_media, 'media', (medium: any) => serialize({ itinerary_day_id: day.id, medium }))\n    );\n\n    await Promise.all([saveMain, saveDays]);\n  }\n\n  async function saveOnPricingPage() {\n    const draft = metaStore.apiSaveDraft({\n      draft_itinerary: {\n        base_currency: pricingStore.currency,\n        payment_date: pricingStore.paymentDate,\n        payment_types: pricingStore.paymentTypes,\n      }\n    });\n    const events = metaStore.apiSavePool(\n      pricingStore.packages,\n      'events',\n      (event: Event) => ({\n        event: {\n          ...event,\n          deposit_amount_cents: pricingStore.packages[0].deposit_amount_cents,\n          installment_amount_cents: pricingStore.packages[0].installment_amount_cents,\n        }\n      }),\n      (event: Event) => metaStore.apiSavePool(event.draft_media, 'media', (medium: any) => serialize({ event_id: event.id, medium }))\n    );\n    await Promise.all([draft, events]);\n  }\n\n  async function saveOnAddonsPage() {\n    const draft = metaStore.apiSaveDraft({ addons_completed: true });\n    const addons = metaStore.apiSavePool(\n      addonsStore.addons,\n      'addons',\n      (addon: Addon) => ({\n        ...addon,\n        start_at: datetime(addon.start_at)?.format('YYYY-MM-DDTHH:mm:ss'),\n        end_at: datetime(addon.end_at)?.format('YYYY-MM-DDTHH:mm:ss'),\n        transfer_due_at: datetime(addon.transfer_due_at)?.format('YYYY-MM-DDTHH:mm:ss'),\n        cancellation_due_at: datetime(addon.cancellation_due_at)?.format('YYYY-MM-DDTHH:mm:ss'),\n      }),\n      (addon: Addon) => metaStore.apiSavePool(addon.draft_media, 'media', (medium: any) => serialize({ addon_id: addon.id, medium }))\n    );\n    await Promise.all([draft, addons]);\n  }\n\n  async function saveOnPoliciesPage() {\n    const draft_itinerary = {\n      passport_required: policiesStore.passport_required,\n      itinerary_faqs_attributes: policiesStore.faqs.filter(x => x.title).map(x => ({\n        id: x.id,\n        title: x.title,\n        description: x.description,\n        _destroy: x.deleted ?? false\n      }))\n    };\n\n    const api = await metaStore.apiSaveDraft({\n      draft_itinerary,\n      cancellation_policy: policiesStore.cancellation_policy\n    });\n    policiesStore.setFaqsFromApi(api.itinerary_faqs);\n  }\n\n  async function saveOnMarketingPage() {\n    const draft = metaStore.apiSaveDraft({\n      draft_itinerary: {\n        visibility: marketingStore.visibility,\n        coupons_completed: true,\n      }\n    }).then(draftItinerary => {\n      if (draftItinerary.version) {\n        metaStore.version = draftItinerary.version;\n      }\n    });\n\n    const coupons = metaStore.apiSavePool(\n      marketingStore.coupons,\n      'coupons',\n      (coupon: Coupon) => ({\n        ...coupon,\n        validity_starts_at: datetime(coupon.validity_starts_at)?.format('YYYY-MM-DDTHH:mm:ss'),\n        validity_ends_at: datetime(coupon.validity_ends_at)?.format('YYYY-MM-DDTHH:mm:ss'),\n      })\n    );\n\n    await Promise.all([draft, coupons]);\n  }\n\n  return {\n    queueFn,\n    bootstrapDraft,\n    markDirty: () => metaStore.saved = false,\n    metaStore,\n    essentialStore,\n    accommodationStore,\n    itineraryStore,\n    pricingStore,\n    addonsStore,\n    policiesStore,\n    marketingStore,\n    saveOnEssentialPage: saveFn(saveOnEssentialPage),\n    saveOnAccommodationPage: saveFn(saveOnAccommodationPage),\n    saveOnItineraryPage: saveFn(saveOnItineraryPage),\n    saveOnPricingPage: saveFn(saveOnPricingPage),\n    saveOnAddonsPage: saveFn(saveOnAddonsPage),\n    saveOnPoliciesPage: saveFn(saveOnPoliciesPage),\n    saveOnMarketingPage: saveFn(saveOnMarketingPage),\n    retrieveSupplierProfile,\n    retrieveHeroProfile,\n  };\n});\n","import COUNTRIES from '@/dataset/countries.json';\n\nexport function keyedCountries() {\n  return Object.fromEntries(COUNTRIES.map(c => [c.alpha2, c]));\n}","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createStaticVNode as _createStaticVNode } from \"vue\"\n\nconst _hoisted_1 = {\n  viewBox: \"0 0 24 24\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createStaticVNode(\"<g clip-path=\\\"url(#clip0_5431_14203)\\\"><path d=\\\"M13.044 14.136L9.33203 14.667L9.86203 10.954L19.408 1.40804C19.83 0.986078 20.4023 0.749023 20.999 0.749023C21.2945 0.749023 21.5871 0.807222 21.8601 0.920296C22.1331 1.03337 22.3811 1.1991 22.59 1.40804C22.799 1.61697 22.9647 1.86501 23.0778 2.13799C23.1908 2.41098 23.249 2.70356 23.249 2.99904C23.249 3.29451 23.1908 3.5871 23.0778 3.86008C22.9647 4.13306 22.799 4.3811 22.59 4.59004L13.044 14.136Z\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M18.3477 2.46875L21.5297 5.65075\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M18.75 14.25V21.75C18.75 22.1478 18.592 22.5294 18.3107 22.8107C18.0294 23.092 17.6478 23.25 17.25 23.25H2.25C1.85218 23.25 1.47064 23.092 1.18934 22.8107C0.908035 22.5294 0.75 22.1478 0.75 21.75V6.75C0.75 6.35218 0.908035 5.97064 1.18934 5.68934C1.47064 5.40804 1.85218 5.25 2.25 5.25H9.75\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path></g><defs><clipPath id=\\\"clip0_5431_14203\\\"><rect width=\\\"24\\\" height=\\\"24\\\" fill=\\\"white\\\"></rect></clipPath></defs>\", 2)\n  ])))\n}\nexport default { render: render }","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createStaticVNode as _createStaticVNode } from \"vue\"\n\nconst _hoisted_1 = {\n  viewBox: \"0 0 24 24\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createStaticVNode(\"<g clip-path=\\\"url(#clip0_5431_14207)\\\"><path d=\\\"M1.5 4.5H22.5\\\" stroke=\\\"currentColor\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M14.25 1.5H9.75C9.35218 1.5 8.97064 1.65804 8.68934 1.93934C8.40804 2.22064 8.25 2.60218 8.25 3V4.5H15.75V3C15.75 2.60218 15.592 2.22064 15.3107 1.93934C15.0294 1.65804 14.6478 1.5 14.25 1.5Z\\\" stroke=\\\"currentColor\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M9.75 17.25V9.75\\\" stroke=\\\"currentColor\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M14.25 17.25V9.75\\\" stroke=\\\"currentColor\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M18.865 21.124C18.8339 21.4991 18.6629 21.8488 18.386 22.1037C18.109 22.3586 17.7464 22.5 17.37 22.5H6.631C6.25462 22.5 5.89198 22.3586 5.61504 22.1037C5.33811 21.8488 5.16711 21.4991 5.136 21.124L3.75 4.5H20.25L18.865 21.124Z\\\" stroke=\\\"currentColor\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path></g><defs><clipPath id=\\\"clip0_5431_14207\\\"><rect width=\\\"24\\\" height=\\\"24\\\" fill=\\\"white\\\"></rect></clipPath></defs>\", 2)\n  ])))\n}\nexport default { render: render }","import { ref } from 'vue'\nimport { createInjectionState, until } from '@vueuse/core'\n\nexport const useConfirmationDialog = (key: string = 'DEFAULT') => {\n  const [provide, inject] = createInjectionState(\n    () => {\n      const show = ref(false);\n      const action = ref('');\n      const confirmFns = ref([] as Function[]);\n\n      async function open() {\n        show.value = true;\n        await handleAction();\n        close();\n      }\n\n      function close() {\n        action.value = '';\n        show.value = false;\n      }\n\n      function onConfirm(callback: Function) {\n        confirmFns.value.push(callback);\n      }\n\n      async function handleAction() {\n        await until(action).toBeTruthy();\n\n        if (action.value === 'confirmed') {\n          try {\n            await Promise.all(confirmFns.value.map(async fn => fn()));\n          } catch (err: any) {\n            const errorMessage = err?.response?.data?.errors?.join('; ') || err;\n            alert(errorMessage);\n          }\n          confirmFns.value = [];\n        }\n      }\n\n      return { show, action, open, onConfirm };\n    },\n    { injectionKey: `CONFIRMATION_DIALOG:${key}` }\n  );\n\n  return { provide, inject };\n};\n","<template>\n  <ConfirmationDialog\n    v-bind=\"$attrs\"\n    :show=\"show\"\n    @confirm=\"action = 'confirmed'\"\n    @cancel=\"action = 'cancelled'\"\n  />\n</template>\n\n<script setup>\nimport ConfirmationDialog from \"@/components/ConfirmationDialog/ConfirmationDialog.vue\";\nimport { useConfirmationDialog } from \"@/components/ConfirmationDialog/StatefulConfirmationDialog.ts\";\n\nconst props = defineProps({ name: String });\n\nconst { show, action } = useConfirmationDialog(props.name).inject();\n</script>","<template>\n  <div class=\"container\">\n    <BackButton @back=\"metaStore.goHome()\"/>\n\n    <template v-if=\"itineraries && itineraries.length > 0\">\n      <div class=\"page-title\">Draft trips</div>\n      <div class=\"itineraries\">\n        <div v-for=\"item in itineraries\" class=\"itinerary\" @click=\"gotoItinerary(item)\" role=\"button\">\n          <div class=\"profile-image\">\n            <img v-if=\"profileImage\" :src=\"profileImage\">\n            <DefaultAvatarIcon v-else width=\"100%\"/>\n          </div>\n\n          <div class=\"detail\">\n            <div class=\"detail-line\">\n              <div class=\"country\">{{ countryDisplay(item.target_country_code) }}</div>\n              <div v-if=\"item.product\" class=\"id\">ID: {{ item.product.id }}</div>\n            </div>\n            <div class=\"title\">{{ item.title ?? placeholder }}</div>\n            <div class=\"date\">{{ dateRangeDisplay(item) }}</div>\n            <DashboardItineraryProgress class=\"progress\" :done=\"item.steps_done\"/>\n            <div class=\"buttons\">\n              <EditIcon width=\"24\" @click.stop=\"gotoItinerary(item)\"/>\n              <DeleteIcon class=\"delete-icon\" width=\"24\" @click.stop=\"removeItinerary(item)\"/>\n            </div>\n          </div>\n        </div>\n      </div>\n\n      <div class=\"page-title\">Plan more trips</div>\n      <div class=\"plan-trips\">\n        <MapIcon width=\"24\"/>\n        <div>Thinking about more trips?</div>\n        <button @click=\"metaStore.goNewItinerary()\">{{ metaStore.planTripLabel() }} <i class=\"icon icon-arrow-right-1\"></i></button>\n      </div>\n    </template>\n\n    <div v-else-if=\"itineraries && itineraries.length === 0\" class=\"no-trip\">\n      <img class=\"cover-image\" src=\"app/assets/images/heroDashboard/upcoming_cover.png\"/>\n      <div class=\"page-title\">No draft trips yet</div>\n      <div>Create your first itinerary instantly, whether you are planning with us or on your own.</div>\n      <div class=\"quick-tip\">\n        <div class=\"heading\">\n          <img src=\"app/assets/images/cms/lightbulb.png\">\n          <span>Quick tip</span>\n        </div>\n        <div>With TourHero, you can get payout support, as well as manage travelers and bookings all in one place.</div>\n      </div>\n      <div class=\"mobile-bottom-section\">\n        <Button color=\"primary\" color-filled @click=\"metaStore.goNewItinerary()\">{{ metaStore.planTripLabel() }}</Button>\n      </div>\n    </div>\n  </div>\n\n  <StatefulConfirmationDialog\n    title=\"Are you sure you want to delete this draft itinerary?\"\n    confirm=\"Confirm delete\"\n    cancel=\"Back\"\n    description=\"Once you delete, your changes will not be saved.\"\n  />\n</template>\n\n<script setup lang=\"ts\">\nimport moment from \"moment-timezone\";\nimport { ref, onMounted } from \"vue\";\nimport { DraftItinerary } from \"@/stores/liteCMS/cmsData\";\nimport BackButton from \"@/modules/LiteCMS/Common/BackButton.vue\";\nimport DefaultAvatarIcon from 'app/assets/images/cms/default_avatar.svg?component';\nimport DashboardItineraryProgress from \"@/modules/LiteCMS/Dashboard/DashboardItineraryProgress.vue\";\nimport MapIcon from 'app/assets/images/cms/map.svg?component';\nimport { Button } from \"@/components/Theme/index.js\";\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore\";\nimport { keyedCountries } from \"@/helpers/dataHelpers\";\nimport { formatUnit } from \"@/utils/stringUtils\";\nimport EditIcon from 'app/assets/images/operatorDashboard/edit.svg?component';\nimport DeleteIcon from 'app/assets/images/operatorDashboard/delete.svg?component';\nimport StatefulConfirmationDialog from \"@/components/ConfirmationDialog/StatefulConfirmationDialog.vue\";\nimport { useConfirmationDialog } from \"@/components/ConfirmationDialog/StatefulConfirmationDialog\";\nimport { cachedApiGet } from \"@/utils/api\";\nimport { sortById } from \"@/utils/arrayUtils\";\n\nconst placeholder = '—';\nconst profileImage = ref('');\nconst itineraries = ref(null as DraftItinerary[] | null);\nconst { bootstrapDraft, metaStore } = useCmsIndexStore();\nconst confirmDelete = useConfirmationDialog().provide();\n\nonMounted(async () => {\n  loadItineraries();\n  setProfileImage();\n});\n\nasync function loadItineraries() {\n  const data = await metaStore.apiIndex();\n  itineraries.value = sortById(data, 'desc');\n}\n\nasync function setProfileImage() {\n  const supplier = await cachedApiGet('/api/operator/supplier');\n  profileImage.value = supplier.image?.url || '';\n}\n\nasync function gotoItinerary(itinerary: DraftItinerary) {\n  await bootstrapDraft(itinerary.id);\n  metaStore.goStep('cms_essentials');\n}\n\nasync function removeItinerary(itinerary: DraftItinerary) {\n  confirmDelete.open();\n  confirmDelete.onConfirm(async () => {\n    await metaStore.apiDeleteDraft(itinerary);\n    await loadItineraries();\n  });\n}\n\nfunction dateRangeDisplay(itinerary: DraftItinerary): string {\n  if (itinerary.start_date && itinerary.end_date) {\n    const start = moment(itinerary.start_date);\n    const end = moment(itinerary.end_date);\n    const formattedDate = start.format('MMM D, YYYY');\n    const nights = end.diff(start, 'days');\n    return [formattedDate, nights && formatUnit(nights, 'night')].filter(Boolean).join(' · ');\n  }\n  return placeholder;\n}\n\nfunction countryDisplay(countryCode: string) {\n  const countries = keyedCountries();\n  return countries[countryCode]?.name || placeholder;\n}\n</script>\n\n<style lang=\"scss\" scoped>\n@import \"app/assets/stylesheets/litecms\";\n\n.itineraries {\n  display: grid;\n  gap: $spacing-6;\n  @include desktop {\n    grid-template-columns: 1fr 1fr 1fr;\n  }\n}\n\n.itinerary {\n  position: relative;\n  border: 1px solid $gray-lighter;\n  border-radius: $rounded;\n  padding: $spacing-4;\n  display: grid;\n  grid-template-columns: 48px 1fr;\n  gap: $spacing-4;\n  cursor: pointer;\n\n  .profile-image img {\n    width: 100%;\n    aspect-ratio: 1;\n    object-fit: cover;\n    border-radius: 50%;\n  }\n\n  .detail {\n    display: grid;\n    gap: $spacing-3;\n\n    .buttons {\n      display: flex;\n      gap: $spacing-3;\n\n      svg {\n        cursor: pointer;\n      }\n    }\n\n    .progress, .buttons {\n      margin-top: $spacing-1;\n    }\n  }\n\n  .detail-line {\n    display: flex;\n    align-items: start;\n    justify-content: space-between;\n    font-weight: $font-semibold;\n    gap: $spacing-2;\n  }\n\n  .id, .country, .date {\n    font-size: $text-xs;\n    line-height: 1.167;\n    color: $gray;\n    text-transform: uppercase;\n  }\n}\n\n.plan-trips {\n  border: 1px solid $gray-lighter;\n  border-radius: $rounded;\n  padding: 30px;\n  @include flex-column;\n  align-items: center;\n  gap: $spacing-4;\n\n  div {\n    font-weight: $font-semibold;\n  }\n\n  button {\n    color: $brand-tertiary;\n    font-weight: $font-semibold;\n  }\n\n  .icon {\n    font-size: $text-xs;\n    line-height: 1;\n  }\n}\n\n.delete {\n  position: absolute;\n  right: $spacing-4;\n  bottom: $spacing-3;\n\n  &:hover :deep(svg path) {\n    stroke: $brand-tertiary;\n  }\n}\n\n.no-trip {\n  display: grid;\n  place-items: start;\n  gap: $spacing-6;\n\n  @include desktop {\n    grid-template-columns: 1fr 1fr;\n  }\n\n  div {\n    grid-column: 1;\n  }\n\n  .cover-image {\n    grid-row: 1 / span 5;\n    grid-column: 2;\n    width: 100%;\n    @include hide-on-mobile;\n  }\n\n  .quick-tip {\n    display: grid;\n    gap: $spacing-3;\n    padding: $spacing-6;\n    background-color: $brand-tertiary-light;\n    border-radius: $rounded;\n    max-width: 357px;\n    margin-bottom: $spacing-10;\n\n    .heading {\n      display: flex;\n      align-items: center;\n      gap: $spacing-1;\n    }\n\n    span {\n      text-transform: uppercase;\n      font-size: $text-sm;\n      line-height: $text-base;\n      font-weight: $font-bold;\n    }\n\n    img {\n      width: 16px;\n    }\n  }\n}\n\n.delete-icon {\n  color: $brand-secondary;\n}\n</style>\n","<template>\n  <div class=\"itinerary-card\">\n    <div class=\"detail\">\n      <div class=\"detail-line\">\n        <div class=\"country\">\n          {{ countryDisplay(item.target_country_code) }}\n        </div>\n        <div v-if=\"item.product\" class=\"id\">ID: {{ item.product.id }}</div>\n      </div>\n      <div class=\"title\">{{ item.title ?? placeholder }}</div>\n      <div class=\"date\">{{ dateRangeDisplay(item) }}</div>\n      <SimpleProgress :progress />\n      <div class=\"buttons\">\n        <EditIcon width=\"24\" @click.stop=\"gotoItinerary(item)\" />\n        <DeleteIcon v-if=\"item.object_type !== 'itinerary_request'\" width=\"24\" @click.stop=\"removeItinerary(item.id)\" />\n      </div>\n    </div>\n  </div>\n</template>\n\n<script setup>\nimport { computed } from 'vue';\nimport moment from \"moment-timezone\";\nimport EditIcon from \"app/assets/images/operatorDashboard/edit.svg?component\";\nimport DeleteIcon from \"app/assets/images/operatorDashboard/delete.svg?component\";\nimport { formatUnit } from \"@/utils/stringUtils\";\nimport { keyedCountries } from \"@/helpers/dataHelpers\";\nimport { steps } from \"@/stores/liteCMS/cmsData\";\nimport { SimpleProgress } from '@/components/Theme';\nimport { useShared } from \"@/helpers/vueHelpers.js\";\n\nconst { t } = useShared();\nconst placeholder = \"-\";\nconst datePlaceholder = t('date_placeholder');\nconst stepCount = steps.length;\n\nconst { item } = defineProps({\n  item: Object,\n  profileImage: String,\n});\n\nconst stepsDone = item.steps_done ? Object.values(item.steps_done).filter(step => step).length : 1;\n\nconst emit = defineEmits([\"gotoItinerary\", \"removeItinerary\"]);\n\nconst progress = computed(() => Math.floor((stepsDone / stepCount) * 100))\n\nfunction countryDisplay(countryCode) {\n  const countries = keyedCountries();\n  return countries[countryCode]?.name || placeholder;\n}\n\nfunction dateRangeDisplay(itinerary) {\n  if (itinerary.object_type === 'itinerary_request') {\n    return displayItineraryRequestDate(itinerary);\n  } else if (itinerary.start_date && itinerary.end_date) {\n    const start = moment(itinerary.start_date);\n    const end = moment(itinerary.end_date);\n    const formattedDate = start.format(\"MMM D, YYYY\");\n    const nights = end.diff(start, \"days\");\n    const dates = [formattedDate, nights && formatUnit(nights, \"night\")]\n      .filter(Boolean)\n      .join(\" · \");\n\n    if (dates.length) {\n      return dates;\n    }\n  }\n  return datePlaceholder;\n}\n\nfunction displayItineraryRequestDate(itineraryRequest) {\n  const text = [];\n  if (itineraryRequest.formatted_first_date) {\n    text.push(itineraryRequest.formatted_first_date);\n  }\n  if (itineraryRequest.duration_nights) {\n    text.push(formatUnit(itineraryRequest.duration_nights, 'night'));\n  }\n  if (text.length) {\n    return text.join(\" · \");\n  }\n  return datePlaceholder;\n}\n\nfunction gotoItinerary(item) {\n  emit(\"gotoItinerary\", item);\n}\n\nfunction removeItinerary(id) {\n  emit(\"removeItinerary\", id);\n}\n</script>\n\n<style lang=\"scss\" scoped>\n@import \"app/assets/stylesheets/litecms\";\n\n.itinerary-card {\n  position: relative;\n  border: 1px solid $gray-lighter;\n  border-radius: $rounded;\n  padding: $spacing-4;\n  display: grid;\n  grid-template-columns: 1fr;\n  gap: $spacing-4;\n  cursor: pointer;\n\n  .detail {\n    display: grid;\n    gap: $spacing-3;\n\n    .buttons {\n      display: flex;\n      gap: $spacing-3;\n      margin-bottom: 8px;\n\n      svg {\n        cursor: pointer;\n      }\n    }\n\n    .progress,\n    .buttons {\n      margin-top: $spacing-1;\n    }\n  }\n\n  .detail-line {\n    display: flex;\n    align-items: start;\n    justify-content: space-between;\n    font-weight: $font-semibold;\n    gap: $spacing-2;\n  }\n\n  .id,\n  .country,\n  .date {\n    font-size: $text-xs;\n    line-height: 1.167;\n    color: $gray;\n    text-transform: uppercase;\n  }\n\n  .date {\n    margin-bottom: 4px;\n  }\n}\n</style>\n\n<i18n lang=\"yaml\">\nen:\n  date_placeholder: Pending dates\n</i18n>\n","<template>\n  <div class=\"how-it-works\">\n    <H4 color=\"primary\">{{ t(\"how_it_works\") }}</H4>\n    <ol class=\"steps\">\n      <li class=\"step\">\n        <span class=\"number\">1</span>\n        <span class=\"text\">{{ t(\"step1\") }}</span>\n      </li>\n      <li class=\"step\">\n        <span class=\"number\">2</span>\n        <span class=\"text\">{{ t(\"step2\") }}</span>\n      </li>\n      <li class=\"step\">\n        <span class=\"number\">3</span>\n        <span class=\"text\">{{ t(\"step3\") }}</span>\n      </li>\n    </ol>\n  </div>\n</template>\n\n<script setup>\nimport { H4 } from \"@/components/Theme\";\nimport { useShared } from \"@/helpers/vueHelpers.js\";\nconst { t } = useShared();\n</script>\n\n<style lang=\"scss\" scoped>\n.how-it-works {\n  box-sizing: border-box;\n  @include flex-column;\n  align-items: flex-start;\n  padding: 32px;\n  gap: 24px;\n  border: 1px solid #e6e6e6;\n  border-radius: 5px;\n}\n\n.steps {\n  @include flex-column;\n  align-items: flex-start;\n  padding: 0;\n  gap: 24px;\n  list-style-type: none;\n  margin: 0;\n}\n\n.step {\n  display: flex;\n  flex-direction: row;\n  align-items: flex-start;\n  padding: 0;\n  gap: 12px;\n}\n\n.number {\n  color: $brand-tertiary;\n  font-weight: 700;\n}\n</style>\n\n<i18n lang=\"yaml\">\nen:\n  how_it_works: How it works\n  step1: Create and modify your dream itinerary\n  step2: Share your draft itinerary with friends\n  step3: Publish your itinerary and let your unforgettable journey begin\n</i18n>\n","<template>\n  <div class=\"container\">\n    <BackButton @back=\"metaStore.goHome()\"/>\n\n    <div v-if=\"itineraries && itineraries.length > 0\">\n      <header class=\"page-title\">Draft trips</header>\n      <div class=\"draft-itineraries\">\n\n        <div class=\"lite__container\">\n          <H4 class=\"lite__header\" color=\"primary\">{{ t('lite_header') }}</H4>\n          <div class=\"lite-itineraries\">\n            <div v-for=\"item in itineraries\" class=\"itinerary\" @click=\"gotoItinerary(item)\" role=\"button\">\n              <DraftItineraryCard :item :profileImage @gotoItinerary=\"gotoItinerary\" @removeItinerary=\"removeItinerary\"/>\n            </div>\n          </div>\n        </div>\n\n        <HowItWorks />\n      </div>\n    </div>\n\n    <div v-else-if=\"itineraries && itineraries.length === 0\" class=\"no-trip\">\n      <img class=\"cover-image\" src=\"app/assets/images/heroDashboard/upcoming_cover.png\"/>\n      <header class=\"page-title\">{{ t('no_trip_title') }}</header>\n      <p>{{ t('no_trip_description') }}</p>\n      <div class=\"quick-tip\">\n        <div class=\"heading\">\n          <img src=\"app/assets/images/cms/lightbulb.png\">\n          <span>{{ t('quick_tip_title') }}</span>\n        </div>\n        <p> {{ t('quick_tip_description') }} </p>\n      </div>\n      <div class=\"mobile-bottom-section\">\n        <Button color=\"primary\" color-filled @click=\"metaStore.goNewItinerary()\">{{ metaStore.planTripLabel() }}</Button>\n      </div>\n    </div>\n  </div>\n\n  <StatefulConfirmationDialog\n    :title=\"t('confirm_title')\"\n    :confirm=\"t('confirm_action')\"\n    :cancel=\"t('confirm_cancel')\"\n    :description=\"t('confirm_description')\"\n  />\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, onMounted } from \"vue\";\nimport { DraftItinerary } from \"@/stores/liteCMS/cmsData\";\nimport BackButton from \"@/modules/LiteCMS/Common/BackButton.vue\";\nimport { Button } from \"@/components/Theme/index.js\";\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore\";\nimport StatefulConfirmationDialog from \"@/components/ConfirmationDialog/StatefulConfirmationDialog.vue\";\nimport { useConfirmationDialog } from \"@/components/ConfirmationDialog/StatefulConfirmationDialog\";\nimport { cachedApiGet } from \"@/utils/api\";\nimport { orderBy } from 'lodash';\nimport DraftItineraryCard from '@/modules/LiteCMS/Dashboard/DraftItineraryCard.vue';\nimport { useShared } from \"@/helpers/vueHelpers.js\";\nimport { H4 } from '@/components/Theme';\nimport HowItWorks from '@/modules/LiteCMS/Dashboard/HowItWorks.vue';\n\nconst { t } = useShared();\nconst profileImage = ref('');\nconst itineraries = ref(null as DraftItinerary[] | null);\nconst { bootstrapDraft, metaStore } = useCmsIndexStore();\nconst confirmDelete = useConfirmationDialog().provide();\n\nonMounted(async () => {\n  loadItineraries();\n  setProfileImage();\n});\n\nasync function loadItineraries() {\n  const data = await metaStore.apiIndex();\n  itineraries.value = orderBy(data, ['created_at'], ['desc']);\n}\n\nasync function setProfileImage() {\n  const supplier = await cachedApiGet('/api/operator/supplier');\n  profileImage.value = supplier.image?.url || '';\n}\n\nasync function gotoItinerary(itinerary: DraftItinerary | object) {\n  if (itinerary.object_type === 'itinerary_request') {\n    window.location.assign(itinerary.meta.link);\n  } else {\n    await bootstrapDraft(itinerary.id);\n    metaStore.goStep('cms_essentials');\n  }\n}\n\nasync function removeItinerary(id: string | number) {\n  confirmDelete.open();\n  confirmDelete.onConfirm(async () => {\n    await metaStore.apiDeleteDraft(id);\n    await loadItineraries();\n  });\n}\n\n</script>\n\n<style lang=\"scss\" scoped>\n@import \"app/assets/stylesheets/litecms\";\n\n.page-title {\n  margin-bottom: 24px;\n}\n\n.draft-itineraries {\n  display: grid;\n  grid-gap: 24px;\n  @include desktop {\n    grid-template-columns: 8fr 4fr;\n  }\n}\n\n.lite__container {\n  border: 1px solid #E6E6E6;\n  padding: 2rem;\n  border-radius: 5px;\n}\n\n.lite-itineraries {\n  display: grid;\n  gap: $spacing-6;\n  @include desktop {\n    grid-template-columns: 1fr 1fr;\n  }\n}\n\n.plan-trips {\n  border: 1px solid $gray-lighter;\n  border-radius: $rounded;\n  padding: 30px;\n  @include flex-column;\n  align-items: center;\n  gap: $spacing-4;\n\n  div {\n    font-weight: $font-semibold;\n  }\n\n  button {\n    color: $brand-tertiary;\n    font-weight: $font-semibold;\n  }\n\n  .icon {\n    font-size: $text-xs;\n    line-height: 1;\n  }\n}\n\n.delete {\n  position: absolute;\n  right: $spacing-4;\n  bottom: $spacing-3;\n\n  &:hover :deep(svg path) {\n    stroke: $brand-tertiary;\n  }\n}\n\n.no-trip {\n  display: grid;\n  place-items: start;\n  gap: $spacing-6;\n\n  @include desktop {\n    grid-template-columns: 1fr 1fr;\n  }\n\n  div {\n    grid-column: 1;\n  }\n\n  .cover-image {\n    grid-row: 1 / span 5;\n    grid-column: 2;\n    width: 100%;\n    @include hide-on-mobile;\n  }\n\n  .quick-tip {\n    display: grid;\n    gap: $spacing-3;\n    padding: $spacing-6;\n    background-color: $brand-tertiary-light;\n    border-radius: $rounded;\n    max-width: 357px;\n    margin-bottom: $spacing-10;\n\n    .heading {\n      display: flex;\n      align-items: center;\n      gap: $spacing-1;\n    }\n\n    span {\n      text-transform: uppercase;\n      font-size: $text-sm;\n      line-height: $text-base;\n      font-weight: $font-bold;\n    }\n\n    img {\n      width: 16px;\n    }\n  }\n}\n\n.lite__header {\n  margin-bottom: 1.5rem;\n}\n</style>\n\n<i18n lang=\"yaml\">\nen:\n  lite_header: Self-serve\n  no_trip_title: No draft trips yet\n  no_trip_description: Create your first itinerary instantly, whether you are planning with us or on your own.\n  quick_tip_title: Quick tip\n  quick_tip_description: With TourHero, you can get payout support, as well as manage travelers and bookings all in one place.\n  confirm_title: Are you sure you want to delete this draft itinerary?\n  confirm_action: Confirm delete\n  confirm_cancel: Back\n  confirm_description: Once you delete, your changes will not be saved.\n</i18n>\n","<template>\n  <div class=\"progress-item\" :class=\"elClass\" @click=\"$emit('goto')\">\n    <RoundCheck :uncheck=\"!done\"/>\n    <span>{{ name }}</span>\n    <i v-if=\"accessible\" class=\"icon icon-arrow-right-1\"></i>\n  </div>\n</template>\n\n<script setup>\nimport { computed } from \"vue\";\nimport { RoundCheck } from \"@/components/Theme/index.js\";\nimport { useCmsMetaStore } from \"@/stores/liteCMS/cmsMetaStore.ts\";\n\ndefineEmits(['goto']);\nconst props = defineProps({\n  current: Number,\n  step: Number,\n  name: String,\n  route: String,\n  done: Boolean,\n});\nconst metaStore = useCmsMetaStore();\nconst accessible = computed(() => metaStore.canAccess(props.route));\n\nconst elClass = computed(() => ({\n  done: props.done,\n  accessible: accessible.value,\n  current: props.step === props.current,\n}));\n</script>\n\n<style lang=\"scss\" scoped>\n.progress-item {\n  display: flex;\n  align-items: center;\n  gap: $spacing-3;\n  font: $font-medium;\n  color: $gray;\n\n  &.accessible {\n    cursor: pointer;\n    color: $brand-tertiary;\n  }\n\n  &.current {\n    color: $black;\n    font-weight: $font-semibold;\n  }\n\n  .icon {\n    font-size: 12px;\n    color: $gray-lighter;\n  }\n}\n</style>\n\n","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createStaticVNode as _createStaticVNode } from \"vue\"\n\nconst _hoisted_1 = {\n  viewBox: \"0 0 20 20\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createStaticVNode(\"<g clip-path=\\\"url(#clip0_6486_17180)\\\"><path d=\\\"M0.631836 11.6719L3.13184 9.17188L5.63184 11.6719\\\" stroke=\\\"white\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M13.1953 2.15234C14.0254 2.36878 14.8154 2.7168 15.5353 3.18318\\\" stroke=\\\"white\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M17.6123 5.08203C18.1445 5.75485 18.5644 6.50931 18.8556 7.3162\\\" stroke=\\\"white\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M19.3746 10.0781C19.3825 10.9356 19.2649 11.7897 19.0254 12.6131\\\" stroke=\\\"white\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M17.7663 15.125C17.2668 15.8229 16.6559 16.4338 15.958 16.9333\\\" stroke=\\\"white\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M13.4452 18.1914C12.6217 18.4309 11.7677 18.5485 10.9102 18.5406\\\" stroke=\\\"white\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M8.14685 18.0207C7.34122 17.7289 6.58793 17.309 5.91602 16.7773\\\" stroke=\\\"white\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M4.01814 14.7033C3.55142 13.9835 3.20337 13.1935 2.9873 12.3633\\\" stroke=\\\"white\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path></g><defs><clipPath id=\\\"clip0_6486_17180\\\"><rect width=\\\"20\\\" height=\\\"20\\\" fill=\\\"white\\\"></rect></clipPath></defs>\", 2)\n  ])))\n}\nexport default { render: render }","<template>\n  <main class=\"cms-page-body\">\n    <div class=\"content\">\n      <slot/>\n\n      <div class=\"content-footer mobile-bottom-section\">\n        <div v-if=\"showSavedMsg\" class=\"saved-message\">Saved!</div>\n\n        <div v-if=\"errorMessage\" class=\"error-message\">\n          <div v-if=\"errorMessage === 'VALIDATION_ERRORS'\">\n            You’ve missed a few details, scroll up to fill in the information\n          </div>\n          <div v-else v-html=\"errorMessage\"></div>\n        </div>\n\n        <div class=\"buttons\">\n          <SaveButton\n            :saving=\"saving && btn === 2\"\n            :text=\"['Save and exit', 'Saving...']\"\n            @click=\"onClickSaveBtn(2)\"\n          />\n\n          <template v-if=\"metaStore.saved && metaStore.currentStepDone\">\n            <Button v-if=\"metaStore.hasNextStep\" @click=\"metaStore.next()\" color=\"primary\" color-filled>Next</Button>\n            <Button v-else @click=\"metaStore.previewItinerary()\" color=\"primary\" color-filled>Preview itinerary</Button>\n          </template>\n\n          <SaveButton\n            v-else\n            :saving=\"saving && btn === 1\"\n            :text=\"['Save', 'Saving...']\"\n            color=\"primary\" color-filled\n            @click=\"onClickSaveBtn(1)\"\n          />\n        </div>\n      </div>\n    </div>\n\n    <div class=\"sidebar panel\">\n      <div class=\"title\">Progress</div>\n      <ProgressItem\n        v-for=\"(item, i) in steps\" :key=\"i\"\n        :current=\"metaStore.progress\"\n        :done=\"metaStore.stepsDone[item.key]\"\n        :step=\"item.step\"\n        :name=\"item.name\"\n        :route=\"item.route\"\n        @goto=\"metaStore.goStep(item.route)\"\n      />\n    </div>\n  </main>\n\n  <ConfirmationDialog :show=\"showExitDialog\"\n                      @confirm=\"$router.push({ name: 'cms_dashboard' })\"\n                      @cancel=\"showExitDialog = false\"\n                      title=\"Progress saved\"\n                      confirm=\"Go to draft trips\"\n                      cancel=\"Back\">\n    Your itinerary progress is saved. You can access it in draft trips.\n  </ConfirmationDialog>\n\n</template>\n\n<script setup>\nimport { nextTick, ref, watch } from \"vue\";\nimport { Button } from \"@/components/Theme/index.js\";\nimport ProgressItem from \"@/modules/LiteCMS/Common/ProgressItem.vue\";\nimport SaveButton from \"@/modules/LiteCMS/Common/SaveButton.vue\";\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore.ts\";\nimport { steps } from \"@/stores/liteCMS/cmsData.ts\";\nimport ConfirmationDialog from \"@/components/ConfirmationDialog/ConfirmationDialog.vue\";\n\nconst props = defineProps({ saveFn: Function });\nconst { metaStore } = useCmsIndexStore();\nconst saving = ref(false);\nconst showSavedMsg = ref(false);\nconst errorMessage = ref('');\nconst btn = ref(null);\nconst showExitDialog = ref(false);\n\nwatch(() => metaStore.saved, (saved) => {\n  if (!saved) {\n    resetSavingStates();\n  }\n})\n\nwatch(() => metaStore.errorCount(), (errCount) => {\n  if (errCount === 0 && errorMessage.value === 'VALIDATION_ERRORS') {\n    errorMessage.value = '';\n  }\n});\n\nasync function onClickSaveBtn(buttonNumber) {\n  btn.value = buttonNumber;\n  resetSavingStates();\n  try {\n    saving.value = true;\n    const validate = btn.value === 1 ? 'full' : 'basic';\n    const res = await props.saveFn(validate);\n    if (res === true) {\n      metaStore.saved = showSavedMsg.value = true;\n      if (btn.value === 2) {\n        showExitDialog.value = true;\n      }\n    } else {\n      metaStore.saved = showSavedMsg.value = false;\n      if (typeof res === 'string') {\n        nextTick(() => errorMessage.value = res);\n      }\n      else if (res instanceof Error) {\n        const errors = res?.response?.data?.errors;\n        const apiErrorList = Array.isArray(errors)\n          ? errors.flat(Infinity).map((x, i) => `${i + 1}. ${x}`).join(`<br>`)\n          : (res.message || res.toString());\n        nextTick(() => errorMessage.value = apiErrorList);\n      }\n    }\n  } finally {\n    saving.value = false;\n  }\n}\n\nfunction resetSavingStates() {\n  saving.value = false;\n  showSavedMsg.value = false;\n  errorMessage.value = '';\n}\n</script>\n\n<style lang=\"scss\" scoped>\n@import 'app/assets/stylesheets/litecms';\n\n.cms-page-body {\n  display: grid;\n  grid-template-columns: repeat(3, minmax(0, 1fr));\n  align-items: start;\n  gap: $spacing-6;\n\n  @include mobile {\n    @include flex-column;\n  }\n\n  .content {\n    width: 100%;\n    grid-column: span 2;\n    &, .content-footer {\n      @include flex-column($spacing-6);\n    }\n  }\n\n  .sidebar {\n    display: grid;\n    gap: $spacing-6;\n    @include mobile {\n      width: 100%;\n    }\n  }\n\n  .buttons {\n    display: flex;\n    @include desktop {\n      gap: $spacing-6;\n    }\n  }\n\n  .saved-message {\n    color: $brand-tertiary;\n  }\n\n  .error-message {\n    border: 1px solid $brand-secondary;\n    border-radius: $rounded;\n    background-color: #D500371A;\n    padding: $spacing-4;\n  }\n\n  .mobile-bottom-section .buttons {\n    @include mobile {\n      flex-direction: column-reverse;\n      gap: $spacing-4;\n    }\n  }\n}\n</style>","<template>\n  <div ref=\"wrapperEl\" class=\"wrapper\" :class=\"{ disabled }\">\n    <div class=\"select\">\n      <div class=\"form-control form-input\"\n           :class=\"{ placeholder: showPlaceholder }\"\n           @click=\"dropdown = !dropdown\"\n      >\n        <div class=\"value\" v-html=\"displayValue\"></div>\n      </div>\n\n      <div class=\"dropdown\" v-show=\"dropdown\">\n        <div ref=\"optionListEl\" class=\"options\">\n          <div class=\"option\"\n               ref=\"optionEls\"\n               :class=\"{ selected: selectIndex === i }\"\n               @mouseenter=\"selectIndex = i\"\n               v-for=\"(option, i) in optionList\" :key=\"i\"\n               @click=\"confirmOption()\"\n          >\n            <div class=\"label\">{{ option.label }}</div>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <i role=\"button\"\n       class=\"icon remove icon-remove-circle\"\n       v-if=\"dropdown && !required && model !== empty\"\n       @click=\"clear()\"\n    />\n\n    <i class=\"icon arrow icon-arrow-down-1\" v-else/>\n  </div>\n</template>\n\n<script setup>\nimport { computed, nextTick, ref } from \"vue\";\nimport { onClickOutside, useInfiniteScroll, onKeyStroke, useMouseInElement } from \"@vueuse/core\";\n\nconst wrapperEl = ref();\nconst optionListEl = ref();\nconst props = defineProps({\n  placeholder: String,\n  options: Array,\n  disabled: Boolean,\n  empty: { type: null, default: null },\n  required: { type: Boolean, default: false },\n});\nconst emit = defineEmits(['infinite-scroll', 'change']);\nconst model = defineModel();\nconst dropdown = ref(false);\nconst selectIndex = ref(null);\nconst optionEls = ref([]);\n\nconst showPlaceholder = computed(() => props.placeholder && !model.value);\nconst selectedOptionEl = computed(() => optionEls.value[selectIndex.value]);\n\nconst optionList = computed(() => {\n  return typeof props.options[0] === 'object'\n    ? props.options\n    : props.options.map(opt => ({ label: opt, value: opt }));\n});\n\nconst displayValue = computed(() => {\n  if (showPlaceholder.value) {\n    return props.placeholder;\n  }\n  const matched = optionList.value.find(opt => opt.value === model.value);\n  return matched ? matched.label : '&nbsp;';\n});\n\nconst { isOutside: mouseOutsideWrapper } = useMouseInElement(wrapperEl)\nconst { isOutside: mouseOutsideDropdown } = useMouseInElement(optionListEl)\nconst mouseInside = computed(() => !mouseOutsideWrapper.value || !mouseOutsideDropdown.value);\n\nonClickOutside(wrapperEl, () => dropdown.value = false);\nuseInfiniteScroll(optionListEl, () => emit('infinite-scroll'));\n\nonKeyStroke(true, (e) => {\n  if (mouseInside.value) {\n    e.preventDefault();\n    if (e.key === 'Enter') confirmOption();\n    else if (e.key === 'ArrowDown') selectNext();\n    else if (e.key === 'ArrowUp') selectPrev();\n    else {\n      const key = e.key.toString().toLowerCase();\n      const matched = optionList.value.findIndex(opt => opt.label.toString().toLowerCase().startsWith(key));\n      if (matched >= 0) selectIndex.value = matched;\n    }\n    showSelectedOption();\n  }\n});\n\nfunction confirmOption() {\n  const option = optionList.value[selectIndex.value];\n  if (model.value !== option.value) {\n    model.value = option.value;\n    emit('change');\n  }\n  dropdown.value = false;\n}\n\nfunction clear() {\n  if (model.value !== props.empty) {\n    model.value = props.empty;\n    emit('change');\n  }\n  dropdown.value = false;\n}\n\nfunction selectPrev() {\n  if (selectIndex.value > 0) {\n    selectIndex.value -= 1;\n  }\n}\n\nfunction selectNext() {\n  if (selectIndex.value === null) {\n    selectIndex.value = 0;\n  }\n  else if (selectIndex.value < (optionList.value.length - 1)) {\n    selectIndex.value += 1;\n  }\n}\n\nfunction showSelectedOption() {\n  if (selectedOptionEl.value) {\n    nextTick(() => selectedOptionEl.value.scrollIntoViewIfNeeded(false));\n  }\n}\n</script>\n\n<style lang=\"scss\" scoped>\n@import \"app/assets/stylesheets/litecms\";\n\n.wrapper {\n  position: relative;\n  line-height: 1.15;\n\n  &.disabled {\n    color: $gray;\n    background-color: $gray-lighter;\n    pointer-events: none;\n  }\n\n  .icon {\n    position: absolute;\n    right: $spacing-5;\n    top: 0;\n    bottom: 0;\n    display: flex;\n    align-items: center;\n    color: $gray;\n    line-height: 1;\n\n    &.remove {\n      cursor: pointer;\n    }\n\n    &.arrow {\n      pointer-events: none;\n    }\n  }\n}\n\n.select {\n  cursor: pointer;\n  position: relative;\n\n  .placeholder {\n    color: $gray;\n  }\n\n  .form-input {\n    font-size: $text-base;\n    line-height: $leading-snug;\n    font-weight: $font-medium;\n  }\n\n  .dropdown {\n    background: $white;\n    position: absolute;\n    z-index: 100;\n    left: 0;\n    right: 0;\n    top: calc(100% + $spacing-1);\n    border: 1px solid $gray-lighter;\n    border-radius: $rounded;\n    max-height: 280px;\n    @include flex-column;\n    flex-shrink: 0;\n\n    @media (max-width: $breakpoint-m) {\n      max-height: 240px;\n    }\n\n    .options {\n      flex: 1;\n      padding: $spacing-3;\n      overflow-y: auto;\n      scrollbar-color: $gray $white;\n\n      .option {\n        cursor: pointer;\n        font-size: $text-base;\n        line-height: $leading-normal;\n        padding: $spacing-3 $spacing-2;\n        border-radius: $rounded;\n\n        &:not(:last-child) {\n          border-bottom: 1px solid $gray-lighter;\n        }\n\n        &.selected {\n          background: $brand-tertiary-light;\n        }\n      }\n    }\n  }\n}\n\n.form-input .value,\n.option .label {\n  overflow: hidden;\n  display: -webkit-box;\n  -webkit-box-orient: vertical;\n  -webkit-line-clamp: 1;\n}\n</style>","<template>\n  <div ref=\"wrapper\" class=\"search\" :class=\"{ 'mobile-expanded': mobileExpanded }\">\n    <div class=\"heading\" v-if=\"mobileExpanded\">\n      <span>{{ title }}</span>\n      <i class=\"icon icon-close\" @click=\"showResults = false\"/>\n    </div>\n\n    <div class=\"input-wrapper\">\n      <input class=\"form-input\"\n             :placeholder=\"placeholder\"\n             :value=\"model\"\n             @input=\"onInput($event.target.value)\"\n             @focus=\"showResults = true\">\n\n      <button v-if=\"model\" class=\"clear\" @click=\"onClear()\">Clear</button>\n      <i v-else class=\"icon icon-search\"/>\n    </div>\n\n    <div class=\"results\" v-if=\"showResults && results.length > 0\">\n      <div class=\"results__item\"\n           v-for=\"(item, i) in results\" :key=\"i\"\n           @click=\"onClickResultItem(item)\"\n      >{{ resultFn(item) }}</div>\n    </div>\n\n    <div class=\"results empty\" v-else-if=\"showResults && queryFailed && $slots['empty']\">\n      <slot name=\"empty\" />\n    </div>\n  </div>\n</template>\n\n<script setup>\nimport { computed, ref } from 'vue';\nimport { useDebounceFn, onClickOutside } from \"@vueuse/core\";\nimport { useShared } from \"@/helpers/vueHelpers.js\";\n\nconst wrapper = ref();\nconst model = defineModel();\nconst props = defineProps({\n  title: String,\n  placeholder: String,\n  queryFn: Function,\n  resultFn: Function,\n  onSelectFn: Function,\n});\nconst emit = defineEmits(['clear']);\nconst { mobile } = useShared();\nconst results = ref([]);\nconst showResults = ref(false);\nconst mobileExpanded = computed(() => mobile.value && showResults.value);\nconst debouncedQuery = useDebounceFn(onQuery, 300);\nconst queryFailed = ref(false);\n\nonClickOutside(wrapper, () => showResults.value = false);\n\nasync function onInput(text) {\n  queryFailed.value = false;\n  model.value = text;\n  debouncedQuery(text);\n}\n\nasync function onClear() {\n  queryFailed.value = false;\n  model.value = '';\n  results.value = [];\n  emit('clear');\n}\n\nasync function onQuery(text) {\n  results.value = text ? (await props.queryFn(text)) : [];\n\n  if (text && (results.value.length === 0 || 'errors' in results.value)) {\n    queryFailed.value = true;\n  }\n}\n\nasync function onClickResultItem(item) {\n  showResults.value = false;\n  await props.onSelectFn(item)\n}\n</script>\n\n<style lang=\"scss\" scoped>\n@import \"app/assets/stylesheets/litecms\";\n\n.search {\n  &, .input-wrapper {\n    position: relative;\n  }\n\n  .form-input {\n    padding-right: $spacing-16;\n  }\n\n  .clear, .icon-search {\n    position: absolute;\n    right: 15px;\n    top: 0;\n    bottom: 0;\n    display: flex;\n    align-items: center;\n    color: $gray;\n  }\n}\n\n.results {\n  @include flex-column;\n  z-index: 100;\n  position: absolute;\n  top: 100%;\n  border: 1px solid $gray-lighter;\n  border-radius: $rounded;\n  background-color: white;\n  width: 100%;\n  margin-top: $spacing-1;\n  padding: $spacing-3;\n  max-height: 280px;\n  overflow-y: auto;\n\n  &.empty {\n    max-height: none;\n  }\n}\n\n.results__item {\n  padding: $spacing-3 $spacing-2;\n  border-radius: $rounded;\n  cursor: pointer;\n\n  &:not(:last-child) {\n    border-bottom: 1px solid $gray-lighter;\n  }\n\n  &:hover, &:focus-within {\n    background-color: $brand-tertiary-light;\n  }\n}\n\n.search.mobile-expanded {\n  position: fixed;\n  inset: 0;\n  z-index: 100;\n  background: white;\n  padding: $spacing-10 $spacing-6;\n\n  .heading {\n    display: flex;\n    justify-content: space-between;\n    align-items: center;\n    margin-bottom: $spacing-6;\n\n    span {\n      font-size: 24px;\n      line-height: 36px;\n      font-weight: $font-semibold;\n    }\n  }\n\n  .results {\n    margin: $spacing-3 0;\n    position: static;\n    border: none;\n    padding: 0;\n    gap: 10px;\n    max-height: none;\n  }\n\n  .results__item {\n    border-bottom: none;\n    padding: $spacing-2;\n  }\n}\n</style>","<template>\n  <SearchApiInput\n    v-model=\"input\"\n    v-bind=\"$attrs\"\n    :queryFn=\"autocomplete\"\n    :resultFn=\"$event => $event\"\n    :onSelectFn=\"onSelectResult\"\n    placeholder=\"Try “Lisbon” or “Colombia”\"\n  />\n</template>\n\n<script setup lang=\"ts\">\nimport { ref } from \"vue\";\nimport api from '@/utils/api.js';\nimport SearchApiInput from \"@/modules/LiteCMS/Common/SearchApiInput.vue\";\nimport { Destination } from \"@/stores/liteCMS/cmsData\";\nimport { watchImmediate } from \"@vueuse/core\";\n\nconst input = ref();\nconst model = defineModel<Destination>();\nconst emit = defineEmits(['select']);\n\nwatchImmediate(model, () => input.value = model.value?.city || '');\nwatchImmediate(input, (val) => {\n  if (!val) setDestination({ city: '', country: '', country_code: '' });\n  if (val && model.value) model.value.city = val;\n});\n\nasync function autocomplete(text: string) {\n  const { data } = await api.post('/api/places/autocomplete', { text, type: 'city' });\n  return (data.suggestions ?? []).map(s => s.placePrediction.text.text);\n}\n\nasync function search(text: string) {\n  const { data } = await api.post(`/api/places/search_destination`, { text });\n  return data\n}\n\nasync function onSelectResult(predictionText: string) {\n  const results = await search(predictionText);\n  if ('errors' in results || results.length === 0) {\n    alert(`Failed to search place: ${predictionText}`);\n  }\n  return setDestination(results[0]);\n}\n\nasync function setDestination(destination: Destination) {\n  input.value = destination.city;\n  model.value = {\n    city: destination.city,\n    country: destination.country,\n    country_code: destination.country_code\n  };\n  emit('select', destination);\n}\n</script>\n\n<style lang=\"scss\" scoped>\n@import \"app/assets/stylesheets/litecms\";\n</style>\n\n","<template>\n  <div ref=\"input\" class=\"daterange-input\">\n    <div class=\"input-wrapper\">\n      <input type=\"text\" class=\"form-input\" :value=\"displayDates\" @click=\"showCalendar = true\" readonly :disabled=\"disabled\">\n\n      <i v-if=\"showCalendar && model.startDate\"\n         class=\"icon icon-remove-circle\"\n         role=\"button\"\n         @click=\"clear()\"\n      />\n    </div>\n\n    <DateRangePicker\n      v-if=\"showCalendar\"\n      opens=\"inline\"\n      :singleDatePicker=\"range ? 'range' : 'single'\"\n      :ranges=\"false\"\n      :autoApply=\"true\"\n      :minDate=\"moment(minDate).toDate()\"\n      :maxDate=\"moment(maxDate).toDate()\"\n      :modelValue=\"daterange\"\n      @update:model-value=\"updateDaterange\"\n      :disabled=\"disabled\"\n    />\n  </div>\n</template>\n\n<script setup>\nimport { computed, ref, watch } from 'vue';\nimport { onClickOutside } from '@vueuse/core';\nimport DateRangePicker from 'vue3-gabe-daterange-picker'; // https://innologica.github.io/vue2-daterange-picker/\nimport 'vue3-gabe-daterange-picker/assets/daterangepicker.scss';\nimport moment from \"moment-timezone\";\nimport { ymd } from '@/utils/dateUtils.ts';\n\nconst input = ref();\nconst showCalendar = ref(false);\nconst model = defineModel();\nconst props = defineProps({\n  range: { type: Boolean, default: true },\n  minDate: { type: [Date, String], default: () => new Date },\n  maxDate: { type: [Date, String], default: () => null },\n  disabled: { type: Boolean, default: false }\n});\nconst daterange = computed(() => ({\n  startDate: model.value.startDate ? moment(model.value.startDate).toDate() : null,\n  endDate: model.value.endDate ? moment(model.value.endDate).toDate() : null\n}));\n\nwatch(model, () => showCalendar.value = false);\nonClickOutside(input, () => showCalendar.value = false);\n\nconst displayDates = computed(() => {\n  const { startDate, endDate } = model.value;\n\n  return startDate && endDate ? formatDateRange(startDate, endDate) : '';\n});\n\nconst formatDateRange = (startDate, endDate) => {\n  return props.range\n    ? `${moment(startDate).format('MMM D, YYYY')} - ${moment(endDate).format('MMM D, YYYY')}`\n    : `${moment(startDate).format('MMM D, YYYY')}`;\n}\n\nfunction updateDaterange({ startDate, endDate }) {\n  model.value = {\n    startDate: ymd(startDate),\n    endDate: ymd(endDate),\n  };\n}\n\nfunction clear() {\n  updateDaterange({ startDate: null, endDate: null });\n}\n</script>\n\n<style lang=\"scss\" scoped>\n@import 'app/assets/stylesheets/litecms';\n\n.input-wrapper {\n  display: flex;\n  align-items: center;\n  position: relative;\n\n  .icon {\n    position: absolute;\n    right: $spacing-4;\n    top: 0;\n    bottom: 0;\n    display: flex;\n    align-items: center;\n    color: $gray;\n    line-height: 1;\n    cursor: pointer;\n  }\n\n  :deep(input) {\n    &[disabled] {\n      background-color: $gray-lighter;\n    }\n  }\n}\n\n.daterange-input {\n  position: relative;\n}\n\n.daterange-input :deep(.vue-daterange-picker) {\n  z-index: 100;\n  position: absolute;\n  left: 0;\n  right: 0;\n  top: 100%;\n\n  &, .calendars-container, .drp-calendar {\n    max-width: none;\n    width: 100%;\n  }\n\n  .calendars {\n    padding: $spacing-4;\n  }\n\n  .month {\n    font-size: 14.68px;\n    line-height: 17.12px;\n  }\n\n  .daterangepicker {\n    margin-top: $spacing-1;\n\n    td {\n      font-size: 12.23px;\n      font-weight: $font-bold;\n    }\n\n    td.in-range {\n      background-color: $brand-tertiary-light;\n    }\n\n    td.active, td.active:hover {\n      background-color: $brand-tertiary;\n    }\n  }\n\n  .reportrange-text {\n    display: none;\n  }\n}\n</style>\n","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = {\n  viewBox: \"0 0 20 20\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createElementVNode(\"path\", {\n      d: \"M9.24805 5.14893C10.4562 5.14893 11.4355 4.16955 11.4355 2.96143C11.4355 1.7533 10.4562 0.773926 9.24805 0.773926C8.03992 0.773926 7.06055 1.7533 7.06055 2.96143C7.06055 4.16955 8.03992 5.14893 9.24805 5.14893Z\",\n      stroke: \"#307582\",\n      \"stroke-width\": \"1.25\",\n      \"stroke-linecap\": \"round\",\n      \"stroke-linejoin\": \"round\"\n    }, null, -1),\n    _createElementVNode(\"path\", {\n      d: \"M15.1247 9.83327C14.8436 9.83402 14.566 9.77122 14.3126 9.64958C14.0592 9.52793 13.8366 9.35057 13.6614 9.13077C13.0587 8.37305 12.2924 7.76151 11.4199 7.34198C10.5474 6.92245 9.5912 6.70581 8.62305 6.70827C7.29737 6.7096 6.02637 7.23681 5.08897 8.1742C4.15158 9.1116 3.62437 10.3826 3.62305 11.7083C3.62305 12.0398 3.75474 12.3577 3.98916 12.5922C4.22358 12.8266 4.54153 12.9583 4.87305 12.9583C5.20457 12.9583 5.52251 12.8266 5.75693 12.5922C5.99135 12.3577 6.12305 12.0398 6.12305 11.7083C6.12477 11.1549 6.30967 10.6177 6.64887 10.1805C6.98807 9.74334 7.46248 9.43077 7.99805 9.29161V9.70827C8.00029 12.4005 7.20329 15.0328 5.70805 17.2716C5.617 17.4084 5.55378 17.5618 5.52201 17.723C5.49024 17.8842 5.49054 18.0501 5.52288 18.2112C5.58821 18.5366 5.78011 18.8227 6.05638 19.0066C6.33265 19.1905 6.67065 19.2571 6.99602 19.1918C7.3214 19.1264 7.6075 18.9345 7.79138 18.6583C8.58207 17.4715 9.21226 16.1854 9.66555 14.8333C10.9684 15.6551 11.9481 16.9009 12.4397 18.3608C12.4872 18.5218 12.5667 18.6715 12.6733 18.8011C12.7799 18.9307 12.9116 19.0375 13.0604 19.1152C13.2092 19.1928 13.3721 19.2397 13.5394 19.253C13.7068 19.2663 13.875 19.2458 14.0342 19.1927C14.1935 19.1395 14.3403 19.0549 14.4661 18.9438C14.5919 18.8327 14.694 18.6973 14.7664 18.5459C14.8388 18.3945 14.8799 18.23 14.8874 18.0623C14.8948 17.8946 14.8684 17.7272 14.8097 17.5699C14.0459 15.2954 12.4236 13.4094 10.2889 12.3141C10.4295 11.4526 10.5 10.5812 10.4997 9.70827V9.68327C10.9674 9.93542 11.3793 10.2795 11.7105 10.6949C12.1193 11.2086 12.639 11.623 13.2307 11.9073C13.8224 12.1916 14.4708 12.3384 15.1272 12.3366C15.4587 12.3366 15.7767 12.2049 16.0111 11.9705C16.2455 11.7361 16.3772 11.4181 16.3772 11.0866C16.3772 10.7551 16.2455 10.4371 16.0111 10.2027C15.7767 9.9683 15.4587 9.83661 15.1272 9.83661L15.1247 9.83327Z\",\n      stroke: \"#307582\",\n      \"stroke-width\": \"1.25\",\n      \"stroke-linecap\": \"round\",\n      \"stroke-linejoin\": \"round\"\n    }, null, -1)\n  ])))\n}\nexport default { render: render }","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createStaticVNode as _createStaticVNode } from \"vue\"\n\nconst _hoisted_1 = {\n  viewBox: \"0 0 20 20\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createStaticVNode(\"<g clip-path=\\\"url(#clip0_6089_46416)\\\"><path d=\\\"M6.25 5.15308C7.45812 5.15308 8.4375 4.1737 8.4375 2.96558C8.4375 1.75745 7.45812 0.778076 6.25 0.778076C5.04188 0.778076 4.0625 1.75745 4.0625 2.96558C4.0625 4.1737 5.04188 5.15308 6.25 5.15308Z\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.25\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M12.1279 9.29391C10.0838 9.29391 10.0013 6.71558 5.62793 6.71558C4.30225 6.7169 3.03125 7.24411 2.09386 8.1815C1.15646 9.1189 0.629253 10.3899 0.62793 11.7156C0.62793 12.0471 0.759626 12.365 0.994046 12.5995C1.22847 12.8339 1.54641 12.9656 1.87793 12.9656C2.20945 12.9656 2.52739 12.8339 2.76181 12.5995C2.99623 12.365 3.12793 12.0471 3.12793 11.7156C3.12883 11.1619 3.31314 10.6241 3.65208 10.1862C3.99101 9.7484 4.46546 9.4352 5.00126 9.29558V9.71224C5.00351 12.4045 4.20651 15.0368 2.71126 17.2756C2.52738 17.5518 2.46077 17.8898 2.5261 18.2152C2.59142 18.5406 2.78333 18.8267 3.0596 19.0106C3.33586 19.1945 3.67386 19.2611 3.99924 19.1957C4.32461 19.1304 4.61071 18.9385 4.7946 18.6622C5.56515 17.5071 6.18332 16.2574 6.63376 14.9439L8.4671 15.9364L9.4671 17.8081C9.5935 18.1133 9.8342 18.357 10.1378 18.4871C10.4414 18.6173 10.7839 18.6236 11.0921 18.5047C11.3998 18.3817 11.646 18.1415 11.7767 17.8369C11.9073 17.5323 11.9117 17.1883 11.7888 16.8806C9.8121 13.1731 10.9296 14.5964 7.24376 12.5172C7.41834 11.5914 7.50456 10.6511 7.50126 9.70891V9.68724C10.0979 11.0872 10.2413 11.7939 12.1279 11.7939C12.4595 11.7939 12.7774 11.6622 13.0118 11.4278C13.2462 11.1934 13.3779 10.8754 13.3779 10.5439C13.3779 10.2124 13.2462 9.89445 13.0118 9.66003C12.7774 9.42561 12.4595 9.29391 12.1279 9.29391Z\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.25\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M19.375 14.2156H16.875V16.7156H14.375V19.2156H13.125\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.25\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path></g><defs><clipPath id=\\\"clip0_6089_46416\\\"><rect width=\\\"20\\\" height=\\\"20\\\" fill=\\\"white\\\"></rect></clipPath></defs>\", 2)\n  ])))\n}\nexport default { render: render }","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createStaticVNode as _createStaticVNode } from \"vue\"\n\nconst _hoisted_1 = {\n  viewBox: \"0 0 20 20\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createStaticVNode(\"<g clip-path=\\\"url(#clip0_6089_46426)\\\"><path d=\\\"M5.625 19.2708H9.375L12.5 16.7708H15L17.5 11.7708H19.375\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.25\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M8.74987 16.7711C8.74987 13.5353 5.62487 12.3961 5.2832 12.122L5.9257 10.3003C7.10237 11.6211 8.79237 11.7711 10.6249 11.7711\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.25\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M10.625 9.27088C9.17329 9.27088 7.87496 9.08921 7.22079 7.79171L6.74412 6.83337C6.6322 6.61553 6.4597 6.43467 6.2474 6.31255C6.0351 6.19043 5.79204 6.13226 5.54746 6.14504C5.3024 6.16047 5.06732 6.24773 4.87155 6.39593C4.67577 6.54413 4.52798 6.74671 4.44662 6.97837L0.696622 17.6034C0.64182 17.7582 0.618074 17.9223 0.626741 18.0864C0.635408 18.2504 0.676318 18.4111 0.747133 18.5593C0.817948 18.7075 0.917278 18.8403 1.03945 18.9501C1.16161 19.0599 1.30422 19.1446 1.45912 19.1992C1.59313 19.2457 1.73393 19.2697 1.87579 19.27C2.13439 19.2702 2.38668 19.1901 2.59786 19.0409C2.80905 18.8916 2.96875 18.6805 3.05496 18.4367L4.40746 14.6034C4.99996 14.895 6.24996 15.21 6.24996 16.77\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.25\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M8.125 5.20825C9.33312 5.20825 10.3125 4.22887 10.3125 3.02075C10.3125 1.81263 9.33312 0.833252 8.125 0.833252C6.91688 0.833252 5.9375 1.81263 5.9375 3.02075C5.9375 4.22887 6.91688 5.20825 8.125 5.20825Z\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.25\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M0.625 10.5208L2.5 6.14575\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.25\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M13.75 16.7708L11.875 6.14575\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.25\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path></g><defs><clipPath id=\\\"clip0_6089_46426\\\"><rect width=\\\"20\\\" height=\\\"20\\\" fill=\\\"white\\\"></rect></clipPath></defs>\", 2)\n  ])))\n}\nexport default { render: render }","<template>\n  <div class=\"activity-selector\">\n    <div class=\"activity\" @click=\"model = 'Light'\">\n      <Radio :checked=\"model === 'Light'\" />\n      <div class=\"heading\">\n        <ActivityLevelOneIcon width=\"20\"/>\n        <div>Light</div>\n      </div>\n      <div class=\"description\">Low-intensity activity, such as city walking</div>\n    </div>\n    <div class=\"activity\" @click=\"model = 'Moderate'\">\n      <Radio :checked=\"model === 'Moderate'\" />\n      <div class=\"heading\">\n        <ActivityLevelTwoIcon width=\"20\"/>\n        <div>Moderate</div>\n      </div>\n      <div class=\"description\">Moderate intensity, such as 2-3 hours of walking or hiking with elevation</div>\n    </div>\n    <div class=\"activity\" @click=\"model = 'Strenuous'\">\n      <Radio :checked=\"model === 'Strenuous'\" />\n      <div class=\"heading\">\n        <ActivityLevelThreeIcon width=\"20\"/>\n        <div>Strenuous</div>\n      </div>\n      <div class=\"description\">Intense physical activity, such as 3+ hours walking (15+ km) with elevation, or trained/special-licensed activities</div>\n    </div>\n  </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { Radio } from \"@/components/Theme\";\nimport ActivityLevelOneIcon from 'app/assets/images/cms/activity_level_1.svg?component'\nimport ActivityLevelTwoIcon from 'app/assets/images/cms/activity_level_2.svg?component'\nimport ActivityLevelThreeIcon from 'app/assets/images/cms/activity_level_3.svg?component'\n\nconst model = defineModel();\n</script>\n\n<style lang=\"scss\" scoped>\n.activity-selector {\n  display: grid;\n  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));\n  gap: $spacing-6;\n\n  @include mobile {\n    grid-template-columns: 1fr;\n    margin-top: $spacing-3;\n    gap: $spacing-3;\n  }\n\n  .activity {\n    border: 1px solid $gray-lighter;\n    border-radius: $rounded;\n    padding: $spacing-4;\n    display: grid;\n    grid-template-rows: auto 1fr;\n    grid-template-columns: auto 1fr;\n    column-gap: $spacing-3;\n    row-gap: $spacing-2;\n    cursor: pointer;\n\n    .heading {\n      display: flex;\n      align-items: center;\n      gap: $spacing-2;\n      font-weight: $font-semibold;\n    }\n\n    .description {\n      color: $gray;\n      grid-column: 2;\n    }\n  }\n}\n</style>","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createStaticVNode as _createStaticVNode } from \"vue\"\n\nconst _hoisted_1 = {\n  viewBox: \"0 0 88 88\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createStaticVNode(\"<g clip-path=\\\"url(#clip0_6048_35468)\\\"><path d=\\\"M27.6171 32.9841C35.911 32.9841 42.6345 26.2606 42.6345 17.9667C42.6345 9.67276 35.911 2.94922 27.6171 2.94922C19.3232 2.94922 12.5996 9.67276 12.5996 17.9667C12.5996 26.2606 19.3232 32.9841 27.6171 32.9841Z\\\" stroke=\\\"#8C8C8C\\\" stroke-width=\\\"5.46089\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M3.04102 63.0163C3.04102 56.4986 5.63014 50.2479 10.2388 45.6392C14.8475 41.0305 21.0982 38.4414 27.6159 38.4414C28.5281 38.4415 29.4396 38.4914 30.3464 38.5907\\\" stroke=\\\"#8C8C8C\\\" stroke-width=\\\"5.46089\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M79.4948 41.1719H46.7294C43.7135 41.1719 41.2686 43.6168 41.2686 46.6328V79.3981C41.2686 82.4141 43.7135 84.859 46.7294 84.859H79.4948C82.5108 84.859 84.9557 82.4141 84.9557 79.3981V46.6328C84.9557 43.6168 82.5108 41.1719 79.4948 41.1719Z\\\" stroke=\\\"#8C8C8C\\\" stroke-width=\\\"5.46089\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M56.2852 52.0938C56.5552 52.0938 56.8192 52.1738 57.0437 52.3238C57.2682 52.4739 57.4432 52.6871 57.5465 52.9366C57.6499 53.186 57.6769 53.4605 57.6242 53.7254C57.5715 53.9902 57.4415 54.2335 57.2506 54.4244C57.0596 54.6153 56.8164 54.7454 56.5515 54.7981C56.2867 54.8507 56.0122 54.8237 55.7627 54.7204C55.5133 54.617 55.3 54.442 55.15 54.2175C55 53.993 54.9199 53.729 54.9199 53.459C54.9199 53.0969 55.0638 52.7497 55.3198 52.4936C55.5758 52.2376 55.9231 52.0938 56.2852 52.0938\\\" stroke=\\\"#8C8C8C\\\" stroke-width=\\\"5.46089\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M84.9518 76.6687L76.2472 63.6098C76.0005 63.24 75.6672 62.936 75.2764 62.7242C74.8855 62.5125 74.4489 62.3993 74.0043 62.3947C73.5598 62.39 73.1209 62.494 72.7256 62.6975C72.3304 62.901 71.9909 63.1979 71.7365 63.5625L64.4553 73.9419L59.9519 70.3413C59.6567 70.1045 59.3155 69.9318 58.95 69.8341C58.5844 69.7364 58.2026 69.7158 57.8286 69.7736C57.4547 69.8315 57.0969 69.9666 56.778 70.1702C56.4591 70.3739 56.1861 70.6417 55.9763 70.9566L46.7256 84.86\\\" stroke=\\\"#8C8C8C\\\" stroke-width=\\\"5.46089\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path></g><defs><clipPath id=\\\"clip0_6048_35468\\\"><rect width=\\\"87.3743\\\" height=\\\"87.3743\\\" fill=\\\"white\\\" transform=\\\"translate(0.311523 0.216797)\\\"></rect></clipPath></defs>\", 2)\n  ])))\n}\nexport default { render: render }","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createStaticVNode as _createStaticVNode } from \"vue\"\n\nconst _hoisted_1 = {\n  viewBox: \"0 0 17 16\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createStaticVNode(\"<path d=\\\"M1.5 3H15.5\\\" stroke=\\\"#8C8C8C\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M10 1H7C6.73478 1 6.48043 1.10536 6.29289 1.29289C6.10536 1.48043 6 1.73478 6 2V3H11V2C11 1.73478 10.8946 1.48043 10.7071 1.29289C10.5196 1.10536 10.2652 1 10 1Z\\\" stroke=\\\"#8C8C8C\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M7 11.5V6.5\\\" stroke=\\\"#8C8C8C\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M10 11.5V6.5\\\" stroke=\\\"#8C8C8C\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M13.0767 14.0827C13.0559 14.3327 12.9419 14.5659 12.7573 14.7358C12.5727 14.9057 12.3309 15 12.08 15H4.92067C4.66975 15 4.42798 14.9057 4.24336 14.7358C4.05874 14.5659 3.94474 14.3327 3.924 14.0827L3 3H14L13.0767 14.0827Z\\\" stroke=\\\"#8C8C8C\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path>\", 5)\n  ])))\n}\nexport default { render: render }","<template>\n  <InputValidation\n    v-bind=\"$attrs\"\n    :errors=\"store.errors\"\n    :validating=\"store.validating\"\n    invalidClass=\"cms-input-validation-error\"\n  />\n</template>\n\n<script setup>\nimport InputValidation from \"@/components/InputValidation.vue\";\nimport { useCmsMetaStore } from \"@/stores/liteCMS/cmsMetaStore.ts\";\n\nconst store = useCmsMetaStore();\n</script>\n\n<style lang=\"scss\" scoped>\n@import \"app/assets/stylesheets/litecms\";\n</style>\n\n<style lang=\"scss\">\n.cms-input-validation-error {\n  &,\n  .form-input,\n  .tags-area,\n  .time-input__body,\n  .time-input__fields button,\n  .ProseMirror.editor,\n  div[role='button'] {\n    border-color: $brand-secondary !important;\n  }\n}\n</style>","<template>\n  <div v-if=\"essentialStore.supplierProfile\" class=\"profile\">\n    <div class=\"profile-avatar\">\n      <img v-if=\"essentialStore.supplierProfile.image\"\n           :src=\"essentialStore.supplierProfile.image\"\n           alt=\"avatar\">\n      <div v-else class=\"avatar-placeholder\">\n        <ProfileImageIcon width=\"87.37\"/>\n      </div>\n      <button @click=\"open\">{{ essentialStore.supplierProfile.image ? 'Change photo' : 'Upload photo' }}</button>\n    </div>\n\n    <div class=\"profile-body\">\n      <div class=\"form-label required\">Name</div>\n      <input class=\"form-input profile-title\" type=\"text\" v-model=\"essentialStore.supplierProfile.title\">\n      <CmsInputValidation target=\".profile-title\" :checker=\"() => essentialStore.supplierProfile.title\"/>\n\n      <div class=\"form-label required\">Bio</div>\n      <textarea class=\"form-input profile-description\" v-model=\"essentialStore.supplierProfile.description\"></textarea>\n      <CmsInputValidation target=\".profile-description\" :checker=\"() => essentialStore.supplierProfile.description\"/>\n\n      <button class=\"link\"\n              @click=\"essentialStore.newSupplierView()\"\n              v-if=\"essentialStore.supplierReviews.length === 0\"\n      >Add a review about your company</button>\n\n      <template v-else>\n        <div v-for=\"(review, i) in essentialStore.supplierReviews\" class=\"review\">\n          <div class=\"heading\">\n            <div class=\"review-title\">Review {{ optionalNumbering(i + 1, essentialStore.supplierReviews.length > 1) }}</div>\n            <button class=\"delete-btn\" @click=\"essentialStore.removeSupplierView(review)\">\n              <TrashIcon width=\"16\"/>\n            </button>\n          </div>\n\n          <div class=\"form-label\">review source</div>\n          <SelectInput :options=\"reviewSources\" v-model=\"review.platform\" empty=\"\" />\n\n          <div class=\"form-label\">Author</div>\n          <input type=\"text\" class=\"form-input\" v-model=\"review.author\">\n\n          <div class=\"form-label required\">Review</div>\n\n          <WithId v-slot=\"{ id }\">\n            <textarea :id=\"id\" class=\"form-input\" v-model=\"review.message\"></textarea>\n            <CmsInputValidation :id=\"id\" :checker=\"() => review.message\"/>\n          </WithId>\n        </div>\n\n        <div class=\"end-of-reviews line\"></div>\n      </template>\n    </div>\n\n    <div class=\"profile-footer\">\n      <Button v-if=\"essentialStore.supplierReviews.length > 0 && essentialStore.supplierReviews.length < 3\"\n              class=\"add-btn\"\n              @click=\"essentialStore.newSupplierView()\">Add another review\n      </Button>\n\n      <Button class=\"save-btn\" color=\"primary\" color-filled @click=\"onSave()\">Save profile</Button>\n    </div>\n  </div>\n\n  <StatefulConfirmationDialog\n    name=\"supplier\"\n    title=\"Changes will update all itineraries\"\n    description=\"Please confirm that updating your profile will apply these changes to all your itineraries.\"\n  />\n</template>\n\n<script setup>\nimport api from \"@/utils/api.js\";\nimport ProfileImageIcon from 'app/assets/images/cms/profile_image.svg?component';\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore.ts\";\nimport { useFileDialog, useObjectUrl } from '@vueuse/core'\nimport { serialize } from \"object-to-formdata\";\nimport TrashIcon from 'app/assets/images/common/trash.svg?component';\nimport SelectInput from \"@/modules/LiteCMS/Common/SelectInput.vue\";\nimport { Button } from \"@/components/Theme/index.js\";\nimport CmsInputValidation from \"@/modules/LiteCMS/Common/CmsInputValidation.vue\";\nimport WithId from \"@/components/Containers/WithId.vue\";\nimport StatefulConfirmationDialog from \"@/components/ConfirmationDialog/StatefulConfirmationDialog.vue\";\nimport { useConfirmationDialog } from \"@/components/ConfirmationDialog/StatefulConfirmationDialog.ts\";\nimport { optionalNumbering } from \"@/utils/stringUtils.js\";\n\nconst { essentialStore, retrieveSupplierProfile } = useCmsIndexStore();\n\nlet newImage = null;\nconst { open, onChange } = useFileDialog({ accept: 'image/*', multiple: false });\nconst reviewSources = [\n  { value: 'google', label: 'Google' },\n  { value: 'tripadvisor', label: 'Tripadvisor' },\n  { value: 'trustpilot', label: 'Trustpilot' }\n];\nconst confirmUpdateSupplier = useConfirmationDialog('supplier').provide();\n\nfunction onSave() {\n  confirmUpdateSupplier.open();\n  confirmUpdateSupplier.onConfirm(saveToApi);\n}\n\nasync function saveToApi() {\n  const supplier = {\n    title: essentialStore.supplierProfile.title,\n    description: essentialStore.supplierProfile.description,\n    supplier_reviews_attributes: essentialStore.supplierProfile.reviews.map(r => ({\n      id: r.id,\n      author: r.author,\n      message: r.message,\n      platform_logo: r.platform,\n      _destroy: r.deleted ?? false,\n    })),\n  };\n  if (newImage) {\n    supplier.image = newImage;\n  }\n  await api.post('/api/operator/supplier', serialize({ supplier }));\n  essentialStore.supplierProfile = await retrieveSupplierProfile();\n}\n\nonChange(([file]) => {\n  newImage = file;\n  essentialStore.supplierProfile.image = useObjectUrl(file).value;\n})\n</script>\n\n<style lang=\"scss\" scoped>\n@import \"app/assets/stylesheets/litecms\";\n\n.profile {\n  display: grid;\n  grid-template-columns: 230fr 421fr;\n  gap: $spacing-6;\n  row-gap: $spacing-4;\n\n  @include mobile {\n    grid-template-columns: 1fr;\n  }\n}\n\n.profile-avatar {\n  @include flex-column($spacing-3);\n\n  img {\n    width: 100%;\n  }\n\n  button {\n    color: $brand-tertiary;\n  }\n\n  .upload_input {\n    display: none;\n  }\n\n  .avatar-placeholder {\n    width: 100%;\n    height: 307px;\n    display: flex;\n    justify-content: center;\n    background-color: $gray-light;\n    border-radius: $rounded;\n  }\n}\n\n.profile-body {\n  @include flex-column;\n  align-items: start;\n\n  textarea {\n    height: 200px;\n  }\n\n  .link {\n    margin-right: auto;\n    color: $brand-tertiary;\n  }\n\n  .form-label:not(:first-of-type), .link {\n    margin-top: $spacing-4;\n  }\n\n  .rating {\n    padding: 4px 0;\n  }\n}\n\n.profile-footer {\n  display: flex;\n  flex-wrap: wrap;\n  gap: $spacing-4;\n\n  @include desktop {\n    grid-column: 2;\n  }\n\n  @include mobile {\n    flex-direction: column;\n    gap: $spacing-4;\n  }\n}\n\n.review {\n  @include flex-column;\n  width: 100%;\n\n  .heading {\n    margin-top: $spacing-4;\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n  }\n\n  .review-title {\n    font-weight: $font-semibold;\n  }\n\n  .delete-btn {\n    padding: $spacing-2;\n    background-color: $gray-light;\n    border-radius: $rounded;\n    display: flex;\n\n    :deep(svg path) {\n      stroke: #222;\n    }\n  }\n}\n\n.end-of-reviews {\n  margin-top: $spacing-4;\n}\n</style>","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createStaticVNode as _createStaticVNode } from \"vue\"\n\nconst _hoisted_1 = {\n  viewBox: \"0 0 16 16\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createStaticVNode(\"<g clip-path=\\\"url(#clip0_6115_15574)\\\"><path d=\\\"M14.7933 1.2069C14.5662 0.980771 14.2966 0.801879 14 0.680557C13.7033 0.559234 13.3856 0.497886 13.0651 0.500056C12.7447 0.502225 12.4278 0.56787 12.1328 0.693197C11.8379 0.818524 11.5707 1.00105 11.3467 1.23023L1.68 10.8969L0.5 15.5002L5.10333 14.3196L14.77 4.6529C14.9992 4.42899 15.1818 4.16186 15.3072 3.86695C15.4326 3.57204 15.4982 3.25521 15.5004 2.93477C15.5026 2.61432 15.4412 2.29663 15.3198 2.00005C15.1985 1.70347 15.0195 1.43389 14.7933 1.2069Z\\\" stroke=\\\"#8C8C8C\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M11.0703 1.50781L14.493 4.93048\\\" stroke=\\\"#8C8C8C\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M1.67969 10.8955L5.10569 14.3155\\\" stroke=\\\"#8C8C8C\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path></g><defs><clipPath id=\\\"clip0_6115_15574\\\"><rect width=\\\"16\\\" height=\\\"16\\\" fill=\\\"white\\\"></rect></clipPath></defs>\", 2)\n  ])))\n}\nexport default { render: render }","<template>\n  <div class=\"itinerary-title-wrapper\">\n    <div ref=\"rootEl\" class=\"itinerary-title\" :class=\"{ editing }\">\n      <div class=\"page-title\"\n           ref=\"titleInput\"\n           v-contenteditable=\"editable && 'plaintext-only'\"\n           @click=\"editing = true\"\n           @beforeinput=\"onBeforeInput($event)\"\n           @keydown.enter.prevent=\"editing = false\">\n        {{ metaStore.title || text }}\n      </div>\n\n      <div class=\"toolbar\" v-if=\"editable\">\n        <div class=\"char-count\">{{ titleInputLength }}/{{ maxChars }}</div>\n        <button class=\"edit-btn\" @click=\"selectTitleInput()\">\n          <PencilIcon width=\"16\"/>\n        </button>\n      </div>\n    </div>\n\n    <div v-if=\"metaStore.productId\" class=\"itinerary-id\">ID: {{ metaStore.productId }}</div>\n  </div>\n</template>\n\n<script setup>\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore\";\nimport PencilIcon from 'app/assets/images/common/pencil.svg?component';\nimport { nextTick, onMounted, ref, watch } from \"vue\";\nimport { onClickOutside, useMutationObserver } from '@vueuse/core'\n\ndefineProps({\n  text: String,\n  editable: {\n    type: Boolean,\n    default: false\n  }\n});\nconst { metaStore, queueFn, markDirty } = useCmsIndexStore();\nconst rootEl = ref();\nconst titleInput = ref();\nconst editing = ref(false);\nconst maxChars = ref(60);\nconst titleInputLength = ref('');\n\nonClickOutside(rootEl, () => editing.value = false);\nwatch(editing, saveTitleInput);\n\nonMounted(setTitleLength);\nuseMutationObserver(titleInput, setTitleLength, { characterData: true, subtree: true });\n\nfunction selectTitleInput() {\n  editing.value = true;\n  nextTick(() => window.getSelection().selectAllChildren(titleInput.value));\n}\n\nfunction setTitleLength() {\n  titleInputLength.value = titleInput.value?.innerText?.length ?? '';\n}\n\nfunction saveTitleInput() {\n  markDirty();\n  const title = titleInput.value.innerText;\n  if (metaStore.title !== title) {\n    metaStore.title = title;\n    queueFn(async () => metaStore.apiSaveDraft({ draft_itinerary: { title } }), 'update-title');\n  }\n}\n\nfunction onBeforeInput(e) {\n  const newTitle = titleInput.value.innerText + (e.data ?? '');\n\n  if (newTitle.length > maxChars.value) {\n    e.preventDefault();\n  }\n}\n</script>\n\n<style lang=\"scss\" scoped>\n@import \"app/assets/stylesheets/litecms\";\n\n.itinerary-title-wrapper {\n  @include flex-column($spacing-3);\n}\n\n.itinerary-title {\n  display: flex;\n  align-items: center;\n  gap: $spacing-3;\n  margin-right: auto;\n\n  @include mobile {\n    flex-direction: column;\n    align-items: start;\n  }\n\n  &.editing .page-title {\n    border: 1px solid $gray-lighter;\n    border-radius: $rounded;\n    padding: calc(#{$spacing-3} - 1px) calc(#{$spacing-5} - 1px);\n  }\n}\n\n.page-title {\n  outline: none;\n}\n\n.toolbar {\n  display: flex;\n  align-items: center;\n  gap: $spacing-3;\n}\n\n.char-count {\n  color: $gray;\n}\n\n.edit-btn {\n  display: inline-flex;\n\n  :deep(svg path) {\n    stroke: $brand-tertiary;\n  }\n}\n\n.itinerary-id {\n  color: $gray;\n}\n</style>","<template>\n  <input\n    type=\"number\"\n    class=\"form-input number\"\n    :class=\"{ invalid }\"\n    v-bind=\"$attrs\"\n    v-model=\"model\"\n  />\n</template>\n\n<script setup>\nimport { computed } from \"vue\";\n\nconst props = defineProps({\n  positive: { type: Boolean, default: false },\n  min: { type: [Number, String], default: null },\n  max: { type: [Number, String], default: null },\n});\n\nconst model = defineModel();\n\nconst invalid = computed(() => {\n  const n = model.value;\n  const { positive, min, max } = props;\n  return (n && positive && n < 0)\n    || (n && min && n < min)\n    || (n && max && n > max);\n});\n</script>\n\n<style lang=\"scss\" scoped>\n.invalid {\n  border-color: $brand-secondary;\n}\n</style>\n","<template>\n  <div class=\"social-input\">\n    <div class=\"social-input__label-container\">\n      <div class=\"social-input__network-name\">\n        <i class=\"icon\" :class=\"icon\" />\n        <span>\n          {{ label }}\n        </span>\n      </div>\n      <div class=\"social-input__network-action\" v-if=\"isEdit\" @click=\"$emit('closeField')\">\n        <span>\n          {{ t('cancel') }}\n        </span>\n      </div>\n      <div class=\"social-input__network-action\" v-else @click=\"$emit('openField')\">\n        <span v-if=\"value\">\n          {{ t('edit_username') }}\n        </span>\n        <span v-else>\n          {{ t('add', { label }) }}\n        </span>\n      </div>\n    </div>\n    <div class=\"social-input__input-container\" v-if=\"isEdit\">\n      <Input\n        :label=\"t('username')\"\n        :value=\"value\"\n        @input=\"v => $emit('input', v)\"\n      >\n        <template v-slot:left>\n          <span class=\"social-input__at\">@</span>\n        </template>\n      </Input>\n    </div>\n    <div class=\"social-input__value\" v-else-if=\"!!valueDisplay\">\n      @{{ valueDisplay }}\n    </div>\n  </div>\n</template>\n\n<script setup>\nimport { Input } from '@/components/Theme';\nimport { computed } from \"vue\";\nimport { useShared } from \"@/helpers/vueHelpers.js\";\n\nconst {t} = useShared();\nconst props = defineProps({\n  icon: String,\n  label: String,\n  isEdit: Boolean,\n  value: String,\n  originalValue: String\n});\ndefineEmits(['input', 'openField', 'closeField']);\n\nconst valueChanged = computed(() => props.value !== props.originalValue);\nconst valueDisplay = computed(() => valueChanged.value ? props.value : props.originalValue || props.value);\n</script>\n\n<style lang=\"scss\" scoped>\n.social-input {\n  display: grid;\n  gap: $spacing-4;\n}\n.social-input__label-container {\n  display: flex;\n  justify-content: space-between;\n}\n.social-input__network-name {\n  display: flex;\n  gap: $spacing-2;\n  font-weight: $font-semibold;\n}\n.social-input__network-action {\n  color: $brand-tertiary;\n  cursor: pointer;\n}\n.social-input__at {\n  color: $gray;\n  font-weight: $font-medium;\n  margin-right: $spacing-1;\n}\n.social-input__value {\n  font-weight: $font-medium;\n  color: $gray;\n}\n</style>\n\n<i18n lang=\"yaml\">\nen:\n  add: Add {label}\n  cancel: Cancel\n  username: USERNAME\n  edit_username: Edit username\n</i18n>\n","<template>\n  <SocialInput\n    v-bind=\"$attrs\"\n    @openField=\"show = true\"\n    @closeField=\"onCancel\"\n    :isEdit=\"show\"\n    :value=\"model\"\n    @input=\"model = $event\"\n    :originalValue=\"initValue\"\n  />\n</template>\n\n<script setup>\nimport SocialInput from \"@/modules/HeroDashboard/ProfileSetup/SocialInput.vue\";\nimport { ref, watch } from \"vue\";\n\nconst show = ref(false);\nconst model = defineModel();\nconst initValue = ref();\n\nwatch(model, (aft, bef) => {\n  if (typeof aft === 'string' && typeof bef === \"undefined\") {\n    initValue.value = aft;\n  }\n});\n\nfunction onCancel() {\n  model.value = initValue.value;\n  show.value = false;\n}\n</script>","<template>\n  <div v-if=\"profile\" class=\"profile\">\n    <div class=\"profile-avatar\">\n      <img v-if=\"essentialStore.heroProfile.image\"\n            :src=\"essentialStore.heroProfile.image\"\n            alt=\"avatar\">\n      <div v-else class=\"avatar-placeholder\">\n        <ProfileImageIcon width=\"87.37\"/>\n      </div>\n      <button @click=\"open\">{{ essentialStore.heroProfile.image ? 'Change photo' : 'Upload photo' }}</button>\n    </div>\n\n    <div>\n      <div class=\"form-label\">Name</div>\n      <input class=\"form-input profile-name\" type=\"text\" v-model=\"essentialStore.heroProfile.name\">\n\n      <div class=\"form-label\">Bio</div>\n      <textarea class=\"form-input profile-bio\" v-model=\"essentialStore.heroProfile.bio\"></textarea>\n\n      <div class=\"form-label social-media\">Social Media</div>\n      <SocialMediaInput\n        class=\"instagram\"\n        label=\"Instagram\"\n        icon=\"icon-social-instagram\"\n        v-model=\"essentialStore.heroProfile.instagram\"\n      />\n      <SocialMediaInput\n        class=\"tiktok\"\n        label=\"TikTok\"\n        icon=\"icon-tiktok\"\n        v-model=\"essentialStore.heroProfile.tiktok\"\n      />\n    </div>\n\n    <div class=\"profile-footer\">\n      <Button class=\"save-btn\" color=\"primary\" color-filled @click=\"onSave()\">Save profile</Button>\n    </div>\n  </div>\n\n  <StatefulConfirmationDialog\n    name=\"hero-profile\"\n    title=\"Changes will update all itineraries\"\n    description=\"Please confirm that updating your profile will apply these changes to all your itineraries.\"\n  />\n</template>\n\n<script setup>\nimport api from \"@/utils/api.js\";\nimport SocialMediaInput from \"@/modules/LiteCMS/Essentials/SocialMediaInput.vue\";\nimport ProfileImageIcon from 'app/assets/images/cms/profile_image.svg?component';\nimport { useFileDialog, useObjectUrl } from '@vueuse/core'\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore.ts\";\nimport { serialize } from \"object-to-formdata\";\nimport { Button } from \"@/components/Theme/index.js\";\nimport StatefulConfirmationDialog from \"@/components/ConfirmationDialog/StatefulConfirmationDialog.vue\";\nimport { useConfirmationDialog } from \"@/components/ConfirmationDialog/StatefulConfirmationDialog.ts\";\n\nconst { essentialStore, retrieveHeroProfile } = useCmsIndexStore();\ndefineProps({ profile: Object });\n\nlet newImage = null;\nconst { open, onChange } = useFileDialog({ accept: 'image/*', multiple: false });\n\nconst confirmUpdateHero = useConfirmationDialog('hero-profile').provide();\n\nfunction onSave() {\n  confirmUpdateHero.open();\n  confirmUpdateHero.onConfirm(saveToApi);\n}\n\nasync function saveToApi() {\n  const hero = {\n    name: essentialStore.heroProfile.name,\n    bio: essentialStore.heroProfile.bio,\n    instagram_username: essentialStore.heroProfile.instagram,\n    tiktok_username: essentialStore.heroProfile.tiktok\n  };\n  if (newImage) {\n    hero.image = newImage;\n  }\n  await api.put('/api/hero/profile', serialize({ hero }));\n  essentialStore.heroProfile = await retrieveHeroProfile();\n}\n\nonChange(([file]) => {\n  newImage = file;\n  essentialStore.heroProfile.image = useObjectUrl(file).value;\n})\n</script>\n\n<style lang=\"scss\" scoped>\n@import \"app/assets/stylesheets/litecms\";\n\n.profile {\n  display: grid;\n  grid-template-columns: 230px 1fr;\n  gap: $spacing-6;\n\n  textarea {\n    height: 200px;\n  }\n\n  .form-label:not(:first-of-type) {\n    margin-top: $spacing-4;\n  }\n}\n\n.profile-avatar {\n  @include flex-column($spacing-3);\n\n  img {\n    width: 100%;\n  }\n\n  button {\n    color: $brand-tertiary;\n  }\n\n  .upload_input {\n    display: none;\n  }\n\n  .avatar-placeholder {\n    width: 100%;\n    height: 307px;\n    display: flex;\n    justify-content: center;\n    background-color: $gray-light;\n    border-radius: $rounded;\n  }\n}\n\n.social-media {\n  margin-bottom: 0;\n}\n\n.instagram {\n  border-bottom: 1px solid $gray-lighter;\n}\n\n.instagram, .tiktok {\n  gap: $spacing-3;\n  padding: $spacing-3 0;\n}\n\n.profile-footer {\n  display: flex;\n  flex-wrap: wrap;\n  gap: $spacing-4;\n\n  @include desktop {\n    grid-column: 2;\n  }\n\n  @include mobile {\n    flex-direction: column;\n    gap: $spacing-4;\n  }\n}\n\n</style>\n","<template>\n  <SearchableSelect\n    :options=\"countries\"\n    :value=\"model?.country_code || ''\"\n    @select=\"onSelectResult\"\n  />\n</template>\n\n<script setup lang=\"ts\">\nimport { Destination } from \"@/stores/liteCMS/cmsData\";\nimport SearchableSelect from \"@/components/Theme/SearchableSelect.vue\";\nimport COUNTRIES from '@/dataset/countries.json';\nimport api from \"@/utils/api\";\n\nconst countries = COUNTRIES.map(c => ({value: c.alpha2, label: c.name})).sort((a, b) => a.label.localeCompare(b.label));\nconst model = defineModel<Destination>();\nconst emit = defineEmits(['select']);\n\nasync function onSelectResult(countryCode: string) {\n  const { data } = await api.get(`/api/find_country?code=${encodeURI(countryCode)}`);\n  if (data) setDestination(data);\n}\n\nasync function setDestination(destination: Destination) {\n  if (model.value) {\n    model.value.country = destination.country;\n    model.value.country_code = destination.country_code;\n  }\n  emit('select', destination);\n}\n</script>\n\n<style lang=\"scss\" scoped>\n@import \"app/assets/stylesheets/litecms\";\n</style>\n\n","<template>\n  <div class=\"essentials container\">\n    <BackButton @back=\"metaStore.back()\"/>\n    <ItineraryTitle text=\"Create new itinerary\" :editable=\"metaStore.title.length > 0\" />\n\n    <PageBody :saveFn=\"saveOnEssentialPage\">\n      <section class=\"panel\"\n               v-for=\"(dest, i) in essentialStore.destinations\" :key=\"i\"\n               :set1=\"title = `Destination ${optionalNumbering(i + 1, essentialStore.destinations.length > 1)}`\"\n               :set2=\"notFirst = dest !== essentialStore.firstDestination\"\n               :set3=\"isLast = dest === essentialStore.lastDestination\"\n      >\n        <div class=\"title\">{{ title }}</div>\n\n        <DivWithId v-slot=\"{ id }\">\n          <div class=\"form-label required\">Destination</div>\n\n          <SearchDestination\n            :id=\"id\"\n            v-model=\"essentialStore.destinations[i]\"\n            @select=\"i === 0 ? setCountryOnSelectFirstDestination($event) : null\"/>\n\n          <CmsInputValidation :id=\"id\" :checker=\"() => dest.city\" basic />\n        </DivWithId>\n\n        <DivWithId v-slot=\"{ id }\">\n          <div class=\"form-label required\">Country</div>\n\n          <SearchCountry\n            :id=\"id\"\n            v-model=\"essentialStore.destinations[i]\"\n            @select=\"i === 0 ? setCountryOnSelectFirstDestination($event) : null\"\n          />\n\n          <CmsInputValidation :id=\"id\" :checker=\"() => dest.country && dest.country_code\" basic />\n        </DivWithId>\n\n        <div v-if=\"i === 0 && dest.country && essentialStore.destTimezones.length > 0\">\n          <div class=\"form-label required\">time zone of itinerary</div>\n          <SelectInput :options=\"essentialStore.destTimezones\" v-model=\"essentialStore.timezone\" empty=\"\" />\n        </div>\n\n        <template v-if=\"notFirst || isLast\">\n          <div class=\"line\"></div>\n          <button v-if=\"notFirst\" class=\"link\" @click=\"removeDestination(dest)\">Remove destination</button>\n          <Button v-if=\"isLast\" class=\"btn\" @click=\"essentialStore.newDestination()\">Add another destination</Button>\n        </template>\n      </section>\n\n      <section class=\"panel\">\n        <div class=\"title\">Trip basics</div>\n\n        <div class=\"travel-dates\">\n          <div>\n            <div class=\"form-label required\">Travel Dates</div>\n            <DateRangeInput id=\"trip-dates\" v-model=\"essentialStore.tripDates\"/>\n            <CmsInputValidation id=\"trip-dates\" :checker=\"() => essentialStore.tripDates.startDate && essentialStore.tripDates.endDate\" />\n            <div class=\"instruction-text\">Choose from the day you land to the day you leave</div>\n          </div>\n          <div>\n            <div class=\"form-label required\">Duration</div>\n            <input class=\"form-input\" type=\"text\" :value=\"essentialStore.tripDuration\" disabled>\n          </div>\n        </div>\n\n        <div>\n          <div class=\"form-label required\">Group Size</div>\n          <div id=\"group-size\" class=\"number-range\">\n            <NumberInput placeholder=\"Min\" v-model=\"essentialStore.groupMin\" positive :max=\"essentialStore.groupMax\" />\n            <span>to</span>\n            <NumberInput placeholder=\"Max\" v-model=\"essentialStore.groupMax\" positive :min=\"essentialStore.groupMin\" />\n          </div>\n          <CmsInputValidation id=\"group-size\" :checker=\"() => essentialStore.groupMin && essentialStore.groupMax\"/>\n          <CmsInputValidation id=\"group-size\" :checker=\"() => essentialStore.groupMin <= essentialStore.groupMax\" message=\"Invalid group size range\" />\n        </div>\n\n        <section>\n          <div class=\"form-label required\">activity level</div>\n          <ActivitySelector v-model=\"essentialStore.activityLevel\"/>\n          <CmsInputValidation :checker=\"() => essentialStore.activityLevel\" />\n        </section>\n      </section>\n\n      <section class=\"panel\" v-if=\"essentialStore.supplierProfile\">\n        <div class=\"title\">Your profile</div>\n        <SupplierProfileEditor />\n      </section>\n\n      <section class=\"panel\" v-else-if=\"essentialStore.heroProfile\">\n        <div class=\"title\">Your profile</div>\n        <HeroProfileEditor :profile=\"essentialStore.heroProfile\" />\n      </section>\n    </PageBody>\n  </div>\n\n  <StatefulConfirmationDialog\n    name=\"destination\"\n    title=\"Are you sure you want to remove this destination?\"\n    description=\"Once you remove it, you cannot undo it.\"\n    confirm=\"Remove\"\n    cancel=\"Back\"\n  />\n</template>\n\n<script setup>\nimport { Button } from \"@/components/Theme/index.js\";\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore.ts\";\nimport BackButton from \"@/modules/LiteCMS/Common/BackButton.vue\";\nimport PageBody from \"@/modules/LiteCMS/Common/PageBody.vue\";\nimport SelectInput from \"@/modules/LiteCMS/Common/SelectInput.vue\";\nimport SearchDestination from \"@/modules/LiteCMS/Essentials/SearchDestination.vue\";\nimport DateRangeInput from \"@/modules/LiteCMS/Common/DateRangeInput.vue\";\nimport ActivitySelector from \"@/modules/LiteCMS/Essentials/ActivitySelector.vue\";\nimport SupplierProfileEditor from \"@/modules/LiteCMS/Essentials/SupplierProfileEditor.vue\";\nimport ItineraryTitle from \"@/modules/LiteCMS/Common/ItineraryTitle.vue\";\nimport StatefulConfirmationDialog from \"@/components/ConfirmationDialog/StatefulConfirmationDialog.vue\";\nimport { useConfirmationDialog } from \"@/components/ConfirmationDialog/StatefulConfirmationDialog.ts\";\nimport CmsInputValidation from \"@/modules/LiteCMS/Common/CmsInputValidation.vue\";\nimport { optionalNumbering } from \"@/utils/stringUtils.js\";\nimport DivWithId from \"@/components/Containers/DivWithId.vue\";\nimport NumberInput from \"@/modules/LiteCMS/Common/NumberInput.vue\";\nimport HeroProfileEditor from \"@/modules/LiteCMS/Essentials/HeroProfileEditor.vue\";\nimport SearchCountry from \"@/modules/LiteCMS/Essentials/SearchCountry.vue\";\n\nconst { metaStore, essentialStore, saveOnEssentialPage } = useCmsIndexStore();\nconst confirmRemoveDestination = useConfirmationDialog('destination').provide();\n\nfunction setCountryOnSelectFirstDestination({ country, country_code, timezones }) {\n  essentialStore.country = country_code;\n  essentialStore.countryName = country;\n  essentialStore.countryTimezones = timezones ?? [];\n  essentialStore.timezone = timezones?.[0].identifier ?? '';\n}\n\nfunction removeDestination(dest) {\n  confirmRemoveDestination.open();\n  confirmRemoveDestination.onConfirm(() => essentialStore.removeDestination(dest));\n}\n</script>\n\n<style lang=\"scss\" scoped>\n@import 'app/assets/stylesheets/litecms';\n\n.btn, .link {\n  margin-right: auto;\n}\n\n.link {\n  color: $brand-tertiary;\n}\n\n.travel-dates {\n  display: grid;\n  grid-template-columns: 1fr 1fr;\n  gap: $spacing-6;\n\n  @include mobile {\n    grid-template-columns: 1fr;\n  }\n\n  input:disabled {\n    color: $gray;\n    background-color: $gray-lighter;\n  }\n}\n</style>\n","<template>\n  <SearchApiInput\n    v-model=\"model\"\n    v-bind=\"$attrs\"\n    :queryFn=\"autocomplete\"\n    :resultFn=\"$event => $event\"\n    :onSelectFn=\"onSelectResult\"\n    placeholder=\"Try “Finca Luna Nueva” or “1601 Biscayne”\"\n    @clear=\"$emit('address', '')\"\n  />\n</template>\n\n<script setup lang=\"ts\">\nimport api from '@/utils/api.js';\nimport SearchApiInput from \"@/modules/LiteCMS/Common/SearchApiInput.vue\";\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore\";\n\nconst { essentialStore } = useCmsIndexStore();\nconst emit = defineEmits(['address']);\nconst model = defineModel();\n\nconst searchParams = (text: string) => {\n  return {\n    text,\n    country_codes: essentialStore.destinations.map(x => x.country_code)\n  };\n};\n\nasync function autocomplete(text: string) {\n  const { data } = await api.post('/api/places/autocomplete', searchParams(text));\n  return (data.suggestions ?? []).map(s => s.placePrediction.text.text);\n}\n\nasync function onSelectResult(text: string) {\n  model.value = text;\n  const { data } = await api.post('/api/places/search', searchParams(text));\n  const address = data.places?.[0]?.formattedAddress;\n  emit('address', address);\n}\n</script>","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createStaticVNode as _createStaticVNode } from \"vue\"\n\nconst _hoisted_1 = {\n  viewBox: \"0 0 37 36\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createStaticVNode(\"<g clip-path=\\\"url(#clip0_5520_24189)\\\"><path d=\\\"M28.625 12.75L18.4985 2.625L8.375 12.75H13.9985V22.875C13.9985 23.1734 14.117 23.4595 14.328 23.6705C14.539 23.8815 14.8251 24 15.1235 24H21.8735C22.1719 24 22.458 23.8815 22.669 23.6705C22.88 23.4595 22.9985 23.1734 22.9985 22.875V12.75H28.625Z\\\" stroke=\\\"#8C8C8C\\\" stroke-width=\\\"2.25\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M35.375 26.25V30.75C35.375 31.3467 35.1379 31.919 34.716 32.341C34.294 32.7629 33.7217 33 33.125 33H3.875C3.27826 33 2.70597 32.7629 2.28401 32.341C1.86205 31.919 1.625 31.3467 1.625 30.75V26.25\\\" stroke=\\\"#8C8C8C\\\" stroke-width=\\\"2.25\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path></g><defs><clipPath id=\\\"clip0_5520_24189\\\"><rect width=\\\"36\\\" height=\\\"36\\\" fill=\\\"white\\\" transform=\\\"translate(0.5)\\\"></rect></clipPath></defs>\", 2)\n  ])))\n}\nexport default { render: render }","<template>\n  <UploadIcon class=\"icon\" width=\"37\"/>\n  <div class=\"title\">{{ t('drop_instruction') }}\n    <button @click=\"$emit('browse')\">{{ t('browse_file') }}</button>\n  </div>\n  <div class=\"text\">\n    <div>{{ t('files_supported') }}: {{ accept }}</div>\n    <div>{{ t('max_size') }}: <span>{{ maxSize }}</span></div>\n  </div>\n</template>\n\n<script setup>\nimport UploadIcon from 'app/assets/images/operatorDashboard/upload.svg?component';\nimport { useShared } from \"@/helpers/vueHelpers.js\";\n\ndefineProps({\n  accept: String,\n  maxSize: String\n});\n\ndefineEmits(['browse'])\n\nconst { t } = useShared();\n</script>\n\n<style lang=\"scss\" scoped>\n$subtitle-line-height: 26px;\n\n.icon {\n  display: block;\n  margin: auto;\n}\n\n.title {\n  text-align: center;\n  font-size: $text-xl;\n  line-height: $subtitle-line-height;\n  font-weight: $font-semibold;\n\n  button {\n    font-weight: $font-semibold;\n    color: $brand-tertiary;\n  }\n}\n\n.text {\n  text-align: center;\n  @include flex-column;\n  align-items: center;\n  gap: $spacing-3;\n  color: $gray;\n  line-height: $leading-snug;\n}\n</style>\n\n<i18n lang=\"yaml\">\nen:\n  drop_instruction: Drag and drop your file here or\n  browse_file: browse file\n  files_supported: Files supported\n  max_size: Maximum file size\n</i18n>","<template>\n  <div ref=\"container\" class=\"upload\" :class=\"{ disabled: !enabled, dropping: isOverDropZone }\">\n    <UploadFileIntro :accept=\"acceptStr\" :max-size=\"maxSize\" @browse=\"input.click()\"/>\n  </div>\n  <input ref=\"input\" type=\"file\" class=\"upload__input\" :accept=\"acceptStr\" @input=\"onFilesSelected($event.target.files)\" multiple>\n</template>\n\n<script setup>\nimport { ref } from \"vue\";\nimport { useDropZone } from '@vueuse/core'\nimport UploadFileIntro from \"@/components/Form/Upload/UploadFileIntro.vue\";\nimport { convertToBytes } from \"@/utils/numberUtils.js\";\n\nconst props = defineProps({\n  enabled: {\n    type: Boolean,\n    default: true,\n  },\n  max: {\n    type: Number,\n    default: 1\n  }\n})\n\nconst emit = defineEmits(['files']);\n\nconst input = ref(null);\nconst container = ref(null);\nconst accept = ['.jpg', '.jpeg', '.png'];\nconst acceptStr = accept.join(', ');\nconst maxSize = '10 MB';\nconst maxSizeBytes = convertToBytes(maxSize);\n\nconst {isOverDropZone} = useDropZone(container, onFilesSelected);\n\nfunction onFilesSelected(fileList) {\n  const rejected = [];\n  const files = [...fileList]\n    .filter(f => {\n      const pass = f.size <= maxSizeBytes && accept.find((ext) => f.name.toLowerCase().endsWith(ext));\n      if (!pass) rejected.push(f);\n      return pass;\n    })\n\n  if (rejected.length > 0) {\n    const rejectedFiles = rejected.map(f => `\"${f.name}\"`).join(', ');\n    alert(`The files: ${rejectedFiles} are not allowed.`);\n  }\n\n  if (files.length > props.max) {\n    alert(`You can't add more than ${props.max} images.`);\n  }\n\n  emit('files', files.slice(0, props.max));\n  input.value.value = '';\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.upload {\n  border: 1px solid $gray-lighter;\n  border-radius: $rounded;\n  display: grid;\n  gap: $spacing-3;\n  padding: $spacing-6;\n\n  &.disabled {\n    background-color: $gray-light;\n    pointer-events: none;\n\n    &:deep(*) {\n      color: $gray;\n    }\n  }\n\n  &.dropping {\n    border: 1px solid $brand-tertiary;\n  }\n}\n\n.upload__input {\n  display: none;\n}\n</style>","<template>\n  <div class=\"itinerary-image\">\n    <div class=\"left\">\n      <img :src=\"imgSrc\">\n      <button class=\"remove\" @click=\"$emit('remove')\">\n        <TrashIcon :width=\"16\"/>\n        <span>{{ t('remove') }}</span>\n      </button>\n    </div>\n\n    <form class=\"right\">\n      <label class=\"form-label required\">{{ t('title') }}</label>\n      <WithId v-slot=\"{ id }\">\n        <AutosizeTextarea :id=\"id\" class=\"form-input\" required type=\"text\" v-model=\"medium.title\" :disabled=\"medium.is_draft === false\" />\n        <CmsInputValidation :id=\"id\" :checker=\"() => isInputValid('title')\"/>\n      </WithId>\n\n      <label class=\"form-label required\">{{ t('caption') }}</label>\n      <WithId v-slot=\"{ id }\">\n        <AutosizeTextarea :id=\"id\" rows=\"2\" class=\"form-input\" required type=\"text\" v-model=\"medium.description\" :disabled=\"medium.is_draft === false\" />\n        <CmsInputValidation :id=\"id\" :checker=\"() => isInputValid('description')\"/>\n      </WithId>\n\n      <label class=\"form-label required\">{{ t('author_name') }}</label>\n      <WithId v-slot=\"{ id }\">\n        <AutosizeTextarea :id=\"id\" class=\"form-input\" required type=\"text\" v-model=\"medium.author_name\" :disabled=\"!!medium.external_url || medium.is_draft === false\"/>\n        <CmsInputValidation :id=\"id\" :checker=\"() => isInputValid('author_name')\"/>\n      </WithId>\n\n      <label class=\"form-label required\">{{ t('author_url') }}</label>\n      <WithId v-slot=\"{ id }\">\n        <AutosizeTextarea :id=\"id\" class=\"form-input\" required type=\"text\" v-model=\"medium.author_url\" :disabled=\"!!medium.external_url || medium.is_draft === false\"/>\n        <CmsInputValidation :id=\"id\" :checker=\"() => isInputValid('author_url')\"/>\n      </WithId>\n\n      <template v-if=\"!medium.external_url\">\n        <label class=\"form-label required\">{{ t('platform') }}</label>\n        <WithId v-slot=\"{ id }\">\n          <AutosizeTextarea :id=\"id\" class=\"form-input\" required type=\"text\" v-model=\"medium.platform\" :disabled=\"medium.is_draft === false\" />\n          <CmsInputValidation :id=\"id\" :checker=\"() => isInputValid('platform')\"/>\n        </WithId>\n\n        <label class=\"form-label required\">{{ t('platform_url') }}</label>\n        <WithId v-slot=\"{ id }\">\n          <AutosizeTextarea :id=\"id\" class=\"form-input\" required type=\"text\" v-model=\"medium.platform_url\" :disabled=\"medium.is_draft === false\" />\n          <CmsInputValidation :id=\"id\" :checker=\"() => isInputValid('platform_url')\"/>\n        </WithId>\n      </template>\n    </form>\n  </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { onMounted, ref } from \"vue\";\nimport { Medium } from \"@/stores/liteCMS/cmsData\";\nimport TrashIcon from 'app/assets/images/common/trash.svg?component';\nimport { useShared } from \"@/helpers/vueHelpers.js\";\nimport { useObjectUrl } from \"@vueuse/core\";\nimport CmsInputValidation from \"@/modules/LiteCMS/Common/CmsInputValidation.vue\";\nimport AutosizeTextarea from \"@/modules/LiteCMS/Common/AutosizeTextarea.vue\";\nimport WithId from \"@/components/Containers/WithId.vue\";\n\ntype Props = { medium: Medium }\nconst { medium } = defineProps<Props>();\n\ndefineEmits(['remove']);\n\nconst { t } = useShared();\nconst imgSrc = ref('' as any);\n\nonMounted(() => {\n  if (medium.file) {\n    imgSrc.value = useObjectUrl(medium.file).value;\n  } else if (medium.external_url) {\n    imgSrc.value = medium.external_url;\n  } else if (medium.image.url) {\n    imgSrc.value = medium.image.url;\n  }\n});\n\nconst isInputValid = (key) => {\n  if (medium.is_draft) {\n    return medium[key];\n  }\n  return true;\n};\n</script>\n\n<style lang=\"scss\" scoped>\n.itinerary-image {\n  border: 1px solid $gray-lighter;\n  border-radius: $rounded;\n  padding: $spacing-4;\n  gap: $spacing-6;\n  display: grid;\n  grid-template-columns: 214fr 405fr;\n\n  @include mobile {\n    @include flex-column;\n    border: none;\n    border-bottom: 1px solid $gray-lighter;\n    padding: 0 0 $spacing-6;\n    margin-bottom: $spacing-2;\n\n    &:last-of-type {\n      border-bottom: none;\n      padding-bottom: 0;\n      margin-bottom: 0;\n    }\n  }\n}\n\n.itinerary-image img {\n  width: 100%;\n  border-radius: $rounded;\n}\n\n.itinerary-image form {\n  label {\n    font-size: $text-xs;\n    line-height: $text-sm;\n    font-weight: $font-bold;\n    color: $gray;\n    margin-bottom: 6px;\n  }\n\n  label:not(:first-child) {\n    margin-top: $spacing-4;\n  }\n}\n\n.itinerary-image .left {\n  @include flex-column;\n  align-items: center;\n  gap: $spacing-3;\n\n  .remove {\n    display: flex;\n    gap: $spacing-2;\n    color: $gray;\n  }\n}\n\n.itinerary-image .right {\n  @include flex-column;\n}\n\n.form-input:disabled {\n  color: $gray;\n  background-color: $gray-lighter;\n}\n</style>\n\n<i18n lang=\"yaml\">\nen:\n  remove: Remove\n  title: Title\n  caption: Caption\n  author_name: Author Name\n  author_url: Author URL\n  platform: Platform\n  platform_url: Platform url\n</i18n>\n","<template>\n  <div class=\"unsplash-search\">\n    <div class=\"search-wrapper\">\n      <input type=\"text\" class=\"form-input search\" v-model=\"query\">\n      <i class=\"icon icon-search\"/>\n    </div>\n\n    <div ref=\"results\" class=\"api-results\" v-if=\"loading || api.results.length > 0\">\n\n      <div class=\"image\"\n           v-for=\"(res, i) in api.results\" :key=\"i\"\n           @click=\"$emit('select', res)\">\n        <div class=\"selected\" v-if=\"imageIds.includes(res.id)\">\n          <RoundCheck/>\n        </div>\n\n        <img :src=\"res.urls.small\" :alt=\"res.alt_description\">\n\n        <div class=\"user\">{{ res.user.name }}</div>\n      </div>\n\n      <template v-if=\"loading\">\n        <div v-for=\"i in limit\" :key=\"i\" class=\"image\">\n          <div class=\"placeholder\"></div>\n        </div>\n      </template>\n\n      <div v-if=\"hasMoreResults\" class=\"load-more\">\n        <Button @click=\"loadMoreResults()\" :disabled=\"loading\">{{ t('load_more') }}</Button>\n      </div>\n    </div>\n  </div>\n</template>\n\n<script setup>\nimport axios from \"axios\";\nimport { ref, reactive, watch, computed } from \"vue\";\nimport { useDebounceFn, useElementSize, watchDebounced } from \"@vueuse/core\";\nimport { Button, RoundCheck } from \"@/components/Theme/index.js\";\nimport { useShared } from \"@/helpers/vueHelpers.js\";\nimport { extractNumber } from \"@/utils/numberUtils.js\";\n\ndefineEmits(['select']);\ndefineProps({ imageIds: Array });\nconst { t, mobile } = useShared();\nconst query = ref('');\nconst page = ref(1);\nconst limit = 28; // 30 max\nconst api = reactive({\n  results: [],\n  total: null,\n  total_pages: null\n});\nconst results = ref();\nconst loading = ref(false);\nconst hasMoreResults = computed(() => page.value < api.total_pages);\n\nconst queryApi = async () => {\n  if (!query.value) return;\n  try {\n    loading.value = true;\n    const { data } = await axios.get(`/api/search_images?query=${query.value}&page=${page.value}&per_page=${limit}`);\n    const ids = api.results.map(r => r.id);\n    api.results = [...api.results, ...data.results.filter(r => !ids.includes(r.id))];\n    api.total = data.total;\n    api.total_pages = data.total_pages;\n  } catch (err) {\n    alert('Failed to fetch images from Unsplash');\n    console.error(err);\n  } finally {\n    loading.value = false\n  }\n};\n\nconst queryApiDebounced = useDebounceFn(queryApi, 300);\nconst { width, height } = useElementSize(results);\nconst rowsOfImage = computed(() => mobile.value ? 3.5 : 2.5); // .5 to indicate to user it's scrollable.\n\nwatch(query, (kw) => {\n  api.results = [];\n  api.total = api.total_pages = null;\n  page.value = 1;\n  if (kw.length > 0) {\n    queryApiDebounced();\n  }\n}, { immediate: true });\n\nwatchDebounced(() => [results, width, height], ([results, width, height]) => {\n  const image = results.value?.querySelector('.image');\n  if (results.value && width.value && height.value && image) {\n    const rowGap = window.getComputedStyle(results.value).rowGap;\n    const imageHeight = image.clientHeight || 0;\n    const gapHeight = extractNumber(rowGap) || 0;\n    const containerHeight = (imageHeight + gapHeight) * rowsOfImage.value - gapHeight;\n    if (containerHeight > 0) {\n      results.value.style.maxHeight = containerHeight + 'px';\n    }\n  }\n}, { deep: true, debounce: 100 });\n\nasync function loadMoreResults() {\n  page.value += 1;\n  await queryApi();\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.unsplash-search {\n  @include flex-column($spacing-4);\n}\n\n.search-wrapper {\n  display: flex;\n  align-items: center;\n  position: relative;\n\n  input {\n    padding-right: $spacing-12;\n  }\n\n  .icon-search {\n    position: absolute;\n    right: $spacing-5;\n  }\n}\n\n.api-results {\n  display: grid;\n  grid-template-columns: repeat(4, 1fr);\n  column-gap: $spacing-4;\n  row-gap: $spacing-3;\n  height: 100%;\n  max-height: 400px; // initial height, actual will be set dynamically in JS\n  overflow-y: auto;\n  padding-left: $spacing-4;\n  padding-right: $spacing-4;\n  margin-left: -$spacing-4;\n  margin-right: -$spacing-4;\n\n  @include mobile {\n    grid-template-columns: repeat(2, 1fr);\n  }\n\n  .image {\n    display: flex;\n    position: relative;\n    cursor: pointer;\n    width: 100%;\n    aspect-ratio: 1;\n\n    .user {\n      position: absolute;\n      left: 0;\n      right: 0;\n      bottom: 0;\n      font-size: $text-sm;\n      line-height: $text-base;\n      background-color: rgba(255, 255, 255, 0.6);\n      padding: $spacing-2 $spacing-4;\n      opacity: 0;\n      transform: translateY(100%);\n      transition: all 100ms ease-in-out;\n    }\n\n    .selected {\n      position: absolute;\n      inset: 0;\n      background-color: rgba(255, 255, 255, 0.6);\n\n      :deep(.theme-round-check) {\n        margin: $spacing-3 $spacing-3 $spacing-3 auto;\n      }\n    }\n\n    &:hover .user {\n      transform: translateY(0%);\n      opacity: 1;\n    }\n\n    img, .placeholder {\n      border-radius: $rounded;\n      background-color: $gray-light;\n      object-fit: cover;\n      width: 100%;\n      height: 100%;\n    }\n  }\n}\n\n.load-more {\n  grid-column: 1/-1;\n  display: flex;\n  justify-content: center;\n  padding-top: $spacing-1;\n}\n</style>\n\n<i18n lang=\"yaml\">\nen:\n  load_more: Load more\n</i18n>","<template>\n  <div class=\"add-images\">\n    <div class=\"title\" :class=\"{ link: !expanded }\" @click=\"expanded = true\">{{ title || t('add_images') }}</div>\n\n    <template v-if=\"expanded\">\n      <div class=\"description\">{{ t('disclaimer') }}</div>\n      <div class=\"container\">\n        <div class=\"container__tabs\">\n          <div class=\"tab\">\n            <button @click=\"tab = 'unsplash'\" :class=\"{ selected: tab === 'unsplash' }\">\n              <Radio :checked=\"tab === 'unsplash'\"/>\n              <span>{{ t('search_unsplash') }}</span>\n            </button>\n          </div>\n          <div class=\"tab\">\n            <button @click=\"tab = 'upload'\" :class=\"{ selected: tab === 'upload' }\">\n              <Radio :checked=\"tab === 'upload'\"/>\n              <span>{{ t('upload_images') }}</span>\n            </button>\n          </div>\n        </div>\n        <div class=\"container__body unsplash\" v-show=\"tab === 'unsplash'\">\n          <UnsplashSearchImage :imageIds=\"imageKeys\" @select=\"toggleUnsplashImage($event)\"/>\n        </div>\n        <div class=\"container__body upload\" v-show=\"tab === 'upload'\">\n          <div class=\"terms\">\n            <SquareCheck\n              class=\"check\"\n              :checked=\"metaStore.agreedUpload\"\n              @click=\"metaStore.agreedUpload = !metaStore.agreedUpload\"\n            />\n            <div class=\"required\">{{ t('terms') }}</div>\n            <div class=\"warning\" v-if=\"!metaStore.agreedUpload\">{{ t('accept') }}</div>\n          </div>\n          <ImageUploader :enabled=\"metaStore.agreedUpload\" :max=\"remainingImages\" @files=\"addUploadedImages\"/>\n        </div>\n      </div>\n\n      <div v-if=\"model.length >= props.max\" class=\"image-limit-alert\">{{ t('max_images') }}</div>\n\n      <div class=\"title\">{{ t('manage_images', [model.length]) }}</div>\n      <div>{{ t('selected_images', [props.max, model.length]) }}</div>\n\n      <ItineraryImage\n        :medium=\"image\"\n        :key=\"image.id\"\n        v-for=\"(image, i) in model\"\n        @remove=\"removeImage(image, i)\"\n      />\n    </template>\n  </div>\n</template>\n\n<script setup>\nimport { computed, ref } from \"vue\";\nimport { Radio, SquareCheck } from \"@/components/Theme/index.js\";\nimport ImageUploader from \"@/modules/LiteCMS/Common/AddImages/ImageUploader.vue\";\nimport ItineraryImage from \"@/modules/LiteCMS/Common/AddImages/ItineraryImage.vue\";\nimport UnsplashSearchImage from \"@/modules/LiteCMS/Common/AddImages/UnsplashSearchImage.vue\";\nimport { useShared } from \"@/helpers/vueHelpers.js\";\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore.ts\";\n\nconst model = defineModel();\nconst props = defineProps({\n  title: String,\n  apiQuery: Object,\n  max: { type: Number, default: 5 },\n  collapsed: { type: Boolean, default: false }\n});\nconst tab = ref('unsplash');\nconst { t } = useShared();\nconst imageKeys = computed(() => model.value.map(i => i.key));\nconst remainingImages = computed(() => Math.max(props.max - model.value.length, 0));\nconst { queueFn, metaStore } = useCmsIndexStore();\nconst expanded = ref(!props.collapsed || model.value.length > 0);\n\nfunction addUploadedImages(list) {\n  list.forEach(file => {\n    model.value.push({\n      id: null,\n      file: file,\n      title: '',\n      description: '',\n      author_name: '',\n      author_url: '',\n      platform: '',\n      platform_url: '',\n    });\n  });\n}\n\nfunction toggleUnsplashImage(img) {\n  const key = img.id;\n  const exist = imageKeys.value.includes(key);\n  if (exist) {\n    model.value = model.value.filter(i => i.key !== key);\n  } else if (model.value.length < props.max) {\n    model.value.push({\n      key,\n      id: null,\n      title: img.description,\n      external_url: img.urls.regular,\n      description: img.alt_description,\n      author_name: img.user.name,\n      author_url: `https://unsplash.com/@${img.user.username}?utm_source=TourHero&utm_medium=referral`,\n      platform: 'Unsplash',\n      platform_url: 'https://unsplash.com/?utm_source=TourHero&utm_medium=referral',\n    });\n  }\n}\n\nfunction removeImage(image, idx) {\n  if (image.id) {\n    queueFn(() => metaStore.apiDelete('media', image.id, props.apiQuery));\n  }\n  model.value.splice(idx, 1);\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.add-images {\n  width: 100%;\n  font-size: $text-base;\n  line-height: $leading-snug;\n  font-weight: $font-medium;\n  @include flex-column($spacing-4);\n}\n\n.title {\n  font-weight: $font-semibold;\n\n  &.link {\n    cursor: pointer;\n    color: $brand-tertiary;\n  }\n}\n\n.description {\n  color: $gray;\n}\n\n.container {\n  border-radius: $rounded;\n  margin-bottom: $spacing-2;\n\n  @include desktop {\n    border: 1px solid $gray-lighter;\n  }\n}\n\n.container__tabs {\n  display: grid;\n\n  @include desktop {\n    border-bottom: 1px solid $gray-lighter;\n    grid-template-columns: 1fr 1fr;\n  }\n\n  .tab {\n    display: flex;\n\n    &:first-child {\n      @include desktop {\n        border-right: 1px solid $gray-lighter;\n      }\n    }\n\n    button {\n      flex: 1;\n      display: flex;\n      align-items: center;\n      gap: $spacing-3;\n      padding: $spacing-3 $spacing-1 calc($spacing-3 + 1px);\n      margin: 0 $spacing-2 -1px;\n      font-weight: $font-medium;\n\n      @include mobile {\n        margin-left: 0;\n        margin-right: 0;\n        padding-left: 0;\n        padding-right: 0;\n      }\n\n      &.selected {\n        color: $brand-tertiary;\n        border-bottom: 1px solid $brand-tertiary;\n      }\n    }\n  }\n}\n\n.container__body {\n  padding: $spacing-4;\n\n  @include mobile {\n    &.unsplash {\n      padding: $spacing-1 0 0;\n    }\n    &.upload {\n      padding: $spacing-4 0 0;\n    }\n  }\n\n  .terms {\n    display: grid;\n    grid-template-columns: auto 1fr;\n    gap: $spacing-3;\n    margin-bottom: $spacing-4;\n\n    & > div:nth-child(2),\n    & > div:nth-child(3) {\n      grid-column: 2;\n    }\n\n    .check {\n      margin-top: $spacing-1;\n    }\n\n    .required::after {\n      content: ' *';\n      color: $brand-secondary;\n    }\n\n    .warning {\n      color: $brand-secondary;\n    }\n  }\n}\n\n.image-limit-alert {\n  background-color: $brand-tertiary-light;\n  border: 1px solid $brand-tertiary;\n  border-radius: $rounded;\n  padding: $spacing-4;\n}\n</style>\n\n<i18n lang=\"yaml\">\nen:\n  add_images: Add images\n  disclaimer: Please use copyright-free or self-owned images. For copyright-free options, check out Unsplash. If uploading your own, remember to give credit where it's due.\n  search_unsplash: Search Unsplash\n  upload_images: Upload images\n  terms: I confirm ownership of the images and will provide proper credit. I understand and accept responsibility for any copyright infringement.\n  accept: Please accept the terms and agreement before you continue.\n  manage_images: Manage images ({0})\n  selected_images: Select 1 to {0} images. You selected {1} in total.\n  max_images: You already selected the maximum number of images.\n</i18n>\n\n","<template>\n  <div class=\"accommodation container\">\n    <BackButton @back=\"metaStore.back()\"/>\n    <ItineraryTitle editable />\n\n    <PageBody :saveFn=\"saveOnAccommodationPage\">\n      <section class=\"panel\"\n               v-for=\"(place, i) in accommodationStore.places\"\n               :key=\"i\"\n               ref=\"accommodationListEl\"\n               :set1=\"title = `Accommodation ${optionalNumbering(i + 1, accommodationStore.places.length > 1)}`\"\n               :set2=\"notFirst = place !== accommodationStore.firstPlace\"\n               :set3=\"isLast = place === accommodationStore.lastPlace\"\n      >\n        <SectionTitle :text=\"title\" :toggleable=\"!metaStore.validating\" :toggled=\"place.show\" @toggle=\"place.show = !place.show\" />\n\n        <template v-if=\"place.show || metaStore.validating\">\n          <DivWithId v-slot=\"{ id }\">\n            <div class=\"form-label required\">accommodation name</div>\n            <SearchAccommodation :id=\"id\" v-model=\"place.name\" @address=\"place.address = $event\" :title=\"title\" />\n            <CmsInputValidation :id=\"id\" :checker=\"() => place.name\" basic />\n          </DivWithId>\n          <DivWithId v-slot=\"{ id }\">\n            <div class=\"form-label required\">address</div>\n            <AutosizeTextarea :id=\"id\" type=\"text\" class=\"form-input\" v-model=\"place.address\" />\n            <CmsInputValidation :id=\"id\" :checker=\"() => place.address\" />\n          </DivWithId>\n\n          <ImageSelector collapsed v-model=\"place.draft_media\" :apiQuery=\"{ itinerary_accommodation_id: place.id }\" />\n        </template>\n\n        <template v-if=\"place.show && (notFirst || isLast)\">\n          <div class=\"line\"></div>\n          <button class=\"btn\" v-if=\"notFirst\"\n                  @click=\"removeAccommodation(place, i)\">Remove accommodation\n          </button>\n          <Button class=\"btn\" v-if=\"isLast\"\n                  @click=\"addAccommodation()\">Add another accommodation\n          </Button>\n        </template>\n      </section>\n    </PageBody>\n  </div>\n\n  <StatefulConfirmationDialog\n    title=\"Are you sure you want to remove this accommodation?\"\n    description=\"Once you remove it, you cannot undo it.\"\n    confirm=\"Remove\"\n    cancel=\"Back\"\n  />\n</template>\n\n<script setup>\nimport BackButton from \"@/modules/LiteCMS/Common/BackButton.vue\";\nimport PageBody from \"@/modules/LiteCMS/Common/PageBody.vue\";\nimport SearchAccommodation from \"@/modules/LiteCMS/Accommodation/SearchAccommodation.vue\";\nimport ImageSelector from \"@/modules/LiteCMS/Common/AddImages/ImageSelector.vue\";\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore.ts\";\nimport { Button } from \"@/components/Theme/index.js\";\nimport ItineraryTitle from \"@/modules/LiteCMS/Common/ItineraryTitle.vue\";\nimport StatefulConfirmationDialog from \"@/components/ConfirmationDialog/StatefulConfirmationDialog.vue\";\nimport { useConfirmationDialog } from \"@/components/ConfirmationDialog/StatefulConfirmationDialog.ts\";\nimport { nextTick, ref } from \"vue\";\nimport CmsInputValidation from \"@/modules/LiteCMS/Common/CmsInputValidation.vue\";\nimport AutosizeTextarea from \"@/modules/LiteCMS/Common/AutosizeTextarea.vue\";\nimport { optionalNumbering } from \"@/utils/stringUtils.js\";\nimport DivWithId from \"@/components/Containers/DivWithId.vue\";\nimport SectionTitle from \"@/modules/LiteCMS/Common/SectionTitle.vue\";\n\nconst { metaStore, accommodationStore, saveOnAccommodationPage } = useCmsIndexStore();\nconst accommodationListEl = ref();\nconst confirmRemove = useConfirmationDialog().provide();\n\nasync function removeAccommodation(place) {\n  confirmRemove.open();\n  confirmRemove.onConfirm(() => {\n    accommodationStore.removePlace(place);\n    openAndGotoLastPlace();\n  });\n}\n\nfunction addAccommodation() {\n  accommodationStore.newPlace();\n  openAndGotoLastPlace();\n}\n\nfunction openAndGotoLastPlace() {\n  accommodationStore.openLastPlace();\n  nextTick(() => accommodationListEl.value.at(-1)?.scrollIntoView());\n}\n</script>\n\n<style lang=\"scss\" scoped>\n@import 'app/assets/stylesheets/litecms';\n\n.btn {\n  color: $brand-tertiary;\n  margin-right: auto;\n}\n</style>\n","<template>\n  <SelectInput v-bind=\"$attrs\" v-model=\"model\" :options=\"numberList\" @infinite-scroll=\"incrementLength()\" />\n</template>\n\n<script setup>\nimport SelectInput from \"@/modules/LiteCMS/Common/SelectInput.vue\";\nimport { ref, computed } from \"vue\";\n\nconst props = defineProps({\n  min: {\n    type: Number,\n    default: 1\n  },\n  max: {\n    type: Number,\n    default: Infinity\n  }\n});\nconst model = defineModel();\nconst length = ref(20);\n\nconst numberList = computed(() => Array.from({ length: Number(model.value || 0) + length.value }, (v, i) => props.min + i).filter(n => n <= props.max));\n\nfunction incrementLength() {\n  const interval = props.max - props.min;\n  if (length.value < interval) {\n    length.value += 10;\n  }\n}\n</script>","<template>\n  <div class=\"wrapper\">\n    <div v-if=\"suggestions\" class=\"suggestions\">\n      <div class=\"label\">Suggestions</div>\n      <div class=\"list\">\n        <button class=\"item\"\n                :class=\"{ selected: model.includes(suggestion) }\"\n                @click=\"toggleTag(suggestion)\"\n                v-for=\"suggestion in suggestions\"\n        >{{ suggestion }}</button>\n      </div>\n    </div>\n\n    <div class=\"tags-area\" @click=\"input.focus()\" @keydown=\"onKeydown\">\n      <div class=\"item\" v-for=\"(tag, i) in model\">\n        <span>{{ tag }}</span>\n        <button><CloseIcon height=\"12\" @click=\"model.splice(i, 1)\" /></button>\n      </div>\n      <div ref=\"input\" class=\"input\" v-contenteditable=\"`plaintext-only`\"></div>\n    </div>\n\n    <div class=\"instruction-text\">Separate by commas</div>\n  </div>\n</template>\n\n<script setup>\nimport { ref } from \"vue\";\nimport { xor } from 'lodash';\nimport CloseIcon from 'app/assets/images/common/close.svg?component';\n\ndefineProps({ suggestions: Array });\nconst model = defineModel();\nconst input = ref();\n\nfunction onKeydown(e) {\n  if (e.code === 'Enter' || e.code === 'Comma') {\n    e.preventDefault();\n    model.value.push(e.target.textContent);\n    e.target.textContent = '';\n  }\n}\n\nfunction toggleTag(tag) {\n  model.value = xor(model.value, [tag]);\n}\n</script>\n\n<style lang=\"scss\" scoped>\n@import \"app/assets/stylesheets/litecms\";\n\n.wrapper {\n  @include flex-column;\n}\n\n.suggestions, .tags-area {\n  border: 1px solid $gray-lighter;\n  border-radius: $rounded;\n  padding: $spacing-3;\n}\n\n.suggestions {\n  margin-bottom: $spacing-3;\n\n  @include mobile {\n    border: none;\n    padding: 0;\n  }\n\n  .label {\n    text-transform: uppercase;\n    font-size: $text-xs;\n    line-height: $text-sm;\n    font-weight: $font-bold;\n    color: $gray;\n    margin-bottom: $spacing-3;\n\n    @include mobile {\n      display: none;\n    }\n  }\n\n  .list {\n    display: flex;\n    flex-wrap: wrap;\n    gap: $spacing-4;\n\n    @include mobile {\n      flex-wrap: nowrap;\n      overflow-x: auto;\n      @include hide-scrollbar;\n    }\n  }\n\n  .item {\n    border: 1px solid $gray-lighter;\n    border-radius: $rounded;\n    color: $gray;\n    padding: $spacing-3 $spacing-5;\n    font-weight: $font-semibold;\n\n    &.selected {\n      color: white;\n      border-color: $brand-tertiary;\n      background-color: $brand-tertiary;\n    }\n  }\n}\n\n.tags-area {\n  display: flex;\n  flex-wrap: wrap;\n  gap: $spacing-2;\n\n  .item {\n    border: 1px solid $brand-tertiary-light;\n    border-radius: $rounded;\n    padding: $spacing-3 $spacing-5;\n    background-color: $brand-tertiary-light;\n    display: flex;\n    align-items: center;\n    gap: $spacing-3;\n\n    button {\n      display: inline-flex;\n    }\n  }\n\n  .input {\n    min-width: 6rem;\n    display: flex;\n    align-items: center;\n    outline: none;\n    padding: $spacing-3 0;\n  }\n}\n</style>","var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {\n  ErrorCode2[\"docTypeError\"] = \"docTypeError\";\n  ErrorCode2[\"contextNotFound\"] = \"contextNotFound\";\n  ErrorCode2[\"timerNotFound\"] = \"timerNotFound\";\n  ErrorCode2[\"ctxCallOutOfScope\"] = \"ctxCallOutOfScope\";\n  ErrorCode2[\"createNodeInParserFail\"] = \"createNodeInParserFail\";\n  ErrorCode2[\"stackOverFlow\"] = \"stackOverFlow\";\n  ErrorCode2[\"parserMatchError\"] = \"parserMatchError\";\n  ErrorCode2[\"serializerMatchError\"] = \"serializerMatchError\";\n  ErrorCode2[\"getAtomFromSchemaFail\"] = \"getAtomFromSchemaFail\";\n  ErrorCode2[\"expectDomTypeError\"] = \"expectDomTypeError\";\n  ErrorCode2[\"callCommandBeforeEditorView\"] = \"callCommandBeforeEditorView\";\n  ErrorCode2[\"missingRootElement\"] = \"missingRootElement\";\n  ErrorCode2[\"missingNodeInSchema\"] = \"missingNodeInSchema\";\n  ErrorCode2[\"missingMarkInSchema\"] = \"missingMarkInSchema\";\n  ErrorCode2[\"ctxNotBind\"] = \"ctxNotBind\";\n  ErrorCode2[\"missingYjsDoc\"] = \"missingYjsDoc\";\n  return ErrorCode2;\n})(ErrorCode || {});\nclass MilkdownError extends Error {\n  constructor(code, message) {\n    super(message);\n    this.name = \"MilkdownError\";\n    this.code = code;\n  }\n}\nconst functionReplacer = (_, value) => typeof value === \"function\" ? \"[Function]\" : value;\nconst stringify = (x) => JSON.stringify(x, functionReplacer);\nfunction docTypeError(type) {\n  return new MilkdownError(\n    ErrorCode.docTypeError,\n    `Doc type error, unsupported type: ${stringify(type)}`\n  );\n}\nfunction contextNotFound(name) {\n  return new MilkdownError(\n    ErrorCode.contextNotFound,\n    `Context \"${name}\" not found, do you forget to inject it?`\n  );\n}\nfunction timerNotFound(name) {\n  return new MilkdownError(\n    ErrorCode.timerNotFound,\n    `Timer \"${name}\" not found, do you forget to record it?`\n  );\n}\nfunction ctxCallOutOfScope() {\n  return new MilkdownError(\n    ErrorCode.ctxCallOutOfScope,\n    \"Should not call a context out of the plugin.\"\n  );\n}\nfunction createNodeInParserFail(...args) {\n  const message = args.reduce((msg, arg) => {\n    if (!arg) return msg;\n    const serialize = (x) => {\n      if (Array.isArray(x))\n        return x.map((y) => serialize(y)).join(\", \");\n      if (x.toJSON)\n        return stringify(\n          x.toJSON()\n        );\n      if (x.spec)\n        return stringify(x.spec);\n      return x.toString();\n    };\n    return `${msg}, ${serialize(arg)}`;\n  }, \"Create prosemirror node from remark failed in parser\");\n  return new MilkdownError(ErrorCode.createNodeInParserFail, message);\n}\nfunction stackOverFlow() {\n  return new MilkdownError(\n    ErrorCode.stackOverFlow,\n    \"Stack over flow, cannot pop on an empty stack.\"\n  );\n}\nfunction parserMatchError(node) {\n  return new MilkdownError(\n    ErrorCode.parserMatchError,\n    `Cannot match target parser for node: ${stringify(node)}.`\n  );\n}\nfunction serializerMatchError(node) {\n  return new MilkdownError(\n    ErrorCode.serializerMatchError,\n    `Cannot match target serializer for node: ${stringify(node)}.`\n  );\n}\nfunction getAtomFromSchemaFail(type, name) {\n  return new MilkdownError(\n    ErrorCode.getAtomFromSchemaFail,\n    `Cannot get ${type}: ${name} from schema.`\n  );\n}\nfunction expectDomTypeError(node) {\n  return new MilkdownError(\n    ErrorCode.expectDomTypeError,\n    `Expect to be a dom, but get: ${stringify(node)}.`\n  );\n}\nfunction callCommandBeforeEditorView() {\n  return new MilkdownError(\n    ErrorCode.callCommandBeforeEditorView,\n    \"You're trying to call a command before editor view initialized, make sure to get commandManager from ctx after editor view has been initialized\"\n  );\n}\nfunction missingRootElement() {\n  return new MilkdownError(\n    ErrorCode.missingRootElement,\n    \"Missing root element, milkdown cannot find root element of the editor.\"\n  );\n}\nfunction missingNodeInSchema(name) {\n  return new MilkdownError(\n    ErrorCode.missingNodeInSchema,\n    `Missing node in schema, milkdown cannot find \"${name}\" in schema.`\n  );\n}\nfunction missingMarkInSchema(name) {\n  return new MilkdownError(\n    ErrorCode.missingMarkInSchema,\n    `Missing mark in schema, milkdown cannot find \"${name}\" in schema.`\n  );\n}\nfunction ctxNotBind() {\n  return new MilkdownError(\n    ErrorCode.ctxNotBind,\n    \"Context not bind, please make sure the plugin has been initialized.\"\n  );\n}\nfunction missingYjsDoc() {\n  return new MilkdownError(\n    ErrorCode.missingYjsDoc,\n    \"Missing yjs doc, please make sure you have bind one.\"\n  );\n}\nexport {\n  callCommandBeforeEditorView,\n  contextNotFound,\n  createNodeInParserFail,\n  ctxCallOutOfScope,\n  ctxNotBind,\n  docTypeError,\n  expectDomTypeError,\n  getAtomFromSchemaFail,\n  missingMarkInSchema,\n  missingNodeInSchema,\n  missingRootElement,\n  missingYjsDoc,\n  parserMatchError,\n  serializerMatchError,\n  stackOverFlow,\n  timerNotFound\n};\n//# sourceMappingURL=index.es.js.map\n","var __typeError = (msg) => {\n  throw TypeError(msg);\n};\nvar __accessCheck = (obj, member, msg) => member.has(obj) || __typeError(\"Cannot \" + msg);\nvar __privateGet = (obj, member, getter) => (__accessCheck(obj, member, \"read from private field\"), getter ? getter.call(obj) : member.get(obj));\nvar __privateAdd = (obj, member, value) => member.has(obj) ? __typeError(\"Cannot add the same private member more than once\") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\nvar __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, \"write to private field\"), setter ? setter.call(obj, value) : member.set(obj, value), value);\nvar _watchers, _value, _emit, _meta, _container, _clock, _injectedSlices, _consumedSlices, _recordedTimers, _waitTimers, _getSlice, _getTimer, _container2, _clock2, _meta2, _inspector, _promise, _listener, _eventUniqId, _status, _removeListener, _waitTimeout;\nimport { contextNotFound, ctxCallOutOfScope, timerNotFound } from \"@milkdown/exception\";\nclass Container {\n  constructor() {\n    this.sliceMap = /* @__PURE__ */ new Map();\n    this.get = (slice) => {\n      const context = typeof slice === \"string\" ? [...this.sliceMap.values()].find((x) => x.type.name === slice) : this.sliceMap.get(slice.id);\n      if (!context) {\n        const name = typeof slice === \"string\" ? slice : slice.name;\n        throw contextNotFound(name);\n      }\n      return context;\n    };\n    this.remove = (slice) => {\n      const context = typeof slice === \"string\" ? [...this.sliceMap.values()].find((x) => x.type.name === slice) : this.sliceMap.get(slice.id);\n      if (!context) return;\n      this.sliceMap.delete(context.type.id);\n    };\n    this.has = (slice) => {\n      if (typeof slice === \"string\")\n        return [...this.sliceMap.values()].some((x) => x.type.name === slice);\n      return this.sliceMap.has(slice.id);\n    };\n  }\n}\nclass Slice {\n  /// @internal\n  constructor(container, value, type) {\n    __privateAdd(this, _watchers);\n    /// @internal\n    __privateAdd(this, _value);\n    __privateAdd(this, _emit);\n    __privateSet(this, _watchers, []);\n    __privateSet(this, _emit, () => {\n      __privateGet(this, _watchers).forEach((watcher) => watcher(__privateGet(this, _value)));\n    });\n    this.set = (value2) => {\n      __privateSet(this, _value, value2);\n      __privateGet(this, _emit).call(this);\n    };\n    this.get = () => __privateGet(this, _value);\n    this.update = (updater) => {\n      __privateSet(this, _value, updater(__privateGet(this, _value)));\n      __privateGet(this, _emit).call(this);\n    };\n    this.type = type;\n    __privateSet(this, _value, value);\n    container.set(type.id, this);\n  }\n  /// Add a watcher for changes in the slice.\n  /// Returns a function to remove the watcher.\n  on(watcher) {\n    __privateGet(this, _watchers).push(watcher);\n    return () => {\n      __privateSet(this, _watchers, __privateGet(this, _watchers).filter((w) => w !== watcher));\n    };\n  }\n  /// Add a one-time watcher for changes in the slice.\n  /// The watcher will be removed after it is called.\n  /// Returns a function to remove the watcher.\n  once(watcher) {\n    const off = this.on((value) => {\n      watcher(value);\n      off();\n    });\n    return off;\n  }\n  /// Remove a watcher.\n  off(watcher) {\n    __privateSet(this, _watchers, __privateGet(this, _watchers).filter((w) => w !== watcher));\n  }\n  /// Remove all watchers.\n  offAll() {\n    __privateSet(this, _watchers, []);\n  }\n}\n_watchers = new WeakMap();\n_value = new WeakMap();\n_emit = new WeakMap();\nclass SliceType {\n  /// Create a slice type with a default value and a name.\n  /// The name should be unique in the container.\n  constructor(value, name) {\n    this.id = Symbol(`Context-${name}`);\n    this.name = name;\n    this._defaultValue = value;\n    this._typeInfo = () => {\n      throw ctxCallOutOfScope();\n    };\n  }\n  /// Create a slice with a container.\n  /// You can also pass a value to override the default value.\n  create(container, value = this._defaultValue) {\n    return new Slice(container, value, this);\n  }\n}\nconst createSlice = (value, name) => new SliceType(value, name);\nclass Inspector {\n  /// Create an inspector with container, clock and metadata.\n  constructor(container, clock, meta) {\n    /// @internal\n    __privateAdd(this, _meta);\n    /// @internal\n    __privateAdd(this, _container);\n    /// @internal\n    __privateAdd(this, _clock);\n    __privateAdd(this, _injectedSlices);\n    __privateAdd(this, _consumedSlices);\n    __privateAdd(this, _recordedTimers);\n    __privateAdd(this, _waitTimers);\n    __privateAdd(this, _getSlice);\n    __privateAdd(this, _getTimer);\n    __privateSet(this, _injectedSlices, /* @__PURE__ */ new Set());\n    __privateSet(this, _consumedSlices, /* @__PURE__ */ new Set());\n    __privateSet(this, _recordedTimers, /* @__PURE__ */ new Map());\n    __privateSet(this, _waitTimers, /* @__PURE__ */ new Map());\n    this.read = () => {\n      return {\n        metadata: __privateGet(this, _meta),\n        injectedSlices: [...__privateGet(this, _injectedSlices)].map((slice) => ({\n          name: typeof slice === \"string\" ? slice : slice.name,\n          value: __privateGet(this, _getSlice).call(this, slice)\n        })),\n        consumedSlices: [...__privateGet(this, _consumedSlices)].map((slice) => ({\n          name: typeof slice === \"string\" ? slice : slice.name,\n          value: __privateGet(this, _getSlice).call(this, slice)\n        })),\n        recordedTimers: [...__privateGet(this, _recordedTimers)].map(\n          ([timer, { duration }]) => ({\n            name: timer.name,\n            duration,\n            status: __privateGet(this, _getTimer).call(this, timer)\n          })\n        ),\n        waitTimers: [...__privateGet(this, _waitTimers)].map(([timer, { duration }]) => ({\n          name: timer.name,\n          duration,\n          status: __privateGet(this, _getTimer).call(this, timer)\n        }))\n      };\n    };\n    this.onRecord = (timerType) => {\n      __privateGet(this, _recordedTimers).set(timerType, { start: Date.now(), duration: 0 });\n    };\n    this.onClear = (timerType) => {\n      __privateGet(this, _recordedTimers).delete(timerType);\n    };\n    this.onDone = (timerType) => {\n      const timer = __privateGet(this, _recordedTimers).get(timerType);\n      if (!timer) return;\n      timer.duration = Date.now() - timer.start;\n    };\n    this.onWait = (timerType, promise) => {\n      const start = Date.now();\n      promise.finally(() => {\n        __privateGet(this, _waitTimers).set(timerType, { duration: Date.now() - start });\n      });\n    };\n    this.onInject = (sliceType) => {\n      __privateGet(this, _injectedSlices).add(sliceType);\n    };\n    this.onRemove = (sliceType) => {\n      __privateGet(this, _injectedSlices).delete(sliceType);\n    };\n    this.onUse = (sliceType) => {\n      __privateGet(this, _consumedSlices).add(sliceType);\n    };\n    __privateSet(this, _getSlice, (sliceType) => {\n      return __privateGet(this, _container).get(sliceType).get();\n    });\n    __privateSet(this, _getTimer, (timerType) => {\n      return __privateGet(this, _clock).get(timerType).status;\n    });\n    __privateSet(this, _container, container);\n    __privateSet(this, _clock, clock);\n    __privateSet(this, _meta, meta);\n  }\n}\n_meta = new WeakMap();\n_container = new WeakMap();\n_clock = new WeakMap();\n_injectedSlices = new WeakMap();\n_consumedSlices = new WeakMap();\n_recordedTimers = new WeakMap();\n_waitTimers = new WeakMap();\n_getSlice = new WeakMap();\n_getTimer = new WeakMap();\nconst _Ctx = class _Ctx {\n  /// Create a ctx object with container and clock.\n  constructor(container, clock, meta) {\n    /// @internal\n    __privateAdd(this, _container2);\n    /// @internal\n    __privateAdd(this, _clock2);\n    /// @internal\n    __privateAdd(this, _meta2);\n    /// @internal\n    __privateAdd(this, _inspector);\n    this.produce = (meta2) => {\n      if (meta2 && Object.keys(meta2).length)\n        return new _Ctx(__privateGet(this, _container2), __privateGet(this, _clock2), { ...meta2 });\n      return this;\n    };\n    this.inject = (sliceType, value) => {\n      var _a;\n      const slice = sliceType.create(__privateGet(this, _container2).sliceMap);\n      if (value != null) slice.set(value);\n      (_a = __privateGet(this, _inspector)) == null ? void 0 : _a.onInject(sliceType);\n      return this;\n    };\n    this.remove = (sliceType) => {\n      var _a;\n      __privateGet(this, _container2).remove(sliceType);\n      (_a = __privateGet(this, _inspector)) == null ? void 0 : _a.onRemove(sliceType);\n      return this;\n    };\n    this.record = (timerType) => {\n      var _a;\n      timerType.create(__privateGet(this, _clock2).store);\n      (_a = __privateGet(this, _inspector)) == null ? void 0 : _a.onRecord(timerType);\n      return this;\n    };\n    this.clearTimer = (timerType) => {\n      var _a;\n      __privateGet(this, _clock2).remove(timerType);\n      (_a = __privateGet(this, _inspector)) == null ? void 0 : _a.onClear(timerType);\n      return this;\n    };\n    this.isInjected = (sliceType) => __privateGet(this, _container2).has(sliceType);\n    this.isRecorded = (timerType) => __privateGet(this, _clock2).has(timerType);\n    this.use = (sliceType) => {\n      var _a;\n      (_a = __privateGet(this, _inspector)) == null ? void 0 : _a.onUse(sliceType);\n      return __privateGet(this, _container2).get(sliceType);\n    };\n    this.get = (sliceType) => this.use(sliceType).get();\n    this.set = (sliceType, value) => this.use(sliceType).set(value);\n    this.update = (sliceType, updater) => this.use(sliceType).update(updater);\n    this.timer = (timer) => __privateGet(this, _clock2).get(timer);\n    this.done = (timer) => {\n      var _a;\n      this.timer(timer).done();\n      (_a = __privateGet(this, _inspector)) == null ? void 0 : _a.onDone(timer);\n    };\n    this.wait = (timer) => {\n      var _a;\n      const promise = this.timer(timer).start();\n      (_a = __privateGet(this, _inspector)) == null ? void 0 : _a.onWait(timer, promise);\n      return promise;\n    };\n    this.waitTimers = async (slice) => {\n      await Promise.all(this.get(slice).map((x) => this.wait(x)));\n    };\n    __privateSet(this, _container2, container);\n    __privateSet(this, _clock2, clock);\n    __privateSet(this, _meta2, meta);\n    if (meta) __privateSet(this, _inspector, new Inspector(container, clock, meta));\n  }\n  /// Get metadata of the ctx.\n  get meta() {\n    return __privateGet(this, _meta2);\n  }\n  /// Get the inspector of the ctx.\n  get inspector() {\n    return __privateGet(this, _inspector);\n  }\n};\n_container2 = new WeakMap();\n_clock2 = new WeakMap();\n_meta2 = new WeakMap();\n_inspector = new WeakMap();\nlet Ctx = _Ctx;\nclass Clock {\n  constructor() {\n    this.store = /* @__PURE__ */ new Map();\n    this.get = (timer) => {\n      const meta = this.store.get(timer.id);\n      if (!meta) throw timerNotFound(timer.name);\n      return meta;\n    };\n    this.remove = (timer) => {\n      this.store.delete(timer.id);\n    };\n    this.has = (timer) => {\n      return this.store.has(timer.id);\n    };\n  }\n}\nclass Timer {\n  /// @internal\n  constructor(clock, type) {\n    __privateAdd(this, _promise);\n    __privateAdd(this, _listener);\n    /// @internal\n    __privateAdd(this, _eventUniqId);\n    __privateAdd(this, _status);\n    __privateAdd(this, _removeListener);\n    __privateAdd(this, _waitTimeout);\n    __privateSet(this, _promise, null);\n    __privateSet(this, _listener, null);\n    __privateSet(this, _status, \"pending\");\n    this.start = () => {\n      __privateGet(this, _promise) ?? __privateSet(this, _promise, new Promise((resolve, reject) => {\n        __privateSet(this, _listener, (e) => {\n          if (!(e instanceof CustomEvent)) return;\n          if (e.detail.id === __privateGet(this, _eventUniqId)) {\n            __privateSet(this, _status, \"resolved\");\n            __privateGet(this, _removeListener).call(this);\n            e.stopImmediatePropagation();\n            resolve();\n          }\n        });\n        __privateGet(this, _waitTimeout).call(this, () => {\n          if (__privateGet(this, _status) === \"pending\") __privateSet(this, _status, \"rejected\");\n          __privateGet(this, _removeListener).call(this);\n          reject(new Error(`Timing ${this.type.name} timeout.`));\n        });\n        __privateSet(this, _status, \"pending\");\n        addEventListener(this.type.name, __privateGet(this, _listener));\n      }));\n      return __privateGet(this, _promise);\n    };\n    this.done = () => {\n      const event = new CustomEvent(this.type.name, {\n        detail: { id: __privateGet(this, _eventUniqId) }\n      });\n      dispatchEvent(event);\n    };\n    __privateSet(this, _removeListener, () => {\n      if (__privateGet(this, _listener)) removeEventListener(this.type.name, __privateGet(this, _listener));\n    });\n    __privateSet(this, _waitTimeout, (ifTimeout) => {\n      setTimeout(() => {\n        ifTimeout();\n      }, this.type.timeout);\n    });\n    __privateSet(this, _eventUniqId, Symbol(type.name));\n    this.type = type;\n    clock.set(type.id, this);\n  }\n  /// The status of the timer.\n  /// Can be `pending`, `resolved` or `rejected`.\n  get status() {\n    return __privateGet(this, _status);\n  }\n}\n_promise = new WeakMap();\n_listener = new WeakMap();\n_eventUniqId = new WeakMap();\n_status = new WeakMap();\n_removeListener = new WeakMap();\n_waitTimeout = new WeakMap();\nclass TimerType {\n  /// Create a timer type with a name and a timeout.\n  /// The name should be unique in the clock.\n  constructor(name, timeout = 3e3) {\n    this.create = (clock) => {\n      return new Timer(clock, this);\n    };\n    this.id = Symbol(`Timer-${name}`);\n    this.name = name;\n    this.timeout = timeout;\n  }\n}\nconst createTimer = (name, timeout = 3e3) => new TimerType(name, timeout);\nexport {\n  Clock,\n  Container,\n  Ctx,\n  Inspector,\n  Slice,\n  SliceType,\n  Timer,\n  TimerType,\n  createSlice,\n  createTimer\n};\n//# sourceMappingURL=index.es.js.map\n","// ::- Persistent data structure representing an ordered mapping from\n// strings to values, with some convenient update methods.\nfunction OrderedMap(content) {\n  this.content = content;\n}\n\nOrderedMap.prototype = {\n  constructor: OrderedMap,\n\n  find: function(key) {\n    for (var i = 0; i < this.content.length; i += 2)\n      if (this.content[i] === key) return i\n    return -1\n  },\n\n  // :: (string) → ?any\n  // Retrieve the value stored under `key`, or return undefined when\n  // no such key exists.\n  get: function(key) {\n    var found = this.find(key);\n    return found == -1 ? undefined : this.content[found + 1]\n  },\n\n  // :: (string, any, ?string) → OrderedMap\n  // Create a new map by replacing the value of `key` with a new\n  // value, or adding a binding to the end of the map. If `newKey` is\n  // given, the key of the binding will be replaced with that key.\n  update: function(key, value, newKey) {\n    var self = newKey && newKey != key ? this.remove(newKey) : this;\n    var found = self.find(key), content = self.content.slice();\n    if (found == -1) {\n      content.push(newKey || key, value);\n    } else {\n      content[found + 1] = value;\n      if (newKey) content[found] = newKey;\n    }\n    return new OrderedMap(content)\n  },\n\n  // :: (string) → OrderedMap\n  // Return a map with the given key removed, if it existed.\n  remove: function(key) {\n    var found = this.find(key);\n    if (found == -1) return this\n    var content = this.content.slice();\n    content.splice(found, 2);\n    return new OrderedMap(content)\n  },\n\n  // :: (string, any) → OrderedMap\n  // Add a new key to the start of the map.\n  addToStart: function(key, value) {\n    return new OrderedMap([key, value].concat(this.remove(key).content))\n  },\n\n  // :: (string, any) → OrderedMap\n  // Add a new key to the end of the map.\n  addToEnd: function(key, value) {\n    var content = this.remove(key).content.slice();\n    content.push(key, value);\n    return new OrderedMap(content)\n  },\n\n  // :: (string, string, any) → OrderedMap\n  // Add a key after the given key. If `place` is not found, the new\n  // key is added to the end.\n  addBefore: function(place, key, value) {\n    var without = this.remove(key), content = without.content.slice();\n    var found = without.find(place);\n    content.splice(found == -1 ? content.length : found, 0, key, value);\n    return new OrderedMap(content)\n  },\n\n  // :: ((key: string, value: any))\n  // Call the given function for each key/value pair in the map, in\n  // order.\n  forEach: function(f) {\n    for (var i = 0; i < this.content.length; i += 2)\n      f(this.content[i], this.content[i + 1]);\n  },\n\n  // :: (union<Object, OrderedMap>) → OrderedMap\n  // Create a new map by prepending the keys in this map that don't\n  // appear in `map` before the keys in `map`.\n  prepend: function(map) {\n    map = OrderedMap.from(map);\n    if (!map.size) return this\n    return new OrderedMap(map.content.concat(this.subtract(map).content))\n  },\n\n  // :: (union<Object, OrderedMap>) → OrderedMap\n  // Create a new map by appending the keys in this map that don't\n  // appear in `map` after the keys in `map`.\n  append: function(map) {\n    map = OrderedMap.from(map);\n    if (!map.size) return this\n    return new OrderedMap(this.subtract(map).content.concat(map.content))\n  },\n\n  // :: (union<Object, OrderedMap>) → OrderedMap\n  // Create a map containing all the keys in this map that don't\n  // appear in `map`.\n  subtract: function(map) {\n    var result = this;\n    map = OrderedMap.from(map);\n    for (var i = 0; i < map.content.length; i += 2)\n      result = result.remove(map.content[i]);\n    return result\n  },\n\n  // :: () → Object\n  // Turn ordered map into a plain object.\n  toObject: function() {\n    var result = {};\n    this.forEach(function(key, value) { result[key] = value; });\n    return result\n  },\n\n  // :: number\n  // The amount of keys in this map.\n  get size() {\n    return this.content.length >> 1\n  }\n};\n\n// :: (?union<Object, OrderedMap>) → OrderedMap\n// Return a map with the given content. If null, create an empty\n// map. If given an ordered map, return that map itself. If given an\n// object, create a map from the object's properties.\nOrderedMap.from = function(value) {\n  if (value instanceof OrderedMap) return value\n  var content = [];\n  if (value) for (var prop in value) content.push(prop, value[prop]);\n  return new OrderedMap(content)\n};\n\nexport default OrderedMap;\n","import OrderedMap from 'orderedmap';\n\nfunction findDiffStart(a, b, pos) {\n    for (let i = 0;; i++) {\n        if (i == a.childCount || i == b.childCount)\n            return a.childCount == b.childCount ? null : pos;\n        let childA = a.child(i), childB = b.child(i);\n        if (childA == childB) {\n            pos += childA.nodeSize;\n            continue;\n        }\n        if (!childA.sameMarkup(childB))\n            return pos;\n        if (childA.isText && childA.text != childB.text) {\n            for (let j = 0; childA.text[j] == childB.text[j]; j++)\n                pos++;\n            return pos;\n        }\n        if (childA.content.size || childB.content.size) {\n            let inner = findDiffStart(childA.content, childB.content, pos + 1);\n            if (inner != null)\n                return inner;\n        }\n        pos += childA.nodeSize;\n    }\n}\nfunction findDiffEnd(a, b, posA, posB) {\n    for (let iA = a.childCount, iB = b.childCount;;) {\n        if (iA == 0 || iB == 0)\n            return iA == iB ? null : { a: posA, b: posB };\n        let childA = a.child(--iA), childB = b.child(--iB), size = childA.nodeSize;\n        if (childA == childB) {\n            posA -= size;\n            posB -= size;\n            continue;\n        }\n        if (!childA.sameMarkup(childB))\n            return { a: posA, b: posB };\n        if (childA.isText && childA.text != childB.text) {\n            let same = 0, minSize = Math.min(childA.text.length, childB.text.length);\n            while (same < minSize && childA.text[childA.text.length - same - 1] == childB.text[childB.text.length - same - 1]) {\n                same++;\n                posA--;\n                posB--;\n            }\n            return { a: posA, b: posB };\n        }\n        if (childA.content.size || childB.content.size) {\n            let inner = findDiffEnd(childA.content, childB.content, posA - 1, posB - 1);\n            if (inner)\n                return inner;\n        }\n        posA -= size;\n        posB -= size;\n    }\n}\n\n/**\nA fragment represents a node's collection of child nodes.\n\nLike nodes, fragments are persistent data structures, and you\nshould not mutate them or their content. Rather, you create new\ninstances whenever needed. The API tries to make this easy.\n*/\nclass Fragment {\n    /**\n    @internal\n    */\n    constructor(\n    /**\n    The child nodes in this fragment.\n    */\n    content, size) {\n        this.content = content;\n        this.size = size || 0;\n        if (size == null)\n            for (let i = 0; i < content.length; i++)\n                this.size += content[i].nodeSize;\n    }\n    /**\n    Invoke a callback for all descendant nodes between the given two\n    positions (relative to start of this fragment). Doesn't descend\n    into a node when the callback returns `false`.\n    */\n    nodesBetween(from, to, f, nodeStart = 0, parent) {\n        for (let i = 0, pos = 0; pos < to; i++) {\n            let child = this.content[i], end = pos + child.nodeSize;\n            if (end > from && f(child, nodeStart + pos, parent || null, i) !== false && child.content.size) {\n                let start = pos + 1;\n                child.nodesBetween(Math.max(0, from - start), Math.min(child.content.size, to - start), f, nodeStart + start);\n            }\n            pos = end;\n        }\n    }\n    /**\n    Call the given callback for every descendant node. `pos` will be\n    relative to the start of the fragment. The callback may return\n    `false` to prevent traversal of a given node's children.\n    */\n    descendants(f) {\n        this.nodesBetween(0, this.size, f);\n    }\n    /**\n    Extract the text between `from` and `to`. See the same method on\n    [`Node`](https://prosemirror.net/docs/ref/#model.Node.textBetween).\n    */\n    textBetween(from, to, blockSeparator, leafText) {\n        let text = \"\", first = true;\n        this.nodesBetween(from, to, (node, pos) => {\n            let nodeText = node.isText ? node.text.slice(Math.max(from, pos) - pos, to - pos)\n                : !node.isLeaf ? \"\"\n                    : leafText ? (typeof leafText === \"function\" ? leafText(node) : leafText)\n                        : node.type.spec.leafText ? node.type.spec.leafText(node)\n                            : \"\";\n            if (node.isBlock && (node.isLeaf && nodeText || node.isTextblock) && blockSeparator) {\n                if (first)\n                    first = false;\n                else\n                    text += blockSeparator;\n            }\n            text += nodeText;\n        }, 0);\n        return text;\n    }\n    /**\n    Create a new fragment containing the combined content of this\n    fragment and the other.\n    */\n    append(other) {\n        if (!other.size)\n            return this;\n        if (!this.size)\n            return other;\n        let last = this.lastChild, first = other.firstChild, content = this.content.slice(), i = 0;\n        if (last.isText && last.sameMarkup(first)) {\n            content[content.length - 1] = last.withText(last.text + first.text);\n            i = 1;\n        }\n        for (; i < other.content.length; i++)\n            content.push(other.content[i]);\n        return new Fragment(content, this.size + other.size);\n    }\n    /**\n    Cut out the sub-fragment between the two given positions.\n    */\n    cut(from, to = this.size) {\n        if (from == 0 && to == this.size)\n            return this;\n        let result = [], size = 0;\n        if (to > from)\n            for (let i = 0, pos = 0; pos < to; i++) {\n                let child = this.content[i], end = pos + child.nodeSize;\n                if (end > from) {\n                    if (pos < from || end > to) {\n                        if (child.isText)\n                            child = child.cut(Math.max(0, from - pos), Math.min(child.text.length, to - pos));\n                        else\n                            child = child.cut(Math.max(0, from - pos - 1), Math.min(child.content.size, to - pos - 1));\n                    }\n                    result.push(child);\n                    size += child.nodeSize;\n                }\n                pos = end;\n            }\n        return new Fragment(result, size);\n    }\n    /**\n    @internal\n    */\n    cutByIndex(from, to) {\n        if (from == to)\n            return Fragment.empty;\n        if (from == 0 && to == this.content.length)\n            return this;\n        return new Fragment(this.content.slice(from, to));\n    }\n    /**\n    Create a new fragment in which the node at the given index is\n    replaced by the given node.\n    */\n    replaceChild(index, node) {\n        let current = this.content[index];\n        if (current == node)\n            return this;\n        let copy = this.content.slice();\n        let size = this.size + node.nodeSize - current.nodeSize;\n        copy[index] = node;\n        return new Fragment(copy, size);\n    }\n    /**\n    Create a new fragment by prepending the given node to this\n    fragment.\n    */\n    addToStart(node) {\n        return new Fragment([node].concat(this.content), this.size + node.nodeSize);\n    }\n    /**\n    Create a new fragment by appending the given node to this\n    fragment.\n    */\n    addToEnd(node) {\n        return new Fragment(this.content.concat(node), this.size + node.nodeSize);\n    }\n    /**\n    Compare this fragment to another one.\n    */\n    eq(other) {\n        if (this.content.length != other.content.length)\n            return false;\n        for (let i = 0; i < this.content.length; i++)\n            if (!this.content[i].eq(other.content[i]))\n                return false;\n        return true;\n    }\n    /**\n    The first child of the fragment, or `null` if it is empty.\n    */\n    get firstChild() { return this.content.length ? this.content[0] : null; }\n    /**\n    The last child of the fragment, or `null` if it is empty.\n    */\n    get lastChild() { return this.content.length ? this.content[this.content.length - 1] : null; }\n    /**\n    The number of child nodes in this fragment.\n    */\n    get childCount() { return this.content.length; }\n    /**\n    Get the child node at the given index. Raise an error when the\n    index is out of range.\n    */\n    child(index) {\n        let found = this.content[index];\n        if (!found)\n            throw new RangeError(\"Index \" + index + \" out of range for \" + this);\n        return found;\n    }\n    /**\n    Get the child node at the given index, if it exists.\n    */\n    maybeChild(index) {\n        return this.content[index] || null;\n    }\n    /**\n    Call `f` for every child node, passing the node, its offset\n    into this parent node, and its index.\n    */\n    forEach(f) {\n        for (let i = 0, p = 0; i < this.content.length; i++) {\n            let child = this.content[i];\n            f(child, p, i);\n            p += child.nodeSize;\n        }\n    }\n    /**\n    Find the first position at which this fragment and another\n    fragment differ, or `null` if they are the same.\n    */\n    findDiffStart(other, pos = 0) {\n        return findDiffStart(this, other, pos);\n    }\n    /**\n    Find the first position, searching from the end, at which this\n    fragment and the given fragment differ, or `null` if they are\n    the same. Since this position will not be the same in both\n    nodes, an object with two separate positions is returned.\n    */\n    findDiffEnd(other, pos = this.size, otherPos = other.size) {\n        return findDiffEnd(this, other, pos, otherPos);\n    }\n    /**\n    Find the index and inner offset corresponding to a given relative\n    position in this fragment. The result object will be reused\n    (overwritten) the next time the function is called. @internal\n    */\n    findIndex(pos, round = -1) {\n        if (pos == 0)\n            return retIndex(0, pos);\n        if (pos == this.size)\n            return retIndex(this.content.length, pos);\n        if (pos > this.size || pos < 0)\n            throw new RangeError(`Position ${pos} outside of fragment (${this})`);\n        for (let i = 0, curPos = 0;; i++) {\n            let cur = this.child(i), end = curPos + cur.nodeSize;\n            if (end >= pos) {\n                if (end == pos || round > 0)\n                    return retIndex(i + 1, end);\n                return retIndex(i, curPos);\n            }\n            curPos = end;\n        }\n    }\n    /**\n    Return a debugging string that describes this fragment.\n    */\n    toString() { return \"<\" + this.toStringInner() + \">\"; }\n    /**\n    @internal\n    */\n    toStringInner() { return this.content.join(\", \"); }\n    /**\n    Create a JSON-serializeable representation of this fragment.\n    */\n    toJSON() {\n        return this.content.length ? this.content.map(n => n.toJSON()) : null;\n    }\n    /**\n    Deserialize a fragment from its JSON representation.\n    */\n    static fromJSON(schema, value) {\n        if (!value)\n            return Fragment.empty;\n        if (!Array.isArray(value))\n            throw new RangeError(\"Invalid input for Fragment.fromJSON\");\n        return new Fragment(value.map(schema.nodeFromJSON));\n    }\n    /**\n    Build a fragment from an array of nodes. Ensures that adjacent\n    text nodes with the same marks are joined together.\n    */\n    static fromArray(array) {\n        if (!array.length)\n            return Fragment.empty;\n        let joined, size = 0;\n        for (let i = 0; i < array.length; i++) {\n            let node = array[i];\n            size += node.nodeSize;\n            if (i && node.isText && array[i - 1].sameMarkup(node)) {\n                if (!joined)\n                    joined = array.slice(0, i);\n                joined[joined.length - 1] = node\n                    .withText(joined[joined.length - 1].text + node.text);\n            }\n            else if (joined) {\n                joined.push(node);\n            }\n        }\n        return new Fragment(joined || array, size);\n    }\n    /**\n    Create a fragment from something that can be interpreted as a\n    set of nodes. For `null`, it returns the empty fragment. For a\n    fragment, the fragment itself. For a node or array of nodes, a\n    fragment containing those nodes.\n    */\n    static from(nodes) {\n        if (!nodes)\n            return Fragment.empty;\n        if (nodes instanceof Fragment)\n            return nodes;\n        if (Array.isArray(nodes))\n            return this.fromArray(nodes);\n        if (nodes.attrs)\n            return new Fragment([nodes], nodes.nodeSize);\n        throw new RangeError(\"Can not convert \" + nodes + \" to a Fragment\" +\n            (nodes.nodesBetween ? \" (looks like multiple versions of prosemirror-model were loaded)\" : \"\"));\n    }\n}\n/**\nAn empty fragment. Intended to be reused whenever a node doesn't\ncontain anything (rather than allocating a new empty fragment for\neach leaf node).\n*/\nFragment.empty = new Fragment([], 0);\nconst found = { index: 0, offset: 0 };\nfunction retIndex(index, offset) {\n    found.index = index;\n    found.offset = offset;\n    return found;\n}\n\nfunction compareDeep(a, b) {\n    if (a === b)\n        return true;\n    if (!(a && typeof a == \"object\") ||\n        !(b && typeof b == \"object\"))\n        return false;\n    let array = Array.isArray(a);\n    if (Array.isArray(b) != array)\n        return false;\n    if (array) {\n        if (a.length != b.length)\n            return false;\n        for (let i = 0; i < a.length; i++)\n            if (!compareDeep(a[i], b[i]))\n                return false;\n    }\n    else {\n        for (let p in a)\n            if (!(p in b) || !compareDeep(a[p], b[p]))\n                return false;\n        for (let p in b)\n            if (!(p in a))\n                return false;\n    }\n    return true;\n}\n\n/**\nA mark is a piece of information that can be attached to a node,\nsuch as it being emphasized, in code font, or a link. It has a\ntype and optionally a set of attributes that provide further\ninformation (such as the target of the link). Marks are created\nthrough a `Schema`, which controls which types exist and which\nattributes they have.\n*/\nclass Mark {\n    /**\n    @internal\n    */\n    constructor(\n    /**\n    The type of this mark.\n    */\n    type, \n    /**\n    The attributes associated with this mark.\n    */\n    attrs) {\n        this.type = type;\n        this.attrs = attrs;\n    }\n    /**\n    Given a set of marks, create a new set which contains this one as\n    well, in the right position. If this mark is already in the set,\n    the set itself is returned. If any marks that are set to be\n    [exclusive](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) with this mark are present,\n    those are replaced by this one.\n    */\n    addToSet(set) {\n        let copy, placed = false;\n        for (let i = 0; i < set.length; i++) {\n            let other = set[i];\n            if (this.eq(other))\n                return set;\n            if (this.type.excludes(other.type)) {\n                if (!copy)\n                    copy = set.slice(0, i);\n            }\n            else if (other.type.excludes(this.type)) {\n                return set;\n            }\n            else {\n                if (!placed && other.type.rank > this.type.rank) {\n                    if (!copy)\n                        copy = set.slice(0, i);\n                    copy.push(this);\n                    placed = true;\n                }\n                if (copy)\n                    copy.push(other);\n            }\n        }\n        if (!copy)\n            copy = set.slice();\n        if (!placed)\n            copy.push(this);\n        return copy;\n    }\n    /**\n    Remove this mark from the given set, returning a new set. If this\n    mark is not in the set, the set itself is returned.\n    */\n    removeFromSet(set) {\n        for (let i = 0; i < set.length; i++)\n            if (this.eq(set[i]))\n                return set.slice(0, i).concat(set.slice(i + 1));\n        return set;\n    }\n    /**\n    Test whether this mark is in the given set of marks.\n    */\n    isInSet(set) {\n        for (let i = 0; i < set.length; i++)\n            if (this.eq(set[i]))\n                return true;\n        return false;\n    }\n    /**\n    Test whether this mark has the same type and attributes as\n    another mark.\n    */\n    eq(other) {\n        return this == other ||\n            (this.type == other.type && compareDeep(this.attrs, other.attrs));\n    }\n    /**\n    Convert this mark to a JSON-serializeable representation.\n    */\n    toJSON() {\n        let obj = { type: this.type.name };\n        for (let _ in this.attrs) {\n            obj.attrs = this.attrs;\n            break;\n        }\n        return obj;\n    }\n    /**\n    Deserialize a mark from JSON.\n    */\n    static fromJSON(schema, json) {\n        if (!json)\n            throw new RangeError(\"Invalid input for Mark.fromJSON\");\n        let type = schema.marks[json.type];\n        if (!type)\n            throw new RangeError(`There is no mark type ${json.type} in this schema`);\n        let mark = type.create(json.attrs);\n        type.checkAttrs(mark.attrs);\n        return mark;\n    }\n    /**\n    Test whether two sets of marks are identical.\n    */\n    static sameSet(a, b) {\n        if (a == b)\n            return true;\n        if (a.length != b.length)\n            return false;\n        for (let i = 0; i < a.length; i++)\n            if (!a[i].eq(b[i]))\n                return false;\n        return true;\n    }\n    /**\n    Create a properly sorted mark set from null, a single mark, or an\n    unsorted array of marks.\n    */\n    static setFrom(marks) {\n        if (!marks || Array.isArray(marks) && marks.length == 0)\n            return Mark.none;\n        if (marks instanceof Mark)\n            return [marks];\n        let copy = marks.slice();\n        copy.sort((a, b) => a.type.rank - b.type.rank);\n        return copy;\n    }\n}\n/**\nThe empty set of marks.\n*/\nMark.none = [];\n\n/**\nError type raised by [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) when\ngiven an invalid replacement.\n*/\nclass ReplaceError extends Error {\n}\n/*\nReplaceError = function(this: any, message: string) {\n  let err = Error.call(this, message)\n  ;(err as any).__proto__ = ReplaceError.prototype\n  return err\n} as any\n\nReplaceError.prototype = Object.create(Error.prototype)\nReplaceError.prototype.constructor = ReplaceError\nReplaceError.prototype.name = \"ReplaceError\"\n*/\n/**\nA slice represents a piece cut out of a larger document. It\nstores not only a fragment, but also the depth up to which nodes on\nboth side are ‘open’ (cut through).\n*/\nclass Slice {\n    /**\n    Create a slice. When specifying a non-zero open depth, you must\n    make sure that there are nodes of at least that depth at the\n    appropriate side of the fragment—i.e. if the fragment is an\n    empty paragraph node, `openStart` and `openEnd` can't be greater\n    than 1.\n    \n    It is not necessary for the content of open nodes to conform to\n    the schema's content constraints, though it should be a valid\n    start/end/middle for such a node, depending on which sides are\n    open.\n    */\n    constructor(\n    /**\n    The slice's content.\n    */\n    content, \n    /**\n    The open depth at the start of the fragment.\n    */\n    openStart, \n    /**\n    The open depth at the end.\n    */\n    openEnd) {\n        this.content = content;\n        this.openStart = openStart;\n        this.openEnd = openEnd;\n    }\n    /**\n    The size this slice would add when inserted into a document.\n    */\n    get size() {\n        return this.content.size - this.openStart - this.openEnd;\n    }\n    /**\n    @internal\n    */\n    insertAt(pos, fragment) {\n        let content = insertInto(this.content, pos + this.openStart, fragment);\n        return content && new Slice(content, this.openStart, this.openEnd);\n    }\n    /**\n    @internal\n    */\n    removeBetween(from, to) {\n        return new Slice(removeRange(this.content, from + this.openStart, to + this.openStart), this.openStart, this.openEnd);\n    }\n    /**\n    Tests whether this slice is equal to another slice.\n    */\n    eq(other) {\n        return this.content.eq(other.content) && this.openStart == other.openStart && this.openEnd == other.openEnd;\n    }\n    /**\n    @internal\n    */\n    toString() {\n        return this.content + \"(\" + this.openStart + \",\" + this.openEnd + \")\";\n    }\n    /**\n    Convert a slice to a JSON-serializable representation.\n    */\n    toJSON() {\n        if (!this.content.size)\n            return null;\n        let json = { content: this.content.toJSON() };\n        if (this.openStart > 0)\n            json.openStart = this.openStart;\n        if (this.openEnd > 0)\n            json.openEnd = this.openEnd;\n        return json;\n    }\n    /**\n    Deserialize a slice from its JSON representation.\n    */\n    static fromJSON(schema, json) {\n        if (!json)\n            return Slice.empty;\n        let openStart = json.openStart || 0, openEnd = json.openEnd || 0;\n        if (typeof openStart != \"number\" || typeof openEnd != \"number\")\n            throw new RangeError(\"Invalid input for Slice.fromJSON\");\n        return new Slice(Fragment.fromJSON(schema, json.content), openStart, openEnd);\n    }\n    /**\n    Create a slice from a fragment by taking the maximum possible\n    open value on both side of the fragment.\n    */\n    static maxOpen(fragment, openIsolating = true) {\n        let openStart = 0, openEnd = 0;\n        for (let n = fragment.firstChild; n && !n.isLeaf && (openIsolating || !n.type.spec.isolating); n = n.firstChild)\n            openStart++;\n        for (let n = fragment.lastChild; n && !n.isLeaf && (openIsolating || !n.type.spec.isolating); n = n.lastChild)\n            openEnd++;\n        return new Slice(fragment, openStart, openEnd);\n    }\n}\n/**\nThe empty slice.\n*/\nSlice.empty = new Slice(Fragment.empty, 0, 0);\nfunction removeRange(content, from, to) {\n    let { index, offset } = content.findIndex(from), child = content.maybeChild(index);\n    let { index: indexTo, offset: offsetTo } = content.findIndex(to);\n    if (offset == from || child.isText) {\n        if (offsetTo != to && !content.child(indexTo).isText)\n            throw new RangeError(\"Removing non-flat range\");\n        return content.cut(0, from).append(content.cut(to));\n    }\n    if (index != indexTo)\n        throw new RangeError(\"Removing non-flat range\");\n    return content.replaceChild(index, child.copy(removeRange(child.content, from - offset - 1, to - offset - 1)));\n}\nfunction insertInto(content, dist, insert, parent) {\n    let { index, offset } = content.findIndex(dist), child = content.maybeChild(index);\n    if (offset == dist || child.isText) {\n        if (parent && !parent.canReplace(index, index, insert))\n            return null;\n        return content.cut(0, dist).append(insert).append(content.cut(dist));\n    }\n    let inner = insertInto(child.content, dist - offset - 1, insert);\n    return inner && content.replaceChild(index, child.copy(inner));\n}\nfunction replace($from, $to, slice) {\n    if (slice.openStart > $from.depth)\n        throw new ReplaceError(\"Inserted content deeper than insertion position\");\n    if ($from.depth - slice.openStart != $to.depth - slice.openEnd)\n        throw new ReplaceError(\"Inconsistent open depths\");\n    return replaceOuter($from, $to, slice, 0);\n}\nfunction replaceOuter($from, $to, slice, depth) {\n    let index = $from.index(depth), node = $from.node(depth);\n    if (index == $to.index(depth) && depth < $from.depth - slice.openStart) {\n        let inner = replaceOuter($from, $to, slice, depth + 1);\n        return node.copy(node.content.replaceChild(index, inner));\n    }\n    else if (!slice.content.size) {\n        return close(node, replaceTwoWay($from, $to, depth));\n    }\n    else if (!slice.openStart && !slice.openEnd && $from.depth == depth && $to.depth == depth) { // Simple, flat case\n        let parent = $from.parent, content = parent.content;\n        return close(parent, content.cut(0, $from.parentOffset).append(slice.content).append(content.cut($to.parentOffset)));\n    }\n    else {\n        let { start, end } = prepareSliceForReplace(slice, $from);\n        return close(node, replaceThreeWay($from, start, end, $to, depth));\n    }\n}\nfunction checkJoin(main, sub) {\n    if (!sub.type.compatibleContent(main.type))\n        throw new ReplaceError(\"Cannot join \" + sub.type.name + \" onto \" + main.type.name);\n}\nfunction joinable($before, $after, depth) {\n    let node = $before.node(depth);\n    checkJoin(node, $after.node(depth));\n    return node;\n}\nfunction addNode(child, target) {\n    let last = target.length - 1;\n    if (last >= 0 && child.isText && child.sameMarkup(target[last]))\n        target[last] = child.withText(target[last].text + child.text);\n    else\n        target.push(child);\n}\nfunction addRange($start, $end, depth, target) {\n    let node = ($end || $start).node(depth);\n    let startIndex = 0, endIndex = $end ? $end.index(depth) : node.childCount;\n    if ($start) {\n        startIndex = $start.index(depth);\n        if ($start.depth > depth) {\n            startIndex++;\n        }\n        else if ($start.textOffset) {\n            addNode($start.nodeAfter, target);\n            startIndex++;\n        }\n    }\n    for (let i = startIndex; i < endIndex; i++)\n        addNode(node.child(i), target);\n    if ($end && $end.depth == depth && $end.textOffset)\n        addNode($end.nodeBefore, target);\n}\nfunction close(node, content) {\n    node.type.checkContent(content);\n    return node.copy(content);\n}\nfunction replaceThreeWay($from, $start, $end, $to, depth) {\n    let openStart = $from.depth > depth && joinable($from, $start, depth + 1);\n    let openEnd = $to.depth > depth && joinable($end, $to, depth + 1);\n    let content = [];\n    addRange(null, $from, depth, content);\n    if (openStart && openEnd && $start.index(depth) == $end.index(depth)) {\n        checkJoin(openStart, openEnd);\n        addNode(close(openStart, replaceThreeWay($from, $start, $end, $to, depth + 1)), content);\n    }\n    else {\n        if (openStart)\n            addNode(close(openStart, replaceTwoWay($from, $start, depth + 1)), content);\n        addRange($start, $end, depth, content);\n        if (openEnd)\n            addNode(close(openEnd, replaceTwoWay($end, $to, depth + 1)), content);\n    }\n    addRange($to, null, depth, content);\n    return new Fragment(content);\n}\nfunction replaceTwoWay($from, $to, depth) {\n    let content = [];\n    addRange(null, $from, depth, content);\n    if ($from.depth > depth) {\n        let type = joinable($from, $to, depth + 1);\n        addNode(close(type, replaceTwoWay($from, $to, depth + 1)), content);\n    }\n    addRange($to, null, depth, content);\n    return new Fragment(content);\n}\nfunction prepareSliceForReplace(slice, $along) {\n    let extra = $along.depth - slice.openStart, parent = $along.node(extra);\n    let node = parent.copy(slice.content);\n    for (let i = extra - 1; i >= 0; i--)\n        node = $along.node(i).copy(Fragment.from(node));\n    return { start: node.resolveNoCache(slice.openStart + extra),\n        end: node.resolveNoCache(node.content.size - slice.openEnd - extra) };\n}\n\n/**\nYou can [_resolve_](https://prosemirror.net/docs/ref/#model.Node.resolve) a position to get more\ninformation about it. Objects of this class represent such a\nresolved position, providing various pieces of context\ninformation, and some helper methods.\n\nThroughout this interface, methods that take an optional `depth`\nparameter will interpret undefined as `this.depth` and negative\nnumbers as `this.depth + value`.\n*/\nclass ResolvedPos {\n    /**\n    @internal\n    */\n    constructor(\n    /**\n    The position that was resolved.\n    */\n    pos, \n    /**\n    @internal\n    */\n    path, \n    /**\n    The offset this position has into its parent node.\n    */\n    parentOffset) {\n        this.pos = pos;\n        this.path = path;\n        this.parentOffset = parentOffset;\n        this.depth = path.length / 3 - 1;\n    }\n    /**\n    @internal\n    */\n    resolveDepth(val) {\n        if (val == null)\n            return this.depth;\n        if (val < 0)\n            return this.depth + val;\n        return val;\n    }\n    /**\n    The parent node that the position points into. Note that even if\n    a position points into a text node, that node is not considered\n    the parent—text nodes are ‘flat’ in this model, and have no content.\n    */\n    get parent() { return this.node(this.depth); }\n    /**\n    The root node in which the position was resolved.\n    */\n    get doc() { return this.node(0); }\n    /**\n    The ancestor node at the given level. `p.node(p.depth)` is the\n    same as `p.parent`.\n    */\n    node(depth) { return this.path[this.resolveDepth(depth) * 3]; }\n    /**\n    The index into the ancestor at the given level. If this points\n    at the 3rd node in the 2nd paragraph on the top level, for\n    example, `p.index(0)` is 1 and `p.index(1)` is 2.\n    */\n    index(depth) { return this.path[this.resolveDepth(depth) * 3 + 1]; }\n    /**\n    The index pointing after this position into the ancestor at the\n    given level.\n    */\n    indexAfter(depth) {\n        depth = this.resolveDepth(depth);\n        return this.index(depth) + (depth == this.depth && !this.textOffset ? 0 : 1);\n    }\n    /**\n    The (absolute) position at the start of the node at the given\n    level.\n    */\n    start(depth) {\n        depth = this.resolveDepth(depth);\n        return depth == 0 ? 0 : this.path[depth * 3 - 1] + 1;\n    }\n    /**\n    The (absolute) position at the end of the node at the given\n    level.\n    */\n    end(depth) {\n        depth = this.resolveDepth(depth);\n        return this.start(depth) + this.node(depth).content.size;\n    }\n    /**\n    The (absolute) position directly before the wrapping node at the\n    given level, or, when `depth` is `this.depth + 1`, the original\n    position.\n    */\n    before(depth) {\n        depth = this.resolveDepth(depth);\n        if (!depth)\n            throw new RangeError(\"There is no position before the top-level node\");\n        return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1];\n    }\n    /**\n    The (absolute) position directly after the wrapping node at the\n    given level, or the original position when `depth` is `this.depth + 1`.\n    */\n    after(depth) {\n        depth = this.resolveDepth(depth);\n        if (!depth)\n            throw new RangeError(\"There is no position after the top-level node\");\n        return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1] + this.path[depth * 3].nodeSize;\n    }\n    /**\n    When this position points into a text node, this returns the\n    distance between the position and the start of the text node.\n    Will be zero for positions that point between nodes.\n    */\n    get textOffset() { return this.pos - this.path[this.path.length - 1]; }\n    /**\n    Get the node directly after the position, if any. If the position\n    points into a text node, only the part of that node after the\n    position is returned.\n    */\n    get nodeAfter() {\n        let parent = this.parent, index = this.index(this.depth);\n        if (index == parent.childCount)\n            return null;\n        let dOff = this.pos - this.path[this.path.length - 1], child = parent.child(index);\n        return dOff ? parent.child(index).cut(dOff) : child;\n    }\n    /**\n    Get the node directly before the position, if any. If the\n    position points into a text node, only the part of that node\n    before the position is returned.\n    */\n    get nodeBefore() {\n        let index = this.index(this.depth);\n        let dOff = this.pos - this.path[this.path.length - 1];\n        if (dOff)\n            return this.parent.child(index).cut(0, dOff);\n        return index == 0 ? null : this.parent.child(index - 1);\n    }\n    /**\n    Get the position at the given index in the parent node at the\n    given depth (which defaults to `this.depth`).\n    */\n    posAtIndex(index, depth) {\n        depth = this.resolveDepth(depth);\n        let node = this.path[depth * 3], pos = depth == 0 ? 0 : this.path[depth * 3 - 1] + 1;\n        for (let i = 0; i < index; i++)\n            pos += node.child(i).nodeSize;\n        return pos;\n    }\n    /**\n    Get the marks at this position, factoring in the surrounding\n    marks' [`inclusive`](https://prosemirror.net/docs/ref/#model.MarkSpec.inclusive) property. If the\n    position is at the start of a non-empty node, the marks of the\n    node after it (if any) are returned.\n    */\n    marks() {\n        let parent = this.parent, index = this.index();\n        // In an empty parent, return the empty array\n        if (parent.content.size == 0)\n            return Mark.none;\n        // When inside a text node, just return the text node's marks\n        if (this.textOffset)\n            return parent.child(index).marks;\n        let main = parent.maybeChild(index - 1), other = parent.maybeChild(index);\n        // If the `after` flag is true of there is no node before, make\n        // the node after this position the main reference.\n        if (!main) {\n            let tmp = main;\n            main = other;\n            other = tmp;\n        }\n        // Use all marks in the main node, except those that have\n        // `inclusive` set to false and are not present in the other node.\n        let marks = main.marks;\n        for (var i = 0; i < marks.length; i++)\n            if (marks[i].type.spec.inclusive === false && (!other || !marks[i].isInSet(other.marks)))\n                marks = marks[i--].removeFromSet(marks);\n        return marks;\n    }\n    /**\n    Get the marks after the current position, if any, except those\n    that are non-inclusive and not present at position `$end`. This\n    is mostly useful for getting the set of marks to preserve after a\n    deletion. Will return `null` if this position is at the end of\n    its parent node or its parent node isn't a textblock (in which\n    case no marks should be preserved).\n    */\n    marksAcross($end) {\n        let after = this.parent.maybeChild(this.index());\n        if (!after || !after.isInline)\n            return null;\n        let marks = after.marks, next = $end.parent.maybeChild($end.index());\n        for (var i = 0; i < marks.length; i++)\n            if (marks[i].type.spec.inclusive === false && (!next || !marks[i].isInSet(next.marks)))\n                marks = marks[i--].removeFromSet(marks);\n        return marks;\n    }\n    /**\n    The depth up to which this position and the given (non-resolved)\n    position share the same parent nodes.\n    */\n    sharedDepth(pos) {\n        for (let depth = this.depth; depth > 0; depth--)\n            if (this.start(depth) <= pos && this.end(depth) >= pos)\n                return depth;\n        return 0;\n    }\n    /**\n    Returns a range based on the place where this position and the\n    given position diverge around block content. If both point into\n    the same textblock, for example, a range around that textblock\n    will be returned. If they point into different blocks, the range\n    around those blocks in their shared ancestor is returned. You can\n    pass in an optional predicate that will be called with a parent\n    node to see if a range into that parent is acceptable.\n    */\n    blockRange(other = this, pred) {\n        if (other.pos < this.pos)\n            return other.blockRange(this);\n        for (let d = this.depth - (this.parent.inlineContent || this.pos == other.pos ? 1 : 0); d >= 0; d--)\n            if (other.pos <= this.end(d) && (!pred || pred(this.node(d))))\n                return new NodeRange(this, other, d);\n        return null;\n    }\n    /**\n    Query whether the given position shares the same parent node.\n    */\n    sameParent(other) {\n        return this.pos - this.parentOffset == other.pos - other.parentOffset;\n    }\n    /**\n    Return the greater of this and the given position.\n    */\n    max(other) {\n        return other.pos > this.pos ? other : this;\n    }\n    /**\n    Return the smaller of this and the given position.\n    */\n    min(other) {\n        return other.pos < this.pos ? other : this;\n    }\n    /**\n    @internal\n    */\n    toString() {\n        let str = \"\";\n        for (let i = 1; i <= this.depth; i++)\n            str += (str ? \"/\" : \"\") + this.node(i).type.name + \"_\" + this.index(i - 1);\n        return str + \":\" + this.parentOffset;\n    }\n    /**\n    @internal\n    */\n    static resolve(doc, pos) {\n        if (!(pos >= 0 && pos <= doc.content.size))\n            throw new RangeError(\"Position \" + pos + \" out of range\");\n        let path = [];\n        let start = 0, parentOffset = pos;\n        for (let node = doc;;) {\n            let { index, offset } = node.content.findIndex(parentOffset);\n            let rem = parentOffset - offset;\n            path.push(node, index, start + offset);\n            if (!rem)\n                break;\n            node = node.child(index);\n            if (node.isText)\n                break;\n            parentOffset = rem - 1;\n            start += offset + 1;\n        }\n        return new ResolvedPos(pos, path, parentOffset);\n    }\n    /**\n    @internal\n    */\n    static resolveCached(doc, pos) {\n        let cache = resolveCache.get(doc);\n        if (cache) {\n            for (let i = 0; i < cache.elts.length; i++) {\n                let elt = cache.elts[i];\n                if (elt.pos == pos)\n                    return elt;\n            }\n        }\n        else {\n            resolveCache.set(doc, cache = new ResolveCache);\n        }\n        let result = cache.elts[cache.i] = ResolvedPos.resolve(doc, pos);\n        cache.i = (cache.i + 1) % resolveCacheSize;\n        return result;\n    }\n}\nclass ResolveCache {\n    constructor() {\n        this.elts = [];\n        this.i = 0;\n    }\n}\nconst resolveCacheSize = 12, resolveCache = new WeakMap();\n/**\nRepresents a flat range of content, i.e. one that starts and\nends in the same node.\n*/\nclass NodeRange {\n    /**\n    Construct a node range. `$from` and `$to` should point into the\n    same node until at least the given `depth`, since a node range\n    denotes an adjacent set of nodes in a single parent node.\n    */\n    constructor(\n    /**\n    A resolved position along the start of the content. May have a\n    `depth` greater than this object's `depth` property, since\n    these are the positions that were used to compute the range,\n    not re-resolved positions directly at its boundaries.\n    */\n    $from, \n    /**\n    A position along the end of the content. See\n    caveat for [`$from`](https://prosemirror.net/docs/ref/#model.NodeRange.$from).\n    */\n    $to, \n    /**\n    The depth of the node that this range points into.\n    */\n    depth) {\n        this.$from = $from;\n        this.$to = $to;\n        this.depth = depth;\n    }\n    /**\n    The position at the start of the range.\n    */\n    get start() { return this.$from.before(this.depth + 1); }\n    /**\n    The position at the end of the range.\n    */\n    get end() { return this.$to.after(this.depth + 1); }\n    /**\n    The parent node that the range points into.\n    */\n    get parent() { return this.$from.node(this.depth); }\n    /**\n    The start index of the range in the parent node.\n    */\n    get startIndex() { return this.$from.index(this.depth); }\n    /**\n    The end index of the range in the parent node.\n    */\n    get endIndex() { return this.$to.indexAfter(this.depth); }\n}\n\nconst emptyAttrs = Object.create(null);\n/**\nThis class represents a node in the tree that makes up a\nProseMirror document. So a document is an instance of `Node`, with\nchildren that are also instances of `Node`.\n\nNodes are persistent data structures. Instead of changing them, you\ncreate new ones with the content you want. Old ones keep pointing\nat the old document shape. This is made cheaper by sharing\nstructure between the old and new data as much as possible, which a\ntree shape like this (without back pointers) makes easy.\n\n**Do not** directly mutate the properties of a `Node` object. See\n[the guide](https://prosemirror.net/docs/guide/#doc) for more information.\n*/\nclass Node {\n    /**\n    @internal\n    */\n    constructor(\n    /**\n    The type of node that this is.\n    */\n    type, \n    /**\n    An object mapping attribute names to values. The kind of\n    attributes allowed and required are\n    [determined](https://prosemirror.net/docs/ref/#model.NodeSpec.attrs) by the node type.\n    */\n    attrs, \n    // A fragment holding the node's children.\n    content, \n    /**\n    The marks (things like whether it is emphasized or part of a\n    link) applied to this node.\n    */\n    marks = Mark.none) {\n        this.type = type;\n        this.attrs = attrs;\n        this.marks = marks;\n        this.content = content || Fragment.empty;\n    }\n    /**\n    The array of this node's child nodes.\n    */\n    get children() { return this.content.content; }\n    /**\n    The size of this node, as defined by the integer-based [indexing\n    scheme](https://prosemirror.net/docs/guide/#doc.indexing). For text nodes, this is the\n    amount of characters. For other leaf nodes, it is one. For\n    non-leaf nodes, it is the size of the content plus two (the\n    start and end token).\n    */\n    get nodeSize() { return this.isLeaf ? 1 : 2 + this.content.size; }\n    /**\n    The number of children that the node has.\n    */\n    get childCount() { return this.content.childCount; }\n    /**\n    Get the child node at the given index. Raises an error when the\n    index is out of range.\n    */\n    child(index) { return this.content.child(index); }\n    /**\n    Get the child node at the given index, if it exists.\n    */\n    maybeChild(index) { return this.content.maybeChild(index); }\n    /**\n    Call `f` for every child node, passing the node, its offset\n    into this parent node, and its index.\n    */\n    forEach(f) { this.content.forEach(f); }\n    /**\n    Invoke a callback for all descendant nodes recursively between\n    the given two positions that are relative to start of this\n    node's content. The callback is invoked with the node, its\n    position relative to the original node (method receiver),\n    its parent node, and its child index. When the callback returns\n    false for a given node, that node's children will not be\n    recursed over. The last parameter can be used to specify a\n    starting position to count from.\n    */\n    nodesBetween(from, to, f, startPos = 0) {\n        this.content.nodesBetween(from, to, f, startPos, this);\n    }\n    /**\n    Call the given callback for every descendant node. Doesn't\n    descend into a node when the callback returns `false`.\n    */\n    descendants(f) {\n        this.nodesBetween(0, this.content.size, f);\n    }\n    /**\n    Concatenates all the text nodes found in this fragment and its\n    children.\n    */\n    get textContent() {\n        return (this.isLeaf && this.type.spec.leafText)\n            ? this.type.spec.leafText(this)\n            : this.textBetween(0, this.content.size, \"\");\n    }\n    /**\n    Get all text between positions `from` and `to`. When\n    `blockSeparator` is given, it will be inserted to separate text\n    from different block nodes. If `leafText` is given, it'll be\n    inserted for every non-text leaf node encountered, otherwise\n    [`leafText`](https://prosemirror.net/docs/ref/#model.NodeSpec^leafText) will be used.\n    */\n    textBetween(from, to, blockSeparator, leafText) {\n        return this.content.textBetween(from, to, blockSeparator, leafText);\n    }\n    /**\n    Returns this node's first child, or `null` if there are no\n    children.\n    */\n    get firstChild() { return this.content.firstChild; }\n    /**\n    Returns this node's last child, or `null` if there are no\n    children.\n    */\n    get lastChild() { return this.content.lastChild; }\n    /**\n    Test whether two nodes represent the same piece of document.\n    */\n    eq(other) {\n        return this == other || (this.sameMarkup(other) && this.content.eq(other.content));\n    }\n    /**\n    Compare the markup (type, attributes, and marks) of this node to\n    those of another. Returns `true` if both have the same markup.\n    */\n    sameMarkup(other) {\n        return this.hasMarkup(other.type, other.attrs, other.marks);\n    }\n    /**\n    Check whether this node's markup correspond to the given type,\n    attributes, and marks.\n    */\n    hasMarkup(type, attrs, marks) {\n        return this.type == type &&\n            compareDeep(this.attrs, attrs || type.defaultAttrs || emptyAttrs) &&\n            Mark.sameSet(this.marks, marks || Mark.none);\n    }\n    /**\n    Create a new node with the same markup as this node, containing\n    the given content (or empty, if no content is given).\n    */\n    copy(content = null) {\n        if (content == this.content)\n            return this;\n        return new Node(this.type, this.attrs, content, this.marks);\n    }\n    /**\n    Create a copy of this node, with the given set of marks instead\n    of the node's own marks.\n    */\n    mark(marks) {\n        return marks == this.marks ? this : new Node(this.type, this.attrs, this.content, marks);\n    }\n    /**\n    Create a copy of this node with only the content between the\n    given positions. If `to` is not given, it defaults to the end of\n    the node.\n    */\n    cut(from, to = this.content.size) {\n        if (from == 0 && to == this.content.size)\n            return this;\n        return this.copy(this.content.cut(from, to));\n    }\n    /**\n    Cut out the part of the document between the given positions, and\n    return it as a `Slice` object.\n    */\n    slice(from, to = this.content.size, includeParents = false) {\n        if (from == to)\n            return Slice.empty;\n        let $from = this.resolve(from), $to = this.resolve(to);\n        let depth = includeParents ? 0 : $from.sharedDepth(to);\n        let start = $from.start(depth), node = $from.node(depth);\n        let content = node.content.cut($from.pos - start, $to.pos - start);\n        return new Slice(content, $from.depth - depth, $to.depth - depth);\n    }\n    /**\n    Replace the part of the document between the given positions with\n    the given slice. The slice must 'fit', meaning its open sides\n    must be able to connect to the surrounding content, and its\n    content nodes must be valid children for the node they are placed\n    into. If any of this is violated, an error of type\n    [`ReplaceError`](https://prosemirror.net/docs/ref/#model.ReplaceError) is thrown.\n    */\n    replace(from, to, slice) {\n        return replace(this.resolve(from), this.resolve(to), slice);\n    }\n    /**\n    Find the node directly after the given position.\n    */\n    nodeAt(pos) {\n        for (let node = this;;) {\n            let { index, offset } = node.content.findIndex(pos);\n            node = node.maybeChild(index);\n            if (!node)\n                return null;\n            if (offset == pos || node.isText)\n                return node;\n            pos -= offset + 1;\n        }\n    }\n    /**\n    Find the (direct) child node after the given offset, if any,\n    and return it along with its index and offset relative to this\n    node.\n    */\n    childAfter(pos) {\n        let { index, offset } = this.content.findIndex(pos);\n        return { node: this.content.maybeChild(index), index, offset };\n    }\n    /**\n    Find the (direct) child node before the given offset, if any,\n    and return it along with its index and offset relative to this\n    node.\n    */\n    childBefore(pos) {\n        if (pos == 0)\n            return { node: null, index: 0, offset: 0 };\n        let { index, offset } = this.content.findIndex(pos);\n        if (offset < pos)\n            return { node: this.content.child(index), index, offset };\n        let node = this.content.child(index - 1);\n        return { node, index: index - 1, offset: offset - node.nodeSize };\n    }\n    /**\n    Resolve the given position in the document, returning an\n    [object](https://prosemirror.net/docs/ref/#model.ResolvedPos) with information about its context.\n    */\n    resolve(pos) { return ResolvedPos.resolveCached(this, pos); }\n    /**\n    @internal\n    */\n    resolveNoCache(pos) { return ResolvedPos.resolve(this, pos); }\n    /**\n    Test whether a given mark or mark type occurs in this document\n    between the two given positions.\n    */\n    rangeHasMark(from, to, type) {\n        let found = false;\n        if (to > from)\n            this.nodesBetween(from, to, node => {\n                if (type.isInSet(node.marks))\n                    found = true;\n                return !found;\n            });\n        return found;\n    }\n    /**\n    True when this is a block (non-inline node)\n    */\n    get isBlock() { return this.type.isBlock; }\n    /**\n    True when this is a textblock node, a block node with inline\n    content.\n    */\n    get isTextblock() { return this.type.isTextblock; }\n    /**\n    True when this node allows inline content.\n    */\n    get inlineContent() { return this.type.inlineContent; }\n    /**\n    True when this is an inline node (a text node or a node that can\n    appear among text).\n    */\n    get isInline() { return this.type.isInline; }\n    /**\n    True when this is a text node.\n    */\n    get isText() { return this.type.isText; }\n    /**\n    True when this is a leaf node.\n    */\n    get isLeaf() { return this.type.isLeaf; }\n    /**\n    True when this is an atom, i.e. when it does not have directly\n    editable content. This is usually the same as `isLeaf`, but can\n    be configured with the [`atom` property](https://prosemirror.net/docs/ref/#model.NodeSpec.atom)\n    on a node's spec (typically used when the node is displayed as\n    an uneditable [node view](https://prosemirror.net/docs/ref/#view.NodeView)).\n    */\n    get isAtom() { return this.type.isAtom; }\n    /**\n    Return a string representation of this node for debugging\n    purposes.\n    */\n    toString() {\n        if (this.type.spec.toDebugString)\n            return this.type.spec.toDebugString(this);\n        let name = this.type.name;\n        if (this.content.size)\n            name += \"(\" + this.content.toStringInner() + \")\";\n        return wrapMarks(this.marks, name);\n    }\n    /**\n    Get the content match in this node at the given index.\n    */\n    contentMatchAt(index) {\n        let match = this.type.contentMatch.matchFragment(this.content, 0, index);\n        if (!match)\n            throw new Error(\"Called contentMatchAt on a node with invalid content\");\n        return match;\n    }\n    /**\n    Test whether replacing the range between `from` and `to` (by\n    child index) with the given replacement fragment (which defaults\n    to the empty fragment) would leave the node's content valid. You\n    can optionally pass `start` and `end` indices into the\n    replacement fragment.\n    */\n    canReplace(from, to, replacement = Fragment.empty, start = 0, end = replacement.childCount) {\n        let one = this.contentMatchAt(from).matchFragment(replacement, start, end);\n        let two = one && one.matchFragment(this.content, to);\n        if (!two || !two.validEnd)\n            return false;\n        for (let i = start; i < end; i++)\n            if (!this.type.allowsMarks(replacement.child(i).marks))\n                return false;\n        return true;\n    }\n    /**\n    Test whether replacing the range `from` to `to` (by index) with\n    a node of the given type would leave the node's content valid.\n    */\n    canReplaceWith(from, to, type, marks) {\n        if (marks && !this.type.allowsMarks(marks))\n            return false;\n        let start = this.contentMatchAt(from).matchType(type);\n        let end = start && start.matchFragment(this.content, to);\n        return end ? end.validEnd : false;\n    }\n    /**\n    Test whether the given node's content could be appended to this\n    node. If that node is empty, this will only return true if there\n    is at least one node type that can appear in both nodes (to avoid\n    merging completely incompatible nodes).\n    */\n    canAppend(other) {\n        if (other.content.size)\n            return this.canReplace(this.childCount, this.childCount, other.content);\n        else\n            return this.type.compatibleContent(other.type);\n    }\n    /**\n    Check whether this node and its descendants conform to the\n    schema, and raise an exception when they do not.\n    */\n    check() {\n        this.type.checkContent(this.content);\n        this.type.checkAttrs(this.attrs);\n        let copy = Mark.none;\n        for (let i = 0; i < this.marks.length; i++) {\n            let mark = this.marks[i];\n            mark.type.checkAttrs(mark.attrs);\n            copy = mark.addToSet(copy);\n        }\n        if (!Mark.sameSet(copy, this.marks))\n            throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(m => m.type.name)}`);\n        this.content.forEach(node => node.check());\n    }\n    /**\n    Return a JSON-serializeable representation of this node.\n    */\n    toJSON() {\n        let obj = { type: this.type.name };\n        for (let _ in this.attrs) {\n            obj.attrs = this.attrs;\n            break;\n        }\n        if (this.content.size)\n            obj.content = this.content.toJSON();\n        if (this.marks.length)\n            obj.marks = this.marks.map(n => n.toJSON());\n        return obj;\n    }\n    /**\n    Deserialize a node from its JSON representation.\n    */\n    static fromJSON(schema, json) {\n        if (!json)\n            throw new RangeError(\"Invalid input for Node.fromJSON\");\n        let marks = undefined;\n        if (json.marks) {\n            if (!Array.isArray(json.marks))\n                throw new RangeError(\"Invalid mark data for Node.fromJSON\");\n            marks = json.marks.map(schema.markFromJSON);\n        }\n        if (json.type == \"text\") {\n            if (typeof json.text != \"string\")\n                throw new RangeError(\"Invalid text node in JSON\");\n            return schema.text(json.text, marks);\n        }\n        let content = Fragment.fromJSON(schema, json.content);\n        let node = schema.nodeType(json.type).create(json.attrs, content, marks);\n        node.type.checkAttrs(node.attrs);\n        return node;\n    }\n}\nNode.prototype.text = undefined;\nclass TextNode extends Node {\n    /**\n    @internal\n    */\n    constructor(type, attrs, content, marks) {\n        super(type, attrs, null, marks);\n        if (!content)\n            throw new RangeError(\"Empty text nodes are not allowed\");\n        this.text = content;\n    }\n    toString() {\n        if (this.type.spec.toDebugString)\n            return this.type.spec.toDebugString(this);\n        return wrapMarks(this.marks, JSON.stringify(this.text));\n    }\n    get textContent() { return this.text; }\n    textBetween(from, to) { return this.text.slice(from, to); }\n    get nodeSize() { return this.text.length; }\n    mark(marks) {\n        return marks == this.marks ? this : new TextNode(this.type, this.attrs, this.text, marks);\n    }\n    withText(text) {\n        if (text == this.text)\n            return this;\n        return new TextNode(this.type, this.attrs, text, this.marks);\n    }\n    cut(from = 0, to = this.text.length) {\n        if (from == 0 && to == this.text.length)\n            return this;\n        return this.withText(this.text.slice(from, to));\n    }\n    eq(other) {\n        return this.sameMarkup(other) && this.text == other.text;\n    }\n    toJSON() {\n        let base = super.toJSON();\n        base.text = this.text;\n        return base;\n    }\n}\nfunction wrapMarks(marks, str) {\n    for (let i = marks.length - 1; i >= 0; i--)\n        str = marks[i].type.name + \"(\" + str + \")\";\n    return str;\n}\n\n/**\nInstances of this class represent a match state of a node type's\n[content expression](https://prosemirror.net/docs/ref/#model.NodeSpec.content), and can be used to\nfind out whether further content matches here, and whether a given\nposition is a valid end of the node.\n*/\nclass ContentMatch {\n    /**\n    @internal\n    */\n    constructor(\n    /**\n    True when this match state represents a valid end of the node.\n    */\n    validEnd) {\n        this.validEnd = validEnd;\n        /**\n        @internal\n        */\n        this.next = [];\n        /**\n        @internal\n        */\n        this.wrapCache = [];\n    }\n    /**\n    @internal\n    */\n    static parse(string, nodeTypes) {\n        let stream = new TokenStream(string, nodeTypes);\n        if (stream.next == null)\n            return ContentMatch.empty;\n        let expr = parseExpr(stream);\n        if (stream.next)\n            stream.err(\"Unexpected trailing text\");\n        let match = dfa(nfa(expr));\n        checkForDeadEnds(match, stream);\n        return match;\n    }\n    /**\n    Match a node type, returning a match after that node if\n    successful.\n    */\n    matchType(type) {\n        for (let i = 0; i < this.next.length; i++)\n            if (this.next[i].type == type)\n                return this.next[i].next;\n        return null;\n    }\n    /**\n    Try to match a fragment. Returns the resulting match when\n    successful.\n    */\n    matchFragment(frag, start = 0, end = frag.childCount) {\n        let cur = this;\n        for (let i = start; cur && i < end; i++)\n            cur = cur.matchType(frag.child(i).type);\n        return cur;\n    }\n    /**\n    @internal\n    */\n    get inlineContent() {\n        return this.next.length != 0 && this.next[0].type.isInline;\n    }\n    /**\n    Get the first matching node type at this match position that can\n    be generated.\n    */\n    get defaultType() {\n        for (let i = 0; i < this.next.length; i++) {\n            let { type } = this.next[i];\n            if (!(type.isText || type.hasRequiredAttrs()))\n                return type;\n        }\n        return null;\n    }\n    /**\n    @internal\n    */\n    compatible(other) {\n        for (let i = 0; i < this.next.length; i++)\n            for (let j = 0; j < other.next.length; j++)\n                if (this.next[i].type == other.next[j].type)\n                    return true;\n        return false;\n    }\n    /**\n    Try to match the given fragment, and if that fails, see if it can\n    be made to match by inserting nodes in front of it. When\n    successful, return a fragment of inserted nodes (which may be\n    empty if nothing had to be inserted). When `toEnd` is true, only\n    return a fragment if the resulting match goes to the end of the\n    content expression.\n    */\n    fillBefore(after, toEnd = false, startIndex = 0) {\n        let seen = [this];\n        function search(match, types) {\n            let finished = match.matchFragment(after, startIndex);\n            if (finished && (!toEnd || finished.validEnd))\n                return Fragment.from(types.map(tp => tp.createAndFill()));\n            for (let i = 0; i < match.next.length; i++) {\n                let { type, next } = match.next[i];\n                if (!(type.isText || type.hasRequiredAttrs()) && seen.indexOf(next) == -1) {\n                    seen.push(next);\n                    let found = search(next, types.concat(type));\n                    if (found)\n                        return found;\n                }\n            }\n            return null;\n        }\n        return search(this, []);\n    }\n    /**\n    Find a set of wrapping node types that would allow a node of the\n    given type to appear at this position. The result may be empty\n    (when it fits directly) and will be null when no such wrapping\n    exists.\n    */\n    findWrapping(target) {\n        for (let i = 0; i < this.wrapCache.length; i += 2)\n            if (this.wrapCache[i] == target)\n                return this.wrapCache[i + 1];\n        let computed = this.computeWrapping(target);\n        this.wrapCache.push(target, computed);\n        return computed;\n    }\n    /**\n    @internal\n    */\n    computeWrapping(target) {\n        let seen = Object.create(null), active = [{ match: this, type: null, via: null }];\n        while (active.length) {\n            let current = active.shift(), match = current.match;\n            if (match.matchType(target)) {\n                let result = [];\n                for (let obj = current; obj.type; obj = obj.via)\n                    result.push(obj.type);\n                return result.reverse();\n            }\n            for (let i = 0; i < match.next.length; i++) {\n                let { type, next } = match.next[i];\n                if (!type.isLeaf && !type.hasRequiredAttrs() && !(type.name in seen) && (!current.type || next.validEnd)) {\n                    active.push({ match: type.contentMatch, type, via: current });\n                    seen[type.name] = true;\n                }\n            }\n        }\n        return null;\n    }\n    /**\n    The number of outgoing edges this node has in the finite\n    automaton that describes the content expression.\n    */\n    get edgeCount() {\n        return this.next.length;\n    }\n    /**\n    Get the _n_​th outgoing edge from this node in the finite\n    automaton that describes the content expression.\n    */\n    edge(n) {\n        if (n >= this.next.length)\n            throw new RangeError(`There's no ${n}th edge in this content match`);\n        return this.next[n];\n    }\n    /**\n    @internal\n    */\n    toString() {\n        let seen = [];\n        function scan(m) {\n            seen.push(m);\n            for (let i = 0; i < m.next.length; i++)\n                if (seen.indexOf(m.next[i].next) == -1)\n                    scan(m.next[i].next);\n        }\n        scan(this);\n        return seen.map((m, i) => {\n            let out = i + (m.validEnd ? \"*\" : \" \") + \" \";\n            for (let i = 0; i < m.next.length; i++)\n                out += (i ? \", \" : \"\") + m.next[i].type.name + \"->\" + seen.indexOf(m.next[i].next);\n            return out;\n        }).join(\"\\n\");\n    }\n}\n/**\n@internal\n*/\nContentMatch.empty = new ContentMatch(true);\nclass TokenStream {\n    constructor(string, nodeTypes) {\n        this.string = string;\n        this.nodeTypes = nodeTypes;\n        this.inline = null;\n        this.pos = 0;\n        this.tokens = string.split(/\\s*(?=\\b|\\W|$)/);\n        if (this.tokens[this.tokens.length - 1] == \"\")\n            this.tokens.pop();\n        if (this.tokens[0] == \"\")\n            this.tokens.shift();\n    }\n    get next() { return this.tokens[this.pos]; }\n    eat(tok) { return this.next == tok && (this.pos++ || true); }\n    err(str) { throw new SyntaxError(str + \" (in content expression '\" + this.string + \"')\"); }\n}\nfunction parseExpr(stream) {\n    let exprs = [];\n    do {\n        exprs.push(parseExprSeq(stream));\n    } while (stream.eat(\"|\"));\n    return exprs.length == 1 ? exprs[0] : { type: \"choice\", exprs };\n}\nfunction parseExprSeq(stream) {\n    let exprs = [];\n    do {\n        exprs.push(parseExprSubscript(stream));\n    } while (stream.next && stream.next != \")\" && stream.next != \"|\");\n    return exprs.length == 1 ? exprs[0] : { type: \"seq\", exprs };\n}\nfunction parseExprSubscript(stream) {\n    let expr = parseExprAtom(stream);\n    for (;;) {\n        if (stream.eat(\"+\"))\n            expr = { type: \"plus\", expr };\n        else if (stream.eat(\"*\"))\n            expr = { type: \"star\", expr };\n        else if (stream.eat(\"?\"))\n            expr = { type: \"opt\", expr };\n        else if (stream.eat(\"{\"))\n            expr = parseExprRange(stream, expr);\n        else\n            break;\n    }\n    return expr;\n}\nfunction parseNum(stream) {\n    if (/\\D/.test(stream.next))\n        stream.err(\"Expected number, got '\" + stream.next + \"'\");\n    let result = Number(stream.next);\n    stream.pos++;\n    return result;\n}\nfunction parseExprRange(stream, expr) {\n    let min = parseNum(stream), max = min;\n    if (stream.eat(\",\")) {\n        if (stream.next != \"}\")\n            max = parseNum(stream);\n        else\n            max = -1;\n    }\n    if (!stream.eat(\"}\"))\n        stream.err(\"Unclosed braced range\");\n    return { type: \"range\", min, max, expr };\n}\nfunction resolveName(stream, name) {\n    let types = stream.nodeTypes, type = types[name];\n    if (type)\n        return [type];\n    let result = [];\n    for (let typeName in types) {\n        let type = types[typeName];\n        if (type.isInGroup(name))\n            result.push(type);\n    }\n    if (result.length == 0)\n        stream.err(\"No node type or group '\" + name + \"' found\");\n    return result;\n}\nfunction parseExprAtom(stream) {\n    if (stream.eat(\"(\")) {\n        let expr = parseExpr(stream);\n        if (!stream.eat(\")\"))\n            stream.err(\"Missing closing paren\");\n        return expr;\n    }\n    else if (!/\\W/.test(stream.next)) {\n        let exprs = resolveName(stream, stream.next).map(type => {\n            if (stream.inline == null)\n                stream.inline = type.isInline;\n            else if (stream.inline != type.isInline)\n                stream.err(\"Mixing inline and block content\");\n            return { type: \"name\", value: type };\n        });\n        stream.pos++;\n        return exprs.length == 1 ? exprs[0] : { type: \"choice\", exprs };\n    }\n    else {\n        stream.err(\"Unexpected token '\" + stream.next + \"'\");\n    }\n}\n// Construct an NFA from an expression as returned by the parser. The\n// NFA is represented as an array of states, which are themselves\n// arrays of edges, which are `{term, to}` objects. The first state is\n// the entry state and the last node is the success state.\n//\n// Note that unlike typical NFAs, the edge ordering in this one is\n// significant, in that it is used to contruct filler content when\n// necessary.\nfunction nfa(expr) {\n    let nfa = [[]];\n    connect(compile(expr, 0), node());\n    return nfa;\n    function node() { return nfa.push([]) - 1; }\n    function edge(from, to, term) {\n        let edge = { term, to };\n        nfa[from].push(edge);\n        return edge;\n    }\n    function connect(edges, to) {\n        edges.forEach(edge => edge.to = to);\n    }\n    function compile(expr, from) {\n        if (expr.type == \"choice\") {\n            return expr.exprs.reduce((out, expr) => out.concat(compile(expr, from)), []);\n        }\n        else if (expr.type == \"seq\") {\n            for (let i = 0;; i++) {\n                let next = compile(expr.exprs[i], from);\n                if (i == expr.exprs.length - 1)\n                    return next;\n                connect(next, from = node());\n            }\n        }\n        else if (expr.type == \"star\") {\n            let loop = node();\n            edge(from, loop);\n            connect(compile(expr.expr, loop), loop);\n            return [edge(loop)];\n        }\n        else if (expr.type == \"plus\") {\n            let loop = node();\n            connect(compile(expr.expr, from), loop);\n            connect(compile(expr.expr, loop), loop);\n            return [edge(loop)];\n        }\n        else if (expr.type == \"opt\") {\n            return [edge(from)].concat(compile(expr.expr, from));\n        }\n        else if (expr.type == \"range\") {\n            let cur = from;\n            for (let i = 0; i < expr.min; i++) {\n                let next = node();\n                connect(compile(expr.expr, cur), next);\n                cur = next;\n            }\n            if (expr.max == -1) {\n                connect(compile(expr.expr, cur), cur);\n            }\n            else {\n                for (let i = expr.min; i < expr.max; i++) {\n                    let next = node();\n                    edge(cur, next);\n                    connect(compile(expr.expr, cur), next);\n                    cur = next;\n                }\n            }\n            return [edge(cur)];\n        }\n        else if (expr.type == \"name\") {\n            return [edge(from, undefined, expr.value)];\n        }\n        else {\n            throw new Error(\"Unknown expr type\");\n        }\n    }\n}\nfunction cmp(a, b) { return b - a; }\n// Get the set of nodes reachable by null edges from `node`. Omit\n// nodes with only a single null-out-edge, since they may lead to\n// needless duplicated nodes.\nfunction nullFrom(nfa, node) {\n    let result = [];\n    scan(node);\n    return result.sort(cmp);\n    function scan(node) {\n        let edges = nfa[node];\n        if (edges.length == 1 && !edges[0].term)\n            return scan(edges[0].to);\n        result.push(node);\n        for (let i = 0; i < edges.length; i++) {\n            let { term, to } = edges[i];\n            if (!term && result.indexOf(to) == -1)\n                scan(to);\n        }\n    }\n}\n// Compiles an NFA as produced by `nfa` into a DFA, modeled as a set\n// of state objects (`ContentMatch` instances) with transitions\n// between them.\nfunction dfa(nfa) {\n    let labeled = Object.create(null);\n    return explore(nullFrom(nfa, 0));\n    function explore(states) {\n        let out = [];\n        states.forEach(node => {\n            nfa[node].forEach(({ term, to }) => {\n                if (!term)\n                    return;\n                let set;\n                for (let i = 0; i < out.length; i++)\n                    if (out[i][0] == term)\n                        set = out[i][1];\n                nullFrom(nfa, to).forEach(node => {\n                    if (!set)\n                        out.push([term, set = []]);\n                    if (set.indexOf(node) == -1)\n                        set.push(node);\n                });\n            });\n        });\n        let state = labeled[states.join(\",\")] = new ContentMatch(states.indexOf(nfa.length - 1) > -1);\n        for (let i = 0; i < out.length; i++) {\n            let states = out[i][1].sort(cmp);\n            state.next.push({ type: out[i][0], next: labeled[states.join(\",\")] || explore(states) });\n        }\n        return state;\n    }\n}\nfunction checkForDeadEnds(match, stream) {\n    for (let i = 0, work = [match]; i < work.length; i++) {\n        let state = work[i], dead = !state.validEnd, nodes = [];\n        for (let j = 0; j < state.next.length; j++) {\n            let { type, next } = state.next[j];\n            nodes.push(type.name);\n            if (dead && !(type.isText || type.hasRequiredAttrs()))\n                dead = false;\n            if (work.indexOf(next) == -1)\n                work.push(next);\n        }\n        if (dead)\n            stream.err(\"Only non-generatable nodes (\" + nodes.join(\", \") + \") in a required position (see https://prosemirror.net/docs/guide/#generatable)\");\n    }\n}\n\n// For node types where all attrs have a default value (or which don't\n// have any attributes), build up a single reusable default attribute\n// object, and use it for all nodes that don't specify specific\n// attributes.\nfunction defaultAttrs(attrs) {\n    let defaults = Object.create(null);\n    for (let attrName in attrs) {\n        let attr = attrs[attrName];\n        if (!attr.hasDefault)\n            return null;\n        defaults[attrName] = attr.default;\n    }\n    return defaults;\n}\nfunction computeAttrs(attrs, value) {\n    let built = Object.create(null);\n    for (let name in attrs) {\n        let given = value && value[name];\n        if (given === undefined) {\n            let attr = attrs[name];\n            if (attr.hasDefault)\n                given = attr.default;\n            else\n                throw new RangeError(\"No value supplied for attribute \" + name);\n        }\n        built[name] = given;\n    }\n    return built;\n}\nfunction checkAttrs(attrs, values, type, name) {\n    for (let name in values)\n        if (!(name in attrs))\n            throw new RangeError(`Unsupported attribute ${name} for ${type} of type ${name}`);\n    for (let name in attrs) {\n        let attr = attrs[name];\n        if (attr.validate)\n            attr.validate(values[name]);\n    }\n}\nfunction initAttrs(typeName, attrs) {\n    let result = Object.create(null);\n    if (attrs)\n        for (let name in attrs)\n            result[name] = new Attribute(typeName, name, attrs[name]);\n    return result;\n}\n/**\nNode types are objects allocated once per `Schema` and used to\n[tag](https://prosemirror.net/docs/ref/#model.Node.type) `Node` instances. They contain information\nabout the node type, such as its name and what kind of node it\nrepresents.\n*/\nclass NodeType {\n    /**\n    @internal\n    */\n    constructor(\n    /**\n    The name the node type has in this schema.\n    */\n    name, \n    /**\n    A link back to the `Schema` the node type belongs to.\n    */\n    schema, \n    /**\n    The spec that this type is based on\n    */\n    spec) {\n        this.name = name;\n        this.schema = schema;\n        this.spec = spec;\n        /**\n        The set of marks allowed in this node. `null` means all marks\n        are allowed.\n        */\n        this.markSet = null;\n        this.groups = spec.group ? spec.group.split(\" \") : [];\n        this.attrs = initAttrs(name, spec.attrs);\n        this.defaultAttrs = defaultAttrs(this.attrs);\n        this.contentMatch = null;\n        this.inlineContent = null;\n        this.isBlock = !(spec.inline || name == \"text\");\n        this.isText = name == \"text\";\n    }\n    /**\n    True if this is an inline type.\n    */\n    get isInline() { return !this.isBlock; }\n    /**\n    True if this is a textblock type, a block that contains inline\n    content.\n    */\n    get isTextblock() { return this.isBlock && this.inlineContent; }\n    /**\n    True for node types that allow no content.\n    */\n    get isLeaf() { return this.contentMatch == ContentMatch.empty; }\n    /**\n    True when this node is an atom, i.e. when it does not have\n    directly editable content.\n    */\n    get isAtom() { return this.isLeaf || !!this.spec.atom; }\n    /**\n    Return true when this node type is part of the given\n    [group](https://prosemirror.net/docs/ref/#model.NodeSpec.group).\n    */\n    isInGroup(group) {\n        return this.groups.indexOf(group) > -1;\n    }\n    /**\n    The node type's [whitespace](https://prosemirror.net/docs/ref/#model.NodeSpec.whitespace) option.\n    */\n    get whitespace() {\n        return this.spec.whitespace || (this.spec.code ? \"pre\" : \"normal\");\n    }\n    /**\n    Tells you whether this node type has any required attributes.\n    */\n    hasRequiredAttrs() {\n        for (let n in this.attrs)\n            if (this.attrs[n].isRequired)\n                return true;\n        return false;\n    }\n    /**\n    Indicates whether this node allows some of the same content as\n    the given node type.\n    */\n    compatibleContent(other) {\n        return this == other || this.contentMatch.compatible(other.contentMatch);\n    }\n    /**\n    @internal\n    */\n    computeAttrs(attrs) {\n        if (!attrs && this.defaultAttrs)\n            return this.defaultAttrs;\n        else\n            return computeAttrs(this.attrs, attrs);\n    }\n    /**\n    Create a `Node` of this type. The given attributes are\n    checked and defaulted (you can pass `null` to use the type's\n    defaults entirely, if no required attributes exist). `content`\n    may be a `Fragment`, a node, an array of nodes, or\n    `null`. Similarly `marks` may be `null` to default to the empty\n    set of marks.\n    */\n    create(attrs = null, content, marks) {\n        if (this.isText)\n            throw new Error(\"NodeType.create can't construct text nodes\");\n        return new Node(this, this.computeAttrs(attrs), Fragment.from(content), Mark.setFrom(marks));\n    }\n    /**\n    Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but check the given content\n    against the node type's content restrictions, and throw an error\n    if it doesn't match.\n    */\n    createChecked(attrs = null, content, marks) {\n        content = Fragment.from(content);\n        this.checkContent(content);\n        return new Node(this, this.computeAttrs(attrs), content, Mark.setFrom(marks));\n    }\n    /**\n    Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but see if it is\n    necessary to add nodes to the start or end of the given fragment\n    to make it fit the node. If no fitting wrapping can be found,\n    return null. Note that, due to the fact that required nodes can\n    always be created, this will always succeed if you pass null or\n    `Fragment.empty` as content.\n    */\n    createAndFill(attrs = null, content, marks) {\n        attrs = this.computeAttrs(attrs);\n        content = Fragment.from(content);\n        if (content.size) {\n            let before = this.contentMatch.fillBefore(content);\n            if (!before)\n                return null;\n            content = before.append(content);\n        }\n        let matched = this.contentMatch.matchFragment(content);\n        let after = matched && matched.fillBefore(Fragment.empty, true);\n        if (!after)\n            return null;\n        return new Node(this, attrs, content.append(after), Mark.setFrom(marks));\n    }\n    /**\n    Returns true if the given fragment is valid content for this node\n    type.\n    */\n    validContent(content) {\n        let result = this.contentMatch.matchFragment(content);\n        if (!result || !result.validEnd)\n            return false;\n        for (let i = 0; i < content.childCount; i++)\n            if (!this.allowsMarks(content.child(i).marks))\n                return false;\n        return true;\n    }\n    /**\n    Throws a RangeError if the given fragment is not valid content for this\n    node type.\n    @internal\n    */\n    checkContent(content) {\n        if (!this.validContent(content))\n            throw new RangeError(`Invalid content for node ${this.name}: ${content.toString().slice(0, 50)}`);\n    }\n    /**\n    @internal\n    */\n    checkAttrs(attrs) {\n        checkAttrs(this.attrs, attrs, \"node\", this.name);\n    }\n    /**\n    Check whether the given mark type is allowed in this node.\n    */\n    allowsMarkType(markType) {\n        return this.markSet == null || this.markSet.indexOf(markType) > -1;\n    }\n    /**\n    Test whether the given set of marks are allowed in this node.\n    */\n    allowsMarks(marks) {\n        if (this.markSet == null)\n            return true;\n        for (let i = 0; i < marks.length; i++)\n            if (!this.allowsMarkType(marks[i].type))\n                return false;\n        return true;\n    }\n    /**\n    Removes the marks that are not allowed in this node from the given set.\n    */\n    allowedMarks(marks) {\n        if (this.markSet == null)\n            return marks;\n        let copy;\n        for (let i = 0; i < marks.length; i++) {\n            if (!this.allowsMarkType(marks[i].type)) {\n                if (!copy)\n                    copy = marks.slice(0, i);\n            }\n            else if (copy) {\n                copy.push(marks[i]);\n            }\n        }\n        return !copy ? marks : copy.length ? copy : Mark.none;\n    }\n    /**\n    @internal\n    */\n    static compile(nodes, schema) {\n        let result = Object.create(null);\n        nodes.forEach((name, spec) => result[name] = new NodeType(name, schema, spec));\n        let topType = schema.spec.topNode || \"doc\";\n        if (!result[topType])\n            throw new RangeError(\"Schema is missing its top node type ('\" + topType + \"')\");\n        if (!result.text)\n            throw new RangeError(\"Every schema needs a 'text' type\");\n        for (let _ in result.text.attrs)\n            throw new RangeError(\"The text node type should not have attributes\");\n        return result;\n    }\n}\nfunction validateType(typeName, attrName, type) {\n    let types = type.split(\"|\");\n    return (value) => {\n        let name = value === null ? \"null\" : typeof value;\n        if (types.indexOf(name) < 0)\n            throw new RangeError(`Expected value of type ${types} for attribute ${attrName} on type ${typeName}, got ${name}`);\n    };\n}\n// Attribute descriptors\nclass Attribute {\n    constructor(typeName, attrName, options) {\n        this.hasDefault = Object.prototype.hasOwnProperty.call(options, \"default\");\n        this.default = options.default;\n        this.validate = typeof options.validate == \"string\" ? validateType(typeName, attrName, options.validate) : options.validate;\n    }\n    get isRequired() {\n        return !this.hasDefault;\n    }\n}\n// Marks\n/**\nLike nodes, marks (which are associated with nodes to signify\nthings like emphasis or being part of a link) are\n[tagged](https://prosemirror.net/docs/ref/#model.Mark.type) with type objects, which are\ninstantiated once per `Schema`.\n*/\nclass MarkType {\n    /**\n    @internal\n    */\n    constructor(\n    /**\n    The name of the mark type.\n    */\n    name, \n    /**\n    @internal\n    */\n    rank, \n    /**\n    The schema that this mark type instance is part of.\n    */\n    schema, \n    /**\n    The spec on which the type is based.\n    */\n    spec) {\n        this.name = name;\n        this.rank = rank;\n        this.schema = schema;\n        this.spec = spec;\n        this.attrs = initAttrs(name, spec.attrs);\n        this.excluded = null;\n        let defaults = defaultAttrs(this.attrs);\n        this.instance = defaults ? new Mark(this, defaults) : null;\n    }\n    /**\n    Create a mark of this type. `attrs` may be `null` or an object\n    containing only some of the mark's attributes. The others, if\n    they have defaults, will be added.\n    */\n    create(attrs = null) {\n        if (!attrs && this.instance)\n            return this.instance;\n        return new Mark(this, computeAttrs(this.attrs, attrs));\n    }\n    /**\n    @internal\n    */\n    static compile(marks, schema) {\n        let result = Object.create(null), rank = 0;\n        marks.forEach((name, spec) => result[name] = new MarkType(name, rank++, schema, spec));\n        return result;\n    }\n    /**\n    When there is a mark of this type in the given set, a new set\n    without it is returned. Otherwise, the input set is returned.\n    */\n    removeFromSet(set) {\n        for (var i = 0; i < set.length; i++)\n            if (set[i].type == this) {\n                set = set.slice(0, i).concat(set.slice(i + 1));\n                i--;\n            }\n        return set;\n    }\n    /**\n    Tests whether there is a mark of this type in the given set.\n    */\n    isInSet(set) {\n        for (let i = 0; i < set.length; i++)\n            if (set[i].type == this)\n                return set[i];\n    }\n    /**\n    @internal\n    */\n    checkAttrs(attrs) {\n        checkAttrs(this.attrs, attrs, \"mark\", this.name);\n    }\n    /**\n    Queries whether a given mark type is\n    [excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one.\n    */\n    excludes(other) {\n        return this.excluded.indexOf(other) > -1;\n    }\n}\n/**\nA document schema. Holds [node](https://prosemirror.net/docs/ref/#model.NodeType) and [mark\ntype](https://prosemirror.net/docs/ref/#model.MarkType) objects for the nodes and marks that may\noccur in conforming documents, and provides functionality for\ncreating and deserializing such documents.\n\nWhen given, the type parameters provide the names of the nodes and\nmarks in this schema.\n*/\nclass Schema {\n    /**\n    Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).\n    */\n    constructor(spec) {\n        /**\n        The [linebreak\n        replacement](https://prosemirror.net/docs/ref/#model.NodeSpec.linebreakReplacement) node defined\n        in this schema, if any.\n        */\n        this.linebreakReplacement = null;\n        /**\n        An object for storing whatever values modules may want to\n        compute and cache per schema. (If you want to store something\n        in it, try to use property names unlikely to clash.)\n        */\n        this.cached = Object.create(null);\n        let instanceSpec = this.spec = {};\n        for (let prop in spec)\n            instanceSpec[prop] = spec[prop];\n        instanceSpec.nodes = OrderedMap.from(spec.nodes),\n            instanceSpec.marks = OrderedMap.from(spec.marks || {}),\n            this.nodes = NodeType.compile(this.spec.nodes, this);\n        this.marks = MarkType.compile(this.spec.marks, this);\n        let contentExprCache = Object.create(null);\n        for (let prop in this.nodes) {\n            if (prop in this.marks)\n                throw new RangeError(prop + \" can not be both a node and a mark\");\n            let type = this.nodes[prop], contentExpr = type.spec.content || \"\", markExpr = type.spec.marks;\n            type.contentMatch = contentExprCache[contentExpr] ||\n                (contentExprCache[contentExpr] = ContentMatch.parse(contentExpr, this.nodes));\n            type.inlineContent = type.contentMatch.inlineContent;\n            if (type.spec.linebreakReplacement) {\n                if (this.linebreakReplacement)\n                    throw new RangeError(\"Multiple linebreak nodes defined\");\n                if (!type.isInline || !type.isLeaf)\n                    throw new RangeError(\"Linebreak replacement nodes must be inline leaf nodes\");\n                this.linebreakReplacement = type;\n            }\n            type.markSet = markExpr == \"_\" ? null :\n                markExpr ? gatherMarks(this, markExpr.split(\" \")) :\n                    markExpr == \"\" || !type.inlineContent ? [] : null;\n        }\n        for (let prop in this.marks) {\n            let type = this.marks[prop], excl = type.spec.excludes;\n            type.excluded = excl == null ? [type] : excl == \"\" ? [] : gatherMarks(this, excl.split(\" \"));\n        }\n        this.nodeFromJSON = this.nodeFromJSON.bind(this);\n        this.markFromJSON = this.markFromJSON.bind(this);\n        this.topNodeType = this.nodes[this.spec.topNode || \"doc\"];\n        this.cached.wrappings = Object.create(null);\n    }\n    /**\n    Create a node in this schema. The `type` may be a string or a\n    `NodeType` instance. Attributes will be extended with defaults,\n    `content` may be a `Fragment`, `null`, a `Node`, or an array of\n    nodes.\n    */\n    node(type, attrs = null, content, marks) {\n        if (typeof type == \"string\")\n            type = this.nodeType(type);\n        else if (!(type instanceof NodeType))\n            throw new RangeError(\"Invalid node type: \" + type);\n        else if (type.schema != this)\n            throw new RangeError(\"Node type from different schema used (\" + type.name + \")\");\n        return type.createChecked(attrs, content, marks);\n    }\n    /**\n    Create a text node in the schema. Empty text nodes are not\n    allowed.\n    */\n    text(text, marks) {\n        let type = this.nodes.text;\n        return new TextNode(type, type.defaultAttrs, text, Mark.setFrom(marks));\n    }\n    /**\n    Create a mark with the given type and attributes.\n    */\n    mark(type, attrs) {\n        if (typeof type == \"string\")\n            type = this.marks[type];\n        return type.create(attrs);\n    }\n    /**\n    Deserialize a node from its JSON representation. This method is\n    bound.\n    */\n    nodeFromJSON(json) {\n        return Node.fromJSON(this, json);\n    }\n    /**\n    Deserialize a mark from its JSON representation. This method is\n    bound.\n    */\n    markFromJSON(json) {\n        return Mark.fromJSON(this, json);\n    }\n    /**\n    @internal\n    */\n    nodeType(name) {\n        let found = this.nodes[name];\n        if (!found)\n            throw new RangeError(\"Unknown node type: \" + name);\n        return found;\n    }\n}\nfunction gatherMarks(schema, marks) {\n    let found = [];\n    for (let i = 0; i < marks.length; i++) {\n        let name = marks[i], mark = schema.marks[name], ok = mark;\n        if (mark) {\n            found.push(mark);\n        }\n        else {\n            for (let prop in schema.marks) {\n                let mark = schema.marks[prop];\n                if (name == \"_\" || (mark.spec.group && mark.spec.group.split(\" \").indexOf(name) > -1))\n                    found.push(ok = mark);\n            }\n        }\n        if (!ok)\n            throw new SyntaxError(\"Unknown mark type: '\" + marks[i] + \"'\");\n    }\n    return found;\n}\n\nfunction isTagRule(rule) { return rule.tag != null; }\nfunction isStyleRule(rule) { return rule.style != null; }\n/**\nA DOM parser represents a strategy for parsing DOM content into a\nProseMirror document conforming to a given schema. Its behavior is\ndefined by an array of [rules](https://prosemirror.net/docs/ref/#model.ParseRule).\n*/\nclass DOMParser {\n    /**\n    Create a parser that targets the given schema, using the given\n    parsing rules.\n    */\n    constructor(\n    /**\n    The schema into which the parser parses.\n    */\n    schema, \n    /**\n    The set of [parse rules](https://prosemirror.net/docs/ref/#model.ParseRule) that the parser\n    uses, in order of precedence.\n    */\n    rules) {\n        this.schema = schema;\n        this.rules = rules;\n        /**\n        @internal\n        */\n        this.tags = [];\n        /**\n        @internal\n        */\n        this.styles = [];\n        let matchedStyles = this.matchedStyles = [];\n        rules.forEach(rule => {\n            if (isTagRule(rule)) {\n                this.tags.push(rule);\n            }\n            else if (isStyleRule(rule)) {\n                let prop = /[^=]*/.exec(rule.style)[0];\n                if (matchedStyles.indexOf(prop) < 0)\n                    matchedStyles.push(prop);\n                this.styles.push(rule);\n            }\n        });\n        // Only normalize list elements when lists in the schema can't directly contain themselves\n        this.normalizeLists = !this.tags.some(r => {\n            if (!/^(ul|ol)\\b/.test(r.tag) || !r.node)\n                return false;\n            let node = schema.nodes[r.node];\n            return node.contentMatch.matchType(node);\n        });\n    }\n    /**\n    Parse a document from the content of a DOM node.\n    */\n    parse(dom, options = {}) {\n        let context = new ParseContext(this, options, false);\n        context.addAll(dom, Mark.none, options.from, options.to);\n        return context.finish();\n    }\n    /**\n    Parses the content of the given DOM node, like\n    [`parse`](https://prosemirror.net/docs/ref/#model.DOMParser.parse), and takes the same set of\n    options. But unlike that method, which produces a whole node,\n    this one returns a slice that is open at the sides, meaning that\n    the schema constraints aren't applied to the start of nodes to\n    the left of the input and the end of nodes at the end.\n    */\n    parseSlice(dom, options = {}) {\n        let context = new ParseContext(this, options, true);\n        context.addAll(dom, Mark.none, options.from, options.to);\n        return Slice.maxOpen(context.finish());\n    }\n    /**\n    @internal\n    */\n    matchTag(dom, context, after) {\n        for (let i = after ? this.tags.indexOf(after) + 1 : 0; i < this.tags.length; i++) {\n            let rule = this.tags[i];\n            if (matches(dom, rule.tag) &&\n                (rule.namespace === undefined || dom.namespaceURI == rule.namespace) &&\n                (!rule.context || context.matchesContext(rule.context))) {\n                if (rule.getAttrs) {\n                    let result = rule.getAttrs(dom);\n                    if (result === false)\n                        continue;\n                    rule.attrs = result || undefined;\n                }\n                return rule;\n            }\n        }\n    }\n    /**\n    @internal\n    */\n    matchStyle(prop, value, context, after) {\n        for (let i = after ? this.styles.indexOf(after) + 1 : 0; i < this.styles.length; i++) {\n            let rule = this.styles[i], style = rule.style;\n            if (style.indexOf(prop) != 0 ||\n                rule.context && !context.matchesContext(rule.context) ||\n                // Test that the style string either precisely matches the prop,\n                // or has an '=' sign after the prop, followed by the given\n                // value.\n                style.length > prop.length &&\n                    (style.charCodeAt(prop.length) != 61 || style.slice(prop.length + 1) != value))\n                continue;\n            if (rule.getAttrs) {\n                let result = rule.getAttrs(value);\n                if (result === false)\n                    continue;\n                rule.attrs = result || undefined;\n            }\n            return rule;\n        }\n    }\n    /**\n    @internal\n    */\n    static schemaRules(schema) {\n        let result = [];\n        function insert(rule) {\n            let priority = rule.priority == null ? 50 : rule.priority, i = 0;\n            for (; i < result.length; i++) {\n                let next = result[i], nextPriority = next.priority == null ? 50 : next.priority;\n                if (nextPriority < priority)\n                    break;\n            }\n            result.splice(i, 0, rule);\n        }\n        for (let name in schema.marks) {\n            let rules = schema.marks[name].spec.parseDOM;\n            if (rules)\n                rules.forEach(rule => {\n                    insert(rule = copy(rule));\n                    if (!(rule.mark || rule.ignore || rule.clearMark))\n                        rule.mark = name;\n                });\n        }\n        for (let name in schema.nodes) {\n            let rules = schema.nodes[name].spec.parseDOM;\n            if (rules)\n                rules.forEach(rule => {\n                    insert(rule = copy(rule));\n                    if (!(rule.node || rule.ignore || rule.mark))\n                        rule.node = name;\n                });\n        }\n        return result;\n    }\n    /**\n    Construct a DOM parser using the parsing rules listed in a\n    schema's [node specs](https://prosemirror.net/docs/ref/#model.NodeSpec.parseDOM), reordered by\n    [priority](https://prosemirror.net/docs/ref/#model.ParseRule.priority).\n    */\n    static fromSchema(schema) {\n        return schema.cached.domParser ||\n            (schema.cached.domParser = new DOMParser(schema, DOMParser.schemaRules(schema)));\n    }\n}\nconst blockTags = {\n    address: true, article: true, aside: true, blockquote: true, canvas: true,\n    dd: true, div: true, dl: true, fieldset: true, figcaption: true, figure: true,\n    footer: true, form: true, h1: true, h2: true, h3: true, h4: true, h5: true,\n    h6: true, header: true, hgroup: true, hr: true, li: true, noscript: true, ol: true,\n    output: true, p: true, pre: true, section: true, table: true, tfoot: true, ul: true\n};\nconst ignoreTags = {\n    head: true, noscript: true, object: true, script: true, style: true, title: true\n};\nconst listTags = { ol: true, ul: true };\n// Using a bitfield for node context options\nconst OPT_PRESERVE_WS = 1, OPT_PRESERVE_WS_FULL = 2, OPT_OPEN_LEFT = 4;\nfunction wsOptionsFor(type, preserveWhitespace, base) {\n    if (preserveWhitespace != null)\n        return (preserveWhitespace ? OPT_PRESERVE_WS : 0) |\n            (preserveWhitespace === \"full\" ? OPT_PRESERVE_WS_FULL : 0);\n    return type && type.whitespace == \"pre\" ? OPT_PRESERVE_WS | OPT_PRESERVE_WS_FULL : base & ~OPT_OPEN_LEFT;\n}\nclass NodeContext {\n    constructor(type, attrs, marks, solid, match, options) {\n        this.type = type;\n        this.attrs = attrs;\n        this.marks = marks;\n        this.solid = solid;\n        this.options = options;\n        this.content = [];\n        // Marks applied to the node's children\n        this.activeMarks = Mark.none;\n        this.match = match || (options & OPT_OPEN_LEFT ? null : type.contentMatch);\n    }\n    findWrapping(node) {\n        if (!this.match) {\n            if (!this.type)\n                return [];\n            let fill = this.type.contentMatch.fillBefore(Fragment.from(node));\n            if (fill) {\n                this.match = this.type.contentMatch.matchFragment(fill);\n            }\n            else {\n                let start = this.type.contentMatch, wrap;\n                if (wrap = start.findWrapping(node.type)) {\n                    this.match = start;\n                    return wrap;\n                }\n                else {\n                    return null;\n                }\n            }\n        }\n        return this.match.findWrapping(node.type);\n    }\n    finish(openEnd) {\n        if (!(this.options & OPT_PRESERVE_WS)) { // Strip trailing whitespace\n            let last = this.content[this.content.length - 1], m;\n            if (last && last.isText && (m = /[ \\t\\r\\n\\u000c]+$/.exec(last.text))) {\n                let text = last;\n                if (last.text.length == m[0].length)\n                    this.content.pop();\n                else\n                    this.content[this.content.length - 1] = text.withText(text.text.slice(0, text.text.length - m[0].length));\n            }\n        }\n        let content = Fragment.from(this.content);\n        if (!openEnd && this.match)\n            content = content.append(this.match.fillBefore(Fragment.empty, true));\n        return this.type ? this.type.create(this.attrs, content, this.marks) : content;\n    }\n    inlineContext(node) {\n        if (this.type)\n            return this.type.inlineContent;\n        if (this.content.length)\n            return this.content[0].isInline;\n        return node.parentNode && !blockTags.hasOwnProperty(node.parentNode.nodeName.toLowerCase());\n    }\n}\nclass ParseContext {\n    constructor(\n    // The parser we are using.\n    parser, \n    // The options passed to this parse.\n    options, isOpen) {\n        this.parser = parser;\n        this.options = options;\n        this.isOpen = isOpen;\n        this.open = 0;\n        this.localPreserveWS = false;\n        let topNode = options.topNode, topContext;\n        let topOptions = wsOptionsFor(null, options.preserveWhitespace, 0) | (isOpen ? OPT_OPEN_LEFT : 0);\n        if (topNode)\n            topContext = new NodeContext(topNode.type, topNode.attrs, Mark.none, true, options.topMatch || topNode.type.contentMatch, topOptions);\n        else if (isOpen)\n            topContext = new NodeContext(null, null, Mark.none, true, null, topOptions);\n        else\n            topContext = new NodeContext(parser.schema.topNodeType, null, Mark.none, true, null, topOptions);\n        this.nodes = [topContext];\n        this.find = options.findPositions;\n        this.needsBlock = false;\n    }\n    get top() {\n        return this.nodes[this.open];\n    }\n    // Add a DOM node to the content. Text is inserted as text node,\n    // otherwise, the node is passed to `addElement` or, if it has a\n    // `style` attribute, `addElementWithStyles`.\n    addDOM(dom, marks) {\n        if (dom.nodeType == 3)\n            this.addTextNode(dom, marks);\n        else if (dom.nodeType == 1)\n            this.addElement(dom, marks);\n    }\n    addTextNode(dom, marks) {\n        let value = dom.nodeValue;\n        let top = this.top, preserveWS = (top.options & OPT_PRESERVE_WS_FULL) ? \"full\"\n            : this.localPreserveWS || (top.options & OPT_PRESERVE_WS) > 0;\n        if (preserveWS === \"full\" ||\n            top.inlineContext(dom) ||\n            /[^ \\t\\r\\n\\u000c]/.test(value)) {\n            if (!preserveWS) {\n                value = value.replace(/[ \\t\\r\\n\\u000c]+/g, \" \");\n                // If this starts with whitespace, and there is no node before it, or\n                // a hard break, or a text node that ends with whitespace, strip the\n                // leading space.\n                if (/^[ \\t\\r\\n\\u000c]/.test(value) && this.open == this.nodes.length - 1) {\n                    let nodeBefore = top.content[top.content.length - 1];\n                    let domNodeBefore = dom.previousSibling;\n                    if (!nodeBefore ||\n                        (domNodeBefore && domNodeBefore.nodeName == 'BR') ||\n                        (nodeBefore.isText && /[ \\t\\r\\n\\u000c]$/.test(nodeBefore.text)))\n                        value = value.slice(1);\n                }\n            }\n            else if (preserveWS !== \"full\") {\n                value = value.replace(/\\r?\\n|\\r/g, \" \");\n            }\n            else {\n                value = value.replace(/\\r\\n?/g, \"\\n\");\n            }\n            if (value)\n                this.insertNode(this.parser.schema.text(value), marks);\n            this.findInText(dom);\n        }\n        else {\n            this.findInside(dom);\n        }\n    }\n    // Try to find a handler for the given tag and use that to parse. If\n    // none is found, the element's content nodes are added directly.\n    addElement(dom, marks, matchAfter) {\n        let outerWS = this.localPreserveWS, top = this.top;\n        if (dom.tagName == \"PRE\" || /pre/.test(dom.style && dom.style.whiteSpace))\n            this.localPreserveWS = true;\n        let name = dom.nodeName.toLowerCase(), ruleID;\n        if (listTags.hasOwnProperty(name) && this.parser.normalizeLists)\n            normalizeList(dom);\n        let rule = (this.options.ruleFromNode && this.options.ruleFromNode(dom)) ||\n            (ruleID = this.parser.matchTag(dom, this, matchAfter));\n        out: if (rule ? rule.ignore : ignoreTags.hasOwnProperty(name)) {\n            this.findInside(dom);\n            this.ignoreFallback(dom, marks);\n        }\n        else if (!rule || rule.skip || rule.closeParent) {\n            if (rule && rule.closeParent)\n                this.open = Math.max(0, this.open - 1);\n            else if (rule && rule.skip.nodeType)\n                dom = rule.skip;\n            let sync, oldNeedsBlock = this.needsBlock;\n            if (blockTags.hasOwnProperty(name)) {\n                if (top.content.length && top.content[0].isInline && this.open) {\n                    this.open--;\n                    top = this.top;\n                }\n                sync = true;\n                if (!top.type)\n                    this.needsBlock = true;\n            }\n            else if (!dom.firstChild) {\n                this.leafFallback(dom, marks);\n                break out;\n            }\n            let innerMarks = rule && rule.skip ? marks : this.readStyles(dom, marks);\n            if (innerMarks)\n                this.addAll(dom, innerMarks);\n            if (sync)\n                this.sync(top);\n            this.needsBlock = oldNeedsBlock;\n        }\n        else {\n            let innerMarks = this.readStyles(dom, marks);\n            if (innerMarks)\n                this.addElementByRule(dom, rule, innerMarks, rule.consuming === false ? ruleID : undefined);\n        }\n        this.localPreserveWS = outerWS;\n    }\n    // Called for leaf DOM nodes that would otherwise be ignored\n    leafFallback(dom, marks) {\n        if (dom.nodeName == \"BR\" && this.top.type && this.top.type.inlineContent)\n            this.addTextNode(dom.ownerDocument.createTextNode(\"\\n\"), marks);\n    }\n    // Called for ignored nodes\n    ignoreFallback(dom, marks) {\n        // Ignored BR nodes should at least create an inline context\n        if (dom.nodeName == \"BR\" && (!this.top.type || !this.top.type.inlineContent))\n            this.findPlace(this.parser.schema.text(\"-\"), marks);\n    }\n    // Run any style parser associated with the node's styles. Either\n    // return an updated array of marks, or null to indicate some of the\n    // styles had a rule with `ignore` set.\n    readStyles(dom, marks) {\n        let styles = dom.style;\n        // Because many properties will only show up in 'normalized' form\n        // in `style.item` (i.e. text-decoration becomes\n        // text-decoration-line, text-decoration-color, etc), we directly\n        // query the styles mentioned in our rules instead of iterating\n        // over the items.\n        if (styles && styles.length)\n            for (let i = 0; i < this.parser.matchedStyles.length; i++) {\n                let name = this.parser.matchedStyles[i], value = styles.getPropertyValue(name);\n                if (value)\n                    for (let after = undefined;;) {\n                        let rule = this.parser.matchStyle(name, value, this, after);\n                        if (!rule)\n                            break;\n                        if (rule.ignore)\n                            return null;\n                        if (rule.clearMark)\n                            marks = marks.filter(m => !rule.clearMark(m));\n                        else\n                            marks = marks.concat(this.parser.schema.marks[rule.mark].create(rule.attrs));\n                        if (rule.consuming === false)\n                            after = rule;\n                        else\n                            break;\n                    }\n            }\n        return marks;\n    }\n    // Look up a handler for the given node. If none are found, return\n    // false. Otherwise, apply it, use its return value to drive the way\n    // the node's content is wrapped, and return true.\n    addElementByRule(dom, rule, marks, continueAfter) {\n        let sync, nodeType;\n        if (rule.node) {\n            nodeType = this.parser.schema.nodes[rule.node];\n            if (!nodeType.isLeaf) {\n                let inner = this.enter(nodeType, rule.attrs || null, marks, rule.preserveWhitespace);\n                if (inner) {\n                    sync = true;\n                    marks = inner;\n                }\n            }\n            else if (!this.insertNode(nodeType.create(rule.attrs), marks)) {\n                this.leafFallback(dom, marks);\n            }\n        }\n        else {\n            let markType = this.parser.schema.marks[rule.mark];\n            marks = marks.concat(markType.create(rule.attrs));\n        }\n        let startIn = this.top;\n        if (nodeType && nodeType.isLeaf) {\n            this.findInside(dom);\n        }\n        else if (continueAfter) {\n            this.addElement(dom, marks, continueAfter);\n        }\n        else if (rule.getContent) {\n            this.findInside(dom);\n            rule.getContent(dom, this.parser.schema).forEach(node => this.insertNode(node, marks));\n        }\n        else {\n            let contentDOM = dom;\n            if (typeof rule.contentElement == \"string\")\n                contentDOM = dom.querySelector(rule.contentElement);\n            else if (typeof rule.contentElement == \"function\")\n                contentDOM = rule.contentElement(dom);\n            else if (rule.contentElement)\n                contentDOM = rule.contentElement;\n            this.findAround(dom, contentDOM, true);\n            this.addAll(contentDOM, marks);\n            this.findAround(dom, contentDOM, false);\n        }\n        if (sync && this.sync(startIn))\n            this.open--;\n    }\n    // Add all child nodes between `startIndex` and `endIndex` (or the\n    // whole node, if not given). If `sync` is passed, use it to\n    // synchronize after every block element.\n    addAll(parent, marks, startIndex, endIndex) {\n        let index = startIndex || 0;\n        for (let dom = startIndex ? parent.childNodes[startIndex] : parent.firstChild, end = endIndex == null ? null : parent.childNodes[endIndex]; dom != end; dom = dom.nextSibling, ++index) {\n            this.findAtPoint(parent, index);\n            this.addDOM(dom, marks);\n        }\n        this.findAtPoint(parent, index);\n    }\n    // Try to find a way to fit the given node type into the current\n    // context. May add intermediate wrappers and/or leave non-solid\n    // nodes that we're in.\n    findPlace(node, marks) {\n        let route, sync;\n        for (let depth = this.open; depth >= 0; depth--) {\n            let cx = this.nodes[depth];\n            let found = cx.findWrapping(node);\n            if (found && (!route || route.length > found.length)) {\n                route = found;\n                sync = cx;\n                if (!found.length)\n                    break;\n            }\n            if (cx.solid)\n                break;\n        }\n        if (!route)\n            return null;\n        this.sync(sync);\n        for (let i = 0; i < route.length; i++)\n            marks = this.enterInner(route[i], null, marks, false);\n        return marks;\n    }\n    // Try to insert the given node, adjusting the context when needed.\n    insertNode(node, marks) {\n        if (node.isInline && this.needsBlock && !this.top.type) {\n            let block = this.textblockFromContext();\n            if (block)\n                marks = this.enterInner(block, null, marks);\n        }\n        let innerMarks = this.findPlace(node, marks);\n        if (innerMarks) {\n            this.closeExtra();\n            let top = this.top;\n            if (top.match)\n                top.match = top.match.matchType(node.type);\n            let nodeMarks = Mark.none;\n            for (let m of innerMarks.concat(node.marks))\n                if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, node.type))\n                    nodeMarks = m.addToSet(nodeMarks);\n            top.content.push(node.mark(nodeMarks));\n            return true;\n        }\n        return false;\n    }\n    // Try to start a node of the given type, adjusting the context when\n    // necessary.\n    enter(type, attrs, marks, preserveWS) {\n        let innerMarks = this.findPlace(type.create(attrs), marks);\n        if (innerMarks)\n            innerMarks = this.enterInner(type, attrs, marks, true, preserveWS);\n        return innerMarks;\n    }\n    // Open a node of the given type\n    enterInner(type, attrs, marks, solid = false, preserveWS) {\n        this.closeExtra();\n        let top = this.top;\n        top.match = top.match && top.match.matchType(type);\n        let options = wsOptionsFor(type, preserveWS, top.options);\n        if ((top.options & OPT_OPEN_LEFT) && top.content.length == 0)\n            options |= OPT_OPEN_LEFT;\n        let applyMarks = Mark.none;\n        marks = marks.filter(m => {\n            if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, type)) {\n                applyMarks = m.addToSet(applyMarks);\n                return false;\n            }\n            return true;\n        });\n        this.nodes.push(new NodeContext(type, attrs, applyMarks, solid, null, options));\n        this.open++;\n        return marks;\n    }\n    // Make sure all nodes above this.open are finished and added to\n    // their parents\n    closeExtra(openEnd = false) {\n        let i = this.nodes.length - 1;\n        if (i > this.open) {\n            for (; i > this.open; i--)\n                this.nodes[i - 1].content.push(this.nodes[i].finish(openEnd));\n            this.nodes.length = this.open + 1;\n        }\n    }\n    finish() {\n        this.open = 0;\n        this.closeExtra(this.isOpen);\n        return this.nodes[0].finish(!!(this.isOpen || this.options.topOpen));\n    }\n    sync(to) {\n        for (let i = this.open; i >= 0; i--) {\n            if (this.nodes[i] == to) {\n                this.open = i;\n                return true;\n            }\n            else if (this.localPreserveWS) {\n                this.nodes[i].options |= OPT_PRESERVE_WS;\n            }\n        }\n        return false;\n    }\n    get currentPos() {\n        this.closeExtra();\n        let pos = 0;\n        for (let i = this.open; i >= 0; i--) {\n            let content = this.nodes[i].content;\n            for (let j = content.length - 1; j >= 0; j--)\n                pos += content[j].nodeSize;\n            if (i)\n                pos++;\n        }\n        return pos;\n    }\n    findAtPoint(parent, offset) {\n        if (this.find)\n            for (let i = 0; i < this.find.length; i++) {\n                if (this.find[i].node == parent && this.find[i].offset == offset)\n                    this.find[i].pos = this.currentPos;\n            }\n    }\n    findInside(parent) {\n        if (this.find)\n            for (let i = 0; i < this.find.length; i++) {\n                if (this.find[i].pos == null && parent.nodeType == 1 && parent.contains(this.find[i].node))\n                    this.find[i].pos = this.currentPos;\n            }\n    }\n    findAround(parent, content, before) {\n        if (parent != content && this.find)\n            for (let i = 0; i < this.find.length; i++) {\n                if (this.find[i].pos == null && parent.nodeType == 1 && parent.contains(this.find[i].node)) {\n                    let pos = content.compareDocumentPosition(this.find[i].node);\n                    if (pos & (before ? 2 : 4))\n                        this.find[i].pos = this.currentPos;\n                }\n            }\n    }\n    findInText(textNode) {\n        if (this.find)\n            for (let i = 0; i < this.find.length; i++) {\n                if (this.find[i].node == textNode)\n                    this.find[i].pos = this.currentPos - (textNode.nodeValue.length - this.find[i].offset);\n            }\n    }\n    // Determines whether the given context string matches this context.\n    matchesContext(context) {\n        if (context.indexOf(\"|\") > -1)\n            return context.split(/\\s*\\|\\s*/).some(this.matchesContext, this);\n        let parts = context.split(\"/\");\n        let option = this.options.context;\n        let useRoot = !this.isOpen && (!option || option.parent.type == this.nodes[0].type);\n        let minDepth = -(option ? option.depth + 1 : 0) + (useRoot ? 0 : 1);\n        let match = (i, depth) => {\n            for (; i >= 0; i--) {\n                let part = parts[i];\n                if (part == \"\") {\n                    if (i == parts.length - 1 || i == 0)\n                        continue;\n                    for (; depth >= minDepth; depth--)\n                        if (match(i - 1, depth))\n                            return true;\n                    return false;\n                }\n                else {\n                    let next = depth > 0 || (depth == 0 && useRoot) ? this.nodes[depth].type\n                        : option && depth >= minDepth ? option.node(depth - minDepth).type\n                            : null;\n                    if (!next || (next.name != part && !next.isInGroup(part)))\n                        return false;\n                    depth--;\n                }\n            }\n            return true;\n        };\n        return match(parts.length - 1, this.open);\n    }\n    textblockFromContext() {\n        let $context = this.options.context;\n        if ($context)\n            for (let d = $context.depth; d >= 0; d--) {\n                let deflt = $context.node(d).contentMatchAt($context.indexAfter(d)).defaultType;\n                if (deflt && deflt.isTextblock && deflt.defaultAttrs)\n                    return deflt;\n            }\n        for (let name in this.parser.schema.nodes) {\n            let type = this.parser.schema.nodes[name];\n            if (type.isTextblock && type.defaultAttrs)\n                return type;\n        }\n    }\n}\n// Kludge to work around directly nested list nodes produced by some\n// tools and allowed by browsers to mean that the nested list is\n// actually part of the list item above it.\nfunction normalizeList(dom) {\n    for (let child = dom.firstChild, prevItem = null; child; child = child.nextSibling) {\n        let name = child.nodeType == 1 ? child.nodeName.toLowerCase() : null;\n        if (name && listTags.hasOwnProperty(name) && prevItem) {\n            prevItem.appendChild(child);\n            child = prevItem;\n        }\n        else if (name == \"li\") {\n            prevItem = child;\n        }\n        else if (name) {\n            prevItem = null;\n        }\n    }\n}\n// Apply a CSS selector.\nfunction matches(dom, selector) {\n    return (dom.matches || dom.msMatchesSelector || dom.webkitMatchesSelector || dom.mozMatchesSelector).call(dom, selector);\n}\nfunction copy(obj) {\n    let copy = {};\n    for (let prop in obj)\n        copy[prop] = obj[prop];\n    return copy;\n}\n// Used when finding a mark at the top level of a fragment parse.\n// Checks whether it would be reasonable to apply a given mark type to\n// a given node, by looking at the way the mark occurs in the schema.\nfunction markMayApply(markType, nodeType) {\n    let nodes = nodeType.schema.nodes;\n    for (let name in nodes) {\n        let parent = nodes[name];\n        if (!parent.allowsMarkType(markType))\n            continue;\n        let seen = [], scan = (match) => {\n            seen.push(match);\n            for (let i = 0; i < match.edgeCount; i++) {\n                let { type, next } = match.edge(i);\n                if (type == nodeType)\n                    return true;\n                if (seen.indexOf(next) < 0 && scan(next))\n                    return true;\n            }\n        };\n        if (scan(parent.contentMatch))\n            return true;\n    }\n}\n\n/**\nA DOM serializer knows how to convert ProseMirror nodes and\nmarks of various types to DOM nodes.\n*/\nclass DOMSerializer {\n    /**\n    Create a serializer. `nodes` should map node names to functions\n    that take a node and return a description of the corresponding\n    DOM. `marks` does the same for mark names, but also gets an\n    argument that tells it whether the mark's content is block or\n    inline content (for typical use, it'll always be inline). A mark\n    serializer may be `null` to indicate that marks of that type\n    should not be serialized.\n    */\n    constructor(\n    /**\n    The node serialization functions.\n    */\n    nodes, \n    /**\n    The mark serialization functions.\n    */\n    marks) {\n        this.nodes = nodes;\n        this.marks = marks;\n    }\n    /**\n    Serialize the content of this fragment to a DOM fragment. When\n    not in the browser, the `document` option, containing a DOM\n    document, should be passed so that the serializer can create\n    nodes.\n    */\n    serializeFragment(fragment, options = {}, target) {\n        if (!target)\n            target = doc(options).createDocumentFragment();\n        let top = target, active = [];\n        fragment.forEach(node => {\n            if (active.length || node.marks.length) {\n                let keep = 0, rendered = 0;\n                while (keep < active.length && rendered < node.marks.length) {\n                    let next = node.marks[rendered];\n                    if (!this.marks[next.type.name]) {\n                        rendered++;\n                        continue;\n                    }\n                    if (!next.eq(active[keep][0]) || next.type.spec.spanning === false)\n                        break;\n                    keep++;\n                    rendered++;\n                }\n                while (keep < active.length)\n                    top = active.pop()[1];\n                while (rendered < node.marks.length) {\n                    let add = node.marks[rendered++];\n                    let markDOM = this.serializeMark(add, node.isInline, options);\n                    if (markDOM) {\n                        active.push([add, top]);\n                        top.appendChild(markDOM.dom);\n                        top = markDOM.contentDOM || markDOM.dom;\n                    }\n                }\n            }\n            top.appendChild(this.serializeNodeInner(node, options));\n        });\n        return target;\n    }\n    /**\n    @internal\n    */\n    serializeNodeInner(node, options) {\n        let { dom, contentDOM } = renderSpec(doc(options), this.nodes[node.type.name](node), null, node.attrs);\n        if (contentDOM) {\n            if (node.isLeaf)\n                throw new RangeError(\"Content hole not allowed in a leaf node spec\");\n            this.serializeFragment(node.content, options, contentDOM);\n        }\n        return dom;\n    }\n    /**\n    Serialize this node to a DOM node. This can be useful when you\n    need to serialize a part of a document, as opposed to the whole\n    document. To serialize a whole document, use\n    [`serializeFragment`](https://prosemirror.net/docs/ref/#model.DOMSerializer.serializeFragment) on\n    its [content](https://prosemirror.net/docs/ref/#model.Node.content).\n    */\n    serializeNode(node, options = {}) {\n        let dom = this.serializeNodeInner(node, options);\n        for (let i = node.marks.length - 1; i >= 0; i--) {\n            let wrap = this.serializeMark(node.marks[i], node.isInline, options);\n            if (wrap) {\n                (wrap.contentDOM || wrap.dom).appendChild(dom);\n                dom = wrap.dom;\n            }\n        }\n        return dom;\n    }\n    /**\n    @internal\n    */\n    serializeMark(mark, inline, options = {}) {\n        let toDOM = this.marks[mark.type.name];\n        return toDOM && renderSpec(doc(options), toDOM(mark, inline), null, mark.attrs);\n    }\n    static renderSpec(doc, structure, xmlNS = null, blockArraysIn) {\n        return renderSpec(doc, structure, xmlNS, blockArraysIn);\n    }\n    /**\n    Build a serializer using the [`toDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.toDOM)\n    properties in a schema's node and mark specs.\n    */\n    static fromSchema(schema) {\n        return schema.cached.domSerializer ||\n            (schema.cached.domSerializer = new DOMSerializer(this.nodesFromSchema(schema), this.marksFromSchema(schema)));\n    }\n    /**\n    Gather the serializers in a schema's node specs into an object.\n    This can be useful as a base to build a custom serializer from.\n    */\n    static nodesFromSchema(schema) {\n        let result = gatherToDOM(schema.nodes);\n        if (!result.text)\n            result.text = node => node.text;\n        return result;\n    }\n    /**\n    Gather the serializers in a schema's mark specs into an object.\n    */\n    static marksFromSchema(schema) {\n        return gatherToDOM(schema.marks);\n    }\n}\nfunction gatherToDOM(obj) {\n    let result = {};\n    for (let name in obj) {\n        let toDOM = obj[name].spec.toDOM;\n        if (toDOM)\n            result[name] = toDOM;\n    }\n    return result;\n}\nfunction doc(options) {\n    return options.document || window.document;\n}\nconst suspiciousAttributeCache = new WeakMap();\nfunction suspiciousAttributes(attrs) {\n    let value = suspiciousAttributeCache.get(attrs);\n    if (value === undefined)\n        suspiciousAttributeCache.set(attrs, value = suspiciousAttributesInner(attrs));\n    return value;\n}\nfunction suspiciousAttributesInner(attrs) {\n    let result = null;\n    function scan(value) {\n        if (value && typeof value == \"object\") {\n            if (Array.isArray(value)) {\n                if (typeof value[0] == \"string\") {\n                    if (!result)\n                        result = [];\n                    result.push(value);\n                }\n                else {\n                    for (let i = 0; i < value.length; i++)\n                        scan(value[i]);\n                }\n            }\n            else {\n                for (let prop in value)\n                    scan(value[prop]);\n            }\n        }\n    }\n    scan(attrs);\n    return result;\n}\nfunction renderSpec(doc, structure, xmlNS, blockArraysIn) {\n    if (typeof structure == \"string\")\n        return { dom: doc.createTextNode(structure) };\n    if (structure.nodeType != null)\n        return { dom: structure };\n    if (structure.dom && structure.dom.nodeType != null)\n        return structure;\n    let tagName = structure[0], suspicious;\n    if (typeof tagName != \"string\")\n        throw new RangeError(\"Invalid array passed to renderSpec\");\n    if (blockArraysIn && (suspicious = suspiciousAttributes(blockArraysIn)) &&\n        suspicious.indexOf(structure) > -1)\n        throw new RangeError(\"Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.\");\n    let space = tagName.indexOf(\" \");\n    if (space > 0) {\n        xmlNS = tagName.slice(0, space);\n        tagName = tagName.slice(space + 1);\n    }\n    let contentDOM;\n    let dom = (xmlNS ? doc.createElementNS(xmlNS, tagName) : doc.createElement(tagName));\n    let attrs = structure[1], start = 1;\n    if (attrs && typeof attrs == \"object\" && attrs.nodeType == null && !Array.isArray(attrs)) {\n        start = 2;\n        for (let name in attrs)\n            if (attrs[name] != null) {\n                let space = name.indexOf(\" \");\n                if (space > 0)\n                    dom.setAttributeNS(name.slice(0, space), name.slice(space + 1), attrs[name]);\n                else\n                    dom.setAttribute(name, attrs[name]);\n            }\n    }\n    for (let i = start; i < structure.length; i++) {\n        let child = structure[i];\n        if (child === 0) {\n            if (i < structure.length - 1 || i > start)\n                throw new RangeError(\"Content hole must be the only child of its parent node\");\n            return { dom, contentDOM: dom };\n        }\n        else {\n            let { dom: inner, contentDOM: innerContent } = renderSpec(doc, child, xmlNS, blockArraysIn);\n            dom.appendChild(inner);\n            if (innerContent) {\n                if (contentDOM)\n                    throw new RangeError(\"Multiple content holes\");\n                contentDOM = innerContent;\n            }\n        }\n    }\n    return { dom, contentDOM };\n}\n\nexport { ContentMatch, DOMParser, DOMSerializer, Fragment, Mark, MarkType, Node, NodeRange, NodeType, ReplaceError, ResolvedPos, Schema, Slice };\n","/**\n * @typedef {import('mdast').Nodes} Nodes\n *\n * @typedef Options\n *   Configuration (optional).\n * @property {boolean | null | undefined} [includeImageAlt=true]\n *   Whether to use `alt` for `image`s (default: `true`).\n * @property {boolean | null | undefined} [includeHtml=true]\n *   Whether to use `value` of HTML (default: `true`).\n */\n\n/** @type {Options} */\nconst emptyOptions = {}\n\n/**\n * Get the text content of a node or list of nodes.\n *\n * Prefers the node’s plain-text fields, otherwise serializes its children,\n * and if the given value is an array, serialize the nodes in it.\n *\n * @param {unknown} [value]\n *   Thing to serialize, typically `Node`.\n * @param {Options | null | undefined} [options]\n *   Configuration (optional).\n * @returns {string}\n *   Serialized `value`.\n */\nexport function toString(value, options) {\n  const settings = options || emptyOptions\n  const includeImageAlt =\n    typeof settings.includeImageAlt === 'boolean'\n      ? settings.includeImageAlt\n      : true\n  const includeHtml =\n    typeof settings.includeHtml === 'boolean' ? settings.includeHtml : true\n\n  return one(value, includeImageAlt, includeHtml)\n}\n\n/**\n * One node or several nodes.\n *\n * @param {unknown} value\n *   Thing to serialize.\n * @param {boolean} includeImageAlt\n *   Include image `alt`s.\n * @param {boolean} includeHtml\n *   Include HTML.\n * @returns {string}\n *   Serialized node.\n */\nfunction one(value, includeImageAlt, includeHtml) {\n  if (node(value)) {\n    if ('value' in value) {\n      return value.type === 'html' && !includeHtml ? '' : value.value\n    }\n\n    if (includeImageAlt && 'alt' in value && value.alt) {\n      return value.alt\n    }\n\n    if ('children' in value) {\n      return all(value.children, includeImageAlt, includeHtml)\n    }\n  }\n\n  if (Array.isArray(value)) {\n    return all(value, includeImageAlt, includeHtml)\n  }\n\n  return ''\n}\n\n/**\n * Serialize a list of nodes.\n *\n * @param {Array<unknown>} values\n *   Thing to serialize.\n * @param {boolean} includeImageAlt\n *   Include image `alt`s.\n * @param {boolean} includeHtml\n *   Include HTML.\n * @returns {string}\n *   Serialized nodes.\n */\nfunction all(values, includeImageAlt, includeHtml) {\n  /** @type {Array<string>} */\n  const result = []\n  let index = -1\n\n  while (++index < values.length) {\n    result[index] = one(values[index], includeImageAlt, includeHtml)\n  }\n\n  return result.join('')\n}\n\n/**\n * Check if `value` looks like a node.\n *\n * @param {unknown} value\n *   Thing.\n * @returns {value is Nodes}\n *   Whether `value` is a node.\n */\nfunction node(value) {\n  return Boolean(value && typeof value === 'object')\n}\n","/// <reference lib=\"dom\" />\n\n/* eslint-env browser */\n\nconst element = document.createElement('i')\n\n/**\n * @param {string} value\n * @returns {string | false}\n */\nexport function decodeNamedCharacterReference(value) {\n  const characterReference = '&' + value + ';'\n  element.innerHTML = characterReference\n  const character = element.textContent\n\n  // Some named character references do not require the closing semicolon\n  // (`&not`, for instance), which leads to situations where parsing the assumed\n  // named reference of `&notit;` will result in the string `¬it;`.\n  // When we encounter a trailing semicolon after parsing, and the character\n  // reference to decode was not a semicolon (`&semi;`), we can assume that the\n  // matching was not complete.\n  if (\n    // @ts-expect-error: TypeScript is wrong that `textContent` on elements can\n    // yield `null`.\n    character.charCodeAt(character.length - 1) === 59 /* `;` */ &&\n    value !== 'semi'\n  ) {\n    return false\n  }\n\n  // If the decoded string is equal to the input, the character reference was\n  // not valid.\n  // @ts-expect-error: TypeScript is wrong that `textContent` on elements can\n  // yield `null`.\n  return character === characterReference ? false : character\n}\n","/**\n * Like `Array#splice`, but smarter for giant arrays.\n *\n * `Array#splice` takes all items to be inserted as individual argument which\n * causes a stack overflow in V8 when trying to insert 100k items for instance.\n *\n * Otherwise, this does not return the removed items, and takes `items` as an\n * array instead of rest parameters.\n *\n * @template {unknown} T\n *   Item type.\n * @param {Array<T>} list\n *   List to operate on.\n * @param {number} start\n *   Index to remove/insert at (can be negative).\n * @param {number} remove\n *   Number of items to remove.\n * @param {Array<T>} items\n *   Items to inject into `list`.\n * @returns {undefined}\n *   Nothing.\n */\nexport function splice(list, start, remove, items) {\n  const end = list.length;\n  let chunkStart = 0;\n  /** @type {Array<unknown>} */\n  let parameters;\n\n  // Make start between zero and `end` (included).\n  if (start < 0) {\n    start = -start > end ? 0 : end + start;\n  } else {\n    start = start > end ? end : start;\n  }\n  remove = remove > 0 ? remove : 0;\n\n  // No need to chunk the items if there’s only a couple (10k) items.\n  if (items.length < 10000) {\n    parameters = Array.from(items);\n    parameters.unshift(start, remove);\n    // @ts-expect-error Hush, it’s fine.\n    list.splice(...parameters);\n  } else {\n    // Delete `remove` items starting from `start`\n    if (remove) list.splice(start, remove);\n\n    // Insert the items in chunks to not cause stack overflows.\n    while (chunkStart < items.length) {\n      parameters = items.slice(chunkStart, chunkStart + 10000);\n      parameters.unshift(start, 0);\n      // @ts-expect-error Hush, it’s fine.\n      list.splice(...parameters);\n      chunkStart += 10000;\n      start += 10000;\n    }\n  }\n}\n\n/**\n * Append `items` (an array) at the end of `list` (another array).\n * When `list` was empty, returns `items` instead.\n *\n * This prevents a potentially expensive operation when `list` is empty,\n * and adds items in batches to prevent V8 from hanging.\n *\n * @template {unknown} T\n *   Item type.\n * @param {Array<T>} list\n *   List to operate on.\n * @param {Array<T>} items\n *   Items to add to `list`.\n * @returns {Array<T>}\n *   Either `list` or `items`.\n */\nexport function push(list, items) {\n  if (list.length > 0) {\n    splice(list, list.length, 0, items);\n    return list;\n  }\n  return items;\n}","/**\n * @import {\n *   Extension,\n *   Handles,\n *   HtmlExtension,\n *   NormalizedExtension\n * } from 'micromark-util-types'\n */\n\nimport {splice} from 'micromark-util-chunked'\n\nconst hasOwnProperty = {}.hasOwnProperty\n\n/**\n * Combine multiple syntax extensions into one.\n *\n * @param {ReadonlyArray<Extension>} extensions\n *   List of syntax extensions.\n * @returns {NormalizedExtension}\n *   A single combined extension.\n */\nexport function combineExtensions(extensions) {\n  /** @type {NormalizedExtension} */\n  const all = {}\n  let index = -1\n\n  while (++index < extensions.length) {\n    syntaxExtension(all, extensions[index])\n  }\n\n  return all\n}\n\n/**\n * Merge `extension` into `all`.\n *\n * @param {NormalizedExtension} all\n *   Extension to merge into.\n * @param {Extension} extension\n *   Extension to merge.\n * @returns {undefined}\n *   Nothing.\n */\nfunction syntaxExtension(all, extension) {\n  /** @type {keyof Extension} */\n  let hook\n\n  for (hook in extension) {\n    const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined\n    /** @type {Record<string, unknown>} */\n    const left = maybe || (all[hook] = {})\n    /** @type {Record<string, unknown> | undefined} */\n    const right = extension[hook]\n    /** @type {string} */\n    let code\n\n    if (right) {\n      for (code in right) {\n        if (!hasOwnProperty.call(left, code)) left[code] = []\n        const value = right[code]\n        constructs(\n          // @ts-expect-error Looks like a list.\n          left[code],\n          Array.isArray(value) ? value : value ? [value] : []\n        )\n      }\n    }\n  }\n}\n\n/**\n * Merge `list` into `existing` (both lists of constructs).\n * Mutates `existing`.\n *\n * @param {Array<unknown>} existing\n *   List of constructs to merge into.\n * @param {Array<unknown>} list\n *   List of constructs to merge.\n * @returns {undefined}\n *   Nothing.\n */\nfunction constructs(existing, list) {\n  let index = -1\n  /** @type {Array<unknown>} */\n  const before = []\n\n  while (++index < list.length) {\n    // @ts-expect-error Looks like an object.\n    ;(list[index].add === 'after' ? existing : before).push(list[index])\n  }\n\n  splice(existing, 0, 0, before)\n}\n\n/**\n * Combine multiple HTML extensions into one.\n *\n * @param {ReadonlyArray<HtmlExtension>} htmlExtensions\n *   List of HTML extensions.\n * @returns {HtmlExtension}\n *   Single combined HTML extension.\n */\nexport function combineHtmlExtensions(htmlExtensions) {\n  /** @type {HtmlExtension} */\n  const handlers = {}\n  let index = -1\n\n  while (++index < htmlExtensions.length) {\n    htmlExtension(handlers, htmlExtensions[index])\n  }\n\n  return handlers\n}\n\n/**\n * Merge `extension` into `all`.\n *\n * @param {HtmlExtension} all\n *   Extension to merge into.\n * @param {HtmlExtension} extension\n *   Extension to merge.\n * @returns {undefined}\n *   Nothing.\n */\nfunction htmlExtension(all, extension) {\n  /** @type {keyof HtmlExtension} */\n  let hook\n\n  for (hook in extension) {\n    const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined\n    const left = maybe || (all[hook] = {})\n    const right = extension[hook]\n    /** @type {keyof Handles} */\n    let type\n\n    if (right) {\n      for (type in right) {\n        // @ts-expect-error assume document vs regular handler are managed correctly.\n        left[type] = right[type]\n      }\n    }\n  }\n}\n","/**\n * Turn the number (in string form as either hexa- or plain decimal) coming from\n * a numeric character reference into a character.\n *\n * Sort of like `String.fromCodePoint(Number.parseInt(value, base))`, but makes\n * non-characters and control characters safe.\n *\n * @param {string} value\n *   Value to decode.\n * @param {number} base\n *   Numeric base.\n * @returns {string}\n *   Character.\n */\nexport function decodeNumericCharacterReference(value, base) {\n  const code = Number.parseInt(value, base);\n  if (\n  // C0 except for HT, LF, FF, CR, space.\n  code < 9 || code === 11 || code > 13 && code < 32 ||\n  // Control character (DEL) of C0, and C1 controls.\n  code > 126 && code < 160 ||\n  // Lone high surrogates and low surrogates.\n  code > 55_295 && code < 57_344 ||\n  // Noncharacters.\n  code > 64_975 && code < 65_008 || /* eslint-disable no-bitwise */\n  (code & 65_535) === 65_535 || (code & 65_535) === 65_534 || /* eslint-enable no-bitwise */\n  // Out of range\n  code > 1_114_111) {\n    return \"\\uFFFD\";\n  }\n  return String.fromCodePoint(code);\n}","/**\n * Normalize an identifier (as found in references, definitions).\n *\n * Collapses markdown whitespace, trim, and then lower- and uppercase.\n *\n * Some characters are considered “uppercase”, such as U+03F4 (`ϴ`), but if their\n * lowercase counterpart (U+03B8 (`θ`)) is uppercased will result in a different\n * uppercase character (U+0398 (`Θ`)).\n * So, to get a canonical form, we perform both lower- and uppercase.\n *\n * Using uppercase last makes sure keys will never interact with default\n * prototypal values (such as `constructor`): nothing in the prototype of\n * `Object` is uppercase.\n *\n * @param {string} value\n *   Identifier to normalize.\n * @returns {string}\n *   Normalized identifier.\n */\nexport function normalizeIdentifier(value) {\n  return value\n  // Collapse markdown whitespace.\n  .replace(/[\\t\\n\\r ]+/g, \" \")\n  // Trim.\n  .replace(/^ | $/g, '')\n  // Some characters are considered “uppercase”, but if their lowercase\n  // counterpart is uppercased will result in a different uppercase\n  // character.\n  // Hence, to get that form, we perform both lower- and uppercase.\n  // Upper case makes sure keys will not interact with default prototypal\n  // methods: no method is uppercase.\n  .toLowerCase().toUpperCase();\n}","/**\n * @import {Code} from 'micromark-util-types'\n */\n\n/**\n * Check whether the character code represents an ASCII alpha (`a` through `z`,\n * case insensitive).\n *\n * An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha.\n *\n * An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`)\n * to U+005A (`Z`).\n *\n * An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`)\n * to U+007A (`z`).\n *\n * @param code\n *   Code.\n * @returns {boolean}\n *   Whether it matches.\n */\nexport const asciiAlpha = regexCheck(/[A-Za-z]/);\n\n/**\n * Check whether the character code represents an ASCII alphanumeric (`a`\n * through `z`, case insensitive, or `0` through `9`).\n *\n * An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha\n * (see `asciiAlpha`).\n *\n * @param code\n *   Code.\n * @returns {boolean}\n *   Whether it matches.\n */\nexport const asciiAlphanumeric = regexCheck(/[\\dA-Za-z]/);\n\n/**\n * Check whether the character code represents an ASCII atext.\n *\n * atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in\n * the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`),\n * U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F\n * SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E\n * CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE\n * (`{`) to U+007E TILDE (`~`).\n *\n * See:\n * **\\[RFC5322]**:\n * [Internet Message Format](https://tools.ietf.org/html/rfc5322).\n * P. Resnick.\n * IETF.\n *\n * @param code\n *   Code.\n * @returns {boolean}\n *   Whether it matches.\n */\nexport const asciiAtext = regexCheck(/[#-'*+\\--9=?A-Z^-~]/);\n\n/**\n * Check whether a character code is an ASCII control character.\n *\n * An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL)\n * to U+001F (US), or U+007F (DEL).\n *\n * @param {Code} code\n *   Code.\n * @returns {boolean}\n *   Whether it matches.\n */\nexport function asciiControl(code) {\n  return (\n    // Special whitespace codes (which have negative values), C0 and Control\n    // character DEL\n    code !== null && (code < 32 || code === 127)\n  );\n}\n\n/**\n * Check whether the character code represents an ASCII digit (`0` through `9`).\n *\n * An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to\n * U+0039 (`9`).\n *\n * @param code\n *   Code.\n * @returns {boolean}\n *   Whether it matches.\n */\nexport const asciiDigit = regexCheck(/\\d/);\n\n/**\n * Check whether the character code represents an ASCII hex digit (`a` through\n * `f`, case insensitive, or `0` through `9`).\n *\n * An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex\n * digit, or an ASCII lower hex digit.\n *\n * An **ASCII upper hex digit** is a character in the inclusive range U+0041\n * (`A`) to U+0046 (`F`).\n *\n * An **ASCII lower hex digit** is a character in the inclusive range U+0061\n * (`a`) to U+0066 (`f`).\n *\n * @param code\n *   Code.\n * @returns {boolean}\n *   Whether it matches.\n */\nexport const asciiHexDigit = regexCheck(/[\\dA-Fa-f]/);\n\n/**\n * Check whether the character code represents ASCII punctuation.\n *\n * An **ASCII punctuation** is a character in the inclusive ranges U+0021\n * EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT\n * SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT\n * (`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`).\n *\n * @param code\n *   Code.\n * @returns {boolean}\n *   Whether it matches.\n */\nexport const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/);\n\n/**\n * Check whether a character code is a markdown line ending.\n *\n * A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN\n * LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR).\n *\n * In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE\n * RETURN (CR) are replaced by these virtual characters depending on whether\n * they occurred together.\n *\n * @param {Code} code\n *   Code.\n * @returns {boolean}\n *   Whether it matches.\n */\nexport function markdownLineEnding(code) {\n  return code !== null && code < -2;\n}\n\n/**\n * Check whether a character code is a markdown line ending (see\n * `markdownLineEnding`) or markdown space (see `markdownSpace`).\n *\n * @param {Code} code\n *   Code.\n * @returns {boolean}\n *   Whether it matches.\n */\nexport function markdownLineEndingOrSpace(code) {\n  return code !== null && (code < 0 || code === 32);\n}\n\n/**\n * Check whether a character code is a markdown space.\n *\n * A **markdown space** is the concrete character U+0020 SPACE (SP) and the\n * virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT).\n *\n * In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is\n * replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL\n * SPACE (VS) characters, depending on the column at which the tab occurred.\n *\n * @param {Code} code\n *   Code.\n * @returns {boolean}\n *   Whether it matches.\n */\nexport function markdownSpace(code) {\n  return code === -2 || code === -1 || code === 32;\n}\n\n// Size note: removing ASCII from the regex and using `asciiPunctuation` here\n// In fact adds to the bundle size.\n/**\n * Check whether the character code represents Unicode punctuation.\n *\n * A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation,\n * Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf`\n * (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po`\n * (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII\n * punctuation (see `asciiPunctuation`).\n *\n * See:\n * **\\[UNICODE]**:\n * [The Unicode Standard](https://www.unicode.org/versions/).\n * Unicode Consortium.\n *\n * @param code\n *   Code.\n * @returns\n *   Whether it matches.\n */\nexport const unicodePunctuation = regexCheck(/\\p{P}|\\p{S}/u);\n\n/**\n * Check whether the character code represents Unicode whitespace.\n *\n * Note that this does handle micromark specific markdown whitespace characters.\n * See `markdownLineEndingOrSpace` to check that.\n *\n * A **Unicode whitespace** is a character in the Unicode `Zs` (Separator,\n * Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF),\n * U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\\[UNICODE]**).\n *\n * See:\n * **\\[UNICODE]**:\n * [The Unicode Standard](https://www.unicode.org/versions/).\n * Unicode Consortium.\n *\n * @param code\n *   Code.\n * @returns\n *   Whether it matches.\n */\nexport const unicodeWhitespace = regexCheck(/\\s/);\n\n/**\n * Create a code check from a regex.\n *\n * @param {RegExp} regex\n *   Expression.\n * @returns {(code: Code) => boolean}\n *   Check.\n */\nfunction regexCheck(regex) {\n  return check;\n\n  /**\n   * Check whether a code matches the bound regex.\n   *\n   * @param {Code} code\n   *   Character code.\n   * @returns {boolean}\n   *   Whether the character code matches the bound regex.\n   */\n  function check(code) {\n    return code !== null && code > -1 && regex.test(String.fromCharCode(code));\n  }\n}","/**\n * @import {Effects, State, TokenType} from 'micromark-util-types'\n */\n\nimport { markdownSpace } from 'micromark-util-character';\n\n// To do: implement `spaceOrTab`, `spaceOrTabMinMax`, `spaceOrTabWithOptions`.\n\n/**\n * Parse spaces and tabs.\n *\n * There is no `nok` parameter:\n *\n * *   spaces in markdown are often optional, in which case this factory can be\n *     used and `ok` will be switched to whether spaces were found or not\n * *   one line ending or space can be detected with `markdownSpace(code)` right\n *     before using `factorySpace`\n *\n * ###### Examples\n *\n * Where `␉` represents a tab (plus how much it expands) and `␠` represents a\n * single space.\n *\n * ```markdown\n * ␉\n * ␠␠␠␠\n * ␉␠\n * ```\n *\n * @param {Effects} effects\n *   Context.\n * @param {State} ok\n *   State switched to when successful.\n * @param {TokenType} type\n *   Type (`' \\t'`).\n * @param {number | undefined} [max=Infinity]\n *   Max (exclusive).\n * @returns {State}\n *   Start state.\n */\nexport function factorySpace(effects, ok, type, max) {\n  const limit = max ? max - 1 : Number.POSITIVE_INFINITY;\n  let size = 0;\n  return start;\n\n  /** @type {State} */\n  function start(code) {\n    if (markdownSpace(code)) {\n      effects.enter(type);\n      return prefix(code);\n    }\n    return ok(code);\n  }\n\n  /** @type {State} */\n  function prefix(code) {\n    if (markdownSpace(code) && size++ < limit) {\n      effects.consume(code);\n      return prefix;\n    }\n    effects.exit(type);\n    return ok(code);\n  }\n}","/**\n * @import {\n *   InitialConstruct,\n *   Initializer,\n *   State,\n *   TokenizeContext,\n *   Token\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding } from 'micromark-util-character';\n/** @type {InitialConstruct} */\nexport const content = {\n  tokenize: initializeContent\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Initializer}\n *   Content.\n */\nfunction initializeContent(effects) {\n  const contentStart = effects.attempt(this.parser.constructs.contentInitial, afterContentStartConstruct, paragraphInitial);\n  /** @type {Token} */\n  let previous;\n  return contentStart;\n\n  /** @type {State} */\n  function afterContentStartConstruct(code) {\n    if (code === null) {\n      effects.consume(code);\n      return;\n    }\n    effects.enter(\"lineEnding\");\n    effects.consume(code);\n    effects.exit(\"lineEnding\");\n    return factorySpace(effects, contentStart, \"linePrefix\");\n  }\n\n  /** @type {State} */\n  function paragraphInitial(code) {\n    effects.enter(\"paragraph\");\n    return lineStart(code);\n  }\n\n  /** @type {State} */\n  function lineStart(code) {\n    const token = effects.enter(\"chunkText\", {\n      contentType: \"text\",\n      previous\n    });\n    if (previous) {\n      previous.next = token;\n    }\n    previous = token;\n    return data(code);\n  }\n\n  /** @type {State} */\n  function data(code) {\n    if (code === null) {\n      effects.exit(\"chunkText\");\n      effects.exit(\"paragraph\");\n      effects.consume(code);\n      return;\n    }\n    if (markdownLineEnding(code)) {\n      effects.consume(code);\n      effects.exit(\"chunkText\");\n      return lineStart;\n    }\n\n    // Data.\n    effects.consume(code);\n    return data;\n  }\n}","/**\n * @import {\n *   Construct,\n *   ContainerState,\n *   InitialConstruct,\n *   Initializer,\n *   Point,\n *   State,\n *   TokenizeContext,\n *   Tokenizer,\n *   Token\n * } from 'micromark-util-types'\n */\n\n/**\n * @typedef {[Construct, ContainerState]} StackItem\n *   Construct and its state.\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding } from 'micromark-util-character';\nimport { splice } from 'micromark-util-chunked';\n/** @type {InitialConstruct} */\nexport const document = {\n  tokenize: initializeDocument\n};\n\n/** @type {Construct} */\nconst containerConstruct = {\n  tokenize: tokenizeContainer\n};\n\n/**\n * @this {TokenizeContext}\n *   Self.\n * @type {Initializer}\n *   Initializer.\n */\nfunction initializeDocument(effects) {\n  const self = this;\n  /** @type {Array<StackItem>} */\n  const stack = [];\n  let continued = 0;\n  /** @type {TokenizeContext | undefined} */\n  let childFlow;\n  /** @type {Token | undefined} */\n  let childToken;\n  /** @type {number} */\n  let lineStartOffset;\n  return start;\n\n  /** @type {State} */\n  function start(code) {\n    // First we iterate through the open blocks, starting with the root\n    // document, and descending through last children down to the last open\n    // block.\n    // Each block imposes a condition that the line must satisfy if the block is\n    // to remain open.\n    // For example, a block quote requires a `>` character.\n    // A paragraph requires a non-blank line.\n    // In this phase we may match all or just some of the open blocks.\n    // But we cannot close unmatched blocks yet, because we may have a lazy\n    // continuation line.\n    if (continued < stack.length) {\n      const item = stack[continued];\n      self.containerState = item[1];\n      return effects.attempt(item[0].continuation, documentContinue, checkNewContainers)(code);\n    }\n\n    // Done.\n    return checkNewContainers(code);\n  }\n\n  /** @type {State} */\n  function documentContinue(code) {\n    continued++;\n\n    // Note: this field is called `_closeFlow` but it also closes containers.\n    // Perhaps a good idea to rename it but it’s already used in the wild by\n    // extensions.\n    if (self.containerState._closeFlow) {\n      self.containerState._closeFlow = undefined;\n      if (childFlow) {\n        closeFlow();\n      }\n\n      // Note: this algorithm for moving events around is similar to the\n      // algorithm when dealing with lazy lines in `writeToChild`.\n      const indexBeforeExits = self.events.length;\n      let indexBeforeFlow = indexBeforeExits;\n      /** @type {Point | undefined} */\n      let point;\n\n      // Find the flow chunk.\n      while (indexBeforeFlow--) {\n        if (self.events[indexBeforeFlow][0] === 'exit' && self.events[indexBeforeFlow][1].type === \"chunkFlow\") {\n          point = self.events[indexBeforeFlow][1].end;\n          break;\n        }\n      }\n      exitContainers(continued);\n\n      // Fix positions.\n      let index = indexBeforeExits;\n      while (index < self.events.length) {\n        self.events[index][1].end = {\n          ...point\n        };\n        index++;\n      }\n\n      // Inject the exits earlier (they’re still also at the end).\n      splice(self.events, indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits));\n\n      // Discard the duplicate exits.\n      self.events.length = index;\n      return checkNewContainers(code);\n    }\n    return start(code);\n  }\n\n  /** @type {State} */\n  function checkNewContainers(code) {\n    // Next, after consuming the continuation markers for existing blocks, we\n    // look for new block starts (e.g. `>` for a block quote).\n    // If we encounter a new block start, we close any blocks unmatched in\n    // step 1 before creating the new block as a child of the last matched\n    // block.\n    if (continued === stack.length) {\n      // No need to `check` whether there’s a container, of `exitContainers`\n      // would be moot.\n      // We can instead immediately `attempt` to parse one.\n      if (!childFlow) {\n        return documentContinued(code);\n      }\n\n      // If we have concrete content, such as block HTML or fenced code,\n      // we can’t have containers “pierce” into them, so we can immediately\n      // start.\n      if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) {\n        return flowStart(code);\n      }\n\n      // If we do have flow, it could still be a blank line,\n      // but we’d be interrupting it w/ a new container if there’s a current\n      // construct.\n      // To do: next major: remove `_gfmTableDynamicInterruptHack` (no longer\n      // needed in micromark-extension-gfm-table@1.0.6).\n      self.interrupt = Boolean(childFlow.currentConstruct && !childFlow._gfmTableDynamicInterruptHack);\n    }\n\n    // Check if there is a new container.\n    self.containerState = {};\n    return effects.check(containerConstruct, thereIsANewContainer, thereIsNoNewContainer)(code);\n  }\n\n  /** @type {State} */\n  function thereIsANewContainer(code) {\n    if (childFlow) closeFlow();\n    exitContainers(continued);\n    return documentContinued(code);\n  }\n\n  /** @type {State} */\n  function thereIsNoNewContainer(code) {\n    self.parser.lazy[self.now().line] = continued !== stack.length;\n    lineStartOffset = self.now().offset;\n    return flowStart(code);\n  }\n\n  /** @type {State} */\n  function documentContinued(code) {\n    // Try new containers.\n    self.containerState = {};\n    return effects.attempt(containerConstruct, containerContinue, flowStart)(code);\n  }\n\n  /** @type {State} */\n  function containerContinue(code) {\n    continued++;\n    stack.push([self.currentConstruct, self.containerState]);\n    // Try another.\n    return documentContinued(code);\n  }\n\n  /** @type {State} */\n  function flowStart(code) {\n    if (code === null) {\n      if (childFlow) closeFlow();\n      exitContainers(0);\n      effects.consume(code);\n      return;\n    }\n    childFlow = childFlow || self.parser.flow(self.now());\n    effects.enter(\"chunkFlow\", {\n      _tokenizer: childFlow,\n      contentType: \"flow\",\n      previous: childToken\n    });\n    return flowContinue(code);\n  }\n\n  /** @type {State} */\n  function flowContinue(code) {\n    if (code === null) {\n      writeToChild(effects.exit(\"chunkFlow\"), true);\n      exitContainers(0);\n      effects.consume(code);\n      return;\n    }\n    if (markdownLineEnding(code)) {\n      effects.consume(code);\n      writeToChild(effects.exit(\"chunkFlow\"));\n      // Get ready for the next line.\n      continued = 0;\n      self.interrupt = undefined;\n      return start;\n    }\n    effects.consume(code);\n    return flowContinue;\n  }\n\n  /**\n   * @param {Token} token\n   *   Token.\n   * @param {boolean | undefined} [endOfFile]\n   *   Whether the token is at the end of the file (default: `false`).\n   * @returns {undefined}\n   *   Nothing.\n   */\n  function writeToChild(token, endOfFile) {\n    const stream = self.sliceStream(token);\n    if (endOfFile) stream.push(null);\n    token.previous = childToken;\n    if (childToken) childToken.next = token;\n    childToken = token;\n    childFlow.defineSkip(token.start);\n    childFlow.write(stream);\n\n    // Alright, so we just added a lazy line:\n    //\n    // ```markdown\n    // > a\n    // b.\n    //\n    // Or:\n    //\n    // > ~~~c\n    // d\n    //\n    // Or:\n    //\n    // > | e |\n    // f\n    // ```\n    //\n    // The construct in the second example (fenced code) does not accept lazy\n    // lines, so it marked itself as done at the end of its first line, and\n    // then the content construct parses `d`.\n    // Most constructs in markdown match on the first line: if the first line\n    // forms a construct, a non-lazy line can’t “unmake” it.\n    //\n    // The construct in the third example is potentially a GFM table, and\n    // those are *weird*.\n    // It *could* be a table, from the first line, if the following line\n    // matches a condition.\n    // In this case, that second line is lazy, which “unmakes” the first line\n    // and turns the whole into one content block.\n    //\n    // We’ve now parsed the non-lazy and the lazy line, and can figure out\n    // whether the lazy line started a new flow block.\n    // If it did, we exit the current containers between the two flow blocks.\n    if (self.parser.lazy[token.start.line]) {\n      let index = childFlow.events.length;\n      while (index--) {\n        if (\n        // The token starts before the line ending…\n        childFlow.events[index][1].start.offset < lineStartOffset && (\n        // …and either is not ended yet…\n        !childFlow.events[index][1].end ||\n        // …or ends after it.\n        childFlow.events[index][1].end.offset > lineStartOffset)) {\n          // Exit: there’s still something open, which means it’s a lazy line\n          // part of something.\n          return;\n        }\n      }\n\n      // Note: this algorithm for moving events around is similar to the\n      // algorithm when closing flow in `documentContinue`.\n      const indexBeforeExits = self.events.length;\n      let indexBeforeFlow = indexBeforeExits;\n      /** @type {boolean | undefined} */\n      let seen;\n      /** @type {Point | undefined} */\n      let point;\n\n      // Find the previous chunk (the one before the lazy line).\n      while (indexBeforeFlow--) {\n        if (self.events[indexBeforeFlow][0] === 'exit' && self.events[indexBeforeFlow][1].type === \"chunkFlow\") {\n          if (seen) {\n            point = self.events[indexBeforeFlow][1].end;\n            break;\n          }\n          seen = true;\n        }\n      }\n      exitContainers(continued);\n\n      // Fix positions.\n      index = indexBeforeExits;\n      while (index < self.events.length) {\n        self.events[index][1].end = {\n          ...point\n        };\n        index++;\n      }\n\n      // Inject the exits earlier (they’re still also at the end).\n      splice(self.events, indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits));\n\n      // Discard the duplicate exits.\n      self.events.length = index;\n    }\n  }\n\n  /**\n   * @param {number} size\n   *   Size.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  function exitContainers(size) {\n    let index = stack.length;\n\n    // Exit open containers.\n    while (index-- > size) {\n      const entry = stack[index];\n      self.containerState = entry[1];\n      entry[0].exit.call(self, effects);\n    }\n    stack.length = size;\n  }\n  function closeFlow() {\n    childFlow.write([null]);\n    childToken = undefined;\n    childFlow = undefined;\n    self.containerState._closeFlow = undefined;\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n *   Tokenizer.\n */\nfunction tokenizeContainer(effects, ok, nok) {\n  // Always populated by defaults.\n\n  return factorySpace(effects, effects.attempt(this.parser.constructs.document, ok, nok), \"linePrefix\", this.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4);\n}","/**\n * @import {Code} from 'micromark-util-types'\n */\n\nimport { markdownLineEndingOrSpace, unicodePunctuation, unicodeWhitespace } from 'micromark-util-character';\n/**\n * Classify whether a code represents whitespace, punctuation, or something\n * else.\n *\n * Used for attention (emphasis, strong), whose sequences can open or close\n * based on the class of surrounding characters.\n *\n * > 👉 **Note**: eof (`null`) is seen as whitespace.\n *\n * @param {Code} code\n *   Code.\n * @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined}\n *   Group.\n */\nexport function classifyCharacter(code) {\n  if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) {\n    return 1;\n  }\n  if (unicodePunctuation(code)) {\n    return 2;\n  }\n}","/**\n * @import {Event, Resolver, TokenizeContext} from 'micromark-util-types'\n */\n\n/**\n * Call all `resolveAll`s.\n *\n * @param {ReadonlyArray<{resolveAll?: Resolver | undefined}>} constructs\n *   List of constructs, optionally with `resolveAll`s.\n * @param {Array<Event>} events\n *   List of events.\n * @param {TokenizeContext} context\n *   Context used by `tokenize`.\n * @returns {Array<Event>}\n *   Changed events.\n */\nexport function resolveAll(constructs, events, context) {\n  /** @type {Array<Resolver>} */\n  const called = []\n  let index = -1\n\n  while (++index < constructs.length) {\n    const resolve = constructs[index].resolveAll\n\n    if (resolve && !called.includes(resolve)) {\n      events = resolve(events, context)\n      called.push(resolve)\n    }\n  }\n\n  return events\n}\n","/**\n * @import {\n *   Code,\n *   Construct,\n *   Event,\n *   Point,\n *   Resolver,\n *   State,\n *   TokenizeContext,\n *   Tokenizer,\n *   Token\n * } from 'micromark-util-types'\n */\n\nimport { push, splice } from 'micromark-util-chunked';\nimport { classifyCharacter } from 'micromark-util-classify-character';\nimport { resolveAll } from 'micromark-util-resolve-all';\n/** @type {Construct} */\nexport const attention = {\n  name: 'attention',\n  resolveAll: resolveAllAttention,\n  tokenize: tokenizeAttention\n};\n\n/**\n * Take all events and resolve attention to emphasis or strong.\n *\n * @type {Resolver}\n */\n// eslint-disable-next-line complexity\nfunction resolveAllAttention(events, context) {\n  let index = -1;\n  /** @type {number} */\n  let open;\n  /** @type {Token} */\n  let group;\n  /** @type {Token} */\n  let text;\n  /** @type {Token} */\n  let openingSequence;\n  /** @type {Token} */\n  let closingSequence;\n  /** @type {number} */\n  let use;\n  /** @type {Array<Event>} */\n  let nextEvents;\n  /** @type {number} */\n  let offset;\n\n  // Walk through all events.\n  //\n  // Note: performance of this is fine on an mb of normal markdown, but it’s\n  // a bottleneck for malicious stuff.\n  while (++index < events.length) {\n    // Find a token that can close.\n    if (events[index][0] === 'enter' && events[index][1].type === 'attentionSequence' && events[index][1]._close) {\n      open = index;\n\n      // Now walk back to find an opener.\n      while (open--) {\n        // Find a token that can open the closer.\n        if (events[open][0] === 'exit' && events[open][1].type === 'attentionSequence' && events[open][1]._open &&\n        // If the markers are the same:\n        context.sliceSerialize(events[open][1]).charCodeAt(0) === context.sliceSerialize(events[index][1]).charCodeAt(0)) {\n          // If the opening can close or the closing can open,\n          // and the close size *is not* a multiple of three,\n          // but the sum of the opening and closing size *is* multiple of three,\n          // then don’t match.\n          if ((events[open][1]._close || events[index][1]._open) && (events[index][1].end.offset - events[index][1].start.offset) % 3 && !((events[open][1].end.offset - events[open][1].start.offset + events[index][1].end.offset - events[index][1].start.offset) % 3)) {\n            continue;\n          }\n\n          // Number of markers to use from the sequence.\n          use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1;\n          const start = {\n            ...events[open][1].end\n          };\n          const end = {\n            ...events[index][1].start\n          };\n          movePoint(start, -use);\n          movePoint(end, use);\n          openingSequence = {\n            type: use > 1 ? \"strongSequence\" : \"emphasisSequence\",\n            start,\n            end: {\n              ...events[open][1].end\n            }\n          };\n          closingSequence = {\n            type: use > 1 ? \"strongSequence\" : \"emphasisSequence\",\n            start: {\n              ...events[index][1].start\n            },\n            end\n          };\n          text = {\n            type: use > 1 ? \"strongText\" : \"emphasisText\",\n            start: {\n              ...events[open][1].end\n            },\n            end: {\n              ...events[index][1].start\n            }\n          };\n          group = {\n            type: use > 1 ? \"strong\" : \"emphasis\",\n            start: {\n              ...openingSequence.start\n            },\n            end: {\n              ...closingSequence.end\n            }\n          };\n          events[open][1].end = {\n            ...openingSequence.start\n          };\n          events[index][1].start = {\n            ...closingSequence.end\n          };\n          nextEvents = [];\n\n          // If there are more markers in the opening, add them before.\n          if (events[open][1].end.offset - events[open][1].start.offset) {\n            nextEvents = push(nextEvents, [['enter', events[open][1], context], ['exit', events[open][1], context]]);\n          }\n\n          // Opening.\n          nextEvents = push(nextEvents, [['enter', group, context], ['enter', openingSequence, context], ['exit', openingSequence, context], ['enter', text, context]]);\n\n          // Always populated by defaults.\n\n          // Between.\n          nextEvents = push(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + 1, index), context));\n\n          // Closing.\n          nextEvents = push(nextEvents, [['exit', text, context], ['enter', closingSequence, context], ['exit', closingSequence, context], ['exit', group, context]]);\n\n          // If there are more markers in the closing, add them after.\n          if (events[index][1].end.offset - events[index][1].start.offset) {\n            offset = 2;\n            nextEvents = push(nextEvents, [['enter', events[index][1], context], ['exit', events[index][1], context]]);\n          } else {\n            offset = 0;\n          }\n          splice(events, open - 1, index - open + 3, nextEvents);\n          index = open + nextEvents.length - offset - 2;\n          break;\n        }\n      }\n    }\n  }\n\n  // Remove remaining sequences.\n  index = -1;\n  while (++index < events.length) {\n    if (events[index][1].type === 'attentionSequence') {\n      events[index][1].type = 'data';\n    }\n  }\n  return events;\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeAttention(effects, ok) {\n  const attentionMarkers = this.parser.constructs.attentionMarkers.null;\n  const previous = this.previous;\n  const before = classifyCharacter(previous);\n\n  /** @type {NonNullable<Code>} */\n  let marker;\n  return start;\n\n  /**\n   * Before a sequence.\n   *\n   * ```markdown\n   * > | **\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    marker = code;\n    effects.enter('attentionSequence');\n    return inside(code);\n  }\n\n  /**\n   * In a sequence.\n   *\n   * ```markdown\n   * > | **\n   *     ^^\n   * ```\n   *\n   * @type {State}\n   */\n  function inside(code) {\n    if (code === marker) {\n      effects.consume(code);\n      return inside;\n    }\n    const token = effects.exit('attentionSequence');\n\n    // To do: next major: move this to resolver, just like `markdown-rs`.\n    const after = classifyCharacter(code);\n\n    // Always populated by defaults.\n\n    const open = !after || after === 2 && before || attentionMarkers.includes(code);\n    const close = !before || before === 2 && after || attentionMarkers.includes(previous);\n    token._open = Boolean(marker === 42 ? open : open && (before || !close));\n    token._close = Boolean(marker === 42 ? close : close && (after || !open));\n    return ok(code);\n  }\n}\n\n/**\n * Move a point a bit.\n *\n * Note: `move` only works inside lines! It’s not possible to move past other\n * chunks (replacement characters, tabs, or line endings).\n *\n * @param {Point} point\n *   Point.\n * @param {number} offset\n *   Amount to move.\n * @returns {undefined}\n *   Nothing.\n */\nfunction movePoint(point, offset) {\n  point.column += offset;\n  point.offset += offset;\n  point._bufferIndex += offset;\n}","/**\n * @import {\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { asciiAlphanumeric, asciiAlpha, asciiAtext, asciiControl } from 'micromark-util-character';\n/** @type {Construct} */\nexport const autolink = {\n  name: 'autolink',\n  tokenize: tokenizeAutolink\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeAutolink(effects, ok, nok) {\n  let size = 0;\n  return start;\n\n  /**\n   * Start of an autolink.\n   *\n   * ```markdown\n   * > | a<https://example.com>b\n   *      ^\n   * > | a<user@example.com>b\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    effects.enter(\"autolink\");\n    effects.enter(\"autolinkMarker\");\n    effects.consume(code);\n    effects.exit(\"autolinkMarker\");\n    effects.enter(\"autolinkProtocol\");\n    return open;\n  }\n\n  /**\n   * After `<`, at protocol or atext.\n   *\n   * ```markdown\n   * > | a<https://example.com>b\n   *       ^\n   * > | a<user@example.com>b\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function open(code) {\n    if (asciiAlpha(code)) {\n      effects.consume(code);\n      return schemeOrEmailAtext;\n    }\n    if (code === 64) {\n      return nok(code);\n    }\n    return emailAtext(code);\n  }\n\n  /**\n   * At second byte of protocol or atext.\n   *\n   * ```markdown\n   * > | a<https://example.com>b\n   *        ^\n   * > | a<user@example.com>b\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function schemeOrEmailAtext(code) {\n    // ASCII alphanumeric and `+`, `-`, and `.`.\n    if (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) {\n      // Count the previous alphabetical from `open` too.\n      size = 1;\n      return schemeInsideOrEmailAtext(code);\n    }\n    return emailAtext(code);\n  }\n\n  /**\n   * In ambiguous protocol or atext.\n   *\n   * ```markdown\n   * > | a<https://example.com>b\n   *        ^\n   * > | a<user@example.com>b\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function schemeInsideOrEmailAtext(code) {\n    if (code === 58) {\n      effects.consume(code);\n      size = 0;\n      return urlInside;\n    }\n\n    // ASCII alphanumeric and `+`, `-`, and `.`.\n    if ((code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) && size++ < 32) {\n      effects.consume(code);\n      return schemeInsideOrEmailAtext;\n    }\n    size = 0;\n    return emailAtext(code);\n  }\n\n  /**\n   * After protocol, in URL.\n   *\n   * ```markdown\n   * > | a<https://example.com>b\n   *             ^\n   * ```\n   *\n   * @type {State}\n   */\n  function urlInside(code) {\n    if (code === 62) {\n      effects.exit(\"autolinkProtocol\");\n      effects.enter(\"autolinkMarker\");\n      effects.consume(code);\n      effects.exit(\"autolinkMarker\");\n      effects.exit(\"autolink\");\n      return ok;\n    }\n\n    // ASCII control, space, or `<`.\n    if (code === null || code === 32 || code === 60 || asciiControl(code)) {\n      return nok(code);\n    }\n    effects.consume(code);\n    return urlInside;\n  }\n\n  /**\n   * In email atext.\n   *\n   * ```markdown\n   * > | a<user.name@example.com>b\n   *              ^\n   * ```\n   *\n   * @type {State}\n   */\n  function emailAtext(code) {\n    if (code === 64) {\n      effects.consume(code);\n      return emailAtSignOrDot;\n    }\n    if (asciiAtext(code)) {\n      effects.consume(code);\n      return emailAtext;\n    }\n    return nok(code);\n  }\n\n  /**\n   * In label, after at-sign or dot.\n   *\n   * ```markdown\n   * > | a<user.name@example.com>b\n   *                 ^       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function emailAtSignOrDot(code) {\n    return asciiAlphanumeric(code) ? emailLabel(code) : nok(code);\n  }\n\n  /**\n   * In label, where `.` and `>` are allowed.\n   *\n   * ```markdown\n   * > | a<user.name@example.com>b\n   *                   ^\n   * ```\n   *\n   * @type {State}\n   */\n  function emailLabel(code) {\n    if (code === 46) {\n      effects.consume(code);\n      size = 0;\n      return emailAtSignOrDot;\n    }\n    if (code === 62) {\n      // Exit, then change the token type.\n      effects.exit(\"autolinkProtocol\").type = \"autolinkEmail\";\n      effects.enter(\"autolinkMarker\");\n      effects.consume(code);\n      effects.exit(\"autolinkMarker\");\n      effects.exit(\"autolink\");\n      return ok;\n    }\n    return emailValue(code);\n  }\n\n  /**\n   * In label, where `.` and `>` are *not* allowed.\n   *\n   * Though, this is also used in `emailLabel` to parse other values.\n   *\n   * ```markdown\n   * > | a<user.name@ex-ample.com>b\n   *                    ^\n   * ```\n   *\n   * @type {State}\n   */\n  function emailValue(code) {\n    // ASCII alphanumeric or `-`.\n    if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) {\n      const next = code === 45 ? emailValue : emailLabel;\n      effects.consume(code);\n      return next;\n    }\n    return nok(code);\n  }\n}","/**\n * @import {\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const blankLine = {\n  partial: true,\n  tokenize: tokenizeBlankLine\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeBlankLine(effects, ok, nok) {\n  return start;\n\n  /**\n   * Start of blank line.\n   *\n   * > 👉 **Note**: `␠` represents a space character.\n   *\n   * ```markdown\n   * > | ␠␠␊\n   *     ^\n   * > | ␊\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    return markdownSpace(code) ? factorySpace(effects, after, \"linePrefix\")(code) : after(code);\n  }\n\n  /**\n   * At eof/eol, after optional whitespace.\n   *\n   * > 👉 **Note**: `␠` represents a space character.\n   *\n   * ```markdown\n   * > | ␠␠␊\n   *       ^\n   * > | ␊\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function after(code) {\n    return code === null || markdownLineEnding(code) ? ok(code) : nok(code);\n  }\n}","/**\n * @import {\n *   Construct,\n *   Exiter,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const blockQuote = {\n  continuation: {\n    tokenize: tokenizeBlockQuoteContinuation\n  },\n  exit,\n  name: 'blockQuote',\n  tokenize: tokenizeBlockQuoteStart\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeBlockQuoteStart(effects, ok, nok) {\n  const self = this;\n  return start;\n\n  /**\n   * Start of block quote.\n   *\n   * ```markdown\n   * > | > a\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    if (code === 62) {\n      const state = self.containerState;\n      if (!state.open) {\n        effects.enter(\"blockQuote\", {\n          _container: true\n        });\n        state.open = true;\n      }\n      effects.enter(\"blockQuotePrefix\");\n      effects.enter(\"blockQuoteMarker\");\n      effects.consume(code);\n      effects.exit(\"blockQuoteMarker\");\n      return after;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After `>`, before optional whitespace.\n   *\n   * ```markdown\n   * > | > a\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function after(code) {\n    if (markdownSpace(code)) {\n      effects.enter(\"blockQuotePrefixWhitespace\");\n      effects.consume(code);\n      effects.exit(\"blockQuotePrefixWhitespace\");\n      effects.exit(\"blockQuotePrefix\");\n      return ok;\n    }\n    effects.exit(\"blockQuotePrefix\");\n    return ok(code);\n  }\n}\n\n/**\n * Start of block quote continuation.\n *\n * ```markdown\n *   | > a\n * > | > b\n *     ^\n * ```\n *\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeBlockQuoteContinuation(effects, ok, nok) {\n  const self = this;\n  return contStart;\n\n  /**\n   * Start of block quote continuation.\n   *\n   * Also used to parse the first block quote opening.\n   *\n   * ```markdown\n   *   | > a\n   * > | > b\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function contStart(code) {\n    if (markdownSpace(code)) {\n      // Always populated by defaults.\n\n      return factorySpace(effects, contBefore, \"linePrefix\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code);\n    }\n    return contBefore(code);\n  }\n\n  /**\n   * At `>`, after optional whitespace.\n   *\n   * Also used to parse the first block quote opening.\n   *\n   * ```markdown\n   *   | > a\n   * > | > b\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function contBefore(code) {\n    return effects.attempt(blockQuote, ok, nok)(code);\n  }\n}\n\n/** @type {Exiter} */\nfunction exit(effects) {\n  effects.exit(\"blockQuote\");\n}","/**\n * @import {\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { asciiPunctuation } from 'micromark-util-character';\n/** @type {Construct} */\nexport const characterEscape = {\n  name: 'characterEscape',\n  tokenize: tokenizeCharacterEscape\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeCharacterEscape(effects, ok, nok) {\n  return start;\n\n  /**\n   * Start of character escape.\n   *\n   * ```markdown\n   * > | a\\*b\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    effects.enter(\"characterEscape\");\n    effects.enter(\"escapeMarker\");\n    effects.consume(code);\n    effects.exit(\"escapeMarker\");\n    return inside;\n  }\n\n  /**\n   * After `\\`, at punctuation.\n   *\n   * ```markdown\n   * > | a\\*b\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function inside(code) {\n    // ASCII punctuation.\n    if (asciiPunctuation(code)) {\n      effects.enter(\"characterEscapeValue\");\n      effects.consume(code);\n      effects.exit(\"characterEscapeValue\");\n      effects.exit(\"characterEscape\");\n      return ok;\n    }\n    return nok(code);\n  }\n}","/**\n * @import {\n *   Code,\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { decodeNamedCharacterReference } from 'decode-named-character-reference';\nimport { asciiAlphanumeric, asciiDigit, asciiHexDigit } from 'micromark-util-character';\n/** @type {Construct} */\nexport const characterReference = {\n  name: 'characterReference',\n  tokenize: tokenizeCharacterReference\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeCharacterReference(effects, ok, nok) {\n  const self = this;\n  let size = 0;\n  /** @type {number} */\n  let max;\n  /** @type {(code: Code) => boolean} */\n  let test;\n  return start;\n\n  /**\n   * Start of character reference.\n   *\n   * ```markdown\n   * > | a&amp;b\n   *      ^\n   * > | a&#123;b\n   *      ^\n   * > | a&#x9;b\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    effects.enter(\"characterReference\");\n    effects.enter(\"characterReferenceMarker\");\n    effects.consume(code);\n    effects.exit(\"characterReferenceMarker\");\n    return open;\n  }\n\n  /**\n   * After `&`, at `#` for numeric references or alphanumeric for named\n   * references.\n   *\n   * ```markdown\n   * > | a&amp;b\n   *       ^\n   * > | a&#123;b\n   *       ^\n   * > | a&#x9;b\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function open(code) {\n    if (code === 35) {\n      effects.enter(\"characterReferenceMarkerNumeric\");\n      effects.consume(code);\n      effects.exit(\"characterReferenceMarkerNumeric\");\n      return numeric;\n    }\n    effects.enter(\"characterReferenceValue\");\n    max = 31;\n    test = asciiAlphanumeric;\n    return value(code);\n  }\n\n  /**\n   * After `#`, at `x` for hexadecimals or digit for decimals.\n   *\n   * ```markdown\n   * > | a&#123;b\n   *        ^\n   * > | a&#x9;b\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function numeric(code) {\n    if (code === 88 || code === 120) {\n      effects.enter(\"characterReferenceMarkerHexadecimal\");\n      effects.consume(code);\n      effects.exit(\"characterReferenceMarkerHexadecimal\");\n      effects.enter(\"characterReferenceValue\");\n      max = 6;\n      test = asciiHexDigit;\n      return value;\n    }\n    effects.enter(\"characterReferenceValue\");\n    max = 7;\n    test = asciiDigit;\n    return value(code);\n  }\n\n  /**\n   * After markers (`&#x`, `&#`, or `&`), in value, before `;`.\n   *\n   * The character reference kind defines what and how many characters are\n   * allowed.\n   *\n   * ```markdown\n   * > | a&amp;b\n   *       ^^^\n   * > | a&#123;b\n   *        ^^^\n   * > | a&#x9;b\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function value(code) {\n    if (code === 59 && size) {\n      const token = effects.exit(\"characterReferenceValue\");\n      if (test === asciiAlphanumeric && !decodeNamedCharacterReference(self.sliceSerialize(token))) {\n        return nok(code);\n      }\n\n      // To do: `markdown-rs` uses a different name:\n      // `CharacterReferenceMarkerSemi`.\n      effects.enter(\"characterReferenceMarker\");\n      effects.consume(code);\n      effects.exit(\"characterReferenceMarker\");\n      effects.exit(\"characterReference\");\n      return ok;\n    }\n    if (test(code) && size++ < max) {\n      effects.consume(code);\n      return value;\n    }\n    return nok(code);\n  }\n}","/**\n * @import {\n *   Code,\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nconst nonLazyContinuation = {\n  partial: true,\n  tokenize: tokenizeNonLazyContinuation\n};\n\n/** @type {Construct} */\nexport const codeFenced = {\n  concrete: true,\n  name: 'codeFenced',\n  tokenize: tokenizeCodeFenced\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeCodeFenced(effects, ok, nok) {\n  const self = this;\n  /** @type {Construct} */\n  const closeStart = {\n    partial: true,\n    tokenize: tokenizeCloseStart\n  };\n  let initialPrefix = 0;\n  let sizeOpen = 0;\n  /** @type {NonNullable<Code>} */\n  let marker;\n  return start;\n\n  /**\n   * Start of code.\n   *\n   * ```markdown\n   * > | ~~~js\n   *     ^\n   *   | alert(1)\n   *   | ~~~\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    // To do: parse whitespace like `markdown-rs`.\n    return beforeSequenceOpen(code);\n  }\n\n  /**\n   * In opening fence, after prefix, at sequence.\n   *\n   * ```markdown\n   * > | ~~~js\n   *     ^\n   *   | alert(1)\n   *   | ~~~\n   * ```\n   *\n   * @type {State}\n   */\n  function beforeSequenceOpen(code) {\n    const tail = self.events[self.events.length - 1];\n    initialPrefix = tail && tail[1].type === \"linePrefix\" ? tail[2].sliceSerialize(tail[1], true).length : 0;\n    marker = code;\n    effects.enter(\"codeFenced\");\n    effects.enter(\"codeFencedFence\");\n    effects.enter(\"codeFencedFenceSequence\");\n    return sequenceOpen(code);\n  }\n\n  /**\n   * In opening fence sequence.\n   *\n   * ```markdown\n   * > | ~~~js\n   *      ^\n   *   | alert(1)\n   *   | ~~~\n   * ```\n   *\n   * @type {State}\n   */\n  function sequenceOpen(code) {\n    if (code === marker) {\n      sizeOpen++;\n      effects.consume(code);\n      return sequenceOpen;\n    }\n    if (sizeOpen < 3) {\n      return nok(code);\n    }\n    effects.exit(\"codeFencedFenceSequence\");\n    return markdownSpace(code) ? factorySpace(effects, infoBefore, \"whitespace\")(code) : infoBefore(code);\n  }\n\n  /**\n   * In opening fence, after the sequence (and optional whitespace), before info.\n   *\n   * ```markdown\n   * > | ~~~js\n   *        ^\n   *   | alert(1)\n   *   | ~~~\n   * ```\n   *\n   * @type {State}\n   */\n  function infoBefore(code) {\n    if (code === null || markdownLineEnding(code)) {\n      effects.exit(\"codeFencedFence\");\n      return self.interrupt ? ok(code) : effects.check(nonLazyContinuation, atNonLazyBreak, after)(code);\n    }\n    effects.enter(\"codeFencedFenceInfo\");\n    effects.enter(\"chunkString\", {\n      contentType: \"string\"\n    });\n    return info(code);\n  }\n\n  /**\n   * In info.\n   *\n   * ```markdown\n   * > | ~~~js\n   *        ^\n   *   | alert(1)\n   *   | ~~~\n   * ```\n   *\n   * @type {State}\n   */\n  function info(code) {\n    if (code === null || markdownLineEnding(code)) {\n      effects.exit(\"chunkString\");\n      effects.exit(\"codeFencedFenceInfo\");\n      return infoBefore(code);\n    }\n    if (markdownSpace(code)) {\n      effects.exit(\"chunkString\");\n      effects.exit(\"codeFencedFenceInfo\");\n      return factorySpace(effects, metaBefore, \"whitespace\")(code);\n    }\n    if (code === 96 && code === marker) {\n      return nok(code);\n    }\n    effects.consume(code);\n    return info;\n  }\n\n  /**\n   * In opening fence, after info and whitespace, before meta.\n   *\n   * ```markdown\n   * > | ~~~js eval\n   *           ^\n   *   | alert(1)\n   *   | ~~~\n   * ```\n   *\n   * @type {State}\n   */\n  function metaBefore(code) {\n    if (code === null || markdownLineEnding(code)) {\n      return infoBefore(code);\n    }\n    effects.enter(\"codeFencedFenceMeta\");\n    effects.enter(\"chunkString\", {\n      contentType: \"string\"\n    });\n    return meta(code);\n  }\n\n  /**\n   * In meta.\n   *\n   * ```markdown\n   * > | ~~~js eval\n   *           ^\n   *   | alert(1)\n   *   | ~~~\n   * ```\n   *\n   * @type {State}\n   */\n  function meta(code) {\n    if (code === null || markdownLineEnding(code)) {\n      effects.exit(\"chunkString\");\n      effects.exit(\"codeFencedFenceMeta\");\n      return infoBefore(code);\n    }\n    if (code === 96 && code === marker) {\n      return nok(code);\n    }\n    effects.consume(code);\n    return meta;\n  }\n\n  /**\n   * At eol/eof in code, before a non-lazy closing fence or content.\n   *\n   * ```markdown\n   * > | ~~~js\n   *          ^\n   * > | alert(1)\n   *             ^\n   *   | ~~~\n   * ```\n   *\n   * @type {State}\n   */\n  function atNonLazyBreak(code) {\n    return effects.attempt(closeStart, after, contentBefore)(code);\n  }\n\n  /**\n   * Before code content, not a closing fence, at eol.\n   *\n   * ```markdown\n   *   | ~~~js\n   * > | alert(1)\n   *             ^\n   *   | ~~~\n   * ```\n   *\n   * @type {State}\n   */\n  function contentBefore(code) {\n    effects.enter(\"lineEnding\");\n    effects.consume(code);\n    effects.exit(\"lineEnding\");\n    return contentStart;\n  }\n\n  /**\n   * Before code content, not a closing fence.\n   *\n   * ```markdown\n   *   | ~~~js\n   * > | alert(1)\n   *     ^\n   *   | ~~~\n   * ```\n   *\n   * @type {State}\n   */\n  function contentStart(code) {\n    return initialPrefix > 0 && markdownSpace(code) ? factorySpace(effects, beforeContentChunk, \"linePrefix\", initialPrefix + 1)(code) : beforeContentChunk(code);\n  }\n\n  /**\n   * Before code content, after optional prefix.\n   *\n   * ```markdown\n   *   | ~~~js\n   * > | alert(1)\n   *     ^\n   *   | ~~~\n   * ```\n   *\n   * @type {State}\n   */\n  function beforeContentChunk(code) {\n    if (code === null || markdownLineEnding(code)) {\n      return effects.check(nonLazyContinuation, atNonLazyBreak, after)(code);\n    }\n    effects.enter(\"codeFlowValue\");\n    return contentChunk(code);\n  }\n\n  /**\n   * In code content.\n   *\n   * ```markdown\n   *   | ~~~js\n   * > | alert(1)\n   *     ^^^^^^^^\n   *   | ~~~\n   * ```\n   *\n   * @type {State}\n   */\n  function contentChunk(code) {\n    if (code === null || markdownLineEnding(code)) {\n      effects.exit(\"codeFlowValue\");\n      return beforeContentChunk(code);\n    }\n    effects.consume(code);\n    return contentChunk;\n  }\n\n  /**\n   * After code.\n   *\n   * ```markdown\n   *   | ~~~js\n   *   | alert(1)\n   * > | ~~~\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function after(code) {\n    effects.exit(\"codeFenced\");\n    return ok(code);\n  }\n\n  /**\n   * @this {TokenizeContext}\n   *   Context.\n   * @type {Tokenizer}\n   */\n  function tokenizeCloseStart(effects, ok, nok) {\n    let size = 0;\n    return startBefore;\n\n    /**\n     *\n     *\n     * @type {State}\n     */\n    function startBefore(code) {\n      effects.enter(\"lineEnding\");\n      effects.consume(code);\n      effects.exit(\"lineEnding\");\n      return start;\n    }\n\n    /**\n     * Before closing fence, at optional whitespace.\n     *\n     * ```markdown\n     *   | ~~~js\n     *   | alert(1)\n     * > | ~~~\n     *     ^\n     * ```\n     *\n     * @type {State}\n     */\n    function start(code) {\n      // Always populated by defaults.\n\n      // To do: `enter` here or in next state?\n      effects.enter(\"codeFencedFence\");\n      return markdownSpace(code) ? factorySpace(effects, beforeSequenceClose, \"linePrefix\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code) : beforeSequenceClose(code);\n    }\n\n    /**\n     * In closing fence, after optional whitespace, at sequence.\n     *\n     * ```markdown\n     *   | ~~~js\n     *   | alert(1)\n     * > | ~~~\n     *     ^\n     * ```\n     *\n     * @type {State}\n     */\n    function beforeSequenceClose(code) {\n      if (code === marker) {\n        effects.enter(\"codeFencedFenceSequence\");\n        return sequenceClose(code);\n      }\n      return nok(code);\n    }\n\n    /**\n     * In closing fence sequence.\n     *\n     * ```markdown\n     *   | ~~~js\n     *   | alert(1)\n     * > | ~~~\n     *     ^\n     * ```\n     *\n     * @type {State}\n     */\n    function sequenceClose(code) {\n      if (code === marker) {\n        size++;\n        effects.consume(code);\n        return sequenceClose;\n      }\n      if (size >= sizeOpen) {\n        effects.exit(\"codeFencedFenceSequence\");\n        return markdownSpace(code) ? factorySpace(effects, sequenceCloseAfter, \"whitespace\")(code) : sequenceCloseAfter(code);\n      }\n      return nok(code);\n    }\n\n    /**\n     * After closing fence sequence, after optional whitespace.\n     *\n     * ```markdown\n     *   | ~~~js\n     *   | alert(1)\n     * > | ~~~\n     *        ^\n     * ```\n     *\n     * @type {State}\n     */\n    function sequenceCloseAfter(code) {\n      if (code === null || markdownLineEnding(code)) {\n        effects.exit(\"codeFencedFence\");\n        return ok(code);\n      }\n      return nok(code);\n    }\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeNonLazyContinuation(effects, ok, nok) {\n  const self = this;\n  return start;\n\n  /**\n   *\n   *\n   * @type {State}\n   */\n  function start(code) {\n    if (code === null) {\n      return nok(code);\n    }\n    effects.enter(\"lineEnding\");\n    effects.consume(code);\n    effects.exit(\"lineEnding\");\n    return lineStart;\n  }\n\n  /**\n   *\n   *\n   * @type {State}\n   */\n  function lineStart(code) {\n    return self.parser.lazy[self.now().line] ? nok(code) : ok(code);\n  }\n}","/**\n * @import {\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const codeIndented = {\n  name: 'codeIndented',\n  tokenize: tokenizeCodeIndented\n};\n\n/** @type {Construct} */\nconst furtherStart = {\n  partial: true,\n  tokenize: tokenizeFurtherStart\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeCodeIndented(effects, ok, nok) {\n  const self = this;\n  return start;\n\n  /**\n   * Start of code (indented).\n   *\n   * > **Parsing note**: it is not needed to check if this first line is a\n   * > filled line (that it has a non-whitespace character), because blank lines\n   * > are parsed already, so we never run into that.\n   *\n   * ```markdown\n   * > |     aaa\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    // To do: manually check if interrupting like `markdown-rs`.\n\n    effects.enter(\"codeIndented\");\n    // To do: use an improved `space_or_tab` function like `markdown-rs`,\n    // so that we can drop the next state.\n    return factorySpace(effects, afterPrefix, \"linePrefix\", 4 + 1)(code);\n  }\n\n  /**\n   * At start, after 1 or 4 spaces.\n   *\n   * ```markdown\n   * > |     aaa\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function afterPrefix(code) {\n    const tail = self.events[self.events.length - 1];\n    return tail && tail[1].type === \"linePrefix\" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? atBreak(code) : nok(code);\n  }\n\n  /**\n   * At a break.\n   *\n   * ```markdown\n   * > |     aaa\n   *         ^  ^\n   * ```\n   *\n   * @type {State}\n   */\n  function atBreak(code) {\n    if (code === null) {\n      return after(code);\n    }\n    if (markdownLineEnding(code)) {\n      return effects.attempt(furtherStart, atBreak, after)(code);\n    }\n    effects.enter(\"codeFlowValue\");\n    return inside(code);\n  }\n\n  /**\n   * In code content.\n   *\n   * ```markdown\n   * > |     aaa\n   *         ^^^^\n   * ```\n   *\n   * @type {State}\n   */\n  function inside(code) {\n    if (code === null || markdownLineEnding(code)) {\n      effects.exit(\"codeFlowValue\");\n      return atBreak(code);\n    }\n    effects.consume(code);\n    return inside;\n  }\n\n  /** @type {State} */\n  function after(code) {\n    effects.exit(\"codeIndented\");\n    // To do: allow interrupting like `markdown-rs`.\n    // Feel free to interrupt.\n    // tokenizer.interrupt = false\n    return ok(code);\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeFurtherStart(effects, ok, nok) {\n  const self = this;\n  return furtherStart;\n\n  /**\n   * At eol, trying to parse another indent.\n   *\n   * ```markdown\n   * > |     aaa\n   *            ^\n   *   |     bbb\n   * ```\n   *\n   * @type {State}\n   */\n  function furtherStart(code) {\n    // To do: improve `lazy` / `pierce` handling.\n    // If this is a lazy line, it can’t be code.\n    if (self.parser.lazy[self.now().line]) {\n      return nok(code);\n    }\n    if (markdownLineEnding(code)) {\n      effects.enter(\"lineEnding\");\n      effects.consume(code);\n      effects.exit(\"lineEnding\");\n      return furtherStart;\n    }\n\n    // To do: the code here in `micromark-js` is a bit different from\n    // `markdown-rs` because there it can attempt spaces.\n    // We can’t yet.\n    //\n    // To do: use an improved `space_or_tab` function like `markdown-rs`,\n    // so that we can drop the next state.\n    return factorySpace(effects, afterPrefix, \"linePrefix\", 4 + 1)(code);\n  }\n\n  /**\n   * At start, after 1 or 4 spaces.\n   *\n   * ```markdown\n   * > |     aaa\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function afterPrefix(code) {\n    const tail = self.events[self.events.length - 1];\n    return tail && tail[1].type === \"linePrefix\" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? ok(code) : markdownLineEnding(code) ? furtherStart(code) : nok(code);\n  }\n}","/**\n * @import {\n *   Construct,\n *   Previous,\n *   Resolver,\n *   State,\n *   TokenizeContext,\n *   Tokenizer,\n *   Token\n * } from 'micromark-util-types'\n */\n\nimport { markdownLineEnding } from 'micromark-util-character';\n/** @type {Construct} */\nexport const codeText = {\n  name: 'codeText',\n  previous,\n  resolve: resolveCodeText,\n  tokenize: tokenizeCodeText\n};\n\n// To do: next major: don’t resolve, like `markdown-rs`.\n/** @type {Resolver} */\nfunction resolveCodeText(events) {\n  let tailExitIndex = events.length - 4;\n  let headEnterIndex = 3;\n  /** @type {number} */\n  let index;\n  /** @type {number | undefined} */\n  let enter;\n\n  // If we start and end with an EOL or a space.\n  if ((events[headEnterIndex][1].type === \"lineEnding\" || events[headEnterIndex][1].type === 'space') && (events[tailExitIndex][1].type === \"lineEnding\" || events[tailExitIndex][1].type === 'space')) {\n    index = headEnterIndex;\n\n    // And we have data.\n    while (++index < tailExitIndex) {\n      if (events[index][1].type === \"codeTextData\") {\n        // Then we have padding.\n        events[headEnterIndex][1].type = \"codeTextPadding\";\n        events[tailExitIndex][1].type = \"codeTextPadding\";\n        headEnterIndex += 2;\n        tailExitIndex -= 2;\n        break;\n      }\n    }\n  }\n\n  // Merge adjacent spaces and data.\n  index = headEnterIndex - 1;\n  tailExitIndex++;\n  while (++index <= tailExitIndex) {\n    if (enter === undefined) {\n      if (index !== tailExitIndex && events[index][1].type !== \"lineEnding\") {\n        enter = index;\n      }\n    } else if (index === tailExitIndex || events[index][1].type === \"lineEnding\") {\n      events[enter][1].type = \"codeTextData\";\n      if (index !== enter + 2) {\n        events[enter][1].end = events[index - 1][1].end;\n        events.splice(enter + 2, index - enter - 2);\n        tailExitIndex -= index - enter - 2;\n        index = enter + 2;\n      }\n      enter = undefined;\n    }\n  }\n  return events;\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Previous}\n */\nfunction previous(code) {\n  // If there is a previous code, there will always be a tail.\n  return code !== 96 || this.events[this.events.length - 1][1].type === \"characterEscape\";\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeCodeText(effects, ok, nok) {\n  const self = this;\n  let sizeOpen = 0;\n  /** @type {number} */\n  let size;\n  /** @type {Token} */\n  let token;\n  return start;\n\n  /**\n   * Start of code (text).\n   *\n   * ```markdown\n   * > | `a`\n   *     ^\n   * > | \\`a`\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    effects.enter(\"codeText\");\n    effects.enter(\"codeTextSequence\");\n    return sequenceOpen(code);\n  }\n\n  /**\n   * In opening sequence.\n   *\n   * ```markdown\n   * > | `a`\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function sequenceOpen(code) {\n    if (code === 96) {\n      effects.consume(code);\n      sizeOpen++;\n      return sequenceOpen;\n    }\n    effects.exit(\"codeTextSequence\");\n    return between(code);\n  }\n\n  /**\n   * Between something and something else.\n   *\n   * ```markdown\n   * > | `a`\n   *      ^^\n   * ```\n   *\n   * @type {State}\n   */\n  function between(code) {\n    // EOF.\n    if (code === null) {\n      return nok(code);\n    }\n\n    // To do: next major: don’t do spaces in resolve, but when compiling,\n    // like `markdown-rs`.\n    // Tabs don’t work, and virtual spaces don’t make sense.\n    if (code === 32) {\n      effects.enter('space');\n      effects.consume(code);\n      effects.exit('space');\n      return between;\n    }\n\n    // Closing fence? Could also be data.\n    if (code === 96) {\n      token = effects.enter(\"codeTextSequence\");\n      size = 0;\n      return sequenceClose(code);\n    }\n    if (markdownLineEnding(code)) {\n      effects.enter(\"lineEnding\");\n      effects.consume(code);\n      effects.exit(\"lineEnding\");\n      return between;\n    }\n\n    // Data.\n    effects.enter(\"codeTextData\");\n    return data(code);\n  }\n\n  /**\n   * In data.\n   *\n   * ```markdown\n   * > | `a`\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function data(code) {\n    if (code === null || code === 32 || code === 96 || markdownLineEnding(code)) {\n      effects.exit(\"codeTextData\");\n      return between(code);\n    }\n    effects.consume(code);\n    return data;\n  }\n\n  /**\n   * In closing sequence.\n   *\n   * ```markdown\n   * > | `a`\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function sequenceClose(code) {\n    // More.\n    if (code === 96) {\n      effects.consume(code);\n      size++;\n      return sequenceClose;\n    }\n\n    // Done!\n    if (size === sizeOpen) {\n      effects.exit(\"codeTextSequence\");\n      effects.exit(\"codeText\");\n      return ok(code);\n    }\n\n    // More or less accents: mark as data.\n    token.type = \"codeTextData\";\n    return data(code);\n  }\n}","/**\n * Some of the internal operations of micromark do lots of editing\n * operations on very large arrays. This runs into problems with two\n * properties of most circa-2020 JavaScript interpreters:\n *\n *  - Array-length modifications at the high end of an array (push/pop) are\n *    expected to be common and are implemented in (amortized) time\n *    proportional to the number of elements added or removed, whereas\n *    other operations (shift/unshift and splice) are much less efficient.\n *  - Function arguments are passed on the stack, so adding tens of thousands\n *    of elements to an array with `arr.push(...newElements)` will frequently\n *    cause stack overflows. (see <https://stackoverflow.com/questions/22123769/rangeerror-maximum-call-stack-size-exceeded-why>)\n *\n * SpliceBuffers are an implementation of gap buffers, which are a\n * generalization of the \"queue made of two stacks\" idea. The splice buffer\n * maintains a cursor, and moving the cursor has cost proportional to the\n * distance the cursor moves, but inserting, deleting, or splicing in\n * new information at the cursor is as efficient as the push/pop operation.\n * This allows for an efficient sequence of splices (or pushes, pops, shifts,\n * or unshifts) as long such edits happen at the same part of the array or\n * generally sweep through the array from the beginning to the end.\n *\n * The interface for splice buffers also supports large numbers of inputs by\n * passing a single array argument rather passing multiple arguments on the\n * function call stack.\n *\n * @template T\n *   Item type.\n */\nexport class SpliceBuffer {\n  /**\n   * @param {ReadonlyArray<T> | null | undefined} [initial]\n   *   Initial items (optional).\n   * @returns\n   *   Splice buffer.\n   */\n  constructor(initial) {\n    /** @type {Array<T>} */\n    this.left = initial ? [...initial] : [];\n    /** @type {Array<T>} */\n    this.right = [];\n  }\n\n  /**\n   * Array access;\n   * does not move the cursor.\n   *\n   * @param {number} index\n   *   Index.\n   * @return {T}\n   *   Item.\n   */\n  get(index) {\n    if (index < 0 || index >= this.left.length + this.right.length) {\n      throw new RangeError('Cannot access index `' + index + '` in a splice buffer of size `' + (this.left.length + this.right.length) + '`');\n    }\n    if (index < this.left.length) return this.left[index];\n    return this.right[this.right.length - index + this.left.length - 1];\n  }\n\n  /**\n   * The length of the splice buffer, one greater than the largest index in the\n   * array.\n   */\n  get length() {\n    return this.left.length + this.right.length;\n  }\n\n  /**\n   * Remove and return `list[0]`;\n   * moves the cursor to `0`.\n   *\n   * @returns {T | undefined}\n   *   Item, optional.\n   */\n  shift() {\n    this.setCursor(0);\n    return this.right.pop();\n  }\n\n  /**\n   * Slice the buffer to get an array;\n   * does not move the cursor.\n   *\n   * @param {number} start\n   *   Start.\n   * @param {number | null | undefined} [end]\n   *   End (optional).\n   * @returns {Array<T>}\n   *   Array of items.\n   */\n  slice(start, end) {\n    /** @type {number} */\n    const stop = end === null || end === undefined ? Number.POSITIVE_INFINITY : end;\n    if (stop < this.left.length) {\n      return this.left.slice(start, stop);\n    }\n    if (start > this.left.length) {\n      return this.right.slice(this.right.length - stop + this.left.length, this.right.length - start + this.left.length).reverse();\n    }\n    return this.left.slice(start).concat(this.right.slice(this.right.length - stop + this.left.length).reverse());\n  }\n\n  /**\n   * Mimics the behavior of Array.prototype.splice() except for the change of\n   * interface necessary to avoid segfaults when patching in very large arrays.\n   *\n   * This operation moves cursor is moved to `start` and results in the cursor\n   * placed after any inserted items.\n   *\n   * @param {number} start\n   *   Start;\n   *   zero-based index at which to start changing the array;\n   *   negative numbers count backwards from the end of the array and values\n   *   that are out-of bounds are clamped to the appropriate end of the array.\n   * @param {number | null | undefined} [deleteCount=0]\n   *   Delete count (default: `0`);\n   *   maximum number of elements to delete, starting from start.\n   * @param {Array<T> | null | undefined} [items=[]]\n   *   Items to include in place of the deleted items (default: `[]`).\n   * @return {Array<T>}\n   *   Any removed items.\n   */\n  splice(start, deleteCount, items) {\n    /** @type {number} */\n    const count = deleteCount || 0;\n    this.setCursor(Math.trunc(start));\n    const removed = this.right.splice(this.right.length - count, Number.POSITIVE_INFINITY);\n    if (items) chunkedPush(this.left, items);\n    return removed.reverse();\n  }\n\n  /**\n   * Remove and return the highest-numbered item in the array, so\n   * `list[list.length - 1]`;\n   * Moves the cursor to `length`.\n   *\n   * @returns {T | undefined}\n   *   Item, optional.\n   */\n  pop() {\n    this.setCursor(Number.POSITIVE_INFINITY);\n    return this.left.pop();\n  }\n\n  /**\n   * Inserts a single item to the high-numbered side of the array;\n   * moves the cursor to `length`.\n   *\n   * @param {T} item\n   *   Item.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  push(item) {\n    this.setCursor(Number.POSITIVE_INFINITY);\n    this.left.push(item);\n  }\n\n  /**\n   * Inserts many items to the high-numbered side of the array.\n   * Moves the cursor to `length`.\n   *\n   * @param {Array<T>} items\n   *   Items.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  pushMany(items) {\n    this.setCursor(Number.POSITIVE_INFINITY);\n    chunkedPush(this.left, items);\n  }\n\n  /**\n   * Inserts a single item to the low-numbered side of the array;\n   * Moves the cursor to `0`.\n   *\n   * @param {T} item\n   *   Item.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  unshift(item) {\n    this.setCursor(0);\n    this.right.push(item);\n  }\n\n  /**\n   * Inserts many items to the low-numbered side of the array;\n   * moves the cursor to `0`.\n   *\n   * @param {Array<T>} items\n   *   Items.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  unshiftMany(items) {\n    this.setCursor(0);\n    chunkedPush(this.right, items.reverse());\n  }\n\n  /**\n   * Move the cursor to a specific position in the array. Requires\n   * time proportional to the distance moved.\n   *\n   * If `n < 0`, the cursor will end up at the beginning.\n   * If `n > length`, the cursor will end up at the end.\n   *\n   * @param {number} n\n   *   Position.\n   * @return {undefined}\n   *   Nothing.\n   */\n  setCursor(n) {\n    if (n === this.left.length || n > this.left.length && this.right.length === 0 || n < 0 && this.left.length === 0) return;\n    if (n < this.left.length) {\n      // Move cursor to the this.left\n      const removed = this.left.splice(n, Number.POSITIVE_INFINITY);\n      chunkedPush(this.right, removed.reverse());\n    } else {\n      // Move cursor to the this.right\n      const removed = this.right.splice(this.left.length + this.right.length - n, Number.POSITIVE_INFINITY);\n      chunkedPush(this.left, removed.reverse());\n    }\n  }\n}\n\n/**\n * Avoid stack overflow by pushing items onto the stack in segments\n *\n * @template T\n *   Item type.\n * @param {Array<T>} list\n *   List to inject into.\n * @param {ReadonlyArray<T>} right\n *   Items to inject.\n * @return {undefined}\n *   Nothing.\n */\nfunction chunkedPush(list, right) {\n  /** @type {number} */\n  let chunkStart = 0;\n  if (right.length < 10000) {\n    list.push(...right);\n  } else {\n    while (chunkStart < right.length) {\n      list.push(...right.slice(chunkStart, chunkStart + 10000));\n      chunkStart += 10000;\n    }\n  }\n}","/**\n * @import {Chunk, Event, Token} from 'micromark-util-types'\n */\n\nimport { splice } from 'micromark-util-chunked';\nimport { SpliceBuffer } from './lib/splice-buffer.js';\n\n// Hidden API exposed for testing.\nexport { SpliceBuffer } from './lib/splice-buffer.js';\n\n/**\n * Tokenize subcontent.\n *\n * @param {Array<Event>} eventsArray\n *   List of events.\n * @returns {boolean}\n *   Whether subtokens were found.\n */\n// eslint-disable-next-line complexity\nexport function subtokenize(eventsArray) {\n  /** @type {Record<string, number>} */\n  const jumps = {};\n  let index = -1;\n  /** @type {Event} */\n  let event;\n  /** @type {number | undefined} */\n  let lineIndex;\n  /** @type {number} */\n  let otherIndex;\n  /** @type {Event} */\n  let otherEvent;\n  /** @type {Array<Event>} */\n  let parameters;\n  /** @type {Array<Event>} */\n  let subevents;\n  /** @type {boolean | undefined} */\n  let more;\n  const events = new SpliceBuffer(eventsArray);\n  while (++index < events.length) {\n    while (index in jumps) {\n      index = jumps[index];\n    }\n    event = events.get(index);\n\n    // Add a hook for the GFM tasklist extension, which needs to know if text\n    // is in the first content of a list item.\n    if (index && event[1].type === \"chunkFlow\" && events.get(index - 1)[1].type === \"listItemPrefix\") {\n      subevents = event[1]._tokenizer.events;\n      otherIndex = 0;\n      if (otherIndex < subevents.length && subevents[otherIndex][1].type === \"lineEndingBlank\") {\n        otherIndex += 2;\n      }\n      if (otherIndex < subevents.length && subevents[otherIndex][1].type === \"content\") {\n        while (++otherIndex < subevents.length) {\n          if (subevents[otherIndex][1].type === \"content\") {\n            break;\n          }\n          if (subevents[otherIndex][1].type === \"chunkText\") {\n            subevents[otherIndex][1]._isInFirstContentOfListItem = true;\n            otherIndex++;\n          }\n        }\n      }\n    }\n\n    // Enter.\n    if (event[0] === 'enter') {\n      if (event[1].contentType) {\n        Object.assign(jumps, subcontent(events, index));\n        index = jumps[index];\n        more = true;\n      }\n    }\n    // Exit.\n    else if (event[1]._container) {\n      otherIndex = index;\n      lineIndex = undefined;\n      while (otherIndex--) {\n        otherEvent = events.get(otherIndex);\n        if (otherEvent[1].type === \"lineEnding\" || otherEvent[1].type === \"lineEndingBlank\") {\n          if (otherEvent[0] === 'enter') {\n            if (lineIndex) {\n              events.get(lineIndex)[1].type = \"lineEndingBlank\";\n            }\n            otherEvent[1].type = \"lineEnding\";\n            lineIndex = otherIndex;\n          }\n        } else if (otherEvent[1].type === \"linePrefix\" || otherEvent[1].type === \"listItemIndent\") {\n          // Move past.\n        } else {\n          break;\n        }\n      }\n      if (lineIndex) {\n        // Fix position.\n        event[1].end = {\n          ...events.get(lineIndex)[1].start\n        };\n\n        // Switch container exit w/ line endings.\n        parameters = events.slice(lineIndex, index);\n        parameters.unshift(event);\n        events.splice(lineIndex, index - lineIndex + 1, parameters);\n      }\n    }\n  }\n\n  // The changes to the `events` buffer must be copied back into the eventsArray\n  splice(eventsArray, 0, Number.POSITIVE_INFINITY, events.slice(0));\n  return !more;\n}\n\n/**\n * Tokenize embedded tokens.\n *\n * @param {SpliceBuffer<Event>} events\n *   Events.\n * @param {number} eventIndex\n *   Index.\n * @returns {Record<string, number>}\n *   Gaps.\n */\nfunction subcontent(events, eventIndex) {\n  const token = events.get(eventIndex)[1];\n  const context = events.get(eventIndex)[2];\n  let startPosition = eventIndex - 1;\n  /** @type {Array<number>} */\n  const startPositions = [];\n  let tokenizer = token._tokenizer;\n  if (!tokenizer) {\n    tokenizer = context.parser[token.contentType](token.start);\n    if (token._contentTypeTextTrailing) {\n      tokenizer._contentTypeTextTrailing = true;\n    }\n  }\n  const childEvents = tokenizer.events;\n  /** @type {Array<[number, number]>} */\n  const jumps = [];\n  /** @type {Record<string, number>} */\n  const gaps = {};\n  /** @type {Array<Chunk>} */\n  let stream;\n  /** @type {Token | undefined} */\n  let previous;\n  let index = -1;\n  /** @type {Token | undefined} */\n  let current = token;\n  let adjust = 0;\n  let start = 0;\n  const breaks = [start];\n\n  // Loop forward through the linked tokens to pass them in order to the\n  // subtokenizer.\n  while (current) {\n    // Find the position of the event for this token.\n    while (events.get(++startPosition)[1] !== current) {\n      // Empty.\n    }\n    startPositions.push(startPosition);\n    if (!current._tokenizer) {\n      stream = context.sliceStream(current);\n      if (!current.next) {\n        stream.push(null);\n      }\n      if (previous) {\n        tokenizer.defineSkip(current.start);\n      }\n      if (current._isInFirstContentOfListItem) {\n        tokenizer._gfmTasklistFirstContentOfListItem = true;\n      }\n      tokenizer.write(stream);\n      if (current._isInFirstContentOfListItem) {\n        tokenizer._gfmTasklistFirstContentOfListItem = undefined;\n      }\n    }\n\n    // Unravel the next token.\n    previous = current;\n    current = current.next;\n  }\n\n  // Now, loop back through all events (and linked tokens), to figure out which\n  // parts belong where.\n  current = token;\n  while (++index < childEvents.length) {\n    if (\n    // Find a void token that includes a break.\n    childEvents[index][0] === 'exit' && childEvents[index - 1][0] === 'enter' && childEvents[index][1].type === childEvents[index - 1][1].type && childEvents[index][1].start.line !== childEvents[index][1].end.line) {\n      start = index + 1;\n      breaks.push(start);\n      // Help GC.\n      current._tokenizer = undefined;\n      current.previous = undefined;\n      current = current.next;\n    }\n  }\n\n  // Help GC.\n  tokenizer.events = [];\n\n  // If there’s one more token (which is the cases for lines that end in an\n  // EOF), that’s perfect: the last point we found starts it.\n  // If there isn’t then make sure any remaining content is added to it.\n  if (current) {\n    // Help GC.\n    current._tokenizer = undefined;\n    current.previous = undefined;\n  } else {\n    breaks.pop();\n  }\n\n  // Now splice the events from the subtokenizer into the current events,\n  // moving back to front so that splice indices aren’t affected.\n  index = breaks.length;\n  while (index--) {\n    const slice = childEvents.slice(breaks[index], breaks[index + 1]);\n    const start = startPositions.pop();\n    jumps.push([start, start + slice.length - 1]);\n    events.splice(start, 2, slice);\n  }\n  jumps.reverse();\n  index = -1;\n  while (++index < jumps.length) {\n    gaps[adjust + jumps[index][0]] = adjust + jumps[index][1];\n    adjust += jumps[index][1] - jumps[index][0] - 1;\n  }\n  return gaps;\n}","/**\n * @import {\n *   Construct,\n *   Resolver,\n *   State,\n *   TokenizeContext,\n *   Tokenizer,\n *   Token\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding } from 'micromark-util-character';\nimport { subtokenize } from 'micromark-util-subtokenize';\n/**\n * No name because it must not be turned off.\n * @type {Construct}\n */\nexport const content = {\n  resolve: resolveContent,\n  tokenize: tokenizeContent\n};\n\n/** @type {Construct} */\nconst continuationConstruct = {\n  partial: true,\n  tokenize: tokenizeContinuation\n};\n\n/**\n * Content is transparent: it’s parsed right now. That way, definitions are also\n * parsed right now: before text in paragraphs (specifically, media) are parsed.\n *\n * @type {Resolver}\n */\nfunction resolveContent(events) {\n  subtokenize(events);\n  return events;\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeContent(effects, ok) {\n  /** @type {Token | undefined} */\n  let previous;\n  return chunkStart;\n\n  /**\n   * Before a content chunk.\n   *\n   * ```markdown\n   * > | abc\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function chunkStart(code) {\n    effects.enter(\"content\");\n    previous = effects.enter(\"chunkContent\", {\n      contentType: \"content\"\n    });\n    return chunkInside(code);\n  }\n\n  /**\n   * In a content chunk.\n   *\n   * ```markdown\n   * > | abc\n   *     ^^^\n   * ```\n   *\n   * @type {State}\n   */\n  function chunkInside(code) {\n    if (code === null) {\n      return contentEnd(code);\n    }\n\n    // To do: in `markdown-rs`, each line is parsed on its own, and everything\n    // is stitched together resolving.\n    if (markdownLineEnding(code)) {\n      return effects.check(continuationConstruct, contentContinue, contentEnd)(code);\n    }\n\n    // Data.\n    effects.consume(code);\n    return chunkInside;\n  }\n\n  /**\n   *\n   *\n   * @type {State}\n   */\n  function contentEnd(code) {\n    effects.exit(\"chunkContent\");\n    effects.exit(\"content\");\n    return ok(code);\n  }\n\n  /**\n   *\n   *\n   * @type {State}\n   */\n  function contentContinue(code) {\n    effects.consume(code);\n    effects.exit(\"chunkContent\");\n    previous.next = effects.enter(\"chunkContent\", {\n      contentType: \"content\",\n      previous\n    });\n    previous = previous.next;\n    return chunkInside;\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeContinuation(effects, ok, nok) {\n  const self = this;\n  return startLookahead;\n\n  /**\n   *\n   *\n   * @type {State}\n   */\n  function startLookahead(code) {\n    effects.exit(\"chunkContent\");\n    effects.enter(\"lineEnding\");\n    effects.consume(code);\n    effects.exit(\"lineEnding\");\n    return factorySpace(effects, prefixed, \"linePrefix\");\n  }\n\n  /**\n   *\n   *\n   * @type {State}\n   */\n  function prefixed(code) {\n    if (code === null || markdownLineEnding(code)) {\n      return nok(code);\n    }\n\n    // Always populated by defaults.\n\n    const tail = self.events[self.events.length - 1];\n    if (!self.parser.constructs.disable.null.includes('codeIndented') && tail && tail[1].type === \"linePrefix\" && tail[2].sliceSerialize(tail[1], true).length >= 4) {\n      return ok(code);\n    }\n    return effects.interrupt(self.parser.constructs.flow, nok, ok)(code);\n  }\n}","/**\n * @import {Effects, State, TokenType} from 'micromark-util-types'\n */\n\nimport { asciiControl, markdownLineEndingOrSpace, markdownLineEnding } from 'micromark-util-character';\n/**\n * Parse destinations.\n *\n * ###### Examples\n *\n * ```markdown\n * <a>\n * <a\\>b>\n * <a b>\n * <a)>\n * a\n * a\\)b\n * a(b)c\n * a(b)\n * ```\n *\n * @param {Effects} effects\n *   Context.\n * @param {State} ok\n *   State switched to when successful.\n * @param {State} nok\n *   State switched to when unsuccessful.\n * @param {TokenType} type\n *   Type for whole (`<a>` or `b`).\n * @param {TokenType} literalType\n *   Type when enclosed (`<a>`).\n * @param {TokenType} literalMarkerType\n *   Type for enclosing (`<` and `>`).\n * @param {TokenType} rawType\n *   Type when not enclosed (`b`).\n * @param {TokenType} stringType\n *   Type for the value (`a` or `b`).\n * @param {number | undefined} [max=Infinity]\n *   Depth of nested parens (inclusive).\n * @returns {State}\n *   Start state.\n */\nexport function factoryDestination(effects, ok, nok, type, literalType, literalMarkerType, rawType, stringType, max) {\n  const limit = max || Number.POSITIVE_INFINITY;\n  let balance = 0;\n  return start;\n\n  /**\n   * Start of destination.\n   *\n   * ```markdown\n   * > | <aa>\n   *     ^\n   * > | aa\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    if (code === 60) {\n      effects.enter(type);\n      effects.enter(literalType);\n      effects.enter(literalMarkerType);\n      effects.consume(code);\n      effects.exit(literalMarkerType);\n      return enclosedBefore;\n    }\n\n    // ASCII control, space, closing paren.\n    if (code === null || code === 32 || code === 41 || asciiControl(code)) {\n      return nok(code);\n    }\n    effects.enter(type);\n    effects.enter(rawType);\n    effects.enter(stringType);\n    effects.enter(\"chunkString\", {\n      contentType: \"string\"\n    });\n    return raw(code);\n  }\n\n  /**\n   * After `<`, at an enclosed destination.\n   *\n   * ```markdown\n   * > | <aa>\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function enclosedBefore(code) {\n    if (code === 62) {\n      effects.enter(literalMarkerType);\n      effects.consume(code);\n      effects.exit(literalMarkerType);\n      effects.exit(literalType);\n      effects.exit(type);\n      return ok;\n    }\n    effects.enter(stringType);\n    effects.enter(\"chunkString\", {\n      contentType: \"string\"\n    });\n    return enclosed(code);\n  }\n\n  /**\n   * In enclosed destination.\n   *\n   * ```markdown\n   * > | <aa>\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function enclosed(code) {\n    if (code === 62) {\n      effects.exit(\"chunkString\");\n      effects.exit(stringType);\n      return enclosedBefore(code);\n    }\n    if (code === null || code === 60 || markdownLineEnding(code)) {\n      return nok(code);\n    }\n    effects.consume(code);\n    return code === 92 ? enclosedEscape : enclosed;\n  }\n\n  /**\n   * After `\\`, at a special character.\n   *\n   * ```markdown\n   * > | <a\\*a>\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function enclosedEscape(code) {\n    if (code === 60 || code === 62 || code === 92) {\n      effects.consume(code);\n      return enclosed;\n    }\n    return enclosed(code);\n  }\n\n  /**\n   * In raw destination.\n   *\n   * ```markdown\n   * > | aa\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function raw(code) {\n    if (!balance && (code === null || code === 41 || markdownLineEndingOrSpace(code))) {\n      effects.exit(\"chunkString\");\n      effects.exit(stringType);\n      effects.exit(rawType);\n      effects.exit(type);\n      return ok(code);\n    }\n    if (balance < limit && code === 40) {\n      effects.consume(code);\n      balance++;\n      return raw;\n    }\n    if (code === 41) {\n      effects.consume(code);\n      balance--;\n      return raw;\n    }\n\n    // ASCII control (but *not* `\\0`) and space and `(`.\n    // Note: in `markdown-rs`, `\\0` exists in codes, in `micromark-js` it\n    // doesn’t.\n    if (code === null || code === 32 || code === 40 || asciiControl(code)) {\n      return nok(code);\n    }\n    effects.consume(code);\n    return code === 92 ? rawEscape : raw;\n  }\n\n  /**\n   * After `\\`, at special character.\n   *\n   * ```markdown\n   * > | a\\*a\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function rawEscape(code) {\n    if (code === 40 || code === 41 || code === 92) {\n      effects.consume(code);\n      return raw;\n    }\n    return raw(code);\n  }\n}","/**\n * @import {\n *   Effects,\n *   State,\n *   TokenizeContext,\n *   TokenType\n * } from 'micromark-util-types'\n */\n\nimport { markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/**\n * Parse labels.\n *\n * > 👉 **Note**: labels in markdown are capped at 999 characters in the string.\n *\n * ###### Examples\n *\n * ```markdown\n * [a]\n * [a\n * b]\n * [a\\]b]\n * ```\n *\n * @this {TokenizeContext}\n *   Tokenize context.\n * @param {Effects} effects\n *   Context.\n * @param {State} ok\n *   State switched to when successful.\n * @param {State} nok\n *   State switched to when unsuccessful.\n * @param {TokenType} type\n *   Type of the whole label (`[a]`).\n * @param {TokenType} markerType\n *   Type for the markers (`[` and `]`).\n * @param {TokenType} stringType\n *   Type for the identifier (`a`).\n * @returns {State}\n *   Start state.\n */\nexport function factoryLabel(effects, ok, nok, type, markerType, stringType) {\n  const self = this;\n  let size = 0;\n  /** @type {boolean} */\n  let seen;\n  return start;\n\n  /**\n   * Start of label.\n   *\n   * ```markdown\n   * > | [a]\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    effects.enter(type);\n    effects.enter(markerType);\n    effects.consume(code);\n    effects.exit(markerType);\n    effects.enter(stringType);\n    return atBreak;\n  }\n\n  /**\n   * In label, at something, before something else.\n   *\n   * ```markdown\n   * > | [a]\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function atBreak(code) {\n    if (size > 999 || code === null || code === 91 || code === 93 && !seen ||\n    // To do: remove in the future once we’ve switched from\n    // `micromark-extension-footnote` to `micromark-extension-gfm-footnote`,\n    // which doesn’t need this.\n    // Hidden footnotes hook.\n    /* c8 ignore next 3 */\n    code === 94 && !size && '_hiddenFootnoteSupport' in self.parser.constructs) {\n      return nok(code);\n    }\n    if (code === 93) {\n      effects.exit(stringType);\n      effects.enter(markerType);\n      effects.consume(code);\n      effects.exit(markerType);\n      effects.exit(type);\n      return ok;\n    }\n\n    // To do: indent? Link chunks and EOLs together?\n    if (markdownLineEnding(code)) {\n      effects.enter(\"lineEnding\");\n      effects.consume(code);\n      effects.exit(\"lineEnding\");\n      return atBreak;\n    }\n    effects.enter(\"chunkString\", {\n      contentType: \"string\"\n    });\n    return labelInside(code);\n  }\n\n  /**\n   * In label, in text.\n   *\n   * ```markdown\n   * > | [a]\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function labelInside(code) {\n    if (code === null || code === 91 || code === 93 || markdownLineEnding(code) || size++ > 999) {\n      effects.exit(\"chunkString\");\n      return atBreak(code);\n    }\n    effects.consume(code);\n    if (!seen) seen = !markdownSpace(code);\n    return code === 92 ? labelEscape : labelInside;\n  }\n\n  /**\n   * After `\\`, at a special character.\n   *\n   * ```markdown\n   * > | [a\\*a]\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function labelEscape(code) {\n    if (code === 91 || code === 92 || code === 93) {\n      effects.consume(code);\n      size++;\n      return labelInside;\n    }\n    return labelInside(code);\n  }\n}","/**\n * @import {\n *   Code,\n *   Effects,\n *   State,\n *   TokenType\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding } from 'micromark-util-character';\n/**\n * Parse titles.\n *\n * ###### Examples\n *\n * ```markdown\n * \"a\"\n * 'b'\n * (c)\n * \"a\n * b\"\n * 'a\n *     b'\n * (a\\)b)\n * ```\n *\n * @param {Effects} effects\n *   Context.\n * @param {State} ok\n *   State switched to when successful.\n * @param {State} nok\n *   State switched to when unsuccessful.\n * @param {TokenType} type\n *   Type of the whole title (`\"a\"`, `'b'`, `(c)`).\n * @param {TokenType} markerType\n *   Type for the markers (`\"`, `'`, `(`, and `)`).\n * @param {TokenType} stringType\n *   Type for the value (`a`).\n * @returns {State}\n *   Start state.\n */\nexport function factoryTitle(effects, ok, nok, type, markerType, stringType) {\n  /** @type {NonNullable<Code>} */\n  let marker;\n  return start;\n\n  /**\n   * Start of title.\n   *\n   * ```markdown\n   * > | \"a\"\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    if (code === 34 || code === 39 || code === 40) {\n      effects.enter(type);\n      effects.enter(markerType);\n      effects.consume(code);\n      effects.exit(markerType);\n      marker = code === 40 ? 41 : code;\n      return begin;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After opening marker.\n   *\n   * This is also used at the closing marker.\n   *\n   * ```markdown\n   * > | \"a\"\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function begin(code) {\n    if (code === marker) {\n      effects.enter(markerType);\n      effects.consume(code);\n      effects.exit(markerType);\n      effects.exit(type);\n      return ok;\n    }\n    effects.enter(stringType);\n    return atBreak(code);\n  }\n\n  /**\n   * At something, before something else.\n   *\n   * ```markdown\n   * > | \"a\"\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function atBreak(code) {\n    if (code === marker) {\n      effects.exit(stringType);\n      return begin(marker);\n    }\n    if (code === null) {\n      return nok(code);\n    }\n\n    // Note: blank lines can’t exist in content.\n    if (markdownLineEnding(code)) {\n      // To do: use `space_or_tab_eol_with_options`, connect.\n      effects.enter(\"lineEnding\");\n      effects.consume(code);\n      effects.exit(\"lineEnding\");\n      return factorySpace(effects, atBreak, \"linePrefix\");\n    }\n    effects.enter(\"chunkString\", {\n      contentType: \"string\"\n    });\n    return inside(code);\n  }\n\n  /**\n   *\n   *\n   * @type {State}\n   */\n  function inside(code) {\n    if (code === marker || code === null || markdownLineEnding(code)) {\n      effects.exit(\"chunkString\");\n      return atBreak(code);\n    }\n    effects.consume(code);\n    return code === 92 ? escape : inside;\n  }\n\n  /**\n   * After `\\`, at a special character.\n   *\n   * ```markdown\n   * > | \"a\\*b\"\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function escape(code) {\n    if (code === marker || code === 92) {\n      effects.consume(code);\n      return inside;\n    }\n    return inside(code);\n  }\n}","/**\n * @import {Effects, State} from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/**\n * Parse spaces and tabs.\n *\n * There is no `nok` parameter:\n *\n * *   line endings or spaces in markdown are often optional, in which case this\n *     factory can be used and `ok` will be switched to whether spaces were found\n *     or not\n * *   one line ending or space can be detected with\n *     `markdownLineEndingOrSpace(code)` right before using `factoryWhitespace`\n *\n * @param {Effects} effects\n *   Context.\n * @param {State} ok\n *   State switched to when successful.\n * @returns {State}\n *   Start state.\n */\nexport function factoryWhitespace(effects, ok) {\n  /** @type {boolean} */\n  let seen;\n  return start;\n\n  /** @type {State} */\n  function start(code) {\n    if (markdownLineEnding(code)) {\n      effects.enter(\"lineEnding\");\n      effects.consume(code);\n      effects.exit(\"lineEnding\");\n      seen = true;\n      return start;\n    }\n    if (markdownSpace(code)) {\n      return factorySpace(effects, start, seen ? \"linePrefix\" : \"lineSuffix\")(code);\n    }\n    return ok(code);\n  }\n}","/**\n * @import {\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factoryDestination } from 'micromark-factory-destination';\nimport { factoryLabel } from 'micromark-factory-label';\nimport { factorySpace } from 'micromark-factory-space';\nimport { factoryTitle } from 'micromark-factory-title';\nimport { factoryWhitespace } from 'micromark-factory-whitespace';\nimport { markdownLineEndingOrSpace, markdownLineEnding, markdownSpace } from 'micromark-util-character';\nimport { normalizeIdentifier } from 'micromark-util-normalize-identifier';\n/** @type {Construct} */\nexport const definition = {\n  name: 'definition',\n  tokenize: tokenizeDefinition\n};\n\n/** @type {Construct} */\nconst titleBefore = {\n  partial: true,\n  tokenize: tokenizeTitleBefore\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeDefinition(effects, ok, nok) {\n  const self = this;\n  /** @type {string} */\n  let identifier;\n  return start;\n\n  /**\n   * At start of a definition.\n   *\n   * ```markdown\n   * > | [a]: b \"c\"\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    // Do not interrupt paragraphs (but do follow definitions).\n    // To do: do `interrupt` the way `markdown-rs` does.\n    // To do: parse whitespace the way `markdown-rs` does.\n    effects.enter(\"definition\");\n    return before(code);\n  }\n\n  /**\n   * After optional whitespace, at `[`.\n   *\n   * ```markdown\n   * > | [a]: b \"c\"\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function before(code) {\n    // To do: parse whitespace the way `markdown-rs` does.\n\n    return factoryLabel.call(self, effects, labelAfter,\n    // Note: we don’t need to reset the way `markdown-rs` does.\n    nok, \"definitionLabel\", \"definitionLabelMarker\", \"definitionLabelString\")(code);\n  }\n\n  /**\n   * After label.\n   *\n   * ```markdown\n   * > | [a]: b \"c\"\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function labelAfter(code) {\n    identifier = normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1));\n    if (code === 58) {\n      effects.enter(\"definitionMarker\");\n      effects.consume(code);\n      effects.exit(\"definitionMarker\");\n      return markerAfter;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After marker.\n   *\n   * ```markdown\n   * > | [a]: b \"c\"\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function markerAfter(code) {\n    // Note: whitespace is optional.\n    return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, destinationBefore)(code) : destinationBefore(code);\n  }\n\n  /**\n   * Before destination.\n   *\n   * ```markdown\n   * > | [a]: b \"c\"\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function destinationBefore(code) {\n    return factoryDestination(effects, destinationAfter,\n    // Note: we don’t need to reset the way `markdown-rs` does.\n    nok, \"definitionDestination\", \"definitionDestinationLiteral\", \"definitionDestinationLiteralMarker\", \"definitionDestinationRaw\", \"definitionDestinationString\")(code);\n  }\n\n  /**\n   * After destination.\n   *\n   * ```markdown\n   * > | [a]: b \"c\"\n   *           ^\n   * ```\n   *\n   * @type {State}\n   */\n  function destinationAfter(code) {\n    return effects.attempt(titleBefore, after, after)(code);\n  }\n\n  /**\n   * After definition.\n   *\n   * ```markdown\n   * > | [a]: b\n   *           ^\n   * > | [a]: b \"c\"\n   *               ^\n   * ```\n   *\n   * @type {State}\n   */\n  function after(code) {\n    return markdownSpace(code) ? factorySpace(effects, afterWhitespace, \"whitespace\")(code) : afterWhitespace(code);\n  }\n\n  /**\n   * After definition, after optional whitespace.\n   *\n   * ```markdown\n   * > | [a]: b\n   *           ^\n   * > | [a]: b \"c\"\n   *               ^\n   * ```\n   *\n   * @type {State}\n   */\n  function afterWhitespace(code) {\n    if (code === null || markdownLineEnding(code)) {\n      effects.exit(\"definition\");\n\n      // Note: we don’t care about uniqueness.\n      // It’s likely that that doesn’t happen very frequently.\n      // It is more likely that it wastes precious time.\n      self.parser.defined.push(identifier);\n\n      // To do: `markdown-rs` interrupt.\n      // // You’d be interrupting.\n      // tokenizer.interrupt = true\n      return ok(code);\n    }\n    return nok(code);\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeTitleBefore(effects, ok, nok) {\n  return titleBefore;\n\n  /**\n   * After destination, at whitespace.\n   *\n   * ```markdown\n   * > | [a]: b\n   *           ^\n   * > | [a]: b \"c\"\n   *           ^\n   * ```\n   *\n   * @type {State}\n   */\n  function titleBefore(code) {\n    return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, beforeMarker)(code) : nok(code);\n  }\n\n  /**\n   * At title.\n   *\n   * ```markdown\n   *   | [a]: b\n   * > | \"c\"\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function beforeMarker(code) {\n    return factoryTitle(effects, titleAfter, nok, \"definitionTitle\", \"definitionTitleMarker\", \"definitionTitleString\")(code);\n  }\n\n  /**\n   * After title.\n   *\n   * ```markdown\n   * > | [a]: b \"c\"\n   *               ^\n   * ```\n   *\n   * @type {State}\n   */\n  function titleAfter(code) {\n    return markdownSpace(code) ? factorySpace(effects, titleAfterOptionalWhitespace, \"whitespace\")(code) : titleAfterOptionalWhitespace(code);\n  }\n\n  /**\n   * After title, after optional whitespace.\n   *\n   * ```markdown\n   * > | [a]: b \"c\"\n   *               ^\n   * ```\n   *\n   * @type {State}\n   */\n  function titleAfterOptionalWhitespace(code) {\n    return code === null || markdownLineEnding(code) ? ok(code) : nok(code);\n  }\n}","/**\n * @import {\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { markdownLineEnding } from 'micromark-util-character';\n/** @type {Construct} */\nexport const hardBreakEscape = {\n  name: 'hardBreakEscape',\n  tokenize: tokenizeHardBreakEscape\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeHardBreakEscape(effects, ok, nok) {\n  return start;\n\n  /**\n   * Start of a hard break (escape).\n   *\n   * ```markdown\n   * > | a\\\n   *      ^\n   *   | b\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    effects.enter(\"hardBreakEscape\");\n    effects.consume(code);\n    return after;\n  }\n\n  /**\n   * After `\\`, at eol.\n   *\n   * ```markdown\n   * > | a\\\n   *       ^\n   *   | b\n   * ```\n   *\n   *  @type {State}\n   */\n  function after(code) {\n    if (markdownLineEnding(code)) {\n      effects.exit(\"hardBreakEscape\");\n      return ok(code);\n    }\n    return nok(code);\n  }\n}","/**\n * @import {\n *   Construct,\n *   Resolver,\n *   State,\n *   TokenizeContext,\n *   Tokenizer,\n *   Token\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEndingOrSpace, markdownLineEnding, markdownSpace } from 'micromark-util-character';\nimport { splice } from 'micromark-util-chunked';\n/** @type {Construct} */\nexport const headingAtx = {\n  name: 'headingAtx',\n  resolve: resolveHeadingAtx,\n  tokenize: tokenizeHeadingAtx\n};\n\n/** @type {Resolver} */\nfunction resolveHeadingAtx(events, context) {\n  let contentEnd = events.length - 2;\n  let contentStart = 3;\n  /** @type {Token} */\n  let content;\n  /** @type {Token} */\n  let text;\n\n  // Prefix whitespace, part of the opening.\n  if (events[contentStart][1].type === \"whitespace\") {\n    contentStart += 2;\n  }\n\n  // Suffix whitespace, part of the closing.\n  if (contentEnd - 2 > contentStart && events[contentEnd][1].type === \"whitespace\") {\n    contentEnd -= 2;\n  }\n  if (events[contentEnd][1].type === \"atxHeadingSequence\" && (contentStart === contentEnd - 1 || contentEnd - 4 > contentStart && events[contentEnd - 2][1].type === \"whitespace\")) {\n    contentEnd -= contentStart + 1 === contentEnd ? 2 : 4;\n  }\n  if (contentEnd > contentStart) {\n    content = {\n      type: \"atxHeadingText\",\n      start: events[contentStart][1].start,\n      end: events[contentEnd][1].end\n    };\n    text = {\n      type: \"chunkText\",\n      start: events[contentStart][1].start,\n      end: events[contentEnd][1].end,\n      contentType: \"text\"\n    };\n    splice(events, contentStart, contentEnd - contentStart + 1, [['enter', content, context], ['enter', text, context], ['exit', text, context], ['exit', content, context]]);\n  }\n  return events;\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeHeadingAtx(effects, ok, nok) {\n  let size = 0;\n  return start;\n\n  /**\n   * Start of a heading (atx).\n   *\n   * ```markdown\n   * > | ## aa\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    // To do: parse indent like `markdown-rs`.\n    effects.enter(\"atxHeading\");\n    return before(code);\n  }\n\n  /**\n   * After optional whitespace, at `#`.\n   *\n   * ```markdown\n   * > | ## aa\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function before(code) {\n    effects.enter(\"atxHeadingSequence\");\n    return sequenceOpen(code);\n  }\n\n  /**\n   * In opening sequence.\n   *\n   * ```markdown\n   * > | ## aa\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function sequenceOpen(code) {\n    if (code === 35 && size++ < 6) {\n      effects.consume(code);\n      return sequenceOpen;\n    }\n\n    // Always at least one `#`.\n    if (code === null || markdownLineEndingOrSpace(code)) {\n      effects.exit(\"atxHeadingSequence\");\n      return atBreak(code);\n    }\n    return nok(code);\n  }\n\n  /**\n   * After something, before something else.\n   *\n   * ```markdown\n   * > | ## aa\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function atBreak(code) {\n    if (code === 35) {\n      effects.enter(\"atxHeadingSequence\");\n      return sequenceFurther(code);\n    }\n    if (code === null || markdownLineEnding(code)) {\n      effects.exit(\"atxHeading\");\n      // To do: interrupt like `markdown-rs`.\n      // // Feel free to interrupt.\n      // tokenizer.interrupt = false\n      return ok(code);\n    }\n    if (markdownSpace(code)) {\n      return factorySpace(effects, atBreak, \"whitespace\")(code);\n    }\n\n    // To do: generate `data` tokens, add the `text` token later.\n    // Needs edit map, see: `markdown.rs`.\n    effects.enter(\"atxHeadingText\");\n    return data(code);\n  }\n\n  /**\n   * In further sequence (after whitespace).\n   *\n   * Could be normal “visible” hashes in the heading or a final sequence.\n   *\n   * ```markdown\n   * > | ## aa ##\n   *           ^\n   * ```\n   *\n   * @type {State}\n   */\n  function sequenceFurther(code) {\n    if (code === 35) {\n      effects.consume(code);\n      return sequenceFurther;\n    }\n    effects.exit(\"atxHeadingSequence\");\n    return atBreak(code);\n  }\n\n  /**\n   * In text.\n   *\n   * ```markdown\n   * > | ## aa\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function data(code) {\n    if (code === null || code === 35 || markdownLineEndingOrSpace(code)) {\n      effects.exit(\"atxHeadingText\");\n      return atBreak(code);\n    }\n    effects.consume(code);\n    return data;\n  }\n}","/**\n * List of lowercase HTML “block” tag names.\n *\n * The list, when parsing HTML (flow), results in more relaxed rules (condition\n * 6).\n * Because they are known blocks, the HTML-like syntax doesn’t have to be\n * strictly parsed.\n * For tag names not in this list, a more strict algorithm (condition 7) is used\n * to detect whether the HTML-like syntax is seen as HTML (flow) or not.\n *\n * This is copied from:\n * <https://spec.commonmark.org/0.30/#html-blocks>.\n *\n * > 👉 **Note**: `search` was added in `CommonMark@0.31`.\n */\nexport const htmlBlockNames = [\n  'address',\n  'article',\n  'aside',\n  'base',\n  'basefont',\n  'blockquote',\n  'body',\n  'caption',\n  'center',\n  'col',\n  'colgroup',\n  'dd',\n  'details',\n  'dialog',\n  'dir',\n  'div',\n  'dl',\n  'dt',\n  'fieldset',\n  'figcaption',\n  'figure',\n  'footer',\n  'form',\n  'frame',\n  'frameset',\n  'h1',\n  'h2',\n  'h3',\n  'h4',\n  'h5',\n  'h6',\n  'head',\n  'header',\n  'hr',\n  'html',\n  'iframe',\n  'legend',\n  'li',\n  'link',\n  'main',\n  'menu',\n  'menuitem',\n  'nav',\n  'noframes',\n  'ol',\n  'optgroup',\n  'option',\n  'p',\n  'param',\n  'search',\n  'section',\n  'summary',\n  'table',\n  'tbody',\n  'td',\n  'tfoot',\n  'th',\n  'thead',\n  'title',\n  'tr',\n  'track',\n  'ul'\n]\n\n/**\n * List of lowercase HTML “raw” tag names.\n *\n * The list, when parsing HTML (flow), results in HTML that can include lines\n * without exiting, until a closing tag also in this list is found (condition\n * 1).\n *\n * This module is copied from:\n * <https://spec.commonmark.org/0.30/#html-blocks>.\n *\n * > 👉 **Note**: `textarea` was added in `CommonMark@0.30`.\n */\nexport const htmlRawNames = ['pre', 'script', 'style', 'textarea']\n","/**\n * @import {\n *   Code,\n *   Construct,\n *   Resolver,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { asciiAlphanumeric, asciiAlpha, markdownLineEndingOrSpace, markdownLineEnding, markdownSpace } from 'micromark-util-character';\nimport { htmlBlockNames, htmlRawNames } from 'micromark-util-html-tag-name';\nimport { blankLine } from './blank-line.js';\n\n/** @type {Construct} */\nexport const htmlFlow = {\n  concrete: true,\n  name: 'htmlFlow',\n  resolveTo: resolveToHtmlFlow,\n  tokenize: tokenizeHtmlFlow\n};\n\n/** @type {Construct} */\nconst blankLineBefore = {\n  partial: true,\n  tokenize: tokenizeBlankLineBefore\n};\nconst nonLazyContinuationStart = {\n  partial: true,\n  tokenize: tokenizeNonLazyContinuationStart\n};\n\n/** @type {Resolver} */\nfunction resolveToHtmlFlow(events) {\n  let index = events.length;\n  while (index--) {\n    if (events[index][0] === 'enter' && events[index][1].type === \"htmlFlow\") {\n      break;\n    }\n  }\n  if (index > 1 && events[index - 2][1].type === \"linePrefix\") {\n    // Add the prefix start to the HTML token.\n    events[index][1].start = events[index - 2][1].start;\n    // Add the prefix start to the HTML line token.\n    events[index + 1][1].start = events[index - 2][1].start;\n    // Remove the line prefix.\n    events.splice(index - 2, 2);\n  }\n  return events;\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeHtmlFlow(effects, ok, nok) {\n  const self = this;\n  /** @type {number} */\n  let marker;\n  /** @type {boolean} */\n  let closingTag;\n  /** @type {string} */\n  let buffer;\n  /** @type {number} */\n  let index;\n  /** @type {Code} */\n  let markerB;\n  return start;\n\n  /**\n   * Start of HTML (flow).\n   *\n   * ```markdown\n   * > | <x />\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    // To do: parse indent like `markdown-rs`.\n    return before(code);\n  }\n\n  /**\n   * At `<`, after optional whitespace.\n   *\n   * ```markdown\n   * > | <x />\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function before(code) {\n    effects.enter(\"htmlFlow\");\n    effects.enter(\"htmlFlowData\");\n    effects.consume(code);\n    return open;\n  }\n\n  /**\n   * After `<`, at tag name or other stuff.\n   *\n   * ```markdown\n   * > | <x />\n   *      ^\n   * > | <!doctype>\n   *      ^\n   * > | <!--xxx-->\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function open(code) {\n    if (code === 33) {\n      effects.consume(code);\n      return declarationOpen;\n    }\n    if (code === 47) {\n      effects.consume(code);\n      closingTag = true;\n      return tagCloseStart;\n    }\n    if (code === 63) {\n      effects.consume(code);\n      marker = 3;\n      // To do:\n      // tokenizer.concrete = true\n      // To do: use `markdown-rs` style interrupt.\n      // While we’re in an instruction instead of a declaration, we’re on a `?`\n      // right now, so we do need to search for `>`, similar to declarations.\n      return self.interrupt ? ok : continuationDeclarationInside;\n    }\n\n    // ASCII alphabetical.\n    if (asciiAlpha(code)) {\n      // Always the case.\n      effects.consume(code);\n      buffer = String.fromCharCode(code);\n      return tagName;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After `<!`, at declaration, comment, or CDATA.\n   *\n   * ```markdown\n   * > | <!doctype>\n   *       ^\n   * > | <!--xxx-->\n   *       ^\n   * > | <![CDATA[>&<]]>\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function declarationOpen(code) {\n    if (code === 45) {\n      effects.consume(code);\n      marker = 2;\n      return commentOpenInside;\n    }\n    if (code === 91) {\n      effects.consume(code);\n      marker = 5;\n      index = 0;\n      return cdataOpenInside;\n    }\n\n    // ASCII alphabetical.\n    if (asciiAlpha(code)) {\n      effects.consume(code);\n      marker = 4;\n      // // Do not form containers.\n      // tokenizer.concrete = true\n      return self.interrupt ? ok : continuationDeclarationInside;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After `<!-`, inside a comment, at another `-`.\n   *\n   * ```markdown\n   * > | <!--xxx-->\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function commentOpenInside(code) {\n    if (code === 45) {\n      effects.consume(code);\n      // // Do not form containers.\n      // tokenizer.concrete = true\n      return self.interrupt ? ok : continuationDeclarationInside;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After `<![`, inside CDATA, expecting `CDATA[`.\n   *\n   * ```markdown\n   * > | <![CDATA[>&<]]>\n   *        ^^^^^^\n   * ```\n   *\n   * @type {State}\n   */\n  function cdataOpenInside(code) {\n    const value = \"CDATA[\";\n    if (code === value.charCodeAt(index++)) {\n      effects.consume(code);\n      if (index === value.length) {\n        // // Do not form containers.\n        // tokenizer.concrete = true\n        return self.interrupt ? ok : continuation;\n      }\n      return cdataOpenInside;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After `</`, in closing tag, at tag name.\n   *\n   * ```markdown\n   * > | </x>\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagCloseStart(code) {\n    if (asciiAlpha(code)) {\n      // Always the case.\n      effects.consume(code);\n      buffer = String.fromCharCode(code);\n      return tagName;\n    }\n    return nok(code);\n  }\n\n  /**\n   * In tag name.\n   *\n   * ```markdown\n   * > | <ab>\n   *      ^^\n   * > | </ab>\n   *       ^^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagName(code) {\n    if (code === null || code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {\n      const slash = code === 47;\n      const name = buffer.toLowerCase();\n      if (!slash && !closingTag && htmlRawNames.includes(name)) {\n        marker = 1;\n        // // Do not form containers.\n        // tokenizer.concrete = true\n        return self.interrupt ? ok(code) : continuation(code);\n      }\n      if (htmlBlockNames.includes(buffer.toLowerCase())) {\n        marker = 6;\n        if (slash) {\n          effects.consume(code);\n          return basicSelfClosing;\n        }\n\n        // // Do not form containers.\n        // tokenizer.concrete = true\n        return self.interrupt ? ok(code) : continuation(code);\n      }\n      marker = 7;\n      // Do not support complete HTML when interrupting.\n      return self.interrupt && !self.parser.lazy[self.now().line] ? nok(code) : closingTag ? completeClosingTagAfter(code) : completeAttributeNameBefore(code);\n    }\n\n    // ASCII alphanumerical and `-`.\n    if (code === 45 || asciiAlphanumeric(code)) {\n      effects.consume(code);\n      buffer += String.fromCharCode(code);\n      return tagName;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After closing slash of a basic tag name.\n   *\n   * ```markdown\n   * > | <div/>\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function basicSelfClosing(code) {\n    if (code === 62) {\n      effects.consume(code);\n      // // Do not form containers.\n      // tokenizer.concrete = true\n      return self.interrupt ? ok : continuation;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After closing slash of a complete tag name.\n   *\n   * ```markdown\n   * > | <x/>\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function completeClosingTagAfter(code) {\n    if (markdownSpace(code)) {\n      effects.consume(code);\n      return completeClosingTagAfter;\n    }\n    return completeEnd(code);\n  }\n\n  /**\n   * At an attribute name.\n   *\n   * At first, this state is used after a complete tag name, after whitespace,\n   * where it expects optional attributes or the end of the tag.\n   * It is also reused after attributes, when expecting more optional\n   * attributes.\n   *\n   * ```markdown\n   * > | <a />\n   *        ^\n   * > | <a :b>\n   *        ^\n   * > | <a _b>\n   *        ^\n   * > | <a b>\n   *        ^\n   * > | <a >\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function completeAttributeNameBefore(code) {\n    if (code === 47) {\n      effects.consume(code);\n      return completeEnd;\n    }\n\n    // ASCII alphanumerical and `:` and `_`.\n    if (code === 58 || code === 95 || asciiAlpha(code)) {\n      effects.consume(code);\n      return completeAttributeName;\n    }\n    if (markdownSpace(code)) {\n      effects.consume(code);\n      return completeAttributeNameBefore;\n    }\n    return completeEnd(code);\n  }\n\n  /**\n   * In attribute name.\n   *\n   * ```markdown\n   * > | <a :b>\n   *         ^\n   * > | <a _b>\n   *         ^\n   * > | <a b>\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function completeAttributeName(code) {\n    // ASCII alphanumerical and `-`, `.`, `:`, and `_`.\n    if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) {\n      effects.consume(code);\n      return completeAttributeName;\n    }\n    return completeAttributeNameAfter(code);\n  }\n\n  /**\n   * After attribute name, at an optional initializer, the end of the tag, or\n   * whitespace.\n   *\n   * ```markdown\n   * > | <a b>\n   *         ^\n   * > | <a b=c>\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function completeAttributeNameAfter(code) {\n    if (code === 61) {\n      effects.consume(code);\n      return completeAttributeValueBefore;\n    }\n    if (markdownSpace(code)) {\n      effects.consume(code);\n      return completeAttributeNameAfter;\n    }\n    return completeAttributeNameBefore(code);\n  }\n\n  /**\n   * Before unquoted, double quoted, or single quoted attribute value, allowing\n   * whitespace.\n   *\n   * ```markdown\n   * > | <a b=c>\n   *          ^\n   * > | <a b=\"c\">\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function completeAttributeValueBefore(code) {\n    if (code === null || code === 60 || code === 61 || code === 62 || code === 96) {\n      return nok(code);\n    }\n    if (code === 34 || code === 39) {\n      effects.consume(code);\n      markerB = code;\n      return completeAttributeValueQuoted;\n    }\n    if (markdownSpace(code)) {\n      effects.consume(code);\n      return completeAttributeValueBefore;\n    }\n    return completeAttributeValueUnquoted(code);\n  }\n\n  /**\n   * In double or single quoted attribute value.\n   *\n   * ```markdown\n   * > | <a b=\"c\">\n   *           ^\n   * > | <a b='c'>\n   *           ^\n   * ```\n   *\n   * @type {State}\n   */\n  function completeAttributeValueQuoted(code) {\n    if (code === markerB) {\n      effects.consume(code);\n      markerB = null;\n      return completeAttributeValueQuotedAfter;\n    }\n    if (code === null || markdownLineEnding(code)) {\n      return nok(code);\n    }\n    effects.consume(code);\n    return completeAttributeValueQuoted;\n  }\n\n  /**\n   * In unquoted attribute value.\n   *\n   * ```markdown\n   * > | <a b=c>\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function completeAttributeValueUnquoted(code) {\n    if (code === null || code === 34 || code === 39 || code === 47 || code === 60 || code === 61 || code === 62 || code === 96 || markdownLineEndingOrSpace(code)) {\n      return completeAttributeNameAfter(code);\n    }\n    effects.consume(code);\n    return completeAttributeValueUnquoted;\n  }\n\n  /**\n   * After double or single quoted attribute value, before whitespace or the\n   * end of the tag.\n   *\n   * ```markdown\n   * > | <a b=\"c\">\n   *            ^\n   * ```\n   *\n   * @type {State}\n   */\n  function completeAttributeValueQuotedAfter(code) {\n    if (code === 47 || code === 62 || markdownSpace(code)) {\n      return completeAttributeNameBefore(code);\n    }\n    return nok(code);\n  }\n\n  /**\n   * In certain circumstances of a complete tag where only an `>` is allowed.\n   *\n   * ```markdown\n   * > | <a b=\"c\">\n   *             ^\n   * ```\n   *\n   * @type {State}\n   */\n  function completeEnd(code) {\n    if (code === 62) {\n      effects.consume(code);\n      return completeAfter;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After `>` in a complete tag.\n   *\n   * ```markdown\n   * > | <x>\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function completeAfter(code) {\n    if (code === null || markdownLineEnding(code)) {\n      // // Do not form containers.\n      // tokenizer.concrete = true\n      return continuation(code);\n    }\n    if (markdownSpace(code)) {\n      effects.consume(code);\n      return completeAfter;\n    }\n    return nok(code);\n  }\n\n  /**\n   * In continuation of any HTML kind.\n   *\n   * ```markdown\n   * > | <!--xxx-->\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function continuation(code) {\n    if (code === 45 && marker === 2) {\n      effects.consume(code);\n      return continuationCommentInside;\n    }\n    if (code === 60 && marker === 1) {\n      effects.consume(code);\n      return continuationRawTagOpen;\n    }\n    if (code === 62 && marker === 4) {\n      effects.consume(code);\n      return continuationClose;\n    }\n    if (code === 63 && marker === 3) {\n      effects.consume(code);\n      return continuationDeclarationInside;\n    }\n    if (code === 93 && marker === 5) {\n      effects.consume(code);\n      return continuationCdataInside;\n    }\n    if (markdownLineEnding(code) && (marker === 6 || marker === 7)) {\n      effects.exit(\"htmlFlowData\");\n      return effects.check(blankLineBefore, continuationAfter, continuationStart)(code);\n    }\n    if (code === null || markdownLineEnding(code)) {\n      effects.exit(\"htmlFlowData\");\n      return continuationStart(code);\n    }\n    effects.consume(code);\n    return continuation;\n  }\n\n  /**\n   * In continuation, at eol.\n   *\n   * ```markdown\n   * > | <x>\n   *        ^\n   *   | asd\n   * ```\n   *\n   * @type {State}\n   */\n  function continuationStart(code) {\n    return effects.check(nonLazyContinuationStart, continuationStartNonLazy, continuationAfter)(code);\n  }\n\n  /**\n   * In continuation, at eol, before non-lazy content.\n   *\n   * ```markdown\n   * > | <x>\n   *        ^\n   *   | asd\n   * ```\n   *\n   * @type {State}\n   */\n  function continuationStartNonLazy(code) {\n    effects.enter(\"lineEnding\");\n    effects.consume(code);\n    effects.exit(\"lineEnding\");\n    return continuationBefore;\n  }\n\n  /**\n   * In continuation, before non-lazy content.\n   *\n   * ```markdown\n   *   | <x>\n   * > | asd\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function continuationBefore(code) {\n    if (code === null || markdownLineEnding(code)) {\n      return continuationStart(code);\n    }\n    effects.enter(\"htmlFlowData\");\n    return continuation(code);\n  }\n\n  /**\n   * In comment continuation, after one `-`, expecting another.\n   *\n   * ```markdown\n   * > | <!--xxx-->\n   *             ^\n   * ```\n   *\n   * @type {State}\n   */\n  function continuationCommentInside(code) {\n    if (code === 45) {\n      effects.consume(code);\n      return continuationDeclarationInside;\n    }\n    return continuation(code);\n  }\n\n  /**\n   * In raw continuation, after `<`, at `/`.\n   *\n   * ```markdown\n   * > | <script>console.log(1)</script>\n   *                            ^\n   * ```\n   *\n   * @type {State}\n   */\n  function continuationRawTagOpen(code) {\n    if (code === 47) {\n      effects.consume(code);\n      buffer = '';\n      return continuationRawEndTag;\n    }\n    return continuation(code);\n  }\n\n  /**\n   * In raw continuation, after `</`, in a raw tag name.\n   *\n   * ```markdown\n   * > | <script>console.log(1)</script>\n   *                             ^^^^^^\n   * ```\n   *\n   * @type {State}\n   */\n  function continuationRawEndTag(code) {\n    if (code === 62) {\n      const name = buffer.toLowerCase();\n      if (htmlRawNames.includes(name)) {\n        effects.consume(code);\n        return continuationClose;\n      }\n      return continuation(code);\n    }\n    if (asciiAlpha(code) && buffer.length < 8) {\n      // Always the case.\n      effects.consume(code);\n      buffer += String.fromCharCode(code);\n      return continuationRawEndTag;\n    }\n    return continuation(code);\n  }\n\n  /**\n   * In cdata continuation, after `]`, expecting `]>`.\n   *\n   * ```markdown\n   * > | <![CDATA[>&<]]>\n   *                  ^\n   * ```\n   *\n   * @type {State}\n   */\n  function continuationCdataInside(code) {\n    if (code === 93) {\n      effects.consume(code);\n      return continuationDeclarationInside;\n    }\n    return continuation(code);\n  }\n\n  /**\n   * In declaration or instruction continuation, at `>`.\n   *\n   * ```markdown\n   * > | <!-->\n   *         ^\n   * > | <?>\n   *       ^\n   * > | <!q>\n   *        ^\n   * > | <!--ab-->\n   *             ^\n   * > | <![CDATA[>&<]]>\n   *                   ^\n   * ```\n   *\n   * @type {State}\n   */\n  function continuationDeclarationInside(code) {\n    if (code === 62) {\n      effects.consume(code);\n      return continuationClose;\n    }\n\n    // More dashes.\n    if (code === 45 && marker === 2) {\n      effects.consume(code);\n      return continuationDeclarationInside;\n    }\n    return continuation(code);\n  }\n\n  /**\n   * In closed continuation: everything we get until the eol/eof is part of it.\n   *\n   * ```markdown\n   * > | <!doctype>\n   *               ^\n   * ```\n   *\n   * @type {State}\n   */\n  function continuationClose(code) {\n    if (code === null || markdownLineEnding(code)) {\n      effects.exit(\"htmlFlowData\");\n      return continuationAfter(code);\n    }\n    effects.consume(code);\n    return continuationClose;\n  }\n\n  /**\n   * Done.\n   *\n   * ```markdown\n   * > | <!doctype>\n   *               ^\n   * ```\n   *\n   * @type {State}\n   */\n  function continuationAfter(code) {\n    effects.exit(\"htmlFlow\");\n    // // Feel free to interrupt.\n    // tokenizer.interrupt = false\n    // // No longer concrete.\n    // tokenizer.concrete = false\n    return ok(code);\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeNonLazyContinuationStart(effects, ok, nok) {\n  const self = this;\n  return start;\n\n  /**\n   * At eol, before continuation.\n   *\n   * ```markdown\n   * > | * ```js\n   *            ^\n   *   | b\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    if (markdownLineEnding(code)) {\n      effects.enter(\"lineEnding\");\n      effects.consume(code);\n      effects.exit(\"lineEnding\");\n      return after;\n    }\n    return nok(code);\n  }\n\n  /**\n   * A continuation.\n   *\n   * ```markdown\n   *   | * ```js\n   * > | b\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function after(code) {\n    return self.parser.lazy[self.now().line] ? nok(code) : ok(code);\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeBlankLineBefore(effects, ok, nok) {\n  return start;\n\n  /**\n   * Before eol, expecting blank line.\n   *\n   * ```markdown\n   * > | <div>\n   *          ^\n   *   |\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    effects.enter(\"lineEnding\");\n    effects.consume(code);\n    effects.exit(\"lineEnding\");\n    return effects.attempt(blankLine, ok, nok);\n  }\n}","/**\n * @import {\n *   Code,\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { asciiAlphanumeric, asciiAlpha, markdownLineEndingOrSpace, markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const htmlText = {\n  name: 'htmlText',\n  tokenize: tokenizeHtmlText\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeHtmlText(effects, ok, nok) {\n  const self = this;\n  /** @type {NonNullable<Code> | undefined} */\n  let marker;\n  /** @type {number} */\n  let index;\n  /** @type {State} */\n  let returnState;\n  return start;\n\n  /**\n   * Start of HTML (text).\n   *\n   * ```markdown\n   * > | a <b> c\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    effects.enter(\"htmlText\");\n    effects.enter(\"htmlTextData\");\n    effects.consume(code);\n    return open;\n  }\n\n  /**\n   * After `<`, at tag name or other stuff.\n   *\n   * ```markdown\n   * > | a <b> c\n   *        ^\n   * > | a <!doctype> c\n   *        ^\n   * > | a <!--b--> c\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function open(code) {\n    if (code === 33) {\n      effects.consume(code);\n      return declarationOpen;\n    }\n    if (code === 47) {\n      effects.consume(code);\n      return tagCloseStart;\n    }\n    if (code === 63) {\n      effects.consume(code);\n      return instruction;\n    }\n\n    // ASCII alphabetical.\n    if (asciiAlpha(code)) {\n      effects.consume(code);\n      return tagOpen;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After `<!`, at declaration, comment, or CDATA.\n   *\n   * ```markdown\n   * > | a <!doctype> c\n   *         ^\n   * > | a <!--b--> c\n   *         ^\n   * > | a <![CDATA[>&<]]> c\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function declarationOpen(code) {\n    if (code === 45) {\n      effects.consume(code);\n      return commentOpenInside;\n    }\n    if (code === 91) {\n      effects.consume(code);\n      index = 0;\n      return cdataOpenInside;\n    }\n    if (asciiAlpha(code)) {\n      effects.consume(code);\n      return declaration;\n    }\n    return nok(code);\n  }\n\n  /**\n   * In a comment, after `<!-`, at another `-`.\n   *\n   * ```markdown\n   * > | a <!--b--> c\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function commentOpenInside(code) {\n    if (code === 45) {\n      effects.consume(code);\n      return commentEnd;\n    }\n    return nok(code);\n  }\n\n  /**\n   * In comment.\n   *\n   * ```markdown\n   * > | a <!--b--> c\n   *           ^\n   * ```\n   *\n   * @type {State}\n   */\n  function comment(code) {\n    if (code === null) {\n      return nok(code);\n    }\n    if (code === 45) {\n      effects.consume(code);\n      return commentClose;\n    }\n    if (markdownLineEnding(code)) {\n      returnState = comment;\n      return lineEndingBefore(code);\n    }\n    effects.consume(code);\n    return comment;\n  }\n\n  /**\n   * In comment, after `-`.\n   *\n   * ```markdown\n   * > | a <!--b--> c\n   *             ^\n   * ```\n   *\n   * @type {State}\n   */\n  function commentClose(code) {\n    if (code === 45) {\n      effects.consume(code);\n      return commentEnd;\n    }\n    return comment(code);\n  }\n\n  /**\n   * In comment, after `--`.\n   *\n   * ```markdown\n   * > | a <!--b--> c\n   *              ^\n   * ```\n   *\n   * @type {State}\n   */\n  function commentEnd(code) {\n    return code === 62 ? end(code) : code === 45 ? commentClose(code) : comment(code);\n  }\n\n  /**\n   * After `<![`, in CDATA, expecting `CDATA[`.\n   *\n   * ```markdown\n   * > | a <![CDATA[>&<]]> b\n   *          ^^^^^^\n   * ```\n   *\n   * @type {State}\n   */\n  function cdataOpenInside(code) {\n    const value = \"CDATA[\";\n    if (code === value.charCodeAt(index++)) {\n      effects.consume(code);\n      return index === value.length ? cdata : cdataOpenInside;\n    }\n    return nok(code);\n  }\n\n  /**\n   * In CDATA.\n   *\n   * ```markdown\n   * > | a <![CDATA[>&<]]> b\n   *                ^^^\n   * ```\n   *\n   * @type {State}\n   */\n  function cdata(code) {\n    if (code === null) {\n      return nok(code);\n    }\n    if (code === 93) {\n      effects.consume(code);\n      return cdataClose;\n    }\n    if (markdownLineEnding(code)) {\n      returnState = cdata;\n      return lineEndingBefore(code);\n    }\n    effects.consume(code);\n    return cdata;\n  }\n\n  /**\n   * In CDATA, after `]`, at another `]`.\n   *\n   * ```markdown\n   * > | a <![CDATA[>&<]]> b\n   *                    ^\n   * ```\n   *\n   * @type {State}\n   */\n  function cdataClose(code) {\n    if (code === 93) {\n      effects.consume(code);\n      return cdataEnd;\n    }\n    return cdata(code);\n  }\n\n  /**\n   * In CDATA, after `]]`, at `>`.\n   *\n   * ```markdown\n   * > | a <![CDATA[>&<]]> b\n   *                     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function cdataEnd(code) {\n    if (code === 62) {\n      return end(code);\n    }\n    if (code === 93) {\n      effects.consume(code);\n      return cdataEnd;\n    }\n    return cdata(code);\n  }\n\n  /**\n   * In declaration.\n   *\n   * ```markdown\n   * > | a <!b> c\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function declaration(code) {\n    if (code === null || code === 62) {\n      return end(code);\n    }\n    if (markdownLineEnding(code)) {\n      returnState = declaration;\n      return lineEndingBefore(code);\n    }\n    effects.consume(code);\n    return declaration;\n  }\n\n  /**\n   * In instruction.\n   *\n   * ```markdown\n   * > | a <?b?> c\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function instruction(code) {\n    if (code === null) {\n      return nok(code);\n    }\n    if (code === 63) {\n      effects.consume(code);\n      return instructionClose;\n    }\n    if (markdownLineEnding(code)) {\n      returnState = instruction;\n      return lineEndingBefore(code);\n    }\n    effects.consume(code);\n    return instruction;\n  }\n\n  /**\n   * In instruction, after `?`, at `>`.\n   *\n   * ```markdown\n   * > | a <?b?> c\n   *           ^\n   * ```\n   *\n   * @type {State}\n   */\n  function instructionClose(code) {\n    return code === 62 ? end(code) : instruction(code);\n  }\n\n  /**\n   * After `</`, in closing tag, at tag name.\n   *\n   * ```markdown\n   * > | a </b> c\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagCloseStart(code) {\n    // ASCII alphabetical.\n    if (asciiAlpha(code)) {\n      effects.consume(code);\n      return tagClose;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After `</x`, in a tag name.\n   *\n   * ```markdown\n   * > | a </b> c\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagClose(code) {\n    // ASCII alphanumerical and `-`.\n    if (code === 45 || asciiAlphanumeric(code)) {\n      effects.consume(code);\n      return tagClose;\n    }\n    return tagCloseBetween(code);\n  }\n\n  /**\n   * In closing tag, after tag name.\n   *\n   * ```markdown\n   * > | a </b> c\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagCloseBetween(code) {\n    if (markdownLineEnding(code)) {\n      returnState = tagCloseBetween;\n      return lineEndingBefore(code);\n    }\n    if (markdownSpace(code)) {\n      effects.consume(code);\n      return tagCloseBetween;\n    }\n    return end(code);\n  }\n\n  /**\n   * After `<x`, in opening tag name.\n   *\n   * ```markdown\n   * > | a <b> c\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagOpen(code) {\n    // ASCII alphanumerical and `-`.\n    if (code === 45 || asciiAlphanumeric(code)) {\n      effects.consume(code);\n      return tagOpen;\n    }\n    if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {\n      return tagOpenBetween(code);\n    }\n    return nok(code);\n  }\n\n  /**\n   * In opening tag, after tag name.\n   *\n   * ```markdown\n   * > | a <b> c\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagOpenBetween(code) {\n    if (code === 47) {\n      effects.consume(code);\n      return end;\n    }\n\n    // ASCII alphabetical and `:` and `_`.\n    if (code === 58 || code === 95 || asciiAlpha(code)) {\n      effects.consume(code);\n      return tagOpenAttributeName;\n    }\n    if (markdownLineEnding(code)) {\n      returnState = tagOpenBetween;\n      return lineEndingBefore(code);\n    }\n    if (markdownSpace(code)) {\n      effects.consume(code);\n      return tagOpenBetween;\n    }\n    return end(code);\n  }\n\n  /**\n   * In attribute name.\n   *\n   * ```markdown\n   * > | a <b c> d\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagOpenAttributeName(code) {\n    // ASCII alphabetical and `-`, `.`, `:`, and `_`.\n    if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) {\n      effects.consume(code);\n      return tagOpenAttributeName;\n    }\n    return tagOpenAttributeNameAfter(code);\n  }\n\n  /**\n   * After attribute name, before initializer, the end of the tag, or\n   * whitespace.\n   *\n   * ```markdown\n   * > | a <b c> d\n   *           ^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagOpenAttributeNameAfter(code) {\n    if (code === 61) {\n      effects.consume(code);\n      return tagOpenAttributeValueBefore;\n    }\n    if (markdownLineEnding(code)) {\n      returnState = tagOpenAttributeNameAfter;\n      return lineEndingBefore(code);\n    }\n    if (markdownSpace(code)) {\n      effects.consume(code);\n      return tagOpenAttributeNameAfter;\n    }\n    return tagOpenBetween(code);\n  }\n\n  /**\n   * Before unquoted, double quoted, or single quoted attribute value, allowing\n   * whitespace.\n   *\n   * ```markdown\n   * > | a <b c=d> e\n   *            ^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagOpenAttributeValueBefore(code) {\n    if (code === null || code === 60 || code === 61 || code === 62 || code === 96) {\n      return nok(code);\n    }\n    if (code === 34 || code === 39) {\n      effects.consume(code);\n      marker = code;\n      return tagOpenAttributeValueQuoted;\n    }\n    if (markdownLineEnding(code)) {\n      returnState = tagOpenAttributeValueBefore;\n      return lineEndingBefore(code);\n    }\n    if (markdownSpace(code)) {\n      effects.consume(code);\n      return tagOpenAttributeValueBefore;\n    }\n    effects.consume(code);\n    return tagOpenAttributeValueUnquoted;\n  }\n\n  /**\n   * In double or single quoted attribute value.\n   *\n   * ```markdown\n   * > | a <b c=\"d\"> e\n   *             ^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagOpenAttributeValueQuoted(code) {\n    if (code === marker) {\n      effects.consume(code);\n      marker = undefined;\n      return tagOpenAttributeValueQuotedAfter;\n    }\n    if (code === null) {\n      return nok(code);\n    }\n    if (markdownLineEnding(code)) {\n      returnState = tagOpenAttributeValueQuoted;\n      return lineEndingBefore(code);\n    }\n    effects.consume(code);\n    return tagOpenAttributeValueQuoted;\n  }\n\n  /**\n   * In unquoted attribute value.\n   *\n   * ```markdown\n   * > | a <b c=d> e\n   *            ^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagOpenAttributeValueUnquoted(code) {\n    if (code === null || code === 34 || code === 39 || code === 60 || code === 61 || code === 96) {\n      return nok(code);\n    }\n    if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {\n      return tagOpenBetween(code);\n    }\n    effects.consume(code);\n    return tagOpenAttributeValueUnquoted;\n  }\n\n  /**\n   * After double or single quoted attribute value, before whitespace or the end\n   * of the tag.\n   *\n   * ```markdown\n   * > | a <b c=\"d\"> e\n   *               ^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagOpenAttributeValueQuotedAfter(code) {\n    if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {\n      return tagOpenBetween(code);\n    }\n    return nok(code);\n  }\n\n  /**\n   * In certain circumstances of a tag where only an `>` is allowed.\n   *\n   * ```markdown\n   * > | a <b c=\"d\"> e\n   *               ^\n   * ```\n   *\n   * @type {State}\n   */\n  function end(code) {\n    if (code === 62) {\n      effects.consume(code);\n      effects.exit(\"htmlTextData\");\n      effects.exit(\"htmlText\");\n      return ok;\n    }\n    return nok(code);\n  }\n\n  /**\n   * At eol.\n   *\n   * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about\n   * > empty tokens.\n   *\n   * ```markdown\n   * > | a <!--a\n   *            ^\n   *   | b-->\n   * ```\n   *\n   * @type {State}\n   */\n  function lineEndingBefore(code) {\n    effects.exit(\"htmlTextData\");\n    effects.enter(\"lineEnding\");\n    effects.consume(code);\n    effects.exit(\"lineEnding\");\n    return lineEndingAfter;\n  }\n\n  /**\n   * After eol, at optional whitespace.\n   *\n   * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about\n   * > empty tokens.\n   *\n   * ```markdown\n   *   | a <!--a\n   * > | b-->\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function lineEndingAfter(code) {\n    // Always populated by defaults.\n\n    return markdownSpace(code) ? factorySpace(effects, lineEndingAfterPrefix, \"linePrefix\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code) : lineEndingAfterPrefix(code);\n  }\n\n  /**\n   * After eol, after optional whitespace.\n   *\n   * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about\n   * > empty tokens.\n   *\n   * ```markdown\n   *   | a <!--a\n   * > | b-->\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function lineEndingAfterPrefix(code) {\n    effects.enter(\"htmlTextData\");\n    return returnState(code);\n  }\n}","/**\n * @import {\n *   Construct,\n *   Event,\n *   Resolver,\n *   State,\n *   TokenizeContext,\n *   Tokenizer,\n *   Token\n * } from 'micromark-util-types'\n */\n\nimport { factoryDestination } from 'micromark-factory-destination';\nimport { factoryLabel } from 'micromark-factory-label';\nimport { factoryTitle } from 'micromark-factory-title';\nimport { factoryWhitespace } from 'micromark-factory-whitespace';\nimport { markdownLineEndingOrSpace } from 'micromark-util-character';\nimport { push, splice } from 'micromark-util-chunked';\nimport { normalizeIdentifier } from 'micromark-util-normalize-identifier';\nimport { resolveAll } from 'micromark-util-resolve-all';\n/** @type {Construct} */\nexport const labelEnd = {\n  name: 'labelEnd',\n  resolveAll: resolveAllLabelEnd,\n  resolveTo: resolveToLabelEnd,\n  tokenize: tokenizeLabelEnd\n};\n\n/** @type {Construct} */\nconst resourceConstruct = {\n  tokenize: tokenizeResource\n};\n/** @type {Construct} */\nconst referenceFullConstruct = {\n  tokenize: tokenizeReferenceFull\n};\n/** @type {Construct} */\nconst referenceCollapsedConstruct = {\n  tokenize: tokenizeReferenceCollapsed\n};\n\n/** @type {Resolver} */\nfunction resolveAllLabelEnd(events) {\n  let index = -1;\n  /** @type {Array<Event>} */\n  const newEvents = [];\n  while (++index < events.length) {\n    const token = events[index][1];\n    newEvents.push(events[index]);\n    if (token.type === \"labelImage\" || token.type === \"labelLink\" || token.type === \"labelEnd\") {\n      // Remove the marker.\n      const offset = token.type === \"labelImage\" ? 4 : 2;\n      token.type = \"data\";\n      index += offset;\n    }\n  }\n\n  // If the events are equal, we don't have to copy newEvents to events\n  if (events.length !== newEvents.length) {\n    splice(events, 0, events.length, newEvents);\n  }\n  return events;\n}\n\n/** @type {Resolver} */\nfunction resolveToLabelEnd(events, context) {\n  let index = events.length;\n  let offset = 0;\n  /** @type {Token} */\n  let token;\n  /** @type {number | undefined} */\n  let open;\n  /** @type {number | undefined} */\n  let close;\n  /** @type {Array<Event>} */\n  let media;\n\n  // Find an opening.\n  while (index--) {\n    token = events[index][1];\n    if (open) {\n      // If we see another link, or inactive link label, we’ve been here before.\n      if (token.type === \"link\" || token.type === \"labelLink\" && token._inactive) {\n        break;\n      }\n\n      // Mark other link openings as inactive, as we can’t have links in\n      // links.\n      if (events[index][0] === 'enter' && token.type === \"labelLink\") {\n        token._inactive = true;\n      }\n    } else if (close) {\n      if (events[index][0] === 'enter' && (token.type === \"labelImage\" || token.type === \"labelLink\") && !token._balanced) {\n        open = index;\n        if (token.type !== \"labelLink\") {\n          offset = 2;\n          break;\n        }\n      }\n    } else if (token.type === \"labelEnd\") {\n      close = index;\n    }\n  }\n  const group = {\n    type: events[open][1].type === \"labelLink\" ? \"link\" : \"image\",\n    start: {\n      ...events[open][1].start\n    },\n    end: {\n      ...events[events.length - 1][1].end\n    }\n  };\n  const label = {\n    type: \"label\",\n    start: {\n      ...events[open][1].start\n    },\n    end: {\n      ...events[close][1].end\n    }\n  };\n  const text = {\n    type: \"labelText\",\n    start: {\n      ...events[open + offset + 2][1].end\n    },\n    end: {\n      ...events[close - 2][1].start\n    }\n  };\n  media = [['enter', group, context], ['enter', label, context]];\n\n  // Opening marker.\n  media = push(media, events.slice(open + 1, open + offset + 3));\n\n  // Text open.\n  media = push(media, [['enter', text, context]]);\n\n  // Always populated by defaults.\n\n  // Between.\n  media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + offset + 4, close - 3), context));\n\n  // Text close, marker close, label close.\n  media = push(media, [['exit', text, context], events[close - 2], events[close - 1], ['exit', label, context]]);\n\n  // Reference, resource, or so.\n  media = push(media, events.slice(close + 1));\n\n  // Media close.\n  media = push(media, [['exit', group, context]]);\n  splice(events, open, events.length, media);\n  return events;\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLabelEnd(effects, ok, nok) {\n  const self = this;\n  let index = self.events.length;\n  /** @type {Token} */\n  let labelStart;\n  /** @type {boolean} */\n  let defined;\n\n  // Find an opening.\n  while (index--) {\n    if ((self.events[index][1].type === \"labelImage\" || self.events[index][1].type === \"labelLink\") && !self.events[index][1]._balanced) {\n      labelStart = self.events[index][1];\n      break;\n    }\n  }\n  return start;\n\n  /**\n   * Start of label end.\n   *\n   * ```markdown\n   * > | [a](b) c\n   *       ^\n   * > | [a][b] c\n   *       ^\n   * > | [a][] b\n   *       ^\n   * > | [a] b\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    // If there is not an okay opening.\n    if (!labelStart) {\n      return nok(code);\n    }\n\n    // If the corresponding label (link) start is marked as inactive,\n    // it means we’d be wrapping a link, like this:\n    //\n    // ```markdown\n    // > | a [b [c](d) e](f) g.\n    //                  ^\n    // ```\n    //\n    // We can’t have that, so it’s just balanced brackets.\n    if (labelStart._inactive) {\n      return labelEndNok(code);\n    }\n    defined = self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize({\n      start: labelStart.end,\n      end: self.now()\n    })));\n    effects.enter(\"labelEnd\");\n    effects.enter(\"labelMarker\");\n    effects.consume(code);\n    effects.exit(\"labelMarker\");\n    effects.exit(\"labelEnd\");\n    return after;\n  }\n\n  /**\n   * After `]`.\n   *\n   * ```markdown\n   * > | [a](b) c\n   *       ^\n   * > | [a][b] c\n   *       ^\n   * > | [a][] b\n   *       ^\n   * > | [a] b\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function after(code) {\n    // Note: `markdown-rs` also parses GFM footnotes here, which for us is in\n    // an extension.\n\n    // Resource (`[asd](fgh)`)?\n    if (code === 40) {\n      return effects.attempt(resourceConstruct, labelEndOk, defined ? labelEndOk : labelEndNok)(code);\n    }\n\n    // Full (`[asd][fgh]`) or collapsed (`[asd][]`) reference?\n    if (code === 91) {\n      return effects.attempt(referenceFullConstruct, labelEndOk, defined ? referenceNotFull : labelEndNok)(code);\n    }\n\n    // Shortcut (`[asd]`) reference?\n    return defined ? labelEndOk(code) : labelEndNok(code);\n  }\n\n  /**\n   * After `]`, at `[`, but not at a full reference.\n   *\n   * > 👉 **Note**: we only get here if the label is defined.\n   *\n   * ```markdown\n   * > | [a][] b\n   *        ^\n   * > | [a] b\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function referenceNotFull(code) {\n    return effects.attempt(referenceCollapsedConstruct, labelEndOk, labelEndNok)(code);\n  }\n\n  /**\n   * Done, we found something.\n   *\n   * ```markdown\n   * > | [a](b) c\n   *           ^\n   * > | [a][b] c\n   *           ^\n   * > | [a][] b\n   *          ^\n   * > | [a] b\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function labelEndOk(code) {\n    // Note: `markdown-rs` does a bunch of stuff here.\n    return ok(code);\n  }\n\n  /**\n   * Done, it’s nothing.\n   *\n   * There was an okay opening, but we didn’t match anything.\n   *\n   * ```markdown\n   * > | [a](b c\n   *        ^\n   * > | [a][b c\n   *        ^\n   * > | [a] b\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function labelEndNok(code) {\n    labelStart._balanced = true;\n    return nok(code);\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeResource(effects, ok, nok) {\n  return resourceStart;\n\n  /**\n   * At a resource.\n   *\n   * ```markdown\n   * > | [a](b) c\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function resourceStart(code) {\n    effects.enter(\"resource\");\n    effects.enter(\"resourceMarker\");\n    effects.consume(code);\n    effects.exit(\"resourceMarker\");\n    return resourceBefore;\n  }\n\n  /**\n   * In resource, after `(`, at optional whitespace.\n   *\n   * ```markdown\n   * > | [a](b) c\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function resourceBefore(code) {\n    return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceOpen)(code) : resourceOpen(code);\n  }\n\n  /**\n   * In resource, after optional whitespace, at `)` or a destination.\n   *\n   * ```markdown\n   * > | [a](b) c\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function resourceOpen(code) {\n    if (code === 41) {\n      return resourceEnd(code);\n    }\n    return factoryDestination(effects, resourceDestinationAfter, resourceDestinationMissing, \"resourceDestination\", \"resourceDestinationLiteral\", \"resourceDestinationLiteralMarker\", \"resourceDestinationRaw\", \"resourceDestinationString\", 32)(code);\n  }\n\n  /**\n   * In resource, after destination, at optional whitespace.\n   *\n   * ```markdown\n   * > | [a](b) c\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function resourceDestinationAfter(code) {\n    return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceBetween)(code) : resourceEnd(code);\n  }\n\n  /**\n   * At invalid destination.\n   *\n   * ```markdown\n   * > | [a](<<) b\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function resourceDestinationMissing(code) {\n    return nok(code);\n  }\n\n  /**\n   * In resource, after destination and whitespace, at `(` or title.\n   *\n   * ```markdown\n   * > | [a](b ) c\n   *           ^\n   * ```\n   *\n   * @type {State}\n   */\n  function resourceBetween(code) {\n    if (code === 34 || code === 39 || code === 40) {\n      return factoryTitle(effects, resourceTitleAfter, nok, \"resourceTitle\", \"resourceTitleMarker\", \"resourceTitleString\")(code);\n    }\n    return resourceEnd(code);\n  }\n\n  /**\n   * In resource, after title, at optional whitespace.\n   *\n   * ```markdown\n   * > | [a](b \"c\") d\n   *              ^\n   * ```\n   *\n   * @type {State}\n   */\n  function resourceTitleAfter(code) {\n    return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceEnd)(code) : resourceEnd(code);\n  }\n\n  /**\n   * In resource, at `)`.\n   *\n   * ```markdown\n   * > | [a](b) d\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function resourceEnd(code) {\n    if (code === 41) {\n      effects.enter(\"resourceMarker\");\n      effects.consume(code);\n      effects.exit(\"resourceMarker\");\n      effects.exit(\"resource\");\n      return ok;\n    }\n    return nok(code);\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeReferenceFull(effects, ok, nok) {\n  const self = this;\n  return referenceFull;\n\n  /**\n   * In a reference (full), at the `[`.\n   *\n   * ```markdown\n   * > | [a][b] d\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function referenceFull(code) {\n    return factoryLabel.call(self, effects, referenceFullAfter, referenceFullMissing, \"reference\", \"referenceMarker\", \"referenceString\")(code);\n  }\n\n  /**\n   * In a reference (full), after `]`.\n   *\n   * ```markdown\n   * > | [a][b] d\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function referenceFullAfter(code) {\n    return self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1))) ? ok(code) : nok(code);\n  }\n\n  /**\n   * In reference (full) that was missing.\n   *\n   * ```markdown\n   * > | [a][b d\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function referenceFullMissing(code) {\n    return nok(code);\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeReferenceCollapsed(effects, ok, nok) {\n  return referenceCollapsedStart;\n\n  /**\n   * In reference (collapsed), at `[`.\n   *\n   * > 👉 **Note**: we only get here if the label is defined.\n   *\n   * ```markdown\n   * > | [a][] d\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function referenceCollapsedStart(code) {\n    // We only attempt a collapsed label if there’s a `[`.\n\n    effects.enter(\"reference\");\n    effects.enter(\"referenceMarker\");\n    effects.consume(code);\n    effects.exit(\"referenceMarker\");\n    return referenceCollapsedOpen;\n  }\n\n  /**\n   * In reference (collapsed), at `]`.\n   *\n   * > 👉 **Note**: we only get here if the label is defined.\n   *\n   * ```markdown\n   * > | [a][] d\n   *         ^\n   * ```\n   *\n   *  @type {State}\n   */\n  function referenceCollapsedOpen(code) {\n    if (code === 93) {\n      effects.enter(\"referenceMarker\");\n      effects.consume(code);\n      effects.exit(\"referenceMarker\");\n      effects.exit(\"reference\");\n      return ok;\n    }\n    return nok(code);\n  }\n}","/**\n * @import {\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { labelEnd } from './label-end.js';\n\n/** @type {Construct} */\nexport const labelStartImage = {\n  name: 'labelStartImage',\n  resolveAll: labelEnd.resolveAll,\n  tokenize: tokenizeLabelStartImage\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLabelStartImage(effects, ok, nok) {\n  const self = this;\n  return start;\n\n  /**\n   * Start of label (image) start.\n   *\n   * ```markdown\n   * > | a ![b] c\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    effects.enter(\"labelImage\");\n    effects.enter(\"labelImageMarker\");\n    effects.consume(code);\n    effects.exit(\"labelImageMarker\");\n    return open;\n  }\n\n  /**\n   * After `!`, at `[`.\n   *\n   * ```markdown\n   * > | a ![b] c\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function open(code) {\n    if (code === 91) {\n      effects.enter(\"labelMarker\");\n      effects.consume(code);\n      effects.exit(\"labelMarker\");\n      effects.exit(\"labelImage\");\n      return after;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After `![`.\n   *\n   * ```markdown\n   * > | a ![b] c\n   *         ^\n   * ```\n   *\n   * This is needed in because, when GFM footnotes are enabled, images never\n   * form when started with a `^`.\n   * Instead, links form:\n   *\n   * ```markdown\n   * ![^a](b)\n   *\n   * ![^a][b]\n   *\n   * [b]: c\n   * ```\n   *\n   * ```html\n   * <p>!<a href=\\\"b\\\">^a</a></p>\n   * <p>!<a href=\\\"c\\\">^a</a></p>\n   * ```\n   *\n   * @type {State}\n   */\n  function after(code) {\n    // To do: use a new field to do this, this is still needed for\n    // `micromark-extension-gfm-footnote`, but the `label-start-link`\n    // behavior isn’t.\n    // Hidden footnotes hook.\n    /* c8 ignore next 3 */\n    return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code);\n  }\n}","/**\n * @import {\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { labelEnd } from './label-end.js';\n\n/** @type {Construct} */\nexport const labelStartLink = {\n  name: 'labelStartLink',\n  resolveAll: labelEnd.resolveAll,\n  tokenize: tokenizeLabelStartLink\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLabelStartLink(effects, ok, nok) {\n  const self = this;\n  return start;\n\n  /**\n   * Start of label (link) start.\n   *\n   * ```markdown\n   * > | a [b] c\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    effects.enter(\"labelLink\");\n    effects.enter(\"labelMarker\");\n    effects.consume(code);\n    effects.exit(\"labelMarker\");\n    effects.exit(\"labelLink\");\n    return after;\n  }\n\n  /** @type {State} */\n  function after(code) {\n    // To do: this isn’t needed in `micromark-extension-gfm-footnote`,\n    // remove.\n    // Hidden footnotes hook.\n    /* c8 ignore next 3 */\n    return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code);\n  }\n}","/**\n * @import {\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding } from 'micromark-util-character';\n/** @type {Construct} */\nexport const lineEnding = {\n  name: 'lineEnding',\n  tokenize: tokenizeLineEnding\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLineEnding(effects, ok) {\n  return start;\n\n  /** @type {State} */\n  function start(code) {\n    effects.enter(\"lineEnding\");\n    effects.consume(code);\n    effects.exit(\"lineEnding\");\n    return factorySpace(effects, ok, \"linePrefix\");\n  }\n}","/**\n * @import {\n *   Code,\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const thematicBreak = {\n  name: 'thematicBreak',\n  tokenize: tokenizeThematicBreak\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeThematicBreak(effects, ok, nok) {\n  let size = 0;\n  /** @type {NonNullable<Code>} */\n  let marker;\n  return start;\n\n  /**\n   * Start of thematic break.\n   *\n   * ```markdown\n   * > | ***\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    effects.enter(\"thematicBreak\");\n    // To do: parse indent like `markdown-rs`.\n    return before(code);\n  }\n\n  /**\n   * After optional whitespace, at marker.\n   *\n   * ```markdown\n   * > | ***\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function before(code) {\n    marker = code;\n    return atBreak(code);\n  }\n\n  /**\n   * After something, before something else.\n   *\n   * ```markdown\n   * > | ***\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function atBreak(code) {\n    if (code === marker) {\n      effects.enter(\"thematicBreakSequence\");\n      return sequence(code);\n    }\n    if (size >= 3 && (code === null || markdownLineEnding(code))) {\n      effects.exit(\"thematicBreak\");\n      return ok(code);\n    }\n    return nok(code);\n  }\n\n  /**\n   * In sequence.\n   *\n   * ```markdown\n   * > | ***\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function sequence(code) {\n    if (code === marker) {\n      effects.consume(code);\n      size++;\n      return sequence;\n    }\n    effects.exit(\"thematicBreakSequence\");\n    return markdownSpace(code) ? factorySpace(effects, atBreak, \"whitespace\")(code) : atBreak(code);\n  }\n}","/**\n * @import {\n *   Code,\n *   Construct,\n *   Exiter,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { asciiDigit, markdownSpace } from 'micromark-util-character';\nimport { blankLine } from './blank-line.js';\nimport { thematicBreak } from './thematic-break.js';\n\n/** @type {Construct} */\nexport const list = {\n  continuation: {\n    tokenize: tokenizeListContinuation\n  },\n  exit: tokenizeListEnd,\n  name: 'list',\n  tokenize: tokenizeListStart\n};\n\n/** @type {Construct} */\nconst listItemPrefixWhitespaceConstruct = {\n  partial: true,\n  tokenize: tokenizeListItemPrefixWhitespace\n};\n\n/** @type {Construct} */\nconst indentConstruct = {\n  partial: true,\n  tokenize: tokenizeIndent\n};\n\n// To do: `markdown-rs` parses list items on their own and later stitches them\n// together.\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeListStart(effects, ok, nok) {\n  const self = this;\n  const tail = self.events[self.events.length - 1];\n  let initialSize = tail && tail[1].type === \"linePrefix\" ? tail[2].sliceSerialize(tail[1], true).length : 0;\n  let size = 0;\n  return start;\n\n  /** @type {State} */\n  function start(code) {\n    const kind = self.containerState.type || (code === 42 || code === 43 || code === 45 ? \"listUnordered\" : \"listOrdered\");\n    if (kind === \"listUnordered\" ? !self.containerState.marker || code === self.containerState.marker : asciiDigit(code)) {\n      if (!self.containerState.type) {\n        self.containerState.type = kind;\n        effects.enter(kind, {\n          _container: true\n        });\n      }\n      if (kind === \"listUnordered\") {\n        effects.enter(\"listItemPrefix\");\n        return code === 42 || code === 45 ? effects.check(thematicBreak, nok, atMarker)(code) : atMarker(code);\n      }\n      if (!self.interrupt || code === 49) {\n        effects.enter(\"listItemPrefix\");\n        effects.enter(\"listItemValue\");\n        return inside(code);\n      }\n    }\n    return nok(code);\n  }\n\n  /** @type {State} */\n  function inside(code) {\n    if (asciiDigit(code) && ++size < 10) {\n      effects.consume(code);\n      return inside;\n    }\n    if ((!self.interrupt || size < 2) && (self.containerState.marker ? code === self.containerState.marker : code === 41 || code === 46)) {\n      effects.exit(\"listItemValue\");\n      return atMarker(code);\n    }\n    return nok(code);\n  }\n\n  /**\n   * @type {State}\n   **/\n  function atMarker(code) {\n    effects.enter(\"listItemMarker\");\n    effects.consume(code);\n    effects.exit(\"listItemMarker\");\n    self.containerState.marker = self.containerState.marker || code;\n    return effects.check(blankLine,\n    // Can’t be empty when interrupting.\n    self.interrupt ? nok : onBlank, effects.attempt(listItemPrefixWhitespaceConstruct, endOfPrefix, otherPrefix));\n  }\n\n  /** @type {State} */\n  function onBlank(code) {\n    self.containerState.initialBlankLine = true;\n    initialSize++;\n    return endOfPrefix(code);\n  }\n\n  /** @type {State} */\n  function otherPrefix(code) {\n    if (markdownSpace(code)) {\n      effects.enter(\"listItemPrefixWhitespace\");\n      effects.consume(code);\n      effects.exit(\"listItemPrefixWhitespace\");\n      return endOfPrefix;\n    }\n    return nok(code);\n  }\n\n  /** @type {State} */\n  function endOfPrefix(code) {\n    self.containerState.size = initialSize + self.sliceSerialize(effects.exit(\"listItemPrefix\"), true).length;\n    return ok(code);\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeListContinuation(effects, ok, nok) {\n  const self = this;\n  self.containerState._closeFlow = undefined;\n  return effects.check(blankLine, onBlank, notBlank);\n\n  /** @type {State} */\n  function onBlank(code) {\n    self.containerState.furtherBlankLines = self.containerState.furtherBlankLines || self.containerState.initialBlankLine;\n\n    // We have a blank line.\n    // Still, try to consume at most the items size.\n    return factorySpace(effects, ok, \"listItemIndent\", self.containerState.size + 1)(code);\n  }\n\n  /** @type {State} */\n  function notBlank(code) {\n    if (self.containerState.furtherBlankLines || !markdownSpace(code)) {\n      self.containerState.furtherBlankLines = undefined;\n      self.containerState.initialBlankLine = undefined;\n      return notInCurrentItem(code);\n    }\n    self.containerState.furtherBlankLines = undefined;\n    self.containerState.initialBlankLine = undefined;\n    return effects.attempt(indentConstruct, ok, notInCurrentItem)(code);\n  }\n\n  /** @type {State} */\n  function notInCurrentItem(code) {\n    // While we do continue, we signal that the flow should be closed.\n    self.containerState._closeFlow = true;\n    // As we’re closing flow, we’re no longer interrupting.\n    self.interrupt = undefined;\n    // Always populated by defaults.\n\n    return factorySpace(effects, effects.attempt(list, ok, nok), \"linePrefix\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code);\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeIndent(effects, ok, nok) {\n  const self = this;\n  return factorySpace(effects, afterPrefix, \"listItemIndent\", self.containerState.size + 1);\n\n  /** @type {State} */\n  function afterPrefix(code) {\n    const tail = self.events[self.events.length - 1];\n    return tail && tail[1].type === \"listItemIndent\" && tail[2].sliceSerialize(tail[1], true).length === self.containerState.size ? ok(code) : nok(code);\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Exiter}\n */\nfunction tokenizeListEnd(effects) {\n  effects.exit(this.containerState.type);\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeListItemPrefixWhitespace(effects, ok, nok) {\n  const self = this;\n\n  // Always populated by defaults.\n\n  return factorySpace(effects, afterPrefix, \"listItemPrefixWhitespace\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 + 1);\n\n  /** @type {State} */\n  function afterPrefix(code) {\n    const tail = self.events[self.events.length - 1];\n    return !markdownSpace(code) && tail && tail[1].type === \"listItemPrefixWhitespace\" ? ok(code) : nok(code);\n  }\n}","/**\n * @import {\n *   Code,\n *   Construct,\n *   Resolver,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const setextUnderline = {\n  name: 'setextUnderline',\n  resolveTo: resolveToSetextUnderline,\n  tokenize: tokenizeSetextUnderline\n};\n\n/** @type {Resolver} */\nfunction resolveToSetextUnderline(events, context) {\n  // To do: resolve like `markdown-rs`.\n  let index = events.length;\n  /** @type {number | undefined} */\n  let content;\n  /** @type {number | undefined} */\n  let text;\n  /** @type {number | undefined} */\n  let definition;\n\n  // Find the opening of the content.\n  // It’ll always exist: we don’t tokenize if it isn’t there.\n  while (index--) {\n    if (events[index][0] === 'enter') {\n      if (events[index][1].type === \"content\") {\n        content = index;\n        break;\n      }\n      if (events[index][1].type === \"paragraph\") {\n        text = index;\n      }\n    }\n    // Exit\n    else {\n      if (events[index][1].type === \"content\") {\n        // Remove the content end (if needed we’ll add it later)\n        events.splice(index, 1);\n      }\n      if (!definition && events[index][1].type === \"definition\") {\n        definition = index;\n      }\n    }\n  }\n  const heading = {\n    type: \"setextHeading\",\n    start: {\n      ...events[content][1].start\n    },\n    end: {\n      ...events[events.length - 1][1].end\n    }\n  };\n\n  // Change the paragraph to setext heading text.\n  events[text][1].type = \"setextHeadingText\";\n\n  // If we have definitions in the content, we’ll keep on having content,\n  // but we need move it.\n  if (definition) {\n    events.splice(text, 0, ['enter', heading, context]);\n    events.splice(definition + 1, 0, ['exit', events[content][1], context]);\n    events[content][1].end = {\n      ...events[definition][1].end\n    };\n  } else {\n    events[content][1] = heading;\n  }\n\n  // Add the heading exit at the end.\n  events.push(['exit', heading, context]);\n  return events;\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeSetextUnderline(effects, ok, nok) {\n  const self = this;\n  /** @type {NonNullable<Code>} */\n  let marker;\n  return start;\n\n  /**\n   * At start of heading (setext) underline.\n   *\n   * ```markdown\n   *   | aa\n   * > | ==\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    let index = self.events.length;\n    /** @type {boolean | undefined} */\n    let paragraph;\n    // Find an opening.\n    while (index--) {\n      // Skip enter/exit of line ending, line prefix, and content.\n      // We can now either have a definition or a paragraph.\n      if (self.events[index][1].type !== \"lineEnding\" && self.events[index][1].type !== \"linePrefix\" && self.events[index][1].type !== \"content\") {\n        paragraph = self.events[index][1].type === \"paragraph\";\n        break;\n      }\n    }\n\n    // To do: handle lazy/pierce like `markdown-rs`.\n    // To do: parse indent like `markdown-rs`.\n    if (!self.parser.lazy[self.now().line] && (self.interrupt || paragraph)) {\n      effects.enter(\"setextHeadingLine\");\n      marker = code;\n      return before(code);\n    }\n    return nok(code);\n  }\n\n  /**\n   * After optional whitespace, at `-` or `=`.\n   *\n   * ```markdown\n   *   | aa\n   * > | ==\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function before(code) {\n    effects.enter(\"setextHeadingLineSequence\");\n    return inside(code);\n  }\n\n  /**\n   * In sequence.\n   *\n   * ```markdown\n   *   | aa\n   * > | ==\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function inside(code) {\n    if (code === marker) {\n      effects.consume(code);\n      return inside;\n    }\n    effects.exit(\"setextHeadingLineSequence\");\n    return markdownSpace(code) ? factorySpace(effects, after, \"lineSuffix\")(code) : after(code);\n  }\n\n  /**\n   * After sequence, after optional whitespace.\n   *\n   * ```markdown\n   *   | aa\n   * > | ==\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function after(code) {\n    if (code === null || markdownLineEnding(code)) {\n      effects.exit(\"setextHeadingLine\");\n      return ok(code);\n    }\n    return nok(code);\n  }\n}","/**\n * @import {\n *   InitialConstruct,\n *   Initializer,\n *   State,\n *   TokenizeContext\n * } from 'micromark-util-types'\n */\n\nimport { blankLine, content } from 'micromark-core-commonmark';\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding } from 'micromark-util-character';\n/** @type {InitialConstruct} */\nexport const flow = {\n  tokenize: initializeFlow\n};\n\n/**\n * @this {TokenizeContext}\n *   Self.\n * @type {Initializer}\n *   Initializer.\n */\nfunction initializeFlow(effects) {\n  const self = this;\n  const initial = effects.attempt(\n  // Try to parse a blank line.\n  blankLine, atBlankEnding,\n  // Try to parse initial flow (essentially, only code).\n  effects.attempt(this.parser.constructs.flowInitial, afterConstruct, factorySpace(effects, effects.attempt(this.parser.constructs.flow, afterConstruct, effects.attempt(content, afterConstruct)), \"linePrefix\")));\n  return initial;\n\n  /** @type {State} */\n  function atBlankEnding(code) {\n    if (code === null) {\n      effects.consume(code);\n      return;\n    }\n    effects.enter(\"lineEndingBlank\");\n    effects.consume(code);\n    effects.exit(\"lineEndingBlank\");\n    self.currentConstruct = undefined;\n    return initial;\n  }\n\n  /** @type {State} */\n  function afterConstruct(code) {\n    if (code === null) {\n      effects.consume(code);\n      return;\n    }\n    effects.enter(\"lineEnding\");\n    effects.consume(code);\n    effects.exit(\"lineEnding\");\n    self.currentConstruct = undefined;\n    return initial;\n  }\n}","/**\n * @import {\n *   Code,\n *   InitialConstruct,\n *   Initializer,\n *   Resolver,\n *   State,\n *   TokenizeContext\n * } from 'micromark-util-types'\n */\n\nexport const resolver = {\n  resolveAll: createResolver()\n};\nexport const string = initializeFactory('string');\nexport const text = initializeFactory('text');\n\n/**\n * @param {'string' | 'text'} field\n *   Field.\n * @returns {InitialConstruct}\n *   Construct.\n */\nfunction initializeFactory(field) {\n  return {\n    resolveAll: createResolver(field === 'text' ? resolveAllLineSuffixes : undefined),\n    tokenize: initializeText\n  };\n\n  /**\n   * @this {TokenizeContext}\n   *   Context.\n   * @type {Initializer}\n   */\n  function initializeText(effects) {\n    const self = this;\n    const constructs = this.parser.constructs[field];\n    const text = effects.attempt(constructs, start, notText);\n    return start;\n\n    /** @type {State} */\n    function start(code) {\n      return atBreak(code) ? text(code) : notText(code);\n    }\n\n    /** @type {State} */\n    function notText(code) {\n      if (code === null) {\n        effects.consume(code);\n        return;\n      }\n      effects.enter(\"data\");\n      effects.consume(code);\n      return data;\n    }\n\n    /** @type {State} */\n    function data(code) {\n      if (atBreak(code)) {\n        effects.exit(\"data\");\n        return text(code);\n      }\n\n      // Data.\n      effects.consume(code);\n      return data;\n    }\n\n    /**\n     * @param {Code} code\n     *   Code.\n     * @returns {boolean}\n     *   Whether the code is a break.\n     */\n    function atBreak(code) {\n      if (code === null) {\n        return true;\n      }\n      const list = constructs[code];\n      let index = -1;\n      if (list) {\n        // Always populated by defaults.\n\n        while (++index < list.length) {\n          const item = list[index];\n          if (!item.previous || item.previous.call(self, self.previous)) {\n            return true;\n          }\n        }\n      }\n      return false;\n    }\n  }\n}\n\n/**\n * @param {Resolver | undefined} [extraResolver]\n *   Resolver.\n * @returns {Resolver}\n *   Resolver.\n */\nfunction createResolver(extraResolver) {\n  return resolveAllText;\n\n  /** @type {Resolver} */\n  function resolveAllText(events, context) {\n    let index = -1;\n    /** @type {number | undefined} */\n    let enter;\n\n    // A rather boring computation (to merge adjacent `data` events) which\n    // improves mm performance by 29%.\n    while (++index <= events.length) {\n      if (enter === undefined) {\n        if (events[index] && events[index][1].type === \"data\") {\n          enter = index;\n          index++;\n        }\n      } else if (!events[index] || events[index][1].type !== \"data\") {\n        // Don’t do anything if there is one data token.\n        if (index !== enter + 2) {\n          events[enter][1].end = events[index - 1][1].end;\n          events.splice(enter + 2, index - enter - 2);\n          index = enter + 2;\n        }\n        enter = undefined;\n      }\n    }\n    return extraResolver ? extraResolver(events, context) : events;\n  }\n}\n\n/**\n * A rather ugly set of instructions which again looks at chunks in the input\n * stream.\n * The reason to do this here is that it is *much* faster to parse in reverse.\n * And that we can’t hook into `null` to split the line suffix before an EOF.\n * To do: figure out if we can make this into a clean utility, or even in core.\n * As it will be useful for GFMs literal autolink extension (and maybe even\n * tables?)\n *\n * @type {Resolver}\n */\nfunction resolveAllLineSuffixes(events, context) {\n  let eventIndex = 0; // Skip first.\n\n  while (++eventIndex <= events.length) {\n    if ((eventIndex === events.length || events[eventIndex][1].type === \"lineEnding\") && events[eventIndex - 1][1].type === \"data\") {\n      const data = events[eventIndex - 1][1];\n      const chunks = context.sliceStream(data);\n      let index = chunks.length;\n      let bufferIndex = -1;\n      let size = 0;\n      /** @type {boolean | undefined} */\n      let tabs;\n      while (index--) {\n        const chunk = chunks[index];\n        if (typeof chunk === 'string') {\n          bufferIndex = chunk.length;\n          while (chunk.charCodeAt(bufferIndex - 1) === 32) {\n            size++;\n            bufferIndex--;\n          }\n          if (bufferIndex) break;\n          bufferIndex = -1;\n        }\n        // Number\n        else if (chunk === -2) {\n          tabs = true;\n          size++;\n        } else if (chunk === -1) {\n          // Empty\n        } else {\n          // Replacement character, exit.\n          index++;\n          break;\n        }\n      }\n\n      // Allow final trailing whitespace.\n      if (context._contentTypeTextTrailing && eventIndex === events.length) {\n        size = 0;\n      }\n      if (size) {\n        const token = {\n          type: eventIndex === events.length || tabs || size < 2 ? \"lineSuffix\" : \"hardBreakTrailing\",\n          start: {\n            _bufferIndex: index ? bufferIndex : data.start._bufferIndex + bufferIndex,\n            _index: data.start._index + index,\n            line: data.end.line,\n            column: data.end.column - size,\n            offset: data.end.offset - size\n          },\n          end: {\n            ...data.end\n          }\n        };\n        data.end = {\n          ...token.start\n        };\n        if (data.start.offset === data.end.offset) {\n          Object.assign(data, token);\n        } else {\n          events.splice(eventIndex, 0, ['enter', token, context], ['exit', token, context]);\n          eventIndex += 2;\n        }\n      }\n      eventIndex++;\n    }\n  }\n  return events;\n}","/**\n * @import {Extension} from 'micromark-util-types'\n */\n\nimport { attention, autolink, blockQuote, characterEscape, characterReference, codeFenced, codeIndented, codeText, definition, hardBreakEscape, headingAtx, htmlFlow, htmlText, labelEnd, labelStartImage, labelStartLink, lineEnding, list, setextUnderline, thematicBreak } from 'micromark-core-commonmark';\nimport { resolver as resolveText } from './initialize/text.js';\n\n/** @satisfies {Extension['document']} */\nexport const document = {\n  [42]: list,\n  [43]: list,\n  [45]: list,\n  [48]: list,\n  [49]: list,\n  [50]: list,\n  [51]: list,\n  [52]: list,\n  [53]: list,\n  [54]: list,\n  [55]: list,\n  [56]: list,\n  [57]: list,\n  [62]: blockQuote\n};\n\n/** @satisfies {Extension['contentInitial']} */\nexport const contentInitial = {\n  [91]: definition\n};\n\n/** @satisfies {Extension['flowInitial']} */\nexport const flowInitial = {\n  [-2]: codeIndented,\n  [-1]: codeIndented,\n  [32]: codeIndented\n};\n\n/** @satisfies {Extension['flow']} */\nexport const flow = {\n  [35]: headingAtx,\n  [42]: thematicBreak,\n  [45]: [setextUnderline, thematicBreak],\n  [60]: htmlFlow,\n  [61]: setextUnderline,\n  [95]: thematicBreak,\n  [96]: codeFenced,\n  [126]: codeFenced\n};\n\n/** @satisfies {Extension['string']} */\nexport const string = {\n  [38]: characterReference,\n  [92]: characterEscape\n};\n\n/** @satisfies {Extension['text']} */\nexport const text = {\n  [-5]: lineEnding,\n  [-4]: lineEnding,\n  [-3]: lineEnding,\n  [33]: labelStartImage,\n  [38]: characterReference,\n  [42]: attention,\n  [60]: [autolink, htmlText],\n  [91]: labelStartLink,\n  [92]: [hardBreakEscape, characterEscape],\n  [93]: labelEnd,\n  [95]: attention,\n  [96]: codeText\n};\n\n/** @satisfies {Extension['insideSpan']} */\nexport const insideSpan = {\n  null: [attention, resolveText]\n};\n\n/** @satisfies {Extension['attentionMarkers']} */\nexport const attentionMarkers = {\n  null: [42, 95]\n};\n\n/** @satisfies {Extension['disable']} */\nexport const disable = {\n  null: []\n};","/**\n * @import {\n *   Chunk,\n *   Code,\n *   ConstructRecord,\n *   Construct,\n *   Effects,\n *   InitialConstruct,\n *   ParseContext,\n *   Point,\n *   State,\n *   TokenizeContext,\n *   Token\n * } from 'micromark-util-types'\n */\n\n/**\n * @callback Restore\n *   Restore the state.\n * @returns {undefined}\n *   Nothing.\n *\n * @typedef Info\n *   Info.\n * @property {Restore} restore\n *   Restore.\n * @property {number} from\n *   From.\n *\n * @callback ReturnHandle\n *   Handle a successful run.\n * @param {Construct} construct\n *   Construct.\n * @param {Info} info\n *   Info.\n * @returns {undefined}\n *   Nothing.\n */\n\nimport { markdownLineEnding } from 'micromark-util-character';\nimport { push, splice } from 'micromark-util-chunked';\nimport { resolveAll } from 'micromark-util-resolve-all';\n/**\n * Create a tokenizer.\n * Tokenizers deal with one type of data (e.g., containers, flow, text).\n * The parser is the object dealing with it all.\n * `initialize` works like other constructs, except that only its `tokenize`\n * function is used, in which case it doesn’t receive an `ok` or `nok`.\n * `from` can be given to set the point before the first character, although\n * when further lines are indented, they must be set with `defineSkip`.\n *\n * @param {ParseContext} parser\n *   Parser.\n * @param {InitialConstruct} initialize\n *   Construct.\n * @param {Omit<Point, '_bufferIndex' | '_index'> | undefined} [from]\n *   Point (optional).\n * @returns {TokenizeContext}\n *   Context.\n */\nexport function createTokenizer(parser, initialize, from) {\n  /** @type {Point} */\n  let point = {\n    _bufferIndex: -1,\n    _index: 0,\n    line: from && from.line || 1,\n    column: from && from.column || 1,\n    offset: from && from.offset || 0\n  };\n  /** @type {Record<string, number>} */\n  const columnStart = {};\n  /** @type {Array<Construct>} */\n  const resolveAllConstructs = [];\n  /** @type {Array<Chunk>} */\n  let chunks = [];\n  /** @type {Array<Token>} */\n  let stack = [];\n  /** @type {boolean | undefined} */\n  let consumed = true;\n\n  /**\n   * Tools used for tokenizing.\n   *\n   * @type {Effects}\n   */\n  const effects = {\n    attempt: constructFactory(onsuccessfulconstruct),\n    check: constructFactory(onsuccessfulcheck),\n    consume,\n    enter,\n    exit,\n    interrupt: constructFactory(onsuccessfulcheck, {\n      interrupt: true\n    })\n  };\n\n  /**\n   * State and tools for resolving and serializing.\n   *\n   * @type {TokenizeContext}\n   */\n  const context = {\n    code: null,\n    containerState: {},\n    defineSkip,\n    events: [],\n    now,\n    parser,\n    previous: null,\n    sliceSerialize,\n    sliceStream,\n    write\n  };\n\n  /**\n   * The state function.\n   *\n   * @type {State | undefined}\n   */\n  let state = initialize.tokenize.call(context, effects);\n\n  /**\n   * Track which character we expect to be consumed, to catch bugs.\n   *\n   * @type {Code}\n   */\n  let expectedCode;\n  if (initialize.resolveAll) {\n    resolveAllConstructs.push(initialize);\n  }\n  return context;\n\n  /** @type {TokenizeContext['write']} */\n  function write(slice) {\n    chunks = push(chunks, slice);\n    main();\n\n    // Exit if we’re not done, resolve might change stuff.\n    if (chunks[chunks.length - 1] !== null) {\n      return [];\n    }\n    addResult(initialize, 0);\n\n    // Otherwise, resolve, and exit.\n    context.events = resolveAll(resolveAllConstructs, context.events, context);\n    return context.events;\n  }\n\n  //\n  // Tools.\n  //\n\n  /** @type {TokenizeContext['sliceSerialize']} */\n  function sliceSerialize(token, expandTabs) {\n    return serializeChunks(sliceStream(token), expandTabs);\n  }\n\n  /** @type {TokenizeContext['sliceStream']} */\n  function sliceStream(token) {\n    return sliceChunks(chunks, token);\n  }\n\n  /** @type {TokenizeContext['now']} */\n  function now() {\n    // This is a hot path, so we clone manually instead of `Object.assign({}, point)`\n    const {\n      _bufferIndex,\n      _index,\n      line,\n      column,\n      offset\n    } = point;\n    return {\n      _bufferIndex,\n      _index,\n      line,\n      column,\n      offset\n    };\n  }\n\n  /** @type {TokenizeContext['defineSkip']} */\n  function defineSkip(value) {\n    columnStart[value.line] = value.column;\n    accountForPotentialSkip();\n  }\n\n  //\n  // State management.\n  //\n\n  /**\n   * Main loop (note that `_index` and `_bufferIndex` in `point` are modified by\n   * `consume`).\n   * Here is where we walk through the chunks, which either include strings of\n   * several characters, or numerical character codes.\n   * The reason to do this in a loop instead of a call is so the stack can\n   * drain.\n   *\n   * @returns {undefined}\n   *   Nothing.\n   */\n  function main() {\n    /** @type {number} */\n    let chunkIndex;\n    while (point._index < chunks.length) {\n      const chunk = chunks[point._index];\n\n      // If we’re in a buffer chunk, loop through it.\n      if (typeof chunk === 'string') {\n        chunkIndex = point._index;\n        if (point._bufferIndex < 0) {\n          point._bufferIndex = 0;\n        }\n        while (point._index === chunkIndex && point._bufferIndex < chunk.length) {\n          go(chunk.charCodeAt(point._bufferIndex));\n        }\n      } else {\n        go(chunk);\n      }\n    }\n  }\n\n  /**\n   * Deal with one code.\n   *\n   * @param {Code} code\n   *   Code.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  function go(code) {\n    consumed = undefined;\n    expectedCode = code;\n    state = state(code);\n  }\n\n  /** @type {Effects['consume']} */\n  function consume(code) {\n    if (markdownLineEnding(code)) {\n      point.line++;\n      point.column = 1;\n      point.offset += code === -3 ? 2 : 1;\n      accountForPotentialSkip();\n    } else if (code !== -1) {\n      point.column++;\n      point.offset++;\n    }\n\n    // Not in a string chunk.\n    if (point._bufferIndex < 0) {\n      point._index++;\n    } else {\n      point._bufferIndex++;\n\n      // At end of string chunk.\n      if (point._bufferIndex ===\n      // Points w/ non-negative `_bufferIndex` reference\n      // strings.\n      /** @type {string} */\n      chunks[point._index].length) {\n        point._bufferIndex = -1;\n        point._index++;\n      }\n    }\n\n    // Expose the previous character.\n    context.previous = code;\n\n    // Mark as consumed.\n    consumed = true;\n  }\n\n  /** @type {Effects['enter']} */\n  function enter(type, fields) {\n    /** @type {Token} */\n    // @ts-expect-error Patch instead of assign required fields to help GC.\n    const token = fields || {};\n    token.type = type;\n    token.start = now();\n    context.events.push(['enter', token, context]);\n    stack.push(token);\n    return token;\n  }\n\n  /** @type {Effects['exit']} */\n  function exit(type) {\n    const token = stack.pop();\n    token.end = now();\n    context.events.push(['exit', token, context]);\n    return token;\n  }\n\n  /**\n   * Use results.\n   *\n   * @type {ReturnHandle}\n   */\n  function onsuccessfulconstruct(construct, info) {\n    addResult(construct, info.from);\n  }\n\n  /**\n   * Discard results.\n   *\n   * @type {ReturnHandle}\n   */\n  function onsuccessfulcheck(_, info) {\n    info.restore();\n  }\n\n  /**\n   * Factory to attempt/check/interrupt.\n   *\n   * @param {ReturnHandle} onreturn\n   *   Callback.\n   * @param {{interrupt?: boolean | undefined} | undefined} [fields]\n   *   Fields.\n   */\n  function constructFactory(onreturn, fields) {\n    return hook;\n\n    /**\n     * Handle either an object mapping codes to constructs, a list of\n     * constructs, or a single construct.\n     *\n     * @param {Array<Construct> | ConstructRecord | Construct} constructs\n     *   Constructs.\n     * @param {State} returnState\n     *   State.\n     * @param {State | undefined} [bogusState]\n     *   State.\n     * @returns {State}\n     *   State.\n     */\n    function hook(constructs, returnState, bogusState) {\n      /** @type {ReadonlyArray<Construct>} */\n      let listOfConstructs;\n      /** @type {number} */\n      let constructIndex;\n      /** @type {Construct} */\n      let currentConstruct;\n      /** @type {Info} */\n      let info;\n      return Array.isArray(constructs) ? /* c8 ignore next 1 */\n      handleListOfConstructs(constructs) : 'tokenize' in constructs ?\n      // Looks like a construct.\n      handleListOfConstructs([(/** @type {Construct} */constructs)]) : handleMapOfConstructs(constructs);\n\n      /**\n       * Handle a list of construct.\n       *\n       * @param {ConstructRecord} map\n       *   Constructs.\n       * @returns {State}\n       *   State.\n       */\n      function handleMapOfConstructs(map) {\n        return start;\n\n        /** @type {State} */\n        function start(code) {\n          const left = code !== null && map[code];\n          const all = code !== null && map.null;\n          const list = [\n          // To do: add more extension tests.\n          /* c8 ignore next 2 */\n          ...(Array.isArray(left) ? left : left ? [left] : []), ...(Array.isArray(all) ? all : all ? [all] : [])];\n          return handleListOfConstructs(list)(code);\n        }\n      }\n\n      /**\n       * Handle a list of construct.\n       *\n       * @param {ReadonlyArray<Construct>} list\n       *   Constructs.\n       * @returns {State}\n       *   State.\n       */\n      function handleListOfConstructs(list) {\n        listOfConstructs = list;\n        constructIndex = 0;\n        if (list.length === 0) {\n          return bogusState;\n        }\n        return handleConstruct(list[constructIndex]);\n      }\n\n      /**\n       * Handle a single construct.\n       *\n       * @param {Construct} construct\n       *   Construct.\n       * @returns {State}\n       *   State.\n       */\n      function handleConstruct(construct) {\n        return start;\n\n        /** @type {State} */\n        function start(code) {\n          // To do: not needed to store if there is no bogus state, probably?\n          // Currently doesn’t work because `inspect` in document does a check\n          // w/o a bogus, which doesn’t make sense. But it does seem to help perf\n          // by not storing.\n          info = store();\n          currentConstruct = construct;\n          if (!construct.partial) {\n            context.currentConstruct = construct;\n          }\n\n          // Always populated by defaults.\n\n          if (construct.name && context.parser.constructs.disable.null.includes(construct.name)) {\n            return nok(code);\n          }\n          return construct.tokenize.call(\n          // If we do have fields, create an object w/ `context` as its\n          // prototype.\n          // This allows a “live binding”, which is needed for `interrupt`.\n          fields ? Object.assign(Object.create(context), fields) : context, effects, ok, nok)(code);\n        }\n      }\n\n      /** @type {State} */\n      function ok(code) {\n        consumed = true;\n        onreturn(currentConstruct, info);\n        return returnState;\n      }\n\n      /** @type {State} */\n      function nok(code) {\n        consumed = true;\n        info.restore();\n        if (++constructIndex < listOfConstructs.length) {\n          return handleConstruct(listOfConstructs[constructIndex]);\n        }\n        return bogusState;\n      }\n    }\n  }\n\n  /**\n   * @param {Construct} construct\n   *   Construct.\n   * @param {number} from\n   *   From.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  function addResult(construct, from) {\n    if (construct.resolveAll && !resolveAllConstructs.includes(construct)) {\n      resolveAllConstructs.push(construct);\n    }\n    if (construct.resolve) {\n      splice(context.events, from, context.events.length - from, construct.resolve(context.events.slice(from), context));\n    }\n    if (construct.resolveTo) {\n      context.events = construct.resolveTo(context.events, context);\n    }\n  }\n\n  /**\n   * Store state.\n   *\n   * @returns {Info}\n   *   Info.\n   */\n  function store() {\n    const startPoint = now();\n    const startPrevious = context.previous;\n    const startCurrentConstruct = context.currentConstruct;\n    const startEventsIndex = context.events.length;\n    const startStack = Array.from(stack);\n    return {\n      from: startEventsIndex,\n      restore\n    };\n\n    /**\n     * Restore state.\n     *\n     * @returns {undefined}\n     *   Nothing.\n     */\n    function restore() {\n      point = startPoint;\n      context.previous = startPrevious;\n      context.currentConstruct = startCurrentConstruct;\n      context.events.length = startEventsIndex;\n      stack = startStack;\n      accountForPotentialSkip();\n    }\n  }\n\n  /**\n   * Move the current point a bit forward in the line when it’s on a column\n   * skip.\n   *\n   * @returns {undefined}\n   *   Nothing.\n   */\n  function accountForPotentialSkip() {\n    if (point.line in columnStart && point.column < 2) {\n      point.column = columnStart[point.line];\n      point.offset += columnStart[point.line] - 1;\n    }\n  }\n}\n\n/**\n * Get the chunks from a slice of chunks in the range of a token.\n *\n * @param {ReadonlyArray<Chunk>} chunks\n *   Chunks.\n * @param {Pick<Token, 'end' | 'start'>} token\n *   Token.\n * @returns {Array<Chunk>}\n *   Chunks.\n */\nfunction sliceChunks(chunks, token) {\n  const startIndex = token.start._index;\n  const startBufferIndex = token.start._bufferIndex;\n  const endIndex = token.end._index;\n  const endBufferIndex = token.end._bufferIndex;\n  /** @type {Array<Chunk>} */\n  let view;\n  if (startIndex === endIndex) {\n    // @ts-expect-error `_bufferIndex` is used on string chunks.\n    view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)];\n  } else {\n    view = chunks.slice(startIndex, endIndex);\n    if (startBufferIndex > -1) {\n      const head = view[0];\n      if (typeof head === 'string') {\n        view[0] = head.slice(startBufferIndex);\n        /* c8 ignore next 4 -- used to be used, no longer */\n      } else {\n        view.shift();\n      }\n    }\n    if (endBufferIndex > 0) {\n      // @ts-expect-error `_bufferIndex` is used on string chunks.\n      view.push(chunks[endIndex].slice(0, endBufferIndex));\n    }\n  }\n  return view;\n}\n\n/**\n * Get the string value of a slice of chunks.\n *\n * @param {ReadonlyArray<Chunk>} chunks\n *   Chunks.\n * @param {boolean | undefined} [expandTabs=false]\n *   Whether to expand tabs (default: `false`).\n * @returns {string}\n *   Result.\n */\nfunction serializeChunks(chunks, expandTabs) {\n  let index = -1;\n  /** @type {Array<string>} */\n  const result = [];\n  /** @type {boolean | undefined} */\n  let atTab;\n  while (++index < chunks.length) {\n    const chunk = chunks[index];\n    /** @type {string} */\n    let value;\n    if (typeof chunk === 'string') {\n      value = chunk;\n    } else switch (chunk) {\n      case -5:\n        {\n          value = \"\\r\";\n          break;\n        }\n      case -4:\n        {\n          value = \"\\n\";\n          break;\n        }\n      case -3:\n        {\n          value = \"\\r\" + \"\\n\";\n          break;\n        }\n      case -2:\n        {\n          value = expandTabs ? \" \" : \"\\t\";\n          break;\n        }\n      case -1:\n        {\n          if (!expandTabs && atTab) continue;\n          value = \" \";\n          break;\n        }\n      default:\n        {\n          // Currently only replacement character.\n          value = String.fromCharCode(chunk);\n        }\n    }\n    atTab = chunk === -2;\n    result.push(value);\n  }\n  return result.join('');\n}","/**\n * @import {\n *   Create,\n *   FullNormalizedExtension,\n *   InitialConstruct,\n *   ParseContext,\n *   ParseOptions\n * } from 'micromark-util-types'\n */\n\nimport { combineExtensions } from 'micromark-util-combine-extensions';\nimport { content } from './initialize/content.js';\nimport { document } from './initialize/document.js';\nimport { flow } from './initialize/flow.js';\nimport { string, text } from './initialize/text.js';\nimport * as defaultConstructs from './constructs.js';\nimport { createTokenizer } from './create-tokenizer.js';\n\n/**\n * @param {ParseOptions | null | undefined} [options]\n *   Configuration (optional).\n * @returns {ParseContext}\n *   Parser.\n */\nexport function parse(options) {\n  const settings = options || {};\n  const constructs = /** @type {FullNormalizedExtension} */\n  combineExtensions([defaultConstructs, ...(settings.extensions || [])]);\n\n  /** @type {ParseContext} */\n  const parser = {\n    constructs,\n    content: create(content),\n    defined: [],\n    document: create(document),\n    flow: create(flow),\n    lazy: {},\n    string: create(string),\n    text: create(text)\n  };\n  return parser;\n\n  /**\n   * @param {InitialConstruct} initial\n   *   Construct to start with.\n   * @returns {Create}\n   *   Create a tokenizer.\n   */\n  function create(initial) {\n    return creator;\n    /** @type {Create} */\n    function creator(from) {\n      return createTokenizer(parser, initial, from);\n    }\n  }\n}","/**\n * @import {Event} from 'micromark-util-types'\n */\n\nimport { subtokenize } from 'micromark-util-subtokenize';\n\n/**\n * @param {Array<Event>} events\n *   Events.\n * @returns {Array<Event>}\n *   Events.\n */\nexport function postprocess(events) {\n  while (!subtokenize(events)) {\n    // Empty\n  }\n  return events;\n}","/**\n * @import {Chunk, Code, Encoding, Value} from 'micromark-util-types'\n */\n\n/**\n * @callback Preprocessor\n *   Preprocess a value.\n * @param {Value} value\n *   Value.\n * @param {Encoding | null | undefined} [encoding]\n *   Encoding when `value` is a typed array (optional).\n * @param {boolean | null | undefined} [end=false]\n *   Whether this is the last chunk (default: `false`).\n * @returns {Array<Chunk>}\n *   Chunks.\n */\n\nconst search = /[\\0\\t\\n\\r]/g;\n\n/**\n * @returns {Preprocessor}\n *   Preprocess a value.\n */\nexport function preprocess() {\n  let column = 1;\n  let buffer = '';\n  /** @type {boolean | undefined} */\n  let start = true;\n  /** @type {boolean | undefined} */\n  let atCarriageReturn;\n  return preprocessor;\n\n  /** @type {Preprocessor} */\n  // eslint-disable-next-line complexity\n  function preprocessor(value, encoding, end) {\n    /** @type {Array<Chunk>} */\n    const chunks = [];\n    /** @type {RegExpMatchArray | null} */\n    let match;\n    /** @type {number} */\n    let next;\n    /** @type {number} */\n    let startPosition;\n    /** @type {number} */\n    let endPosition;\n    /** @type {Code} */\n    let code;\n    value = buffer + (typeof value === 'string' ? value.toString() : new TextDecoder(encoding || undefined).decode(value));\n    startPosition = 0;\n    buffer = '';\n    if (start) {\n      // To do: `markdown-rs` actually parses BOMs (byte order mark).\n      if (value.charCodeAt(0) === 65279) {\n        startPosition++;\n      }\n      start = undefined;\n    }\n    while (startPosition < value.length) {\n      search.lastIndex = startPosition;\n      match = search.exec(value);\n      endPosition = match && match.index !== undefined ? match.index : value.length;\n      code = value.charCodeAt(endPosition);\n      if (!match) {\n        buffer = value.slice(startPosition);\n        break;\n      }\n      if (code === 10 && startPosition === endPosition && atCarriageReturn) {\n        chunks.push(-3);\n        atCarriageReturn = undefined;\n      } else {\n        if (atCarriageReturn) {\n          chunks.push(-5);\n          atCarriageReturn = undefined;\n        }\n        if (startPosition < endPosition) {\n          chunks.push(value.slice(startPosition, endPosition));\n          column += endPosition - startPosition;\n        }\n        switch (code) {\n          case 0:\n            {\n              chunks.push(65533);\n              column++;\n              break;\n            }\n          case 9:\n            {\n              next = Math.ceil(column / 4) * 4;\n              chunks.push(-2);\n              while (column++ < next) chunks.push(-1);\n              break;\n            }\n          case 10:\n            {\n              chunks.push(-4);\n              column = 1;\n              break;\n            }\n          default:\n            {\n              atCarriageReturn = true;\n              column = 1;\n            }\n        }\n      }\n      startPosition = endPosition + 1;\n    }\n    if (end) {\n      if (atCarriageReturn) chunks.push(-5);\n      if (buffer) chunks.push(buffer);\n      chunks.push(null);\n    }\n    return chunks;\n  }\n}","import { decodeNamedCharacterReference } from 'decode-named-character-reference';\nimport { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference';\nconst characterEscapeOrReference = /\\\\([!-/:-@[-`{-~])|&(#(?:\\d{1,7}|x[\\da-f]{1,6})|[\\da-z]{1,31});/gi;\n\n/**\n * Decode markdown strings (which occur in places such as fenced code info\n * strings, destinations, labels, and titles).\n *\n * The “string” content type allows character escapes and -references.\n * This decodes those.\n *\n * @param {string} value\n *   Value to decode.\n * @returns {string}\n *   Decoded value.\n */\nexport function decodeString(value) {\n  return value.replace(characterEscapeOrReference, decode);\n}\n\n/**\n * @param {string} $0\n *   Match.\n * @param {string} $1\n *   Character escape.\n * @param {string} $2\n *   Character reference.\n * @returns {string}\n *   Decoded value\n */\nfunction decode($0, $1, $2) {\n  if ($1) {\n    // Escape.\n    return $1;\n  }\n\n  // Reference.\n  const head = $2.charCodeAt(0);\n  if (head === 35) {\n    const head = $2.charCodeAt(1);\n    const hex = head === 120 || head === 88;\n    return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10);\n  }\n  return decodeNamedCharacterReference($2) || $0;\n}","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Point} Point\n * @typedef {import('unist').Position} Position\n */\n\n/**\n * @typedef NodeLike\n * @property {string} type\n * @property {PositionLike | null | undefined} [position]\n *\n * @typedef PointLike\n * @property {number | null | undefined} [line]\n * @property {number | null | undefined} [column]\n * @property {number | null | undefined} [offset]\n *\n * @typedef PositionLike\n * @property {PointLike | null | undefined} [start]\n * @property {PointLike | null | undefined} [end]\n */\n\n/**\n * Serialize the positional info of a point, position (start and end points),\n * or node.\n *\n * @param {Node | NodeLike | Point | PointLike | Position | PositionLike | null | undefined} [value]\n *   Node, position, or point.\n * @returns {string}\n *   Pretty printed positional info of a node (`string`).\n *\n *   In the format of a range `ls:cs-le:ce` (when given `node` or `position`)\n *   or a point `l:c` (when given `point`), where `l` stands for line, `c` for\n *   column, `s` for `start`, and `e` for end.\n *   An empty string (`''`) is returned if the given value is neither `node`,\n *   `position`, nor `point`.\n */\nexport function stringifyPosition(value) {\n  // Nothing.\n  if (!value || typeof value !== 'object') {\n    return ''\n  }\n\n  // Node.\n  if ('position' in value || 'type' in value) {\n    return position(value.position)\n  }\n\n  // Position.\n  if ('start' in value || 'end' in value) {\n    return position(value)\n  }\n\n  // Point.\n  if ('line' in value || 'column' in value) {\n    return point(value)\n  }\n\n  // ?\n  return ''\n}\n\n/**\n * @param {Point | PointLike | null | undefined} point\n * @returns {string}\n */\nfunction point(point) {\n  return index(point && point.line) + ':' + index(point && point.column)\n}\n\n/**\n * @param {Position | PositionLike | null | undefined} pos\n * @returns {string}\n */\nfunction position(pos) {\n  return point(pos && pos.start) + '-' + point(pos && pos.end)\n}\n\n/**\n * @param {number | null | undefined} value\n * @returns {number}\n */\nfunction index(value) {\n  return value && typeof value === 'number' ? value : 1\n}\n","/**\n * @import {\n *   Break,\n *   Blockquote,\n *   Code,\n *   Definition,\n *   Emphasis,\n *   Heading,\n *   Html,\n *   Image,\n *   InlineCode,\n *   Link,\n *   ListItem,\n *   List,\n *   Nodes,\n *   Paragraph,\n *   PhrasingContent,\n *   ReferenceType,\n *   Root,\n *   Strong,\n *   Text,\n *   ThematicBreak\n * } from 'mdast'\n * @import {\n *   Encoding,\n *   Event,\n *   Token,\n *   Value\n * } from 'micromark-util-types'\n * @import {Point} from 'unist'\n * @import {\n *   CompileContext,\n *   CompileData,\n *   Config,\n *   Extension,\n *   Handle,\n *   OnEnterError,\n *   Options\n * } from './types.js'\n */\n\nimport { toString } from 'mdast-util-to-string';\nimport { parse, postprocess, preprocess } from 'micromark';\nimport { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference';\nimport { decodeString } from 'micromark-util-decode-string';\nimport { normalizeIdentifier } from 'micromark-util-normalize-identifier';\nimport { decodeNamedCharacterReference } from 'decode-named-character-reference';\nimport { stringifyPosition } from 'unist-util-stringify-position';\nconst own = {}.hasOwnProperty;\n\n/**\n * Turn markdown into a syntax tree.\n *\n * @overload\n * @param {Value} value\n * @param {Encoding | null | undefined} [encoding]\n * @param {Options | null | undefined} [options]\n * @returns {Root}\n *\n * @overload\n * @param {Value} value\n * @param {Options | null | undefined} [options]\n * @returns {Root}\n *\n * @param {Value} value\n *   Markdown to parse.\n * @param {Encoding | Options | null | undefined} [encoding]\n *   Character encoding for when `value` is `Buffer`.\n * @param {Options | null | undefined} [options]\n *   Configuration.\n * @returns {Root}\n *   mdast tree.\n */\nexport function fromMarkdown(value, encoding, options) {\n  if (typeof encoding !== 'string') {\n    options = encoding;\n    encoding = undefined;\n  }\n  return compiler(options)(postprocess(parse(options).document().write(preprocess()(value, encoding, true))));\n}\n\n/**\n * Note this compiler only understand complete buffering, not streaming.\n *\n * @param {Options | null | undefined} [options]\n */\nfunction compiler(options) {\n  /** @type {Config} */\n  const config = {\n    transforms: [],\n    canContainEols: ['emphasis', 'fragment', 'heading', 'paragraph', 'strong'],\n    enter: {\n      autolink: opener(link),\n      autolinkProtocol: onenterdata,\n      autolinkEmail: onenterdata,\n      atxHeading: opener(heading),\n      blockQuote: opener(blockQuote),\n      characterEscape: onenterdata,\n      characterReference: onenterdata,\n      codeFenced: opener(codeFlow),\n      codeFencedFenceInfo: buffer,\n      codeFencedFenceMeta: buffer,\n      codeIndented: opener(codeFlow, buffer),\n      codeText: opener(codeText, buffer),\n      codeTextData: onenterdata,\n      data: onenterdata,\n      codeFlowValue: onenterdata,\n      definition: opener(definition),\n      definitionDestinationString: buffer,\n      definitionLabelString: buffer,\n      definitionTitleString: buffer,\n      emphasis: opener(emphasis),\n      hardBreakEscape: opener(hardBreak),\n      hardBreakTrailing: opener(hardBreak),\n      htmlFlow: opener(html, buffer),\n      htmlFlowData: onenterdata,\n      htmlText: opener(html, buffer),\n      htmlTextData: onenterdata,\n      image: opener(image),\n      label: buffer,\n      link: opener(link),\n      listItem: opener(listItem),\n      listItemValue: onenterlistitemvalue,\n      listOrdered: opener(list, onenterlistordered),\n      listUnordered: opener(list),\n      paragraph: opener(paragraph),\n      reference: onenterreference,\n      referenceString: buffer,\n      resourceDestinationString: buffer,\n      resourceTitleString: buffer,\n      setextHeading: opener(heading),\n      strong: opener(strong),\n      thematicBreak: opener(thematicBreak)\n    },\n    exit: {\n      atxHeading: closer(),\n      atxHeadingSequence: onexitatxheadingsequence,\n      autolink: closer(),\n      autolinkEmail: onexitautolinkemail,\n      autolinkProtocol: onexitautolinkprotocol,\n      blockQuote: closer(),\n      characterEscapeValue: onexitdata,\n      characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker,\n      characterReferenceMarkerNumeric: onexitcharacterreferencemarker,\n      characterReferenceValue: onexitcharacterreferencevalue,\n      characterReference: onexitcharacterreference,\n      codeFenced: closer(onexitcodefenced),\n      codeFencedFence: onexitcodefencedfence,\n      codeFencedFenceInfo: onexitcodefencedfenceinfo,\n      codeFencedFenceMeta: onexitcodefencedfencemeta,\n      codeFlowValue: onexitdata,\n      codeIndented: closer(onexitcodeindented),\n      codeText: closer(onexitcodetext),\n      codeTextData: onexitdata,\n      data: onexitdata,\n      definition: closer(),\n      definitionDestinationString: onexitdefinitiondestinationstring,\n      definitionLabelString: onexitdefinitionlabelstring,\n      definitionTitleString: onexitdefinitiontitlestring,\n      emphasis: closer(),\n      hardBreakEscape: closer(onexithardbreak),\n      hardBreakTrailing: closer(onexithardbreak),\n      htmlFlow: closer(onexithtmlflow),\n      htmlFlowData: onexitdata,\n      htmlText: closer(onexithtmltext),\n      htmlTextData: onexitdata,\n      image: closer(onexitimage),\n      label: onexitlabel,\n      labelText: onexitlabeltext,\n      lineEnding: onexitlineending,\n      link: closer(onexitlink),\n      listItem: closer(),\n      listOrdered: closer(),\n      listUnordered: closer(),\n      paragraph: closer(),\n      referenceString: onexitreferencestring,\n      resourceDestinationString: onexitresourcedestinationstring,\n      resourceTitleString: onexitresourcetitlestring,\n      resource: onexitresource,\n      setextHeading: closer(onexitsetextheading),\n      setextHeadingLineSequence: onexitsetextheadinglinesequence,\n      setextHeadingText: onexitsetextheadingtext,\n      strong: closer(),\n      thematicBreak: closer()\n    }\n  };\n  configure(config, (options || {}).mdastExtensions || []);\n\n  /** @type {CompileData} */\n  const data = {};\n  return compile;\n\n  /**\n   * Turn micromark events into an mdast tree.\n   *\n   * @param {Array<Event>} events\n   *   Events.\n   * @returns {Root}\n   *   mdast tree.\n   */\n  function compile(events) {\n    /** @type {Root} */\n    let tree = {\n      type: 'root',\n      children: []\n    };\n    /** @type {Omit<CompileContext, 'sliceSerialize'>} */\n    const context = {\n      stack: [tree],\n      tokenStack: [],\n      config,\n      enter,\n      exit,\n      buffer,\n      resume,\n      data\n    };\n    /** @type {Array<number>} */\n    const listStack = [];\n    let index = -1;\n    while (++index < events.length) {\n      // We preprocess lists to add `listItem` tokens, and to infer whether\n      // items the list itself are spread out.\n      if (events[index][1].type === \"listOrdered\" || events[index][1].type === \"listUnordered\") {\n        if (events[index][0] === 'enter') {\n          listStack.push(index);\n        } else {\n          const tail = listStack.pop();\n          index = prepareList(events, tail, index);\n        }\n      }\n    }\n    index = -1;\n    while (++index < events.length) {\n      const handler = config[events[index][0]];\n      if (own.call(handler, events[index][1].type)) {\n        handler[events[index][1].type].call(Object.assign({\n          sliceSerialize: events[index][2].sliceSerialize\n        }, context), events[index][1]);\n      }\n    }\n\n    // Handle tokens still being open.\n    if (context.tokenStack.length > 0) {\n      const tail = context.tokenStack[context.tokenStack.length - 1];\n      const handler = tail[1] || defaultOnError;\n      handler.call(context, undefined, tail[0]);\n    }\n\n    // Figure out `root` position.\n    tree.position = {\n      start: point(events.length > 0 ? events[0][1].start : {\n        line: 1,\n        column: 1,\n        offset: 0\n      }),\n      end: point(events.length > 0 ? events[events.length - 2][1].end : {\n        line: 1,\n        column: 1,\n        offset: 0\n      })\n    };\n\n    // Call transforms.\n    index = -1;\n    while (++index < config.transforms.length) {\n      tree = config.transforms[index](tree) || tree;\n    }\n    return tree;\n  }\n\n  /**\n   * @param {Array<Event>} events\n   * @param {number} start\n   * @param {number} length\n   * @returns {number}\n   */\n  function prepareList(events, start, length) {\n    let index = start - 1;\n    let containerBalance = -1;\n    let listSpread = false;\n    /** @type {Token | undefined} */\n    let listItem;\n    /** @type {number | undefined} */\n    let lineIndex;\n    /** @type {number | undefined} */\n    let firstBlankLineIndex;\n    /** @type {boolean | undefined} */\n    let atMarker;\n    while (++index <= length) {\n      const event = events[index];\n      switch (event[1].type) {\n        case \"listUnordered\":\n        case \"listOrdered\":\n        case \"blockQuote\":\n          {\n            if (event[0] === 'enter') {\n              containerBalance++;\n            } else {\n              containerBalance--;\n            }\n            atMarker = undefined;\n            break;\n          }\n        case \"lineEndingBlank\":\n          {\n            if (event[0] === 'enter') {\n              if (listItem && !atMarker && !containerBalance && !firstBlankLineIndex) {\n                firstBlankLineIndex = index;\n              }\n              atMarker = undefined;\n            }\n            break;\n          }\n        case \"linePrefix\":\n        case \"listItemValue\":\n        case \"listItemMarker\":\n        case \"listItemPrefix\":\n        case \"listItemPrefixWhitespace\":\n          {\n            // Empty.\n\n            break;\n          }\n        default:\n          {\n            atMarker = undefined;\n          }\n      }\n      if (!containerBalance && event[0] === 'enter' && event[1].type === \"listItemPrefix\" || containerBalance === -1 && event[0] === 'exit' && (event[1].type === \"listUnordered\" || event[1].type === \"listOrdered\")) {\n        if (listItem) {\n          let tailIndex = index;\n          lineIndex = undefined;\n          while (tailIndex--) {\n            const tailEvent = events[tailIndex];\n            if (tailEvent[1].type === \"lineEnding\" || tailEvent[1].type === \"lineEndingBlank\") {\n              if (tailEvent[0] === 'exit') continue;\n              if (lineIndex) {\n                events[lineIndex][1].type = \"lineEndingBlank\";\n                listSpread = true;\n              }\n              tailEvent[1].type = \"lineEnding\";\n              lineIndex = tailIndex;\n            } else if (tailEvent[1].type === \"linePrefix\" || tailEvent[1].type === \"blockQuotePrefix\" || tailEvent[1].type === \"blockQuotePrefixWhitespace\" || tailEvent[1].type === \"blockQuoteMarker\" || tailEvent[1].type === \"listItemIndent\") {\n              // Empty\n            } else {\n              break;\n            }\n          }\n          if (firstBlankLineIndex && (!lineIndex || firstBlankLineIndex < lineIndex)) {\n            listItem._spread = true;\n          }\n\n          // Fix position.\n          listItem.end = Object.assign({}, lineIndex ? events[lineIndex][1].start : event[1].end);\n          events.splice(lineIndex || index, 0, ['exit', listItem, event[2]]);\n          index++;\n          length++;\n        }\n\n        // Create a new list item.\n        if (event[1].type === \"listItemPrefix\") {\n          /** @type {Token} */\n          const item = {\n            type: 'listItem',\n            _spread: false,\n            start: Object.assign({}, event[1].start),\n            // @ts-expect-error: we’ll add `end` in a second.\n            end: undefined\n          };\n          listItem = item;\n          events.splice(index, 0, ['enter', item, event[2]]);\n          index++;\n          length++;\n          firstBlankLineIndex = undefined;\n          atMarker = true;\n        }\n      }\n    }\n    events[start][1]._spread = listSpread;\n    return length;\n  }\n\n  /**\n   * Create an opener handle.\n   *\n   * @param {(token: Token) => Nodes} create\n   *   Create a node.\n   * @param {Handle | undefined} [and]\n   *   Optional function to also run.\n   * @returns {Handle}\n   *   Handle.\n   */\n  function opener(create, and) {\n    return open;\n\n    /**\n     * @this {CompileContext}\n     * @param {Token} token\n     * @returns {undefined}\n     */\n    function open(token) {\n      enter.call(this, create(token), token);\n      if (and) and.call(this, token);\n    }\n  }\n\n  /**\n   * @type {CompileContext['buffer']}\n   */\n  function buffer() {\n    this.stack.push({\n      type: 'fragment',\n      children: []\n    });\n  }\n\n  /**\n   * @type {CompileContext['enter']}\n   */\n  function enter(node, token, errorHandler) {\n    const parent = this.stack[this.stack.length - 1];\n    /** @type {Array<Nodes>} */\n    const siblings = parent.children;\n    siblings.push(node);\n    this.stack.push(node);\n    this.tokenStack.push([token, errorHandler || undefined]);\n    node.position = {\n      start: point(token.start),\n      // @ts-expect-error: `end` will be patched later.\n      end: undefined\n    };\n  }\n\n  /**\n   * Create a closer handle.\n   *\n   * @param {Handle | undefined} [and]\n   *   Optional function to also run.\n   * @returns {Handle}\n   *   Handle.\n   */\n  function closer(and) {\n    return close;\n\n    /**\n     * @this {CompileContext}\n     * @param {Token} token\n     * @returns {undefined}\n     */\n    function close(token) {\n      if (and) and.call(this, token);\n      exit.call(this, token);\n    }\n  }\n\n  /**\n   * @type {CompileContext['exit']}\n   */\n  function exit(token, onExitError) {\n    const node = this.stack.pop();\n    const open = this.tokenStack.pop();\n    if (!open) {\n      throw new Error('Cannot close `' + token.type + '` (' + stringifyPosition({\n        start: token.start,\n        end: token.end\n      }) + '): it’s not open');\n    } else if (open[0].type !== token.type) {\n      if (onExitError) {\n        onExitError.call(this, token, open[0]);\n      } else {\n        const handler = open[1] || defaultOnError;\n        handler.call(this, token, open[0]);\n      }\n    }\n    node.position.end = point(token.end);\n  }\n\n  /**\n   * @type {CompileContext['resume']}\n   */\n  function resume() {\n    return toString(this.stack.pop());\n  }\n\n  //\n  // Handlers.\n  //\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onenterlistordered() {\n    this.data.expectingFirstListItemValue = true;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onenterlistitemvalue(token) {\n    if (this.data.expectingFirstListItemValue) {\n      const ancestor = this.stack[this.stack.length - 2];\n      ancestor.start = Number.parseInt(this.sliceSerialize(token), 10);\n      this.data.expectingFirstListItemValue = undefined;\n    }\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitcodefencedfenceinfo() {\n    const data = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    node.lang = data;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitcodefencedfencemeta() {\n    const data = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    node.meta = data;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitcodefencedfence() {\n    // Exit if this is the closing fence.\n    if (this.data.flowCodeInside) return;\n    this.buffer();\n    this.data.flowCodeInside = true;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitcodefenced() {\n    const data = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    node.value = data.replace(/^(\\r?\\n|\\r)|(\\r?\\n|\\r)$/g, '');\n    this.data.flowCodeInside = undefined;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitcodeindented() {\n    const data = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    node.value = data.replace(/(\\r?\\n|\\r)$/g, '');\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitdefinitionlabelstring(token) {\n    const label = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    node.label = label;\n    node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitdefinitiontitlestring() {\n    const data = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    node.title = data;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitdefinitiondestinationstring() {\n    const data = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    node.url = data;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitatxheadingsequence(token) {\n    const node = this.stack[this.stack.length - 1];\n    if (!node.depth) {\n      const depth = this.sliceSerialize(token).length;\n      node.depth = depth;\n    }\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitsetextheadingtext() {\n    this.data.setextHeadingSlurpLineEnding = true;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitsetextheadinglinesequence(token) {\n    const node = this.stack[this.stack.length - 1];\n    node.depth = this.sliceSerialize(token).codePointAt(0) === 61 ? 1 : 2;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitsetextheading() {\n    this.data.setextHeadingSlurpLineEnding = undefined;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onenterdata(token) {\n    const node = this.stack[this.stack.length - 1];\n    /** @type {Array<Nodes>} */\n    const siblings = node.children;\n    let tail = siblings[siblings.length - 1];\n    if (!tail || tail.type !== 'text') {\n      // Add a new text node.\n      tail = text();\n      tail.position = {\n        start: point(token.start),\n        // @ts-expect-error: we’ll add `end` later.\n        end: undefined\n      };\n      siblings.push(tail);\n    }\n    this.stack.push(tail);\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexitdata(token) {\n    const tail = this.stack.pop();\n    tail.value += this.sliceSerialize(token);\n    tail.position.end = point(token.end);\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexitlineending(token) {\n    const context = this.stack[this.stack.length - 1];\n    // If we’re at a hard break, include the line ending in there.\n    if (this.data.atHardBreak) {\n      const tail = context.children[context.children.length - 1];\n      tail.position.end = point(token.end);\n      this.data.atHardBreak = undefined;\n      return;\n    }\n    if (!this.data.setextHeadingSlurpLineEnding && config.canContainEols.includes(context.type)) {\n      onenterdata.call(this, token);\n      onexitdata.call(this, token);\n    }\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexithardbreak() {\n    this.data.atHardBreak = true;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexithtmlflow() {\n    const data = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    node.value = data;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexithtmltext() {\n    const data = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    node.value = data;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexitcodetext() {\n    const data = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    node.value = data;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexitlink() {\n    const node = this.stack[this.stack.length - 1];\n    // Note: there are also `identifier` and `label` fields on this link node!\n    // These are used / cleaned here.\n\n    // To do: clean.\n    if (this.data.inReference) {\n      /** @type {ReferenceType} */\n      const referenceType = this.data.referenceType || 'shortcut';\n      node.type += 'Reference';\n      // @ts-expect-error: mutate.\n      node.referenceType = referenceType;\n      // @ts-expect-error: mutate.\n      delete node.url;\n      delete node.title;\n    } else {\n      // @ts-expect-error: mutate.\n      delete node.identifier;\n      // @ts-expect-error: mutate.\n      delete node.label;\n    }\n    this.data.referenceType = undefined;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexitimage() {\n    const node = this.stack[this.stack.length - 1];\n    // Note: there are also `identifier` and `label` fields on this link node!\n    // These are used / cleaned here.\n\n    // To do: clean.\n    if (this.data.inReference) {\n      /** @type {ReferenceType} */\n      const referenceType = this.data.referenceType || 'shortcut';\n      node.type += 'Reference';\n      // @ts-expect-error: mutate.\n      node.referenceType = referenceType;\n      // @ts-expect-error: mutate.\n      delete node.url;\n      delete node.title;\n    } else {\n      // @ts-expect-error: mutate.\n      delete node.identifier;\n      // @ts-expect-error: mutate.\n      delete node.label;\n    }\n    this.data.referenceType = undefined;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexitlabeltext(token) {\n    const string = this.sliceSerialize(token);\n    const ancestor = this.stack[this.stack.length - 2];\n    // @ts-expect-error: stash this on the node, as it might become a reference\n    // later.\n    ancestor.label = decodeString(string);\n    // @ts-expect-error: same as above.\n    ancestor.identifier = normalizeIdentifier(string).toLowerCase();\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexitlabel() {\n    const fragment = this.stack[this.stack.length - 1];\n    const value = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    // Assume a reference.\n    this.data.inReference = true;\n    if (node.type === 'link') {\n      /** @type {Array<PhrasingContent>} */\n      const children = fragment.children;\n      node.children = children;\n    } else {\n      node.alt = value;\n    }\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexitresourcedestinationstring() {\n    const data = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    node.url = data;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexitresourcetitlestring() {\n    const data = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    node.title = data;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexitresource() {\n    this.data.inReference = undefined;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onenterreference() {\n    this.data.referenceType = 'collapsed';\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexitreferencestring(token) {\n    const label = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    // @ts-expect-error: stash this on the node, as it might become a reference\n    // later.\n    node.label = label;\n    // @ts-expect-error: same as above.\n    node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();\n    this.data.referenceType = 'full';\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexitcharacterreferencemarker(token) {\n    this.data.characterReferenceType = token.type;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitcharacterreferencevalue(token) {\n    const data = this.sliceSerialize(token);\n    const type = this.data.characterReferenceType;\n    /** @type {string} */\n    let value;\n    if (type) {\n      value = decodeNumericCharacterReference(data, type === \"characterReferenceMarkerNumeric\" ? 10 : 16);\n      this.data.characterReferenceType = undefined;\n    } else {\n      const result = decodeNamedCharacterReference(data);\n      value = result;\n    }\n    const tail = this.stack[this.stack.length - 1];\n    tail.value += value;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitcharacterreference(token) {\n    const tail = this.stack.pop();\n    tail.position.end = point(token.end);\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitautolinkprotocol(token) {\n    onexitdata.call(this, token);\n    const node = this.stack[this.stack.length - 1];\n    node.url = this.sliceSerialize(token);\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitautolinkemail(token) {\n    onexitdata.call(this, token);\n    const node = this.stack[this.stack.length - 1];\n    node.url = 'mailto:' + this.sliceSerialize(token);\n  }\n\n  //\n  // Creaters.\n  //\n\n  /** @returns {Blockquote} */\n  function blockQuote() {\n    return {\n      type: 'blockquote',\n      children: []\n    };\n  }\n\n  /** @returns {Code} */\n  function codeFlow() {\n    return {\n      type: 'code',\n      lang: null,\n      meta: null,\n      value: ''\n    };\n  }\n\n  /** @returns {InlineCode} */\n  function codeText() {\n    return {\n      type: 'inlineCode',\n      value: ''\n    };\n  }\n\n  /** @returns {Definition} */\n  function definition() {\n    return {\n      type: 'definition',\n      identifier: '',\n      label: null,\n      title: null,\n      url: ''\n    };\n  }\n\n  /** @returns {Emphasis} */\n  function emphasis() {\n    return {\n      type: 'emphasis',\n      children: []\n    };\n  }\n\n  /** @returns {Heading} */\n  function heading() {\n    return {\n      type: 'heading',\n      // @ts-expect-error `depth` will be set later.\n      depth: 0,\n      children: []\n    };\n  }\n\n  /** @returns {Break} */\n  function hardBreak() {\n    return {\n      type: 'break'\n    };\n  }\n\n  /** @returns {Html} */\n  function html() {\n    return {\n      type: 'html',\n      value: ''\n    };\n  }\n\n  /** @returns {Image} */\n  function image() {\n    return {\n      type: 'image',\n      title: null,\n      url: '',\n      alt: null\n    };\n  }\n\n  /** @returns {Link} */\n  function link() {\n    return {\n      type: 'link',\n      title: null,\n      url: '',\n      children: []\n    };\n  }\n\n  /**\n   * @param {Token} token\n   * @returns {List}\n   */\n  function list(token) {\n    return {\n      type: 'list',\n      ordered: token.type === 'listOrdered',\n      start: null,\n      spread: token._spread,\n      children: []\n    };\n  }\n\n  /**\n   * @param {Token} token\n   * @returns {ListItem}\n   */\n  function listItem(token) {\n    return {\n      type: 'listItem',\n      spread: token._spread,\n      checked: null,\n      children: []\n    };\n  }\n\n  /** @returns {Paragraph} */\n  function paragraph() {\n    return {\n      type: 'paragraph',\n      children: []\n    };\n  }\n\n  /** @returns {Strong} */\n  function strong() {\n    return {\n      type: 'strong',\n      children: []\n    };\n  }\n\n  /** @returns {Text} */\n  function text() {\n    return {\n      type: 'text',\n      value: ''\n    };\n  }\n\n  /** @returns {ThematicBreak} */\n  function thematicBreak() {\n    return {\n      type: 'thematicBreak'\n    };\n  }\n}\n\n/**\n * Copy a point-like value.\n *\n * @param {Point} d\n *   Point-like value.\n * @returns {Point}\n *   unist point.\n */\nfunction point(d) {\n  return {\n    line: d.line,\n    column: d.column,\n    offset: d.offset\n  };\n}\n\n/**\n * @param {Config} combined\n * @param {Array<Array<Extension> | Extension>} extensions\n * @returns {undefined}\n */\nfunction configure(combined, extensions) {\n  let index = -1;\n  while (++index < extensions.length) {\n    const value = extensions[index];\n    if (Array.isArray(value)) {\n      configure(combined, value);\n    } else {\n      extension(combined, value);\n    }\n  }\n}\n\n/**\n * @param {Config} combined\n * @param {Extension} extension\n * @returns {undefined}\n */\nfunction extension(combined, extension) {\n  /** @type {keyof Extension} */\n  let key;\n  for (key in extension) {\n    if (own.call(extension, key)) {\n      switch (key) {\n        case 'canContainEols':\n          {\n            const right = extension[key];\n            if (right) {\n              combined[key].push(...right);\n            }\n            break;\n          }\n        case 'transforms':\n          {\n            const right = extension[key];\n            if (right) {\n              combined[key].push(...right);\n            }\n            break;\n          }\n        case 'enter':\n        case 'exit':\n          {\n            const right = extension[key];\n            if (right) {\n              Object.assign(combined[key], right);\n            }\n            break;\n          }\n        // No default\n      }\n    }\n  }\n}\n\n/** @type {OnEnterError} */\nfunction defaultOnError(left, right) {\n  if (left) {\n    throw new Error('Cannot close `' + left.type + '` (' + stringifyPosition({\n      start: left.start,\n      end: left.end\n    }) + '): a different token (`' + right.type + '`, ' + stringifyPosition({\n      start: right.start,\n      end: right.end\n    }) + ') is open');\n  } else {\n    throw new Error('Cannot close document, a token (`' + right.type + '`, ' + stringifyPosition({\n      start: right.start,\n      end: right.end\n    }) + ') is still open');\n  }\n}","/**\n * @typedef {import('mdast').Root} Root\n * @typedef {import('mdast-util-from-markdown').Options} FromMarkdownOptions\n * @typedef {import('unified').Parser<Root>} Parser\n * @typedef {import('unified').Processor<Root>} Processor\n */\n\n/**\n * @typedef {Omit<FromMarkdownOptions, 'extensions' | 'mdastExtensions'>} Options\n */\n\nimport {fromMarkdown} from 'mdast-util-from-markdown'\n\n/**\n * Aadd support for parsing from markdown.\n *\n * @param {Readonly<Options> | null | undefined} [options]\n *   Configuration (optional).\n * @returns {undefined}\n *   Nothing.\n */\nexport default function remarkParse(options) {\n  /** @type {Processor} */\n  // @ts-expect-error: TS in JSDoc generates wrong types if `this` is typed regularly.\n  const self = this\n\n  self.parser = parser\n\n  /**\n   * @type {Parser}\n   */\n  function parser(doc) {\n    return fromMarkdown(doc, {\n      ...self.data('settings'),\n      ...options,\n      // Note: these options are not in the readme.\n      // The goal is for them to be set by plugins on `data` instead of being\n      // passed by users.\n      extensions: self.data('micromarkExtensions') || [],\n      mdastExtensions: self.data('fromMarkdownExtensions') || []\n    })\n  }\n}\n","/**\n * @callback Handler\n *   Handle a value, with a certain ID field set to a certain value.\n *   The ID field is passed to `zwitch`, and it’s value is this function’s\n *   place on the `handlers` record.\n * @param {...any} parameters\n *   Arbitrary parameters passed to the zwitch.\n *   The first will be an object with a certain ID field set to a certain value.\n * @returns {any}\n *   Anything!\n */\n\n/**\n * @callback UnknownHandler\n *   Handle values that do have a certain ID field, but it’s set to a value\n *   that is not listed in the `handlers` record.\n * @param {unknown} value\n *   An object with a certain ID field set to an unknown value.\n * @param {...any} rest\n *   Arbitrary parameters passed to the zwitch.\n * @returns {any}\n *   Anything!\n */\n\n/**\n * @callback InvalidHandler\n *   Handle values that do not have a certain ID field.\n * @param {unknown} value\n *   Any unknown value.\n * @param {...any} rest\n *   Arbitrary parameters passed to the zwitch.\n * @returns {void|null|undefined|never}\n *   This should crash or return nothing.\n */\n\n/**\n * @template {InvalidHandler} [Invalid=InvalidHandler]\n * @template {UnknownHandler} [Unknown=UnknownHandler]\n * @template {Record<string, Handler>} [Handlers=Record<string, Handler>]\n * @typedef Options\n *   Configuration (required).\n * @property {Invalid} [invalid]\n *   Handler to use for invalid values.\n * @property {Unknown} [unknown]\n *   Handler to use for unknown values.\n * @property {Handlers} [handlers]\n *   Handlers to use.\n */\n\nconst own = {}.hasOwnProperty\n\n/**\n * Handle values based on a field.\n *\n * @template {InvalidHandler} [Invalid=InvalidHandler]\n * @template {UnknownHandler} [Unknown=UnknownHandler]\n * @template {Record<string, Handler>} [Handlers=Record<string, Handler>]\n * @param {string} key\n *   Field to switch on.\n * @param {Options<Invalid, Unknown, Handlers>} [options]\n *   Configuration (required).\n * @returns {{unknown: Unknown, invalid: Invalid, handlers: Handlers, (...parameters: Parameters<Handlers[keyof Handlers]>): ReturnType<Handlers[keyof Handlers]>, (...parameters: Parameters<Unknown>): ReturnType<Unknown>}}\n */\nexport function zwitch(key, options) {\n  const settings = options || {}\n\n  /**\n   * Handle one value.\n   *\n   * Based on the bound `key`, a respective handler will be called.\n   * If `value` is not an object, or doesn’t have a `key` property, the special\n   * “invalid” handler will be called.\n   * If `value` has an unknown `key`, the special “unknown” handler will be\n   * called.\n   *\n   * All arguments, and the context object, are passed through to the handler,\n   * and it’s result is returned.\n   *\n   * @this {unknown}\n   *   Any context object.\n   * @param {unknown} [value]\n   *   Any value.\n   * @param {...unknown} parameters\n   *   Arbitrary parameters passed to the zwitch.\n   * @property {Handler} invalid\n   *   Handle for values that do not have a certain ID field.\n   * @property {Handler} unknown\n   *   Handle values that do have a certain ID field, but it’s set to a value\n   *   that is not listed in the `handlers` record.\n   * @property {Handlers} handlers\n   *   Record of handlers.\n   * @returns {unknown}\n   *   Anything.\n   */\n  function one(value, ...parameters) {\n    /** @type {Handler|undefined} */\n    let fn = one.invalid\n    const handlers = one.handlers\n\n    if (value && own.call(value, key)) {\n      // @ts-expect-error Indexable.\n      const id = String(value[key])\n      // @ts-expect-error Indexable.\n      fn = own.call(handlers, id) ? handlers[id] : one.unknown\n    }\n\n    if (fn) {\n      return fn.call(this, value, ...parameters)\n    }\n  }\n\n  one.handlers = settings.handlers || {}\n  one.invalid = settings.invalid\n  one.unknown = settings.unknown\n\n  // @ts-expect-error: matches!\n  return one\n}\n","/**\n * @import {Options, State} from './types.js'\n */\n\nconst own = {}.hasOwnProperty\n\n/**\n * @param {State} base\n * @param {Options} extension\n * @returns {State}\n */\nexport function configure(base, extension) {\n  let index = -1\n  /** @type {keyof Options} */\n  let key\n\n  // First do subextensions.\n  if (extension.extensions) {\n    while (++index < extension.extensions.length) {\n      configure(base, extension.extensions[index])\n    }\n  }\n\n  for (key in extension) {\n    if (own.call(extension, key)) {\n      switch (key) {\n        case 'extensions': {\n          // Empty.\n          break\n        }\n\n        /* c8 ignore next 4 */\n        case 'unsafe': {\n          list(base[key], extension[key])\n          break\n        }\n\n        case 'join': {\n          list(base[key], extension[key])\n          break\n        }\n\n        case 'handlers': {\n          map(base[key], extension[key])\n          break\n        }\n\n        default: {\n          // @ts-expect-error: matches.\n          base.options[key] = extension[key]\n        }\n      }\n    }\n  }\n\n  return base\n}\n\n/**\n * @template T\n * @param {Array<T>} left\n * @param {Array<T> | null | undefined} right\n */\nfunction list(left, right) {\n  if (right) {\n    left.push(...right)\n  }\n}\n\n/**\n * @template T\n * @param {Record<string, T>} left\n * @param {Record<string, T> | null | undefined} right\n */\nfunction map(left, right) {\n  if (right) {\n    Object.assign(left, right)\n  }\n}\n","/**\n * @import {Blockquote, Parents} from 'mdast'\n * @import {Info, Map, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {Blockquote} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function blockquote(node, _, state, info) {\n  const exit = state.enter('blockquote')\n  const tracker = state.createTracker(info)\n  tracker.move('> ')\n  tracker.shift(2)\n  const value = state.indentLines(\n    state.containerFlow(node, tracker.current()),\n    map\n  )\n  exit()\n  return value\n}\n\n/** @type {Map} */\nfunction map(line, _, blank) {\n  return '>' + (blank ? '' : ' ') + line\n}\n","/**\n * @import {ConstructName, Unsafe} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {Array<ConstructName>} stack\n * @param {Unsafe} pattern\n * @returns {boolean}\n */\nexport function patternInScope(stack, pattern) {\n  return (\n    listInScope(stack, pattern.inConstruct, true) &&\n    !listInScope(stack, pattern.notInConstruct, false)\n  )\n}\n\n/**\n * @param {Array<ConstructName>} stack\n * @param {Unsafe['inConstruct']} list\n * @param {boolean} none\n * @returns {boolean}\n */\nfunction listInScope(stack, list, none) {\n  if (typeof list === 'string') {\n    list = [list]\n  }\n\n  if (!list || list.length === 0) {\n    return none\n  }\n\n  let index = -1\n\n  while (++index < list.length) {\n    if (stack.includes(list[index])) {\n      return true\n    }\n  }\n\n  return false\n}\n","/**\n * @import {Break, Parents} from 'mdast'\n * @import {Info, State} from 'mdast-util-to-markdown'\n */\n\nimport {patternInScope} from '../util/pattern-in-scope.js'\n\n/**\n * @param {Break} _\n * @param {Parents | undefined} _1\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function hardBreak(_, _1, state, info) {\n  let index = -1\n\n  while (++index < state.unsafe.length) {\n    // If we can’t put eols in this construct (setext headings, tables), use a\n    // space instead.\n    if (\n      state.unsafe[index].character === '\\n' &&\n      patternInScope(state.stack, state.unsafe[index])\n    ) {\n      return /[ \\t]/.test(info.before) ? '' : ' '\n    }\n  }\n\n  return '\\\\\\n'\n}\n","/**\n * Get the count of the longest repeating streak of `substring` in `value`.\n *\n * @param {string} value\n *   Content to search in.\n * @param {string} substring\n *   Substring to look for, typically one character.\n * @returns {number}\n *   Count of most frequent adjacent `substring`s in `value`.\n */\nexport function longestStreak(value, substring) {\n  const source = String(value)\n  let index = source.indexOf(substring)\n  let expected = index\n  let count = 0\n  let max = 0\n\n  if (typeof substring !== 'string') {\n    throw new TypeError('Expected substring')\n  }\n\n  while (index !== -1) {\n    if (index === expected) {\n      if (++count > max) {\n        max = count\n      }\n    } else {\n      count = 1\n    }\n\n    expected = index + substring.length\n    index = source.indexOf(substring, expected)\n  }\n\n  return max\n}\n","/**\n * @import {State} from 'mdast-util-to-markdown'\n * @import {Code} from 'mdast'\n */\n\n/**\n * @param {Code} node\n * @param {State} state\n * @returns {boolean}\n */\nexport function formatCodeAsIndented(node, state) {\n  return Boolean(\n    state.options.fences === false &&\n      node.value &&\n      // If there’s no info…\n      !node.lang &&\n      // And there’s a non-whitespace character…\n      /[^ \\r\\n]/.test(node.value) &&\n      // And the value doesn’t start or end in a blank…\n      !/^[\\t ]*(?:[\\r\\n]|$)|(?:^|[\\r\\n])[\\t ]*$/.test(node.value)\n  )\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['fence'], null | undefined>}\n */\nexport function checkFence(state) {\n  const marker = state.options.fence || '`'\n\n  if (marker !== '`' && marker !== '~') {\n    throw new Error(\n      'Cannot serialize code with `' +\n        marker +\n        '` for `options.fence`, expected `` ` `` or `~`'\n    )\n  }\n\n  return marker\n}\n","/**\n * @import {Info, Map, State} from 'mdast-util-to-markdown'\n * @import {Code, Parents} from 'mdast'\n */\n\nimport {longestStreak} from 'longest-streak'\nimport {formatCodeAsIndented} from '../util/format-code-as-indented.js'\nimport {checkFence} from '../util/check-fence.js'\n\n/**\n * @param {Code} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function code(node, _, state, info) {\n  const marker = checkFence(state)\n  const raw = node.value || ''\n  const suffix = marker === '`' ? 'GraveAccent' : 'Tilde'\n\n  if (formatCodeAsIndented(node, state)) {\n    const exit = state.enter('codeIndented')\n    const value = state.indentLines(raw, map)\n    exit()\n    return value\n  }\n\n  const tracker = state.createTracker(info)\n  const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3))\n  const exit = state.enter('codeFenced')\n  let value = tracker.move(sequence)\n\n  if (node.lang) {\n    const subexit = state.enter(`codeFencedLang${suffix}`)\n    value += tracker.move(\n      state.safe(node.lang, {\n        before: value,\n        after: ' ',\n        encode: ['`'],\n        ...tracker.current()\n      })\n    )\n    subexit()\n  }\n\n  if (node.lang && node.meta) {\n    const subexit = state.enter(`codeFencedMeta${suffix}`)\n    value += tracker.move(' ')\n    value += tracker.move(\n      state.safe(node.meta, {\n        before: value,\n        after: '\\n',\n        encode: ['`'],\n        ...tracker.current()\n      })\n    )\n    subexit()\n  }\n\n  value += tracker.move('\\n')\n\n  if (raw) {\n    value += tracker.move(raw + '\\n')\n  }\n\n  value += tracker.move(sequence)\n  exit()\n  return value\n}\n\n/** @type {Map} */\nfunction map(line, _, blank) {\n  return (blank ? '' : '    ') + line\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['quote'], null | undefined>}\n */\nexport function checkQuote(state) {\n  const marker = state.options.quote || '\"'\n\n  if (marker !== '\"' && marker !== \"'\") {\n    throw new Error(\n      'Cannot serialize title with `' +\n        marker +\n        '` for `options.quote`, expected `\"`, or `\\'`'\n    )\n  }\n\n  return marker\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Definition, Parents} from 'mdast'\n */\n\nimport {checkQuote} from '../util/check-quote.js'\n\n/**\n * @param {Definition} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function definition(node, _, state, info) {\n  const quote = checkQuote(state)\n  const suffix = quote === '\"' ? 'Quote' : 'Apostrophe'\n  const exit = state.enter('definition')\n  let subexit = state.enter('label')\n  const tracker = state.createTracker(info)\n  let value = tracker.move('[')\n  value += tracker.move(\n    state.safe(state.associationId(node), {\n      before: value,\n      after: ']',\n      ...tracker.current()\n    })\n  )\n  value += tracker.move(']: ')\n\n  subexit()\n\n  if (\n    // If there’s no url, or…\n    !node.url ||\n    // If there are control characters or whitespace.\n    /[\\0- \\u007F]/.test(node.url)\n  ) {\n    subexit = state.enter('destinationLiteral')\n    value += tracker.move('<')\n    value += tracker.move(\n      state.safe(node.url, {before: value, after: '>', ...tracker.current()})\n    )\n    value += tracker.move('>')\n  } else {\n    // No whitespace, raw is prettier.\n    subexit = state.enter('destinationRaw')\n    value += tracker.move(\n      state.safe(node.url, {\n        before: value,\n        after: node.title ? ' ' : '\\n',\n        ...tracker.current()\n      })\n    )\n  }\n\n  subexit()\n\n  if (node.title) {\n    subexit = state.enter(`title${suffix}`)\n    value += tracker.move(' ' + quote)\n    value += tracker.move(\n      state.safe(node.title, {\n        before: value,\n        after: quote,\n        ...tracker.current()\n      })\n    )\n    value += tracker.move(quote)\n    subexit()\n  }\n\n  exit()\n\n  return value\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['emphasis'], null | undefined>}\n */\nexport function checkEmphasis(state) {\n  const marker = state.options.emphasis || '*'\n\n  if (marker !== '*' && marker !== '_') {\n    throw new Error(\n      'Cannot serialize emphasis with `' +\n        marker +\n        '` for `options.emphasis`, expected `*`, or `_`'\n    )\n  }\n\n  return marker\n}\n","/**\n * Encode a code point as a character reference.\n *\n * @param {number} code\n *   Code point to encode.\n * @returns {string}\n *   Encoded character reference.\n */\nexport function encodeCharacterReference(code) {\n  return '&#x' + code.toString(16).toUpperCase() + ';'\n}\n","/**\n * @import {EncodeSides} from '../types.js'\n */\n\nimport {classifyCharacter} from 'micromark-util-classify-character'\n\n/**\n * Check whether to encode (as a character reference) the characters\n * surrounding an attention run.\n *\n * Which characters are around an attention run influence whether it works or\n * not.\n *\n * See <https://github.com/orgs/syntax-tree/discussions/60> for more info.\n * See this markdown in a particular renderer to see what works:\n *\n * ```markdown\n * |                         | A (letter inside) | B (punctuation inside) | C (whitespace inside) | D (nothing inside) |\n * | ----------------------- | ----------------- | ---------------------- | --------------------- | ------------------ |\n * | 1 (letter outside)      | x*y*z             | x*.*z                  | x* *z                 | x**z               |\n * | 2 (punctuation outside) | .*y*.             | .*.*.                  | .* *.                 | .**.               |\n * | 3 (whitespace outside)  | x *y* z           | x *.* z                | x * * z               | x ** z             |\n * | 4 (nothing outside)     | *x*               | *.*                    | * *                   | **                 |\n * ```\n *\n * @param {number} outside\n *   Code point on the outer side of the run.\n * @param {number} inside\n *   Code point on the inner side of the run.\n * @param {'*' | '_'} marker\n *   Marker of the run.\n *   Underscores are handled more strictly (they form less often) than\n *   asterisks.\n * @returns {EncodeSides}\n *   Whether to encode characters.\n */\n// Important: punctuation must never be encoded.\n// Punctuation is solely used by markdown constructs.\n// And by encoding itself.\n// Encoding them will break constructs or double encode things.\nexport function encodeInfo(outside, inside, marker) {\n  const outsideKind = classifyCharacter(outside)\n  const insideKind = classifyCharacter(inside)\n\n  // Letter outside:\n  if (outsideKind === undefined) {\n    return insideKind === undefined\n      ? // Letter inside:\n        // we have to encode *both* letters for `_` as it is looser.\n        // it already forms for `*` (and GFMs `~`).\n        marker === '_'\n        ? {inside: true, outside: true}\n        : {inside: false, outside: false}\n      : insideKind === 1\n        ? // Whitespace inside: encode both (letter, whitespace).\n          {inside: true, outside: true}\n        : // Punctuation inside: encode outer (letter)\n          {inside: false, outside: true}\n  }\n\n  // Whitespace outside:\n  if (outsideKind === 1) {\n    return insideKind === undefined\n      ? // Letter inside: already forms.\n        {inside: false, outside: false}\n      : insideKind === 1\n        ? // Whitespace inside: encode both (whitespace).\n          {inside: true, outside: true}\n        : // Punctuation inside: already forms.\n          {inside: false, outside: false}\n  }\n\n  // Punctuation outside:\n  return insideKind === undefined\n    ? // Letter inside: already forms.\n      {inside: false, outside: false}\n    : insideKind === 1\n      ? // Whitespace inside: encode inner (whitespace).\n        {inside: true, outside: false}\n      : // Punctuation inside: already forms.\n        {inside: false, outside: false}\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Emphasis, Parents} from 'mdast'\n */\n\nimport {checkEmphasis} from '../util/check-emphasis.js'\nimport {encodeCharacterReference} from '../util/encode-character-reference.js'\nimport {encodeInfo} from '../util/encode-info.js'\n\nemphasis.peek = emphasisPeek\n\n/**\n * @param {Emphasis} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function emphasis(node, _, state, info) {\n  const marker = checkEmphasis(state)\n  const exit = state.enter('emphasis')\n  const tracker = state.createTracker(info)\n  const before = tracker.move(marker)\n\n  let between = tracker.move(\n    state.containerPhrasing(node, {\n      after: marker,\n      before,\n      ...tracker.current()\n    })\n  )\n  const betweenHead = between.charCodeAt(0)\n  const open = encodeInfo(\n    info.before.charCodeAt(info.before.length - 1),\n    betweenHead,\n    marker\n  )\n\n  if (open.inside) {\n    between = encodeCharacterReference(betweenHead) + between.slice(1)\n  }\n\n  const betweenTail = between.charCodeAt(between.length - 1)\n  const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker)\n\n  if (close.inside) {\n    between = between.slice(0, -1) + encodeCharacterReference(betweenTail)\n  }\n\n  const after = tracker.move(marker)\n\n  exit()\n\n  state.attentionEncodeSurroundingInfo = {\n    after: close.outside,\n    before: open.outside\n  }\n  return before + between + after\n}\n\n/**\n * @param {Emphasis} _\n * @param {Parents | undefined} _1\n * @param {State} state\n * @returns {string}\n */\nfunction emphasisPeek(_, _1, state) {\n  return state.options.emphasis || '*'\n}\n","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Parent} Parent\n */\n\n/**\n * @template Fn\n * @template Fallback\n * @typedef {Fn extends (value: any) => value is infer Thing ? Thing : Fallback} Predicate\n */\n\n/**\n * @callback Check\n *   Check that an arbitrary value is a node.\n * @param {unknown} this\n *   The given context.\n * @param {unknown} [node]\n *   Anything (typically a node).\n * @param {number | null | undefined} [index]\n *   The node’s position in its parent.\n * @param {Parent | null | undefined} [parent]\n *   The node’s parent.\n * @returns {boolean}\n *   Whether this is a node and passes a test.\n *\n * @typedef {Record<string, unknown> | Node} Props\n *   Object to check for equivalence.\n *\n *   Note: `Node` is included as it is common but is not indexable.\n *\n * @typedef {Array<Props | TestFunction | string> | Props | TestFunction | string | null | undefined} Test\n *   Check for an arbitrary node.\n *\n * @callback TestFunction\n *   Check if a node passes a test.\n * @param {unknown} this\n *   The given context.\n * @param {Node} node\n *   A node.\n * @param {number | undefined} [index]\n *   The node’s position in its parent.\n * @param {Parent | undefined} [parent]\n *   The node’s parent.\n * @returns {boolean | undefined | void}\n *   Whether this node passes the test.\n *\n *   Note: `void` is included until TS sees no return as `undefined`.\n */\n\n/**\n * Check if `node` is a `Node` and whether it passes the given test.\n *\n * @param {unknown} node\n *   Thing to check, typically `Node`.\n * @param {Test} test\n *   A check for a specific node.\n * @param {number | null | undefined} index\n *   The node’s position in its parent.\n * @param {Parent | null | undefined} parent\n *   The node’s parent.\n * @param {unknown} context\n *   Context object (`this`) to pass to `test` functions.\n * @returns {boolean}\n *   Whether `node` is a node and passes a test.\n */\nexport const is =\n  // Note: overloads in JSDoc can’t yet use different `@template`s.\n  /**\n   * @type {(\n   *   (<Condition extends string>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n   *   (<Condition extends Props>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n   *   (<Condition extends TestFunction>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &\n   *   ((node?: null | undefined) => false) &\n   *   ((node: unknown, test?: null | undefined, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n   *   ((node: unknown, test?: Test, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => boolean)\n   * )}\n   */\n  (\n    /**\n     * @param {unknown} [node]\n     * @param {Test} [test]\n     * @param {number | null | undefined} [index]\n     * @param {Parent | null | undefined} [parent]\n     * @param {unknown} [context]\n     * @returns {boolean}\n     */\n    // eslint-disable-next-line max-params\n    function (node, test, index, parent, context) {\n      const check = convert(test)\n\n      if (\n        index !== undefined &&\n        index !== null &&\n        (typeof index !== 'number' ||\n          index < 0 ||\n          index === Number.POSITIVE_INFINITY)\n      ) {\n        throw new Error('Expected positive finite index')\n      }\n\n      if (\n        parent !== undefined &&\n        parent !== null &&\n        (!is(parent) || !parent.children)\n      ) {\n        throw new Error('Expected parent node')\n      }\n\n      if (\n        (parent === undefined || parent === null) !==\n        (index === undefined || index === null)\n      ) {\n        throw new Error('Expected both parent and index')\n      }\n\n      return looksLikeANode(node)\n        ? check.call(context, node, index, parent)\n        : false\n    }\n  )\n\n/**\n * Generate an assertion from a test.\n *\n * Useful if you’re going to test many nodes, for example when creating a\n * utility where something else passes a compatible test.\n *\n * The created function is a bit faster because it expects valid input only:\n * a `node`, `index`, and `parent`.\n *\n * @param {Test} test\n *   *   when nullish, checks if `node` is a `Node`.\n *   *   when `string`, works like passing `(node) => node.type === test`.\n *   *   when `function` checks if function passed the node is true.\n *   *   when `object`, checks that all keys in test are in node, and that they have (strictly) equal values.\n *   *   when `array`, checks if any one of the subtests pass.\n * @returns {Check}\n *   An assertion.\n */\nexport const convert =\n  // Note: overloads in JSDoc can’t yet use different `@template`s.\n  /**\n   * @type {(\n   *   (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n   *   (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n   *   (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &\n   *   ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n   *   ((test?: Test) => Check)\n   * )}\n   */\n  (\n    /**\n     * @param {Test} [test]\n     * @returns {Check}\n     */\n    function (test) {\n      if (test === null || test === undefined) {\n        return ok\n      }\n\n      if (typeof test === 'function') {\n        return castFactory(test)\n      }\n\n      if (typeof test === 'object') {\n        return Array.isArray(test) ? anyFactory(test) : propsFactory(test)\n      }\n\n      if (typeof test === 'string') {\n        return typeFactory(test)\n      }\n\n      throw new Error('Expected function, string, or object as test')\n    }\n  )\n\n/**\n * @param {Array<Props | TestFunction | string>} tests\n * @returns {Check}\n */\nfunction anyFactory(tests) {\n  /** @type {Array<Check>} */\n  const checks = []\n  let index = -1\n\n  while (++index < tests.length) {\n    checks[index] = convert(tests[index])\n  }\n\n  return castFactory(any)\n\n  /**\n   * @this {unknown}\n   * @type {TestFunction}\n   */\n  function any(...parameters) {\n    let index = -1\n\n    while (++index < checks.length) {\n      if (checks[index].apply(this, parameters)) return true\n    }\n\n    return false\n  }\n}\n\n/**\n * Turn an object into a test for a node with a certain fields.\n *\n * @param {Props} check\n * @returns {Check}\n */\nfunction propsFactory(check) {\n  const checkAsRecord = /** @type {Record<string, unknown>} */ (check)\n\n  return castFactory(all)\n\n  /**\n   * @param {Node} node\n   * @returns {boolean}\n   */\n  function all(node) {\n    const nodeAsRecord = /** @type {Record<string, unknown>} */ (\n      /** @type {unknown} */ (node)\n    )\n\n    /** @type {string} */\n    let key\n\n    for (key in check) {\n      if (nodeAsRecord[key] !== checkAsRecord[key]) return false\n    }\n\n    return true\n  }\n}\n\n/**\n * Turn a string into a test for a node with a certain type.\n *\n * @param {string} check\n * @returns {Check}\n */\nfunction typeFactory(check) {\n  return castFactory(type)\n\n  /**\n   * @param {Node} node\n   */\n  function type(node) {\n    return node && node.type === check\n  }\n}\n\n/**\n * Turn a custom test into a test for a node that passes that test.\n *\n * @param {TestFunction} testFunction\n * @returns {Check}\n */\nfunction castFactory(testFunction) {\n  return check\n\n  /**\n   * @this {unknown}\n   * @type {Check}\n   */\n  function check(value, index, parent) {\n    return Boolean(\n      looksLikeANode(value) &&\n        testFunction.call(\n          this,\n          value,\n          typeof index === 'number' ? index : undefined,\n          parent || undefined\n        )\n    )\n  }\n}\n\nfunction ok() {\n  return true\n}\n\n/**\n * @param {unknown} value\n * @returns {value is Node}\n */\nfunction looksLikeANode(value) {\n  return value !== null && typeof value === 'object' && 'type' in value\n}\n","/**\n * @typedef {import('unist').Node} UnistNode\n * @typedef {import('unist').Parent} UnistParent\n */\n\n/**\n * @typedef {Exclude<import('unist-util-is').Test, undefined> | undefined} Test\n *   Test from `unist-util-is`.\n *\n *   Note: we have remove and add `undefined`, because otherwise when generating\n *   automatic `.d.ts` files, TS tries to flatten paths from a local perspective,\n *   which doesn’t work when publishing on npm.\n */\n\n/**\n * @typedef {(\n *   Fn extends (value: any) => value is infer Thing\n *   ? Thing\n *   : Fallback\n * )} Predicate\n *   Get the value of a type guard `Fn`.\n * @template Fn\n *   Value; typically function that is a type guard (such as `(x): x is Y`).\n * @template Fallback\n *   Value to yield if `Fn` is not a type guard.\n */\n\n/**\n * @typedef {(\n *   Check extends null | undefined // No test.\n *   ? Value\n *   : Value extends {type: Check} // String (type) test.\n *   ? Value\n *   : Value extends Check // Partial test.\n *   ? Value\n *   : Check extends Function // Function test.\n *   ? Predicate<Check, Value> extends Value\n *     ? Predicate<Check, Value>\n *     : never\n *   : never // Some other test?\n * )} MatchesOne\n *   Check whether a node matches a primitive check in the type system.\n * @template Value\n *   Value; typically unist `Node`.\n * @template Check\n *   Value; typically `unist-util-is`-compatible test, but not arrays.\n */\n\n/**\n * @typedef {(\n *   Check extends Array<any>\n *   ? MatchesOne<Value, Check[keyof Check]>\n *   : MatchesOne<Value, Check>\n * )} Matches\n *   Check whether a node matches a check in the type system.\n * @template Value\n *   Value; typically unist `Node`.\n * @template Check\n *   Value; typically `unist-util-is`-compatible test.\n */\n\n/**\n * @typedef {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10} Uint\n *   Number; capped reasonably.\n */\n\n/**\n * @typedef {I extends 0 ? 1 : I extends 1 ? 2 : I extends 2 ? 3 : I extends 3 ? 4 : I extends 4 ? 5 : I extends 5 ? 6 : I extends 6 ? 7 : I extends 7 ? 8 : I extends 8 ? 9 : 10} Increment\n *   Increment a number in the type system.\n * @template {Uint} [I=0]\n *   Index.\n */\n\n/**\n * @typedef {(\n *   Node extends UnistParent\n *   ? Node extends {children: Array<infer Children>}\n *     ? Child extends Children ? Node : never\n *     : never\n *   : never\n * )} InternalParent\n *   Collect nodes that can be parents of `Child`.\n * @template {UnistNode} Node\n *   All node types in a tree.\n * @template {UnistNode} Child\n *   Node to search for.\n */\n\n/**\n * @typedef {InternalParent<InclusiveDescendant<Tree>, Child>} Parent\n *   Collect nodes in `Tree` that can be parents of `Child`.\n * @template {UnistNode} Tree\n *   All node types in a tree.\n * @template {UnistNode} Child\n *   Node to search for.\n */\n\n/**\n * @typedef {(\n *   Depth extends Max\n *   ? never\n *   :\n *     | InternalParent<Node, Child>\n *     | InternalAncestor<Node, InternalParent<Node, Child>, Max, Increment<Depth>>\n * )} InternalAncestor\n *   Collect nodes in `Tree` that can be ancestors of `Child`.\n * @template {UnistNode} Node\n *   All node types in a tree.\n * @template {UnistNode} Child\n *   Node to search for.\n * @template {Uint} [Max=10]\n *   Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n *   Current depth.\n */\n\n/**\n * @typedef {InternalAncestor<InclusiveDescendant<Tree>, Child>} Ancestor\n *   Collect nodes in `Tree` that can be ancestors of `Child`.\n * @template {UnistNode} Tree\n *   All node types in a tree.\n * @template {UnistNode} Child\n *   Node to search for.\n */\n\n/**\n * @typedef {(\n *   Tree extends UnistParent\n *     ? Depth extends Max\n *       ? Tree\n *       : Tree | InclusiveDescendant<Tree['children'][number], Max, Increment<Depth>>\n *     : Tree\n * )} InclusiveDescendant\n *   Collect all (inclusive) descendants of `Tree`.\n *\n *   > 👉 **Note**: for performance reasons, this seems to be the fastest way to\n *   > recurse without actually running into an infinite loop, which the\n *   > previous version did.\n *   >\n *   > Practically, a max of `2` is typically enough assuming a `Root` is\n *   > passed, but it doesn’t improve performance.\n *   > It gets higher with `List > ListItem > Table > TableRow > TableCell`.\n *   > Using up to `10` doesn’t hurt or help either.\n * @template {UnistNode} Tree\n *   Tree type.\n * @template {Uint} [Max=10]\n *   Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n *   Current depth.\n */\n\n/**\n * @typedef {'skip' | boolean} Action\n *   Union of the action types.\n *\n * @typedef {number} Index\n *   Move to the sibling at `index` next (after node itself is completely\n *   traversed).\n *\n *   Useful if mutating the tree, such as removing the node the visitor is\n *   currently on, or any of its previous siblings.\n *   Results less than 0 or greater than or equal to `children.length` stop\n *   traversing the parent.\n *\n * @typedef {[(Action | null | undefined | void)?, (Index | null | undefined)?]} ActionTuple\n *   List with one or two values, the first an action, the second an index.\n *\n * @typedef {Action | ActionTuple | Index | null | undefined | void} VisitorResult\n *   Any value that can be returned from a visitor.\n */\n\n/**\n * @callback Visitor\n *   Handle a node (matching `test`, if given).\n *\n *   Visitors are free to transform `node`.\n *   They can also transform the parent of node (the last of `ancestors`).\n *\n *   Replacing `node` itself, if `SKIP` is not returned, still causes its\n *   descendants to be walked (which is a bug).\n *\n *   When adding or removing previous siblings of `node` (or next siblings, in\n *   case of reverse), the `Visitor` should return a new `Index` to specify the\n *   sibling to traverse after `node` is traversed.\n *   Adding or removing next siblings of `node` (or previous siblings, in case\n *   of reverse) is handled as expected without needing to return a new `Index`.\n *\n *   Removing the children property of an ancestor still results in them being\n *   traversed.\n * @param {Visited} node\n *   Found node.\n * @param {Array<VisitedParents>} ancestors\n *   Ancestors of `node`.\n * @returns {VisitorResult}\n *   What to do next.\n *\n *   An `Index` is treated as a tuple of `[CONTINUE, Index]`.\n *   An `Action` is treated as a tuple of `[Action]`.\n *\n *   Passing a tuple back only makes sense if the `Action` is `SKIP`.\n *   When the `Action` is `EXIT`, that action can be returned.\n *   When the `Action` is `CONTINUE`, `Index` can be returned.\n * @template {UnistNode} [Visited=UnistNode]\n *   Visited node type.\n * @template {UnistParent} [VisitedParents=UnistParent]\n *   Ancestor type.\n */\n\n/**\n * @typedef {Visitor<Matches<InclusiveDescendant<Tree>, Check>, Ancestor<Tree, Matches<InclusiveDescendant<Tree>, Check>>>} BuildVisitor\n *   Build a typed `Visitor` function from a tree and a test.\n *\n *   It will infer which values are passed as `node` and which as `parents`.\n * @template {UnistNode} [Tree=UnistNode]\n *   Tree type.\n * @template {Test} [Check=Test]\n *   Test type.\n */\n\nimport {convert} from 'unist-util-is'\nimport {color} from 'unist-util-visit-parents/do-not-use-color'\n\n/** @type {Readonly<ActionTuple>} */\nconst empty = []\n\n/**\n * Continue traversing as normal.\n */\nexport const CONTINUE = true\n\n/**\n * Stop traversing immediately.\n */\nexport const EXIT = false\n\n/**\n * Do not traverse this node’s children.\n */\nexport const SKIP = 'skip'\n\n/**\n * Visit nodes, with ancestral information.\n *\n * This algorithm performs *depth-first* *tree traversal* in *preorder*\n * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).\n *\n * You can choose for which nodes `visitor` is called by passing a `test`.\n * For complex tests, you should test yourself in `visitor`, as it will be\n * faster and will have improved type information.\n *\n * Walking the tree is an intensive task.\n * Make use of the return values of the visitor when possible.\n * Instead of walking a tree multiple times, walk it once, use `unist-util-is`\n * to check if a node matches, and then perform different operations.\n *\n * You can change the tree.\n * See `Visitor` for more info.\n *\n * @overload\n * @param {Tree} tree\n * @param {Check} check\n * @param {BuildVisitor<Tree, Check>} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @overload\n * @param {Tree} tree\n * @param {BuildVisitor<Tree>} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @param {UnistNode} tree\n *   Tree to traverse.\n * @param {Visitor | Test} test\n *   `unist-util-is`-compatible test\n * @param {Visitor | boolean | null | undefined} [visitor]\n *   Handle each node.\n * @param {boolean | null | undefined} [reverse]\n *   Traverse in reverse preorder (NRL) instead of the default preorder (NLR).\n * @returns {undefined}\n *   Nothing.\n *\n * @template {UnistNode} Tree\n *   Node type.\n * @template {Test} Check\n *   `unist-util-is`-compatible test.\n */\nexport function visitParents(tree, test, visitor, reverse) {\n  /** @type {Test} */\n  let check\n\n  if (typeof test === 'function' && typeof visitor !== 'function') {\n    reverse = visitor\n    // @ts-expect-error no visitor given, so `visitor` is test.\n    visitor = test\n  } else {\n    // @ts-expect-error visitor given, so `test` isn’t a visitor.\n    check = test\n  }\n\n  const is = convert(check)\n  const step = reverse ? -1 : 1\n\n  factory(tree, undefined, [])()\n\n  /**\n   * @param {UnistNode} node\n   * @param {number | undefined} index\n   * @param {Array<UnistParent>} parents\n   */\n  function factory(node, index, parents) {\n    const value = /** @type {Record<string, unknown>} */ (\n      node && typeof node === 'object' ? node : {}\n    )\n\n    if (typeof value.type === 'string') {\n      const name =\n        // `hast`\n        typeof value.tagName === 'string'\n          ? value.tagName\n          : // `xast`\n          typeof value.name === 'string'\n          ? value.name\n          : undefined\n\n      Object.defineProperty(visit, 'name', {\n        value:\n          'node (' + color(node.type + (name ? '<' + name + '>' : '')) + ')'\n      })\n    }\n\n    return visit\n\n    function visit() {\n      /** @type {Readonly<ActionTuple>} */\n      let result = empty\n      /** @type {Readonly<ActionTuple>} */\n      let subresult\n      /** @type {number} */\n      let offset\n      /** @type {Array<UnistParent>} */\n      let grandparents\n\n      if (!test || is(node, index, parents[parents.length - 1] || undefined)) {\n        // @ts-expect-error: `visitor` is now a visitor.\n        result = toResult(visitor(node, parents))\n\n        if (result[0] === EXIT) {\n          return result\n        }\n      }\n\n      if ('children' in node && node.children) {\n        const nodeAsParent = /** @type {UnistParent} */ (node)\n\n        if (nodeAsParent.children && result[0] !== SKIP) {\n          offset = (reverse ? nodeAsParent.children.length : -1) + step\n          grandparents = parents.concat(nodeAsParent)\n\n          while (offset > -1 && offset < nodeAsParent.children.length) {\n            const child = nodeAsParent.children[offset]\n\n            subresult = factory(child, offset, grandparents)()\n\n            if (subresult[0] === EXIT) {\n              return subresult\n            }\n\n            offset =\n              typeof subresult[1] === 'number' ? subresult[1] : offset + step\n          }\n        }\n      }\n\n      return result\n    }\n  }\n}\n\n/**\n * Turn a return value into a clean result.\n *\n * @param {VisitorResult} value\n *   Valid return values from visitors.\n * @returns {Readonly<ActionTuple>}\n *   Clean result.\n */\nfunction toResult(value) {\n  if (Array.isArray(value)) {\n    return value\n  }\n\n  if (typeof value === 'number') {\n    return [CONTINUE, value]\n  }\n\n  return value === null || value === undefined ? empty : [value]\n}\n","/**\n * @typedef {import('unist').Node} UnistNode\n * @typedef {import('unist').Parent} UnistParent\n * @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult\n */\n\n/**\n * @typedef {Exclude<import('unist-util-is').Test, undefined> | undefined} Test\n *   Test from `unist-util-is`.\n *\n *   Note: we have remove and add `undefined`, because otherwise when generating\n *   automatic `.d.ts` files, TS tries to flatten paths from a local perspective,\n *   which doesn’t work when publishing on npm.\n */\n\n// To do: use types from `unist-util-visit-parents` when it’s released.\n\n/**\n * @typedef {(\n *   Fn extends (value: any) => value is infer Thing\n *   ? Thing\n *   : Fallback\n * )} Predicate\n *   Get the value of a type guard `Fn`.\n * @template Fn\n *   Value; typically function that is a type guard (such as `(x): x is Y`).\n * @template Fallback\n *   Value to yield if `Fn` is not a type guard.\n */\n\n/**\n * @typedef {(\n *   Check extends null | undefined // No test.\n *   ? Value\n *   : Value extends {type: Check} // String (type) test.\n *   ? Value\n *   : Value extends Check // Partial test.\n *   ? Value\n *   : Check extends Function // Function test.\n *   ? Predicate<Check, Value> extends Value\n *     ? Predicate<Check, Value>\n *     : never\n *   : never // Some other test?\n * )} MatchesOne\n *   Check whether a node matches a primitive check in the type system.\n * @template Value\n *   Value; typically unist `Node`.\n * @template Check\n *   Value; typically `unist-util-is`-compatible test, but not arrays.\n */\n\n/**\n * @typedef {(\n *   Check extends Array<any>\n *   ? MatchesOne<Value, Check[keyof Check]>\n *   : MatchesOne<Value, Check>\n * )} Matches\n *   Check whether a node matches a check in the type system.\n * @template Value\n *   Value; typically unist `Node`.\n * @template Check\n *   Value; typically `unist-util-is`-compatible test.\n */\n\n/**\n * @typedef {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10} Uint\n *   Number; capped reasonably.\n */\n\n/**\n * @typedef {I extends 0 ? 1 : I extends 1 ? 2 : I extends 2 ? 3 : I extends 3 ? 4 : I extends 4 ? 5 : I extends 5 ? 6 : I extends 6 ? 7 : I extends 7 ? 8 : I extends 8 ? 9 : 10} Increment\n *   Increment a number in the type system.\n * @template {Uint} [I=0]\n *   Index.\n */\n\n/**\n * @typedef {(\n *   Node extends UnistParent\n *   ? Node extends {children: Array<infer Children>}\n *     ? Child extends Children ? Node : never\n *     : never\n *   : never\n * )} InternalParent\n *   Collect nodes that can be parents of `Child`.\n * @template {UnistNode} Node\n *   All node types in a tree.\n * @template {UnistNode} Child\n *   Node to search for.\n */\n\n/**\n * @typedef {InternalParent<InclusiveDescendant<Tree>, Child>} Parent\n *   Collect nodes in `Tree` that can be parents of `Child`.\n * @template {UnistNode} Tree\n *   All node types in a tree.\n * @template {UnistNode} Child\n *   Node to search for.\n */\n\n/**\n * @typedef {(\n *   Depth extends Max\n *   ? never\n *   :\n *     | InternalParent<Node, Child>\n *     | InternalAncestor<Node, InternalParent<Node, Child>, Max, Increment<Depth>>\n * )} InternalAncestor\n *   Collect nodes in `Tree` that can be ancestors of `Child`.\n * @template {UnistNode} Node\n *   All node types in a tree.\n * @template {UnistNode} Child\n *   Node to search for.\n * @template {Uint} [Max=10]\n *   Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n *   Current depth.\n */\n\n/**\n * @typedef {(\n *   Tree extends UnistParent\n *     ? Depth extends Max\n *       ? Tree\n *       : Tree | InclusiveDescendant<Tree['children'][number], Max, Increment<Depth>>\n *     : Tree\n * )} InclusiveDescendant\n *   Collect all (inclusive) descendants of `Tree`.\n *\n *   > 👉 **Note**: for performance reasons, this seems to be the fastest way to\n *   > recurse without actually running into an infinite loop, which the\n *   > previous version did.\n *   >\n *   > Practically, a max of `2` is typically enough assuming a `Root` is\n *   > passed, but it doesn’t improve performance.\n *   > It gets higher with `List > ListItem > Table > TableRow > TableCell`.\n *   > Using up to `10` doesn’t hurt or help either.\n * @template {UnistNode} Tree\n *   Tree type.\n * @template {Uint} [Max=10]\n *   Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n *   Current depth.\n */\n\n/**\n * @callback Visitor\n *   Handle a node (matching `test`, if given).\n *\n *   Visitors are free to transform `node`.\n *   They can also transform `parent`.\n *\n *   Replacing `node` itself, if `SKIP` is not returned, still causes its\n *   descendants to be walked (which is a bug).\n *\n *   When adding or removing previous siblings of `node` (or next siblings, in\n *   case of reverse), the `Visitor` should return a new `Index` to specify the\n *   sibling to traverse after `node` is traversed.\n *   Adding or removing next siblings of `node` (or previous siblings, in case\n *   of reverse) is handled as expected without needing to return a new `Index`.\n *\n *   Removing the children property of `parent` still results in them being\n *   traversed.\n * @param {Visited} node\n *   Found node.\n * @param {Visited extends UnistNode ? number | undefined : never} index\n *   Index of `node` in `parent`.\n * @param {Ancestor extends UnistParent ? Ancestor | undefined : never} parent\n *   Parent of `node`.\n * @returns {VisitorResult}\n *   What to do next.\n *\n *   An `Index` is treated as a tuple of `[CONTINUE, Index]`.\n *   An `Action` is treated as a tuple of `[Action]`.\n *\n *   Passing a tuple back only makes sense if the `Action` is `SKIP`.\n *   When the `Action` is `EXIT`, that action can be returned.\n *   When the `Action` is `CONTINUE`, `Index` can be returned.\n * @template {UnistNode} [Visited=UnistNode]\n *   Visited node type.\n * @template {UnistParent} [Ancestor=UnistParent]\n *   Ancestor type.\n */\n\n/**\n * @typedef {Visitor<Visited, Parent<Ancestor, Visited>>} BuildVisitorFromMatch\n *   Build a typed `Visitor` function from a node and all possible parents.\n *\n *   It will infer which values are passed as `node` and which as `parent`.\n * @template {UnistNode} Visited\n *   Node type.\n * @template {UnistParent} Ancestor\n *   Parent type.\n */\n\n/**\n * @typedef {(\n *   BuildVisitorFromMatch<\n *     Matches<Descendant, Check>,\n *     Extract<Descendant, UnistParent>\n *   >\n * )} BuildVisitorFromDescendants\n *   Build a typed `Visitor` function from a list of descendants and a test.\n *\n *   It will infer which values are passed as `node` and which as `parent`.\n * @template {UnistNode} Descendant\n *   Node type.\n * @template {Test} Check\n *   Test type.\n */\n\n/**\n * @typedef {(\n *   BuildVisitorFromDescendants<\n *     InclusiveDescendant<Tree>,\n *     Check\n *   >\n * )} BuildVisitor\n *   Build a typed `Visitor` function from a tree and a test.\n *\n *   It will infer which values are passed as `node` and which as `parent`.\n * @template {UnistNode} [Tree=UnistNode]\n *   Node type.\n * @template {Test} [Check=Test]\n *   Test type.\n */\n\nimport {visitParents} from 'unist-util-visit-parents'\n\nexport {CONTINUE, EXIT, SKIP} from 'unist-util-visit-parents'\n\n/**\n * Visit nodes.\n *\n * This algorithm performs *depth-first* *tree traversal* in *preorder*\n * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).\n *\n * You can choose for which nodes `visitor` is called by passing a `test`.\n * For complex tests, you should test yourself in `visitor`, as it will be\n * faster and will have improved type information.\n *\n * Walking the tree is an intensive task.\n * Make use of the return values of the visitor when possible.\n * Instead of walking a tree multiple times, walk it once, use `unist-util-is`\n * to check if a node matches, and then perform different operations.\n *\n * You can change the tree.\n * See `Visitor` for more info.\n *\n * @overload\n * @param {Tree} tree\n * @param {Check} check\n * @param {BuildVisitor<Tree, Check>} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @overload\n * @param {Tree} tree\n * @param {BuildVisitor<Tree>} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @param {UnistNode} tree\n *   Tree to traverse.\n * @param {Visitor | Test} testOrVisitor\n *   `unist-util-is`-compatible test (optional, omit to pass a visitor).\n * @param {Visitor | boolean | null | undefined} [visitorOrReverse]\n *   Handle each node (when test is omitted, pass `reverse`).\n * @param {boolean | null | undefined} [maybeReverse=false]\n *   Traverse in reverse preorder (NRL) instead of the default preorder (NLR).\n * @returns {undefined}\n *   Nothing.\n *\n * @template {UnistNode} Tree\n *   Node type.\n * @template {Test} Check\n *   `unist-util-is`-compatible test.\n */\nexport function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {\n  /** @type {boolean | null | undefined} */\n  let reverse\n  /** @type {Test} */\n  let test\n  /** @type {Visitor} */\n  let visitor\n\n  if (\n    typeof testOrVisitor === 'function' &&\n    typeof visitorOrReverse !== 'function'\n  ) {\n    test = undefined\n    visitor = testOrVisitor\n    reverse = visitorOrReverse\n  } else {\n    // @ts-expect-error: assume the overload with test was given.\n    test = testOrVisitor\n    // @ts-expect-error: assume the overload with test was given.\n    visitor = visitorOrReverse\n    reverse = maybeReverse\n  }\n\n  visitParents(tree, test, overload, reverse)\n\n  /**\n   * @param {UnistNode} node\n   * @param {Array<UnistParent>} parents\n   */\n  function overload(node, parents) {\n    const parent = parents[parents.length - 1]\n    const index = parent ? parent.children.indexOf(node) : undefined\n    return visitor(node, index, parent)\n  }\n}\n","/**\n * @import {State} from 'mdast-util-to-markdown'\n * @import {Heading} from 'mdast'\n */\n\nimport {EXIT, visit} from 'unist-util-visit'\nimport {toString} from 'mdast-util-to-string'\n\n/**\n * @param {Heading} node\n * @param {State} state\n * @returns {boolean}\n */\nexport function formatHeadingAsSetext(node, state) {\n  let literalWithBreak = false\n\n  // Look for literals with a line break.\n  // Note that this also\n  visit(node, function (node) {\n    if (\n      ('value' in node && /\\r?\\n|\\r/.test(node.value)) ||\n      node.type === 'break'\n    ) {\n      literalWithBreak = true\n      return EXIT\n    }\n  })\n\n  return Boolean(\n    (!node.depth || node.depth < 3) &&\n      toString(node) &&\n      (state.options.setext || literalWithBreak)\n  )\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Heading, Parents} from 'mdast'\n */\n\nimport {encodeCharacterReference} from '../util/encode-character-reference.js'\nimport {formatHeadingAsSetext} from '../util/format-heading-as-setext.js'\n\n/**\n * @param {Heading} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function heading(node, _, state, info) {\n  const rank = Math.max(Math.min(6, node.depth || 1), 1)\n  const tracker = state.createTracker(info)\n\n  if (formatHeadingAsSetext(node, state)) {\n    const exit = state.enter('headingSetext')\n    const subexit = state.enter('phrasing')\n    const value = state.containerPhrasing(node, {\n      ...tracker.current(),\n      before: '\\n',\n      after: '\\n'\n    })\n    subexit()\n    exit()\n\n    return (\n      value +\n      '\\n' +\n      (rank === 1 ? '=' : '-').repeat(\n        // The whole size…\n        value.length -\n          // Minus the position of the character after the last EOL (or\n          // 0 if there is none)…\n          (Math.max(value.lastIndexOf('\\r'), value.lastIndexOf('\\n')) + 1)\n      )\n    )\n  }\n\n  const sequence = '#'.repeat(rank)\n  const exit = state.enter('headingAtx')\n  const subexit = state.enter('phrasing')\n\n  // Note: for proper tracking, we should reset the output positions when there\n  // is no content returned, because then the space is not output.\n  // Practically, in that case, there is no content, so it doesn’t matter that\n  // we’ve tracked one too many characters.\n  tracker.move(sequence + ' ')\n\n  let value = state.containerPhrasing(node, {\n    before: '# ',\n    after: '\\n',\n    ...tracker.current()\n  })\n\n  if (/^[\\t ]/.test(value)) {\n    // To do: what effect has the character reference on tracking?\n    value = encodeCharacterReference(value.charCodeAt(0)) + value.slice(1)\n  }\n\n  value = value ? sequence + ' ' + value : sequence\n\n  if (state.options.closeAtx) {\n    value += ' ' + sequence\n  }\n\n  subexit()\n  exit()\n\n  return value\n}\n","/**\n * @import {Html} from 'mdast'\n */\n\nhtml.peek = htmlPeek\n\n/**\n * @param {Html} node\n * @returns {string}\n */\nexport function html(node) {\n  return node.value || ''\n}\n\n/**\n * @returns {string}\n */\nfunction htmlPeek() {\n  return '<'\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Image, Parents} from 'mdast'\n */\n\nimport {checkQuote} from '../util/check-quote.js'\n\nimage.peek = imagePeek\n\n/**\n * @param {Image} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function image(node, _, state, info) {\n  const quote = checkQuote(state)\n  const suffix = quote === '\"' ? 'Quote' : 'Apostrophe'\n  const exit = state.enter('image')\n  let subexit = state.enter('label')\n  const tracker = state.createTracker(info)\n  let value = tracker.move('![')\n  value += tracker.move(\n    state.safe(node.alt, {before: value, after: ']', ...tracker.current()})\n  )\n  value += tracker.move('](')\n\n  subexit()\n\n  if (\n    // If there’s no url but there is a title…\n    (!node.url && node.title) ||\n    // If there are control characters or whitespace.\n    /[\\0- \\u007F]/.test(node.url)\n  ) {\n    subexit = state.enter('destinationLiteral')\n    value += tracker.move('<')\n    value += tracker.move(\n      state.safe(node.url, {before: value, after: '>', ...tracker.current()})\n    )\n    value += tracker.move('>')\n  } else {\n    // No whitespace, raw is prettier.\n    subexit = state.enter('destinationRaw')\n    value += tracker.move(\n      state.safe(node.url, {\n        before: value,\n        after: node.title ? ' ' : ')',\n        ...tracker.current()\n      })\n    )\n  }\n\n  subexit()\n\n  if (node.title) {\n    subexit = state.enter(`title${suffix}`)\n    value += tracker.move(' ' + quote)\n    value += tracker.move(\n      state.safe(node.title, {\n        before: value,\n        after: quote,\n        ...tracker.current()\n      })\n    )\n    value += tracker.move(quote)\n    subexit()\n  }\n\n  value += tracker.move(')')\n  exit()\n\n  return value\n}\n\n/**\n * @returns {string}\n */\nfunction imagePeek() {\n  return '!'\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {ImageReference, Parents} from 'mdast'\n */\n\nimageReference.peek = imageReferencePeek\n\n/**\n * @param {ImageReference} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function imageReference(node, _, state, info) {\n  const type = node.referenceType\n  const exit = state.enter('imageReference')\n  let subexit = state.enter('label')\n  const tracker = state.createTracker(info)\n  let value = tracker.move('![')\n  const alt = state.safe(node.alt, {\n    before: value,\n    after: ']',\n    ...tracker.current()\n  })\n  value += tracker.move(alt + '][')\n\n  subexit()\n  // Hide the fact that we’re in phrasing, because escapes don’t work.\n  const stack = state.stack\n  state.stack = []\n  subexit = state.enter('reference')\n  // Note: for proper tracking, we should reset the output positions when we end\n  // up making a `shortcut` reference, because then there is no brace output.\n  // Practically, in that case, there is no content, so it doesn’t matter that\n  // we’ve tracked one too many characters.\n  const reference = state.safe(state.associationId(node), {\n    before: value,\n    after: ']',\n    ...tracker.current()\n  })\n  subexit()\n  state.stack = stack\n  exit()\n\n  if (type === 'full' || !alt || alt !== reference) {\n    value += tracker.move(reference + ']')\n  } else if (type === 'shortcut') {\n    // Remove the unwanted `[`.\n    value = value.slice(0, -1)\n  } else {\n    value += tracker.move(']')\n  }\n\n  return value\n}\n\n/**\n * @returns {string}\n */\nfunction imageReferencePeek() {\n  return '!'\n}\n","/**\n * @import {State} from 'mdast-util-to-markdown'\n * @import {InlineCode, Parents} from 'mdast'\n */\n\ninlineCode.peek = inlineCodePeek\n\n/**\n * @param {InlineCode} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @returns {string}\n */\nexport function inlineCode(node, _, state) {\n  let value = node.value || ''\n  let sequence = '`'\n  let index = -1\n\n  // If there is a single grave accent on its own in the code, use a fence of\n  // two.\n  // If there are two in a row, use one.\n  while (new RegExp('(^|[^`])' + sequence + '([^`]|$)').test(value)) {\n    sequence += '`'\n  }\n\n  // If this is not just spaces or eols (tabs don’t count), and either the\n  // first or last character are a space, eol, or tick, then pad with spaces.\n  if (\n    /[^ \\r\\n]/.test(value) &&\n    ((/^[ \\r\\n]/.test(value) && /[ \\r\\n]$/.test(value)) || /^`|`$/.test(value))\n  ) {\n    value = ' ' + value + ' '\n  }\n\n  // We have a potential problem: certain characters after eols could result in\n  // blocks being seen.\n  // For example, if someone injected the string `'\\n# b'`, then that would\n  // result in an ATX heading.\n  // We can’t escape characters in `inlineCode`, but because eols are\n  // transformed to spaces when going from markdown to HTML anyway, we can swap\n  // them out.\n  while (++index < state.unsafe.length) {\n    const pattern = state.unsafe[index]\n    const expression = state.compilePattern(pattern)\n    /** @type {RegExpExecArray | null} */\n    let match\n\n    // Only look for `atBreak`s.\n    // Btw: note that `atBreak` patterns will always start the regex at LF or\n    // CR.\n    if (!pattern.atBreak) continue\n\n    while ((match = expression.exec(value))) {\n      let position = match.index\n\n      // Support CRLF (patterns only look for one of the characters).\n      if (\n        value.charCodeAt(position) === 10 /* `\\n` */ &&\n        value.charCodeAt(position - 1) === 13 /* `\\r` */\n      ) {\n        position--\n      }\n\n      value = value.slice(0, position) + ' ' + value.slice(match.index + 1)\n    }\n  }\n\n  return sequence + value + sequence\n}\n\n/**\n * @returns {string}\n */\nfunction inlineCodePeek() {\n  return '`'\n}\n","/**\n * @import {State} from 'mdast-util-to-markdown'\n * @import {Link} from 'mdast'\n */\n\nimport {toString} from 'mdast-util-to-string'\n\n/**\n * @param {Link} node\n * @param {State} state\n * @returns {boolean}\n */\nexport function formatLinkAsAutolink(node, state) {\n  const raw = toString(node)\n\n  return Boolean(\n    !state.options.resourceLink &&\n      // If there’s a url…\n      node.url &&\n      // And there’s a no title…\n      !node.title &&\n      // And the content of `node` is a single text node…\n      node.children &&\n      node.children.length === 1 &&\n      node.children[0].type === 'text' &&\n      // And if the url is the same as the content…\n      (raw === node.url || 'mailto:' + raw === node.url) &&\n      // And that starts w/ a protocol…\n      /^[a-z][a-z+.-]+:/i.test(node.url) &&\n      // And that doesn’t contain ASCII control codes (character escapes and\n      // references don’t work), space, or angle brackets…\n      !/[\\0- <>\\u007F]/.test(node.url)\n  )\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Link, Parents} from 'mdast'\n * @import {Exit} from '../types.js'\n */\n\nimport {checkQuote} from '../util/check-quote.js'\nimport {formatLinkAsAutolink} from '../util/format-link-as-autolink.js'\n\nlink.peek = linkPeek\n\n/**\n * @param {Link} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function link(node, _, state, info) {\n  const quote = checkQuote(state)\n  const suffix = quote === '\"' ? 'Quote' : 'Apostrophe'\n  const tracker = state.createTracker(info)\n  /** @type {Exit} */\n  let exit\n  /** @type {Exit} */\n  let subexit\n\n  if (formatLinkAsAutolink(node, state)) {\n    // Hide the fact that we’re in phrasing, because escapes don’t work.\n    const stack = state.stack\n    state.stack = []\n    exit = state.enter('autolink')\n    let value = tracker.move('<')\n    value += tracker.move(\n      state.containerPhrasing(node, {\n        before: value,\n        after: '>',\n        ...tracker.current()\n      })\n    )\n    value += tracker.move('>')\n    exit()\n    state.stack = stack\n    return value\n  }\n\n  exit = state.enter('link')\n  subexit = state.enter('label')\n  let value = tracker.move('[')\n  value += tracker.move(\n    state.containerPhrasing(node, {\n      before: value,\n      after: '](',\n      ...tracker.current()\n    })\n  )\n  value += tracker.move('](')\n  subexit()\n\n  if (\n    // If there’s no url but there is a title…\n    (!node.url && node.title) ||\n    // If there are control characters or whitespace.\n    /[\\0- \\u007F]/.test(node.url)\n  ) {\n    subexit = state.enter('destinationLiteral')\n    value += tracker.move('<')\n    value += tracker.move(\n      state.safe(node.url, {before: value, after: '>', ...tracker.current()})\n    )\n    value += tracker.move('>')\n  } else {\n    // No whitespace, raw is prettier.\n    subexit = state.enter('destinationRaw')\n    value += tracker.move(\n      state.safe(node.url, {\n        before: value,\n        after: node.title ? ' ' : ')',\n        ...tracker.current()\n      })\n    )\n  }\n\n  subexit()\n\n  if (node.title) {\n    subexit = state.enter(`title${suffix}`)\n    value += tracker.move(' ' + quote)\n    value += tracker.move(\n      state.safe(node.title, {\n        before: value,\n        after: quote,\n        ...tracker.current()\n      })\n    )\n    value += tracker.move(quote)\n    subexit()\n  }\n\n  value += tracker.move(')')\n\n  exit()\n  return value\n}\n\n/**\n * @param {Link} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @returns {string}\n */\nfunction linkPeek(node, _, state) {\n  return formatLinkAsAutolink(node, state) ? '<' : '['\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {LinkReference, Parents} from 'mdast'\n */\n\nlinkReference.peek = linkReferencePeek\n\n/**\n * @param {LinkReference} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function linkReference(node, _, state, info) {\n  const type = node.referenceType\n  const exit = state.enter('linkReference')\n  let subexit = state.enter('label')\n  const tracker = state.createTracker(info)\n  let value = tracker.move('[')\n  const text = state.containerPhrasing(node, {\n    before: value,\n    after: ']',\n    ...tracker.current()\n  })\n  value += tracker.move(text + '][')\n\n  subexit()\n  // Hide the fact that we’re in phrasing, because escapes don’t work.\n  const stack = state.stack\n  state.stack = []\n  subexit = state.enter('reference')\n  // Note: for proper tracking, we should reset the output positions when we end\n  // up making a `shortcut` reference, because then there is no brace output.\n  // Practically, in that case, there is no content, so it doesn’t matter that\n  // we’ve tracked one too many characters.\n  const reference = state.safe(state.associationId(node), {\n    before: value,\n    after: ']',\n    ...tracker.current()\n  })\n  subexit()\n  state.stack = stack\n  exit()\n\n  if (type === 'full' || !text || text !== reference) {\n    value += tracker.move(reference + ']')\n  } else if (type === 'shortcut') {\n    // Remove the unwanted `[`.\n    value = value.slice(0, -1)\n  } else {\n    value += tracker.move(']')\n  }\n\n  return value\n}\n\n/**\n * @returns {string}\n */\nfunction linkReferencePeek() {\n  return '['\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['bullet'], null | undefined>}\n */\nexport function checkBullet(state) {\n  const marker = state.options.bullet || '*'\n\n  if (marker !== '*' && marker !== '+' && marker !== '-') {\n    throw new Error(\n      'Cannot serialize items with `' +\n        marker +\n        '` for `options.bullet`, expected `*`, `+`, or `-`'\n    )\n  }\n\n  return marker\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\nimport {checkBullet} from './check-bullet.js'\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['bullet'], null | undefined>}\n */\nexport function checkBulletOther(state) {\n  const bullet = checkBullet(state)\n  const bulletOther = state.options.bulletOther\n\n  if (!bulletOther) {\n    return bullet === '*' ? '-' : '*'\n  }\n\n  if (bulletOther !== '*' && bulletOther !== '+' && bulletOther !== '-') {\n    throw new Error(\n      'Cannot serialize items with `' +\n        bulletOther +\n        '` for `options.bulletOther`, expected `*`, `+`, or `-`'\n    )\n  }\n\n  if (bulletOther === bullet) {\n    throw new Error(\n      'Expected `bullet` (`' +\n        bullet +\n        '`) and `bulletOther` (`' +\n        bulletOther +\n        '`) to be different'\n    )\n  }\n\n  return bulletOther\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['bulletOrdered'], null | undefined>}\n */\nexport function checkBulletOrdered(state) {\n  const marker = state.options.bulletOrdered || '.'\n\n  if (marker !== '.' && marker !== ')') {\n    throw new Error(\n      'Cannot serialize items with `' +\n        marker +\n        '` for `options.bulletOrdered`, expected `.` or `)`'\n    )\n  }\n\n  return marker\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['rule'], null | undefined>}\n */\nexport function checkRule(state) {\n  const marker = state.options.rule || '*'\n\n  if (marker !== '*' && marker !== '-' && marker !== '_') {\n    throw new Error(\n      'Cannot serialize rules with `' +\n        marker +\n        '` for `options.rule`, expected `*`, `-`, or `_`'\n    )\n  }\n\n  return marker\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {List, Parents} from 'mdast'\n */\n\nimport {checkBullet} from '../util/check-bullet.js'\nimport {checkBulletOther} from '../util/check-bullet-other.js'\nimport {checkBulletOrdered} from '../util/check-bullet-ordered.js'\nimport {checkRule} from '../util/check-rule.js'\n\n/**\n * @param {List} node\n * @param {Parents | undefined} parent\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function list(node, parent, state, info) {\n  const exit = state.enter('list')\n  const bulletCurrent = state.bulletCurrent\n  /** @type {string} */\n  let bullet = node.ordered ? checkBulletOrdered(state) : checkBullet(state)\n  /** @type {string} */\n  const bulletOther = node.ordered\n    ? bullet === '.'\n      ? ')'\n      : '.'\n    : checkBulletOther(state)\n  let useDifferentMarker =\n    parent && state.bulletLastUsed ? bullet === state.bulletLastUsed : false\n\n  if (!node.ordered) {\n    const firstListItem = node.children ? node.children[0] : undefined\n\n    // If there’s an empty first list item directly in two list items,\n    // we have to use a different bullet:\n    //\n    // ```markdown\n    // * - *\n    // ```\n    //\n    // …because otherwise it would become one big thematic break.\n    if (\n      // Bullet could be used as a thematic break marker:\n      (bullet === '*' || bullet === '-') &&\n      // Empty first list item:\n      firstListItem &&\n      (!firstListItem.children || !firstListItem.children[0]) &&\n      // Directly in two other list items:\n      state.stack[state.stack.length - 1] === 'list' &&\n      state.stack[state.stack.length - 2] === 'listItem' &&\n      state.stack[state.stack.length - 3] === 'list' &&\n      state.stack[state.stack.length - 4] === 'listItem' &&\n      // That are each the first child.\n      state.indexStack[state.indexStack.length - 1] === 0 &&\n      state.indexStack[state.indexStack.length - 2] === 0 &&\n      state.indexStack[state.indexStack.length - 3] === 0\n    ) {\n      useDifferentMarker = true\n    }\n\n    // If there’s a thematic break at the start of the first list item,\n    // we have to use a different bullet:\n    //\n    // ```markdown\n    // * ---\n    // ```\n    //\n    // …because otherwise it would become one big thematic break.\n    if (checkRule(state) === bullet && firstListItem) {\n      let index = -1\n\n      while (++index < node.children.length) {\n        const item = node.children[index]\n\n        if (\n          item &&\n          item.type === 'listItem' &&\n          item.children &&\n          item.children[0] &&\n          item.children[0].type === 'thematicBreak'\n        ) {\n          useDifferentMarker = true\n          break\n        }\n      }\n    }\n  }\n\n  if (useDifferentMarker) {\n    bullet = bulletOther\n  }\n\n  state.bulletCurrent = bullet\n  const value = state.containerFlow(node, info)\n  state.bulletLastUsed = bullet\n  state.bulletCurrent = bulletCurrent\n  exit()\n  return value\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['listItemIndent'], null | undefined>}\n */\nexport function checkListItemIndent(state) {\n  const style = state.options.listItemIndent || 'one'\n\n  if (style !== 'tab' && style !== 'one' && style !== 'mixed') {\n    throw new Error(\n      'Cannot serialize items with `' +\n        style +\n        '` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`'\n    )\n  }\n\n  return style\n}\n","/**\n * @import {Info, Map, State} from 'mdast-util-to-markdown'\n * @import {ListItem, Parents} from 'mdast'\n */\n\nimport {checkBullet} from '../util/check-bullet.js'\nimport {checkListItemIndent} from '../util/check-list-item-indent.js'\n\n/**\n * @param {ListItem} node\n * @param {Parents | undefined} parent\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function listItem(node, parent, state, info) {\n  const listItemIndent = checkListItemIndent(state)\n  let bullet = state.bulletCurrent || checkBullet(state)\n\n  // Add the marker value for ordered lists.\n  if (parent && parent.type === 'list' && parent.ordered) {\n    bullet =\n      (typeof parent.start === 'number' && parent.start > -1\n        ? parent.start\n        : 1) +\n      (state.options.incrementListMarker === false\n        ? 0\n        : parent.children.indexOf(node)) +\n      bullet\n  }\n\n  let size = bullet.length + 1\n\n  if (\n    listItemIndent === 'tab' ||\n    (listItemIndent === 'mixed' &&\n      ((parent && parent.type === 'list' && parent.spread) || node.spread))\n  ) {\n    size = Math.ceil(size / 4) * 4\n  }\n\n  const tracker = state.createTracker(info)\n  tracker.move(bullet + ' '.repeat(size - bullet.length))\n  tracker.shift(size)\n  const exit = state.enter('listItem')\n  const value = state.indentLines(\n    state.containerFlow(node, tracker.current()),\n    map\n  )\n  exit()\n\n  return value\n\n  /** @type {Map} */\n  function map(line, index, blank) {\n    if (index) {\n      return (blank ? '' : ' '.repeat(size)) + line\n    }\n\n    return (blank ? bullet : bullet + ' '.repeat(size - bullet.length)) + line\n  }\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Paragraph, Parents} from 'mdast'\n */\n\n/**\n * @param {Paragraph} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function paragraph(node, _, state, info) {\n  const exit = state.enter('paragraph')\n  const subexit = state.enter('phrasing')\n  const value = state.containerPhrasing(node, info)\n  subexit()\n  exit()\n  return value\n}\n","/**\n * @typedef {import('mdast').Html} Html\n * @typedef {import('mdast').PhrasingContent} PhrasingContent\n */\n\nimport {convert} from 'unist-util-is'\n\n/**\n * Check if the given value is *phrasing content*.\n *\n * > 👉 **Note**: Excludes `html`, which can be both phrasing or flow.\n *\n * @param node\n *   Thing to check, typically `Node`.\n * @returns\n *   Whether `value` is phrasing content.\n */\n\nexport const phrasing =\n  /** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */\n  (\n    convert([\n      'break',\n      'delete',\n      'emphasis',\n      // To do: next major: removed since footnotes were added to GFM.\n      'footnote',\n      'footnoteReference',\n      'image',\n      'imageReference',\n      'inlineCode',\n      // Enabled by `mdast-util-math`:\n      'inlineMath',\n      'link',\n      'linkReference',\n      // Enabled by `mdast-util-mdx`:\n      'mdxJsxTextElement',\n      // Enabled by `mdast-util-mdx`:\n      'mdxTextExpression',\n      'strong',\n      'text',\n      // Enabled by `mdast-util-directive`:\n      'textDirective'\n    ])\n  )\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Parents, Root} from 'mdast'\n */\n\nimport {phrasing} from 'mdast-util-phrasing'\n\n/**\n * @param {Root} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function root(node, _, state, info) {\n  // Note: `html` nodes are ambiguous.\n  const hasPhrasing = node.children.some(function (d) {\n    return phrasing(d)\n  })\n\n  const container = hasPhrasing ? state.containerPhrasing : state.containerFlow\n  return container.call(state, node, info)\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['strong'], null | undefined>}\n */\nexport function checkStrong(state) {\n  const marker = state.options.strong || '*'\n\n  if (marker !== '*' && marker !== '_') {\n    throw new Error(\n      'Cannot serialize strong with `' +\n        marker +\n        '` for `options.strong`, expected `*`, or `_`'\n    )\n  }\n\n  return marker\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Parents, Strong} from 'mdast'\n */\n\nimport {checkStrong} from '../util/check-strong.js'\nimport {encodeCharacterReference} from '../util/encode-character-reference.js'\nimport {encodeInfo} from '../util/encode-info.js'\n\nstrong.peek = strongPeek\n\n/**\n * @param {Strong} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function strong(node, _, state, info) {\n  const marker = checkStrong(state)\n  const exit = state.enter('strong')\n  const tracker = state.createTracker(info)\n  const before = tracker.move(marker + marker)\n\n  let between = tracker.move(\n    state.containerPhrasing(node, {\n      after: marker,\n      before,\n      ...tracker.current()\n    })\n  )\n  const betweenHead = between.charCodeAt(0)\n  const open = encodeInfo(\n    info.before.charCodeAt(info.before.length - 1),\n    betweenHead,\n    marker\n  )\n\n  if (open.inside) {\n    between = encodeCharacterReference(betweenHead) + between.slice(1)\n  }\n\n  const betweenTail = between.charCodeAt(between.length - 1)\n  const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker)\n\n  if (close.inside) {\n    between = between.slice(0, -1) + encodeCharacterReference(betweenTail)\n  }\n\n  const after = tracker.move(marker + marker)\n\n  exit()\n\n  state.attentionEncodeSurroundingInfo = {\n    after: close.outside,\n    before: open.outside\n  }\n  return before + between + after\n}\n\n/**\n * @param {Strong} _\n * @param {Parents | undefined} _1\n * @param {State} state\n * @returns {string}\n */\nfunction strongPeek(_, _1, state) {\n  return state.options.strong || '*'\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Parents, Text} from 'mdast'\n */\n\n/**\n * @param {Text} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function text(node, _, state, info) {\n  return state.safe(node.value, info)\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['ruleRepetition'], null | undefined>}\n */\nexport function checkRuleRepetition(state) {\n  const repetition = state.options.ruleRepetition || 3\n\n  if (repetition < 3) {\n    throw new Error(\n      'Cannot serialize rules with repetition `' +\n        repetition +\n        '` for `options.ruleRepetition`, expected `3` or more'\n    )\n  }\n\n  return repetition\n}\n","/**\n * @import {State} from 'mdast-util-to-markdown'\n * @import {Parents, ThematicBreak} from 'mdast'\n */\n\nimport {checkRuleRepetition} from '../util/check-rule-repetition.js'\nimport {checkRule} from '../util/check-rule.js'\n\n/**\n * @param {ThematicBreak} _\n * @param {Parents | undefined} _1\n * @param {State} state\n * @returns {string}\n */\nexport function thematicBreak(_, _1, state) {\n  const value = (\n    checkRule(state) + (state.options.ruleSpaces ? ' ' : '')\n  ).repeat(checkRuleRepetition(state))\n\n  return state.options.ruleSpaces ? value.slice(0, -1) : value\n}\n","import {blockquote} from './blockquote.js'\nimport {hardBreak} from './break.js'\nimport {code} from './code.js'\nimport {definition} from './definition.js'\nimport {emphasis} from './emphasis.js'\nimport {heading} from './heading.js'\nimport {html} from './html.js'\nimport {image} from './image.js'\nimport {imageReference} from './image-reference.js'\nimport {inlineCode} from './inline-code.js'\nimport {link} from './link.js'\nimport {linkReference} from './link-reference.js'\nimport {list} from './list.js'\nimport {listItem} from './list-item.js'\nimport {paragraph} from './paragraph.js'\nimport {root} from './root.js'\nimport {strong} from './strong.js'\nimport {text} from './text.js'\nimport {thematicBreak} from './thematic-break.js'\n\n/**\n * Default (CommonMark) handlers.\n */\nexport const handle = {\n  blockquote,\n  break: hardBreak,\n  code,\n  definition,\n  emphasis,\n  hardBreak,\n  heading,\n  html,\n  image,\n  imageReference,\n  inlineCode,\n  link,\n  linkReference,\n  list,\n  listItem,\n  paragraph,\n  root,\n  strong,\n  text,\n  thematicBreak\n}\n","/**\n * @import {Join} from 'mdast-util-to-markdown'\n */\n\nimport {formatCodeAsIndented} from './util/format-code-as-indented.js'\nimport {formatHeadingAsSetext} from './util/format-heading-as-setext.js'\n\n/** @type {Array<Join>} */\nexport const join = [joinDefaults]\n\n/** @type {Join} */\nfunction joinDefaults(left, right, parent, state) {\n  // Indented code after list or another indented code.\n  if (\n    right.type === 'code' &&\n    formatCodeAsIndented(right, state) &&\n    (left.type === 'list' ||\n      (left.type === right.type && formatCodeAsIndented(left, state)))\n  ) {\n    return false\n  }\n\n  // Join children of a list or an item.\n  // In which case, `parent` has a `spread` field.\n  if ('spread' in parent && typeof parent.spread === 'boolean') {\n    if (\n      left.type === 'paragraph' &&\n      // Two paragraphs.\n      (left.type === right.type ||\n        right.type === 'definition' ||\n        // Paragraph followed by a setext heading.\n        (right.type === 'heading' && formatHeadingAsSetext(right, state)))\n    ) {\n      return\n    }\n\n    return parent.spread ? 1 : 0\n  }\n}\n","/**\n * @import {ConstructName, Unsafe} from 'mdast-util-to-markdown'\n */\n\n/**\n * List of constructs that occur in phrasing (paragraphs, headings), but cannot\n * contain things like attention (emphasis, strong), images, or links.\n * So they sort of cancel each other out.\n * Note: could use a better name.\n *\n * @type {Array<ConstructName>}\n */\nconst fullPhrasingSpans = [\n  'autolink',\n  'destinationLiteral',\n  'destinationRaw',\n  'reference',\n  'titleQuote',\n  'titleApostrophe'\n]\n\n/** @type {Array<Unsafe>} */\nexport const unsafe = [\n  {character: '\\t', after: '[\\\\r\\\\n]', inConstruct: 'phrasing'},\n  {character: '\\t', before: '[\\\\r\\\\n]', inConstruct: 'phrasing'},\n  {\n    character: '\\t',\n    inConstruct: ['codeFencedLangGraveAccent', 'codeFencedLangTilde']\n  },\n  {\n    character: '\\r',\n    inConstruct: [\n      'codeFencedLangGraveAccent',\n      'codeFencedLangTilde',\n      'codeFencedMetaGraveAccent',\n      'codeFencedMetaTilde',\n      'destinationLiteral',\n      'headingAtx'\n    ]\n  },\n  {\n    character: '\\n',\n    inConstruct: [\n      'codeFencedLangGraveAccent',\n      'codeFencedLangTilde',\n      'codeFencedMetaGraveAccent',\n      'codeFencedMetaTilde',\n      'destinationLiteral',\n      'headingAtx'\n    ]\n  },\n  {character: ' ', after: '[\\\\r\\\\n]', inConstruct: 'phrasing'},\n  {character: ' ', before: '[\\\\r\\\\n]', inConstruct: 'phrasing'},\n  {\n    character: ' ',\n    inConstruct: ['codeFencedLangGraveAccent', 'codeFencedLangTilde']\n  },\n  // An exclamation mark can start an image, if it is followed by a link or\n  // a link reference.\n  {\n    character: '!',\n    after: '\\\\[',\n    inConstruct: 'phrasing',\n    notInConstruct: fullPhrasingSpans\n  },\n  // A quote can break out of a title.\n  {character: '\"', inConstruct: 'titleQuote'},\n  // A number sign could start an ATX heading if it starts a line.\n  {atBreak: true, character: '#'},\n  {character: '#', inConstruct: 'headingAtx', after: '(?:[\\r\\n]|$)'},\n  // Dollar sign and percentage are not used in markdown.\n  // An ampersand could start a character reference.\n  {character: '&', after: '[#A-Za-z]', inConstruct: 'phrasing'},\n  // An apostrophe can break out of a title.\n  {character: \"'\", inConstruct: 'titleApostrophe'},\n  // A left paren could break out of a destination raw.\n  {character: '(', inConstruct: 'destinationRaw'},\n  // A left paren followed by `]` could make something into a link or image.\n  {\n    before: '\\\\]',\n    character: '(',\n    inConstruct: 'phrasing',\n    notInConstruct: fullPhrasingSpans\n  },\n  // A right paren could start a list item or break out of a destination\n  // raw.\n  {atBreak: true, before: '\\\\d+', character: ')'},\n  {character: ')', inConstruct: 'destinationRaw'},\n  // An asterisk can start thematic breaks, list items, emphasis, strong.\n  {atBreak: true, character: '*', after: '(?:[ \\t\\r\\n*])'},\n  {character: '*', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans},\n  // A plus sign could start a list item.\n  {atBreak: true, character: '+', after: '(?:[ \\t\\r\\n])'},\n  // A dash can start thematic breaks, list items, and setext heading\n  // underlines.\n  {atBreak: true, character: '-', after: '(?:[ \\t\\r\\n-])'},\n  // A dot could start a list item.\n  {atBreak: true, before: '\\\\d+', character: '.', after: '(?:[ \\t\\r\\n]|$)'},\n  // Slash, colon, and semicolon are not used in markdown for constructs.\n  // A less than can start html (flow or text) or an autolink.\n  // HTML could start with an exclamation mark (declaration, cdata, comment),\n  // slash (closing tag), question mark (instruction), or a letter (tag).\n  // An autolink also starts with a letter.\n  // Finally, it could break out of a destination literal.\n  {atBreak: true, character: '<', after: '[!/?A-Za-z]'},\n  {\n    character: '<',\n    after: '[!/?A-Za-z]',\n    inConstruct: 'phrasing',\n    notInConstruct: fullPhrasingSpans\n  },\n  {character: '<', inConstruct: 'destinationLiteral'},\n  // An equals to can start setext heading underlines.\n  {atBreak: true, character: '='},\n  // A greater than can start block quotes and it can break out of a\n  // destination literal.\n  {atBreak: true, character: '>'},\n  {character: '>', inConstruct: 'destinationLiteral'},\n  // Question mark and at sign are not used in markdown for constructs.\n  // A left bracket can start definitions, references, labels,\n  {atBreak: true, character: '['},\n  {character: '[', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans},\n  {character: '[', inConstruct: ['label', 'reference']},\n  // A backslash can start an escape (when followed by punctuation) or a\n  // hard break (when followed by an eol).\n  // Note: typical escapes are handled in `safe`!\n  {character: '\\\\', after: '[\\\\r\\\\n]', inConstruct: 'phrasing'},\n  // A right bracket can exit labels.\n  {character: ']', inConstruct: ['label', 'reference']},\n  // Caret is not used in markdown for constructs.\n  // An underscore can start emphasis, strong, or a thematic break.\n  {atBreak: true, character: '_'},\n  {character: '_', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans},\n  // A grave accent can start code (fenced or text), or it can break out of\n  // a grave accent code fence.\n  {atBreak: true, character: '`'},\n  {\n    character: '`',\n    inConstruct: ['codeFencedLangGraveAccent', 'codeFencedMetaGraveAccent']\n  },\n  {character: '`', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans},\n  // Left brace, vertical bar, right brace are not used in markdown for\n  // constructs.\n  // A tilde can start code (fenced).\n  {atBreak: true, character: '~'}\n]\n","/**\n * @import {AssociationId} from '../types.js'\n */\n\nimport {decodeString} from 'micromark-util-decode-string'\n\n/**\n * Get an identifier from an association to match it to others.\n *\n * Associations are nodes that match to something else through an ID:\n * <https://github.com/syntax-tree/mdast#association>.\n *\n * The `label` of an association is the string value: character escapes and\n * references work, and casing is intact.\n * The `identifier` is used to match one association to another:\n * controversially, character escapes and references don’t work in this\n * matching: `&copy;` does not match `©`, and `\\+` does not match `+`.\n *\n * But casing is ignored (and whitespace) is trimmed and collapsed: ` A\\nb`\n * matches `a b`.\n * So, we do prefer the label when figuring out how we’re going to serialize:\n * it has whitespace, casing, and we can ignore most useless character\n * escapes and all character references.\n *\n * @type {AssociationId}\n */\nexport function association(node) {\n  if (node.label || !node.identifier) {\n    return node.label || ''\n  }\n\n  return decodeString(node.identifier)\n}\n","/**\n * @import {CompilePattern} from '../types.js'\n */\n\n/**\n * @type {CompilePattern}\n */\nexport function compilePattern(pattern) {\n  if (!pattern._compiled) {\n    const before =\n      (pattern.atBreak ? '[\\\\r\\\\n][\\\\t ]*' : '') +\n      (pattern.before ? '(?:' + pattern.before + ')' : '')\n\n    pattern._compiled = new RegExp(\n      (before ? '(' + before + ')' : '') +\n        (/[|\\\\{}()[\\]^$+*?.-]/.test(pattern.character) ? '\\\\' : '') +\n        pattern.character +\n        (pattern.after ? '(?:' + pattern.after + ')' : ''),\n      'g'\n    )\n  }\n\n  return pattern._compiled\n}\n","/**\n * @import {Handle, Info, State} from 'mdast-util-to-markdown'\n * @import {PhrasingParents} from '../types.js'\n */\n\nimport {encodeCharacterReference} from './encode-character-reference.js'\n\n/**\n * Serialize the children of a parent that contains phrasing children.\n *\n * These children will be joined flush together.\n *\n * @param {PhrasingParents} parent\n *   Parent of flow nodes.\n * @param {State} state\n *   Info passed around about the current state.\n * @param {Info} info\n *   Info on where we are in the document we are generating.\n * @returns {string}\n *   Serialized children, joined together.\n */\nexport function containerPhrasing(parent, state, info) {\n  const indexStack = state.indexStack\n  const children = parent.children || []\n  /** @type {Array<string>} */\n  const results = []\n  let index = -1\n  let before = info.before\n  /** @type {string | undefined} */\n  let encodeAfter\n\n  indexStack.push(-1)\n  let tracker = state.createTracker(info)\n\n  while (++index < children.length) {\n    const child = children[index]\n    /** @type {string} */\n    let after\n\n    indexStack[indexStack.length - 1] = index\n\n    if (index + 1 < children.length) {\n      /** @type {Handle} */\n      // @ts-expect-error: hush, it’s actually a `zwitch`.\n      let handle = state.handle.handlers[children[index + 1].type]\n      /** @type {Handle} */\n      // @ts-expect-error: hush, it’s actually a `zwitch`.\n      if (handle && handle.peek) handle = handle.peek\n      after = handle\n        ? handle(children[index + 1], parent, state, {\n            before: '',\n            after: '',\n            ...tracker.current()\n          }).charAt(0)\n        : ''\n    } else {\n      after = info.after\n    }\n\n    // In some cases, html (text) can be found in phrasing right after an eol.\n    // When we’d serialize that, in most cases that would be seen as html\n    // (flow).\n    // As we can’t escape or so to prevent it from happening, we take a somewhat\n    // reasonable approach: replace that eol with a space.\n    // See: <https://github.com/syntax-tree/mdast-util-to-markdown/issues/15>\n    if (\n      results.length > 0 &&\n      (before === '\\r' || before === '\\n') &&\n      child.type === 'html'\n    ) {\n      results[results.length - 1] = results[results.length - 1].replace(\n        /(\\r?\\n|\\r)$/,\n        ' '\n      )\n      before = ' '\n\n      // To do: does this work to reset tracker?\n      tracker = state.createTracker(info)\n      tracker.move(results.join(''))\n    }\n\n    let value = state.handle(child, parent, state, {\n      ...tracker.current(),\n      after,\n      before\n    })\n\n    // If we had to encode the first character after the previous node and it’s\n    // still the same character,\n    // encode it.\n    if (encodeAfter && encodeAfter === value.slice(0, 1)) {\n      value =\n        encodeCharacterReference(encodeAfter.charCodeAt(0)) + value.slice(1)\n    }\n\n    const encodingInfo = state.attentionEncodeSurroundingInfo\n    state.attentionEncodeSurroundingInfo = undefined\n    encodeAfter = undefined\n\n    // If we have to encode the first character before the current node and\n    // it’s still the same character,\n    // encode it.\n    if (encodingInfo) {\n      if (\n        results.length > 0 &&\n        encodingInfo.before &&\n        before === results[results.length - 1].slice(-1)\n      ) {\n        results[results.length - 1] =\n          results[results.length - 1].slice(0, -1) +\n          encodeCharacterReference(before.charCodeAt(0))\n      }\n\n      if (encodingInfo.after) encodeAfter = after\n    }\n\n    tracker.move(value)\n    results.push(value)\n    before = value.slice(-1)\n  }\n\n  indexStack.pop()\n\n  return results.join('')\n}\n","/**\n * @import {State} from 'mdast-util-to-markdown'\n * @import {FlowChildren, FlowParents, TrackFields} from '../types.js'\n */\n\n/**\n * @param {FlowParents} parent\n *   Parent of flow nodes.\n * @param {State} state\n *   Info passed around about the current state.\n * @param {TrackFields} info\n *   Info on where we are in the document we are generating.\n * @returns {string}\n *   Serialized children, joined by (blank) lines.\n */\nexport function containerFlow(parent, state, info) {\n  const indexStack = state.indexStack\n  const children = parent.children || []\n  const tracker = state.createTracker(info)\n  /** @type {Array<string>} */\n  const results = []\n  let index = -1\n\n  indexStack.push(-1)\n\n  while (++index < children.length) {\n    const child = children[index]\n\n    indexStack[indexStack.length - 1] = index\n\n    results.push(\n      tracker.move(\n        state.handle(child, parent, state, {\n          before: '\\n',\n          after: '\\n',\n          ...tracker.current()\n        })\n      )\n    )\n\n    if (child.type !== 'list') {\n      state.bulletLastUsed = undefined\n    }\n\n    if (index < children.length - 1) {\n      results.push(\n        tracker.move(between(child, children[index + 1], parent, state))\n      )\n    }\n  }\n\n  indexStack.pop()\n\n  return results.join('')\n}\n\n/**\n * @param {FlowChildren} left\n * @param {FlowChildren} right\n * @param {FlowParents} parent\n * @param {State} state\n * @returns {string}\n */\nfunction between(left, right, parent, state) {\n  let index = state.join.length\n\n  while (index--) {\n    const result = state.join[index](left, right, parent, state)\n\n    if (result === true || result === 1) {\n      break\n    }\n\n    if (typeof result === 'number') {\n      return '\\n'.repeat(1 + result)\n    }\n\n    if (result === false) {\n      return '\\n\\n<!---->\\n\\n'\n    }\n  }\n\n  return '\\n\\n'\n}\n","/**\n * @import {IndentLines} from '../types.js'\n */\n\nconst eol = /\\r?\\n|\\r/g\n\n/**\n * @type {IndentLines}\n */\nexport function indentLines(value, map) {\n  /** @type {Array<string>} */\n  const result = []\n  let start = 0\n  let line = 0\n  /** @type {RegExpExecArray | null} */\n  let match\n\n  while ((match = eol.exec(value))) {\n    one(value.slice(start, match.index))\n    result.push(match[0])\n    start = match.index + match[0].length\n    line++\n  }\n\n  one(value.slice(start))\n\n  return result.join('')\n\n  /**\n   * @param {string} value\n   */\n  function one(value) {\n    result.push(map(value, line, !value))\n  }\n}\n","/**\n * @import {SafeConfig, State} from 'mdast-util-to-markdown'\n */\n\nimport {encodeCharacterReference} from './encode-character-reference.js'\nimport {patternInScope} from './pattern-in-scope.js'\n\n/**\n * Make a string safe for embedding in markdown constructs.\n *\n * In markdown, almost all punctuation characters can, in certain cases,\n * result in something.\n * Whether they do is highly subjective to where they happen and in what\n * they happen.\n *\n * To solve this, `mdast-util-to-markdown` tracks:\n *\n * * Characters before and after something;\n * * What “constructs” we are in.\n *\n * This information is then used by this function to escape or encode\n * special characters.\n *\n * @param {State} state\n *   Info passed around about the current state.\n * @param {string | null | undefined} input\n *   Raw value to make safe.\n * @param {SafeConfig} config\n *   Configuration.\n * @returns {string}\n *   Serialized markdown safe for embedding.\n */\nexport function safe(state, input, config) {\n  const value = (config.before || '') + (input || '') + (config.after || '')\n  /** @type {Array<number>} */\n  const positions = []\n  /** @type {Array<string>} */\n  const result = []\n  /** @type {Record<number, {before: boolean, after: boolean}>} */\n  const infos = {}\n  let index = -1\n\n  while (++index < state.unsafe.length) {\n    const pattern = state.unsafe[index]\n\n    if (!patternInScope(state.stack, pattern)) {\n      continue\n    }\n\n    const expression = state.compilePattern(pattern)\n    /** @type {RegExpExecArray | null} */\n    let match\n\n    while ((match = expression.exec(value))) {\n      const before = 'before' in pattern || Boolean(pattern.atBreak)\n      const after = 'after' in pattern\n      const position = match.index + (before ? match[1].length : 0)\n\n      if (positions.includes(position)) {\n        if (infos[position].before && !before) {\n          infos[position].before = false\n        }\n\n        if (infos[position].after && !after) {\n          infos[position].after = false\n        }\n      } else {\n        positions.push(position)\n        infos[position] = {before, after}\n      }\n    }\n  }\n\n  positions.sort(numerical)\n\n  let start = config.before ? config.before.length : 0\n  const end = value.length - (config.after ? config.after.length : 0)\n  index = -1\n\n  while (++index < positions.length) {\n    const position = positions[index]\n\n    // Character before or after matched:\n    if (position < start || position >= end) {\n      continue\n    }\n\n    // If this character is supposed to be escaped because it has a condition on\n    // the next character, and the next character is definitly being escaped,\n    // then skip this escape.\n    if (\n      (position + 1 < end &&\n        positions[index + 1] === position + 1 &&\n        infos[position].after &&\n        !infos[position + 1].before &&\n        !infos[position + 1].after) ||\n      (positions[index - 1] === position - 1 &&\n        infos[position].before &&\n        !infos[position - 1].before &&\n        !infos[position - 1].after)\n    ) {\n      continue\n    }\n\n    if (start !== position) {\n      // If we have to use a character reference, an ampersand would be more\n      // correct, but as backslashes only care about punctuation, either will\n      // do the trick\n      result.push(escapeBackslashes(value.slice(start, position), '\\\\'))\n    }\n\n    start = position\n\n    if (\n      /[!-/:-@[-`{-~]/.test(value.charAt(position)) &&\n      (!config.encode || !config.encode.includes(value.charAt(position)))\n    ) {\n      // Character escape.\n      result.push('\\\\')\n    } else {\n      // Character reference.\n      result.push(encodeCharacterReference(value.charCodeAt(position)))\n      start++\n    }\n  }\n\n  result.push(escapeBackslashes(value.slice(start, end), config.after))\n\n  return result.join('')\n}\n\n/**\n * @param {number} a\n * @param {number} b\n * @returns {number}\n */\nfunction numerical(a, b) {\n  return a - b\n}\n\n/**\n * @param {string} value\n * @param {string} after\n * @returns {string}\n */\nfunction escapeBackslashes(value, after) {\n  const expression = /\\\\(?=[!-/:-@[-`{-~])/g\n  /** @type {Array<number>} */\n  const positions = []\n  /** @type {Array<string>} */\n  const results = []\n  const whole = value + after\n  let index = -1\n  let start = 0\n  /** @type {RegExpExecArray | null} */\n  let match\n\n  while ((match = expression.exec(whole))) {\n    positions.push(match.index)\n  }\n\n  while (++index < positions.length) {\n    if (start !== positions[index]) {\n      results.push(value.slice(start, positions[index]))\n    }\n\n    results.push('\\\\')\n    start = positions[index]\n  }\n\n  results.push(value.slice(start))\n\n  return results.join('')\n}\n","/**\n * @import {CreateTracker, TrackCurrent, TrackMove, TrackShift} from '../types.js'\n */\n\n/**\n * Track positional info in the output.\n *\n * @type {CreateTracker}\n */\nexport function track(config) {\n  // Defaults are used to prevent crashes when older utilities somehow activate\n  // this code.\n  /* c8 ignore next 5 */\n  const options = config || {}\n  const now = options.now || {}\n  let lineShift = options.lineShift || 0\n  let line = now.line || 1\n  let column = now.column || 1\n\n  return {move, current, shift}\n\n  /**\n   * Get the current tracked info.\n   *\n   * @type {TrackCurrent}\n   */\n  function current() {\n    return {now: {line, column}, lineShift}\n  }\n\n  /**\n   * Define an increased line shift (the typical indent for lines).\n   *\n   * @type {TrackShift}\n   */\n  function shift(value) {\n    lineShift += value\n  }\n\n  /**\n   * Move past some generated markdown.\n   *\n   * @type {TrackMove}\n   */\n  function move(input) {\n    // eslint-disable-next-line unicorn/prefer-default-parameters\n    const value = input || ''\n    const chunks = value.split(/\\r?\\n|\\r/g)\n    const tail = chunks[chunks.length - 1]\n    line += chunks.length - 1\n    column =\n      chunks.length === 1 ? column + tail.length : 1 + tail.length + lineShift\n    return value\n  }\n}\n","/**\n * @import {Info, Join, Options, SafeConfig, State} from 'mdast-util-to-markdown'\n * @import {Nodes} from 'mdast'\n * @import {Enter, FlowParents, PhrasingParents, TrackFields} from './types.js'\n */\n\nimport {zwitch} from 'zwitch'\nimport {configure} from './configure.js'\nimport {handle as handlers} from './handle/index.js'\nimport {join} from './join.js'\nimport {unsafe} from './unsafe.js'\nimport {association} from './util/association.js'\nimport {compilePattern} from './util/compile-pattern.js'\nimport {containerPhrasing} from './util/container-phrasing.js'\nimport {containerFlow} from './util/container-flow.js'\nimport {indentLines} from './util/indent-lines.js'\nimport {safe} from './util/safe.js'\nimport {track} from './util/track.js'\n\n/**\n * Turn an mdast syntax tree into markdown.\n *\n * @param {Nodes} tree\n *   Tree to serialize.\n * @param {Options | null | undefined} [options]\n *   Configuration (optional).\n * @returns {string}\n *   Serialized markdown representing `tree`.\n */\nexport function toMarkdown(tree, options) {\n  const settings = options || {}\n  /** @type {State} */\n  const state = {\n    associationId: association,\n    containerPhrasing: containerPhrasingBound,\n    containerFlow: containerFlowBound,\n    createTracker: track,\n    compilePattern,\n    enter,\n    // @ts-expect-error: GFM / frontmatter are typed in `mdast` but not defined\n    // here.\n    handlers: {...handlers},\n    // @ts-expect-error: add `handle` in a second.\n    handle: undefined,\n    indentLines,\n    indexStack: [],\n    join: [...join],\n    options: {},\n    safe: safeBound,\n    stack: [],\n    unsafe: [...unsafe]\n  }\n\n  configure(state, settings)\n\n  if (state.options.tightDefinitions) {\n    state.join.push(joinDefinition)\n  }\n\n  state.handle = zwitch('type', {\n    invalid,\n    unknown,\n    handlers: state.handlers\n  })\n\n  let result = state.handle(tree, undefined, state, {\n    before: '\\n',\n    after: '\\n',\n    now: {line: 1, column: 1},\n    lineShift: 0\n  })\n\n  if (\n    result &&\n    result.charCodeAt(result.length - 1) !== 10 &&\n    result.charCodeAt(result.length - 1) !== 13\n  ) {\n    result += '\\n'\n  }\n\n  return result\n\n  /** @type {Enter} */\n  function enter(name) {\n    state.stack.push(name)\n    return exit\n\n    /**\n     * @returns {undefined}\n     */\n    function exit() {\n      state.stack.pop()\n    }\n  }\n}\n\n/**\n * @param {unknown} value\n * @returns {never}\n */\nfunction invalid(value) {\n  throw new Error('Cannot handle value `' + value + '`, expected node')\n}\n\n/**\n * @param {unknown} value\n * @returns {never}\n */\nfunction unknown(value) {\n  // Always a node.\n  const node = /** @type {Nodes} */ (value)\n  throw new Error('Cannot handle unknown node `' + node.type + '`')\n}\n\n/** @type {Join} */\nfunction joinDefinition(left, right) {\n  // No blank line between adjacent definitions.\n  if (left.type === 'definition' && left.type === right.type) {\n    return 0\n  }\n}\n\n/**\n * Serialize the children of a parent that contains phrasing children.\n *\n * These children will be joined flush together.\n *\n * @this {State}\n *   Info passed around about the current state.\n * @param {PhrasingParents} parent\n *   Parent of flow nodes.\n * @param {Info} info\n *   Info on where we are in the document we are generating.\n * @returns {string}\n *   Serialized children, joined together.\n */\nfunction containerPhrasingBound(parent, info) {\n  return containerPhrasing(parent, this, info)\n}\n\n/**\n * Serialize the children of a parent that contains flow children.\n *\n * These children will typically be joined by blank lines.\n * What they are joined by exactly is defined by `Join` functions.\n *\n * @this {State}\n *   Info passed around about the current state.\n * @param {FlowParents} parent\n *   Parent of flow nodes.\n * @param {TrackFields} info\n *   Info on where we are in the document we are generating.\n * @returns {string}\n *   Serialized children, joined by (blank) lines.\n */\nfunction containerFlowBound(parent, info) {\n  return containerFlow(parent, this, info)\n}\n\n/**\n * Make a string safe for embedding in markdown constructs.\n *\n * In markdown, almost all punctuation characters can, in certain cases,\n * result in something.\n * Whether they do is highly subjective to where they happen and in what\n * they happen.\n *\n * To solve this, `mdast-util-to-markdown` tracks:\n *\n * * Characters before and after something;\n * * What “constructs” we are in.\n *\n * This information is then used by this function to escape or encode\n * special characters.\n *\n * @this {State}\n *   Info passed around about the current state.\n * @param {string | null | undefined} value\n *   Raw value to make safe.\n * @param {SafeConfig} config\n *   Configuration.\n * @returns {string}\n *   Serialized markdown safe for embedding.\n */\nfunction safeBound(value, config) {\n  return safe(this, value, config)\n}\n","/**\n * @typedef {import('mdast').Root} Root\n * @typedef {import('mdast-util-to-markdown').Options} ToMarkdownOptions\n * @typedef {import('unified').Compiler<Root, string>} Compiler\n * @typedef {import('unified').Processor<undefined, undefined, undefined, Root, string>} Processor\n */\n\n/**\n * @typedef {Omit<ToMarkdownOptions, 'extensions'>} Options\n */\n\nimport {toMarkdown} from 'mdast-util-to-markdown'\n\n/**\n * Add support for serializing to markdown.\n *\n * @param {Readonly<Options> | null | undefined} [options]\n *   Configuration (optional).\n * @returns {undefined}\n *   Nothing.\n */\nexport default function remarkStringify(options) {\n  /** @type {Processor} */\n  // @ts-expect-error: TS in JSDoc generates wrong types if `this` is typed regularly.\n  const self = this\n\n  self.compiler = compiler\n\n  /**\n   * @type {Compiler}\n   */\n  function compiler(tree) {\n    return toMarkdown(tree, {\n      ...self.data('settings'),\n      ...options,\n      // Note: this option is not in the readme.\n      // The goal is for it to be set by plugins on `data` instead of being\n      // passed by users.\n      extensions: self.data('toMarkdownExtensions') || []\n    })\n  }\n}\n","/**\n * Throw a given error.\n *\n * @param {Error|null|undefined} [error]\n *   Maybe error.\n * @returns {asserts error is null|undefined}\n */\nexport function bail(error) {\n  if (error) {\n    throw error\n  }\n}\n","'use strict';\n\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toStr = Object.prototype.toString;\nvar defineProperty = Object.defineProperty;\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nvar isArray = function isArray(arr) {\n\tif (typeof Array.isArray === 'function') {\n\t\treturn Array.isArray(arr);\n\t}\n\n\treturn toStr.call(arr) === '[object Array]';\n};\n\nvar isPlainObject = function isPlainObject(obj) {\n\tif (!obj || toStr.call(obj) !== '[object Object]') {\n\t\treturn false;\n\t}\n\n\tvar hasOwnConstructor = hasOwn.call(obj, 'constructor');\n\tvar hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');\n\t// Not own constructor property must be Object\n\tif (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n\t\treturn false;\n\t}\n\n\t// Own properties are enumerated firstly, so to speed up,\n\t// if last one is own, then all properties are own.\n\tvar key;\n\tfor (key in obj) { /**/ }\n\n\treturn typeof key === 'undefined' || hasOwn.call(obj, key);\n};\n\n// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target\nvar setProperty = function setProperty(target, options) {\n\tif (defineProperty && options.name === '__proto__') {\n\t\tdefineProperty(target, options.name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\tvalue: options.newValue,\n\t\t\twritable: true\n\t\t});\n\t} else {\n\t\ttarget[options.name] = options.newValue;\n\t}\n};\n\n// Return undefined instead of __proto__ if '__proto__' is not an own property\nvar getProperty = function getProperty(obj, name) {\n\tif (name === '__proto__') {\n\t\tif (!hasOwn.call(obj, name)) {\n\t\t\treturn void 0;\n\t\t} else if (gOPD) {\n\t\t\t// In early versions of node, obj['__proto__'] is buggy when obj has\n\t\t\t// __proto__ as an own property. Object.getOwnPropertyDescriptor() works.\n\t\t\treturn gOPD(obj, name).value;\n\t\t}\n\t}\n\n\treturn obj[name];\n};\n\nmodule.exports = function extend() {\n\tvar options, name, src, copy, copyIsArray, clone;\n\tvar target = arguments[0];\n\tvar i = 1;\n\tvar length = arguments.length;\n\tvar deep = false;\n\n\t// Handle a deep copy situation\n\tif (typeof target === 'boolean') {\n\t\tdeep = target;\n\t\ttarget = arguments[1] || {};\n\t\t// skip the boolean and the target\n\t\ti = 2;\n\t}\n\tif (target == null || (typeof target !== 'object' && typeof target !== 'function')) {\n\t\ttarget = {};\n\t}\n\n\tfor (; i < length; ++i) {\n\t\toptions = arguments[i];\n\t\t// Only deal with non-null/undefined values\n\t\tif (options != null) {\n\t\t\t// Extend the base object\n\t\t\tfor (name in options) {\n\t\t\t\tsrc = getProperty(target, name);\n\t\t\t\tcopy = getProperty(options, name);\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif (target !== copy) {\n\t\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\t\tif (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {\n\t\t\t\t\t\tif (copyIsArray) {\n\t\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\t\tclone = src && isArray(src) ? src : [];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tclone = src && isPlainObject(src) ? src : {};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: extend(deep, clone, copy) });\n\n\t\t\t\t\t// Don't bring in undefined values\n\t\t\t\t\t} else if (typeof copy !== 'undefined') {\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: copy });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n","export default function isPlainObject(value) {\n\tif (typeof value !== 'object' || value === null) {\n\t\treturn false;\n\t}\n\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);\n}\n","// To do: remove `void`s\n// To do: remove `null` from output of our APIs, allow it as user APIs.\n\n/**\n * @typedef {(error?: Error | null | undefined, ...output: Array<any>) => void} Callback\n *   Callback.\n *\n * @typedef {(...input: Array<any>) => any} Middleware\n *   Ware.\n *\n * @typedef Pipeline\n *   Pipeline.\n * @property {Run} run\n *   Run the pipeline.\n * @property {Use} use\n *   Add middleware.\n *\n * @typedef {(...input: Array<any>) => void} Run\n *   Call all middleware.\n *\n *   Calls `done` on completion with either an error or the output of the\n *   last middleware.\n *\n *   > 👉 **Note**: as the length of input defines whether async functions get a\n *   > `next` function,\n *   > it’s recommended to keep `input` at one value normally.\n\n *\n * @typedef {(fn: Middleware) => Pipeline} Use\n *   Add middleware.\n */\n\n/**\n * Create new middleware.\n *\n * @returns {Pipeline}\n *   Pipeline.\n */\nexport function trough() {\n  /** @type {Array<Middleware>} */\n  const fns = []\n  /** @type {Pipeline} */\n  const pipeline = {run, use}\n\n  return pipeline\n\n  /** @type {Run} */\n  function run(...values) {\n    let middlewareIndex = -1\n    /** @type {Callback} */\n    const callback = values.pop()\n\n    if (typeof callback !== 'function') {\n      throw new TypeError('Expected function as last argument, not ' + callback)\n    }\n\n    next(null, ...values)\n\n    /**\n     * Run the next `fn`, or we’re done.\n     *\n     * @param {Error | null | undefined} error\n     * @param {Array<any>} output\n     */\n    function next(error, ...output) {\n      const fn = fns[++middlewareIndex]\n      let index = -1\n\n      if (error) {\n        callback(error)\n        return\n      }\n\n      // Copy non-nullish input into values.\n      while (++index < values.length) {\n        if (output[index] === null || output[index] === undefined) {\n          output[index] = values[index]\n        }\n      }\n\n      // Save the newly created `output` for the next call.\n      values = output\n\n      // Next or done.\n      if (fn) {\n        wrap(fn, next)(...output)\n      } else {\n        callback(null, ...output)\n      }\n    }\n  }\n\n  /** @type {Use} */\n  function use(middelware) {\n    if (typeof middelware !== 'function') {\n      throw new TypeError(\n        'Expected `middelware` to be a function, not ' + middelware\n      )\n    }\n\n    fns.push(middelware)\n    return pipeline\n  }\n}\n\n/**\n * Wrap `middleware` into a uniform interface.\n *\n * You can pass all input to the resulting function.\n * `callback` is then called with the output of `middleware`.\n *\n * If `middleware` accepts more arguments than the later given in input,\n * an extra `done` function is passed to it after that input,\n * which must be called by `middleware`.\n *\n * The first value in `input` is the main input value.\n * All other input values are the rest input values.\n * The values given to `callback` are the input values,\n * merged with every non-nullish output value.\n *\n * * if `middleware` throws an error,\n *   returns a promise that is rejected,\n *   or calls the given `done` function with an error,\n *   `callback` is called with that error\n * * if `middleware` returns a value or returns a promise that is resolved,\n *   that value is the main output value\n * * if `middleware` calls `done`,\n *   all non-nullish values except for the first one (the error) overwrite the\n *   output values\n *\n * @param {Middleware} middleware\n *   Function to wrap.\n * @param {Callback} callback\n *   Callback called with the output of `middleware`.\n * @returns {Run}\n *   Wrapped middleware.\n */\nexport function wrap(middleware, callback) {\n  /** @type {boolean} */\n  let called\n\n  return wrapped\n\n  /**\n   * Call `middleware`.\n   * @this {any}\n   * @param {Array<any>} parameters\n   * @returns {void}\n   */\n  function wrapped(...parameters) {\n    const fnExpectsCallback = middleware.length > parameters.length\n    /** @type {any} */\n    let result\n\n    if (fnExpectsCallback) {\n      parameters.push(done)\n    }\n\n    try {\n      result = middleware.apply(this, parameters)\n    } catch (error) {\n      const exception = /** @type {Error} */ (error)\n\n      // Well, this is quite the pickle.\n      // `middleware` received a callback and called it synchronously, but that\n      // threw an error.\n      // The only thing left to do is to throw the thing instead.\n      if (fnExpectsCallback && called) {\n        throw exception\n      }\n\n      return done(exception)\n    }\n\n    if (!fnExpectsCallback) {\n      if (result && result.then && typeof result.then === 'function') {\n        result.then(then, done)\n      } else if (result instanceof Error) {\n        done(result)\n      } else {\n        then(result)\n      }\n    }\n  }\n\n  /**\n   * Call `callback`, only once.\n   *\n   * @type {Callback}\n   */\n  function done(error, ...output) {\n    if (!called) {\n      called = true\n      callback(error, ...output)\n    }\n  }\n\n  /**\n   * Call `done` with one value.\n   *\n   * @param {any} [value]\n   */\n  function then(value) {\n    done(null, value)\n  }\n}\n","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Point} Point\n * @typedef {import('unist').Position} Position\n */\n\n/**\n * @typedef {object & {type: string, position?: Position | undefined}} NodeLike\n *\n * @typedef Options\n *   Configuration.\n * @property {Array<Node> | null | undefined} [ancestors]\n *   Stack of (inclusive) ancestor nodes surrounding the message (optional).\n * @property {Error | null | undefined} [cause]\n *   Original error cause of the message (optional).\n * @property {Point | Position | null | undefined} [place]\n *   Place of message (optional).\n * @property {string | null | undefined} [ruleId]\n *   Category of message (optional, example: `'my-rule'`).\n * @property {string | null | undefined} [source]\n *   Namespace of who sent the message (optional, example: `'my-package'`).\n */\n\nimport {stringifyPosition} from 'unist-util-stringify-position'\n\n/**\n * Message.\n */\nexport class VFileMessage extends Error {\n  /**\n   * Create a message for `reason`.\n   *\n   * > 🪦 **Note**: also has obsolete signatures.\n   *\n   * @overload\n   * @param {string} reason\n   * @param {Options | null | undefined} [options]\n   * @returns\n   *\n   * @overload\n   * @param {string} reason\n   * @param {Node | NodeLike | null | undefined} parent\n   * @param {string | null | undefined} [origin]\n   * @returns\n   *\n   * @overload\n   * @param {string} reason\n   * @param {Point | Position | null | undefined} place\n   * @param {string | null | undefined} [origin]\n   * @returns\n   *\n   * @overload\n   * @param {string} reason\n   * @param {string | null | undefined} [origin]\n   * @returns\n   *\n   * @overload\n   * @param {Error | VFileMessage} cause\n   * @param {Node | NodeLike | null | undefined} parent\n   * @param {string | null | undefined} [origin]\n   * @returns\n   *\n   * @overload\n   * @param {Error | VFileMessage} cause\n   * @param {Point | Position | null | undefined} place\n   * @param {string | null | undefined} [origin]\n   * @returns\n   *\n   * @overload\n   * @param {Error | VFileMessage} cause\n   * @param {string | null | undefined} [origin]\n   * @returns\n   *\n   * @param {Error | VFileMessage | string} causeOrReason\n   *   Reason for message, should use markdown.\n   * @param {Node | NodeLike | Options | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n   *   Configuration (optional).\n   * @param {string | null | undefined} [origin]\n   *   Place in code where the message originates (example:\n   *   `'my-package:my-rule'` or `'my-rule'`).\n   * @returns\n   *   Instance of `VFileMessage`.\n   */\n  // eslint-disable-next-line complexity\n  constructor(causeOrReason, optionsOrParentOrPlace, origin) {\n    super()\n\n    if (typeof optionsOrParentOrPlace === 'string') {\n      origin = optionsOrParentOrPlace\n      optionsOrParentOrPlace = undefined\n    }\n\n    /** @type {string} */\n    let reason = ''\n    /** @type {Options} */\n    let options = {}\n    let legacyCause = false\n\n    if (optionsOrParentOrPlace) {\n      // Point.\n      if (\n        'line' in optionsOrParentOrPlace &&\n        'column' in optionsOrParentOrPlace\n      ) {\n        options = {place: optionsOrParentOrPlace}\n      }\n      // Position.\n      else if (\n        'start' in optionsOrParentOrPlace &&\n        'end' in optionsOrParentOrPlace\n      ) {\n        options = {place: optionsOrParentOrPlace}\n      }\n      // Node.\n      else if ('type' in optionsOrParentOrPlace) {\n        options = {\n          ancestors: [optionsOrParentOrPlace],\n          place: optionsOrParentOrPlace.position\n        }\n      }\n      // Options.\n      else {\n        options = {...optionsOrParentOrPlace}\n      }\n    }\n\n    if (typeof causeOrReason === 'string') {\n      reason = causeOrReason\n    }\n    // Error.\n    else if (!options.cause && causeOrReason) {\n      legacyCause = true\n      reason = causeOrReason.message\n      options.cause = causeOrReason\n    }\n\n    if (!options.ruleId && !options.source && typeof origin === 'string') {\n      const index = origin.indexOf(':')\n\n      if (index === -1) {\n        options.ruleId = origin\n      } else {\n        options.source = origin.slice(0, index)\n        options.ruleId = origin.slice(index + 1)\n      }\n    }\n\n    if (!options.place && options.ancestors && options.ancestors) {\n      const parent = options.ancestors[options.ancestors.length - 1]\n\n      if (parent) {\n        options.place = parent.position\n      }\n    }\n\n    const start =\n      options.place && 'start' in options.place\n        ? options.place.start\n        : options.place\n\n    /* eslint-disable no-unused-expressions */\n    /**\n     * Stack of ancestor nodes surrounding the message.\n     *\n     * @type {Array<Node> | undefined}\n     */\n    this.ancestors = options.ancestors || undefined\n\n    /**\n     * Original error cause of the message.\n     *\n     * @type {Error | undefined}\n     */\n    this.cause = options.cause || undefined\n\n    /**\n     * Starting column of message.\n     *\n     * @type {number | undefined}\n     */\n    this.column = start ? start.column : undefined\n\n    /**\n     * State of problem.\n     *\n     * * `true` — error, file not usable\n     * * `false` — warning, change may be needed\n     * * `undefined` — change likely not needed\n     *\n     * @type {boolean | null | undefined}\n     */\n    this.fatal = undefined\n\n    /**\n     * Path of a file (used throughout the `VFile` ecosystem).\n     *\n     * @type {string | undefined}\n     */\n    this.file\n\n    // Field from `Error`.\n    /**\n     * Reason for message.\n     *\n     * @type {string}\n     */\n    this.message = reason\n\n    /**\n     * Starting line of error.\n     *\n     * @type {number | undefined}\n     */\n    this.line = start ? start.line : undefined\n\n    // Field from `Error`.\n    /**\n     * Serialized positional info of message.\n     *\n     * On normal errors, this would be something like `ParseError`, buit in\n     * `VFile` messages we use this space to show where an error happened.\n     */\n    this.name = stringifyPosition(options.place) || '1:1'\n\n    /**\n     * Place of message.\n     *\n     * @type {Point | Position | undefined}\n     */\n    this.place = options.place || undefined\n\n    /**\n     * Reason for message, should use markdown.\n     *\n     * @type {string}\n     */\n    this.reason = this.message\n\n    /**\n     * Category of message (example: `'my-rule'`).\n     *\n     * @type {string | undefined}\n     */\n    this.ruleId = options.ruleId || undefined\n\n    /**\n     * Namespace of message (example: `'my-package'`).\n     *\n     * @type {string | undefined}\n     */\n    this.source = options.source || undefined\n\n    // Field from `Error`.\n    /**\n     * Stack of message.\n     *\n     * This is used by normal errors to show where something happened in\n     * programming code, irrelevant for `VFile` messages,\n     *\n     * @type {string}\n     */\n    this.stack =\n      legacyCause && options.cause && typeof options.cause.stack === 'string'\n        ? options.cause.stack\n        : ''\n\n    // The following fields are “well known”.\n    // Not standard.\n    // Feel free to add other non-standard fields to your messages.\n\n    /**\n     * Specify the source value that’s being reported, which is deemed\n     * incorrect.\n     *\n     * @type {string | undefined}\n     */\n    this.actual\n\n    /**\n     * Suggest acceptable values that can be used instead of `actual`.\n     *\n     * @type {Array<string> | undefined}\n     */\n    this.expected\n\n    /**\n     * Long form description of the message (you should use markdown).\n     *\n     * @type {string | undefined}\n     */\n    this.note\n\n    /**\n     * Link to docs for the message.\n     *\n     * > 👉 **Note**: this must be an absolute URL that can be passed as `x`\n     * > to `new URL(x)`.\n     *\n     * @type {string | undefined}\n     */\n    this.url\n    /* eslint-enable no-unused-expressions */\n  }\n}\n\nVFileMessage.prototype.file = ''\nVFileMessage.prototype.name = ''\nVFileMessage.prototype.reason = ''\nVFileMessage.prototype.message = ''\nVFileMessage.prototype.stack = ''\nVFileMessage.prototype.column = undefined\nVFileMessage.prototype.line = undefined\nVFileMessage.prototype.ancestors = undefined\nVFileMessage.prototype.cause = undefined\nVFileMessage.prototype.fatal = undefined\nVFileMessage.prototype.place = undefined\nVFileMessage.prototype.ruleId = undefined\nVFileMessage.prototype.source = undefined\n","// A derivative work based on:\n// <https://github.com/browserify/path-browserify>.\n// Which is licensed:\n//\n// MIT License\n//\n// Copyright (c) 2013 James Halliday\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy of\n// this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to\n// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n// the Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n// A derivative work based on:\n//\n// Parts of that are extracted from Node’s internal `path` module:\n// <https://github.com/nodejs/node/blob/master/lib/path.js>.\n// Which is licensed:\n//\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nexport const minpath = {basename, dirname, extname, join, sep: '/'}\n\n/* eslint-disable max-depth, complexity */\n\n/**\n * Get the basename from a path.\n *\n * @param {string} path\n *   File path.\n * @param {string | null | undefined} [extname]\n *   Extension to strip.\n * @returns {string}\n *   Stem or basename.\n */\nfunction basename(path, extname) {\n  if (extname !== undefined && typeof extname !== 'string') {\n    throw new TypeError('\"ext\" argument must be a string')\n  }\n\n  assertPath(path)\n  let start = 0\n  let end = -1\n  let index = path.length\n  /** @type {boolean | undefined} */\n  let seenNonSlash\n\n  if (\n    extname === undefined ||\n    extname.length === 0 ||\n    extname.length > path.length\n  ) {\n    while (index--) {\n      if (path.codePointAt(index) === 47 /* `/` */) {\n        // If we reached a path separator that was not part of a set of path\n        // separators at the end of the string, stop now.\n        if (seenNonSlash) {\n          start = index + 1\n          break\n        }\n      } else if (end < 0) {\n        // We saw the first non-path separator, mark this as the end of our\n        // path component.\n        seenNonSlash = true\n        end = index + 1\n      }\n    }\n\n    return end < 0 ? '' : path.slice(start, end)\n  }\n\n  if (extname === path) {\n    return ''\n  }\n\n  let firstNonSlashEnd = -1\n  let extnameIndex = extname.length - 1\n\n  while (index--) {\n    if (path.codePointAt(index) === 47 /* `/` */) {\n      // If we reached a path separator that was not part of a set of path\n      // separators at the end of the string, stop now.\n      if (seenNonSlash) {\n        start = index + 1\n        break\n      }\n    } else {\n      if (firstNonSlashEnd < 0) {\n        // We saw the first non-path separator, remember this index in case\n        // we need it if the extension ends up not matching.\n        seenNonSlash = true\n        firstNonSlashEnd = index + 1\n      }\n\n      if (extnameIndex > -1) {\n        // Try to match the explicit extension.\n        if (path.codePointAt(index) === extname.codePointAt(extnameIndex--)) {\n          if (extnameIndex < 0) {\n            // We matched the extension, so mark this as the end of our path\n            // component\n            end = index\n          }\n        } else {\n          // Extension does not match, so our result is the entire path\n          // component\n          extnameIndex = -1\n          end = firstNonSlashEnd\n        }\n      }\n    }\n  }\n\n  if (start === end) {\n    end = firstNonSlashEnd\n  } else if (end < 0) {\n    end = path.length\n  }\n\n  return path.slice(start, end)\n}\n\n/**\n * Get the dirname from a path.\n *\n * @param {string} path\n *   File path.\n * @returns {string}\n *   File path.\n */\nfunction dirname(path) {\n  assertPath(path)\n\n  if (path.length === 0) {\n    return '.'\n  }\n\n  let end = -1\n  let index = path.length\n  /** @type {boolean | undefined} */\n  let unmatchedSlash\n\n  // Prefix `--` is important to not run on `0`.\n  while (--index) {\n    if (path.codePointAt(index) === 47 /* `/` */) {\n      if (unmatchedSlash) {\n        end = index\n        break\n      }\n    } else if (!unmatchedSlash) {\n      // We saw the first non-path separator\n      unmatchedSlash = true\n    }\n  }\n\n  return end < 0\n    ? path.codePointAt(0) === 47 /* `/` */\n      ? '/'\n      : '.'\n    : end === 1 && path.codePointAt(0) === 47 /* `/` */\n      ? '//'\n      : path.slice(0, end)\n}\n\n/**\n * Get an extname from a path.\n *\n * @param {string} path\n *   File path.\n * @returns {string}\n *   Extname.\n */\nfunction extname(path) {\n  assertPath(path)\n\n  let index = path.length\n\n  let end = -1\n  let startPart = 0\n  let startDot = -1\n  // Track the state of characters (if any) we see before our first dot and\n  // after any path separator we find.\n  let preDotState = 0\n  /** @type {boolean | undefined} */\n  let unmatchedSlash\n\n  while (index--) {\n    const code = path.codePointAt(index)\n\n    if (code === 47 /* `/` */) {\n      // If we reached a path separator that was not part of a set of path\n      // separators at the end of the string, stop now.\n      if (unmatchedSlash) {\n        startPart = index + 1\n        break\n      }\n\n      continue\n    }\n\n    if (end < 0) {\n      // We saw the first non-path separator, mark this as the end of our\n      // extension.\n      unmatchedSlash = true\n      end = index + 1\n    }\n\n    if (code === 46 /* `.` */) {\n      // If this is our first dot, mark it as the start of our extension.\n      if (startDot < 0) {\n        startDot = index\n      } else if (preDotState !== 1) {\n        preDotState = 1\n      }\n    } else if (startDot > -1) {\n      // We saw a non-dot and non-path separator before our dot, so we should\n      // have a good chance at having a non-empty extension.\n      preDotState = -1\n    }\n  }\n\n  if (\n    startDot < 0 ||\n    end < 0 ||\n    // We saw a non-dot character immediately before the dot.\n    preDotState === 0 ||\n    // The (right-most) trimmed path component is exactly `..`.\n    (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)\n  ) {\n    return ''\n  }\n\n  return path.slice(startDot, end)\n}\n\n/**\n * Join segments from a path.\n *\n * @param {Array<string>} segments\n *   Path segments.\n * @returns {string}\n *   File path.\n */\nfunction join(...segments) {\n  let index = -1\n  /** @type {string | undefined} */\n  let joined\n\n  while (++index < segments.length) {\n    assertPath(segments[index])\n\n    if (segments[index]) {\n      joined =\n        joined === undefined ? segments[index] : joined + '/' + segments[index]\n    }\n  }\n\n  return joined === undefined ? '.' : normalize(joined)\n}\n\n/**\n * Normalize a basic file path.\n *\n * @param {string} path\n *   File path.\n * @returns {string}\n *   File path.\n */\n// Note: `normalize` is not exposed as `path.normalize`, so some code is\n// manually removed from it.\nfunction normalize(path) {\n  assertPath(path)\n\n  const absolute = path.codePointAt(0) === 47 /* `/` */\n\n  // Normalize the path according to POSIX rules.\n  let value = normalizeString(path, !absolute)\n\n  if (value.length === 0 && !absolute) {\n    value = '.'\n  }\n\n  if (value.length > 0 && path.codePointAt(path.length - 1) === 47 /* / */) {\n    value += '/'\n  }\n\n  return absolute ? '/' + value : value\n}\n\n/**\n * Resolve `.` and `..` elements in a path with directory names.\n *\n * @param {string} path\n *   File path.\n * @param {boolean} allowAboveRoot\n *   Whether `..` can move above root.\n * @returns {string}\n *   File path.\n */\nfunction normalizeString(path, allowAboveRoot) {\n  let result = ''\n  let lastSegmentLength = 0\n  let lastSlash = -1\n  let dots = 0\n  let index = -1\n  /** @type {number | undefined} */\n  let code\n  /** @type {number} */\n  let lastSlashIndex\n\n  while (++index <= path.length) {\n    if (index < path.length) {\n      code = path.codePointAt(index)\n    } else if (code === 47 /* `/` */) {\n      break\n    } else {\n      code = 47 /* `/` */\n    }\n\n    if (code === 47 /* `/` */) {\n      if (lastSlash === index - 1 || dots === 1) {\n        // Empty.\n      } else if (lastSlash !== index - 1 && dots === 2) {\n        if (\n          result.length < 2 ||\n          lastSegmentLength !== 2 ||\n          result.codePointAt(result.length - 1) !== 46 /* `.` */ ||\n          result.codePointAt(result.length - 2) !== 46 /* `.` */\n        ) {\n          if (result.length > 2) {\n            lastSlashIndex = result.lastIndexOf('/')\n\n            if (lastSlashIndex !== result.length - 1) {\n              if (lastSlashIndex < 0) {\n                result = ''\n                lastSegmentLength = 0\n              } else {\n                result = result.slice(0, lastSlashIndex)\n                lastSegmentLength = result.length - 1 - result.lastIndexOf('/')\n              }\n\n              lastSlash = index\n              dots = 0\n              continue\n            }\n          } else if (result.length > 0) {\n            result = ''\n            lastSegmentLength = 0\n            lastSlash = index\n            dots = 0\n            continue\n          }\n        }\n\n        if (allowAboveRoot) {\n          result = result.length > 0 ? result + '/..' : '..'\n          lastSegmentLength = 2\n        }\n      } else {\n        if (result.length > 0) {\n          result += '/' + path.slice(lastSlash + 1, index)\n        } else {\n          result = path.slice(lastSlash + 1, index)\n        }\n\n        lastSegmentLength = index - lastSlash - 1\n      }\n\n      lastSlash = index\n      dots = 0\n    } else if (code === 46 /* `.` */ && dots > -1) {\n      dots++\n    } else {\n      dots = -1\n    }\n  }\n\n  return result\n}\n\n/**\n * Make sure `path` is a string.\n *\n * @param {string} path\n *   File path.\n * @returns {asserts path is string}\n *   Nothing.\n */\nfunction assertPath(path) {\n  if (typeof path !== 'string') {\n    throw new TypeError(\n      'Path must be a string. Received ' + JSON.stringify(path)\n    )\n  }\n}\n\n/* eslint-enable max-depth, complexity */\n","// Somewhat based on:\n// <https://github.com/defunctzombie/node-process/blob/master/browser.js>.\n// But I don’t think one tiny line of code can be copyrighted. 😅\nexport const minproc = {cwd}\n\nfunction cwd() {\n  return '/'\n}\n","/**\n * Checks if a value has the shape of a WHATWG URL object.\n *\n * Using a symbol or instanceof would not be able to recognize URL objects\n * coming from other implementations (e.g. in Electron), so instead we are\n * checking some well known properties for a lack of a better test.\n *\n * We use `href` and `protocol` as they are the only properties that are\n * easy to retrieve and calculate due to the lazy nature of the getters.\n *\n * We check for auth attribute to distinguish legacy url instance with\n * WHATWG URL instance.\n *\n * @param {unknown} fileUrlOrPath\n *   File path or URL.\n * @returns {fileUrlOrPath is URL}\n *   Whether it’s a URL.\n */\n// From: <https://github.com/nodejs/node/blob/6a3403c/lib/internal/url.js#L720>\nexport function isUrl(fileUrlOrPath) {\n  return Boolean(\n    fileUrlOrPath !== null &&\n      typeof fileUrlOrPath === 'object' &&\n      'href' in fileUrlOrPath &&\n      fileUrlOrPath.href &&\n      'protocol' in fileUrlOrPath &&\n      fileUrlOrPath.protocol &&\n      // @ts-expect-error: indexing is fine.\n      fileUrlOrPath.auth === undefined\n  )\n}\n","import {isUrl} from './minurl.shared.js'\n\nexport {isUrl} from './minurl.shared.js'\n\n// See: <https://github.com/nodejs/node/blob/6a3403c/lib/internal/url.js>\n\n/**\n * @param {URL | string} path\n *   File URL.\n * @returns {string}\n *   File URL.\n */\nexport function urlToPath(path) {\n  if (typeof path === 'string') {\n    path = new URL(path)\n  } else if (!isUrl(path)) {\n    /** @type {NodeJS.ErrnoException} */\n    const error = new TypeError(\n      'The \"path\" argument must be of type string or an instance of URL. Received `' +\n        path +\n        '`'\n    )\n    error.code = 'ERR_INVALID_ARG_TYPE'\n    throw error\n  }\n\n  if (path.protocol !== 'file:') {\n    /** @type {NodeJS.ErrnoException} */\n    const error = new TypeError('The URL must be of scheme file')\n    error.code = 'ERR_INVALID_URL_SCHEME'\n    throw error\n  }\n\n  return getPathFromURLPosix(path)\n}\n\n/**\n * Get a path from a POSIX URL.\n *\n * @param {URL} url\n *   URL.\n * @returns {string}\n *   File path.\n */\nfunction getPathFromURLPosix(url) {\n  if (url.hostname !== '') {\n    /** @type {NodeJS.ErrnoException} */\n    const error = new TypeError(\n      'File URL host must be \"localhost\" or empty on darwin'\n    )\n    error.code = 'ERR_INVALID_FILE_URL_HOST'\n    throw error\n  }\n\n  const pathname = url.pathname\n  let index = -1\n\n  while (++index < pathname.length) {\n    if (\n      pathname.codePointAt(index) === 37 /* `%` */ &&\n      pathname.codePointAt(index + 1) === 50 /* `2` */\n    ) {\n      const third = pathname.codePointAt(index + 2)\n      if (third === 70 /* `F` */ || third === 102 /* `f` */) {\n        /** @type {NodeJS.ErrnoException} */\n        const error = new TypeError(\n          'File URL path must not include encoded / characters'\n        )\n        error.code = 'ERR_INVALID_FILE_URL_PATH'\n        throw error\n      }\n    }\n  }\n\n  return decodeURIComponent(pathname)\n}\n","/**\n * @import {Node, Point, Position} from 'unist'\n * @import {Options as MessageOptions} from 'vfile-message'\n * @import {Compatible, Data, Map, Options, Value} from 'vfile'\n */\n\n/**\n * @typedef {object & {type: string, position?: Position | undefined}} NodeLike\n */\n\nimport {VFileMessage} from 'vfile-message'\nimport {minpath} from '#minpath'\nimport {minproc} from '#minproc'\nimport {urlToPath, isUrl} from '#minurl'\n\n/**\n * Order of setting (least specific to most), we need this because otherwise\n * `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a\n * stem can be set.\n */\nconst order = /** @type {const} */ ([\n  'history',\n  'path',\n  'basename',\n  'stem',\n  'extname',\n  'dirname'\n])\n\nexport class VFile {\n  /**\n   * Create a new virtual file.\n   *\n   * `options` is treated as:\n   *\n   * *   `string` or `Uint8Array` — `{value: options}`\n   * *   `URL` — `{path: options}`\n   * *   `VFile` — shallow copies its data over to the new file\n   * *   `object` — all fields are shallow copied over to the new file\n   *\n   * Path related fields are set in the following order (least specific to\n   * most specific): `history`, `path`, `basename`, `stem`, `extname`,\n   * `dirname`.\n   *\n   * You cannot set `dirname` or `extname` without setting either `history`,\n   * `path`, `basename`, or `stem` too.\n   *\n   * @param {Compatible | null | undefined} [value]\n   *   File value.\n   * @returns\n   *   New instance.\n   */\n  constructor(value) {\n    /** @type {Options | VFile} */\n    let options\n\n    if (!value) {\n      options = {}\n    } else if (isUrl(value)) {\n      options = {path: value}\n    } else if (typeof value === 'string' || isUint8Array(value)) {\n      options = {value}\n    } else {\n      options = value\n    }\n\n    /* eslint-disable no-unused-expressions */\n\n    /**\n     * Base of `path` (default: `process.cwd()` or `'/'` in browsers).\n     *\n     * @type {string}\n     */\n    // Prevent calling `cwd` (which could be expensive) if it’s not needed;\n    // the empty string will be overridden in the next block.\n    this.cwd = 'cwd' in options ? '' : minproc.cwd()\n\n    /**\n     * Place to store custom info (default: `{}`).\n     *\n     * It’s OK to store custom data directly on the file but moving it to\n     * `data` is recommended.\n     *\n     * @type {Data}\n     */\n    this.data = {}\n\n    /**\n     * List of file paths the file moved between.\n     *\n     * The first is the original path and the last is the current path.\n     *\n     * @type {Array<string>}\n     */\n    this.history = []\n\n    /**\n     * List of messages associated with the file.\n     *\n     * @type {Array<VFileMessage>}\n     */\n    this.messages = []\n\n    /**\n     * Raw value.\n     *\n     * @type {Value}\n     */\n    this.value\n\n    // The below are non-standard, they are “well-known”.\n    // As in, used in several tools.\n    /**\n     * Source map.\n     *\n     * This type is equivalent to the `RawSourceMap` type from the `source-map`\n     * module.\n     *\n     * @type {Map | null | undefined}\n     */\n    this.map\n\n    /**\n     * Custom, non-string, compiled, representation.\n     *\n     * This is used by unified to store non-string results.\n     * One example is when turning markdown into React nodes.\n     *\n     * @type {unknown}\n     */\n    this.result\n\n    /**\n     * Whether a file was saved to disk.\n     *\n     * This is used by vfile reporters.\n     *\n     * @type {boolean}\n     */\n    this.stored\n    /* eslint-enable no-unused-expressions */\n\n    // Set path related properties in the correct order.\n    let index = -1\n\n    while (++index < order.length) {\n      const field = order[index]\n\n      // Note: we specifically use `in` instead of `hasOwnProperty` to accept\n      // `vfile`s too.\n      if (\n        field in options &&\n        options[field] !== undefined &&\n        options[field] !== null\n      ) {\n        // @ts-expect-error: TS doesn’t understand basic reality.\n        this[field] = field === 'history' ? [...options[field]] : options[field]\n      }\n    }\n\n    /** @type {string} */\n    let field\n\n    // Set non-path related properties.\n    for (field in options) {\n      // @ts-expect-error: fine to set other things.\n      if (!order.includes(field)) {\n        // @ts-expect-error: fine to set other things.\n        this[field] = options[field]\n      }\n    }\n  }\n\n  /**\n   * Get the basename (including extname) (example: `'index.min.js'`).\n   *\n   * @returns {string | undefined}\n   *   Basename.\n   */\n  get basename() {\n    return typeof this.path === 'string'\n      ? minpath.basename(this.path)\n      : undefined\n  }\n\n  /**\n   * Set basename (including extname) (`'index.min.js'`).\n   *\n   * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n   * on windows).\n   * Cannot be nullified (use `file.path = file.dirname` instead).\n   *\n   * @param {string} basename\n   *   Basename.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  set basename(basename) {\n    assertNonEmpty(basename, 'basename')\n    assertPart(basename, 'basename')\n    this.path = minpath.join(this.dirname || '', basename)\n  }\n\n  /**\n   * Get the parent path (example: `'~'`).\n   *\n   * @returns {string | undefined}\n   *   Dirname.\n   */\n  get dirname() {\n    return typeof this.path === 'string'\n      ? minpath.dirname(this.path)\n      : undefined\n  }\n\n  /**\n   * Set the parent path (example: `'~'`).\n   *\n   * Cannot be set if there’s no `path` yet.\n   *\n   * @param {string | undefined} dirname\n   *   Dirname.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  set dirname(dirname) {\n    assertPath(this.basename, 'dirname')\n    this.path = minpath.join(dirname || '', this.basename)\n  }\n\n  /**\n   * Get the extname (including dot) (example: `'.js'`).\n   *\n   * @returns {string | undefined}\n   *   Extname.\n   */\n  get extname() {\n    return typeof this.path === 'string'\n      ? minpath.extname(this.path)\n      : undefined\n  }\n\n  /**\n   * Set the extname (including dot) (example: `'.js'`).\n   *\n   * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n   * on windows).\n   * Cannot be set if there’s no `path` yet.\n   *\n   * @param {string | undefined} extname\n   *   Extname.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  set extname(extname) {\n    assertPart(extname, 'extname')\n    assertPath(this.dirname, 'extname')\n\n    if (extname) {\n      if (extname.codePointAt(0) !== 46 /* `.` */) {\n        throw new Error('`extname` must start with `.`')\n      }\n\n      if (extname.includes('.', 1)) {\n        throw new Error('`extname` cannot contain multiple dots')\n      }\n    }\n\n    this.path = minpath.join(this.dirname, this.stem + (extname || ''))\n  }\n\n  /**\n   * Get the full path (example: `'~/index.min.js'`).\n   *\n   * @returns {string}\n   *   Path.\n   */\n  get path() {\n    return this.history[this.history.length - 1]\n  }\n\n  /**\n   * Set the full path (example: `'~/index.min.js'`).\n   *\n   * Cannot be nullified.\n   * You can set a file URL (a `URL` object with a `file:` protocol) which will\n   * be turned into a path with `url.fileURLToPath`.\n   *\n   * @param {URL | string} path\n   *   Path.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  set path(path) {\n    if (isUrl(path)) {\n      path = urlToPath(path)\n    }\n\n    assertNonEmpty(path, 'path')\n\n    if (this.path !== path) {\n      this.history.push(path)\n    }\n  }\n\n  /**\n   * Get the stem (basename w/o extname) (example: `'index.min'`).\n   *\n   * @returns {string | undefined}\n   *   Stem.\n   */\n  get stem() {\n    return typeof this.path === 'string'\n      ? minpath.basename(this.path, this.extname)\n      : undefined\n  }\n\n  /**\n   * Set the stem (basename w/o extname) (example: `'index.min'`).\n   *\n   * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n   * on windows).\n   * Cannot be nullified (use `file.path = file.dirname` instead).\n   *\n   * @param {string} stem\n   *   Stem.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  set stem(stem) {\n    assertNonEmpty(stem, 'stem')\n    assertPart(stem, 'stem')\n    this.path = minpath.join(this.dirname || '', stem + (this.extname || ''))\n  }\n\n  // Normal prototypal methods.\n  /**\n   * Create a fatal message for `reason` associated with the file.\n   *\n   * The `fatal` field of the message is set to `true` (error; file not usable)\n   * and the `file` field is set to the current file path.\n   * The message is added to the `messages` field on `file`.\n   *\n   * > 🪦 **Note**: also has obsolete signatures.\n   *\n   * @overload\n   * @param {string} reason\n   * @param {MessageOptions | null | undefined} [options]\n   * @returns {never}\n   *\n   * @overload\n   * @param {string} reason\n   * @param {Node | NodeLike | null | undefined} parent\n   * @param {string | null | undefined} [origin]\n   * @returns {never}\n   *\n   * @overload\n   * @param {string} reason\n   * @param {Point | Position | null | undefined} place\n   * @param {string | null | undefined} [origin]\n   * @returns {never}\n   *\n   * @overload\n   * @param {string} reason\n   * @param {string | null | undefined} [origin]\n   * @returns {never}\n   *\n   * @overload\n   * @param {Error | VFileMessage} cause\n   * @param {Node | NodeLike | null | undefined} parent\n   * @param {string | null | undefined} [origin]\n   * @returns {never}\n   *\n   * @overload\n   * @param {Error | VFileMessage} cause\n   * @param {Point | Position | null | undefined} place\n   * @param {string | null | undefined} [origin]\n   * @returns {never}\n   *\n   * @overload\n   * @param {Error | VFileMessage} cause\n   * @param {string | null | undefined} [origin]\n   * @returns {never}\n   *\n   * @param {Error | VFileMessage | string} causeOrReason\n   *   Reason for message, should use markdown.\n   * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n   *   Configuration (optional).\n   * @param {string | null | undefined} [origin]\n   *   Place in code where the message originates (example:\n   *   `'my-package:my-rule'` or `'my-rule'`).\n   * @returns {never}\n   *   Never.\n   * @throws {VFileMessage}\n   *   Message.\n   */\n  fail(causeOrReason, optionsOrParentOrPlace, origin) {\n    // @ts-expect-error: the overloads are fine.\n    const message = this.message(causeOrReason, optionsOrParentOrPlace, origin)\n\n    message.fatal = true\n\n    throw message\n  }\n\n  /**\n   * Create an info message for `reason` associated with the file.\n   *\n   * The `fatal` field of the message is set to `undefined` (info; change\n   * likely not needed) and the `file` field is set to the current file path.\n   * The message is added to the `messages` field on `file`.\n   *\n   * > 🪦 **Note**: also has obsolete signatures.\n   *\n   * @overload\n   * @param {string} reason\n   * @param {MessageOptions | null | undefined} [options]\n   * @returns {VFileMessage}\n   *\n   * @overload\n   * @param {string} reason\n   * @param {Node | NodeLike | null | undefined} parent\n   * @param {string | null | undefined} [origin]\n   * @returns {VFileMessage}\n   *\n   * @overload\n   * @param {string} reason\n   * @param {Point | Position | null | undefined} place\n   * @param {string | null | undefined} [origin]\n   * @returns {VFileMessage}\n   *\n   * @overload\n   * @param {string} reason\n   * @param {string | null | undefined} [origin]\n   * @returns {VFileMessage}\n   *\n   * @overload\n   * @param {Error | VFileMessage} cause\n   * @param {Node | NodeLike | null | undefined} parent\n   * @param {string | null | undefined} [origin]\n   * @returns {VFileMessage}\n   *\n   * @overload\n   * @param {Error | VFileMessage} cause\n   * @param {Point | Position | null | undefined} place\n   * @param {string | null | undefined} [origin]\n   * @returns {VFileMessage}\n   *\n   * @overload\n   * @param {Error | VFileMessage} cause\n   * @param {string | null | undefined} [origin]\n   * @returns {VFileMessage}\n   *\n   * @param {Error | VFileMessage | string} causeOrReason\n   *   Reason for message, should use markdown.\n   * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n   *   Configuration (optional).\n   * @param {string | null | undefined} [origin]\n   *   Place in code where the message originates (example:\n   *   `'my-package:my-rule'` or `'my-rule'`).\n   * @returns {VFileMessage}\n   *   Message.\n   */\n  info(causeOrReason, optionsOrParentOrPlace, origin) {\n    // @ts-expect-error: the overloads are fine.\n    const message = this.message(causeOrReason, optionsOrParentOrPlace, origin)\n\n    message.fatal = undefined\n\n    return message\n  }\n\n  /**\n   * Create a message for `reason` associated with the file.\n   *\n   * The `fatal` field of the message is set to `false` (warning; change may be\n   * needed) and the `file` field is set to the current file path.\n   * The message is added to the `messages` field on `file`.\n   *\n   * > 🪦 **Note**: also has obsolete signatures.\n   *\n   * @overload\n   * @param {string} reason\n   * @param {MessageOptions | null | undefined} [options]\n   * @returns {VFileMessage}\n   *\n   * @overload\n   * @param {string} reason\n   * @param {Node | NodeLike | null | undefined} parent\n   * @param {string | null | undefined} [origin]\n   * @returns {VFileMessage}\n   *\n   * @overload\n   * @param {string} reason\n   * @param {Point | Position | null | undefined} place\n   * @param {string | null | undefined} [origin]\n   * @returns {VFileMessage}\n   *\n   * @overload\n   * @param {string} reason\n   * @param {string | null | undefined} [origin]\n   * @returns {VFileMessage}\n   *\n   * @overload\n   * @param {Error | VFileMessage} cause\n   * @param {Node | NodeLike | null | undefined} parent\n   * @param {string | null | undefined} [origin]\n   * @returns {VFileMessage}\n   *\n   * @overload\n   * @param {Error | VFileMessage} cause\n   * @param {Point | Position | null | undefined} place\n   * @param {string | null | undefined} [origin]\n   * @returns {VFileMessage}\n   *\n   * @overload\n   * @param {Error | VFileMessage} cause\n   * @param {string | null | undefined} [origin]\n   * @returns {VFileMessage}\n   *\n   * @param {Error | VFileMessage | string} causeOrReason\n   *   Reason for message, should use markdown.\n   * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n   *   Configuration (optional).\n   * @param {string | null | undefined} [origin]\n   *   Place in code where the message originates (example:\n   *   `'my-package:my-rule'` or `'my-rule'`).\n   * @returns {VFileMessage}\n   *   Message.\n   */\n  message(causeOrReason, optionsOrParentOrPlace, origin) {\n    const message = new VFileMessage(\n      // @ts-expect-error: the overloads are fine.\n      causeOrReason,\n      optionsOrParentOrPlace,\n      origin\n    )\n\n    if (this.path) {\n      message.name = this.path + ':' + message.name\n      message.file = this.path\n    }\n\n    message.fatal = false\n\n    this.messages.push(message)\n\n    return message\n  }\n\n  /**\n   * Serialize the file.\n   *\n   * > **Note**: which encodings are supported depends on the engine.\n   * > For info on Node.js, see:\n   * > <https://nodejs.org/api/util.html#whatwg-supported-encodings>.\n   *\n   * @param {string | null | undefined} [encoding='utf8']\n   *   Character encoding to understand `value` as when it’s a `Uint8Array`\n   *   (default: `'utf-8'`).\n   * @returns {string}\n   *   Serialized file.\n   */\n  toString(encoding) {\n    if (this.value === undefined) {\n      return ''\n    }\n\n    if (typeof this.value === 'string') {\n      return this.value\n    }\n\n    const decoder = new TextDecoder(encoding || undefined)\n    return decoder.decode(this.value)\n  }\n}\n\n/**\n * Assert that `part` is not a path (as in, does not contain `path.sep`).\n *\n * @param {string | null | undefined} part\n *   File path part.\n * @param {string} name\n *   Part name.\n * @returns {undefined}\n *   Nothing.\n */\nfunction assertPart(part, name) {\n  if (part && part.includes(minpath.sep)) {\n    throw new Error(\n      '`' + name + '` cannot be a path: did not expect `' + minpath.sep + '`'\n    )\n  }\n}\n\n/**\n * Assert that `part` is not empty.\n *\n * @param {string | undefined} part\n *   Thing.\n * @param {string} name\n *   Part name.\n * @returns {asserts part is string}\n *   Nothing.\n */\nfunction assertNonEmpty(part, name) {\n  if (!part) {\n    throw new Error('`' + name + '` cannot be empty')\n  }\n}\n\n/**\n * Assert `path` exists.\n *\n * @param {string | undefined} path\n *   Path.\n * @param {string} name\n *   Dependency name.\n * @returns {asserts path is string}\n *   Nothing.\n */\nfunction assertPath(path, name) {\n  if (!path) {\n    throw new Error('Setting `' + name + '` requires `path` to be set too')\n  }\n}\n\n/**\n * Assert `value` is an `Uint8Array`.\n *\n * @param {unknown} value\n *   thing.\n * @returns {value is Uint8Array}\n *   Whether `value` is an `Uint8Array`.\n */\nfunction isUint8Array(value) {\n  return Boolean(\n    value &&\n      typeof value === 'object' &&\n      'byteLength' in value &&\n      'byteOffset' in value\n  )\n}\n","export const CallableInstance =\n  /**\n   * @type {new <Parameters extends Array<unknown>, Result>(property: string | symbol) => (...parameters: Parameters) => Result}\n   */\n  (\n    /** @type {unknown} */\n    (\n      /**\n       * @this {Function}\n       * @param {string | symbol} property\n       * @returns {(...parameters: Array<unknown>) => unknown}\n       */\n      function (property) {\n        const self = this\n        const constr = self.constructor\n        const proto = /** @type {Record<string | symbol, Function>} */ (\n          // Prototypes do exist.\n          // type-coverage:ignore-next-line\n          constr.prototype\n        )\n        const value = proto[property]\n        /** @type {(...parameters: Array<unknown>) => unknown} */\n        const apply = function () {\n          return value.apply(apply, arguments)\n        }\n\n        Object.setPrototypeOf(apply, proto)\n\n        // Not needed for us in `unified`: we only call this on the `copy`\n        // function,\n        // and we don't need to add its fields (`length`, `name`)\n        // over.\n        // See also: GH-246.\n        // const names = Object.getOwnPropertyNames(value)\n        //\n        // for (const p of names) {\n        //   const descriptor = Object.getOwnPropertyDescriptor(value, p)\n        //   if (descriptor) Object.defineProperty(apply, p, descriptor)\n        // }\n\n        return apply\n      }\n    )\n  )\n","/**\n * @typedef {import('trough').Pipeline} Pipeline\n *\n * @typedef {import('unist').Node} Node\n *\n * @typedef {import('vfile').Compatible} Compatible\n * @typedef {import('vfile').Value} Value\n *\n * @typedef {import('../index.js').CompileResultMap} CompileResultMap\n * @typedef {import('../index.js').Data} Data\n * @typedef {import('../index.js').Settings} Settings\n */\n\n/**\n * @typedef {CompileResultMap[keyof CompileResultMap]} CompileResults\n *   Acceptable results from compilers.\n *\n *   To register custom results, add them to\n *   {@linkcode CompileResultMap}.\n */\n\n/**\n * @template {Node} [Tree=Node]\n *   The node that the compiler receives (default: `Node`).\n * @template {CompileResults} [Result=CompileResults]\n *   The thing that the compiler yields (default: `CompileResults`).\n * @callback Compiler\n *   A **compiler** handles the compiling of a syntax tree to something else\n *   (in most cases, text) (TypeScript type).\n *\n *   It is used in the stringify phase and called with a {@linkcode Node}\n *   and {@linkcode VFile} representation of the document to compile.\n *   It should return the textual representation of the given tree (typically\n *   `string`).\n *\n *   > **Note**: unified typically compiles by serializing: most compilers\n *   > return `string` (or `Uint8Array`).\n *   > Some compilers, such as the one configured with\n *   > [`rehype-react`][rehype-react], return other values (in this case, a\n *   > React tree).\n *   > If you’re using a compiler that doesn’t serialize, expect different\n *   > result values.\n *   >\n *   > To register custom results in TypeScript, add them to\n *   > {@linkcode CompileResultMap}.\n *\n *   [rehype-react]: https://github.com/rehypejs/rehype-react\n * @param {Tree} tree\n *   Tree to compile.\n * @param {VFile} file\n *   File associated with `tree`.\n * @returns {Result}\n *   New content: compiled text (`string` or `Uint8Array`, for `file.value`) or\n *   something else (for `file.result`).\n */\n\n/**\n * @template {Node} [Tree=Node]\n *   The node that the parser yields (default: `Node`)\n * @callback Parser\n *   A **parser** handles the parsing of text to a syntax tree.\n *\n *   It is used in the parse phase and is called with a `string` and\n *   {@linkcode VFile} of the document to parse.\n *   It must return the syntax tree representation of the given file\n *   ({@linkcode Node}).\n * @param {string} document\n *   Document to parse.\n * @param {VFile} file\n *   File associated with `document`.\n * @returns {Tree}\n *   Node representing the given file.\n */\n\n/**\n * @typedef {(\n *   Plugin<Array<any>, any, any> |\n *   PluginTuple<Array<any>, any, any> |\n *   Preset\n * )} Pluggable\n *   Union of the different ways to add plugins and settings.\n */\n\n/**\n * @typedef {Array<Pluggable>} PluggableList\n *   List of plugins and presets.\n */\n\n// Note: we can’t use `callback` yet as it messes up `this`:\n//  <https://github.com/microsoft/TypeScript/issues/55197>.\n/**\n * @template {Array<unknown>} [PluginParameters=[]]\n *   Arguments passed to the plugin (default: `[]`, the empty tuple).\n * @template {Node | string | undefined} [Input=Node]\n *   Value that is expected as input (default: `Node`).\n *\n *   *   If the plugin returns a {@linkcode Transformer}, this\n *       should be the node it expects.\n *   *   If the plugin sets a {@linkcode Parser}, this should be\n *       `string`.\n *   *   If the plugin sets a {@linkcode Compiler}, this should be the\n *       node it expects.\n * @template [Output=Input]\n *   Value that is yielded as output (default: `Input`).\n *\n *   *   If the plugin returns a {@linkcode Transformer}, this\n *       should be the node that that yields.\n *   *   If the plugin sets a {@linkcode Parser}, this should be the\n *       node that it yields.\n *   *   If the plugin sets a {@linkcode Compiler}, this should be\n *       result it yields.\n * @typedef {(\n *   (this: Processor, ...parameters: PluginParameters) =>\n *     Input extends string ? // Parser.\n *        Output extends Node | undefined ? undefined | void : never :\n *     Output extends CompileResults ? // Compiler.\n *        Input extends Node | undefined ? undefined | void : never :\n *     Transformer<\n *       Input extends Node ? Input : Node,\n *       Output extends Node ? Output : Node\n *     > | undefined | void\n * )} Plugin\n *   Single plugin.\n *\n *   Plugins configure the processors they are applied on in the following\n *   ways:\n *\n *   *   they change the processor, such as the parser, the compiler, or by\n *       configuring data\n *   *   they specify how to handle trees and files\n *\n *   In practice, they are functions that can receive options and configure the\n *   processor (`this`).\n *\n *   > **Note**: plugins are called when the processor is *frozen*, not when\n *   > they are applied.\n */\n\n/**\n * Tuple of a plugin and its configuration.\n *\n * The first item is a plugin, the rest are its parameters.\n *\n * @template {Array<unknown>} [TupleParameters=[]]\n *   Arguments passed to the plugin (default: `[]`, the empty tuple).\n * @template {Node | string | undefined} [Input=undefined]\n *   Value that is expected as input (optional).\n *\n *   *   If the plugin returns a {@linkcode Transformer}, this\n *       should be the node it expects.\n *   *   If the plugin sets a {@linkcode Parser}, this should be\n *       `string`.\n *   *   If the plugin sets a {@linkcode Compiler}, this should be the\n *       node it expects.\n * @template [Output=undefined] (optional).\n *   Value that is yielded as output.\n *\n *   *   If the plugin returns a {@linkcode Transformer}, this\n *       should be the node that that yields.\n *   *   If the plugin sets a {@linkcode Parser}, this should be the\n *       node that it yields.\n *   *   If the plugin sets a {@linkcode Compiler}, this should be\n *       result it yields.\n * @typedef {(\n *   [\n *     plugin: Plugin<TupleParameters, Input, Output>,\n *     ...parameters: TupleParameters\n *   ]\n * )} PluginTuple\n */\n\n/**\n * @typedef Preset\n *   Sharable configuration.\n *\n *   They can contain plugins and settings.\n * @property {PluggableList | undefined} [plugins]\n *   List of plugins and presets (optional).\n * @property {Settings | undefined} [settings]\n *   Shared settings for parsers and compilers (optional).\n */\n\n/**\n * @template {VFile} [File=VFile]\n *   The file that the callback receives (default: `VFile`).\n * @callback ProcessCallback\n *   Callback called when the process is done.\n *\n *   Called with either an error or a result.\n * @param {Error | undefined} [error]\n *   Fatal error (optional).\n * @param {File | undefined} [file]\n *   Processed file (optional).\n * @returns {undefined}\n *   Nothing.\n */\n\n/**\n * @template {Node} [Tree=Node]\n *   The tree that the callback receives (default: `Node`).\n * @callback RunCallback\n *   Callback called when transformers are done.\n *\n *   Called with either an error or results.\n * @param {Error | undefined} [error]\n *   Fatal error (optional).\n * @param {Tree | undefined} [tree]\n *   Transformed tree (optional).\n * @param {VFile | undefined} [file]\n *   File (optional).\n * @returns {undefined}\n *   Nothing.\n */\n\n/**\n * @template {Node} [Output=Node]\n *   Node type that the transformer yields (default: `Node`).\n * @callback TransformCallback\n *   Callback passed to transforms.\n *\n *   If the signature of a `transformer` accepts a third argument, the\n *   transformer may perform asynchronous operations, and must call it.\n * @param {Error | undefined} [error]\n *   Fatal error to stop the process (optional).\n * @param {Output | undefined} [tree]\n *   New, changed, tree (optional).\n * @param {VFile | undefined} [file]\n *   New, changed, file (optional).\n * @returns {undefined}\n *   Nothing.\n */\n\n/**\n * @template {Node} [Input=Node]\n *   Node type that the transformer expects (default: `Node`).\n * @template {Node} [Output=Input]\n *   Node type that the transformer yields (default: `Input`).\n * @callback Transformer\n *   Transformers handle syntax trees and files.\n *\n *   They are functions that are called each time a syntax tree and file are\n *   passed through the run phase.\n *   When an error occurs in them (either because it’s thrown, returned,\n *   rejected, or passed to `next`), the process stops.\n *\n *   The run phase is handled by [`trough`][trough], see its documentation for\n *   the exact semantics of these functions.\n *\n *   > **Note**: you should likely ignore `next`: don’t accept it.\n *   > it supports callback-style async work.\n *   > But promises are likely easier to reason about.\n *\n *   [trough]: https://github.com/wooorm/trough#function-fninput-next\n * @param {Input} tree\n *   Tree to handle.\n * @param {VFile} file\n *   File to handle.\n * @param {TransformCallback<Output>} next\n *   Callback.\n * @returns {(\n *   Promise<Output | undefined | void> |\n *   Promise<never> | // For some reason this is needed separately.\n *   Output |\n *   Error |\n *   undefined |\n *   void\n * )}\n *   If you accept `next`, nothing.\n *   Otherwise:\n *\n *   *   `Error` — fatal error to stop the process\n *   *   `Promise<undefined>` or `undefined` — the next transformer keeps using\n *       same tree\n *   *   `Promise<Node>` or `Node` — new, changed, tree\n */\n\n/**\n * @template {Node | undefined} ParseTree\n *   Output of `parse`.\n * @template {Node | undefined} HeadTree\n *   Input for `run`.\n * @template {Node | undefined} TailTree\n *   Output for `run`.\n * @template {Node | undefined} CompileTree\n *   Input of `stringify`.\n * @template {CompileResults | undefined} CompileResult\n *   Output of `stringify`.\n * @template {Node | string | undefined} Input\n *   Input of plugin.\n * @template Output\n *   Output of plugin (optional).\n * @typedef {(\n *   Input extends string\n *     ? Output extends Node | undefined\n *       ? // Parser.\n *         Processor<\n *           Output extends undefined ? ParseTree : Output,\n *           HeadTree,\n *           TailTree,\n *           CompileTree,\n *           CompileResult\n *         >\n *       : // Unknown.\n *         Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>\n *     : Output extends CompileResults\n *     ? Input extends Node | undefined\n *       ? // Compiler.\n *         Processor<\n *           ParseTree,\n *           HeadTree,\n *           TailTree,\n *           Input extends undefined ? CompileTree : Input,\n *           Output extends undefined ? CompileResult : Output\n *         >\n *       : // Unknown.\n *         Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>\n *     : Input extends Node | undefined\n *     ? Output extends Node | undefined\n *       ? // Transform.\n *         Processor<\n *           ParseTree,\n *           HeadTree extends undefined ? Input : HeadTree,\n *           Output extends undefined ? TailTree : Output,\n *           CompileTree,\n *           CompileResult\n *         >\n *       : // Unknown.\n *         Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>\n *     : // Unknown.\n *       Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>\n * )} UsePlugin\n *   Create a processor based on the input/output of a {@link Plugin plugin}.\n */\n\n/**\n * @template {CompileResults | undefined} Result\n *   Node type that the transformer yields.\n * @typedef {(\n *   Result extends Value | undefined ?\n *     VFile :\n *     VFile & {result: Result}\n *   )} VFileWithOutput\n *   Type to generate a {@linkcode VFile} corresponding to a compiler result.\n *\n *   If a result that is not acceptable on a `VFile` is used, that will\n *   be stored on the `result` field of {@linkcode VFile}.\n */\n\nimport {bail} from 'bail'\nimport extend from 'extend'\nimport {ok as assert} from 'devlop'\nimport isPlainObj from 'is-plain-obj'\nimport {trough} from 'trough'\nimport {VFile} from 'vfile'\nimport {CallableInstance} from './callable-instance.js'\n\n// To do: next major: drop `Compiler`, `Parser`: prefer lowercase.\n\n// To do: we could start yielding `never` in TS when a parser is missing and\n// `parse` is called.\n// Currently, we allow directly setting `processor.parser`, which is untyped.\n\nconst own = {}.hasOwnProperty\n\n/**\n * @template {Node | undefined} [ParseTree=undefined]\n *   Output of `parse` (optional).\n * @template {Node | undefined} [HeadTree=undefined]\n *   Input for `run` (optional).\n * @template {Node | undefined} [TailTree=undefined]\n *   Output for `run` (optional).\n * @template {Node | undefined} [CompileTree=undefined]\n *   Input of `stringify` (optional).\n * @template {CompileResults | undefined} [CompileResult=undefined]\n *   Output of `stringify` (optional).\n * @extends {CallableInstance<[], Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>>}\n */\nexport class Processor extends CallableInstance {\n  /**\n   * Create a processor.\n   */\n  constructor() {\n    // If `Processor()` is called (w/o new), `copy` is called instead.\n    super('copy')\n\n    /**\n     * Compiler to use (deprecated).\n     *\n     * @deprecated\n     *   Use `compiler` instead.\n     * @type {(\n     *   Compiler<\n     *     CompileTree extends undefined ? Node : CompileTree,\n     *     CompileResult extends undefined ? CompileResults : CompileResult\n     *   > |\n     *   undefined\n     * )}\n     */\n    this.Compiler = undefined\n\n    /**\n     * Parser to use (deprecated).\n     *\n     * @deprecated\n     *   Use `parser` instead.\n     * @type {(\n     *   Parser<ParseTree extends undefined ? Node : ParseTree> |\n     *   undefined\n     * )}\n     */\n    this.Parser = undefined\n\n    // Note: the following fields are considered private.\n    // However, they are needed for tests, and TSC generates an untyped\n    // `private freezeIndex` field for, which trips `type-coverage` up.\n    // Instead, we use `@deprecated` to visualize that they shouldn’t be used.\n    /**\n     * Internal list of configured plugins.\n     *\n     * @deprecated\n     *   This is a private internal property and should not be used.\n     * @type {Array<PluginTuple<Array<unknown>>>}\n     */\n    this.attachers = []\n\n    /**\n     * Compiler to use.\n     *\n     * @type {(\n     *   Compiler<\n     *     CompileTree extends undefined ? Node : CompileTree,\n     *     CompileResult extends undefined ? CompileResults : CompileResult\n     *   > |\n     *   undefined\n     * )}\n     */\n    this.compiler = undefined\n\n    /**\n     * Internal state to track where we are while freezing.\n     *\n     * @deprecated\n     *   This is a private internal property and should not be used.\n     * @type {number}\n     */\n    this.freezeIndex = -1\n\n    /**\n     * Internal state to track whether we’re frozen.\n     *\n     * @deprecated\n     *   This is a private internal property and should not be used.\n     * @type {boolean | undefined}\n     */\n    this.frozen = undefined\n\n    /**\n     * Internal state.\n     *\n     * @deprecated\n     *   This is a private internal property and should not be used.\n     * @type {Data}\n     */\n    this.namespace = {}\n\n    /**\n     * Parser to use.\n     *\n     * @type {(\n     *   Parser<ParseTree extends undefined ? Node : ParseTree> |\n     *   undefined\n     * )}\n     */\n    this.parser = undefined\n\n    /**\n     * Internal list of configured transformers.\n     *\n     * @deprecated\n     *   This is a private internal property and should not be used.\n     * @type {Pipeline}\n     */\n    this.transformers = trough()\n  }\n\n  /**\n   * Copy a processor.\n   *\n   * @deprecated\n   *   This is a private internal method and should not be used.\n   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n   *   New *unfrozen* processor ({@linkcode Processor}) that is\n   *   configured to work the same as its ancestor.\n   *   When the descendant processor is configured in the future it does not\n   *   affect the ancestral processor.\n   */\n  copy() {\n    // Cast as the type parameters will be the same after attaching.\n    const destination =\n      /** @type {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>} */ (\n        new Processor()\n      )\n    let index = -1\n\n    while (++index < this.attachers.length) {\n      const attacher = this.attachers[index]\n      destination.use(...attacher)\n    }\n\n    destination.data(extend(true, {}, this.namespace))\n\n    return destination\n  }\n\n  /**\n   * Configure the processor with info available to all plugins.\n   * Information is stored in an object.\n   *\n   * Typically, options can be given to a specific plugin, but sometimes it\n   * makes sense to have information shared with several plugins.\n   * For example, a list of HTML elements that are self-closing, which is\n   * needed during all phases.\n   *\n   * > **Note**: setting information cannot occur on *frozen* processors.\n   * > Call the processor first to create a new unfrozen processor.\n   *\n   * > **Note**: to register custom data in TypeScript, augment the\n   * > {@linkcode Data} interface.\n   *\n   * @example\n   *   This example show how to get and set info:\n   *\n   *   ```js\n   *   import {unified} from 'unified'\n   *\n   *   const processor = unified().data('alpha', 'bravo')\n   *\n   *   processor.data('alpha') // => 'bravo'\n   *\n   *   processor.data() // => {alpha: 'bravo'}\n   *\n   *   processor.data({charlie: 'delta'})\n   *\n   *   processor.data() // => {charlie: 'delta'}\n   *   ```\n   *\n   * @template {keyof Data} Key\n   *\n   * @overload\n   * @returns {Data}\n   *\n   * @overload\n   * @param {Data} dataset\n   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n   *\n   * @overload\n   * @param {Key} key\n   * @returns {Data[Key]}\n   *\n   * @overload\n   * @param {Key} key\n   * @param {Data[Key]} value\n   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n   *\n   * @param {Data | Key} [key]\n   *   Key to get or set, or entire dataset to set, or nothing to get the\n   *   entire dataset (optional).\n   * @param {Data[Key]} [value]\n   *   Value to set (optional).\n   * @returns {unknown}\n   *   The current processor when setting, the value at `key` when getting, or\n   *   the entire dataset when getting without key.\n   */\n  data(key, value) {\n    if (typeof key === 'string') {\n      // Set `key`.\n      if (arguments.length === 2) {\n        assertUnfrozen('data', this.frozen)\n        this.namespace[key] = value\n        return this\n      }\n\n      // Get `key`.\n      return (own.call(this.namespace, key) && this.namespace[key]) || undefined\n    }\n\n    // Set space.\n    if (key) {\n      assertUnfrozen('data', this.frozen)\n      this.namespace = key\n      return this\n    }\n\n    // Get space.\n    return this.namespace\n  }\n\n  /**\n   * Freeze a processor.\n   *\n   * Frozen processors are meant to be extended and not to be configured\n   * directly.\n   *\n   * When a processor is frozen it cannot be unfrozen.\n   * New processors working the same way can be created by calling the\n   * processor.\n   *\n   * It’s possible to freeze processors explicitly by calling `.freeze()`.\n   * Processors freeze automatically when `.parse()`, `.run()`, `.runSync()`,\n   * `.stringify()`, `.process()`, or `.processSync()` are called.\n   *\n   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n   *   The current processor.\n   */\n  freeze() {\n    if (this.frozen) {\n      return this\n    }\n\n    // Cast so that we can type plugins easier.\n    // Plugins are supposed to be usable on different processors, not just on\n    // this exact processor.\n    const self = /** @type {Processor} */ (/** @type {unknown} */ (this))\n\n    while (++this.freezeIndex < this.attachers.length) {\n      const [attacher, ...options] = this.attachers[this.freezeIndex]\n\n      if (options[0] === false) {\n        continue\n      }\n\n      if (options[0] === true) {\n        options[0] = undefined\n      }\n\n      const transformer = attacher.call(self, ...options)\n\n      if (typeof transformer === 'function') {\n        this.transformers.use(transformer)\n      }\n    }\n\n    this.frozen = true\n    this.freezeIndex = Number.POSITIVE_INFINITY\n\n    return this\n  }\n\n  /**\n   * Parse text to a syntax tree.\n   *\n   * > **Note**: `parse` freezes the processor if not already *frozen*.\n   *\n   * > **Note**: `parse` performs the parse phase, not the run phase or other\n   * > phases.\n   *\n   * @param {Compatible | undefined} [file]\n   *   file to parse (optional); typically `string` or `VFile`; any value\n   *   accepted as `x` in `new VFile(x)`.\n   * @returns {ParseTree extends undefined ? Node : ParseTree}\n   *   Syntax tree representing `file`.\n   */\n  parse(file) {\n    this.freeze()\n    const realFile = vfile(file)\n    const parser = this.parser || this.Parser\n    assertParser('parse', parser)\n    return parser(String(realFile), realFile)\n  }\n\n  /**\n   * Process the given file as configured on the processor.\n   *\n   * > **Note**: `process` freezes the processor if not already *frozen*.\n   *\n   * > **Note**: `process` performs the parse, run, and stringify phases.\n   *\n   * @overload\n   * @param {Compatible | undefined} file\n   * @param {ProcessCallback<VFileWithOutput<CompileResult>>} done\n   * @returns {undefined}\n   *\n   * @overload\n   * @param {Compatible | undefined} [file]\n   * @returns {Promise<VFileWithOutput<CompileResult>>}\n   *\n   * @param {Compatible | undefined} [file]\n   *   File (optional); typically `string` or `VFile`]; any value accepted as\n   *   `x` in `new VFile(x)`.\n   * @param {ProcessCallback<VFileWithOutput<CompileResult>> | undefined} [done]\n   *   Callback (optional).\n   * @returns {Promise<VFile> | undefined}\n   *   Nothing if `done` is given.\n   *   Otherwise a promise, rejected with a fatal error or resolved with the\n   *   processed file.\n   *\n   *   The parsed, transformed, and compiled value is available at\n   *   `file.value` (see note).\n   *\n   *   > **Note**: unified typically compiles by serializing: most\n   *   > compilers return `string` (or `Uint8Array`).\n   *   > Some compilers, such as the one configured with\n   *   > [`rehype-react`][rehype-react], return other values (in this case, a\n   *   > React tree).\n   *   > If you’re using a compiler that doesn’t serialize, expect different\n   *   > result values.\n   *   >\n   *   > To register custom results in TypeScript, add them to\n   *   > {@linkcode CompileResultMap}.\n   *\n   *   [rehype-react]: https://github.com/rehypejs/rehype-react\n   */\n  process(file, done) {\n    const self = this\n\n    this.freeze()\n    assertParser('process', this.parser || this.Parser)\n    assertCompiler('process', this.compiler || this.Compiler)\n\n    return done ? executor(undefined, done) : new Promise(executor)\n\n    // Note: `void`s needed for TS.\n    /**\n     * @param {((file: VFileWithOutput<CompileResult>) => undefined | void) | undefined} resolve\n     * @param {(error: Error | undefined) => undefined | void} reject\n     * @returns {undefined}\n     */\n    function executor(resolve, reject) {\n      const realFile = vfile(file)\n      // Assume `ParseTree` (the result of the parser) matches `HeadTree` (the\n      // input of the first transform).\n      const parseTree =\n        /** @type {HeadTree extends undefined ? Node : HeadTree} */ (\n          /** @type {unknown} */ (self.parse(realFile))\n        )\n\n      self.run(parseTree, realFile, function (error, tree, file) {\n        if (error || !tree || !file) {\n          return realDone(error)\n        }\n\n        // Assume `TailTree` (the output of the last transform) matches\n        // `CompileTree` (the input of the compiler).\n        const compileTree =\n          /** @type {CompileTree extends undefined ? Node : CompileTree} */ (\n            /** @type {unknown} */ (tree)\n          )\n\n        const compileResult = self.stringify(compileTree, file)\n\n        if (looksLikeAValue(compileResult)) {\n          file.value = compileResult\n        } else {\n          file.result = compileResult\n        }\n\n        realDone(error, /** @type {VFileWithOutput<CompileResult>} */ (file))\n      })\n\n      /**\n       * @param {Error | undefined} error\n       * @param {VFileWithOutput<CompileResult> | undefined} [file]\n       * @returns {undefined}\n       */\n      function realDone(error, file) {\n        if (error || !file) {\n          reject(error)\n        } else if (resolve) {\n          resolve(file)\n        } else {\n          assert(done, '`done` is defined if `resolve` is not')\n          done(undefined, file)\n        }\n      }\n    }\n  }\n\n  /**\n   * Process the given file as configured on the processor.\n   *\n   * An error is thrown if asynchronous transforms are configured.\n   *\n   * > **Note**: `processSync` freezes the processor if not already *frozen*.\n   *\n   * > **Note**: `processSync` performs the parse, run, and stringify phases.\n   *\n   * @param {Compatible | undefined} [file]\n   *   File (optional); typically `string` or `VFile`; any value accepted as\n   *   `x` in `new VFile(x)`.\n   * @returns {VFileWithOutput<CompileResult>}\n   *   The processed file.\n   *\n   *   The parsed, transformed, and compiled value is available at\n   *   `file.value` (see note).\n   *\n   *   > **Note**: unified typically compiles by serializing: most\n   *   > compilers return `string` (or `Uint8Array`).\n   *   > Some compilers, such as the one configured with\n   *   > [`rehype-react`][rehype-react], return other values (in this case, a\n   *   > React tree).\n   *   > If you’re using a compiler that doesn’t serialize, expect different\n   *   > result values.\n   *   >\n   *   > To register custom results in TypeScript, add them to\n   *   > {@linkcode CompileResultMap}.\n   *\n   *   [rehype-react]: https://github.com/rehypejs/rehype-react\n   */\n  processSync(file) {\n    /** @type {boolean} */\n    let complete = false\n    /** @type {VFileWithOutput<CompileResult> | undefined} */\n    let result\n\n    this.freeze()\n    assertParser('processSync', this.parser || this.Parser)\n    assertCompiler('processSync', this.compiler || this.Compiler)\n\n    this.process(file, realDone)\n    assertDone('processSync', 'process', complete)\n    assert(result, 'we either bailed on an error or have a tree')\n\n    return result\n\n    /**\n     * @type {ProcessCallback<VFileWithOutput<CompileResult>>}\n     */\n    function realDone(error, file) {\n      complete = true\n      bail(error)\n      result = file\n    }\n  }\n\n  /**\n   * Run *transformers* on a syntax tree.\n   *\n   * > **Note**: `run` freezes the processor if not already *frozen*.\n   *\n   * > **Note**: `run` performs the run phase, not other phases.\n   *\n   * @overload\n   * @param {HeadTree extends undefined ? Node : HeadTree} tree\n   * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done\n   * @returns {undefined}\n   *\n   * @overload\n   * @param {HeadTree extends undefined ? Node : HeadTree} tree\n   * @param {Compatible | undefined} file\n   * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done\n   * @returns {undefined}\n   *\n   * @overload\n   * @param {HeadTree extends undefined ? Node : HeadTree} tree\n   * @param {Compatible | undefined} [file]\n   * @returns {Promise<TailTree extends undefined ? Node : TailTree>}\n   *\n   * @param {HeadTree extends undefined ? Node : HeadTree} tree\n   *   Tree to transform and inspect.\n   * @param {(\n   *   RunCallback<TailTree extends undefined ? Node : TailTree> |\n   *   Compatible\n   * )} [file]\n   *   File associated with `node` (optional); any value accepted as `x` in\n   *   `new VFile(x)`.\n   * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} [done]\n   *   Callback (optional).\n   * @returns {Promise<TailTree extends undefined ? Node : TailTree> | undefined}\n   *   Nothing if `done` is given.\n   *   Otherwise, a promise rejected with a fatal error or resolved with the\n   *   transformed tree.\n   */\n  run(tree, file, done) {\n    assertNode(tree)\n    this.freeze()\n\n    const transformers = this.transformers\n\n    if (!done && typeof file === 'function') {\n      done = file\n      file = undefined\n    }\n\n    return done ? executor(undefined, done) : new Promise(executor)\n\n    // Note: `void`s needed for TS.\n    /**\n     * @param {(\n     *   ((tree: TailTree extends undefined ? Node : TailTree) => undefined | void) |\n     *   undefined\n     * )} resolve\n     * @param {(error: Error) => undefined | void} reject\n     * @returns {undefined}\n     */\n    function executor(resolve, reject) {\n      assert(\n        typeof file !== 'function',\n        '`file` can’t be a `done` anymore, we checked'\n      )\n      const realFile = vfile(file)\n      transformers.run(tree, realFile, realDone)\n\n      /**\n       * @param {Error | undefined} error\n       * @param {Node} outputTree\n       * @param {VFile} file\n       * @returns {undefined}\n       */\n      function realDone(error, outputTree, file) {\n        const resultingTree =\n          /** @type {TailTree extends undefined ? Node : TailTree} */ (\n            outputTree || tree\n          )\n\n        if (error) {\n          reject(error)\n        } else if (resolve) {\n          resolve(resultingTree)\n        } else {\n          assert(done, '`done` is defined if `resolve` is not')\n          done(undefined, resultingTree, file)\n        }\n      }\n    }\n  }\n\n  /**\n   * Run *transformers* on a syntax tree.\n   *\n   * An error is thrown if asynchronous transforms are configured.\n   *\n   * > **Note**: `runSync` freezes the processor if not already *frozen*.\n   *\n   * > **Note**: `runSync` performs the run phase, not other phases.\n   *\n   * @param {HeadTree extends undefined ? Node : HeadTree} tree\n   *   Tree to transform and inspect.\n   * @param {Compatible | undefined} [file]\n   *   File associated with `node` (optional); any value accepted as `x` in\n   *   `new VFile(x)`.\n   * @returns {TailTree extends undefined ? Node : TailTree}\n   *   Transformed tree.\n   */\n  runSync(tree, file) {\n    /** @type {boolean} */\n    let complete = false\n    /** @type {(TailTree extends undefined ? Node : TailTree) | undefined} */\n    let result\n\n    this.run(tree, file, realDone)\n\n    assertDone('runSync', 'run', complete)\n    assert(result, 'we either bailed on an error or have a tree')\n    return result\n\n    /**\n     * @type {RunCallback<TailTree extends undefined ? Node : TailTree>}\n     */\n    function realDone(error, tree) {\n      bail(error)\n      result = tree\n      complete = true\n    }\n  }\n\n  /**\n   * Compile a syntax tree.\n   *\n   * > **Note**: `stringify` freezes the processor if not already *frozen*.\n   *\n   * > **Note**: `stringify` performs the stringify phase, not the run phase\n   * > or other phases.\n   *\n   * @param {CompileTree extends undefined ? Node : CompileTree} tree\n   *   Tree to compile.\n   * @param {Compatible | undefined} [file]\n   *   File associated with `node` (optional); any value accepted as `x` in\n   *   `new VFile(x)`.\n   * @returns {CompileResult extends undefined ? Value : CompileResult}\n   *   Textual representation of the tree (see note).\n   *\n   *   > **Note**: unified typically compiles by serializing: most compilers\n   *   > return `string` (or `Uint8Array`).\n   *   > Some compilers, such as the one configured with\n   *   > [`rehype-react`][rehype-react], return other values (in this case, a\n   *   > React tree).\n   *   > If you’re using a compiler that doesn’t serialize, expect different\n   *   > result values.\n   *   >\n   *   > To register custom results in TypeScript, add them to\n   *   > {@linkcode CompileResultMap}.\n   *\n   *   [rehype-react]: https://github.com/rehypejs/rehype-react\n   */\n  stringify(tree, file) {\n    this.freeze()\n    const realFile = vfile(file)\n    const compiler = this.compiler || this.Compiler\n    assertCompiler('stringify', compiler)\n    assertNode(tree)\n\n    return compiler(tree, realFile)\n  }\n\n  /**\n   * Configure the processor to use a plugin, a list of usable values, or a\n   * preset.\n   *\n   * If the processor is already using a plugin, the previous plugin\n   * configuration is changed based on the options that are passed in.\n   * In other words, the plugin is not added a second time.\n   *\n   * > **Note**: `use` cannot be called on *frozen* processors.\n   * > Call the processor first to create a new unfrozen processor.\n   *\n   * @example\n   *   There are many ways to pass plugins to `.use()`.\n   *   This example gives an overview:\n   *\n   *   ```js\n   *   import {unified} from 'unified'\n   *\n   *   unified()\n   *     // Plugin with options:\n   *     .use(pluginA, {x: true, y: true})\n   *     // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):\n   *     .use(pluginA, {y: false, z: true})\n   *     // Plugins:\n   *     .use([pluginB, pluginC])\n   *     // Two plugins, the second with options:\n   *     .use([pluginD, [pluginE, {}]])\n   *     // Preset with plugins and settings:\n   *     .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})\n   *     // Settings only:\n   *     .use({settings: {position: false}})\n   *   ```\n   *\n   * @template {Array<unknown>} [Parameters=[]]\n   * @template {Node | string | undefined} [Input=undefined]\n   * @template [Output=Input]\n   *\n   * @overload\n   * @param {Preset | null | undefined} [preset]\n   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n   *\n   * @overload\n   * @param {PluggableList} list\n   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n   *\n   * @overload\n   * @param {Plugin<Parameters, Input, Output>} plugin\n   * @param {...(Parameters | [boolean])} parameters\n   * @returns {UsePlugin<ParseTree, HeadTree, TailTree, CompileTree, CompileResult, Input, Output>}\n   *\n   * @param {PluggableList | Plugin | Preset | null | undefined} value\n   *   Usable value.\n   * @param {...unknown} parameters\n   *   Parameters, when a plugin is given as a usable value.\n   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n   *   Current processor.\n   */\n  use(value, ...parameters) {\n    const attachers = this.attachers\n    const namespace = this.namespace\n\n    assertUnfrozen('use', this.frozen)\n\n    if (value === null || value === undefined) {\n      // Empty.\n    } else if (typeof value === 'function') {\n      addPlugin(value, parameters)\n    } else if (typeof value === 'object') {\n      if (Array.isArray(value)) {\n        addList(value)\n      } else {\n        addPreset(value)\n      }\n    } else {\n      throw new TypeError('Expected usable value, not `' + value + '`')\n    }\n\n    return this\n\n    /**\n     * @param {Pluggable} value\n     * @returns {undefined}\n     */\n    function add(value) {\n      if (typeof value === 'function') {\n        addPlugin(value, [])\n      } else if (typeof value === 'object') {\n        if (Array.isArray(value)) {\n          const [plugin, ...parameters] =\n            /** @type {PluginTuple<Array<unknown>>} */ (value)\n          addPlugin(plugin, parameters)\n        } else {\n          addPreset(value)\n        }\n      } else {\n        throw new TypeError('Expected usable value, not `' + value + '`')\n      }\n    }\n\n    /**\n     * @param {Preset} result\n     * @returns {undefined}\n     */\n    function addPreset(result) {\n      if (!('plugins' in result) && !('settings' in result)) {\n        throw new Error(\n          'Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither'\n        )\n      }\n\n      addList(result.plugins)\n\n      if (result.settings) {\n        namespace.settings = extend(true, namespace.settings, result.settings)\n      }\n    }\n\n    /**\n     * @param {PluggableList | null | undefined} plugins\n     * @returns {undefined}\n     */\n    function addList(plugins) {\n      let index = -1\n\n      if (plugins === null || plugins === undefined) {\n        // Empty.\n      } else if (Array.isArray(plugins)) {\n        while (++index < plugins.length) {\n          const thing = plugins[index]\n          add(thing)\n        }\n      } else {\n        throw new TypeError('Expected a list of plugins, not `' + plugins + '`')\n      }\n    }\n\n    /**\n     * @param {Plugin} plugin\n     * @param {Array<unknown>} parameters\n     * @returns {undefined}\n     */\n    function addPlugin(plugin, parameters) {\n      let index = -1\n      let entryIndex = -1\n\n      while (++index < attachers.length) {\n        if (attachers[index][0] === plugin) {\n          entryIndex = index\n          break\n        }\n      }\n\n      if (entryIndex === -1) {\n        attachers.push([plugin, ...parameters])\n      }\n      // Only set if there was at least a `primary` value, otherwise we’d change\n      // `arguments.length`.\n      else if (parameters.length > 0) {\n        let [primary, ...rest] = parameters\n        const currentPrimary = attachers[entryIndex][1]\n        if (isPlainObj(currentPrimary) && isPlainObj(primary)) {\n          primary = extend(true, currentPrimary, primary)\n        }\n\n        attachers[entryIndex] = [plugin, primary, ...rest]\n      }\n    }\n  }\n}\n\n// Note: this returns a *callable* instance.\n// That’s why it’s documented as a function.\n/**\n * Create a new processor.\n *\n * @example\n *   This example shows how a new processor can be created (from `remark`) and linked\n *   to **stdin**(4) and **stdout**(4).\n *\n *   ```js\n *   import process from 'node:process'\n *   import concatStream from 'concat-stream'\n *   import {remark} from 'remark'\n *\n *   process.stdin.pipe(\n *     concatStream(function (buf) {\n *       process.stdout.write(String(remark().processSync(buf)))\n *     })\n *   )\n *   ```\n *\n * @returns\n *   New *unfrozen* processor (`processor`).\n *\n *   This processor is configured to work the same as its ancestor.\n *   When the descendant processor is configured in the future it does not\n *   affect the ancestral processor.\n */\nexport const unified = new Processor().freeze()\n\n/**\n * Assert a parser is available.\n *\n * @param {string} name\n * @param {unknown} value\n * @returns {asserts value is Parser}\n */\nfunction assertParser(name, value) {\n  if (typeof value !== 'function') {\n    throw new TypeError('Cannot `' + name + '` without `parser`')\n  }\n}\n\n/**\n * Assert a compiler is available.\n *\n * @param {string} name\n * @param {unknown} value\n * @returns {asserts value is Compiler}\n */\nfunction assertCompiler(name, value) {\n  if (typeof value !== 'function') {\n    throw new TypeError('Cannot `' + name + '` without `compiler`')\n  }\n}\n\n/**\n * Assert the processor is not frozen.\n *\n * @param {string} name\n * @param {unknown} frozen\n * @returns {asserts frozen is false}\n */\nfunction assertUnfrozen(name, frozen) {\n  if (frozen) {\n    throw new Error(\n      'Cannot call `' +\n        name +\n        '` on a frozen processor.\\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.'\n    )\n  }\n}\n\n/**\n * Assert `node` is a unist node.\n *\n * @param {unknown} node\n * @returns {asserts node is Node}\n */\nfunction assertNode(node) {\n  // `isPlainObj` unfortunately uses `any` instead of `unknown`.\n  // type-coverage:ignore-next-line\n  if (!isPlainObj(node) || typeof node.type !== 'string') {\n    throw new TypeError('Expected node, got `' + node + '`')\n    // Fine.\n  }\n}\n\n/**\n * Assert that `complete` is `true`.\n *\n * @param {string} name\n * @param {string} asyncName\n * @param {unknown} complete\n * @returns {asserts complete is true}\n */\nfunction assertDone(name, asyncName, complete) {\n  if (!complete) {\n    throw new Error(\n      '`' + name + '` finished async. Use `' + asyncName + '` instead'\n    )\n  }\n}\n\n/**\n * @param {Compatible | undefined} [value]\n * @returns {VFile}\n */\nfunction vfile(value) {\n  return looksLikeAVFile(value) ? value : new VFile(value)\n}\n\n/**\n * @param {Compatible | undefined} [value]\n * @returns {value is VFile}\n */\nfunction looksLikeAVFile(value) {\n  return Boolean(\n    value &&\n      typeof value === 'object' &&\n      'message' in value &&\n      'messages' in value\n  )\n}\n\n/**\n * @param {unknown} [value]\n * @returns {value is Value}\n */\nfunction looksLikeAValue(value) {\n  return typeof value === 'string' || isUint8Array(value)\n}\n\n/**\n * Assert `value` is an `Uint8Array`.\n *\n * @param {unknown} value\n *   thing.\n * @returns {value is Uint8Array}\n *   Whether `value` is an `Uint8Array`.\n */\nfunction isUint8Array(value) {\n  return Boolean(\n    value &&\n      typeof value === 'object' &&\n      'byteLength' in value &&\n      'byteOffset' in value\n  )\n}\n","var __typeError = (msg) => {\n  throw TypeError(msg);\n};\nvar __accessCheck = (obj, member, msg) => member.has(obj) || __typeError(\"Cannot \" + msg);\nvar __privateGet = (obj, member, getter) => (__accessCheck(obj, member, \"read from private field\"), getter ? getter.call(obj) : member.get(obj));\nvar __privateAdd = (obj, member, value) => member.has(obj) ? __typeError(\"Cannot add the same private member more than once\") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\nvar __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, \"write to private field\"), setter ? setter.call(obj, value) : member.set(obj, value), value);\nvar _marks, _hasText, _maybeMerge, _matchTarget, _runNode, _closeNodeAndPush, _addNodeAndPush, _marks2, _matchTarget2, _runProseNode, _runProseMark, _runNode2, _searchType, _maybeMergeChildren, _createMarkdownNode, _moveSpaces, _closeNodeAndPush2, _addNodeAndPush2, _openMark, _closeMark;\nimport { stackOverFlow, parserMatchError, createNodeInParserFail, serializerMatchError } from \"@milkdown/exception\";\nimport { Mark } from \"@milkdown/prose/model\";\nclass StackElement {\n}\nclass Stack {\n  constructor() {\n    this.elements = [];\n    this.size = () => {\n      return this.elements.length;\n    };\n    this.top = () => {\n      return this.elements.at(-1);\n    };\n    this.push = (node) => {\n      var _a;\n      (_a = this.top()) == null ? void 0 : _a.push(node);\n    };\n    this.open = (node) => {\n      this.elements.push(node);\n    };\n    this.close = () => {\n      const el = this.elements.pop();\n      if (!el) throw stackOverFlow();\n      return el;\n    };\n  }\n}\nclass ParserStackElement extends StackElement {\n  constructor(type, content, attrs) {\n    super();\n    this.type = type;\n    this.content = content;\n    this.attrs = attrs;\n  }\n  push(node, ...rest) {\n    this.content.push(node, ...rest);\n  }\n  pop() {\n    return this.content.pop();\n  }\n  static create(type, content, attrs) {\n    return new ParserStackElement(type, content, attrs);\n  }\n}\nconst _ParserState = class _ParserState extends Stack {\n  /// @internal\n  constructor(schema) {\n    super();\n    __privateAdd(this, _marks);\n    __privateAdd(this, _hasText);\n    __privateAdd(this, _maybeMerge);\n    __privateAdd(this, _matchTarget);\n    __privateAdd(this, _runNode);\n    __privateAdd(this, _closeNodeAndPush);\n    __privateAdd(this, _addNodeAndPush);\n    __privateSet(this, _marks, Mark.none);\n    __privateSet(this, _hasText, (node) => node.isText);\n    __privateSet(this, _maybeMerge, (a, b) => {\n      if (__privateGet(this, _hasText).call(this, a) && __privateGet(this, _hasText).call(this, b) && Mark.sameSet(a.marks, b.marks))\n        return this.schema.text(a.text + b.text, a.marks);\n      return void 0;\n    });\n    __privateSet(this, _matchTarget, (node) => {\n      const result = Object.values({\n        ...this.schema.nodes,\n        ...this.schema.marks\n      }).find((x) => {\n        const spec = x.spec;\n        return spec.parseMarkdown.match(node);\n      });\n      if (!result) throw parserMatchError(node);\n      return result;\n    });\n    __privateSet(this, _runNode, (node) => {\n      const type = __privateGet(this, _matchTarget).call(this, node);\n      const spec = type.spec;\n      spec.parseMarkdown.runner(this, node, type);\n    });\n    this.injectRoot = (node, nodeType, attrs) => {\n      this.openNode(nodeType, attrs);\n      this.next(node.children);\n      return this;\n    };\n    this.openNode = (nodeType, attrs) => {\n      this.open(ParserStackElement.create(nodeType, [], attrs));\n      return this;\n    };\n    __privateSet(this, _closeNodeAndPush, () => {\n      __privateSet(this, _marks, Mark.none);\n      const element = this.close();\n      return __privateGet(this, _addNodeAndPush).call(this, element.type, element.attrs, element.content);\n    });\n    this.closeNode = () => {\n      __privateGet(this, _closeNodeAndPush).call(this);\n      return this;\n    };\n    __privateSet(this, _addNodeAndPush, (nodeType, attrs, content) => {\n      const node = nodeType.createAndFill(attrs, content, __privateGet(this, _marks));\n      if (!node) throw createNodeInParserFail(nodeType, attrs, content);\n      this.push(node);\n      return node;\n    });\n    this.addNode = (nodeType, attrs, content) => {\n      __privateGet(this, _addNodeAndPush).call(this, nodeType, attrs, content);\n      return this;\n    };\n    this.openMark = (markType, attrs) => {\n      const mark = markType.create(attrs);\n      __privateSet(this, _marks, mark.addToSet(__privateGet(this, _marks)));\n      return this;\n    };\n    this.closeMark = (markType) => {\n      __privateSet(this, _marks, markType.removeFromSet(__privateGet(this, _marks)));\n      return this;\n    };\n    this.addText = (text) => {\n      const topElement = this.top();\n      if (!topElement) throw stackOverFlow();\n      const prevNode = topElement.pop();\n      const currNode = this.schema.text(text, __privateGet(this, _marks));\n      if (!prevNode) {\n        topElement.push(currNode);\n        return this;\n      }\n      const merged = __privateGet(this, _maybeMerge).call(this, prevNode, currNode);\n      if (merged) {\n        topElement.push(merged);\n        return this;\n      }\n      topElement.push(prevNode, currNode);\n      return this;\n    };\n    this.build = () => {\n      let doc;\n      do\n        doc = __privateGet(this, _closeNodeAndPush).call(this);\n      while (this.size());\n      return doc;\n    };\n    this.next = (nodes = []) => {\n      [nodes].flat().forEach((node) => __privateGet(this, _runNode).call(this, node));\n      return this;\n    };\n    this.toDoc = () => this.build();\n    this.run = (remark, markdown) => {\n      const tree = remark.runSync(\n        remark.parse(markdown),\n        markdown\n      );\n      this.next(tree);\n      return this;\n    };\n    this.schema = schema;\n  }\n};\n_marks = new WeakMap();\n_hasText = new WeakMap();\n_maybeMerge = new WeakMap();\n_matchTarget = new WeakMap();\n_runNode = new WeakMap();\n_closeNodeAndPush = new WeakMap();\n_addNodeAndPush = new WeakMap();\n_ParserState.create = (schema, remark) => {\n  const state = new _ParserState(schema);\n  return (text) => {\n    state.run(remark, text);\n    return state.toDoc();\n  };\n};\nlet ParserState = _ParserState;\nconst _SerializerStackElement = class _SerializerStackElement extends StackElement {\n  constructor(type, children, value, props = {}) {\n    super();\n    this.type = type;\n    this.children = children;\n    this.value = value;\n    this.props = props;\n    this.push = (node, ...rest) => {\n      if (!this.children) this.children = [];\n      this.children.push(node, ...rest);\n    };\n    this.pop = () => {\n      var _a;\n      return (_a = this.children) == null ? void 0 : _a.pop();\n    };\n  }\n};\n_SerializerStackElement.create = (type, children, value, props = {}) => new _SerializerStackElement(type, children, value, props);\nlet SerializerStackElement = _SerializerStackElement;\nconst isFragment = (x) => Object.prototype.hasOwnProperty.call(x, \"size\");\nconst _SerializerState = class _SerializerState extends Stack {\n  /// @internal\n  constructor(schema) {\n    super();\n    __privateAdd(this, _marks2);\n    __privateAdd(this, _matchTarget2);\n    __privateAdd(this, _runProseNode);\n    __privateAdd(this, _runProseMark);\n    __privateAdd(this, _runNode2);\n    __privateAdd(this, _searchType);\n    __privateAdd(this, _maybeMergeChildren);\n    __privateAdd(this, _createMarkdownNode);\n    __privateAdd(this, _moveSpaces);\n    __privateAdd(this, _closeNodeAndPush2);\n    __privateAdd(this, _addNodeAndPush2);\n    __privateAdd(this, _openMark);\n    __privateAdd(this, _closeMark);\n    __privateSet(this, _marks2, Mark.none);\n    __privateSet(this, _matchTarget2, (node) => {\n      const result = Object.values({\n        ...this.schema.nodes,\n        ...this.schema.marks\n      }).find((x) => {\n        const spec = x.spec;\n        return spec.toMarkdown.match(node);\n      });\n      if (!result) throw serializerMatchError(node.type);\n      return result;\n    });\n    __privateSet(this, _runProseNode, (node) => {\n      const type = __privateGet(this, _matchTarget2).call(this, node);\n      const spec = type.spec;\n      return spec.toMarkdown.runner(this, node);\n    });\n    __privateSet(this, _runProseMark, (mark, node) => {\n      const type = __privateGet(this, _matchTarget2).call(this, mark);\n      const spec = type.spec;\n      return spec.toMarkdown.runner(this, mark, node);\n    });\n    __privateSet(this, _runNode2, (node) => {\n      const { marks } = node;\n      const getPriority = (x) => x.type.spec.priority ?? 50;\n      const tmp = [...marks].sort((a, b) => getPriority(a) - getPriority(b));\n      const unPreventNext = tmp.every((mark) => !__privateGet(this, _runProseMark).call(this, mark, node));\n      if (unPreventNext) __privateGet(this, _runProseNode).call(this, node);\n      marks.forEach((mark) => __privateGet(this, _closeMark).call(this, mark));\n    });\n    __privateSet(this, _searchType, (child, type) => {\n      var _a;\n      if (child.type === type) return child;\n      if (((_a = child.children) == null ? void 0 : _a.length) !== 1) return child;\n      const searchNode = (node2) => {\n        var _a2;\n        if (node2.type === type) return node2;\n        if (((_a2 = node2.children) == null ? void 0 : _a2.length) !== 1) return null;\n        const [firstChild] = node2.children;\n        if (!firstChild) return null;\n        return searchNode(firstChild);\n      };\n      const target = searchNode(child);\n      if (!target) return child;\n      const tmp = target.children ? [...target.children] : void 0;\n      const node = { ...child, children: tmp };\n      node.children = tmp;\n      target.children = [node];\n      return target;\n    });\n    __privateSet(this, _maybeMergeChildren, (node) => {\n      const { children } = node;\n      if (!children) return node;\n      node.children = children.reduce((nextChildren, child, index) => {\n        if (index === 0) return [child];\n        const last = nextChildren.at(-1);\n        if (last && last.isMark && child.isMark) {\n          child = __privateGet(this, _searchType).call(this, child, last.type);\n          const { children: currChildren, ...currRest } = child;\n          const { children: prevChildren, ...prevRest } = last;\n          if (child.type === last.type && currChildren && prevChildren && JSON.stringify(currRest) === JSON.stringify(prevRest)) {\n            const next = {\n              ...prevRest,\n              children: [...prevChildren, ...currChildren]\n            };\n            return nextChildren.slice(0, -1).concat(__privateGet(this, _maybeMergeChildren).call(this, next));\n          }\n        }\n        return nextChildren.concat(child);\n      }, []);\n      return node;\n    });\n    __privateSet(this, _createMarkdownNode, (element) => {\n      const node = {\n        ...element.props,\n        type: element.type\n      };\n      if (element.children) node.children = element.children;\n      if (element.value) node.value = element.value;\n      return node;\n    });\n    this.openNode = (type, value, props) => {\n      this.open(SerializerStackElement.create(type, void 0, value, props));\n      return this;\n    };\n    __privateSet(this, _moveSpaces, (element, onPush) => {\n      let startSpaces = \"\";\n      let endSpaces = \"\";\n      const children = element.children;\n      let first = -1;\n      let last = -1;\n      const findIndex = (node) => {\n        if (!node) return;\n        node.forEach((child, index) => {\n          if (child.type === \"text\" && child.value) {\n            if (first < 0) first = index;\n            last = index;\n          }\n        });\n      };\n      if (children) {\n        findIndex(children);\n        const lastChild = children == null ? void 0 : children[last];\n        const firstChild = children == null ? void 0 : children[first];\n        if (lastChild && lastChild.value.endsWith(\" \")) {\n          endSpaces = lastChild.value.match(/ +$/)[0];\n          lastChild.value = lastChild.value.trimEnd();\n        }\n        if (firstChild && firstChild.value.startsWith(\" \")) {\n          startSpaces = firstChild.value.match(/^ +/)[0];\n          firstChild.value = firstChild.value.trimStart();\n        }\n      }\n      if (startSpaces.length) __privateGet(this, _addNodeAndPush2).call(this, \"text\", void 0, startSpaces);\n      const result = onPush();\n      if (endSpaces.length) __privateGet(this, _addNodeAndPush2).call(this, \"text\", void 0, endSpaces);\n      return result;\n    });\n    __privateSet(this, _closeNodeAndPush2, (trim = false) => {\n      const element = this.close();\n      const onPush = () => __privateGet(this, _addNodeAndPush2).call(this, element.type, element.children, element.value, element.props);\n      if (trim) return __privateGet(this, _moveSpaces).call(this, element, onPush);\n      return onPush();\n    });\n    this.closeNode = () => {\n      __privateGet(this, _closeNodeAndPush2).call(this);\n      return this;\n    };\n    __privateSet(this, _addNodeAndPush2, (type, children, value, props) => {\n      const element = SerializerStackElement.create(type, children, value, props);\n      const node = __privateGet(this, _maybeMergeChildren).call(this, __privateGet(this, _createMarkdownNode).call(this, element));\n      this.push(node);\n      return node;\n    });\n    this.addNode = (type, children, value, props) => {\n      __privateGet(this, _addNodeAndPush2).call(this, type, children, value, props);\n      return this;\n    };\n    __privateSet(this, _openMark, (mark, type, value, props) => {\n      const isIn = mark.isInSet(__privateGet(this, _marks2));\n      if (isIn) return this;\n      __privateSet(this, _marks2, mark.addToSet(__privateGet(this, _marks2)));\n      return this.openNode(type, value, { ...props, isMark: true });\n    });\n    __privateSet(this, _closeMark, (mark) => {\n      const isIn = mark.isInSet(__privateGet(this, _marks2));\n      if (!isIn) return;\n      __privateSet(this, _marks2, mark.type.removeFromSet(__privateGet(this, _marks2)));\n      __privateGet(this, _closeNodeAndPush2).call(this, true);\n    });\n    this.withMark = (mark, type, value, props) => {\n      __privateGet(this, _openMark).call(this, mark, type, value, props);\n      return this;\n    };\n    this.closeMark = (mark) => {\n      __privateGet(this, _closeMark).call(this, mark);\n      return this;\n    };\n    this.build = () => {\n      let doc = null;\n      do\n        doc = __privateGet(this, _closeNodeAndPush2).call(this);\n      while (this.size());\n      return doc;\n    };\n    this.next = (nodes) => {\n      if (isFragment(nodes)) {\n        nodes.forEach((node) => {\n          __privateGet(this, _runNode2).call(this, node);\n        });\n        return this;\n      }\n      __privateGet(this, _runNode2).call(this, nodes);\n      return this;\n    };\n    this.toString = (remark) => remark.stringify(this.build());\n    this.run = (tree) => {\n      this.next(tree);\n      return this;\n    };\n    this.schema = schema;\n  }\n};\n_marks2 = new WeakMap();\n_matchTarget2 = new WeakMap();\n_runProseNode = new WeakMap();\n_runProseMark = new WeakMap();\n_runNode2 = new WeakMap();\n_searchType = new WeakMap();\n_maybeMergeChildren = new WeakMap();\n_createMarkdownNode = new WeakMap();\n_moveSpaces = new WeakMap();\n_closeNodeAndPush2 = new WeakMap();\n_addNodeAndPush2 = new WeakMap();\n_openMark = new WeakMap();\n_closeMark = new WeakMap();\n_SerializerState.create = (schema, remark) => {\n  const state = new _SerializerState(schema);\n  return (content) => {\n    state.run(content);\n    return state.toString(remark);\n  };\n};\nlet SerializerState = _SerializerState;\nexport {\n  ParserState,\n  SerializerState,\n  Stack,\n  StackElement\n};\n//# sourceMappingURL=index.es.js.map\n","import { ReplaceError, Slice, Fragment, MarkType, Mark } from 'prosemirror-model';\n\n// Recovery values encode a range index and an offset. They are\n// represented as numbers, because tons of them will be created when\n// mapping, for example, a large number of decorations. The number's\n// lower 16 bits provide the index, the remaining bits the offset.\n//\n// Note: We intentionally don't use bit shift operators to en- and\n// decode these, since those clip to 32 bits, which we might in rare\n// cases want to overflow. A 64-bit float can represent 48-bit\n// integers precisely.\nconst lower16 = 0xffff;\nconst factor16 = Math.pow(2, 16);\nfunction makeRecover(index, offset) { return index + offset * factor16; }\nfunction recoverIndex(value) { return value & lower16; }\nfunction recoverOffset(value) { return (value - (value & lower16)) / factor16; }\nconst DEL_BEFORE = 1, DEL_AFTER = 2, DEL_ACROSS = 4, DEL_SIDE = 8;\n/**\nAn object representing a mapped position with extra\ninformation.\n*/\nclass MapResult {\n    /**\n    @internal\n    */\n    constructor(\n    /**\n    The mapped version of the position.\n    */\n    pos, \n    /**\n    @internal\n    */\n    delInfo, \n    /**\n    @internal\n    */\n    recover) {\n        this.pos = pos;\n        this.delInfo = delInfo;\n        this.recover = recover;\n    }\n    /**\n    Tells you whether the position was deleted, that is, whether the\n    step removed the token on the side queried (via the `assoc`)\n    argument from the document.\n    */\n    get deleted() { return (this.delInfo & DEL_SIDE) > 0; }\n    /**\n    Tells you whether the token before the mapped position was deleted.\n    */\n    get deletedBefore() { return (this.delInfo & (DEL_BEFORE | DEL_ACROSS)) > 0; }\n    /**\n    True when the token after the mapped position was deleted.\n    */\n    get deletedAfter() { return (this.delInfo & (DEL_AFTER | DEL_ACROSS)) > 0; }\n    /**\n    Tells whether any of the steps mapped through deletes across the\n    position (including both the token before and after the\n    position).\n    */\n    get deletedAcross() { return (this.delInfo & DEL_ACROSS) > 0; }\n}\n/**\nA map describing the deletions and insertions made by a step, which\ncan be used to find the correspondence between positions in the\npre-step version of a document and the same position in the\npost-step version.\n*/\nclass StepMap {\n    /**\n    Create a position map. The modifications to the document are\n    represented as an array of numbers, in which each group of three\n    represents a modified chunk as `[start, oldSize, newSize]`.\n    */\n    constructor(\n    /**\n    @internal\n    */\n    ranges, \n    /**\n    @internal\n    */\n    inverted = false) {\n        this.ranges = ranges;\n        this.inverted = inverted;\n        if (!ranges.length && StepMap.empty)\n            return StepMap.empty;\n    }\n    /**\n    @internal\n    */\n    recover(value) {\n        let diff = 0, index = recoverIndex(value);\n        if (!this.inverted)\n            for (let i = 0; i < index; i++)\n                diff += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1];\n        return this.ranges[index * 3] + diff + recoverOffset(value);\n    }\n    mapResult(pos, assoc = 1) { return this._map(pos, assoc, false); }\n    map(pos, assoc = 1) { return this._map(pos, assoc, true); }\n    /**\n    @internal\n    */\n    _map(pos, assoc, simple) {\n        let diff = 0, oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;\n        for (let i = 0; i < this.ranges.length; i += 3) {\n            let start = this.ranges[i] - (this.inverted ? diff : 0);\n            if (start > pos)\n                break;\n            let oldSize = this.ranges[i + oldIndex], newSize = this.ranges[i + newIndex], end = start + oldSize;\n            if (pos <= end) {\n                let side = !oldSize ? assoc : pos == start ? -1 : pos == end ? 1 : assoc;\n                let result = start + diff + (side < 0 ? 0 : newSize);\n                if (simple)\n                    return result;\n                let recover = pos == (assoc < 0 ? start : end) ? null : makeRecover(i / 3, pos - start);\n                let del = pos == start ? DEL_AFTER : pos == end ? DEL_BEFORE : DEL_ACROSS;\n                if (assoc < 0 ? pos != start : pos != end)\n                    del |= DEL_SIDE;\n                return new MapResult(result, del, recover);\n            }\n            diff += newSize - oldSize;\n        }\n        return simple ? pos + diff : new MapResult(pos + diff, 0, null);\n    }\n    /**\n    @internal\n    */\n    touches(pos, recover) {\n        let diff = 0, index = recoverIndex(recover);\n        let oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;\n        for (let i = 0; i < this.ranges.length; i += 3) {\n            let start = this.ranges[i] - (this.inverted ? diff : 0);\n            if (start > pos)\n                break;\n            let oldSize = this.ranges[i + oldIndex], end = start + oldSize;\n            if (pos <= end && i == index * 3)\n                return true;\n            diff += this.ranges[i + newIndex] - oldSize;\n        }\n        return false;\n    }\n    /**\n    Calls the given function on each of the changed ranges included in\n    this map.\n    */\n    forEach(f) {\n        let oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;\n        for (let i = 0, diff = 0; i < this.ranges.length; i += 3) {\n            let start = this.ranges[i], oldStart = start - (this.inverted ? diff : 0), newStart = start + (this.inverted ? 0 : diff);\n            let oldSize = this.ranges[i + oldIndex], newSize = this.ranges[i + newIndex];\n            f(oldStart, oldStart + oldSize, newStart, newStart + newSize);\n            diff += newSize - oldSize;\n        }\n    }\n    /**\n    Create an inverted version of this map. The result can be used to\n    map positions in the post-step document to the pre-step document.\n    */\n    invert() {\n        return new StepMap(this.ranges, !this.inverted);\n    }\n    /**\n    @internal\n    */\n    toString() {\n        return (this.inverted ? \"-\" : \"\") + JSON.stringify(this.ranges);\n    }\n    /**\n    Create a map that moves all positions by offset `n` (which may be\n    negative). This can be useful when applying steps meant for a\n    sub-document to a larger document, or vice-versa.\n    */\n    static offset(n) {\n        return n == 0 ? StepMap.empty : new StepMap(n < 0 ? [0, -n, 0] : [0, 0, n]);\n    }\n}\n/**\nA StepMap that contains no changed ranges.\n*/\nStepMap.empty = new StepMap([]);\n/**\nA mapping represents a pipeline of zero or more [step\nmaps](https://prosemirror.net/docs/ref/#transform.StepMap). It has special provisions for losslessly\nhandling mapping positions through a series of steps in which some\nsteps are inverted versions of earlier steps. (This comes up when\n‘[rebasing](https://prosemirror.net/docs/guide/#transform.rebasing)’ steps for\ncollaboration or history management.)\n*/\nclass Mapping {\n    /**\n    Create a new mapping with the given position maps.\n    */\n    constructor(maps, \n    /**\n    @internal\n    */\n    mirror, \n    /**\n    The starting position in the `maps` array, used when `map` or\n    `mapResult` is called.\n    */\n    from = 0, \n    /**\n    The end position in the `maps` array.\n    */\n    to = maps ? maps.length : 0) {\n        this.mirror = mirror;\n        this.from = from;\n        this.to = to;\n        this._maps = maps || [];\n        this.ownData = !(maps || mirror);\n    }\n    /**\n    The step maps in this mapping.\n    */\n    get maps() { return this._maps; }\n    /**\n    Create a mapping that maps only through a part of this one.\n    */\n    slice(from = 0, to = this.maps.length) {\n        return new Mapping(this._maps, this.mirror, from, to);\n    }\n    /**\n    Add a step map to the end of this mapping. If `mirrors` is\n    given, it should be the index of the step map that is the mirror\n    image of this one.\n    */\n    appendMap(map, mirrors) {\n        if (!this.ownData) {\n            this._maps = this._maps.slice();\n            this.mirror = this.mirror && this.mirror.slice();\n            this.ownData = true;\n        }\n        this.to = this._maps.push(map);\n        if (mirrors != null)\n            this.setMirror(this._maps.length - 1, mirrors);\n    }\n    /**\n    Add all the step maps in a given mapping to this one (preserving\n    mirroring information).\n    */\n    appendMapping(mapping) {\n        for (let i = 0, startSize = this._maps.length; i < mapping._maps.length; i++) {\n            let mirr = mapping.getMirror(i);\n            this.appendMap(mapping._maps[i], mirr != null && mirr < i ? startSize + mirr : undefined);\n        }\n    }\n    /**\n    Finds the offset of the step map that mirrors the map at the\n    given offset, in this mapping (as per the second argument to\n    `appendMap`).\n    */\n    getMirror(n) {\n        if (this.mirror)\n            for (let i = 0; i < this.mirror.length; i++)\n                if (this.mirror[i] == n)\n                    return this.mirror[i + (i % 2 ? -1 : 1)];\n    }\n    /**\n    @internal\n    */\n    setMirror(n, m) {\n        if (!this.mirror)\n            this.mirror = [];\n        this.mirror.push(n, m);\n    }\n    /**\n    Append the inverse of the given mapping to this one.\n    */\n    appendMappingInverted(mapping) {\n        for (let i = mapping.maps.length - 1, totalSize = this._maps.length + mapping._maps.length; i >= 0; i--) {\n            let mirr = mapping.getMirror(i);\n            this.appendMap(mapping._maps[i].invert(), mirr != null && mirr > i ? totalSize - mirr - 1 : undefined);\n        }\n    }\n    /**\n    Create an inverted version of this mapping.\n    */\n    invert() {\n        let inverse = new Mapping;\n        inverse.appendMappingInverted(this);\n        return inverse;\n    }\n    /**\n    Map a position through this mapping.\n    */\n    map(pos, assoc = 1) {\n        if (this.mirror)\n            return this._map(pos, assoc, true);\n        for (let i = this.from; i < this.to; i++)\n            pos = this._maps[i].map(pos, assoc);\n        return pos;\n    }\n    /**\n    Map a position through this mapping, returning a mapping\n    result.\n    */\n    mapResult(pos, assoc = 1) { return this._map(pos, assoc, false); }\n    /**\n    @internal\n    */\n    _map(pos, assoc, simple) {\n        let delInfo = 0;\n        for (let i = this.from; i < this.to; i++) {\n            let map = this._maps[i], result = map.mapResult(pos, assoc);\n            if (result.recover != null) {\n                let corr = this.getMirror(i);\n                if (corr != null && corr > i && corr < this.to) {\n                    i = corr;\n                    pos = this._maps[corr].recover(result.recover);\n                    continue;\n                }\n            }\n            delInfo |= result.delInfo;\n            pos = result.pos;\n        }\n        return simple ? pos : new MapResult(pos, delInfo, null);\n    }\n}\n\nconst stepsByID = Object.create(null);\n/**\nA step object represents an atomic change. It generally applies\nonly to the document it was created for, since the positions\nstored in it will only make sense for that document.\n\nNew steps are defined by creating classes that extend `Step`,\noverriding the `apply`, `invert`, `map`, `getMap` and `fromJSON`\nmethods, and registering your class with a unique\nJSON-serialization identifier using\n[`Step.jsonID`](https://prosemirror.net/docs/ref/#transform.Step^jsonID).\n*/\nclass Step {\n    /**\n    Get the step map that represents the changes made by this step,\n    and which can be used to transform between positions in the old\n    and the new document.\n    */\n    getMap() { return StepMap.empty; }\n    /**\n    Try to merge this step with another one, to be applied directly\n    after it. Returns the merged step when possible, null if the\n    steps can't be merged.\n    */\n    merge(other) { return null; }\n    /**\n    Deserialize a step from its JSON representation. Will call\n    through to the step class' own implementation of this method.\n    */\n    static fromJSON(schema, json) {\n        if (!json || !json.stepType)\n            throw new RangeError(\"Invalid input for Step.fromJSON\");\n        let type = stepsByID[json.stepType];\n        if (!type)\n            throw new RangeError(`No step type ${json.stepType} defined`);\n        return type.fromJSON(schema, json);\n    }\n    /**\n    To be able to serialize steps to JSON, each step needs a string\n    ID to attach to its JSON representation. Use this method to\n    register an ID for your step classes. Try to pick something\n    that's unlikely to clash with steps from other modules.\n    */\n    static jsonID(id, stepClass) {\n        if (id in stepsByID)\n            throw new RangeError(\"Duplicate use of step JSON ID \" + id);\n        stepsByID[id] = stepClass;\n        stepClass.prototype.jsonID = id;\n        return stepClass;\n    }\n}\n/**\nThe result of [applying](https://prosemirror.net/docs/ref/#transform.Step.apply) a step. Contains either a\nnew document or a failure value.\n*/\nclass StepResult {\n    /**\n    @internal\n    */\n    constructor(\n    /**\n    The transformed document, if successful.\n    */\n    doc, \n    /**\n    The failure message, if unsuccessful.\n    */\n    failed) {\n        this.doc = doc;\n        this.failed = failed;\n    }\n    /**\n    Create a successful step result.\n    */\n    static ok(doc) { return new StepResult(doc, null); }\n    /**\n    Create a failed step result.\n    */\n    static fail(message) { return new StepResult(null, message); }\n    /**\n    Call [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) with the given\n    arguments. Create a successful result if it succeeds, and a\n    failed one if it throws a `ReplaceError`.\n    */\n    static fromReplace(doc, from, to, slice) {\n        try {\n            return StepResult.ok(doc.replace(from, to, slice));\n        }\n        catch (e) {\n            if (e instanceof ReplaceError)\n                return StepResult.fail(e.message);\n            throw e;\n        }\n    }\n}\n\nfunction mapFragment(fragment, f, parent) {\n    let mapped = [];\n    for (let i = 0; i < fragment.childCount; i++) {\n        let child = fragment.child(i);\n        if (child.content.size)\n            child = child.copy(mapFragment(child.content, f, child));\n        if (child.isInline)\n            child = f(child, parent, i);\n        mapped.push(child);\n    }\n    return Fragment.fromArray(mapped);\n}\n/**\nAdd a mark to all inline content between two positions.\n*/\nclass AddMarkStep extends Step {\n    /**\n    Create a mark step.\n    */\n    constructor(\n    /**\n    The start of the marked range.\n    */\n    from, \n    /**\n    The end of the marked range.\n    */\n    to, \n    /**\n    The mark to add.\n    */\n    mark) {\n        super();\n        this.from = from;\n        this.to = to;\n        this.mark = mark;\n    }\n    apply(doc) {\n        let oldSlice = doc.slice(this.from, this.to), $from = doc.resolve(this.from);\n        let parent = $from.node($from.sharedDepth(this.to));\n        let slice = new Slice(mapFragment(oldSlice.content, (node, parent) => {\n            if (!node.isAtom || !parent.type.allowsMarkType(this.mark.type))\n                return node;\n            return node.mark(this.mark.addToSet(node.marks));\n        }, parent), oldSlice.openStart, oldSlice.openEnd);\n        return StepResult.fromReplace(doc, this.from, this.to, slice);\n    }\n    invert() {\n        return new RemoveMarkStep(this.from, this.to, this.mark);\n    }\n    map(mapping) {\n        let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);\n        if (from.deleted && to.deleted || from.pos >= to.pos)\n            return null;\n        return new AddMarkStep(from.pos, to.pos, this.mark);\n    }\n    merge(other) {\n        if (other instanceof AddMarkStep &&\n            other.mark.eq(this.mark) &&\n            this.from <= other.to && this.to >= other.from)\n            return new AddMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);\n        return null;\n    }\n    toJSON() {\n        return { stepType: \"addMark\", mark: this.mark.toJSON(),\n            from: this.from, to: this.to };\n    }\n    /**\n    @internal\n    */\n    static fromJSON(schema, json) {\n        if (typeof json.from != \"number\" || typeof json.to != \"number\")\n            throw new RangeError(\"Invalid input for AddMarkStep.fromJSON\");\n        return new AddMarkStep(json.from, json.to, schema.markFromJSON(json.mark));\n    }\n}\nStep.jsonID(\"addMark\", AddMarkStep);\n/**\nRemove a mark from all inline content between two positions.\n*/\nclass RemoveMarkStep extends Step {\n    /**\n    Create a mark-removing step.\n    */\n    constructor(\n    /**\n    The start of the unmarked range.\n    */\n    from, \n    /**\n    The end of the unmarked range.\n    */\n    to, \n    /**\n    The mark to remove.\n    */\n    mark) {\n        super();\n        this.from = from;\n        this.to = to;\n        this.mark = mark;\n    }\n    apply(doc) {\n        let oldSlice = doc.slice(this.from, this.to);\n        let slice = new Slice(mapFragment(oldSlice.content, node => {\n            return node.mark(this.mark.removeFromSet(node.marks));\n        }, doc), oldSlice.openStart, oldSlice.openEnd);\n        return StepResult.fromReplace(doc, this.from, this.to, slice);\n    }\n    invert() {\n        return new AddMarkStep(this.from, this.to, this.mark);\n    }\n    map(mapping) {\n        let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);\n        if (from.deleted && to.deleted || from.pos >= to.pos)\n            return null;\n        return new RemoveMarkStep(from.pos, to.pos, this.mark);\n    }\n    merge(other) {\n        if (other instanceof RemoveMarkStep &&\n            other.mark.eq(this.mark) &&\n            this.from <= other.to && this.to >= other.from)\n            return new RemoveMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);\n        return null;\n    }\n    toJSON() {\n        return { stepType: \"removeMark\", mark: this.mark.toJSON(),\n            from: this.from, to: this.to };\n    }\n    /**\n    @internal\n    */\n    static fromJSON(schema, json) {\n        if (typeof json.from != \"number\" || typeof json.to != \"number\")\n            throw new RangeError(\"Invalid input for RemoveMarkStep.fromJSON\");\n        return new RemoveMarkStep(json.from, json.to, schema.markFromJSON(json.mark));\n    }\n}\nStep.jsonID(\"removeMark\", RemoveMarkStep);\n/**\nAdd a mark to a specific node.\n*/\nclass AddNodeMarkStep extends Step {\n    /**\n    Create a node mark step.\n    */\n    constructor(\n    /**\n    The position of the target node.\n    */\n    pos, \n    /**\n    The mark to add.\n    */\n    mark) {\n        super();\n        this.pos = pos;\n        this.mark = mark;\n    }\n    apply(doc) {\n        let node = doc.nodeAt(this.pos);\n        if (!node)\n            return StepResult.fail(\"No node at mark step's position\");\n        let updated = node.type.create(node.attrs, null, this.mark.addToSet(node.marks));\n        return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1));\n    }\n    invert(doc) {\n        let node = doc.nodeAt(this.pos);\n        if (node) {\n            let newSet = this.mark.addToSet(node.marks);\n            if (newSet.length == node.marks.length) {\n                for (let i = 0; i < node.marks.length; i++)\n                    if (!node.marks[i].isInSet(newSet))\n                        return new AddNodeMarkStep(this.pos, node.marks[i]);\n                return new AddNodeMarkStep(this.pos, this.mark);\n            }\n        }\n        return new RemoveNodeMarkStep(this.pos, this.mark);\n    }\n    map(mapping) {\n        let pos = mapping.mapResult(this.pos, 1);\n        return pos.deletedAfter ? null : new AddNodeMarkStep(pos.pos, this.mark);\n    }\n    toJSON() {\n        return { stepType: \"addNodeMark\", pos: this.pos, mark: this.mark.toJSON() };\n    }\n    /**\n    @internal\n    */\n    static fromJSON(schema, json) {\n        if (typeof json.pos != \"number\")\n            throw new RangeError(\"Invalid input for AddNodeMarkStep.fromJSON\");\n        return new AddNodeMarkStep(json.pos, schema.markFromJSON(json.mark));\n    }\n}\nStep.jsonID(\"addNodeMark\", AddNodeMarkStep);\n/**\nRemove a mark from a specific node.\n*/\nclass RemoveNodeMarkStep extends Step {\n    /**\n    Create a mark-removing step.\n    */\n    constructor(\n    /**\n    The position of the target node.\n    */\n    pos, \n    /**\n    The mark to remove.\n    */\n    mark) {\n        super();\n        this.pos = pos;\n        this.mark = mark;\n    }\n    apply(doc) {\n        let node = doc.nodeAt(this.pos);\n        if (!node)\n            return StepResult.fail(\"No node at mark step's position\");\n        let updated = node.type.create(node.attrs, null, this.mark.removeFromSet(node.marks));\n        return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1));\n    }\n    invert(doc) {\n        let node = doc.nodeAt(this.pos);\n        if (!node || !this.mark.isInSet(node.marks))\n            return this;\n        return new AddNodeMarkStep(this.pos, this.mark);\n    }\n    map(mapping) {\n        let pos = mapping.mapResult(this.pos, 1);\n        return pos.deletedAfter ? null : new RemoveNodeMarkStep(pos.pos, this.mark);\n    }\n    toJSON() {\n        return { stepType: \"removeNodeMark\", pos: this.pos, mark: this.mark.toJSON() };\n    }\n    /**\n    @internal\n    */\n    static fromJSON(schema, json) {\n        if (typeof json.pos != \"number\")\n            throw new RangeError(\"Invalid input for RemoveNodeMarkStep.fromJSON\");\n        return new RemoveNodeMarkStep(json.pos, schema.markFromJSON(json.mark));\n    }\n}\nStep.jsonID(\"removeNodeMark\", RemoveNodeMarkStep);\n\n/**\nReplace a part of the document with a slice of new content.\n*/\nclass ReplaceStep extends Step {\n    /**\n    The given `slice` should fit the 'gap' between `from` and\n    `to`—the depths must line up, and the surrounding nodes must be\n    able to be joined with the open sides of the slice. When\n    `structure` is true, the step will fail if the content between\n    from and to is not just a sequence of closing and then opening\n    tokens (this is to guard against rebased replace steps\n    overwriting something they weren't supposed to).\n    */\n    constructor(\n    /**\n    The start position of the replaced range.\n    */\n    from, \n    /**\n    The end position of the replaced range.\n    */\n    to, \n    /**\n    The slice to insert.\n    */\n    slice, \n    /**\n    @internal\n    */\n    structure = false) {\n        super();\n        this.from = from;\n        this.to = to;\n        this.slice = slice;\n        this.structure = structure;\n    }\n    apply(doc) {\n        if (this.structure && contentBetween(doc, this.from, this.to))\n            return StepResult.fail(\"Structure replace would overwrite content\");\n        return StepResult.fromReplace(doc, this.from, this.to, this.slice);\n    }\n    getMap() {\n        return new StepMap([this.from, this.to - this.from, this.slice.size]);\n    }\n    invert(doc) {\n        return new ReplaceStep(this.from, this.from + this.slice.size, doc.slice(this.from, this.to));\n    }\n    map(mapping) {\n        let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);\n        if (from.deletedAcross && to.deletedAcross)\n            return null;\n        return new ReplaceStep(from.pos, Math.max(from.pos, to.pos), this.slice);\n    }\n    merge(other) {\n        if (!(other instanceof ReplaceStep) || other.structure || this.structure)\n            return null;\n        if (this.from + this.slice.size == other.from && !this.slice.openEnd && !other.slice.openStart) {\n            let slice = this.slice.size + other.slice.size == 0 ? Slice.empty\n                : new Slice(this.slice.content.append(other.slice.content), this.slice.openStart, other.slice.openEnd);\n            return new ReplaceStep(this.from, this.to + (other.to - other.from), slice, this.structure);\n        }\n        else if (other.to == this.from && !this.slice.openStart && !other.slice.openEnd) {\n            let slice = this.slice.size + other.slice.size == 0 ? Slice.empty\n                : new Slice(other.slice.content.append(this.slice.content), other.slice.openStart, this.slice.openEnd);\n            return new ReplaceStep(other.from, this.to, slice, this.structure);\n        }\n        else {\n            return null;\n        }\n    }\n    toJSON() {\n        let json = { stepType: \"replace\", from: this.from, to: this.to };\n        if (this.slice.size)\n            json.slice = this.slice.toJSON();\n        if (this.structure)\n            json.structure = true;\n        return json;\n    }\n    /**\n    @internal\n    */\n    static fromJSON(schema, json) {\n        if (typeof json.from != \"number\" || typeof json.to != \"number\")\n            throw new RangeError(\"Invalid input for ReplaceStep.fromJSON\");\n        return new ReplaceStep(json.from, json.to, Slice.fromJSON(schema, json.slice), !!json.structure);\n    }\n}\nStep.jsonID(\"replace\", ReplaceStep);\n/**\nReplace a part of the document with a slice of content, but\npreserve a range of the replaced content by moving it into the\nslice.\n*/\nclass ReplaceAroundStep extends Step {\n    /**\n    Create a replace-around step with the given range and gap.\n    `insert` should be the point in the slice into which the content\n    of the gap should be moved. `structure` has the same meaning as\n    it has in the [`ReplaceStep`](https://prosemirror.net/docs/ref/#transform.ReplaceStep) class.\n    */\n    constructor(\n    /**\n    The start position of the replaced range.\n    */\n    from, \n    /**\n    The end position of the replaced range.\n    */\n    to, \n    /**\n    The start of preserved range.\n    */\n    gapFrom, \n    /**\n    The end of preserved range.\n    */\n    gapTo, \n    /**\n    The slice to insert.\n    */\n    slice, \n    /**\n    The position in the slice where the preserved range should be\n    inserted.\n    */\n    insert, \n    /**\n    @internal\n    */\n    structure = false) {\n        super();\n        this.from = from;\n        this.to = to;\n        this.gapFrom = gapFrom;\n        this.gapTo = gapTo;\n        this.slice = slice;\n        this.insert = insert;\n        this.structure = structure;\n    }\n    apply(doc) {\n        if (this.structure && (contentBetween(doc, this.from, this.gapFrom) ||\n            contentBetween(doc, this.gapTo, this.to)))\n            return StepResult.fail(\"Structure gap-replace would overwrite content\");\n        let gap = doc.slice(this.gapFrom, this.gapTo);\n        if (gap.openStart || gap.openEnd)\n            return StepResult.fail(\"Gap is not a flat range\");\n        let inserted = this.slice.insertAt(this.insert, gap.content);\n        if (!inserted)\n            return StepResult.fail(\"Content does not fit in gap\");\n        return StepResult.fromReplace(doc, this.from, this.to, inserted);\n    }\n    getMap() {\n        return new StepMap([this.from, this.gapFrom - this.from, this.insert,\n            this.gapTo, this.to - this.gapTo, this.slice.size - this.insert]);\n    }\n    invert(doc) {\n        let gap = this.gapTo - this.gapFrom;\n        return new ReplaceAroundStep(this.from, this.from + this.slice.size + gap, this.from + this.insert, this.from + this.insert + gap, doc.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);\n    }\n    map(mapping) {\n        let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);\n        let gapFrom = this.from == this.gapFrom ? from.pos : mapping.map(this.gapFrom, -1);\n        let gapTo = this.to == this.gapTo ? to.pos : mapping.map(this.gapTo, 1);\n        if ((from.deletedAcross && to.deletedAcross) || gapFrom < from.pos || gapTo > to.pos)\n            return null;\n        return new ReplaceAroundStep(from.pos, to.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);\n    }\n    toJSON() {\n        let json = { stepType: \"replaceAround\", from: this.from, to: this.to,\n            gapFrom: this.gapFrom, gapTo: this.gapTo, insert: this.insert };\n        if (this.slice.size)\n            json.slice = this.slice.toJSON();\n        if (this.structure)\n            json.structure = true;\n        return json;\n    }\n    /**\n    @internal\n    */\n    static fromJSON(schema, json) {\n        if (typeof json.from != \"number\" || typeof json.to != \"number\" ||\n            typeof json.gapFrom != \"number\" || typeof json.gapTo != \"number\" || typeof json.insert != \"number\")\n            throw new RangeError(\"Invalid input for ReplaceAroundStep.fromJSON\");\n        return new ReplaceAroundStep(json.from, json.to, json.gapFrom, json.gapTo, Slice.fromJSON(schema, json.slice), json.insert, !!json.structure);\n    }\n}\nStep.jsonID(\"replaceAround\", ReplaceAroundStep);\nfunction contentBetween(doc, from, to) {\n    let $from = doc.resolve(from), dist = to - from, depth = $from.depth;\n    while (dist > 0 && depth > 0 && $from.indexAfter(depth) == $from.node(depth).childCount) {\n        depth--;\n        dist--;\n    }\n    if (dist > 0) {\n        let next = $from.node(depth).maybeChild($from.indexAfter(depth));\n        while (dist > 0) {\n            if (!next || next.isLeaf)\n                return true;\n            next = next.firstChild;\n            dist--;\n        }\n    }\n    return false;\n}\n\nfunction addMark(tr, from, to, mark) {\n    let removed = [], added = [];\n    let removing, adding;\n    tr.doc.nodesBetween(from, to, (node, pos, parent) => {\n        if (!node.isInline)\n            return;\n        let marks = node.marks;\n        if (!mark.isInSet(marks) && parent.type.allowsMarkType(mark.type)) {\n            let start = Math.max(pos, from), end = Math.min(pos + node.nodeSize, to);\n            let newSet = mark.addToSet(marks);\n            for (let i = 0; i < marks.length; i++) {\n                if (!marks[i].isInSet(newSet)) {\n                    if (removing && removing.to == start && removing.mark.eq(marks[i]))\n                        removing.to = end;\n                    else\n                        removed.push(removing = new RemoveMarkStep(start, end, marks[i]));\n                }\n            }\n            if (adding && adding.to == start)\n                adding.to = end;\n            else\n                added.push(adding = new AddMarkStep(start, end, mark));\n        }\n    });\n    removed.forEach(s => tr.step(s));\n    added.forEach(s => tr.step(s));\n}\nfunction removeMark(tr, from, to, mark) {\n    let matched = [], step = 0;\n    tr.doc.nodesBetween(from, to, (node, pos) => {\n        if (!node.isInline)\n            return;\n        step++;\n        let toRemove = null;\n        if (mark instanceof MarkType) {\n            let set = node.marks, found;\n            while (found = mark.isInSet(set)) {\n                (toRemove || (toRemove = [])).push(found);\n                set = found.removeFromSet(set);\n            }\n        }\n        else if (mark) {\n            if (mark.isInSet(node.marks))\n                toRemove = [mark];\n        }\n        else {\n            toRemove = node.marks;\n        }\n        if (toRemove && toRemove.length) {\n            let end = Math.min(pos + node.nodeSize, to);\n            for (let i = 0; i < toRemove.length; i++) {\n                let style = toRemove[i], found;\n                for (let j = 0; j < matched.length; j++) {\n                    let m = matched[j];\n                    if (m.step == step - 1 && style.eq(matched[j].style))\n                        found = m;\n                }\n                if (found) {\n                    found.to = end;\n                    found.step = step;\n                }\n                else {\n                    matched.push({ style, from: Math.max(pos, from), to: end, step });\n                }\n            }\n        }\n    });\n    matched.forEach(m => tr.step(new RemoveMarkStep(m.from, m.to, m.style)));\n}\nfunction clearIncompatible(tr, pos, parentType, match = parentType.contentMatch, clearNewlines = true) {\n    let node = tr.doc.nodeAt(pos);\n    let replSteps = [], cur = pos + 1;\n    for (let i = 0; i < node.childCount; i++) {\n        let child = node.child(i), end = cur + child.nodeSize;\n        let allowed = match.matchType(child.type);\n        if (!allowed) {\n            replSteps.push(new ReplaceStep(cur, end, Slice.empty));\n        }\n        else {\n            match = allowed;\n            for (let j = 0; j < child.marks.length; j++)\n                if (!parentType.allowsMarkType(child.marks[j].type))\n                    tr.step(new RemoveMarkStep(cur, end, child.marks[j]));\n            if (clearNewlines && child.isText && parentType.whitespace != \"pre\") {\n                let m, newline = /\\r?\\n|\\r/g, slice;\n                while (m = newline.exec(child.text)) {\n                    if (!slice)\n                        slice = new Slice(Fragment.from(parentType.schema.text(\" \", parentType.allowedMarks(child.marks))), 0, 0);\n                    replSteps.push(new ReplaceStep(cur + m.index, cur + m.index + m[0].length, slice));\n                }\n            }\n        }\n        cur = end;\n    }\n    if (!match.validEnd) {\n        let fill = match.fillBefore(Fragment.empty, true);\n        tr.replace(cur, cur, new Slice(fill, 0, 0));\n    }\n    for (let i = replSteps.length - 1; i >= 0; i--)\n        tr.step(replSteps[i]);\n}\n\nfunction canCut(node, start, end) {\n    return (start == 0 || node.canReplace(start, node.childCount)) &&\n        (end == node.childCount || node.canReplace(0, end));\n}\n/**\nTry to find a target depth to which the content in the given range\ncan be lifted. Will not go across\n[isolating](https://prosemirror.net/docs/ref/#model.NodeSpec.isolating) parent nodes.\n*/\nfunction liftTarget(range) {\n    let parent = range.parent;\n    let content = parent.content.cutByIndex(range.startIndex, range.endIndex);\n    for (let depth = range.depth;; --depth) {\n        let node = range.$from.node(depth);\n        let index = range.$from.index(depth), endIndex = range.$to.indexAfter(depth);\n        if (depth < range.depth && node.canReplace(index, endIndex, content))\n            return depth;\n        if (depth == 0 || node.type.spec.isolating || !canCut(node, index, endIndex))\n            break;\n    }\n    return null;\n}\nfunction lift(tr, range, target) {\n    let { $from, $to, depth } = range;\n    let gapStart = $from.before(depth + 1), gapEnd = $to.after(depth + 1);\n    let start = gapStart, end = gapEnd;\n    let before = Fragment.empty, openStart = 0;\n    for (let d = depth, splitting = false; d > target; d--)\n        if (splitting || $from.index(d) > 0) {\n            splitting = true;\n            before = Fragment.from($from.node(d).copy(before));\n            openStart++;\n        }\n        else {\n            start--;\n        }\n    let after = Fragment.empty, openEnd = 0;\n    for (let d = depth, splitting = false; d > target; d--)\n        if (splitting || $to.after(d + 1) < $to.end(d)) {\n            splitting = true;\n            after = Fragment.from($to.node(d).copy(after));\n            openEnd++;\n        }\n        else {\n            end++;\n        }\n    tr.step(new ReplaceAroundStep(start, end, gapStart, gapEnd, new Slice(before.append(after), openStart, openEnd), before.size - openStart, true));\n}\n/**\nTry to find a valid way to wrap the content in the given range in a\nnode of the given type. May introduce extra nodes around and inside\nthe wrapper node, if necessary. Returns null if no valid wrapping\ncould be found. When `innerRange` is given, that range's content is\nused as the content to fit into the wrapping, instead of the\ncontent of `range`.\n*/\nfunction findWrapping(range, nodeType, attrs = null, innerRange = range) {\n    let around = findWrappingOutside(range, nodeType);\n    let inner = around && findWrappingInside(innerRange, nodeType);\n    if (!inner)\n        return null;\n    return around.map(withAttrs)\n        .concat({ type: nodeType, attrs }).concat(inner.map(withAttrs));\n}\nfunction withAttrs(type) { return { type, attrs: null }; }\nfunction findWrappingOutside(range, type) {\n    let { parent, startIndex, endIndex } = range;\n    let around = parent.contentMatchAt(startIndex).findWrapping(type);\n    if (!around)\n        return null;\n    let outer = around.length ? around[0] : type;\n    return parent.canReplaceWith(startIndex, endIndex, outer) ? around : null;\n}\nfunction findWrappingInside(range, type) {\n    let { parent, startIndex, endIndex } = range;\n    let inner = parent.child(startIndex);\n    let inside = type.contentMatch.findWrapping(inner.type);\n    if (!inside)\n        return null;\n    let lastType = inside.length ? inside[inside.length - 1] : type;\n    let innerMatch = lastType.contentMatch;\n    for (let i = startIndex; innerMatch && i < endIndex; i++)\n        innerMatch = innerMatch.matchType(parent.child(i).type);\n    if (!innerMatch || !innerMatch.validEnd)\n        return null;\n    return inside;\n}\nfunction wrap(tr, range, wrappers) {\n    let content = Fragment.empty;\n    for (let i = wrappers.length - 1; i >= 0; i--) {\n        if (content.size) {\n            let match = wrappers[i].type.contentMatch.matchFragment(content);\n            if (!match || !match.validEnd)\n                throw new RangeError(\"Wrapper type given to Transform.wrap does not form valid content of its parent wrapper\");\n        }\n        content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));\n    }\n    let start = range.start, end = range.end;\n    tr.step(new ReplaceAroundStep(start, end, start, end, new Slice(content, 0, 0), wrappers.length, true));\n}\nfunction setBlockType(tr, from, to, type, attrs) {\n    if (!type.isTextblock)\n        throw new RangeError(\"Type given to setBlockType should be a textblock\");\n    let mapFrom = tr.steps.length;\n    tr.doc.nodesBetween(from, to, (node, pos) => {\n        let attrsHere = typeof attrs == \"function\" ? attrs(node) : attrs;\n        if (node.isTextblock && !node.hasMarkup(type, attrsHere) &&\n            canChangeType(tr.doc, tr.mapping.slice(mapFrom).map(pos), type)) {\n            let convertNewlines = null;\n            if (type.schema.linebreakReplacement) {\n                let pre = type.whitespace == \"pre\", supportLinebreak = !!type.contentMatch.matchType(type.schema.linebreakReplacement);\n                if (pre && !supportLinebreak)\n                    convertNewlines = false;\n                else if (!pre && supportLinebreak)\n                    convertNewlines = true;\n            }\n            // Ensure all markup that isn't allowed in the new node type is cleared\n            if (convertNewlines === false)\n                replaceLinebreaks(tr, node, pos, mapFrom);\n            clearIncompatible(tr, tr.mapping.slice(mapFrom).map(pos, 1), type, undefined, convertNewlines === null);\n            let mapping = tr.mapping.slice(mapFrom);\n            let startM = mapping.map(pos, 1), endM = mapping.map(pos + node.nodeSize, 1);\n            tr.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type.create(attrsHere, null, node.marks)), 0, 0), 1, true));\n            if (convertNewlines === true)\n                replaceNewlines(tr, node, pos, mapFrom);\n            return false;\n        }\n    });\n}\nfunction replaceNewlines(tr, node, pos, mapFrom) {\n    node.forEach((child, offset) => {\n        if (child.isText) {\n            let m, newline = /\\r?\\n|\\r/g;\n            while (m = newline.exec(child.text)) {\n                let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset + m.index);\n                tr.replaceWith(start, start + 1, node.type.schema.linebreakReplacement.create());\n            }\n        }\n    });\n}\nfunction replaceLinebreaks(tr, node, pos, mapFrom) {\n    node.forEach((child, offset) => {\n        if (child.type == child.type.schema.linebreakReplacement) {\n            let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset);\n            tr.replaceWith(start, start + 1, node.type.schema.text(\"\\n\"));\n        }\n    });\n}\nfunction canChangeType(doc, pos, type) {\n    let $pos = doc.resolve(pos), index = $pos.index();\n    return $pos.parent.canReplaceWith(index, index + 1, type);\n}\n/**\nChange the type, attributes, and/or marks of the node at `pos`.\nWhen `type` isn't given, the existing node type is preserved,\n*/\nfunction setNodeMarkup(tr, pos, type, attrs, marks) {\n    let node = tr.doc.nodeAt(pos);\n    if (!node)\n        throw new RangeError(\"No node at given position\");\n    if (!type)\n        type = node.type;\n    let newNode = type.create(attrs, null, marks || node.marks);\n    if (node.isLeaf)\n        return tr.replaceWith(pos, pos + node.nodeSize, newNode);\n    if (!type.validContent(node.content))\n        throw new RangeError(\"Invalid content for node type \" + type.name);\n    tr.step(new ReplaceAroundStep(pos, pos + node.nodeSize, pos + 1, pos + node.nodeSize - 1, new Slice(Fragment.from(newNode), 0, 0), 1, true));\n}\n/**\nCheck whether splitting at the given position is allowed.\n*/\nfunction canSplit(doc, pos, depth = 1, typesAfter) {\n    let $pos = doc.resolve(pos), base = $pos.depth - depth;\n    let innerType = (typesAfter && typesAfter[typesAfter.length - 1]) || $pos.parent;\n    if (base < 0 || $pos.parent.type.spec.isolating ||\n        !$pos.parent.canReplace($pos.index(), $pos.parent.childCount) ||\n        !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount)))\n        return false;\n    for (let d = $pos.depth - 1, i = depth - 2; d > base; d--, i--) {\n        let node = $pos.node(d), index = $pos.index(d);\n        if (node.type.spec.isolating)\n            return false;\n        let rest = node.content.cutByIndex(index, node.childCount);\n        let overrideChild = typesAfter && typesAfter[i + 1];\n        if (overrideChild)\n            rest = rest.replaceChild(0, overrideChild.type.create(overrideChild.attrs));\n        let after = (typesAfter && typesAfter[i]) || node;\n        if (!node.canReplace(index + 1, node.childCount) || !after.type.validContent(rest))\n            return false;\n    }\n    let index = $pos.indexAfter(base);\n    let baseType = typesAfter && typesAfter[0];\n    return $pos.node(base).canReplaceWith(index, index, baseType ? baseType.type : $pos.node(base + 1).type);\n}\nfunction split(tr, pos, depth = 1, typesAfter) {\n    let $pos = tr.doc.resolve(pos), before = Fragment.empty, after = Fragment.empty;\n    for (let d = $pos.depth, e = $pos.depth - depth, i = depth - 1; d > e; d--, i--) {\n        before = Fragment.from($pos.node(d).copy(before));\n        let typeAfter = typesAfter && typesAfter[i];\n        after = Fragment.from(typeAfter ? typeAfter.type.create(typeAfter.attrs, after) : $pos.node(d).copy(after));\n    }\n    tr.step(new ReplaceStep(pos, pos, new Slice(before.append(after), depth, depth), true));\n}\n/**\nTest whether the blocks before and after a given position can be\njoined.\n*/\nfunction canJoin(doc, pos) {\n    let $pos = doc.resolve(pos), index = $pos.index();\n    return joinable($pos.nodeBefore, $pos.nodeAfter) &&\n        $pos.parent.canReplace(index, index + 1);\n}\nfunction canAppendWithSubstitutedLinebreaks(a, b) {\n    if (!b.content.size)\n        a.type.compatibleContent(b.type);\n    let match = a.contentMatchAt(a.childCount);\n    let { linebreakReplacement } = a.type.schema;\n    for (let i = 0; i < b.childCount; i++) {\n        let child = b.child(i);\n        let type = child.type == linebreakReplacement ? a.type.schema.nodes.text : child.type;\n        match = match.matchType(type);\n        if (!match)\n            return false;\n        if (!a.type.allowsMarks(child.marks))\n            return false;\n    }\n    return match.validEnd;\n}\nfunction joinable(a, b) {\n    return !!(a && b && !a.isLeaf && canAppendWithSubstitutedLinebreaks(a, b));\n}\n/**\nFind an ancestor of the given position that can be joined to the\nblock before (or after if `dir` is positive). Returns the joinable\npoint, if any.\n*/\nfunction joinPoint(doc, pos, dir = -1) {\n    let $pos = doc.resolve(pos);\n    for (let d = $pos.depth;; d--) {\n        let before, after, index = $pos.index(d);\n        if (d == $pos.depth) {\n            before = $pos.nodeBefore;\n            after = $pos.nodeAfter;\n        }\n        else if (dir > 0) {\n            before = $pos.node(d + 1);\n            index++;\n            after = $pos.node(d).maybeChild(index);\n        }\n        else {\n            before = $pos.node(d).maybeChild(index - 1);\n            after = $pos.node(d + 1);\n        }\n        if (before && !before.isTextblock && joinable(before, after) &&\n            $pos.node(d).canReplace(index, index + 1))\n            return pos;\n        if (d == 0)\n            break;\n        pos = dir < 0 ? $pos.before(d) : $pos.after(d);\n    }\n}\nfunction join(tr, pos, depth) {\n    let convertNewlines = null;\n    let { linebreakReplacement } = tr.doc.type.schema;\n    let $before = tr.doc.resolve(pos - depth), beforeType = $before.node().type;\n    if (linebreakReplacement && beforeType.inlineContent) {\n        let pre = beforeType.whitespace == \"pre\";\n        let supportLinebreak = !!beforeType.contentMatch.matchType(linebreakReplacement);\n        if (pre && !supportLinebreak)\n            convertNewlines = false;\n        else if (!pre && supportLinebreak)\n            convertNewlines = true;\n    }\n    let mapFrom = tr.steps.length;\n    if (convertNewlines === false) {\n        let $after = tr.doc.resolve(pos + depth);\n        replaceLinebreaks(tr, $after.node(), $after.before(), mapFrom);\n    }\n    if (beforeType.inlineContent)\n        clearIncompatible(tr, pos + depth - 1, beforeType, $before.node().contentMatchAt($before.index()), convertNewlines == null);\n    let mapping = tr.mapping.slice(mapFrom), start = mapping.map(pos - depth);\n    tr.step(new ReplaceStep(start, mapping.map(pos + depth, -1), Slice.empty, true));\n    if (convertNewlines === true) {\n        let $full = tr.doc.resolve(start);\n        replaceNewlines(tr, $full.node(), $full.before(), tr.steps.length);\n    }\n    return tr;\n}\n/**\nTry to find a point where a node of the given type can be inserted\nnear `pos`, by searching up the node hierarchy when `pos` itself\nisn't a valid place but is at the start or end of a node. Return\nnull if no position was found.\n*/\nfunction insertPoint(doc, pos, nodeType) {\n    let $pos = doc.resolve(pos);\n    if ($pos.parent.canReplaceWith($pos.index(), $pos.index(), nodeType))\n        return pos;\n    if ($pos.parentOffset == 0)\n        for (let d = $pos.depth - 1; d >= 0; d--) {\n            let index = $pos.index(d);\n            if ($pos.node(d).canReplaceWith(index, index, nodeType))\n                return $pos.before(d + 1);\n            if (index > 0)\n                return null;\n        }\n    if ($pos.parentOffset == $pos.parent.content.size)\n        for (let d = $pos.depth - 1; d >= 0; d--) {\n            let index = $pos.indexAfter(d);\n            if ($pos.node(d).canReplaceWith(index, index, nodeType))\n                return $pos.after(d + 1);\n            if (index < $pos.node(d).childCount)\n                return null;\n        }\n    return null;\n}\n/**\nFinds a position at or around the given position where the given\nslice can be inserted. Will look at parent nodes' nearest boundary\nand try there, even if the original position wasn't directly at the\nstart or end of that node. Returns null when no position was found.\n*/\nfunction dropPoint(doc, pos, slice) {\n    let $pos = doc.resolve(pos);\n    if (!slice.content.size)\n        return pos;\n    let content = slice.content;\n    for (let i = 0; i < slice.openStart; i++)\n        content = content.firstChild.content;\n    for (let pass = 1; pass <= (slice.openStart == 0 && slice.size ? 2 : 1); pass++) {\n        for (let d = $pos.depth; d >= 0; d--) {\n            let bias = d == $pos.depth ? 0 : $pos.pos <= ($pos.start(d + 1) + $pos.end(d + 1)) / 2 ? -1 : 1;\n            let insertPos = $pos.index(d) + (bias > 0 ? 1 : 0);\n            let parent = $pos.node(d), fits = false;\n            if (pass == 1) {\n                fits = parent.canReplace(insertPos, insertPos, content);\n            }\n            else {\n                let wrapping = parent.contentMatchAt(insertPos).findWrapping(content.firstChild.type);\n                fits = wrapping && parent.canReplaceWith(insertPos, insertPos, wrapping[0]);\n            }\n            if (fits)\n                return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d + 1) : $pos.after(d + 1);\n        }\n    }\n    return null;\n}\n\n/**\n‘Fit’ a slice into a given position in the document, producing a\n[step](https://prosemirror.net/docs/ref/#transform.Step) that inserts it. Will return null if\nthere's no meaningful way to insert the slice here, or inserting it\nwould be a no-op (an empty slice over an empty range).\n*/\nfunction replaceStep(doc, from, to = from, slice = Slice.empty) {\n    if (from == to && !slice.size)\n        return null;\n    let $from = doc.resolve(from), $to = doc.resolve(to);\n    // Optimization -- avoid work if it's obvious that it's not needed.\n    if (fitsTrivially($from, $to, slice))\n        return new ReplaceStep(from, to, slice);\n    return new Fitter($from, $to, slice).fit();\n}\nfunction fitsTrivially($from, $to, slice) {\n    return !slice.openStart && !slice.openEnd && $from.start() == $to.start() &&\n        $from.parent.canReplace($from.index(), $to.index(), slice.content);\n}\n// Algorithm for 'placing' the elements of a slice into a gap:\n//\n// We consider the content of each node that is open to the left to be\n// independently placeable. I.e. in <p(\"foo\"), p(\"bar\")>, when the\n// paragraph on the left is open, \"foo\" can be placed (somewhere on\n// the left side of the replacement gap) independently from p(\"bar\").\n//\n// This class tracks the state of the placement progress in the\n// following properties:\n//\n//  - `frontier` holds a stack of `{type, match}` objects that\n//    represent the open side of the replacement. It starts at\n//    `$from`, then moves forward as content is placed, and is finally\n//    reconciled with `$to`.\n//\n//  - `unplaced` is a slice that represents the content that hasn't\n//    been placed yet.\n//\n//  - `placed` is a fragment of placed content. Its open-start value\n//    is implicit in `$from`, and its open-end value in `frontier`.\nclass Fitter {\n    constructor($from, $to, unplaced) {\n        this.$from = $from;\n        this.$to = $to;\n        this.unplaced = unplaced;\n        this.frontier = [];\n        this.placed = Fragment.empty;\n        for (let i = 0; i <= $from.depth; i++) {\n            let node = $from.node(i);\n            this.frontier.push({\n                type: node.type,\n                match: node.contentMatchAt($from.indexAfter(i))\n            });\n        }\n        for (let i = $from.depth; i > 0; i--)\n            this.placed = Fragment.from($from.node(i).copy(this.placed));\n    }\n    get depth() { return this.frontier.length - 1; }\n    fit() {\n        // As long as there's unplaced content, try to place some of it.\n        // If that fails, either increase the open score of the unplaced\n        // slice, or drop nodes from it, and then try again.\n        while (this.unplaced.size) {\n            let fit = this.findFittable();\n            if (fit)\n                this.placeNodes(fit);\n            else\n                this.openMore() || this.dropNode();\n        }\n        // When there's inline content directly after the frontier _and_\n        // directly after `this.$to`, we must generate a `ReplaceAround`\n        // step that pulls that content into the node after the frontier.\n        // That means the fitting must be done to the end of the textblock\n        // node after `this.$to`, not `this.$to` itself.\n        let moveInline = this.mustMoveInline(), placedSize = this.placed.size - this.depth - this.$from.depth;\n        let $from = this.$from, $to = this.close(moveInline < 0 ? this.$to : $from.doc.resolve(moveInline));\n        if (!$to)\n            return null;\n        // If closing to `$to` succeeded, create a step\n        let content = this.placed, openStart = $from.depth, openEnd = $to.depth;\n        while (openStart && openEnd && content.childCount == 1) { // Normalize by dropping open parent nodes\n            content = content.firstChild.content;\n            openStart--;\n            openEnd--;\n        }\n        let slice = new Slice(content, openStart, openEnd);\n        if (moveInline > -1)\n            return new ReplaceAroundStep($from.pos, moveInline, this.$to.pos, this.$to.end(), slice, placedSize);\n        if (slice.size || $from.pos != this.$to.pos) // Don't generate no-op steps\n            return new ReplaceStep($from.pos, $to.pos, slice);\n        return null;\n    }\n    // Find a position on the start spine of `this.unplaced` that has\n    // content that can be moved somewhere on the frontier. Returns two\n    // depths, one for the slice and one for the frontier.\n    findFittable() {\n        let startDepth = this.unplaced.openStart;\n        for (let cur = this.unplaced.content, d = 0, openEnd = this.unplaced.openEnd; d < startDepth; d++) {\n            let node = cur.firstChild;\n            if (cur.childCount > 1)\n                openEnd = 0;\n            if (node.type.spec.isolating && openEnd <= d) {\n                startDepth = d;\n                break;\n            }\n            cur = node.content;\n        }\n        // Only try wrapping nodes (pass 2) after finding a place without\n        // wrapping failed.\n        for (let pass = 1; pass <= 2; pass++) {\n            for (let sliceDepth = pass == 1 ? startDepth : this.unplaced.openStart; sliceDepth >= 0; sliceDepth--) {\n                let fragment, parent = null;\n                if (sliceDepth) {\n                    parent = contentAt(this.unplaced.content, sliceDepth - 1).firstChild;\n                    fragment = parent.content;\n                }\n                else {\n                    fragment = this.unplaced.content;\n                }\n                let first = fragment.firstChild;\n                for (let frontierDepth = this.depth; frontierDepth >= 0; frontierDepth--) {\n                    let { type, match } = this.frontier[frontierDepth], wrap, inject = null;\n                    // In pass 1, if the next node matches, or there is no next\n                    // node but the parents look compatible, we've found a\n                    // place.\n                    if (pass == 1 && (first ? match.matchType(first.type) || (inject = match.fillBefore(Fragment.from(first), false))\n                        : parent && type.compatibleContent(parent.type)))\n                        return { sliceDepth, frontierDepth, parent, inject };\n                    // In pass 2, look for a set of wrapping nodes that make\n                    // `first` fit here.\n                    else if (pass == 2 && first && (wrap = match.findWrapping(first.type)))\n                        return { sliceDepth, frontierDepth, parent, wrap };\n                    // Don't continue looking further up if the parent node\n                    // would fit here.\n                    if (parent && match.matchType(parent.type))\n                        break;\n                }\n            }\n        }\n    }\n    openMore() {\n        let { content, openStart, openEnd } = this.unplaced;\n        let inner = contentAt(content, openStart);\n        if (!inner.childCount || inner.firstChild.isLeaf)\n            return false;\n        this.unplaced = new Slice(content, openStart + 1, Math.max(openEnd, inner.size + openStart >= content.size - openEnd ? openStart + 1 : 0));\n        return true;\n    }\n    dropNode() {\n        let { content, openStart, openEnd } = this.unplaced;\n        let inner = contentAt(content, openStart);\n        if (inner.childCount <= 1 && openStart > 0) {\n            let openAtEnd = content.size - openStart <= openStart + inner.size;\n            this.unplaced = new Slice(dropFromFragment(content, openStart - 1, 1), openStart - 1, openAtEnd ? openStart - 1 : openEnd);\n        }\n        else {\n            this.unplaced = new Slice(dropFromFragment(content, openStart, 1), openStart, openEnd);\n        }\n    }\n    // Move content from the unplaced slice at `sliceDepth` to the\n    // frontier node at `frontierDepth`. Close that frontier node when\n    // applicable.\n    placeNodes({ sliceDepth, frontierDepth, parent, inject, wrap }) {\n        while (this.depth > frontierDepth)\n            this.closeFrontierNode();\n        if (wrap)\n            for (let i = 0; i < wrap.length; i++)\n                this.openFrontierNode(wrap[i]);\n        let slice = this.unplaced, fragment = parent ? parent.content : slice.content;\n        let openStart = slice.openStart - sliceDepth;\n        let taken = 0, add = [];\n        let { match, type } = this.frontier[frontierDepth];\n        if (inject) {\n            for (let i = 0; i < inject.childCount; i++)\n                add.push(inject.child(i));\n            match = match.matchFragment(inject);\n        }\n        // Computes the amount of (end) open nodes at the end of the\n        // fragment. When 0, the parent is open, but no more. When\n        // negative, nothing is open.\n        let openEndCount = (fragment.size + sliceDepth) - (slice.content.size - slice.openEnd);\n        // Scan over the fragment, fitting as many child nodes as\n        // possible.\n        while (taken < fragment.childCount) {\n            let next = fragment.child(taken), matches = match.matchType(next.type);\n            if (!matches)\n                break;\n            taken++;\n            if (taken > 1 || openStart == 0 || next.content.size) { // Drop empty open nodes\n                match = matches;\n                add.push(closeNodeStart(next.mark(type.allowedMarks(next.marks)), taken == 1 ? openStart : 0, taken == fragment.childCount ? openEndCount : -1));\n            }\n        }\n        let toEnd = taken == fragment.childCount;\n        if (!toEnd)\n            openEndCount = -1;\n        this.placed = addToFragment(this.placed, frontierDepth, Fragment.from(add));\n        this.frontier[frontierDepth].match = match;\n        // If the parent types match, and the entire node was moved, and\n        // it's not open, close this frontier node right away.\n        if (toEnd && openEndCount < 0 && parent && parent.type == this.frontier[this.depth].type && this.frontier.length > 1)\n            this.closeFrontierNode();\n        // Add new frontier nodes for any open nodes at the end.\n        for (let i = 0, cur = fragment; i < openEndCount; i++) {\n            let node = cur.lastChild;\n            this.frontier.push({ type: node.type, match: node.contentMatchAt(node.childCount) });\n            cur = node.content;\n        }\n        // Update `this.unplaced`. Drop the entire node from which we\n        // placed it we got to its end, otherwise just drop the placed\n        // nodes.\n        this.unplaced = !toEnd ? new Slice(dropFromFragment(slice.content, sliceDepth, taken), slice.openStart, slice.openEnd)\n            : sliceDepth == 0 ? Slice.empty\n                : new Slice(dropFromFragment(slice.content, sliceDepth - 1, 1), sliceDepth - 1, openEndCount < 0 ? slice.openEnd : sliceDepth - 1);\n    }\n    mustMoveInline() {\n        if (!this.$to.parent.isTextblock)\n            return -1;\n        let top = this.frontier[this.depth], level;\n        if (!top.type.isTextblock || !contentAfterFits(this.$to, this.$to.depth, top.type, top.match, false) ||\n            (this.$to.depth == this.depth && (level = this.findCloseLevel(this.$to)) && level.depth == this.depth))\n            return -1;\n        let { depth } = this.$to, after = this.$to.after(depth);\n        while (depth > 1 && after == this.$to.end(--depth))\n            ++after;\n        return after;\n    }\n    findCloseLevel($to) {\n        scan: for (let i = Math.min(this.depth, $to.depth); i >= 0; i--) {\n            let { match, type } = this.frontier[i];\n            let dropInner = i < $to.depth && $to.end(i + 1) == $to.pos + ($to.depth - (i + 1));\n            let fit = contentAfterFits($to, i, type, match, dropInner);\n            if (!fit)\n                continue;\n            for (let d = i - 1; d >= 0; d--) {\n                let { match, type } = this.frontier[d];\n                let matches = contentAfterFits($to, d, type, match, true);\n                if (!matches || matches.childCount)\n                    continue scan;\n            }\n            return { depth: i, fit, move: dropInner ? $to.doc.resolve($to.after(i + 1)) : $to };\n        }\n    }\n    close($to) {\n        let close = this.findCloseLevel($to);\n        if (!close)\n            return null;\n        while (this.depth > close.depth)\n            this.closeFrontierNode();\n        if (close.fit.childCount)\n            this.placed = addToFragment(this.placed, close.depth, close.fit);\n        $to = close.move;\n        for (let d = close.depth + 1; d <= $to.depth; d++) {\n            let node = $to.node(d), add = node.type.contentMatch.fillBefore(node.content, true, $to.index(d));\n            this.openFrontierNode(node.type, node.attrs, add);\n        }\n        return $to;\n    }\n    openFrontierNode(type, attrs = null, content) {\n        let top = this.frontier[this.depth];\n        top.match = top.match.matchType(type);\n        this.placed = addToFragment(this.placed, this.depth, Fragment.from(type.create(attrs, content)));\n        this.frontier.push({ type, match: type.contentMatch });\n    }\n    closeFrontierNode() {\n        let open = this.frontier.pop();\n        let add = open.match.fillBefore(Fragment.empty, true);\n        if (add.childCount)\n            this.placed = addToFragment(this.placed, this.frontier.length, add);\n    }\n}\nfunction dropFromFragment(fragment, depth, count) {\n    if (depth == 0)\n        return fragment.cutByIndex(count, fragment.childCount);\n    return fragment.replaceChild(0, fragment.firstChild.copy(dropFromFragment(fragment.firstChild.content, depth - 1, count)));\n}\nfunction addToFragment(fragment, depth, content) {\n    if (depth == 0)\n        return fragment.append(content);\n    return fragment.replaceChild(fragment.childCount - 1, fragment.lastChild.copy(addToFragment(fragment.lastChild.content, depth - 1, content)));\n}\nfunction contentAt(fragment, depth) {\n    for (let i = 0; i < depth; i++)\n        fragment = fragment.firstChild.content;\n    return fragment;\n}\nfunction closeNodeStart(node, openStart, openEnd) {\n    if (openStart <= 0)\n        return node;\n    let frag = node.content;\n    if (openStart > 1)\n        frag = frag.replaceChild(0, closeNodeStart(frag.firstChild, openStart - 1, frag.childCount == 1 ? openEnd - 1 : 0));\n    if (openStart > 0) {\n        frag = node.type.contentMatch.fillBefore(frag).append(frag);\n        if (openEnd <= 0)\n            frag = frag.append(node.type.contentMatch.matchFragment(frag).fillBefore(Fragment.empty, true));\n    }\n    return node.copy(frag);\n}\nfunction contentAfterFits($to, depth, type, match, open) {\n    let node = $to.node(depth), index = open ? $to.indexAfter(depth) : $to.index(depth);\n    if (index == node.childCount && !type.compatibleContent(node.type))\n        return null;\n    let fit = match.fillBefore(node.content, true, index);\n    return fit && !invalidMarks(type, node.content, index) ? fit : null;\n}\nfunction invalidMarks(type, fragment, start) {\n    for (let i = start; i < fragment.childCount; i++)\n        if (!type.allowsMarks(fragment.child(i).marks))\n            return true;\n    return false;\n}\nfunction definesContent(type) {\n    return type.spec.defining || type.spec.definingForContent;\n}\nfunction replaceRange(tr, from, to, slice) {\n    if (!slice.size)\n        return tr.deleteRange(from, to);\n    let $from = tr.doc.resolve(from), $to = tr.doc.resolve(to);\n    if (fitsTrivially($from, $to, slice))\n        return tr.step(new ReplaceStep(from, to, slice));\n    let targetDepths = coveredDepths($from, tr.doc.resolve(to));\n    // Can't replace the whole document, so remove 0 if it's present\n    if (targetDepths[targetDepths.length - 1] == 0)\n        targetDepths.pop();\n    // Negative numbers represent not expansion over the whole node at\n    // that depth, but replacing from $from.before(-D) to $to.pos.\n    let preferredTarget = -($from.depth + 1);\n    targetDepths.unshift(preferredTarget);\n    // This loop picks a preferred target depth, if one of the covering\n    // depths is not outside of a defining node, and adds negative\n    // depths for any depth that has $from at its start and does not\n    // cross a defining node.\n    for (let d = $from.depth, pos = $from.pos - 1; d > 0; d--, pos--) {\n        let spec = $from.node(d).type.spec;\n        if (spec.defining || spec.definingAsContext || spec.isolating)\n            break;\n        if (targetDepths.indexOf(d) > -1)\n            preferredTarget = d;\n        else if ($from.before(d) == pos)\n            targetDepths.splice(1, 0, -d);\n    }\n    // Try to fit each possible depth of the slice into each possible\n    // target depth, starting with the preferred depths.\n    let preferredTargetIndex = targetDepths.indexOf(preferredTarget);\n    let leftNodes = [], preferredDepth = slice.openStart;\n    for (let content = slice.content, i = 0;; i++) {\n        let node = content.firstChild;\n        leftNodes.push(node);\n        if (i == slice.openStart)\n            break;\n        content = node.content;\n    }\n    // Back up preferredDepth to cover defining textblocks directly\n    // above it, possibly skipping a non-defining textblock.\n    for (let d = preferredDepth - 1; d >= 0; d--) {\n        let leftNode = leftNodes[d], def = definesContent(leftNode.type);\n        if (def && !leftNode.sameMarkup($from.node(Math.abs(preferredTarget) - 1)))\n            preferredDepth = d;\n        else if (def || !leftNode.type.isTextblock)\n            break;\n    }\n    for (let j = slice.openStart; j >= 0; j--) {\n        let openDepth = (j + preferredDepth + 1) % (slice.openStart + 1);\n        let insert = leftNodes[openDepth];\n        if (!insert)\n            continue;\n        for (let i = 0; i < targetDepths.length; i++) {\n            // Loop over possible expansion levels, starting with the\n            // preferred one\n            let targetDepth = targetDepths[(i + preferredTargetIndex) % targetDepths.length], expand = true;\n            if (targetDepth < 0) {\n                expand = false;\n                targetDepth = -targetDepth;\n            }\n            let parent = $from.node(targetDepth - 1), index = $from.index(targetDepth - 1);\n            if (parent.canReplaceWith(index, index, insert.type, insert.marks))\n                return tr.replace($from.before(targetDepth), expand ? $to.after(targetDepth) : to, new Slice(closeFragment(slice.content, 0, slice.openStart, openDepth), openDepth, slice.openEnd));\n        }\n    }\n    let startSteps = tr.steps.length;\n    for (let i = targetDepths.length - 1; i >= 0; i--) {\n        tr.replace(from, to, slice);\n        if (tr.steps.length > startSteps)\n            break;\n        let depth = targetDepths[i];\n        if (depth < 0)\n            continue;\n        from = $from.before(depth);\n        to = $to.after(depth);\n    }\n}\nfunction closeFragment(fragment, depth, oldOpen, newOpen, parent) {\n    if (depth < oldOpen) {\n        let first = fragment.firstChild;\n        fragment = fragment.replaceChild(0, first.copy(closeFragment(first.content, depth + 1, oldOpen, newOpen, first)));\n    }\n    if (depth > newOpen) {\n        let match = parent.contentMatchAt(0);\n        let start = match.fillBefore(fragment).append(fragment);\n        fragment = start.append(match.matchFragment(start).fillBefore(Fragment.empty, true));\n    }\n    return fragment;\n}\nfunction replaceRangeWith(tr, from, to, node) {\n    if (!node.isInline && from == to && tr.doc.resolve(from).parent.content.size) {\n        let point = insertPoint(tr.doc, from, node.type);\n        if (point != null)\n            from = to = point;\n    }\n    tr.replaceRange(from, to, new Slice(Fragment.from(node), 0, 0));\n}\nfunction deleteRange(tr, from, to) {\n    let $from = tr.doc.resolve(from), $to = tr.doc.resolve(to);\n    let covered = coveredDepths($from, $to);\n    for (let i = 0; i < covered.length; i++) {\n        let depth = covered[i], last = i == covered.length - 1;\n        if ((last && depth == 0) || $from.node(depth).type.contentMatch.validEnd)\n            return tr.delete($from.start(depth), $to.end(depth));\n        if (depth > 0 && (last || $from.node(depth - 1).canReplace($from.index(depth - 1), $to.indexAfter(depth - 1))))\n            return tr.delete($from.before(depth), $to.after(depth));\n    }\n    for (let d = 1; d <= $from.depth && d <= $to.depth; d++) {\n        if (from - $from.start(d) == $from.depth - d && to > $from.end(d) && $to.end(d) - to != $to.depth - d &&\n            $from.start(d - 1) == $to.start(d - 1) && $from.node(d - 1).canReplace($from.index(d - 1), $to.index(d - 1)))\n            return tr.delete($from.before(d), to);\n    }\n    tr.delete(from, to);\n}\n// Returns an array of all depths for which $from - $to spans the\n// whole content of the nodes at that depth.\nfunction coveredDepths($from, $to) {\n    let result = [], minDepth = Math.min($from.depth, $to.depth);\n    for (let d = minDepth; d >= 0; d--) {\n        let start = $from.start(d);\n        if (start < $from.pos - ($from.depth - d) ||\n            $to.end(d) > $to.pos + ($to.depth - d) ||\n            $from.node(d).type.spec.isolating ||\n            $to.node(d).type.spec.isolating)\n            break;\n        if (start == $to.start(d) ||\n            (d == $from.depth && d == $to.depth && $from.parent.inlineContent && $to.parent.inlineContent &&\n                d && $to.start(d - 1) == start - 1))\n            result.push(d);\n    }\n    return result;\n}\n\n/**\nUpdate an attribute in a specific node.\n*/\nclass AttrStep extends Step {\n    /**\n    Construct an attribute step.\n    */\n    constructor(\n    /**\n    The position of the target node.\n    */\n    pos, \n    /**\n    The attribute to set.\n    */\n    attr, \n    // The attribute's new value.\n    value) {\n        super();\n        this.pos = pos;\n        this.attr = attr;\n        this.value = value;\n    }\n    apply(doc) {\n        let node = doc.nodeAt(this.pos);\n        if (!node)\n            return StepResult.fail(\"No node at attribute step's position\");\n        let attrs = Object.create(null);\n        for (let name in node.attrs)\n            attrs[name] = node.attrs[name];\n        attrs[this.attr] = this.value;\n        let updated = node.type.create(attrs, null, node.marks);\n        return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1));\n    }\n    getMap() {\n        return StepMap.empty;\n    }\n    invert(doc) {\n        return new AttrStep(this.pos, this.attr, doc.nodeAt(this.pos).attrs[this.attr]);\n    }\n    map(mapping) {\n        let pos = mapping.mapResult(this.pos, 1);\n        return pos.deletedAfter ? null : new AttrStep(pos.pos, this.attr, this.value);\n    }\n    toJSON() {\n        return { stepType: \"attr\", pos: this.pos, attr: this.attr, value: this.value };\n    }\n    static fromJSON(schema, json) {\n        if (typeof json.pos != \"number\" || typeof json.attr != \"string\")\n            throw new RangeError(\"Invalid input for AttrStep.fromJSON\");\n        return new AttrStep(json.pos, json.attr, json.value);\n    }\n}\nStep.jsonID(\"attr\", AttrStep);\n/**\nUpdate an attribute in the doc node.\n*/\nclass DocAttrStep extends Step {\n    /**\n    Construct an attribute step.\n    */\n    constructor(\n    /**\n    The attribute to set.\n    */\n    attr, \n    // The attribute's new value.\n    value) {\n        super();\n        this.attr = attr;\n        this.value = value;\n    }\n    apply(doc) {\n        let attrs = Object.create(null);\n        for (let name in doc.attrs)\n            attrs[name] = doc.attrs[name];\n        attrs[this.attr] = this.value;\n        let updated = doc.type.create(attrs, doc.content, doc.marks);\n        return StepResult.ok(updated);\n    }\n    getMap() {\n        return StepMap.empty;\n    }\n    invert(doc) {\n        return new DocAttrStep(this.attr, doc.attrs[this.attr]);\n    }\n    map(mapping) {\n        return this;\n    }\n    toJSON() {\n        return { stepType: \"docAttr\", attr: this.attr, value: this.value };\n    }\n    static fromJSON(schema, json) {\n        if (typeof json.attr != \"string\")\n            throw new RangeError(\"Invalid input for DocAttrStep.fromJSON\");\n        return new DocAttrStep(json.attr, json.value);\n    }\n}\nStep.jsonID(\"docAttr\", DocAttrStep);\n\n/**\n@internal\n*/\nlet TransformError = class extends Error {\n};\nTransformError = function TransformError(message) {\n    let err = Error.call(this, message);\n    err.__proto__ = TransformError.prototype;\n    return err;\n};\nTransformError.prototype = Object.create(Error.prototype);\nTransformError.prototype.constructor = TransformError;\nTransformError.prototype.name = \"TransformError\";\n/**\nAbstraction to build up and track an array of\n[steps](https://prosemirror.net/docs/ref/#transform.Step) representing a document transformation.\n\nMost transforming methods return the `Transform` object itself, so\nthat they can be chained.\n*/\nclass Transform {\n    /**\n    Create a transform that starts with the given document.\n    */\n    constructor(\n    /**\n    The current document (the result of applying the steps in the\n    transform).\n    */\n    doc) {\n        this.doc = doc;\n        /**\n        The steps in this transform.\n        */\n        this.steps = [];\n        /**\n        The documents before each of the steps.\n        */\n        this.docs = [];\n        /**\n        A mapping with the maps for each of the steps in this transform.\n        */\n        this.mapping = new Mapping;\n    }\n    /**\n    The starting document.\n    */\n    get before() { return this.docs.length ? this.docs[0] : this.doc; }\n    /**\n    Apply a new step in this transform, saving the result. Throws an\n    error when the step fails.\n    */\n    step(step) {\n        let result = this.maybeStep(step);\n        if (result.failed)\n            throw new TransformError(result.failed);\n        return this;\n    }\n    /**\n    Try to apply a step in this transformation, ignoring it if it\n    fails. Returns the step result.\n    */\n    maybeStep(step) {\n        let result = step.apply(this.doc);\n        if (!result.failed)\n            this.addStep(step, result.doc);\n        return result;\n    }\n    /**\n    True when the document has been changed (when there are any\n    steps).\n    */\n    get docChanged() {\n        return this.steps.length > 0;\n    }\n    /**\n    @internal\n    */\n    addStep(step, doc) {\n        this.docs.push(this.doc);\n        this.steps.push(step);\n        this.mapping.appendMap(step.getMap());\n        this.doc = doc;\n    }\n    /**\n    Replace the part of the document between `from` and `to` with the\n    given `slice`.\n    */\n    replace(from, to = from, slice = Slice.empty) {\n        let step = replaceStep(this.doc, from, to, slice);\n        if (step)\n            this.step(step);\n        return this;\n    }\n    /**\n    Replace the given range with the given content, which may be a\n    fragment, node, or array of nodes.\n    */\n    replaceWith(from, to, content) {\n        return this.replace(from, to, new Slice(Fragment.from(content), 0, 0));\n    }\n    /**\n    Delete the content between the given positions.\n    */\n    delete(from, to) {\n        return this.replace(from, to, Slice.empty);\n    }\n    /**\n    Insert the given content at the given position.\n    */\n    insert(pos, content) {\n        return this.replaceWith(pos, pos, content);\n    }\n    /**\n    Replace a range of the document with a given slice, using\n    `from`, `to`, and the slice's\n    [`openStart`](https://prosemirror.net/docs/ref/#model.Slice.openStart) property as hints, rather\n    than fixed start and end points. This method may grow the\n    replaced area or close open nodes in the slice in order to get a\n    fit that is more in line with WYSIWYG expectations, by dropping\n    fully covered parent nodes of the replaced region when they are\n    marked [non-defining as\n    context](https://prosemirror.net/docs/ref/#model.NodeSpec.definingAsContext), or including an\n    open parent node from the slice that _is_ marked as [defining\n    its content](https://prosemirror.net/docs/ref/#model.NodeSpec.definingForContent).\n    \n    This is the method, for example, to handle paste. The similar\n    [`replace`](https://prosemirror.net/docs/ref/#transform.Transform.replace) method is a more\n    primitive tool which will _not_ move the start and end of its given\n    range, and is useful in situations where you need more precise\n    control over what happens.\n    */\n    replaceRange(from, to, slice) {\n        replaceRange(this, from, to, slice);\n        return this;\n    }\n    /**\n    Replace the given range with a node, but use `from` and `to` as\n    hints, rather than precise positions. When from and to are the same\n    and are at the start or end of a parent node in which the given\n    node doesn't fit, this method may _move_ them out towards a parent\n    that does allow the given node to be placed. When the given range\n    completely covers a parent node, this method may completely replace\n    that parent node.\n    */\n    replaceRangeWith(from, to, node) {\n        replaceRangeWith(this, from, to, node);\n        return this;\n    }\n    /**\n    Delete the given range, expanding it to cover fully covered\n    parent nodes until a valid replace is found.\n    */\n    deleteRange(from, to) {\n        deleteRange(this, from, to);\n        return this;\n    }\n    /**\n    Split the content in the given range off from its parent, if there\n    is sibling content before or after it, and move it up the tree to\n    the depth specified by `target`. You'll probably want to use\n    [`liftTarget`](https://prosemirror.net/docs/ref/#transform.liftTarget) to compute `target`, to make\n    sure the lift is valid.\n    */\n    lift(range, target) {\n        lift(this, range, target);\n        return this;\n    }\n    /**\n    Join the blocks around the given position. If depth is 2, their\n    last and first siblings are also joined, and so on.\n    */\n    join(pos, depth = 1) {\n        join(this, pos, depth);\n        return this;\n    }\n    /**\n    Wrap the given [range](https://prosemirror.net/docs/ref/#model.NodeRange) in the given set of wrappers.\n    The wrappers are assumed to be valid in this position, and should\n    probably be computed with [`findWrapping`](https://prosemirror.net/docs/ref/#transform.findWrapping).\n    */\n    wrap(range, wrappers) {\n        wrap(this, range, wrappers);\n        return this;\n    }\n    /**\n    Set the type of all textblocks (partly) between `from` and `to` to\n    the given node type with the given attributes.\n    */\n    setBlockType(from, to = from, type, attrs = null) {\n        setBlockType(this, from, to, type, attrs);\n        return this;\n    }\n    /**\n    Change the type, attributes, and/or marks of the node at `pos`.\n    When `type` isn't given, the existing node type is preserved,\n    */\n    setNodeMarkup(pos, type, attrs = null, marks) {\n        setNodeMarkup(this, pos, type, attrs, marks);\n        return this;\n    }\n    /**\n    Set a single attribute on a given node to a new value.\n    The `pos` addresses the document content. Use `setDocAttribute`\n    to set attributes on the document itself.\n    */\n    setNodeAttribute(pos, attr, value) {\n        this.step(new AttrStep(pos, attr, value));\n        return this;\n    }\n    /**\n    Set a single attribute on the document to a new value.\n    */\n    setDocAttribute(attr, value) {\n        this.step(new DocAttrStep(attr, value));\n        return this;\n    }\n    /**\n    Add a mark to the node at position `pos`.\n    */\n    addNodeMark(pos, mark) {\n        this.step(new AddNodeMarkStep(pos, mark));\n        return this;\n    }\n    /**\n    Remove a mark (or a mark of the given type) from the node at\n    position `pos`.\n    */\n    removeNodeMark(pos, mark) {\n        if (!(mark instanceof Mark)) {\n            let node = this.doc.nodeAt(pos);\n            if (!node)\n                throw new RangeError(\"No node at position \" + pos);\n            mark = mark.isInSet(node.marks);\n            if (!mark)\n                return this;\n        }\n        this.step(new RemoveNodeMarkStep(pos, mark));\n        return this;\n    }\n    /**\n    Split the node at the given position, and optionally, if `depth` is\n    greater than one, any number of nodes above that. By default, the\n    parts split off will inherit the node type of the original node.\n    This can be changed by passing an array of types and attributes to\n    use after the split (with the outermost nodes coming first).\n    */\n    split(pos, depth = 1, typesAfter) {\n        split(this, pos, depth, typesAfter);\n        return this;\n    }\n    /**\n    Add the given mark to the inline content between `from` and `to`.\n    */\n    addMark(from, to, mark) {\n        addMark(this, from, to, mark);\n        return this;\n    }\n    /**\n    Remove marks from inline nodes between `from` and `to`. When\n    `mark` is a single mark, remove precisely that mark. When it is\n    a mark type, remove all marks of that type. When it is null,\n    remove all marks of any type.\n    */\n    removeMark(from, to, mark) {\n        removeMark(this, from, to, mark);\n        return this;\n    }\n    /**\n    Removes all marks and nodes from the content of the node at\n    `pos` that don't match the given new parent node type. Accepts\n    an optional starting [content match](https://prosemirror.net/docs/ref/#model.ContentMatch) as\n    third argument.\n    */\n    clearIncompatible(pos, parentType, match) {\n        clearIncompatible(this, pos, parentType, match);\n        return this;\n    }\n}\n\nexport { AddMarkStep, AddNodeMarkStep, AttrStep, DocAttrStep, MapResult, Mapping, RemoveMarkStep, RemoveNodeMarkStep, ReplaceAroundStep, ReplaceStep, Step, StepMap, StepResult, Transform, TransformError, canJoin, canSplit, dropPoint, findWrapping, insertPoint, joinPoint, liftTarget, replaceStep };\n","import { Slice, Fragment, Mark, Node } from 'prosemirror-model';\nimport { ReplaceStep, ReplaceAroundStep, Transform } from 'prosemirror-transform';\n\nconst classesById = Object.create(null);\n/**\nSuperclass for editor selections. Every selection type should\nextend this. Should not be instantiated directly.\n*/\nclass Selection {\n    /**\n    Initialize a selection with the head and anchor and ranges. If no\n    ranges are given, constructs a single range across `$anchor` and\n    `$head`.\n    */\n    constructor(\n    /**\n    The resolved anchor of the selection (the side that stays in\n    place when the selection is modified).\n    */\n    $anchor, \n    /**\n    The resolved head of the selection (the side that moves when\n    the selection is modified).\n    */\n    $head, ranges) {\n        this.$anchor = $anchor;\n        this.$head = $head;\n        this.ranges = ranges || [new SelectionRange($anchor.min($head), $anchor.max($head))];\n    }\n    /**\n    The selection's anchor, as an unresolved position.\n    */\n    get anchor() { return this.$anchor.pos; }\n    /**\n    The selection's head.\n    */\n    get head() { return this.$head.pos; }\n    /**\n    The lower bound of the selection's main range.\n    */\n    get from() { return this.$from.pos; }\n    /**\n    The upper bound of the selection's main range.\n    */\n    get to() { return this.$to.pos; }\n    /**\n    The resolved lower  bound of the selection's main range.\n    */\n    get $from() {\n        return this.ranges[0].$from;\n    }\n    /**\n    The resolved upper bound of the selection's main range.\n    */\n    get $to() {\n        return this.ranges[0].$to;\n    }\n    /**\n    Indicates whether the selection contains any content.\n    */\n    get empty() {\n        let ranges = this.ranges;\n        for (let i = 0; i < ranges.length; i++)\n            if (ranges[i].$from.pos != ranges[i].$to.pos)\n                return false;\n        return true;\n    }\n    /**\n    Get the content of this selection as a slice.\n    */\n    content() {\n        return this.$from.doc.slice(this.from, this.to, true);\n    }\n    /**\n    Replace the selection with a slice or, if no slice is given,\n    delete the selection. Will append to the given transaction.\n    */\n    replace(tr, content = Slice.empty) {\n        // Put the new selection at the position after the inserted\n        // content. When that ended in an inline node, search backwards,\n        // to get the position after that node. If not, search forward.\n        let lastNode = content.content.lastChild, lastParent = null;\n        for (let i = 0; i < content.openEnd; i++) {\n            lastParent = lastNode;\n            lastNode = lastNode.lastChild;\n        }\n        let mapFrom = tr.steps.length, ranges = this.ranges;\n        for (let i = 0; i < ranges.length; i++) {\n            let { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);\n            tr.replaceRange(mapping.map($from.pos), mapping.map($to.pos), i ? Slice.empty : content);\n            if (i == 0)\n                selectionToInsertionEnd(tr, mapFrom, (lastNode ? lastNode.isInline : lastParent && lastParent.isTextblock) ? -1 : 1);\n        }\n    }\n    /**\n    Replace the selection with the given node, appending the changes\n    to the given transaction.\n    */\n    replaceWith(tr, node) {\n        let mapFrom = tr.steps.length, ranges = this.ranges;\n        for (let i = 0; i < ranges.length; i++) {\n            let { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);\n            let from = mapping.map($from.pos), to = mapping.map($to.pos);\n            if (i) {\n                tr.deleteRange(from, to);\n            }\n            else {\n                tr.replaceRangeWith(from, to, node);\n                selectionToInsertionEnd(tr, mapFrom, node.isInline ? -1 : 1);\n            }\n        }\n    }\n    /**\n    Find a valid cursor or leaf node selection starting at the given\n    position and searching back if `dir` is negative, and forward if\n    positive. When `textOnly` is true, only consider cursor\n    selections. Will return null when no valid selection position is\n    found.\n    */\n    static findFrom($pos, dir, textOnly = false) {\n        let inner = $pos.parent.inlineContent ? new TextSelection($pos)\n            : findSelectionIn($pos.node(0), $pos.parent, $pos.pos, $pos.index(), dir, textOnly);\n        if (inner)\n            return inner;\n        for (let depth = $pos.depth - 1; depth >= 0; depth--) {\n            let found = dir < 0\n                ? findSelectionIn($pos.node(0), $pos.node(depth), $pos.before(depth + 1), $pos.index(depth), dir, textOnly)\n                : findSelectionIn($pos.node(0), $pos.node(depth), $pos.after(depth + 1), $pos.index(depth) + 1, dir, textOnly);\n            if (found)\n                return found;\n        }\n        return null;\n    }\n    /**\n    Find a valid cursor or leaf node selection near the given\n    position. Searches forward first by default, but if `bias` is\n    negative, it will search backwards first.\n    */\n    static near($pos, bias = 1) {\n        return this.findFrom($pos, bias) || this.findFrom($pos, -bias) || new AllSelection($pos.node(0));\n    }\n    /**\n    Find the cursor or leaf node selection closest to the start of\n    the given document. Will return an\n    [`AllSelection`](https://prosemirror.net/docs/ref/#state.AllSelection) if no valid position\n    exists.\n    */\n    static atStart(doc) {\n        return findSelectionIn(doc, doc, 0, 0, 1) || new AllSelection(doc);\n    }\n    /**\n    Find the cursor or leaf node selection closest to the end of the\n    given document.\n    */\n    static atEnd(doc) {\n        return findSelectionIn(doc, doc, doc.content.size, doc.childCount, -1) || new AllSelection(doc);\n    }\n    /**\n    Deserialize the JSON representation of a selection. Must be\n    implemented for custom classes (as a static class method).\n    */\n    static fromJSON(doc, json) {\n        if (!json || !json.type)\n            throw new RangeError(\"Invalid input for Selection.fromJSON\");\n        let cls = classesById[json.type];\n        if (!cls)\n            throw new RangeError(`No selection type ${json.type} defined`);\n        return cls.fromJSON(doc, json);\n    }\n    /**\n    To be able to deserialize selections from JSON, custom selection\n    classes must register themselves with an ID string, so that they\n    can be disambiguated. Try to pick something that's unlikely to\n    clash with classes from other modules.\n    */\n    static jsonID(id, selectionClass) {\n        if (id in classesById)\n            throw new RangeError(\"Duplicate use of selection JSON ID \" + id);\n        classesById[id] = selectionClass;\n        selectionClass.prototype.jsonID = id;\n        return selectionClass;\n    }\n    /**\n    Get a [bookmark](https://prosemirror.net/docs/ref/#state.SelectionBookmark) for this selection,\n    which is a value that can be mapped without having access to a\n    current document, and later resolved to a real selection for a\n    given document again. (This is used mostly by the history to\n    track and restore old selections.) The default implementation of\n    this method just converts the selection to a text selection and\n    returns the bookmark for that.\n    */\n    getBookmark() {\n        return TextSelection.between(this.$anchor, this.$head).getBookmark();\n    }\n}\nSelection.prototype.visible = true;\n/**\nRepresents a selected range in a document.\n*/\nclass SelectionRange {\n    /**\n    Create a range.\n    */\n    constructor(\n    /**\n    The lower bound of the range.\n    */\n    $from, \n    /**\n    The upper bound of the range.\n    */\n    $to) {\n        this.$from = $from;\n        this.$to = $to;\n    }\n}\nlet warnedAboutTextSelection = false;\nfunction checkTextSelection($pos) {\n    if (!warnedAboutTextSelection && !$pos.parent.inlineContent) {\n        warnedAboutTextSelection = true;\n        console[\"warn\"](\"TextSelection endpoint not pointing into a node with inline content (\" + $pos.parent.type.name + \")\");\n    }\n}\n/**\nA text selection represents a classical editor selection, with a\nhead (the moving side) and anchor (immobile side), both of which\npoint into textblock nodes. It can be empty (a regular cursor\nposition).\n*/\nclass TextSelection extends Selection {\n    /**\n    Construct a text selection between the given points.\n    */\n    constructor($anchor, $head = $anchor) {\n        checkTextSelection($anchor);\n        checkTextSelection($head);\n        super($anchor, $head);\n    }\n    /**\n    Returns a resolved position if this is a cursor selection (an\n    empty text selection), and null otherwise.\n    */\n    get $cursor() { return this.$anchor.pos == this.$head.pos ? this.$head : null; }\n    map(doc, mapping) {\n        let $head = doc.resolve(mapping.map(this.head));\n        if (!$head.parent.inlineContent)\n            return Selection.near($head);\n        let $anchor = doc.resolve(mapping.map(this.anchor));\n        return new TextSelection($anchor.parent.inlineContent ? $anchor : $head, $head);\n    }\n    replace(tr, content = Slice.empty) {\n        super.replace(tr, content);\n        if (content == Slice.empty) {\n            let marks = this.$from.marksAcross(this.$to);\n            if (marks)\n                tr.ensureMarks(marks);\n        }\n    }\n    eq(other) {\n        return other instanceof TextSelection && other.anchor == this.anchor && other.head == this.head;\n    }\n    getBookmark() {\n        return new TextBookmark(this.anchor, this.head);\n    }\n    toJSON() {\n        return { type: \"text\", anchor: this.anchor, head: this.head };\n    }\n    /**\n    @internal\n    */\n    static fromJSON(doc, json) {\n        if (typeof json.anchor != \"number\" || typeof json.head != \"number\")\n            throw new RangeError(\"Invalid input for TextSelection.fromJSON\");\n        return new TextSelection(doc.resolve(json.anchor), doc.resolve(json.head));\n    }\n    /**\n    Create a text selection from non-resolved positions.\n    */\n    static create(doc, anchor, head = anchor) {\n        let $anchor = doc.resolve(anchor);\n        return new this($anchor, head == anchor ? $anchor : doc.resolve(head));\n    }\n    /**\n    Return a text selection that spans the given positions or, if\n    they aren't text positions, find a text selection near them.\n    `bias` determines whether the method searches forward (default)\n    or backwards (negative number) first. Will fall back to calling\n    [`Selection.near`](https://prosemirror.net/docs/ref/#state.Selection^near) when the document\n    doesn't contain a valid text position.\n    */\n    static between($anchor, $head, bias) {\n        let dPos = $anchor.pos - $head.pos;\n        if (!bias || dPos)\n            bias = dPos >= 0 ? 1 : -1;\n        if (!$head.parent.inlineContent) {\n            let found = Selection.findFrom($head, bias, true) || Selection.findFrom($head, -bias, true);\n            if (found)\n                $head = found.$head;\n            else\n                return Selection.near($head, bias);\n        }\n        if (!$anchor.parent.inlineContent) {\n            if (dPos == 0) {\n                $anchor = $head;\n            }\n            else {\n                $anchor = (Selection.findFrom($anchor, -bias, true) || Selection.findFrom($anchor, bias, true)).$anchor;\n                if (($anchor.pos < $head.pos) != (dPos < 0))\n                    $anchor = $head;\n            }\n        }\n        return new TextSelection($anchor, $head);\n    }\n}\nSelection.jsonID(\"text\", TextSelection);\nclass TextBookmark {\n    constructor(anchor, head) {\n        this.anchor = anchor;\n        this.head = head;\n    }\n    map(mapping) {\n        return new TextBookmark(mapping.map(this.anchor), mapping.map(this.head));\n    }\n    resolve(doc) {\n        return TextSelection.between(doc.resolve(this.anchor), doc.resolve(this.head));\n    }\n}\n/**\nA node selection is a selection that points at a single node. All\nnodes marked [selectable](https://prosemirror.net/docs/ref/#model.NodeSpec.selectable) can be the\ntarget of a node selection. In such a selection, `from` and `to`\npoint directly before and after the selected node, `anchor` equals\n`from`, and `head` equals `to`..\n*/\nclass NodeSelection extends Selection {\n    /**\n    Create a node selection. Does not verify the validity of its\n    argument.\n    */\n    constructor($pos) {\n        let node = $pos.nodeAfter;\n        let $end = $pos.node(0).resolve($pos.pos + node.nodeSize);\n        super($pos, $end);\n        this.node = node;\n    }\n    map(doc, mapping) {\n        let { deleted, pos } = mapping.mapResult(this.anchor);\n        let $pos = doc.resolve(pos);\n        if (deleted)\n            return Selection.near($pos);\n        return new NodeSelection($pos);\n    }\n    content() {\n        return new Slice(Fragment.from(this.node), 0, 0);\n    }\n    eq(other) {\n        return other instanceof NodeSelection && other.anchor == this.anchor;\n    }\n    toJSON() {\n        return { type: \"node\", anchor: this.anchor };\n    }\n    getBookmark() { return new NodeBookmark(this.anchor); }\n    /**\n    @internal\n    */\n    static fromJSON(doc, json) {\n        if (typeof json.anchor != \"number\")\n            throw new RangeError(\"Invalid input for NodeSelection.fromJSON\");\n        return new NodeSelection(doc.resolve(json.anchor));\n    }\n    /**\n    Create a node selection from non-resolved positions.\n    */\n    static create(doc, from) {\n        return new NodeSelection(doc.resolve(from));\n    }\n    /**\n    Determines whether the given node may be selected as a node\n    selection.\n    */\n    static isSelectable(node) {\n        return !node.isText && node.type.spec.selectable !== false;\n    }\n}\nNodeSelection.prototype.visible = false;\nSelection.jsonID(\"node\", NodeSelection);\nclass NodeBookmark {\n    constructor(anchor) {\n        this.anchor = anchor;\n    }\n    map(mapping) {\n        let { deleted, pos } = mapping.mapResult(this.anchor);\n        return deleted ? new TextBookmark(pos, pos) : new NodeBookmark(pos);\n    }\n    resolve(doc) {\n        let $pos = doc.resolve(this.anchor), node = $pos.nodeAfter;\n        if (node && NodeSelection.isSelectable(node))\n            return new NodeSelection($pos);\n        return Selection.near($pos);\n    }\n}\n/**\nA selection type that represents selecting the whole document\n(which can not necessarily be expressed with a text selection, when\nthere are for example leaf block nodes at the start or end of the\ndocument).\n*/\nclass AllSelection extends Selection {\n    /**\n    Create an all-selection over the given document.\n    */\n    constructor(doc) {\n        super(doc.resolve(0), doc.resolve(doc.content.size));\n    }\n    replace(tr, content = Slice.empty) {\n        if (content == Slice.empty) {\n            tr.delete(0, tr.doc.content.size);\n            let sel = Selection.atStart(tr.doc);\n            if (!sel.eq(tr.selection))\n                tr.setSelection(sel);\n        }\n        else {\n            super.replace(tr, content);\n        }\n    }\n    toJSON() { return { type: \"all\" }; }\n    /**\n    @internal\n    */\n    static fromJSON(doc) { return new AllSelection(doc); }\n    map(doc) { return new AllSelection(doc); }\n    eq(other) { return other instanceof AllSelection; }\n    getBookmark() { return AllBookmark; }\n}\nSelection.jsonID(\"all\", AllSelection);\nconst AllBookmark = {\n    map() { return this; },\n    resolve(doc) { return new AllSelection(doc); }\n};\n// FIXME we'll need some awareness of text direction when scanning for selections\n// Try to find a selection inside the given node. `pos` points at the\n// position where the search starts. When `text` is true, only return\n// text selections.\nfunction findSelectionIn(doc, node, pos, index, dir, text = false) {\n    if (node.inlineContent)\n        return TextSelection.create(doc, pos);\n    for (let i = index - (dir > 0 ? 0 : 1); dir > 0 ? i < node.childCount : i >= 0; i += dir) {\n        let child = node.child(i);\n        if (!child.isAtom) {\n            let inner = findSelectionIn(doc, child, pos + dir, dir < 0 ? child.childCount : 0, dir, text);\n            if (inner)\n                return inner;\n        }\n        else if (!text && NodeSelection.isSelectable(child)) {\n            return NodeSelection.create(doc, pos - (dir < 0 ? child.nodeSize : 0));\n        }\n        pos += child.nodeSize * dir;\n    }\n    return null;\n}\nfunction selectionToInsertionEnd(tr, startLen, bias) {\n    let last = tr.steps.length - 1;\n    if (last < startLen)\n        return;\n    let step = tr.steps[last];\n    if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep))\n        return;\n    let map = tr.mapping.maps[last], end;\n    map.forEach((_from, _to, _newFrom, newTo) => { if (end == null)\n        end = newTo; });\n    tr.setSelection(Selection.near(tr.doc.resolve(end), bias));\n}\n\nconst UPDATED_SEL = 1, UPDATED_MARKS = 2, UPDATED_SCROLL = 4;\n/**\nAn editor state transaction, which can be applied to a state to\ncreate an updated state. Use\n[`EditorState.tr`](https://prosemirror.net/docs/ref/#state.EditorState.tr) to create an instance.\n\nTransactions track changes to the document (they are a subclass of\n[`Transform`](https://prosemirror.net/docs/ref/#transform.Transform)), but also other state changes,\nlike selection updates and adjustments of the set of [stored\nmarks](https://prosemirror.net/docs/ref/#state.EditorState.storedMarks). In addition, you can store\nmetadata properties in a transaction, which are extra pieces of\ninformation that client code or plugins can use to describe what a\ntransaction represents, so that they can update their [own\nstate](https://prosemirror.net/docs/ref/#state.StateField) accordingly.\n\nThe [editor view](https://prosemirror.net/docs/ref/#view.EditorView) uses a few metadata\nproperties: it will attach a property `\"pointer\"` with the value\n`true` to selection transactions directly caused by mouse or touch\ninput, a `\"composition\"` property holding an ID identifying the\ncomposition that caused it to transactions caused by composed DOM\ninput, and a `\"uiEvent\"` property of that may be `\"paste\"`,\n`\"cut\"`, or `\"drop\"`.\n*/\nclass Transaction extends Transform {\n    /**\n    @internal\n    */\n    constructor(state) {\n        super(state.doc);\n        // The step count for which the current selection is valid.\n        this.curSelectionFor = 0;\n        // Bitfield to track which aspects of the state were updated by\n        // this transaction.\n        this.updated = 0;\n        // Object used to store metadata properties for the transaction.\n        this.meta = Object.create(null);\n        this.time = Date.now();\n        this.curSelection = state.selection;\n        this.storedMarks = state.storedMarks;\n    }\n    /**\n    The transaction's current selection. This defaults to the editor\n    selection [mapped](https://prosemirror.net/docs/ref/#state.Selection.map) through the steps in the\n    transaction, but can be overwritten with\n    [`setSelection`](https://prosemirror.net/docs/ref/#state.Transaction.setSelection).\n    */\n    get selection() {\n        if (this.curSelectionFor < this.steps.length) {\n            this.curSelection = this.curSelection.map(this.doc, this.mapping.slice(this.curSelectionFor));\n            this.curSelectionFor = this.steps.length;\n        }\n        return this.curSelection;\n    }\n    /**\n    Update the transaction's current selection. Will determine the\n    selection that the editor gets when the transaction is applied.\n    */\n    setSelection(selection) {\n        if (selection.$from.doc != this.doc)\n            throw new RangeError(\"Selection passed to setSelection must point at the current document\");\n        this.curSelection = selection;\n        this.curSelectionFor = this.steps.length;\n        this.updated = (this.updated | UPDATED_SEL) & ~UPDATED_MARKS;\n        this.storedMarks = null;\n        return this;\n    }\n    /**\n    Whether the selection was explicitly updated by this transaction.\n    */\n    get selectionSet() {\n        return (this.updated & UPDATED_SEL) > 0;\n    }\n    /**\n    Set the current stored marks.\n    */\n    setStoredMarks(marks) {\n        this.storedMarks = marks;\n        this.updated |= UPDATED_MARKS;\n        return this;\n    }\n    /**\n    Make sure the current stored marks or, if that is null, the marks\n    at the selection, match the given set of marks. Does nothing if\n    this is already the case.\n    */\n    ensureMarks(marks) {\n        if (!Mark.sameSet(this.storedMarks || this.selection.$from.marks(), marks))\n            this.setStoredMarks(marks);\n        return this;\n    }\n    /**\n    Add a mark to the set of stored marks.\n    */\n    addStoredMark(mark) {\n        return this.ensureMarks(mark.addToSet(this.storedMarks || this.selection.$head.marks()));\n    }\n    /**\n    Remove a mark or mark type from the set of stored marks.\n    */\n    removeStoredMark(mark) {\n        return this.ensureMarks(mark.removeFromSet(this.storedMarks || this.selection.$head.marks()));\n    }\n    /**\n    Whether the stored marks were explicitly set for this transaction.\n    */\n    get storedMarksSet() {\n        return (this.updated & UPDATED_MARKS) > 0;\n    }\n    /**\n    @internal\n    */\n    addStep(step, doc) {\n        super.addStep(step, doc);\n        this.updated = this.updated & ~UPDATED_MARKS;\n        this.storedMarks = null;\n    }\n    /**\n    Update the timestamp for the transaction.\n    */\n    setTime(time) {\n        this.time = time;\n        return this;\n    }\n    /**\n    Replace the current selection with the given slice.\n    */\n    replaceSelection(slice) {\n        this.selection.replace(this, slice);\n        return this;\n    }\n    /**\n    Replace the selection with the given node. When `inheritMarks` is\n    true and the content is inline, it inherits the marks from the\n    place where it is inserted.\n    */\n    replaceSelectionWith(node, inheritMarks = true) {\n        let selection = this.selection;\n        if (inheritMarks)\n            node = node.mark(this.storedMarks || (selection.empty ? selection.$from.marks() : (selection.$from.marksAcross(selection.$to) || Mark.none)));\n        selection.replaceWith(this, node);\n        return this;\n    }\n    /**\n    Delete the selection.\n    */\n    deleteSelection() {\n        this.selection.replace(this);\n        return this;\n    }\n    /**\n    Replace the given range, or the selection if no range is given,\n    with a text node containing the given string.\n    */\n    insertText(text, from, to) {\n        let schema = this.doc.type.schema;\n        if (from == null) {\n            if (!text)\n                return this.deleteSelection();\n            return this.replaceSelectionWith(schema.text(text), true);\n        }\n        else {\n            if (to == null)\n                to = from;\n            to = to == null ? from : to;\n            if (!text)\n                return this.deleteRange(from, to);\n            let marks = this.storedMarks;\n            if (!marks) {\n                let $from = this.doc.resolve(from);\n                marks = to == from ? $from.marks() : $from.marksAcross(this.doc.resolve(to));\n            }\n            this.replaceRangeWith(from, to, schema.text(text, marks));\n            if (!this.selection.empty)\n                this.setSelection(Selection.near(this.selection.$to));\n            return this;\n        }\n    }\n    /**\n    Store a metadata property in this transaction, keyed either by\n    name or by plugin.\n    */\n    setMeta(key, value) {\n        this.meta[typeof key == \"string\" ? key : key.key] = value;\n        return this;\n    }\n    /**\n    Retrieve a metadata property for a given name or plugin.\n    */\n    getMeta(key) {\n        return this.meta[typeof key == \"string\" ? key : key.key];\n    }\n    /**\n    Returns true if this transaction doesn't contain any metadata,\n    and can thus safely be extended.\n    */\n    get isGeneric() {\n        for (let _ in this.meta)\n            return false;\n        return true;\n    }\n    /**\n    Indicate that the editor should scroll the selection into view\n    when updated to the state produced by this transaction.\n    */\n    scrollIntoView() {\n        this.updated |= UPDATED_SCROLL;\n        return this;\n    }\n    /**\n    True when this transaction has had `scrollIntoView` called on it.\n    */\n    get scrolledIntoView() {\n        return (this.updated & UPDATED_SCROLL) > 0;\n    }\n}\n\nfunction bind(f, self) {\n    return !self || !f ? f : f.bind(self);\n}\nclass FieldDesc {\n    constructor(name, desc, self) {\n        this.name = name;\n        this.init = bind(desc.init, self);\n        this.apply = bind(desc.apply, self);\n    }\n}\nconst baseFields = [\n    new FieldDesc(\"doc\", {\n        init(config) { return config.doc || config.schema.topNodeType.createAndFill(); },\n        apply(tr) { return tr.doc; }\n    }),\n    new FieldDesc(\"selection\", {\n        init(config, instance) { return config.selection || Selection.atStart(instance.doc); },\n        apply(tr) { return tr.selection; }\n    }),\n    new FieldDesc(\"storedMarks\", {\n        init(config) { return config.storedMarks || null; },\n        apply(tr, _marks, _old, state) { return state.selection.$cursor ? tr.storedMarks : null; }\n    }),\n    new FieldDesc(\"scrollToSelection\", {\n        init() { return 0; },\n        apply(tr, prev) { return tr.scrolledIntoView ? prev + 1 : prev; }\n    })\n];\n// Object wrapping the part of a state object that stays the same\n// across transactions. Stored in the state's `config` property.\nclass Configuration {\n    constructor(schema, plugins) {\n        this.schema = schema;\n        this.plugins = [];\n        this.pluginsByKey = Object.create(null);\n        this.fields = baseFields.slice();\n        if (plugins)\n            plugins.forEach(plugin => {\n                if (this.pluginsByKey[plugin.key])\n                    throw new RangeError(\"Adding different instances of a keyed plugin (\" + plugin.key + \")\");\n                this.plugins.push(plugin);\n                this.pluginsByKey[plugin.key] = plugin;\n                if (plugin.spec.state)\n                    this.fields.push(new FieldDesc(plugin.key, plugin.spec.state, plugin));\n            });\n    }\n}\n/**\nThe state of a ProseMirror editor is represented by an object of\nthis type. A state is a persistent data structure—it isn't\nupdated, but rather a new state value is computed from an old one\nusing the [`apply`](https://prosemirror.net/docs/ref/#state.EditorState.apply) method.\n\nA state holds a number of built-in fields, and plugins can\n[define](https://prosemirror.net/docs/ref/#state.PluginSpec.state) additional fields.\n*/\nclass EditorState {\n    /**\n    @internal\n    */\n    constructor(\n    /**\n    @internal\n    */\n    config) {\n        this.config = config;\n    }\n    /**\n    The schema of the state's document.\n    */\n    get schema() {\n        return this.config.schema;\n    }\n    /**\n    The plugins that are active in this state.\n    */\n    get plugins() {\n        return this.config.plugins;\n    }\n    /**\n    Apply the given transaction to produce a new state.\n    */\n    apply(tr) {\n        return this.applyTransaction(tr).state;\n    }\n    /**\n    @internal\n    */\n    filterTransaction(tr, ignore = -1) {\n        for (let i = 0; i < this.config.plugins.length; i++)\n            if (i != ignore) {\n                let plugin = this.config.plugins[i];\n                if (plugin.spec.filterTransaction && !plugin.spec.filterTransaction.call(plugin, tr, this))\n                    return false;\n            }\n        return true;\n    }\n    /**\n    Verbose variant of [`apply`](https://prosemirror.net/docs/ref/#state.EditorState.apply) that\n    returns the precise transactions that were applied (which might\n    be influenced by the [transaction\n    hooks](https://prosemirror.net/docs/ref/#state.PluginSpec.filterTransaction) of\n    plugins) along with the new state.\n    */\n    applyTransaction(rootTr) {\n        if (!this.filterTransaction(rootTr))\n            return { state: this, transactions: [] };\n        let trs = [rootTr], newState = this.applyInner(rootTr), seen = null;\n        // This loop repeatedly gives plugins a chance to respond to\n        // transactions as new transactions are added, making sure to only\n        // pass the transactions the plugin did not see before.\n        for (;;) {\n            let haveNew = false;\n            for (let i = 0; i < this.config.plugins.length; i++) {\n                let plugin = this.config.plugins[i];\n                if (plugin.spec.appendTransaction) {\n                    let n = seen ? seen[i].n : 0, oldState = seen ? seen[i].state : this;\n                    let tr = n < trs.length &&\n                        plugin.spec.appendTransaction.call(plugin, n ? trs.slice(n) : trs, oldState, newState);\n                    if (tr && newState.filterTransaction(tr, i)) {\n                        tr.setMeta(\"appendedTransaction\", rootTr);\n                        if (!seen) {\n                            seen = [];\n                            for (let j = 0; j < this.config.plugins.length; j++)\n                                seen.push(j < i ? { state: newState, n: trs.length } : { state: this, n: 0 });\n                        }\n                        trs.push(tr);\n                        newState = newState.applyInner(tr);\n                        haveNew = true;\n                    }\n                    if (seen)\n                        seen[i] = { state: newState, n: trs.length };\n                }\n            }\n            if (!haveNew)\n                return { state: newState, transactions: trs };\n        }\n    }\n    /**\n    @internal\n    */\n    applyInner(tr) {\n        if (!tr.before.eq(this.doc))\n            throw new RangeError(\"Applying a mismatched transaction\");\n        let newInstance = new EditorState(this.config), fields = this.config.fields;\n        for (let i = 0; i < fields.length; i++) {\n            let field = fields[i];\n            newInstance[field.name] = field.apply(tr, this[field.name], this, newInstance);\n        }\n        return newInstance;\n    }\n    /**\n    Start a [transaction](https://prosemirror.net/docs/ref/#state.Transaction) from this state.\n    */\n    get tr() { return new Transaction(this); }\n    /**\n    Create a new state.\n    */\n    static create(config) {\n        let $config = new Configuration(config.doc ? config.doc.type.schema : config.schema, config.plugins);\n        let instance = new EditorState($config);\n        for (let i = 0; i < $config.fields.length; i++)\n            instance[$config.fields[i].name] = $config.fields[i].init(config, instance);\n        return instance;\n    }\n    /**\n    Create a new state based on this one, but with an adjusted set\n    of active plugins. State fields that exist in both sets of\n    plugins are kept unchanged. Those that no longer exist are\n    dropped, and those that are new are initialized using their\n    [`init`](https://prosemirror.net/docs/ref/#state.StateField.init) method, passing in the new\n    configuration object..\n    */\n    reconfigure(config) {\n        let $config = new Configuration(this.schema, config.plugins);\n        let fields = $config.fields, instance = new EditorState($config);\n        for (let i = 0; i < fields.length; i++) {\n            let name = fields[i].name;\n            instance[name] = this.hasOwnProperty(name) ? this[name] : fields[i].init(config, instance);\n        }\n        return instance;\n    }\n    /**\n    Serialize this state to JSON. If you want to serialize the state\n    of plugins, pass an object mapping property names to use in the\n    resulting JSON object to plugin objects. The argument may also be\n    a string or number, in which case it is ignored, to support the\n    way `JSON.stringify` calls `toString` methods.\n    */\n    toJSON(pluginFields) {\n        let result = { doc: this.doc.toJSON(), selection: this.selection.toJSON() };\n        if (this.storedMarks)\n            result.storedMarks = this.storedMarks.map(m => m.toJSON());\n        if (pluginFields && typeof pluginFields == 'object')\n            for (let prop in pluginFields) {\n                if (prop == \"doc\" || prop == \"selection\")\n                    throw new RangeError(\"The JSON fields `doc` and `selection` are reserved\");\n                let plugin = pluginFields[prop], state = plugin.spec.state;\n                if (state && state.toJSON)\n                    result[prop] = state.toJSON.call(plugin, this[plugin.key]);\n            }\n        return result;\n    }\n    /**\n    Deserialize a JSON representation of a state. `config` should\n    have at least a `schema` field, and should contain array of\n    plugins to initialize the state with. `pluginFields` can be used\n    to deserialize the state of plugins, by associating plugin\n    instances with the property names they use in the JSON object.\n    */\n    static fromJSON(config, json, pluginFields) {\n        if (!json)\n            throw new RangeError(\"Invalid input for EditorState.fromJSON\");\n        if (!config.schema)\n            throw new RangeError(\"Required config field 'schema' missing\");\n        let $config = new Configuration(config.schema, config.plugins);\n        let instance = new EditorState($config);\n        $config.fields.forEach(field => {\n            if (field.name == \"doc\") {\n                instance.doc = Node.fromJSON(config.schema, json.doc);\n            }\n            else if (field.name == \"selection\") {\n                instance.selection = Selection.fromJSON(instance.doc, json.selection);\n            }\n            else if (field.name == \"storedMarks\") {\n                if (json.storedMarks)\n                    instance.storedMarks = json.storedMarks.map(config.schema.markFromJSON);\n            }\n            else {\n                if (pluginFields)\n                    for (let prop in pluginFields) {\n                        let plugin = pluginFields[prop], state = plugin.spec.state;\n                        if (plugin.key == field.name && state && state.fromJSON &&\n                            Object.prototype.hasOwnProperty.call(json, prop)) {\n                            instance[field.name] = state.fromJSON.call(plugin, config, json[prop], instance);\n                            return;\n                        }\n                    }\n                instance[field.name] = field.init(config, instance);\n            }\n        });\n        return instance;\n    }\n}\n\nfunction bindProps(obj, self, target) {\n    for (let prop in obj) {\n        let val = obj[prop];\n        if (val instanceof Function)\n            val = val.bind(self);\n        else if (prop == \"handleDOMEvents\")\n            val = bindProps(val, self, {});\n        target[prop] = val;\n    }\n    return target;\n}\n/**\nPlugins bundle functionality that can be added to an editor.\nThey are part of the [editor state](https://prosemirror.net/docs/ref/#state.EditorState) and\nmay influence that state and the view that contains it.\n*/\nclass Plugin {\n    /**\n    Create a plugin.\n    */\n    constructor(\n    /**\n    The plugin's [spec object](https://prosemirror.net/docs/ref/#state.PluginSpec).\n    */\n    spec) {\n        this.spec = spec;\n        /**\n        The [props](https://prosemirror.net/docs/ref/#view.EditorProps) exported by this plugin.\n        */\n        this.props = {};\n        if (spec.props)\n            bindProps(spec.props, this, this.props);\n        this.key = spec.key ? spec.key.key : createKey(\"plugin\");\n    }\n    /**\n    Extract the plugin's state field from an editor state.\n    */\n    getState(state) { return state[this.key]; }\n}\nconst keys = Object.create(null);\nfunction createKey(name) {\n    if (name in keys)\n        return name + \"$\" + ++keys[name];\n    keys[name] = 0;\n    return name + \"$\";\n}\n/**\nA key is used to [tag](https://prosemirror.net/docs/ref/#state.PluginSpec.key) plugins in a way\nthat makes it possible to find them, given an editor state.\nAssigning a key does mean only one plugin of that type can be\nactive in a state.\n*/\nclass PluginKey {\n    /**\n    Create a plugin key.\n    */\n    constructor(name = \"key\") { this.key = createKey(name); }\n    /**\n    Get the active plugin with this key, if any, from an editor\n    state.\n    */\n    get(state) { return state.config.pluginsByKey[this.key]; }\n    /**\n    Get the plugin's state from an editor state.\n    */\n    getState(state) { return state[this.key]; }\n}\n\nexport { AllSelection, EditorState, NodeSelection, Plugin, PluginKey, Selection, SelectionRange, TextSelection, Transaction };\n","import { Plugin } from 'prosemirror-state';\nimport { findWrapping, canJoin } from 'prosemirror-transform';\n\n/**\nInput rules are regular expressions describing a piece of text\nthat, when typed, causes something to happen. This might be\nchanging two dashes into an emdash, wrapping a paragraph starting\nwith `\"> \"` into a blockquote, or something entirely different.\n*/\nclass InputRule {\n    /**\n    Create an input rule. The rule applies when the user typed\n    something and the text directly in front of the cursor matches\n    `match`, which should end with `$`.\n    \n    The `handler` can be a string, in which case the matched text, or\n    the first matched group in the regexp, is replaced by that\n    string.\n    \n    Or a it can be a function, which will be called with the match\n    array produced by\n    [`RegExp.exec`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec),\n    as well as the start and end of the matched range, and which can\n    return a [transaction](https://prosemirror.net/docs/ref/#state.Transaction) that describes the\n    rule's effect, or null to indicate the input was not handled.\n    */\n    constructor(\n    /**\n    @internal\n    */\n    match, handler, options = {}) {\n        this.match = match;\n        this.match = match;\n        this.handler = typeof handler == \"string\" ? stringHandler(handler) : handler;\n        this.undoable = options.undoable !== false;\n        this.inCode = options.inCode || false;\n        this.inCodeMark = options.inCodeMark !== false;\n    }\n}\nfunction stringHandler(string) {\n    return function (state, match, start, end) {\n        let insert = string;\n        if (match[1]) {\n            let offset = match[0].lastIndexOf(match[1]);\n            insert += match[0].slice(offset + match[1].length);\n            start += offset;\n            let cutOff = start - end;\n            if (cutOff > 0) {\n                insert = match[0].slice(offset - cutOff, offset) + insert;\n                start = end;\n            }\n        }\n        return state.tr.insertText(insert, start, end);\n    };\n}\nconst MAX_MATCH = 500;\n/**\nCreate an input rules plugin. When enabled, it will cause text\ninput that matches any of the given rules to trigger the rule's\naction.\n*/\nfunction inputRules({ rules }) {\n    let plugin = new Plugin({\n        state: {\n            init() { return null; },\n            apply(tr, prev) {\n                let stored = tr.getMeta(this);\n                if (stored)\n                    return stored;\n                return tr.selectionSet || tr.docChanged ? null : prev;\n            }\n        },\n        props: {\n            handleTextInput(view, from, to, text) {\n                return run(view, from, to, text, rules, plugin);\n            },\n            handleDOMEvents: {\n                compositionend: (view) => {\n                    setTimeout(() => {\n                        let { $cursor } = view.state.selection;\n                        if ($cursor)\n                            run(view, $cursor.pos, $cursor.pos, \"\", rules, plugin);\n                    });\n                }\n            }\n        },\n        isInputRules: true\n    });\n    return plugin;\n}\nfunction run(view, from, to, text, rules, plugin) {\n    if (view.composing)\n        return false;\n    let state = view.state, $from = state.doc.resolve(from);\n    let textBefore = $from.parent.textBetween(Math.max(0, $from.parentOffset - MAX_MATCH), $from.parentOffset, null, \"\\ufffc\") + text;\n    for (let i = 0; i < rules.length; i++) {\n        let rule = rules[i];\n        if (!rule.inCodeMark && $from.marks().some(m => m.type.spec.code))\n            continue;\n        if ($from.parent.type.spec.code) {\n            if (!rule.inCode)\n                continue;\n        }\n        else if (rule.inCode === \"only\") {\n            continue;\n        }\n        let match = rule.match.exec(textBefore);\n        let tr = match && match[0].length >= text.length &&\n            rule.handler(state, match, from - (match[0].length - text.length), to);\n        if (!tr)\n            continue;\n        if (rule.undoable)\n            tr.setMeta(plugin, { transform: tr, from, to, text });\n        view.dispatch(tr);\n        return true;\n    }\n    return false;\n}\n/**\nThis is a command that will undo an input rule, if applying such a\nrule was the last thing that the user did.\n*/\nconst undoInputRule = (state, dispatch) => {\n    let plugins = state.plugins;\n    for (let i = 0; i < plugins.length; i++) {\n        let plugin = plugins[i], undoable;\n        if (plugin.spec.isInputRules && (undoable = plugin.getState(state))) {\n            if (dispatch) {\n                let tr = state.tr, toUndo = undoable.transform;\n                for (let j = toUndo.steps.length - 1; j >= 0; j--)\n                    tr.step(toUndo.steps[j].invert(toUndo.docs[j]));\n                if (undoable.text) {\n                    let marks = tr.doc.resolve(undoable.from).marks();\n                    tr.replaceWith(undoable.from, undoable.to, state.schema.text(undoable.text, marks));\n                }\n                else {\n                    tr.delete(undoable.from, undoable.to);\n                }\n                dispatch(tr);\n            }\n            return true;\n        }\n    }\n    return false;\n};\n\n/**\nConverts double dashes to an emdash.\n*/\nconst emDash = new InputRule(/--$/, \"—\", { inCodeMark: false });\n/**\nConverts three dots to an ellipsis character.\n*/\nconst ellipsis = new InputRule(/\\.\\.\\.$/, \"…\", { inCodeMark: false });\n/**\n“Smart” opening double quotes.\n*/\nconst openDoubleQuote = new InputRule(/(?:^|[\\s\\{\\[\\(\\<'\"\\u2018\\u201C])(\")$/, \"“\", { inCodeMark: false });\n/**\n“Smart” closing double quotes.\n*/\nconst closeDoubleQuote = new InputRule(/\"$/, \"”\", { inCodeMark: false });\n/**\n“Smart” opening single quotes.\n*/\nconst openSingleQuote = new InputRule(/(?:^|[\\s\\{\\[\\(\\<'\"\\u2018\\u201C])(')$/, \"‘\", { inCodeMark: false });\n/**\n“Smart” closing single quotes.\n*/\nconst closeSingleQuote = new InputRule(/'$/, \"’\", { inCodeMark: false });\n/**\nSmart-quote related input rules.\n*/\nconst smartQuotes = [openDoubleQuote, closeDoubleQuote, openSingleQuote, closeSingleQuote];\n\n/**\nBuild an input rule for automatically wrapping a textblock when a\ngiven string is typed. The `regexp` argument is\ndirectly passed through to the `InputRule` constructor. You'll\nprobably want the regexp to start with `^`, so that the pattern can\nonly occur at the start of a textblock.\n\n`nodeType` is the type of node to wrap in. If it needs attributes,\nyou can either pass them directly, or pass a function that will\ncompute them from the regular expression match.\n\nBy default, if there's a node with the same type above the newly\nwrapped node, the rule will try to [join](https://prosemirror.net/docs/ref/#transform.Transform.join) those\ntwo nodes. You can pass a join predicate, which takes a regular\nexpression match and the node before the wrapped node, and can\nreturn a boolean to indicate whether a join should happen.\n*/\nfunction wrappingInputRule(regexp, nodeType, getAttrs = null, joinPredicate) {\n    return new InputRule(regexp, (state, match, start, end) => {\n        let attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;\n        let tr = state.tr.delete(start, end);\n        let $start = tr.doc.resolve(start), range = $start.blockRange(), wrapping = range && findWrapping(range, nodeType, attrs);\n        if (!wrapping)\n            return null;\n        tr.wrap(range, wrapping);\n        let before = tr.doc.resolve(start - 1).nodeBefore;\n        if (before && before.type == nodeType && canJoin(tr.doc, start - 1) &&\n            (!joinPredicate || joinPredicate(match, before)))\n            tr.join(start - 1);\n        return tr;\n    });\n}\n/**\nBuild an input rule that changes the type of a textblock when the\nmatched text is typed into it. You'll usually want to start your\nregexp with `^` to that it is only matched at the start of a\ntextblock. The optional `getAttrs` parameter can be used to compute\nthe new node's attributes, and works the same as in the\n`wrappingInputRule` function.\n*/\nfunction textblockTypeInputRule(regexp, nodeType, getAttrs = null) {\n    return new InputRule(regexp, (state, match, start, end) => {\n        let $start = state.doc.resolve(start);\n        let attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;\n        if (!$start.node(-1).canReplaceWith($start.index(-1), $start.indexAfter(-1), nodeType))\n            return null;\n        return state.tr\n            .delete(start, end)\n            .setBlockType(start, start, nodeType, attrs);\n    });\n}\n\nexport { InputRule, closeDoubleQuote, closeSingleQuote, ellipsis, emDash, inputRules, openDoubleQuote, openSingleQuote, smartQuotes, textblockTypeInputRule, undoInputRule, wrappingInputRule };\n","import { PluginKey, Plugin, NodeSelection } from 'prosemirror-state';\nimport { InputRule } from 'prosemirror-inputrules';\nimport { expectDomTypeError, missingRootElement, getAtomFromSchemaFail } from '@milkdown/exception';\n\nconst nav = typeof navigator != \"undefined\" ? navigator : null;\nconst doc = typeof document != \"undefined\" ? document : null;\nconst agent = nav && nav.userAgent || \"\";\nconst ie_edge = /Edge\\/(\\d+)/.exec(agent);\nconst ie_upto10 = /MSIE \\d/.exec(agent);\nconst ie_11up = /Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(agent);\nconst ie = !!(ie_upto10 || ie_11up || ie_edge);\nconst ie_version = ie_upto10 ? document.documentMode : ie_11up ? +ie_11up[1] : ie_edge ? +ie_edge[1] : 0;\nconst gecko = !ie && /gecko\\/(\\d+)/i.test(agent);\nconst gecko_version = gecko && +(/Firefox\\/(\\d+)/.exec(agent) || [0, 0])[1];\nconst _chrome = !ie && /Chrome\\/(\\d+)/.exec(agent);\nconst chrome = !!_chrome;\nconst chrome_version = _chrome ? +_chrome[1] : 0;\nconst safari = !ie && !!nav && /Apple Computer/.test(nav.vendor);\nconst ios = safari && (/Mobile\\/\\w+/.test(agent) || !!nav && nav.maxTouchPoints > 2);\nconst mac = ios || (nav ? /Mac/.test(nav.platform) : false);\nconst android = /Android \\d/.test(agent);\nconst webkit = !!doc && \"webkitFontSmoothing\" in doc.documentElement.style;\nconst webkit_version = webkit ? +(/\\bAppleWebKit\\/(\\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;\n\nvar browser = /*#__PURE__*/Object.freeze({\n  __proto__: null,\n  android: android,\n  chrome: chrome,\n  chrome_version: chrome_version,\n  gecko: gecko,\n  gecko_version: gecko_version,\n  ie: ie,\n  ie_version: ie_version,\n  ios: ios,\n  mac: mac,\n  safari: safari,\n  webkit: webkit,\n  webkit_version: webkit_version\n});\n\nfunction run(view, from, to, text, rules, plugin) {\n  if (view.composing) return false;\n  const state = view.state;\n  const $from = state.doc.resolve(from);\n  if ($from.parent.type.spec.code) return false;\n  const textBefore = $from.parent.textBetween(\n    Math.max(0, $from.parentOffset - 500),\n    $from.parentOffset,\n    void 0,\n    \"\\uFFFC\"\n  ) + text;\n  for (let _matcher of rules) {\n    const matcher = _matcher;\n    const match = matcher.match.exec(textBefore);\n    const tr = match && match[0] && matcher.handler(state, match, from - (match[0].length - text.length), to);\n    if (!tr) continue;\n    if (matcher.undoable !== false)\n      tr.setMeta(plugin, { transform: tr, from, to, text });\n    view.dispatch(tr);\n    return true;\n  }\n  return false;\n}\nconst customInputRulesKey = new PluginKey(\"MILKDOWN_CUSTOM_INPUTRULES\");\nfunction customInputRules({ rules }) {\n  const plugin = new Plugin({\n    key: customInputRulesKey,\n    isInputRules: true,\n    state: {\n      init() {\n        return null;\n      },\n      apply(tr, prev) {\n        const stored = tr.getMeta(this);\n        if (stored) return stored;\n        return tr.selectionSet || tr.docChanged ? null : prev;\n      }\n    },\n    props: {\n      handleTextInput(view, from, to, text) {\n        return run(view, from, to, text, rules, plugin);\n      },\n      handleDOMEvents: {\n        compositionend: (view) => {\n          setTimeout(() => {\n            const { $cursor } = view.state.selection;\n            if ($cursor) run(view, $cursor.pos, $cursor.pos, \"\", rules, plugin);\n          });\n          return false;\n        }\n      },\n      handleKeyDown(view, event) {\n        if (event.key !== \"Enter\") return false;\n        const { $cursor } = view.state.selection;\n        if ($cursor)\n          return run(view, $cursor.pos, $cursor.pos, \"\\n\", rules, plugin);\n        return false;\n      }\n    }\n  });\n  return plugin;\n}\n\nfunction markRule(regexp, markType, options = {}) {\n  return new InputRule(regexp, (state, match, start, end) => {\n    var _a, _b, _c, _d;\n    const { tr } = state;\n    const matchLength = match.length;\n    let group = match[matchLength - 1];\n    let fullMatch = match[0];\n    let initialStoredMarks = [];\n    let markEnd = end;\n    const captured = {\n      group,\n      fullMatch,\n      start,\n      end\n    };\n    const result = (_a = options.updateCaptured) == null ? void 0 : _a.call(options, captured);\n    Object.assign(captured, result);\n    ({ group, fullMatch, start, end } = captured);\n    if (fullMatch === null) return null;\n    if ((group == null ? void 0 : group.trim()) === \"\") return null;\n    if (group) {\n      const startSpaces = fullMatch.search(/\\S/);\n      const textStart = start + fullMatch.indexOf(group);\n      const textEnd = textStart + group.length;\n      initialStoredMarks = (_b = tr.storedMarks) != null ? _b : [];\n      if (textEnd < end) tr.delete(textEnd, end);\n      if (textStart > start) tr.delete(start + startSpaces, textStart);\n      markEnd = start + startSpaces + group.length;\n      const attrs = (_c = options.getAttr) == null ? void 0 : _c.call(options, match);\n      tr.addMark(start, markEnd, markType.create(attrs));\n      tr.setStoredMarks(initialStoredMarks);\n      (_d = options.beforeDispatch) == null ? void 0 : _d.call(options, { match, start, end, tr });\n    }\n    return tr;\n  });\n}\n\nfunction nodeRule(regexp, nodeType, options = {}) {\n  return new InputRule(regexp, (state, match, start, end) => {\n    var _a, _b, _c;\n    const { tr } = state;\n    let group = match[1];\n    let fullMatch = match[0];\n    const captured = {\n      group,\n      fullMatch,\n      start,\n      end\n    };\n    const result = (_a = options.updateCaptured) == null ? void 0 : _a.call(options, captured);\n    Object.assign(captured, result);\n    ({ group, fullMatch, start, end } = captured);\n    if (fullMatch === null) return null;\n    if (!group || group.trim() === \"\") return null;\n    const attrs = (_b = options.getAttr) == null ? void 0 : _b.call(options, match);\n    const node = nodeType.createAndFill(attrs);\n    if (node) {\n      tr.replaceRangeWith(\n        nodeType.isBlock ? tr.doc.resolve(start).before() : start,\n        end,\n        node\n      );\n      (_c = options.beforeDispatch) == null ? void 0 : _c.call(options, {\n        match: [fullMatch, group != null ? group : \"\"],\n        start,\n        end,\n        tr\n      });\n    }\n    return tr;\n  });\n}\n\nvar __defProp = Object.defineProperty;\nvar __defProps = Object.defineProperties;\nvar __getOwnPropDescs = Object.getOwnPropertyDescriptors;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n  for (var prop in b || (b = {}))\n    if (__hasOwnProp.call(b, prop))\n      __defNormalProp(a, prop, b[prop]);\n  if (__getOwnPropSymbols)\n    for (var prop of __getOwnPropSymbols(b)) {\n      if (__propIsEnum.call(b, prop))\n        __defNormalProp(a, prop, b[prop]);\n    }\n  return a;\n};\nvar __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));\nfunction calculateNodePosition(view, target, handler) {\n  const state = view.state;\n  const { from } = state.selection;\n  const { node } = view.domAtPos(from);\n  const element = node instanceof Text ? node.parentElement : node;\n  if (!(element instanceof HTMLElement)) throw expectDomTypeError(element);\n  const selectedNodeRect = element.getBoundingClientRect();\n  const targetNodeRect = target.getBoundingClientRect();\n  const parent = target.parentElement;\n  if (!parent) throw expectDomTypeError(parent);\n  const parentNodeRect = parent.getBoundingClientRect();\n  const [top, left] = handler(selectedNodeRect, targetNodeRect, parentNodeRect);\n  target.style.top = `${top}px`;\n  target.style.left = `${left}px`;\n}\nfunction calculateTextPosition(view, target, handler) {\n  const state = view.state;\n  const { from, to } = state.selection;\n  const start = view.coordsAtPos(from);\n  const end = view.coordsAtPos(to);\n  const targetNodeRect = target.getBoundingClientRect();\n  const parent = target.parentElement;\n  if (!parent) throw missingRootElement();\n  const parentNodeRect = parent.getBoundingClientRect();\n  const [top, left] = handler(start, end, targetNodeRect, parentNodeRect);\n  target.style.top = `${top}px`;\n  target.style.left = `${left}px`;\n}\nfunction minMax(value = 0, min = 0, max = 0) {\n  return Math.min(Math.max(value, min), max);\n}\nfunction posToDOMRect(view, from, to) {\n  const minPos = 0;\n  const maxPos = view.state.doc.content.size;\n  const resolvedFrom = minMax(from, minPos, maxPos);\n  const resolvedEnd = minMax(to, minPos, maxPos);\n  const start = view.coordsAtPos(resolvedFrom);\n  const end = view.coordsAtPos(resolvedEnd, -1);\n  const top = Math.min(start.top, end.top);\n  const bottom = Math.max(start.bottom, end.bottom);\n  const left = Math.min(start.left, end.left);\n  const right = Math.max(start.right, end.right);\n  const width = right - left;\n  const height = bottom - top;\n  const x = left;\n  const y = top;\n  const data = {\n    top,\n    bottom,\n    left,\n    right,\n    width,\n    height,\n    x,\n    y\n  };\n  return __spreadProps(__spreadValues({}, data), {\n    toJSON: () => data\n  });\n}\n\nfunction cloneTr(tr) {\n  return Object.assign(Object.create(tr), tr).setTime(Date.now());\n}\nfunction equalNodeType(nodeType, node) {\n  return Array.isArray(nodeType) && nodeType.includes(node.type) || node.type === nodeType;\n}\n\nfunction flatten(node, descend = true) {\n  const result = [];\n  node.descendants((child, pos) => {\n    result.push({ node: child, pos });\n    if (!descend) return false;\n    return void 0;\n  });\n  return result;\n}\nfunction findChildren(predicate) {\n  return (node, descend) => flatten(node, descend).filter((child) => predicate(child.node));\n}\nfunction findChildrenByMark(node, markType, descend) {\n  return findChildren((child) => Boolean(markType.isInSet(child.marks)))(\n    node,\n    descend\n  );\n}\nfunction findParent(predicate) {\n  return ($pos) => {\n    for (let depth = $pos.depth; depth > 0; depth -= 1) {\n      const node = $pos.node(depth);\n      if (predicate(node)) {\n        const from = $pos.before(depth);\n        const to = $pos.after(depth);\n        return {\n          from,\n          to,\n          node\n        };\n      }\n    }\n    return void 0;\n  };\n}\nfunction findParentNodeType($pos, nodeType) {\n  return findParent((node) => node.type === nodeType)($pos);\n}\n\nfunction getNodeFromSchema(type, schema) {\n  const target = schema.nodes[type];\n  if (!target) throw getAtomFromSchemaFail(\"node\", type);\n  return target;\n}\nfunction getMarkFromSchema(type, schema) {\n  const target = schema.marks[type];\n  if (!target) throw getAtomFromSchemaFail(\"mark\", type);\n  return target;\n}\n\nfunction findParentNodeClosestToPos(predicate) {\n  return ($pos) => {\n    for (let i = $pos.depth; i > 0; i--) {\n      const node = $pos.node(i);\n      if (predicate(node)) {\n        return {\n          pos: i > 0 ? $pos.before(i) : 0,\n          start: $pos.start(i),\n          depth: i,\n          node\n        };\n      }\n    }\n    return void 0;\n  };\n}\nfunction findParentNode(predicate) {\n  return (selection) => {\n    return findParentNodeClosestToPos(predicate)(selection.$from);\n  };\n}\nfunction findSelectedNodeOfType(selection, nodeType) {\n  if (!(selection instanceof NodeSelection)) return;\n  const { node, $from } = selection;\n  if (equalNodeType(nodeType, node))\n    return {\n      node,\n      pos: $from.pos,\n      start: $from.start($from.depth),\n      depth: $from.depth\n    };\n  return void 0;\n}\n\nexport { browser, calculateNodePosition, calculateTextPosition, cloneTr, customInputRules, customInputRulesKey, equalNodeType, findChildren, findChildrenByMark, findParent, findParentNode, findParentNodeClosestToPos, findParentNodeType, findSelectedNodeOfType, flatten, getMarkFromSchema, getNodeFromSchema, markRule, nodeRule, posToDOMRect };\n//# sourceMappingURL=index.js.map\n","import { liftTarget, replaceStep, ReplaceStep, canJoin, joinPoint, canSplit, ReplaceAroundStep, findWrapping } from 'prosemirror-transform';\nimport { Slice, Fragment } from 'prosemirror-model';\nimport { NodeSelection, Selection, TextSelection, AllSelection, SelectionRange } from 'prosemirror-state';\n\n/**\nDelete the selection, if there is one.\n*/\nconst deleteSelection = (state, dispatch) => {\n    if (state.selection.empty)\n        return false;\n    if (dispatch)\n        dispatch(state.tr.deleteSelection().scrollIntoView());\n    return true;\n};\nfunction atBlockStart(state, view) {\n    let { $cursor } = state.selection;\n    if (!$cursor || (view ? !view.endOfTextblock(\"backward\", state)\n        : $cursor.parentOffset > 0))\n        return null;\n    return $cursor;\n}\n/**\nIf the selection is empty and at the start of a textblock, try to\nreduce the distance between that block and the one before it—if\nthere's a block directly before it that can be joined, join them.\nIf not, try to move the selected block closer to the next one in\nthe document structure by lifting it out of its parent or moving it\ninto a parent of the previous block. Will use the view for accurate\n(bidi-aware) start-of-textblock detection if given.\n*/\nconst joinBackward = (state, dispatch, view) => {\n    let $cursor = atBlockStart(state, view);\n    if (!$cursor)\n        return false;\n    let $cut = findCutBefore($cursor);\n    // If there is no node before this, try to lift\n    if (!$cut) {\n        let range = $cursor.blockRange(), target = range && liftTarget(range);\n        if (target == null)\n            return false;\n        if (dispatch)\n            dispatch(state.tr.lift(range, target).scrollIntoView());\n        return true;\n    }\n    let before = $cut.nodeBefore;\n    // Apply the joining algorithm\n    if (deleteBarrier(state, $cut, dispatch, -1))\n        return true;\n    // If the node below has no content and the node above is\n    // selectable, delete the node below and select the one above.\n    if ($cursor.parent.content.size == 0 &&\n        (textblockAt(before, \"end\") || NodeSelection.isSelectable(before))) {\n        for (let depth = $cursor.depth;; depth--) {\n            let delStep = replaceStep(state.doc, $cursor.before(depth), $cursor.after(depth), Slice.empty);\n            if (delStep && delStep.slice.size < delStep.to - delStep.from) {\n                if (dispatch) {\n                    let tr = state.tr.step(delStep);\n                    tr.setSelection(textblockAt(before, \"end\")\n                        ? Selection.findFrom(tr.doc.resolve(tr.mapping.map($cut.pos, -1)), -1)\n                        : NodeSelection.create(tr.doc, $cut.pos - before.nodeSize));\n                    dispatch(tr.scrollIntoView());\n                }\n                return true;\n            }\n            if (depth == 1 || $cursor.node(depth - 1).childCount > 1)\n                break;\n        }\n    }\n    // If the node before is an atom, delete it\n    if (before.isAtom && $cut.depth == $cursor.depth - 1) {\n        if (dispatch)\n            dispatch(state.tr.delete($cut.pos - before.nodeSize, $cut.pos).scrollIntoView());\n        return true;\n    }\n    return false;\n};\n/**\nA more limited form of [`joinBackward`](https://prosemirror.net/docs/ref/#commands.joinBackward)\nthat only tries to join the current textblock to the one before\nit, if the cursor is at the start of a textblock.\n*/\nconst joinTextblockBackward = (state, dispatch, view) => {\n    let $cursor = atBlockStart(state, view);\n    if (!$cursor)\n        return false;\n    let $cut = findCutBefore($cursor);\n    return $cut ? joinTextblocksAround(state, $cut, dispatch) : false;\n};\n/**\nA more limited form of [`joinForward`](https://prosemirror.net/docs/ref/#commands.joinForward)\nthat only tries to join the current textblock to the one after\nit, if the cursor is at the end of a textblock.\n*/\nconst joinTextblockForward = (state, dispatch, view) => {\n    let $cursor = atBlockEnd(state, view);\n    if (!$cursor)\n        return false;\n    let $cut = findCutAfter($cursor);\n    return $cut ? joinTextblocksAround(state, $cut, dispatch) : false;\n};\nfunction joinTextblocksAround(state, $cut, dispatch) {\n    let before = $cut.nodeBefore, beforeText = before, beforePos = $cut.pos - 1;\n    for (; !beforeText.isTextblock; beforePos--) {\n        if (beforeText.type.spec.isolating)\n            return false;\n        let child = beforeText.lastChild;\n        if (!child)\n            return false;\n        beforeText = child;\n    }\n    let after = $cut.nodeAfter, afterText = after, afterPos = $cut.pos + 1;\n    for (; !afterText.isTextblock; afterPos++) {\n        if (afterText.type.spec.isolating)\n            return false;\n        let child = afterText.firstChild;\n        if (!child)\n            return false;\n        afterText = child;\n    }\n    let step = replaceStep(state.doc, beforePos, afterPos, Slice.empty);\n    if (!step || step.from != beforePos ||\n        step instanceof ReplaceStep && step.slice.size >= afterPos - beforePos)\n        return false;\n    if (dispatch) {\n        let tr = state.tr.step(step);\n        tr.setSelection(TextSelection.create(tr.doc, beforePos));\n        dispatch(tr.scrollIntoView());\n    }\n    return true;\n}\nfunction textblockAt(node, side, only = false) {\n    for (let scan = node; scan; scan = (side == \"start\" ? scan.firstChild : scan.lastChild)) {\n        if (scan.isTextblock)\n            return true;\n        if (only && scan.childCount != 1)\n            return false;\n    }\n    return false;\n}\n/**\nWhen the selection is empty and at the start of a textblock, select\nthe node before that textblock, if possible. This is intended to be\nbound to keys like backspace, after\n[`joinBackward`](https://prosemirror.net/docs/ref/#commands.joinBackward) or other deleting\ncommands, as a fall-back behavior when the schema doesn't allow\ndeletion at the selected point.\n*/\nconst selectNodeBackward = (state, dispatch, view) => {\n    let { $head, empty } = state.selection, $cut = $head;\n    if (!empty)\n        return false;\n    if ($head.parent.isTextblock) {\n        if (view ? !view.endOfTextblock(\"backward\", state) : $head.parentOffset > 0)\n            return false;\n        $cut = findCutBefore($head);\n    }\n    let node = $cut && $cut.nodeBefore;\n    if (!node || !NodeSelection.isSelectable(node))\n        return false;\n    if (dispatch)\n        dispatch(state.tr.setSelection(NodeSelection.create(state.doc, $cut.pos - node.nodeSize)).scrollIntoView());\n    return true;\n};\nfunction findCutBefore($pos) {\n    if (!$pos.parent.type.spec.isolating)\n        for (let i = $pos.depth - 1; i >= 0; i--) {\n            if ($pos.index(i) > 0)\n                return $pos.doc.resolve($pos.before(i + 1));\n            if ($pos.node(i).type.spec.isolating)\n                break;\n        }\n    return null;\n}\nfunction atBlockEnd(state, view) {\n    let { $cursor } = state.selection;\n    if (!$cursor || (view ? !view.endOfTextblock(\"forward\", state)\n        : $cursor.parentOffset < $cursor.parent.content.size))\n        return null;\n    return $cursor;\n}\n/**\nIf the selection is empty and the cursor is at the end of a\ntextblock, try to reduce or remove the boundary between that block\nand the one after it, either by joining them or by moving the other\nblock closer to this one in the tree structure. Will use the view\nfor accurate start-of-textblock detection if given.\n*/\nconst joinForward = (state, dispatch, view) => {\n    let $cursor = atBlockEnd(state, view);\n    if (!$cursor)\n        return false;\n    let $cut = findCutAfter($cursor);\n    // If there is no node after this, there's nothing to do\n    if (!$cut)\n        return false;\n    let after = $cut.nodeAfter;\n    // Try the joining algorithm\n    if (deleteBarrier(state, $cut, dispatch, 1))\n        return true;\n    // If the node above has no content and the node below is\n    // selectable, delete the node above and select the one below.\n    if ($cursor.parent.content.size == 0 &&\n        (textblockAt(after, \"start\") || NodeSelection.isSelectable(after))) {\n        let delStep = replaceStep(state.doc, $cursor.before(), $cursor.after(), Slice.empty);\n        if (delStep && delStep.slice.size < delStep.to - delStep.from) {\n            if (dispatch) {\n                let tr = state.tr.step(delStep);\n                tr.setSelection(textblockAt(after, \"start\") ? Selection.findFrom(tr.doc.resolve(tr.mapping.map($cut.pos)), 1)\n                    : NodeSelection.create(tr.doc, tr.mapping.map($cut.pos)));\n                dispatch(tr.scrollIntoView());\n            }\n            return true;\n        }\n    }\n    // If the next node is an atom, delete it\n    if (after.isAtom && $cut.depth == $cursor.depth - 1) {\n        if (dispatch)\n            dispatch(state.tr.delete($cut.pos, $cut.pos + after.nodeSize).scrollIntoView());\n        return true;\n    }\n    return false;\n};\n/**\nWhen the selection is empty and at the end of a textblock, select\nthe node coming after that textblock, if possible. This is intended\nto be bound to keys like delete, after\n[`joinForward`](https://prosemirror.net/docs/ref/#commands.joinForward) and similar deleting\ncommands, to provide a fall-back behavior when the schema doesn't\nallow deletion at the selected point.\n*/\nconst selectNodeForward = (state, dispatch, view) => {\n    let { $head, empty } = state.selection, $cut = $head;\n    if (!empty)\n        return false;\n    if ($head.parent.isTextblock) {\n        if (view ? !view.endOfTextblock(\"forward\", state) : $head.parentOffset < $head.parent.content.size)\n            return false;\n        $cut = findCutAfter($head);\n    }\n    let node = $cut && $cut.nodeAfter;\n    if (!node || !NodeSelection.isSelectable(node))\n        return false;\n    if (dispatch)\n        dispatch(state.tr.setSelection(NodeSelection.create(state.doc, $cut.pos)).scrollIntoView());\n    return true;\n};\nfunction findCutAfter($pos) {\n    if (!$pos.parent.type.spec.isolating)\n        for (let i = $pos.depth - 1; i >= 0; i--) {\n            let parent = $pos.node(i);\n            if ($pos.index(i) + 1 < parent.childCount)\n                return $pos.doc.resolve($pos.after(i + 1));\n            if (parent.type.spec.isolating)\n                break;\n        }\n    return null;\n}\n/**\nJoin the selected block or, if there is a text selection, the\nclosest ancestor block of the selection that can be joined, with\nthe sibling above it.\n*/\nconst joinUp = (state, dispatch) => {\n    let sel = state.selection, nodeSel = sel instanceof NodeSelection, point;\n    if (nodeSel) {\n        if (sel.node.isTextblock || !canJoin(state.doc, sel.from))\n            return false;\n        point = sel.from;\n    }\n    else {\n        point = joinPoint(state.doc, sel.from, -1);\n        if (point == null)\n            return false;\n    }\n    if (dispatch) {\n        let tr = state.tr.join(point);\n        if (nodeSel)\n            tr.setSelection(NodeSelection.create(tr.doc, point - state.doc.resolve(point).nodeBefore.nodeSize));\n        dispatch(tr.scrollIntoView());\n    }\n    return true;\n};\n/**\nJoin the selected block, or the closest ancestor of the selection\nthat can be joined, with the sibling after it.\n*/\nconst joinDown = (state, dispatch) => {\n    let sel = state.selection, point;\n    if (sel instanceof NodeSelection) {\n        if (sel.node.isTextblock || !canJoin(state.doc, sel.to))\n            return false;\n        point = sel.to;\n    }\n    else {\n        point = joinPoint(state.doc, sel.to, 1);\n        if (point == null)\n            return false;\n    }\n    if (dispatch)\n        dispatch(state.tr.join(point).scrollIntoView());\n    return true;\n};\n/**\nLift the selected block, or the closest ancestor block of the\nselection that can be lifted, out of its parent node.\n*/\nconst lift = (state, dispatch) => {\n    let { $from, $to } = state.selection;\n    let range = $from.blockRange($to), target = range && liftTarget(range);\n    if (target == null)\n        return false;\n    if (dispatch)\n        dispatch(state.tr.lift(range, target).scrollIntoView());\n    return true;\n};\n/**\nIf the selection is in a node whose type has a truthy\n[`code`](https://prosemirror.net/docs/ref/#model.NodeSpec.code) property in its spec, replace the\nselection with a newline character.\n*/\nconst newlineInCode = (state, dispatch) => {\n    let { $head, $anchor } = state.selection;\n    if (!$head.parent.type.spec.code || !$head.sameParent($anchor))\n        return false;\n    if (dispatch)\n        dispatch(state.tr.insertText(\"\\n\").scrollIntoView());\n    return true;\n};\nfunction defaultBlockAt(match) {\n    for (let i = 0; i < match.edgeCount; i++) {\n        let { type } = match.edge(i);\n        if (type.isTextblock && !type.hasRequiredAttrs())\n            return type;\n    }\n    return null;\n}\n/**\nWhen the selection is in a node with a truthy\n[`code`](https://prosemirror.net/docs/ref/#model.NodeSpec.code) property in its spec, create a\ndefault block after the code block, and move the cursor there.\n*/\nconst exitCode = (state, dispatch) => {\n    let { $head, $anchor } = state.selection;\n    if (!$head.parent.type.spec.code || !$head.sameParent($anchor))\n        return false;\n    let above = $head.node(-1), after = $head.indexAfter(-1), type = defaultBlockAt(above.contentMatchAt(after));\n    if (!type || !above.canReplaceWith(after, after, type))\n        return false;\n    if (dispatch) {\n        let pos = $head.after(), tr = state.tr.replaceWith(pos, pos, type.createAndFill());\n        tr.setSelection(Selection.near(tr.doc.resolve(pos), 1));\n        dispatch(tr.scrollIntoView());\n    }\n    return true;\n};\n/**\nIf a block node is selected, create an empty paragraph before (if\nit is its parent's first child) or after it.\n*/\nconst createParagraphNear = (state, dispatch) => {\n    let sel = state.selection, { $from, $to } = sel;\n    if (sel instanceof AllSelection || $from.parent.inlineContent || $to.parent.inlineContent)\n        return false;\n    let type = defaultBlockAt($to.parent.contentMatchAt($to.indexAfter()));\n    if (!type || !type.isTextblock)\n        return false;\n    if (dispatch) {\n        let side = (!$from.parentOffset && $to.index() < $to.parent.childCount ? $from : $to).pos;\n        let tr = state.tr.insert(side, type.createAndFill());\n        tr.setSelection(TextSelection.create(tr.doc, side + 1));\n        dispatch(tr.scrollIntoView());\n    }\n    return true;\n};\n/**\nIf the cursor is in an empty textblock that can be lifted, lift the\nblock.\n*/\nconst liftEmptyBlock = (state, dispatch) => {\n    let { $cursor } = state.selection;\n    if (!$cursor || $cursor.parent.content.size)\n        return false;\n    if ($cursor.depth > 1 && $cursor.after() != $cursor.end(-1)) {\n        let before = $cursor.before();\n        if (canSplit(state.doc, before)) {\n            if (dispatch)\n                dispatch(state.tr.split(before).scrollIntoView());\n            return true;\n        }\n    }\n    let range = $cursor.blockRange(), target = range && liftTarget(range);\n    if (target == null)\n        return false;\n    if (dispatch)\n        dispatch(state.tr.lift(range, target).scrollIntoView());\n    return true;\n};\n/**\nCreate a variant of [`splitBlock`](https://prosemirror.net/docs/ref/#commands.splitBlock) that uses\na custom function to determine the type of the newly split off block.\n*/\nfunction splitBlockAs(splitNode) {\n    return (state, dispatch) => {\n        let { $from, $to } = state.selection;\n        if (state.selection instanceof NodeSelection && state.selection.node.isBlock) {\n            if (!$from.parentOffset || !canSplit(state.doc, $from.pos))\n                return false;\n            if (dispatch)\n                dispatch(state.tr.split($from.pos).scrollIntoView());\n            return true;\n        }\n        if (!$from.depth)\n            return false;\n        let types = [];\n        let splitDepth, deflt, atEnd = false, atStart = false;\n        for (let d = $from.depth;; d--) {\n            let node = $from.node(d);\n            if (node.isBlock) {\n                atEnd = $from.end(d) == $from.pos + ($from.depth - d);\n                atStart = $from.start(d) == $from.pos - ($from.depth - d);\n                deflt = defaultBlockAt($from.node(d - 1).contentMatchAt($from.indexAfter(d - 1)));\n                let splitType = splitNode && splitNode($to.parent, atEnd, $from);\n                types.unshift(splitType || (atEnd && deflt ? { type: deflt } : null));\n                splitDepth = d;\n                break;\n            }\n            else {\n                if (d == 1)\n                    return false;\n                types.unshift(null);\n            }\n        }\n        let tr = state.tr;\n        if (state.selection instanceof TextSelection || state.selection instanceof AllSelection)\n            tr.deleteSelection();\n        let splitPos = tr.mapping.map($from.pos);\n        let can = canSplit(tr.doc, splitPos, types.length, types);\n        if (!can) {\n            types[0] = deflt ? { type: deflt } : null;\n            can = canSplit(tr.doc, splitPos, types.length, types);\n        }\n        tr.split(splitPos, types.length, types);\n        if (!atEnd && atStart && $from.node(splitDepth).type != deflt) {\n            let first = tr.mapping.map($from.before(splitDepth)), $first = tr.doc.resolve(first);\n            if (deflt && $from.node(splitDepth - 1).canReplaceWith($first.index(), $first.index() + 1, deflt))\n                tr.setNodeMarkup(tr.mapping.map($from.before(splitDepth)), deflt);\n        }\n        if (dispatch)\n            dispatch(tr.scrollIntoView());\n        return true;\n    };\n}\n/**\nSplit the parent block of the selection. If the selection is a text\nselection, also delete its content.\n*/\nconst splitBlock = splitBlockAs();\n/**\nActs like [`splitBlock`](https://prosemirror.net/docs/ref/#commands.splitBlock), but without\nresetting the set of active marks at the cursor.\n*/\nconst splitBlockKeepMarks = (state, dispatch) => {\n    return splitBlock(state, dispatch && (tr => {\n        let marks = state.storedMarks || (state.selection.$to.parentOffset && state.selection.$from.marks());\n        if (marks)\n            tr.ensureMarks(marks);\n        dispatch(tr);\n    }));\n};\n/**\nMove the selection to the node wrapping the current selection, if\nany. (Will not select the document node.)\n*/\nconst selectParentNode = (state, dispatch) => {\n    let { $from, to } = state.selection, pos;\n    let same = $from.sharedDepth(to);\n    if (same == 0)\n        return false;\n    pos = $from.before(same);\n    if (dispatch)\n        dispatch(state.tr.setSelection(NodeSelection.create(state.doc, pos)));\n    return true;\n};\n/**\nSelect the whole document.\n*/\nconst selectAll = (state, dispatch) => {\n    if (dispatch)\n        dispatch(state.tr.setSelection(new AllSelection(state.doc)));\n    return true;\n};\nfunction joinMaybeClear(state, $pos, dispatch) {\n    let before = $pos.nodeBefore, after = $pos.nodeAfter, index = $pos.index();\n    if (!before || !after || !before.type.compatibleContent(after.type))\n        return false;\n    if (!before.content.size && $pos.parent.canReplace(index - 1, index)) {\n        if (dispatch)\n            dispatch(state.tr.delete($pos.pos - before.nodeSize, $pos.pos).scrollIntoView());\n        return true;\n    }\n    if (!$pos.parent.canReplace(index, index + 1) || !(after.isTextblock || canJoin(state.doc, $pos.pos)))\n        return false;\n    if (dispatch)\n        dispatch(state.tr.join($pos.pos).scrollIntoView());\n    return true;\n}\nfunction deleteBarrier(state, $cut, dispatch, dir) {\n    let before = $cut.nodeBefore, after = $cut.nodeAfter, conn, match;\n    let isolated = before.type.spec.isolating || after.type.spec.isolating;\n    if (!isolated && joinMaybeClear(state, $cut, dispatch))\n        return true;\n    let canDelAfter = !isolated && $cut.parent.canReplace($cut.index(), $cut.index() + 1);\n    if (canDelAfter &&\n        (conn = (match = before.contentMatchAt(before.childCount)).findWrapping(after.type)) &&\n        match.matchType(conn[0] || after.type).validEnd) {\n        if (dispatch) {\n            let end = $cut.pos + after.nodeSize, wrap = Fragment.empty;\n            for (let i = conn.length - 1; i >= 0; i--)\n                wrap = Fragment.from(conn[i].create(null, wrap));\n            wrap = Fragment.from(before.copy(wrap));\n            let tr = state.tr.step(new ReplaceAroundStep($cut.pos - 1, end, $cut.pos, end, new Slice(wrap, 1, 0), conn.length, true));\n            let $joinAt = tr.doc.resolve(end + 2 * conn.length);\n            if ($joinAt.nodeAfter && $joinAt.nodeAfter.type == before.type &&\n                canJoin(tr.doc, $joinAt.pos))\n                tr.join($joinAt.pos);\n            dispatch(tr.scrollIntoView());\n        }\n        return true;\n    }\n    let selAfter = after.type.spec.isolating || (dir > 0 && isolated) ? null : Selection.findFrom($cut, 1);\n    let range = selAfter && selAfter.$from.blockRange(selAfter.$to), target = range && liftTarget(range);\n    if (target != null && target >= $cut.depth) {\n        if (dispatch)\n            dispatch(state.tr.lift(range, target).scrollIntoView());\n        return true;\n    }\n    if (canDelAfter && textblockAt(after, \"start\", true) && textblockAt(before, \"end\")) {\n        let at = before, wrap = [];\n        for (;;) {\n            wrap.push(at);\n            if (at.isTextblock)\n                break;\n            at = at.lastChild;\n        }\n        let afterText = after, afterDepth = 1;\n        for (; !afterText.isTextblock; afterText = afterText.firstChild)\n            afterDepth++;\n        if (at.canReplace(at.childCount, at.childCount, afterText.content)) {\n            if (dispatch) {\n                let end = Fragment.empty;\n                for (let i = wrap.length - 1; i >= 0; i--)\n                    end = Fragment.from(wrap[i].copy(end));\n                let tr = state.tr.step(new ReplaceAroundStep($cut.pos - wrap.length, $cut.pos + after.nodeSize, $cut.pos + afterDepth, $cut.pos + after.nodeSize - afterDepth, new Slice(end, wrap.length, 0), 0, true));\n                dispatch(tr.scrollIntoView());\n            }\n            return true;\n        }\n    }\n    return false;\n}\nfunction selectTextblockSide(side) {\n    return function (state, dispatch) {\n        let sel = state.selection, $pos = side < 0 ? sel.$from : sel.$to;\n        let depth = $pos.depth;\n        while ($pos.node(depth).isInline) {\n            if (!depth)\n                return false;\n            depth--;\n        }\n        if (!$pos.node(depth).isTextblock)\n            return false;\n        if (dispatch)\n            dispatch(state.tr.setSelection(TextSelection.create(state.doc, side < 0 ? $pos.start(depth) : $pos.end(depth))));\n        return true;\n    };\n}\n/**\nMoves the cursor to the start of current text block.\n*/\nconst selectTextblockStart = selectTextblockSide(-1);\n/**\nMoves the cursor to the end of current text block.\n*/\nconst selectTextblockEnd = selectTextblockSide(1);\n// Parameterized commands\n/**\nWrap the selection in a node of the given type with the given\nattributes.\n*/\nfunction wrapIn(nodeType, attrs = null) {\n    return function (state, dispatch) {\n        let { $from, $to } = state.selection;\n        let range = $from.blockRange($to), wrapping = range && findWrapping(range, nodeType, attrs);\n        if (!wrapping)\n            return false;\n        if (dispatch)\n            dispatch(state.tr.wrap(range, wrapping).scrollIntoView());\n        return true;\n    };\n}\n/**\nReturns a command that tries to set the selected textblocks to the\ngiven node type with the given attributes.\n*/\nfunction setBlockType(nodeType, attrs = null) {\n    return function (state, dispatch) {\n        let applicable = false;\n        for (let i = 0; i < state.selection.ranges.length && !applicable; i++) {\n            let { $from: { pos: from }, $to: { pos: to } } = state.selection.ranges[i];\n            state.doc.nodesBetween(from, to, (node, pos) => {\n                if (applicable)\n                    return false;\n                if (!node.isTextblock || node.hasMarkup(nodeType, attrs))\n                    return;\n                if (node.type == nodeType) {\n                    applicable = true;\n                }\n                else {\n                    let $pos = state.doc.resolve(pos), index = $pos.index();\n                    applicable = $pos.parent.canReplaceWith(index, index + 1, nodeType);\n                }\n            });\n        }\n        if (!applicable)\n            return false;\n        if (dispatch) {\n            let tr = state.tr;\n            for (let i = 0; i < state.selection.ranges.length; i++) {\n                let { $from: { pos: from }, $to: { pos: to } } = state.selection.ranges[i];\n                tr.setBlockType(from, to, nodeType, attrs);\n            }\n            dispatch(tr.scrollIntoView());\n        }\n        return true;\n    };\n}\nfunction markApplies(doc, ranges, type, enterAtoms) {\n    for (let i = 0; i < ranges.length; i++) {\n        let { $from, $to } = ranges[i];\n        let can = $from.depth == 0 ? doc.inlineContent && doc.type.allowsMarkType(type) : false;\n        doc.nodesBetween($from.pos, $to.pos, (node, pos) => {\n            if (can || !enterAtoms && node.isAtom && node.isInline && pos >= $from.pos && pos + node.nodeSize <= $to.pos)\n                return false;\n            can = node.inlineContent && node.type.allowsMarkType(type);\n        });\n        if (can)\n            return true;\n    }\n    return false;\n}\nfunction removeInlineAtoms(ranges) {\n    let result = [];\n    for (let i = 0; i < ranges.length; i++) {\n        let { $from, $to } = ranges[i];\n        $from.doc.nodesBetween($from.pos, $to.pos, (node, pos) => {\n            if (node.isAtom && node.content.size && node.isInline && pos >= $from.pos && pos + node.nodeSize <= $to.pos) {\n                if (pos + 1 > $from.pos)\n                    result.push(new SelectionRange($from, $from.doc.resolve(pos + 1)));\n                $from = $from.doc.resolve(pos + 1 + node.content.size);\n                return false;\n            }\n        });\n        if ($from.pos < $to.pos)\n            result.push(new SelectionRange($from, $to));\n    }\n    return result;\n}\n/**\nCreate a command function that toggles the given mark with the\ngiven attributes. Will return `false` when the current selection\ndoesn't support that mark. This will remove the mark if any marks\nof that type exist in the selection, or add it otherwise. If the\nselection is empty, this applies to the [stored\nmarks](https://prosemirror.net/docs/ref/#state.EditorState.storedMarks) instead of a range of the\ndocument.\n*/\nfunction toggleMark(markType, attrs = null, options) {\n    let removeWhenPresent = (options && options.removeWhenPresent) !== false;\n    let enterAtoms = (options && options.enterInlineAtoms) !== false;\n    let dropSpace = !(options && options.includeWhitespace);\n    return function (state, dispatch) {\n        let { empty, $cursor, ranges } = state.selection;\n        if ((empty && !$cursor) || !markApplies(state.doc, ranges, markType, enterAtoms))\n            return false;\n        if (dispatch) {\n            if ($cursor) {\n                if (markType.isInSet(state.storedMarks || $cursor.marks()))\n                    dispatch(state.tr.removeStoredMark(markType));\n                else\n                    dispatch(state.tr.addStoredMark(markType.create(attrs)));\n            }\n            else {\n                let add, tr = state.tr;\n                if (!enterAtoms)\n                    ranges = removeInlineAtoms(ranges);\n                if (removeWhenPresent) {\n                    add = !ranges.some(r => state.doc.rangeHasMark(r.$from.pos, r.$to.pos, markType));\n                }\n                else {\n                    add = !ranges.every(r => {\n                        let missing = false;\n                        tr.doc.nodesBetween(r.$from.pos, r.$to.pos, (node, pos, parent) => {\n                            if (missing)\n                                return false;\n                            missing = !markType.isInSet(node.marks) && !!parent && parent.type.allowsMarkType(markType) &&\n                                !(node.isText && /^\\s*$/.test(node.textBetween(Math.max(0, r.$from.pos - pos), Math.min(node.nodeSize, r.$to.pos - pos))));\n                        });\n                        return !missing;\n                    });\n                }\n                for (let i = 0; i < ranges.length; i++) {\n                    let { $from, $to } = ranges[i];\n                    if (!add) {\n                        tr.removeMark($from.pos, $to.pos, markType);\n                    }\n                    else {\n                        let from = $from.pos, to = $to.pos, start = $from.nodeAfter, end = $to.nodeBefore;\n                        let spaceStart = dropSpace && start && start.isText ? /^\\s*/.exec(start.text)[0].length : 0;\n                        let spaceEnd = dropSpace && end && end.isText ? /\\s*$/.exec(end.text)[0].length : 0;\n                        if (from + spaceStart < to) {\n                            from += spaceStart;\n                            to -= spaceEnd;\n                        }\n                        tr.addMark(from, to, markType.create(attrs));\n                    }\n                }\n                dispatch(tr.scrollIntoView());\n            }\n        }\n        return true;\n    };\n}\nfunction wrapDispatchForJoin(dispatch, isJoinable) {\n    return (tr) => {\n        if (!tr.isGeneric)\n            return dispatch(tr);\n        let ranges = [];\n        for (let i = 0; i < tr.mapping.maps.length; i++) {\n            let map = tr.mapping.maps[i];\n            for (let j = 0; j < ranges.length; j++)\n                ranges[j] = map.map(ranges[j]);\n            map.forEach((_s, _e, from, to) => ranges.push(from, to));\n        }\n        // Figure out which joinable points exist inside those ranges,\n        // by checking all node boundaries in their parent nodes.\n        let joinable = [];\n        for (let i = 0; i < ranges.length; i += 2) {\n            let from = ranges[i], to = ranges[i + 1];\n            let $from = tr.doc.resolve(from), depth = $from.sharedDepth(to), parent = $from.node(depth);\n            for (let index = $from.indexAfter(depth), pos = $from.after(depth + 1); pos <= to; ++index) {\n                let after = parent.maybeChild(index);\n                if (!after)\n                    break;\n                if (index && joinable.indexOf(pos) == -1) {\n                    let before = parent.child(index - 1);\n                    if (before.type == after.type && isJoinable(before, after))\n                        joinable.push(pos);\n                }\n                pos += after.nodeSize;\n            }\n        }\n        // Join the joinable points\n        joinable.sort((a, b) => a - b);\n        for (let i = joinable.length - 1; i >= 0; i--) {\n            if (canJoin(tr.doc, joinable[i]))\n                tr.join(joinable[i]);\n        }\n        dispatch(tr);\n    };\n}\n/**\nWrap a command so that, when it produces a transform that causes\ntwo joinable nodes to end up next to each other, those are joined.\nNodes are considered joinable when they are of the same type and\nwhen the `isJoinable` predicate returns true for them or, if an\narray of strings was passed, if their node type name is in that\narray.\n*/\nfunction autoJoin(command, isJoinable) {\n    let canJoin = Array.isArray(isJoinable) ? (node) => isJoinable.indexOf(node.type.name) > -1\n        : isJoinable;\n    return (state, dispatch, view) => command(state, dispatch && wrapDispatchForJoin(dispatch, canJoin), view);\n}\n/**\nCombine a number of command functions into a single function (which\ncalls them one by one until one returns true).\n*/\nfunction chainCommands(...commands) {\n    return function (state, dispatch, view) {\n        for (let i = 0; i < commands.length; i++)\n            if (commands[i](state, dispatch, view))\n                return true;\n        return false;\n    };\n}\nlet backspace = chainCommands(deleteSelection, joinBackward, selectNodeBackward);\nlet del = chainCommands(deleteSelection, joinForward, selectNodeForward);\n/**\nA basic keymap containing bindings not specific to any schema.\nBinds the following keys (when multiple commands are listed, they\nare chained with [`chainCommands`](https://prosemirror.net/docs/ref/#commands.chainCommands)):\n\n* **Enter** to `newlineInCode`, `createParagraphNear`, `liftEmptyBlock`, `splitBlock`\n* **Mod-Enter** to `exitCode`\n* **Backspace** and **Mod-Backspace** to `deleteSelection`, `joinBackward`, `selectNodeBackward`\n* **Delete** and **Mod-Delete** to `deleteSelection`, `joinForward`, `selectNodeForward`\n* **Mod-Delete** to `deleteSelection`, `joinForward`, `selectNodeForward`\n* **Mod-a** to `selectAll`\n*/\nconst pcBaseKeymap = {\n    \"Enter\": chainCommands(newlineInCode, createParagraphNear, liftEmptyBlock, splitBlock),\n    \"Mod-Enter\": exitCode,\n    \"Backspace\": backspace,\n    \"Mod-Backspace\": backspace,\n    \"Shift-Backspace\": backspace,\n    \"Delete\": del,\n    \"Mod-Delete\": del,\n    \"Mod-a\": selectAll\n};\n/**\nA copy of `pcBaseKeymap` that also binds **Ctrl-h** like Backspace,\n**Ctrl-d** like Delete, **Alt-Backspace** like Ctrl-Backspace, and\n**Ctrl-Alt-Backspace**, **Alt-Delete**, and **Alt-d** like\nCtrl-Delete.\n*/\nconst macBaseKeymap = {\n    \"Ctrl-h\": pcBaseKeymap[\"Backspace\"],\n    \"Alt-Backspace\": pcBaseKeymap[\"Mod-Backspace\"],\n    \"Ctrl-d\": pcBaseKeymap[\"Delete\"],\n    \"Ctrl-Alt-Backspace\": pcBaseKeymap[\"Mod-Delete\"],\n    \"Alt-Delete\": pcBaseKeymap[\"Mod-Delete\"],\n    \"Alt-d\": pcBaseKeymap[\"Mod-Delete\"],\n    \"Ctrl-a\": selectTextblockStart,\n    \"Ctrl-e\": selectTextblockEnd\n};\nfor (let key in pcBaseKeymap)\n    macBaseKeymap[key] = pcBaseKeymap[key];\nconst mac = typeof navigator != \"undefined\" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform)\n    // @ts-ignore\n    : typeof os != \"undefined\" && os.platform ? os.platform() == \"darwin\" : false;\n/**\nDepending on the detected platform, this will hold\n[`pcBasekeymap`](https://prosemirror.net/docs/ref/#commands.pcBaseKeymap) or\n[`macBaseKeymap`](https://prosemirror.net/docs/ref/#commands.macBaseKeymap).\n*/\nconst baseKeymap = mac ? macBaseKeymap : pcBaseKeymap;\n\nexport { autoJoin, baseKeymap, chainCommands, createParagraphNear, deleteSelection, exitCode, joinBackward, joinDown, joinForward, joinTextblockBackward, joinTextblockForward, joinUp, lift, liftEmptyBlock, macBaseKeymap, newlineInCode, pcBaseKeymap, selectAll, selectNodeBackward, selectNodeForward, selectParentNode, selectTextblockEnd, selectTextblockStart, setBlockType, splitBlock, splitBlockAs, splitBlockKeepMarks, toggleMark, wrapIn };\n","export var base = {\n  8: \"Backspace\",\n  9: \"Tab\",\n  10: \"Enter\",\n  12: \"NumLock\",\n  13: \"Enter\",\n  16: \"Shift\",\n  17: \"Control\",\n  18: \"Alt\",\n  20: \"CapsLock\",\n  27: \"Escape\",\n  32: \" \",\n  33: \"PageUp\",\n  34: \"PageDown\",\n  35: \"End\",\n  36: \"Home\",\n  37: \"ArrowLeft\",\n  38: \"ArrowUp\",\n  39: \"ArrowRight\",\n  40: \"ArrowDown\",\n  44: \"PrintScreen\",\n  45: \"Insert\",\n  46: \"Delete\",\n  59: \";\",\n  61: \"=\",\n  91: \"Meta\",\n  92: \"Meta\",\n  106: \"*\",\n  107: \"+\",\n  108: \",\",\n  109: \"-\",\n  110: \".\",\n  111: \"/\",\n  144: \"NumLock\",\n  145: \"ScrollLock\",\n  160: \"Shift\",\n  161: \"Shift\",\n  162: \"Control\",\n  163: \"Control\",\n  164: \"Alt\",\n  165: \"Alt\",\n  173: \"-\",\n  186: \";\",\n  187: \"=\",\n  188: \",\",\n  189: \"-\",\n  190: \".\",\n  191: \"/\",\n  192: \"`\",\n  219: \"[\",\n  220: \"\\\\\",\n  221: \"]\",\n  222: \"'\"\n}\n\nexport var shift = {\n  48: \")\",\n  49: \"!\",\n  50: \"@\",\n  51: \"#\",\n  52: \"$\",\n  53: \"%\",\n  54: \"^\",\n  55: \"&\",\n  56: \"*\",\n  57: \"(\",\n  59: \":\",\n  61: \"+\",\n  173: \"_\",\n  186: \":\",\n  187: \"+\",\n  188: \"<\",\n  189: \"_\",\n  190: \">\",\n  191: \"?\",\n  192: \"~\",\n  219: \"{\",\n  220: \"|\",\n  221: \"}\",\n  222: \"\\\"\"\n}\n\nvar mac = typeof navigator != \"undefined\" && /Mac/.test(navigator.platform)\nvar ie = typeof navigator != \"undefined\" && /MSIE \\d|Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(navigator.userAgent)\n\n// Fill in the digit keys\nfor (var i = 0; i < 10; i++) base[48 + i] = base[96 + i] = String(i)\n\n// The function keys\nfor (var i = 1; i <= 24; i++) base[i + 111] = \"F\" + i\n\n// And the alphabetic keys\nfor (var i = 65; i <= 90; i++) {\n  base[i] = String.fromCharCode(i + 32)\n  shift[i] = String.fromCharCode(i)\n}\n\n// For each code that doesn't have a shift-equivalent, copy the base name\nfor (var code in base) if (!shift.hasOwnProperty(code)) shift[code] = base[code]\n\nexport function keyName(event) {\n  // On macOS, keys held with Shift and Cmd don't reflect the effect of Shift in `.key`.\n  // On IE, shift effect is never included in `.key`.\n  var ignoreKey = mac && event.metaKey && event.shiftKey && !event.ctrlKey && !event.altKey ||\n      ie && event.shiftKey && event.key && event.key.length == 1 ||\n      event.key == \"Unidentified\"\n  var name = (!ignoreKey && event.key) ||\n    (event.shiftKey ? shift : base)[event.keyCode] ||\n    event.key || \"Unidentified\"\n  // Edge sometimes produces wrong names (Issue #3)\n  if (name == \"Esc\") name = \"Escape\"\n  if (name == \"Del\") name = \"Delete\"\n  // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8860571/\n  if (name == \"Left\") name = \"ArrowLeft\"\n  if (name == \"Up\") name = \"ArrowUp\"\n  if (name == \"Right\") name = \"ArrowRight\"\n  if (name == \"Down\") name = \"ArrowDown\"\n  return name\n}\n","import { keyName, base } from 'w3c-keyname';\nimport { Plugin } from 'prosemirror-state';\n\nconst mac = typeof navigator != \"undefined\" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : false;\nfunction normalizeKeyName(name) {\n    let parts = name.split(/-(?!$)/), result = parts[parts.length - 1];\n    if (result == \"Space\")\n        result = \" \";\n    let alt, ctrl, shift, meta;\n    for (let i = 0; i < parts.length - 1; i++) {\n        let mod = parts[i];\n        if (/^(cmd|meta|m)$/i.test(mod))\n            meta = true;\n        else if (/^a(lt)?$/i.test(mod))\n            alt = true;\n        else if (/^(c|ctrl|control)$/i.test(mod))\n            ctrl = true;\n        else if (/^s(hift)?$/i.test(mod))\n            shift = true;\n        else if (/^mod$/i.test(mod)) {\n            if (mac)\n                meta = true;\n            else\n                ctrl = true;\n        }\n        else\n            throw new Error(\"Unrecognized modifier name: \" + mod);\n    }\n    if (alt)\n        result = \"Alt-\" + result;\n    if (ctrl)\n        result = \"Ctrl-\" + result;\n    if (meta)\n        result = \"Meta-\" + result;\n    if (shift)\n        result = \"Shift-\" + result;\n    return result;\n}\nfunction normalize(map) {\n    let copy = Object.create(null);\n    for (let prop in map)\n        copy[normalizeKeyName(prop)] = map[prop];\n    return copy;\n}\nfunction modifiers(name, event, shift = true) {\n    if (event.altKey)\n        name = \"Alt-\" + name;\n    if (event.ctrlKey)\n        name = \"Ctrl-\" + name;\n    if (event.metaKey)\n        name = \"Meta-\" + name;\n    if (shift && event.shiftKey)\n        name = \"Shift-\" + name;\n    return name;\n}\n/**\nCreate a keymap plugin for the given set of bindings.\n\nBindings should map key names to [command](https://prosemirror.net/docs/ref/#commands)-style\nfunctions, which will be called with `(EditorState, dispatch,\nEditorView)` arguments, and should return true when they've handled\nthe key. Note that the view argument isn't part of the command\nprotocol, but can be used as an escape hatch if a binding needs to\ndirectly interact with the UI.\n\nKey names may be strings like `\"Shift-Ctrl-Enter\"`—a key\nidentifier prefixed with zero or more modifiers. Key identifiers\nare based on the strings that can appear in\n[`KeyEvent.key`](https:developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key).\nUse lowercase letters to refer to letter keys (or uppercase letters\nif you want shift to be held). You may use `\"Space\"` as an alias\nfor the `\" \"` name.\n\nModifiers can be given in any order. `Shift-` (or `s-`), `Alt-` (or\n`a-`), `Ctrl-` (or `c-` or `Control-`) and `Cmd-` (or `m-` or\n`Meta-`) are recognized. For characters that are created by holding\nshift, the `Shift-` prefix is implied, and should not be added\nexplicitly.\n\nYou can use `Mod-` as a shorthand for `Cmd-` on Mac and `Ctrl-` on\nother platforms.\n\nYou can add multiple keymap plugins to an editor. The order in\nwhich they appear determines their precedence (the ones early in\nthe array get to dispatch first).\n*/\nfunction keymap(bindings) {\n    return new Plugin({ props: { handleKeyDown: keydownHandler(bindings) } });\n}\n/**\nGiven a set of bindings (using the same format as\n[`keymap`](https://prosemirror.net/docs/ref/#keymap.keymap)), return a [keydown\nhandler](https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyDown) that handles them.\n*/\nfunction keydownHandler(bindings) {\n    let map = normalize(bindings);\n    return function (view, event) {\n        let name = keyName(event), baseName, direct = map[modifiers(name, event)];\n        if (direct && direct(view.state, view.dispatch, view))\n            return true;\n        // A character key\n        if (name.length == 1 && name != \" \") {\n            if (event.shiftKey) {\n                // In case the name was already modified by shift, try looking\n                // it up without its shift modifier\n                let noShift = map[modifiers(name, event, false)];\n                if (noShift && noShift(view.state, view.dispatch, view))\n                    return true;\n            }\n            if ((event.shiftKey || event.altKey || event.metaKey || name.charCodeAt(0) > 127) &&\n                (baseName = base[event.keyCode]) && baseName != name) {\n                // Try falling back to the keyCode when there's a modifier\n                // active or the character produced isn't ASCII, and our table\n                // produces a different name from the the keyCode. See #668,\n                // #1060\n                let fromCode = map[modifiers(baseName, event)];\n                if (fromCode && fromCode(view.state, view.dispatch, view))\n                    return true;\n            }\n        }\n        return false;\n    };\n}\n\nexport { keydownHandler, keymap };\n","import { TextSelection, NodeSelection, AllSelection, Selection } from 'prosemirror-state';\nimport { DOMSerializer, Fragment, Mark, Slice, DOMParser } from 'prosemirror-model';\nimport { dropPoint } from 'prosemirror-transform';\n\nconst domIndex = function (node) {\n    for (var index = 0;; index++) {\n        node = node.previousSibling;\n        if (!node)\n            return index;\n    }\n};\nconst parentNode = function (node) {\n    let parent = node.assignedSlot || node.parentNode;\n    return parent && parent.nodeType == 11 ? parent.host : parent;\n};\nlet reusedRange = null;\n// Note that this will always return the same range, because DOM range\n// objects are every expensive, and keep slowing down subsequent DOM\n// updates, for some reason.\nconst textRange = function (node, from, to) {\n    let range = reusedRange || (reusedRange = document.createRange());\n    range.setEnd(node, to == null ? node.nodeValue.length : to);\n    range.setStart(node, from || 0);\n    return range;\n};\nconst clearReusedRange = function () {\n    reusedRange = null;\n};\n// Scans forward and backward through DOM positions equivalent to the\n// given one to see if the two are in the same place (i.e. after a\n// text node vs at the end of that text node)\nconst isEquivalentPosition = function (node, off, targetNode, targetOff) {\n    return targetNode && (scanFor(node, off, targetNode, targetOff, -1) ||\n        scanFor(node, off, targetNode, targetOff, 1));\n};\nconst atomElements = /^(img|br|input|textarea|hr)$/i;\nfunction scanFor(node, off, targetNode, targetOff, dir) {\n    for (;;) {\n        if (node == targetNode && off == targetOff)\n            return true;\n        if (off == (dir < 0 ? 0 : nodeSize(node))) {\n            let parent = node.parentNode;\n            if (!parent || parent.nodeType != 1 || hasBlockDesc(node) || atomElements.test(node.nodeName) ||\n                node.contentEditable == \"false\")\n                return false;\n            off = domIndex(node) + (dir < 0 ? 0 : 1);\n            node = parent;\n        }\n        else if (node.nodeType == 1) {\n            node = node.childNodes[off + (dir < 0 ? -1 : 0)];\n            if (node.contentEditable == \"false\")\n                return false;\n            off = dir < 0 ? nodeSize(node) : 0;\n        }\n        else {\n            return false;\n        }\n    }\n}\nfunction nodeSize(node) {\n    return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;\n}\nfunction textNodeBefore$1(node, offset) {\n    for (;;) {\n        if (node.nodeType == 3 && offset)\n            return node;\n        if (node.nodeType == 1 && offset > 0) {\n            if (node.contentEditable == \"false\")\n                return null;\n            node = node.childNodes[offset - 1];\n            offset = nodeSize(node);\n        }\n        else if (node.parentNode && !hasBlockDesc(node)) {\n            offset = domIndex(node);\n            node = node.parentNode;\n        }\n        else {\n            return null;\n        }\n    }\n}\nfunction textNodeAfter$1(node, offset) {\n    for (;;) {\n        if (node.nodeType == 3 && offset < node.nodeValue.length)\n            return node;\n        if (node.nodeType == 1 && offset < node.childNodes.length) {\n            if (node.contentEditable == \"false\")\n                return null;\n            node = node.childNodes[offset];\n            offset = 0;\n        }\n        else if (node.parentNode && !hasBlockDesc(node)) {\n            offset = domIndex(node) + 1;\n            node = node.parentNode;\n        }\n        else {\n            return null;\n        }\n    }\n}\nfunction isOnEdge(node, offset, parent) {\n    for (let atStart = offset == 0, atEnd = offset == nodeSize(node); atStart || atEnd;) {\n        if (node == parent)\n            return true;\n        let index = domIndex(node);\n        node = node.parentNode;\n        if (!node)\n            return false;\n        atStart = atStart && index == 0;\n        atEnd = atEnd && index == nodeSize(node);\n    }\n}\nfunction hasBlockDesc(dom) {\n    let desc;\n    for (let cur = dom; cur; cur = cur.parentNode)\n        if (desc = cur.pmViewDesc)\n            break;\n    return desc && desc.node && desc.node.isBlock && (desc.dom == dom || desc.contentDOM == dom);\n}\n// Work around Chrome issue https://bugs.chromium.org/p/chromium/issues/detail?id=447523\n// (isCollapsed inappropriately returns true in shadow dom)\nconst selectionCollapsed = function (domSel) {\n    return domSel.focusNode && isEquivalentPosition(domSel.focusNode, domSel.focusOffset, domSel.anchorNode, domSel.anchorOffset);\n};\nfunction keyEvent(keyCode, key) {\n    let event = document.createEvent(\"Event\");\n    event.initEvent(\"keydown\", true, true);\n    event.keyCode = keyCode;\n    event.key = event.code = key;\n    return event;\n}\nfunction deepActiveElement(doc) {\n    let elt = doc.activeElement;\n    while (elt && elt.shadowRoot)\n        elt = elt.shadowRoot.activeElement;\n    return elt;\n}\nfunction caretFromPoint(doc, x, y) {\n    if (doc.caretPositionFromPoint) {\n        try { // Firefox throws for this call in hard-to-predict circumstances (#994)\n            let pos = doc.caretPositionFromPoint(x, y);\n            // Clip the offset, because Chrome will return a text offset\n            // into <input> nodes, which can't be treated as a regular DOM\n            // offset\n            if (pos)\n                return { node: pos.offsetNode, offset: Math.min(nodeSize(pos.offsetNode), pos.offset) };\n        }\n        catch (_) { }\n    }\n    if (doc.caretRangeFromPoint) {\n        let range = doc.caretRangeFromPoint(x, y);\n        if (range)\n            return { node: range.startContainer, offset: Math.min(nodeSize(range.startContainer), range.startOffset) };\n    }\n}\n\nconst nav = typeof navigator != \"undefined\" ? navigator : null;\nconst doc = typeof document != \"undefined\" ? document : null;\nconst agent = (nav && nav.userAgent) || \"\";\nconst ie_edge = /Edge\\/(\\d+)/.exec(agent);\nconst ie_upto10 = /MSIE \\d/.exec(agent);\nconst ie_11up = /Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(agent);\nconst ie = !!(ie_upto10 || ie_11up || ie_edge);\nconst ie_version = ie_upto10 ? document.documentMode : ie_11up ? +ie_11up[1] : ie_edge ? +ie_edge[1] : 0;\nconst gecko = !ie && /gecko\\/(\\d+)/i.test(agent);\ngecko && +(/Firefox\\/(\\d+)/.exec(agent) || [0, 0])[1];\nconst _chrome = !ie && /Chrome\\/(\\d+)/.exec(agent);\nconst chrome = !!_chrome;\nconst chrome_version = _chrome ? +_chrome[1] : 0;\nconst safari = !ie && !!nav && /Apple Computer/.test(nav.vendor);\n// Is true for both iOS and iPadOS for convenience\nconst ios = safari && (/Mobile\\/\\w+/.test(agent) || !!nav && nav.maxTouchPoints > 2);\nconst mac = ios || (nav ? /Mac/.test(nav.platform) : false);\nconst windows = nav ? /Win/.test(nav.platform) : false;\nconst android = /Android \\d/.test(agent);\nconst webkit = !!doc && \"webkitFontSmoothing\" in doc.documentElement.style;\nconst webkit_version = webkit ? +(/\\bAppleWebKit\\/(\\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;\n\nfunction windowRect(doc) {\n    let vp = doc.defaultView && doc.defaultView.visualViewport;\n    if (vp)\n        return {\n            left: 0, right: vp.width,\n            top: 0, bottom: vp.height\n        };\n    return { left: 0, right: doc.documentElement.clientWidth,\n        top: 0, bottom: doc.documentElement.clientHeight };\n}\nfunction getSide(value, side) {\n    return typeof value == \"number\" ? value : value[side];\n}\nfunction clientRect(node) {\n    let rect = node.getBoundingClientRect();\n    // Adjust for elements with style \"transform: scale()\"\n    let scaleX = (rect.width / node.offsetWidth) || 1;\n    let scaleY = (rect.height / node.offsetHeight) || 1;\n    // Make sure scrollbar width isn't included in the rectangle\n    return { left: rect.left, right: rect.left + node.clientWidth * scaleX,\n        top: rect.top, bottom: rect.top + node.clientHeight * scaleY };\n}\nfunction scrollRectIntoView(view, rect, startDOM) {\n    let scrollThreshold = view.someProp(\"scrollThreshold\") || 0, scrollMargin = view.someProp(\"scrollMargin\") || 5;\n    let doc = view.dom.ownerDocument;\n    for (let parent = startDOM || view.dom;;) {\n        if (!parent)\n            break;\n        if (parent.nodeType != 1) {\n            parent = parentNode(parent);\n            continue;\n        }\n        let elt = parent;\n        let atTop = elt == doc.body;\n        let bounding = atTop ? windowRect(doc) : clientRect(elt);\n        let moveX = 0, moveY = 0;\n        if (rect.top < bounding.top + getSide(scrollThreshold, \"top\"))\n            moveY = -(bounding.top - rect.top + getSide(scrollMargin, \"top\"));\n        else if (rect.bottom > bounding.bottom - getSide(scrollThreshold, \"bottom\"))\n            moveY = rect.bottom - rect.top > bounding.bottom - bounding.top\n                ? rect.top + getSide(scrollMargin, \"top\") - bounding.top\n                : rect.bottom - bounding.bottom + getSide(scrollMargin, \"bottom\");\n        if (rect.left < bounding.left + getSide(scrollThreshold, \"left\"))\n            moveX = -(bounding.left - rect.left + getSide(scrollMargin, \"left\"));\n        else if (rect.right > bounding.right - getSide(scrollThreshold, \"right\"))\n            moveX = rect.right - bounding.right + getSide(scrollMargin, \"right\");\n        if (moveX || moveY) {\n            if (atTop) {\n                doc.defaultView.scrollBy(moveX, moveY);\n            }\n            else {\n                let startX = elt.scrollLeft, startY = elt.scrollTop;\n                if (moveY)\n                    elt.scrollTop += moveY;\n                if (moveX)\n                    elt.scrollLeft += moveX;\n                let dX = elt.scrollLeft - startX, dY = elt.scrollTop - startY;\n                rect = { left: rect.left - dX, top: rect.top - dY, right: rect.right - dX, bottom: rect.bottom - dY };\n            }\n        }\n        let pos = atTop ? \"fixed\" : getComputedStyle(parent).position;\n        if (/^(fixed|sticky)$/.test(pos))\n            break;\n        parent = pos == \"absolute\" ? parent.offsetParent : parentNode(parent);\n    }\n}\n// Store the scroll position of the editor's parent nodes, along with\n// the top position of an element near the top of the editor, which\n// will be used to make sure the visible viewport remains stable even\n// when the size of the content above changes.\nfunction storeScrollPos(view) {\n    let rect = view.dom.getBoundingClientRect(), startY = Math.max(0, rect.top);\n    let refDOM, refTop;\n    for (let x = (rect.left + rect.right) / 2, y = startY + 1; y < Math.min(innerHeight, rect.bottom); y += 5) {\n        let dom = view.root.elementFromPoint(x, y);\n        if (!dom || dom == view.dom || !view.dom.contains(dom))\n            continue;\n        let localRect = dom.getBoundingClientRect();\n        if (localRect.top >= startY - 20) {\n            refDOM = dom;\n            refTop = localRect.top;\n            break;\n        }\n    }\n    return { refDOM: refDOM, refTop: refTop, stack: scrollStack(view.dom) };\n}\nfunction scrollStack(dom) {\n    let stack = [], doc = dom.ownerDocument;\n    for (let cur = dom; cur; cur = parentNode(cur)) {\n        stack.push({ dom: cur, top: cur.scrollTop, left: cur.scrollLeft });\n        if (dom == doc)\n            break;\n    }\n    return stack;\n}\n// Reset the scroll position of the editor's parent nodes to that what\n// it was before, when storeScrollPos was called.\nfunction resetScrollPos({ refDOM, refTop, stack }) {\n    let newRefTop = refDOM ? refDOM.getBoundingClientRect().top : 0;\n    restoreScrollStack(stack, newRefTop == 0 ? 0 : newRefTop - refTop);\n}\nfunction restoreScrollStack(stack, dTop) {\n    for (let i = 0; i < stack.length; i++) {\n        let { dom, top, left } = stack[i];\n        if (dom.scrollTop != top + dTop)\n            dom.scrollTop = top + dTop;\n        if (dom.scrollLeft != left)\n            dom.scrollLeft = left;\n    }\n}\nlet preventScrollSupported = null;\n// Feature-detects support for .focus({preventScroll: true}), and uses\n// a fallback kludge when not supported.\nfunction focusPreventScroll(dom) {\n    if (dom.setActive)\n        return dom.setActive(); // in IE\n    if (preventScrollSupported)\n        return dom.focus(preventScrollSupported);\n    let stored = scrollStack(dom);\n    dom.focus(preventScrollSupported == null ? {\n        get preventScroll() {\n            preventScrollSupported = { preventScroll: true };\n            return true;\n        }\n    } : undefined);\n    if (!preventScrollSupported) {\n        preventScrollSupported = false;\n        restoreScrollStack(stored, 0);\n    }\n}\nfunction findOffsetInNode(node, coords) {\n    let closest, dxClosest = 2e8, coordsClosest, offset = 0;\n    let rowBot = coords.top, rowTop = coords.top;\n    let firstBelow, coordsBelow;\n    for (let child = node.firstChild, childIndex = 0; child; child = child.nextSibling, childIndex++) {\n        let rects;\n        if (child.nodeType == 1)\n            rects = child.getClientRects();\n        else if (child.nodeType == 3)\n            rects = textRange(child).getClientRects();\n        else\n            continue;\n        for (let i = 0; i < rects.length; i++) {\n            let rect = rects[i];\n            if (rect.top <= rowBot && rect.bottom >= rowTop) {\n                rowBot = Math.max(rect.bottom, rowBot);\n                rowTop = Math.min(rect.top, rowTop);\n                let dx = rect.left > coords.left ? rect.left - coords.left\n                    : rect.right < coords.left ? coords.left - rect.right : 0;\n                if (dx < dxClosest) {\n                    closest = child;\n                    dxClosest = dx;\n                    coordsClosest = dx && closest.nodeType == 3 ? {\n                        left: rect.right < coords.left ? rect.right : rect.left,\n                        top: coords.top\n                    } : coords;\n                    if (child.nodeType == 1 && dx)\n                        offset = childIndex + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0);\n                    continue;\n                }\n            }\n            else if (rect.top > coords.top && !firstBelow && rect.left <= coords.left && rect.right >= coords.left) {\n                firstBelow = child;\n                coordsBelow = { left: Math.max(rect.left, Math.min(rect.right, coords.left)), top: rect.top };\n            }\n            if (!closest && (coords.left >= rect.right && coords.top >= rect.top ||\n                coords.left >= rect.left && coords.top >= rect.bottom))\n                offset = childIndex + 1;\n        }\n    }\n    if (!closest && firstBelow) {\n        closest = firstBelow;\n        coordsClosest = coordsBelow;\n        dxClosest = 0;\n    }\n    if (closest && closest.nodeType == 3)\n        return findOffsetInText(closest, coordsClosest);\n    if (!closest || (dxClosest && closest.nodeType == 1))\n        return { node, offset };\n    return findOffsetInNode(closest, coordsClosest);\n}\nfunction findOffsetInText(node, coords) {\n    let len = node.nodeValue.length;\n    let range = document.createRange();\n    for (let i = 0; i < len; i++) {\n        range.setEnd(node, i + 1);\n        range.setStart(node, i);\n        let rect = singleRect(range, 1);\n        if (rect.top == rect.bottom)\n            continue;\n        if (inRect(coords, rect))\n            return { node, offset: i + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0) };\n    }\n    return { node, offset: 0 };\n}\nfunction inRect(coords, rect) {\n    return coords.left >= rect.left - 1 && coords.left <= rect.right + 1 &&\n        coords.top >= rect.top - 1 && coords.top <= rect.bottom + 1;\n}\nfunction targetKludge(dom, coords) {\n    let parent = dom.parentNode;\n    if (parent && /^li$/i.test(parent.nodeName) && coords.left < dom.getBoundingClientRect().left)\n        return parent;\n    return dom;\n}\nfunction posFromElement(view, elt, coords) {\n    let { node, offset } = findOffsetInNode(elt, coords), bias = -1;\n    if (node.nodeType == 1 && !node.firstChild) {\n        let rect = node.getBoundingClientRect();\n        bias = rect.left != rect.right && coords.left > (rect.left + rect.right) / 2 ? 1 : -1;\n    }\n    return view.docView.posFromDOM(node, offset, bias);\n}\nfunction posFromCaret(view, node, offset, coords) {\n    // Browser (in caretPosition/RangeFromPoint) will agressively\n    // normalize towards nearby inline nodes. Since we are interested in\n    // positions between block nodes too, we first walk up the hierarchy\n    // of nodes to see if there are block nodes that the coordinates\n    // fall outside of. If so, we take the position before/after that\n    // block. If not, we call `posFromDOM` on the raw node/offset.\n    let outsideBlock = -1;\n    for (let cur = node, sawBlock = false;;) {\n        if (cur == view.dom)\n            break;\n        let desc = view.docView.nearestDesc(cur, true), rect;\n        if (!desc)\n            return null;\n        if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent || !desc.contentDOM) &&\n            // Ignore elements with zero-size bounding rectangles\n            ((rect = desc.dom.getBoundingClientRect()).width || rect.height)) {\n            if (desc.node.isBlock && desc.parent) {\n                // Only apply the horizontal test to the innermost block. Vertical for any parent.\n                if (!sawBlock && rect.left > coords.left || rect.top > coords.top)\n                    outsideBlock = desc.posBefore;\n                else if (!sawBlock && rect.right < coords.left || rect.bottom < coords.top)\n                    outsideBlock = desc.posAfter;\n                sawBlock = true;\n            }\n            if (!desc.contentDOM && outsideBlock < 0 && !desc.node.isText) {\n                // If we are inside a leaf, return the side of the leaf closer to the coords\n                let before = desc.node.isBlock ? coords.top < (rect.top + rect.bottom) / 2\n                    : coords.left < (rect.left + rect.right) / 2;\n                return before ? desc.posBefore : desc.posAfter;\n            }\n        }\n        cur = desc.dom.parentNode;\n    }\n    return outsideBlock > -1 ? outsideBlock : view.docView.posFromDOM(node, offset, -1);\n}\nfunction elementFromPoint(element, coords, box) {\n    let len = element.childNodes.length;\n    if (len && box.top < box.bottom) {\n        for (let startI = Math.max(0, Math.min(len - 1, Math.floor(len * (coords.top - box.top) / (box.bottom - box.top)) - 2)), i = startI;;) {\n            let child = element.childNodes[i];\n            if (child.nodeType == 1) {\n                let rects = child.getClientRects();\n                for (let j = 0; j < rects.length; j++) {\n                    let rect = rects[j];\n                    if (inRect(coords, rect))\n                        return elementFromPoint(child, coords, rect);\n                }\n            }\n            if ((i = (i + 1) % len) == startI)\n                break;\n        }\n    }\n    return element;\n}\n// Given an x,y position on the editor, get the position in the document.\nfunction posAtCoords(view, coords) {\n    let doc = view.dom.ownerDocument, node, offset = 0;\n    let caret = caretFromPoint(doc, coords.left, coords.top);\n    if (caret)\n        ({ node, offset } = caret);\n    let elt = (view.root.elementFromPoint ? view.root : doc)\n        .elementFromPoint(coords.left, coords.top);\n    let pos;\n    if (!elt || !view.dom.contains(elt.nodeType != 1 ? elt.parentNode : elt)) {\n        let box = view.dom.getBoundingClientRect();\n        if (!inRect(coords, box))\n            return null;\n        elt = elementFromPoint(view.dom, coords, box);\n        if (!elt)\n            return null;\n    }\n    // Safari's caretRangeFromPoint returns nonsense when on a draggable element\n    if (safari) {\n        for (let p = elt; node && p; p = parentNode(p))\n            if (p.draggable)\n                node = undefined;\n    }\n    elt = targetKludge(elt, coords);\n    if (node) {\n        if (gecko && node.nodeType == 1) {\n            // Firefox will sometimes return offsets into <input> nodes, which\n            // have no actual children, from caretPositionFromPoint (#953)\n            offset = Math.min(offset, node.childNodes.length);\n            // It'll also move the returned position before image nodes,\n            // even if those are behind it.\n            if (offset < node.childNodes.length) {\n                let next = node.childNodes[offset], box;\n                if (next.nodeName == \"IMG\" && (box = next.getBoundingClientRect()).right <= coords.left &&\n                    box.bottom > coords.top)\n                    offset++;\n            }\n        }\n        let prev;\n        // When clicking above the right side of an uneditable node, Chrome will report a cursor position after that node.\n        if (webkit && offset && node.nodeType == 1 && (prev = node.childNodes[offset - 1]).nodeType == 1 &&\n            prev.contentEditable == \"false\" && prev.getBoundingClientRect().top >= coords.top)\n            offset--;\n        // Suspiciously specific kludge to work around caret*FromPoint\n        // never returning a position at the end of the document\n        if (node == view.dom && offset == node.childNodes.length - 1 && node.lastChild.nodeType == 1 &&\n            coords.top > node.lastChild.getBoundingClientRect().bottom)\n            pos = view.state.doc.content.size;\n        // Ignore positions directly after a BR, since caret*FromPoint\n        // 'round up' positions that would be more accurately placed\n        // before the BR node.\n        else if (offset == 0 || node.nodeType != 1 || node.childNodes[offset - 1].nodeName != \"BR\")\n            pos = posFromCaret(view, node, offset, coords);\n    }\n    if (pos == null)\n        pos = posFromElement(view, elt, coords);\n    let desc = view.docView.nearestDesc(elt, true);\n    return { pos, inside: desc ? desc.posAtStart - desc.border : -1 };\n}\nfunction nonZero(rect) {\n    return rect.top < rect.bottom || rect.left < rect.right;\n}\nfunction singleRect(target, bias) {\n    let rects = target.getClientRects();\n    if (rects.length) {\n        let first = rects[bias < 0 ? 0 : rects.length - 1];\n        if (nonZero(first))\n            return first;\n    }\n    return Array.prototype.find.call(rects, nonZero) || target.getBoundingClientRect();\n}\nconst BIDI = /[\\u0590-\\u05f4\\u0600-\\u06ff\\u0700-\\u08ac]/;\n// Given a position in the document model, get a bounding box of the\n// character at that position, relative to the window.\nfunction coordsAtPos(view, pos, side) {\n    let { node, offset, atom } = view.docView.domFromPos(pos, side < 0 ? -1 : 1);\n    let supportEmptyRange = webkit || gecko;\n    if (node.nodeType == 3) {\n        // These browsers support querying empty text ranges. Prefer that in\n        // bidi context or when at the end of a node.\n        if (supportEmptyRange && (BIDI.test(node.nodeValue) || (side < 0 ? !offset : offset == node.nodeValue.length))) {\n            let rect = singleRect(textRange(node, offset, offset), side);\n            // Firefox returns bad results (the position before the space)\n            // when querying a position directly after line-broken\n            // whitespace. Detect this situation and and kludge around it\n            if (gecko && offset && /\\s/.test(node.nodeValue[offset - 1]) && offset < node.nodeValue.length) {\n                let rectBefore = singleRect(textRange(node, offset - 1, offset - 1), -1);\n                if (rectBefore.top == rect.top) {\n                    let rectAfter = singleRect(textRange(node, offset, offset + 1), -1);\n                    if (rectAfter.top != rect.top)\n                        return flattenV(rectAfter, rectAfter.left < rectBefore.left);\n                }\n            }\n            return rect;\n        }\n        else {\n            let from = offset, to = offset, takeSide = side < 0 ? 1 : -1;\n            if (side < 0 && !offset) {\n                to++;\n                takeSide = -1;\n            }\n            else if (side >= 0 && offset == node.nodeValue.length) {\n                from--;\n                takeSide = 1;\n            }\n            else if (side < 0) {\n                from--;\n            }\n            else {\n                to++;\n            }\n            return flattenV(singleRect(textRange(node, from, to), takeSide), takeSide < 0);\n        }\n    }\n    let $dom = view.state.doc.resolve(pos - (atom || 0));\n    // Return a horizontal line in block context\n    if (!$dom.parent.inlineContent) {\n        if (atom == null && offset && (side < 0 || offset == nodeSize(node))) {\n            let before = node.childNodes[offset - 1];\n            if (before.nodeType == 1)\n                return flattenH(before.getBoundingClientRect(), false);\n        }\n        if (atom == null && offset < nodeSize(node)) {\n            let after = node.childNodes[offset];\n            if (after.nodeType == 1)\n                return flattenH(after.getBoundingClientRect(), true);\n        }\n        return flattenH(node.getBoundingClientRect(), side >= 0);\n    }\n    // Inline, not in text node (this is not Bidi-safe)\n    if (atom == null && offset && (side < 0 || offset == nodeSize(node))) {\n        let before = node.childNodes[offset - 1];\n        let target = before.nodeType == 3 ? textRange(before, nodeSize(before) - (supportEmptyRange ? 0 : 1))\n            // BR nodes tend to only return the rectangle before them.\n            // Only use them if they are the last element in their parent\n            : before.nodeType == 1 && (before.nodeName != \"BR\" || !before.nextSibling) ? before : null;\n        if (target)\n            return flattenV(singleRect(target, 1), false);\n    }\n    if (atom == null && offset < nodeSize(node)) {\n        let after = node.childNodes[offset];\n        while (after.pmViewDesc && after.pmViewDesc.ignoreForCoords)\n            after = after.nextSibling;\n        let target = !after ? null : after.nodeType == 3 ? textRange(after, 0, (supportEmptyRange ? 0 : 1))\n            : after.nodeType == 1 ? after : null;\n        if (target)\n            return flattenV(singleRect(target, -1), true);\n    }\n    // All else failed, just try to get a rectangle for the target node\n    return flattenV(singleRect(node.nodeType == 3 ? textRange(node) : node, -side), side >= 0);\n}\nfunction flattenV(rect, left) {\n    if (rect.width == 0)\n        return rect;\n    let x = left ? rect.left : rect.right;\n    return { top: rect.top, bottom: rect.bottom, left: x, right: x };\n}\nfunction flattenH(rect, top) {\n    if (rect.height == 0)\n        return rect;\n    let y = top ? rect.top : rect.bottom;\n    return { top: y, bottom: y, left: rect.left, right: rect.right };\n}\nfunction withFlushedState(view, state, f) {\n    let viewState = view.state, active = view.root.activeElement;\n    if (viewState != state)\n        view.updateState(state);\n    if (active != view.dom)\n        view.focus();\n    try {\n        return f();\n    }\n    finally {\n        if (viewState != state)\n            view.updateState(viewState);\n        if (active != view.dom && active)\n            active.focus();\n    }\n}\n// Whether vertical position motion in a given direction\n// from a position would leave a text block.\nfunction endOfTextblockVertical(view, state, dir) {\n    let sel = state.selection;\n    let $pos = dir == \"up\" ? sel.$from : sel.$to;\n    return withFlushedState(view, state, () => {\n        let { node: dom } = view.docView.domFromPos($pos.pos, dir == \"up\" ? -1 : 1);\n        for (;;) {\n            let nearest = view.docView.nearestDesc(dom, true);\n            if (!nearest)\n                break;\n            if (nearest.node.isBlock) {\n                dom = nearest.contentDOM || nearest.dom;\n                break;\n            }\n            dom = nearest.dom.parentNode;\n        }\n        let coords = coordsAtPos(view, $pos.pos, 1);\n        for (let child = dom.firstChild; child; child = child.nextSibling) {\n            let boxes;\n            if (child.nodeType == 1)\n                boxes = child.getClientRects();\n            else if (child.nodeType == 3)\n                boxes = textRange(child, 0, child.nodeValue.length).getClientRects();\n            else\n                continue;\n            for (let i = 0; i < boxes.length; i++) {\n                let box = boxes[i];\n                if (box.bottom > box.top + 1 &&\n                    (dir == \"up\" ? coords.top - box.top > (box.bottom - coords.top) * 2\n                        : box.bottom - coords.bottom > (coords.bottom - box.top) * 2))\n                    return false;\n            }\n        }\n        return true;\n    });\n}\nconst maybeRTL = /[\\u0590-\\u08ac]/;\nfunction endOfTextblockHorizontal(view, state, dir) {\n    let { $head } = state.selection;\n    if (!$head.parent.isTextblock)\n        return false;\n    let offset = $head.parentOffset, atStart = !offset, atEnd = offset == $head.parent.content.size;\n    let sel = view.domSelection();\n    if (!sel)\n        return $head.pos == $head.start() || $head.pos == $head.end();\n    // If the textblock is all LTR, or the browser doesn't support\n    // Selection.modify (Edge), fall back to a primitive approach\n    if (!maybeRTL.test($head.parent.textContent) || !sel.modify)\n        return dir == \"left\" || dir == \"backward\" ? atStart : atEnd;\n    return withFlushedState(view, state, () => {\n        // This is a huge hack, but appears to be the best we can\n        // currently do: use `Selection.modify` to move the selection by\n        // one character, and see if that moves the cursor out of the\n        // textblock (or doesn't move it at all, when at the start/end of\n        // the document).\n        let { focusNode: oldNode, focusOffset: oldOff, anchorNode, anchorOffset } = view.domSelectionRange();\n        let oldBidiLevel = sel.caretBidiLevel // Only for Firefox\n        ;\n        sel.modify(\"move\", dir, \"character\");\n        let parentDOM = $head.depth ? view.docView.domAfterPos($head.before()) : view.dom;\n        let { focusNode: newNode, focusOffset: newOff } = view.domSelectionRange();\n        let result = newNode && !parentDOM.contains(newNode.nodeType == 1 ? newNode : newNode.parentNode) ||\n            (oldNode == newNode && oldOff == newOff);\n        // Restore the previous selection\n        try {\n            sel.collapse(anchorNode, anchorOffset);\n            if (oldNode && (oldNode != anchorNode || oldOff != anchorOffset) && sel.extend)\n                sel.extend(oldNode, oldOff);\n        }\n        catch (_) { }\n        if (oldBidiLevel != null)\n            sel.caretBidiLevel = oldBidiLevel;\n        return result;\n    });\n}\nlet cachedState = null;\nlet cachedDir = null;\nlet cachedResult = false;\nfunction endOfTextblock(view, state, dir) {\n    if (cachedState == state && cachedDir == dir)\n        return cachedResult;\n    cachedState = state;\n    cachedDir = dir;\n    return cachedResult = dir == \"up\" || dir == \"down\"\n        ? endOfTextblockVertical(view, state, dir)\n        : endOfTextblockHorizontal(view, state, dir);\n}\n\n// View descriptions are data structures that describe the DOM that is\n// used to represent the editor's content. They are used for:\n//\n// - Incremental redrawing when the document changes\n//\n// - Figuring out what part of the document a given DOM position\n//   corresponds to\n//\n// - Wiring in custom implementations of the editing interface for a\n//   given node\n//\n// They form a doubly-linked mutable tree, starting at `view.docView`.\nconst NOT_DIRTY = 0, CHILD_DIRTY = 1, CONTENT_DIRTY = 2, NODE_DIRTY = 3;\n// Superclass for the various kinds of descriptions. Defines their\n// basic structure and shared methods.\nclass ViewDesc {\n    constructor(parent, children, dom, \n    // This is the node that holds the child views. It may be null for\n    // descs that don't have children.\n    contentDOM) {\n        this.parent = parent;\n        this.children = children;\n        this.dom = dom;\n        this.contentDOM = contentDOM;\n        this.dirty = NOT_DIRTY;\n        // An expando property on the DOM node provides a link back to its\n        // description.\n        dom.pmViewDesc = this;\n    }\n    // Used to check whether a given description corresponds to a\n    // widget/mark/node.\n    matchesWidget(widget) { return false; }\n    matchesMark(mark) { return false; }\n    matchesNode(node, outerDeco, innerDeco) { return false; }\n    matchesHack(nodeName) { return false; }\n    // When parsing in-editor content (in domchange.js), we allow\n    // descriptions to determine the parse rules that should be used to\n    // parse them.\n    parseRule() { return null; }\n    // Used by the editor's event handler to ignore events that come\n    // from certain descs.\n    stopEvent(event) { return false; }\n    // The size of the content represented by this desc.\n    get size() {\n        let size = 0;\n        for (let i = 0; i < this.children.length; i++)\n            size += this.children[i].size;\n        return size;\n    }\n    // For block nodes, this represents the space taken up by their\n    // start/end tokens.\n    get border() { return 0; }\n    destroy() {\n        this.parent = undefined;\n        if (this.dom.pmViewDesc == this)\n            this.dom.pmViewDesc = undefined;\n        for (let i = 0; i < this.children.length; i++)\n            this.children[i].destroy();\n    }\n    posBeforeChild(child) {\n        for (let i = 0, pos = this.posAtStart;; i++) {\n            let cur = this.children[i];\n            if (cur == child)\n                return pos;\n            pos += cur.size;\n        }\n    }\n    get posBefore() {\n        return this.parent.posBeforeChild(this);\n    }\n    get posAtStart() {\n        return this.parent ? this.parent.posBeforeChild(this) + this.border : 0;\n    }\n    get posAfter() {\n        return this.posBefore + this.size;\n    }\n    get posAtEnd() {\n        return this.posAtStart + this.size - 2 * this.border;\n    }\n    localPosFromDOM(dom, offset, bias) {\n        // If the DOM position is in the content, use the child desc after\n        // it to figure out a position.\n        if (this.contentDOM && this.contentDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode)) {\n            if (bias < 0) {\n                let domBefore, desc;\n                if (dom == this.contentDOM) {\n                    domBefore = dom.childNodes[offset - 1];\n                }\n                else {\n                    while (dom.parentNode != this.contentDOM)\n                        dom = dom.parentNode;\n                    domBefore = dom.previousSibling;\n                }\n                while (domBefore && !((desc = domBefore.pmViewDesc) && desc.parent == this))\n                    domBefore = domBefore.previousSibling;\n                return domBefore ? this.posBeforeChild(desc) + desc.size : this.posAtStart;\n            }\n            else {\n                let domAfter, desc;\n                if (dom == this.contentDOM) {\n                    domAfter = dom.childNodes[offset];\n                }\n                else {\n                    while (dom.parentNode != this.contentDOM)\n                        dom = dom.parentNode;\n                    domAfter = dom.nextSibling;\n                }\n                while (domAfter && !((desc = domAfter.pmViewDesc) && desc.parent == this))\n                    domAfter = domAfter.nextSibling;\n                return domAfter ? this.posBeforeChild(desc) : this.posAtEnd;\n            }\n        }\n        // Otherwise, use various heuristics, falling back on the bias\n        // parameter, to determine whether to return the position at the\n        // start or at the end of this view desc.\n        let atEnd;\n        if (dom == this.dom && this.contentDOM) {\n            atEnd = offset > domIndex(this.contentDOM);\n        }\n        else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM)) {\n            atEnd = dom.compareDocumentPosition(this.contentDOM) & 2;\n        }\n        else if (this.dom.firstChild) {\n            if (offset == 0)\n                for (let search = dom;; search = search.parentNode) {\n                    if (search == this.dom) {\n                        atEnd = false;\n                        break;\n                    }\n                    if (search.previousSibling)\n                        break;\n                }\n            if (atEnd == null && offset == dom.childNodes.length)\n                for (let search = dom;; search = search.parentNode) {\n                    if (search == this.dom) {\n                        atEnd = true;\n                        break;\n                    }\n                    if (search.nextSibling)\n                        break;\n                }\n        }\n        return (atEnd == null ? bias > 0 : atEnd) ? this.posAtEnd : this.posAtStart;\n    }\n    nearestDesc(dom, onlyNodes = false) {\n        for (let first = true, cur = dom; cur; cur = cur.parentNode) {\n            let desc = this.getDesc(cur), nodeDOM;\n            if (desc && (!onlyNodes || desc.node)) {\n                // If dom is outside of this desc's nodeDOM, don't count it.\n                if (first && (nodeDOM = desc.nodeDOM) &&\n                    !(nodeDOM.nodeType == 1 ? nodeDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode) : nodeDOM == dom))\n                    first = false;\n                else\n                    return desc;\n            }\n        }\n    }\n    getDesc(dom) {\n        let desc = dom.pmViewDesc;\n        for (let cur = desc; cur; cur = cur.parent)\n            if (cur == this)\n                return desc;\n    }\n    posFromDOM(dom, offset, bias) {\n        for (let scan = dom; scan; scan = scan.parentNode) {\n            let desc = this.getDesc(scan);\n            if (desc)\n                return desc.localPosFromDOM(dom, offset, bias);\n        }\n        return -1;\n    }\n    // Find the desc for the node after the given pos, if any. (When a\n    // parent node overrode rendering, there might not be one.)\n    descAt(pos) {\n        for (let i = 0, offset = 0; i < this.children.length; i++) {\n            let child = this.children[i], end = offset + child.size;\n            if (offset == pos && end != offset) {\n                while (!child.border && child.children.length) {\n                    for (let i = 0; i < child.children.length; i++) {\n                        let inner = child.children[i];\n                        if (inner.size) {\n                            child = inner;\n                            break;\n                        }\n                    }\n                }\n                return child;\n            }\n            if (pos < end)\n                return child.descAt(pos - offset - child.border);\n            offset = end;\n        }\n    }\n    domFromPos(pos, side) {\n        if (!this.contentDOM)\n            return { node: this.dom, offset: 0, atom: pos + 1 };\n        // First find the position in the child array\n        let i = 0, offset = 0;\n        for (let curPos = 0; i < this.children.length; i++) {\n            let child = this.children[i], end = curPos + child.size;\n            if (end > pos || child instanceof TrailingHackViewDesc) {\n                offset = pos - curPos;\n                break;\n            }\n            curPos = end;\n        }\n        // If this points into the middle of a child, call through\n        if (offset)\n            return this.children[i].domFromPos(offset - this.children[i].border, side);\n        // Go back if there were any zero-length widgets with side >= 0 before this point\n        for (let prev; i && !(prev = this.children[i - 1]).size && prev instanceof WidgetViewDesc && prev.side >= 0; i--) { }\n        // Scan towards the first useable node\n        if (side <= 0) {\n            let prev, enter = true;\n            for (;; i--, enter = false) {\n                prev = i ? this.children[i - 1] : null;\n                if (!prev || prev.dom.parentNode == this.contentDOM)\n                    break;\n            }\n            if (prev && side && enter && !prev.border && !prev.domAtom)\n                return prev.domFromPos(prev.size, side);\n            return { node: this.contentDOM, offset: prev ? domIndex(prev.dom) + 1 : 0 };\n        }\n        else {\n            let next, enter = true;\n            for (;; i++, enter = false) {\n                next = i < this.children.length ? this.children[i] : null;\n                if (!next || next.dom.parentNode == this.contentDOM)\n                    break;\n            }\n            if (next && enter && !next.border && !next.domAtom)\n                return next.domFromPos(0, side);\n            return { node: this.contentDOM, offset: next ? domIndex(next.dom) : this.contentDOM.childNodes.length };\n        }\n    }\n    // Used to find a DOM range in a single parent for a given changed\n    // range.\n    parseRange(from, to, base = 0) {\n        if (this.children.length == 0)\n            return { node: this.contentDOM, from, to, fromOffset: 0, toOffset: this.contentDOM.childNodes.length };\n        let fromOffset = -1, toOffset = -1;\n        for (let offset = base, i = 0;; i++) {\n            let child = this.children[i], end = offset + child.size;\n            if (fromOffset == -1 && from <= end) {\n                let childBase = offset + child.border;\n                // FIXME maybe descend mark views to parse a narrower range?\n                if (from >= childBase && to <= end - child.border && child.node &&\n                    child.contentDOM && this.contentDOM.contains(child.contentDOM))\n                    return child.parseRange(from, to, childBase);\n                from = offset;\n                for (let j = i; j > 0; j--) {\n                    let prev = this.children[j - 1];\n                    if (prev.size && prev.dom.parentNode == this.contentDOM && !prev.emptyChildAt(1)) {\n                        fromOffset = domIndex(prev.dom) + 1;\n                        break;\n                    }\n                    from -= prev.size;\n                }\n                if (fromOffset == -1)\n                    fromOffset = 0;\n            }\n            if (fromOffset > -1 && (end > to || i == this.children.length - 1)) {\n                to = end;\n                for (let j = i + 1; j < this.children.length; j++) {\n                    let next = this.children[j];\n                    if (next.size && next.dom.parentNode == this.contentDOM && !next.emptyChildAt(-1)) {\n                        toOffset = domIndex(next.dom);\n                        break;\n                    }\n                    to += next.size;\n                }\n                if (toOffset == -1)\n                    toOffset = this.contentDOM.childNodes.length;\n                break;\n            }\n            offset = end;\n        }\n        return { node: this.contentDOM, from, to, fromOffset, toOffset };\n    }\n    emptyChildAt(side) {\n        if (this.border || !this.contentDOM || !this.children.length)\n            return false;\n        let child = this.children[side < 0 ? 0 : this.children.length - 1];\n        return child.size == 0 || child.emptyChildAt(side);\n    }\n    domAfterPos(pos) {\n        let { node, offset } = this.domFromPos(pos, 0);\n        if (node.nodeType != 1 || offset == node.childNodes.length)\n            throw new RangeError(\"No node after pos \" + pos);\n        return node.childNodes[offset];\n    }\n    // View descs are responsible for setting any selection that falls\n    // entirely inside of them, so that custom implementations can do\n    // custom things with the selection. Note that this falls apart when\n    // a selection starts in such a node and ends in another, in which\n    // case we just use whatever domFromPos produces as a best effort.\n    setSelection(anchor, head, view, force = false) {\n        // If the selection falls entirely in a child, give it to that child\n        let from = Math.min(anchor, head), to = Math.max(anchor, head);\n        for (let i = 0, offset = 0; i < this.children.length; i++) {\n            let child = this.children[i], end = offset + child.size;\n            if (from > offset && to < end)\n                return child.setSelection(anchor - offset - child.border, head - offset - child.border, view, force);\n            offset = end;\n        }\n        let anchorDOM = this.domFromPos(anchor, anchor ? -1 : 1);\n        let headDOM = head == anchor ? anchorDOM : this.domFromPos(head, head ? -1 : 1);\n        let domSel = view.root.getSelection();\n        let selRange = view.domSelectionRange();\n        let brKludge = false;\n        // On Firefox, using Selection.collapse to put the cursor after a\n        // BR node for some reason doesn't always work (#1073). On Safari,\n        // the cursor sometimes inexplicable visually lags behind its\n        // reported position in such situations (#1092).\n        if ((gecko || safari) && anchor == head) {\n            let { node, offset } = anchorDOM;\n            if (node.nodeType == 3) {\n                brKludge = !!(offset && node.nodeValue[offset - 1] == \"\\n\");\n                // Issue #1128\n                if (brKludge && offset == node.nodeValue.length) {\n                    for (let scan = node, after; scan; scan = scan.parentNode) {\n                        if (after = scan.nextSibling) {\n                            if (after.nodeName == \"BR\")\n                                anchorDOM = headDOM = { node: after.parentNode, offset: domIndex(after) + 1 };\n                            break;\n                        }\n                        let desc = scan.pmViewDesc;\n                        if (desc && desc.node && desc.node.isBlock)\n                            break;\n                    }\n                }\n            }\n            else {\n                let prev = node.childNodes[offset - 1];\n                brKludge = prev && (prev.nodeName == \"BR\" || prev.contentEditable == \"false\");\n            }\n        }\n        // Firefox can act strangely when the selection is in front of an\n        // uneditable node. See #1163 and https://bugzilla.mozilla.org/show_bug.cgi?id=1709536\n        if (gecko && selRange.focusNode && selRange.focusNode != headDOM.node && selRange.focusNode.nodeType == 1) {\n            let after = selRange.focusNode.childNodes[selRange.focusOffset];\n            if (after && after.contentEditable == \"false\")\n                force = true;\n        }\n        if (!(force || brKludge && safari) &&\n            isEquivalentPosition(anchorDOM.node, anchorDOM.offset, selRange.anchorNode, selRange.anchorOffset) &&\n            isEquivalentPosition(headDOM.node, headDOM.offset, selRange.focusNode, selRange.focusOffset))\n            return;\n        // Selection.extend can be used to create an 'inverted' selection\n        // (one where the focus is before the anchor), but not all\n        // browsers support it yet.\n        let domSelExtended = false;\n        if ((domSel.extend || anchor == head) && !brKludge) {\n            domSel.collapse(anchorDOM.node, anchorDOM.offset);\n            try {\n                if (anchor != head)\n                    domSel.extend(headDOM.node, headDOM.offset);\n                domSelExtended = true;\n            }\n            catch (_) {\n                // In some cases with Chrome the selection is empty after calling\n                // collapse, even when it should be valid. This appears to be a bug, but\n                // it is difficult to isolate. If this happens fallback to the old path\n                // without using extend.\n                // Similarly, this could crash on Safari if the editor is hidden, and\n                // there was no selection.\n            }\n        }\n        if (!domSelExtended) {\n            if (anchor > head) {\n                let tmp = anchorDOM;\n                anchorDOM = headDOM;\n                headDOM = tmp;\n            }\n            let range = document.createRange();\n            range.setEnd(headDOM.node, headDOM.offset);\n            range.setStart(anchorDOM.node, anchorDOM.offset);\n            domSel.removeAllRanges();\n            domSel.addRange(range);\n        }\n    }\n    ignoreMutation(mutation) {\n        return !this.contentDOM && mutation.type != \"selection\";\n    }\n    get contentLost() {\n        return this.contentDOM && this.contentDOM != this.dom && !this.dom.contains(this.contentDOM);\n    }\n    // Remove a subtree of the element tree that has been touched\n    // by a DOM change, so that the next update will redraw it.\n    markDirty(from, to) {\n        for (let offset = 0, i = 0; i < this.children.length; i++) {\n            let child = this.children[i], end = offset + child.size;\n            if (offset == end ? from <= end && to >= offset : from < end && to > offset) {\n                let startInside = offset + child.border, endInside = end - child.border;\n                if (from >= startInside && to <= endInside) {\n                    this.dirty = from == offset || to == end ? CONTENT_DIRTY : CHILD_DIRTY;\n                    if (from == startInside && to == endInside &&\n                        (child.contentLost || child.dom.parentNode != this.contentDOM))\n                        child.dirty = NODE_DIRTY;\n                    else\n                        child.markDirty(from - startInside, to - startInside);\n                    return;\n                }\n                else {\n                    child.dirty = child.dom == child.contentDOM && child.dom.parentNode == this.contentDOM && !child.children.length\n                        ? CONTENT_DIRTY : NODE_DIRTY;\n                }\n            }\n            offset = end;\n        }\n        this.dirty = CONTENT_DIRTY;\n    }\n    markParentsDirty() {\n        let level = 1;\n        for (let node = this.parent; node; node = node.parent, level++) {\n            let dirty = level == 1 ? CONTENT_DIRTY : CHILD_DIRTY;\n            if (node.dirty < dirty)\n                node.dirty = dirty;\n        }\n    }\n    get domAtom() { return false; }\n    get ignoreForCoords() { return false; }\n    isText(text) { return false; }\n}\n// A widget desc represents a widget decoration, which is a DOM node\n// drawn between the document nodes.\nclass WidgetViewDesc extends ViewDesc {\n    constructor(parent, widget, view, pos) {\n        let self, dom = widget.type.toDOM;\n        if (typeof dom == \"function\")\n            dom = dom(view, () => {\n                if (!self)\n                    return pos;\n                if (self.parent)\n                    return self.parent.posBeforeChild(self);\n            });\n        if (!widget.type.spec.raw) {\n            if (dom.nodeType != 1) {\n                let wrap = document.createElement(\"span\");\n                wrap.appendChild(dom);\n                dom = wrap;\n            }\n            dom.contentEditable = \"false\";\n            dom.classList.add(\"ProseMirror-widget\");\n        }\n        super(parent, [], dom, null);\n        this.widget = widget;\n        this.widget = widget;\n        self = this;\n    }\n    matchesWidget(widget) {\n        return this.dirty == NOT_DIRTY && widget.type.eq(this.widget.type);\n    }\n    parseRule() { return { ignore: true }; }\n    stopEvent(event) {\n        let stop = this.widget.spec.stopEvent;\n        return stop ? stop(event) : false;\n    }\n    ignoreMutation(mutation) {\n        return mutation.type != \"selection\" || this.widget.spec.ignoreSelection;\n    }\n    destroy() {\n        this.widget.type.destroy(this.dom);\n        super.destroy();\n    }\n    get domAtom() { return true; }\n    get side() { return this.widget.type.side; }\n}\nclass CompositionViewDesc extends ViewDesc {\n    constructor(parent, dom, textDOM, text) {\n        super(parent, [], dom, null);\n        this.textDOM = textDOM;\n        this.text = text;\n    }\n    get size() { return this.text.length; }\n    localPosFromDOM(dom, offset) {\n        if (dom != this.textDOM)\n            return this.posAtStart + (offset ? this.size : 0);\n        return this.posAtStart + offset;\n    }\n    domFromPos(pos) {\n        return { node: this.textDOM, offset: pos };\n    }\n    ignoreMutation(mut) {\n        return mut.type === 'characterData' && mut.target.nodeValue == mut.oldValue;\n    }\n}\n// A mark desc represents a mark. May have multiple children,\n// depending on how the mark is split. Note that marks are drawn using\n// a fixed nesting order, for simplicity and predictability, so in\n// some cases they will be split more often than would appear\n// necessary.\nclass MarkViewDesc extends ViewDesc {\n    constructor(parent, mark, dom, contentDOM, spec) {\n        super(parent, [], dom, contentDOM);\n        this.mark = mark;\n        this.spec = spec;\n    }\n    static create(parent, mark, inline, view) {\n        let custom = view.nodeViews[mark.type.name];\n        let spec = custom && custom(mark, view, inline);\n        if (!spec || !spec.dom)\n            spec = DOMSerializer.renderSpec(document, mark.type.spec.toDOM(mark, inline), null, mark.attrs);\n        return new MarkViewDesc(parent, mark, spec.dom, spec.contentDOM || spec.dom, spec);\n    }\n    parseRule() {\n        if ((this.dirty & NODE_DIRTY) || this.mark.type.spec.reparseInView)\n            return null;\n        return { mark: this.mark.type.name, attrs: this.mark.attrs, contentElement: this.contentDOM };\n    }\n    matchesMark(mark) { return this.dirty != NODE_DIRTY && this.mark.eq(mark); }\n    markDirty(from, to) {\n        super.markDirty(from, to);\n        // Move dirty info to nearest node view\n        if (this.dirty != NOT_DIRTY) {\n            let parent = this.parent;\n            while (!parent.node)\n                parent = parent.parent;\n            if (parent.dirty < this.dirty)\n                parent.dirty = this.dirty;\n            this.dirty = NOT_DIRTY;\n        }\n    }\n    slice(from, to, view) {\n        let copy = MarkViewDesc.create(this.parent, this.mark, true, view);\n        let nodes = this.children, size = this.size;\n        if (to < size)\n            nodes = replaceNodes(nodes, to, size, view);\n        if (from > 0)\n            nodes = replaceNodes(nodes, 0, from, view);\n        for (let i = 0; i < nodes.length; i++)\n            nodes[i].parent = copy;\n        copy.children = nodes;\n        return copy;\n    }\n    ignoreMutation(mutation) {\n        return this.spec.ignoreMutation ? this.spec.ignoreMutation(mutation) : super.ignoreMutation(mutation);\n    }\n    destroy() {\n        if (this.spec.destroy)\n            this.spec.destroy();\n        super.destroy();\n    }\n}\n// Node view descs are the main, most common type of view desc, and\n// correspond to an actual node in the document. Unlike mark descs,\n// they populate their child array themselves.\nclass NodeViewDesc extends ViewDesc {\n    constructor(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos) {\n        super(parent, [], dom, contentDOM);\n        this.node = node;\n        this.outerDeco = outerDeco;\n        this.innerDeco = innerDeco;\n        this.nodeDOM = nodeDOM;\n    }\n    // By default, a node is rendered using the `toDOM` method from the\n    // node type spec. But client code can use the `nodeViews` spec to\n    // supply a custom node view, which can influence various aspects of\n    // the way the node works.\n    //\n    // (Using subclassing for this was intentionally decided against,\n    // since it'd require exposing a whole slew of finicky\n    // implementation details to the user code that they probably will\n    // never need.)\n    static create(parent, node, outerDeco, innerDeco, view, pos) {\n        let custom = view.nodeViews[node.type.name], descObj;\n        let spec = custom && custom(node, view, () => {\n            // (This is a function that allows the custom view to find its\n            // own position)\n            if (!descObj)\n                return pos;\n            if (descObj.parent)\n                return descObj.parent.posBeforeChild(descObj);\n        }, outerDeco, innerDeco);\n        let dom = spec && spec.dom, contentDOM = spec && spec.contentDOM;\n        if (node.isText) {\n            if (!dom)\n                dom = document.createTextNode(node.text);\n            else if (dom.nodeType != 3)\n                throw new RangeError(\"Text must be rendered as a DOM text node\");\n        }\n        else if (!dom) {\n            let spec = DOMSerializer.renderSpec(document, node.type.spec.toDOM(node), null, node.attrs);\n            ({ dom, contentDOM } = spec);\n        }\n        if (!contentDOM && !node.isText && dom.nodeName != \"BR\") { // Chrome gets confused by <br contenteditable=false>\n            if (!dom.hasAttribute(\"contenteditable\"))\n                dom.contentEditable = \"false\";\n            if (node.type.spec.draggable)\n                dom.draggable = true;\n        }\n        let nodeDOM = dom;\n        dom = applyOuterDeco(dom, outerDeco, node);\n        if (spec)\n            return descObj = new CustomNodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM || null, nodeDOM, spec, view, pos + 1);\n        else if (node.isText)\n            return new TextViewDesc(parent, node, outerDeco, innerDeco, dom, nodeDOM, view);\n        else\n            return new NodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM || null, nodeDOM, view, pos + 1);\n    }\n    parseRule() {\n        // Experimental kludge to allow opt-in re-parsing of nodes\n        if (this.node.type.spec.reparseInView)\n            return null;\n        // FIXME the assumption that this can always return the current\n        // attrs means that if the user somehow manages to change the\n        // attrs in the dom, that won't be picked up. Not entirely sure\n        // whether this is a problem\n        let rule = { node: this.node.type.name, attrs: this.node.attrs };\n        if (this.node.type.whitespace == \"pre\")\n            rule.preserveWhitespace = \"full\";\n        if (!this.contentDOM) {\n            rule.getContent = () => this.node.content;\n        }\n        else if (!this.contentLost) {\n            rule.contentElement = this.contentDOM;\n        }\n        else {\n            // Chrome likes to randomly recreate parent nodes when\n            // backspacing things. When that happens, this tries to find the\n            // new parent.\n            for (let i = this.children.length - 1; i >= 0; i--) {\n                let child = this.children[i];\n                if (this.dom.contains(child.dom.parentNode)) {\n                    rule.contentElement = child.dom.parentNode;\n                    break;\n                }\n            }\n            if (!rule.contentElement)\n                rule.getContent = () => Fragment.empty;\n        }\n        return rule;\n    }\n    matchesNode(node, outerDeco, innerDeco) {\n        return this.dirty == NOT_DIRTY && node.eq(this.node) &&\n            sameOuterDeco(outerDeco, this.outerDeco) && innerDeco.eq(this.innerDeco);\n    }\n    get size() { return this.node.nodeSize; }\n    get border() { return this.node.isLeaf ? 0 : 1; }\n    // Syncs `this.children` to match `this.node.content` and the local\n    // decorations, possibly introducing nesting for marks. Then, in a\n    // separate step, syncs the DOM inside `this.contentDOM` to\n    // `this.children`.\n    updateChildren(view, pos) {\n        let inline = this.node.inlineContent, off = pos;\n        let composition = view.composing ? this.localCompositionInfo(view, pos) : null;\n        let localComposition = composition && composition.pos > -1 ? composition : null;\n        let compositionInChild = composition && composition.pos < 0;\n        let updater = new ViewTreeUpdater(this, localComposition && localComposition.node, view);\n        iterDeco(this.node, this.innerDeco, (widget, i, insideNode) => {\n            if (widget.spec.marks)\n                updater.syncToMarks(widget.spec.marks, inline, view);\n            else if (widget.type.side >= 0 && !insideNode)\n                updater.syncToMarks(i == this.node.childCount ? Mark.none : this.node.child(i).marks, inline, view);\n            // If the next node is a desc matching this widget, reuse it,\n            // otherwise insert the widget as a new view desc.\n            updater.placeWidget(widget, view, off);\n        }, (child, outerDeco, innerDeco, i) => {\n            // Make sure the wrapping mark descs match the node's marks.\n            updater.syncToMarks(child.marks, inline, view);\n            // Try several strategies for drawing this node\n            let compIndex;\n            if (updater.findNodeMatch(child, outerDeco, innerDeco, i)) ;\n            else if (compositionInChild && view.state.selection.from > off &&\n                view.state.selection.to < off + child.nodeSize &&\n                (compIndex = updater.findIndexWithChild(composition.node)) > -1 &&\n                updater.updateNodeAt(child, outerDeco, innerDeco, compIndex, view)) ;\n            else if (updater.updateNextNode(child, outerDeco, innerDeco, view, i, off)) ;\n            else {\n                // Add it as a new view\n                updater.addNode(child, outerDeco, innerDeco, view, off);\n            }\n            off += child.nodeSize;\n        });\n        // Drop all remaining descs after the current position.\n        updater.syncToMarks([], inline, view);\n        if (this.node.isTextblock)\n            updater.addTextblockHacks();\n        updater.destroyRest();\n        // Sync the DOM if anything changed\n        if (updater.changed || this.dirty == CONTENT_DIRTY) {\n            // May have to protect focused DOM from being changed if a composition is active\n            if (localComposition)\n                this.protectLocalComposition(view, localComposition);\n            renderDescs(this.contentDOM, this.children, view);\n            if (ios)\n                iosHacks(this.dom);\n        }\n    }\n    localCompositionInfo(view, pos) {\n        // Only do something if both the selection and a focused text node\n        // are inside of this node\n        let { from, to } = view.state.selection;\n        if (!(view.state.selection instanceof TextSelection) || from < pos || to > pos + this.node.content.size)\n            return null;\n        let textNode = view.input.compositionNode;\n        if (!textNode || !this.dom.contains(textNode.parentNode))\n            return null;\n        if (this.node.inlineContent) {\n            // Find the text in the focused node in the node, stop if it's not\n            // there (may have been modified through other means, in which\n            // case it should overwritten)\n            let text = textNode.nodeValue;\n            let textPos = findTextInFragment(this.node.content, text, from - pos, to - pos);\n            return textPos < 0 ? null : { node: textNode, pos: textPos, text };\n        }\n        else {\n            return { node: textNode, pos: -1, text: \"\" };\n        }\n    }\n    protectLocalComposition(view, { node, pos, text }) {\n        // The node is already part of a local view desc, leave it there\n        if (this.getDesc(node))\n            return;\n        // Create a composition view for the orphaned nodes\n        let topNode = node;\n        for (;; topNode = topNode.parentNode) {\n            if (topNode.parentNode == this.contentDOM)\n                break;\n            while (topNode.previousSibling)\n                topNode.parentNode.removeChild(topNode.previousSibling);\n            while (topNode.nextSibling)\n                topNode.parentNode.removeChild(topNode.nextSibling);\n            if (topNode.pmViewDesc)\n                topNode.pmViewDesc = undefined;\n        }\n        let desc = new CompositionViewDesc(this, topNode, node, text);\n        view.input.compositionNodes.push(desc);\n        // Patch up this.children to contain the composition view\n        this.children = replaceNodes(this.children, pos, pos + text.length, view, desc);\n    }\n    // If this desc must be updated to match the given node decoration,\n    // do so and return true.\n    update(node, outerDeco, innerDeco, view) {\n        if (this.dirty == NODE_DIRTY ||\n            !node.sameMarkup(this.node))\n            return false;\n        this.updateInner(node, outerDeco, innerDeco, view);\n        return true;\n    }\n    updateInner(node, outerDeco, innerDeco, view) {\n        this.updateOuterDeco(outerDeco);\n        this.node = node;\n        this.innerDeco = innerDeco;\n        if (this.contentDOM)\n            this.updateChildren(view, this.posAtStart);\n        this.dirty = NOT_DIRTY;\n    }\n    updateOuterDeco(outerDeco) {\n        if (sameOuterDeco(outerDeco, this.outerDeco))\n            return;\n        let needsWrap = this.nodeDOM.nodeType != 1;\n        let oldDOM = this.dom;\n        this.dom = patchOuterDeco(this.dom, this.nodeDOM, computeOuterDeco(this.outerDeco, this.node, needsWrap), computeOuterDeco(outerDeco, this.node, needsWrap));\n        if (this.dom != oldDOM) {\n            oldDOM.pmViewDesc = undefined;\n            this.dom.pmViewDesc = this;\n        }\n        this.outerDeco = outerDeco;\n    }\n    // Mark this node as being the selected node.\n    selectNode() {\n        if (this.nodeDOM.nodeType == 1)\n            this.nodeDOM.classList.add(\"ProseMirror-selectednode\");\n        if (this.contentDOM || !this.node.type.spec.draggable)\n            this.dom.draggable = true;\n    }\n    // Remove selected node marking from this node.\n    deselectNode() {\n        if (this.nodeDOM.nodeType == 1) {\n            this.nodeDOM.classList.remove(\"ProseMirror-selectednode\");\n            if (this.contentDOM || !this.node.type.spec.draggable)\n                this.dom.removeAttribute(\"draggable\");\n        }\n    }\n    get domAtom() { return this.node.isAtom; }\n}\n// Create a view desc for the top-level document node, to be exported\n// and used by the view class.\nfunction docViewDesc(doc, outerDeco, innerDeco, dom, view) {\n    applyOuterDeco(dom, outerDeco, doc);\n    let docView = new NodeViewDesc(undefined, doc, outerDeco, innerDeco, dom, dom, dom, view, 0);\n    if (docView.contentDOM)\n        docView.updateChildren(view, 0);\n    return docView;\n}\nclass TextViewDesc extends NodeViewDesc {\n    constructor(parent, node, outerDeco, innerDeco, dom, nodeDOM, view) {\n        super(parent, node, outerDeco, innerDeco, dom, null, nodeDOM, view, 0);\n    }\n    parseRule() {\n        let skip = this.nodeDOM.parentNode;\n        while (skip && skip != this.dom && !skip.pmIsDeco)\n            skip = skip.parentNode;\n        return { skip: (skip || true) };\n    }\n    update(node, outerDeco, innerDeco, view) {\n        if (this.dirty == NODE_DIRTY || (this.dirty != NOT_DIRTY && !this.inParent()) ||\n            !node.sameMarkup(this.node))\n            return false;\n        this.updateOuterDeco(outerDeco);\n        if ((this.dirty != NOT_DIRTY || node.text != this.node.text) && node.text != this.nodeDOM.nodeValue) {\n            this.nodeDOM.nodeValue = node.text;\n            if (view.trackWrites == this.nodeDOM)\n                view.trackWrites = null;\n        }\n        this.node = node;\n        this.dirty = NOT_DIRTY;\n        return true;\n    }\n    inParent() {\n        let parentDOM = this.parent.contentDOM;\n        for (let n = this.nodeDOM; n; n = n.parentNode)\n            if (n == parentDOM)\n                return true;\n        return false;\n    }\n    domFromPos(pos) {\n        return { node: this.nodeDOM, offset: pos };\n    }\n    localPosFromDOM(dom, offset, bias) {\n        if (dom == this.nodeDOM)\n            return this.posAtStart + Math.min(offset, this.node.text.length);\n        return super.localPosFromDOM(dom, offset, bias);\n    }\n    ignoreMutation(mutation) {\n        return mutation.type != \"characterData\" && mutation.type != \"selection\";\n    }\n    slice(from, to, view) {\n        let node = this.node.cut(from, to), dom = document.createTextNode(node.text);\n        return new TextViewDesc(this.parent, node, this.outerDeco, this.innerDeco, dom, dom, view);\n    }\n    markDirty(from, to) {\n        super.markDirty(from, to);\n        if (this.dom != this.nodeDOM && (from == 0 || to == this.nodeDOM.nodeValue.length))\n            this.dirty = NODE_DIRTY;\n    }\n    get domAtom() { return false; }\n    isText(text) { return this.node.text == text; }\n}\n// A dummy desc used to tag trailing BR or IMG nodes created to work\n// around contentEditable terribleness.\nclass TrailingHackViewDesc extends ViewDesc {\n    parseRule() { return { ignore: true }; }\n    matchesHack(nodeName) { return this.dirty == NOT_DIRTY && this.dom.nodeName == nodeName; }\n    get domAtom() { return true; }\n    get ignoreForCoords() { return this.dom.nodeName == \"IMG\"; }\n}\n// A separate subclass is used for customized node views, so that the\n// extra checks only have to be made for nodes that are actually\n// customized.\nclass CustomNodeViewDesc extends NodeViewDesc {\n    constructor(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, spec, view, pos) {\n        super(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos);\n        this.spec = spec;\n    }\n    // A custom `update` method gets to decide whether the update goes\n    // through. If it does, and there's a `contentDOM` node, our logic\n    // updates the children.\n    update(node, outerDeco, innerDeco, view) {\n        if (this.dirty == NODE_DIRTY)\n            return false;\n        if (this.spec.update && (this.node.type == node.type || this.spec.multiType)) {\n            let result = this.spec.update(node, outerDeco, innerDeco);\n            if (result)\n                this.updateInner(node, outerDeco, innerDeco, view);\n            return result;\n        }\n        else if (!this.contentDOM && !node.isLeaf) {\n            return false;\n        }\n        else {\n            return super.update(node, outerDeco, innerDeco, view);\n        }\n    }\n    selectNode() {\n        this.spec.selectNode ? this.spec.selectNode() : super.selectNode();\n    }\n    deselectNode() {\n        this.spec.deselectNode ? this.spec.deselectNode() : super.deselectNode();\n    }\n    setSelection(anchor, head, view, force) {\n        this.spec.setSelection ? this.spec.setSelection(anchor, head, view.root)\n            : super.setSelection(anchor, head, view, force);\n    }\n    destroy() {\n        if (this.spec.destroy)\n            this.spec.destroy();\n        super.destroy();\n    }\n    stopEvent(event) {\n        return this.spec.stopEvent ? this.spec.stopEvent(event) : false;\n    }\n    ignoreMutation(mutation) {\n        return this.spec.ignoreMutation ? this.spec.ignoreMutation(mutation) : super.ignoreMutation(mutation);\n    }\n}\n// Sync the content of the given DOM node with the nodes associated\n// with the given array of view descs, recursing into mark descs\n// because this should sync the subtree for a whole node at a time.\nfunction renderDescs(parentDOM, descs, view) {\n    let dom = parentDOM.firstChild, written = false;\n    for (let i = 0; i < descs.length; i++) {\n        let desc = descs[i], childDOM = desc.dom;\n        if (childDOM.parentNode == parentDOM) {\n            while (childDOM != dom) {\n                dom = rm(dom);\n                written = true;\n            }\n            dom = dom.nextSibling;\n        }\n        else {\n            written = true;\n            parentDOM.insertBefore(childDOM, dom);\n        }\n        if (desc instanceof MarkViewDesc) {\n            let pos = dom ? dom.previousSibling : parentDOM.lastChild;\n            renderDescs(desc.contentDOM, desc.children, view);\n            dom = pos ? pos.nextSibling : parentDOM.firstChild;\n        }\n    }\n    while (dom) {\n        dom = rm(dom);\n        written = true;\n    }\n    if (written && view.trackWrites == parentDOM)\n        view.trackWrites = null;\n}\nconst OuterDecoLevel = function (nodeName) {\n    if (nodeName)\n        this.nodeName = nodeName;\n};\nOuterDecoLevel.prototype = Object.create(null);\nconst noDeco = [new OuterDecoLevel];\nfunction computeOuterDeco(outerDeco, node, needsWrap) {\n    if (outerDeco.length == 0)\n        return noDeco;\n    let top = needsWrap ? noDeco[0] : new OuterDecoLevel, result = [top];\n    for (let i = 0; i < outerDeco.length; i++) {\n        let attrs = outerDeco[i].type.attrs;\n        if (!attrs)\n            continue;\n        if (attrs.nodeName)\n            result.push(top = new OuterDecoLevel(attrs.nodeName));\n        for (let name in attrs) {\n            let val = attrs[name];\n            if (val == null)\n                continue;\n            if (needsWrap && result.length == 1)\n                result.push(top = new OuterDecoLevel(node.isInline ? \"span\" : \"div\"));\n            if (name == \"class\")\n                top.class = (top.class ? top.class + \" \" : \"\") + val;\n            else if (name == \"style\")\n                top.style = (top.style ? top.style + \";\" : \"\") + val;\n            else if (name != \"nodeName\")\n                top[name] = val;\n        }\n    }\n    return result;\n}\nfunction patchOuterDeco(outerDOM, nodeDOM, prevComputed, curComputed) {\n    // Shortcut for trivial case\n    if (prevComputed == noDeco && curComputed == noDeco)\n        return nodeDOM;\n    let curDOM = nodeDOM;\n    for (let i = 0; i < curComputed.length; i++) {\n        let deco = curComputed[i], prev = prevComputed[i];\n        if (i) {\n            let parent;\n            if (prev && prev.nodeName == deco.nodeName && curDOM != outerDOM &&\n                (parent = curDOM.parentNode) && parent.nodeName.toLowerCase() == deco.nodeName) {\n                curDOM = parent;\n            }\n            else {\n                parent = document.createElement(deco.nodeName);\n                parent.pmIsDeco = true;\n                parent.appendChild(curDOM);\n                prev = noDeco[0];\n                curDOM = parent;\n            }\n        }\n        patchAttributes(curDOM, prev || noDeco[0], deco);\n    }\n    return curDOM;\n}\nfunction patchAttributes(dom, prev, cur) {\n    for (let name in prev)\n        if (name != \"class\" && name != \"style\" && name != \"nodeName\" && !(name in cur))\n            dom.removeAttribute(name);\n    for (let name in cur)\n        if (name != \"class\" && name != \"style\" && name != \"nodeName\" && cur[name] != prev[name])\n            dom.setAttribute(name, cur[name]);\n    if (prev.class != cur.class) {\n        let prevList = prev.class ? prev.class.split(\" \").filter(Boolean) : [];\n        let curList = cur.class ? cur.class.split(\" \").filter(Boolean) : [];\n        for (let i = 0; i < prevList.length; i++)\n            if (curList.indexOf(prevList[i]) == -1)\n                dom.classList.remove(prevList[i]);\n        for (let i = 0; i < curList.length; i++)\n            if (prevList.indexOf(curList[i]) == -1)\n                dom.classList.add(curList[i]);\n        if (dom.classList.length == 0)\n            dom.removeAttribute(\"class\");\n    }\n    if (prev.style != cur.style) {\n        if (prev.style) {\n            let prop = /\\s*([\\w\\-\\xa1-\\uffff]+)\\s*:(?:\"(?:\\\\.|[^\"])*\"|'(?:\\\\.|[^'])*'|\\(.*?\\)|[^;])*/g, m;\n            while (m = prop.exec(prev.style))\n                dom.style.removeProperty(m[1]);\n        }\n        if (cur.style)\n            dom.style.cssText += cur.style;\n    }\n}\nfunction applyOuterDeco(dom, deco, node) {\n    return patchOuterDeco(dom, dom, noDeco, computeOuterDeco(deco, node, dom.nodeType != 1));\n}\nfunction sameOuterDeco(a, b) {\n    if (a.length != b.length)\n        return false;\n    for (let i = 0; i < a.length; i++)\n        if (!a[i].type.eq(b[i].type))\n            return false;\n    return true;\n}\n// Remove a DOM node and return its next sibling.\nfunction rm(dom) {\n    let next = dom.nextSibling;\n    dom.parentNode.removeChild(dom);\n    return next;\n}\n// Helper class for incrementally updating a tree of mark descs and\n// the widget and node descs inside of them.\nclass ViewTreeUpdater {\n    constructor(top, lock, view) {\n        this.lock = lock;\n        this.view = view;\n        // Index into `this.top`'s child array, represents the current\n        // update position.\n        this.index = 0;\n        // When entering a mark, the current top and index are pushed\n        // onto this.\n        this.stack = [];\n        // Tracks whether anything was changed\n        this.changed = false;\n        this.top = top;\n        this.preMatch = preMatch(top.node.content, top);\n    }\n    // Destroy and remove the children between the given indices in\n    // `this.top`.\n    destroyBetween(start, end) {\n        if (start == end)\n            return;\n        for (let i = start; i < end; i++)\n            this.top.children[i].destroy();\n        this.top.children.splice(start, end - start);\n        this.changed = true;\n    }\n    // Destroy all remaining children in `this.top`.\n    destroyRest() {\n        this.destroyBetween(this.index, this.top.children.length);\n    }\n    // Sync the current stack of mark descs with the given array of\n    // marks, reusing existing mark descs when possible.\n    syncToMarks(marks, inline, view) {\n        let keep = 0, depth = this.stack.length >> 1;\n        let maxKeep = Math.min(depth, marks.length);\n        while (keep < maxKeep &&\n            (keep == depth - 1 ? this.top : this.stack[(keep + 1) << 1])\n                .matchesMark(marks[keep]) && marks[keep].type.spec.spanning !== false)\n            keep++;\n        while (keep < depth) {\n            this.destroyRest();\n            this.top.dirty = NOT_DIRTY;\n            this.index = this.stack.pop();\n            this.top = this.stack.pop();\n            depth--;\n        }\n        while (depth < marks.length) {\n            this.stack.push(this.top, this.index + 1);\n            let found = -1;\n            for (let i = this.index; i < Math.min(this.index + 3, this.top.children.length); i++) {\n                let next = this.top.children[i];\n                if (next.matchesMark(marks[depth]) && !this.isLocked(next.dom)) {\n                    found = i;\n                    break;\n                }\n            }\n            if (found > -1) {\n                if (found > this.index) {\n                    this.changed = true;\n                    this.destroyBetween(this.index, found);\n                }\n                this.top = this.top.children[this.index];\n            }\n            else {\n                let markDesc = MarkViewDesc.create(this.top, marks[depth], inline, view);\n                this.top.children.splice(this.index, 0, markDesc);\n                this.top = markDesc;\n                this.changed = true;\n            }\n            this.index = 0;\n            depth++;\n        }\n    }\n    // Try to find a node desc matching the given data. Skip over it and\n    // return true when successful.\n    findNodeMatch(node, outerDeco, innerDeco, index) {\n        let found = -1, targetDesc;\n        if (index >= this.preMatch.index &&\n            (targetDesc = this.preMatch.matches[index - this.preMatch.index]).parent == this.top &&\n            targetDesc.matchesNode(node, outerDeco, innerDeco)) {\n            found = this.top.children.indexOf(targetDesc, this.index);\n        }\n        else {\n            for (let i = this.index, e = Math.min(this.top.children.length, i + 5); i < e; i++) {\n                let child = this.top.children[i];\n                if (child.matchesNode(node, outerDeco, innerDeco) && !this.preMatch.matched.has(child)) {\n                    found = i;\n                    break;\n                }\n            }\n        }\n        if (found < 0)\n            return false;\n        this.destroyBetween(this.index, found);\n        this.index++;\n        return true;\n    }\n    updateNodeAt(node, outerDeco, innerDeco, index, view) {\n        let child = this.top.children[index];\n        if (child.dirty == NODE_DIRTY && child.dom == child.contentDOM)\n            child.dirty = CONTENT_DIRTY;\n        if (!child.update(node, outerDeco, innerDeco, view))\n            return false;\n        this.destroyBetween(this.index, index);\n        this.index++;\n        return true;\n    }\n    findIndexWithChild(domNode) {\n        for (;;) {\n            let parent = domNode.parentNode;\n            if (!parent)\n                return -1;\n            if (parent == this.top.contentDOM) {\n                let desc = domNode.pmViewDesc;\n                if (desc)\n                    for (let i = this.index; i < this.top.children.length; i++) {\n                        if (this.top.children[i] == desc)\n                            return i;\n                    }\n                return -1;\n            }\n            domNode = parent;\n        }\n    }\n    // Try to update the next node, if any, to the given data. Checks\n    // pre-matches to avoid overwriting nodes that could still be used.\n    updateNextNode(node, outerDeco, innerDeco, view, index, pos) {\n        for (let i = this.index; i < this.top.children.length; i++) {\n            let next = this.top.children[i];\n            if (next instanceof NodeViewDesc) {\n                let preMatch = this.preMatch.matched.get(next);\n                if (preMatch != null && preMatch != index)\n                    return false;\n                let nextDOM = next.dom, updated;\n                // Can't update if nextDOM is or contains this.lock, except if\n                // it's a text node whose content already matches the new text\n                // and whose decorations match the new ones.\n                let locked = this.isLocked(nextDOM) &&\n                    !(node.isText && next.node && next.node.isText && next.nodeDOM.nodeValue == node.text &&\n                        next.dirty != NODE_DIRTY && sameOuterDeco(outerDeco, next.outerDeco));\n                if (!locked && next.update(node, outerDeco, innerDeco, view)) {\n                    this.destroyBetween(this.index, i);\n                    if (next.dom != nextDOM)\n                        this.changed = true;\n                    this.index++;\n                    return true;\n                }\n                else if (!locked && (updated = this.recreateWrapper(next, node, outerDeco, innerDeco, view, pos))) {\n                    this.destroyBetween(this.index, i);\n                    this.top.children[this.index] = updated;\n                    if (updated.contentDOM) {\n                        updated.dirty = CONTENT_DIRTY;\n                        updated.updateChildren(view, pos + 1);\n                        updated.dirty = NOT_DIRTY;\n                    }\n                    this.changed = true;\n                    this.index++;\n                    return true;\n                }\n                break;\n            }\n        }\n        return false;\n    }\n    // When a node with content is replaced by a different node with\n    // identical content, move over its children.\n    recreateWrapper(next, node, outerDeco, innerDeco, view, pos) {\n        if (next.dirty || node.isAtom || !next.children.length ||\n            !next.node.content.eq(node.content) ||\n            !sameOuterDeco(outerDeco, next.outerDeco) || !innerDeco.eq(next.innerDeco))\n            return null;\n        let wrapper = NodeViewDesc.create(this.top, node, outerDeco, innerDeco, view, pos);\n        if (wrapper.contentDOM) {\n            wrapper.children = next.children;\n            next.children = [];\n            for (let ch of wrapper.children)\n                ch.parent = wrapper;\n        }\n        next.destroy();\n        return wrapper;\n    }\n    // Insert the node as a newly created node desc.\n    addNode(node, outerDeco, innerDeco, view, pos) {\n        let desc = NodeViewDesc.create(this.top, node, outerDeco, innerDeco, view, pos);\n        if (desc.contentDOM)\n            desc.updateChildren(view, pos + 1);\n        this.top.children.splice(this.index++, 0, desc);\n        this.changed = true;\n    }\n    placeWidget(widget, view, pos) {\n        let next = this.index < this.top.children.length ? this.top.children[this.index] : null;\n        if (next && next.matchesWidget(widget) &&\n            (widget == next.widget || !next.widget.type.toDOM.parentNode)) {\n            this.index++;\n        }\n        else {\n            let desc = new WidgetViewDesc(this.top, widget, view, pos);\n            this.top.children.splice(this.index++, 0, desc);\n            this.changed = true;\n        }\n    }\n    // Make sure a textblock looks and behaves correctly in\n    // contentEditable.\n    addTextblockHacks() {\n        let lastChild = this.top.children[this.index - 1], parent = this.top;\n        while (lastChild instanceof MarkViewDesc) {\n            parent = lastChild;\n            lastChild = parent.children[parent.children.length - 1];\n        }\n        if (!lastChild || // Empty textblock\n            !(lastChild instanceof TextViewDesc) ||\n            /\\n$/.test(lastChild.node.text) ||\n            (this.view.requiresGeckoHackNode && /\\s$/.test(lastChild.node.text))) {\n            // Avoid bugs in Safari's cursor drawing (#1165) and Chrome's mouse selection (#1152)\n            if ((safari || chrome) && lastChild && lastChild.dom.contentEditable == \"false\")\n                this.addHackNode(\"IMG\", parent);\n            this.addHackNode(\"BR\", this.top);\n        }\n    }\n    addHackNode(nodeName, parent) {\n        if (parent == this.top && this.index < parent.children.length && parent.children[this.index].matchesHack(nodeName)) {\n            this.index++;\n        }\n        else {\n            let dom = document.createElement(nodeName);\n            if (nodeName == \"IMG\") {\n                dom.className = \"ProseMirror-separator\";\n                dom.alt = \"\";\n            }\n            if (nodeName == \"BR\")\n                dom.className = \"ProseMirror-trailingBreak\";\n            let hack = new TrailingHackViewDesc(this.top, [], dom, null);\n            if (parent != this.top)\n                parent.children.push(hack);\n            else\n                parent.children.splice(this.index++, 0, hack);\n            this.changed = true;\n        }\n    }\n    isLocked(node) {\n        return this.lock && (node == this.lock || node.nodeType == 1 && node.contains(this.lock.parentNode));\n    }\n}\n// Iterate from the end of the fragment and array of descs to find\n// directly matching ones, in order to avoid overeagerly reusing those\n// for other nodes. Returns the fragment index of the first node that\n// is part of the sequence of matched nodes at the end of the\n// fragment.\nfunction preMatch(frag, parentDesc) {\n    let curDesc = parentDesc, descI = curDesc.children.length;\n    let fI = frag.childCount, matched = new Map, matches = [];\n    outer: while (fI > 0) {\n        let desc;\n        for (;;) {\n            if (descI) {\n                let next = curDesc.children[descI - 1];\n                if (next instanceof MarkViewDesc) {\n                    curDesc = next;\n                    descI = next.children.length;\n                }\n                else {\n                    desc = next;\n                    descI--;\n                    break;\n                }\n            }\n            else if (curDesc == parentDesc) {\n                break outer;\n            }\n            else {\n                // FIXME\n                descI = curDesc.parent.children.indexOf(curDesc);\n                curDesc = curDesc.parent;\n            }\n        }\n        let node = desc.node;\n        if (!node)\n            continue;\n        if (node != frag.child(fI - 1))\n            break;\n        --fI;\n        matched.set(desc, fI);\n        matches.push(desc);\n    }\n    return { index: fI, matched, matches: matches.reverse() };\n}\nfunction compareSide(a, b) {\n    return a.type.side - b.type.side;\n}\n// This function abstracts iterating over the nodes and decorations in\n// a fragment. Calls `onNode` for each node, with its local and child\n// decorations. Splits text nodes when there is a decoration starting\n// or ending inside of them. Calls `onWidget` for each widget.\nfunction iterDeco(parent, deco, onWidget, onNode) {\n    let locals = deco.locals(parent), offset = 0;\n    // Simple, cheap variant for when there are no local decorations\n    if (locals.length == 0) {\n        for (let i = 0; i < parent.childCount; i++) {\n            let child = parent.child(i);\n            onNode(child, locals, deco.forChild(offset, child), i);\n            offset += child.nodeSize;\n        }\n        return;\n    }\n    let decoIndex = 0, active = [], restNode = null;\n    for (let parentIndex = 0;;) {\n        let widget, widgets;\n        while (decoIndex < locals.length && locals[decoIndex].to == offset) {\n            let next = locals[decoIndex++];\n            if (next.widget) {\n                if (!widget)\n                    widget = next;\n                else\n                    (widgets || (widgets = [widget])).push(next);\n            }\n        }\n        if (widget) {\n            if (widgets) {\n                widgets.sort(compareSide);\n                for (let i = 0; i < widgets.length; i++)\n                    onWidget(widgets[i], parentIndex, !!restNode);\n            }\n            else {\n                onWidget(widget, parentIndex, !!restNode);\n            }\n        }\n        let child, index;\n        if (restNode) {\n            index = -1;\n            child = restNode;\n            restNode = null;\n        }\n        else if (parentIndex < parent.childCount) {\n            index = parentIndex;\n            child = parent.child(parentIndex++);\n        }\n        else {\n            break;\n        }\n        for (let i = 0; i < active.length; i++)\n            if (active[i].to <= offset)\n                active.splice(i--, 1);\n        while (decoIndex < locals.length && locals[decoIndex].from <= offset && locals[decoIndex].to > offset)\n            active.push(locals[decoIndex++]);\n        let end = offset + child.nodeSize;\n        if (child.isText) {\n            let cutAt = end;\n            if (decoIndex < locals.length && locals[decoIndex].from < cutAt)\n                cutAt = locals[decoIndex].from;\n            for (let i = 0; i < active.length; i++)\n                if (active[i].to < cutAt)\n                    cutAt = active[i].to;\n            if (cutAt < end) {\n                restNode = child.cut(cutAt - offset);\n                child = child.cut(0, cutAt - offset);\n                end = cutAt;\n                index = -1;\n            }\n        }\n        else {\n            while (decoIndex < locals.length && locals[decoIndex].to < end)\n                decoIndex++;\n        }\n        let outerDeco = child.isInline && !child.isLeaf ? active.filter(d => !d.inline) : active.slice();\n        onNode(child, outerDeco, deco.forChild(offset, child), index);\n        offset = end;\n    }\n}\n// List markers in Mobile Safari will mysteriously disappear\n// sometimes. This works around that.\nfunction iosHacks(dom) {\n    if (dom.nodeName == \"UL\" || dom.nodeName == \"OL\") {\n        let oldCSS = dom.style.cssText;\n        dom.style.cssText = oldCSS + \"; list-style: square !important\";\n        window.getComputedStyle(dom).listStyle;\n        dom.style.cssText = oldCSS;\n    }\n}\n// Find a piece of text in an inline fragment, overlapping from-to\nfunction findTextInFragment(frag, text, from, to) {\n    for (let i = 0, pos = 0; i < frag.childCount && pos <= to;) {\n        let child = frag.child(i++), childStart = pos;\n        pos += child.nodeSize;\n        if (!child.isText)\n            continue;\n        let str = child.text;\n        while (i < frag.childCount) {\n            let next = frag.child(i++);\n            pos += next.nodeSize;\n            if (!next.isText)\n                break;\n            str += next.text;\n        }\n        if (pos >= from) {\n            if (pos >= to && str.slice(to - text.length - childStart, to - childStart) == text)\n                return to - text.length;\n            let found = childStart < to ? str.lastIndexOf(text, to - childStart - 1) : -1;\n            if (found >= 0 && found + text.length + childStart >= from)\n                return childStart + found;\n            if (from == to && str.length >= (to + text.length) - childStart &&\n                str.slice(to - childStart, to - childStart + text.length) == text)\n                return to;\n        }\n    }\n    return -1;\n}\n// Replace range from-to in an array of view descs with replacement\n// (may be null to just delete). This goes very much against the grain\n// of the rest of this code, which tends to create nodes with the\n// right shape in one go, rather than messing with them after\n// creation, but is necessary in the composition hack.\nfunction replaceNodes(nodes, from, to, view, replacement) {\n    let result = [];\n    for (let i = 0, off = 0; i < nodes.length; i++) {\n        let child = nodes[i], start = off, end = off += child.size;\n        if (start >= to || end <= from) {\n            result.push(child);\n        }\n        else {\n            if (start < from)\n                result.push(child.slice(0, from - start, view));\n            if (replacement) {\n                result.push(replacement);\n                replacement = undefined;\n            }\n            if (end > to)\n                result.push(child.slice(to - start, child.size, view));\n        }\n    }\n    return result;\n}\n\nfunction selectionFromDOM(view, origin = null) {\n    let domSel = view.domSelectionRange(), doc = view.state.doc;\n    if (!domSel.focusNode)\n        return null;\n    let nearestDesc = view.docView.nearestDesc(domSel.focusNode), inWidget = nearestDesc && nearestDesc.size == 0;\n    let head = view.docView.posFromDOM(domSel.focusNode, domSel.focusOffset, 1);\n    if (head < 0)\n        return null;\n    let $head = doc.resolve(head), anchor, selection;\n    if (selectionCollapsed(domSel)) {\n        anchor = head;\n        while (nearestDesc && !nearestDesc.node)\n            nearestDesc = nearestDesc.parent;\n        let nearestDescNode = nearestDesc.node;\n        if (nearestDesc && nearestDescNode.isAtom && NodeSelection.isSelectable(nearestDescNode) && nearestDesc.parent\n            && !(nearestDescNode.isInline && isOnEdge(domSel.focusNode, domSel.focusOffset, nearestDesc.dom))) {\n            let pos = nearestDesc.posBefore;\n            selection = new NodeSelection(head == pos ? $head : doc.resolve(pos));\n        }\n    }\n    else {\n        if (domSel instanceof view.dom.ownerDocument.defaultView.Selection && domSel.rangeCount > 1) {\n            let min = head, max = head;\n            for (let i = 0; i < domSel.rangeCount; i++) {\n                let range = domSel.getRangeAt(i);\n                min = Math.min(min, view.docView.posFromDOM(range.startContainer, range.startOffset, 1));\n                max = Math.max(max, view.docView.posFromDOM(range.endContainer, range.endOffset, -1));\n            }\n            if (min < 0)\n                return null;\n            [anchor, head] = max == view.state.selection.anchor ? [max, min] : [min, max];\n            $head = doc.resolve(head);\n        }\n        else {\n            anchor = view.docView.posFromDOM(domSel.anchorNode, domSel.anchorOffset, 1);\n        }\n        if (anchor < 0)\n            return null;\n    }\n    let $anchor = doc.resolve(anchor);\n    if (!selection) {\n        let bias = origin == \"pointer\" || (view.state.selection.head < $head.pos && !inWidget) ? 1 : -1;\n        selection = selectionBetween(view, $anchor, $head, bias);\n    }\n    return selection;\n}\nfunction editorOwnsSelection(view) {\n    return view.editable ? view.hasFocus() :\n        hasSelection(view) && document.activeElement && document.activeElement.contains(view.dom);\n}\nfunction selectionToDOM(view, force = false) {\n    let sel = view.state.selection;\n    syncNodeSelection(view, sel);\n    if (!editorOwnsSelection(view))\n        return;\n    // The delayed drag selection causes issues with Cell Selections\n    // in Safari. And the drag selection delay is to workarond issues\n    // which only present in Chrome.\n    if (!force && view.input.mouseDown && view.input.mouseDown.allowDefault && chrome) {\n        let domSel = view.domSelectionRange(), curSel = view.domObserver.currentSelection;\n        if (domSel.anchorNode && curSel.anchorNode &&\n            isEquivalentPosition(domSel.anchorNode, domSel.anchorOffset, curSel.anchorNode, curSel.anchorOffset)) {\n            view.input.mouseDown.delayedSelectionSync = true;\n            view.domObserver.setCurSelection();\n            return;\n        }\n    }\n    view.domObserver.disconnectSelection();\n    if (view.cursorWrapper) {\n        selectCursorWrapper(view);\n    }\n    else {\n        let { anchor, head } = sel, resetEditableFrom, resetEditableTo;\n        if (brokenSelectBetweenUneditable && !(sel instanceof TextSelection)) {\n            if (!sel.$from.parent.inlineContent)\n                resetEditableFrom = temporarilyEditableNear(view, sel.from);\n            if (!sel.empty && !sel.$from.parent.inlineContent)\n                resetEditableTo = temporarilyEditableNear(view, sel.to);\n        }\n        view.docView.setSelection(anchor, head, view, force);\n        if (brokenSelectBetweenUneditable) {\n            if (resetEditableFrom)\n                resetEditable(resetEditableFrom);\n            if (resetEditableTo)\n                resetEditable(resetEditableTo);\n        }\n        if (sel.visible) {\n            view.dom.classList.remove(\"ProseMirror-hideselection\");\n        }\n        else {\n            view.dom.classList.add(\"ProseMirror-hideselection\");\n            if (\"onselectionchange\" in document)\n                removeClassOnSelectionChange(view);\n        }\n    }\n    view.domObserver.setCurSelection();\n    view.domObserver.connectSelection();\n}\n// Kludge to work around Webkit not allowing a selection to start/end\n// between non-editable block nodes. We briefly make something\n// editable, set the selection, then set it uneditable again.\nconst brokenSelectBetweenUneditable = safari || chrome && chrome_version < 63;\nfunction temporarilyEditableNear(view, pos) {\n    let { node, offset } = view.docView.domFromPos(pos, 0);\n    let after = offset < node.childNodes.length ? node.childNodes[offset] : null;\n    let before = offset ? node.childNodes[offset - 1] : null;\n    if (safari && after && after.contentEditable == \"false\")\n        return setEditable(after);\n    if ((!after || after.contentEditable == \"false\") &&\n        (!before || before.contentEditable == \"false\")) {\n        if (after)\n            return setEditable(after);\n        else if (before)\n            return setEditable(before);\n    }\n}\nfunction setEditable(element) {\n    element.contentEditable = \"true\";\n    if (safari && element.draggable) {\n        element.draggable = false;\n        element.wasDraggable = true;\n    }\n    return element;\n}\nfunction resetEditable(element) {\n    element.contentEditable = \"false\";\n    if (element.wasDraggable) {\n        element.draggable = true;\n        element.wasDraggable = null;\n    }\n}\nfunction removeClassOnSelectionChange(view) {\n    let doc = view.dom.ownerDocument;\n    doc.removeEventListener(\"selectionchange\", view.input.hideSelectionGuard);\n    let domSel = view.domSelectionRange();\n    let node = domSel.anchorNode, offset = domSel.anchorOffset;\n    doc.addEventListener(\"selectionchange\", view.input.hideSelectionGuard = () => {\n        if (domSel.anchorNode != node || domSel.anchorOffset != offset) {\n            doc.removeEventListener(\"selectionchange\", view.input.hideSelectionGuard);\n            setTimeout(() => {\n                if (!editorOwnsSelection(view) || view.state.selection.visible)\n                    view.dom.classList.remove(\"ProseMirror-hideselection\");\n            }, 20);\n        }\n    });\n}\nfunction selectCursorWrapper(view) {\n    let domSel = view.domSelection(), range = document.createRange();\n    if (!domSel)\n        return;\n    let node = view.cursorWrapper.dom, img = node.nodeName == \"IMG\";\n    if (img)\n        range.setStart(node.parentNode, domIndex(node) + 1);\n    else\n        range.setStart(node, 0);\n    range.collapse(true);\n    domSel.removeAllRanges();\n    domSel.addRange(range);\n    // Kludge to kill 'control selection' in IE11 when selecting an\n    // invisible cursor wrapper, since that would result in those weird\n    // resize handles and a selection that considers the absolutely\n    // positioned wrapper, rather than the root editable node, the\n    // focused element.\n    if (!img && !view.state.selection.visible && ie && ie_version <= 11) {\n        node.disabled = true;\n        node.disabled = false;\n    }\n}\nfunction syncNodeSelection(view, sel) {\n    if (sel instanceof NodeSelection) {\n        let desc = view.docView.descAt(sel.from);\n        if (desc != view.lastSelectedViewDesc) {\n            clearNodeSelection(view);\n            if (desc)\n                desc.selectNode();\n            view.lastSelectedViewDesc = desc;\n        }\n    }\n    else {\n        clearNodeSelection(view);\n    }\n}\n// Clear all DOM statefulness of the last node selection.\nfunction clearNodeSelection(view) {\n    if (view.lastSelectedViewDesc) {\n        if (view.lastSelectedViewDesc.parent)\n            view.lastSelectedViewDesc.deselectNode();\n        view.lastSelectedViewDesc = undefined;\n    }\n}\nfunction selectionBetween(view, $anchor, $head, bias) {\n    return view.someProp(\"createSelectionBetween\", f => f(view, $anchor, $head))\n        || TextSelection.between($anchor, $head, bias);\n}\nfunction hasFocusAndSelection(view) {\n    if (view.editable && !view.hasFocus())\n        return false;\n    return hasSelection(view);\n}\nfunction hasSelection(view) {\n    let sel = view.domSelectionRange();\n    if (!sel.anchorNode)\n        return false;\n    try {\n        // Firefox will raise 'permission denied' errors when accessing\n        // properties of `sel.anchorNode` when it's in a generated CSS\n        // element.\n        return view.dom.contains(sel.anchorNode.nodeType == 3 ? sel.anchorNode.parentNode : sel.anchorNode) &&\n            (view.editable || view.dom.contains(sel.focusNode.nodeType == 3 ? sel.focusNode.parentNode : sel.focusNode));\n    }\n    catch (_) {\n        return false;\n    }\n}\nfunction anchorInRightPlace(view) {\n    let anchorDOM = view.docView.domFromPos(view.state.selection.anchor, 0);\n    let domSel = view.domSelectionRange();\n    return isEquivalentPosition(anchorDOM.node, anchorDOM.offset, domSel.anchorNode, domSel.anchorOffset);\n}\n\nfunction moveSelectionBlock(state, dir) {\n    let { $anchor, $head } = state.selection;\n    let $side = dir > 0 ? $anchor.max($head) : $anchor.min($head);\n    let $start = !$side.parent.inlineContent ? $side : $side.depth ? state.doc.resolve(dir > 0 ? $side.after() : $side.before()) : null;\n    return $start && Selection.findFrom($start, dir);\n}\nfunction apply(view, sel) {\n    view.dispatch(view.state.tr.setSelection(sel).scrollIntoView());\n    return true;\n}\nfunction selectHorizontally(view, dir, mods) {\n    let sel = view.state.selection;\n    if (sel instanceof TextSelection) {\n        if (mods.indexOf(\"s\") > -1) {\n            let { $head } = sel, node = $head.textOffset ? null : dir < 0 ? $head.nodeBefore : $head.nodeAfter;\n            if (!node || node.isText || !node.isLeaf)\n                return false;\n            let $newHead = view.state.doc.resolve($head.pos + node.nodeSize * (dir < 0 ? -1 : 1));\n            return apply(view, new TextSelection(sel.$anchor, $newHead));\n        }\n        else if (!sel.empty) {\n            return false;\n        }\n        else if (view.endOfTextblock(dir > 0 ? \"forward\" : \"backward\")) {\n            let next = moveSelectionBlock(view.state, dir);\n            if (next && (next instanceof NodeSelection))\n                return apply(view, next);\n            return false;\n        }\n        else if (!(mac && mods.indexOf(\"m\") > -1)) {\n            let $head = sel.$head, node = $head.textOffset ? null : dir < 0 ? $head.nodeBefore : $head.nodeAfter, desc;\n            if (!node || node.isText)\n                return false;\n            let nodePos = dir < 0 ? $head.pos - node.nodeSize : $head.pos;\n            if (!(node.isAtom || (desc = view.docView.descAt(nodePos)) && !desc.contentDOM))\n                return false;\n            if (NodeSelection.isSelectable(node)) {\n                return apply(view, new NodeSelection(dir < 0 ? view.state.doc.resolve($head.pos - node.nodeSize) : $head));\n            }\n            else if (webkit) {\n                // Chrome and Safari will introduce extra pointless cursor\n                // positions around inline uneditable nodes, so we have to\n                // take over and move the cursor past them (#937)\n                return apply(view, new TextSelection(view.state.doc.resolve(dir < 0 ? nodePos : nodePos + node.nodeSize)));\n            }\n            else {\n                return false;\n            }\n        }\n    }\n    else if (sel instanceof NodeSelection && sel.node.isInline) {\n        return apply(view, new TextSelection(dir > 0 ? sel.$to : sel.$from));\n    }\n    else {\n        let next = moveSelectionBlock(view.state, dir);\n        if (next)\n            return apply(view, next);\n        return false;\n    }\n}\nfunction nodeLen(node) {\n    return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;\n}\nfunction isIgnorable(dom, dir) {\n    let desc = dom.pmViewDesc;\n    return desc && desc.size == 0 && (dir < 0 || dom.nextSibling || dom.nodeName != \"BR\");\n}\nfunction skipIgnoredNodes(view, dir) {\n    return dir < 0 ? skipIgnoredNodesBefore(view) : skipIgnoredNodesAfter(view);\n}\n// Make sure the cursor isn't directly after one or more ignored\n// nodes, which will confuse the browser's cursor motion logic.\nfunction skipIgnoredNodesBefore(view) {\n    let sel = view.domSelectionRange();\n    let node = sel.focusNode, offset = sel.focusOffset;\n    if (!node)\n        return;\n    let moveNode, moveOffset, force = false;\n    // Gecko will do odd things when the selection is directly in front\n    // of a non-editable node, so in that case, move it into the next\n    // node if possible. Issue prosemirror/prosemirror#832.\n    if (gecko && node.nodeType == 1 && offset < nodeLen(node) && isIgnorable(node.childNodes[offset], -1))\n        force = true;\n    for (;;) {\n        if (offset > 0) {\n            if (node.nodeType != 1) {\n                break;\n            }\n            else {\n                let before = node.childNodes[offset - 1];\n                if (isIgnorable(before, -1)) {\n                    moveNode = node;\n                    moveOffset = --offset;\n                }\n                else if (before.nodeType == 3) {\n                    node = before;\n                    offset = node.nodeValue.length;\n                }\n                else\n                    break;\n            }\n        }\n        else if (isBlockNode(node)) {\n            break;\n        }\n        else {\n            let prev = node.previousSibling;\n            while (prev && isIgnorable(prev, -1)) {\n                moveNode = node.parentNode;\n                moveOffset = domIndex(prev);\n                prev = prev.previousSibling;\n            }\n            if (!prev) {\n                node = node.parentNode;\n                if (node == view.dom)\n                    break;\n                offset = 0;\n            }\n            else {\n                node = prev;\n                offset = nodeLen(node);\n            }\n        }\n    }\n    if (force)\n        setSelFocus(view, node, offset);\n    else if (moveNode)\n        setSelFocus(view, moveNode, moveOffset);\n}\n// Make sure the cursor isn't directly before one or more ignored\n// nodes.\nfunction skipIgnoredNodesAfter(view) {\n    let sel = view.domSelectionRange();\n    let node = sel.focusNode, offset = sel.focusOffset;\n    if (!node)\n        return;\n    let len = nodeLen(node);\n    let moveNode, moveOffset;\n    for (;;) {\n        if (offset < len) {\n            if (node.nodeType != 1)\n                break;\n            let after = node.childNodes[offset];\n            if (isIgnorable(after, 1)) {\n                moveNode = node;\n                moveOffset = ++offset;\n            }\n            else\n                break;\n        }\n        else if (isBlockNode(node)) {\n            break;\n        }\n        else {\n            let next = node.nextSibling;\n            while (next && isIgnorable(next, 1)) {\n                moveNode = next.parentNode;\n                moveOffset = domIndex(next) + 1;\n                next = next.nextSibling;\n            }\n            if (!next) {\n                node = node.parentNode;\n                if (node == view.dom)\n                    break;\n                offset = len = 0;\n            }\n            else {\n                node = next;\n                offset = 0;\n                len = nodeLen(node);\n            }\n        }\n    }\n    if (moveNode)\n        setSelFocus(view, moveNode, moveOffset);\n}\nfunction isBlockNode(dom) {\n    let desc = dom.pmViewDesc;\n    return desc && desc.node && desc.node.isBlock;\n}\nfunction textNodeAfter(node, offset) {\n    while (node && offset == node.childNodes.length && !hasBlockDesc(node)) {\n        offset = domIndex(node) + 1;\n        node = node.parentNode;\n    }\n    while (node && offset < node.childNodes.length) {\n        let next = node.childNodes[offset];\n        if (next.nodeType == 3)\n            return next;\n        if (next.nodeType == 1 && next.contentEditable == \"false\")\n            break;\n        node = next;\n        offset = 0;\n    }\n}\nfunction textNodeBefore(node, offset) {\n    while (node && !offset && !hasBlockDesc(node)) {\n        offset = domIndex(node);\n        node = node.parentNode;\n    }\n    while (node && offset) {\n        let next = node.childNodes[offset - 1];\n        if (next.nodeType == 3)\n            return next;\n        if (next.nodeType == 1 && next.contentEditable == \"false\")\n            break;\n        node = next;\n        offset = node.childNodes.length;\n    }\n}\nfunction setSelFocus(view, node, offset) {\n    if (node.nodeType != 3) {\n        let before, after;\n        if (after = textNodeAfter(node, offset)) {\n            node = after;\n            offset = 0;\n        }\n        else if (before = textNodeBefore(node, offset)) {\n            node = before;\n            offset = before.nodeValue.length;\n        }\n    }\n    let sel = view.domSelection();\n    if (!sel)\n        return;\n    if (selectionCollapsed(sel)) {\n        let range = document.createRange();\n        range.setEnd(node, offset);\n        range.setStart(node, offset);\n        sel.removeAllRanges();\n        sel.addRange(range);\n    }\n    else if (sel.extend) {\n        sel.extend(node, offset);\n    }\n    view.domObserver.setCurSelection();\n    let { state } = view;\n    // If no state update ends up happening, reset the selection.\n    setTimeout(() => {\n        if (view.state == state)\n            selectionToDOM(view);\n    }, 50);\n}\nfunction findDirection(view, pos) {\n    let $pos = view.state.doc.resolve(pos);\n    if (!(chrome || windows) && $pos.parent.inlineContent) {\n        let coords = view.coordsAtPos(pos);\n        if (pos > $pos.start()) {\n            let before = view.coordsAtPos(pos - 1);\n            let mid = (before.top + before.bottom) / 2;\n            if (mid > coords.top && mid < coords.bottom && Math.abs(before.left - coords.left) > 1)\n                return before.left < coords.left ? \"ltr\" : \"rtl\";\n        }\n        if (pos < $pos.end()) {\n            let after = view.coordsAtPos(pos + 1);\n            let mid = (after.top + after.bottom) / 2;\n            if (mid > coords.top && mid < coords.bottom && Math.abs(after.left - coords.left) > 1)\n                return after.left > coords.left ? \"ltr\" : \"rtl\";\n        }\n    }\n    let computed = getComputedStyle(view.dom).direction;\n    return computed == \"rtl\" ? \"rtl\" : \"ltr\";\n}\n// Check whether vertical selection motion would involve node\n// selections. If so, apply it (if not, the result is left to the\n// browser)\nfunction selectVertically(view, dir, mods) {\n    let sel = view.state.selection;\n    if (sel instanceof TextSelection && !sel.empty || mods.indexOf(\"s\") > -1)\n        return false;\n    if (mac && mods.indexOf(\"m\") > -1)\n        return false;\n    let { $from, $to } = sel;\n    if (!$from.parent.inlineContent || view.endOfTextblock(dir < 0 ? \"up\" : \"down\")) {\n        let next = moveSelectionBlock(view.state, dir);\n        if (next && (next instanceof NodeSelection))\n            return apply(view, next);\n    }\n    if (!$from.parent.inlineContent) {\n        let side = dir < 0 ? $from : $to;\n        let beyond = sel instanceof AllSelection ? Selection.near(side, dir) : Selection.findFrom(side, dir);\n        return beyond ? apply(view, beyond) : false;\n    }\n    return false;\n}\nfunction stopNativeHorizontalDelete(view, dir) {\n    if (!(view.state.selection instanceof TextSelection))\n        return true;\n    let { $head, $anchor, empty } = view.state.selection;\n    if (!$head.sameParent($anchor))\n        return true;\n    if (!empty)\n        return false;\n    if (view.endOfTextblock(dir > 0 ? \"forward\" : \"backward\"))\n        return true;\n    let nextNode = !$head.textOffset && (dir < 0 ? $head.nodeBefore : $head.nodeAfter);\n    if (nextNode && !nextNode.isText) {\n        let tr = view.state.tr;\n        if (dir < 0)\n            tr.delete($head.pos - nextNode.nodeSize, $head.pos);\n        else\n            tr.delete($head.pos, $head.pos + nextNode.nodeSize);\n        view.dispatch(tr);\n        return true;\n    }\n    return false;\n}\nfunction switchEditable(view, node, state) {\n    view.domObserver.stop();\n    node.contentEditable = state;\n    view.domObserver.start();\n}\n// Issue #867 / #1090 / https://bugs.chromium.org/p/chromium/issues/detail?id=903821\n// In which Safari (and at some point in the past, Chrome) does really\n// wrong things when the down arrow is pressed when the cursor is\n// directly at the start of a textblock and has an uneditable node\n// after it\nfunction safariDownArrowBug(view) {\n    if (!safari || view.state.selection.$head.parentOffset > 0)\n        return false;\n    let { focusNode, focusOffset } = view.domSelectionRange();\n    if (focusNode && focusNode.nodeType == 1 && focusOffset == 0 &&\n        focusNode.firstChild && focusNode.firstChild.contentEditable == \"false\") {\n        let child = focusNode.firstChild;\n        switchEditable(view, child, \"true\");\n        setTimeout(() => switchEditable(view, child, \"false\"), 20);\n    }\n    return false;\n}\n// A backdrop key mapping used to make sure we always suppress keys\n// that have a dangerous default effect, even if the commands they are\n// bound to return false, and to make sure that cursor-motion keys\n// find a cursor (as opposed to a node selection) when pressed. For\n// cursor-motion keys, the code in the handlers also takes care of\n// block selections.\nfunction getMods(event) {\n    let result = \"\";\n    if (event.ctrlKey)\n        result += \"c\";\n    if (event.metaKey)\n        result += \"m\";\n    if (event.altKey)\n        result += \"a\";\n    if (event.shiftKey)\n        result += \"s\";\n    return result;\n}\nfunction captureKeyDown(view, event) {\n    let code = event.keyCode, mods = getMods(event);\n    if (code == 8 || (mac && code == 72 && mods == \"c\")) { // Backspace, Ctrl-h on Mac\n        return stopNativeHorizontalDelete(view, -1) || skipIgnoredNodes(view, -1);\n    }\n    else if ((code == 46 && !event.shiftKey) || (mac && code == 68 && mods == \"c\")) { // Delete, Ctrl-d on Mac\n        return stopNativeHorizontalDelete(view, 1) || skipIgnoredNodes(view, 1);\n    }\n    else if (code == 13 || code == 27) { // Enter, Esc\n        return true;\n    }\n    else if (code == 37 || (mac && code == 66 && mods == \"c\")) { // Left arrow, Ctrl-b on Mac\n        let dir = code == 37 ? (findDirection(view, view.state.selection.from) == \"ltr\" ? -1 : 1) : -1;\n        return selectHorizontally(view, dir, mods) || skipIgnoredNodes(view, dir);\n    }\n    else if (code == 39 || (mac && code == 70 && mods == \"c\")) { // Right arrow, Ctrl-f on Mac\n        let dir = code == 39 ? (findDirection(view, view.state.selection.from) == \"ltr\" ? 1 : -1) : 1;\n        return selectHorizontally(view, dir, mods) || skipIgnoredNodes(view, dir);\n    }\n    else if (code == 38 || (mac && code == 80 && mods == \"c\")) { // Up arrow, Ctrl-p on Mac\n        return selectVertically(view, -1, mods) || skipIgnoredNodes(view, -1);\n    }\n    else if (code == 40 || (mac && code == 78 && mods == \"c\")) { // Down arrow, Ctrl-n on Mac\n        return safariDownArrowBug(view) || selectVertically(view, 1, mods) || skipIgnoredNodes(view, 1);\n    }\n    else if (mods == (mac ? \"m\" : \"c\") &&\n        (code == 66 || code == 73 || code == 89 || code == 90)) { // Mod-[biyz]\n        return true;\n    }\n    return false;\n}\n\nfunction serializeForClipboard(view, slice) {\n    view.someProp(\"transformCopied\", f => { slice = f(slice, view); });\n    let context = [], { content, openStart, openEnd } = slice;\n    while (openStart > 1 && openEnd > 1 && content.childCount == 1 && content.firstChild.childCount == 1) {\n        openStart--;\n        openEnd--;\n        let node = content.firstChild;\n        context.push(node.type.name, node.attrs != node.type.defaultAttrs ? node.attrs : null);\n        content = node.content;\n    }\n    let serializer = view.someProp(\"clipboardSerializer\") || DOMSerializer.fromSchema(view.state.schema);\n    let doc = detachedDoc(), wrap = doc.createElement(\"div\");\n    wrap.appendChild(serializer.serializeFragment(content, { document: doc }));\n    let firstChild = wrap.firstChild, needsWrap, wrappers = 0;\n    while (firstChild && firstChild.nodeType == 1 && (needsWrap = wrapMap[firstChild.nodeName.toLowerCase()])) {\n        for (let i = needsWrap.length - 1; i >= 0; i--) {\n            let wrapper = doc.createElement(needsWrap[i]);\n            while (wrap.firstChild)\n                wrapper.appendChild(wrap.firstChild);\n            wrap.appendChild(wrapper);\n            wrappers++;\n        }\n        firstChild = wrap.firstChild;\n    }\n    if (firstChild && firstChild.nodeType == 1)\n        firstChild.setAttribute(\"data-pm-slice\", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : \"\"} ${JSON.stringify(context)}`);\n    let text = view.someProp(\"clipboardTextSerializer\", f => f(slice, view)) ||\n        slice.content.textBetween(0, slice.content.size, \"\\n\\n\");\n    return { dom: wrap, text, slice };\n}\n// Read a slice of content from the clipboard (or drop data).\nfunction parseFromClipboard(view, text, html, plainText, $context) {\n    let inCode = $context.parent.type.spec.code;\n    let dom, slice;\n    if (!html && !text)\n        return null;\n    let asText = text && (plainText || inCode || !html);\n    if (asText) {\n        view.someProp(\"transformPastedText\", f => { text = f(text, inCode || plainText, view); });\n        if (inCode)\n            return text ? new Slice(Fragment.from(view.state.schema.text(text.replace(/\\r\\n?/g, \"\\n\"))), 0, 0) : Slice.empty;\n        let parsed = view.someProp(\"clipboardTextParser\", f => f(text, $context, plainText, view));\n        if (parsed) {\n            slice = parsed;\n        }\n        else {\n            let marks = $context.marks();\n            let { schema } = view.state, serializer = DOMSerializer.fromSchema(schema);\n            dom = document.createElement(\"div\");\n            text.split(/(?:\\r\\n?|\\n)+/).forEach(block => {\n                let p = dom.appendChild(document.createElement(\"p\"));\n                if (block)\n                    p.appendChild(serializer.serializeNode(schema.text(block, marks)));\n            });\n        }\n    }\n    else {\n        view.someProp(\"transformPastedHTML\", f => { html = f(html, view); });\n        dom = readHTML(html);\n        if (webkit)\n            restoreReplacedSpaces(dom);\n    }\n    let contextNode = dom && dom.querySelector(\"[data-pm-slice]\");\n    let sliceData = contextNode && /^(\\d+) (\\d+)(?: -(\\d+))? (.*)/.exec(contextNode.getAttribute(\"data-pm-slice\") || \"\");\n    if (sliceData && sliceData[3])\n        for (let i = +sliceData[3]; i > 0; i--) {\n            let child = dom.firstChild;\n            while (child && child.nodeType != 1)\n                child = child.nextSibling;\n            if (!child)\n                break;\n            dom = child;\n        }\n    if (!slice) {\n        let parser = view.someProp(\"clipboardParser\") || view.someProp(\"domParser\") || DOMParser.fromSchema(view.state.schema);\n        slice = parser.parseSlice(dom, {\n            preserveWhitespace: !!(asText || sliceData),\n            context: $context,\n            ruleFromNode(dom) {\n                if (dom.nodeName == \"BR\" && !dom.nextSibling &&\n                    dom.parentNode && !inlineParents.test(dom.parentNode.nodeName))\n                    return { ignore: true };\n                return null;\n            }\n        });\n    }\n    if (sliceData) {\n        slice = addContext(closeSlice(slice, +sliceData[1], +sliceData[2]), sliceData[4]);\n    }\n    else { // HTML wasn't created by ProseMirror. Make sure top-level siblings are coherent\n        slice = Slice.maxOpen(normalizeSiblings(slice.content, $context), true);\n        if (slice.openStart || slice.openEnd) {\n            let openStart = 0, openEnd = 0;\n            for (let node = slice.content.firstChild; openStart < slice.openStart && !node.type.spec.isolating; openStart++, node = node.firstChild) { }\n            for (let node = slice.content.lastChild; openEnd < slice.openEnd && !node.type.spec.isolating; openEnd++, node = node.lastChild) { }\n            slice = closeSlice(slice, openStart, openEnd);\n        }\n    }\n    view.someProp(\"transformPasted\", f => { slice = f(slice, view); });\n    return slice;\n}\nconst inlineParents = /^(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;\n// Takes a slice parsed with parseSlice, which means there hasn't been\n// any content-expression checking done on the top nodes, tries to\n// find a parent node in the current context that might fit the nodes,\n// and if successful, rebuilds the slice so that it fits into that parent.\n//\n// This addresses the problem that Transform.replace expects a\n// coherent slice, and will fail to place a set of siblings that don't\n// fit anywhere in the schema.\nfunction normalizeSiblings(fragment, $context) {\n    if (fragment.childCount < 2)\n        return fragment;\n    for (let d = $context.depth; d >= 0; d--) {\n        let parent = $context.node(d);\n        let match = parent.contentMatchAt($context.index(d));\n        let lastWrap, result = [];\n        fragment.forEach(node => {\n            if (!result)\n                return;\n            let wrap = match.findWrapping(node.type), inLast;\n            if (!wrap)\n                return result = null;\n            if (inLast = result.length && lastWrap.length && addToSibling(wrap, lastWrap, node, result[result.length - 1], 0)) {\n                result[result.length - 1] = inLast;\n            }\n            else {\n                if (result.length)\n                    result[result.length - 1] = closeRight(result[result.length - 1], lastWrap.length);\n                let wrapped = withWrappers(node, wrap);\n                result.push(wrapped);\n                match = match.matchType(wrapped.type);\n                lastWrap = wrap;\n            }\n        });\n        if (result)\n            return Fragment.from(result);\n    }\n    return fragment;\n}\nfunction withWrappers(node, wrap, from = 0) {\n    for (let i = wrap.length - 1; i >= from; i--)\n        node = wrap[i].create(null, Fragment.from(node));\n    return node;\n}\n// Used to group adjacent nodes wrapped in similar parents by\n// normalizeSiblings into the same parent node\nfunction addToSibling(wrap, lastWrap, node, sibling, depth) {\n    if (depth < wrap.length && depth < lastWrap.length && wrap[depth] == lastWrap[depth]) {\n        let inner = addToSibling(wrap, lastWrap, node, sibling.lastChild, depth + 1);\n        if (inner)\n            return sibling.copy(sibling.content.replaceChild(sibling.childCount - 1, inner));\n        let match = sibling.contentMatchAt(sibling.childCount);\n        if (match.matchType(depth == wrap.length - 1 ? node.type : wrap[depth + 1]))\n            return sibling.copy(sibling.content.append(Fragment.from(withWrappers(node, wrap, depth + 1))));\n    }\n}\nfunction closeRight(node, depth) {\n    if (depth == 0)\n        return node;\n    let fragment = node.content.replaceChild(node.childCount - 1, closeRight(node.lastChild, depth - 1));\n    let fill = node.contentMatchAt(node.childCount).fillBefore(Fragment.empty, true);\n    return node.copy(fragment.append(fill));\n}\nfunction closeRange(fragment, side, from, to, depth, openEnd) {\n    let node = side < 0 ? fragment.firstChild : fragment.lastChild, inner = node.content;\n    if (fragment.childCount > 1)\n        openEnd = 0;\n    if (depth < to - 1)\n        inner = closeRange(inner, side, from, to, depth + 1, openEnd);\n    if (depth >= from)\n        inner = side < 0 ? node.contentMatchAt(0).fillBefore(inner, openEnd <= depth).append(inner)\n            : inner.append(node.contentMatchAt(node.childCount).fillBefore(Fragment.empty, true));\n    return fragment.replaceChild(side < 0 ? 0 : fragment.childCount - 1, node.copy(inner));\n}\nfunction closeSlice(slice, openStart, openEnd) {\n    if (openStart < slice.openStart)\n        slice = new Slice(closeRange(slice.content, -1, openStart, slice.openStart, 0, slice.openEnd), openStart, slice.openEnd);\n    if (openEnd < slice.openEnd)\n        slice = new Slice(closeRange(slice.content, 1, openEnd, slice.openEnd, 0, 0), slice.openStart, openEnd);\n    return slice;\n}\n// Trick from jQuery -- some elements must be wrapped in other\n// elements for innerHTML to work. I.e. if you do `div.innerHTML =\n// \"<td>..</td>\"` the table cells are ignored.\nconst wrapMap = {\n    thead: [\"table\"],\n    tbody: [\"table\"],\n    tfoot: [\"table\"],\n    caption: [\"table\"],\n    colgroup: [\"table\"],\n    col: [\"table\", \"colgroup\"],\n    tr: [\"table\", \"tbody\"],\n    td: [\"table\", \"tbody\", \"tr\"],\n    th: [\"table\", \"tbody\", \"tr\"]\n};\nlet _detachedDoc = null;\nfunction detachedDoc() {\n    return _detachedDoc || (_detachedDoc = document.implementation.createHTMLDocument(\"title\"));\n}\nlet _policy = null;\nfunction maybeWrapTrusted(html) {\n    let trustedTypes = window.trustedTypes;\n    if (!trustedTypes)\n        return html;\n    // With the require-trusted-types-for CSP, Chrome will block\n    // innerHTML, even on a detached document. This wraps the string in\n    // a way that makes the browser allow us to use its parser again.\n    if (!_policy)\n        _policy = trustedTypes.createPolicy(\"ProseMirrorClipboard\", { createHTML: (s) => s });\n    return _policy.createHTML(html);\n}\nfunction readHTML(html) {\n    let metas = /^(\\s*<meta [^>]*>)*/.exec(html);\n    if (metas)\n        html = html.slice(metas[0].length);\n    let elt = detachedDoc().createElement(\"div\");\n    let firstTag = /<([a-z][^>\\s]+)/i.exec(html), wrap;\n    if (wrap = firstTag && wrapMap[firstTag[1].toLowerCase()])\n        html = wrap.map(n => \"<\" + n + \">\").join(\"\") + html + wrap.map(n => \"</\" + n + \">\").reverse().join(\"\");\n    elt.innerHTML = maybeWrapTrusted(html);\n    if (wrap)\n        for (let i = 0; i < wrap.length; i++)\n            elt = elt.querySelector(wrap[i]) || elt;\n    return elt;\n}\n// Webkit browsers do some hard-to-predict replacement of regular\n// spaces with non-breaking spaces when putting content on the\n// clipboard. This tries to convert such non-breaking spaces (which\n// will be wrapped in a plain span on Chrome, a span with class\n// Apple-converted-space on Safari) back to regular spaces.\nfunction restoreReplacedSpaces(dom) {\n    let nodes = dom.querySelectorAll(chrome ? \"span:not([class]):not([style])\" : \"span.Apple-converted-space\");\n    for (let i = 0; i < nodes.length; i++) {\n        let node = nodes[i];\n        if (node.childNodes.length == 1 && node.textContent == \"\\u00a0\" && node.parentNode)\n            node.parentNode.replaceChild(dom.ownerDocument.createTextNode(\" \"), node);\n    }\n}\nfunction addContext(slice, context) {\n    if (!slice.size)\n        return slice;\n    let schema = slice.content.firstChild.type.schema, array;\n    try {\n        array = JSON.parse(context);\n    }\n    catch (e) {\n        return slice;\n    }\n    let { content, openStart, openEnd } = slice;\n    for (let i = array.length - 2; i >= 0; i -= 2) {\n        let type = schema.nodes[array[i]];\n        if (!type || type.hasRequiredAttrs())\n            break;\n        content = Fragment.from(type.create(array[i + 1], content));\n        openStart++;\n        openEnd++;\n    }\n    return new Slice(content, openStart, openEnd);\n}\n\n// A collection of DOM events that occur within the editor, and callback functions\n// to invoke when the event fires.\nconst handlers = {};\nconst editHandlers = {};\nconst passiveHandlers = { touchstart: true, touchmove: true };\nclass InputState {\n    constructor() {\n        this.shiftKey = false;\n        this.mouseDown = null;\n        this.lastKeyCode = null;\n        this.lastKeyCodeTime = 0;\n        this.lastClick = { time: 0, x: 0, y: 0, type: \"\" };\n        this.lastSelectionOrigin = null;\n        this.lastSelectionTime = 0;\n        this.lastIOSEnter = 0;\n        this.lastIOSEnterFallbackTimeout = -1;\n        this.lastFocus = 0;\n        this.lastTouch = 0;\n        this.lastChromeDelete = 0;\n        this.composing = false;\n        this.compositionNode = null;\n        this.composingTimeout = -1;\n        this.compositionNodes = [];\n        this.compositionEndedAt = -2e8;\n        this.compositionID = 1;\n        // Set to a composition ID when there are pending changes at compositionend\n        this.compositionPendingChanges = 0;\n        this.domChangeCount = 0;\n        this.eventHandlers = Object.create(null);\n        this.hideSelectionGuard = null;\n    }\n}\nfunction initInput(view) {\n    for (let event in handlers) {\n        let handler = handlers[event];\n        view.dom.addEventListener(event, view.input.eventHandlers[event] = (event) => {\n            if (eventBelongsToView(view, event) && !runCustomHandler(view, event) &&\n                (view.editable || !(event.type in editHandlers)))\n                handler(view, event);\n        }, passiveHandlers[event] ? { passive: true } : undefined);\n    }\n    // On Safari, for reasons beyond my understanding, adding an input\n    // event handler makes an issue where the composition vanishes when\n    // you press enter go away.\n    if (safari)\n        view.dom.addEventListener(\"input\", () => null);\n    ensureListeners(view);\n}\nfunction setSelectionOrigin(view, origin) {\n    view.input.lastSelectionOrigin = origin;\n    view.input.lastSelectionTime = Date.now();\n}\nfunction destroyInput(view) {\n    view.domObserver.stop();\n    for (let type in view.input.eventHandlers)\n        view.dom.removeEventListener(type, view.input.eventHandlers[type]);\n    clearTimeout(view.input.composingTimeout);\n    clearTimeout(view.input.lastIOSEnterFallbackTimeout);\n}\nfunction ensureListeners(view) {\n    view.someProp(\"handleDOMEvents\", currentHandlers => {\n        for (let type in currentHandlers)\n            if (!view.input.eventHandlers[type])\n                view.dom.addEventListener(type, view.input.eventHandlers[type] = event => runCustomHandler(view, event));\n    });\n}\nfunction runCustomHandler(view, event) {\n    return view.someProp(\"handleDOMEvents\", handlers => {\n        let handler = handlers[event.type];\n        return handler ? handler(view, event) || event.defaultPrevented : false;\n    });\n}\nfunction eventBelongsToView(view, event) {\n    if (!event.bubbles)\n        return true;\n    if (event.defaultPrevented)\n        return false;\n    for (let node = event.target; node != view.dom; node = node.parentNode)\n        if (!node || node.nodeType == 11 ||\n            (node.pmViewDesc && node.pmViewDesc.stopEvent(event)))\n            return false;\n    return true;\n}\nfunction dispatchEvent(view, event) {\n    if (!runCustomHandler(view, event) && handlers[event.type] &&\n        (view.editable || !(event.type in editHandlers)))\n        handlers[event.type](view, event);\n}\neditHandlers.keydown = (view, _event) => {\n    let event = _event;\n    view.input.shiftKey = event.keyCode == 16 || event.shiftKey;\n    if (inOrNearComposition(view, event))\n        return;\n    view.input.lastKeyCode = event.keyCode;\n    view.input.lastKeyCodeTime = Date.now();\n    // Suppress enter key events on Chrome Android, because those tend\n    // to be part of a confused sequence of composition events fired,\n    // and handling them eagerly tends to corrupt the input.\n    if (android && chrome && event.keyCode == 13)\n        return;\n    if (event.keyCode != 229)\n        view.domObserver.forceFlush();\n    // On iOS, if we preventDefault enter key presses, the virtual\n    // keyboard gets confused. So the hack here is to set a flag that\n    // makes the DOM change code recognize that what just happens should\n    // be replaced by whatever the Enter key handlers do.\n    if (ios && event.keyCode == 13 && !event.ctrlKey && !event.altKey && !event.metaKey) {\n        let now = Date.now();\n        view.input.lastIOSEnter = now;\n        view.input.lastIOSEnterFallbackTimeout = setTimeout(() => {\n            if (view.input.lastIOSEnter == now) {\n                view.someProp(\"handleKeyDown\", f => f(view, keyEvent(13, \"Enter\")));\n                view.input.lastIOSEnter = 0;\n            }\n        }, 200);\n    }\n    else if (view.someProp(\"handleKeyDown\", f => f(view, event)) || captureKeyDown(view, event)) {\n        event.preventDefault();\n    }\n    else {\n        setSelectionOrigin(view, \"key\");\n    }\n};\neditHandlers.keyup = (view, event) => {\n    if (event.keyCode == 16)\n        view.input.shiftKey = false;\n};\neditHandlers.keypress = (view, _event) => {\n    let event = _event;\n    if (inOrNearComposition(view, event) || !event.charCode ||\n        event.ctrlKey && !event.altKey || mac && event.metaKey)\n        return;\n    if (view.someProp(\"handleKeyPress\", f => f(view, event))) {\n        event.preventDefault();\n        return;\n    }\n    let sel = view.state.selection;\n    if (!(sel instanceof TextSelection) || !sel.$from.sameParent(sel.$to)) {\n        let text = String.fromCharCode(event.charCode);\n        if (!/[\\r\\n]/.test(text) && !view.someProp(\"handleTextInput\", f => f(view, sel.$from.pos, sel.$to.pos, text)))\n            view.dispatch(view.state.tr.insertText(text).scrollIntoView());\n        event.preventDefault();\n    }\n};\nfunction eventCoords(event) { return { left: event.clientX, top: event.clientY }; }\nfunction isNear(event, click) {\n    let dx = click.x - event.clientX, dy = click.y - event.clientY;\n    return dx * dx + dy * dy < 100;\n}\nfunction runHandlerOnContext(view, propName, pos, inside, event) {\n    if (inside == -1)\n        return false;\n    let $pos = view.state.doc.resolve(inside);\n    for (let i = $pos.depth + 1; i > 0; i--) {\n        if (view.someProp(propName, f => i > $pos.depth ? f(view, pos, $pos.nodeAfter, $pos.before(i), event, true)\n            : f(view, pos, $pos.node(i), $pos.before(i), event, false)))\n            return true;\n    }\n    return false;\n}\nfunction updateSelection(view, selection, origin) {\n    if (!view.focused)\n        view.focus();\n    if (view.state.selection.eq(selection))\n        return;\n    let tr = view.state.tr.setSelection(selection);\n    if (origin == \"pointer\")\n        tr.setMeta(\"pointer\", true);\n    view.dispatch(tr);\n}\nfunction selectClickedLeaf(view, inside) {\n    if (inside == -1)\n        return false;\n    let $pos = view.state.doc.resolve(inside), node = $pos.nodeAfter;\n    if (node && node.isAtom && NodeSelection.isSelectable(node)) {\n        updateSelection(view, new NodeSelection($pos), \"pointer\");\n        return true;\n    }\n    return false;\n}\nfunction selectClickedNode(view, inside) {\n    if (inside == -1)\n        return false;\n    let sel = view.state.selection, selectedNode, selectAt;\n    if (sel instanceof NodeSelection)\n        selectedNode = sel.node;\n    let $pos = view.state.doc.resolve(inside);\n    for (let i = $pos.depth + 1; i > 0; i--) {\n        let node = i > $pos.depth ? $pos.nodeAfter : $pos.node(i);\n        if (NodeSelection.isSelectable(node)) {\n            if (selectedNode && sel.$from.depth > 0 &&\n                i >= sel.$from.depth && $pos.before(sel.$from.depth + 1) == sel.$from.pos)\n                selectAt = $pos.before(sel.$from.depth);\n            else\n                selectAt = $pos.before(i);\n            break;\n        }\n    }\n    if (selectAt != null) {\n        updateSelection(view, NodeSelection.create(view.state.doc, selectAt), \"pointer\");\n        return true;\n    }\n    else {\n        return false;\n    }\n}\nfunction handleSingleClick(view, pos, inside, event, selectNode) {\n    return runHandlerOnContext(view, \"handleClickOn\", pos, inside, event) ||\n        view.someProp(\"handleClick\", f => f(view, pos, event)) ||\n        (selectNode ? selectClickedNode(view, inside) : selectClickedLeaf(view, inside));\n}\nfunction handleDoubleClick(view, pos, inside, event) {\n    return runHandlerOnContext(view, \"handleDoubleClickOn\", pos, inside, event) ||\n        view.someProp(\"handleDoubleClick\", f => f(view, pos, event));\n}\nfunction handleTripleClick(view, pos, inside, event) {\n    return runHandlerOnContext(view, \"handleTripleClickOn\", pos, inside, event) ||\n        view.someProp(\"handleTripleClick\", f => f(view, pos, event)) ||\n        defaultTripleClick(view, inside, event);\n}\nfunction defaultTripleClick(view, inside, event) {\n    if (event.button != 0)\n        return false;\n    let doc = view.state.doc;\n    if (inside == -1) {\n        if (doc.inlineContent) {\n            updateSelection(view, TextSelection.create(doc, 0, doc.content.size), \"pointer\");\n            return true;\n        }\n        return false;\n    }\n    let $pos = doc.resolve(inside);\n    for (let i = $pos.depth + 1; i > 0; i--) {\n        let node = i > $pos.depth ? $pos.nodeAfter : $pos.node(i);\n        let nodePos = $pos.before(i);\n        if (node.inlineContent)\n            updateSelection(view, TextSelection.create(doc, nodePos + 1, nodePos + 1 + node.content.size), \"pointer\");\n        else if (NodeSelection.isSelectable(node))\n            updateSelection(view, NodeSelection.create(doc, nodePos), \"pointer\");\n        else\n            continue;\n        return true;\n    }\n}\nfunction forceDOMFlush(view) {\n    return endComposition(view);\n}\nconst selectNodeModifier = mac ? \"metaKey\" : \"ctrlKey\";\nhandlers.mousedown = (view, _event) => {\n    let event = _event;\n    view.input.shiftKey = event.shiftKey;\n    let flushed = forceDOMFlush(view);\n    let now = Date.now(), type = \"singleClick\";\n    if (now - view.input.lastClick.time < 500 && isNear(event, view.input.lastClick) && !event[selectNodeModifier]) {\n        if (view.input.lastClick.type == \"singleClick\")\n            type = \"doubleClick\";\n        else if (view.input.lastClick.type == \"doubleClick\")\n            type = \"tripleClick\";\n    }\n    view.input.lastClick = { time: now, x: event.clientX, y: event.clientY, type };\n    let pos = view.posAtCoords(eventCoords(event));\n    if (!pos)\n        return;\n    if (type == \"singleClick\") {\n        if (view.input.mouseDown)\n            view.input.mouseDown.done();\n        view.input.mouseDown = new MouseDown(view, pos, event, !!flushed);\n    }\n    else if ((type == \"doubleClick\" ? handleDoubleClick : handleTripleClick)(view, pos.pos, pos.inside, event)) {\n        event.preventDefault();\n    }\n    else {\n        setSelectionOrigin(view, \"pointer\");\n    }\n};\nclass MouseDown {\n    constructor(view, pos, event, flushed) {\n        this.view = view;\n        this.pos = pos;\n        this.event = event;\n        this.flushed = flushed;\n        this.delayedSelectionSync = false;\n        this.mightDrag = null;\n        this.startDoc = view.state.doc;\n        this.selectNode = !!event[selectNodeModifier];\n        this.allowDefault = event.shiftKey;\n        let targetNode, targetPos;\n        if (pos.inside > -1) {\n            targetNode = view.state.doc.nodeAt(pos.inside);\n            targetPos = pos.inside;\n        }\n        else {\n            let $pos = view.state.doc.resolve(pos.pos);\n            targetNode = $pos.parent;\n            targetPos = $pos.depth ? $pos.before() : 0;\n        }\n        const target = flushed ? null : event.target;\n        const targetDesc = target ? view.docView.nearestDesc(target, true) : null;\n        this.target = targetDesc && targetDesc.dom.nodeType == 1 ? targetDesc.dom : null;\n        let { selection } = view.state;\n        if (event.button == 0 &&\n            targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false ||\n            selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos)\n            this.mightDrag = {\n                node: targetNode,\n                pos: targetPos,\n                addAttr: !!(this.target && !this.target.draggable),\n                setUneditable: !!(this.target && gecko && !this.target.hasAttribute(\"contentEditable\"))\n            };\n        if (this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable)) {\n            this.view.domObserver.stop();\n            if (this.mightDrag.addAttr)\n                this.target.draggable = true;\n            if (this.mightDrag.setUneditable)\n                setTimeout(() => {\n                    if (this.view.input.mouseDown == this)\n                        this.target.setAttribute(\"contentEditable\", \"false\");\n                }, 20);\n            this.view.domObserver.start();\n        }\n        view.root.addEventListener(\"mouseup\", this.up = this.up.bind(this));\n        view.root.addEventListener(\"mousemove\", this.move = this.move.bind(this));\n        setSelectionOrigin(view, \"pointer\");\n    }\n    done() {\n        this.view.root.removeEventListener(\"mouseup\", this.up);\n        this.view.root.removeEventListener(\"mousemove\", this.move);\n        if (this.mightDrag && this.target) {\n            this.view.domObserver.stop();\n            if (this.mightDrag.addAttr)\n                this.target.removeAttribute(\"draggable\");\n            if (this.mightDrag.setUneditable)\n                this.target.removeAttribute(\"contentEditable\");\n            this.view.domObserver.start();\n        }\n        if (this.delayedSelectionSync)\n            setTimeout(() => selectionToDOM(this.view));\n        this.view.input.mouseDown = null;\n    }\n    up(event) {\n        this.done();\n        if (!this.view.dom.contains(event.target))\n            return;\n        let pos = this.pos;\n        if (this.view.state.doc != this.startDoc)\n            pos = this.view.posAtCoords(eventCoords(event));\n        this.updateAllowDefault(event);\n        if (this.allowDefault || !pos) {\n            setSelectionOrigin(this.view, \"pointer\");\n        }\n        else if (handleSingleClick(this.view, pos.pos, pos.inside, event, this.selectNode)) {\n            event.preventDefault();\n        }\n        else if (event.button == 0 &&\n            (this.flushed ||\n                // Safari ignores clicks on draggable elements\n                (safari && this.mightDrag && !this.mightDrag.node.isAtom) ||\n                // Chrome will sometimes treat a node selection as a\n                // cursor, but still report that the node is selected\n                // when asked through getSelection. You'll then get a\n                // situation where clicking at the point where that\n                // (hidden) cursor is doesn't change the selection, and\n                // thus doesn't get a reaction from ProseMirror. This\n                // works around that.\n                (chrome && !this.view.state.selection.visible &&\n                    Math.min(Math.abs(pos.pos - this.view.state.selection.from), Math.abs(pos.pos - this.view.state.selection.to)) <= 2))) {\n            updateSelection(this.view, Selection.near(this.view.state.doc.resolve(pos.pos)), \"pointer\");\n            event.preventDefault();\n        }\n        else {\n            setSelectionOrigin(this.view, \"pointer\");\n        }\n    }\n    move(event) {\n        this.updateAllowDefault(event);\n        setSelectionOrigin(this.view, \"pointer\");\n        if (event.buttons == 0)\n            this.done();\n    }\n    updateAllowDefault(event) {\n        if (!this.allowDefault && (Math.abs(this.event.x - event.clientX) > 4 ||\n            Math.abs(this.event.y - event.clientY) > 4))\n            this.allowDefault = true;\n    }\n}\nhandlers.touchstart = view => {\n    view.input.lastTouch = Date.now();\n    forceDOMFlush(view);\n    setSelectionOrigin(view, \"pointer\");\n};\nhandlers.touchmove = view => {\n    view.input.lastTouch = Date.now();\n    setSelectionOrigin(view, \"pointer\");\n};\nhandlers.contextmenu = view => forceDOMFlush(view);\nfunction inOrNearComposition(view, event) {\n    if (view.composing)\n        return true;\n    // See https://www.stum.de/2016/06/24/handling-ime-events-in-javascript/.\n    // On Japanese input method editors (IMEs), the Enter key is used to confirm character\n    // selection. On Safari, when Enter is pressed, compositionend and keydown events are\n    // emitted. The keydown event triggers newline insertion, which we don't want.\n    // This method returns true if the keydown event should be ignored.\n    // We only ignore it once, as pressing Enter a second time *should* insert a newline.\n    // Furthermore, the keydown event timestamp must be close to the compositionEndedAt timestamp.\n    // This guards against the case where compositionend is triggered without the keyboard\n    // (e.g. character confirmation may be done with the mouse), and keydown is triggered\n    // afterwards- we wouldn't want to ignore the keydown event in this case.\n    if (safari && Math.abs(event.timeStamp - view.input.compositionEndedAt) < 500) {\n        view.input.compositionEndedAt = -2e8;\n        return true;\n    }\n    return false;\n}\n// Drop active composition after 5 seconds of inactivity on Android\nconst timeoutComposition = android ? 5000 : -1;\neditHandlers.compositionstart = editHandlers.compositionupdate = view => {\n    if (!view.composing) {\n        view.domObserver.flush();\n        let { state } = view, $pos = state.selection.$to;\n        if (state.selection instanceof TextSelection &&\n            (state.storedMarks ||\n                (!$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some(m => m.type.spec.inclusive === false)))) {\n            // Need to wrap the cursor in mark nodes different from the ones in the DOM context\n            view.markCursor = view.state.storedMarks || $pos.marks();\n            endComposition(view, true);\n            view.markCursor = null;\n        }\n        else {\n            endComposition(view, !state.selection.empty);\n            // In firefox, if the cursor is after but outside a marked node,\n            // the inserted text won't inherit the marks. So this moves it\n            // inside if necessary.\n            if (gecko && state.selection.empty && $pos.parentOffset && !$pos.textOffset && $pos.nodeBefore.marks.length) {\n                let sel = view.domSelectionRange();\n                for (let node = sel.focusNode, offset = sel.focusOffset; node && node.nodeType == 1 && offset != 0;) {\n                    let before = offset < 0 ? node.lastChild : node.childNodes[offset - 1];\n                    if (!before)\n                        break;\n                    if (before.nodeType == 3) {\n                        let sel = view.domSelection();\n                        if (sel)\n                            sel.collapse(before, before.nodeValue.length);\n                        break;\n                    }\n                    else {\n                        node = before;\n                        offset = -1;\n                    }\n                }\n            }\n        }\n        view.input.composing = true;\n    }\n    scheduleComposeEnd(view, timeoutComposition);\n};\neditHandlers.compositionend = (view, event) => {\n    if (view.composing) {\n        view.input.composing = false;\n        view.input.compositionEndedAt = event.timeStamp;\n        view.input.compositionPendingChanges = view.domObserver.pendingRecords().length ? view.input.compositionID : 0;\n        view.input.compositionNode = null;\n        if (view.input.compositionPendingChanges)\n            Promise.resolve().then(() => view.domObserver.flush());\n        view.input.compositionID++;\n        scheduleComposeEnd(view, 20);\n    }\n};\nfunction scheduleComposeEnd(view, delay) {\n    clearTimeout(view.input.composingTimeout);\n    if (delay > -1)\n        view.input.composingTimeout = setTimeout(() => endComposition(view), delay);\n}\nfunction clearComposition(view) {\n    if (view.composing) {\n        view.input.composing = false;\n        view.input.compositionEndedAt = timestampFromCustomEvent();\n    }\n    while (view.input.compositionNodes.length > 0)\n        view.input.compositionNodes.pop().markParentsDirty();\n}\nfunction findCompositionNode(view) {\n    let sel = view.domSelectionRange();\n    if (!sel.focusNode)\n        return null;\n    let textBefore = textNodeBefore$1(sel.focusNode, sel.focusOffset);\n    let textAfter = textNodeAfter$1(sel.focusNode, sel.focusOffset);\n    if (textBefore && textAfter && textBefore != textAfter) {\n        let descAfter = textAfter.pmViewDesc, lastChanged = view.domObserver.lastChangedTextNode;\n        if (textBefore == lastChanged || textAfter == lastChanged)\n            return lastChanged;\n        if (!descAfter || !descAfter.isText(textAfter.nodeValue)) {\n            return textAfter;\n        }\n        else if (view.input.compositionNode == textAfter) {\n            let descBefore = textBefore.pmViewDesc;\n            if (!(!descBefore || !descBefore.isText(textBefore.nodeValue)))\n                return textAfter;\n        }\n    }\n    return textBefore || textAfter;\n}\nfunction timestampFromCustomEvent() {\n    let event = document.createEvent(\"Event\");\n    event.initEvent(\"event\", true, true);\n    return event.timeStamp;\n}\n/**\n@internal\n*/\nfunction endComposition(view, restarting = false) {\n    if (android && view.domObserver.flushingSoon >= 0)\n        return;\n    view.domObserver.forceFlush();\n    clearComposition(view);\n    if (restarting || view.docView && view.docView.dirty) {\n        let sel = selectionFromDOM(view);\n        if (sel && !sel.eq(view.state.selection))\n            view.dispatch(view.state.tr.setSelection(sel));\n        else if ((view.markCursor || restarting) && !view.state.selection.empty)\n            view.dispatch(view.state.tr.deleteSelection());\n        else\n            view.updateState(view.state);\n        return true;\n    }\n    return false;\n}\nfunction captureCopy(view, dom) {\n    // The extra wrapper is somehow necessary on IE/Edge to prevent the\n    // content from being mangled when it is put onto the clipboard\n    if (!view.dom.parentNode)\n        return;\n    let wrap = view.dom.parentNode.appendChild(document.createElement(\"div\"));\n    wrap.appendChild(dom);\n    wrap.style.cssText = \"position: fixed; left: -10000px; top: 10px\";\n    let sel = getSelection(), range = document.createRange();\n    range.selectNodeContents(dom);\n    // Done because IE will fire a selectionchange moving the selection\n    // to its start when removeAllRanges is called and the editor still\n    // has focus (which will mess up the editor's selection state).\n    view.dom.blur();\n    sel.removeAllRanges();\n    sel.addRange(range);\n    setTimeout(() => {\n        if (wrap.parentNode)\n            wrap.parentNode.removeChild(wrap);\n        view.focus();\n    }, 50);\n}\n// This is very crude, but unfortunately both these browsers _pretend_\n// that they have a clipboard API—all the objects and methods are\n// there, they just don't work, and they are hard to test.\nconst brokenClipboardAPI = (ie && ie_version < 15) ||\n    (ios && webkit_version < 604);\nhandlers.copy = editHandlers.cut = (view, _event) => {\n    let event = _event;\n    let sel = view.state.selection, cut = event.type == \"cut\";\n    if (sel.empty)\n        return;\n    // IE and Edge's clipboard interface is completely broken\n    let data = brokenClipboardAPI ? null : event.clipboardData;\n    let slice = sel.content(), { dom, text } = serializeForClipboard(view, slice);\n    if (data) {\n        event.preventDefault();\n        data.clearData();\n        data.setData(\"text/html\", dom.innerHTML);\n        data.setData(\"text/plain\", text);\n    }\n    else {\n        captureCopy(view, dom);\n    }\n    if (cut)\n        view.dispatch(view.state.tr.deleteSelection().scrollIntoView().setMeta(\"uiEvent\", \"cut\"));\n};\nfunction sliceSingleNode(slice) {\n    return slice.openStart == 0 && slice.openEnd == 0 && slice.content.childCount == 1 ? slice.content.firstChild : null;\n}\nfunction capturePaste(view, event) {\n    if (!view.dom.parentNode)\n        return;\n    let plainText = view.input.shiftKey || view.state.selection.$from.parent.type.spec.code;\n    let target = view.dom.parentNode.appendChild(document.createElement(plainText ? \"textarea\" : \"div\"));\n    if (!plainText)\n        target.contentEditable = \"true\";\n    target.style.cssText = \"position: fixed; left: -10000px; top: 10px\";\n    target.focus();\n    let plain = view.input.shiftKey && view.input.lastKeyCode != 45;\n    setTimeout(() => {\n        view.focus();\n        if (target.parentNode)\n            target.parentNode.removeChild(target);\n        if (plainText)\n            doPaste(view, target.value, null, plain, event);\n        else\n            doPaste(view, target.textContent, target.innerHTML, plain, event);\n    }, 50);\n}\nfunction doPaste(view, text, html, preferPlain, event) {\n    let slice = parseFromClipboard(view, text, html, preferPlain, view.state.selection.$from);\n    if (view.someProp(\"handlePaste\", f => f(view, event, slice || Slice.empty)))\n        return true;\n    if (!slice)\n        return false;\n    let singleNode = sliceSingleNode(slice);\n    let tr = singleNode\n        ? view.state.tr.replaceSelectionWith(singleNode, preferPlain)\n        : view.state.tr.replaceSelection(slice);\n    view.dispatch(tr.scrollIntoView().setMeta(\"paste\", true).setMeta(\"uiEvent\", \"paste\"));\n    return true;\n}\nfunction getText(clipboardData) {\n    let text = clipboardData.getData(\"text/plain\") || clipboardData.getData(\"Text\");\n    if (text)\n        return text;\n    let uris = clipboardData.getData(\"text/uri-list\");\n    return uris ? uris.replace(/\\r?\\n/g, \" \") : \"\";\n}\neditHandlers.paste = (view, _event) => {\n    let event = _event;\n    // Handling paste from JavaScript during composition is very poorly\n    // handled by browsers, so as a dodgy but preferable kludge, we just\n    // let the browser do its native thing there, except on Android,\n    // where the editor is almost always composing.\n    if (view.composing && !android)\n        return;\n    let data = brokenClipboardAPI ? null : event.clipboardData;\n    let plain = view.input.shiftKey && view.input.lastKeyCode != 45;\n    if (data && doPaste(view, getText(data), data.getData(\"text/html\"), plain, event))\n        event.preventDefault();\n    else\n        capturePaste(view, event);\n};\nclass Dragging {\n    constructor(slice, move, node) {\n        this.slice = slice;\n        this.move = move;\n        this.node = node;\n    }\n}\nconst dragCopyModifier = mac ? \"altKey\" : \"ctrlKey\";\nhandlers.dragstart = (view, _event) => {\n    let event = _event;\n    let mouseDown = view.input.mouseDown;\n    if (mouseDown)\n        mouseDown.done();\n    if (!event.dataTransfer)\n        return;\n    let sel = view.state.selection;\n    let pos = sel.empty ? null : view.posAtCoords(eventCoords(event));\n    let node;\n    if (pos && pos.pos >= sel.from && pos.pos <= (sel instanceof NodeSelection ? sel.to - 1 : sel.to)) ;\n    else if (mouseDown && mouseDown.mightDrag) {\n        node = NodeSelection.create(view.state.doc, mouseDown.mightDrag.pos);\n    }\n    else if (event.target && event.target.nodeType == 1) {\n        let desc = view.docView.nearestDesc(event.target, true);\n        if (desc && desc.node.type.spec.draggable && desc != view.docView)\n            node = NodeSelection.create(view.state.doc, desc.posBefore);\n    }\n    let draggedSlice = (node || view.state.selection).content();\n    let { dom, text, slice } = serializeForClipboard(view, draggedSlice);\n    // Pre-120 Chrome versions clear files when calling `clearData` (#1472)\n    if (!event.dataTransfer.files.length || !chrome || chrome_version > 120)\n        event.dataTransfer.clearData();\n    event.dataTransfer.setData(brokenClipboardAPI ? \"Text\" : \"text/html\", dom.innerHTML);\n    // See https://github.com/ProseMirror/prosemirror/issues/1156\n    event.dataTransfer.effectAllowed = \"copyMove\";\n    if (!brokenClipboardAPI)\n        event.dataTransfer.setData(\"text/plain\", text);\n    view.dragging = new Dragging(slice, !event[dragCopyModifier], node);\n};\nhandlers.dragend = view => {\n    let dragging = view.dragging;\n    window.setTimeout(() => {\n        if (view.dragging == dragging)\n            view.dragging = null;\n    }, 50);\n};\neditHandlers.dragover = editHandlers.dragenter = (_, e) => e.preventDefault();\neditHandlers.drop = (view, _event) => {\n    let event = _event;\n    let dragging = view.dragging;\n    view.dragging = null;\n    if (!event.dataTransfer)\n        return;\n    let eventPos = view.posAtCoords(eventCoords(event));\n    if (!eventPos)\n        return;\n    let $mouse = view.state.doc.resolve(eventPos.pos);\n    let slice = dragging && dragging.slice;\n    if (slice) {\n        view.someProp(\"transformPasted\", f => { slice = f(slice, view); });\n    }\n    else {\n        slice = parseFromClipboard(view, getText(event.dataTransfer), brokenClipboardAPI ? null : event.dataTransfer.getData(\"text/html\"), false, $mouse);\n    }\n    let move = !!(dragging && !event[dragCopyModifier]);\n    if (view.someProp(\"handleDrop\", f => f(view, event, slice || Slice.empty, move))) {\n        event.preventDefault();\n        return;\n    }\n    if (!slice)\n        return;\n    event.preventDefault();\n    let insertPos = slice ? dropPoint(view.state.doc, $mouse.pos, slice) : $mouse.pos;\n    if (insertPos == null)\n        insertPos = $mouse.pos;\n    let tr = view.state.tr;\n    if (move) {\n        let { node } = dragging;\n        if (node)\n            node.replace(tr);\n        else\n            tr.deleteSelection();\n    }\n    let pos = tr.mapping.map(insertPos);\n    let isNode = slice.openStart == 0 && slice.openEnd == 0 && slice.content.childCount == 1;\n    let beforeInsert = tr.doc;\n    if (isNode)\n        tr.replaceRangeWith(pos, pos, slice.content.firstChild);\n    else\n        tr.replaceRange(pos, pos, slice);\n    if (tr.doc.eq(beforeInsert))\n        return;\n    let $pos = tr.doc.resolve(pos);\n    if (isNode && NodeSelection.isSelectable(slice.content.firstChild) &&\n        $pos.nodeAfter && $pos.nodeAfter.sameMarkup(slice.content.firstChild)) {\n        tr.setSelection(new NodeSelection($pos));\n    }\n    else {\n        let end = tr.mapping.map(insertPos);\n        tr.mapping.maps[tr.mapping.maps.length - 1].forEach((_from, _to, _newFrom, newTo) => end = newTo);\n        tr.setSelection(selectionBetween(view, $pos, tr.doc.resolve(end)));\n    }\n    view.focus();\n    view.dispatch(tr.setMeta(\"uiEvent\", \"drop\"));\n};\nhandlers.focus = view => {\n    view.input.lastFocus = Date.now();\n    if (!view.focused) {\n        view.domObserver.stop();\n        view.dom.classList.add(\"ProseMirror-focused\");\n        view.domObserver.start();\n        view.focused = true;\n        setTimeout(() => {\n            if (view.docView && view.hasFocus() && !view.domObserver.currentSelection.eq(view.domSelectionRange()))\n                selectionToDOM(view);\n        }, 20);\n    }\n};\nhandlers.blur = (view, _event) => {\n    let event = _event;\n    if (view.focused) {\n        view.domObserver.stop();\n        view.dom.classList.remove(\"ProseMirror-focused\");\n        view.domObserver.start();\n        if (event.relatedTarget && view.dom.contains(event.relatedTarget))\n            view.domObserver.currentSelection.clear();\n        view.focused = false;\n    }\n};\nhandlers.beforeinput = (view, _event) => {\n    let event = _event;\n    // We should probably do more with beforeinput events, but support\n    // is so spotty that I'm still waiting to see where they are going.\n    // Very specific hack to deal with backspace sometimes failing on\n    // Chrome Android when after an uneditable node.\n    if (chrome && android && event.inputType == \"deleteContentBackward\") {\n        view.domObserver.flushSoon();\n        let { domChangeCount } = view.input;\n        setTimeout(() => {\n            if (view.input.domChangeCount != domChangeCount)\n                return; // Event already had some effect\n            // This bug tends to close the virtual keyboard, so we refocus\n            view.dom.blur();\n            view.focus();\n            if (view.someProp(\"handleKeyDown\", f => f(view, keyEvent(8, \"Backspace\"))))\n                return;\n            let { $cursor } = view.state.selection;\n            // Crude approximation of backspace behavior when no command handled it\n            if ($cursor && $cursor.pos > 0)\n                view.dispatch(view.state.tr.delete($cursor.pos - 1, $cursor.pos).scrollIntoView());\n        }, 50);\n    }\n};\n// Make sure all handlers get registered\nfor (let prop in editHandlers)\n    handlers[prop] = editHandlers[prop];\n\nfunction compareObjs(a, b) {\n    if (a == b)\n        return true;\n    for (let p in a)\n        if (a[p] !== b[p])\n            return false;\n    for (let p in b)\n        if (!(p in a))\n            return false;\n    return true;\n}\nclass WidgetType {\n    constructor(toDOM, spec) {\n        this.toDOM = toDOM;\n        this.spec = spec || noSpec;\n        this.side = this.spec.side || 0;\n    }\n    map(mapping, span, offset, oldOffset) {\n        let { pos, deleted } = mapping.mapResult(span.from + oldOffset, this.side < 0 ? -1 : 1);\n        return deleted ? null : new Decoration(pos - offset, pos - offset, this);\n    }\n    valid() { return true; }\n    eq(other) {\n        return this == other ||\n            (other instanceof WidgetType &&\n                (this.spec.key && this.spec.key == other.spec.key ||\n                    this.toDOM == other.toDOM && compareObjs(this.spec, other.spec)));\n    }\n    destroy(node) {\n        if (this.spec.destroy)\n            this.spec.destroy(node);\n    }\n}\nclass InlineType {\n    constructor(attrs, spec) {\n        this.attrs = attrs;\n        this.spec = spec || noSpec;\n    }\n    map(mapping, span, offset, oldOffset) {\n        let from = mapping.map(span.from + oldOffset, this.spec.inclusiveStart ? -1 : 1) - offset;\n        let to = mapping.map(span.to + oldOffset, this.spec.inclusiveEnd ? 1 : -1) - offset;\n        return from >= to ? null : new Decoration(from, to, this);\n    }\n    valid(_, span) { return span.from < span.to; }\n    eq(other) {\n        return this == other ||\n            (other instanceof InlineType && compareObjs(this.attrs, other.attrs) &&\n                compareObjs(this.spec, other.spec));\n    }\n    static is(span) { return span.type instanceof InlineType; }\n    destroy() { }\n}\nclass NodeType {\n    constructor(attrs, spec) {\n        this.attrs = attrs;\n        this.spec = spec || noSpec;\n    }\n    map(mapping, span, offset, oldOffset) {\n        let from = mapping.mapResult(span.from + oldOffset, 1);\n        if (from.deleted)\n            return null;\n        let to = mapping.mapResult(span.to + oldOffset, -1);\n        if (to.deleted || to.pos <= from.pos)\n            return null;\n        return new Decoration(from.pos - offset, to.pos - offset, this);\n    }\n    valid(node, span) {\n        let { index, offset } = node.content.findIndex(span.from), child;\n        return offset == span.from && !(child = node.child(index)).isText && offset + child.nodeSize == span.to;\n    }\n    eq(other) {\n        return this == other ||\n            (other instanceof NodeType && compareObjs(this.attrs, other.attrs) &&\n                compareObjs(this.spec, other.spec));\n    }\n    destroy() { }\n}\n/**\nDecoration objects can be provided to the view through the\n[`decorations` prop](https://prosemirror.net/docs/ref/#view.EditorProps.decorations). They come in\nseveral variants—see the static members of this class for details.\n*/\nclass Decoration {\n    /**\n    @internal\n    */\n    constructor(\n    /**\n    The start position of the decoration.\n    */\n    from, \n    /**\n    The end position. Will be the same as `from` for [widget\n    decorations](https://prosemirror.net/docs/ref/#view.Decoration^widget).\n    */\n    to, \n    /**\n    @internal\n    */\n    type) {\n        this.from = from;\n        this.to = to;\n        this.type = type;\n    }\n    /**\n    @internal\n    */\n    copy(from, to) {\n        return new Decoration(from, to, this.type);\n    }\n    /**\n    @internal\n    */\n    eq(other, offset = 0) {\n        return this.type.eq(other.type) && this.from + offset == other.from && this.to + offset == other.to;\n    }\n    /**\n    @internal\n    */\n    map(mapping, offset, oldOffset) {\n        return this.type.map(mapping, this, offset, oldOffset);\n    }\n    /**\n    Creates a widget decoration, which is a DOM node that's shown in\n    the document at the given position. It is recommended that you\n    delay rendering the widget by passing a function that will be\n    called when the widget is actually drawn in a view, but you can\n    also directly pass a DOM node. `getPos` can be used to find the\n    widget's current document position.\n    */\n    static widget(pos, toDOM, spec) {\n        return new Decoration(pos, pos, new WidgetType(toDOM, spec));\n    }\n    /**\n    Creates an inline decoration, which adds the given attributes to\n    each inline node between `from` and `to`.\n    */\n    static inline(from, to, attrs, spec) {\n        return new Decoration(from, to, new InlineType(attrs, spec));\n    }\n    /**\n    Creates a node decoration. `from` and `to` should point precisely\n    before and after a node in the document. That node, and only that\n    node, will receive the given attributes.\n    */\n    static node(from, to, attrs, spec) {\n        return new Decoration(from, to, new NodeType(attrs, spec));\n    }\n    /**\n    The spec provided when creating this decoration. Can be useful\n    if you've stored extra information in that object.\n    */\n    get spec() { return this.type.spec; }\n    /**\n    @internal\n    */\n    get inline() { return this.type instanceof InlineType; }\n    /**\n    @internal\n    */\n    get widget() { return this.type instanceof WidgetType; }\n}\nconst none = [], noSpec = {};\n/**\nA collection of [decorations](https://prosemirror.net/docs/ref/#view.Decoration), organized in such\na way that the drawing algorithm can efficiently use and compare\nthem. This is a persistent data structure—it is not modified,\nupdates create a new value.\n*/\nclass DecorationSet {\n    /**\n    @internal\n    */\n    constructor(local, children) {\n        this.local = local.length ? local : none;\n        this.children = children.length ? children : none;\n    }\n    /**\n    Create a set of decorations, using the structure of the given\n    document. This will consume (modify) the `decorations` array, so\n    you must make a copy if you want need to preserve that.\n    */\n    static create(doc, decorations) {\n        return decorations.length ? buildTree(decorations, doc, 0, noSpec) : empty;\n    }\n    /**\n    Find all decorations in this set which touch the given range\n    (including decorations that start or end directly at the\n    boundaries) and match the given predicate on their spec. When\n    `start` and `end` are omitted, all decorations in the set are\n    considered. When `predicate` isn't given, all decorations are\n    assumed to match.\n    */\n    find(start, end, predicate) {\n        let result = [];\n        this.findInner(start == null ? 0 : start, end == null ? 1e9 : end, result, 0, predicate);\n        return result;\n    }\n    findInner(start, end, result, offset, predicate) {\n        for (let i = 0; i < this.local.length; i++) {\n            let span = this.local[i];\n            if (span.from <= end && span.to >= start && (!predicate || predicate(span.spec)))\n                result.push(span.copy(span.from + offset, span.to + offset));\n        }\n        for (let i = 0; i < this.children.length; i += 3) {\n            if (this.children[i] < end && this.children[i + 1] > start) {\n                let childOff = this.children[i] + 1;\n                this.children[i + 2].findInner(start - childOff, end - childOff, result, offset + childOff, predicate);\n            }\n        }\n    }\n    /**\n    Map the set of decorations in response to a change in the\n    document.\n    */\n    map(mapping, doc, options) {\n        if (this == empty || mapping.maps.length == 0)\n            return this;\n        return this.mapInner(mapping, doc, 0, 0, options || noSpec);\n    }\n    /**\n    @internal\n    */\n    mapInner(mapping, node, offset, oldOffset, options) {\n        let newLocal;\n        for (let i = 0; i < this.local.length; i++) {\n            let mapped = this.local[i].map(mapping, offset, oldOffset);\n            if (mapped && mapped.type.valid(node, mapped))\n                (newLocal || (newLocal = [])).push(mapped);\n            else if (options.onRemove)\n                options.onRemove(this.local[i].spec);\n        }\n        if (this.children.length)\n            return mapChildren(this.children, newLocal || [], mapping, node, offset, oldOffset, options);\n        else\n            return newLocal ? new DecorationSet(newLocal.sort(byPos), none) : empty;\n    }\n    /**\n    Add the given array of decorations to the ones in the set,\n    producing a new set. Consumes the `decorations` array. Needs\n    access to the current document to create the appropriate tree\n    structure.\n    */\n    add(doc, decorations) {\n        if (!decorations.length)\n            return this;\n        if (this == empty)\n            return DecorationSet.create(doc, decorations);\n        return this.addInner(doc, decorations, 0);\n    }\n    addInner(doc, decorations, offset) {\n        let children, childIndex = 0;\n        doc.forEach((childNode, childOffset) => {\n            let baseOffset = childOffset + offset, found;\n            if (!(found = takeSpansForNode(decorations, childNode, baseOffset)))\n                return;\n            if (!children)\n                children = this.children.slice();\n            while (childIndex < children.length && children[childIndex] < childOffset)\n                childIndex += 3;\n            if (children[childIndex] == childOffset)\n                children[childIndex + 2] = children[childIndex + 2].addInner(childNode, found, baseOffset + 1);\n            else\n                children.splice(childIndex, 0, childOffset, childOffset + childNode.nodeSize, buildTree(found, childNode, baseOffset + 1, noSpec));\n            childIndex += 3;\n        });\n        let local = moveSpans(childIndex ? withoutNulls(decorations) : decorations, -offset);\n        for (let i = 0; i < local.length; i++)\n            if (!local[i].type.valid(doc, local[i]))\n                local.splice(i--, 1);\n        return new DecorationSet(local.length ? this.local.concat(local).sort(byPos) : this.local, children || this.children);\n    }\n    /**\n    Create a new set that contains the decorations in this set, minus\n    the ones in the given array.\n    */\n    remove(decorations) {\n        if (decorations.length == 0 || this == empty)\n            return this;\n        return this.removeInner(decorations, 0);\n    }\n    removeInner(decorations, offset) {\n        let children = this.children, local = this.local;\n        for (let i = 0; i < children.length; i += 3) {\n            let found;\n            let from = children[i] + offset, to = children[i + 1] + offset;\n            for (let j = 0, span; j < decorations.length; j++)\n                if (span = decorations[j]) {\n                    if (span.from > from && span.to < to) {\n                        decorations[j] = null;\n                        (found || (found = [])).push(span);\n                    }\n                }\n            if (!found)\n                continue;\n            if (children == this.children)\n                children = this.children.slice();\n            let removed = children[i + 2].removeInner(found, from + 1);\n            if (removed != empty) {\n                children[i + 2] = removed;\n            }\n            else {\n                children.splice(i, 3);\n                i -= 3;\n            }\n        }\n        if (local.length)\n            for (let i = 0, span; i < decorations.length; i++)\n                if (span = decorations[i]) {\n                    for (let j = 0; j < local.length; j++)\n                        if (local[j].eq(span, offset)) {\n                            if (local == this.local)\n                                local = this.local.slice();\n                            local.splice(j--, 1);\n                        }\n                }\n        if (children == this.children && local == this.local)\n            return this;\n        return local.length || children.length ? new DecorationSet(local, children) : empty;\n    }\n    forChild(offset, node) {\n        if (this == empty)\n            return this;\n        if (node.isLeaf)\n            return DecorationSet.empty;\n        let child, local;\n        for (let i = 0; i < this.children.length; i += 3)\n            if (this.children[i] >= offset) {\n                if (this.children[i] == offset)\n                    child = this.children[i + 2];\n                break;\n            }\n        let start = offset + 1, end = start + node.content.size;\n        for (let i = 0; i < this.local.length; i++) {\n            let dec = this.local[i];\n            if (dec.from < end && dec.to > start && (dec.type instanceof InlineType)) {\n                let from = Math.max(start, dec.from) - start, to = Math.min(end, dec.to) - start;\n                if (from < to)\n                    (local || (local = [])).push(dec.copy(from, to));\n            }\n        }\n        if (local) {\n            let localSet = new DecorationSet(local.sort(byPos), none);\n            return child ? new DecorationGroup([localSet, child]) : localSet;\n        }\n        return child || empty;\n    }\n    /**\n    @internal\n    */\n    eq(other) {\n        if (this == other)\n            return true;\n        if (!(other instanceof DecorationSet) ||\n            this.local.length != other.local.length ||\n            this.children.length != other.children.length)\n            return false;\n        for (let i = 0; i < this.local.length; i++)\n            if (!this.local[i].eq(other.local[i]))\n                return false;\n        for (let i = 0; i < this.children.length; i += 3)\n            if (this.children[i] != other.children[i] ||\n                this.children[i + 1] != other.children[i + 1] ||\n                !this.children[i + 2].eq(other.children[i + 2]))\n                return false;\n        return true;\n    }\n    /**\n    @internal\n    */\n    locals(node) {\n        return removeOverlap(this.localsInner(node));\n    }\n    /**\n    @internal\n    */\n    localsInner(node) {\n        if (this == empty)\n            return none;\n        if (node.inlineContent || !this.local.some(InlineType.is))\n            return this.local;\n        let result = [];\n        for (let i = 0; i < this.local.length; i++) {\n            if (!(this.local[i].type instanceof InlineType))\n                result.push(this.local[i]);\n        }\n        return result;\n    }\n    forEachSet(f) { f(this); }\n}\n/**\nThe empty set of decorations.\n*/\nDecorationSet.empty = new DecorationSet([], []);\n/**\n@internal\n*/\nDecorationSet.removeOverlap = removeOverlap;\nconst empty = DecorationSet.empty;\n// An abstraction that allows the code dealing with decorations to\n// treat multiple DecorationSet objects as if it were a single object\n// with (a subset of) the same interface.\nclass DecorationGroup {\n    constructor(members) {\n        this.members = members;\n    }\n    map(mapping, doc) {\n        const mappedDecos = this.members.map(member => member.map(mapping, doc, noSpec));\n        return DecorationGroup.from(mappedDecos);\n    }\n    forChild(offset, child) {\n        if (child.isLeaf)\n            return DecorationSet.empty;\n        let found = [];\n        for (let i = 0; i < this.members.length; i++) {\n            let result = this.members[i].forChild(offset, child);\n            if (result == empty)\n                continue;\n            if (result instanceof DecorationGroup)\n                found = found.concat(result.members);\n            else\n                found.push(result);\n        }\n        return DecorationGroup.from(found);\n    }\n    eq(other) {\n        if (!(other instanceof DecorationGroup) ||\n            other.members.length != this.members.length)\n            return false;\n        for (let i = 0; i < this.members.length; i++)\n            if (!this.members[i].eq(other.members[i]))\n                return false;\n        return true;\n    }\n    locals(node) {\n        let result, sorted = true;\n        for (let i = 0; i < this.members.length; i++) {\n            let locals = this.members[i].localsInner(node);\n            if (!locals.length)\n                continue;\n            if (!result) {\n                result = locals;\n            }\n            else {\n                if (sorted) {\n                    result = result.slice();\n                    sorted = false;\n                }\n                for (let j = 0; j < locals.length; j++)\n                    result.push(locals[j]);\n            }\n        }\n        return result ? removeOverlap(sorted ? result : result.sort(byPos)) : none;\n    }\n    // Create a group for the given array of decoration sets, or return\n    // a single set when possible.\n    static from(members) {\n        switch (members.length) {\n            case 0: return empty;\n            case 1: return members[0];\n            default: return new DecorationGroup(members.every(m => m instanceof DecorationSet) ? members :\n                members.reduce((r, m) => r.concat(m instanceof DecorationSet ? m : m.members), []));\n        }\n    }\n    forEachSet(f) {\n        for (let i = 0; i < this.members.length; i++)\n            this.members[i].forEachSet(f);\n    }\n}\nfunction mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, options) {\n    let children = oldChildren.slice();\n    // Mark the children that are directly touched by changes, and\n    // move those that are after the changes.\n    for (let i = 0, baseOffset = oldOffset; i < mapping.maps.length; i++) {\n        let moved = 0;\n        mapping.maps[i].forEach((oldStart, oldEnd, newStart, newEnd) => {\n            let dSize = (newEnd - newStart) - (oldEnd - oldStart);\n            for (let i = 0; i < children.length; i += 3) {\n                let end = children[i + 1];\n                if (end < 0 || oldStart > end + baseOffset - moved)\n                    continue;\n                let start = children[i] + baseOffset - moved;\n                if (oldEnd >= start) {\n                    children[i + 1] = oldStart <= start ? -2 : -1;\n                }\n                else if (oldStart >= baseOffset && dSize) {\n                    children[i] += dSize;\n                    children[i + 1] += dSize;\n                }\n            }\n            moved += dSize;\n        });\n        baseOffset = mapping.maps[i].map(baseOffset, -1);\n    }\n    // Find the child nodes that still correspond to a single node,\n    // recursively call mapInner on them and update their positions.\n    let mustRebuild = false;\n    for (let i = 0; i < children.length; i += 3)\n        if (children[i + 1] < 0) { // Touched nodes\n            if (children[i + 1] == -2) {\n                mustRebuild = true;\n                children[i + 1] = -1;\n                continue;\n            }\n            let from = mapping.map(oldChildren[i] + oldOffset), fromLocal = from - offset;\n            if (fromLocal < 0 || fromLocal >= node.content.size) {\n                mustRebuild = true;\n                continue;\n            }\n            // Must read oldChildren because children was tagged with -1\n            let to = mapping.map(oldChildren[i + 1] + oldOffset, -1), toLocal = to - offset;\n            let { index, offset: childOffset } = node.content.findIndex(fromLocal);\n            let childNode = node.maybeChild(index);\n            if (childNode && childOffset == fromLocal && childOffset + childNode.nodeSize == toLocal) {\n                let mapped = children[i + 2]\n                    .mapInner(mapping, childNode, from + 1, oldChildren[i] + oldOffset + 1, options);\n                if (mapped != empty) {\n                    children[i] = fromLocal;\n                    children[i + 1] = toLocal;\n                    children[i + 2] = mapped;\n                }\n                else {\n                    children[i + 1] = -2;\n                    mustRebuild = true;\n                }\n            }\n            else {\n                mustRebuild = true;\n            }\n        }\n    // Remaining children must be collected and rebuilt into the appropriate structure\n    if (mustRebuild) {\n        let decorations = mapAndGatherRemainingDecorations(children, oldChildren, newLocal, mapping, offset, oldOffset, options);\n        let built = buildTree(decorations, node, 0, options);\n        newLocal = built.local;\n        for (let i = 0; i < children.length; i += 3)\n            if (children[i + 1] < 0) {\n                children.splice(i, 3);\n                i -= 3;\n            }\n        for (let i = 0, j = 0; i < built.children.length; i += 3) {\n            let from = built.children[i];\n            while (j < children.length && children[j] < from)\n                j += 3;\n            children.splice(j, 0, built.children[i], built.children[i + 1], built.children[i + 2]);\n        }\n    }\n    return new DecorationSet(newLocal.sort(byPos), children);\n}\nfunction moveSpans(spans, offset) {\n    if (!offset || !spans.length)\n        return spans;\n    let result = [];\n    for (let i = 0; i < spans.length; i++) {\n        let span = spans[i];\n        result.push(new Decoration(span.from + offset, span.to + offset, span.type));\n    }\n    return result;\n}\nfunction mapAndGatherRemainingDecorations(children, oldChildren, decorations, mapping, offset, oldOffset, options) {\n    // Gather all decorations from the remaining marked children\n    function gather(set, oldOffset) {\n        for (let i = 0; i < set.local.length; i++) {\n            let mapped = set.local[i].map(mapping, offset, oldOffset);\n            if (mapped)\n                decorations.push(mapped);\n            else if (options.onRemove)\n                options.onRemove(set.local[i].spec);\n        }\n        for (let i = 0; i < set.children.length; i += 3)\n            gather(set.children[i + 2], set.children[i] + oldOffset + 1);\n    }\n    for (let i = 0; i < children.length; i += 3)\n        if (children[i + 1] == -1)\n            gather(children[i + 2], oldChildren[i] + oldOffset + 1);\n    return decorations;\n}\nfunction takeSpansForNode(spans, node, offset) {\n    if (node.isLeaf)\n        return null;\n    let end = offset + node.nodeSize, found = null;\n    for (let i = 0, span; i < spans.length; i++) {\n        if ((span = spans[i]) && span.from > offset && span.to < end) {\n            (found || (found = [])).push(span);\n            spans[i] = null;\n        }\n    }\n    return found;\n}\nfunction withoutNulls(array) {\n    let result = [];\n    for (let i = 0; i < array.length; i++)\n        if (array[i] != null)\n            result.push(array[i]);\n    return result;\n}\n// Build up a tree that corresponds to a set of decorations. `offset`\n// is a base offset that should be subtracted from the `from` and `to`\n// positions in the spans (so that we don't have to allocate new spans\n// for recursive calls).\nfunction buildTree(spans, node, offset, options) {\n    let children = [], hasNulls = false;\n    node.forEach((childNode, localStart) => {\n        let found = takeSpansForNode(spans, childNode, localStart + offset);\n        if (found) {\n            hasNulls = true;\n            let subtree = buildTree(found, childNode, offset + localStart + 1, options);\n            if (subtree != empty)\n                children.push(localStart, localStart + childNode.nodeSize, subtree);\n        }\n    });\n    let locals = moveSpans(hasNulls ? withoutNulls(spans) : spans, -offset).sort(byPos);\n    for (let i = 0; i < locals.length; i++)\n        if (!locals[i].type.valid(node, locals[i])) {\n            if (options.onRemove)\n                options.onRemove(locals[i].spec);\n            locals.splice(i--, 1);\n        }\n    return locals.length || children.length ? new DecorationSet(locals, children) : empty;\n}\n// Used to sort decorations so that ones with a low start position\n// come first, and within a set with the same start position, those\n// with an smaller end position come first.\nfunction byPos(a, b) {\n    return a.from - b.from || a.to - b.to;\n}\n// Scan a sorted array of decorations for partially overlapping spans,\n// and split those so that only fully overlapping spans are left (to\n// make subsequent rendering easier). Will return the input array if\n// no partially overlapping spans are found (the common case).\nfunction removeOverlap(spans) {\n    let working = spans;\n    for (let i = 0; i < working.length - 1; i++) {\n        let span = working[i];\n        if (span.from != span.to)\n            for (let j = i + 1; j < working.length; j++) {\n                let next = working[j];\n                if (next.from == span.from) {\n                    if (next.to != span.to) {\n                        if (working == spans)\n                            working = spans.slice();\n                        // Followed by a partially overlapping larger span. Split that\n                        // span.\n                        working[j] = next.copy(next.from, span.to);\n                        insertAhead(working, j + 1, next.copy(span.to, next.to));\n                    }\n                    continue;\n                }\n                else {\n                    if (next.from < span.to) {\n                        if (working == spans)\n                            working = spans.slice();\n                        // The end of this one overlaps with a subsequent span. Split\n                        // this one.\n                        working[i] = span.copy(span.from, next.from);\n                        insertAhead(working, j, span.copy(next.from, span.to));\n                    }\n                    break;\n                }\n            }\n    }\n    return working;\n}\nfunction insertAhead(array, i, deco) {\n    while (i < array.length && byPos(deco, array[i]) > 0)\n        i++;\n    array.splice(i, 0, deco);\n}\n// Get the decorations associated with the current props of a view.\nfunction viewDecorations(view) {\n    let found = [];\n    view.someProp(\"decorations\", f => {\n        let result = f(view.state);\n        if (result && result != empty)\n            found.push(result);\n    });\n    if (view.cursorWrapper)\n        found.push(DecorationSet.create(view.state.doc, [view.cursorWrapper.deco]));\n    return DecorationGroup.from(found);\n}\n\nconst observeOptions = {\n    childList: true,\n    characterData: true,\n    characterDataOldValue: true,\n    attributes: true,\n    attributeOldValue: true,\n    subtree: true\n};\n// IE11 has very broken mutation observers, so we also listen to DOMCharacterDataModified\nconst useCharData = ie && ie_version <= 11;\nclass SelectionState {\n    constructor() {\n        this.anchorNode = null;\n        this.anchorOffset = 0;\n        this.focusNode = null;\n        this.focusOffset = 0;\n    }\n    set(sel) {\n        this.anchorNode = sel.anchorNode;\n        this.anchorOffset = sel.anchorOffset;\n        this.focusNode = sel.focusNode;\n        this.focusOffset = sel.focusOffset;\n    }\n    clear() {\n        this.anchorNode = this.focusNode = null;\n    }\n    eq(sel) {\n        return sel.anchorNode == this.anchorNode && sel.anchorOffset == this.anchorOffset &&\n            sel.focusNode == this.focusNode && sel.focusOffset == this.focusOffset;\n    }\n}\nclass DOMObserver {\n    constructor(view, handleDOMChange) {\n        this.view = view;\n        this.handleDOMChange = handleDOMChange;\n        this.queue = [];\n        this.flushingSoon = -1;\n        this.observer = null;\n        this.currentSelection = new SelectionState;\n        this.onCharData = null;\n        this.suppressingSelectionUpdates = false;\n        this.lastChangedTextNode = null;\n        this.observer = window.MutationObserver &&\n            new window.MutationObserver(mutations => {\n                for (let i = 0; i < mutations.length; i++)\n                    this.queue.push(mutations[i]);\n                // IE11 will sometimes (on backspacing out a single character\n                // text node after a BR node) call the observer callback\n                // before actually updating the DOM, which will cause\n                // ProseMirror to miss the change (see #930)\n                if (ie && ie_version <= 11 && mutations.some(m => m.type == \"childList\" && m.removedNodes.length ||\n                    m.type == \"characterData\" && m.oldValue.length > m.target.nodeValue.length))\n                    this.flushSoon();\n                else\n                    this.flush();\n            });\n        if (useCharData) {\n            this.onCharData = e => {\n                this.queue.push({ target: e.target, type: \"characterData\", oldValue: e.prevValue });\n                this.flushSoon();\n            };\n        }\n        this.onSelectionChange = this.onSelectionChange.bind(this);\n    }\n    flushSoon() {\n        if (this.flushingSoon < 0)\n            this.flushingSoon = window.setTimeout(() => { this.flushingSoon = -1; this.flush(); }, 20);\n    }\n    forceFlush() {\n        if (this.flushingSoon > -1) {\n            window.clearTimeout(this.flushingSoon);\n            this.flushingSoon = -1;\n            this.flush();\n        }\n    }\n    start() {\n        if (this.observer) {\n            this.observer.takeRecords();\n            this.observer.observe(this.view.dom, observeOptions);\n        }\n        if (this.onCharData)\n            this.view.dom.addEventListener(\"DOMCharacterDataModified\", this.onCharData);\n        this.connectSelection();\n    }\n    stop() {\n        if (this.observer) {\n            let take = this.observer.takeRecords();\n            if (take.length) {\n                for (let i = 0; i < take.length; i++)\n                    this.queue.push(take[i]);\n                window.setTimeout(() => this.flush(), 20);\n            }\n            this.observer.disconnect();\n        }\n        if (this.onCharData)\n            this.view.dom.removeEventListener(\"DOMCharacterDataModified\", this.onCharData);\n        this.disconnectSelection();\n    }\n    connectSelection() {\n        this.view.dom.ownerDocument.addEventListener(\"selectionchange\", this.onSelectionChange);\n    }\n    disconnectSelection() {\n        this.view.dom.ownerDocument.removeEventListener(\"selectionchange\", this.onSelectionChange);\n    }\n    suppressSelectionUpdates() {\n        this.suppressingSelectionUpdates = true;\n        setTimeout(() => this.suppressingSelectionUpdates = false, 50);\n    }\n    onSelectionChange() {\n        if (!hasFocusAndSelection(this.view))\n            return;\n        if (this.suppressingSelectionUpdates)\n            return selectionToDOM(this.view);\n        // Deletions on IE11 fire their events in the wrong order, giving\n        // us a selection change event before the DOM changes are\n        // reported.\n        if (ie && ie_version <= 11 && !this.view.state.selection.empty) {\n            let sel = this.view.domSelectionRange();\n            // Selection.isCollapsed isn't reliable on IE\n            if (sel.focusNode && isEquivalentPosition(sel.focusNode, sel.focusOffset, sel.anchorNode, sel.anchorOffset))\n                return this.flushSoon();\n        }\n        this.flush();\n    }\n    setCurSelection() {\n        this.currentSelection.set(this.view.domSelectionRange());\n    }\n    ignoreSelectionChange(sel) {\n        if (!sel.focusNode)\n            return true;\n        let ancestors = new Set, container;\n        for (let scan = sel.focusNode; scan; scan = parentNode(scan))\n            ancestors.add(scan);\n        for (let scan = sel.anchorNode; scan; scan = parentNode(scan))\n            if (ancestors.has(scan)) {\n                container = scan;\n                break;\n            }\n        let desc = container && this.view.docView.nearestDesc(container);\n        if (desc && desc.ignoreMutation({\n            type: \"selection\",\n            target: container.nodeType == 3 ? container.parentNode : container\n        })) {\n            this.setCurSelection();\n            return true;\n        }\n    }\n    pendingRecords() {\n        if (this.observer)\n            for (let mut of this.observer.takeRecords())\n                this.queue.push(mut);\n        return this.queue;\n    }\n    flush() {\n        let { view } = this;\n        if (!view.docView || this.flushingSoon > -1)\n            return;\n        let mutations = this.pendingRecords();\n        if (mutations.length)\n            this.queue = [];\n        let sel = view.domSelectionRange();\n        let newSel = !this.suppressingSelectionUpdates && !this.currentSelection.eq(sel) && hasFocusAndSelection(view) && !this.ignoreSelectionChange(sel);\n        let from = -1, to = -1, typeOver = false, added = [];\n        if (view.editable) {\n            for (let i = 0; i < mutations.length; i++) {\n                let result = this.registerMutation(mutations[i], added);\n                if (result) {\n                    from = from < 0 ? result.from : Math.min(result.from, from);\n                    to = to < 0 ? result.to : Math.max(result.to, to);\n                    if (result.typeOver)\n                        typeOver = true;\n                }\n            }\n        }\n        if (gecko && added.length) {\n            let brs = added.filter(n => n.nodeName == \"BR\");\n            if (brs.length == 2) {\n                let [a, b] = brs;\n                if (a.parentNode && a.parentNode.parentNode == b.parentNode)\n                    b.remove();\n                else\n                    a.remove();\n            }\n            else {\n                let { focusNode } = this.currentSelection;\n                for (let br of brs) {\n                    let parent = br.parentNode;\n                    if (parent && parent.nodeName == \"LI\" && (!focusNode || blockParent(view, focusNode) != parent))\n                        br.remove();\n                }\n            }\n        }\n        let readSel = null;\n        // If it looks like the browser has reset the selection to the\n        // start of the document after focus, restore the selection from\n        // the state\n        if (from < 0 && newSel && view.input.lastFocus > Date.now() - 200 &&\n            Math.max(view.input.lastTouch, view.input.lastClick.time) < Date.now() - 300 &&\n            selectionCollapsed(sel) && (readSel = selectionFromDOM(view)) &&\n            readSel.eq(Selection.near(view.state.doc.resolve(0), 1))) {\n            view.input.lastFocus = 0;\n            selectionToDOM(view);\n            this.currentSelection.set(sel);\n            view.scrollToSelection();\n        }\n        else if (from > -1 || newSel) {\n            if (from > -1) {\n                view.docView.markDirty(from, to);\n                checkCSS(view);\n            }\n            this.handleDOMChange(from, to, typeOver, added);\n            if (view.docView && view.docView.dirty)\n                view.updateState(view.state);\n            else if (!this.currentSelection.eq(sel))\n                selectionToDOM(view);\n            this.currentSelection.set(sel);\n        }\n    }\n    registerMutation(mut, added) {\n        // Ignore mutations inside nodes that were already noted as inserted\n        if (added.indexOf(mut.target) > -1)\n            return null;\n        let desc = this.view.docView.nearestDesc(mut.target);\n        if (mut.type == \"attributes\" &&\n            (desc == this.view.docView || mut.attributeName == \"contenteditable\" ||\n                // Firefox sometimes fires spurious events for null/empty styles\n                (mut.attributeName == \"style\" && !mut.oldValue && !mut.target.getAttribute(\"style\"))))\n            return null;\n        if (!desc || desc.ignoreMutation(mut))\n            return null;\n        if (mut.type == \"childList\") {\n            for (let i = 0; i < mut.addedNodes.length; i++) {\n                let node = mut.addedNodes[i];\n                added.push(node);\n                if (node.nodeType == 3)\n                    this.lastChangedTextNode = node;\n            }\n            if (desc.contentDOM && desc.contentDOM != desc.dom && !desc.contentDOM.contains(mut.target))\n                return { from: desc.posBefore, to: desc.posAfter };\n            let prev = mut.previousSibling, next = mut.nextSibling;\n            if (ie && ie_version <= 11 && mut.addedNodes.length) {\n                // IE11 gives us incorrect next/prev siblings for some\n                // insertions, so if there are added nodes, recompute those\n                for (let i = 0; i < mut.addedNodes.length; i++) {\n                    let { previousSibling, nextSibling } = mut.addedNodes[i];\n                    if (!previousSibling || Array.prototype.indexOf.call(mut.addedNodes, previousSibling) < 0)\n                        prev = previousSibling;\n                    if (!nextSibling || Array.prototype.indexOf.call(mut.addedNodes, nextSibling) < 0)\n                        next = nextSibling;\n                }\n            }\n            let fromOffset = prev && prev.parentNode == mut.target\n                ? domIndex(prev) + 1 : 0;\n            let from = desc.localPosFromDOM(mut.target, fromOffset, -1);\n            let toOffset = next && next.parentNode == mut.target\n                ? domIndex(next) : mut.target.childNodes.length;\n            let to = desc.localPosFromDOM(mut.target, toOffset, 1);\n            return { from, to };\n        }\n        else if (mut.type == \"attributes\") {\n            return { from: desc.posAtStart - desc.border, to: desc.posAtEnd + desc.border };\n        }\n        else { // \"characterData\"\n            this.lastChangedTextNode = mut.target;\n            return {\n                from: desc.posAtStart,\n                to: desc.posAtEnd,\n                // An event was generated for a text change that didn't change\n                // any text. Mark the dom change to fall back to assuming the\n                // selection was typed over with an identical value if it can't\n                // find another change.\n                typeOver: mut.target.nodeValue == mut.oldValue\n            };\n        }\n    }\n}\nlet cssChecked = new WeakMap();\nlet cssCheckWarned = false;\nfunction checkCSS(view) {\n    if (cssChecked.has(view))\n        return;\n    cssChecked.set(view, null);\n    if (['normal', 'nowrap', 'pre-line'].indexOf(getComputedStyle(view.dom).whiteSpace) !== -1) {\n        view.requiresGeckoHackNode = gecko;\n        if (cssCheckWarned)\n            return;\n        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.\");\n        cssCheckWarned = true;\n    }\n}\nfunction rangeToSelectionRange(view, range) {\n    let anchorNode = range.startContainer, anchorOffset = range.startOffset;\n    let focusNode = range.endContainer, focusOffset = range.endOffset;\n    let currentAnchor = view.domAtPos(view.state.selection.anchor);\n    // Since such a range doesn't distinguish between anchor and head,\n    // use a heuristic that flips it around if its end matches the\n    // current anchor.\n    if (isEquivalentPosition(currentAnchor.node, currentAnchor.offset, focusNode, focusOffset))\n        [anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset];\n    return { anchorNode, anchorOffset, focusNode, focusOffset };\n}\n// Used to work around a Safari Selection/shadow DOM bug\n// Based on https://github.com/codemirror/dev/issues/414 fix\nfunction safariShadowSelectionRange(view, selection) {\n    if (selection.getComposedRanges) {\n        let range = selection.getComposedRanges(view.root)[0];\n        if (range)\n            return rangeToSelectionRange(view, range);\n    }\n    let found;\n    function read(event) {\n        event.preventDefault();\n        event.stopImmediatePropagation();\n        found = event.getTargetRanges()[0];\n    }\n    // Because Safari (at least in 2018-2022) doesn't provide regular\n    // access to the selection inside a shadowRoot, we have to perform a\n    // ridiculous hack to get at it—using `execCommand` to trigger a\n    // `beforeInput` event so that we can read the target range from the\n    // event.\n    view.dom.addEventListener(\"beforeinput\", read, true);\n    document.execCommand(\"indent\");\n    view.dom.removeEventListener(\"beforeinput\", read, true);\n    return found ? rangeToSelectionRange(view, found) : null;\n}\nfunction blockParent(view, node) {\n    for (let p = node.parentNode; p && p != view.dom; p = p.parentNode) {\n        let desc = view.docView.nearestDesc(p, true);\n        if (desc && desc.node.isBlock)\n            return p;\n    }\n    return null;\n}\n\n// Note that all referencing and parsing is done with the\n// start-of-operation selection and document, since that's the one\n// that the DOM represents. If any changes came in in the meantime,\n// the modification is mapped over those before it is applied, in\n// readDOMChange.\nfunction parseBetween(view, from_, to_) {\n    let { node: parent, fromOffset, toOffset, from, to } = view.docView.parseRange(from_, to_);\n    let domSel = view.domSelectionRange();\n    let find;\n    let anchor = domSel.anchorNode;\n    if (anchor && view.dom.contains(anchor.nodeType == 1 ? anchor : anchor.parentNode)) {\n        find = [{ node: anchor, offset: domSel.anchorOffset }];\n        if (!selectionCollapsed(domSel))\n            find.push({ node: domSel.focusNode, offset: domSel.focusOffset });\n    }\n    // Work around issue in Chrome where backspacing sometimes replaces\n    // the deleted content with a random BR node (issues #799, #831)\n    if (chrome && view.input.lastKeyCode === 8) {\n        for (let off = toOffset; off > fromOffset; off--) {\n            let node = parent.childNodes[off - 1], desc = node.pmViewDesc;\n            if (node.nodeName == \"BR\" && !desc) {\n                toOffset = off;\n                break;\n            }\n            if (!desc || desc.size)\n                break;\n        }\n    }\n    let startDoc = view.state.doc;\n    let parser = view.someProp(\"domParser\") || DOMParser.fromSchema(view.state.schema);\n    let $from = startDoc.resolve(from);\n    let sel = null, doc = parser.parse(parent, {\n        topNode: $from.parent,\n        topMatch: $from.parent.contentMatchAt($from.index()),\n        topOpen: true,\n        from: fromOffset,\n        to: toOffset,\n        preserveWhitespace: $from.parent.type.whitespace == \"pre\" ? \"full\" : true,\n        findPositions: find,\n        ruleFromNode,\n        context: $from\n    });\n    if (find && find[0].pos != null) {\n        let anchor = find[0].pos, head = find[1] && find[1].pos;\n        if (head == null)\n            head = anchor;\n        sel = { anchor: anchor + from, head: head + from };\n    }\n    return { doc, sel, from, to };\n}\nfunction ruleFromNode(dom) {\n    let desc = dom.pmViewDesc;\n    if (desc) {\n        return desc.parseRule();\n    }\n    else if (dom.nodeName == \"BR\" && dom.parentNode) {\n        // Safari replaces the list item or table cell with a BR\n        // directly in the list node (?!) if you delete the last\n        // character in a list item or table cell (#708, #862)\n        if (safari && /^(ul|ol)$/i.test(dom.parentNode.nodeName)) {\n            let skip = document.createElement(\"div\");\n            skip.appendChild(document.createElement(\"li\"));\n            return { skip };\n        }\n        else if (dom.parentNode.lastChild == dom || safari && /^(tr|table)$/i.test(dom.parentNode.nodeName)) {\n            return { ignore: true };\n        }\n    }\n    else if (dom.nodeName == \"IMG\" && dom.getAttribute(\"mark-placeholder\")) {\n        return { ignore: true };\n    }\n    return null;\n}\nconst isInline = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;\nfunction readDOMChange(view, from, to, typeOver, addedNodes) {\n    let compositionID = view.input.compositionPendingChanges || (view.composing ? view.input.compositionID : 0);\n    view.input.compositionPendingChanges = 0;\n    if (from < 0) {\n        let origin = view.input.lastSelectionTime > Date.now() - 50 ? view.input.lastSelectionOrigin : null;\n        let newSel = selectionFromDOM(view, origin);\n        if (newSel && !view.state.selection.eq(newSel)) {\n            if (chrome && android &&\n                view.input.lastKeyCode === 13 && Date.now() - 100 < view.input.lastKeyCodeTime &&\n                view.someProp(\"handleKeyDown\", f => f(view, keyEvent(13, \"Enter\"))))\n                return;\n            let tr = view.state.tr.setSelection(newSel);\n            if (origin == \"pointer\")\n                tr.setMeta(\"pointer\", true);\n            else if (origin == \"key\")\n                tr.scrollIntoView();\n            if (compositionID)\n                tr.setMeta(\"composition\", compositionID);\n            view.dispatch(tr);\n        }\n        return;\n    }\n    let $before = view.state.doc.resolve(from);\n    let shared = $before.sharedDepth(to);\n    from = $before.before(shared + 1);\n    to = view.state.doc.resolve(to).after(shared + 1);\n    let sel = view.state.selection;\n    let parse = parseBetween(view, from, to);\n    let doc = view.state.doc, compare = doc.slice(parse.from, parse.to);\n    let preferredPos, preferredSide;\n    // Prefer anchoring to end when Backspace is pressed\n    if (view.input.lastKeyCode === 8 && Date.now() - 100 < view.input.lastKeyCodeTime) {\n        preferredPos = view.state.selection.to;\n        preferredSide = \"end\";\n    }\n    else {\n        preferredPos = view.state.selection.from;\n        preferredSide = \"start\";\n    }\n    view.input.lastKeyCode = null;\n    let change = findDiff(compare.content, parse.doc.content, parse.from, preferredPos, preferredSide);\n    if (change)\n        view.input.domChangeCount++;\n    if ((ios && view.input.lastIOSEnter > Date.now() - 225 || android) &&\n        addedNodes.some(n => n.nodeType == 1 && !isInline.test(n.nodeName)) &&\n        (!change || change.endA >= change.endB) &&\n        view.someProp(\"handleKeyDown\", f => f(view, keyEvent(13, \"Enter\")))) {\n        view.input.lastIOSEnter = 0;\n        return;\n    }\n    if (!change) {\n        if (typeOver && sel instanceof TextSelection && !sel.empty && sel.$head.sameParent(sel.$anchor) &&\n            !view.composing && !(parse.sel && parse.sel.anchor != parse.sel.head)) {\n            change = { start: sel.from, endA: sel.to, endB: sel.to };\n        }\n        else {\n            if (parse.sel) {\n                let sel = resolveSelection(view, view.state.doc, parse.sel);\n                if (sel && !sel.eq(view.state.selection)) {\n                    let tr = view.state.tr.setSelection(sel);\n                    if (compositionID)\n                        tr.setMeta(\"composition\", compositionID);\n                    view.dispatch(tr);\n                }\n            }\n            return;\n        }\n    }\n    // Handle the case where overwriting a selection by typing matches\n    // the start or end of the selected content, creating a change\n    // that's smaller than what was actually overwritten.\n    if (view.state.selection.from < view.state.selection.to &&\n        change.start == change.endB &&\n        view.state.selection instanceof TextSelection) {\n        if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2 &&\n            view.state.selection.from >= parse.from) {\n            change.start = view.state.selection.from;\n        }\n        else if (change.endA < view.state.selection.to && change.endA >= view.state.selection.to - 2 &&\n            view.state.selection.to <= parse.to) {\n            change.endB += (view.state.selection.to - change.endA);\n            change.endA = view.state.selection.to;\n        }\n    }\n    // IE11 will insert a non-breaking space _ahead_ of the space after\n    // the cursor space when adding a space before another space. When\n    // that happened, adjust the change to cover the space instead.\n    if (ie && ie_version <= 11 && change.endB == change.start + 1 &&\n        change.endA == change.start && change.start > parse.from &&\n        parse.doc.textBetween(change.start - parse.from - 1, change.start - parse.from + 1) == \" \\u00a0\") {\n        change.start--;\n        change.endA--;\n        change.endB--;\n    }\n    let $from = parse.doc.resolveNoCache(change.start - parse.from);\n    let $to = parse.doc.resolveNoCache(change.endB - parse.from);\n    let $fromA = doc.resolve(change.start);\n    let inlineChange = $from.sameParent($to) && $from.parent.inlineContent && $fromA.end() >= change.endA;\n    let nextSel;\n    // If this looks like the effect of pressing Enter (or was recorded\n    // as being an iOS enter press), just dispatch an Enter key instead.\n    if (((ios && view.input.lastIOSEnter > Date.now() - 225 &&\n        (!inlineChange || addedNodes.some(n => n.nodeName == \"DIV\" || n.nodeName == \"P\"))) ||\n        (!inlineChange && $from.pos < parse.doc.content.size && !$from.sameParent($to) &&\n            (nextSel = Selection.findFrom(parse.doc.resolve($from.pos + 1), 1, true)) &&\n            nextSel.head == $to.pos)) &&\n        view.someProp(\"handleKeyDown\", f => f(view, keyEvent(13, \"Enter\")))) {\n        view.input.lastIOSEnter = 0;\n        return;\n    }\n    // Same for backspace\n    if (view.state.selection.anchor > change.start &&\n        looksLikeBackspace(doc, change.start, change.endA, $from, $to) &&\n        view.someProp(\"handleKeyDown\", f => f(view, keyEvent(8, \"Backspace\")))) {\n        if (android && chrome)\n            view.domObserver.suppressSelectionUpdates(); // #820\n        return;\n    }\n    // Chrome will occasionally, during composition, delete the\n    // entire composition and then immediately insert it again. This is\n    // used to detect that situation.\n    if (chrome && change.endB == change.start)\n        view.input.lastChromeDelete = Date.now();\n    // This tries to detect Android virtual keyboard\n    // enter-and-pick-suggestion action. That sometimes (see issue\n    // #1059) first fires a DOM mutation, before moving the selection to\n    // the newly created block. And then, because ProseMirror cleans up\n    // the DOM selection, it gives up moving the selection entirely,\n    // leaving the cursor in the wrong place. When that happens, we drop\n    // the new paragraph from the initial change, and fire a simulated\n    // enter key afterwards.\n    if (android && !inlineChange && $from.start() != $to.start() && $to.parentOffset == 0 && $from.depth == $to.depth &&\n        parse.sel && parse.sel.anchor == parse.sel.head && parse.sel.head == change.endA) {\n        change.endB -= 2;\n        $to = parse.doc.resolveNoCache(change.endB - parse.from);\n        setTimeout(() => {\n            view.someProp(\"handleKeyDown\", function (f) { return f(view, keyEvent(13, \"Enter\")); });\n        }, 20);\n    }\n    let chFrom = change.start, chTo = change.endA;\n    let tr, storedMarks, markChange;\n    if (inlineChange) {\n        if ($from.pos == $to.pos) { // Deletion\n            // IE11 sometimes weirdly moves the DOM selection around after\n            // backspacing out the first element in a textblock\n            if (ie && ie_version <= 11 && $from.parentOffset == 0) {\n                view.domObserver.suppressSelectionUpdates();\n                setTimeout(() => selectionToDOM(view), 20);\n            }\n            tr = view.state.tr.delete(chFrom, chTo);\n            storedMarks = doc.resolve(change.start).marksAcross(doc.resolve(change.endA));\n        }\n        else if ( // Adding or removing a mark\n        change.endA == change.endB &&\n            (markChange = isMarkChange($from.parent.content.cut($from.parentOffset, $to.parentOffset), $fromA.parent.content.cut($fromA.parentOffset, change.endA - $fromA.start())))) {\n            tr = view.state.tr;\n            if (markChange.type == \"add\")\n                tr.addMark(chFrom, chTo, markChange.mark);\n            else\n                tr.removeMark(chFrom, chTo, markChange.mark);\n        }\n        else if ($from.parent.child($from.index()).isText && $from.index() == $to.index() - ($to.textOffset ? 0 : 1)) {\n            // Both positions in the same text node -- simply insert text\n            let text = $from.parent.textBetween($from.parentOffset, $to.parentOffset);\n            if (view.someProp(\"handleTextInput\", f => f(view, chFrom, chTo, text)))\n                return;\n            tr = view.state.tr.insertText(text, chFrom, chTo);\n        }\n    }\n    if (!tr)\n        tr = view.state.tr.replace(chFrom, chTo, parse.doc.slice(change.start - parse.from, change.endB - parse.from));\n    if (parse.sel) {\n        let sel = resolveSelection(view, tr.doc, parse.sel);\n        // Chrome will sometimes, during composition, report the\n        // selection in the wrong place. If it looks like that is\n        // happening, don't update the selection.\n        // Edge just doesn't move the cursor forward when you start typing\n        // in an empty block or between br nodes.\n        if (sel && !(chrome && view.composing && sel.empty &&\n            (change.start != change.endB || view.input.lastChromeDelete < Date.now() - 100) &&\n            (sel.head == chFrom || sel.head == tr.mapping.map(chTo) - 1) ||\n            ie && sel.empty && sel.head == chFrom))\n            tr.setSelection(sel);\n    }\n    if (storedMarks)\n        tr.ensureMarks(storedMarks);\n    if (compositionID)\n        tr.setMeta(\"composition\", compositionID);\n    view.dispatch(tr.scrollIntoView());\n}\nfunction resolveSelection(view, doc, parsedSel) {\n    if (Math.max(parsedSel.anchor, parsedSel.head) > doc.content.size)\n        return null;\n    return selectionBetween(view, doc.resolve(parsedSel.anchor), doc.resolve(parsedSel.head));\n}\n// Given two same-length, non-empty fragments of inline content,\n// determine whether the first could be created from the second by\n// removing or adding a single mark type.\nfunction isMarkChange(cur, prev) {\n    let curMarks = cur.firstChild.marks, prevMarks = prev.firstChild.marks;\n    let added = curMarks, removed = prevMarks, type, mark, update;\n    for (let i = 0; i < prevMarks.length; i++)\n        added = prevMarks[i].removeFromSet(added);\n    for (let i = 0; i < curMarks.length; i++)\n        removed = curMarks[i].removeFromSet(removed);\n    if (added.length == 1 && removed.length == 0) {\n        mark = added[0];\n        type = \"add\";\n        update = (node) => node.mark(mark.addToSet(node.marks));\n    }\n    else if (added.length == 0 && removed.length == 1) {\n        mark = removed[0];\n        type = \"remove\";\n        update = (node) => node.mark(mark.removeFromSet(node.marks));\n    }\n    else {\n        return null;\n    }\n    let updated = [];\n    for (let i = 0; i < prev.childCount; i++)\n        updated.push(update(prev.child(i)));\n    if (Fragment.from(updated).eq(cur))\n        return { mark, type };\n}\nfunction looksLikeBackspace(old, start, end, $newStart, $newEnd) {\n    if ( // The content must have shrunk\n    end - start <= $newEnd.pos - $newStart.pos ||\n        // newEnd must point directly at or after the end of the block that newStart points into\n        skipClosingAndOpening($newStart, true, false) < $newEnd.pos)\n        return false;\n    let $start = old.resolve(start);\n    // Handle the case where, rather than joining blocks, the change just removed an entire block\n    if (!$newStart.parent.isTextblock) {\n        let after = $start.nodeAfter;\n        return after != null && end == start + after.nodeSize;\n    }\n    // Start must be at the end of a block\n    if ($start.parentOffset < $start.parent.content.size || !$start.parent.isTextblock)\n        return false;\n    let $next = old.resolve(skipClosingAndOpening($start, true, true));\n    // The next textblock must start before end and end near it\n    if (!$next.parent.isTextblock || $next.pos > end ||\n        skipClosingAndOpening($next, true, false) < end)\n        return false;\n    // The fragments after the join point must match\n    return $newStart.parent.content.cut($newStart.parentOffset).eq($next.parent.content);\n}\nfunction skipClosingAndOpening($pos, fromEnd, mayOpen) {\n    let depth = $pos.depth, end = fromEnd ? $pos.end() : $pos.pos;\n    while (depth > 0 && (fromEnd || $pos.indexAfter(depth) == $pos.node(depth).childCount)) {\n        depth--;\n        end++;\n        fromEnd = false;\n    }\n    if (mayOpen) {\n        let next = $pos.node(depth).maybeChild($pos.indexAfter(depth));\n        while (next && !next.isLeaf) {\n            next = next.firstChild;\n            end++;\n        }\n    }\n    return end;\n}\nfunction findDiff(a, b, pos, preferredPos, preferredSide) {\n    let start = a.findDiffStart(b, pos);\n    if (start == null)\n        return null;\n    let { a: endA, b: endB } = a.findDiffEnd(b, pos + a.size, pos + b.size);\n    if (preferredSide == \"end\") {\n        let adjust = Math.max(0, start - Math.min(endA, endB));\n        preferredPos -= endA + adjust - start;\n    }\n    if (endA < start && a.size < b.size) {\n        let move = preferredPos <= start && preferredPos >= endA ? start - preferredPos : 0;\n        start -= move;\n        if (start && start < b.size && isSurrogatePair(b.textBetween(start - 1, start + 1)))\n            start += move ? 1 : -1;\n        endB = start + (endB - endA);\n        endA = start;\n    }\n    else if (endB < start) {\n        let move = preferredPos <= start && preferredPos >= endB ? start - preferredPos : 0;\n        start -= move;\n        if (start && start < a.size && isSurrogatePair(a.textBetween(start - 1, start + 1)))\n            start += move ? 1 : -1;\n        endA = start + (endA - endB);\n        endB = start;\n    }\n    return { start, endA, endB };\n}\nfunction isSurrogatePair(str) {\n    if (str.length != 2)\n        return false;\n    let a = str.charCodeAt(0), b = str.charCodeAt(1);\n    return a >= 0xDC00 && a <= 0xDFFF && b >= 0xD800 && b <= 0xDBFF;\n}\n\n/**\n@internal\n*/\nconst __parseFromClipboard = parseFromClipboard;\n/**\n@internal\n*/\nconst __endComposition = endComposition;\n/**\nAn editor view manages the DOM structure that represents an\neditable document. Its state and behavior are determined by its\n[props](https://prosemirror.net/docs/ref/#view.DirectEditorProps).\n*/\nclass EditorView {\n    /**\n    Create a view. `place` may be a DOM node that the editor should\n    be appended to, a function that will place it into the document,\n    or an object whose `mount` property holds the node to use as the\n    document container. If it is `null`, the editor will not be\n    added to the document.\n    */\n    constructor(place, props) {\n        this._root = null;\n        /**\n        @internal\n        */\n        this.focused = false;\n        /**\n        Kludge used to work around a Chrome bug @internal\n        */\n        this.trackWrites = null;\n        this.mounted = false;\n        /**\n        @internal\n        */\n        this.markCursor = null;\n        /**\n        @internal\n        */\n        this.cursorWrapper = null;\n        /**\n        @internal\n        */\n        this.lastSelectedViewDesc = undefined;\n        /**\n        @internal\n        */\n        this.input = new InputState;\n        this.prevDirectPlugins = [];\n        this.pluginViews = [];\n        /**\n        Holds `true` when a hack node is needed in Firefox to prevent the\n        [space is eaten issue](https://github.com/ProseMirror/prosemirror/issues/651)\n        @internal\n        */\n        this.requiresGeckoHackNode = false;\n        /**\n        When editor content is being dragged, this object contains\n        information about the dragged slice and whether it is being\n        copied or moved. At any other time, it is null.\n        */\n        this.dragging = null;\n        this._props = props;\n        this.state = props.state;\n        this.directPlugins = props.plugins || [];\n        this.directPlugins.forEach(checkStateComponent);\n        this.dispatch = this.dispatch.bind(this);\n        this.dom = (place && place.mount) || document.createElement(\"div\");\n        if (place) {\n            if (place.appendChild)\n                place.appendChild(this.dom);\n            else if (typeof place == \"function\")\n                place(this.dom);\n            else if (place.mount)\n                this.mounted = true;\n        }\n        this.editable = getEditable(this);\n        updateCursorWrapper(this);\n        this.nodeViews = buildNodeViews(this);\n        this.docView = docViewDesc(this.state.doc, computeDocDeco(this), viewDecorations(this), this.dom, this);\n        this.domObserver = new DOMObserver(this, (from, to, typeOver, added) => readDOMChange(this, from, to, typeOver, added));\n        this.domObserver.start();\n        initInput(this);\n        this.updatePluginViews();\n    }\n    /**\n    Holds `true` when a\n    [composition](https://w3c.github.io/uievents/#events-compositionevents)\n    is active.\n    */\n    get composing() { return this.input.composing; }\n    /**\n    The view's current [props](https://prosemirror.net/docs/ref/#view.EditorProps).\n    */\n    get props() {\n        if (this._props.state != this.state) {\n            let prev = this._props;\n            this._props = {};\n            for (let name in prev)\n                this._props[name] = prev[name];\n            this._props.state = this.state;\n        }\n        return this._props;\n    }\n    /**\n    Update the view's props. Will immediately cause an update to\n    the DOM.\n    */\n    update(props) {\n        if (props.handleDOMEvents != this._props.handleDOMEvents)\n            ensureListeners(this);\n        let prevProps = this._props;\n        this._props = props;\n        if (props.plugins) {\n            props.plugins.forEach(checkStateComponent);\n            this.directPlugins = props.plugins;\n        }\n        this.updateStateInner(props.state, prevProps);\n    }\n    /**\n    Update the view by updating existing props object with the object\n    given as argument. Equivalent to `view.update(Object.assign({},\n    view.props, props))`.\n    */\n    setProps(props) {\n        let updated = {};\n        for (let name in this._props)\n            updated[name] = this._props[name];\n        updated.state = this.state;\n        for (let name in props)\n            updated[name] = props[name];\n        this.update(updated);\n    }\n    /**\n    Update the editor's `state` prop, without touching any of the\n    other props.\n    */\n    updateState(state) {\n        this.updateStateInner(state, this._props);\n    }\n    updateStateInner(state, prevProps) {\n        var _a;\n        let prev = this.state, redraw = false, updateSel = false;\n        // When stored marks are added, stop composition, so that they can\n        // be displayed.\n        if (state.storedMarks && this.composing) {\n            clearComposition(this);\n            updateSel = true;\n        }\n        this.state = state;\n        let pluginsChanged = prev.plugins != state.plugins || this._props.plugins != prevProps.plugins;\n        if (pluginsChanged || this._props.plugins != prevProps.plugins || this._props.nodeViews != prevProps.nodeViews) {\n            let nodeViews = buildNodeViews(this);\n            if (changedNodeViews(nodeViews, this.nodeViews)) {\n                this.nodeViews = nodeViews;\n                redraw = true;\n            }\n        }\n        if (pluginsChanged || prevProps.handleDOMEvents != this._props.handleDOMEvents) {\n            ensureListeners(this);\n        }\n        this.editable = getEditable(this);\n        updateCursorWrapper(this);\n        let innerDeco = viewDecorations(this), outerDeco = computeDocDeco(this);\n        let scroll = prev.plugins != state.plugins && !prev.doc.eq(state.doc) ? \"reset\"\n            : state.scrollToSelection > prev.scrollToSelection ? \"to selection\" : \"preserve\";\n        let updateDoc = redraw || !this.docView.matchesNode(state.doc, outerDeco, innerDeco);\n        if (updateDoc || !state.selection.eq(prev.selection))\n            updateSel = true;\n        let oldScrollPos = scroll == \"preserve\" && updateSel && this.dom.style.overflowAnchor == null && storeScrollPos(this);\n        if (updateSel) {\n            this.domObserver.stop();\n            // Work around an issue in Chrome, IE, and Edge where changing\n            // the DOM around an active selection puts it into a broken\n            // state where the thing the user sees differs from the\n            // selection reported by the Selection object (#710, #973,\n            // #1011, #1013, #1035).\n            let forceSelUpdate = updateDoc && (ie || chrome) && !this.composing &&\n                !prev.selection.empty && !state.selection.empty && selectionContextChanged(prev.selection, state.selection);\n            if (updateDoc) {\n                // If the node that the selection points into is written to,\n                // Chrome sometimes starts misreporting the selection, so this\n                // tracks that and forces a selection reset when our update\n                // did write to the node.\n                let chromeKludge = chrome ? (this.trackWrites = this.domSelectionRange().focusNode) : null;\n                if (this.composing)\n                    this.input.compositionNode = findCompositionNode(this);\n                if (redraw || !this.docView.update(state.doc, outerDeco, innerDeco, this)) {\n                    this.docView.updateOuterDeco(outerDeco);\n                    this.docView.destroy();\n                    this.docView = docViewDesc(state.doc, outerDeco, innerDeco, this.dom, this);\n                }\n                if (chromeKludge && !this.trackWrites)\n                    forceSelUpdate = true;\n            }\n            // Work around for an issue where an update arriving right between\n            // a DOM selection change and the \"selectionchange\" event for it\n            // can cause a spurious DOM selection update, disrupting mouse\n            // drag selection.\n            if (forceSelUpdate ||\n                !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) &&\n                    anchorInRightPlace(this))) {\n                selectionToDOM(this, forceSelUpdate);\n            }\n            else {\n                syncNodeSelection(this, state.selection);\n                this.domObserver.setCurSelection();\n            }\n            this.domObserver.start();\n        }\n        this.updatePluginViews(prev);\n        if (((_a = this.dragging) === null || _a === void 0 ? void 0 : _a.node) && !prev.doc.eq(state.doc))\n            this.updateDraggedNode(this.dragging, prev);\n        if (scroll == \"reset\") {\n            this.dom.scrollTop = 0;\n        }\n        else if (scroll == \"to selection\") {\n            this.scrollToSelection();\n        }\n        else if (oldScrollPos) {\n            resetScrollPos(oldScrollPos);\n        }\n    }\n    /**\n    @internal\n    */\n    scrollToSelection() {\n        let startDOM = this.domSelectionRange().focusNode;\n        if (!startDOM || !this.dom.contains(startDOM.nodeType == 1 ? startDOM : startDOM.parentNode)) ;\n        else if (this.someProp(\"handleScrollToSelection\", f => f(this))) ;\n        else if (this.state.selection instanceof NodeSelection) {\n            let target = this.docView.domAfterPos(this.state.selection.from);\n            if (target.nodeType == 1)\n                scrollRectIntoView(this, target.getBoundingClientRect(), startDOM);\n        }\n        else {\n            scrollRectIntoView(this, this.coordsAtPos(this.state.selection.head, 1), startDOM);\n        }\n    }\n    destroyPluginViews() {\n        let view;\n        while (view = this.pluginViews.pop())\n            if (view.destroy)\n                view.destroy();\n    }\n    updatePluginViews(prevState) {\n        if (!prevState || prevState.plugins != this.state.plugins || this.directPlugins != this.prevDirectPlugins) {\n            this.prevDirectPlugins = this.directPlugins;\n            this.destroyPluginViews();\n            for (let i = 0; i < this.directPlugins.length; i++) {\n                let plugin = this.directPlugins[i];\n                if (plugin.spec.view)\n                    this.pluginViews.push(plugin.spec.view(this));\n            }\n            for (let i = 0; i < this.state.plugins.length; i++) {\n                let plugin = this.state.plugins[i];\n                if (plugin.spec.view)\n                    this.pluginViews.push(plugin.spec.view(this));\n            }\n        }\n        else {\n            for (let i = 0; i < this.pluginViews.length; i++) {\n                let pluginView = this.pluginViews[i];\n                if (pluginView.update)\n                    pluginView.update(this, prevState);\n            }\n        }\n    }\n    updateDraggedNode(dragging, prev) {\n        let sel = dragging.node, found = -1;\n        if (this.state.doc.nodeAt(sel.from) == sel.node) {\n            found = sel.from;\n        }\n        else {\n            let movedPos = sel.from + (this.state.doc.content.size - prev.doc.content.size);\n            let moved = movedPos > 0 && this.state.doc.nodeAt(movedPos);\n            if (moved == sel.node)\n                found = movedPos;\n        }\n        this.dragging = new Dragging(dragging.slice, dragging.move, found < 0 ? undefined : NodeSelection.create(this.state.doc, found));\n    }\n    someProp(propName, f) {\n        let prop = this._props && this._props[propName], value;\n        if (prop != null && (value = f ? f(prop) : prop))\n            return value;\n        for (let i = 0; i < this.directPlugins.length; i++) {\n            let prop = this.directPlugins[i].props[propName];\n            if (prop != null && (value = f ? f(prop) : prop))\n                return value;\n        }\n        let plugins = this.state.plugins;\n        if (plugins)\n            for (let i = 0; i < plugins.length; i++) {\n                let prop = plugins[i].props[propName];\n                if (prop != null && (value = f ? f(prop) : prop))\n                    return value;\n            }\n    }\n    /**\n    Query whether the view has focus.\n    */\n    hasFocus() {\n        // Work around IE not handling focus correctly if resize handles are shown.\n        // If the cursor is inside an element with resize handles, activeElement\n        // will be that element instead of this.dom.\n        if (ie) {\n            // If activeElement is within this.dom, and there are no other elements\n            // setting `contenteditable` to false in between, treat it as focused.\n            let node = this.root.activeElement;\n            if (node == this.dom)\n                return true;\n            if (!node || !this.dom.contains(node))\n                return false;\n            while (node && this.dom != node && this.dom.contains(node)) {\n                if (node.contentEditable == 'false')\n                    return false;\n                node = node.parentElement;\n            }\n            return true;\n        }\n        return this.root.activeElement == this.dom;\n    }\n    /**\n    Focus the editor.\n    */\n    focus() {\n        this.domObserver.stop();\n        if (this.editable)\n            focusPreventScroll(this.dom);\n        selectionToDOM(this);\n        this.domObserver.start();\n    }\n    /**\n    Get the document root in which the editor exists. This will\n    usually be the top-level `document`, but might be a [shadow\n    DOM](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Shadow_DOM)\n    root if the editor is inside one.\n    */\n    get root() {\n        let cached = this._root;\n        if (cached == null)\n            for (let search = this.dom.parentNode; search; search = search.parentNode) {\n                if (search.nodeType == 9 || (search.nodeType == 11 && search.host)) {\n                    if (!search.getSelection)\n                        Object.getPrototypeOf(search).getSelection = () => search.ownerDocument.getSelection();\n                    return this._root = search;\n                }\n            }\n        return cached || document;\n    }\n    /**\n    When an existing editor view is moved to a new document or\n    shadow tree, call this to make it recompute its root.\n    */\n    updateRoot() {\n        this._root = null;\n    }\n    /**\n    Given a pair of viewport coordinates, return the document\n    position that corresponds to them. May return null if the given\n    coordinates aren't inside of the editor. When an object is\n    returned, its `pos` property is the position nearest to the\n    coordinates, and its `inside` property holds the position of the\n    inner node that the position falls inside of, or -1 if it is at\n    the top level, not in any node.\n    */\n    posAtCoords(coords) {\n        return posAtCoords(this, coords);\n    }\n    /**\n    Returns the viewport rectangle at a given document position.\n    `left` and `right` will be the same number, as this returns a\n    flat cursor-ish rectangle. If the position is between two things\n    that aren't directly adjacent, `side` determines which element\n    is used. When < 0, the element before the position is used,\n    otherwise the element after.\n    */\n    coordsAtPos(pos, side = 1) {\n        return coordsAtPos(this, pos, side);\n    }\n    /**\n    Find the DOM position that corresponds to the given document\n    position. When `side` is negative, find the position as close as\n    possible to the content before the position. When positive,\n    prefer positions close to the content after the position. When\n    zero, prefer as shallow a position as possible.\n    \n    Note that you should **not** mutate the editor's internal DOM,\n    only inspect it (and even that is usually not necessary).\n    */\n    domAtPos(pos, side = 0) {\n        return this.docView.domFromPos(pos, side);\n    }\n    /**\n    Find the DOM node that represents the document node after the\n    given position. May return `null` when the position doesn't point\n    in front of a node or if the node is inside an opaque node view.\n    \n    This is intended to be able to call things like\n    `getBoundingClientRect` on that DOM node. Do **not** mutate the\n    editor DOM directly, or add styling this way, since that will be\n    immediately overriden by the editor as it redraws the node.\n    */\n    nodeDOM(pos) {\n        let desc = this.docView.descAt(pos);\n        return desc ? desc.nodeDOM : null;\n    }\n    /**\n    Find the document position that corresponds to a given DOM\n    position. (Whenever possible, it is preferable to inspect the\n    document structure directly, rather than poking around in the\n    DOM, but sometimes—for example when interpreting an event\n    target—you don't have a choice.)\n    \n    The `bias` parameter can be used to influence which side of a DOM\n    node to use when the position is inside a leaf node.\n    */\n    posAtDOM(node, offset, bias = -1) {\n        let pos = this.docView.posFromDOM(node, offset, bias);\n        if (pos == null)\n            throw new RangeError(\"DOM position not inside the editor\");\n        return pos;\n    }\n    /**\n    Find out whether the selection is at the end of a textblock when\n    moving in a given direction. When, for example, given `\"left\"`,\n    it will return true if moving left from the current cursor\n    position would leave that position's parent textblock. Will apply\n    to the view's current state by default, but it is possible to\n    pass a different state.\n    */\n    endOfTextblock(dir, state) {\n        return endOfTextblock(this, state || this.state, dir);\n    }\n    /**\n    Run the editor's paste logic with the given HTML string. The\n    `event`, if given, will be passed to the\n    [`handlePaste`](https://prosemirror.net/docs/ref/#view.EditorProps.handlePaste) hook.\n    */\n    pasteHTML(html, event) {\n        return doPaste(this, \"\", html, false, event || new ClipboardEvent(\"paste\"));\n    }\n    /**\n    Run the editor's paste logic with the given plain-text input.\n    */\n    pasteText(text, event) {\n        return doPaste(this, text, null, true, event || new ClipboardEvent(\"paste\"));\n    }\n    /**\n    Serialize the given slice as it would be if it was copied from\n    this editor. Returns a DOM element that contains a\n    representation of the slice as its children, a textual\n    representation, and the transformed slice (which can be\n    different from the given input due to hooks like\n    [`transformCopied`](https://prosemirror.net/docs/ref/#view.EditorProps.transformCopied)).\n    */\n    serializeForClipboard(slice) {\n        return serializeForClipboard(this, slice);\n    }\n    /**\n    Removes the editor from the DOM and destroys all [node\n    views](https://prosemirror.net/docs/ref/#view.NodeView).\n    */\n    destroy() {\n        if (!this.docView)\n            return;\n        destroyInput(this);\n        this.destroyPluginViews();\n        if (this.mounted) {\n            this.docView.update(this.state.doc, [], viewDecorations(this), this);\n            this.dom.textContent = \"\";\n        }\n        else if (this.dom.parentNode) {\n            this.dom.parentNode.removeChild(this.dom);\n        }\n        this.docView.destroy();\n        this.docView = null;\n        clearReusedRange();\n    }\n    /**\n    This is true when the view has been\n    [destroyed](https://prosemirror.net/docs/ref/#view.EditorView.destroy) (and thus should not be\n    used anymore).\n    */\n    get isDestroyed() {\n        return this.docView == null;\n    }\n    /**\n    Used for testing.\n    */\n    dispatchEvent(event) {\n        return dispatchEvent(this, event);\n    }\n    /**\n    Dispatch a transaction. Will call\n    [`dispatchTransaction`](https://prosemirror.net/docs/ref/#view.DirectEditorProps.dispatchTransaction)\n    when given, and otherwise defaults to applying the transaction to\n    the current state and calling\n    [`updateState`](https://prosemirror.net/docs/ref/#view.EditorView.updateState) with the result.\n    This method is bound to the view instance, so that it can be\n    easily passed around.\n    */\n    dispatch(tr) {\n        let dispatchTransaction = this._props.dispatchTransaction;\n        if (dispatchTransaction)\n            dispatchTransaction.call(this, tr);\n        else\n            this.updateState(this.state.apply(tr));\n    }\n    /**\n    @internal\n    */\n    domSelectionRange() {\n        let sel = this.domSelection();\n        if (!sel)\n            return { focusNode: null, focusOffset: 0, anchorNode: null, anchorOffset: 0 };\n        return safari && this.root.nodeType === 11 &&\n            deepActiveElement(this.dom.ownerDocument) == this.dom && safariShadowSelectionRange(this, sel) || sel;\n    }\n    /**\n    @internal\n    */\n    domSelection() {\n        return this.root.getSelection();\n    }\n}\nfunction computeDocDeco(view) {\n    let attrs = Object.create(null);\n    attrs.class = \"ProseMirror\";\n    attrs.contenteditable = String(view.editable);\n    view.someProp(\"attributes\", value => {\n        if (typeof value == \"function\")\n            value = value(view.state);\n        if (value)\n            for (let attr in value) {\n                if (attr == \"class\")\n                    attrs.class += \" \" + value[attr];\n                else if (attr == \"style\")\n                    attrs.style = (attrs.style ? attrs.style + \";\" : \"\") + value[attr];\n                else if (!attrs[attr] && attr != \"contenteditable\" && attr != \"nodeName\")\n                    attrs[attr] = String(value[attr]);\n            }\n    });\n    if (!attrs.translate)\n        attrs.translate = \"no\";\n    return [Decoration.node(0, view.state.doc.content.size, attrs)];\n}\nfunction updateCursorWrapper(view) {\n    if (view.markCursor) {\n        let dom = document.createElement(\"img\");\n        dom.className = \"ProseMirror-separator\";\n        dom.setAttribute(\"mark-placeholder\", \"true\");\n        dom.setAttribute(\"alt\", \"\");\n        view.cursorWrapper = { dom, deco: Decoration.widget(view.state.selection.from, dom, { raw: true, marks: view.markCursor }) };\n    }\n    else {\n        view.cursorWrapper = null;\n    }\n}\nfunction getEditable(view) {\n    return !view.someProp(\"editable\", value => value(view.state) === false);\n}\nfunction selectionContextChanged(sel1, sel2) {\n    let depth = Math.min(sel1.$anchor.sharedDepth(sel1.head), sel2.$anchor.sharedDepth(sel2.head));\n    return sel1.$anchor.start(depth) != sel2.$anchor.start(depth);\n}\nfunction buildNodeViews(view) {\n    let result = Object.create(null);\n    function add(obj) {\n        for (let prop in obj)\n            if (!Object.prototype.hasOwnProperty.call(result, prop))\n                result[prop] = obj[prop];\n    }\n    view.someProp(\"nodeViews\", add);\n    view.someProp(\"markViews\", add);\n    return result;\n}\nfunction changedNodeViews(a, b) {\n    let nA = 0, nB = 0;\n    for (let prop in a) {\n        if (a[prop] != b[prop])\n            return true;\n        nA++;\n    }\n    for (let _ in b)\n        nB++;\n    return nA != nB;\n}\nfunction checkStateComponent(plugin) {\n    if (plugin.spec.state || plugin.spec.filterTransaction || plugin.spec.appendTransaction)\n        throw new RangeError(\"Plugins passed directly to the view must not have a state component\");\n}\n\nexport { Decoration, DecorationSet, EditorView, __endComposition, __parseFromClipboard };\n","var __typeError = (msg) => {\n  throw TypeError(msg);\n};\nvar __accessCheck = (obj, member, msg) => member.has(obj) || __typeError(\"Cannot \" + msg);\nvar __privateGet = (obj, member, getter) => (__accessCheck(obj, member, \"read from private field\"), getter ? getter.call(obj) : member.get(obj));\nvar __privateAdd = (obj, member, value) => member.has(obj) ? __typeError(\"Cannot add the same private member more than once\") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\nvar __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, \"write to private field\"), setter ? setter.call(obj, value) : member.set(obj, value), value);\nvar _container, _ctx, _enableInspector, _status, _configureList, _onStatusChange, _container2, _clock, _usrPluginStore, _sysPluginStore, _ctx2, _loadInternal, _prepare, _cleanup, _cleanupInternal, _setStatus, _loadPluginInStore;\nimport { createSlice, createTimer, Container, Clock, Ctx } from \"@milkdown/ctx\";\nimport { Schema, DOMParser, Node } from \"@milkdown/prose/model\";\nimport remarkParse from \"remark-parse\";\nimport remarkStringify from \"remark-stringify\";\nimport { unified } from \"unified\";\nimport { callCommandBeforeEditorView, ctxCallOutOfScope, docTypeError } from \"@milkdown/exception\";\nimport { ParserState, SerializerState } from \"@milkdown/transformer\";\nimport { customInputRules } from \"@milkdown/prose\";\nimport { chainCommands, deleteSelection, joinBackward, selectNodeBackward, baseKeymap } from \"@milkdown/prose/commands\";\nimport { undoInputRule } from \"@milkdown/prose/inputrules\";\nimport { keymap } from \"@milkdown/prose/keymap\";\nimport { Plugin, PluginKey, EditorState } from \"@milkdown/prose/state\";\nimport { EditorView } from \"@milkdown/prose/view\";\nfunction withMeta(plugin, meta) {\n  plugin.meta = {\n    package: \"@milkdown/core\",\n    group: \"System\",\n    ...meta\n  };\n  return plugin;\n}\nconst remarkHandlers = {\n  strong: (node, _, state, info) => {\n    const marker = node.marker || state.options.strong || \"*\";\n    const exit = state.enter(\"strong\");\n    const tracker = state.createTracker(info);\n    let value = tracker.move(marker + marker);\n    value += tracker.move(\n      state.containerPhrasing(node, {\n        before: value,\n        after: marker,\n        ...tracker.current()\n      })\n    );\n    value += tracker.move(marker + marker);\n    exit();\n    return value;\n  },\n  emphasis: (node, _, state, info) => {\n    const marker = node.marker || state.options.emphasis || \"*\";\n    const exit = state.enter(\"emphasis\");\n    const tracker = state.createTracker(info);\n    let value = tracker.move(marker);\n    value += tracker.move(\n      state.containerPhrasing(node, {\n        before: value,\n        after: marker,\n        ...tracker.current()\n      })\n    );\n    value += tracker.move(marker);\n    exit();\n    return value;\n  }\n};\nconst editorViewCtx = createSlice({}, \"editorView\");\nconst editorStateCtx = createSlice({}, \"editorState\");\nconst initTimerCtx = createSlice([], \"initTimer\");\nconst editorCtx = createSlice({}, \"editor\");\nconst inputRulesCtx = createSlice([], \"inputRules\");\nconst prosePluginsCtx = createSlice([], \"prosePlugins\");\nconst remarkPluginsCtx = createSlice(\n  [],\n  \"remarkPlugins\"\n);\nconst nodeViewCtx = createSlice([], \"nodeView\");\nconst markViewCtx = createSlice([], \"markView\");\nconst remarkCtx = createSlice(\n  unified().use(remarkParse).use(remarkStringify),\n  \"remark\"\n);\nconst remarkStringifyOptionsCtx = createSlice(\n  {\n    handlers: remarkHandlers\n  },\n  \"remarkStringifyOptions\"\n);\nconst ConfigReady = createTimer(\"ConfigReady\");\nfunction config(configure) {\n  const plugin = (ctx) => {\n    ctx.record(ConfigReady);\n    return async () => {\n      await configure(ctx);\n      ctx.done(ConfigReady);\n      return () => {\n        ctx.clearTimer(ConfigReady);\n      };\n    };\n  };\n  withMeta(plugin, {\n    displayName: \"Config\"\n  });\n  return plugin;\n}\nconst InitReady = createTimer(\"InitReady\");\nfunction init(editor) {\n  const plugin = (ctx) => {\n    ctx.inject(editorCtx, editor).inject(prosePluginsCtx, []).inject(remarkPluginsCtx, []).inject(inputRulesCtx, []).inject(nodeViewCtx, []).inject(markViewCtx, []).inject(remarkStringifyOptionsCtx, {\n      handlers: remarkHandlers\n    }).inject(remarkCtx, unified().use(remarkParse).use(remarkStringify)).inject(initTimerCtx, [ConfigReady]).record(InitReady);\n    return async () => {\n      await ctx.waitTimers(initTimerCtx);\n      const options = ctx.get(remarkStringifyOptionsCtx);\n      ctx.set(\n        remarkCtx,\n        unified().use(remarkParse).use(remarkStringify, options)\n      );\n      ctx.done(InitReady);\n      return () => {\n        ctx.remove(editorCtx).remove(prosePluginsCtx).remove(remarkPluginsCtx).remove(inputRulesCtx).remove(nodeViewCtx).remove(markViewCtx).remove(remarkStringifyOptionsCtx).remove(remarkCtx).remove(initTimerCtx).clearTimer(InitReady);\n      };\n    };\n  };\n  withMeta(plugin, {\n    displayName: \"Init\"\n  });\n  return plugin;\n}\nconst SchemaReady = createTimer(\"SchemaReady\");\nconst schemaTimerCtx = createSlice([], \"schemaTimer\");\nconst schemaCtx = createSlice({}, \"schema\");\nconst nodesCtx = createSlice([], \"nodes\");\nconst marksCtx = createSlice([], \"marks\");\nfunction extendPriority(x) {\n  var _a;\n  return {\n    ...x,\n    parseDOM: (_a = x.parseDOM) == null ? void 0 : _a.map((rule) => ({ priority: x.priority, ...rule }))\n  };\n}\nconst schema = (ctx) => {\n  ctx.inject(schemaCtx, {}).inject(nodesCtx, []).inject(marksCtx, []).inject(schemaTimerCtx, [InitReady]).record(SchemaReady);\n  return async () => {\n    await ctx.waitTimers(schemaTimerCtx);\n    const remark = ctx.get(remarkCtx);\n    const remarkPlugins = ctx.get(remarkPluginsCtx);\n    const processor = remarkPlugins.reduce(\n      (acc, plug) => acc.use(plug.plugin, plug.options),\n      remark\n    );\n    ctx.set(remarkCtx, processor);\n    const nodes = Object.fromEntries(\n      ctx.get(nodesCtx).map(([key2, x]) => [key2, extendPriority(x)])\n    );\n    const marks = Object.fromEntries(\n      ctx.get(marksCtx).map(([key2, x]) => [key2, extendPriority(x)])\n    );\n    const schema2 = new Schema({ nodes, marks });\n    ctx.set(schemaCtx, schema2);\n    ctx.done(SchemaReady);\n    return () => {\n      ctx.remove(schemaCtx).remove(nodesCtx).remove(marksCtx).remove(schemaTimerCtx).clearTimer(SchemaReady);\n    };\n  };\n};\nwithMeta(schema, {\n  displayName: \"Schema\"\n});\nclass CommandManager {\n  constructor() {\n    __privateAdd(this, _container);\n    __privateAdd(this, _ctx);\n    __privateSet(this, _container, new Container());\n    __privateSet(this, _ctx, null);\n    this.setCtx = (ctx) => {\n      __privateSet(this, _ctx, ctx);\n    };\n  }\n  get ctx() {\n    return __privateGet(this, _ctx);\n  }\n  /// Register a command into the manager.\n  create(meta, value) {\n    const slice = meta.create(__privateGet(this, _container).sliceMap);\n    slice.set(value);\n    return slice;\n  }\n  get(slice) {\n    return __privateGet(this, _container).get(slice).get();\n  }\n  remove(slice) {\n    return __privateGet(this, _container).remove(slice);\n  }\n  call(slice, payload) {\n    if (__privateGet(this, _ctx) == null) throw callCommandBeforeEditorView();\n    const cmd = this.get(slice);\n    const command = cmd(payload);\n    const view = __privateGet(this, _ctx).get(editorViewCtx);\n    return command(view.state, view.dispatch, view);\n  }\n}\n_container = new WeakMap();\n_ctx = new WeakMap();\nfunction createCmdKey(key2 = \"cmdKey\") {\n  return createSlice(() => () => false, key2);\n}\nconst commandsCtx = createSlice(new CommandManager(), \"commands\");\nconst commandsTimerCtx = createSlice([SchemaReady], \"commandsTimer\");\nconst CommandsReady = createTimer(\"CommandsReady\");\nconst commands = (ctx) => {\n  const cmd = new CommandManager();\n  cmd.setCtx(ctx);\n  ctx.inject(commandsCtx, cmd).inject(commandsTimerCtx, [SchemaReady]).record(CommandsReady);\n  return async () => {\n    await ctx.waitTimers(commandsTimerCtx);\n    ctx.done(CommandsReady);\n    return () => {\n      ctx.remove(commandsCtx).remove(commandsTimerCtx).clearTimer(CommandsReady);\n    };\n  };\n};\nwithMeta(commands, {\n  displayName: \"Commands\"\n});\nconst ParserReady = createTimer(\"ParserReady\");\nconst outOfScope$1 = () => {\n  throw ctxCallOutOfScope();\n};\nconst parserCtx = createSlice(outOfScope$1, \"parser\");\nconst parserTimerCtx = createSlice([], \"parserTimer\");\nconst parser = (ctx) => {\n  ctx.inject(parserCtx, outOfScope$1).inject(parserTimerCtx, [SchemaReady]).record(ParserReady);\n  return async () => {\n    await ctx.waitTimers(parserTimerCtx);\n    const remark = ctx.get(remarkCtx);\n    const schema2 = ctx.get(schemaCtx);\n    ctx.set(parserCtx, ParserState.create(schema2, remark));\n    ctx.done(ParserReady);\n    return () => {\n      ctx.remove(parserCtx).remove(parserTimerCtx).clearTimer(ParserReady);\n    };\n  };\n};\nwithMeta(parser, {\n  displayName: \"Parser\"\n});\nconst SerializerReady = createTimer(\"SerializerReady\");\nconst serializerTimerCtx = createSlice(\n  [],\n  \"serializerTimer\"\n);\nconst outOfScope = () => {\n  throw ctxCallOutOfScope();\n};\nconst serializerCtx = createSlice(\n  outOfScope,\n  \"serializer\"\n);\nconst serializer = (ctx) => {\n  ctx.inject(serializerCtx, outOfScope).inject(serializerTimerCtx, [SchemaReady]).record(SerializerReady);\n  return async () => {\n    await ctx.waitTimers(serializerTimerCtx);\n    const remark = ctx.get(remarkCtx);\n    const schema2 = ctx.get(schemaCtx);\n    ctx.set(serializerCtx, SerializerState.create(schema2, remark));\n    ctx.done(SerializerReady);\n    return () => {\n      ctx.remove(serializerCtx).remove(serializerTimerCtx).clearTimer(SerializerReady);\n    };\n  };\n};\nwithMeta(serializer, {\n  displayName: \"Serializer\"\n});\nconst defaultValueCtx = createSlice(\"\", \"defaultValue\");\nconst editorStateOptionsCtx = createSlice(\n  (x) => x,\n  \"stateOptions\"\n);\nconst editorStateTimerCtx = createSlice(\n  [],\n  \"editorStateTimer\"\n);\nconst EditorStateReady = createTimer(\"EditorStateReady\");\nfunction getDoc(defaultValue, parser2, schema2) {\n  if (typeof defaultValue === \"string\") return parser2(defaultValue);\n  if (defaultValue.type === \"html\")\n    return DOMParser.fromSchema(schema2).parse(defaultValue.dom);\n  if (defaultValue.type === \"json\")\n    return Node.fromJSON(schema2, defaultValue.value);\n  throw docTypeError(defaultValue);\n}\nconst key$1 = new PluginKey(\"MILKDOWN_STATE_TRACKER\");\nfunction overrideBaseKeymap(keymap2) {\n  const handleBackspace = chainCommands(\n    undoInputRule,\n    deleteSelection,\n    joinBackward,\n    selectNodeBackward\n  );\n  keymap2.Backspace = handleBackspace;\n  return keymap2;\n}\nconst editorState = (ctx) => {\n  ctx.inject(defaultValueCtx, \"\").inject(editorStateCtx, {}).inject(editorStateOptionsCtx, (x) => x).inject(editorStateTimerCtx, [ParserReady, SerializerReady, CommandsReady]).record(EditorStateReady);\n  return async () => {\n    await ctx.waitTimers(editorStateTimerCtx);\n    const schema2 = ctx.get(schemaCtx);\n    const parser2 = ctx.get(parserCtx);\n    const rules = ctx.get(inputRulesCtx);\n    const optionsOverride = ctx.get(editorStateOptionsCtx);\n    const prosePlugins = ctx.get(prosePluginsCtx);\n    const defaultValue = ctx.get(defaultValueCtx);\n    const doc = getDoc(defaultValue, parser2, schema2);\n    const plugins = [\n      ...prosePlugins,\n      new Plugin({\n        key: key$1,\n        state: {\n          init: () => {\n          },\n          apply: (_tr, _value, _oldState, newState) => {\n            ctx.set(editorStateCtx, newState);\n          }\n        }\n      }),\n      customInputRules({ rules }),\n      keymap(overrideBaseKeymap(baseKeymap))\n    ];\n    ctx.set(prosePluginsCtx, plugins);\n    const options = optionsOverride({\n      schema: schema2,\n      doc,\n      plugins\n    });\n    const state = EditorState.create(options);\n    ctx.set(editorStateCtx, state);\n    ctx.done(EditorStateReady);\n    return () => {\n      ctx.remove(defaultValueCtx).remove(editorStateCtx).remove(editorStateOptionsCtx).remove(editorStateTimerCtx).clearTimer(EditorStateReady);\n    };\n  };\n};\nwithMeta(editorState, {\n  displayName: \"EditorState\"\n});\nconst EditorViewReady = createTimer(\"EditorViewReady\");\nconst editorViewTimerCtx = createSlice(\n  [],\n  \"editorViewTimer\"\n);\nconst editorViewOptionsCtx = createSlice(\n  {},\n  \"editorViewOptions\"\n);\nconst rootCtx = createSlice(null, \"root\");\nconst rootDOMCtx = createSlice(null, \"rootDOM\");\nconst rootAttrsCtx = createSlice(\n  {},\n  \"rootAttrs\"\n);\nfunction createViewContainer(root, ctx) {\n  const container = document.createElement(\"div\");\n  container.className = \"milkdown\";\n  root.appendChild(container);\n  ctx.set(rootDOMCtx, container);\n  const attrs = ctx.get(rootAttrsCtx);\n  Object.entries(attrs).forEach(\n    ([key2, value]) => container.setAttribute(key2, value)\n  );\n  return container;\n}\nfunction prepareViewDom(dom) {\n  dom.classList.add(\"editor\");\n  dom.setAttribute(\"role\", \"textbox\");\n}\nconst key = new PluginKey(\"MILKDOWN_VIEW_CLEAR\");\nconst editorView = (ctx) => {\n  ctx.inject(rootCtx, document.body).inject(editorViewCtx, {}).inject(editorViewOptionsCtx, {}).inject(rootDOMCtx, null).inject(rootAttrsCtx, {}).inject(editorViewTimerCtx, [EditorStateReady]).record(EditorViewReady);\n  return async () => {\n    await ctx.wait(InitReady);\n    const root = ctx.get(rootCtx) || document.body;\n    const el = typeof root === \"string\" ? document.querySelector(root) : root;\n    ctx.update(prosePluginsCtx, (xs) => [\n      new Plugin({\n        key,\n        view: (editorView2) => {\n          const container = el ? createViewContainer(el, ctx) : void 0;\n          const handleDOM = () => {\n            if (container && el) {\n              const editor = editorView2.dom;\n              el.replaceChild(container, editor);\n              container.appendChild(editor);\n            }\n          };\n          handleDOM();\n          return {\n            destroy: () => {\n              if (container == null ? void 0 : container.parentNode)\n                container == null ? void 0 : container.parentNode.replaceChild(editorView2.dom, container);\n              container == null ? void 0 : container.remove();\n            }\n          };\n        }\n      }),\n      ...xs\n    ]);\n    await ctx.waitTimers(editorViewTimerCtx);\n    const state = ctx.get(editorStateCtx);\n    const options = ctx.get(editorViewOptionsCtx);\n    const nodeViews = Object.fromEntries(ctx.get(nodeViewCtx));\n    const markViews = Object.fromEntries(ctx.get(markViewCtx));\n    const view = new EditorView(el, {\n      state,\n      nodeViews,\n      markViews,\n      ...options\n    });\n    prepareViewDom(view.dom);\n    ctx.set(editorViewCtx, view);\n    ctx.done(EditorViewReady);\n    return () => {\n      view == null ? void 0 : view.destroy();\n      ctx.remove(rootCtx).remove(editorViewCtx).remove(editorViewOptionsCtx).remove(rootDOMCtx).remove(rootAttrsCtx).remove(editorViewTimerCtx).clearTimer(EditorViewReady);\n    };\n  };\n};\nwithMeta(editorView, {\n  displayName: \"EditorView\"\n});\nvar EditorStatus = /* @__PURE__ */ ((EditorStatus2) => {\n  EditorStatus2[\"Idle\"] = \"Idle\";\n  EditorStatus2[\"OnCreate\"] = \"OnCreate\";\n  EditorStatus2[\"Created\"] = \"Created\";\n  EditorStatus2[\"OnDestroy\"] = \"OnDestroy\";\n  EditorStatus2[\"Destroyed\"] = \"Destroyed\";\n  return EditorStatus2;\n})(EditorStatus || {});\nconst _Editor = class _Editor {\n  constructor() {\n    __privateAdd(this, _enableInspector);\n    __privateAdd(this, _status);\n    __privateAdd(this, _configureList);\n    __privateAdd(this, _onStatusChange);\n    __privateAdd(this, _container2);\n    __privateAdd(this, _clock);\n    __privateAdd(this, _usrPluginStore);\n    __privateAdd(this, _sysPluginStore);\n    __privateAdd(this, _ctx2);\n    __privateAdd(this, _loadInternal);\n    __privateAdd(this, _prepare);\n    __privateAdd(this, _cleanup);\n    __privateAdd(this, _cleanupInternal);\n    __privateAdd(this, _setStatus);\n    __privateAdd(this, _loadPluginInStore);\n    __privateSet(this, _enableInspector, false);\n    __privateSet(this, _status, \"Idle\");\n    __privateSet(this, _configureList, []);\n    __privateSet(this, _onStatusChange, () => void 0);\n    __privateSet(this, _container2, new Container());\n    __privateSet(this, _clock, new Clock());\n    __privateSet(this, _usrPluginStore, /* @__PURE__ */ new Map());\n    __privateSet(this, _sysPluginStore, /* @__PURE__ */ new Map());\n    __privateSet(this, _ctx2, new Ctx(__privateGet(this, _container2), __privateGet(this, _clock)));\n    __privateSet(this, _loadInternal, () => {\n      const configPlugin = config(async (ctx) => {\n        await Promise.all(__privateGet(this, _configureList).map((fn) => fn(ctx)));\n      });\n      const internalPlugins = [\n        schema,\n        parser,\n        serializer,\n        commands,\n        editorState,\n        editorView,\n        init(this),\n        configPlugin\n      ];\n      __privateGet(this, _prepare).call(this, internalPlugins, __privateGet(this, _sysPluginStore));\n    });\n    __privateSet(this, _prepare, (plugins, store) => {\n      plugins.forEach((plugin) => {\n        const ctx = __privateGet(this, _ctx2).produce(\n          __privateGet(this, _enableInspector) ? plugin.meta : void 0\n        );\n        const handler = plugin(ctx);\n        store.set(plugin, { ctx, handler, cleanup: void 0 });\n      });\n    });\n    __privateSet(this, _cleanup, (plugins, remove = false) => {\n      return Promise.all(\n        [plugins].flat().map((plugin) => {\n          const loader = __privateGet(this, _usrPluginStore).get(plugin);\n          const cleanup = loader == null ? void 0 : loader.cleanup;\n          if (remove) __privateGet(this, _usrPluginStore).delete(plugin);\n          else\n            __privateGet(this, _usrPluginStore).set(plugin, {\n              ctx: void 0,\n              handler: void 0,\n              cleanup: void 0\n            });\n          if (typeof cleanup === \"function\") return cleanup();\n          return cleanup;\n        })\n      );\n    });\n    __privateSet(this, _cleanupInternal, async () => {\n      await Promise.all(\n        [...__privateGet(this, _sysPluginStore).entries()].map(([_, { cleanup }]) => {\n          if (typeof cleanup === \"function\") return cleanup();\n          return cleanup;\n        })\n      );\n      __privateGet(this, _sysPluginStore).clear();\n    });\n    __privateSet(this, _setStatus, (status) => {\n      __privateSet(this, _status, status);\n      __privateGet(this, _onStatusChange).call(this, status);\n    });\n    __privateSet(this, _loadPluginInStore, (store) => {\n      return [...store.entries()].map(async ([key2, loader]) => {\n        const { ctx, handler } = loader;\n        if (!handler) return;\n        const cleanup = await handler();\n        store.set(key2, { ctx, handler, cleanup });\n      });\n    });\n    this.enableInspector = (enable = true) => {\n      __privateSet(this, _enableInspector, enable);\n      return this;\n    };\n    this.onStatusChange = (onChange) => {\n      __privateSet(this, _onStatusChange, onChange);\n      return this;\n    };\n    this.config = (configure) => {\n      __privateGet(this, _configureList).push(configure);\n      return this;\n    };\n    this.removeConfig = (configure) => {\n      __privateSet(this, _configureList, __privateGet(this, _configureList).filter((x) => x !== configure));\n      return this;\n    };\n    this.use = (plugins) => {\n      const _plugins = [plugins].flat();\n      _plugins.flat().forEach((plugin) => {\n        __privateGet(this, _usrPluginStore).set(plugin, {\n          ctx: void 0,\n          handler: void 0,\n          cleanup: void 0\n        });\n      });\n      if (__privateGet(this, _status) === \"Created\")\n        __privateGet(this, _prepare).call(this, _plugins, __privateGet(this, _usrPluginStore));\n      return this;\n    };\n    this.remove = async (plugins) => {\n      if (__privateGet(this, _status) === \"OnCreate\") {\n        console.warn(\n          \"[Milkdown]: You are trying to remove plugins when the editor is creating, this is not recommended, please check your code.\"\n        );\n        return new Promise((resolve) => {\n          setTimeout(() => {\n            resolve(this.remove(plugins));\n          }, 50);\n        });\n      }\n      await __privateGet(this, _cleanup).call(this, [plugins].flat(), true);\n      return this;\n    };\n    this.create = async () => {\n      if (__privateGet(this, _status) === \"OnCreate\") return this;\n      if (__privateGet(this, _status) === \"Created\") await this.destroy();\n      __privateGet(this, _setStatus).call(this, \"OnCreate\");\n      __privateGet(this, _loadInternal).call(this);\n      __privateGet(this, _prepare).call(this, [...__privateGet(this, _usrPluginStore).keys()], __privateGet(this, _usrPluginStore));\n      await Promise.all(\n        [\n          __privateGet(this, _loadPluginInStore).call(this, __privateGet(this, _sysPluginStore)),\n          __privateGet(this, _loadPluginInStore).call(this, __privateGet(this, _usrPluginStore))\n        ].flat()\n      );\n      __privateGet(this, _setStatus).call(this, \"Created\");\n      return this;\n    };\n    this.destroy = async (clearPlugins = false) => {\n      if (__privateGet(this, _status) === \"Destroyed\" || __privateGet(this, _status) === \"OnDestroy\")\n        return this;\n      if (__privateGet(this, _status) === \"OnCreate\") {\n        return new Promise((resolve) => {\n          setTimeout(() => {\n            resolve(this.destroy(clearPlugins));\n          }, 50);\n        });\n      }\n      if (clearPlugins) __privateSet(this, _configureList, []);\n      __privateGet(this, _setStatus).call(this, \"OnDestroy\");\n      await __privateGet(this, _cleanup).call(this, [...__privateGet(this, _usrPluginStore).keys()], clearPlugins);\n      await __privateGet(this, _cleanupInternal).call(this);\n      __privateGet(this, _setStatus).call(this, \"Destroyed\");\n      return this;\n    };\n    this.action = (action) => action(__privateGet(this, _ctx2));\n    this.inspect = () => {\n      if (!__privateGet(this, _enableInspector)) {\n        console.warn(\n          \"[Milkdown]: You are trying to collect inspection when inspector is disabled, please enable inspector by `editor.enableInspector()` first.\"\n        );\n        return [];\n      }\n      return [...__privateGet(this, _sysPluginStore).values(), ...__privateGet(this, _usrPluginStore).values()].map(({ ctx }) => {\n        var _a;\n        return (_a = ctx == null ? void 0 : ctx.inspector) == null ? void 0 : _a.read();\n      }).filter((x) => Boolean(x));\n    };\n  }\n  /// Create a new editor instance.\n  static make() {\n    return new _Editor();\n  }\n  /// Get the ctx of the editor.\n  get ctx() {\n    return __privateGet(this, _ctx2);\n  }\n  /// Get the status of the editor.\n  get status() {\n    return __privateGet(this, _status);\n  }\n};\n_enableInspector = new WeakMap();\n_status = new WeakMap();\n_configureList = new WeakMap();\n_onStatusChange = new WeakMap();\n_container2 = new WeakMap();\n_clock = new WeakMap();\n_usrPluginStore = new WeakMap();\n_sysPluginStore = new WeakMap();\n_ctx2 = new WeakMap();\n_loadInternal = new WeakMap();\n_prepare = new WeakMap();\n_cleanup = new WeakMap();\n_cleanupInternal = new WeakMap();\n_setStatus = new WeakMap();\n_loadPluginInStore = new WeakMap();\nlet Editor = _Editor;\nexport {\n  CommandManager,\n  CommandsReady,\n  ConfigReady,\n  Editor,\n  EditorStateReady,\n  EditorStatus,\n  EditorViewReady,\n  InitReady,\n  ParserReady,\n  SchemaReady,\n  SerializerReady,\n  commands,\n  commandsCtx,\n  commandsTimerCtx,\n  config,\n  createCmdKey,\n  defaultValueCtx,\n  editorCtx,\n  editorState,\n  editorStateCtx,\n  editorStateOptionsCtx,\n  editorStateTimerCtx,\n  editorView,\n  editorViewCtx,\n  editorViewOptionsCtx,\n  editorViewTimerCtx,\n  getDoc,\n  init,\n  initTimerCtx,\n  inputRulesCtx,\n  markViewCtx,\n  marksCtx,\n  nodeViewCtx,\n  nodesCtx,\n  parser,\n  parserCtx,\n  parserTimerCtx,\n  prosePluginsCtx,\n  remarkCtx,\n  remarkPluginsCtx,\n  remarkStringifyOptionsCtx,\n  rootAttrsCtx,\n  rootCtx,\n  rootDOMCtx,\n  schema,\n  schemaCtx,\n  schemaTimerCtx,\n  serializer,\n  serializerCtx,\n  serializerTimerCtx\n};\n//# sourceMappingURL=index.es.js.map\n","import { inject, ref, onMounted, onUnmounted, defineComponent, createVNode, provide, Fragment } from \"vue\";\nconst editorInfoCtxKey = Symbol(\"editorInfoCtxKey\");\nfunction useGetEditor() {\n  const {\n    dom,\n    loading,\n    editor: editorRef,\n    editorFactory: getEditor\n  } = inject(editorInfoCtxKey, {});\n  const currentEditorRef = ref();\n  onMounted(() => {\n    if (!dom.value) return;\n    const editor = getEditor.value(dom.value);\n    if (!editor) return;\n    loading.value = true;\n    currentEditorRef.value = editor;\n    editor.create().then((editor2) => {\n      editorRef.value = editor2;\n    }).finally(() => {\n      loading.value = false;\n    }).catch(console.error);\n  });\n  onUnmounted(() => {\n    var _a;\n    (_a = currentEditorRef.value) == null ? void 0 : _a.destroy();\n  });\n  return dom;\n}\nconst Milkdown = /* @__PURE__ */ defineComponent({\n  name: \"Milkdown\",\n  setup: () => {\n    const domRef = useGetEditor();\n    return () => createVNode(\"div\", {\n      \"data-milkdown-root\": true,\n      \"ref\": domRef\n    }, null);\n  }\n});\nconst MilkdownProvider = /* @__PURE__ */ defineComponent({\n  name: \"MilkdownProvider\",\n  setup: (_, {\n    slots\n  }) => {\n    const dom = ref(null);\n    const editorFactory = ref(void 0);\n    const editor = ref(void 0);\n    const loading = ref(true);\n    provide(editorInfoCtxKey, {\n      loading,\n      dom,\n      editor,\n      editorFactory\n    });\n    return () => {\n      var _a;\n      return createVNode(Fragment, null, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);\n    };\n  }\n});\nfunction useEditor(getEditor) {\n  const { editorFactory, loading, editor } = inject(editorInfoCtxKey);\n  editorFactory.value = getEditor;\n  return {\n    loading,\n    get: () => editor.value\n  };\n}\nfunction useInstance() {\n  const editorInfo = inject(editorInfoCtxKey);\n  return [editorInfo.loading, () => editorInfo.editor.value];\n}\nexport {\n  Milkdown,\n  MilkdownProvider,\n  useEditor,\n  useInstance\n};\n//# sourceMappingURL=index.es.js.map\n","import { createCmdKey, commandsTimerCtx, CommandsReady, commandsCtx, editorStateTimerCtx, SchemaReady, inputRulesCtx, schemaCtx, schemaTimerCtx, marksCtx, nodesCtx, prosePluginsCtx, editorViewTimerCtx, nodeViewCtx, markViewCtx, InitReady, remarkPluginsCtx, editorViewCtx, serializerCtx, parserCtx, editorStateOptionsCtx } from \"@milkdown/core\";\nimport { createTimer, createSlice } from \"@milkdown/ctx\";\nimport { customAlphabet } from \"nanoid\";\nimport { missingMarkInSchema, missingNodeInSchema } from \"@milkdown/exception\";\nimport { keymap } from \"@milkdown/prose/keymap\";\nimport { NodeType, DOMSerializer, Slice } from \"@milkdown/prose/model\";\nimport { EditorState } from \"@milkdown/prose/state\";\nconst nanoid = customAlphabet(\"abcedfghicklmn\", 10);\nfunction addTimer(runner, injectTo, timerName) {\n  const timer = createTimer(timerName || nanoid());\n  let doneCalled = false;\n  const plugin = (ctx) => {\n    ctx.record(timer);\n    ctx.update(injectTo, (x) => x.concat(timer));\n    return async () => {\n      const done = () => {\n        ctx.done(timer);\n        doneCalled = true;\n      };\n      const cleanup = await runner(ctx, plugin, done);\n      if (!doneCalled) ctx.done(timer);\n      return () => {\n        ctx.update(injectTo, (x) => x.filter((y) => y !== timer));\n        ctx.clearTimer(timer);\n        cleanup == null ? void 0 : cleanup();\n      };\n    };\n  };\n  plugin.timer = timer;\n  return plugin;\n}\nfunction $command(key, cmd) {\n  const cmdKey = createCmdKey(key);\n  const plugin = (ctx) => async () => {\n    plugin.key = cmdKey;\n    await ctx.wait(CommandsReady);\n    const command = cmd(ctx);\n    ctx.get(commandsCtx).create(cmdKey, command);\n    plugin.run = (payload) => ctx.get(commandsCtx).call(key, payload);\n    return () => {\n      ctx.get(commandsCtx).remove(cmdKey);\n    };\n  };\n  return plugin;\n}\nfunction $commandAsync(key, cmd, timerName) {\n  const cmdKey = createCmdKey(key);\n  return addTimer(\n    async (ctx, plugin) => {\n      await ctx.wait(CommandsReady);\n      const command = await cmd(ctx);\n      ctx.get(commandsCtx).create(cmdKey, command);\n      plugin.run = (payload) => ctx.get(commandsCtx).call(key, payload);\n      plugin.key = cmdKey;\n      return () => {\n        ctx.get(commandsCtx).remove(cmdKey);\n      };\n    },\n    commandsTimerCtx,\n    timerName\n  );\n}\nfunction $inputRule(inputRule) {\n  const plugin = (ctx) => async () => {\n    await ctx.wait(SchemaReady);\n    const ir = inputRule(ctx);\n    ctx.update(inputRulesCtx, (irs) => [...irs, ir]);\n    plugin.inputRule = ir;\n    return () => {\n      ctx.update(inputRulesCtx, (irs) => irs.filter((x) => x !== ir));\n    };\n  };\n  return plugin;\n}\nfunction $inputRuleAsync(inputRule, timerName) {\n  return addTimer(\n    async (ctx, plugin) => {\n      await ctx.wait(SchemaReady);\n      const ir = await inputRule(ctx);\n      ctx.update(inputRulesCtx, (irs) => [...irs, ir]);\n      plugin.inputRule = ir;\n      return () => {\n        ctx.update(inputRulesCtx, (irs) => irs.filter((x) => x !== ir));\n      };\n    },\n    editorStateTimerCtx,\n    timerName\n  );\n}\nfunction $mark(id, schema) {\n  const plugin = (ctx) => async () => {\n    const markSchema = schema(ctx);\n    ctx.update(marksCtx, (ns) => [\n      ...ns.filter((n) => n[0] !== id),\n      [id, markSchema]\n    ]);\n    plugin.id = id;\n    plugin.schema = markSchema;\n    return () => {\n      ctx.update(marksCtx, (ns) => ns.filter(([x]) => x !== id));\n    };\n  };\n  plugin.type = (ctx) => {\n    const markType = ctx.get(schemaCtx).marks[id];\n    if (!markType) throw missingMarkInSchema(id);\n    return markType;\n  };\n  return plugin;\n}\nfunction $markAsync(id, schema, timerName) {\n  const plugin = addTimer(\n    async (ctx, plugin2, done) => {\n      const markSchema = await schema(ctx);\n      ctx.update(marksCtx, (ns) => [\n        ...ns.filter((n) => n[0] !== id),\n        [id, markSchema]\n      ]);\n      plugin2.id = id;\n      plugin2.schema = markSchema;\n      done();\n      return () => {\n        ctx.update(marksCtx, (ns) => ns.filter(([x]) => x !== id));\n      };\n    },\n    schemaTimerCtx,\n    timerName\n  );\n  plugin.type = (ctx) => {\n    const markType = ctx.get(schemaCtx).marks[id];\n    if (!markType) throw missingMarkInSchema(id);\n    return markType;\n  };\n  return plugin;\n}\nfunction $node(id, schema) {\n  const plugin = (ctx) => async () => {\n    const nodeSchema = schema(ctx);\n    ctx.update(nodesCtx, (ns) => [\n      ...ns.filter((n) => n[0] !== id),\n      [id, nodeSchema]\n    ]);\n    plugin.id = id;\n    plugin.schema = nodeSchema;\n    return () => {\n      ctx.update(nodesCtx, (ns) => ns.filter(([x]) => x !== id));\n    };\n  };\n  plugin.type = (ctx) => {\n    const nodeType = ctx.get(schemaCtx).nodes[id];\n    if (!nodeType) throw missingNodeInSchema(id);\n    return nodeType;\n  };\n  return plugin;\n}\nfunction $nodeAsync(id, schema, timerName) {\n  const plugin = addTimer(\n    async (ctx, plugin2, done) => {\n      const nodeSchema = await schema(ctx);\n      ctx.update(nodesCtx, (ns) => [\n        ...ns.filter((n) => n[0] !== id),\n        [id, nodeSchema]\n      ]);\n      plugin2.id = id;\n      plugin2.schema = nodeSchema;\n      done();\n      return () => {\n        ctx.update(nodesCtx, (ns) => ns.filter(([x]) => x !== id));\n      };\n    },\n    schemaTimerCtx,\n    timerName\n  );\n  plugin.type = (ctx) => {\n    const nodeType = ctx.get(schemaCtx).nodes[id];\n    if (!nodeType) throw missingNodeInSchema(id);\n    return nodeType;\n  };\n  return plugin;\n}\nfunction $prose(prose) {\n  let prosePlugin;\n  const plugin = (ctx) => async () => {\n    await ctx.wait(SchemaReady);\n    prosePlugin = prose(ctx);\n    ctx.update(prosePluginsCtx, (ps) => [...ps, prosePlugin]);\n    return () => {\n      ctx.update(prosePluginsCtx, (ps) => ps.filter((x) => x !== prosePlugin));\n    };\n  };\n  plugin.plugin = () => prosePlugin;\n  plugin.key = () => prosePlugin.spec.key;\n  return plugin;\n}\nfunction $proseAsync(prose, timerName) {\n  let prosePlugin;\n  const plugin = addTimer(\n    async (ctx) => {\n      await ctx.wait(SchemaReady);\n      prosePlugin = await prose(ctx);\n      ctx.update(prosePluginsCtx, (ps) => [...ps, prosePlugin]);\n      return () => {\n        ctx.update(prosePluginsCtx, (ps) => ps.filter((x) => x !== prosePlugin));\n      };\n    },\n    editorStateTimerCtx,\n    timerName\n  );\n  plugin.plugin = () => prosePlugin;\n  plugin.key = () => prosePlugin.spec.key;\n  return plugin;\n}\nfunction $shortcut(shortcut) {\n  const plugin = (ctx) => async () => {\n    await ctx.wait(SchemaReady);\n    const k = shortcut(ctx);\n    const keymapPlugin = keymap(k);\n    ctx.update(prosePluginsCtx, (ps) => [...ps, keymapPlugin]);\n    plugin.keymap = k;\n    return () => {\n      ctx.update(prosePluginsCtx, (ps) => ps.filter((x) => x !== keymapPlugin));\n    };\n  };\n  return plugin;\n}\nfunction $shortcutAsync(shortcut, timerName) {\n  return addTimer(\n    async (ctx, plugin) => {\n      await ctx.wait(SchemaReady);\n      const k = await shortcut(ctx);\n      const keymapPlugin = keymap(k);\n      ctx.update(prosePluginsCtx, (ps) => [...ps, keymapPlugin]);\n      plugin.keymap = k;\n      return () => {\n        ctx.update(\n          prosePluginsCtx,\n          (ps) => ps.filter((x) => x !== keymapPlugin)\n        );\n      };\n    },\n    editorStateTimerCtx,\n    timerName\n  );\n}\nfunction $view(type, view) {\n  const plugin = (ctx) => async () => {\n    await ctx.wait(SchemaReady);\n    const v = view(ctx);\n    if (type.type(ctx) instanceof NodeType)\n      ctx.update(nodeViewCtx, (ps) => [\n        ...ps,\n        [type.id, v]\n      ]);\n    else\n      ctx.update(markViewCtx, (ps) => [\n        ...ps,\n        [type.id, v]\n      ]);\n    plugin.view = v;\n    plugin.type = type;\n    return () => {\n      if (type.type(ctx) instanceof NodeType)\n        ctx.update(nodeViewCtx, (ps) => ps.filter((x) => x[0] !== type.id));\n      else ctx.update(markViewCtx, (ps) => ps.filter((x) => x[0] !== type.id));\n    };\n  };\n  return plugin;\n}\nfunction $viewAsync(type, view, timerName) {\n  return addTimer(\n    async (ctx, plugin) => {\n      await ctx.wait(SchemaReady);\n      const v = await view(ctx);\n      if (type.type(ctx) instanceof NodeType)\n        ctx.update(nodeViewCtx, (ps) => [\n          ...ps,\n          [type.id, v]\n        ]);\n      else\n        ctx.update(markViewCtx, (ps) => [\n          ...ps,\n          [type.id, v]\n        ]);\n      plugin.view = v;\n      plugin.type = type;\n      return () => {\n        if (type.type(ctx) instanceof NodeType)\n          ctx.update(nodeViewCtx, (ps) => ps.filter((x) => x[0] !== type.id));\n        else ctx.update(markViewCtx, (ps) => ps.filter((x) => x[0] !== type.id));\n      };\n    },\n    editorViewTimerCtx,\n    timerName\n  );\n}\nfunction $ctx(value, name) {\n  const slice = createSlice(value, name);\n  const plugin = (ctx) => {\n    ctx.inject(slice);\n    return () => {\n      return () => {\n        ctx.remove(slice);\n      };\n    };\n  };\n  plugin.key = slice;\n  return plugin;\n}\nfunction $nodeSchema(id, schema) {\n  const schemaCtx2 = $ctx(schema, id);\n  const nodeSchema = $node(id, (ctx) => {\n    const userSchema = ctx.get(schemaCtx2.key);\n    return userSchema(ctx);\n  });\n  const result = [schemaCtx2, nodeSchema];\n  result.id = nodeSchema.id;\n  result.node = nodeSchema;\n  result.type = (ctx) => nodeSchema.type(ctx);\n  result.schema = nodeSchema.schema;\n  result.ctx = schemaCtx2;\n  result.key = schemaCtx2.key;\n  result.extendSchema = (handler) => {\n    return (ctx) => () => {\n      const prev = ctx.get(schemaCtx2.key);\n      const next = handler(prev);\n      const nodeSchema2 = next(ctx);\n      ctx.update(nodesCtx, (ns) => [\n        ...ns.filter((n) => n[0] !== id),\n        [id, nodeSchema2]\n      ]);\n      result.schema = nodeSchema2;\n    };\n  };\n  return result;\n}\nfunction $markSchema(id, schema) {\n  const schemaCtx2 = $ctx(schema, id);\n  const markSchema = $mark(id, (ctx) => {\n    const userSchema = ctx.get(schemaCtx2.key);\n    return userSchema(ctx);\n  });\n  const result = [schemaCtx2, markSchema];\n  result.id = markSchema.id;\n  result.mark = markSchema;\n  result.type = markSchema.type;\n  result.schema = markSchema.schema;\n  result.ctx = schemaCtx2;\n  result.key = schemaCtx2.key;\n  result.extendSchema = (handler) => {\n    return (ctx) => () => {\n      const prev = ctx.get(schemaCtx2.key);\n      const next = handler(prev);\n      const markSchema2 = next(ctx);\n      ctx.update(marksCtx, (ms) => [\n        ...ms.filter((m) => m[0] !== id),\n        [id, markSchema2]\n      ]);\n      result.schema = markSchema2;\n    };\n  };\n  return result;\n}\nfunction $useKeymap(name, userKeymap) {\n  const key = Object.fromEntries(\n    Object.entries(userKeymap).map(([key2, { shortcuts: shortcuts2 }]) => {\n      return [key2, shortcuts2];\n    })\n  );\n  const keymapDef = $ctx(key, `${name}Keymap`);\n  const shortcuts = $shortcut((ctx) => {\n    const keys = ctx.get(keymapDef.key);\n    const keymapTuple = Object.entries(userKeymap).flatMap(\n      ([key2, { command }]) => {\n        const targetKeys = [keys[key2]].flat();\n        return targetKeys.map((targetKey) => [targetKey, command(ctx)]);\n      }\n    );\n    return Object.fromEntries(keymapTuple);\n  });\n  const result = [keymapDef, shortcuts];\n  result.ctx = keymapDef;\n  result.shortcuts = shortcuts;\n  result.key = keymapDef.key;\n  result.keymap = shortcuts.keymap;\n  return result;\n}\nconst $nodeAttr = (name, value = () => ({})) => $ctx(value, `${name}Attr`);\nconst $markAttr = (name, value = () => ({})) => $ctx(value, `${name}Attr`);\nfunction $remark(id, remark, initialOptions) {\n  const options = $ctx(initialOptions ?? {}, id);\n  const plugin = (ctx) => async () => {\n    await ctx.wait(InitReady);\n    const re = remark(ctx);\n    const remarkPlugin = {\n      plugin: re,\n      options: ctx.get(options.key)\n    };\n    ctx.update(remarkPluginsCtx, (rp) => [...rp, remarkPlugin]);\n    return () => {\n      ctx.update(remarkPluginsCtx, (rp) => rp.filter((x) => x !== remarkPlugin));\n    };\n  };\n  const result = [options, plugin];\n  result.id = id;\n  result.plugin = plugin;\n  result.options = options;\n  return result;\n}\nfunction callCommand(slice, payload) {\n  return (ctx) => {\n    return ctx.get(commandsCtx).call(slice, payload);\n  };\n}\nfunction forceUpdate() {\n  return (ctx) => {\n    const view = ctx.get(editorViewCtx);\n    const { tr } = view.state;\n    const nextTr = Object.assign(Object.create(tr), tr).setTime(Date.now());\n    return view.dispatch(nextTr);\n  };\n}\nfunction getHTML() {\n  return (ctx) => {\n    const div = document.createElement(\"div\");\n    const schema = ctx.get(schemaCtx);\n    const view = ctx.get(editorViewCtx);\n    const fragment = DOMSerializer.fromSchema(schema).serializeFragment(\n      view.state.doc.content\n    );\n    div.appendChild(fragment);\n    return div.innerHTML;\n  };\n}\nfunction getMarkdown() {\n  return (ctx) => {\n    const view = ctx.get(editorViewCtx);\n    const serializer = ctx.get(serializerCtx);\n    return serializer(view.state.doc);\n  };\n}\nfunction insert(markdown) {\n  return (ctx) => {\n    const view = ctx.get(editorViewCtx);\n    const parser = ctx.get(parserCtx);\n    const doc = parser(markdown);\n    if (!doc) return;\n    const contentSlice = view.state.selection.content();\n    return view.dispatch(\n      view.state.tr.replaceSelection(\n        new Slice(doc.content, contentSlice.openStart, contentSlice.openEnd)\n      ).scrollIntoView()\n    );\n  };\n}\nfunction outline() {\n  return (ctx) => {\n    const view = ctx.get(editorViewCtx);\n    const data = [];\n    const doc = view.state.doc;\n    doc.descendants((node) => {\n      if (node.type.name === \"heading\" && node.attrs.level)\n        data.push({\n          text: node.textContent,\n          level: node.attrs.level,\n          id: node.attrs.id\n        });\n    });\n    return data;\n  };\n}\nfunction replaceAll(markdown, flush = false) {\n  return (ctx) => {\n    const view = ctx.get(editorViewCtx);\n    const parser = ctx.get(parserCtx);\n    const doc = parser(markdown);\n    if (!doc) return;\n    if (!flush) {\n      const { state: state2 } = view;\n      return view.dispatch(\n        state2.tr.replace(\n          0,\n          state2.doc.content.size,\n          new Slice(doc.content, 0, 0)\n        )\n      );\n    }\n    const schema = ctx.get(schemaCtx);\n    const options = ctx.get(editorStateOptionsCtx);\n    const plugins = ctx.get(prosePluginsCtx);\n    const state = EditorState.create({\n      schema,\n      doc,\n      plugins,\n      ...options\n    });\n    view.updateState(state);\n  };\n}\nfunction setAttr(pos, update) {\n  return (ctx) => {\n    const view = ctx.get(editorViewCtx);\n    const { tr } = view.state;\n    const node = tr.doc.nodeAt(pos);\n    if (!node) return;\n    const nextAttr = update(node.attrs);\n    return view.dispatch(tr.setNodeMarkup(pos, void 0, nextAttr));\n  };\n}\nconst pipe = (...funcs) => {\n  const length = funcs.length;\n  let index = length;\n  while (index--) {\n    if (typeof funcs[index] !== \"function\")\n      throw new TypeError(\"Expected a function\");\n  }\n  return (...args) => {\n    let index2 = 0;\n    let result = length ? funcs[index2](...args) : args[0];\n    while (++index2 < length) result = funcs[index2](result);\n    return result;\n  };\n};\nexport {\n  $command,\n  $commandAsync,\n  $ctx,\n  $inputRule,\n  $inputRuleAsync,\n  $mark,\n  $markAsync,\n  $markAttr,\n  $markSchema,\n  $node,\n  $nodeAsync,\n  $nodeAttr,\n  $nodeSchema,\n  $prose,\n  $proseAsync,\n  $remark,\n  $shortcut,\n  $shortcutAsync,\n  $useKeymap,\n  $view,\n  $viewAsync,\n  addTimer,\n  callCommand,\n  forceUpdate,\n  getHTML,\n  getMarkdown,\n  insert,\n  nanoid,\n  outline,\n  pipe,\n  replaceAll,\n  setAttr\n};\n//# sourceMappingURL=index.es.js.map\n","import { findWrapping, ReplaceAroundStep, canSplit, liftTarget, canJoin } from 'prosemirror-transform';\nimport { NodeRange, Fragment, Slice } from 'prosemirror-model';\nimport { Selection } from 'prosemirror-state';\n\nconst olDOM = [\"ol\", 0], ulDOM = [\"ul\", 0], liDOM = [\"li\", 0];\n/**\nAn ordered list [node spec](https://prosemirror.net/docs/ref/#model.NodeSpec). Has a single\nattribute, `order`, which determines the number at which the list\nstarts counting, and defaults to 1. Represented as an `<ol>`\nelement.\n*/\nconst orderedList = {\n    attrs: { order: { default: 1, validate: \"number\" } },\n    parseDOM: [{ tag: \"ol\", getAttrs(dom) {\n                return { order: dom.hasAttribute(\"start\") ? +dom.getAttribute(\"start\") : 1 };\n            } }],\n    toDOM(node) {\n        return node.attrs.order == 1 ? olDOM : [\"ol\", { start: node.attrs.order }, 0];\n    }\n};\n/**\nA bullet list node spec, represented in the DOM as `<ul>`.\n*/\nconst bulletList = {\n    parseDOM: [{ tag: \"ul\" }],\n    toDOM() { return ulDOM; }\n};\n/**\nA list item (`<li>`) spec.\n*/\nconst listItem = {\n    parseDOM: [{ tag: \"li\" }],\n    toDOM() { return liDOM; },\n    defining: true\n};\nfunction add(obj, props) {\n    let copy = {};\n    for (let prop in obj)\n        copy[prop] = obj[prop];\n    for (let prop in props)\n        copy[prop] = props[prop];\n    return copy;\n}\n/**\nConvenience function for adding list-related node types to a map\nspecifying the nodes for a schema. Adds\n[`orderedList`](https://prosemirror.net/docs/ref/#schema-list.orderedList) as `\"ordered_list\"`,\n[`bulletList`](https://prosemirror.net/docs/ref/#schema-list.bulletList) as `\"bullet_list\"`, and\n[`listItem`](https://prosemirror.net/docs/ref/#schema-list.listItem) as `\"list_item\"`.\n\n`itemContent` determines the content expression for the list items.\nIf you want the commands defined in this module to apply to your\nlist structure, it should have a shape like `\"paragraph block*\"` or\n`\"paragraph (ordered_list | bullet_list)*\"`. `listGroup` can be\ngiven to assign a group name to the list node types, for example\n`\"block\"`.\n*/\nfunction addListNodes(nodes, itemContent, listGroup) {\n    return nodes.append({\n        ordered_list: add(orderedList, { content: \"list_item+\", group: listGroup }),\n        bullet_list: add(bulletList, { content: \"list_item+\", group: listGroup }),\n        list_item: add(listItem, { content: itemContent })\n    });\n}\n/**\nReturns a command function that wraps the selection in a list with\nthe given type an attributes. If `dispatch` is null, only return a\nvalue to indicate whether this is possible, but don't actually\nperform the change.\n*/\nfunction wrapInList(listType, attrs = null) {\n    return function (state, dispatch) {\n        let { $from, $to } = state.selection;\n        let range = $from.blockRange($to);\n        if (!range)\n            return false;\n        let tr = dispatch ? state.tr : null;\n        if (!wrapRangeInList(tr, range, listType, attrs))\n            return false;\n        if (dispatch)\n            dispatch(tr.scrollIntoView());\n        return true;\n    };\n}\n/**\nTry to wrap the given node range in a list of the given type.\nReturn `true` when this is possible, `false` otherwise. When `tr`\nis non-null, the wrapping is added to that transaction. When it is\n`null`, the function only queries whether the wrapping is\npossible.\n*/\nfunction wrapRangeInList(tr, range, listType, attrs = null) {\n    let doJoin = false, outerRange = range, doc = range.$from.doc;\n    // This is at the top of an existing list item\n    if (range.depth >= 2 && range.$from.node(range.depth - 1).type.compatibleContent(listType) && range.startIndex == 0) {\n        // Don't do anything if this is the top of the list\n        if (range.$from.index(range.depth - 1) == 0)\n            return false;\n        let $insert = doc.resolve(range.start - 2);\n        outerRange = new NodeRange($insert, $insert, range.depth);\n        if (range.endIndex < range.parent.childCount)\n            range = new NodeRange(range.$from, doc.resolve(range.$to.end(range.depth)), range.depth);\n        doJoin = true;\n    }\n    let wrap = findWrapping(outerRange, listType, attrs, range);\n    if (!wrap)\n        return false;\n    if (tr)\n        doWrapInList(tr, range, wrap, doJoin, listType);\n    return true;\n}\nfunction doWrapInList(tr, range, wrappers, joinBefore, listType) {\n    let content = Fragment.empty;\n    for (let i = wrappers.length - 1; i >= 0; i--)\n        content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));\n    tr.step(new ReplaceAroundStep(range.start - (joinBefore ? 2 : 0), range.end, range.start, range.end, new Slice(content, 0, 0), wrappers.length, true));\n    let found = 0;\n    for (let i = 0; i < wrappers.length; i++)\n        if (wrappers[i].type == listType)\n            found = i + 1;\n    let splitDepth = wrappers.length - found;\n    let splitPos = range.start + wrappers.length - (joinBefore ? 2 : 0), parent = range.parent;\n    for (let i = range.startIndex, e = range.endIndex, first = true; i < e; i++, first = false) {\n        if (!first && canSplit(tr.doc, splitPos, splitDepth)) {\n            tr.split(splitPos, splitDepth);\n            splitPos += 2 * splitDepth;\n        }\n        splitPos += parent.child(i).nodeSize;\n    }\n    return tr;\n}\n/**\nBuild a command that splits a non-empty textblock at the top level\nof a list item by also splitting that list item.\n*/\nfunction splitListItem(itemType, itemAttrs) {\n    return function (state, dispatch) {\n        let { $from, $to, node } = state.selection;\n        if ((node && node.isBlock) || $from.depth < 2 || !$from.sameParent($to))\n            return false;\n        let grandParent = $from.node(-1);\n        if (grandParent.type != itemType)\n            return false;\n        if ($from.parent.content.size == 0 && $from.node(-1).childCount == $from.indexAfter(-1)) {\n            // In an empty block. If this is a nested list, the wrapping\n            // list item should be split. Otherwise, bail out and let next\n            // command handle lifting.\n            if ($from.depth == 3 || $from.node(-3).type != itemType ||\n                $from.index(-2) != $from.node(-2).childCount - 1)\n                return false;\n            if (dispatch) {\n                let wrap = Fragment.empty;\n                let depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;\n                // Build a fragment containing empty versions of the structure\n                // from the outer list item to the parent node of the cursor\n                for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d--)\n                    wrap = Fragment.from($from.node(d).copy(wrap));\n                let depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1\n                    : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3;\n                // Add a second list item with an empty default start node\n                wrap = wrap.append(Fragment.from(itemType.createAndFill()));\n                let start = $from.before($from.depth - (depthBefore - 1));\n                let tr = state.tr.replace(start, $from.after(-depthAfter), new Slice(wrap, 4 - depthBefore, 0));\n                let sel = -1;\n                tr.doc.nodesBetween(start, tr.doc.content.size, (node, pos) => {\n                    if (sel > -1)\n                        return false;\n                    if (node.isTextblock && node.content.size == 0)\n                        sel = pos + 1;\n                });\n                if (sel > -1)\n                    tr.setSelection(Selection.near(tr.doc.resolve(sel)));\n                dispatch(tr.scrollIntoView());\n            }\n            return true;\n        }\n        let nextType = $to.pos == $from.end() ? grandParent.contentMatchAt(0).defaultType : null;\n        let tr = state.tr.delete($from.pos, $to.pos);\n        let types = nextType ? [itemAttrs ? { type: itemType, attrs: itemAttrs } : null, { type: nextType }] : undefined;\n        if (!canSplit(tr.doc, $from.pos, 2, types))\n            return false;\n        if (dispatch)\n            dispatch(tr.split($from.pos, 2, types).scrollIntoView());\n        return true;\n    };\n}\n/**\nActs like [`splitListItem`](https://prosemirror.net/docs/ref/#schema-list.splitListItem), but\nwithout resetting the set of active marks at the cursor.\n*/\nfunction splitListItemKeepMarks(itemType, itemAttrs) {\n    let split = splitListItem(itemType, itemAttrs);\n    return (state, dispatch) => {\n        return split(state, dispatch && (tr => {\n            let marks = state.storedMarks || (state.selection.$to.parentOffset && state.selection.$from.marks());\n            if (marks)\n                tr.ensureMarks(marks);\n            dispatch(tr);\n        }));\n    };\n}\n/**\nCreate a command to lift the list item around the selection up into\na wrapping list.\n*/\nfunction liftListItem(itemType) {\n    return function (state, dispatch) {\n        let { $from, $to } = state.selection;\n        let range = $from.blockRange($to, node => node.childCount > 0 && node.firstChild.type == itemType);\n        if (!range)\n            return false;\n        if (!dispatch)\n            return true;\n        if ($from.node(range.depth - 1).type == itemType) // Inside a parent list\n            return liftToOuterList(state, dispatch, itemType, range);\n        else // Outer list node\n            return liftOutOfList(state, dispatch, range);\n    };\n}\nfunction liftToOuterList(state, dispatch, itemType, range) {\n    let tr = state.tr, end = range.end, endOfList = range.$to.end(range.depth);\n    if (end < endOfList) {\n        // There are siblings after the lifted items, which must become\n        // children of the last item\n        tr.step(new ReplaceAroundStep(end - 1, endOfList, end, endOfList, new Slice(Fragment.from(itemType.create(null, range.parent.copy())), 1, 0), 1, true));\n        range = new NodeRange(tr.doc.resolve(range.$from.pos), tr.doc.resolve(endOfList), range.depth);\n    }\n    const target = liftTarget(range);\n    if (target == null)\n        return false;\n    tr.lift(range, target);\n    let $after = tr.doc.resolve(tr.mapping.map(end, -1) - 1);\n    if (canJoin(tr.doc, $after.pos) && $after.nodeBefore.type == $after.nodeAfter.type)\n        tr.join($after.pos);\n    dispatch(tr.scrollIntoView());\n    return true;\n}\nfunction liftOutOfList(state, dispatch, range) {\n    let tr = state.tr, list = range.parent;\n    // Merge the list items into a single big item\n    for (let pos = range.end, i = range.endIndex - 1, e = range.startIndex; i > e; i--) {\n        pos -= list.child(i).nodeSize;\n        tr.delete(pos - 1, pos + 1);\n    }\n    let $start = tr.doc.resolve(range.start), item = $start.nodeAfter;\n    if (tr.mapping.map(range.end) != range.start + $start.nodeAfter.nodeSize)\n        return false;\n    let atStart = range.startIndex == 0, atEnd = range.endIndex == list.childCount;\n    let parent = $start.node(-1), indexBefore = $start.index(-1);\n    if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexBefore + 1, item.content.append(atEnd ? Fragment.empty : Fragment.from(list))))\n        return false;\n    let start = $start.pos, end = start + item.nodeSize;\n    // Strip off the surrounding list. At the sides where we're not at\n    // the end of the list, the existing list is closed. At sides where\n    // this is the end, it is overwritten to its end.\n    tr.step(new ReplaceAroundStep(start - (atStart ? 1 : 0), end + (atEnd ? 1 : 0), start + 1, end - 1, new Slice((atStart ? Fragment.empty : Fragment.from(list.copy(Fragment.empty)))\n        .append(atEnd ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))), atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));\n    dispatch(tr.scrollIntoView());\n    return true;\n}\n/**\nCreate a command to sink the list item around the selection down\ninto an inner list.\n*/\nfunction sinkListItem(itemType) {\n    return function (state, dispatch) {\n        let { $from, $to } = state.selection;\n        let range = $from.blockRange($to, node => node.childCount > 0 && node.firstChild.type == itemType);\n        if (!range)\n            return false;\n        let startIndex = range.startIndex;\n        if (startIndex == 0)\n            return false;\n        let parent = range.parent, nodeBefore = parent.child(startIndex - 1);\n        if (nodeBefore.type != itemType)\n            return false;\n        if (dispatch) {\n            let nestedBefore = nodeBefore.lastChild && nodeBefore.lastChild.type == parent.type;\n            let inner = Fragment.from(nestedBefore ? itemType.create() : null);\n            let slice = new Slice(Fragment.from(itemType.create(null, Fragment.from(parent.type.create(null, inner)))), nestedBefore ? 3 : 1, 0);\n            let before = range.start, after = range.end;\n            dispatch(state.tr.step(new ReplaceAroundStep(before - (nestedBefore ? 3 : 1), after, before, after, slice, 1, true))\n                .scrollIntoView());\n        }\n        return true;\n    };\n}\n\nexport { addListNodes, bulletList, liftListItem, listItem, orderedList, sinkListItem, splitListItem, splitListItemKeepMarks, wrapInList, wrapRangeInList };\n","/**\n * @typedef {import('mdast').Definition} Definition\n * @typedef {import('mdast').Nodes} Nodes\n */\n\n/**\n * @callback GetDefinition\n *   Get a definition by identifier.\n * @param {string | null | undefined} [identifier]\n *   Identifier of definition (optional).\n * @returns {Definition | undefined}\n *   Definition corresponding to `identifier` or `null`.\n */\n\nimport {visit} from 'unist-util-visit'\n\n/**\n * Find definitions in `tree`.\n *\n * Uses CommonMark precedence, which means that earlier definitions are\n * preferred over duplicate later definitions.\n *\n * @param {Nodes} tree\n *   Tree to check.\n * @returns {GetDefinition}\n *   Getter.\n */\nexport function definitions(tree) {\n  /** @type {Map<string, Definition>} */\n  const cache = new Map()\n\n  if (!tree || !tree.type) {\n    throw new Error('mdast-util-definitions expected node')\n  }\n\n  visit(tree, 'definition', function (definition) {\n    const id = clean(definition.identifier)\n    if (id && !cache.get(id)) {\n      cache.set(id, definition)\n    }\n  })\n\n  return definition\n\n  /** @type {GetDefinition} */\n  function definition(identifier) {\n    const id = clean(identifier)\n    return cache.get(id)\n  }\n}\n\n/**\n * @param {string | null | undefined} [value]\n * @returns {string}\n */\nfunction clean(value) {\n  return String(value || '').toUpperCase()\n}\n","/**\n * @typedef {import('mdast').Root} Root\n */\n\nimport {definitions} from 'mdast-util-definitions'\nimport {SKIP, visit} from 'unist-util-visit'\n\n/**\n * Turn references and definitions into normal links and images.\n *\n * @returns\n *   Transform.\n */\nexport default function remarkInlineLinks() {\n  /**\n   * Transform.\n   *\n   * @param {Root} tree\n   *   Tree.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  return function (tree) {\n    const definition = definitions(tree)\n\n    visit(tree, function (node, index, parent) {\n      if (\n        node.type === 'definition' &&\n        parent !== undefined &&\n        typeof index === 'number'\n      ) {\n        parent.children.splice(index, 1)\n        return [SKIP, index]\n      }\n\n      if (node.type === 'imageReference' || node.type === 'linkReference') {\n        const def = definition(node.identifier)\n\n        if (def && parent && typeof index === 'number') {\n          parent.children[index] =\n            node.type === 'imageReference'\n              ? {type: 'image', url: def.url, title: def.title, alt: node.alt}\n              : {\n                  type: 'link',\n                  url: def.url,\n                  title: def.title,\n                  children: node.children\n                }\n          return [SKIP, index]\n        }\n      }\n    })\n  }\n}\n","import { $markAttr, $markSchema, $inputRule, $command, $useKeymap, $node, $remark, $nodeAttr, $nodeSchema, $ctx, $prose } from \"@milkdown/utils\";\nimport { remarkStringifyOptionsCtx, commandsCtx, editorViewCtx } from \"@milkdown/core\";\nimport { toggleMark, setBlockType, wrapIn } from \"@milkdown/prose/commands\";\nimport { visit } from \"unist-util-visit\";\nimport { Fragment } from \"@milkdown/prose/model\";\nimport { expectDomTypeError } from \"@milkdown/exception\";\nimport { textblockTypeInputRule, wrappingInputRule, InputRule } from \"@milkdown/prose/inputrules\";\nimport { TextSelection, Selection, PluginKey, Plugin } from \"@milkdown/prose/state\";\nimport { markRule, findSelectedNodeOfType } from \"@milkdown/prose\";\nimport { sinkListItem, splitListItem, liftListItem } from \"@milkdown/prose/schema-list\";\nimport { ReplaceStep, AddMarkStep } from \"@milkdown/prose/transform\";\nimport { Decoration, DecorationSet } from \"@milkdown/prose/view\";\nimport remarkInlineLinks from \"remark-inline-links\";\nfunction serializeText(state, node) {\n  var _a;\n  const lastIsHardBreak = node.childCount >= 1 && ((_a = node.lastChild) == null ? void 0 : _a.type.name) === \"hardbreak\";\n  if (!lastIsHardBreak) {\n    state.next(node.content);\n    return;\n  }\n  const contentArr = [];\n  node.content.forEach((n, _, i) => {\n    if (i === node.childCount - 1) return;\n    contentArr.push(n);\n  });\n  state.next(Fragment.fromArray(contentArr));\n}\nfunction withMeta(plugin, meta) {\n  Object.assign(plugin, {\n    meta: {\n      package: \"@milkdown/preset-commonmark\",\n      ...meta\n    }\n  });\n  return plugin;\n}\nconst emphasisAttr = $markAttr(\"emphasis\");\nwithMeta(emphasisAttr, {\n  displayName: \"Attr<emphasis>\",\n  group: \"Emphasis\"\n});\nconst emphasisSchema = $markSchema(\"emphasis\", (ctx) => ({\n  attrs: {\n    marker: {\n      default: ctx.get(remarkStringifyOptionsCtx).emphasis || \"*\"\n    }\n  },\n  parseDOM: [\n    { tag: \"i\" },\n    { tag: \"em\" },\n    { style: \"font-style\", getAttrs: (value) => value === \"italic\" }\n  ],\n  toDOM: (mark) => [\"em\", ctx.get(emphasisAttr.key)(mark)],\n  parseMarkdown: {\n    match: (node) => node.type === \"emphasis\",\n    runner: (state, node, markType) => {\n      state.openMark(markType, { marker: node.marker });\n      state.next(node.children);\n      state.closeMark(markType);\n    }\n  },\n  toMarkdown: {\n    match: (mark) => mark.type.name === \"emphasis\",\n    runner: (state, mark) => {\n      state.withMark(mark, \"emphasis\", void 0, {\n        marker: mark.attrs.marker\n      });\n    }\n  }\n}));\nwithMeta(emphasisSchema.mark, {\n  displayName: \"MarkSchema<emphasis>\",\n  group: \"Emphasis\"\n});\nwithMeta(emphasisSchema.ctx, {\n  displayName: \"MarkSchemaCtx<emphasis>\",\n  group: \"Emphasis\"\n});\nconst toggleEmphasisCommand = $command(\"ToggleEmphasis\", (ctx) => () => {\n  return toggleMark(emphasisSchema.type(ctx));\n});\nwithMeta(toggleEmphasisCommand, {\n  displayName: \"Command<toggleEmphasisCommand>\",\n  group: \"Emphasis\"\n});\nconst emphasisStarInputRule = $inputRule((ctx) => {\n  return markRule(/(?:^|[^*])\\*([^*]+)\\*$/, emphasisSchema.type(ctx), {\n    getAttr: () => ({\n      marker: \"*\"\n    }),\n    updateCaptured: ({ fullMatch, start }) => !fullMatch.startsWith(\"*\") ? { fullMatch: fullMatch.slice(1), start: start + 1 } : {}\n  });\n});\nwithMeta(emphasisStarInputRule, {\n  displayName: \"InputRule<emphasis>|Star\",\n  group: \"Emphasis\"\n});\nconst emphasisUnderscoreInputRule = $inputRule((ctx) => {\n  return markRule(/(?:^|[^_])_([^_]+)_$/, emphasisSchema.type(ctx), {\n    getAttr: () => ({\n      marker: \"_\"\n    }),\n    updateCaptured: ({ fullMatch, start }) => !fullMatch.startsWith(\"_\") ? { fullMatch: fullMatch.slice(1), start: start + 1 } : {}\n  });\n});\nwithMeta(emphasisUnderscoreInputRule, {\n  displayName: \"InputRule<emphasis>|Underscore\",\n  group: \"Emphasis\"\n});\nconst emphasisKeymap = $useKeymap(\"emphasisKeymap\", {\n  ToggleEmphasis: {\n    shortcuts: \"Mod-i\",\n    command: (ctx) => {\n      const commands2 = ctx.get(commandsCtx);\n      return () => commands2.call(toggleEmphasisCommand.key);\n    }\n  }\n});\nwithMeta(emphasisKeymap.ctx, {\n  displayName: \"KeymapCtx<emphasis>\",\n  group: \"Emphasis\"\n});\nwithMeta(emphasisKeymap.shortcuts, {\n  displayName: \"Keymap<emphasis>\",\n  group: \"Emphasis\"\n});\nconst strongAttr = $markAttr(\"strong\");\nwithMeta(strongAttr, {\n  displayName: \"Attr<strong>\",\n  group: \"Strong\"\n});\nconst strongSchema = $markSchema(\"strong\", (ctx) => ({\n  attrs: {\n    marker: {\n      default: ctx.get(remarkStringifyOptionsCtx).strong || \"*\"\n    }\n  },\n  parseDOM: [\n    { tag: \"b\" },\n    { tag: \"strong\" },\n    { style: \"font-style\", getAttrs: (value) => value === \"bold\" }\n  ],\n  toDOM: (mark) => [\"strong\", ctx.get(strongAttr.key)(mark)],\n  parseMarkdown: {\n    match: (node) => node.type === \"strong\",\n    runner: (state, node, markType) => {\n      state.openMark(markType, { marker: node.marker });\n      state.next(node.children);\n      state.closeMark(markType);\n    }\n  },\n  toMarkdown: {\n    match: (mark) => mark.type.name === \"strong\",\n    runner: (state, mark) => {\n      state.withMark(mark, \"strong\", void 0, {\n        marker: mark.attrs.marker\n      });\n    }\n  }\n}));\nwithMeta(strongSchema.mark, {\n  displayName: \"MarkSchema<strong>\",\n  group: \"Strong\"\n});\nwithMeta(strongSchema.ctx, {\n  displayName: \"MarkSchemaCtx<strong>\",\n  group: \"Strong\"\n});\nconst toggleStrongCommand = $command(\"ToggleStrong\", (ctx) => () => {\n  return toggleMark(strongSchema.type(ctx));\n});\nwithMeta(toggleStrongCommand, {\n  displayName: \"Command<toggleStrongCommand>\",\n  group: \"Strong\"\n});\nconst strongInputRule = $inputRule((ctx) => {\n  return markRule(/(?:\\*\\*|__)([^*_]+)(?:\\*\\*|__)$/, strongSchema.type(ctx), {\n    getAttr: (match) => {\n      return {\n        marker: match[0].startsWith(\"*\") ? \"*\" : \"_\"\n      };\n    }\n  });\n});\nwithMeta(strongInputRule, {\n  displayName: \"InputRule<strong>\",\n  group: \"Strong\"\n});\nconst strongKeymap = $useKeymap(\"strongKeymap\", {\n  ToggleBold: {\n    shortcuts: [\"Mod-b\"],\n    command: (ctx) => {\n      const commands2 = ctx.get(commandsCtx);\n      return () => commands2.call(toggleStrongCommand.key);\n    }\n  }\n});\nwithMeta(strongKeymap.ctx, {\n  displayName: \"KeymapCtx<strong>\",\n  group: \"Strong\"\n});\nwithMeta(strongKeymap.shortcuts, {\n  displayName: \"Keymap<strong>\",\n  group: \"Strong\"\n});\nconst inlineCodeAttr = $markAttr(\"inlineCode\");\nwithMeta(inlineCodeAttr, {\n  displayName: \"Attr<inlineCode>\",\n  group: \"InlineCode\"\n});\nconst inlineCodeSchema = $markSchema(\"inlineCode\", (ctx) => ({\n  priority: 100,\n  code: true,\n  inclusive: false,\n  parseDOM: [{ tag: \"code\" }],\n  toDOM: (mark) => [\"code\", ctx.get(inlineCodeAttr.key)(mark)],\n  parseMarkdown: {\n    match: (node) => node.type === \"inlineCode\",\n    runner: (state, node, markType) => {\n      state.openMark(markType);\n      state.addText(node.value);\n      state.closeMark(markType);\n    }\n  },\n  toMarkdown: {\n    match: (mark) => mark.type.name === \"inlineCode\",\n    runner: (state, mark, node) => {\n      state.withMark(mark, \"inlineCode\", node.text || \"\");\n    }\n  }\n}));\nwithMeta(inlineCodeSchema.mark, {\n  displayName: \"MarkSchema<inlineCode>\",\n  group: \"InlineCode\"\n});\nwithMeta(inlineCodeSchema.ctx, {\n  displayName: \"MarkSchemaCtx<inlineCode>\",\n  group: \"InlineCode\"\n});\nconst toggleInlineCodeCommand = $command(\n  \"ToggleInlineCode\",\n  (ctx) => () => (state, dispatch) => {\n    const { selection, tr } = state;\n    if (selection.empty) return false;\n    const { from, to } = selection;\n    const has = state.doc.rangeHasMark(from, to, inlineCodeSchema.type(ctx));\n    if (has) {\n      dispatch == null ? void 0 : dispatch(tr.removeMark(from, to, inlineCodeSchema.type(ctx)));\n      return true;\n    }\n    const restMarksName = Object.keys(state.schema.marks).filter(\n      (x) => x !== inlineCodeSchema.type.name\n    );\n    restMarksName.map((name) => state.schema.marks[name]).forEach((t) => {\n      tr.removeMark(from, to, t);\n    });\n    dispatch == null ? void 0 : dispatch(tr.addMark(from, to, inlineCodeSchema.type(ctx).create()));\n    return true;\n  }\n);\nwithMeta(toggleInlineCodeCommand, {\n  displayName: \"Command<toggleInlineCodeCommand>\",\n  group: \"InlineCode\"\n});\nconst inlineCodeInputRule = $inputRule((ctx) => {\n  return markRule(/(?:`)([^`]+)(?:`)$/, inlineCodeSchema.type(ctx));\n});\nwithMeta(inlineCodeInputRule, {\n  displayName: \"InputRule<inlineCodeInputRule>\",\n  group: \"InlineCode\"\n});\nconst inlineCodeKeymap = $useKeymap(\"inlineCodeKeymap\", {\n  ToggleInlineCode: {\n    shortcuts: \"Mod-e\",\n    command: (ctx) => {\n      const commands2 = ctx.get(commandsCtx);\n      return () => commands2.call(toggleInlineCodeCommand.key);\n    }\n  }\n});\nwithMeta(inlineCodeKeymap.ctx, {\n  displayName: \"KeymapCtx<inlineCode>\",\n  group: \"InlineCode\"\n});\nwithMeta(inlineCodeKeymap.shortcuts, {\n  displayName: \"Keymap<inlineCode>\",\n  group: \"InlineCode\"\n});\nconst linkAttr = $markAttr(\"link\");\nwithMeta(linkAttr, {\n  displayName: \"Attr<link>\",\n  group: \"Link\"\n});\nconst linkSchema = $markSchema(\"link\", (ctx) => ({\n  attrs: {\n    href: {},\n    title: { default: null }\n  },\n  parseDOM: [\n    {\n      tag: \"a[href]\",\n      getAttrs: (dom) => {\n        if (!(dom instanceof HTMLElement)) throw expectDomTypeError(dom);\n        return {\n          href: dom.getAttribute(\"href\"),\n          title: dom.getAttribute(\"title\")\n        };\n      }\n    }\n  ],\n  toDOM: (mark) => [\"a\", { ...ctx.get(linkAttr.key)(mark), ...mark.attrs }],\n  parseMarkdown: {\n    match: (node) => node.type === \"link\",\n    runner: (state, node, markType) => {\n      const url = node.url;\n      const title = node.title;\n      state.openMark(markType, { href: url, title });\n      state.next(node.children);\n      state.closeMark(markType);\n    }\n  },\n  toMarkdown: {\n    match: (mark) => mark.type.name === \"link\",\n    runner: (state, mark) => {\n      state.withMark(mark, \"link\", void 0, {\n        title: mark.attrs.title,\n        url: mark.attrs.href\n      });\n    }\n  }\n}));\nwithMeta(linkSchema.mark, {\n  displayName: \"MarkSchema<link>\",\n  group: \"Link\"\n});\nconst toggleLinkCommand = $command(\n  \"ToggleLink\",\n  (ctx) => (payload = {}) => toggleMark(linkSchema.type(ctx), payload)\n);\nwithMeta(toggleLinkCommand, {\n  displayName: \"Command<toggleLinkCommand>\",\n  group: \"Link\"\n});\nconst updateLinkCommand = $command(\n  \"UpdateLink\",\n  (ctx) => (payload = {}) => (state, dispatch) => {\n    if (!dispatch) return false;\n    let node;\n    let pos = -1;\n    const { selection } = state;\n    const { from, to } = selection;\n    state.doc.nodesBetween(from, from === to ? to + 1 : to, (n, p) => {\n      if (linkSchema.type(ctx).isInSet(n.marks)) {\n        node = n;\n        pos = p;\n        return false;\n      }\n      return void 0;\n    });\n    if (!node) return false;\n    const mark = node.marks.find(({ type }) => type === linkSchema.type(ctx));\n    if (!mark) return false;\n    const start = pos;\n    const end = pos + node.nodeSize;\n    const { tr } = state;\n    const linkMark = linkSchema.type(ctx).create({ ...mark.attrs, ...payload });\n    if (!linkMark) return false;\n    dispatch(\n      tr.removeMark(start, end, mark).addMark(start, end, linkMark).setSelection(new TextSelection(tr.selection.$anchor)).scrollIntoView()\n    );\n    return true;\n  }\n);\nwithMeta(updateLinkCommand, {\n  displayName: \"Command<updateLinkCommand>\",\n  group: \"Link\"\n});\nconst docSchema = $node(\"doc\", () => ({\n  content: \"block+\",\n  parseMarkdown: {\n    match: ({ type }) => type === \"root\",\n    runner: (state, node, type) => {\n      state.injectRoot(node, type);\n    }\n  },\n  toMarkdown: {\n    match: (node) => node.type.name === \"doc\",\n    runner: (state, node) => {\n      state.openNode(\"root\");\n      state.next(node.content);\n    }\n  }\n}));\nwithMeta(docSchema, {\n  displayName: \"NodeSchema<doc>\",\n  group: \"Doc\"\n});\nfunction visitImage(ast) {\n  return visit(ast, \"paragraph\", (node) => {\n    var _a, _b;\n    if (((_a = node.children) == null ? void 0 : _a.length) !== 1) return;\n    const firstChild = (_b = node.children) == null ? void 0 : _b[0];\n    if (!firstChild || firstChild.type !== \"html\") return;\n    const { value } = firstChild;\n    if (![\"<br />\", \"<br>\", \"<br/>\"].includes(value)) {\n      return;\n    }\n    node.children.splice(0, 1);\n  });\n}\nconst remarkPreserveEmptyLinePlugin = $remark(\n  \"remark-preserve-empty-line\",\n  () => () => visitImage\n);\nwithMeta(remarkPreserveEmptyLinePlugin.plugin, {\n  displayName: \"Remark<remarkPreserveEmptyLine>\",\n  group: \"Remark\"\n});\nwithMeta(remarkPreserveEmptyLinePlugin.options, {\n  displayName: \"RemarkConfig<remarkPreserveEmptyLine>\",\n  group: \"Remark\"\n});\nconst paragraphAttr = $nodeAttr(\"paragraph\");\nwithMeta(paragraphAttr, {\n  displayName: \"Attr<paragraph>\",\n  group: \"Paragraph\"\n});\nconst paragraphSchema = $nodeSchema(\"paragraph\", (ctx) => ({\n  content: \"inline*\",\n  group: \"block\",\n  parseDOM: [{ tag: \"p\" }],\n  toDOM: (node) => [\"p\", ctx.get(paragraphAttr.key)(node), 0],\n  parseMarkdown: {\n    match: (node) => node.type === \"paragraph\",\n    runner: (state, node, type) => {\n      state.openNode(type);\n      if (node.children) state.next(node.children);\n      else state.addText(node.value || \"\");\n      state.closeNode();\n    }\n  },\n  toMarkdown: {\n    match: (node) => node.type.name === \"paragraph\",\n    runner: (state, node) => {\n      state.openNode(\"paragraph\");\n      if ((!node.content || node.content.size === 0) && shouldPreserveEmptyLine(ctx)) {\n        state.addNode(\"html\", void 0, \"<br />\");\n      } else {\n        serializeText(state, node);\n      }\n      state.closeNode();\n    }\n  }\n}));\nfunction shouldPreserveEmptyLine(ctx) {\n  let shouldPreserveEmptyLine2 = false;\n  try {\n    ctx.get(remarkPreserveEmptyLinePlugin.id);\n    shouldPreserveEmptyLine2 = true;\n  } catch {\n    shouldPreserveEmptyLine2 = false;\n  }\n  return shouldPreserveEmptyLine2;\n}\nwithMeta(paragraphSchema.node, {\n  displayName: \"NodeSchema<paragraph>\",\n  group: \"Paragraph\"\n});\nwithMeta(paragraphSchema.ctx, {\n  displayName: \"NodeSchemaCtx<paragraph>\",\n  group: \"Paragraph\"\n});\nconst turnIntoTextCommand = $command(\n  \"TurnIntoText\",\n  (ctx) => () => setBlockType(paragraphSchema.type(ctx))\n);\nwithMeta(turnIntoTextCommand, {\n  displayName: \"Command<turnIntoTextCommand>\",\n  group: \"Paragraph\"\n});\nconst paragraphKeymap = $useKeymap(\"paragraphKeymap\", {\n  TurnIntoText: {\n    shortcuts: \"Mod-Alt-0\",\n    command: (ctx) => {\n      const commands2 = ctx.get(commandsCtx);\n      return () => commands2.call(turnIntoTextCommand.key);\n    }\n  }\n});\nwithMeta(paragraphKeymap.ctx, {\n  displayName: \"KeymapCtx<paragraph>\",\n  group: \"Paragraph\"\n});\nwithMeta(paragraphKeymap.shortcuts, {\n  displayName: \"Keymap<paragraph>\",\n  group: \"Paragraph\"\n});\nconst headingIndex = Array(6).fill(0).map((_, i) => i + 1);\nfunction defaultHeadingIdGenerator(node) {\n  return node.textContent.toLowerCase().trim().replace(/[^\\w\\s-]/g, \"\").replace(/\\s+/g, \"-\");\n}\nconst headingIdGenerator = $ctx(\n  defaultHeadingIdGenerator,\n  \"headingIdGenerator\"\n);\nwithMeta(headingIdGenerator, {\n  displayName: \"Ctx<HeadingIdGenerator>\",\n  group: \"Heading\"\n});\nconst headingAttr = $nodeAttr(\"heading\");\nwithMeta(headingAttr, {\n  displayName: \"Attr<heading>\",\n  group: \"Heading\"\n});\nconst headingSchema = $nodeSchema(\"heading\", (ctx) => {\n  const getId = ctx.get(headingIdGenerator.key);\n  return {\n    content: \"inline*\",\n    group: \"block\",\n    defining: true,\n    attrs: {\n      id: {\n        default: \"\"\n      },\n      level: {\n        default: 1\n      }\n    },\n    parseDOM: headingIndex.map((x) => ({\n      tag: `h${x}`,\n      getAttrs: (node) => {\n        if (!(node instanceof HTMLElement)) throw expectDomTypeError(node);\n        return { level: x, id: node.id };\n      }\n    })),\n    toDOM: (node) => {\n      return [\n        `h${node.attrs.level}`,\n        {\n          ...ctx.get(headingAttr.key)(node),\n          id: node.attrs.id || getId(node)\n        },\n        0\n      ];\n    },\n    parseMarkdown: {\n      match: ({ type }) => type === \"heading\",\n      runner: (state, node, type) => {\n        const depth = node.depth;\n        state.openNode(type, { level: depth });\n        state.next(node.children);\n        state.closeNode();\n      }\n    },\n    toMarkdown: {\n      match: (node) => node.type.name === \"heading\",\n      runner: (state, node) => {\n        state.openNode(\"heading\", void 0, { depth: node.attrs.level });\n        serializeText(state, node);\n        state.closeNode();\n      }\n    }\n  };\n});\nwithMeta(headingSchema.node, {\n  displayName: \"NodeSchema<heading>\",\n  group: \"Heading\"\n});\nwithMeta(headingSchema.ctx, {\n  displayName: \"NodeSchemaCtx<heading>\",\n  group: \"Heading\"\n});\nconst wrapInHeadingInputRule = $inputRule((ctx) => {\n  return textblockTypeInputRule(\n    /^(?<hashes>#+)\\s$/,\n    headingSchema.type(ctx),\n    (match) => {\n      var _a, _b;\n      const x = ((_b = (_a = match.groups) == null ? void 0 : _a.hashes) == null ? void 0 : _b.length) || 0;\n      const view = ctx.get(editorViewCtx);\n      const { $from } = view.state.selection;\n      const node = $from.node();\n      if (node.type.name === \"heading\") {\n        let level = Number(node.attrs.level) + Number(x);\n        if (level > 6) level = 6;\n        return { level };\n      }\n      return { level: x };\n    }\n  );\n});\nwithMeta(wrapInHeadingInputRule, {\n  displayName: \"InputRule<wrapInHeadingInputRule>\",\n  group: \"Heading\"\n});\nconst wrapInHeadingCommand = $command(\"WrapInHeading\", (ctx) => {\n  return (level) => {\n    level ?? (level = 1);\n    if (level < 1) return setBlockType(paragraphSchema.type(ctx));\n    return setBlockType(headingSchema.type(ctx), { level });\n  };\n});\nwithMeta(wrapInHeadingCommand, {\n  displayName: \"Command<wrapInHeadingCommand>\",\n  group: \"Heading\"\n});\nconst downgradeHeadingCommand = $command(\n  \"DowngradeHeading\",\n  (ctx) => () => (state, dispatch, view) => {\n    const { $from } = state.selection;\n    const node = $from.node();\n    if (node.type !== headingSchema.type(ctx) || !state.selection.empty || $from.parentOffset !== 0)\n      return false;\n    const level = node.attrs.level - 1;\n    if (!level)\n      return setBlockType(paragraphSchema.type(ctx))(state, dispatch, view);\n    dispatch == null ? void 0 : dispatch(\n      state.tr.setNodeMarkup(state.selection.$from.before(), void 0, {\n        ...node.attrs,\n        level\n      })\n    );\n    return true;\n  }\n);\nwithMeta(downgradeHeadingCommand, {\n  displayName: \"Command<downgradeHeadingCommand>\",\n  group: \"Heading\"\n});\nconst headingKeymap = $useKeymap(\"headingKeymap\", {\n  TurnIntoH1: {\n    shortcuts: \"Mod-Alt-1\",\n    command: (ctx) => {\n      const commands2 = ctx.get(commandsCtx);\n      return () => commands2.call(wrapInHeadingCommand.key, 1);\n    }\n  },\n  TurnIntoH2: {\n    shortcuts: \"Mod-Alt-2\",\n    command: (ctx) => {\n      const commands2 = ctx.get(commandsCtx);\n      return () => commands2.call(wrapInHeadingCommand.key, 2);\n    }\n  },\n  TurnIntoH3: {\n    shortcuts: \"Mod-Alt-3\",\n    command: (ctx) => {\n      const commands2 = ctx.get(commandsCtx);\n      return () => commands2.call(wrapInHeadingCommand.key, 3);\n    }\n  },\n  TurnIntoH4: {\n    shortcuts: \"Mod-Alt-4\",\n    command: (ctx) => {\n      const commands2 = ctx.get(commandsCtx);\n      return () => commands2.call(wrapInHeadingCommand.key, 4);\n    }\n  },\n  TurnIntoH5: {\n    shortcuts: \"Mod-Alt-5\",\n    command: (ctx) => {\n      const commands2 = ctx.get(commandsCtx);\n      return () => commands2.call(wrapInHeadingCommand.key, 5);\n    }\n  },\n  TurnIntoH6: {\n    shortcuts: \"Mod-Alt-6\",\n    command: (ctx) => {\n      const commands2 = ctx.get(commandsCtx);\n      return () => commands2.call(wrapInHeadingCommand.key, 6);\n    }\n  },\n  DowngradeHeading: {\n    shortcuts: [\"Delete\", \"Backspace\"],\n    command: (ctx) => {\n      const commands2 = ctx.get(commandsCtx);\n      return () => commands2.call(downgradeHeadingCommand.key);\n    }\n  }\n});\nwithMeta(headingKeymap.ctx, {\n  displayName: \"KeymapCtx<heading>\",\n  group: \"Heading\"\n});\nwithMeta(headingKeymap.shortcuts, {\n  displayName: \"Keymap<heading>\",\n  group: \"Heading\"\n});\nconst blockquoteAttr = $nodeAttr(\"blockquote\");\nwithMeta(blockquoteAttr, {\n  displayName: \"Attr<blockquote>\",\n  group: \"Blockquote\"\n});\nconst blockquoteSchema = $nodeSchema(\n  \"blockquote\",\n  (ctx) => ({\n    content: \"block+\",\n    group: \"block\",\n    defining: true,\n    parseDOM: [{ tag: \"blockquote\" }],\n    toDOM: (node) => [\"blockquote\", ctx.get(blockquoteAttr.key)(node), 0],\n    parseMarkdown: {\n      match: ({ type }) => type === \"blockquote\",\n      runner: (state, node, type) => {\n        state.openNode(type).next(node.children).closeNode();\n      }\n    },\n    toMarkdown: {\n      match: (node) => node.type.name === \"blockquote\",\n      runner: (state, node) => {\n        state.openNode(\"blockquote\").next(node.content).closeNode();\n      }\n    }\n  })\n);\nwithMeta(blockquoteSchema.node, {\n  displayName: \"NodeSchema<blockquote>\",\n  group: \"Blockquote\"\n});\nwithMeta(blockquoteSchema.ctx, {\n  displayName: \"NodeSchemaCtx<blockquote>\",\n  group: \"Blockquote\"\n});\nconst wrapInBlockquoteInputRule = $inputRule(\n  (ctx) => wrappingInputRule(/^\\s*>\\s$/, blockquoteSchema.type(ctx))\n);\nwithMeta(wrapInBlockquoteInputRule, {\n  displayName: \"InputRule<wrapInBlockquoteInputRule>\",\n  group: \"Blockquote\"\n});\nconst wrapInBlockquoteCommand = $command(\n  \"WrapInBlockquote\",\n  (ctx) => () => wrapIn(blockquoteSchema.type(ctx))\n);\nwithMeta(wrapInBlockquoteCommand, {\n  displayName: \"Command<wrapInBlockquoteCommand>\",\n  group: \"Blockquote\"\n});\nconst blockquoteKeymap = $useKeymap(\"blockquoteKeymap\", {\n  WrapInBlockquote: {\n    shortcuts: \"Mod-Shift-b\",\n    command: (ctx) => {\n      const commands2 = ctx.get(commandsCtx);\n      return () => commands2.call(wrapInBlockquoteCommand.key);\n    }\n  }\n});\nwithMeta(blockquoteKeymap.ctx, {\n  displayName: \"KeymapCtx<blockquote>\",\n  group: \"Blockquote\"\n});\nwithMeta(blockquoteKeymap.shortcuts, {\n  displayName: \"Keymap<blockquote>\",\n  group: \"Blockquote\"\n});\nconst codeBlockAttr = $nodeAttr(\"codeBlock\", () => ({\n  pre: {},\n  code: {}\n}));\nwithMeta(codeBlockAttr, {\n  displayName: \"Attr<codeBlock>\",\n  group: \"CodeBlock\"\n});\nconst codeBlockSchema = $nodeSchema(\"code_block\", (ctx) => {\n  return {\n    content: \"text*\",\n    group: \"block\",\n    marks: \"\",\n    defining: true,\n    code: true,\n    attrs: {\n      language: {\n        default: \"\"\n      }\n    },\n    parseDOM: [\n      {\n        tag: \"pre\",\n        preserveWhitespace: \"full\",\n        getAttrs: (dom) => {\n          if (!(dom instanceof HTMLElement)) throw expectDomTypeError(dom);\n          return { language: dom.dataset.language };\n        }\n      }\n    ],\n    toDOM: (node) => {\n      const attr = ctx.get(codeBlockAttr.key)(node);\n      return [\n        \"pre\",\n        {\n          ...attr.pre,\n          \"data-language\": node.attrs.language\n        },\n        [\"code\", attr.code, 0]\n      ];\n    },\n    parseMarkdown: {\n      match: ({ type }) => type === \"code\",\n      runner: (state, node, type) => {\n        const language = node.lang;\n        const value = node.value;\n        state.openNode(type, { language });\n        if (value) state.addText(value);\n        state.closeNode();\n      }\n    },\n    toMarkdown: {\n      match: (node) => node.type.name === \"code_block\",\n      runner: (state, node) => {\n        var _a;\n        state.addNode(\"code\", void 0, ((_a = node.content.firstChild) == null ? void 0 : _a.text) || \"\", {\n          lang: node.attrs.language\n        });\n      }\n    }\n  };\n});\nwithMeta(codeBlockSchema.node, {\n  displayName: \"NodeSchema<codeBlock>\",\n  group: \"CodeBlock\"\n});\nwithMeta(codeBlockSchema.ctx, {\n  displayName: \"NodeSchemaCtx<codeBlock>\",\n  group: \"CodeBlock\"\n});\nconst createCodeBlockInputRule = $inputRule(\n  (ctx) => textblockTypeInputRule(\n    /^```(?<language>[a-z]*)?[\\s\\n]$/,\n    codeBlockSchema.type(ctx),\n    (match) => {\n      var _a;\n      return {\n        language: ((_a = match.groups) == null ? void 0 : _a.language) ?? \"\"\n      };\n    }\n  )\n);\nwithMeta(createCodeBlockInputRule, {\n  displayName: \"InputRule<createCodeBlockInputRule>\",\n  group: \"CodeBlock\"\n});\nconst createCodeBlockCommand = $command(\n  \"CreateCodeBlock\",\n  (ctx) => (language = \"\") => setBlockType(codeBlockSchema.type(ctx), { language })\n);\nwithMeta(createCodeBlockCommand, {\n  displayName: \"Command<createCodeBlockCommand>\",\n  group: \"CodeBlock\"\n});\nconst updateCodeBlockLanguageCommand = $command(\n  \"UpdateCodeBlockLanguage\",\n  () => ({ pos, language } = {\n    pos: -1,\n    language: \"\"\n  }) => (state, dispatch) => {\n    if (pos >= 0) {\n      dispatch == null ? void 0 : dispatch(state.tr.setNodeAttribute(pos, \"language\", language));\n      return true;\n    }\n    return false;\n  }\n);\nwithMeta(updateCodeBlockLanguageCommand, {\n  displayName: \"Command<updateCodeBlockLanguageCommand>\",\n  group: \"CodeBlock\"\n});\nconst codeBlockKeymap = $useKeymap(\"codeBlockKeymap\", {\n  CreateCodeBlock: {\n    shortcuts: \"Mod-Alt-c\",\n    command: (ctx) => {\n      const commands2 = ctx.get(commandsCtx);\n      return () => commands2.call(createCodeBlockCommand.key);\n    }\n  }\n});\nwithMeta(codeBlockKeymap.ctx, {\n  displayName: \"KeymapCtx<codeBlock>\",\n  group: \"CodeBlock\"\n});\nwithMeta(codeBlockKeymap.shortcuts, {\n  displayName: \"Keymap<codeBlock>\",\n  group: \"CodeBlock\"\n});\nconst imageAttr = $nodeAttr(\"image\");\nwithMeta(imageAttr, {\n  displayName: \"Attr<image>\",\n  group: \"Image\"\n});\nconst imageSchema = $nodeSchema(\"image\", (ctx) => {\n  return {\n    inline: true,\n    group: \"inline\",\n    selectable: true,\n    draggable: true,\n    marks: \"\",\n    atom: true,\n    defining: true,\n    isolating: true,\n    attrs: {\n      src: { default: \"\" },\n      alt: { default: \"\" },\n      title: { default: \"\" }\n    },\n    parseDOM: [\n      {\n        tag: \"img[src]\",\n        getAttrs: (dom) => {\n          if (!(dom instanceof HTMLElement)) throw expectDomTypeError(dom);\n          return {\n            src: dom.getAttribute(\"src\") || \"\",\n            alt: dom.getAttribute(\"alt\") || \"\",\n            title: dom.getAttribute(\"title\") || dom.getAttribute(\"alt\") || \"\"\n          };\n        }\n      }\n    ],\n    toDOM: (node) => {\n      return [\"img\", { ...ctx.get(imageAttr.key)(node), ...node.attrs }];\n    },\n    parseMarkdown: {\n      match: ({ type }) => type === \"image\",\n      runner: (state, node, type) => {\n        const url = node.url;\n        const alt = node.alt;\n        const title = node.title;\n        state.addNode(type, {\n          src: url,\n          alt,\n          title\n        });\n      }\n    },\n    toMarkdown: {\n      match: (node) => node.type.name === \"image\",\n      runner: (state, node) => {\n        state.addNode(\"image\", void 0, void 0, {\n          title: node.attrs.title,\n          url: node.attrs.src,\n          alt: node.attrs.alt\n        });\n      }\n    }\n  };\n});\nwithMeta(imageSchema.node, {\n  displayName: \"NodeSchema<image>\",\n  group: \"Image\"\n});\nwithMeta(imageSchema.ctx, {\n  displayName: \"NodeSchemaCtx<image>\",\n  group: \"Image\"\n});\nconst insertImageCommand = $command(\n  \"InsertImage\",\n  (ctx) => (payload = {}) => (state, dispatch) => {\n    if (!dispatch) return true;\n    const { src = \"\", alt = \"\", title = \"\" } = payload;\n    const node = imageSchema.type(ctx).create({ src, alt, title });\n    if (!node) return true;\n    dispatch(state.tr.replaceSelectionWith(node).scrollIntoView());\n    return true;\n  }\n);\nwithMeta(insertImageCommand, {\n  displayName: \"Command<insertImageCommand>\",\n  group: \"Image\"\n});\nconst updateImageCommand = $command(\n  \"UpdateImage\",\n  (ctx) => (payload = {}) => (state, dispatch) => {\n    const nodeWithPos = findSelectedNodeOfType(\n      state.selection,\n      imageSchema.type(ctx)\n    );\n    if (!nodeWithPos) return false;\n    const { node, pos } = nodeWithPos;\n    const newAttrs = { ...node.attrs };\n    const { src, alt, title } = payload;\n    if (src !== void 0) newAttrs.src = src;\n    if (alt !== void 0) newAttrs.alt = alt;\n    if (title !== void 0) newAttrs.title = title;\n    dispatch == null ? void 0 : dispatch(\n      state.tr.setNodeMarkup(pos, void 0, newAttrs).scrollIntoView()\n    );\n    return true;\n  }\n);\nwithMeta(updateImageCommand, {\n  displayName: \"Command<updateImageCommand>\",\n  group: \"Image\"\n});\nconst insertImageInputRule = $inputRule(\n  (ctx) => new InputRule(\n    /!\\[(?<alt>.*?)]\\((?<filename>.*?)\\s*(?=\"|\\))\"?(?<title>[^\"]+)?\"?\\)/,\n    (state, match, start, end) => {\n      const [matched, alt, src = \"\", title] = match;\n      if (matched)\n        return state.tr.replaceWith(\n          start,\n          end,\n          imageSchema.type(ctx).create({ src, alt, title })\n        );\n      return null;\n    }\n  )\n);\nwithMeta(insertImageInputRule, {\n  displayName: \"InputRule<insertImageInputRule>\",\n  group: \"Image\"\n});\nconst hardbreakAttr = $nodeAttr(\"hardbreak\", (node) => {\n  return {\n    \"data-type\": \"hardbreak\",\n    \"data-is-inline\": node.attrs.isInline\n  };\n});\nwithMeta(hardbreakAttr, {\n  displayName: \"Attr<hardbreak>\",\n  group: \"Hardbreak\"\n});\nconst hardbreakSchema = $nodeSchema(\"hardbreak\", (ctx) => ({\n  inline: true,\n  group: \"inline\",\n  attrs: {\n    isInline: {\n      default: false\n    }\n  },\n  selectable: false,\n  parseDOM: [\n    { tag: \"br\" },\n    {\n      tag: 'span[data-type=\"hardbreak\"]',\n      getAttrs: () => ({ isInline: true })\n    }\n  ],\n  toDOM: (node) => node.attrs.isInline ? [\"span\", ctx.get(hardbreakAttr.key)(node), \" \"] : [\"br\", ctx.get(hardbreakAttr.key)(node)],\n  parseMarkdown: {\n    match: ({ type }) => type === \"break\",\n    runner: (state, node, type) => {\n      var _a;\n      state.addNode(type, {\n        isInline: Boolean(\n          (_a = node.data) == null ? void 0 : _a.isInline\n        )\n      });\n    }\n  },\n  leafText: () => \"\\n\",\n  toMarkdown: {\n    match: (node) => node.type.name === \"hardbreak\",\n    runner: (state, node) => {\n      if (node.attrs.isInline) state.addNode(\"text\", void 0, \"\\n\");\n      else state.addNode(\"break\");\n    }\n  }\n}));\nwithMeta(hardbreakSchema.node, {\n  displayName: \"NodeSchema<hardbreak>\",\n  group: \"Hardbreak\"\n});\nwithMeta(hardbreakSchema.ctx, {\n  displayName: \"NodeSchemaCtx<hardbreak>\",\n  group: \"Hardbreak\"\n});\nconst insertHardbreakCommand = $command(\n  \"InsertHardbreak\",\n  (ctx) => () => (state, dispatch) => {\n    var _a;\n    const { selection, tr } = state;\n    if (!(selection instanceof TextSelection)) return false;\n    if (selection.empty) {\n      const node = selection.$from.node();\n      if (node.childCount > 0 && ((_a = node.lastChild) == null ? void 0 : _a.type.name) === \"hardbreak\") {\n        dispatch == null ? void 0 : dispatch(\n          tr.replaceRangeWith(\n            selection.to - 1,\n            selection.to,\n            state.schema.node(\"paragraph\")\n          ).setSelection(Selection.near(tr.doc.resolve(selection.to))).scrollIntoView()\n        );\n        return true;\n      }\n    }\n    dispatch == null ? void 0 : dispatch(\n      tr.setMeta(\"hardbreak\", true).replaceSelectionWith(hardbreakSchema.type(ctx).create()).scrollIntoView()\n    );\n    return true;\n  }\n);\nwithMeta(insertHardbreakCommand, {\n  displayName: \"Command<insertHardbreakCommand>\",\n  group: \"Hardbreak\"\n});\nconst hardbreakKeymap = $useKeymap(\"hardbreakKeymap\", {\n  InsertHardbreak: {\n    shortcuts: \"Shift-Enter\",\n    command: (ctx) => {\n      const commands2 = ctx.get(commandsCtx);\n      return () => commands2.call(insertHardbreakCommand.key);\n    }\n  }\n});\nwithMeta(hardbreakKeymap.ctx, {\n  displayName: \"KeymapCtx<hardbreak>\",\n  group: \"Hardbreak\"\n});\nwithMeta(hardbreakKeymap.shortcuts, {\n  displayName: \"Keymap<hardbreak>\",\n  group: \"Hardbreak\"\n});\nconst hrAttr = $nodeAttr(\"hr\");\nwithMeta(hrAttr, {\n  displayName: \"Attr<hr>\",\n  group: \"Hr\"\n});\nconst hrSchema = $nodeSchema(\"hr\", (ctx) => ({\n  group: \"block\",\n  parseDOM: [{ tag: \"hr\" }],\n  toDOM: (node) => [\"hr\", ctx.get(hrAttr.key)(node)],\n  parseMarkdown: {\n    match: ({ type }) => type === \"thematicBreak\",\n    runner: (state, _, type) => {\n      state.addNode(type);\n    }\n  },\n  toMarkdown: {\n    match: (node) => node.type.name === \"hr\",\n    runner: (state) => {\n      state.addNode(\"thematicBreak\");\n    }\n  }\n}));\nwithMeta(hrSchema.node, {\n  displayName: \"NodeSchema<hr>\",\n  group: \"Hr\"\n});\nwithMeta(hrSchema.ctx, {\n  displayName: \"NodeSchemaCtx<hr>\",\n  group: \"Hr\"\n});\nconst insertHrInputRule = $inputRule(\n  (ctx) => new InputRule(/^(?:---|___\\s|\\*\\*\\*\\s)$/, (state, match, start, end) => {\n    const { tr } = state;\n    if (match[0]) tr.replaceWith(start - 1, end, hrSchema.type(ctx).create());\n    return tr;\n  })\n);\nwithMeta(insertHrInputRule, {\n  displayName: \"InputRule<insertHrInputRule>\",\n  group: \"Hr\"\n});\nconst insertHrCommand = $command(\n  \"InsertHr\",\n  (ctx) => () => (state, dispatch) => {\n    if (!dispatch) return true;\n    const paragraph = paragraphSchema.node.type(ctx).create();\n    const { tr, selection } = state;\n    const { from } = selection;\n    const node = hrSchema.type(ctx).create();\n    if (!node) return true;\n    const _tr = tr.replaceSelectionWith(node).insert(from, paragraph);\n    const sel = Selection.findFrom(_tr.doc.resolve(from), 1, true);\n    if (!sel) return true;\n    dispatch(_tr.setSelection(sel).scrollIntoView());\n    return true;\n  }\n);\nwithMeta(insertHrCommand, {\n  displayName: \"Command<insertHrCommand>\",\n  group: \"Hr\"\n});\nconst bulletListAttr = $nodeAttr(\"bulletList\");\nwithMeta(bulletListAttr, {\n  displayName: \"Attr<bulletList>\",\n  group: \"BulletList\"\n});\nconst bulletListSchema = $nodeSchema(\"bullet_list\", (ctx) => {\n  return {\n    content: \"listItem+\",\n    group: \"block\",\n    attrs: {\n      spread: {\n        default: false\n      }\n    },\n    parseDOM: [\n      {\n        tag: \"ul\",\n        getAttrs: (dom) => {\n          if (!(dom instanceof HTMLElement)) throw expectDomTypeError(dom);\n          return {\n            spread: dom.dataset.spread\n          };\n        }\n      }\n    ],\n    toDOM: (node) => {\n      return [\n        \"ul\",\n        {\n          ...ctx.get(bulletListAttr.key)(node),\n          \"data-spread\": node.attrs.spread\n        },\n        0\n      ];\n    },\n    parseMarkdown: {\n      match: ({ type, ordered }) => type === \"list\" && !ordered,\n      runner: (state, node, type) => {\n        const spread = node.spread != null ? `${node.spread}` : \"false\";\n        state.openNode(type, { spread }).next(node.children).closeNode();\n      }\n    },\n    toMarkdown: {\n      match: (node) => node.type.name === \"bullet_list\",\n      runner: (state, node) => {\n        state.openNode(\"list\", void 0, {\n          ordered: false,\n          spread: node.attrs.spread === \"true\"\n        }).next(node.content).closeNode();\n      }\n    }\n  };\n});\nwithMeta(bulletListSchema.node, {\n  displayName: \"NodeSchema<bulletList>\",\n  group: \"BulletList\"\n});\nwithMeta(bulletListSchema.ctx, {\n  displayName: \"NodeSchemaCtx<bulletList>\",\n  group: \"BulletList\"\n});\nconst wrapInBulletListInputRule = $inputRule(\n  (ctx) => wrappingInputRule(/^\\s*([-+*])\\s$/, bulletListSchema.type(ctx))\n);\nwithMeta(wrapInBulletListInputRule, {\n  displayName: \"InputRule<wrapInBulletListInputRule>\",\n  group: \"BulletList\"\n});\nconst wrapInBulletListCommand = $command(\n  \"WrapInBulletList\",\n  (ctx) => () => wrapIn(bulletListSchema.type(ctx))\n);\nwithMeta(wrapInBulletListCommand, {\n  displayName: \"Command<wrapInBulletListCommand>\",\n  group: \"BulletList\"\n});\nconst bulletListKeymap = $useKeymap(\"bulletListKeymap\", {\n  WrapInBulletList: {\n    shortcuts: \"Mod-Alt-8\",\n    command: (ctx) => {\n      const commands2 = ctx.get(commandsCtx);\n      return () => commands2.call(wrapInBulletListCommand.key);\n    }\n  }\n});\nwithMeta(bulletListKeymap.ctx, {\n  displayName: \"KeymapCtx<bulletListKeymap>\",\n  group: \"BulletList\"\n});\nwithMeta(bulletListKeymap.shortcuts, {\n  displayName: \"Keymap<bulletListKeymap>\",\n  group: \"BulletList\"\n});\nconst orderedListAttr = $nodeAttr(\"orderedList\");\nwithMeta(orderedListAttr, {\n  displayName: \"Attr<orderedList>\",\n  group: \"OrderedList\"\n});\nconst orderedListSchema = $nodeSchema(\"ordered_list\", (ctx) => ({\n  content: \"listItem+\",\n  group: \"block\",\n  attrs: {\n    order: {\n      default: 1\n    },\n    spread: {\n      default: false\n    }\n  },\n  parseDOM: [\n    {\n      tag: \"ol\",\n      getAttrs: (dom) => {\n        if (!(dom instanceof HTMLElement)) throw expectDomTypeError(dom);\n        return {\n          spread: dom.dataset.spread,\n          order: dom.hasAttribute(\"start\") ? Number(dom.getAttribute(\"start\")) : 1\n        };\n      }\n    }\n  ],\n  toDOM: (node) => [\n    \"ol\",\n    {\n      ...ctx.get(orderedListAttr.key)(node),\n      ...node.attrs.order === 1 ? {} : node.attrs.order,\n      \"data-spread\": node.attrs.spread\n    },\n    0\n  ],\n  parseMarkdown: {\n    match: ({ type, ordered }) => type === \"list\" && !!ordered,\n    runner: (state, node, type) => {\n      const spread = node.spread != null ? `${node.spread}` : \"true\";\n      state.openNode(type, { spread }).next(node.children).closeNode();\n    }\n  },\n  toMarkdown: {\n    match: (node) => node.type.name === \"ordered_list\",\n    runner: (state, node) => {\n      state.openNode(\"list\", void 0, {\n        ordered: true,\n        start: 1,\n        spread: node.attrs.spread === \"true\"\n      });\n      state.next(node.content);\n      state.closeNode();\n    }\n  }\n}));\nwithMeta(orderedListSchema.node, {\n  displayName: \"NodeSchema<orderedList>\",\n  group: \"OrderedList\"\n});\nwithMeta(orderedListSchema.ctx, {\n  displayName: \"NodeSchemaCtx<orderedList>\",\n  group: \"OrderedList\"\n});\nconst wrapInOrderedListInputRule = $inputRule(\n  (ctx) => wrappingInputRule(\n    /^\\s*(\\d+)\\.\\s$/,\n    orderedListSchema.type(ctx),\n    (match) => ({ order: Number(match[1]) }),\n    (match, node) => node.childCount + node.attrs.order === Number(match[1])\n  )\n);\nwithMeta(wrapInOrderedListInputRule, {\n  displayName: \"InputRule<wrapInOrderedListInputRule>\",\n  group: \"OrderedList\"\n});\nconst wrapInOrderedListCommand = $command(\n  \"WrapInOrderedList\",\n  (ctx) => () => wrapIn(orderedListSchema.type(ctx))\n);\nwithMeta(wrapInOrderedListCommand, {\n  displayName: \"Command<wrapInOrderedListCommand>\",\n  group: \"OrderedList\"\n});\nconst orderedListKeymap = $useKeymap(\"orderedListKeymap\", {\n  WrapInOrderedList: {\n    shortcuts: \"Mod-Alt-7\",\n    command: (ctx) => {\n      const commands2 = ctx.get(commandsCtx);\n      return () => commands2.call(wrapInOrderedListCommand.key);\n    }\n  }\n});\nwithMeta(orderedListKeymap.ctx, {\n  displayName: \"KeymapCtx<orderedList>\",\n  group: \"OrderedList\"\n});\nwithMeta(orderedListKeymap.shortcuts, {\n  displayName: \"Keymap<orderedList>\",\n  group: \"OrderedList\"\n});\nconst listItemAttr = $nodeAttr(\"listItem\");\nwithMeta(listItemAttr, {\n  displayName: \"Attr<listItem>\",\n  group: \"ListItem\"\n});\nconst listItemSchema = $nodeSchema(\"list_item\", (ctx) => ({\n  group: \"listItem\",\n  content: \"paragraph block*\",\n  attrs: {\n    label: {\n      default: \"•\"\n    },\n    listType: {\n      default: \"bullet\"\n    },\n    spread: {\n      default: \"true\"\n    }\n  },\n  defining: true,\n  parseDOM: [\n    {\n      tag: \"li\",\n      getAttrs: (dom) => {\n        if (!(dom instanceof HTMLElement)) throw expectDomTypeError(dom);\n        return {\n          label: dom.dataset.label,\n          listType: dom.dataset.listType,\n          spread: dom.dataset.spread\n        };\n      }\n    }\n  ],\n  toDOM: (node) => [\n    \"li\",\n    {\n      ...ctx.get(listItemAttr.key)(node),\n      \"data-label\": node.attrs.label,\n      \"data-list-type\": node.attrs.listType,\n      \"data-spread\": node.attrs.spread\n    },\n    0\n  ],\n  parseMarkdown: {\n    match: ({ type }) => type === \"listItem\",\n    runner: (state, node, type) => {\n      const label = node.label != null ? `${node.label}.` : \"•\";\n      const listType = node.label != null ? \"ordered\" : \"bullet\";\n      const spread = node.spread != null ? `${node.spread}` : \"true\";\n      state.openNode(type, { label, listType, spread });\n      state.next(node.children);\n      state.closeNode();\n    }\n  },\n  toMarkdown: {\n    match: (node) => node.type.name === \"list_item\",\n    runner: (state, node) => {\n      state.openNode(\"listItem\", void 0, {\n        spread: node.attrs.spread === \"true\"\n      });\n      state.next(node.content);\n      state.closeNode();\n    }\n  }\n}));\nwithMeta(listItemSchema.node, {\n  displayName: \"NodeSchema<listItem>\",\n  group: \"ListItem\"\n});\nwithMeta(listItemSchema.ctx, {\n  displayName: \"NodeSchemaCtx<listItem>\",\n  group: \"ListItem\"\n});\nconst sinkListItemCommand = $command(\n  \"SinkListItem\",\n  (ctx) => () => sinkListItem(listItemSchema.type(ctx))\n);\nwithMeta(sinkListItemCommand, {\n  displayName: \"Command<sinkListItemCommand>\",\n  group: \"ListItem\"\n});\nconst liftListItemCommand = $command(\n  \"LiftListItem\",\n  (ctx) => () => liftListItem(listItemSchema.type(ctx))\n);\nwithMeta(liftListItemCommand, {\n  displayName: \"Command<liftListItemCommand>\",\n  group: \"ListItem\"\n});\nconst splitListItemCommand = $command(\n  \"SplitListItem\",\n  (ctx) => () => splitListItem(listItemSchema.type(ctx))\n);\nwithMeta(splitListItemCommand, {\n  displayName: \"Command<splitListItemCommand>\",\n  group: \"ListItem\"\n});\nfunction liftFirstListItem(ctx) {\n  return (state, dispatch, view) => {\n    const { selection } = state;\n    if (!(selection instanceof TextSelection)) return false;\n    const { empty, $from } = selection;\n    if (!empty || $from.parentOffset !== 0) return false;\n    const parentItem = $from.node(-1);\n    if (parentItem.type !== listItemSchema.type(ctx) || parentItem.firstChild !== $from.node())\n      return false;\n    const list = $from.node(-2);\n    if (list.childCount > 1) return false;\n    return liftListItem(listItemSchema.type(ctx))(state, dispatch, view);\n  };\n}\nconst liftFirstListItemCommand = $command(\n  \"LiftFirstListItem\",\n  (ctx) => () => liftFirstListItem(ctx)\n);\nwithMeta(liftFirstListItemCommand, {\n  displayName: \"Command<liftFirstListItemCommand>\",\n  group: \"ListItem\"\n});\nconst listItemKeymap = $useKeymap(\"listItemKeymap\", {\n  NextListItem: {\n    shortcuts: \"Enter\",\n    command: (ctx) => {\n      const commands2 = ctx.get(commandsCtx);\n      return () => commands2.call(splitListItemCommand.key);\n    }\n  },\n  SinkListItem: {\n    shortcuts: [\"Tab\", \"Mod-]\"],\n    command: (ctx) => {\n      const commands2 = ctx.get(commandsCtx);\n      return () => commands2.call(sinkListItemCommand.key);\n    }\n  },\n  LiftListItem: {\n    shortcuts: [\"Shift-Tab\", \"Mod-[\"],\n    command: (ctx) => {\n      const commands2 = ctx.get(commandsCtx);\n      return () => commands2.call(liftListItemCommand.key);\n    }\n  },\n  LiftFirstListItem: {\n    shortcuts: [\"Backspace\", \"Delete\"],\n    command: (ctx) => {\n      const commands2 = ctx.get(commandsCtx);\n      return () => commands2.call(liftFirstListItemCommand.key);\n    }\n  }\n});\nwithMeta(listItemKeymap.ctx, {\n  displayName: \"KeymapCtx<listItem>\",\n  group: \"ListItem\"\n});\nwithMeta(listItemKeymap.shortcuts, {\n  displayName: \"Keymap<listItem>\",\n  group: \"ListItem\"\n});\nconst textSchema = $node(\"text\", () => ({\n  group: \"inline\",\n  parseMarkdown: {\n    match: ({ type }) => type === \"text\",\n    runner: (state, node) => {\n      state.addText(node.value);\n    }\n  },\n  toMarkdown: {\n    match: (node) => node.type.name === \"text\",\n    runner: (state, node) => {\n      state.addNode(\"text\", void 0, node.text);\n    }\n  }\n}));\nwithMeta(textSchema, {\n  displayName: \"NodeSchema<text>\",\n  group: \"Text\"\n});\nconst htmlAttr = $nodeAttr(\"html\");\nwithMeta(htmlAttr, {\n  displayName: \"Attr<html>\",\n  group: \"Html\"\n});\nconst htmlSchema = $nodeSchema(\"html\", (ctx) => {\n  return {\n    atom: true,\n    group: \"inline\",\n    inline: true,\n    attrs: {\n      value: {\n        default: \"\"\n      }\n    },\n    toDOM: (node) => {\n      const span = document.createElement(\"span\");\n      const attr = {\n        ...ctx.get(htmlAttr.key)(node),\n        \"data-value\": node.attrs.value,\n        \"data-type\": \"html\"\n      };\n      span.textContent = node.attrs.value;\n      return [\"span\", attr, node.attrs.value];\n    },\n    parseDOM: [\n      {\n        tag: 'span[data-type=\"html\"]',\n        getAttrs: (dom) => {\n          return {\n            value: dom.dataset.value ?? \"\"\n          };\n        }\n      }\n    ],\n    parseMarkdown: {\n      match: ({ type }) => Boolean(type === \"html\"),\n      runner: (state, node, type) => {\n        state.addNode(type, { value: node.value });\n      }\n    },\n    toMarkdown: {\n      match: (node) => node.type.name === \"html\",\n      runner: (state, node) => {\n        state.addNode(\"html\", void 0, node.attrs.value);\n      }\n    }\n  };\n});\nwithMeta(htmlSchema.node, {\n  displayName: \"NodeSchema<html>\",\n  group: \"Html\"\n});\nwithMeta(htmlSchema.ctx, {\n  displayName: \"NodeSchemaCtx<html>\",\n  group: \"Html\"\n});\nconst schema = [\n  docSchema,\n  paragraphAttr,\n  paragraphSchema,\n  headingIdGenerator,\n  headingAttr,\n  headingSchema,\n  hardbreakAttr,\n  hardbreakSchema,\n  blockquoteAttr,\n  blockquoteSchema,\n  codeBlockAttr,\n  codeBlockSchema,\n  hrAttr,\n  hrSchema,\n  imageAttr,\n  imageSchema,\n  bulletListAttr,\n  bulletListSchema,\n  orderedListAttr,\n  orderedListSchema,\n  listItemAttr,\n  listItemSchema,\n  emphasisAttr,\n  emphasisSchema,\n  strongAttr,\n  strongSchema,\n  inlineCodeAttr,\n  inlineCodeSchema,\n  linkAttr,\n  linkSchema,\n  htmlAttr,\n  htmlSchema,\n  textSchema\n].flat();\nconst inputRules = [\n  wrapInBlockquoteInputRule,\n  wrapInBulletListInputRule,\n  wrapInOrderedListInputRule,\n  createCodeBlockInputRule,\n  insertHrInputRule,\n  wrapInHeadingInputRule\n].flat();\nconst markInputRules = [\n  emphasisStarInputRule,\n  emphasisUnderscoreInputRule,\n  inlineCodeInputRule,\n  strongInputRule\n];\nconst commands = [\n  turnIntoTextCommand,\n  wrapInBlockquoteCommand,\n  wrapInHeadingCommand,\n  downgradeHeadingCommand,\n  createCodeBlockCommand,\n  insertHardbreakCommand,\n  insertHrCommand,\n  insertImageCommand,\n  updateImageCommand,\n  wrapInOrderedListCommand,\n  wrapInBulletListCommand,\n  sinkListItemCommand,\n  splitListItemCommand,\n  liftListItemCommand,\n  liftFirstListItemCommand,\n  toggleEmphasisCommand,\n  toggleInlineCodeCommand,\n  toggleStrongCommand,\n  toggleLinkCommand,\n  updateLinkCommand\n];\nconst keymap = [\n  blockquoteKeymap,\n  codeBlockKeymap,\n  hardbreakKeymap,\n  headingKeymap,\n  listItemKeymap,\n  orderedListKeymap,\n  bulletListKeymap,\n  paragraphKeymap,\n  emphasisKeymap,\n  inlineCodeKeymap,\n  strongKeymap\n].flat();\nconst remarkAddOrderInListPlugin = $remark(\n  \"remarkAddOrderInList\",\n  () => () => (tree) => {\n    visit(tree, \"list\", (node) => {\n      if (node.ordered) {\n        const start = node.start ?? 1;\n        node.children.forEach((child, index) => {\n          child.label = index + start;\n        });\n      }\n    });\n  }\n);\nwithMeta(remarkAddOrderInListPlugin.plugin, {\n  displayName: \"Remark<remarkAddOrderInListPlugin>\",\n  group: \"Remark\"\n});\nwithMeta(remarkAddOrderInListPlugin.options, {\n  displayName: \"RemarkConfig<remarkAddOrderInListPlugin>\",\n  group: \"Remark\"\n});\nconst remarkLineBreak = $remark(\n  \"remarkLineBreak\",\n  () => () => (tree) => {\n    const find = /[\\t ]*(?:\\r?\\n|\\r)/g;\n    visit(\n      tree,\n      \"text\",\n      (node, index, parent) => {\n        if (!node.value || typeof node.value !== \"string\") return;\n        const result = [];\n        let start = 0;\n        find.lastIndex = 0;\n        let match = find.exec(node.value);\n        while (match) {\n          const position = match.index;\n          if (start !== position)\n            result.push({\n              type: \"text\",\n              value: node.value.slice(start, position)\n            });\n          result.push({ type: \"break\", data: { isInline: true } });\n          start = position + match[0].length;\n          match = find.exec(node.value);\n        }\n        const hasResultAndIndex = result.length > 0 && parent && typeof index === \"number\";\n        if (!hasResultAndIndex) return;\n        if (start < node.value.length)\n          result.push({ type: \"text\", value: node.value.slice(start) });\n        parent.children.splice(index, 1, ...result);\n        return index + result.length;\n      }\n    );\n  }\n);\nwithMeta(remarkLineBreak.plugin, {\n  displayName: \"Remark<remarkLineBreak>\",\n  group: \"Remark\"\n});\nwithMeta(remarkLineBreak.options, {\n  displayName: \"RemarkConfig<remarkLineBreak>\",\n  group: \"Remark\"\n});\nconst remarkInlineLinkPlugin = $remark(\n  \"remarkInlineLink\",\n  () => remarkInlineLinks\n);\nwithMeta(remarkInlineLinkPlugin.plugin, {\n  displayName: \"Remark<remarkInlineLinkPlugin>\",\n  group: \"Remark\"\n});\nwithMeta(remarkInlineLinkPlugin.options, {\n  displayName: \"RemarkConfig<remarkInlineLinkPlugin>\",\n  group: \"Remark\"\n});\nconst isParent = (node) => !!node.children;\nconst isHTML = (node) => node.type === \"html\";\nfunction flatMapWithDepth(ast, fn) {\n  return transform(ast, 0, null)[0];\n  function transform(node, index, parent) {\n    if (isParent(node)) {\n      const out = [];\n      for (let i = 0, n = node.children.length; i < n; i++) {\n        const nthChild = node.children[i];\n        if (nthChild) {\n          const xs = transform(nthChild, i, node);\n          if (xs) {\n            for (let j = 0, m = xs.length; j < m; j++) {\n              const item = xs[j];\n              if (item) out.push(item);\n            }\n          }\n        }\n      }\n      node.children = out;\n    }\n    return fn(node, index, parent);\n  }\n}\nconst remarkHtmlTransformer = $remark(\n  \"remarkHTMLTransformer\",\n  () => () => (tree) => {\n    flatMapWithDepth(tree, (node, _index, parent) => {\n      if (!isHTML(node)) return [node];\n      if ((parent == null ? void 0 : parent.type) === \"root\") {\n        node.children = [{ ...node }];\n        delete node.value;\n        node.type = \"paragraph\";\n      }\n      return [node];\n    });\n  }\n);\nwithMeta(remarkHtmlTransformer.plugin, {\n  displayName: \"Remark<remarkHtmlTransformer>\",\n  group: \"Remark\"\n});\nwithMeta(remarkHtmlTransformer.options, {\n  displayName: \"RemarkConfig<remarkHtmlTransformer>\",\n  group: \"Remark\"\n});\nconst remarkMarker = $remark(\n  \"remarkMarker\",\n  () => () => (tree, file) => {\n    const getMarker = (node) => {\n      return file.value.charAt(node.position.start.offset);\n    };\n    visit(\n      tree,\n      (node) => [\"strong\", \"emphasis\"].includes(node.type),\n      (node) => {\n        node.marker = getMarker(node);\n      }\n    );\n  }\n);\nwithMeta(remarkMarker.plugin, {\n  displayName: \"Remark<remarkMarker>\",\n  group: \"Remark\"\n});\nwithMeta(remarkMarker.options, {\n  displayName: \"RemarkConfig<remarkMarker>\",\n  group: \"Remark\"\n});\nconst inlineNodesCursorPlugin = $prose(() => {\n  let lock = false;\n  const inlineNodesCursorPluginKey = new PluginKey(\n    \"MILKDOWN_INLINE_NODES_CURSOR\"\n  );\n  const inlineNodesCursorPlugin2 = new Plugin({\n    key: inlineNodesCursorPluginKey,\n    state: {\n      init() {\n        return false;\n      },\n      apply(tr) {\n        if (!tr.selection.empty) return false;\n        const pos = tr.selection.$from;\n        const left = pos.nodeBefore;\n        const right = pos.nodeAfter;\n        if (left && right && left.isInline && !left.isText && right.isInline && !right.isText)\n          return true;\n        return false;\n      }\n    },\n    props: {\n      handleDOMEvents: {\n        compositionend: (view, e) => {\n          if (lock) {\n            lock = false;\n            requestAnimationFrame(() => {\n              const active = inlineNodesCursorPlugin2.getState(view.state);\n              if (active) {\n                const from = view.state.selection.from;\n                e.preventDefault();\n                view.dispatch(view.state.tr.insertText(e.data || \"\", from));\n              }\n            });\n            return true;\n          }\n          return false;\n        },\n        compositionstart: (view) => {\n          const active = inlineNodesCursorPlugin2.getState(view.state);\n          if (active) lock = true;\n          return false;\n        },\n        beforeinput: (view, e) => {\n          const active = inlineNodesCursorPlugin2.getState(view.state);\n          if (active && e instanceof InputEvent && e.data && !lock) {\n            const from = view.state.selection.from;\n            e.preventDefault();\n            view.dispatch(view.state.tr.insertText(e.data || \"\", from));\n            return true;\n          }\n          return false;\n        }\n      },\n      decorations(state) {\n        const active = inlineNodesCursorPlugin2.getState(state);\n        if (active) {\n          const pos = state.selection.$from;\n          const position = pos.pos;\n          const left = document.createElement(\"span\");\n          const leftDec = Decoration.widget(position, left, {\n            side: -1\n          });\n          const right = document.createElement(\"span\");\n          const rightDec = Decoration.widget(position, right);\n          setTimeout(() => {\n            left.contentEditable = \"true\";\n            right.contentEditable = \"true\";\n          });\n          return DecorationSet.create(state.doc, [leftDec, rightDec]);\n        }\n        return DecorationSet.empty;\n      }\n    }\n  });\n  return inlineNodesCursorPlugin2;\n});\nwithMeta(inlineNodesCursorPlugin, {\n  displayName: \"Prose<inlineNodesCursorPlugin>\",\n  group: \"Prose\"\n});\nconst hardbreakClearMarkPlugin = $prose((ctx) => {\n  return new Plugin({\n    key: new PluginKey(\"MILKDOWN_HARDBREAK_MARKS\"),\n    appendTransaction: (trs, _oldState, newState) => {\n      if (!trs.length) return;\n      const [tr] = trs;\n      if (!tr) return;\n      const [step] = tr.steps;\n      const isInsertHr = tr.getMeta(\"hardbreak\");\n      if (isInsertHr) {\n        if (!(step instanceof ReplaceStep)) return;\n        const { from } = step;\n        return newState.tr.setNodeMarkup(\n          from,\n          hardbreakSchema.type(ctx),\n          void 0,\n          []\n        );\n      }\n      const isAddMarkStep = step instanceof AddMarkStep;\n      if (isAddMarkStep) {\n        let _tr = newState.tr;\n        const { from, to } = step;\n        newState.doc.nodesBetween(from, to, (node, pos) => {\n          if (node.type === hardbreakSchema.type(ctx))\n            _tr = _tr.setNodeMarkup(\n              pos,\n              hardbreakSchema.type(ctx),\n              void 0,\n              []\n            );\n        });\n        return _tr;\n      }\n      return void 0;\n    }\n  });\n});\nwithMeta(hardbreakClearMarkPlugin, {\n  displayName: \"Prose<hardbreakClearMarkPlugin>\",\n  group: \"Prose\"\n});\nconst hardbreakFilterNodes = $ctx(\n  [\"table\", \"code_block\"],\n  \"hardbreakFilterNodes\"\n);\nwithMeta(hardbreakFilterNodes, {\n  displayName: \"Ctx<hardbreakFilterNodes>\",\n  group: \"Prose\"\n});\nconst hardbreakFilterPlugin = $prose((ctx) => {\n  const notIn = ctx.get(hardbreakFilterNodes.key);\n  return new Plugin({\n    key: new PluginKey(\"MILKDOWN_HARDBREAK_FILTER\"),\n    filterTransaction: (tr, state) => {\n      const isInsertHr = tr.getMeta(\"hardbreak\");\n      const [step] = tr.steps;\n      if (isInsertHr && step) {\n        const { from } = step;\n        const $from = state.doc.resolve(from);\n        let curDepth = $from.depth;\n        let canApply = true;\n        while (curDepth > 0) {\n          if (notIn.includes($from.node(curDepth).type.name)) canApply = false;\n          curDepth--;\n        }\n        return canApply;\n      }\n      return true;\n    }\n  });\n});\nwithMeta(hardbreakFilterPlugin, {\n  displayName: \"Prose<hardbreakFilterPlugin>\",\n  group: \"Prose\"\n});\nconst syncHeadingIdPlugin = $prose((ctx) => {\n  const headingIdPluginKey = new PluginKey(\"MILKDOWN_HEADING_ID\");\n  const updateId = (view) => {\n    if (view.composing) return;\n    const getId = ctx.get(headingIdGenerator.key);\n    const tr = view.state.tr.setMeta(\"addToHistory\", false);\n    let found = false;\n    const idMap = {};\n    view.state.doc.descendants((node, pos) => {\n      if (node.type === headingSchema.type(ctx)) {\n        if (node.textContent.trim().length === 0) return;\n        const attrs = node.attrs;\n        let id = getId(node);\n        if (idMap[id]) {\n          idMap[id] += 1;\n          id += `-#${idMap[id]}`;\n        } else {\n          idMap[id] = 1;\n        }\n        if (attrs.id !== id) {\n          found = true;\n          tr.setMeta(headingIdPluginKey, true).setNodeMarkup(pos, void 0, {\n            ...attrs,\n            id\n          });\n        }\n      }\n    });\n    if (found) view.dispatch(tr);\n  };\n  return new Plugin({\n    key: headingIdPluginKey,\n    view: (view) => {\n      updateId(view);\n      return {\n        update: (view2, prevState) => {\n          if (view2.state.doc.eq(prevState.doc)) return;\n          updateId(view2);\n        }\n      };\n    }\n  });\n});\nwithMeta(syncHeadingIdPlugin, {\n  displayName: \"Prose<syncHeadingIdPlugin>\",\n  group: \"Prose\"\n});\nconst syncListOrderPlugin = $prose((ctx) => {\n  const syncOrderLabel = (view) => {\n    if (view.composing || !view.editable) return;\n    const orderedListType = orderedListSchema.type(ctx);\n    const bulletListType = bulletListSchema.type(ctx);\n    const listItemType = listItemSchema.type(ctx);\n    const state = view.state;\n    const handleNodeItem = (attrs, index) => {\n      let changed = false;\n      const expectedLabel = `${index + 1}.`;\n      if (attrs.label !== expectedLabel) {\n        attrs.label = expectedLabel;\n        changed = true;\n      }\n      return changed;\n    };\n    let tr = state.tr;\n    let needDispatch = false;\n    state.doc.descendants((node, pos, parent, index) => {\n      if (node.type === bulletListType) {\n        const base = node.maybeChild(0);\n        if ((base == null ? void 0 : base.type) === listItemType && base.attrs.listType === \"ordered\") {\n          needDispatch = true;\n          tr.setNodeMarkup(pos, orderedListType, { spread: \"true\" });\n          node.descendants((child, pos2, _parent, index2) => {\n            if (child.type === listItemType) {\n              const attrs = { ...child.attrs };\n              const changed = handleNodeItem(attrs, index2);\n              if (changed) tr = tr.setNodeMarkup(pos2, void 0, attrs);\n            }\n            return false;\n          });\n        }\n      } else if (node.type === listItemType && (parent == null ? void 0 : parent.type) === orderedListType) {\n        const attrs = { ...node.attrs };\n        let changed = false;\n        if (attrs.listType !== \"ordered\") {\n          attrs.listType = \"ordered\";\n          changed = true;\n        }\n        const base = parent == null ? void 0 : parent.maybeChild(0);\n        if (base) changed = handleNodeItem(attrs, index);\n        if (changed) {\n          tr = tr.setNodeMarkup(pos, void 0, attrs);\n          needDispatch = true;\n        }\n      }\n    });\n    if (needDispatch) view.dispatch(tr.setMeta(\"addToHistory\", false));\n  };\n  return new Plugin({\n    key: new PluginKey(\"MILKDOWN_KEEP_LIST_ORDER\"),\n    view: (view) => {\n      syncOrderLabel(view);\n      return {\n        update: (view2) => {\n          syncOrderLabel(view2);\n        }\n      };\n    }\n  });\n});\nwithMeta(syncListOrderPlugin, {\n  displayName: \"Prose<syncListOrderPlugin>\",\n  group: \"Prose\"\n});\nconst plugins = [\n  hardbreakClearMarkPlugin,\n  hardbreakFilterNodes,\n  hardbreakFilterPlugin,\n  inlineNodesCursorPlugin,\n  remarkAddOrderInListPlugin,\n  remarkInlineLinkPlugin,\n  remarkLineBreak,\n  remarkHtmlTransformer,\n  remarkMarker,\n  remarkPreserveEmptyLinePlugin,\n  syncHeadingIdPlugin,\n  syncListOrderPlugin\n].flat();\nconst commonmark = [\n  schema,\n  inputRules,\n  markInputRules,\n  commands,\n  keymap,\n  plugins\n].flat();\nexport {\n  blockquoteAttr,\n  blockquoteKeymap,\n  blockquoteSchema,\n  bulletListAttr,\n  bulletListKeymap,\n  bulletListSchema,\n  codeBlockAttr,\n  codeBlockKeymap,\n  codeBlockSchema,\n  commands,\n  commonmark,\n  createCodeBlockCommand,\n  createCodeBlockInputRule,\n  docSchema,\n  downgradeHeadingCommand,\n  emphasisAttr,\n  emphasisKeymap,\n  emphasisSchema,\n  emphasisStarInputRule,\n  emphasisUnderscoreInputRule,\n  hardbreakAttr,\n  hardbreakClearMarkPlugin,\n  hardbreakFilterNodes,\n  hardbreakFilterPlugin,\n  hardbreakKeymap,\n  hardbreakSchema,\n  headingAttr,\n  headingIdGenerator,\n  headingKeymap,\n  headingSchema,\n  hrAttr,\n  hrSchema,\n  htmlAttr,\n  htmlSchema,\n  imageAttr,\n  imageSchema,\n  inlineCodeAttr,\n  inlineCodeInputRule,\n  inlineCodeKeymap,\n  inlineCodeSchema,\n  inlineNodesCursorPlugin,\n  inputRules,\n  insertHardbreakCommand,\n  insertHrCommand,\n  insertHrInputRule,\n  insertImageCommand,\n  insertImageInputRule,\n  keymap,\n  liftFirstListItemCommand,\n  liftListItemCommand,\n  linkAttr,\n  linkSchema,\n  listItemAttr,\n  listItemKeymap,\n  listItemSchema,\n  markInputRules,\n  orderedListAttr,\n  orderedListKeymap,\n  orderedListSchema,\n  paragraphAttr,\n  paragraphKeymap,\n  paragraphSchema,\n  plugins,\n  remarkAddOrderInListPlugin,\n  remarkHtmlTransformer,\n  remarkInlineLinkPlugin,\n  remarkLineBreak,\n  remarkMarker,\n  remarkPreserveEmptyLinePlugin,\n  schema,\n  sinkListItemCommand,\n  splitListItemCommand,\n  strongAttr,\n  strongInputRule,\n  strongKeymap,\n  strongSchema,\n  syncHeadingIdPlugin,\n  syncListOrderPlugin,\n  textSchema,\n  toggleEmphasisCommand,\n  toggleInlineCodeCommand,\n  toggleLinkCommand,\n  toggleStrongCommand,\n  turnIntoTextCommand,\n  updateCodeBlockLanguageCommand,\n  updateImageCommand,\n  updateLinkCommand,\n  wrapInBlockquoteCommand,\n  wrapInBlockquoteInputRule,\n  wrapInBulletListCommand,\n  wrapInBulletListInputRule,\n  wrapInHeadingCommand,\n  wrapInHeadingInputRule,\n  wrapInOrderedListCommand,\n  wrapInOrderedListInputRule\n};\n//# sourceMappingURL=index.es.js.map\n","var GOOD_LEAF_SIZE = 200;\n\n// :: class<T> A rope sequence is a persistent sequence data structure\n// that supports appending, prepending, and slicing without doing a\n// full copy. It is represented as a mostly-balanced tree.\nvar RopeSequence = function RopeSequence () {};\n\nRopeSequence.prototype.append = function append (other) {\n  if (!other.length) { return this }\n  other = RopeSequence.from(other);\n\n  return (!this.length && other) ||\n    (other.length < GOOD_LEAF_SIZE && this.leafAppend(other)) ||\n    (this.length < GOOD_LEAF_SIZE && other.leafPrepend(this)) ||\n    this.appendInner(other)\n};\n\n// :: (union<[T], RopeSequence<T>>) → RopeSequence<T>\n// Prepend an array or other rope to this one, returning a new rope.\nRopeSequence.prototype.prepend = function prepend (other) {\n  if (!other.length) { return this }\n  return RopeSequence.from(other).append(this)\n};\n\nRopeSequence.prototype.appendInner = function appendInner (other) {\n  return new Append(this, other)\n};\n\n// :: (?number, ?number) → RopeSequence<T>\n// Create a rope repesenting a sub-sequence of this rope.\nRopeSequence.prototype.slice = function slice (from, to) {\n    if ( from === void 0 ) from = 0;\n    if ( to === void 0 ) to = this.length;\n\n  if (from >= to) { return RopeSequence.empty }\n  return this.sliceInner(Math.max(0, from), Math.min(this.length, to))\n};\n\n// :: (number) → T\n// Retrieve the element at the given position from this rope.\nRopeSequence.prototype.get = function get (i) {\n  if (i < 0 || i >= this.length) { return undefined }\n  return this.getInner(i)\n};\n\n// :: ((element: T, index: number) → ?bool, ?number, ?number)\n// Call the given function for each element between the given\n// indices. This tends to be more efficient than looping over the\n// indices and calling `get`, because it doesn't have to descend the\n// tree for every element.\nRopeSequence.prototype.forEach = function forEach (f, from, to) {\n    if ( from === void 0 ) from = 0;\n    if ( to === void 0 ) to = this.length;\n\n  if (from <= to)\n    { this.forEachInner(f, from, to, 0); }\n  else\n    { this.forEachInvertedInner(f, from, to, 0); }\n};\n\n// :: ((element: T, index: number) → U, ?number, ?number) → [U]\n// Map the given functions over the elements of the rope, producing\n// a flat array.\nRopeSequence.prototype.map = function map (f, from, to) {\n    if ( from === void 0 ) from = 0;\n    if ( to === void 0 ) to = this.length;\n\n  var result = [];\n  this.forEach(function (elt, i) { return result.push(f(elt, i)); }, from, to);\n  return result\n};\n\n// :: (?union<[T], RopeSequence<T>>) → RopeSequence<T>\n// Create a rope representing the given array, or return the rope\n// itself if a rope was given.\nRopeSequence.from = function from (values) {\n  if (values instanceof RopeSequence) { return values }\n  return values && values.length ? new Leaf(values) : RopeSequence.empty\n};\n\nvar Leaf = /*@__PURE__*/(function (RopeSequence) {\n  function Leaf(values) {\n    RopeSequence.call(this);\n    this.values = values;\n  }\n\n  if ( RopeSequence ) Leaf.__proto__ = RopeSequence;\n  Leaf.prototype = Object.create( RopeSequence && RopeSequence.prototype );\n  Leaf.prototype.constructor = Leaf;\n\n  var prototypeAccessors = { length: { configurable: true },depth: { configurable: true } };\n\n  Leaf.prototype.flatten = function flatten () {\n    return this.values\n  };\n\n  Leaf.prototype.sliceInner = function sliceInner (from, to) {\n    if (from == 0 && to == this.length) { return this }\n    return new Leaf(this.values.slice(from, to))\n  };\n\n  Leaf.prototype.getInner = function getInner (i) {\n    return this.values[i]\n  };\n\n  Leaf.prototype.forEachInner = function forEachInner (f, from, to, start) {\n    for (var i = from; i < to; i++)\n      { if (f(this.values[i], start + i) === false) { return false } }\n  };\n\n  Leaf.prototype.forEachInvertedInner = function forEachInvertedInner (f, from, to, start) {\n    for (var i = from - 1; i >= to; i--)\n      { if (f(this.values[i], start + i) === false) { return false } }\n  };\n\n  Leaf.prototype.leafAppend = function leafAppend (other) {\n    if (this.length + other.length <= GOOD_LEAF_SIZE)\n      { return new Leaf(this.values.concat(other.flatten())) }\n  };\n\n  Leaf.prototype.leafPrepend = function leafPrepend (other) {\n    if (this.length + other.length <= GOOD_LEAF_SIZE)\n      { return new Leaf(other.flatten().concat(this.values)) }\n  };\n\n  prototypeAccessors.length.get = function () { return this.values.length };\n\n  prototypeAccessors.depth.get = function () { return 0 };\n\n  Object.defineProperties( Leaf.prototype, prototypeAccessors );\n\n  return Leaf;\n}(RopeSequence));\n\n// :: RopeSequence\n// The empty rope sequence.\nRopeSequence.empty = new Leaf([]);\n\nvar Append = /*@__PURE__*/(function (RopeSequence) {\n  function Append(left, right) {\n    RopeSequence.call(this);\n    this.left = left;\n    this.right = right;\n    this.length = left.length + right.length;\n    this.depth = Math.max(left.depth, right.depth) + 1;\n  }\n\n  if ( RopeSequence ) Append.__proto__ = RopeSequence;\n  Append.prototype = Object.create( RopeSequence && RopeSequence.prototype );\n  Append.prototype.constructor = Append;\n\n  Append.prototype.flatten = function flatten () {\n    return this.left.flatten().concat(this.right.flatten())\n  };\n\n  Append.prototype.getInner = function getInner (i) {\n    return i < this.left.length ? this.left.get(i) : this.right.get(i - this.left.length)\n  };\n\n  Append.prototype.forEachInner = function forEachInner (f, from, to, start) {\n    var leftLen = this.left.length;\n    if (from < leftLen &&\n        this.left.forEachInner(f, from, Math.min(to, leftLen), start) === false)\n      { return false }\n    if (to > leftLen &&\n        this.right.forEachInner(f, Math.max(from - leftLen, 0), Math.min(this.length, to) - leftLen, start + leftLen) === false)\n      { return false }\n  };\n\n  Append.prototype.forEachInvertedInner = function forEachInvertedInner (f, from, to, start) {\n    var leftLen = this.left.length;\n    if (from > leftLen &&\n        this.right.forEachInvertedInner(f, from - leftLen, Math.max(to, leftLen) - leftLen, start + leftLen) === false)\n      { return false }\n    if (to < leftLen &&\n        this.left.forEachInvertedInner(f, Math.min(from, leftLen), to, start) === false)\n      { return false }\n  };\n\n  Append.prototype.sliceInner = function sliceInner (from, to) {\n    if (from == 0 && to == this.length) { return this }\n    var leftLen = this.left.length;\n    if (to <= leftLen) { return this.left.slice(from, to) }\n    if (from >= leftLen) { return this.right.slice(from - leftLen, to - leftLen) }\n    return this.left.slice(from, leftLen).append(this.right.slice(0, to - leftLen))\n  };\n\n  Append.prototype.leafAppend = function leafAppend (other) {\n    var inner = this.right.leafAppend(other);\n    if (inner) { return new Append(this.left, inner) }\n  };\n\n  Append.prototype.leafPrepend = function leafPrepend (other) {\n    var inner = this.left.leafPrepend(other);\n    if (inner) { return new Append(inner, this.right) }\n  };\n\n  Append.prototype.appendInner = function appendInner (other) {\n    if (this.left.depth >= Math.max(this.right.depth, other.depth) + 1)\n      { return new Append(this.left, new Append(this.right, other)) }\n    return new Append(this, other)\n  };\n\n  return Append;\n}(RopeSequence));\n\nexport default RopeSequence;\n","import RopeSequence from 'rope-sequence';\nimport { Mapping } from 'prosemirror-transform';\nimport { PluginKey, Plugin } from 'prosemirror-state';\n\n// ProseMirror's history isn't simply a way to roll back to a previous\n// state, because ProseMirror supports applying changes without adding\n// them to the history (for example during collaboration).\n//\n// To this end, each 'Branch' (one for the undo history and one for\n// the redo history) keeps an array of 'Items', which can optionally\n// hold a step (an actual undoable change), and always hold a position\n// map (which is needed to move changes below them to apply to the\n// current document).\n//\n// An item that has both a step and a selection bookmark is the start\n// of an 'event' — a group of changes that will be undone or redone at\n// once. (It stores only the bookmark, since that way we don't have to\n// provide a document until the selection is actually applied, which\n// is useful when compressing.)\n// Used to schedule history compression\nconst max_empty_items = 500;\nclass Branch {\n    constructor(items, eventCount) {\n        this.items = items;\n        this.eventCount = eventCount;\n    }\n    // Pop the latest event off the branch's history and apply it\n    // to a document transform.\n    popEvent(state, preserveItems) {\n        if (this.eventCount == 0)\n            return null;\n        let end = this.items.length;\n        for (;; end--) {\n            let next = this.items.get(end - 1);\n            if (next.selection) {\n                --end;\n                break;\n            }\n        }\n        let remap, mapFrom;\n        if (preserveItems) {\n            remap = this.remapping(end, this.items.length);\n            mapFrom = remap.maps.length;\n        }\n        let transform = state.tr;\n        let selection, remaining;\n        let addAfter = [], addBefore = [];\n        this.items.forEach((item, i) => {\n            if (!item.step) {\n                if (!remap) {\n                    remap = this.remapping(end, i + 1);\n                    mapFrom = remap.maps.length;\n                }\n                mapFrom--;\n                addBefore.push(item);\n                return;\n            }\n            if (remap) {\n                addBefore.push(new Item(item.map));\n                let step = item.step.map(remap.slice(mapFrom)), map;\n                if (step && transform.maybeStep(step).doc) {\n                    map = transform.mapping.maps[transform.mapping.maps.length - 1];\n                    addAfter.push(new Item(map, undefined, undefined, addAfter.length + addBefore.length));\n                }\n                mapFrom--;\n                if (map)\n                    remap.appendMap(map, mapFrom);\n            }\n            else {\n                transform.maybeStep(item.step);\n            }\n            if (item.selection) {\n                selection = remap ? item.selection.map(remap.slice(mapFrom)) : item.selection;\n                remaining = new Branch(this.items.slice(0, end).append(addBefore.reverse().concat(addAfter)), this.eventCount - 1);\n                return false;\n            }\n        }, this.items.length, 0);\n        return { remaining: remaining, transform, selection: selection };\n    }\n    // Create a new branch with the given transform added.\n    addTransform(transform, selection, histOptions, preserveItems) {\n        let newItems = [], eventCount = this.eventCount;\n        let oldItems = this.items, lastItem = !preserveItems && oldItems.length ? oldItems.get(oldItems.length - 1) : null;\n        for (let i = 0; i < transform.steps.length; i++) {\n            let step = transform.steps[i].invert(transform.docs[i]);\n            let item = new Item(transform.mapping.maps[i], step, selection), merged;\n            if (merged = lastItem && lastItem.merge(item)) {\n                item = merged;\n                if (i)\n                    newItems.pop();\n                else\n                    oldItems = oldItems.slice(0, oldItems.length - 1);\n            }\n            newItems.push(item);\n            if (selection) {\n                eventCount++;\n                selection = undefined;\n            }\n            if (!preserveItems)\n                lastItem = item;\n        }\n        let overflow = eventCount - histOptions.depth;\n        if (overflow > DEPTH_OVERFLOW) {\n            oldItems = cutOffEvents(oldItems, overflow);\n            eventCount -= overflow;\n        }\n        return new Branch(oldItems.append(newItems), eventCount);\n    }\n    remapping(from, to) {\n        let maps = new Mapping;\n        this.items.forEach((item, i) => {\n            let mirrorPos = item.mirrorOffset != null && i - item.mirrorOffset >= from\n                ? maps.maps.length - item.mirrorOffset : undefined;\n            maps.appendMap(item.map, mirrorPos);\n        }, from, to);\n        return maps;\n    }\n    addMaps(array) {\n        if (this.eventCount == 0)\n            return this;\n        return new Branch(this.items.append(array.map(map => new Item(map))), this.eventCount);\n    }\n    // When the collab module receives remote changes, the history has\n    // to know about those, so that it can adjust the steps that were\n    // rebased on top of the remote changes, and include the position\n    // maps for the remote changes in its array of items.\n    rebased(rebasedTransform, rebasedCount) {\n        if (!this.eventCount)\n            return this;\n        let rebasedItems = [], start = Math.max(0, this.items.length - rebasedCount);\n        let mapping = rebasedTransform.mapping;\n        let newUntil = rebasedTransform.steps.length;\n        let eventCount = this.eventCount;\n        this.items.forEach(item => { if (item.selection)\n            eventCount--; }, start);\n        let iRebased = rebasedCount;\n        this.items.forEach(item => {\n            let pos = mapping.getMirror(--iRebased);\n            if (pos == null)\n                return;\n            newUntil = Math.min(newUntil, pos);\n            let map = mapping.maps[pos];\n            if (item.step) {\n                let step = rebasedTransform.steps[pos].invert(rebasedTransform.docs[pos]);\n                let selection = item.selection && item.selection.map(mapping.slice(iRebased + 1, pos));\n                if (selection)\n                    eventCount++;\n                rebasedItems.push(new Item(map, step, selection));\n            }\n            else {\n                rebasedItems.push(new Item(map));\n            }\n        }, start);\n        let newMaps = [];\n        for (let i = rebasedCount; i < newUntil; i++)\n            newMaps.push(new Item(mapping.maps[i]));\n        let items = this.items.slice(0, start).append(newMaps).append(rebasedItems);\n        let branch = new Branch(items, eventCount);\n        if (branch.emptyItemCount() > max_empty_items)\n            branch = branch.compress(this.items.length - rebasedItems.length);\n        return branch;\n    }\n    emptyItemCount() {\n        let count = 0;\n        this.items.forEach(item => { if (!item.step)\n            count++; });\n        return count;\n    }\n    // Compressing a branch means rewriting it to push the air (map-only\n    // items) out. During collaboration, these naturally accumulate\n    // because each remote change adds one. The `upto` argument is used\n    // to ensure that only the items below a given level are compressed,\n    // because `rebased` relies on a clean, untouched set of items in\n    // order to associate old items with rebased steps.\n    compress(upto = this.items.length) {\n        let remap = this.remapping(0, upto), mapFrom = remap.maps.length;\n        let items = [], events = 0;\n        this.items.forEach((item, i) => {\n            if (i >= upto) {\n                items.push(item);\n                if (item.selection)\n                    events++;\n            }\n            else if (item.step) {\n                let step = item.step.map(remap.slice(mapFrom)), map = step && step.getMap();\n                mapFrom--;\n                if (map)\n                    remap.appendMap(map, mapFrom);\n                if (step) {\n                    let selection = item.selection && item.selection.map(remap.slice(mapFrom));\n                    if (selection)\n                        events++;\n                    let newItem = new Item(map.invert(), step, selection), merged, last = items.length - 1;\n                    if (merged = items.length && items[last].merge(newItem))\n                        items[last] = merged;\n                    else\n                        items.push(newItem);\n                }\n            }\n            else if (item.map) {\n                mapFrom--;\n            }\n        }, this.items.length, 0);\n        return new Branch(RopeSequence.from(items.reverse()), events);\n    }\n}\nBranch.empty = new Branch(RopeSequence.empty, 0);\nfunction cutOffEvents(items, n) {\n    let cutPoint;\n    items.forEach((item, i) => {\n        if (item.selection && (n-- == 0)) {\n            cutPoint = i;\n            return false;\n        }\n    });\n    return items.slice(cutPoint);\n}\nclass Item {\n    constructor(\n    // The (forward) step map for this item.\n    map, \n    // The inverted step\n    step, \n    // If this is non-null, this item is the start of a group, and\n    // this selection is the starting selection for the group (the one\n    // that was active before the first step was applied)\n    selection, \n    // If this item is the inverse of a previous mapping on the stack,\n    // this points at the inverse's offset\n    mirrorOffset) {\n        this.map = map;\n        this.step = step;\n        this.selection = selection;\n        this.mirrorOffset = mirrorOffset;\n    }\n    merge(other) {\n        if (this.step && other.step && !other.selection) {\n            let step = other.step.merge(this.step);\n            if (step)\n                return new Item(step.getMap().invert(), step, this.selection);\n        }\n    }\n}\n// The value of the state field that tracks undo/redo history for that\n// state. Will be stored in the plugin state when the history plugin\n// is active.\nclass HistoryState {\n    constructor(done, undone, prevRanges, prevTime, prevComposition) {\n        this.done = done;\n        this.undone = undone;\n        this.prevRanges = prevRanges;\n        this.prevTime = prevTime;\n        this.prevComposition = prevComposition;\n    }\n}\nconst DEPTH_OVERFLOW = 20;\n// Record a transformation in undo history.\nfunction applyTransaction(history, state, tr, options) {\n    let historyTr = tr.getMeta(historyKey), rebased;\n    if (historyTr)\n        return historyTr.historyState;\n    if (tr.getMeta(closeHistoryKey))\n        history = new HistoryState(history.done, history.undone, null, 0, -1);\n    let appended = tr.getMeta(\"appendedTransaction\");\n    if (tr.steps.length == 0) {\n        return history;\n    }\n    else if (appended && appended.getMeta(historyKey)) {\n        if (appended.getMeta(historyKey).redo)\n            return new HistoryState(history.done.addTransform(tr, undefined, options, mustPreserveItems(state)), history.undone, rangesFor(tr.mapping.maps), history.prevTime, history.prevComposition);\n        else\n            return new HistoryState(history.done, history.undone.addTransform(tr, undefined, options, mustPreserveItems(state)), null, history.prevTime, history.prevComposition);\n    }\n    else if (tr.getMeta(\"addToHistory\") !== false && !(appended && appended.getMeta(\"addToHistory\") === false)) {\n        // Group transforms that occur in quick succession into one event.\n        let composition = tr.getMeta(\"composition\");\n        let newGroup = history.prevTime == 0 ||\n            (!appended && history.prevComposition != composition &&\n                (history.prevTime < (tr.time || 0) - options.newGroupDelay || !isAdjacentTo(tr, history.prevRanges)));\n        let prevRanges = appended ? mapRanges(history.prevRanges, tr.mapping) : rangesFor(tr.mapping.maps);\n        return new HistoryState(history.done.addTransform(tr, newGroup ? state.selection.getBookmark() : undefined, options, mustPreserveItems(state)), Branch.empty, prevRanges, tr.time, composition == null ? history.prevComposition : composition);\n    }\n    else if (rebased = tr.getMeta(\"rebased\")) {\n        // Used by the collab module to tell the history that some of its\n        // content has been rebased.\n        return new HistoryState(history.done.rebased(tr, rebased), history.undone.rebased(tr, rebased), mapRanges(history.prevRanges, tr.mapping), history.prevTime, history.prevComposition);\n    }\n    else {\n        return new HistoryState(history.done.addMaps(tr.mapping.maps), history.undone.addMaps(tr.mapping.maps), mapRanges(history.prevRanges, tr.mapping), history.prevTime, history.prevComposition);\n    }\n}\nfunction isAdjacentTo(transform, prevRanges) {\n    if (!prevRanges)\n        return false;\n    if (!transform.docChanged)\n        return true;\n    let adjacent = false;\n    transform.mapping.maps[0].forEach((start, end) => {\n        for (let i = 0; i < prevRanges.length; i += 2)\n            if (start <= prevRanges[i + 1] && end >= prevRanges[i])\n                adjacent = true;\n    });\n    return adjacent;\n}\nfunction rangesFor(maps) {\n    let result = [];\n    for (let i = maps.length - 1; i >= 0 && result.length == 0; i--)\n        maps[i].forEach((_from, _to, from, to) => result.push(from, to));\n    return result;\n}\nfunction mapRanges(ranges, mapping) {\n    if (!ranges)\n        return null;\n    let result = [];\n    for (let i = 0; i < ranges.length; i += 2) {\n        let from = mapping.map(ranges[i], 1), to = mapping.map(ranges[i + 1], -1);\n        if (from <= to)\n            result.push(from, to);\n    }\n    return result;\n}\n// Apply the latest event from one branch to the document and shift the event\n// onto the other branch.\nfunction histTransaction(history, state, redo) {\n    let preserveItems = mustPreserveItems(state);\n    let histOptions = historyKey.get(state).spec.config;\n    let pop = (redo ? history.undone : history.done).popEvent(state, preserveItems);\n    if (!pop)\n        return null;\n    let selection = pop.selection.resolve(pop.transform.doc);\n    let added = (redo ? history.done : history.undone).addTransform(pop.transform, state.selection.getBookmark(), histOptions, preserveItems);\n    let newHist = new HistoryState(redo ? added : pop.remaining, redo ? pop.remaining : added, null, 0, -1);\n    return pop.transform.setSelection(selection).setMeta(historyKey, { redo, historyState: newHist });\n}\nlet cachedPreserveItems = false, cachedPreserveItemsPlugins = null;\n// Check whether any plugin in the given state has a\n// `historyPreserveItems` property in its spec, in which case we must\n// preserve steps exactly as they came in, so that they can be\n// rebased.\nfunction mustPreserveItems(state) {\n    let plugins = state.plugins;\n    if (cachedPreserveItemsPlugins != plugins) {\n        cachedPreserveItems = false;\n        cachedPreserveItemsPlugins = plugins;\n        for (let i = 0; i < plugins.length; i++)\n            if (plugins[i].spec.historyPreserveItems) {\n                cachedPreserveItems = true;\n                break;\n            }\n    }\n    return cachedPreserveItems;\n}\n/**\nSet a flag on the given transaction that will prevent further steps\nfrom being appended to an existing history event (so that they\nrequire a separate undo command to undo).\n*/\nfunction closeHistory(tr) {\n    return tr.setMeta(closeHistoryKey, true);\n}\nconst historyKey = new PluginKey(\"history\");\nconst closeHistoryKey = new PluginKey(\"closeHistory\");\n/**\nReturns a plugin that enables the undo history for an editor. The\nplugin will track undo and redo stacks, which can be used with the\n[`undo`](https://prosemirror.net/docs/ref/#history.undo) and [`redo`](https://prosemirror.net/docs/ref/#history.redo) commands.\n\nYou can set an `\"addToHistory\"` [metadata\nproperty](https://prosemirror.net/docs/ref/#state.Transaction.setMeta) of `false` on a transaction\nto prevent it from being rolled back by undo.\n*/\nfunction history(config = {}) {\n    config = { depth: config.depth || 100,\n        newGroupDelay: config.newGroupDelay || 500 };\n    return new Plugin({\n        key: historyKey,\n        state: {\n            init() {\n                return new HistoryState(Branch.empty, Branch.empty, null, 0, -1);\n            },\n            apply(tr, hist, state) {\n                return applyTransaction(hist, state, tr, config);\n            }\n        },\n        config,\n        props: {\n            handleDOMEvents: {\n                beforeinput(view, e) {\n                    let inputType = e.inputType;\n                    let command = inputType == \"historyUndo\" ? undo : inputType == \"historyRedo\" ? redo : null;\n                    if (!command)\n                        return false;\n                    e.preventDefault();\n                    return command(view.state, view.dispatch);\n                }\n            }\n        }\n    });\n}\nfunction buildCommand(redo, scroll) {\n    return (state, dispatch) => {\n        let hist = historyKey.getState(state);\n        if (!hist || (redo ? hist.undone : hist.done).eventCount == 0)\n            return false;\n        if (dispatch) {\n            let tr = histTransaction(hist, state, redo);\n            if (tr)\n                dispatch(scroll ? tr.scrollIntoView() : tr);\n        }\n        return true;\n    };\n}\n/**\nA command function that undoes the last change, if any.\n*/\nconst undo = buildCommand(false, true);\n/**\nA command function that redoes the last undone change, if any.\n*/\nconst redo = buildCommand(true, true);\n/**\nA command function that undoes the last change. Don't scroll the\nselection into view.\n*/\nconst undoNoScroll = buildCommand(false, false);\n/**\nA command function that redoes the last undone change. Don't\nscroll the selection into view.\n*/\nconst redoNoScroll = buildCommand(true, false);\n/**\nThe amount of undoable events available in a given state.\n*/\nfunction undoDepth(state) {\n    let hist = historyKey.getState(state);\n    return hist ? hist.done.eventCount : 0;\n}\n/**\nThe amount of redoable events available in a given editor state.\n*/\nfunction redoDepth(state) {\n    let hist = historyKey.getState(state);\n    return hist ? hist.undone.eventCount : 0;\n}\n\nexport { closeHistory, history, redo, redoDepth, redoNoScroll, undo, undoDepth, undoNoScroll };\n","import { commandsCtx } from \"@milkdown/core\";\nimport { undo, redo, history as history$1 } from \"@milkdown/prose/history\";\nimport { $command, $ctx, $prose, $useKeymap } from \"@milkdown/utils\";\nfunction withMeta(plugin, meta) {\n  Object.assign(plugin, {\n    meta: {\n      package: \"@milkdown/plugin-history\",\n      ...meta\n    }\n  });\n  return plugin;\n}\nconst undoCommand = $command(\"Undo\", () => () => undo);\nwithMeta(undoCommand, {\n  displayName: \"Command<undo>\"\n});\nconst redoCommand = $command(\"Redo\", () => () => redo);\nwithMeta(redoCommand, {\n  displayName: \"Command<redo>\"\n});\nconst historyProviderConfig = $ctx({}, \"historyProviderConfig\");\nwithMeta(historyProviderConfig, {\n  displayName: \"Ctx<historyProviderConfig>\"\n});\nconst historyProviderPlugin = $prose(\n  (ctx) => history$1(ctx.get(historyProviderConfig.key))\n);\nwithMeta(historyProviderPlugin, {\n  displayName: \"Ctx<historyProviderPlugin>\"\n});\nconst historyKeymap = $useKeymap(\"historyKeymap\", {\n  Undo: {\n    shortcuts: \"Mod-z\",\n    command: (ctx) => {\n      const commands = ctx.get(commandsCtx);\n      return () => commands.call(undoCommand.key);\n    }\n  },\n  Redo: {\n    shortcuts: [\"Mod-y\", \"Shift-Mod-z\"],\n    command: (ctx) => {\n      const commands = ctx.get(commandsCtx);\n      return () => commands.call(redoCommand.key);\n    }\n  }\n});\nwithMeta(historyKeymap.ctx, {\n  displayName: \"KeymapCtx<history>\"\n});\nwithMeta(historyKeymap.shortcuts, {\n  displayName: \"Keymap<history>\"\n});\nconst history = [\n  historyProviderConfig,\n  historyProviderPlugin,\n  historyKeymap,\n  undoCommand,\n  redoCommand\n].flat();\nexport {\n  history,\n  historyKeymap,\n  historyProviderConfig,\n  historyProviderPlugin,\n  redoCommand,\n  undoCommand\n};\n//# sourceMappingURL=index.es.js.map\n","/**\n * lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n    nativeMin = Math.min;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n *   console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n  return root.Date.now();\n};\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n *  Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n *  The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n *  Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n *   'leading': true,\n *   'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n  var lastArgs,\n      lastThis,\n      maxWait,\n      result,\n      timerId,\n      lastCallTime,\n      lastInvokeTime = 0,\n      leading = false,\n      maxing = false,\n      trailing = true;\n\n  if (typeof func != 'function') {\n    throw new TypeError(FUNC_ERROR_TEXT);\n  }\n  wait = toNumber(wait) || 0;\n  if (isObject(options)) {\n    leading = !!options.leading;\n    maxing = 'maxWait' in options;\n    maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n    trailing = 'trailing' in options ? !!options.trailing : trailing;\n  }\n\n  function invokeFunc(time) {\n    var args = lastArgs,\n        thisArg = lastThis;\n\n    lastArgs = lastThis = undefined;\n    lastInvokeTime = time;\n    result = func.apply(thisArg, args);\n    return result;\n  }\n\n  function leadingEdge(time) {\n    // Reset any `maxWait` timer.\n    lastInvokeTime = time;\n    // Start the timer for the trailing edge.\n    timerId = setTimeout(timerExpired, wait);\n    // Invoke the leading edge.\n    return leading ? invokeFunc(time) : result;\n  }\n\n  function remainingWait(time) {\n    var timeSinceLastCall = time - lastCallTime,\n        timeSinceLastInvoke = time - lastInvokeTime,\n        result = wait - timeSinceLastCall;\n\n    return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;\n  }\n\n  function shouldInvoke(time) {\n    var timeSinceLastCall = time - lastCallTime,\n        timeSinceLastInvoke = time - lastInvokeTime;\n\n    // Either this is the first call, activity has stopped and we're at the\n    // trailing edge, the system time has gone backwards and we're treating\n    // it as the trailing edge, or we've hit the `maxWait` limit.\n    return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n      (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n  }\n\n  function timerExpired() {\n    var time = now();\n    if (shouldInvoke(time)) {\n      return trailingEdge(time);\n    }\n    // Restart the timer.\n    timerId = setTimeout(timerExpired, remainingWait(time));\n  }\n\n  function trailingEdge(time) {\n    timerId = undefined;\n\n    // Only invoke if we have `lastArgs` which means `func` has been\n    // debounced at least once.\n    if (trailing && lastArgs) {\n      return invokeFunc(time);\n    }\n    lastArgs = lastThis = undefined;\n    return result;\n  }\n\n  function cancel() {\n    if (timerId !== undefined) {\n      clearTimeout(timerId);\n    }\n    lastInvokeTime = 0;\n    lastArgs = lastCallTime = lastThis = timerId = undefined;\n  }\n\n  function flush() {\n    return timerId === undefined ? result : trailingEdge(now());\n  }\n\n  function debounced() {\n    var time = now(),\n        isInvoking = shouldInvoke(time);\n\n    lastArgs = arguments;\n    lastThis = this;\n    lastCallTime = time;\n\n    if (isInvoking) {\n      if (timerId === undefined) {\n        return leadingEdge(lastCallTime);\n      }\n      if (maxing) {\n        // Handle invocations in a tight loop.\n        timerId = setTimeout(timerExpired, wait);\n        return invokeFunc(lastCallTime);\n      }\n    }\n    if (timerId === undefined) {\n      timerId = setTimeout(timerExpired, wait);\n    }\n    return result;\n  }\n  debounced.cancel = cancel;\n  debounced.flush = flush;\n  return debounced;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n  var type = typeof value;\n  return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n  return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n  return typeof value == 'symbol' ||\n    (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n  if (typeof value == 'number') {\n    return value;\n  }\n  if (isSymbol(value)) {\n    return NAN;\n  }\n  if (isObject(value)) {\n    var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n    value = isObject(other) ? (other + '') : other;\n  }\n  if (typeof value != 'string') {\n    return value === 0 ? value : +value;\n  }\n  value = value.replace(reTrim, '');\n  var isBinary = reIsBinary.test(value);\n  return (isBinary || reIsOctal.test(value))\n    ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n    : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = debounce;\n","import { createSlice } from \"@milkdown/ctx\";\nimport { InitReady, SerializerReady, serializerCtx, prosePluginsCtx, EditorViewReady } from \"@milkdown/core\";\nimport { PluginKey, Plugin } from \"@milkdown/prose/state\";\nimport debounce from \"lodash.debounce\";\nclass ListenerManager {\n  constructor() {\n    this.beforeMountedListeners = [];\n    this.mountedListeners = [];\n    this.updatedListeners = [];\n    this.markdownUpdatedListeners = [];\n    this.blurListeners = [];\n    this.focusListeners = [];\n    this.destroyListeners = [];\n    this.beforeMount = (fn) => {\n      this.beforeMountedListeners.push(fn);\n      return this;\n    };\n    this.mounted = (fn) => {\n      this.mountedListeners.push(fn);\n      return this;\n    };\n    this.updated = (fn) => {\n      this.updatedListeners.push(fn);\n      return this;\n    };\n  }\n  /// A getter to get all [subscribers](#interface-subscribers). You should not use this method directly.\n  get listeners() {\n    return {\n      beforeMount: this.beforeMountedListeners,\n      mounted: this.mountedListeners,\n      updated: this.updatedListeners,\n      markdownUpdated: this.markdownUpdatedListeners,\n      blur: this.blurListeners,\n      focus: this.focusListeners,\n      destroy: this.destroyListeners\n    };\n  }\n  /// Subscribe to the markdownUpdated event.\n  /// This event will be triggered after the editor state is updated and **the document is changed**.\n  /// The second parameter is the current markdown and the third parameter is the previous markdown.\n  markdownUpdated(fn) {\n    this.markdownUpdatedListeners.push(fn);\n    return this;\n  }\n  /// Subscribe to the blur event.\n  /// This event will be triggered when the editor is blurred.\n  blur(fn) {\n    this.blurListeners.push(fn);\n    return this;\n  }\n  /// Subscribe to the focus event.\n  /// This event will be triggered when the editor is focused.\n  focus(fn) {\n    this.focusListeners.push(fn);\n    return this;\n  }\n  /// Subscribe to the destroy event.\n  /// This event will be triggered before the editor is destroyed.\n  destroy(fn) {\n    this.destroyListeners.push(fn);\n    return this;\n  }\n}\nconst listenerCtx = createSlice(\n  new ListenerManager(),\n  \"listener\"\n);\nconst key = new PluginKey(\"MILKDOWN_LISTENER\");\nconst listener = (ctx) => {\n  ctx.inject(listenerCtx, new ListenerManager());\n  return async () => {\n    await ctx.wait(InitReady);\n    const listener2 = ctx.get(listenerCtx);\n    const { listeners } = listener2;\n    listeners.beforeMount.forEach((fn) => fn(ctx));\n    await ctx.wait(SerializerReady);\n    const serializer = ctx.get(serializerCtx);\n    let prevDoc = null;\n    let prevMarkdown = null;\n    const plugin = new Plugin({\n      key,\n      view: () => {\n        return {\n          destroy: () => {\n            listeners.destroy.forEach((fn) => fn(ctx));\n          }\n        };\n      },\n      props: {\n        handleDOMEvents: {\n          focus: () => {\n            listeners.focus.forEach((fn) => fn(ctx));\n            return false;\n          },\n          blur: () => {\n            listeners.blur.forEach((fn) => fn(ctx));\n            return false;\n          }\n        }\n      },\n      state: {\n        init: (_, instance) => {\n          prevDoc = instance.doc;\n          prevMarkdown = serializer(instance.doc);\n        },\n        apply: (tr) => {\n          if (!tr.docChanged || tr.getMeta(\"addToHistory\") === false) return;\n          const handler = debounce(() => {\n            const { doc } = tr;\n            if (listeners.updated.length > 0 && prevDoc && !prevDoc.eq(doc)) {\n              listeners.updated.forEach((fn) => {\n                fn(ctx, doc, prevDoc);\n              });\n            }\n            if (listeners.markdownUpdated.length > 0 && prevDoc && !prevDoc.eq(doc)) {\n              const markdown = serializer(doc);\n              listeners.markdownUpdated.forEach((fn) => {\n                fn(ctx, markdown, prevMarkdown);\n              });\n              prevMarkdown = markdown;\n            }\n            prevDoc = doc;\n          }, 200);\n          return handler();\n        }\n      }\n    });\n    ctx.update(prosePluginsCtx, (x) => x.concat(plugin));\n    await ctx.wait(EditorViewReady);\n    listeners.mounted.forEach((fn) => fn(ctx));\n  };\n};\nlistener.meta = {\n  package: \"@milkdown/plugin-listener\",\n  displayName: \"Listener\"\n};\nexport {\n  ListenerManager,\n  key,\n  listener,\n  listenerCtx\n};\n//# sourceMappingURL=index.es.js.map\n","import { Plugin } from '@milkdown/prose/state';\nimport { editorViewCtx, parserCtx } from '@milkdown/core';\nimport { Slice } from '@milkdown/prose/model'\n\nexport const onUpdatePlugin = (callback) => new Plugin({\n  view() {\n    return {\n      update(view) {\n        callback(view.state); // EditorState\n      },\n    };\n  },\n});\n\nexport function getStateData(state) {\n  const {$from} = state.selection;\n  const bold = state.schema.marks.strong.isInSet(state.storedMarks || $from.marks());\n  const italic = state.schema.marks.emphasis.isInSet(state.storedMarks || $from.marks());\n\n  let bulletList = false;\n  let orderedList = false;\n  state.doc.nodesBetween(state.selection.from, state.selection.to, node => {\n    switch (node.type.name) {\n      case 'bullet_list':\n        bulletList = true;\n        break;\n      case 'ordered_list':\n        orderedList = true;\n        break;\n    }\n  });\n\n  return {\n    bold,\n    italic,\n    bulletList,\n    orderedList,\n    selection: getSelectionData(state),\n  };\n}\n\nfunction getSelectionData(state) {\n  const marks = (node, type) => node.marks.filter(m => m.type.name === type);\n  const {from, to} = state.selection;\n  const res = {\n    from, to,\n    bold: false,\n    italic: false,\n    linked: false,\n    href: null,\n    linkPos: { from: null, to: null }, // the link from & to positions that wraps the selection.\n    bulletList: false,\n    orderedList: false,\n  };\n  res.text = state.doc.textBetween(from, to, ' ');\n\n  state.doc.nodesBetween(from, to, (node) => {\n    res.bold ||= marks(node, 'strong').length > 0;\n    res.italic ||= marks(node, 'emphasis').length > 0;\n    res.linked ||= marks(node, 'link').length > 0;\n    res.href ||= marks(node, 'link')[0]?.attrs?.href;\n    res.bulletList ||= node.type.name == \"bullet_list\";\n    res.orderedList ||= node.type.name == \"ordered_list\";\n  });\n\n  state.doc.descendants((node, pos) => {\n    if (marks(node, 'link').length > 0 && pos <= from && (pos + node.nodeSize) >= to) {\n      res.linkPos.from = pos;\n      res.linkPos.to = pos + node.nodeSize;\n    }\n  });\n\n  return res;\n}\n\nexport function replaceAll(markdown) {\n  return (ctx) => {\n    const view = ctx.get(editorViewCtx)\n    const parser = ctx.get(parserCtx)\n    const { state } = view\n\n    const { paragraph } = state.schema.nodes;\n    const nodes = markdown.split(/\\n\\n/).map((frag) => frag === '' ? paragraph.create() : parser(frag));\n    const doc = state.schema.nodes.doc.create(null, nodes);\n\n    if (doc) {\n      view.dispatch(state.tr.replace(0, state.doc.content.size, new Slice(doc.content, 0, 0)));\n    }\n  }\n}","<template>\n  <Milkdown v-bind=\"$attrs\"/>\n</template>\n\n<script setup>\nimport { watch } from \"vue\";\nimport { Milkdown, useEditor } from '@milkdown/vue';\nimport { defaultValueCtx, Editor, editorStateCtx, prosePluginsCtx, rootCtx } from '@milkdown/core';\nimport { listener, listenerCtx } from '@milkdown/plugin-listener';\nimport { commonmark } from '@milkdown/preset-commonmark';\nimport { history } from '@milkdown/plugin-history';\nimport { redoDepth, undoDepth } from '@milkdown/prose/history';\nimport { onUpdatePlugin, getStateData, replaceAll } from \"@/utils/milkdown.js\";\nimport { getMarkdown } from '@milkdown/utils';\n\nlet editor, setContent, getContent, dirty = false;\nconst props = defineProps({ value: String });\nconst emit = defineEmits(['ready', 'markdown', 'updated', 'undoDepth', 'redoDepth']);\n\nconst { loading, get } = useEditor((root) => {\n  return Editor.make()\n    .config((ctx) => {\n      ctx.set(rootCtx, root);\n      ctx.set(defaultValueCtx, props.value);\n      ctx.get(listenerCtx).markdownUpdated(onMarkdownUpdated);\n      ctx.update(prosePluginsCtx, plugins => [...plugins, onUpdatePlugin(onUpdated)]);\n    })\n    .use(history)\n    .use(listener)\n    .use(commonmark)\n});\n\nwatch(loading, loading => {\n  if (!loading) {\n    editor = get();\n    if (editor) {\n      setContent = md => editor.action(replaceAll(md));\n      getContent = () => editor.action(getMarkdown());\n\n      editor.action(ctx => {\n        const state = ctx.get(editorStateCtx);\n        emit('ready', { editor, state: getStateData(state) });\n      });\n    }\n  }\n});\n\nwatch(() => props.value, (md) => {\n  if (setContent && getContent && !dirty) {\n    const current = getContent();\n    if (md !== current) setContent(md);\n  }\n});\n\nfunction onUpdated(state) {\n  dirty = true;\n  emit('updated', getStateData(state));\n}\n\nfunction onMarkdownUpdated(ctx, markdown) {\n  const state = ctx.get(editorStateCtx);\n  onUpdated(state);\n  emit('markdown', markdown);\n  emit('undoDepth', undoDepth(state));\n  emit('redoDepth', redoDepth(state));\n}\n</script>","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createStaticVNode as _createStaticVNode } from \"vue\"\n\nconst _hoisted_1 = {\n  viewBox: \"0 0 16 16\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createStaticVNode(\"<g clip-path=\\\"url(#clip0_6142_5288)\\\"><path d=\\\"M0.5 0.498047V5.49805H5.5\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M7.99831 15.498C9.37349 15.4989 10.7224 15.1216 11.8976 14.4074C13.0728 13.6932 14.029 12.6697 14.6617 11.4487C15.2945 10.2278 15.5793 8.85632 15.4851 7.48437C15.3909 6.11243 14.9213 4.79278 14.1277 3.66972C13.3341 2.54666 12.2469 1.66342 10.9852 1.11656C9.72341 0.569705 8.33557 0.380287 6.97341 0.569017C5.61124 0.757746 4.32719 1.31736 3.26163 2.18667C2.19607 3.05598 1.39003 4.20152 0.931641 5.49805\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path></g><defs><clipPath id=\\\"clip0_6142_5288\\\"><rect width=\\\"16\\\" height=\\\"16\\\" fill=\\\"white\\\"></rect></clipPath></defs>\", 2)\n  ])))\n}\nexport default { render: render }","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createStaticVNode as _createStaticVNode } from \"vue\"\n\nconst _hoisted_1 = {\n  viewBox: \"0 0 16 16\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createStaticVNode(\"<g clip-path=\\\"url(#clip0_6142_3468)\\\"><path d=\\\"M15.5 0.498047V5.49805H10.5\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M7.99854 15.498C6.62337 15.4989 5.27444 15.1216 4.09924 14.4074C2.92404 13.6932 1.96782 12.6697 1.33511 11.4487C0.7024 10.2278 0.417569 8.85632 0.511755 7.48437C0.605941 6.11243 1.07552 4.79278 1.86915 3.66972C2.66278 2.54666 3.74991 1.66342 5.01168 1.11656C6.27344 0.569705 7.66128 0.380287 9.02344 0.569017C10.3856 0.757746 11.6697 1.31736 12.7352 2.18667C13.8008 3.05598 14.6068 4.20152 15.0652 5.49805\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path></g><defs><clipPath id=\\\"clip0_6142_3468\\\"><rect width=\\\"16\\\" height=\\\"16\\\" fill=\\\"white\\\"></rect></clipPath></defs>\", 2)\n  ])))\n}\nexport default { render: render }","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createStaticVNode as _createStaticVNode } from \"vue\"\n\nconst _hoisted_1 = {\n  viewBox: \"0 0 16 16\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createStaticVNode(\"<g clip-path=\\\"url(#clip0_6142_1530)\\\"><path d=\\\"M2.5 15.498H9C10.1935 15.498 11.3381 15.0239 12.182 14.18C13.0259 13.3361 13.5 12.1915 13.5 10.998C13.5 9.80457 13.0259 8.65998 12.182 7.81607C11.3381 6.97215 10.1935 6.49805 9 6.49805H9.5C9.89397 6.49805 10.2841 6.42045 10.6481 6.26969C11.012 6.11892 11.3427 5.89794 11.6213 5.61937C11.8999 5.34079 12.1209 5.01007 12.2716 4.6461C12.4224 4.28212 12.5 3.89201 12.5 3.49805C12.5 3.10408 12.4224 2.71397 12.2716 2.35C12.1209 1.98602 11.8999 1.6553 11.6213 1.37673C11.3427 1.09815 11.012 0.877172 10.6481 0.726408C10.2841 0.575644 9.89397 0.498047 9.5 0.498047H2.5\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M4.5 0.498047V15.498\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M9 6.49805H4.5\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path></g><defs><clipPath id=\\\"clip0_6142_1530\\\"><rect width=\\\"16\\\" height=\\\"16\\\" fill=\\\"white\\\"></rect></clipPath></defs>\", 2)\n  ])))\n}\nexport default { render: render }","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createStaticVNode as _createStaticVNode } from \"vue\"\n\nconst _hoisted_1 = {\n  viewBox: \"0 0 16 16\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createStaticVNode(\"<g clip-path=\\\"url(#clip0_6142_4192)\\\"><path d=\\\"M15.5 0.498047H8.5\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M7.5 15.498H0.5\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M4 15.498L12 0.498047\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path></g><defs><clipPath id=\\\"clip0_6142_4192\\\"><rect width=\\\"16\\\" height=\\\"16\\\" fill=\\\"white\\\"></rect></clipPath></defs>\", 2)\n  ])))\n}\nexport default { render: render }","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createStaticVNode as _createStaticVNode } from \"vue\"\n\nconst _hoisted_1 = {\n  viewBox: \"0 0 16 16\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createStaticVNode(\"<g clip-path=\\\"url(#clip0_6142_1518)\\\"><path d=\\\"M6.72133 6.33398C6.4424 6.02024 6.10032 5.76897 5.71752 5.59664C5.33471 5.4243 4.91981 5.3348 4.5 5.33398H3.5C2.70435 5.33398 1.94129 5.65006 1.37868 6.21266C0.81607 6.77527 0.5 7.53833 0.5 8.33398C0.5 9.12963 0.81607 9.8927 1.37868 10.4553C1.94129 11.0179 2.70435 11.334 3.5 11.334H4.5C4.91978 11.333 5.33463 11.2434 5.71741 11.0711C6.10019 10.8988 6.44229 10.6476 6.72133 10.334\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M9.28125 6.33398C9.56016 6.02021 9.90223 5.76891 10.285 5.59658C10.6679 5.42424 11.0828 5.33476 11.5026 5.33398H12.5026C13.2982 5.33398 14.0613 5.65006 14.6239 6.21266C15.1865 6.77527 15.5026 7.53833 15.5026 8.33398C15.5026 9.12963 15.1865 9.8927 14.6239 10.4553C14.0613 11.0179 13.2982 11.334 12.5026 11.334H11.5026C11.0828 11.3331 10.6679 11.2435 10.2851 11.0712C9.90232 10.8989 9.56024 10.6477 9.28125 10.334\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M4.5 8.33398H11.5\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path></g><defs><clipPath id=\\\"clip0_6142_1518\\\"><rect width=\\\"16\\\" height=\\\"16\\\" fill=\\\"white\\\"></rect></clipPath></defs>\", 2)\n  ])))\n}\nexport default { render: render }","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createStaticVNode as _createStaticVNode } from \"vue\"\n\nconst _hoisted_1 = {\n  viewBox: \"0 0 16 16\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createStaticVNode(\"<g clip-path=\\\"url(#clip0_6142_1628)\\\"><path d=\\\"M11 10.4998H12.25C12.9451 10.5292 13.6238 10.2832 14.1387 9.81529C14.6535 9.34735 14.9631 8.6952 15 8.00044C14.9634 7.30549 14.654 6.65307 14.1391 6.18495C13.6241 5.71684 12.9453 5.47084 12.25 5.50044H11\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M5 10.4997H3.75C3.05488 10.5292 2.3762 10.2832 1.86133 9.81527C1.34646 9.34732 1.03695 8.69518 1 8.00041C1.03678 7.30553 1.34621 6.65321 1.86111 6.18513C2.376 5.71704 3.05477 5.47099 3.75 5.50041H5\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M8 3.5V0.5\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M6 3.5L5 2.5\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M10 3.5L11 2.5\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M8 12.5V15.5\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M6 12.5L5 13.5\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M10 12.5L11 13.5\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path></g><defs><clipPath id=\\\"clip0_6142_1628\\\"><rect width=\\\"16\\\" height=\\\"16\\\" fill=\\\"white\\\"></rect></clipPath></defs>\", 2)\n  ])))\n}\nexport default { render: render }","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createStaticVNode as _createStaticVNode } from \"vue\"\n\nconst _hoisted_1 = {\n  viewBox: \"0 0 16 16\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createStaticVNode(\"<g clip-path=\\\"url(#clip0_8254_21964)\\\"><path d=\\\"M2 3.49805C2.82843 3.49805 3.5 2.82647 3.5 1.99805C3.5 1.16962 2.82843 0.498047 2 0.498047C1.17157 0.498047 0.5 1.16962 0.5 1.99805C0.5 2.82647 1.17157 3.49805 2 3.49805Z\\\" fill=\\\"#222222\\\"></path><path d=\\\"M2 9.49805C2.82843 9.49805 3.5 8.82647 3.5 7.99805C3.5 7.16962 2.82843 6.49805 2 6.49805C1.17157 6.49805 0.5 7.16962 0.5 7.99805C0.5 8.82647 1.17157 9.49805 2 9.49805Z\\\" fill=\\\"#222222\\\"></path><path d=\\\"M2 15.498C2.82843 15.498 3.5 14.8265 3.5 13.998C3.5 13.1696 2.82843 12.498 2 12.498C1.17157 12.498 0.5 13.1696 0.5 13.998C0.5 14.8265 1.17157 15.498 2 15.498Z\\\" fill=\\\"#222222\\\"></path><path d=\\\"M5.5 2.49805H15.5\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M5.5 8.49805H15.5\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M5.5 14.498H15.5\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path></g><defs><clipPath id=\\\"clip0_8254_21964\\\"><rect width=\\\"16\\\" height=\\\"16\\\" fill=\\\"white\\\"></rect></clipPath></defs>\", 2)\n  ])))\n}\nexport default { render: render }","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createStaticVNode as _createStaticVNode } from \"vue\"\n\nconst _hoisted_1 = {\n  viewBox: \"0 0 16 16\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createStaticVNode(\"<g clip-path=\\\"url(#clip0_8254_20032)\\\"><path d=\\\"M5.5 2.49805H15.5\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M5.5 8.49805H15.5\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M5.5 14.498H15.5\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M0.533203 12.2394C0.581476 12.0591 0.679232 11.8959 0.815413 11.7683C0.951594 11.6407 1.12077 11.5538 1.30379 11.5173C1.48682 11.4809 1.6764 11.4963 1.85108 11.562C2.02577 11.6277 2.17859 11.7409 2.29226 11.8889C2.40593 12.037 2.47592 12.2138 2.49431 12.3995C2.51269 12.5853 2.47874 12.7724 2.39629 12.9398C2.31385 13.1073 2.18619 13.2483 2.02777 13.3469C1.86936 13.4456 1.68649 13.4979 1.49987 13.498C1.68619 13.498 1.86883 13.5499 2.02719 13.6481C2.18555 13.7463 2.31334 13.8867 2.39615 14.0536C2.47895 14.2205 2.51348 14.4073 2.49583 14.5927C2.47819 14.7782 2.40907 14.9551 2.29629 15.1034C2.1835 15.2517 2.03152 15.3655 1.85749 15.4321C1.68346 15.4986 1.4943 15.5152 1.31133 15.48C1.12837 15.4448 0.958885 15.3592 0.821986 15.2328C0.685088 15.1064 0.586222 14.9443 0.536536 14.7647\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M0.5 7.49805C0.5 7.23283 0.605357 6.97848 0.792893 6.79094C0.98043 6.6034 1.23478 6.49805 1.5 6.49805C1.76522 6.49805 2.01957 6.6034 2.20711 6.79094C2.39464 6.97848 2.5 7.23283 2.5 7.49805C2.5001 7.82174 2.39007 8.13584 2.188 8.38871L0.5 9.49805H2.5\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M0.5 0.498047H1C1.13261 0.498047 1.25979 0.550725 1.35355 0.644493C1.44732 0.738262 1.5 0.865439 1.5 0.998047V4.49805\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M0.5 4.49805H2.5\\\" stroke=\\\"#222222\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path></g><defs><clipPath id=\\\"clip0_8254_20032\\\"><rect width=\\\"16\\\" height=\\\"16\\\" fill=\\\"white\\\"></rect></clipPath></defs>\", 2)\n  ])))\n}\nexport default { render: render }","<template>\n  <div class=\"markdown-editor\">\n    <div class=\"toolbar\" v-if=\"state\">\n      <button :class=\"{ disabled: undoDepth === 0 }\"\n              @click=\"command(undoCommand)\">\n        <UndoIcon class=\"icon\"/>\n      </button>\n\n      <button :class=\"{ disabled: redoDepth === 0 }\"\n              @click=\"command(redoCommand)\">\n        <RedoIcon class=\"icon\"/>\n      </button>\n\n      <div class=\"divider\"></div>\n\n      <button :class=\"{ active: state.bold || state.selection.bold }\"\n              @click=\"command(toggleStrongCommand)\">\n        <BoldIcon class=\"icon\"/>\n      </button>\n\n      <button :class=\"{ active: state.italic || state.selection.italic }\"\n              @click=\"command(toggleEmphasisCommand)\">\n        <ItalicIcon class=\"icon\"/>\n      </button>\n\n      <button :class=\"{ active: state.bulletList || state.selection.bulletList }\"\n              @click=\"toggleBulletList()\">\n        <BulletListIcon class=\"icon\"/>\n      </button>\n\n      <button :class=\"{ active: state.orderedList || state.selection.orderedList }\"\n              @click=\"toggleOrderedList()\">\n        <OrderedListIcon class=\"icon\"/>\n      </button>\n\n      <button :class=\"{ active: state.selection.linked }\"\n              @click=\"toggleLinkDialog(true)\">\n        <LinkIcon class=\"icon\"/>\n      </button>\n\n      <button :class=\"{ disabled: !state.selection.linked }\"\n              @click=\"unlinkText()\">\n        <UnlinkIcon class=\"icon\"/>\n      </button>\n    </div>\n\n    <MilkdownProvider>\n      <Milkdown\n        :id=\"elementId\"\n        :value=\"model\"\n        @ready=\"onReady($event)\"\n        @markdown=\"model = $event\"\n        @undoDepth=\"undoDepth = $event\"\n        @redoDepth=\"redoDepth = $event\"\n        @updated=\"state = $event\"\n      />\n    </MilkdownProvider>\n\n    <Dialog class=\"add-link-dialog\"\n            v-if=\"linkDialog.open\"\n            :set=\"editing = linkDialog.open === 'edit'\"\n    >\n      <template v-slot:header>\n        <H3>{{ t(editing ? 'edit_link' : 'add_link') }}</H3>\n      </template>\n      <div>\n        <label class=\"form-label\">{{ t('text') }}</label>\n        <input class=\"form-input\" required type=\"text\" v-model=\"linkDialog.text\">\n      </div>\n      <div>\n        <label class=\"form-label\">{{ t('link') }}</label>\n        <input class=\"form-input\" required type=\"text\" v-model=\"linkDialog.href\">\n      </div>\n      <div v-show=\"editing\">\n        <button class=\"remove\" @click=\"removeLinkFromDialog()\">\n          <TrashIcon width=\"16\"/>\n          <span>Remove Link</span>\n        </button>\n      </div>\n      <template v-slot:footer>\n        <Button @click=\"toggleLinkDialog(false)\">{{ t('cancel') }}</Button>\n        <Button color=\"primary\" color-filled @click=\"addLinkFromDialog()\">{{ t('save') }}</Button>\n      </template>\n    </Dialog>\n  </div>\n</template>\n\n<script setup>\nimport { reactive, ref, watchEffect } from \"vue\";\nimport { commandsCtx, editorViewCtx } from '@milkdown/core';\nimport { MilkdownProvider } from \"@milkdown/vue\";\nimport {\n  toggleStrongCommand,\n  toggleEmphasisCommand,\n  toggleLinkCommand,\n  wrapInBulletListCommand,\n  wrapInOrderedListCommand\n} from \"@milkdown/preset-commonmark\";\nimport { undoCommand, redoCommand } from '@milkdown/plugin-history';\nimport { TextSelection } from \"@milkdown/prose/state\";\nimport { lift } from \"@milkdown/prose/commands\";\nimport Milkdown from \"@/components/Milkdown/Milkdown.vue\";\nimport UndoIcon from 'app/assets/images/common/undo.svg?component';\nimport RedoIcon from 'app/assets/images/common/redo.svg?component';\nimport BoldIcon from 'app/assets/images/common/bold.svg?component';\nimport ItalicIcon from 'app/assets/images/common/italic.svg?component';\nimport LinkIcon from 'app/assets/images/common/link.svg?component';\nimport UnlinkIcon from 'app/assets/images/common/unlink.svg?component';\nimport TrashIcon from 'app/assets/images/common/trash.svg?component';\nimport BulletListIcon from 'app/assets/images/common/bullet-list.svg?component';\nimport OrderedListIcon from 'app/assets/images/common/ordered-list.svg?component';\nimport { Dialog, H3, Button } from \"@/components/Theme/index.js\";\nimport { useShared } from \"@/helpers/vueHelpers.js\";\nimport { useStyleTag } from \"@vueuse/core\";\nimport { uniqId } from \"@/utils/stringUtils.js\";\n\nconst { t } = useShared();\nconst model = defineModel();\nconst props = defineProps({\n  height: {\n    type: String,\n    default: '200px'\n  },\n  placeholder: {\n    type: String,\n    default: ''\n  }\n});\n\nlet editor = null;\nconst undoDepth = ref(0);\nconst redoDepth = ref(0);\nconst state = ref(null);\nconst linkDialog = reactive({ open: false, text: '', href: '' });\nconst elementId = uniqId();\nconst { css } = useStyleTag();\n\nwatchEffect(() => {\n  const cssRules = `position: absolute; content: \"${props.placeholder}\"; color: #8c8c8c;`;\n  css.value = model.value ? '' : `#${elementId} .editor:not(:focus):before { ${cssRules} }`;\n});\n\nfunction onReady(e) {\n  editor = e.editor;\n  state.value = e.state;\n  editor.el = document.querySelector('.milkdown .editor');\n  editor.el.style.height = props.height;\n}\n\nfunction command(command, options = {}) {\n  runCommand(command, options);\n  focusEditor();\n}\n\nfunction toggleLinkDialog(onoff) {\n  selectLinkIfCursorIsWithin();\n  linkDialog.text = state.value.selection.text;\n  linkDialog.href = state.value.selection.href || '';\n  linkDialog.open = onoff ? (linkDialog.href ? 'edit' : 'add') : false;\n}\n\nfunction addLinkFromDialog() {\n  editor.action(ctx => {\n    const text = linkDialog.text;\n    const { state, dispatch } = ctx.get(editorViewCtx);\n    const { from, to } = state.selection;\n    if (linkDialog.href) {\n      const linkMark = state.schema.marks.link.create({ href: linkDialog.href });\n      const transaction = state.tr\n        .insertText(text, from, to)\n        .addMark(from, from + text.length, linkMark)\n        .setStoredMarks([])\n      dispatch(transaction.scrollIntoView());\n    }\n    else {\n      const transaction = state.tr.removeMark(from, to, state.schema.marks.link);\n      dispatch(transaction.scrollIntoView());\n    }\n  });\n  linkDialog.open = false;\n  linkDialog.text = linkDialog.href = '';\n  focusEditor();\n}\n\nfunction removeLinkFromDialog() {\n  linkDialog.href = '';\n  addLinkFromDialog();\n}\n\nfunction unlinkText() {\n  const { from, to } = state.value.selection;\n  selectLinkIfCursorIsWithin();\n  if (state.value.selection.linked) {\n    command(toggleLinkCommand);\n  }\n  selectPosition(from, to);\n}\n\nfunction runCommand(command, options = {}) {\n  editor.action(ctx => ctx.get(commandsCtx).call(command.key, options));\n}\n\nfunction focusEditor() {\n  editor.action(ctx => ctx.get(editorViewCtx).focus());\n}\n\nfunction selectLinkIfCursorIsWithin() {\n  const { from, to } = state.value.selection.linkPos;\n\n  if (from !== null && to !== null) {\n    selectPosition(from, to);\n  }\n}\n\nfunction selectPosition(from, to) {\n  editor.action(ctx => {\n    const { state, dispatch } = ctx.get(editorViewCtx);\n    dispatch(state.tr.setSelection(TextSelection.create(state.doc, from, to)));\n  });\n}\n\nfunction toggleBulletList() {\n  editor.action(ctx => {\n    const { dispatch, state: editorState } = ctx.get(editorViewCtx);\n\n    if (state.value.bulletList) {\n      lift(editorState, dispatch);\n    } else {\n      runCommand(wrapInBulletListCommand);\n    }\n  });\n  focusEditor();\n}\n\nfunction toggleOrderedList() {\n  editor.action(ctx => {\n    const { dispatch, state: editorState } = ctx.get(editorViewCtx);\n\n    if (state.value.orderedList) {\n      lift(editorState, dispatch);\n    } else {\n      runCommand(wrapInOrderedListCommand);\n    }\n  });\n  focusEditor();\n}\n</script>\n\n<style lang=\"scss\">\n.markdown-editor {\n  width: 100%;\n\n  .toolbar {\n    border: 1px solid $gray-lighter;\n    margin-bottom: $spacing-3;\n    background-color: $gray-light;\n    display: flex;\n    align-items: center;\n    flex-wrap: wrap;\n    gap: $spacing-2;\n    padding: $spacing-2;\n\n    .divider {\n      height: 24px;\n      border-right: 1px solid $gray-lighter;\n    }\n\n    button {\n      width: 30px;\n      height: 30px;\n      display: flex;\n      align-items: center;\n      justify-content: center;\n      border-radius: $rounded;\n\n      &.active {\n        background-color: #E6E6E6;\n      }\n\n      &:hover {\n        background-color: $brand-tertiary-light;\n      }\n\n      &.disabled {\n        cursor: not-allowed;\n\n        &:hover {\n          background-color: initial;\n        }\n\n        svg path {\n          stroke: #8C8C8C;\n        }\n      }\n    }\n\n    .icon {\n      width: 16px;\n    }\n  }\n\n  .editor {\n    padding: $spacing-3 $spacing-5;\n    border: 1px solid $gray-lighter;\n    box-sizing: content-box;\n    border-radius: $rounded;\n    font-weight: $font-medium;\n    font-size: $text-base;\n    line-height: $leading-snug;\n    outline: none;\n    overflow-y: auto;\n\n    p {\n      margin: 0;\n    }\n\n    a {\n      color: $brand-tertiary;\n    }\n\n    ul li {\n      list-style: initial;\n      margin-left: $spacing-6;\n    }\n  }\n}\n\n.add-link-dialog {\n  .theme-h3 {\n    font-weight: 700;\n  }\n\n  .form-label {\n    font-size: $text-xs;\n    line-height: 14px;\n    margin-bottom: 6px;\n  }\n\n  .modal__content {\n    @include flex-column($spacing-6);\n\n    .remove {\n      display: flex;\n      align-items: center;\n      gap: $spacing-2;\n      color: $brand-secondary;\n\n      svg path {\n        stroke: $brand-secondary;\n      }\n    }\n  }\n\n  .modal__footer {\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    gap: $spacing-6;\n  }\n}\n</style>\n\n<i18n lang=\"yaml\">\nen:\n  add_link: Add link\n  edit_link: Edit link\n  text: Text\n  link: Link\n  cancel: Cancel\n  save: Save\n</i18n>\n","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createStaticVNode as _createStaticVNode } from \"vue\"\n\nconst _hoisted_1 = {\n  viewBox: \"0 0 8 14\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createStaticVNode(\"<circle cx=\\\"1\\\" cy=\\\"1\\\" r=\\\"1\\\" fill=\\\"#8C8C8C\\\"></circle><circle cx=\\\"7\\\" cy=\\\"1\\\" r=\\\"1\\\" fill=\\\"#8C8C8C\\\"></circle><circle cx=\\\"1\\\" cy=\\\"7\\\" r=\\\"1\\\" fill=\\\"#8C8C8C\\\"></circle><circle cx=\\\"7\\\" cy=\\\"7\\\" r=\\\"1\\\" fill=\\\"#8C8C8C\\\"></circle><circle cx=\\\"1\\\" cy=\\\"13\\\" r=\\\"1\\\" fill=\\\"#8C8C8C\\\"></circle><circle cx=\\\"7\\\" cy=\\\"13\\\" r=\\\"1\\\" fill=\\\"#8C8C8C\\\"></circle>\", 6)\n  ])))\n}\nexport default { render: render }","<template>\n  <div class=\"time-input\">\n    <div class=\"time-input__label\">\n      <label v-if=\"label\">\n        {{ label }}\n      </label>\n    </div>\n    <div class=\"time-input__fields\">\n      <div class=\"time-input__text\">\n        <div class=\"time-input__body\" :class=\"{ 'time-input__body_error': !focused && error }\">\n          <input\n            class=\"time-input__input\"\n            placeholder=\"hh:mm\"\n            :disabled=\"disabled\"\n            :value=\"value\"\n            @input=\"input\"\n            :name=\"name\"\n            inputmode=\"decimal\"\n            @focus=\"onFocus()\"\n            @blur=\"onBlur()\"\n          />\n        </div>\n      </div>\n      <Button :colorFilled=\"amPm === 'am'\" @click=\"selectAmpm('am')\" :class=\"{ 'time-input__button_inactive': amPm !== 'am' }\">AM</Button>\n      <Button :colorFilled=\"amPm === 'pm'\" @click=\"selectAmpm('pm')\" :class=\"{ 'time-input__button_inactive': amPm !== 'pm' }\">PM</Button>\n    </div>\n    <div class=\"time-input__error\" v-if=\"!focused && (error || errorMessage)\">\n      {{ error || errorMessage }}\n    </div>\n  </div>\n</template>\n\n<script setup>\nimport { Button } from '@/components/Theme/index.js';\nimport { ref, computed, nextTick } from \"vue\";\nimport moment from \"moment-timezone\";\n\nconst props = defineProps({\n  disabled: { type: Boolean, default: false },\n  value: String,\n  label: { type: String, default: '' },\n  name: { type: String, default: '' },\n  amPm: String,\n  errorMessage: String\n});\nconst emit = defineEmits(['input', 'changeAmPm', 'date']);\nconst focused = ref(false);\nconst error = computed(() => {\n  if (!props.value) {\n    return '';\n  }\n  if (!/\\d{2}:\\d{2}/.test(props.value)) {\n    return 'Invalid time';\n  }\n  const [hours, minutes] = props.value.split(':');\n  if (hours > 12 || minutes > 59) {\n    return 'Invalid time';\n  }\n  return '';\n});\nconst valid = computed(() => props.value && props.amPm && !error.value);\n\nfunction input(evt) {\n  emit('input', evt.target.value);\n  tryEmitValidDate();\n}\n\nfunction selectAmpm(ampm) {\n  emit('changeAmPm', ampm);\n  tryEmitValidDate();\n}\n\nfunction onFocus() {\n  focused.value = true;\n}\n\nfunction onBlur() {\n  focused.value = false;\n\n  if (!valid.value) {\n    tryGuessTimeFromInput();\n    tryEmitValidDate();\n  }\n}\n\nfunction tryEmitValidDate() {\n  nextTick(() => {\n    if (props.value && props.amPm && !error.value) {\n      const t = moment(`${props.value} ${props.amPm}`, \"hh:mm a\");\n      emit('date', t.toDate());\n    } else if (!props.value) {\n      emit('date', null);\n    }\n  });\n}\n\nfunction tryGuessTimeFromInput() {\n  let formattedTime;\n  const input = String(props.value).trim();\n\n  if (/^\\d{1,2}:\\d{2}$/.test(input)) {\n    formattedTime = moment(input, 'HH:mm');\n  } else {\n    // Remove any non-digit characters\n    const digits = input.replace(/\\D/g, '');\n\n    // \"1500\" -> 3:00 pm\n    if (digits.length === 4) {\n      formattedTime = moment(digits, 'HHmm');\n    }\n    // \"130\" -> 1:30 am\n    else if (digits.length === 3) {\n      formattedTime = moment(digits, 'Hmm');\n    }\n    // \"10\" -> 10am\n    else if (digits.length === 2) {\n      formattedTime = moment(digits, 'H').minute(0);\n    }\n    // \"7\" -> 7am\n    else if (digits.length === 1) {\n      formattedTime = moment(digits, 'h').minute(0);\n    }\n    else {\n      return null; // Invalid input\n    }\n  }\n\n  if (!formattedTime.isValid()) {\n    return null; // Invalid moment object\n  }\n\n  emit('input', formattedTime.format('hh:mm'));\n  emit('changeAmPm', formattedTime.format('a'));\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.time-input {\n  &:deep(.time-input__text) {\n    flex-grow: 1;\n  }\n\n  &:deep(.button) {\n    width: min-content;\n  }\n\n  label {\n    color: $gray;\n    text-transform: uppercase;\n    font-weight: $font-bold;\n    font-size: $text-xs;\n    display: block;\n    margin-bottom: $spacing-2;\n  }\n}\n\n.time-input__fields {\n  display: flex;\n  gap: $spacing-2;\n  width: 100%;\n}\n\n.time-input__body {\n  padding: $spacing-3 $spacing-5;\n  border: 1px solid $gray-lighter;\n  border-radius: $spacing-1;\n  display: flex;\n  align-items: center;\n\n  &_error {\n    border: 1px solid $brand-secondary;\n  }\n\n  &:focus-within:not(.time-input__body_error) {\n    border: 1px solid $brand-tertiary;\n  }\n\n  .icon {\n    flex-grow: 0;\n    flex-shrink: 1;\n    margin-left: $spacing-2;\n    color: $gray;\n  }\n}\n\n.time-input__input {\n  padding: 0;\n  border: 0;\n  border-radius: 0;\n  font-size: $text-base;\n  -webkit-appearance: none;\n  width: 100%;\n  flex-grow: 1;\n\n  &[disabled] {\n    background-color: $gray-lighter;\n  }\n\n  &::placeholder {\n    color: $gray;\n  }\n\n  &:focus-visible {\n    outline: 0;\n  }\n\n  &:focus {\n    outline: 0;\n    box-shadow: none;\n  }\n}\n\n.time-input__error {\n  margin-top: 6px;\n  color: $brand-secondary;\n}\n\n.time-input__button_inactive {\n  border-color: $gray-lighter;\n  color: $gray;\n}\n</style>\n","<template>\n  <TimeInput\n    :value=\"time\"\n    @input=\"time = $event\"\n    :amPm=\"ampm\"\n    @changeAmPm=\"ampm = $event\"\n    @date=\"updateTime\"\n  />\n</template>\n\n<script setup lang=\"ts\">\nimport moment from \"moment-timezone\";\nimport { computed, ref, watch } from 'vue';\nimport TimeInput from \"@/components/Form/TimeInput.vue\";\n\nconst model = defineModel<string | null>(); // HH:mm:ss\nconst modelTime = computed(() => model.value ? moment(`0000-01-01T${model.value}Z`).tz('UTC').format('hh:mm') : '');\nconst modelAmpm = computed(() => model.value ? moment(`0000-01-01T${model.value}Z`).tz('UTC').format('a') : '');\n\nconst time = ref(modelTime.value);\nconst ampm = ref(modelAmpm.value);\n\nwatch(model, () => {\n  time.value = modelTime.value;\n  ampm.value = modelAmpm.value;\n});\n\nfunction updateTime(dt: Date | null) {\n  if (dt === null) {\n    model.value = null;\n    return;\n  }\n\n  model.value = moment(dt).format('HH:mm:ss');\n}\n</script>\n\n<style lang=\"scss\" scoped>\n@import 'app/assets/stylesheets/litecms';\n</style>","<template>\n  <div class=\"activity-item\">\n    <div class=\"timeline-dot\"></div>\n\n    <div class=\"handle\">\n      <MovableIcon width=\"8\"/>\n    </div>\n\n    <div class=\"activity-item__body\">\n      <label class=\"form-label\">{{ t('activity') }}</label>\n      <input class=\"form-input activity-input\" required type=\"text\" v-model=\"model.title\">\n\n      <div class=\"activity-item__footer\">\n        <button v-if=\"!showTimeInput\"\n                @click=\"showTimeInput = !showTimeInput\"\n                class=\"add-time\">{{ t('include_time') }}\n        </button>\n\n        <TimeInputV2 v-else v-model=\"model.time\" :label=\"t('time')\"/>\n\n        <button class=\"delete-btn\" v-if=\"!first\" @click=\"$emit('delete')\">\n          <TrashIcon width=\"16\"/>\n        </button>\n      </div>\n    </div>\n\n  </div>\n</template>\n\n<script setup>\nimport { ref } from \"vue\";\nimport { useShared } from \"@/helpers/vueHelpers.js\";\nimport TrashIcon from 'app/assets/images/common/trash.svg?component';\nimport MovableIcon from 'app/assets/images/common/movable.svg?component';\nimport TimeInputV2 from \"@/modules/LiteCMS/Common/TimeInputV2.vue\";\n\ndefineProps({ first: Boolean });\ndefineEmits(['delete']);\nconst model = defineModel();\nconst { t } = useShared();\nconst showTimeInput = ref(model.value.time || model.value.ampm);\n</script>\n\n<style lang=\"scss\" scoped>\n.activity-item {\n  display: flex;\n  position: relative;\n  border: 1px solid $gray-lighter;\n  border-radius: $rounded;\n\n  .handle {\n    padding: $spacing-3;\n    cursor: grab;\n    display: flex;\n    align-items: center;\n\n    &:active {\n      cursor: grabbing;\n    }\n  }\n}\n\n.activity-item__body {\n  flex: 1;\n  padding: $spacing-3 $spacing-3 $spacing-3 0;\n}\n\n.activity-item__footer {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n\n  :deep(.time-input__label label) {\n    margin-bottom: 6px;\n    font-weight: $font-semibold;\n  }\n\n  @include mobile {\n    flex-direction: column;\n    align-items: start;\n    gap: $spacing-4;\n\n    :deep(.time-input) {\n      width: 100%;\n    }\n\n    :deep(.time-input__fields) {\n      display: grid;\n      grid-template-columns: 1fr 1fr;\n\n      & > div, & > button {\n        width: 100%;\n        max-width: initial;\n      }\n\n      .time-input__text {\n        grid-column: span 2;\n      }\n    }\n  }\n}\n\n.timeline-dot {\n  position: absolute;\n  width: 6px;\n  height: 6px;\n  border-radius: 50%;\n  border: 1px solid $brand-tertiary;\n  background-color: white;\n  left: -25px; // 20 (colum-gap) + 1 (self-border) + 4 (self-width:6 - timeline-width:2)\n  top: 0;\n}\n\n.form-label {\n  margin-bottom: 6px;\n  font-size: $text-xs;\n  line-height: 1.16667;\n}\n\n.add-time {\n  line-height: $leading-snug;\n  color: $brand-tertiary;\n  font-weight: $font-semibold;\n}\n\n.activity-input {\n  margin-bottom: $spacing-4;\n}\n\n.delete-btn {\n  display: inline-flex;\n  padding: $spacing-2;\n  background-color: $gray-light;\n  border-radius: $rounded;\n  margin-top: auto;\n\n  :deep(svg path) {\n    stroke: #222222;\n  }\n}\n\n:deep(.time-input__text) {\n  max-width: 120px;\n}\n</style>\n\n<i18n lang=\"yaml\">\nen:\n  time: Time\n  include_time: Include time\n  activity: Activity\n</i18n>","<template>\n  <div class=\"activity-item\">\n    <div class=\"timeline-dot\">\n      <i class=\"icon\" :class=\"getTransportationIconClass(model.transportation_type)\"></i>\n    </div>\n\n    <div class=\"handle\">\n      <MovableIcon width=\"8\" />\n    </div>\n\n    <div class=\"activity-item__body\">\n      <div class=\"transportation-item__body\">\n        <label class=\"form-label\">{{ t('transportation') }}</label>\n        <SelectInput v-model=\"model.transportation_type\" :options=\"transportationOptions\" />\n      </div>\n\n      <div ref=\"durationContainer\" class=\"transportation-item__body\">\n        <label class=\"form-label\">{{ t('duration') }}</label>\n        <div class=\"transportation-item__body__time\">\n          <div class=\"form-input\">\n            <input class=\"transportation-item__number-input\" type=\"number\" :value=\"durationHours\" @change=\"updateHours\"\n              min=\"0\" max=\"24\">\n            <span>{{ width > 270 ? 'hours' : 'h' }}</span>\n          </div>\n\n          <div class=\"form-input\">\n            <input class=\"transportation-item__number-input\" type=\"number\" :value=\"durationMinutes\"\n              @change=\"updateMinutes\" min=\"0\" max=\"60\">\n            <span>{{ width > 270 ? 'minutes' : 'm' }}</span>\n          </div>\n        </div>\n      </div>\n\n      <button class=\"delete-btn\" v-if=\"!first\" @click=\"$emit('delete')\">\n        <TrashIcon width=\"16\" />\n      </button>\n    </div>\n  </div>\n</template>\n\n<script setup>\nimport { computed, ref } from 'vue'\nimport { useElementSize } from \"@vueuse/core\";\nimport { useShared } from \"@/helpers/vueHelpers.js\";\nimport SelectInput from \"@/modules/LiteCMS/Common/SelectInput.vue\";\nimport TrashIcon from 'app/assets/images/common/trash.svg?component';\nimport MovableIcon from 'app/assets/images/common/movable.svg?component';\n\nconst model = defineModel({\n  modeOfTransportation: String,\n  durationLength: Object\n});\n\ndefineProps({ first: Boolean });\ndefineEmits(['delete']);\n\nconst { t } = useShared();\nconst durationContainer = ref();\nconst durationHours = computed(() => Math.floor(model.value.duration_length / 60))\nconst durationMinutes = computed(() => model.value.duration_length % 60)\n\nconst { width } = useElementSize(durationContainer)\n\nconst transportationOptions = [\"Car\", \"Ferry\", \"Motorcycle\", \"Plane\", \"Self-drive\", \"Speedboat\", \"Taxi\", \"Train\", \"Van\", \"Walk\"].map((item) => ({ label: item, value: item.toLowerCase() }))\n\nconst getTransportationIconClass = (selection) => {\n  return `itinerary-timeline__item--${(selection ?? 'Self-drive').toLowerCase()}`\n}\n\nconst updateHours = (e) => {\n  const minutes = durationMinutes.value\n  model.value.duration_length = Number(e.target.value) * 60 + minutes\n}\nconst updateMinutes = (e) => {\n  const hours = durationHours.value * 60\n  model.value.duration_length = Number(e.target.value) + hours\n}\n\n</script>\n\n<style lang=\"scss\" scoped>\n.timeline-dot {\n  position: absolute;\n  background-color: white;\n  left: -30px;\n  top: 0;\n}\n\n.icon {\n  color: $brand-tertiary;\n  font-family: \"streamline\";\n  font-style: normal;\n  font-weight: normal;\n  display: inline-block;\n  width: 1em;\n  height: 1em;\n}\n\n\n.activity-item {\n  display: flex;\n  position: relative;\n  border: 1px solid $gray-lighter;\n  border-radius: $rounded;\n  align-items: center;\n\n  .handle {\n    padding: $spacing-3;\n    cursor: grab;\n    display: flex;\n    align-items: center;\n\n    &:active {\n      cursor: grabbing;\n    }\n  }\n\n  @include mobile {\n    flex-wrap: wrap;\n  }\n}\n\n.activity-item__body {\n  display: flex;\n  width: 100%;\n\n  @include mobile {\n    display: block;\n    flex: 1;\n  }\n}\n\n.transportation-item__body {\n  flex: 1;\n  padding: $spacing-3 $spacing-3 $spacing-3 0;\n}\n\n.form-label {\n  margin-bottom: 6px;\n  font-size: $text-xs;\n  line-height: 1.16667;\n}\n\n.form-input {\n  flex: 1;\n  padding: 0 20px 0 0;\n  display: flex;\n  align-items: center;\n  overflow: hidden;\n\n  input {\n    flex: 1;\n    border: none;\n    padding: calc(#{$spacing-3} - 1px) $spacing-2 calc(#{$spacing-3} - 1px) calc(#{$spacing-5} - 1px);\n\n\n    &:focus {\n      outline: none;\n    }\n  }\n}\n\n.transportation-item__body__time {\n  display: flex;\n  flex-wrap: wrap;\n  width: 100%;\n  height: 46px;\n  gap: $spacing-3;\n}\n\n.transportation-item__number-input {\n  padding: calc(0.75rem - 1px) 0 calc(0.75rem - 1px) calc(1.25rem - 1px) !important;\n}\n\n.transportation-item__number-input::-webkit-outer-spin-button,\n.transportation-item__number-input::-webkit-inner-spin-button {\n  -webkit-appearance: none;\n  margin: 0;\n}\n\n.delete-btn {\n  padding: $spacing-2;\n  background-color: $gray-light;\n  border-radius: $rounded;\n  margin: auto $spacing-3 calc($spacing-4 + 1px) 0;\n\n  :deep(svg path) {\n    stroke: #222222;\n  }\n\n  @include mobile {\n    margin-top: $spacing-3\n  }\n}\n\n:deep(.time-input__text) {\n  max-width: 120px;\n}\n</style>\n\n<i18n lang=\"yaml\">\nen:\n  time: Time\n  include_time: Include time\n  transportation: Transportation\n  duration: Duration\n</i18n>","/**!\n * Sortable 1.15.6\n * @author\tRubaXa   <trash@rubaxa.org>\n * @author\towenm    <owen23355@gmail.com>\n * @license MIT\n */\nfunction ownKeys(object, enumerableOnly) {\n  var keys = Object.keys(object);\n  if (Object.getOwnPropertySymbols) {\n    var symbols = Object.getOwnPropertySymbols(object);\n    if (enumerableOnly) {\n      symbols = symbols.filter(function (sym) {\n        return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n      });\n    }\n    keys.push.apply(keys, symbols);\n  }\n  return keys;\n}\nfunction _objectSpread2(target) {\n  for (var i = 1; i < arguments.length; i++) {\n    var source = arguments[i] != null ? arguments[i] : {};\n    if (i % 2) {\n      ownKeys(Object(source), true).forEach(function (key) {\n        _defineProperty(target, key, source[key]);\n      });\n    } else if (Object.getOwnPropertyDescriptors) {\n      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n    } else {\n      ownKeys(Object(source)).forEach(function (key) {\n        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n      });\n    }\n  }\n  return target;\n}\nfunction _typeof(obj) {\n  \"@babel/helpers - typeof\";\n\n  if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n    _typeof = function (obj) {\n      return typeof obj;\n    };\n  } else {\n    _typeof = function (obj) {\n      return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n    };\n  }\n  return _typeof(obj);\n}\nfunction _defineProperty(obj, key, value) {\n  if (key in obj) {\n    Object.defineProperty(obj, key, {\n      value: value,\n      enumerable: true,\n      configurable: true,\n      writable: true\n    });\n  } else {\n    obj[key] = value;\n  }\n  return obj;\n}\nfunction _extends() {\n  _extends = Object.assign || function (target) {\n    for (var i = 1; i < arguments.length; i++) {\n      var source = arguments[i];\n      for (var key in source) {\n        if (Object.prototype.hasOwnProperty.call(source, key)) {\n          target[key] = source[key];\n        }\n      }\n    }\n    return target;\n  };\n  return _extends.apply(this, arguments);\n}\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n  if (source == null) return {};\n  var target = {};\n  var sourceKeys = Object.keys(source);\n  var key, i;\n  for (i = 0; i < sourceKeys.length; i++) {\n    key = sourceKeys[i];\n    if (excluded.indexOf(key) >= 0) continue;\n    target[key] = source[key];\n  }\n  return target;\n}\nfunction _objectWithoutProperties(source, excluded) {\n  if (source == null) return {};\n  var target = _objectWithoutPropertiesLoose(source, excluded);\n  var key, i;\n  if (Object.getOwnPropertySymbols) {\n    var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n    for (i = 0; i < sourceSymbolKeys.length; i++) {\n      key = sourceSymbolKeys[i];\n      if (excluded.indexOf(key) >= 0) continue;\n      if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n      target[key] = source[key];\n    }\n  }\n  return target;\n}\nfunction _toConsumableArray(arr) {\n  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();\n}\nfunction _arrayWithoutHoles(arr) {\n  if (Array.isArray(arr)) return _arrayLikeToArray(arr);\n}\nfunction _iterableToArray(iter) {\n  if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter);\n}\nfunction _unsupportedIterableToArray(o, minLen) {\n  if (!o) return;\n  if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n  var n = Object.prototype.toString.call(o).slice(8, -1);\n  if (n === \"Object\" && o.constructor) n = o.constructor.name;\n  if (n === \"Map\" || n === \"Set\") return Array.from(o);\n  if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\nfunction _arrayLikeToArray(arr, len) {\n  if (len == null || len > arr.length) len = arr.length;\n  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n  return arr2;\n}\nfunction _nonIterableSpread() {\n  throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nvar version = \"1.15.6\";\n\nfunction userAgent(pattern) {\n  if (typeof window !== 'undefined' && window.navigator) {\n    return !! /*@__PURE__*/navigator.userAgent.match(pattern);\n  }\n}\nvar IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\\.|msie|iemobile|Windows Phone)/i);\nvar Edge = userAgent(/Edge/i);\nvar FireFox = userAgent(/firefox/i);\nvar Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i);\nvar IOS = userAgent(/iP(ad|od|hone)/i);\nvar ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i);\n\nvar captureMode = {\n  capture: false,\n  passive: false\n};\nfunction on(el, event, fn) {\n  el.addEventListener(event, fn, !IE11OrLess && captureMode);\n}\nfunction off(el, event, fn) {\n  el.removeEventListener(event, fn, !IE11OrLess && captureMode);\n}\nfunction matches( /**HTMLElement*/el, /**String*/selector) {\n  if (!selector) return;\n  selector[0] === '>' && (selector = selector.substring(1));\n  if (el) {\n    try {\n      if (el.matches) {\n        return el.matches(selector);\n      } else if (el.msMatchesSelector) {\n        return el.msMatchesSelector(selector);\n      } else if (el.webkitMatchesSelector) {\n        return el.webkitMatchesSelector(selector);\n      }\n    } catch (_) {\n      return false;\n    }\n  }\n  return false;\n}\nfunction getParentOrHost(el) {\n  return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;\n}\nfunction closest( /**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx, includeCTX) {\n  if (el) {\n    ctx = ctx || document;\n    do {\n      if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) {\n        return el;\n      }\n      if (el === ctx) break;\n      /* jshint boss:true */\n    } while (el = getParentOrHost(el));\n  }\n  return null;\n}\nvar R_SPACE = /\\s+/g;\nfunction toggleClass(el, name, state) {\n  if (el && name) {\n    if (el.classList) {\n      el.classList[state ? 'add' : 'remove'](name);\n    } else {\n      var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');\n      el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');\n    }\n  }\n}\nfunction css(el, prop, val) {\n  var style = el && el.style;\n  if (style) {\n    if (val === void 0) {\n      if (document.defaultView && document.defaultView.getComputedStyle) {\n        val = document.defaultView.getComputedStyle(el, '');\n      } else if (el.currentStyle) {\n        val = el.currentStyle;\n      }\n      return prop === void 0 ? val : val[prop];\n    } else {\n      if (!(prop in style) && prop.indexOf('webkit') === -1) {\n        prop = '-webkit-' + prop;\n      }\n      style[prop] = val + (typeof val === 'string' ? '' : 'px');\n    }\n  }\n}\nfunction matrix(el, selfOnly) {\n  var appliedTransforms = '';\n  if (typeof el === 'string') {\n    appliedTransforms = el;\n  } else {\n    do {\n      var transform = css(el, 'transform');\n      if (transform && transform !== 'none') {\n        appliedTransforms = transform + ' ' + appliedTransforms;\n      }\n      /* jshint boss:true */\n    } while (!selfOnly && (el = el.parentNode));\n  }\n  var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;\n  /*jshint -W056 */\n  return matrixFn && new matrixFn(appliedTransforms);\n}\nfunction find(ctx, tagName, iterator) {\n  if (ctx) {\n    var list = ctx.getElementsByTagName(tagName),\n      i = 0,\n      n = list.length;\n    if (iterator) {\n      for (; i < n; i++) {\n        iterator(list[i], i);\n      }\n    }\n    return list;\n  }\n  return [];\n}\nfunction getWindowScrollingElement() {\n  var scrollingElement = document.scrollingElement;\n  if (scrollingElement) {\n    return scrollingElement;\n  } else {\n    return document.documentElement;\n  }\n}\n\n/**\r\n * Returns the \"bounding client rect\" of given element\r\n * @param  {HTMLElement} el                       The element whose boundingClientRect is wanted\r\n * @param  {[Boolean]} relativeToContainingBlock  Whether the rect should be relative to the containing block of (including) the container\r\n * @param  {[Boolean]} relativeToNonStaticParent  Whether the rect should be relative to the relative parent of (including) the contaienr\r\n * @param  {[Boolean]} undoScale                  Whether the container's scale() should be undone\r\n * @param  {[HTMLElement]} container              The parent the element will be placed in\r\n * @return {Object}                               The boundingClientRect of el, with specified adjustments\r\n */\nfunction getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {\n  if (!el.getBoundingClientRect && el !== window) return;\n  var elRect, top, left, bottom, right, height, width;\n  if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {\n    elRect = el.getBoundingClientRect();\n    top = elRect.top;\n    left = elRect.left;\n    bottom = elRect.bottom;\n    right = elRect.right;\n    height = elRect.height;\n    width = elRect.width;\n  } else {\n    top = 0;\n    left = 0;\n    bottom = window.innerHeight;\n    right = window.innerWidth;\n    height = window.innerHeight;\n    width = window.innerWidth;\n  }\n  if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {\n    // Adjust for translate()\n    container = container || el.parentNode;\n\n    // solves #1123 (see: https://stackoverflow.com/a/37953806/6088312)\n    // Not needed on <= IE11\n    if (!IE11OrLess) {\n      do {\n        if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) {\n          var containerRect = container.getBoundingClientRect();\n\n          // Set relative to edges of padding box of container\n          top -= containerRect.top + parseInt(css(container, 'border-top-width'));\n          left -= containerRect.left + parseInt(css(container, 'border-left-width'));\n          bottom = top + elRect.height;\n          right = left + elRect.width;\n          break;\n        }\n        /* jshint boss:true */\n      } while (container = container.parentNode);\n    }\n  }\n  if (undoScale && el !== window) {\n    // Adjust for scale()\n    var elMatrix = matrix(container || el),\n      scaleX = elMatrix && elMatrix.a,\n      scaleY = elMatrix && elMatrix.d;\n    if (elMatrix) {\n      top /= scaleY;\n      left /= scaleX;\n      width /= scaleX;\n      height /= scaleY;\n      bottom = top + height;\n      right = left + width;\n    }\n  }\n  return {\n    top: top,\n    left: left,\n    bottom: bottom,\n    right: right,\n    width: width,\n    height: height\n  };\n}\n\n/**\r\n * Checks if a side of an element is scrolled past a side of its parents\r\n * @param  {HTMLElement}  el           The element who's side being scrolled out of view is in question\r\n * @param  {String}       elSide       Side of the element in question ('top', 'left', 'right', 'bottom')\r\n * @param  {String}       parentSide   Side of the parent in question ('top', 'left', 'right', 'bottom')\r\n * @return {HTMLElement}               The parent scroll element that the el's side is scrolled past, or null if there is no such element\r\n */\nfunction isScrolledPast(el, elSide, parentSide) {\n  var parent = getParentAutoScrollElement(el, true),\n    elSideVal = getRect(el)[elSide];\n\n  /* jshint boss:true */\n  while (parent) {\n    var parentSideVal = getRect(parent)[parentSide],\n      visible = void 0;\n    if (parentSide === 'top' || parentSide === 'left') {\n      visible = elSideVal >= parentSideVal;\n    } else {\n      visible = elSideVal <= parentSideVal;\n    }\n    if (!visible) return parent;\n    if (parent === getWindowScrollingElement()) break;\n    parent = getParentAutoScrollElement(parent, false);\n  }\n  return false;\n}\n\n/**\r\n * Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)\r\n * and non-draggable elements\r\n * @param  {HTMLElement} el       The parent element\r\n * @param  {Number} childNum      The index of the child\r\n * @param  {Object} options       Parent Sortable's options\r\n * @return {HTMLElement}          The child at index childNum, or null if not found\r\n */\nfunction getChild(el, childNum, options, includeDragEl) {\n  var currentChild = 0,\n    i = 0,\n    children = el.children;\n  while (i < children.length) {\n    if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) {\n      if (currentChild === childNum) {\n        return children[i];\n      }\n      currentChild++;\n    }\n    i++;\n  }\n  return null;\n}\n\n/**\r\n * Gets the last child in the el, ignoring ghostEl or invisible elements (clones)\r\n * @param  {HTMLElement} el       Parent element\r\n * @param  {selector} selector    Any other elements that should be ignored\r\n * @return {HTMLElement}          The last child, ignoring ghostEl\r\n */\nfunction lastChild(el, selector) {\n  var last = el.lastElementChild;\n  while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) {\n    last = last.previousElementSibling;\n  }\n  return last || null;\n}\n\n/**\r\n * Returns the index of an element within its parent for a selected set of\r\n * elements\r\n * @param  {HTMLElement} el\r\n * @param  {selector} selector\r\n * @return {number}\r\n */\nfunction index(el, selector) {\n  var index = 0;\n  if (!el || !el.parentNode) {\n    return -1;\n  }\n\n  /* jshint boss:true */\n  while (el = el.previousElementSibling) {\n    if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) {\n      index++;\n    }\n  }\n  return index;\n}\n\n/**\r\n * Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.\r\n * The value is returned in real pixels.\r\n * @param  {HTMLElement} el\r\n * @return {Array}             Offsets in the format of [left, top]\r\n */\nfunction getRelativeScrollOffset(el) {\n  var offsetLeft = 0,\n    offsetTop = 0,\n    winScroller = getWindowScrollingElement();\n  if (el) {\n    do {\n      var elMatrix = matrix(el),\n        scaleX = elMatrix.a,\n        scaleY = elMatrix.d;\n      offsetLeft += el.scrollLeft * scaleX;\n      offsetTop += el.scrollTop * scaleY;\n    } while (el !== winScroller && (el = el.parentNode));\n  }\n  return [offsetLeft, offsetTop];\n}\n\n/**\r\n * Returns the index of the object within the given array\r\n * @param  {Array} arr   Array that may or may not hold the object\r\n * @param  {Object} obj  An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find\r\n * @return {Number}      The index of the object in the array, or -1\r\n */\nfunction indexOfObject(arr, obj) {\n  for (var i in arr) {\n    if (!arr.hasOwnProperty(i)) continue;\n    for (var key in obj) {\n      if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i);\n    }\n  }\n  return -1;\n}\nfunction getParentAutoScrollElement(el, includeSelf) {\n  // skip to window\n  if (!el || !el.getBoundingClientRect) return getWindowScrollingElement();\n  var elem = el;\n  var gotSelf = false;\n  do {\n    // we don't need to get elem css if it isn't even overflowing in the first place (performance)\n    if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {\n      var elemCSS = css(elem);\n      if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) {\n        if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();\n        if (gotSelf || includeSelf) return elem;\n        gotSelf = true;\n      }\n    }\n    /* jshint boss:true */\n  } while (elem = elem.parentNode);\n  return getWindowScrollingElement();\n}\nfunction extend(dst, src) {\n  if (dst && src) {\n    for (var key in src) {\n      if (src.hasOwnProperty(key)) {\n        dst[key] = src[key];\n      }\n    }\n  }\n  return dst;\n}\nfunction isRectEqual(rect1, rect2) {\n  return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width);\n}\nvar _throttleTimeout;\nfunction throttle(callback, ms) {\n  return function () {\n    if (!_throttleTimeout) {\n      var args = arguments,\n        _this = this;\n      if (args.length === 1) {\n        callback.call(_this, args[0]);\n      } else {\n        callback.apply(_this, args);\n      }\n      _throttleTimeout = setTimeout(function () {\n        _throttleTimeout = void 0;\n      }, ms);\n    }\n  };\n}\nfunction cancelThrottle() {\n  clearTimeout(_throttleTimeout);\n  _throttleTimeout = void 0;\n}\nfunction scrollBy(el, x, y) {\n  el.scrollLeft += x;\n  el.scrollTop += y;\n}\nfunction clone(el) {\n  var Polymer = window.Polymer;\n  var $ = window.jQuery || window.Zepto;\n  if (Polymer && Polymer.dom) {\n    return Polymer.dom(el).cloneNode(true);\n  } else if ($) {\n    return $(el).clone(true)[0];\n  } else {\n    return el.cloneNode(true);\n  }\n}\nfunction setRect(el, rect) {\n  css(el, 'position', 'absolute');\n  css(el, 'top', rect.top);\n  css(el, 'left', rect.left);\n  css(el, 'width', rect.width);\n  css(el, 'height', rect.height);\n}\nfunction unsetRect(el) {\n  css(el, 'position', '');\n  css(el, 'top', '');\n  css(el, 'left', '');\n  css(el, 'width', '');\n  css(el, 'height', '');\n}\nfunction getChildContainingRectFromElement(container, options, ghostEl) {\n  var rect = {};\n  Array.from(container.children).forEach(function (child) {\n    var _rect$left, _rect$top, _rect$right, _rect$bottom;\n    if (!closest(child, options.draggable, container, false) || child.animated || child === ghostEl) return;\n    var childRect = getRect(child);\n    rect.left = Math.min((_rect$left = rect.left) !== null && _rect$left !== void 0 ? _rect$left : Infinity, childRect.left);\n    rect.top = Math.min((_rect$top = rect.top) !== null && _rect$top !== void 0 ? _rect$top : Infinity, childRect.top);\n    rect.right = Math.max((_rect$right = rect.right) !== null && _rect$right !== void 0 ? _rect$right : -Infinity, childRect.right);\n    rect.bottom = Math.max((_rect$bottom = rect.bottom) !== null && _rect$bottom !== void 0 ? _rect$bottom : -Infinity, childRect.bottom);\n  });\n  rect.width = rect.right - rect.left;\n  rect.height = rect.bottom - rect.top;\n  rect.x = rect.left;\n  rect.y = rect.top;\n  return rect;\n}\nvar expando = 'Sortable' + new Date().getTime();\n\nfunction AnimationStateManager() {\n  var animationStates = [],\n    animationCallbackId;\n  return {\n    captureAnimationState: function captureAnimationState() {\n      animationStates = [];\n      if (!this.options.animation) return;\n      var children = [].slice.call(this.el.children);\n      children.forEach(function (child) {\n        if (css(child, 'display') === 'none' || child === Sortable.ghost) return;\n        animationStates.push({\n          target: child,\n          rect: getRect(child)\n        });\n        var fromRect = _objectSpread2({}, animationStates[animationStates.length - 1].rect);\n\n        // If animating: compensate for current animation\n        if (child.thisAnimationDuration) {\n          var childMatrix = matrix(child, true);\n          if (childMatrix) {\n            fromRect.top -= childMatrix.f;\n            fromRect.left -= childMatrix.e;\n          }\n        }\n        child.fromRect = fromRect;\n      });\n    },\n    addAnimationState: function addAnimationState(state) {\n      animationStates.push(state);\n    },\n    removeAnimationState: function removeAnimationState(target) {\n      animationStates.splice(indexOfObject(animationStates, {\n        target: target\n      }), 1);\n    },\n    animateAll: function animateAll(callback) {\n      var _this = this;\n      if (!this.options.animation) {\n        clearTimeout(animationCallbackId);\n        if (typeof callback === 'function') callback();\n        return;\n      }\n      var animating = false,\n        animationTime = 0;\n      animationStates.forEach(function (state) {\n        var time = 0,\n          target = state.target,\n          fromRect = target.fromRect,\n          toRect = getRect(target),\n          prevFromRect = target.prevFromRect,\n          prevToRect = target.prevToRect,\n          animatingRect = state.rect,\n          targetMatrix = matrix(target, true);\n        if (targetMatrix) {\n          // Compensate for current animation\n          toRect.top -= targetMatrix.f;\n          toRect.left -= targetMatrix.e;\n        }\n        target.toRect = toRect;\n        if (target.thisAnimationDuration) {\n          // Could also check if animatingRect is between fromRect and toRect\n          if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) &&\n          // Make sure animatingRect is on line between toRect & fromRect\n          (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) {\n            // If returning to same place as started from animation and on same axis\n            time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options);\n          }\n        }\n\n        // if fromRect != toRect: animate\n        if (!isRectEqual(toRect, fromRect)) {\n          target.prevFromRect = fromRect;\n          target.prevToRect = toRect;\n          if (!time) {\n            time = _this.options.animation;\n          }\n          _this.animate(target, animatingRect, toRect, time);\n        }\n        if (time) {\n          animating = true;\n          animationTime = Math.max(animationTime, time);\n          clearTimeout(target.animationResetTimer);\n          target.animationResetTimer = setTimeout(function () {\n            target.animationTime = 0;\n            target.prevFromRect = null;\n            target.fromRect = null;\n            target.prevToRect = null;\n            target.thisAnimationDuration = null;\n          }, time);\n          target.thisAnimationDuration = time;\n        }\n      });\n      clearTimeout(animationCallbackId);\n      if (!animating) {\n        if (typeof callback === 'function') callback();\n      } else {\n        animationCallbackId = setTimeout(function () {\n          if (typeof callback === 'function') callback();\n        }, animationTime);\n      }\n      animationStates = [];\n    },\n    animate: function animate(target, currentRect, toRect, duration) {\n      if (duration) {\n        css(target, 'transition', '');\n        css(target, 'transform', '');\n        var elMatrix = matrix(this.el),\n          scaleX = elMatrix && elMatrix.a,\n          scaleY = elMatrix && elMatrix.d,\n          translateX = (currentRect.left - toRect.left) / (scaleX || 1),\n          translateY = (currentRect.top - toRect.top) / (scaleY || 1);\n        target.animatingX = !!translateX;\n        target.animatingY = !!translateY;\n        css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');\n        this.forRepaintDummy = repaint(target); // repaint\n\n        css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));\n        css(target, 'transform', 'translate3d(0,0,0)');\n        typeof target.animated === 'number' && clearTimeout(target.animated);\n        target.animated = setTimeout(function () {\n          css(target, 'transition', '');\n          css(target, 'transform', '');\n          target.animated = false;\n          target.animatingX = false;\n          target.animatingY = false;\n        }, duration);\n      }\n    }\n  };\n}\nfunction repaint(target) {\n  return target.offsetWidth;\n}\nfunction calculateRealTime(animatingRect, fromRect, toRect, options) {\n  return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation;\n}\n\nvar plugins = [];\nvar defaults = {\n  initializeByDefault: true\n};\nvar PluginManager = {\n  mount: function mount(plugin) {\n    // Set default static properties\n    for (var option in defaults) {\n      if (defaults.hasOwnProperty(option) && !(option in plugin)) {\n        plugin[option] = defaults[option];\n      }\n    }\n    plugins.forEach(function (p) {\n      if (p.pluginName === plugin.pluginName) {\n        throw \"Sortable: Cannot mount plugin \".concat(plugin.pluginName, \" more than once\");\n      }\n    });\n    plugins.push(plugin);\n  },\n  pluginEvent: function pluginEvent(eventName, sortable, evt) {\n    var _this = this;\n    this.eventCanceled = false;\n    evt.cancel = function () {\n      _this.eventCanceled = true;\n    };\n    var eventNameGlobal = eventName + 'Global';\n    plugins.forEach(function (plugin) {\n      if (!sortable[plugin.pluginName]) return;\n      // Fire global events if it exists in this sortable\n      if (sortable[plugin.pluginName][eventNameGlobal]) {\n        sortable[plugin.pluginName][eventNameGlobal](_objectSpread2({\n          sortable: sortable\n        }, evt));\n      }\n\n      // Only fire plugin event if plugin is enabled in this sortable,\n      // and plugin has event defined\n      if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) {\n        sortable[plugin.pluginName][eventName](_objectSpread2({\n          sortable: sortable\n        }, evt));\n      }\n    });\n  },\n  initializePlugins: function initializePlugins(sortable, el, defaults, options) {\n    plugins.forEach(function (plugin) {\n      var pluginName = plugin.pluginName;\n      if (!sortable.options[pluginName] && !plugin.initializeByDefault) return;\n      var initialized = new plugin(sortable, el, sortable.options);\n      initialized.sortable = sortable;\n      initialized.options = sortable.options;\n      sortable[pluginName] = initialized;\n\n      // Add default options from plugin\n      _extends(defaults, initialized.defaults);\n    });\n    for (var option in sortable.options) {\n      if (!sortable.options.hasOwnProperty(option)) continue;\n      var modified = this.modifyOption(sortable, option, sortable.options[option]);\n      if (typeof modified !== 'undefined') {\n        sortable.options[option] = modified;\n      }\n    }\n  },\n  getEventProperties: function getEventProperties(name, sortable) {\n    var eventProperties = {};\n    plugins.forEach(function (plugin) {\n      if (typeof plugin.eventProperties !== 'function') return;\n      _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));\n    });\n    return eventProperties;\n  },\n  modifyOption: function modifyOption(sortable, name, value) {\n    var modifiedValue;\n    plugins.forEach(function (plugin) {\n      // Plugin must exist on the Sortable\n      if (!sortable[plugin.pluginName]) return;\n\n      // If static option listener exists for this option, call in the context of the Sortable's instance of this plugin\n      if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') {\n        modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);\n      }\n    });\n    return modifiedValue;\n  }\n};\n\nfunction dispatchEvent(_ref) {\n  var sortable = _ref.sortable,\n    rootEl = _ref.rootEl,\n    name = _ref.name,\n    targetEl = _ref.targetEl,\n    cloneEl = _ref.cloneEl,\n    toEl = _ref.toEl,\n    fromEl = _ref.fromEl,\n    oldIndex = _ref.oldIndex,\n    newIndex = _ref.newIndex,\n    oldDraggableIndex = _ref.oldDraggableIndex,\n    newDraggableIndex = _ref.newDraggableIndex,\n    originalEvent = _ref.originalEvent,\n    putSortable = _ref.putSortable,\n    extraEventProperties = _ref.extraEventProperties;\n  sortable = sortable || rootEl && rootEl[expando];\n  if (!sortable) return;\n  var evt,\n    options = sortable.options,\n    onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);\n  // Support for new CustomEvent feature\n  if (window.CustomEvent && !IE11OrLess && !Edge) {\n    evt = new CustomEvent(name, {\n      bubbles: true,\n      cancelable: true\n    });\n  } else {\n    evt = document.createEvent('Event');\n    evt.initEvent(name, true, true);\n  }\n  evt.to = toEl || rootEl;\n  evt.from = fromEl || rootEl;\n  evt.item = targetEl || rootEl;\n  evt.clone = cloneEl;\n  evt.oldIndex = oldIndex;\n  evt.newIndex = newIndex;\n  evt.oldDraggableIndex = oldDraggableIndex;\n  evt.newDraggableIndex = newDraggableIndex;\n  evt.originalEvent = originalEvent;\n  evt.pullMode = putSortable ? putSortable.lastPutMode : undefined;\n  var allEventProperties = _objectSpread2(_objectSpread2({}, extraEventProperties), PluginManager.getEventProperties(name, sortable));\n  for (var option in allEventProperties) {\n    evt[option] = allEventProperties[option];\n  }\n  if (rootEl) {\n    rootEl.dispatchEvent(evt);\n  }\n  if (options[onName]) {\n    options[onName].call(sortable, evt);\n  }\n}\n\nvar _excluded = [\"evt\"];\nvar pluginEvent = function pluginEvent(eventName, sortable) {\n  var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},\n    originalEvent = _ref.evt,\n    data = _objectWithoutProperties(_ref, _excluded);\n  PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread2({\n    dragEl: dragEl,\n    parentEl: parentEl,\n    ghostEl: ghostEl,\n    rootEl: rootEl,\n    nextEl: nextEl,\n    lastDownEl: lastDownEl,\n    cloneEl: cloneEl,\n    cloneHidden: cloneHidden,\n    dragStarted: moved,\n    putSortable: putSortable,\n    activeSortable: Sortable.active,\n    originalEvent: originalEvent,\n    oldIndex: oldIndex,\n    oldDraggableIndex: oldDraggableIndex,\n    newIndex: newIndex,\n    newDraggableIndex: newDraggableIndex,\n    hideGhostForTarget: _hideGhostForTarget,\n    unhideGhostForTarget: _unhideGhostForTarget,\n    cloneNowHidden: function cloneNowHidden() {\n      cloneHidden = true;\n    },\n    cloneNowShown: function cloneNowShown() {\n      cloneHidden = false;\n    },\n    dispatchSortableEvent: function dispatchSortableEvent(name) {\n      _dispatchEvent({\n        sortable: sortable,\n        name: name,\n        originalEvent: originalEvent\n      });\n    }\n  }, data));\n};\nfunction _dispatchEvent(info) {\n  dispatchEvent(_objectSpread2({\n    putSortable: putSortable,\n    cloneEl: cloneEl,\n    targetEl: dragEl,\n    rootEl: rootEl,\n    oldIndex: oldIndex,\n    oldDraggableIndex: oldDraggableIndex,\n    newIndex: newIndex,\n    newDraggableIndex: newDraggableIndex\n  }, info));\n}\nvar dragEl,\n  parentEl,\n  ghostEl,\n  rootEl,\n  nextEl,\n  lastDownEl,\n  cloneEl,\n  cloneHidden,\n  oldIndex,\n  newIndex,\n  oldDraggableIndex,\n  newDraggableIndex,\n  activeGroup,\n  putSortable,\n  awaitingDragStarted = false,\n  ignoreNextClick = false,\n  sortables = [],\n  tapEvt,\n  touchEvt,\n  lastDx,\n  lastDy,\n  tapDistanceLeft,\n  tapDistanceTop,\n  moved,\n  lastTarget,\n  lastDirection,\n  pastFirstInvertThresh = false,\n  isCircumstantialInvert = false,\n  targetMoveDistance,\n  // For positioning ghost absolutely\n  ghostRelativeParent,\n  ghostRelativeParentInitialScroll = [],\n  // (left, top)\n\n  _silent = false,\n  savedInputChecked = [];\n\n/** @const */\nvar documentExists = typeof document !== 'undefined',\n  PositionGhostAbsolutely = IOS,\n  CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float',\n  // This will not pass for IE9, because IE9 DnD only works on anchors\n  supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),\n  supportCssPointerEvents = function () {\n    if (!documentExists) return;\n    // false when <= IE11\n    if (IE11OrLess) {\n      return false;\n    }\n    var el = document.createElement('x');\n    el.style.cssText = 'pointer-events:auto';\n    return el.style.pointerEvents === 'auto';\n  }(),\n  _detectDirection = function _detectDirection(el, options) {\n    var elCSS = css(el),\n      elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth),\n      child1 = getChild(el, 0, options),\n      child2 = getChild(el, 1, options),\n      firstChildCSS = child1 && css(child1),\n      secondChildCSS = child2 && css(child2),\n      firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width,\n      secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width;\n    if (elCSS.display === 'flex') {\n      return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal';\n    }\n    if (elCSS.display === 'grid') {\n      return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal';\n    }\n    if (child1 && firstChildCSS[\"float\"] && firstChildCSS[\"float\"] !== 'none') {\n      var touchingSideChild2 = firstChildCSS[\"float\"] === 'left' ? 'left' : 'right';\n      return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal';\n    }\n    return child1 && (firstChildCSS.display === 'block' || firstChildCSS.display === 'flex' || firstChildCSS.display === 'table' || firstChildCSS.display === 'grid' || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === 'none' || child2 && elCSS[CSSFloatProperty] === 'none' && firstChildWidth + secondChildWidth > elWidth) ? 'vertical' : 'horizontal';\n  },\n  _dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) {\n    var dragElS1Opp = vertical ? dragRect.left : dragRect.top,\n      dragElS2Opp = vertical ? dragRect.right : dragRect.bottom,\n      dragElOppLength = vertical ? dragRect.width : dragRect.height,\n      targetS1Opp = vertical ? targetRect.left : targetRect.top,\n      targetS2Opp = vertical ? targetRect.right : targetRect.bottom,\n      targetOppLength = vertical ? targetRect.width : targetRect.height;\n    return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;\n  },\n  /**\r\n   * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.\r\n   * @param  {Number} x      X position\r\n   * @param  {Number} y      Y position\r\n   * @return {HTMLElement}   Element of the first found nearest Sortable\r\n   */\n  _detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {\n    var ret;\n    sortables.some(function (sortable) {\n      var threshold = sortable[expando].options.emptyInsertThreshold;\n      if (!threshold || lastChild(sortable)) return;\n      var rect = getRect(sortable),\n        insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold,\n        insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;\n      if (insideHorizontally && insideVertically) {\n        return ret = sortable;\n      }\n    });\n    return ret;\n  },\n  _prepareGroup = function _prepareGroup(options) {\n    function toFn(value, pull) {\n      return function (to, from, dragEl, evt) {\n        var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;\n        if (value == null && (pull || sameGroup)) {\n          // Default pull value\n          // Default pull and put value if same group\n          return true;\n        } else if (value == null || value === false) {\n          return false;\n        } else if (pull && value === 'clone') {\n          return value;\n        } else if (typeof value === 'function') {\n          return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt);\n        } else {\n          var otherGroup = (pull ? to : from).options.group.name;\n          return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;\n        }\n      };\n    }\n    var group = {};\n    var originalGroup = options.group;\n    if (!originalGroup || _typeof(originalGroup) != 'object') {\n      originalGroup = {\n        name: originalGroup\n      };\n    }\n    group.name = originalGroup.name;\n    group.checkPull = toFn(originalGroup.pull, true);\n    group.checkPut = toFn(originalGroup.put);\n    group.revertClone = originalGroup.revertClone;\n    options.group = group;\n  },\n  _hideGhostForTarget = function _hideGhostForTarget() {\n    if (!supportCssPointerEvents && ghostEl) {\n      css(ghostEl, 'display', 'none');\n    }\n  },\n  _unhideGhostForTarget = function _unhideGhostForTarget() {\n    if (!supportCssPointerEvents && ghostEl) {\n      css(ghostEl, 'display', '');\n    }\n  };\n\n// #1184 fix - Prevent click event on fallback if dragged but item not changed position\nif (documentExists && !ChromeForAndroid) {\n  document.addEventListener('click', function (evt) {\n    if (ignoreNextClick) {\n      evt.preventDefault();\n      evt.stopPropagation && evt.stopPropagation();\n      evt.stopImmediatePropagation && evt.stopImmediatePropagation();\n      ignoreNextClick = false;\n      return false;\n    }\n  }, true);\n}\nvar nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) {\n  if (dragEl) {\n    evt = evt.touches ? evt.touches[0] : evt;\n    var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);\n    if (nearest) {\n      // Create imitation event\n      var event = {};\n      for (var i in evt) {\n        if (evt.hasOwnProperty(i)) {\n          event[i] = evt[i];\n        }\n      }\n      event.target = event.rootEl = nearest;\n      event.preventDefault = void 0;\n      event.stopPropagation = void 0;\n      nearest[expando]._onDragOver(event);\n    }\n  }\n};\nvar _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) {\n  if (dragEl) {\n    dragEl.parentNode[expando]._isOutsideThisEl(evt.target);\n  }\n};\n\n/**\r\n * @class  Sortable\r\n * @param  {HTMLElement}  el\r\n * @param  {Object}       [options]\r\n */\nfunction Sortable(el, options) {\n  if (!(el && el.nodeType && el.nodeType === 1)) {\n    throw \"Sortable: `el` must be an HTMLElement, not \".concat({}.toString.call(el));\n  }\n  this.el = el; // root element\n  this.options = options = _extends({}, options);\n\n  // Export instance\n  el[expando] = this;\n  var defaults = {\n    group: null,\n    sort: true,\n    disabled: false,\n    store: null,\n    handle: null,\n    draggable: /^[uo]l$/i.test(el.nodeName) ? '>li' : '>*',\n    swapThreshold: 1,\n    // percentage; 0 <= x <= 1\n    invertSwap: false,\n    // invert always\n    invertedSwapThreshold: null,\n    // will be set to same as swapThreshold if default\n    removeCloneOnHide: true,\n    direction: function direction() {\n      return _detectDirection(el, this.options);\n    },\n    ghostClass: 'sortable-ghost',\n    chosenClass: 'sortable-chosen',\n    dragClass: 'sortable-drag',\n    ignore: 'a, img',\n    filter: null,\n    preventOnFilter: true,\n    animation: 0,\n    easing: null,\n    setData: function setData(dataTransfer, dragEl) {\n      dataTransfer.setData('Text', dragEl.textContent);\n    },\n    dropBubble: false,\n    dragoverBubble: false,\n    dataIdAttr: 'data-id',\n    delay: 0,\n    delayOnTouchOnly: false,\n    touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,\n    forceFallback: false,\n    fallbackClass: 'sortable-fallback',\n    fallbackOnBody: false,\n    fallbackTolerance: 0,\n    fallbackOffset: {\n      x: 0,\n      y: 0\n    },\n    // Disabled on Safari: #1571; Enabled on Safari IOS: #2244\n    supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && (!Safari || IOS),\n    emptyInsertThreshold: 5\n  };\n  PluginManager.initializePlugins(this, el, defaults);\n\n  // Set default options\n  for (var name in defaults) {\n    !(name in options) && (options[name] = defaults[name]);\n  }\n  _prepareGroup(options);\n\n  // Bind all private methods\n  for (var fn in this) {\n    if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n      this[fn] = this[fn].bind(this);\n    }\n  }\n\n  // Setup drag mode\n  this.nativeDraggable = options.forceFallback ? false : supportDraggable;\n  if (this.nativeDraggable) {\n    // Touch start threshold cannot be greater than the native dragstart threshold\n    this.options.touchStartThreshold = 1;\n  }\n\n  // Bind events\n  if (options.supportPointer) {\n    on(el, 'pointerdown', this._onTapStart);\n  } else {\n    on(el, 'mousedown', this._onTapStart);\n    on(el, 'touchstart', this._onTapStart);\n  }\n  if (this.nativeDraggable) {\n    on(el, 'dragover', this);\n    on(el, 'dragenter', this);\n  }\n  sortables.push(this.el);\n\n  // Restore sorting\n  options.store && options.store.get && this.sort(options.store.get(this) || []);\n\n  // Add animation state manager\n  _extends(this, AnimationStateManager());\n}\nSortable.prototype = /** @lends Sortable.prototype */{\n  constructor: Sortable,\n  _isOutsideThisEl: function _isOutsideThisEl(target) {\n    if (!this.el.contains(target) && target !== this.el) {\n      lastTarget = null;\n    }\n  },\n  _getDirection: function _getDirection(evt, target) {\n    return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;\n  },\n  _onTapStart: function _onTapStart( /** Event|TouchEvent */evt) {\n    if (!evt.cancelable) return;\n    var _this = this,\n      el = this.el,\n      options = this.options,\n      preventOnFilter = options.preventOnFilter,\n      type = evt.type,\n      touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt,\n      target = (touch || evt).target,\n      originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target,\n      filter = options.filter;\n    _saveInputCheckedState(el);\n\n    // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.\n    if (dragEl) {\n      return;\n    }\n    if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {\n      return; // only left button and enabled\n    }\n\n    // cancel dnd if original target is content editable\n    if (originalTarget.isContentEditable) {\n      return;\n    }\n\n    // Safari ignores further event handling after mousedown\n    if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {\n      return;\n    }\n    target = closest(target, options.draggable, el, false);\n    if (target && target.animated) {\n      return;\n    }\n    if (lastDownEl === target) {\n      // Ignoring duplicate `down`\n      return;\n    }\n\n    // Get the index of the dragged element within its parent\n    oldIndex = index(target);\n    oldDraggableIndex = index(target, options.draggable);\n\n    // Check filter\n    if (typeof filter === 'function') {\n      if (filter.call(this, evt, target, this)) {\n        _dispatchEvent({\n          sortable: _this,\n          rootEl: originalTarget,\n          name: 'filter',\n          targetEl: target,\n          toEl: el,\n          fromEl: el\n        });\n        pluginEvent('filter', _this, {\n          evt: evt\n        });\n        preventOnFilter && evt.preventDefault();\n        return; // cancel dnd\n      }\n    } else if (filter) {\n      filter = filter.split(',').some(function (criteria) {\n        criteria = closest(originalTarget, criteria.trim(), el, false);\n        if (criteria) {\n          _dispatchEvent({\n            sortable: _this,\n            rootEl: criteria,\n            name: 'filter',\n            targetEl: target,\n            fromEl: el,\n            toEl: el\n          });\n          pluginEvent('filter', _this, {\n            evt: evt\n          });\n          return true;\n        }\n      });\n      if (filter) {\n        preventOnFilter && evt.preventDefault();\n        return; // cancel dnd\n      }\n    }\n    if (options.handle && !closest(originalTarget, options.handle, el, false)) {\n      return;\n    }\n\n    // Prepare `dragstart`\n    this._prepareDragStart(evt, touch, target);\n  },\n  _prepareDragStart: function _prepareDragStart( /** Event */evt, /** Touch */touch, /** HTMLElement */target) {\n    var _this = this,\n      el = _this.el,\n      options = _this.options,\n      ownerDocument = el.ownerDocument,\n      dragStartFn;\n    if (target && !dragEl && target.parentNode === el) {\n      var dragRect = getRect(target);\n      rootEl = el;\n      dragEl = target;\n      parentEl = dragEl.parentNode;\n      nextEl = dragEl.nextSibling;\n      lastDownEl = target;\n      activeGroup = options.group;\n      Sortable.dragged = dragEl;\n      tapEvt = {\n        target: dragEl,\n        clientX: (touch || evt).clientX,\n        clientY: (touch || evt).clientY\n      };\n      tapDistanceLeft = tapEvt.clientX - dragRect.left;\n      tapDistanceTop = tapEvt.clientY - dragRect.top;\n      this._lastX = (touch || evt).clientX;\n      this._lastY = (touch || evt).clientY;\n      dragEl.style['will-change'] = 'all';\n      dragStartFn = function dragStartFn() {\n        pluginEvent('delayEnded', _this, {\n          evt: evt\n        });\n        if (Sortable.eventCanceled) {\n          _this._onDrop();\n          return;\n        }\n        // Delayed drag has been triggered\n        // we can re-enable the events: touchmove/mousemove\n        _this._disableDelayedDragEvents();\n        if (!FireFox && _this.nativeDraggable) {\n          dragEl.draggable = true;\n        }\n\n        // Bind the events: dragstart/dragend\n        _this._triggerDragStart(evt, touch);\n\n        // Drag start event\n        _dispatchEvent({\n          sortable: _this,\n          name: 'choose',\n          originalEvent: evt\n        });\n\n        // Chosen item\n        toggleClass(dragEl, options.chosenClass, true);\n      };\n\n      // Disable \"draggable\"\n      options.ignore.split(',').forEach(function (criteria) {\n        find(dragEl, criteria.trim(), _disableDraggable);\n      });\n      on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);\n      on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);\n      on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);\n      if (options.supportPointer) {\n        on(ownerDocument, 'pointerup', _this._onDrop);\n        // Native D&D triggers pointercancel\n        !this.nativeDraggable && on(ownerDocument, 'pointercancel', _this._onDrop);\n      } else {\n        on(ownerDocument, 'mouseup', _this._onDrop);\n        on(ownerDocument, 'touchend', _this._onDrop);\n        on(ownerDocument, 'touchcancel', _this._onDrop);\n      }\n\n      // Make dragEl draggable (must be before delay for FireFox)\n      if (FireFox && this.nativeDraggable) {\n        this.options.touchStartThreshold = 4;\n        dragEl.draggable = true;\n      }\n      pluginEvent('delayStart', this, {\n        evt: evt\n      });\n\n      // Delay is impossible for native DnD in Edge or IE\n      if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {\n        if (Sortable.eventCanceled) {\n          this._onDrop();\n          return;\n        }\n        // If the user moves the pointer or let go the click or touch\n        // before the delay has been reached:\n        // disable the delayed drag\n        if (options.supportPointer) {\n          on(ownerDocument, 'pointerup', _this._disableDelayedDrag);\n          on(ownerDocument, 'pointercancel', _this._disableDelayedDrag);\n        } else {\n          on(ownerDocument, 'mouseup', _this._disableDelayedDrag);\n          on(ownerDocument, 'touchend', _this._disableDelayedDrag);\n          on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);\n        }\n        on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);\n        on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);\n        options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);\n        _this._dragStartTimer = setTimeout(dragStartFn, options.delay);\n      } else {\n        dragStartFn();\n      }\n    }\n  },\n  _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler( /** TouchEvent|PointerEvent **/e) {\n    var touch = e.touches ? e.touches[0] : e;\n    if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) {\n      this._disableDelayedDrag();\n    }\n  },\n  _disableDelayedDrag: function _disableDelayedDrag() {\n    dragEl && _disableDraggable(dragEl);\n    clearTimeout(this._dragStartTimer);\n    this._disableDelayedDragEvents();\n  },\n  _disableDelayedDragEvents: function _disableDelayedDragEvents() {\n    var ownerDocument = this.el.ownerDocument;\n    off(ownerDocument, 'mouseup', this._disableDelayedDrag);\n    off(ownerDocument, 'touchend', this._disableDelayedDrag);\n    off(ownerDocument, 'touchcancel', this._disableDelayedDrag);\n    off(ownerDocument, 'pointerup', this._disableDelayedDrag);\n    off(ownerDocument, 'pointercancel', this._disableDelayedDrag);\n    off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);\n    off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);\n    off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);\n  },\n  _triggerDragStart: function _triggerDragStart( /** Event */evt, /** Touch */touch) {\n    touch = touch || evt.pointerType == 'touch' && evt;\n    if (!this.nativeDraggable || touch) {\n      if (this.options.supportPointer) {\n        on(document, 'pointermove', this._onTouchMove);\n      } else if (touch) {\n        on(document, 'touchmove', this._onTouchMove);\n      } else {\n        on(document, 'mousemove', this._onTouchMove);\n      }\n    } else {\n      on(dragEl, 'dragend', this);\n      on(rootEl, 'dragstart', this._onDragStart);\n    }\n    try {\n      if (document.selection) {\n        _nextTick(function () {\n          document.selection.empty();\n        });\n      } else {\n        window.getSelection().removeAllRanges();\n      }\n    } catch (err) {}\n  },\n  _dragStarted: function _dragStarted(fallback, evt) {\n    awaitingDragStarted = false;\n    if (rootEl && dragEl) {\n      pluginEvent('dragStarted', this, {\n        evt: evt\n      });\n      if (this.nativeDraggable) {\n        on(document, 'dragover', _checkOutsideTargetEl);\n      }\n      var options = this.options;\n\n      // Apply effect\n      !fallback && toggleClass(dragEl, options.dragClass, false);\n      toggleClass(dragEl, options.ghostClass, true);\n      Sortable.active = this;\n      fallback && this._appendGhost();\n\n      // Drag start event\n      _dispatchEvent({\n        sortable: this,\n        name: 'start',\n        originalEvent: evt\n      });\n    } else {\n      this._nulling();\n    }\n  },\n  _emulateDragOver: function _emulateDragOver() {\n    if (touchEvt) {\n      this._lastX = touchEvt.clientX;\n      this._lastY = touchEvt.clientY;\n      _hideGhostForTarget();\n      var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY);\n      var parent = target;\n      while (target && target.shadowRoot) {\n        target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);\n        if (target === parent) break;\n        parent = target;\n      }\n      dragEl.parentNode[expando]._isOutsideThisEl(target);\n      if (parent) {\n        do {\n          if (parent[expando]) {\n            var inserted = void 0;\n            inserted = parent[expando]._onDragOver({\n              clientX: touchEvt.clientX,\n              clientY: touchEvt.clientY,\n              target: target,\n              rootEl: parent\n            });\n            if (inserted && !this.options.dragoverBubble) {\n              break;\n            }\n          }\n          target = parent; // store last element\n        }\n        /* jshint boss:true */ while (parent = getParentOrHost(parent));\n      }\n      _unhideGhostForTarget();\n    }\n  },\n  _onTouchMove: function _onTouchMove( /**TouchEvent*/evt) {\n    if (tapEvt) {\n      var options = this.options,\n        fallbackTolerance = options.fallbackTolerance,\n        fallbackOffset = options.fallbackOffset,\n        touch = evt.touches ? evt.touches[0] : evt,\n        ghostMatrix = ghostEl && matrix(ghostEl, true),\n        scaleX = ghostEl && ghostMatrix && ghostMatrix.a,\n        scaleY = ghostEl && ghostMatrix && ghostMatrix.d,\n        relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent),\n        dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1),\n        dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1);\n\n      // only set the status to dragging, when we are actually dragging\n      if (!Sortable.active && !awaitingDragStarted) {\n        if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) {\n          return;\n        }\n        this._onDragStart(evt, true);\n      }\n      if (ghostEl) {\n        if (ghostMatrix) {\n          ghostMatrix.e += dx - (lastDx || 0);\n          ghostMatrix.f += dy - (lastDy || 0);\n        } else {\n          ghostMatrix = {\n            a: 1,\n            b: 0,\n            c: 0,\n            d: 1,\n            e: dx,\n            f: dy\n          };\n        }\n        var cssMatrix = \"matrix(\".concat(ghostMatrix.a, \",\").concat(ghostMatrix.b, \",\").concat(ghostMatrix.c, \",\").concat(ghostMatrix.d, \",\").concat(ghostMatrix.e, \",\").concat(ghostMatrix.f, \")\");\n        css(ghostEl, 'webkitTransform', cssMatrix);\n        css(ghostEl, 'mozTransform', cssMatrix);\n        css(ghostEl, 'msTransform', cssMatrix);\n        css(ghostEl, 'transform', cssMatrix);\n        lastDx = dx;\n        lastDy = dy;\n        touchEvt = touch;\n      }\n      evt.cancelable && evt.preventDefault();\n    }\n  },\n  _appendGhost: function _appendGhost() {\n    // Bug if using scale(): https://stackoverflow.com/questions/2637058\n    // Not being adjusted for\n    if (!ghostEl) {\n      var container = this.options.fallbackOnBody ? document.body : rootEl,\n        rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container),\n        options = this.options;\n\n      // Position absolutely\n      if (PositionGhostAbsolutely) {\n        // Get relatively positioned parent\n        ghostRelativeParent = container;\n        while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) {\n          ghostRelativeParent = ghostRelativeParent.parentNode;\n        }\n        if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) {\n          if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement();\n          rect.top += ghostRelativeParent.scrollTop;\n          rect.left += ghostRelativeParent.scrollLeft;\n        } else {\n          ghostRelativeParent = getWindowScrollingElement();\n        }\n        ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent);\n      }\n      ghostEl = dragEl.cloneNode(true);\n      toggleClass(ghostEl, options.ghostClass, false);\n      toggleClass(ghostEl, options.fallbackClass, true);\n      toggleClass(ghostEl, options.dragClass, true);\n      css(ghostEl, 'transition', '');\n      css(ghostEl, 'transform', '');\n      css(ghostEl, 'box-sizing', 'border-box');\n      css(ghostEl, 'margin', 0);\n      css(ghostEl, 'top', rect.top);\n      css(ghostEl, 'left', rect.left);\n      css(ghostEl, 'width', rect.width);\n      css(ghostEl, 'height', rect.height);\n      css(ghostEl, 'opacity', '0.8');\n      css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed');\n      css(ghostEl, 'zIndex', '100000');\n      css(ghostEl, 'pointerEvents', 'none');\n      Sortable.ghost = ghostEl;\n      container.appendChild(ghostEl);\n\n      // Set transform-origin\n      css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%');\n    }\n  },\n  _onDragStart: function _onDragStart( /**Event*/evt, /**boolean*/fallback) {\n    var _this = this;\n    var dataTransfer = evt.dataTransfer;\n    var options = _this.options;\n    pluginEvent('dragStart', this, {\n      evt: evt\n    });\n    if (Sortable.eventCanceled) {\n      this._onDrop();\n      return;\n    }\n    pluginEvent('setupClone', this);\n    if (!Sortable.eventCanceled) {\n      cloneEl = clone(dragEl);\n      cloneEl.removeAttribute(\"id\");\n      cloneEl.draggable = false;\n      cloneEl.style['will-change'] = '';\n      this._hideClone();\n      toggleClass(cloneEl, this.options.chosenClass, false);\n      Sortable.clone = cloneEl;\n    }\n\n    // #1143: IFrame support workaround\n    _this.cloneId = _nextTick(function () {\n      pluginEvent('clone', _this);\n      if (Sortable.eventCanceled) return;\n      if (!_this.options.removeCloneOnHide) {\n        rootEl.insertBefore(cloneEl, dragEl);\n      }\n      _this._hideClone();\n      _dispatchEvent({\n        sortable: _this,\n        name: 'clone'\n      });\n    });\n    !fallback && toggleClass(dragEl, options.dragClass, true);\n\n    // Set proper drop events\n    if (fallback) {\n      ignoreNextClick = true;\n      _this._loopId = setInterval(_this._emulateDragOver, 50);\n    } else {\n      // Undo what was set in _prepareDragStart before drag started\n      off(document, 'mouseup', _this._onDrop);\n      off(document, 'touchend', _this._onDrop);\n      off(document, 'touchcancel', _this._onDrop);\n      if (dataTransfer) {\n        dataTransfer.effectAllowed = 'move';\n        options.setData && options.setData.call(_this, dataTransfer, dragEl);\n      }\n      on(document, 'drop', _this);\n\n      // #1276 fix:\n      css(dragEl, 'transform', 'translateZ(0)');\n    }\n    awaitingDragStarted = true;\n    _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));\n    on(document, 'selectstart', _this);\n    moved = true;\n    window.getSelection().removeAllRanges();\n    if (Safari) {\n      css(document.body, 'user-select', 'none');\n    }\n  },\n  // Returns true - if no further action is needed (either inserted or another condition)\n  _onDragOver: function _onDragOver( /**Event*/evt) {\n    var el = this.el,\n      target = evt.target,\n      dragRect,\n      targetRect,\n      revert,\n      options = this.options,\n      group = options.group,\n      activeSortable = Sortable.active,\n      isOwner = activeGroup === group,\n      canSort = options.sort,\n      fromSortable = putSortable || activeSortable,\n      vertical,\n      _this = this,\n      completedFired = false;\n    if (_silent) return;\n    function dragOverEvent(name, extra) {\n      pluginEvent(name, _this, _objectSpread2({\n        evt: evt,\n        isOwner: isOwner,\n        axis: vertical ? 'vertical' : 'horizontal',\n        revert: revert,\n        dragRect: dragRect,\n        targetRect: targetRect,\n        canSort: canSort,\n        fromSortable: fromSortable,\n        target: target,\n        completed: completed,\n        onMove: function onMove(target, after) {\n          return _onMove(rootEl, el, dragEl, dragRect, target, getRect(target), evt, after);\n        },\n        changed: changed\n      }, extra));\n    }\n\n    // Capture animation state\n    function capture() {\n      dragOverEvent('dragOverAnimationCapture');\n      _this.captureAnimationState();\n      if (_this !== fromSortable) {\n        fromSortable.captureAnimationState();\n      }\n    }\n\n    // Return invocation when dragEl is inserted (or completed)\n    function completed(insertion) {\n      dragOverEvent('dragOverCompleted', {\n        insertion: insertion\n      });\n      if (insertion) {\n        // Clones must be hidden before folding animation to capture dragRectAbsolute properly\n        if (isOwner) {\n          activeSortable._hideClone();\n        } else {\n          activeSortable._showClone(_this);\n        }\n        if (_this !== fromSortable) {\n          // Set ghost class to new sortable's ghost class\n          toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false);\n          toggleClass(dragEl, options.ghostClass, true);\n        }\n        if (putSortable !== _this && _this !== Sortable.active) {\n          putSortable = _this;\n        } else if (_this === Sortable.active && putSortable) {\n          putSortable = null;\n        }\n\n        // Animation\n        if (fromSortable === _this) {\n          _this._ignoreWhileAnimating = target;\n        }\n        _this.animateAll(function () {\n          dragOverEvent('dragOverAnimationComplete');\n          _this._ignoreWhileAnimating = null;\n        });\n        if (_this !== fromSortable) {\n          fromSortable.animateAll();\n          fromSortable._ignoreWhileAnimating = null;\n        }\n      }\n\n      // Null lastTarget if it is not inside a previously swapped element\n      if (target === dragEl && !dragEl.animated || target === el && !target.animated) {\n        lastTarget = null;\n      }\n\n      // no bubbling and not fallback\n      if (!options.dragoverBubble && !evt.rootEl && target !== document) {\n        dragEl.parentNode[expando]._isOutsideThisEl(evt.target);\n\n        // Do not detect for empty insert if already inserted\n        !insertion && nearestEmptyInsertDetectEvent(evt);\n      }\n      !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation();\n      return completedFired = true;\n    }\n\n    // Call when dragEl has been inserted\n    function changed() {\n      newIndex = index(dragEl);\n      newDraggableIndex = index(dragEl, options.draggable);\n      _dispatchEvent({\n        sortable: _this,\n        name: 'change',\n        toEl: el,\n        newIndex: newIndex,\n        newDraggableIndex: newDraggableIndex,\n        originalEvent: evt\n      });\n    }\n    if (evt.preventDefault !== void 0) {\n      evt.cancelable && evt.preventDefault();\n    }\n    target = closest(target, options.draggable, el, true);\n    dragOverEvent('dragOver');\n    if (Sortable.eventCanceled) return completedFired;\n    if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) {\n      return completed(false);\n    }\n    ignoreNextClick = false;\n    if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = parentEl !== rootEl) // Reverting item into the original list\n    : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {\n      vertical = this._getDirection(evt, target) === 'vertical';\n      dragRect = getRect(dragEl);\n      dragOverEvent('dragOverValid');\n      if (Sortable.eventCanceled) return completedFired;\n      if (revert) {\n        parentEl = rootEl; // actualization\n        capture();\n        this._hideClone();\n        dragOverEvent('revert');\n        if (!Sortable.eventCanceled) {\n          if (nextEl) {\n            rootEl.insertBefore(dragEl, nextEl);\n          } else {\n            rootEl.appendChild(dragEl);\n          }\n        }\n        return completed(true);\n      }\n      var elLastChild = lastChild(el, options.draggable);\n      if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {\n        // Insert to end of list\n\n        // If already at end of list: Do not insert\n        if (elLastChild === dragEl) {\n          return completed(false);\n        }\n\n        // if there is a last element, it is the target\n        if (elLastChild && el === evt.target) {\n          target = elLastChild;\n        }\n        if (target) {\n          targetRect = getRect(target);\n        }\n        if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {\n          capture();\n          if (elLastChild && elLastChild.nextSibling) {\n            // the last draggable element is not the last node\n            el.insertBefore(dragEl, elLastChild.nextSibling);\n          } else {\n            el.appendChild(dragEl);\n          }\n          parentEl = el; // actualization\n\n          changed();\n          return completed(true);\n        }\n      } else if (elLastChild && _ghostIsFirst(evt, vertical, this)) {\n        // Insert to start of list\n        var firstChild = getChild(el, 0, options, true);\n        if (firstChild === dragEl) {\n          return completed(false);\n        }\n        target = firstChild;\n        targetRect = getRect(target);\n        if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) {\n          capture();\n          el.insertBefore(dragEl, firstChild);\n          parentEl = el; // actualization\n\n          changed();\n          return completed(true);\n        }\n      } else if (target.parentNode === el) {\n        targetRect = getRect(target);\n        var direction = 0,\n          targetBeforeFirstSwap,\n          differentLevel = dragEl.parentNode !== el,\n          differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical),\n          side1 = vertical ? 'top' : 'left',\n          scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'),\n          scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0;\n        if (lastTarget !== target) {\n          targetBeforeFirstSwap = targetRect[side1];\n          pastFirstInvertThresh = false;\n          isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel;\n        }\n        direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target);\n        var sibling;\n        if (direction !== 0) {\n          // Check if target is beside dragEl in respective direction (ignoring hidden elements)\n          var dragIndex = index(dragEl);\n          do {\n            dragIndex -= direction;\n            sibling = parentEl.children[dragIndex];\n          } while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl));\n        }\n        // If dragEl is already beside target: Do not insert\n        if (direction === 0 || sibling === target) {\n          return completed(false);\n        }\n        lastTarget = target;\n        lastDirection = direction;\n        var nextSibling = target.nextElementSibling,\n          after = false;\n        after = direction === 1;\n        var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);\n        if (moveVector !== false) {\n          if (moveVector === 1 || moveVector === -1) {\n            after = moveVector === 1;\n          }\n          _silent = true;\n          setTimeout(_unsilent, 30);\n          capture();\n          if (after && !nextSibling) {\n            el.appendChild(dragEl);\n          } else {\n            target.parentNode.insertBefore(dragEl, after ? nextSibling : target);\n          }\n\n          // Undo chrome's scroll adjustment (has no effect on other browsers)\n          if (scrolledPastTop) {\n            scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);\n          }\n          parentEl = dragEl.parentNode; // actualization\n\n          // must be done before animation\n          if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) {\n            targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]);\n          }\n          changed();\n          return completed(true);\n        }\n      }\n      if (el.contains(dragEl)) {\n        return completed(false);\n      }\n    }\n    return false;\n  },\n  _ignoreWhileAnimating: null,\n  _offMoveEvents: function _offMoveEvents() {\n    off(document, 'mousemove', this._onTouchMove);\n    off(document, 'touchmove', this._onTouchMove);\n    off(document, 'pointermove', this._onTouchMove);\n    off(document, 'dragover', nearestEmptyInsertDetectEvent);\n    off(document, 'mousemove', nearestEmptyInsertDetectEvent);\n    off(document, 'touchmove', nearestEmptyInsertDetectEvent);\n  },\n  _offUpEvents: function _offUpEvents() {\n    var ownerDocument = this.el.ownerDocument;\n    off(ownerDocument, 'mouseup', this._onDrop);\n    off(ownerDocument, 'touchend', this._onDrop);\n    off(ownerDocument, 'pointerup', this._onDrop);\n    off(ownerDocument, 'pointercancel', this._onDrop);\n    off(ownerDocument, 'touchcancel', this._onDrop);\n    off(document, 'selectstart', this);\n  },\n  _onDrop: function _onDrop( /**Event*/evt) {\n    var el = this.el,\n      options = this.options;\n\n    // Get the index of the dragged element within its parent\n    newIndex = index(dragEl);\n    newDraggableIndex = index(dragEl, options.draggable);\n    pluginEvent('drop', this, {\n      evt: evt\n    });\n    parentEl = dragEl && dragEl.parentNode;\n\n    // Get again after plugin event\n    newIndex = index(dragEl);\n    newDraggableIndex = index(dragEl, options.draggable);\n    if (Sortable.eventCanceled) {\n      this._nulling();\n      return;\n    }\n    awaitingDragStarted = false;\n    isCircumstantialInvert = false;\n    pastFirstInvertThresh = false;\n    clearInterval(this._loopId);\n    clearTimeout(this._dragStartTimer);\n    _cancelNextTick(this.cloneId);\n    _cancelNextTick(this._dragStartId);\n\n    // Unbind events\n    if (this.nativeDraggable) {\n      off(document, 'drop', this);\n      off(el, 'dragstart', this._onDragStart);\n    }\n    this._offMoveEvents();\n    this._offUpEvents();\n    if (Safari) {\n      css(document.body, 'user-select', '');\n    }\n    css(dragEl, 'transform', '');\n    if (evt) {\n      if (moved) {\n        evt.cancelable && evt.preventDefault();\n        !options.dropBubble && evt.stopPropagation();\n      }\n      ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);\n      if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {\n        // Remove clone(s)\n        cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);\n      }\n      if (dragEl) {\n        if (this.nativeDraggable) {\n          off(dragEl, 'dragend', this);\n        }\n        _disableDraggable(dragEl);\n        dragEl.style['will-change'] = '';\n\n        // Remove classes\n        // ghostClass is added in dragStarted\n        if (moved && !awaitingDragStarted) {\n          toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false);\n        }\n        toggleClass(dragEl, this.options.chosenClass, false);\n\n        // Drag stop event\n        _dispatchEvent({\n          sortable: this,\n          name: 'unchoose',\n          toEl: parentEl,\n          newIndex: null,\n          newDraggableIndex: null,\n          originalEvent: evt\n        });\n        if (rootEl !== parentEl) {\n          if (newIndex >= 0) {\n            // Add event\n            _dispatchEvent({\n              rootEl: parentEl,\n              name: 'add',\n              toEl: parentEl,\n              fromEl: rootEl,\n              originalEvent: evt\n            });\n\n            // Remove event\n            _dispatchEvent({\n              sortable: this,\n              name: 'remove',\n              toEl: parentEl,\n              originalEvent: evt\n            });\n\n            // drag from one list and drop into another\n            _dispatchEvent({\n              rootEl: parentEl,\n              name: 'sort',\n              toEl: parentEl,\n              fromEl: rootEl,\n              originalEvent: evt\n            });\n            _dispatchEvent({\n              sortable: this,\n              name: 'sort',\n              toEl: parentEl,\n              originalEvent: evt\n            });\n          }\n          putSortable && putSortable.save();\n        } else {\n          if (newIndex !== oldIndex) {\n            if (newIndex >= 0) {\n              // drag & drop within the same list\n              _dispatchEvent({\n                sortable: this,\n                name: 'update',\n                toEl: parentEl,\n                originalEvent: evt\n              });\n              _dispatchEvent({\n                sortable: this,\n                name: 'sort',\n                toEl: parentEl,\n                originalEvent: evt\n              });\n            }\n          }\n        }\n        if (Sortable.active) {\n          /* jshint eqnull:true */\n          if (newIndex == null || newIndex === -1) {\n            newIndex = oldIndex;\n            newDraggableIndex = oldDraggableIndex;\n          }\n          _dispatchEvent({\n            sortable: this,\n            name: 'end',\n            toEl: parentEl,\n            originalEvent: evt\n          });\n\n          // Save sorting\n          this.save();\n        }\n      }\n    }\n    this._nulling();\n  },\n  _nulling: function _nulling() {\n    pluginEvent('nulling', this);\n    rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null;\n    savedInputChecked.forEach(function (el) {\n      el.checked = true;\n    });\n    savedInputChecked.length = lastDx = lastDy = 0;\n  },\n  handleEvent: function handleEvent( /**Event*/evt) {\n    switch (evt.type) {\n      case 'drop':\n      case 'dragend':\n        this._onDrop(evt);\n        break;\n      case 'dragenter':\n      case 'dragover':\n        if (dragEl) {\n          this._onDragOver(evt);\n          _globalDragOver(evt);\n        }\n        break;\n      case 'selectstart':\n        evt.preventDefault();\n        break;\n    }\n  },\n  /**\r\n   * Serializes the item into an array of string.\r\n   * @returns {String[]}\r\n   */\n  toArray: function toArray() {\n    var order = [],\n      el,\n      children = this.el.children,\n      i = 0,\n      n = children.length,\n      options = this.options;\n    for (; i < n; i++) {\n      el = children[i];\n      if (closest(el, options.draggable, this.el, false)) {\n        order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));\n      }\n    }\n    return order;\n  },\n  /**\r\n   * Sorts the elements according to the array.\r\n   * @param  {String[]}  order  order of the items\r\n   */\n  sort: function sort(order, useAnimation) {\n    var items = {},\n      rootEl = this.el;\n    this.toArray().forEach(function (id, i) {\n      var el = rootEl.children[i];\n      if (closest(el, this.options.draggable, rootEl, false)) {\n        items[id] = el;\n      }\n    }, this);\n    useAnimation && this.captureAnimationState();\n    order.forEach(function (id) {\n      if (items[id]) {\n        rootEl.removeChild(items[id]);\n        rootEl.appendChild(items[id]);\n      }\n    });\n    useAnimation && this.animateAll();\n  },\n  /**\r\n   * Save the current sorting\r\n   */\n  save: function save() {\n    var store = this.options.store;\n    store && store.set && store.set(this);\n  },\n  /**\r\n   * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.\r\n   * @param   {HTMLElement}  el\r\n   * @param   {String}       [selector]  default: `options.draggable`\r\n   * @returns {HTMLElement|null}\r\n   */\n  closest: function closest$1(el, selector) {\n    return closest(el, selector || this.options.draggable, this.el, false);\n  },\n  /**\r\n   * Set/get option\r\n   * @param   {string} name\r\n   * @param   {*}      [value]\r\n   * @returns {*}\r\n   */\n  option: function option(name, value) {\n    var options = this.options;\n    if (value === void 0) {\n      return options[name];\n    } else {\n      var modifiedValue = PluginManager.modifyOption(this, name, value);\n      if (typeof modifiedValue !== 'undefined') {\n        options[name] = modifiedValue;\n      } else {\n        options[name] = value;\n      }\n      if (name === 'group') {\n        _prepareGroup(options);\n      }\n    }\n  },\n  /**\r\n   * Destroy\r\n   */\n  destroy: function destroy() {\n    pluginEvent('destroy', this);\n    var el = this.el;\n    el[expando] = null;\n    off(el, 'mousedown', this._onTapStart);\n    off(el, 'touchstart', this._onTapStart);\n    off(el, 'pointerdown', this._onTapStart);\n    if (this.nativeDraggable) {\n      off(el, 'dragover', this);\n      off(el, 'dragenter', this);\n    }\n    // Remove draggable attributes\n    Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {\n      el.removeAttribute('draggable');\n    });\n    this._onDrop();\n    this._disableDelayedDragEvents();\n    sortables.splice(sortables.indexOf(this.el), 1);\n    this.el = el = null;\n  },\n  _hideClone: function _hideClone() {\n    if (!cloneHidden) {\n      pluginEvent('hideClone', this);\n      if (Sortable.eventCanceled) return;\n      css(cloneEl, 'display', 'none');\n      if (this.options.removeCloneOnHide && cloneEl.parentNode) {\n        cloneEl.parentNode.removeChild(cloneEl);\n      }\n      cloneHidden = true;\n    }\n  },\n  _showClone: function _showClone(putSortable) {\n    if (putSortable.lastPutMode !== 'clone') {\n      this._hideClone();\n      return;\n    }\n    if (cloneHidden) {\n      pluginEvent('showClone', this);\n      if (Sortable.eventCanceled) return;\n\n      // show clone at dragEl or original position\n      if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {\n        rootEl.insertBefore(cloneEl, dragEl);\n      } else if (nextEl) {\n        rootEl.insertBefore(cloneEl, nextEl);\n      } else {\n        rootEl.appendChild(cloneEl);\n      }\n      if (this.options.group.revertClone) {\n        this.animate(dragEl, cloneEl);\n      }\n      css(cloneEl, 'display', '');\n      cloneHidden = false;\n    }\n  }\n};\nfunction _globalDragOver( /**Event*/evt) {\n  if (evt.dataTransfer) {\n    evt.dataTransfer.dropEffect = 'move';\n  }\n  evt.cancelable && evt.preventDefault();\n}\nfunction _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {\n  var evt,\n    sortable = fromEl[expando],\n    onMoveFn = sortable.options.onMove,\n    retVal;\n  // Support for new CustomEvent feature\n  if (window.CustomEvent && !IE11OrLess && !Edge) {\n    evt = new CustomEvent('move', {\n      bubbles: true,\n      cancelable: true\n    });\n  } else {\n    evt = document.createEvent('Event');\n    evt.initEvent('move', true, true);\n  }\n  evt.to = toEl;\n  evt.from = fromEl;\n  evt.dragged = dragEl;\n  evt.draggedRect = dragRect;\n  evt.related = targetEl || toEl;\n  evt.relatedRect = targetRect || getRect(toEl);\n  evt.willInsertAfter = willInsertAfter;\n  evt.originalEvent = originalEvent;\n  fromEl.dispatchEvent(evt);\n  if (onMoveFn) {\n    retVal = onMoveFn.call(sortable, evt, originalEvent);\n  }\n  return retVal;\n}\nfunction _disableDraggable(el) {\n  el.draggable = false;\n}\nfunction _unsilent() {\n  _silent = false;\n}\nfunction _ghostIsFirst(evt, vertical, sortable) {\n  var firstElRect = getRect(getChild(sortable.el, 0, sortable.options, true));\n  var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);\n  var spacer = 10;\n  return vertical ? evt.clientX < childContainingRect.left - spacer || evt.clientY < firstElRect.top && evt.clientX < firstElRect.right : evt.clientY < childContainingRect.top - spacer || evt.clientY < firstElRect.bottom && evt.clientX < firstElRect.left;\n}\nfunction _ghostIsLast(evt, vertical, sortable) {\n  var lastElRect = getRect(lastChild(sortable.el, sortable.options.draggable));\n  var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);\n  var spacer = 10;\n  return vertical ? evt.clientX > childContainingRect.right + spacer || evt.clientY > lastElRect.bottom && evt.clientX > lastElRect.left : evt.clientY > childContainingRect.bottom + spacer || evt.clientX > lastElRect.right && evt.clientY > lastElRect.top;\n}\nfunction _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {\n  var mouseOnAxis = vertical ? evt.clientY : evt.clientX,\n    targetLength = vertical ? targetRect.height : targetRect.width,\n    targetS1 = vertical ? targetRect.top : targetRect.left,\n    targetS2 = vertical ? targetRect.bottom : targetRect.right,\n    invert = false;\n  if (!invertSwap) {\n    // Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold\n    if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) {\n      // multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2\n      // check if past first invert threshold on side opposite of lastDirection\n      if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) {\n        // past first invert threshold, do not restrict inverted threshold to dragEl shadow\n        pastFirstInvertThresh = true;\n      }\n      if (!pastFirstInvertThresh) {\n        // dragEl shadow (target move distance shadow)\n        if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow\n        : mouseOnAxis > targetS2 - targetMoveDistance) {\n          return -lastDirection;\n        }\n      } else {\n        invert = true;\n      }\n    } else {\n      // Regular\n      if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) {\n        return _getInsertDirection(target);\n      }\n    }\n  }\n  invert = invert || invertSwap;\n  if (invert) {\n    // Invert of regular\n    if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) {\n      return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1;\n    }\n  }\n  return 0;\n}\n\n/**\r\n * Gets the direction dragEl must be swapped relative to target in order to make it\r\n * seem that dragEl has been \"inserted\" into that element's position\r\n * @param  {HTMLElement} target       The target whose position dragEl is being inserted at\r\n * @return {Number}                   Direction dragEl must be swapped\r\n */\nfunction _getInsertDirection(target) {\n  if (index(dragEl) < index(target)) {\n    return 1;\n  } else {\n    return -1;\n  }\n}\n\n/**\r\n * Generate id\r\n * @param   {HTMLElement} el\r\n * @returns {String}\r\n * @private\r\n */\nfunction _generateId(el) {\n  var str = el.tagName + el.className + el.src + el.href + el.textContent,\n    i = str.length,\n    sum = 0;\n  while (i--) {\n    sum += str.charCodeAt(i);\n  }\n  return sum.toString(36);\n}\nfunction _saveInputCheckedState(root) {\n  savedInputChecked.length = 0;\n  var inputs = root.getElementsByTagName('input');\n  var idx = inputs.length;\n  while (idx--) {\n    var el = inputs[idx];\n    el.checked && savedInputChecked.push(el);\n  }\n}\nfunction _nextTick(fn) {\n  return setTimeout(fn, 0);\n}\nfunction _cancelNextTick(id) {\n  return clearTimeout(id);\n}\n\n// Fixed #973:\nif (documentExists) {\n  on(document, 'touchmove', function (evt) {\n    if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {\n      evt.preventDefault();\n    }\n  });\n}\n\n// Export utils\nSortable.utils = {\n  on: on,\n  off: off,\n  css: css,\n  find: find,\n  is: function is(el, selector) {\n    return !!closest(el, selector, el, false);\n  },\n  extend: extend,\n  throttle: throttle,\n  closest: closest,\n  toggleClass: toggleClass,\n  clone: clone,\n  index: index,\n  nextTick: _nextTick,\n  cancelNextTick: _cancelNextTick,\n  detectDirection: _detectDirection,\n  getChild: getChild,\n  expando: expando\n};\n\n/**\r\n * Get the Sortable instance of an element\r\n * @param  {HTMLElement} element The element\r\n * @return {Sortable|undefined}         The instance of Sortable\r\n */\nSortable.get = function (element) {\n  return element[expando];\n};\n\n/**\r\n * Mount a plugin to Sortable\r\n * @param  {...SortablePlugin|SortablePlugin[]} plugins       Plugins being mounted\r\n */\nSortable.mount = function () {\n  for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {\n    plugins[_key] = arguments[_key];\n  }\n  if (plugins[0].constructor === Array) plugins = plugins[0];\n  plugins.forEach(function (plugin) {\n    if (!plugin.prototype || !plugin.prototype.constructor) {\n      throw \"Sortable: Mounted plugin must be a constructor function, not \".concat({}.toString.call(plugin));\n    }\n    if (plugin.utils) Sortable.utils = _objectSpread2(_objectSpread2({}, Sortable.utils), plugin.utils);\n    PluginManager.mount(plugin);\n  });\n};\n\n/**\r\n * Create sortable instance\r\n * @param {HTMLElement}  el\r\n * @param {Object}      [options]\r\n */\nSortable.create = function (el, options) {\n  return new Sortable(el, options);\n};\n\n// Export\nSortable.version = version;\n\nvar autoScrolls = [],\n  scrollEl,\n  scrollRootEl,\n  scrolling = false,\n  lastAutoScrollX,\n  lastAutoScrollY,\n  touchEvt$1,\n  pointerElemChangedInterval;\nfunction AutoScrollPlugin() {\n  function AutoScroll() {\n    this.defaults = {\n      scroll: true,\n      forceAutoScrollFallback: false,\n      scrollSensitivity: 30,\n      scrollSpeed: 10,\n      bubbleScroll: true\n    };\n\n    // Bind all private methods\n    for (var fn in this) {\n      if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n        this[fn] = this[fn].bind(this);\n      }\n    }\n  }\n  AutoScroll.prototype = {\n    dragStarted: function dragStarted(_ref) {\n      var originalEvent = _ref.originalEvent;\n      if (this.sortable.nativeDraggable) {\n        on(document, 'dragover', this._handleAutoScroll);\n      } else {\n        if (this.options.supportPointer) {\n          on(document, 'pointermove', this._handleFallbackAutoScroll);\n        } else if (originalEvent.touches) {\n          on(document, 'touchmove', this._handleFallbackAutoScroll);\n        } else {\n          on(document, 'mousemove', this._handleFallbackAutoScroll);\n        }\n      }\n    },\n    dragOverCompleted: function dragOverCompleted(_ref2) {\n      var originalEvent = _ref2.originalEvent;\n      // For when bubbling is canceled and using fallback (fallback 'touchmove' always reached)\n      if (!this.options.dragOverBubble && !originalEvent.rootEl) {\n        this._handleAutoScroll(originalEvent);\n      }\n    },\n    drop: function drop() {\n      if (this.sortable.nativeDraggable) {\n        off(document, 'dragover', this._handleAutoScroll);\n      } else {\n        off(document, 'pointermove', this._handleFallbackAutoScroll);\n        off(document, 'touchmove', this._handleFallbackAutoScroll);\n        off(document, 'mousemove', this._handleFallbackAutoScroll);\n      }\n      clearPointerElemChangedInterval();\n      clearAutoScrolls();\n      cancelThrottle();\n    },\n    nulling: function nulling() {\n      touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null;\n      autoScrolls.length = 0;\n    },\n    _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) {\n      this._handleAutoScroll(evt, true);\n    },\n    _handleAutoScroll: function _handleAutoScroll(evt, fallback) {\n      var _this = this;\n      var x = (evt.touches ? evt.touches[0] : evt).clientX,\n        y = (evt.touches ? evt.touches[0] : evt).clientY,\n        elem = document.elementFromPoint(x, y);\n      touchEvt$1 = evt;\n\n      // IE does not seem to have native autoscroll,\n      // Edge's autoscroll seems too conditional,\n      // MACOS Safari does not have autoscroll,\n      // Firefox and Chrome are good\n      if (fallback || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) {\n        autoScroll(evt, this.options, elem, fallback);\n\n        // Listener for pointer element change\n        var ogElemScroller = getParentAutoScrollElement(elem, true);\n        if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) {\n          pointerElemChangedInterval && clearPointerElemChangedInterval();\n          // Detect for pointer elem change, emulating native DnD behaviour\n          pointerElemChangedInterval = setInterval(function () {\n            var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true);\n            if (newElem !== ogElemScroller) {\n              ogElemScroller = newElem;\n              clearAutoScrolls();\n            }\n            autoScroll(evt, _this.options, newElem, fallback);\n          }, 10);\n          lastAutoScrollX = x;\n          lastAutoScrollY = y;\n        }\n      } else {\n        // if DnD is enabled (and browser has good autoscrolling), first autoscroll will already scroll, so get parent autoscroll of first autoscroll\n        if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) {\n          clearAutoScrolls();\n          return;\n        }\n        autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false);\n      }\n    }\n  };\n  return _extends(AutoScroll, {\n    pluginName: 'scroll',\n    initializeByDefault: true\n  });\n}\nfunction clearAutoScrolls() {\n  autoScrolls.forEach(function (autoScroll) {\n    clearInterval(autoScroll.pid);\n  });\n  autoScrolls = [];\n}\nfunction clearPointerElemChangedInterval() {\n  clearInterval(pointerElemChangedInterval);\n}\nvar autoScroll = throttle(function (evt, options, rootEl, isFallback) {\n  // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521\n  if (!options.scroll) return;\n  var x = (evt.touches ? evt.touches[0] : evt).clientX,\n    y = (evt.touches ? evt.touches[0] : evt).clientY,\n    sens = options.scrollSensitivity,\n    speed = options.scrollSpeed,\n    winScroller = getWindowScrollingElement();\n  var scrollThisInstance = false,\n    scrollCustomFn;\n\n  // New scroll root, set scrollEl\n  if (scrollRootEl !== rootEl) {\n    scrollRootEl = rootEl;\n    clearAutoScrolls();\n    scrollEl = options.scroll;\n    scrollCustomFn = options.scrollFn;\n    if (scrollEl === true) {\n      scrollEl = getParentAutoScrollElement(rootEl, true);\n    }\n  }\n  var layersOut = 0;\n  var currentParent = scrollEl;\n  do {\n    var el = currentParent,\n      rect = getRect(el),\n      top = rect.top,\n      bottom = rect.bottom,\n      left = rect.left,\n      right = rect.right,\n      width = rect.width,\n      height = rect.height,\n      canScrollX = void 0,\n      canScrollY = void 0,\n      scrollWidth = el.scrollWidth,\n      scrollHeight = el.scrollHeight,\n      elCSS = css(el),\n      scrollPosX = el.scrollLeft,\n      scrollPosY = el.scrollTop;\n    if (el === winScroller) {\n      canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible');\n      canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible');\n    } else {\n      canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll');\n      canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll');\n    }\n    var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);\n    var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);\n    if (!autoScrolls[layersOut]) {\n      for (var i = 0; i <= layersOut; i++) {\n        if (!autoScrolls[i]) {\n          autoScrolls[i] = {};\n        }\n      }\n    }\n    if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {\n      autoScrolls[layersOut].el = el;\n      autoScrolls[layersOut].vx = vx;\n      autoScrolls[layersOut].vy = vy;\n      clearInterval(autoScrolls[layersOut].pid);\n      if (vx != 0 || vy != 0) {\n        scrollThisInstance = true;\n        /* jshint loopfunc:true */\n        autoScrolls[layersOut].pid = setInterval(function () {\n          // emulate drag over during autoscroll (fallback), emulating native DnD behaviour\n          if (isFallback && this.layer === 0) {\n            Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely\n          }\n          var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;\n          var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;\n          if (typeof scrollCustomFn === 'function') {\n            if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') {\n              return;\n            }\n          }\n          scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);\n        }.bind({\n          layer: layersOut\n        }), 24);\n      }\n    }\n    layersOut++;\n  } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false)));\n  scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not\n}, 30);\n\nvar drop = function drop(_ref) {\n  var originalEvent = _ref.originalEvent,\n    putSortable = _ref.putSortable,\n    dragEl = _ref.dragEl,\n    activeSortable = _ref.activeSortable,\n    dispatchSortableEvent = _ref.dispatchSortableEvent,\n    hideGhostForTarget = _ref.hideGhostForTarget,\n    unhideGhostForTarget = _ref.unhideGhostForTarget;\n  if (!originalEvent) return;\n  var toSortable = putSortable || activeSortable;\n  hideGhostForTarget();\n  var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;\n  var target = document.elementFromPoint(touch.clientX, touch.clientY);\n  unhideGhostForTarget();\n  if (toSortable && !toSortable.el.contains(target)) {\n    dispatchSortableEvent('spill');\n    this.onSpill({\n      dragEl: dragEl,\n      putSortable: putSortable\n    });\n  }\n};\nfunction Revert() {}\nRevert.prototype = {\n  startIndex: null,\n  dragStart: function dragStart(_ref2) {\n    var oldDraggableIndex = _ref2.oldDraggableIndex;\n    this.startIndex = oldDraggableIndex;\n  },\n  onSpill: function onSpill(_ref3) {\n    var dragEl = _ref3.dragEl,\n      putSortable = _ref3.putSortable;\n    this.sortable.captureAnimationState();\n    if (putSortable) {\n      putSortable.captureAnimationState();\n    }\n    var nextSibling = getChild(this.sortable.el, this.startIndex, this.options);\n    if (nextSibling) {\n      this.sortable.el.insertBefore(dragEl, nextSibling);\n    } else {\n      this.sortable.el.appendChild(dragEl);\n    }\n    this.sortable.animateAll();\n    if (putSortable) {\n      putSortable.animateAll();\n    }\n  },\n  drop: drop\n};\n_extends(Revert, {\n  pluginName: 'revertOnSpill'\n});\nfunction Remove() {}\nRemove.prototype = {\n  onSpill: function onSpill(_ref4) {\n    var dragEl = _ref4.dragEl,\n      putSortable = _ref4.putSortable;\n    var parentSortable = putSortable || this.sortable;\n    parentSortable.captureAnimationState();\n    dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);\n    parentSortable.animateAll();\n  },\n  drop: drop\n};\n_extends(Remove, {\n  pluginName: 'removeOnSpill'\n});\n\nvar lastSwapEl;\nfunction SwapPlugin() {\n  function Swap() {\n    this.defaults = {\n      swapClass: 'sortable-swap-highlight'\n    };\n  }\n  Swap.prototype = {\n    dragStart: function dragStart(_ref) {\n      var dragEl = _ref.dragEl;\n      lastSwapEl = dragEl;\n    },\n    dragOverValid: function dragOverValid(_ref2) {\n      var completed = _ref2.completed,\n        target = _ref2.target,\n        onMove = _ref2.onMove,\n        activeSortable = _ref2.activeSortable,\n        changed = _ref2.changed,\n        cancel = _ref2.cancel;\n      if (!activeSortable.options.swap) return;\n      var el = this.sortable.el,\n        options = this.options;\n      if (target && target !== el) {\n        var prevSwapEl = lastSwapEl;\n        if (onMove(target) !== false) {\n          toggleClass(target, options.swapClass, true);\n          lastSwapEl = target;\n        } else {\n          lastSwapEl = null;\n        }\n        if (prevSwapEl && prevSwapEl !== lastSwapEl) {\n          toggleClass(prevSwapEl, options.swapClass, false);\n        }\n      }\n      changed();\n      completed(true);\n      cancel();\n    },\n    drop: function drop(_ref3) {\n      var activeSortable = _ref3.activeSortable,\n        putSortable = _ref3.putSortable,\n        dragEl = _ref3.dragEl;\n      var toSortable = putSortable || this.sortable;\n      var options = this.options;\n      lastSwapEl && toggleClass(lastSwapEl, options.swapClass, false);\n      if (lastSwapEl && (options.swap || putSortable && putSortable.options.swap)) {\n        if (dragEl !== lastSwapEl) {\n          toSortable.captureAnimationState();\n          if (toSortable !== activeSortable) activeSortable.captureAnimationState();\n          swapNodes(dragEl, lastSwapEl);\n          toSortable.animateAll();\n          if (toSortable !== activeSortable) activeSortable.animateAll();\n        }\n      }\n    },\n    nulling: function nulling() {\n      lastSwapEl = null;\n    }\n  };\n  return _extends(Swap, {\n    pluginName: 'swap',\n    eventProperties: function eventProperties() {\n      return {\n        swapItem: lastSwapEl\n      };\n    }\n  });\n}\nfunction swapNodes(n1, n2) {\n  var p1 = n1.parentNode,\n    p2 = n2.parentNode,\n    i1,\n    i2;\n  if (!p1 || !p2 || p1.isEqualNode(n2) || p2.isEqualNode(n1)) return;\n  i1 = index(n1);\n  i2 = index(n2);\n  if (p1.isEqualNode(p2) && i1 < i2) {\n    i2++;\n  }\n  p1.insertBefore(n2, p1.children[i1]);\n  p2.insertBefore(n1, p2.children[i2]);\n}\n\nvar multiDragElements = [],\n  multiDragClones = [],\n  lastMultiDragSelect,\n  // for selection with modifier key down (SHIFT)\n  multiDragSortable,\n  initialFolding = false,\n  // Initial multi-drag fold when drag started\n  folding = false,\n  // Folding any other time\n  dragStarted = false,\n  dragEl$1,\n  clonesFromRect,\n  clonesHidden;\nfunction MultiDragPlugin() {\n  function MultiDrag(sortable) {\n    // Bind all private methods\n    for (var fn in this) {\n      if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n        this[fn] = this[fn].bind(this);\n      }\n    }\n    if (!sortable.options.avoidImplicitDeselect) {\n      if (sortable.options.supportPointer) {\n        on(document, 'pointerup', this._deselectMultiDrag);\n      } else {\n        on(document, 'mouseup', this._deselectMultiDrag);\n        on(document, 'touchend', this._deselectMultiDrag);\n      }\n    }\n    on(document, 'keydown', this._checkKeyDown);\n    on(document, 'keyup', this._checkKeyUp);\n    this.defaults = {\n      selectedClass: 'sortable-selected',\n      multiDragKey: null,\n      avoidImplicitDeselect: false,\n      setData: function setData(dataTransfer, dragEl) {\n        var data = '';\n        if (multiDragElements.length && multiDragSortable === sortable) {\n          multiDragElements.forEach(function (multiDragElement, i) {\n            data += (!i ? '' : ', ') + multiDragElement.textContent;\n          });\n        } else {\n          data = dragEl.textContent;\n        }\n        dataTransfer.setData('Text', data);\n      }\n    };\n  }\n  MultiDrag.prototype = {\n    multiDragKeyDown: false,\n    isMultiDrag: false,\n    delayStartGlobal: function delayStartGlobal(_ref) {\n      var dragged = _ref.dragEl;\n      dragEl$1 = dragged;\n    },\n    delayEnded: function delayEnded() {\n      this.isMultiDrag = ~multiDragElements.indexOf(dragEl$1);\n    },\n    setupClone: function setupClone(_ref2) {\n      var sortable = _ref2.sortable,\n        cancel = _ref2.cancel;\n      if (!this.isMultiDrag) return;\n      for (var i = 0; i < multiDragElements.length; i++) {\n        multiDragClones.push(clone(multiDragElements[i]));\n        multiDragClones[i].sortableIndex = multiDragElements[i].sortableIndex;\n        multiDragClones[i].draggable = false;\n        multiDragClones[i].style['will-change'] = '';\n        toggleClass(multiDragClones[i], this.options.selectedClass, false);\n        multiDragElements[i] === dragEl$1 && toggleClass(multiDragClones[i], this.options.chosenClass, false);\n      }\n      sortable._hideClone();\n      cancel();\n    },\n    clone: function clone(_ref3) {\n      var sortable = _ref3.sortable,\n        rootEl = _ref3.rootEl,\n        dispatchSortableEvent = _ref3.dispatchSortableEvent,\n        cancel = _ref3.cancel;\n      if (!this.isMultiDrag) return;\n      if (!this.options.removeCloneOnHide) {\n        if (multiDragElements.length && multiDragSortable === sortable) {\n          insertMultiDragClones(true, rootEl);\n          dispatchSortableEvent('clone');\n          cancel();\n        }\n      }\n    },\n    showClone: function showClone(_ref4) {\n      var cloneNowShown = _ref4.cloneNowShown,\n        rootEl = _ref4.rootEl,\n        cancel = _ref4.cancel;\n      if (!this.isMultiDrag) return;\n      insertMultiDragClones(false, rootEl);\n      multiDragClones.forEach(function (clone) {\n        css(clone, 'display', '');\n      });\n      cloneNowShown();\n      clonesHidden = false;\n      cancel();\n    },\n    hideClone: function hideClone(_ref5) {\n      var _this = this;\n      var sortable = _ref5.sortable,\n        cloneNowHidden = _ref5.cloneNowHidden,\n        cancel = _ref5.cancel;\n      if (!this.isMultiDrag) return;\n      multiDragClones.forEach(function (clone) {\n        css(clone, 'display', 'none');\n        if (_this.options.removeCloneOnHide && clone.parentNode) {\n          clone.parentNode.removeChild(clone);\n        }\n      });\n      cloneNowHidden();\n      clonesHidden = true;\n      cancel();\n    },\n    dragStartGlobal: function dragStartGlobal(_ref6) {\n      var sortable = _ref6.sortable;\n      if (!this.isMultiDrag && multiDragSortable) {\n        multiDragSortable.multiDrag._deselectMultiDrag();\n      }\n      multiDragElements.forEach(function (multiDragElement) {\n        multiDragElement.sortableIndex = index(multiDragElement);\n      });\n\n      // Sort multi-drag elements\n      multiDragElements = multiDragElements.sort(function (a, b) {\n        return a.sortableIndex - b.sortableIndex;\n      });\n      dragStarted = true;\n    },\n    dragStarted: function dragStarted(_ref7) {\n      var _this2 = this;\n      var sortable = _ref7.sortable;\n      if (!this.isMultiDrag) return;\n      if (this.options.sort) {\n        // Capture rects,\n        // hide multi drag elements (by positioning them absolute),\n        // set multi drag elements rects to dragRect,\n        // show multi drag elements,\n        // animate to rects,\n        // unset rects & remove from DOM\n\n        sortable.captureAnimationState();\n        if (this.options.animation) {\n          multiDragElements.forEach(function (multiDragElement) {\n            if (multiDragElement === dragEl$1) return;\n            css(multiDragElement, 'position', 'absolute');\n          });\n          var dragRect = getRect(dragEl$1, false, true, true);\n          multiDragElements.forEach(function (multiDragElement) {\n            if (multiDragElement === dragEl$1) return;\n            setRect(multiDragElement, dragRect);\n          });\n          folding = true;\n          initialFolding = true;\n        }\n      }\n      sortable.animateAll(function () {\n        folding = false;\n        initialFolding = false;\n        if (_this2.options.animation) {\n          multiDragElements.forEach(function (multiDragElement) {\n            unsetRect(multiDragElement);\n          });\n        }\n\n        // Remove all auxiliary multidrag items from el, if sorting enabled\n        if (_this2.options.sort) {\n          removeMultiDragElements();\n        }\n      });\n    },\n    dragOver: function dragOver(_ref8) {\n      var target = _ref8.target,\n        completed = _ref8.completed,\n        cancel = _ref8.cancel;\n      if (folding && ~multiDragElements.indexOf(target)) {\n        completed(false);\n        cancel();\n      }\n    },\n    revert: function revert(_ref9) {\n      var fromSortable = _ref9.fromSortable,\n        rootEl = _ref9.rootEl,\n        sortable = _ref9.sortable,\n        dragRect = _ref9.dragRect;\n      if (multiDragElements.length > 1) {\n        // Setup unfold animation\n        multiDragElements.forEach(function (multiDragElement) {\n          sortable.addAnimationState({\n            target: multiDragElement,\n            rect: folding ? getRect(multiDragElement) : dragRect\n          });\n          unsetRect(multiDragElement);\n          multiDragElement.fromRect = dragRect;\n          fromSortable.removeAnimationState(multiDragElement);\n        });\n        folding = false;\n        insertMultiDragElements(!this.options.removeCloneOnHide, rootEl);\n      }\n    },\n    dragOverCompleted: function dragOverCompleted(_ref10) {\n      var sortable = _ref10.sortable,\n        isOwner = _ref10.isOwner,\n        insertion = _ref10.insertion,\n        activeSortable = _ref10.activeSortable,\n        parentEl = _ref10.parentEl,\n        putSortable = _ref10.putSortable;\n      var options = this.options;\n      if (insertion) {\n        // Clones must be hidden before folding animation to capture dragRectAbsolute properly\n        if (isOwner) {\n          activeSortable._hideClone();\n        }\n        initialFolding = false;\n        // If leaving sort:false root, or already folding - Fold to new location\n        if (options.animation && multiDragElements.length > 1 && (folding || !isOwner && !activeSortable.options.sort && !putSortable)) {\n          // Fold: Set all multi drag elements's rects to dragEl's rect when multi-drag elements are invisible\n          var dragRectAbsolute = getRect(dragEl$1, false, true, true);\n          multiDragElements.forEach(function (multiDragElement) {\n            if (multiDragElement === dragEl$1) return;\n            setRect(multiDragElement, dragRectAbsolute);\n\n            // Move element(s) to end of parentEl so that it does not interfere with multi-drag clones insertion if they are inserted\n            // while folding, and so that we can capture them again because old sortable will no longer be fromSortable\n            parentEl.appendChild(multiDragElement);\n          });\n          folding = true;\n        }\n\n        // Clones must be shown (and check to remove multi drags) after folding when interfering multiDragElements are moved out\n        if (!isOwner) {\n          // Only remove if not folding (folding will remove them anyways)\n          if (!folding) {\n            removeMultiDragElements();\n          }\n          if (multiDragElements.length > 1) {\n            var clonesHiddenBefore = clonesHidden;\n            activeSortable._showClone(sortable);\n\n            // Unfold animation for clones if showing from hidden\n            if (activeSortable.options.animation && !clonesHidden && clonesHiddenBefore) {\n              multiDragClones.forEach(function (clone) {\n                activeSortable.addAnimationState({\n                  target: clone,\n                  rect: clonesFromRect\n                });\n                clone.fromRect = clonesFromRect;\n                clone.thisAnimationDuration = null;\n              });\n            }\n          } else {\n            activeSortable._showClone(sortable);\n          }\n        }\n      }\n    },\n    dragOverAnimationCapture: function dragOverAnimationCapture(_ref11) {\n      var dragRect = _ref11.dragRect,\n        isOwner = _ref11.isOwner,\n        activeSortable = _ref11.activeSortable;\n      multiDragElements.forEach(function (multiDragElement) {\n        multiDragElement.thisAnimationDuration = null;\n      });\n      if (activeSortable.options.animation && !isOwner && activeSortable.multiDrag.isMultiDrag) {\n        clonesFromRect = _extends({}, dragRect);\n        var dragMatrix = matrix(dragEl$1, true);\n        clonesFromRect.top -= dragMatrix.f;\n        clonesFromRect.left -= dragMatrix.e;\n      }\n    },\n    dragOverAnimationComplete: function dragOverAnimationComplete() {\n      if (folding) {\n        folding = false;\n        removeMultiDragElements();\n      }\n    },\n    drop: function drop(_ref12) {\n      var evt = _ref12.originalEvent,\n        rootEl = _ref12.rootEl,\n        parentEl = _ref12.parentEl,\n        sortable = _ref12.sortable,\n        dispatchSortableEvent = _ref12.dispatchSortableEvent,\n        oldIndex = _ref12.oldIndex,\n        putSortable = _ref12.putSortable;\n      var toSortable = putSortable || this.sortable;\n      if (!evt) return;\n      var options = this.options,\n        children = parentEl.children;\n\n      // Multi-drag selection\n      if (!dragStarted) {\n        if (options.multiDragKey && !this.multiDragKeyDown) {\n          this._deselectMultiDrag();\n        }\n        toggleClass(dragEl$1, options.selectedClass, !~multiDragElements.indexOf(dragEl$1));\n        if (!~multiDragElements.indexOf(dragEl$1)) {\n          multiDragElements.push(dragEl$1);\n          dispatchEvent({\n            sortable: sortable,\n            rootEl: rootEl,\n            name: 'select',\n            targetEl: dragEl$1,\n            originalEvent: evt\n          });\n\n          // Modifier activated, select from last to dragEl\n          if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) {\n            var lastIndex = index(lastMultiDragSelect),\n              currentIndex = index(dragEl$1);\n            if (~lastIndex && ~currentIndex && lastIndex !== currentIndex) {\n              (function () {\n                // Must include lastMultiDragSelect (select it), in case modified selection from no selection\n                // (but previous selection existed)\n                var n, i;\n                if (currentIndex > lastIndex) {\n                  i = lastIndex;\n                  n = currentIndex;\n                } else {\n                  i = currentIndex;\n                  n = lastIndex + 1;\n                }\n                var filter = options.filter;\n                for (; i < n; i++) {\n                  if (~multiDragElements.indexOf(children[i])) continue;\n                  // Check if element is draggable\n                  if (!closest(children[i], options.draggable, parentEl, false)) continue;\n                  // Check if element is filtered\n                  var filtered = filter && (typeof filter === 'function' ? filter.call(sortable, evt, children[i], sortable) : filter.split(',').some(function (criteria) {\n                    return closest(children[i], criteria.trim(), parentEl, false);\n                  }));\n                  if (filtered) continue;\n                  toggleClass(children[i], options.selectedClass, true);\n                  multiDragElements.push(children[i]);\n                  dispatchEvent({\n                    sortable: sortable,\n                    rootEl: rootEl,\n                    name: 'select',\n                    targetEl: children[i],\n                    originalEvent: evt\n                  });\n                }\n              })();\n            }\n          } else {\n            lastMultiDragSelect = dragEl$1;\n          }\n          multiDragSortable = toSortable;\n        } else {\n          multiDragElements.splice(multiDragElements.indexOf(dragEl$1), 1);\n          lastMultiDragSelect = null;\n          dispatchEvent({\n            sortable: sortable,\n            rootEl: rootEl,\n            name: 'deselect',\n            targetEl: dragEl$1,\n            originalEvent: evt\n          });\n        }\n      }\n\n      // Multi-drag drop\n      if (dragStarted && this.isMultiDrag) {\n        folding = false;\n        // Do not \"unfold\" after around dragEl if reverted\n        if ((parentEl[expando].options.sort || parentEl !== rootEl) && multiDragElements.length > 1) {\n          var dragRect = getRect(dragEl$1),\n            multiDragIndex = index(dragEl$1, ':not(.' + this.options.selectedClass + ')');\n          if (!initialFolding && options.animation) dragEl$1.thisAnimationDuration = null;\n          toSortable.captureAnimationState();\n          if (!initialFolding) {\n            if (options.animation) {\n              dragEl$1.fromRect = dragRect;\n              multiDragElements.forEach(function (multiDragElement) {\n                multiDragElement.thisAnimationDuration = null;\n                if (multiDragElement !== dragEl$1) {\n                  var rect = folding ? getRect(multiDragElement) : dragRect;\n                  multiDragElement.fromRect = rect;\n\n                  // Prepare unfold animation\n                  toSortable.addAnimationState({\n                    target: multiDragElement,\n                    rect: rect\n                  });\n                }\n              });\n            }\n\n            // Multi drag elements are not necessarily removed from the DOM on drop, so to reinsert\n            // properly they must all be removed\n            removeMultiDragElements();\n            multiDragElements.forEach(function (multiDragElement) {\n              if (children[multiDragIndex]) {\n                parentEl.insertBefore(multiDragElement, children[multiDragIndex]);\n              } else {\n                parentEl.appendChild(multiDragElement);\n              }\n              multiDragIndex++;\n            });\n\n            // If initial folding is done, the elements may have changed position because they are now\n            // unfolding around dragEl, even though dragEl may not have his index changed, so update event\n            // must be fired here as Sortable will not.\n            if (oldIndex === index(dragEl$1)) {\n              var update = false;\n              multiDragElements.forEach(function (multiDragElement) {\n                if (multiDragElement.sortableIndex !== index(multiDragElement)) {\n                  update = true;\n                  return;\n                }\n              });\n              if (update) {\n                dispatchSortableEvent('update');\n                dispatchSortableEvent('sort');\n              }\n            }\n          }\n\n          // Must be done after capturing individual rects (scroll bar)\n          multiDragElements.forEach(function (multiDragElement) {\n            unsetRect(multiDragElement);\n          });\n          toSortable.animateAll();\n        }\n        multiDragSortable = toSortable;\n      }\n\n      // Remove clones if necessary\n      if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {\n        multiDragClones.forEach(function (clone) {\n          clone.parentNode && clone.parentNode.removeChild(clone);\n        });\n      }\n    },\n    nullingGlobal: function nullingGlobal() {\n      this.isMultiDrag = dragStarted = false;\n      multiDragClones.length = 0;\n    },\n    destroyGlobal: function destroyGlobal() {\n      this._deselectMultiDrag();\n      off(document, 'pointerup', this._deselectMultiDrag);\n      off(document, 'mouseup', this._deselectMultiDrag);\n      off(document, 'touchend', this._deselectMultiDrag);\n      off(document, 'keydown', this._checkKeyDown);\n      off(document, 'keyup', this._checkKeyUp);\n    },\n    _deselectMultiDrag: function _deselectMultiDrag(evt) {\n      if (typeof dragStarted !== \"undefined\" && dragStarted) return;\n\n      // Only deselect if selection is in this sortable\n      if (multiDragSortable !== this.sortable) return;\n\n      // Only deselect if target is not item in this sortable\n      if (evt && closest(evt.target, this.options.draggable, this.sortable.el, false)) return;\n\n      // Only deselect if left click\n      if (evt && evt.button !== 0) return;\n      while (multiDragElements.length) {\n        var el = multiDragElements[0];\n        toggleClass(el, this.options.selectedClass, false);\n        multiDragElements.shift();\n        dispatchEvent({\n          sortable: this.sortable,\n          rootEl: this.sortable.el,\n          name: 'deselect',\n          targetEl: el,\n          originalEvent: evt\n        });\n      }\n    },\n    _checkKeyDown: function _checkKeyDown(evt) {\n      if (evt.key === this.options.multiDragKey) {\n        this.multiDragKeyDown = true;\n      }\n    },\n    _checkKeyUp: function _checkKeyUp(evt) {\n      if (evt.key === this.options.multiDragKey) {\n        this.multiDragKeyDown = false;\n      }\n    }\n  };\n  return _extends(MultiDrag, {\n    // Static methods & properties\n    pluginName: 'multiDrag',\n    utils: {\n      /**\r\n       * Selects the provided multi-drag item\r\n       * @param  {HTMLElement} el    The element to be selected\r\n       */\n      select: function select(el) {\n        var sortable = el.parentNode[expando];\n        if (!sortable || !sortable.options.multiDrag || ~multiDragElements.indexOf(el)) return;\n        if (multiDragSortable && multiDragSortable !== sortable) {\n          multiDragSortable.multiDrag._deselectMultiDrag();\n          multiDragSortable = sortable;\n        }\n        toggleClass(el, sortable.options.selectedClass, true);\n        multiDragElements.push(el);\n      },\n      /**\r\n       * Deselects the provided multi-drag item\r\n       * @param  {HTMLElement} el    The element to be deselected\r\n       */\n      deselect: function deselect(el) {\n        var sortable = el.parentNode[expando],\n          index = multiDragElements.indexOf(el);\n        if (!sortable || !sortable.options.multiDrag || !~index) return;\n        toggleClass(el, sortable.options.selectedClass, false);\n        multiDragElements.splice(index, 1);\n      }\n    },\n    eventProperties: function eventProperties() {\n      var _this3 = this;\n      var oldIndicies = [],\n        newIndicies = [];\n      multiDragElements.forEach(function (multiDragElement) {\n        oldIndicies.push({\n          multiDragElement: multiDragElement,\n          index: multiDragElement.sortableIndex\n        });\n\n        // multiDragElements will already be sorted if folding\n        var newIndex;\n        if (folding && multiDragElement !== dragEl$1) {\n          newIndex = -1;\n        } else if (folding) {\n          newIndex = index(multiDragElement, ':not(.' + _this3.options.selectedClass + ')');\n        } else {\n          newIndex = index(multiDragElement);\n        }\n        newIndicies.push({\n          multiDragElement: multiDragElement,\n          index: newIndex\n        });\n      });\n      return {\n        items: _toConsumableArray(multiDragElements),\n        clones: [].concat(multiDragClones),\n        oldIndicies: oldIndicies,\n        newIndicies: newIndicies\n      };\n    },\n    optionListeners: {\n      multiDragKey: function multiDragKey(key) {\n        key = key.toLowerCase();\n        if (key === 'ctrl') {\n          key = 'Control';\n        } else if (key.length > 1) {\n          key = key.charAt(0).toUpperCase() + key.substr(1);\n        }\n        return key;\n      }\n    }\n  });\n}\nfunction insertMultiDragElements(clonesInserted, rootEl) {\n  multiDragElements.forEach(function (multiDragElement, i) {\n    var target = rootEl.children[multiDragElement.sortableIndex + (clonesInserted ? Number(i) : 0)];\n    if (target) {\n      rootEl.insertBefore(multiDragElement, target);\n    } else {\n      rootEl.appendChild(multiDragElement);\n    }\n  });\n}\n\n/**\r\n * Insert multi-drag clones\r\n * @param  {[Boolean]} elementsInserted  Whether the multi-drag elements are inserted\r\n * @param  {HTMLElement} rootEl\r\n */\nfunction insertMultiDragClones(elementsInserted, rootEl) {\n  multiDragClones.forEach(function (clone, i) {\n    var target = rootEl.children[clone.sortableIndex + (elementsInserted ? Number(i) : 0)];\n    if (target) {\n      rootEl.insertBefore(clone, target);\n    } else {\n      rootEl.appendChild(clone);\n    }\n  });\n}\nfunction removeMultiDragElements() {\n  multiDragElements.forEach(function (multiDragElement) {\n    if (multiDragElement === dragEl$1) return;\n    multiDragElement.parentNode && multiDragElement.parentNode.removeChild(multiDragElement);\n  });\n}\n\nSortable.mount(new AutoScrollPlugin());\nSortable.mount(Remove, Revert);\n\nexport default Sortable;\nexport { MultiDragPlugin as MultiDrag, Sortable, SwapPlugin as Swap };\n","<template>\n  <div class=\"activity-item\">\n    <div class=\"timeline-dot\"></div>\n\n    <div class=\"activity-item__body\">\n      <DivWithId v-slot=\"{ id }\">\n        <label class=\"form-label required\">{{ t('overview') }}</label>\n        <input :id=\"id\" type=\"text\" class=\"form-input\" v-model=\"model.overview\">\n        <CmsInputValidation :id=\"id\" :checker=\"() => model.overview\" />\n      </DivWithId>\n\n      <DivWithId v-slot=\"{ id }\">\n        <label class=\"form-label\" :class=\"{ required: !last }\">{{ t('accommodation', [model.day]) }}</label>\n        <SelectInput :id=\"id\" :options=\"accommodations\" v-model=\"model.itinerary_accommodation_id\" empty=\"\" />\n        <CmsInputValidation v-if=\"!last\" :id=\"id\" :checker=\"() => model.itinerary_accommodation_id\" />\n      </DivWithId>\n\n      <DivWithId v-slot=\"{ id }\">\n        <label class=\"form-label required\">{{ t('description') }}</label>\n        <textarea :id=\"id\" class=\"form-input\" v-model=\"model.description\"></textarea>\n        <CmsInputValidation :id=\"id\" :checker=\"() => model.description\" />\n      </DivWithId>\n\n      <ImageSelector\n        collapsed\n        v-model=\"model.draft_media\"\n        :apiQuery=\"{ itinerary_day_id: model.id }\"\n        :title=\"`Add images for day ${model.day}`\"\n      />\n    </div>\n  </div>\n</template>\n\n<script setup>\nimport { computed } from \"vue\";\nimport { useShared } from \"@/helpers/vueHelpers.js\";\nimport SelectInput from \"@/modules/LiteCMS/Common/SelectInput.vue\";\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore.ts\";\nimport ImageSelector from \"@/modules/LiteCMS/Common/AddImages/ImageSelector.vue\";\nimport CmsInputValidation from \"@/modules/LiteCMS/Common/CmsInputValidation.vue\";\nimport DivWithId from \"@/components/Containers/DivWithId.vue\";\n\ndefineProps({\n  last: {\n    type: Boolean,\n    default: false\n  }\n});\nconst model = defineModel();\nconst { t } = useShared();\nconst { accommodationStore } = useCmsIndexStore();\nconst accommodations = computed(() => accommodationStore.places.map(p => ({ value: p.id, label: p.name })));\n</script>\n\n<style lang=\"scss\" scoped>\n.activity-item {\n  display: flex;\n  position: relative;\n}\n\n.activity-item__body {\n  flex: 1;\n  @include flex-column($spacing-6);\n\n  .form-label {\n    margin-bottom: 6px;\n    font-size: $text-xs;\n    line-height: 1.16667;\n  }\n\n  textarea {\n    resize: none;\n    height: 200px;\n  }\n}\n\n.timeline-dot {\n  position: absolute;\n  width: 6px;\n  height: 6px;\n  border-radius: 50%;\n  border: 1px solid $brand-tertiary;\n  background-color: white;\n  left: -25px; // 20 (colum-gap) + 1 (self-border) + 4 (self-width:6 - timeline-width:2)\n  top: 0;\n}\n</style>\n\n<i18n lang=\"yaml\">\nen:\n  overview: Overview\n  accommodation: Day {0} accommodation\n  description: Description\n</i18n>\n","<template>\n  <div class=\"activity-day\" :class=\"{ expand, collapse, last, notlast, editing }\">\n    <div class=\"timeline\">\n      <div class=\"timeline-dot\"></div>\n    </div>\n\n    <div class=\"body\">\n      <div class=\"day-heading\" role=\"button\" @click=\"emit('toggle')\">\n        <div ref=\"titleEl\" class=\"title\">\n          <span>Day {{ model.day }}</span>\n          <span> · </span>\n          <span>{{ model.date }}</span>\n\n          <template v-if=\"summary\">\n            <span> · </span>\n            <span ref=\"titleInput\"\n                  class=\"title-input\"\n                  v-contenteditable=\"editing && 'plaintext-only'\"\n                  @click.stop=\"editing = true\"\n                  @keydown.enter.prevent=\"saveTitleInput()\"\n                  v-html=\"model.title || 'Title'\"\n            ></span>\n          </template>\n\n          <button v-if=\"summary\" class=\"edit-btn\" @click.stop=\"selectTitleInput()\">\n            <PencilIcon width=\"16\" />\n          </button>\n\n          <CmsInputValidation v-if=\"summary\" message=\"Please add a title\" :checker=\"() => model.title\" top=\"0px\" inline />\n        </div>\n\n        <i class=\"icon icon-arrow-down-1\"></i>\n      </div>\n      <div ref=\"list\" class=\"day-items\" v-show=\"expand\" :data-day=\"model.day\">\n        <template v-if=\"summary\" v-for=\"(item, i) in model.activities\" :key=\"item.key\">\n          <ActivityTimelineTransportItem\n            v-if=\"item.transportation_type\"\n            v-model=\"model.activities[i]\"\n            :first=\"i === 0\"\n            @delete=\"model.activities.splice(i, 1)\" />\n          <ActivityTimelineDayItem\n            v-else v-model=\"model.activities[i]\"\n            :first=\"i === 0\"\n            @delete=\"model.activities.splice(i, 1)\"\n          />\n        </template>\n\n        <ActivityTimelineDayOverview v-else v-model=\"model\" :last=\"last\" />\n      </div>\n      <div class=\"add-item-container\" v-show=\"expand && summary\">\n        <div class=\"add-item-text\">{{ t('add_item') }}</div>\n        <Button class=\"add-button\" @click=\"itineraryStore.addTransportation(model)\">{{ t('add_transportation') }}</Button>\n        <Button class=\"add-button\" @click=\"itineraryStore.addActivity(model)\">{{ t('add_activity') }}</Button>\n      </div>\n    </div>\n  </div>\n</template>\n\n<script setup>\nimport ActivityTimelineDayItem from \"@/modules/LiteCMS/Itinerary/ActivityTimelineDayItem.vue\";\nimport ActivityTimelineTransportItem from \"@/modules/LiteCMS/Itinerary/ActivityTimelineTransportItem.vue\"\nimport PencilIcon from 'app/assets/images/common/pencil.svg?component';\nimport { computed, nextTick, onMounted, ref } from \"vue\";\nimport Sortable from \"sortablejs\";\nimport { useShared } from \"@/helpers/vueHelpers.js\";\nimport { Button } from \"@/components/Theme/index.js\";\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore.ts\";\nimport ActivityTimelineDayOverview from \"@/modules/LiteCMS/Itinerary/ActivityTimelineDayOverview.vue\";\nimport CmsInputValidation from \"@/modules/LiteCMS/Common/CmsInputValidation.vue\";\nimport { onClickOutside } from '@vueuse/core'\n\nconst list = ref();\nconst titleInput = ref();\nconst { t } = useShared();\nconst props = defineProps({ expand: Boolean, last: Boolean, summary: Boolean });\nconst emit = defineEmits(['toggle']);\nconst model = defineModel();\nconst { itineraryStore } = useCmsIndexStore();\nconst collapse = computed(() => !props.expand);\nconst notlast = computed(() => !props.last);\nconst titleEl = ref();\nconst editing = ref(false);\n\nonMounted(() => {\n  if (props.summary) {\n    Sortable.create(list.value, {\n      group: 'activity-timeline',\n      draggable: '.activity-item',\n      handle: '.handle',\n      onEnd: itineraryStore.onActivityItemMoved,\n    });\n  }\n});\n\nonClickOutside(titleEl, saveTitleInput);\n\nfunction saveTitleInput() {\n  editing.value = false;\n  if (titleInput.value) {\n    model.value.title = titleInput.value.innerText;\n  }\n}\n\nfunction selectTitleInput() {\n  editing.value = true;\n  nextTick(() => window.getSelection().selectAllChildren(titleInput.value));\n}\n</script>\n\n<style lang=\"scss\" scoped>\n$circle: $spacing-2;\n$offset: ($text-base * $leading-snug / 2) - ($circle / 2) + $spacing-2 + $spacing-2;\n\n.activity-day {\n  display: grid;\n  grid-template-columns: 2px 1fr;\n  column-gap: $spacing-5;\n\n  &.expand .icon-arrow-down-1 {\n    transform: rotate(180deg\n    );\n}\n\n&.collapse.last .timeline {\n  background-color: transparent;\n}\n\n&.collapse.last .day-heading {\n  margin-bottom: 0;\n}\n\n&.expand.last .timeline {\n  margin-bottom: $offset;\n}\n\n&.notlast .body {\n  border-bottom: 1px solid $gray-lighter;\n}\n\n&.editing .title-input {\n  display: inline-block;\n  border: 1px solid $gray-lighter;\n  border-radius: $rounded;\n  padding: $spacing-1 $spacing-2;\n}\n\n.timeline {\n  @include flex-column;\n  align-items: center;\n  width: 100%;\n  background-color: $brand-tertiary-light;\n  position: relative;\n  transform: translateY($offset);\n}\n\n.timeline-dot {\n  width: 8px;\n  height: 8px;\n  border-radius: 50%;\n  background-color: $brand-tertiary;\n  position: absolute;\n  left: -3px;\n}\n\n.day-heading {\n  display: flex;\n  align-items: center;\n  gap: $spacing-2;\n  margin: $spacing-2 0;\n  cursor: pointer;\n\n  .title {\n    color: $brand-primary;\n    font-weight: $font-semibold;\n    padding: $spacing-2 0;\n\n    .edit-btn {\n      display: inline-flex;\n      padding: 0 $spacing-2;\n      transform: translateY(3px);\n\n      :deep(svg path) {\n        stroke: $brand-tertiary;\n      }\n    }\n\n    span {\n      outline: none;\n    }\n  }\n\n  .icon {\n    cursor: pointer;\n    margin-left: auto;\n  }\n}\n\n.day-items {\n  @include flex-column($spacing-4);\n  margin: $spacing-4 0;\n}\n\n\n.add-item-container {\n  width: 100%;\n  display: flex;\n  flex-wrap: wrap;\n  background-color: $grey-25;\n  padding: $spacing-3;\n  justify-content: center;\n  border-radius: 5px;\n  margin-bottom: $spacing-4;\n  gap: $spacing-3\n}\n\n\n.add-item-text {\n  width: 100%;\n  text-align: center;\n  font-size: $text-base;\n  font-weight: $font-semibold;\n}\n}\n</style>\n\n<i18n lang=\"yaml\">\nen:\n  add_item: Add another item\n  add_transportation: Add a transportation\n  add_activity: Add another activity\n</i18n>","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createStaticVNode as _createStaticVNode } from \"vue\"\n\nconst _hoisted_1 = {\n  viewBox: \"0 0 20 20\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createStaticVNode(\"<g clip-path=\\\"url(#clip0_6214_13352)\\\"><path d=\\\"M10 19.3733V0.623291\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.25\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M6.875 16.2483L10 19.3733L13.125 16.2483\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.25\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M6.875 3.74829L10 0.623291L13.125 3.74829\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.25\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path></g><defs><clipPath id=\\\"clip0_6214_13352\\\"><rect width=\\\"20\\\" height=\\\"20\\\" fill=\\\"white\\\"></rect></clipPath></defs>\", 2)\n  ])))\n}\nexport default { render: render }","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createStaticVNode as _createStaticVNode } from \"vue\"\n\nconst _hoisted_1 = {\n  viewBox: \"0 0 24 24\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createStaticVNode(\"<g clip-path=\\\"url(#clip0_6232_29065)\\\"><path d=\\\"M12.002 8.99805V0.748047\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M12.002 23.248V14.998\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M8.25195 5.24805L12.002 8.99805L15.752 5.24805\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M8.25195 18.748L12.002 14.998L15.752 18.748\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path><path d=\\\"M0.751953 11.998H23.252\\\" stroke=\\\"#307582\\\" stroke-width=\\\"1.5\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"></path></g><defs><clipPath id=\\\"clip0_6232_29065\\\"><rect width=\\\"24\\\" height=\\\"24\\\" fill=\\\"white\\\"></rect></clipPath></defs>\", 2)\n  ])))\n}\nexport default { render: render }","<template>\n  <button v-if=\"expanded\" @click=\"onClick()\">\n    <CollapseIcon width=\"20\"/>\n    {{ t('collapse_all') }}\n  </button>\n\n  <button v-else @click=\"onClick()\">\n    <ExpandIcon width=\"20\"/>\n    {{ t('expand_all') }}\n  </button>\n</template>\n\n<script setup>\nimport ExpandIcon from 'app/assets/images/common/expand-vertical.svg?component';\nimport CollapseIcon from 'app/assets/images/common/collapse-vertical.svg?component';\nimport { useShared } from \"@/helpers/vueHelpers.js\";\n\nconst { t } = useShared();\nconst props = defineProps({\n  expanded: {\n    type: Boolean,\n    default: false,\n  }\n});\nconst emit = defineEmits(['expand', 'collapse']);\n\nfunction onClick() {\n  emit(props.expanded ? 'collapse' : 'expand');\n}\n</script>\n\n<style lang=\"scss\" scoped>\nbutton {\n  display: flex;\n  align-items: center;\n  gap: $spacing-2;\n  white-space: nowrap;\n  font-weight: $font-semibold;\n  color: $brand-tertiary;\n}\n</style>\n\n<i18n lang=\"yaml\">\nen:\n  expand_all: Expand all\n  collapse_all: Collapse all\n</i18n>","<template>\n  <div class=\"activity-timeline\">\n    <div class=\"meta\">\n      <div class=\"heading\">{{ t('total_days', [model.length]) }}</div>\n      <ExpandAllToggle :expanded=\"allExpaned\" @expand=\"expandAll\" @collapse=\"collapseAll\" />\n    </div>\n\n    <div class=\"activity-list\" ref=\"list\">\n      <ActivityTimelineDay\n        v-for=\"(group, i) in model\" :key=\"i\"\n        v-model=\"model[i]\"\n        :last=\"group === last(model)\"\n        :expand=\"expandedDates.includes(group.date)\"\n        @toggle=\"toggleExpand(group)\"\n        :summary\n      />\n    </div>\n  </div>\n</template>\n\n<script setup>\nimport ActivityTimelineDay from \"@/modules/LiteCMS/Itinerary/ActivityTimelineDay.vue\";\nimport { useShared } from \"@/helpers/vueHelpers.js\";\nimport { ref, computed, watch, onMounted } from \"vue\";\nimport { last, xor } from 'lodash';\nimport ExpandAllToggle from \"@/modules/LiteCMS/Common/ExpandAllToggle.vue\";\n\ndefineProps({ summary: Boolean });\nconst { t } = useShared();\nconst model = defineModel();\nconst expandedDates = ref([]);\nconst allExpaned = computed(() => model.value.every(item => expandedDates.value.includes(item.date)));\n\nonMounted(setInitExpansion);\nwatch(() => model.value[0]?.date, setInitExpansion);\n\nconst expandAll = () => expandedDates.value = model.value.map(item => item.date);\nconst collapseAll = () => expandedDates.value = [];\n\nfunction toggleExpand(group) {\n  expandedDates.value = xor(expandedDates.value, [group.date]);\n}\n\nfunction setInitExpansion() {\n  const date = model.value?.[0]?.date;\n  if (date && expandedDates.value.length === 0) {\n    expandedDates.value.push(date);\n  }\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.activity-timeline {\n  width: 100%;\n  font-size: $text-base;\n  line-height: $leading-snug;\n\n  .title {\n    font-size: $text-xl;\n    line-height: 1.625rem;\n    font-weight: $font-semibold;\n    color: $brand-primary;\n    margin-bottom: $spacing-6;\n  }\n\n  .meta {\n    display: flex;\n    justify-content: space-between;\n    align-items: center;\n    margin-bottom: $spacing-4;\n\n    .heading {\n      font-weight: $font-semibold;\n    }\n  }\n\n  :deep(.sortable-chosen) {\n    border: 1px solid $brand-tertiary;\n\n    .timeline-dot {\n      display: none;\n    }\n  }\n\n  :deep(.sortable-drag) {\n    background-color: white;\n  }\n\n  :deep(.sortable-chosen.sortable-ghost) {\n    & > * {\n      visibility: hidden;\n    }\n\n    border: 1px dashed $gray-lighter;\n  }\n}\n\ncode {\n  width: 100%;\n  max-width: 740px;\n  margin: auto;\n  background: $gray-light;\n  border-radius: $rounded;\n  padding: $spacing-6;\n  white-space: pre-wrap;\n  font-size: $text-sm;\n}\n</style>\n\n<i18n lang=\"yaml\">\nen:\n  total_days: \"{0} days in total\"\n</i18n>","<template>\n  <div class=\"itinerary container\">\n    <BackButton @back=\"metaStore.back()\"/>\n    <ItineraryTitle editable/>\n\n    <PageBody :saveFn=\"saveOnItineraryPage\">\n      <div class=\"panel\">\n        <div class=\"title\">Your fellow travelers</div>\n\n        <div>\n          <div class=\"form-label required\">Age range</div>\n          <div id=\"age-range\" class=\"number-range\">\n            <SelectNumber placeholder=\"Min\" class=\"number\" v-model=\"itineraryStore.ageMin\" :min=\"minAge\" required />\n            <span>to</span>\n            <SelectNumber placeholder=\"Max\" class=\"number\" v-model=\"itineraryStore.ageMax\" :min=\"itineraryStore.ageMin || minAge\" :max=\"maxAge\" required />\n          </div>\n          <CmsInputValidation id=\"age-range\" :checker=\"() => itineraryStore.ageMin && itineraryStore.ageMax\" />\n          <div class=\"form__message\" v-if=\"itineraryStore.ageMin < ageThreshold\">\n            All travelers under the age of 18 must be accompanied by an adult during their journey.\n          </div>\n        </div>\n\n        <div>\n          <div class=\"form-label required\">travel interest</div>\n          <TagInput class=\"interest-tags\" v-model=\"itineraryStore.interests\" :suggestions=\"interestSuggestions\" />\n          <CmsInputValidation target=\".interest-tags\" :checker=\"() => itineraryStore.interests.length > 0\" />\n        </div>\n      </div>\n\n      <div class=\"panel\">\n        <div class=\"title\">Highlight</div>\n        <MarkdownEditor id=\"highlight\" v-model=\"itineraryStore.highlight\" />\n        <CmsInputValidation id=\"highlight\" :checker=\"() => itineraryStore.highlight\" top=\"-12px\" />\n      </div>\n\n      <div class=\"panel\">\n        <div class=\"title\">Timeline</div>\n        <ActivityTimeline v-model=\"itineraryStore.itineraryDays\" summary />\n        <CmsInputValidation\n          top=\"0px\"\n          message=\"Please include at least one item per day\"\n          :checker=\"() => itineraryStore.hasAtLeastOneActivityPerDay()\"\n        />\n      </div>\n\n      <div class=\"panel\">\n        <div class=\"title\">Details</div>\n        <ActivityTimeline v-model=\"itineraryStore.itineraryDays\" />\n        <CmsInputValidation\n          top=\"0px\"\n          message=\"Please include at least one item per day\"\n          :checker=\"() => itineraryStore.itineraryDayDetailsAreFilled()\"\n        />\n      </div>\n    </PageBody>\n  </div>\n</template>\n\n<script setup>\nimport { ref } from 'vue';\nimport BackButton from \"@/modules/LiteCMS/Common/BackButton.vue\";\nimport PageBody from \"@/modules/LiteCMS/Common/PageBody.vue\";\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore.ts\";\nimport ItineraryTitle from \"@/modules/LiteCMS/Common/ItineraryTitle.vue\";\nimport SelectNumber from \"@/modules/LiteCMS/Common/SelectNumber.vue\";\nimport TagInput from \"@/modules/LiteCMS/Itinerary/TagInput.vue\";\nimport MarkdownEditor from \"@/components/Milkdown/MarkdownEditor.vue\";\nimport ActivityTimeline from \"@/modules/LiteCMS/Itinerary/ActivityTimeline.vue\";\nimport CmsInputValidation from \"@/modules/LiteCMS/Common/CmsInputValidation.vue\";\n\nconst { metaStore, itineraryStore, saveOnItineraryPage } = useCmsIndexStore();\nconst minAge = ref(3);\nconst ageThreshold = 18;\nconst maxAge = 122;\nconst interestSuggestions = ref(['Sightseeing', 'Culture', 'Adventure', 'Food', 'Relax', 'City']);\n</script>\n\n<style lang=\"scss\" scoped>\n@import 'app/assets/stylesheets/litecms';\n\n.interest-tags {\n  margin-top: $spacing-3;\n}\n.form__message {\n  margin-top: $spacing-3;\n  border: 1px solid $brand-tertiary;\n  border-radius: $rounded;\n  background-color: $brand-tertiary-light;\n  padding: $spacing-4;\n}\n</style>\n","<template>\n  <div class=\"fee-summary\">\n    <div>Selling price</div>\n    <div class=\"right\">{{ totalAmount }}</div>\n\n    <template v-if=\"percent\">\n      <div class=\"fee\">\n        <span>Platform fee</span>\n        <i @click=\"show = !show\" class=\"icon icon-information-circle\"/>\n      </div>\n      <div class=\"right\">{{ percent }}%</div>\n      <div class=\"text\" v-if=\"show\">The platform fee is a percentage of your selling price, covering the cost of running the platform and credit card fees.</div>\n    </template>\n\n    <div class=\"hr\"></div>\n    <div>You receive</div>\n    <div class=\"right\">{{ revAmount }}</div>\n  </div>\n</template>\n\n<script setup>\nimport { computed, ref } from 'vue';\nimport { currencyFormat } from \"@/utils/numberUtils.js\";\n\nconst show = ref(false);\nconst props = defineProps({\n  amount: Number,\n  currency: Object,\n  percent: Number,\n});\n\nconst totalAmount = computed(() => {\n  const { currency, exponent } = props.currency;\n  const amount = props.amount * Math.pow(10, -exponent);\n  return currencyFormat(amount, currency);\n});\n\nconst revAmount = computed(() => {\n  const { currency, exponent } = props.currency;\n  const amount = props.amount * Math.pow(10, -exponent) * (100 - props.percent) / 100;\n  return currencyFormat(amount, currency);\n});\n</script>\n\n<style lang=\"scss\" scoped>\n@import \"app/assets/stylesheets/litecms\";\n\n.fee-summary {\n  border: 1px solid $gray-lighter;\n  border-radius: $rounded;\n  padding: $spacing-4 $spacing-5;\n  display: grid;\n  grid-template-columns: auto auto;\n  row-gap: $spacing-3;\n\n  .fee {\n    display: flex;\n    gap: $spacing-1;\n\n    .icon {\n      cursor: pointer;\n      color: $brand-tertiary;\n    }\n  }\n\n  .right {\n    text-align: right;\n  }\n\n  .text, .hr {\n    grid-column: 1/-1;\n  }\n\n  .text {\n    color: $gray;\n  }\n\n  .hr {\n    border-bottom: 1px solid $gray-lighter;\n  }\n}\n</style>","<template>\n  <div class=\"lineitems\">\n    <DivWithId v-for=\"(_, i) in model\" :key=\"i\" v-slot=\"{ id }\">\n      <div class=\"item\">\n        <AutosizeTextarea :id=\"id\" class=\"form-input\" v-model=\"model[i]\"/>\n        <button class=\"delete\" @click=\"model.splice(i, 1)\">\n          <TrashIcon :width=\"16\"/>\n        </button>\n      </div>\n      <CmsInputValidation :id=\"id\" :checker=\"() => model[i]\"/>\n    </DivWithId>\n\n    <button class=\"add\" @click=\"model.push('')\">\n      {{ model.length === 0 ? appendText[0] : appendText[1] }}\n    </button>\n  </div>\n</template>\n\n<script setup>\nimport { onMounted } from \"vue\";\nimport TrashIcon from 'app/assets/images/common/trash.svg?component';\nimport AutosizeTextarea from \"@/modules/LiteCMS/Common/AutosizeTextarea.vue\";\nimport CmsInputValidation from \"@/modules/LiteCMS/Common/CmsInputValidation.vue\";\nimport DivWithId from \"@/components/Containers/DivWithId.vue\";\n\nconst model = defineModel();\nconst props = defineProps({ appendText: Array, placeholder: Boolean });\n\nonMounted(() => {\n  if (props.placeholder && model.value.length === 0) {\n    model.value.push('');\n  }\n});\n</script>\n\n<style lang=\"scss\" scoped>\n@import \"app/assets/stylesheets/litecms\";\n\n.lineitems {\n  @include flex-column($spacing-3);\n\n  .item {\n    display: flex;\n    align-items: center;\n    position: relative;\n\n    &:hover .delete,\n    &:focus-within .delete {\n      display: inline-flex;\n    }\n  }\n\n  .form-input {\n    padding-right: $spacing-5 + $spacing-8 + $spacing-2;\n  }\n\n  .delete {\n    display: none;\n    padding: $spacing-2;\n    background-color: $gray-light;\n    border-radius: $rounded;\n    position: absolute;\n    right: $spacing-5;\n\n    :deep(svg path) {\n      stroke: #222;\n    }\n  }\n\n  .add {\n    color: $brand-tertiary;\n    margin-right: auto;\n  }\n}\n</style>\n","<template>\n  <input type=\"text\" class=\"form-input\" v-model=\"text\" @blur=\"confirmInput\">\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, watch } from 'vue';\nimport { extractNumber, currencyFormat } from \"@/utils/numberUtils.js\";\n\nconst text = ref('')\nconst model = defineModel();\nconst props = defineProps({ exponent: { type: Number, default: 2 } });\n\nconst setModel = (n: number|null) => {\n  model.value = n !== null\n    ? n * Math.pow(10, props.exponent)\n    : null;\n};\nconst getModel = () => {\n  if (model.value === null || model.value == undefined)\n    return null;\n\n  return Number(model.value) * Math.pow(10, -props.exponent)\n};\n\nwatch(text, () => {\n  const amount = extractNumber(text.value);\n  setModel(Number.isFinite(amount) ? amount : null);\n});\n\nwatch(() => [model.value, props.exponent], confirmInput, { immediate: true });\n\nfunction confirmInput() {\n  const amt = getModel();\n  text.value = amt !== null ? currencyFormat(amt) : '';\n}\n</script>","<template>\n  <DateRangeInput\n    v-bind=\"$attrs\"\n    v-model=\"dateRange\"\n    :range=\"false\"\n    :minDate=\"minDate\"\n    :maxDate=\"maxDate\"\n  />\n</template>\n\n<script setup>\nimport { ref, watch } from \"vue\";\nimport DateRangeInput from \"@/modules/LiteCMS/Common/DateRangeInput.vue\";\nimport moment from \"moment-timezone\";\nimport { ymd } from \"@/utils/dateUtils.ts\";\n\nconst props = defineProps({\n  minDate: { type: [Date, String] },\n  maxDate: { type: [Date, String] },\n});\n\nconst model = defineModel();\nconst dateRange = ref({ startDate: model.value, endDate: model.value });\n\nwatch(dateRange, (range) => model.value = range.startDate);\nwatch(model, (date) => dateRange.value.startDate = dateRange.value.endDate = date);\n\n// when model fails min/max constraints, set it to null.\nwatch(() => [model, props.minDate, props.maxDate], function () {\n  const date = moment(model.value);\n  const min = props.minDate ? moment(props.minDate).startOf('day') : null;\n  const max = props.maxDate ? moment(props.maxDate).endOf('day') : null;\n  // preselect the min-date, so the calendar is shown in the right month\n  if (!date.isValid() && min?.isValid()) {\n    dateRange.value.startDate = ymd(min);\n  }\n  const dateBeforeMin = min?.isValid() && date.isValid() && date.isBefore(min);\n  const dateAfterMax = max?.isValid() && date.isValid() && date.isAfter(max);\n  if (dateBeforeMin || dateAfterMax) {\n    model.value = null;\n  }\n}, { deep: true, immediate: true });\n</script>\n","<template>\n  <div class=\"plans\">\n    <div class=\"plan\" :set=\"selected = store.paymentTypes.includes('installment')\">\n      <SquareCheck class=\"checkbox\" :class=\"{ expand: selected }\" :checked=\"selected\" @click=\"store.togglePaymentType('installment')\" />\n      <div>Installment</div>\n      <div class=\"description\">Guests pay a deposit, then the remaining payment is split incrementally until the last payment date</div>\n      <div v-if=\"selected\">\n        <div class=\"form-label required\">deposit amount</div>\n        <div class=\"currency-money\">\n          <input type=\"text\" class=\"form-input currency\" disabled v-model=\"store.currency\">\n          <MoneyInput class=\"money\" v-model=\"store.packages[0].installment_amount_cents\" :exponent=\"store.currencyInfo.exponent\" />\n        </div>\n      </div>\n    </div>\n\n    <div class=\"plan\" :set=\"selected = store.paymentTypes.includes('deposit')\">\n      <SquareCheck class=\"checkbox\" :class=\"{ expand: selected }\" :checked=\"selected\" @click=\"store.togglePaymentType('deposit')\" />\n      <div>Deposit + one-time payment</div>\n      <div class=\"description\">Guests pay a deposit then a final payment on the last payment date</div>\n      <div v-if=\"selected\">\n        <div class=\"form-label required\">deposit amount</div>\n        <div class=\"currency-money\">\n          <input type=\"text\" class=\"form-input currency\" disabled v-model=\"store.currency\">\n          <MoneyInput class=\"money\" v-model=\"store.packages[0].deposit_amount_cents\" :exponent=\"store.currencyInfo.exponent\" />\n        </div>\n      </div>\n    </div>\n\n    <div class=\"plan\" :set=\"selected = store.paymentTypes.includes('full')\">\n      <SquareCheck class=\"checkbox\" :checked=\"selected\" @click=\"store.togglePaymentType('full')\" />\n      <div>Full amount</div>\n      <div class=\"description\">Guests pay full amount in one go on the day of the booking</div>\n    </div>\n  </div>\n\n  <div class=\"last-payment\" v-if=\"store.paymentTypes.includes('installment') || store.paymentTypes.includes('deposit')\">\n    <div class=\"heading\">Pick the last payment date</div>\n    <div class=\"text\">Guests with Installment and Deposit payment plans will pay the remaining amounts on this date. If no date is selected, the last payment date will be <strong>automatically set to\n      30 days before the trip departs</strong>.\n    </div>\n    <div>\n      <div class=\"form-label\">last payment date</div>\n      <DatePicker class=\"date-input\" v-model=\"store.paymentDate\" />\n      <CmsInputValidation target=\".date-input .form-input\" :checker=\"() => isLastPaymentDateValid()\" message=\"Last payment date is after the earliest package start date\" />\n    </div>\n  </div>\n</template>\n\n<script setup>\nimport { SquareCheck } from \"@/components/Theme/index.js\";\nimport { useCmsPricingStore } from \"@/stores/liteCMS/cmsPricingStore.ts\";\nimport MoneyInput from \"@/modules/LiteCMS/Common/MoneyInput.vue\";\nimport DatePicker from \"@/modules/LiteCMS/Common/DatePicker.vue\";\nimport { earliest } from \"@/utils/dateUtils\";\nimport CmsInputValidation from \"@/modules/LiteCMS/Common/CmsInputValidation.vue\";\n\n\nconst store = useCmsPricingStore();\n\nconst isLastPaymentDateValid = () => {\n  if (!store.paymentDate) {\n    return true;\n  }\n\n  const dates = [...(store.packages.map(p => p.starts_at)), store.paymentDate];\n  const earliestDate = earliest(...dates);\n  return store.paymentDate == earliestDate\n};\n</script>\n\n<style lang=\"scss\" scoped>\n@import \"app/assets/stylesheets/litecms\";\n\n.plans, .last-payment {\n  @include flex-column($spacing-3);\n}\n\n.plan {\n  border: 1px solid $gray-lighter;\n  border-radius: $rounded;\n  padding: $spacing-4;\n  display: grid;\n  grid-template-columns: auto 1fr;\n  gap: $spacing-3;\n\n  .checkbox {\n    margin: 3px 0;\n    grid-row: span 2;\n\n    &.expand {\n      grid-row: span 3;\n    }\n  }\n\n  .description {\n    color: $gray;\n  }\n}\n\n.last-payment {\n  .heading {\n    font-weight: $font-semibold;\n  }\n\n  .text {\n    color: $gray;\n  }\n\n  .date-input {\n    max-width: 325px;\n  }\n}\n\n.currency-money {\n  display: flex;\n  gap: $spacing-3;\n\n  input:nth-child(1) {\n    max-width: 110px;\n  }\n\n  input:nth-child(2) {\n    max-width: 200px;\n  }\n}\n\ninput:disabled {\n  color: $gray;\n  background-color: $gray-lighter;\n}\n</style>\n","<template>\n  <div\n    ref=\"el\"\n    class=\"show-first\"\n    :style=\"{ display: children > 0 ? 'block' : 'none' }\"\n  >\n    <slot/>\n  </div>\n</template>\n\n<script setup>\nimport { onMounted, ref } from 'vue';\nimport { useMutationObserver } from \"@vueuse/core\";\n\nconst el = ref();\nconst children = ref(0);\n\nonMounted(setChildren);\nuseMutationObserver(el, setChildren, { childList: true });\n\nfunction setChildren() {\n  children.value = el.value.children.length;\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.show-first > *:not(:first-child) {\n  display: none !important;\n}\n</style>","<template>\n  <div class=\"pricing container\">\n    <BackButton @back=\"metaStore.back()\"/>\n    <ItineraryTitle editable/>\n\n    <PageBody :saveFn=\"saveOnPricingPage\">\n      <div class=\"panel\">\n        <div class=\"title\">Currency</div>\n        <SelectInput id=\"currency\" :options=\"metaStore.currencyList\" v-model=\"pricingStore.currency\" empty=\"\"/>\n        <CmsInputValidation id=\"currency\" :checker=\"() => pricingStore.currency\" top=\"-18px\"/>\n      </div>\n\n      <div class=\"panel\"\n           ref=\"packageListEl\"\n           v-for=\"(event, i) in pricingStore.packages\"\n           :set1=\"notFirst = i !== 0\"\n           :set2=\"isLast = i >= (pricingStore.packages.length - 1)\"\n      >\n        <SectionTitle :text=\"`Package ${optionalNumbering(i + 1, pricingStore.packages.length > 1)}`\"\n                      :toggleable=\"!metaStore.validating\" :toggled=\"event.show\" @toggle=\"event.show = !event.show\" />\n\n        <template v-if=\"event.show || metaStore.validating\">\n\n          <div>\n            <div class=\"form-label required\">Name of package</div>\n\n            <WithId v-slot=\"{ id }\">\n              <AutosizeTextarea :id=\"id\" :rows=\"mobile ? 2 : 1\" class=\"form-input\" v-model=\"event.name\"/>\n              <CmsInputValidation :id=\"id\" :checker=\"() => event.name\" top=\"0\" basic/>\n            </WithId>\n\n            <div class=\"instruction-text\">If your trip is a single package, please use \"Basic package\"</div>\n          </div>\n\n          <div class=\"two-col\">\n            <DivWithId v-slot=\"{ id }\">\n              <div class=\"form-label required\">Trip Starts</div>\n              <DatePicker :id=\"id\"\n                          v-model=\"event.starts_at\"\n                          :minDate=\"essentialStore.tripDates.startDate\"\n                          :maxDate=\"essentialStore.tripDates.endDate\"\n              />\n              <ShowFirst>\n                <CmsInputValidation :id=\"id\" :checker=\"() => event.starts_at\" basic/>\n                <CmsInputValidation :id=\"id\" basic\n                                 :checker=\"() => moment(event.starts_at) >= moment(essentialStore.tripDates.startDate)\"\n                                 :message=\"`Trip start date should not be before ${essentialStore.tripDates.startDate}`\"/>\n              </ShowFirst>\n            </DivWithId>\n\n            <DivWithId v-slot=\"{ id }\">\n              <div class=\"form-label required\">Trip Ends</div>\n              <DatePicker :id=\"id\"\n                          v-model=\"event.ends_at\"\n                          :minDate=\"latest(essentialStore.tripDates.startDate, event.starts_at)\"\n                          :maxDate=\"essentialStore.tripDates.endDate\"\n              />\n\n              <ShowFirst>\n                <CmsInputValidation :id=\"id\" :checker=\"() => event.ends_at\" basic/>\n                <CmsInputValidation :id=\"id\" basic\n                                 :checker=\"() => event.starts_at && event.ends_at && moment(event.starts_at) <= moment(event.ends_at)\"\n                                 message=\"Trip end date should not be before the trip start date\"/>\n                <CmsInputValidation :id=\"id\" basic\n                                 :checker=\"() => moment(event.ends_at) <= moment(essentialStore.tripDates.endDate)\"\n                                 :message=\"`Trip end date should not be after ${essentialStore.tripDates.endDate}`\"/>\n              </ShowFirst>\n            </DivWithId>\n          </div>\n\n          <div class=\"two-col\">\n            <DivWithId v-slot=\"{ id1, id2 }\">\n              <div class=\"form-label required\">group size limit</div>\n              <div class=\"number-range\">\n                <NumberInput :id=\"id1\" placeholder=\"Min\" positive v-model=\"event.min_guest_count\" :max=\"event.max_guest_count\"/>\n                <span>to</span>\n                <NumberInput :id=\"id2\" placeholder=\"Max\" positive v-model=\"event.max_guest_count\" :min=\"event.min_guest_count\"/>\n              </div>\n\n              <ShowFirst>\n                <CmsInputValidation :id=\"id1\" :checker=\"() => event.min_guest_count\" basic/>\n                <CmsInputValidation :id=\"id2\" :checker=\"() => event.max_guest_count\" basic/>\n                <CmsInputValidation :id=\"id1\" :checker=\"() => event.min_guest_count <= event.max_guest_count\"\n                                 message=\"Minimum group size must be lesser than the maximum group size\"/>\n                <CmsInputValidation :id=\"id1\"\n                                 :checker=\"() => event.min_guest_count >= essentialStore.groupMin && event.min_guest_count <= essentialStore.groupMax\"\n                                 :message=\"`Min group size should be between ${essentialStore.groupMin} and ${essentialStore.groupMax}`\"/>\n                <CmsInputValidation :id=\"id2\"\n                                 :checker=\"() => event.max_guest_count >= essentialStore.groupMin && event.max_guest_count <= essentialStore.groupMax\"\n                                 :message=\"`Max group size should be between ${essentialStore.groupMin} and ${essentialStore.groupMax}`\"/>\n              </ShowFirst>\n\n            </DivWithId>\n          </div>\n\n          <div class=\"two-col\">\n            <DivWithId v-slot=\"{ id }\">\n              <div class=\"form-label required\">price per person</div>\n              <div class=\"currency-money\">\n                <input type=\"text\" class=\"form-input currency\" v-model=\"pricingStore.currency\" disabled>\n                <MoneyInput :id=\"id\" class=\"money\" v-model=\"event.amount_cents\" :exponent=\"pricingStore.currencyInfo.exponent\"/>\n              </div>\n              <CmsInputValidation :id=\"id\" :checker=\"() => event.amount_cents\"/>\n            </DivWithId>\n          </div>\n\n          <div class=\"two-col\" v-if=\"event.amount_cents > 0\">\n            <FeeSummary\n              :amount=\"event.amount_cents\"\n              :currency=\"pricingStore.currencyInfo\"\n              :percent=\"event.commission || pricingStore.commission\"\n            />\n          </div>\n\n          <div>\n            <div class=\"subtitle required\">Inclusions</div>\n            <LineitemList\n              :placeholder=\"!event.id\"\n              v-model=\"event.package.included_in_price\"\n              :appendText=\"['Add inclusion item', 'Add another inclusion item']\"\n            />\n          </div>\n\n          <div>\n            <div class=\"subtitle required\">Exclusions</div>\n            <LineitemList\n              :placeholder=\"!event.id\"\n              v-model=\"event.package.excluded_in_price\"\n              :appendText=\"['Add exclusion item', 'Add another exclusion item']\"\n            />\n          </div>\n\n          <ImageSelector collapsed v-model=\"event.draft_media\" :max=\"10\" :apiQuery=\"{ event_id: event.id }\"/>\n\n          <template v-if=\"notFirst || isLast\">\n            <div class=\"line\"></div>\n            <button v-if=\"notFirst\" class=\"link\" @click=\"removePackage(event)\">Remove package</button>\n            <Button v-if=\"isLast\" class=\"btn\" @click=\"addPackage()\">Add another package</Button>\n          </template>\n        </template>\n      </div>\n\n      <div class=\"panel\">\n        <div class=\"title\">Payment plans</div>\n        <PaymentPlans v-if=\"pricingStore.packages.length > 0\"/>\n        <CmsInputValidation :checker=\"() => pricingStore.paymentTypes.length > 0\" message=\"Please select at least one payment plan\"/>\n      </div>\n    </PageBody>\n  </div>\n\n  <StatefulConfirmationDialog\n    title=\"Are you sure you want to remove this package?\"\n    description=\"Once you remove it, you cannot undo it.\"\n    confirm=\"Remove\"\n    cancel=\"Back\"\n  />\n</template>\n\n<script setup>\nimport BackButton from \"@/modules/LiteCMS/Common/BackButton.vue\";\nimport PageBody from \"@/modules/LiteCMS/Common/PageBody.vue\";\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore.ts\";\nimport ItineraryTitle from \"@/modules/LiteCMS/Common/ItineraryTitle.vue\";\nimport SelectInput from \"@/modules/LiteCMS/Common/SelectInput.vue\";\nimport FeeSummary from \"@/modules/LiteCMS/Pricing/FeeSummary.vue\";\nimport LineitemList from \"@/modules/LiteCMS/Pricing/LineitemList.vue\";\nimport ImageSelector from \"@/modules/LiteCMS/Common/AddImages/ImageSelector.vue\";\nimport { useShared } from \"@/helpers/vueHelpers.js\";\nimport { Button } from \"@/components/Theme/index.js\";\nimport PaymentPlans from \"@/modules/LiteCMS/Pricing/PaymentPlans.vue\";\nimport DatePicker from \"@/modules/LiteCMS/Common/DatePicker.vue\";\nimport MoneyInput from \"@/modules/LiteCMS/Common/MoneyInput.vue\";\nimport StatefulConfirmationDialog from \"@/components/ConfirmationDialog/StatefulConfirmationDialog.vue\";\nimport { useConfirmationDialog } from \"@/components/ConfirmationDialog/StatefulConfirmationDialog.ts\";\nimport AutosizeTextarea from \"@/modules/LiteCMS/Common/AutosizeTextarea.vue\";\nimport CmsInputValidation from \"@/modules/LiteCMS/Common/CmsInputValidation.vue\";\nimport WithId from \"@/components/Containers/WithId.vue\";\nimport { optionalNumbering } from \"@/utils/stringUtils.js\";\nimport ShowFirst from \"@/modules/LiteCMS/Common/ShowFirst.vue\";\nimport moment from \"moment-timezone\";\nimport DivWithId from \"@/components/Containers/DivWithId.vue\";\nimport { latest } from \"@/utils/dateUtils.ts\";\nimport NumberInput from \"@/modules/LiteCMS/Common/NumberInput.vue\";\nimport SectionTitle from \"@/modules/LiteCMS/Common/SectionTitle.vue\";\nimport { ref, nextTick } from \"vue\";\n\nconst { metaStore, essentialStore, pricingStore, saveOnPricingPage } = useCmsIndexStore();\nconst confirmRemove = useConfirmationDialog().provide();\nconst { mobile } = useShared();\nconst packageListEl = ref();\n\nfunction addPackage() {\n  pricingStore.newPackage();\n  openAndGotoLastPackage();\n}\n\nfunction removePackage(event) {\n  confirmRemove.open();\n  confirmRemove.onConfirm(() => {\n    pricingStore.removePackage(event);\n    openAndGotoLastPackage();\n  });\n}\n\nfunction openAndGotoLastPackage() {\n  pricingStore.openLastPackage();\n  nextTick(() => packageListEl.value.at(-1)?.scrollIntoView());\n}\n</script>\n\n<style lang=\"scss\" scoped>\n@import 'app/assets/stylesheets/litecms';\n\n.two-col {\n  display: grid;\n  gap: $spacing-6;\n\n  @media (min-width: $breakpoint-lg) {\n    grid-template-columns: 1fr 1fr;\n  }\n\n  .number-range .number {\n    width: 100%;\n  }\n}\n\n.subtitle {\n  font-weight: $font-semibold;\n  margin-bottom: $spacing-3;\n\n  &.required::after {\n    font-size: $text-xs;\n    color: $brand-secondary;\n    content: \" *\";\n  }\n}\n\n.btn, .link {\n  margin-right: auto;\n}\n\n.link {\n  color: $brand-tertiary;\n}\n</style>","<template>\n  <div class=\"form\" v-if=\"model\">\n    <div class=\"date\">\n      <div class=\"form-label\" :class=\"{ required: requireDate }\">{{ dateLabel }}</div>\n      <DatePicker v-model=\"model.date\" :minDate=\"minDate\" :maxDate=\"maxDate\" />\n    </div>\n    <div class=\"time\">\n      <div class=\"form-label\" :class=\"{ required: requireTime }\">{{ timeLabel }}</div>\n      <TimeInputV2 v-model=\"model.time\" />\n    </div>\n    <slot />\n  </div>\n</template>\n\n<script setup>\nimport DatePicker from \"@/modules/LiteCMS/Common/DatePicker.vue\";\nimport TimeInputV2 from \"@/modules/LiteCMS/Common/TimeInputV2.vue\";\n\ndefineProps({\n  dateLabel: String,\n  timeLabel: String,\n  requireDate: Boolean,\n  requireTime: Boolean,\n  minDate: [Date, String],\n  maxDate: [Date, String],\n});\n\nconst model = defineModel(); // { date, time }\n</script>\n\n<style lang=\"scss\" scoped>\n@import 'app/assets/stylesheets/litecms';\n\n.form {\n  display: grid;\n  gap: $spacing-6;\n\n  @media (min-width: $breakpoint-lg) {\n    grid-template-columns: 1fr 1fr;\n  }\n}\n</style>\n","<template>\n  <div class=\"addons container\">\n    <BackButton @back=\"metaStore.back()\"/>\n    <ItineraryTitle editable/>\n\n    <PageBody :saveFn=\"saveOnAddonsPage\">\n\n      <div class=\"panel\" v-if=\"addonsStore.addons.length === 0\">\n        <div class=\"title\">Add-ons</div>\n\n        <div class=\"select\" role=\"button\" @click=\"addAddon()\">\n          <div class=\"heading\">Create an add-on</div>\n          <div class=\"text\">Offer optional add-ons for travelers to purchase, such as room upgrades, airport transfers, additional activities, etc.</div>\n        </div>\n\n        <div role=\"button\"\n             class=\"select\"\n             :class=\"{ highlight: addonsStore.skipAddon }\"\n             @click=\"addonsStore.skipAddon = true\">\n          <div class=\"heading\">Skip add-ons</div>\n          <div class=\"text\">No add-ons will be added to this itinerary</div>\n          <i v-if=\"addonsStore.skipAddon\" class=\"icon icon-check\" />\n        </div>\n\n        <CmsInputValidation :checker=\"() => addonsStore.addons.length > 0 || addonsStore.skipAddon\" top=\"0\"/>\n      </div>\n\n      <div class=\"panel\"\n           v-else\n           ref=\"addonListEl\"\n           v-for=\"(addon, i) in addonsStore.addons\"\n           :set=\"isLast = i >= (addonsStore.addons.length - 1)\"\n      >\n        <SectionTitle :text=\"`Add-on ${optionalNumbering(i + 1, addonsStore.addons.length > 1)}`\"\n                      :toggleable=\"!metaStore.validating\" :toggled=\"addon.show\" @toggle=\"addon.show = !addon.show\"/>\n\n        <template v-if=\"addon.show || metaStore.validating\">\n\n          <DivWithId v-slot=\"{ id }\">\n            <div class=\"form-label required\">Add-on title</div>\n            <AutosizeTextarea :id=\"id\" class=\"form-input\" v-model=\"addon.title\"/>\n            <CmsInputValidation :id=\"id\" :checker=\"() => addon.title\" top=\"0px\" basic/>\n          </DivWithId>\n\n          <DivWithId v-slot=\"{ id }\">\n            <div class=\"form-label required\">Description</div>\n            <AutosizeTextarea :id=\"id\" rows=\"8\" class=\"form-input\" v-model=\"addon.description\"/>\n            <CmsInputValidation :id=\"id\" :checker=\"() => addon.description\" top=\"0px\"/>\n          </DivWithId>\n\n          <DivWithId v-slot=\"{ id }\">\n            <div class=\"form-label\">day of add-on (optional)</div>\n            <SelectInput :id=\"id\" :options=\"addonsStore.itineraryDays\" v-model=\"addon.day\" @change=\"autofillAddonDates(addon)\"/>\n            <CmsInputValidation\n              :id=\"id\" basic\n              :checker=\"() => datetime(addon.start_at) || datetime(addon.end_at) ? addon.day : true\"\n            />\n          </DivWithId>\n\n          <WithId v-slot=\"{ id }\">\n            <DateTimeCombinedInput :id=\"id\"\n                                   v-model=\"addon.start_at\"\n                                   :minDate=\"essentialStore.tripDates.startDate\"\n                                   :maxDate=\"essentialStore.tripDates.endDate\"\n                                   date-label=\"start date (optional)\"\n                                   time-label=\"start time (optional)\"/>\n            <ShowFirst>\n              <CmsInputValidation basic\n                               :target=\"`#${id} .date`\"\n                               :checker=\"() => addon.end_at.date ? addon.start_at.date : true\"\n                               top=\"-18px\"/>\n            </ShowFirst>\n          </WithId>\n\n          <WithId v-slot=\"{ id }\">\n            <DateTimeCombinedInput :id=\"id\"\n                                   v-model=\"addon.end_at\"\n                                   :minDate=\"latest(essentialStore.tripDates.startDate, addon.start_at.date)\"\n                                   :maxDate=\"essentialStore.tripDates.endDate\"\n                                   date-label=\"end date (optional)\"\n                                   time-label=\"end time (optional)\"/>\n            <ShowFirst>\n              <CmsInputValidation basic\n                               :target=\"`#${id} .date`\"\n                               :checker=\"() => addon.start_at.date ? addon.end_at.date : true\"\n                               top=\"-18px\"/>\n              <CmsInputValidation basic :id=\"id\"\n                               :checker=\"() => datetime(addon.end_at) >= datetime(addon.start_at)\"\n                               message=\"End date/time must be after the start date/time\"\n                               top=\"-18px\"/>\n            </ShowFirst>\n          </WithId>\n\n          <div class=\"two-col\">\n            <DivWithId v-slot=\"{ id }\">\n              <div class=\"form-label required\">price per person</div>\n              <div class=\"currency-money\">\n                <input type=\"text\" class=\"form-input currency\" v-model=\"pricingStore.currency\" disabled>\n                <MoneyInput :id=\"id\" class=\"money\" :exponent=\"pricingStore.currencyInfo.exponent\" v-model=\"addon.price_cents\"/>\n              </div>\n              <CmsInputValidation :id=\"id\" :checker=\"() => addon.price_cents\" basic/>\n            </DivWithId>\n          </div>\n\n          <div class=\"two-col\">\n            <DivWithId v-slot=\"{ id }\">\n              <div class=\"form-label required\">maximum spots allowed</div>\n              <input\n                :id=\"id\"\n                type=\"number\"\n                class=\"form-input number\"\n                v-model=\"addon.max_guest_count\"\n                :min=\"1\"\n                :max=\"essentialStore.groupMax\"\n                required\n              />\n              <ShowFirst>\n                <CmsInputValidation :id=\"id\" :checker=\"() => addon.max_guest_count\"/>\n                <CmsInputValidation :id=\"id\"\n                                 :checker=\"() => addon.max_guest_count >= 1 && addon.max_guest_count <= essentialStore.groupMax\"\n                                 :message=\"`Maximum spots should be between 1 and ${essentialStore.groupMax}`\"/>\n              </ShowFirst>\n            </DivWithId>\n          </div>\n\n          <ToggleOption v-model=\"addon.allowCancellation\">Allow travelers to cancel with refund</ToggleOption>\n\n          <WithId v-slot=\"{ id }\">\n            <DateTimeCombinedInput class=\"expansion\"\n                                   :id=\"id\"\n                                   v-if=\"addon.allowCancellation\"\n                                   v-model=\"addon.cancellation_due_at\"\n                                   date-label=\"cancellation due date\" require-date\n                                   time-label=\"cancellation due time\"\n            >\n              <CmsInputValidation :id=\"id\" :checker=\"() => addon.cancellation_due_at.date\" top=\"0\"/>\n              <div class=\"instruction\">Due date and time are in destination time zone - {{ essentialStore.destTimezone?.label }}</div>\n            </DateTimeCombinedInput>\n          </WithId>\n\n          <ToggleOption v-model=\"addon.allowTransfer\">Allow travelers to transfer spot to another traveler</ToggleOption>\n\n          <WithId v-slot=\"{ id }\">\n            <DateTimeCombinedInput class=\"expansion\"\n                                   :id=\"id\"\n                                   v-if=\"addon.allowTransfer\"\n                                   v-model=\"addon.transfer_due_at\"\n                                   date-label=\"transfer due date\" require-date\n                                   time-label=\"transfer due time\"\n            >\n              <CmsInputValidation :id=\"id\" :checker=\"() => addon.transfer_due_at.date\" top=\"0\"/>\n              <div class=\"instruction\">Due date and time are in destination time zone - {{ essentialStore.destTimezone?.label }}</div>\n            </DateTimeCombinedInput>\n          </WithId>\n\n          <ImageSelector collapsed v-model=\"addon.draft_media\" :max=\"1\" :apiQuery=\"{ addon_id: addon.id }\"/>\n\n          <div class=\"line\"></div>\n          <button class=\"link\" @click=\"removeAddon(addon)\">Remove add-on</button>\n          <Button v-if=\"isLast\" class=\"btn\" @click=\"addAddon()\">Add another add-on</Button>\n        </template>\n      </div>\n    </PageBody>\n  </div>\n\n  <StatefulConfirmationDialog\n    title=\"Are you sure you want to remove this add-on?\"\n    description=\"Once you remove it, you cannot undo it.\"\n    confirm=\"Remove\"\n    cancel=\"Back\"\n  />\n</template>\n\n<script setup>\nimport BackButton from \"@/modules/LiteCMS/Common/BackButton.vue\";\nimport PageBody from \"@/modules/LiteCMS/Common/PageBody.vue\";\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore.ts\";\nimport ItineraryTitle from \"@/modules/LiteCMS/Common/ItineraryTitle.vue\";\nimport { Button } from \"@/components/Theme/index.js\";\nimport StatefulConfirmationDialog from \"@/components/ConfirmationDialog/StatefulConfirmationDialog.vue\";\nimport { useConfirmationDialog } from \"@/components/ConfirmationDialog/StatefulConfirmationDialog.ts\";\nimport AutosizeTextarea from \"@/modules/LiteCMS/Common/AutosizeTextarea.vue\";\nimport SelectInput from \"@/modules/LiteCMS/Common/SelectInput.vue\";\nimport MoneyInput from \"@/modules/LiteCMS/Common/MoneyInput.vue\";\nimport ToggleOption from \"@/modules/LiteCMS/Common/ToggleOption.vue\";\nimport ImageSelector from \"@/modules/LiteCMS/Common/AddImages/ImageSelector.vue\";\nimport DateTimeCombinedInput from \"@/modules/LiteCMS/Common/DateTimeCombinedInput.vue\";\nimport { optionalNumbering } from \"@/utils/stringUtils.js\";\nimport CmsInputValidation from \"@/modules/LiteCMS/Common/CmsInputValidation.vue\";\nimport WithId from \"@/components/Containers/WithId.vue\";\nimport ShowFirst from \"@/modules/LiteCMS/Common/ShowFirst.vue\";\nimport { datetime, latest, ymd } from \"@/utils/dateUtils.ts\";\nimport DivWithId from \"@/components/Containers/DivWithId.vue\";\nimport moment from \"moment-timezone\";\nimport SectionTitle from \"@/modules/LiteCMS/Common/SectionTitle.vue\";\nimport { ref, nextTick } from \"vue\";\n\nconst { metaStore, essentialStore, itineraryStore, addonsStore, pricingStore, saveOnAddonsPage } = useCmsIndexStore();\nconst confirmRemove = useConfirmationDialog().provide();\nconst addonListEl = ref();\n\nfunction addAddon() {\n  addonsStore.newAddon();\n  openAndGotoLastAddon();\n}\n\nfunction removeAddon(addon) {\n  confirmRemove.open();\n  confirmRemove.onConfirm(() => {\n    addonsStore.removeAddon(addon);\n    openAndGotoLastAddon();\n  });\n}\n\nfunction openAndGotoLastAddon() {\n  addonsStore.openLastAddon();\n  nextTick(() => addonListEl.value.at(-1)?.scrollIntoView());\n}\n\nfunction autofillAddonDates(addon) {\n  const date = itineraryStore.itineraryDays.find(d => d.day === addon.day)?.date;\n  if (date && !addon.start_at.date && !addon.end_at.date) {\n    const m = moment(date, 'MMM D, YYYY');\n    addon.start_at.date = addon.end_at.date = ymd(m);\n  }\n}\n</script>\n\n<style lang=\"scss\" scoped>\n@import 'app/assets/stylesheets/litecms';\n\n.select {\n  border: 1px solid $gray-lighter;\n  border-radius: $rounded;\n  padding: $spacing-4;\n  @include flex-column($spacing-2);\n  cursor: pointer;\n  position: relative;\n\n  &.highlight {\n    border-color: $brand-tertiary;\n  }\n\n  .heading {\n    font-weight: $font-semibold;\n  }\n\n  .text {\n    color: $gray;\n  }\n\n  .icon-check {\n    position: absolute;\n    top: $spacing-4;\n    right: $spacing-4;\n    padding: $spacing-1;\n    color: $brand-tertiary;\n    line-height: 1;\n  }\n}\n\n.btn, .link {\n  margin-right: auto;\n}\n\n.link {\n  color: $brand-tertiary;\n}\n\n.two-col {\n  display: grid;\n  gap: $spacing-6;\n\n  @media (min-width: $breakpoint-lg) {\n    grid-template-columns: 1fr 1fr;\n  }\n}\n\n.expansion {\n  margin-top: -$spacing-3;\n  row-gap: $spacing-3 / 2;\n\n  @include mobile {\n    row-gap: $spacing-3;\n  }\n\n  .instruction {\n    color: $gray;\n    grid-column: 1/-1;\n  }\n}\n</style>\n","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createStaticVNode as _createStaticVNode } from \"vue\"\n\nconst _hoisted_1 = {\n  xmlns: \"http://www.w3.org/2000/svg\",\n  fill: \"none\",\n  viewBox: \"0 0 24 24\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createStaticVNode(\"<g stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\" stroke-width=\\\"1.5\\\" filter=\\\"url(#a)\\\"><path fill=\\\"#fff\\\" stroke=\\\"#E6E6E6\\\" d=\\\"M12 23.25C5.787 23.25.75 18.213.75 12S5.787.75 12 .75 23.25 5.787 23.25 12 18.213 23.25 12 23.25Z\\\"></path><path stroke=\\\"#8C8C8C\\\" d=\\\"m15 17.25-7.256-4.617a.751.751 0 0 1 0-1.266L15 6.75\\\"></path></g><defs><filter id=\\\"a\\\" width=\\\"36\\\" height=\\\"36\\\" x=\\\"-6\\\" y=\\\"-2\\\" color-interpolation-filters=\\\"sRGB\\\" filterUnits=\\\"userSpaceOnUse\\\"><feFlood flood-opacity=\\\"0\\\" result=\\\"BackgroundImageFix\\\"></feFlood><feColorMatrix in=\\\"SourceAlpha\\\" result=\\\"hardAlpha\\\" values=\\\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0\\\"></feColorMatrix><feOffset dy=\\\"4\\\"></feOffset><feGaussianBlur stdDeviation=\\\"3\\\"></feGaussianBlur><feComposite in2=\\\"hardAlpha\\\" operator=\\\"out\\\"></feComposite><feColorMatrix values=\\\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0\\\"></feColorMatrix><feBlend in2=\\\"BackgroundImageFix\\\" result=\\\"effect1_dropShadow_7857_25996\\\"></feBlend><feBlend in=\\\"SourceGraphic\\\" in2=\\\"effect1_dropShadow_7857_25996\\\" result=\\\"shape\\\"></feBlend></filter></defs>\", 2)\n  ])))\n}\nexport default { render: render }","<template>\n  <div v-if=\"timeline.length > 0\" class=\"timeline-container\">\n    <button v-if=\"mobile && !arrivedState.left\" @click=\"scrollLeft()\" class=\"left\"><ArrowLeft/></button>\n    <button v-if=\"mobile && !arrivedState.right\" @click=\"scrollRight()\" class=\"right\"><ArrowLeft/></button>\n\n    <div ref=\"rootEl\" class=\"timeline\" :class=\"`size-${timeline.length}`\">\n      <div v-for=\"([label, date, dateLabel]) in timeline\"\n           class=\"segment\" :class=\"{ empty: !date }\"\n      >\n        <div class=\"bar\">{{ date ? label : '?' }}</div>\n\n        <template v-if=\"date\">\n          <div class=\"date\">{{ absoluteDate(date) }}</div>\n          <div class=\"time\">{{ absoluteTime(date) }}</div>\n          <div class=\"rel\">{{ dateLabel ?? diffDays(date) }}</div>\n        </template>\n      </div>\n    </div>\n  </div>\n</template>\n\n<script setup>\nimport { computed, ref } from \"vue\";\nimport moment from \"moment-timezone\";\nimport { useShared } from \"@/helpers/vueHelpers.js\";\nimport ArrowLeft from \"app/assets/images/operatorDashboard/circle-left.svg?component\";\nimport { useScroll } from \"@vueuse/core\";\n\nconst rootEl = ref(null);\nconst { t, mobile } = useShared();\nconst { x, arrivedState } = useScroll(rootEl, { behavior: 'smooth' });\n\nconst props = defineProps({\n  t1: Array,\n  t2: Array,\n  t3: Array,\n  last: Array,\n  timezone: String,\n});\n\nconst timeline = computed(() => [props.t1, props.t2, props.t3, props.last].filter(t => t && Array.isArray(t)));\n\nfunction absoluteDate(date) {\n  return moment(date).format('MMM D, YYYY');\n}\n\nfunction absoluteTime(date) {\n  const offset = moment.tz(date, props.timezone).utcOffset() / 60;\n  const sign = offset >= 0 ? '+' : '';\n  return `11:59 PM (GMT ${sign}${offset})`;\n}\n\nfunction diffDays(date) {\n  const days = moment(props.last[1]).diff(date, 'days');\n  return t('days_before', days);\n}\n\nfunction scrollLeft() {\n  const width = rootEl.value.querySelector('.segment').clientWidth;\n  x.value -= width;\n}\n\nfunction scrollRight() {\n  const width = rootEl.value.querySelector('.segment').clientWidth;\n  x.value += width;\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.timeline-container {\n  grid-column: 1/-1;\n  display: grid;\n  position: relative;\n}\n\n.timeline {\n  display: flex;\n  width: 100%;\n  gap: 2px;\n}\n\n.segment {\n  flex: 1;\n  @include flex-column;\n  align-items: flex-end;\n  font-size: 14px;\n  line-height: 16px;\n  font-weight: 500;\n  gap: 6px;\n\n  &:first-child .bar {\n    border-radius: 5px 0 0 5px;\n  }\n\n  &:last-child .bar {\n    border-radius: 0 5px 5px 0;\n  }\n\n  .bar {\n    width: 100%;\n    height: 24px;\n    background-color: #E3F2FD;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n  }\n\n  &:last-child .bar {\n    background-color: #FBE6EB;\n  }\n\n  &.empty .bar {\n    background-color: $grey-25;\n  }\n\n  .date, .time {\n    font-weight: 600;\n  }\n\n  .rel {\n    color: $gray;\n  }\n}\n\n.left, .right {\n  display: flex;\n  position: absolute;\n  color: #8C8C8C;\n\n  svg {\n    height: 24px;\n  }\n}\n\n.left {\n  left: 0;\n  padding-right: 12px;\n  background: linear-gradient(90deg, #FFF 47.79%, rgba(255, 255, 255, 0.00) 100%);\n}\n\n.right {\n  right: 0;\n  padding-left: 12px;\n  background: linear-gradient(270deg, #FFF 47.79%, rgba(255, 255, 255, 0.00) 100%);\n\n  svg {\n    transform: rotate(180deg);\n  }\n}\n\n@include mobile('.timeline.size-3', '.timeline.size-4') {\n  @include hide-scrollbar;\n  overflow-x: auto;\n  scroll-snap-type: x mandatory;\n\n  .segment {\n    min-width: 56vw;\n    scroll-snap-align: start;\n  }\n}\n</style>\n\n<i18n lang=\"yaml\">\nen:\n  days_before: '{count} day before | {count} days before'\n</i18n>","<template>\n  <div class=\"form-input\">\n    <input type=\"number\" v-bind=\"$attrs\" v-model=\"model\" min=\"0\" max=\"100\">\n    <span>%</span>\n  </div>\n</template>\n\n<script setup>\nconst model = defineModel();\n</script>\n\n<style lang=\"scss\" scoped>\n@import 'app/assets/stylesheets/litecms';\n\n.form-input {\n  padding: 0 20px 0 0;\n  display: flex;\n  align-items: center;\n  overflow: hidden;\n\n  input {\n    flex: 1;\n    border: none;\n    padding: calc(#{$spacing-3} - 1px) $spacing-2 calc(#{$spacing-3} - 1px) calc(#{$spacing-5} - 1px);\n  }\n}\n</style>","<template>\n  <div class=\"deadlines\">\n    <div v-for=\"(ddl, i) in cancellation_policy.cancellation_fees_deadlines\" class=\"deadline\">\n      <header>\n        <div class=\"subtitle\">Deadline #{{ i + 1 }}</div>\n        <button class=\"delete\"\n                v-if=\"cancellation_policy.cancellation_fees_deadlines.length > 1\"\n                @click=\"cancellation_policy.cancellation_fees_deadlines.splice(i, 1)\">\n          <DeleteIcon width=\"16\"/>\n        </button>\n      </header>\n\n      <DivWithId v-slot=\"{ id }\">\n        <div class=\"form-label required\">last day for balance refund</div>\n        <DatePicker :id=\"id\" v-model=\"ddl.due_at\" :minDate=\"ddlMinDate(i)\" :maxDate=\"essentialStore.dayBeforeTrip\" />\n        <div v-if=\"ddl.due_at\" class=\"instruction-text\">{{ dateText(ddl.due_at) }}</div>\n        <CmsInputValidation :id=\"id\" :checker=\"() => ddl.due_at\" basic />\n      </DivWithId>\n\n      <DivWithId v-slot=\"{ id }\">\n        <div class=\"form-label required\">select an option</div>\n        <SelectInput :id=\"id\" v-model=\"ddl.option\" :options=\"options\" @change=\"onChangeOption(ddl)\"/>\n        <CmsInputValidation :id=\"id\" :checker=\"() => ddl.option\" basic />\n      </DivWithId>\n\n      <DivWithId v-slot=\"{ id }\" v-if=\"ddl.option === 'cancellation_fee'\">\n        <div class=\"form-label required\">cancellation fee</div>\n        <div class=\"currency\">\n          <MoneyInput :id=\"id\" v-if=\"ddl.fee_type === 'fixed'\" v-model=\"ddl.fee\" :exponent=\"0\" />\n          <input :id=\"id\" v-if=\"ddl.fee_type === 'percentage'\" v-model=\"ddl.fee\" type=\"number\" class=\"form-input\" max=\"100\">\n          <SelectInput v-model=\"ddl.fee_type\" :options=\"feeOptions\" required @change=\"onChangeFeeOption(ddl)\"/>\n        </div>\n        <ShowFirst>\n          <CmsInputValidation :id=\"id\" :checker=\"() => ddl.fee\" basic />\n          <CmsInputValidation :id=\"id\" :checker=\"() => ddl.fee_type\" basic />\n          <CmsInputValidation basic :id=\"id\"\n                           v-if=\"ddl.fee_type === 'percentage'\"\n                           :checker=\"() => ddl.fee > 0 && ddl.fee < 100\"\n                           :message=\"`${ddl.fee}% is not allowed`\"/>\n          <div class=\"instruction-text\">{{ cancellationFeeText(ddl) }}</div>\n        </ShowFirst>\n      </DivWithId>\n\n      <DivWithId v-slot=\"{ id }\" v-if=\"ddl.option === 'partial_refund'\">\n        <div class=\"form-label required\">refund percentage</div>\n        <PercentageInput :id=\"id\" v-model=\"ddl.fee\" />\n        <ShowFirst>\n          <CmsInputValidation :id=\"id\" :checker=\"() => ddl.fee\" basic />\n          <CmsInputValidation basic :id=\"id\"\n                           v-if=\"ddl.fee_type === 'percentage'\"\n                           :checker=\"() => ddl.fee > 0 && ddl.fee < 100\"\n                           :message=\"`${ddl.fee}% is not allowed`\"/>\n          <div class=\"instruction-text\">{{ partialRefundText(ddl) }}</div>\n        </ShowFirst>\n      </DivWithId>\n\n    </div>\n  </div>\n\n  <button v-if=\"cancellation_policy.cancellation_fees_deadlines.length < 3\"\n          @click=\"policiesStore.addFeeDeadline()\"\n          class=\"add\">Add another deadline\n  </button>\n</template>\n\n<script setup>\nimport moment from \"moment-timezone\";\nimport { computed, onMounted } from \"vue\";\nimport { storeToRefs } from \"pinia\";\nimport DeleteIcon from 'app/assets/images/operatorDashboard/delete.svg?component';\nimport DivWithId from \"@/components/Containers/DivWithId.vue\";\nimport DatePicker from \"@/modules/LiteCMS/Common/DatePicker.vue\";\nimport SelectInput from \"@/modules/LiteCMS/Common/SelectInput.vue\";\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore.ts\";\nimport { useShared } from \"@/helpers/vueHelpers.js\";\nimport MoneyInput from \"@/modules/LiteCMS/Common/MoneyInput.vue\";\nimport PercentageInput from \"@/modules/LiteCMS/Policies/PercentageInput.vue\";\nimport CmsInputValidation from \"@/modules/LiteCMS/Common/CmsInputValidation.vue\";\nimport ShowFirst from \"@/modules/LiteCMS/Common/ShowFirst.vue\";\nimport { ymd } from \"@/utils/dateUtils.ts\";\n\nconst { t } = useShared();\nconst { essentialStore, pricingStore, policiesStore } = useCmsIndexStore();\nconst { cancellation_policy } = storeToRefs(policiesStore);\nconst options = [{ label: 'Cancellation fee', value: 'cancellation_fee' }, { label: 'Partial refund', value: 'partial_refund' }];\nconst feeOptions = computed(() => [{ label: pricingStore.currencyInfo.currency, value: 'fixed' }, { label: '%', value: 'percentage' }]);\n\nonMounted(() => {\n  if (cancellation_policy.value.cancellation_fees_deadlines.length === 0) {\n    policiesStore.addFeeDeadline();\n  }\n});\n\nfunction ddlMinDate(i) {\n  const prev = policiesStore.cancellation_policy.cancellation_fees_deadlines[i - 1]?.due_at;\n\n  return prev ? ymd(moment(prev).add(1, 'day')) : ymd(moment());\n}\n\nfunction onChangeOption(ddl) {\n  ddl.fee = null;\n  if (ddl.option === 'partial_refund') {\n    ddl.fee_type = 'percentage';\n  }\n}\n\nfunction onChangeFeeOption(ddl) {\n  ddl.fee = null;\n}\n\nfunction dateText(date) {\n  const days = moment(essentialStore.tripDates.startDate).diff(date, 'days');\n\n  return t('days_before', days);\n}\n\nfunction cancellationFeeText(ddl) {\n  const postfix = ddl.fee_type === 'percentage' ? '%' : ` ${pricingStore.currencyInfo.currency}`;\n\n  return ddl.fee ? `Traveler gets full refund, minus ${ddl.fee}${postfix}` : '';\n}\n\nfunction partialRefundText(ddl) {\n  return ddl.fee ? `Traveler gets ${ddl.fee}% of their balance refund` : '';\n}\n</script>\n\n<style lang=\"scss\" scoped>\n@import 'app/assets/stylesheets/litecms';\n\n.deadlines {\n  display: grid;\n  row-gap: 16px;\n}\n\n.deadline {\n  border-radius: 5px;\n  border: 1px solid $gray-lighter;\n  padding: 20px;\n  display: grid;\n  grid-template-columns: 1fr 1fr;\n  row-gap: 16px;\n  column-gap: 24px;\n\n  @include mobile {\n    grid-template-columns: 1fr;\n  }\n\n  header {\n    display: flex;\n    justify-content: space-between;\n    align-items: center;\n    grid-column: 1/-1;\n  }\n\n  .subtitle {\n    font-weight: 600;\n  }\n\n  .form-label {\n    color: $gray;\n    font-size: 12px;\n    font-weight: 700;\n    line-height: 14px;\n    text-transform: uppercase;\n  }\n}\n\n.add {\n  margin-right: auto;\n  color: $brand-tertiary;\n  font-size: 16px;\n  font-weight: 600;\n  line-height: 22px; /* 137.5% */\n}\n\n.delete {\n  padding: 8px;\n  border-radius: 5px;\n  background: $gray-light;\n  display: flex;\n  color: $black;\n}\n\n.currency {\n  display: flex;\n  gap: $spacing-3;\n\n  & > div:last-child {\n    width: 100%;\n    max-width: 110px;\n  }\n}\n</style>\n\n<i18n lang=\"yaml\">\nen:\n  days_before: '{count} day before the start of the trip | {count} days before the start of the trip'\n</i18n>","<template>\n  <TimelineBreakdown\n    :t1=\"dates[0]\"\n    :t2=\"dates[1]\"\n    :t3=\"dates[2]\"\n    :last=\"['No refund', tripStartsAt, 'Trip starts']\"\n    :timezone=\"timezone\"\n  />\n</template>\n\n<script setup>\nimport { computed } from \"vue\";\nimport TimelineBreakdown from \"@/modules/LiteCMS/Policies/TimelineBreakdown.vue\";\n\nconst props = defineProps({\n  deadlines: Array,\n  tripStartsAt: String,\n  timezone: String,\n});\n\nconst dates = computed(() => props.deadlines.map(ddl => [ddlLabelText(ddl), ddl.dueAt ?? ddl.due_at]));\n\nfunction ddlLabelText(ddl) {\n  if (ddl.option === 'cancellation_fee') {\n    return 'Refund minus fee';\n  }\n\n  if (ddl.option === 'partial_refund') {\n    return ddl.fee ? `${ddl.fee}% refund` : 'Partial refund';\n  }\n}\n</script>","<template>\n  <div class=\"option\">\n    <div class=\"subtitle\">Deposit</div>\n    <ToggleOption v-model=\"policiesStore.cancellation_policy.no_deposit_refund\">No deposit refund policy</ToggleOption>\n    <ToggleOption v-model=\"policiesStore.cancellation_policy.allow_deposit_refund\" :disabled=\"policiesStore.cancellation_policy.no_deposit_refund\">Allow refunds for deposit</ToggleOption>\n\n    <div v-if=\"policiesStore.cancellation_policy.allow_deposit_refund && !policiesStore.cancellation_policy.no_deposit_refund\" class=\"expansion\">\n      <TimelineBreakdown\n        :t1=\"['Full deposit refund', policiesStore.cancellation_policy.refund_due_at]\"\n        :last=\"['No deposit refund', essentialStore.tripDates.startDate, 'Trip starts']\"\n        :timezone=\"essentialStore.timezone\"\n      />\n\n      <DivWithId class=\"datepicker\" v-slot=\"{ id }\">\n        <div class=\"form-label required\">last day for deposit refund</div>\n        <DatePicker :id=\"id\" v-model=\"policiesStore.cancellation_policy.refund_due_at\" />\n        <CmsInputValidation :id=\"id\" :checker=\"() => policiesStore.cancellation_policy.refund_due_at\" />\n      </DivWithId>\n\n      <div class=\"explainer\" v-html=\"policiesStore.previews.deposit_policy\" v-if=\"!policiesStore.cancellation_policy.no_deposit_refund\"></div>\n    </div>\n\n    <div class=\"explainer\" v-else-if=\"!policiesStore.cancellation_policy.no_deposit_refund\">\n      <strong>Refunds for deposits</strong>\n      <div>We will hold your spot as soon as you put down your deposit. However, if you decide to cancel your trip, we will be unable to refund your deposit.</div>\n    </div>\n  </div>\n\n  <hr />\n\n  <div class=\"option\">\n    <div class=\"subtitle\">{{ remainingBalanceTitle }}</div>\n    <ToggleOption v-model=\"policiesStore.cancellation_policy.allow_remaining_refund\">Allow refunds for {{ remainingBalanceTitle.toLowerCase() }}</ToggleOption>\n    <ToggleOption v-model=\"policiesStore.cancellation_policy.allow_collect_cancellation_fee\">Set a cancellation fee/partial refund</ToggleOption>\n\n    <div v-if=\"policiesStore.cancellation_policy.allow_remaining_refund && !policiesStore.cancellation_policy.allow_collect_cancellation_fee\" class=\"expansion\">\n      <TimelineBreakdown\n        :t1=\"['Full balance refund', policiesStore.cancellation_policy.cancellation_due_at]\"\n        :last=\"['No refund', essentialStore.tripDates.startDate, 'Trip starts']\"\n        :timezone=\"essentialStore.timezone\"\n      />\n\n      <DivWithId class=\"datepicker\" v-slot=\"{ id }\">\n        <div class=\"form-label required\">last day for balance refund</div>\n        <DatePicker :id=\"id\" v-model=\"policiesStore.cancellation_policy.cancellation_due_at\" :maxDate=\"essentialStore.dayBeforeTrip\" />\n        <CmsInputValidation :id=\"id\" :checker=\"() => policiesStore.cancellation_policy.cancellation_due_at\" />\n      </DivWithId>\n    </div>\n\n    <div v-if=\"policiesStore.cancellation_policy.allow_collect_cancellation_fee\" class=\"expansion cancellation-fee\">\n      <PartialRefundTimeline\n        :tripStartsAt=\"essentialStore.tripDates.startDate\"\n        :deadlines=\"policiesStore.cancellation_policy.cancellation_fees_deadlines\"\n        :timezone=\"essentialStore.timezone\"\n      />\n      <div class=\"label\">Set a cancellation fee/partial refund</div>\n      <CancellationFeeDeadlines />\n    </div>\n\n    <div class=\"explainer\" v-html=\"policiesStore.previews.fully_paid_policy\"></div>\n  </div>\n\n  <hr />\n\n  <div class=\"option\">\n    <div class=\"subtitle\">Additional text</div>\n\n    <ToggleOption v-model=\"policiesStore.cancellation_policy.use_extra_text\">Add additional custom text to policy</ToggleOption>\n\n    <DivWithId v-slot=\"{ id }\" v-if=\"policiesStore.cancellation_policy.use_extra_text\" class=\"expansion custom-policy\">\n\n      <MarkdownEditor :id=\"id\"\n                      v-model=\"policiesStore.cancellation_policy.extra_text\"\n                      placeholder=\"Write your custom policy here\" />\n\n      <CmsInputValidation basic :id=\"id\" :checker=\"() => policiesStore.cancellation_policy.extra_text.length > 0\" top=\"-6px\" />\n    </DivWithId>\n  </div>\n\n  <hr />\n\n  <div class=\"option\">\n    <div class=\"subtitle\">Transferring spots</div>\n    <ToggleOption v-model=\"policiesStore.cancellation_policy.allow_spot_transfer\">\n      Allow transfer and refund including deposit\n      <i class=\"icon icon-information-circle\" @click=\"showTransferSpotExplainer = !showTransferSpotExplainer\"/>\n    </ToggleOption>\n\n    <div v-if=\"showTransferSpotExplainer\" class=\"explainer-text\">\n      Transferring a spot will allow a traveler to transfer their purchased spot to a new traveler and receive a full refund, including their deposit. The new traveler will have to make the purchase before the cancellation occurs.\n    </div>\n\n    <div v-if=\"policiesStore.cancellation_policy.allow_spot_transfer\" class=\"expansion\">\n      <DivWithId class=\"datepicker\" v-slot=\"{ id }\">\n        <div class=\"form-label required\">last day to transfer</div>\n        <DatePicker :id=\"id\" v-model=\"policiesStore.cancellation_policy.transfer_due_at\" />\n        <CmsInputValidation :id=\"id\" :checker=\"() => policiesStore.cancellation_policy.transfer_due_at\" />\n      </DivWithId>\n\n      <div class=\"explainer\" v-html=\"policiesStore.previews.transfer_spot_policy\"></div>\n    </div>\n  </div>\n</template>\n\n<script setup>\nimport { ref, watch, computed } from \"vue\";\nimport { watchDebounced } from \"@vueuse/core\";\nimport ToggleOption from \"@/modules/LiteCMS/Common/ToggleOption.vue\";\nimport DatePicker from \"@/modules/LiteCMS/Common/DatePicker.vue\";\nimport CmsInputValidation from \"@/modules/LiteCMS/Common/CmsInputValidation.vue\";\nimport DivWithId from \"@/components/Containers/DivWithId.vue\";\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore.ts\";\nimport TimelineBreakdown from \"@/modules/LiteCMS/Policies/TimelineBreakdown.vue\";\nimport CancellationFeeDeadlines from \"@/modules/LiteCMS/Policies/CancellationFeeDeadlines.vue\";\nimport PartialRefundTimeline from \"@/modules/LiteCMS/Policies/PartialRefundTimeline.vue\";\nimport MarkdownEditor from \"@/components/Milkdown/MarkdownEditor.vue\";\n\nconst { essentialStore, policiesStore } = useCmsIndexStore();\nconst showTransferSpotExplainer = ref(false);\n\nwatch(() => policiesStore.cancellation_policy.allow_remaining_refund, allowRefund => {\n  if (!allowRefund) policiesStore.cancellation_policy.allow_collect_cancellation_fee = false;\n});\n\nwatch(() => policiesStore.cancellation_policy.allow_collect_cancellation_fee, allowCancel => {\n  if (allowCancel) policiesStore.cancellation_policy.allow_remaining_refund = true;\n});\n\nwatchDebounced(() => policiesStore.cancellation_policy, () => policiesStore.updatePolicyPreviews(), { deep: true, immediate: true, debounce: 500 });\n\nconst remainingBalanceTitle = computed(() => {\n  return policiesStore.cancellation_policy.no_deposit_refund ? 'Paid amount' : 'Remaining balance';\n});\n\n</script>\n\n<style lang=\"scss\" scoped>\n@import 'app/assets/stylesheets/litecms';\n\n.subtitle {\n  font-weight: $font-semibold;\n}\n\n.option {\n  @include flex-column;\n  gap: $spacing-3\n}\n\n.explainer {\n  grid-column: 1/-1;\n  padding: $spacing-3 $spacing-5;\n  background-color: $gray-light;\n  border: 1px solid $gray-lighter;\n  border-radius: $rounded;\n  margin-top: -$spacing-1;\n\n  &:deep(p) {\n    margin: 0;\n  }\n}\n\n.explainer-text {\n  color: $gray;\n}\n\n.icon {\n  cursor: pointer;\n  color: $brand-tertiary;\n}\n\n.expansion {\n  display: grid;\n  row-gap: $spacing-4;\n  column-gap: $spacing-6;\n  @include desktop {\n    grid-template-columns: 1fr 1fr;\n  }\n\n  .timeline {\n    grid-column: 1/-1;\n  }\n\n  &.custom-policy, &.cancellation-fee {\n    row-gap: $spacing-3;\n    grid-template-columns: 1fr;\n\n    .label {\n      font-weight: 600;\n    }\n  }\n}\n\n.fee {\n  display: grid;\n  grid-template-columns: 1fr 110px;\n  column-gap: $spacing-3;\n\n  & > div:first-child {\n    grid-column: 1/-1;\n  }\n}\n\nhr {\n  width: 100%;\n  border-top: none;\n  border-bottom: 1px solid $gray-lighter;\n  margin: 0;\n}\n\n.additional_text {\n  white-space: pre-wrap;\n}\n</style>\n","<template>\n  <div class=\"meta\">\n    <div class=\"total\">{{ faqList.length }} questions in total</div>\n    <ExpandAllToggle :expanded=\"allExpaned\" @expand=\"expandAll\" @collapse=\"collapseAll\"/>\n  </div>\n\n  <div class=\"faqs\" ref=\"faqs\">\n    <DivWithId v-for=\"(item, i) in faqList\" :key=\"i\" class=\"faq\" :class=\"{ expand: item.expand }\" v-slot=\"{ id1, id2 }\">\n      <div class=\"heading\" role=\"button\" @click=\"item.expand = !item.expand\">\n        <div v-if=\"!item.expand || !item.editable\" class=\"question\">{{ item.title }}</div>\n\n        <div class=\"heading-edit\" v-else @click.stop>\n          <input :id=\"id1\" type=\"text\" class=\"form-input question-input\" v-model=\"item.title\">\n          <button class=\"delete-btn\" @click.stop=\"removeFaq(item)\">\n            <TrashIcon width=\"16\"/>\n          </button>\n        </div>\n\n        <i class=\"icon icon-arrow-down-1\"/>\n      </div>\n\n      <div v-if=\"item.expand\" class=\"faq-body\">\n        <AutosizeTextarea :id=\"id2\" v-if=\"item.editable\" v-model=\"item.description\" class=\"form-input\" rows=\"8\"/>\n        <div v-else v-html=\"item.description\"></div>\n      </div>\n\n      <ShowFirst v-if=\"item.expand && item.editable\">\n        <CmsInputValidation :id=\"id1\" :checker=\"() => item.title\" top=\"0px\" basic/>\n        <CmsInputValidation :id=\"id2\" :checker=\"() => item.description\" top=\"0px\" basic/>\n      </ShowFirst>\n    </DivWithId>\n  </div>\n\n  <Button class=\"btn\" @click=\"addNew()\">Add another question</Button>\n</template>\n\n<script setup>\nimport AutosizeTextarea from \"@/modules/LiteCMS/Common/AutosizeTextarea.vue\";\nimport TrashIcon from 'app/assets/images/common/trash.svg?component';\nimport ExpandAllToggle from \"@/modules/LiteCMS/Common/ExpandAllToggle.vue\";\nimport { computed, nextTick, onMounted, ref } from \"vue\";\nimport { Button } from \"@/components/Theme/index.js\";\nimport { last, remove } from 'lodash';\nimport CmsInputValidation from \"@/modules/LiteCMS/Common/CmsInputValidation.vue\";\nimport ShowFirst from \"@/modules/LiteCMS/Common/ShowFirst.vue\";\nimport DivWithId from \"@/components/Containers/DivWithId.vue\";\n\nconst faqs = ref();\nconst model = defineModel();\nconst faqList = computed(() => model.value.filter(x => !x.deleted));\nconst allExpaned = computed(() => model.value.every(x => x.expand));\nconst expandAll = () => model.value.forEach(x => x.expand = true);\nconst collapseAll = () => model.value.forEach(x => x.expand = false);\n\nonMounted(() => {\n  model.value.forEach(faq => faq.expand = false);\n});\n\nfunction addNew() {\n  model.value.push({ title: '', description: '', expand: true, editable: true });\n\n  nextTick(() => {\n    const lastFaq = last([...faqs.value.querySelectorAll('.faq')]);\n    lastFaq.querySelector('.question-input').focus();\n  });\n}\n\nfunction removeFaq(faq) {\n  if (faq.id) {\n    faq.deleted = true;\n    return;\n  }\n  remove(model.value, x => x === faq);\n}\n</script>\n\n<style lang=\"scss\" scoped>\n@import 'app/assets/stylesheets/litecms';\n\n.meta {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n\n  * {\n    color: $brand-tertiary;\n    font-weight: $font-semibold;\n  }\n\n  button {\n    display: flex;\n    align-items: center;\n  }\n\n  .total {\n    color: $brand-primary;\n  }\n}\n\n.faqs {\n  margin-top: -$spacing-4;\n}\n\n.faq {\n  @include flex-column;\n\n  border-bottom: 1px solid $gray-lighter;\n}\n\n.heading {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  gap: $spacing-6;\n  padding: $spacing-4 0;\n  cursor: pointer;\n\n  @include mobile {\n    gap: $spacing-3;\n  }\n\n  .question {\n    font-weight: $font-semibold;\n  }\n}\n\n.heading-edit {\n  flex: 1;\n  display: flex;\n  align-items: center;\n  gap: $spacing-6;\n\n  @include mobile {\n    gap: $spacing-3;\n  }\n}\n\n.icon-arrow-down-1 {\n  cursor: pointer;\n  transition: transform 100ms linear;\n}\n\n.expand {\n  .faq-body {\n    @include flex-column;\n    padding-bottom: $spacing-4;\n\n    &:deep(a) {\n      color: $brand-tertiary;\n    }\n  }\n\n  .icon-arrow-down-1 {\n    transform: rotate(180deg);\n  }\n}\n\n.delete-btn {\n  padding: $spacing-2;\n  background-color: $gray-light;\n  border-radius: $rounded;\n  display: flex;\n\n  :deep(svg path) {\n    stroke: #222;\n  }\n}\n\n.btn {\n  margin-right: auto;\n}\n</style>","<template>\n  <div class=\"policies container\">\n    <BackButton @back=\"metaStore.back()\"/>\n    <ItineraryTitle editable/>\n\n    <PageBody :saveFn=\"saveOnPoliciesPage\">\n      <div class=\"panel\">\n        <div class=\"title\">Passport at checkout</div>\n        <div class=\"passport-toggle\">\n          <ToggleOption v-model=\"policiesStore.passport_required\">Require passport information at checkout</ToggleOption>\n          <div class=\"text\">We collect passport information after checkout by default. If you prefer to collect it during checkout, please note that it may extend the booking process slightly.</div>\n        </div>\n      </div>\n\n      <div class=\"panel\">\n        <div class=\"title\">Cancellation policy</div>\n        <CancellationPolicySection />\n      </div>\n\n      <div class=\"panel\">\n        <div class=\"title\">Frequently asked questions</div>\n        <FaqSection v-model=\"policiesStore.faqs\" />\n      </div>\n    </PageBody>\n  </div>\n</template>\n\n<script setup>\nimport BackButton from \"@/modules/LiteCMS/Common/BackButton.vue\";\nimport PageBody from \"@/modules/LiteCMS/Common/PageBody.vue\";\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore.ts\";\nimport ItineraryTitle from \"@/modules/LiteCMS/Common/ItineraryTitle.vue\";\nimport CancellationPolicySection from \"@/modules/LiteCMS/Policies/CancellationPolicySection.vue\";\nimport FaqSection from \"@/modules/LiteCMS/Policies/FaqSection.vue\";\nimport ToggleOption from \"@/modules/LiteCMS/Common/ToggleOption.vue\";\n\nconst { metaStore, policiesStore, saveOnPoliciesPage } = useCmsIndexStore();\n</script>\n\n<style lang=\"scss\" scoped>\n@import 'app/assets/stylesheets/litecms';\n\n.passport-toggle {\n  @include flex-column($spacing-3);\n\n  .text {\n    color: $gray;\n  }\n}\n</style>\n","<template>\n  <div>\n    <div class=\"form-label required\">Coupon Code</div>\n\n    <WithId v-slot=\"{ id }\">\n      <AutosizeTextarea :id=\"id\"\n                        class=\"form-input\"\n                        v-model=\"model.code\"\n                        :prefix=\"model.is_early_bird ? 'EB' : ''\"\n                        :max=\"codeMaxLength\"\n      />\n      <CmsInputValidation basic :id=\"id\" :checker=\"() => model.code\" top=\"0px\"/>\n      <CmsInputValidation basic :id=\"id\" :checker=\"() => model.code.length >= codeMinLength\" top=\"0px\" :message=\"`Coupon code must be at least ${codeMinLength} characters`\"/>\n      <CmsInputValidation basic :id=\"id\" :checker=\"() => model.code.length <= codeMaxLength\" top=\"0px\" message=\"Coupon code characters exceeds limit\"/>\n    </WithId>\n\n    <div class=\"instruction-text\">\n      <template v-if=\"model.is_early_bird\">Early bird coupons will automatically apply at checkout. Discount applied will be deducted from your payout.</template>\n      {{ codeMaxLength - model.code.length }} characters remaining\n    </div>\n  </div>\n\n  <div class=\"two-col\">\n    <DivWithId v-slot=\"{ id }\">\n      <div class=\"form-label required\">discount</div>\n      <div class=\"discount\">\n        <MoneyInput :id=\"id\" v-if=\"discountType === 'amount'\" v-model=\"model.discount_amount_cents\" :exponent=\"pricingStore.currencyInfo.exponent\"/>\n        <input :id=\"id\" v-if=\"discountType === 'percent'\" v-model=\"model.discount_percentage\" type=\"number\" class=\"form-input\">\n        <SelectInput v-model=\"discountType\" :options=\"discountTypeOptions\" required />\n      </div>\n      <ShowFirst>\n        <CmsInputValidation basic :id=\"id\" :checker=\"() => discountType === 'amount' ? model.discount_amount_cents : model.discount_percentage\"/>\n        <CmsInputValidation basic :id=\"id\" v-if=\"discountType === 'percent'\"\n                         :checker=\"() => model.discount_percentage > 0 && model.discount_percentage < 100\"\n                         :message=\"`${model.discount_percentage}% is not allowed`\"/>\n      </ShowFirst>\n    </DivWithId>\n\n    <DivWithId v-slot=\"{ id }\">\n      <div class=\"form-label required\">maximum coupons allowed</div>\n      <SelectNumber :id=\"id\" v-model=\"model.max_usage\" required />\n      <CmsInputValidation :id=\"id\" :checker=\"() => model.max_usage\"/>\n    </DivWithId>\n  </div>\n\n  <div class=\"section\">\n    <div class=\"heading\">Validity</div>\n    <div class=\"text\">Validity is based on destination time zone - {{ essentialStore.destTimezone?.label }}</div>\n  </div>\n\n  <WithId v-slot=\"{ id }\">\n    <DateTimeCombinedInput v-model=\"model.validity_starts_at\" :id=\"id\"\n                           date-label=\"coupon start date\" require-date\n                           time-label=\"coupon start time\" require-time/>\n\n    <ShowFirst>\n      <CmsInputValidation basic :target=\"`#${id} .date`\" :checker=\"() => model.validity_starts_at.date\" top=\"-18px\"/>\n      <CmsInputValidation basic :target=\"`#${id} .time`\" :checker=\"() => model.validity_starts_at.time\" top=\"-18px\"/>\n    </ShowFirst>\n  </WithId>\n\n  <WithId v-slot=\"{ id }\">\n    <DateTimeCombinedInput v-model=\"model.validity_ends_at\" :id=\"id\"\n                           date-label=\"coupon end date\" require-date :minDate=\"model.validity_starts_at.date || new Date\"\n                           time-label=\"coupon end time\" require-time />\n    <ShowFirst>\n      <CmsInputValidation basic :target=\"`#${id} .date`\" :checker=\"() => model.validity_ends_at.date\" top=\"-18px\"/>\n      <CmsInputValidation basic :target=\"`#${id} .time`\" :checker=\"() => model.validity_ends_at.time\" top=\"-18px\"/>\n      <CmsInputValidation basic :id=\"id\" message=\"End date/time must be after the start date/time\" top=\"-18px\"\n                       :checker=\"() => datetime(model.validity_ends_at) >= datetime(model.validity_starts_at)\" />\n    </ShowFirst>\n  </WithId>\n\n  <button class=\"link\" @click=\"removeCoupon()\">Remove coupon code</button>\n\n  <Button v-if=\"showAddCoupon\" class=\"btn\" @click=\"marketingStore.addCoupon = true\">Add another coupon</Button>\n\n  <StatefulConfirmationDialog\n    title=\"Are you sure you want to remove this coupon?\"\n    description=\"Once you remove it, you cannot undo it.\"\n    confirm=\"Remove\"\n    cancel=\"Back\"\n  />\n</template>\n\n<script setup>\nimport SelectNumber from \"@/modules/LiteCMS/Common/SelectNumber.vue\";\nimport MoneyInput from \"@/modules/LiteCMS/Common/MoneyInput.vue\";\nimport SelectInput from \"@/modules/LiteCMS/Common/SelectInput.vue\";\nimport { Button } from \"@/components/Theme/index.js\";\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore.ts\";\nimport StatefulConfirmationDialog from \"@/components/ConfirmationDialog/StatefulConfirmationDialog.vue\";\nimport { useConfirmationDialog } from \"@/components/ConfirmationDialog/StatefulConfirmationDialog\";\nimport { computed, ref, watch } from \"vue\";\nimport { last } from 'lodash';\nimport DateTimeCombinedInput from \"@/modules/LiteCMS/Common/DateTimeCombinedInput.vue\";\nimport AutosizeTextarea from \"@/modules/LiteCMS/Common/AutosizeTextarea.vue\";\nimport CmsInputValidation from \"@/modules/LiteCMS/Common/CmsInputValidation.vue\";\nimport WithId from \"@/components/Containers/WithId.vue\";\nimport { datetime } from \"@/utils/dateUtils.ts\";\nimport ShowFirst from \"@/modules/LiteCMS/Common/ShowFirst.vue\";\nimport DivWithId from \"@/components/Containers/DivWithId.vue\";\n\nconst codeMinLength = 4;\nconst codeMaxLength = 25;\nconst model = defineModel();\nconst { essentialStore, marketingStore, pricingStore } = useCmsIndexStore();\nconst confirmRemove = useConfirmationDialog().provide();\nconst showAddCoupon = computed(() => !marketingStore.addCoupon && model.value === last(marketingStore.coupons));\nconst discountType = ref(model.value.discount_percentage ? 'percent' : 'amount');\nconst discountTypeOptions = computed(() => [\n  { value: 'amount', label: pricingStore.currency },\n  { value: 'percent', label: '%' },\n]);\n\nwatch(discountType, (type) => {\n  if (type === 'amount') model.value.discount_percentage = null;\n  if (type === 'percent') model.value.discount_amount_cents = 0;\n}, { immediate: true });\n\nfunction removeCoupon() {\n  confirmRemove.open();\n  confirmRemove.onConfirm(() => marketingStore.removeCoupon(model.value));\n}\n</script>\n\n<style lang=\"scss\" scoped>\n@import 'app/assets/stylesheets/litecms';\n\n.section {\n  display: grid;\n  gap: $spacing-3;\n}\n\n.heading {\n  font-weight: $font-semibold;\n}\n\n.text {\n  color: $gray;\n}\n\n.two-col {\n  display: grid;\n  gap: $spacing-6;\n\n  @media (min-width: $breakpoint-lg) {\n    grid-template-columns: 1fr 1fr;\n  }\n}\n\n.discount {\n  display: flex;\n  gap: $spacing-3;\n\n  & > div:last-child {\n    width: 100%;\n    max-width: 110px;\n  }\n}\n\n.btn, .link {\n  margin-right: auto;\n}\n\n.link {\n  color: $brand-tertiary;\n}\n</style>\n","<template>\n  <div class=\"text\">Please choose from your existing gallery or upload self-owned images. If uploading your own, remember to give credit where it's due.</div>\n\n  <div class=\"featured-image\">\n    <div class=\"cover-photo\">Cover photo</div>\n    <img v-if=\"metaStore.featuredImage?.image\" :src=\"metaStore.featuredImage.image.url\">\n    <img v-else-if=\"metaStore.featuredImage?.file\" :src=\"uploadImageUrl\">\n    <img v-else src=\"app/assets/images/common/placeholder.svg\">\n  </div>\n\n  <div class=\"container\">\n    <div class=\"container__tabs\">\n      <div class=\"tab\">\n        <button @click=\"tab = 'choose'\" :class=\"{ selected: tab === 'choose' }\">\n          <Radio :checked=\"tab === 'choose'\"/>\n          <span>Choose from existing gallery</span>\n        </button>\n      </div>\n      <div class=\"tab\">\n        <button @click=\"tab = 'upload'\" :class=\"{ selected: tab === 'upload' }\">\n          <Radio :checked=\"tab === 'upload'\"/>\n          <span>Upload new image</span>\n        </button>\n      </div>\n    </div>\n    <div ref=\"chooseContainer\" class=\"container__body choose\" :class=\"{ empty: metaStore.allImages.length === 0 }\" v-show=\"tab === 'choose'\">\n      <div class=\"image\"\n           :class=\"{ selected: metaStore.featuredImage?.id === item.id }\"\n           v-for=\"item in metaStore.allImages\"\n           @click=\"metaStore.featuredImage = item\">\n        <img :src=\"item.image.url\">\n      </div>\n      <div v-if=\"metaStore.allImages.length === 0\" class=\"no-images\">No images in gallery</div>\n    </div>\n    <div class=\"container__body upload\" v-show=\"tab === 'upload'\">\n      <div class=\"terms\">\n        <SquareCheck\n          class=\"check\"\n          :checked=\"metaStore.agreedUpload\"\n          @click=\"metaStore.agreedUpload = !metaStore.agreedUpload\"\n        />\n        <div class=\"required\">{{ t('terms') }}</div>\n        <div class=\"warning\" v-if=\"!metaStore.agreedUpload\">{{ t('accept') }}</div>\n      </div>\n      <ImageUploader :enabled=\"metaStore.agreedUpload\" :max=\"1\" @files=\"setUploadedImages\"/>\n    </div>\n  </div>\n\n  <ItineraryImage\n    v-if=\"metaStore.featuredImage?.file\"\n    :medium=\"metaStore.featuredImage\"\n    @remove=\"metaStore.featuredImage = null\"\n  />\n</template>\n\n<script setup>\nimport { computed, ref } from \"vue\";\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore.ts\";\nimport { Radio, SquareCheck } from \"@/components/Theme/index.js\";\nimport ImageUploader from \"@/modules/LiteCMS/Common/AddImages/ImageUploader.vue\";\nimport { useShared } from \"@/helpers/vueHelpers.js\";\nimport ItineraryImage from \"@/modules/LiteCMS/Common/AddImages/ItineraryImage.vue\";\nimport { useElementSize, useObjectUrl, watchDebounced, watchDeep } from \"@vueuse/core\";\nimport { pick } from 'lodash';\nimport { serialize } from 'object-to-formdata';\n\nconst { t, desktop } = useShared();\nconst { metaStore, queueFn } = useCmsIndexStore();\nconst chooseContainer = ref(null);\nconst { width } = useElementSize(chooseContainer);\n\nconst tab = ref('choose');\nconst uploadImageUrl = computed(() => metaStore.featuredImage.file ? useObjectUrl(metaStore.featuredImage.file).value : '');\n\nwatchDebounced(width, (width) => {\n  const height = width / 1.5;\n  chooseContainer.value.style.minHeight = desktop.value ? `${Math.min(280, height)}px` : 'auto';\n  chooseContainer.value.style.maxHeight = desktop.value ? `${height}px` : `${width * 1.8}px`;\n}, { debounce: 100 });\n\nwatchDeep(() => metaStore.featuredImage, (image) => {\n  const payload = image.id\n    ? { media: [{ id: image.id }]}\n    : { media: [pick(metaStore.featuredImage, ['file', 'title', 'description', 'author_name', 'author_url', 'platform', 'platform_url'])] };\n\n  queueFn(() => metaStore.apiSave(serialize(payload), 'images', '', { entity_type: 'draft_itinerary' }), 'post:update-featured-image');\n});\n\nfunction setUploadedImages(images) {\n  metaStore.featuredImage = {\n    id: null,\n    file: images[0],\n    title: '',\n    description: '',\n    author_name: '',\n    author_url: '',\n    platform: '',\n    platform_url: '',\n  };\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.text, .no-images {\n  color: $gray;\n}\n\n.featured-image {\n  position: relative;\n\n  img {\n    width: 100%;\n    border-radius: 5px;\n  }\n\n  .cover-photo {\n    position: absolute;\n    top: 16px;\n    left: 16px;\n    font-weight: 600;\n    padding: 8px 16px;\n    background-color: rgba(255, 255, 255, 0.6);\n    backdrop-filter: blur(40px);\n    border-radius: 5px;\n  }\n}\n\n.container {\n  border-radius: $rounded;\n  margin-bottom: $spacing-2;\n\n  @include desktop {\n    border: 1px solid $gray-lighter;\n  }\n}\n\n.container__tabs {\n  display: grid;\n\n  @include desktop {\n    border-bottom: 1px solid $gray-lighter;\n    grid-template-columns: 1fr 1fr;\n  }\n\n  .tab {\n    display: flex;\n\n    &:first-child {\n      @include desktop {\n        border-right: 1px solid $gray-lighter;\n      }\n    }\n\n    button {\n      flex: 1;\n      display: flex;\n      align-items: center;\n      gap: $spacing-3;\n      padding: $spacing-3 $spacing-1 calc($spacing-3 + 1px);\n      margin: 0 $spacing-2 -1px;\n      font-weight: $font-medium;\n      color: initial;\n\n      @include mobile {\n        margin-left: 0;\n        margin-right: 0;\n        padding-left: 0;\n        padding-right: 0;\n      }\n\n      &.selected {\n        color: $brand-tertiary;\n        border-bottom: 1px solid $brand-tertiary;\n      }\n    }\n  }\n}\n\n.container__body {\n  padding: $spacing-4;\n\n  @include mobile {\n    &.choose {\n      padding: $spacing-1 0 0;\n    }\n    &.upload {\n      padding: $spacing-4 0 0;\n    }\n  }\n\n  &.choose {\n    display: grid;\n    grid-template-columns: repeat(4, 1fr);\n    align-items: start;\n    gap: 8px;\n    overflow-y: auto;\n\n    @include desktop {\n      padding: $spacing-3;\n    }\n\n    @include mobile {\n      grid-template-columns: repeat(2, 1fr);\n      padding-right: 24px;\n      margin-right: -24px;\n    }\n\n    &.empty {\n      grid-template-columns: 1fr;\n\n      @include desktop {\n        place-items: center;\n      }\n    }\n\n    .image {\n      display: flex;\n      position: relative;\n      cursor: pointer;\n      aspect-ratio: 1;\n      border: 4px solid transparent;\n    }\n\n    .image.selected {\n      border-radius: 5px;\n      border: 4px solid $brand-tertiary;\n      img {\n        border-radius: 0;\n      }\n    }\n\n    img {\n      position: absolute;\n      object-fit: cover;\n      width: 100%;\n      height: 100%;\n      border-radius: 5px;\n    }\n  }\n\n  .terms {\n    display: grid;\n    grid-template-columns: auto 1fr;\n    gap: $spacing-3;\n    margin-bottom: $spacing-4;\n\n    & > div:nth-child(2),\n    & > div:nth-child(3) {\n      grid-column: 2;\n    }\n\n    .check {\n      margin-top: $spacing-1;\n    }\n\n    .required::after {\n      content: ' *';\n      color: $brand-secondary;\n    }\n\n    .warning {\n      color: $brand-secondary;\n    }\n  }\n}\n</style>\n\n<i18n lang=\"yaml\">\nen:\n  terms: I confirm ownership of the images and will provide proper credit. I understand and accept responsibility for any copyright infringement.\n  accept: Please accept the terms and agreement before you continue.\n</i18n>\n","<template>\n  <div class=\"marketing container\">\n    <BackButton @back=\"metaStore.back()\"/>\n    <ItineraryTitle editable/>\n\n    <PageBody :saveFn=\"saveOnMarketingPage\">\n      <div class=\"panel\" v-for=\"(_, i) in marketingStore.coupons\">\n        <div class=\"title\">\n          Coupon Code {{ optionalNumbering(i+1, marketingStore.addCoupon || marketingStore.coupons.length > 1) }}\n        </div>\n        <CouponCodeForm v-model=\"marketingStore.coupons[i]\"/>\n      </div>\n\n      <div class=\"panel\" v-if=\"marketingStore.addCoupon\">\n        <div class=\"title\">\n          Coupon Code {{ optionalNumbering(marketingStore.coupons.length + 1, marketingStore.coupons.length > 0) }}\n        </div>\n\n        <div class=\"select\" role=\"button\" @click=\"marketingStore.createStandardCoupon()\">\n          <div class=\"heading\">Standard discount</div>\n          <div class=\"text\">Offer a discount applicable within your specified timeframe</div>\n        </div>\n\n        <div class=\"select\" role=\"button\" @click=\"marketingStore.createEarlyBirdCoupon()\">\n          <div class=\"heading\">Early bird discount</div>\n          <div class=\"text\">Offer an early bird discount to automatically apply to your trip</div>\n        </div>\n\n\n        <button class=\"link\"\n                v-if=\"marketingStore.coupons.length > 0\"\n                @click=\"marketingStore.addCoupon = false\"\n        >Remove coupon code</button>\n      </div>\n\n      <DivWithId class=\"panel\" v-slot=\"{ id }\">\n        <div class=\"title\">Trip visibility</div>\n        <div class=\"visibility-selector\" :id=\"id\">\n          <div class=\"select\" role=\"button\" @click=\"marketingStore.visibility = 'listed'\">\n            <Radio class=\"radio\" :checked=\"marketingStore.visibility === 'listed'\" />\n            <div class=\"heading\">Public</div>\n            <div class=\"text\">The trip will be searchable on both Google and our explore page</div>\n          </div>\n\n          <div class=\"select\" role=\"button\" @click=\"marketingStore.visibility = 'unlisted'\">\n            <Radio class=\"radio\" :checked=\"marketingStore.visibility === 'unlisted'\" />\n            <div class=\"heading\">Private</div>\n            <div class=\"text\">A private link will be provided to you to share with your network</div>\n          </div>\n        </div>\n\n        <CmsInputValidation :id=\"id\" :checker=\"() => marketingStore.visibility\" top=\"0px\" />\n      </DivWithId>\n\n      <div class=\"panel\">\n        <div class=\"title\">Cover image</div>\n        <FeatureImageForm />\n      </div>\n    </PageBody>\n  </div>\n</template>\n\n<script setup>\nimport BackButton from \"@/modules/LiteCMS/Common/BackButton.vue\";\nimport PageBody from \"@/modules/LiteCMS/Common/PageBody.vue\";\nimport { useCmsIndexStore } from \"@/stores/liteCMS/cmsIndexStore.ts\";\nimport ItineraryTitle from \"@/modules/LiteCMS/Common/ItineraryTitle.vue\";\nimport CouponCodeForm from \"@/modules/LiteCMS/Marketing/CouponCodeForm.vue\";\nimport { Radio } from \"@/components/Theme/index.js\";\nimport { optionalNumbering } from \"@/utils/stringUtils.js\";\nimport CmsInputValidation from \"@/modules/LiteCMS/Common/CmsInputValidation.vue\";\nimport DivWithId from \"@/components/Containers/DivWithId.vue\";\nimport FeatureImageForm from \"@/modules/LiteCMS/Marketing/FeatureImageForm.vue\";\n\nconst { metaStore, marketingStore, saveOnMarketingPage } = useCmsIndexStore();\n</script>\n\n<style lang=\"scss\" scoped>\n@import 'app/assets/stylesheets/litecms';\n\n.link {\n  margin-right: auto;\n  color: $brand-tertiary;\n}\n\n.select {\n  border: 1px solid $gray-lighter;\n  border-radius: $rounded;\n  padding: $spacing-4;\n  @include flex-column($spacing-2);\n  cursor: pointer;\n\n  .heading {\n    font-weight: $font-semibold;\n  }\n\n  .text {\n    color: $gray;\n  }\n}\n\n.visibility-selector {\n  display: grid;\n  gap: $spacing-6;\n\n  @include desktop {\n    grid-template-columns: 1fr 1fr;\n  }\n\n  .select {\n    border: 1px solid $gray-lighter;\n    border-radius: $rounded;\n    padding: $spacing-4;\n    gap: $spacing-3;\n    cursor: pointer;\n    display: grid;\n    grid-template-columns: auto 1fr;\n\n    & > div:nth-child(2), & > div:nth-child(3) {\n      grid-column: 2;\n    }\n  }\n\n  .radio {\n    margin: auto 0;\n  }\n\n  .heading {\n    font-weight: $font-semibold;\n  }\n\n  .text {\n    color: $gray;\n  }\n}\n</style>","import { isFeatureEnabled } from \"@/utils/featureUtils.js\";\nimport PlanTrip from \"@/modules/LiteCMS/PlanTrip/PlanTrip.vue\";\nimport Dashboard from \"@/modules/LiteCMS/Dashboard.vue\";\nimport HeroDashboard from \"@/modules/LiteCMS/HeroDashboard.vue\";\nimport Essentials from \"@/modules/LiteCMS/Essentials.vue\";\nimport Accommodation from \"@/modules/LiteCMS/Accommodation.vue\";\nimport Itinerary from \"@/modules/LiteCMS/Itinerary.vue\";\nimport Pricing from \"@/modules/LiteCMS/Pricing.vue\";\nimport Addons from \"@/modules/LiteCMS/Addons.vue\";\nimport Policies from \"@/modules/LiteCMS/Policies.vue\";\nimport Marketing from \"@/modules/LiteCMS/Marketing.vue\";\n\nexport default (role) => isFeatureEnabled('lite_cms') ? [\n  {\n    path: `/:lang/${role}/draft-itinerary/dashboard`,\n    component: role === 'operators' ? Dashboard : HeroDashboard,\n    name: 'cms_dashboard',\n  },\n  {\n    path: `/:lang/${role}/draft-itinerary/plan`,\n    component: PlanTrip,\n    name: 'cms_plan',\n  },\n  {\n    path: `/:lang/${role}/draft-itinerary/essentials`,\n    component: Essentials,\n    name: 'cms_essentials',\n  },\n  {\n    path: `/:lang/${role}/draft-itinerary/accommodation`,\n    component: Accommodation,\n    name: 'cms_accommodation',\n  },\n  {\n    path: `/:lang/${role}/draft-itinerary/itinerary`,\n    component: Itinerary,\n    name: 'cms_itinerary',\n  },\n  {\n    path: `/:lang/${role}/draft-itinerary/pricing`,\n    component: Pricing,\n    name: 'cms_pricing',\n  },\n  {\n    path: `/:lang/${role}/draft-itinerary/addons`,\n    component: Addons,\n    name: 'cms_addons',\n  },\n  {\n    path: `/:lang/${role}/draft-itinerary/policies`,\n    component: Policies,\n    name: 'cms_policies',\n  },\n  {\n    path: `/:lang/${role}/draft-itinerary/marketing`,\n    component: Marketing,\n    name: 'cms_marketing',\n  },\n] : [];\n"],"names":["_sfc_render","_ctx","_cache","_openBlock","_createElementBlock","_hoisted_1","DashboardCheckImage","DashboardCrossImage","expand","ref","mobile","desktop","useShared","useBodyClass","upcomingCoverImg","_imports_1","t","render","_createElementVNode","DefaultAvatarIcon","steps","_createStaticVNode","MapIcon","isUndefined","value","isNull","isBoolean","isObject","isArray","isDate","isBlob","isReactNative","isFile","initCfg","serialize","obj","cfg","fd","pre","index","key","prop","src","useCmsEssentialStore","defineStore","state","first","last","tz","_a","r","startDate","endDate","days","moment","formatUnit","ymd","dest","x","review","remove","title","useCmsAccommodationStore","place","queueFn","metaStore","useCmsIndexStore","p","useCmsItineraryStore","dates","listDays","date","isFirst","isLast","defaultTitle","day","randomKey","from","to","oldIndex","newIndex","fromGrp","grp","toGrp","pulled","pullAt","_b","_d","_c","tobeRemoved","useCmsPricingStore","useCmsMetaStore","c","event","type","xor","lastPackage","useCmsAddonsStore","itineraryStore","addon","a","lastAddon","useCmsPoliciesStore","data","sortById","f","i","coupon","useCmsMarketingStore","API_VERSION_DIFF_THRESHOLD","s","route","currencyJson","e","routeName","saved","nextTick","bootstrapDraft","redirectTo","id","nullableInt","prevStep","done","prevDone","addonStore","resource","resourceId","query","qs","api","deserializeJsonApi","url","err","AxiosError","cancellation_policy","payload","now","isUpdate","list","payloadMaker","callback","_","pool","item","promise","res","action","itinerary","version","bootstrapped","essentialStore","accommodationStore","pricingStore","addonsStore","policiesStore","marketingStore","onSaveJobQueue","postSaveJobQueue","draftId","cleanUpdate","watchIgnorable","watchImmediate","setupPusher","resetAll","fn","fnKey","refresh","retrieveDraft","retrieveEvents","retrieveAddons","retrieveCoupons","setupSupplierOrHeroProfile","saveFn","validationMode","until","runPostSaveHooks","fetchDraft","updateImages","useCmsPusher","useDebounceFn","act","evt","hms","retrieveSupplierProfile","retrieveHeroProfile","cached","supplier","cachedApiGet","apiGet","hero","saveOnEssentialPage","draft_itinerary","saveOnAccommodationPage","medium","saveOnItineraryPage","saveMain","saveDays","saveOnPricingPage","draft","events","saveOnAddonsPage","addons","datetime","saveOnPoliciesPage","saveOnMarketingPage","draftItinerary","coupons","keyedCountries","COUNTRIES","EditIcon","DeleteIcon","useConfirmationDialog","provide","inject","createInjectionState","show","confirmFns","open","handleAction","close","onConfirm","errorMessage","props","__props","placeholder","profileImage","itineraries","confirmDelete","onMounted","loadItineraries","setProfileImage","gotoItinerary","removeItinerary","dateRangeDisplay","start","end","formattedDate","nights","countryDisplay","countryCode","datePlaceholder","stepCount","stepsDone","step","emit","__emit","progress","computed","displayItineraryRequestDate","itineraryRequest","text","orderBy","accessible","elClass","CirclingArrowIcon","saving","showSavedMsg","btn","showExitDialog","watch","resetSavingStates","errCount","onClickSaveBtn","buttonNumber","validate","errors","apiErrorList","wrapperEl","optionListEl","model","_useModel","dropdown","selectIndex","optionEls","showPlaceholder","selectedOptionEl","optionList","opt","displayValue","matched","mouseOutsideWrapper","useMouseInElement","mouseOutsideDropdown","mouseInside","onClickOutside","useInfiniteScroll","onKeyStroke","confirmOption","selectNext","selectPrev","showSelectedOption","option","clear","wrapper","results","showResults","mobileExpanded","debouncedQuery","onQuery","queryFailed","onInput","onClear","onClickResultItem","input","val","setDestination","autocomplete","search","onSelectResult","predictionText","destination","showCalendar","daterange","displayDates","formatDateRange","updateDaterange","ActivityLevelOneIcon","ActivityLevelTwoIcon","ActivityLevelThreeIcon","ProfileImageIcon","TrashIcon","store","newImage","onChange","useFileDialog","reviewSources","confirmUpdateSupplier","onSave","saveToApi","file","useObjectUrl","PencilIcon","markDirty","rootEl","titleInput","editing","maxChars","titleInputLength","saveTitleInput","setTitleLength","useMutationObserver","selectTitleInput","onBeforeInput","invalid","n","positive","min","max","valueChanged","valueDisplay","initValue","aft","bef","onCancel","confirmUpdateHero","countries","b","confirmRemoveDestination","setCountryOnSelectFirstDestination","country","country_code","timezones","removeDestination","searchParams","address","UploadIcon","maxSize","container","accept","acceptStr","maxSizeBytes","convertToBytes","isOverDropZone","useDropZone","onFilesSelected","fileList","rejected","files","pass","ext","rejectedFiles","imgSrc","isInputValid","limit","page","reactive","loading","hasMoreResults","queryApi","axios","ids","queryApiDebounced","width","height","useElementSize","rowsOfImage","kw","watchDebounced","image","rowGap","imageHeight","gapHeight","extractNumber","containerHeight","loadMoreResults","tab","imageKeys","remainingImages","expanded","addUploadedImages","toggleUnsplashImage","img","removeImage","idx","accommodationListEl","confirmRemove","removeAccommodation","openAndGotoLastPlace","addAccommodation","length","numberList","v","incrementLength","interval","onKeydown","toggleTag","tag","ErrorCode","ErrorCode2","MilkdownError","code","message","functionReplacer","stringify","docTypeError","contextNotFound","name","timerNotFound","ctxCallOutOfScope","createNodeInParserFail","args","msg","arg","y","stackOverFlow","parserMatchError","node","serializerMatchError","expectDomTypeError","callCommandBeforeEditorView","missingNodeInSchema","missingMarkInSchema","__typeError","__accessCheck","member","__privateGet","getter","__privateAdd","__privateSet","setter","_watchers","_value","_emit","_meta","_container","_clock","_injectedSlices","_consumedSlices","_recordedTimers","_waitTimers","_getSlice","_getTimer","_container2","_clock2","_meta2","_inspector","_promise","_listener","_eventUniqId","_status","_removeListener","_waitTimeout","Container","slice","context","Slice$1","watcher","value2","updater","w","off","SliceType","Slice","createSlice","Inspector","clock","meta","timer","duration","timerType","sliceType","_Ctx","meta2","Ctx","Clock","Timer","resolve","reject","ifTimeout","TimerType","timeout","createTimer","OrderedMap","content","found","newKey","self","without","map","result","findDiffStart","pos","childA","childB","j","inner","findDiffEnd","posA","posB","iA","iB","size","same","minSize","Fragment","nodeStart","parent","child","blockSeparator","leafText","nodeText","other","current","copy","otherPos","round","retIndex","curPos","cur","schema","array","joined","nodes","offset","compareDeep","Mark","attrs","set","placed","json","mark","marks","ReplaceError","openStart","openEnd","fragment","insertInto","removeRange","openIsolating","indexTo","offsetTo","dist","insert","replace","$from","$to","replaceOuter","depth","prepareSliceForReplace","replaceThreeWay","replaceTwoWay","checkJoin","main","sub","joinable","$before","$after","addNode","target","addRange","$start","$end","startIndex","endIndex","$along","extra","ResolvedPos","path","parentOffset","dOff","tmp","after","next","pred","d","NodeRange","str","doc","rem","cache","resolveCache","elt","ResolveCache","resolveCacheSize","emptyAttrs","Node","startPos","includeParents","wrapMarks","match","replacement","one","two","m","TextNode","base","ContentMatch","validEnd","string","nodeTypes","stream","TokenStream","expr","parseExpr","dfa","nfa","checkForDeadEnds","frag","toEnd","seen","types","finished","tp","active","scan","out","tok","exprs","parseExprSeq","parseExprSubscript","parseExprAtom","parseExprRange","parseNum","resolveName","typeName","connect","compile","edge","term","edges","loop","cmp","nullFrom","labeled","explore","states","work","dead","defaultAttrs","defaults","attrName","attr","computeAttrs","built","given","checkAttrs","values","initAttrs","Attribute","NodeType$1","NodeType","spec","group","before","markType","topType","validateType","options","MarkType","rank","Schema","instanceSpec","contentExprCache","contentExpr","markExpr","gatherMarks","excl","ok","isTagRule","rule","isStyleRule","DOMParser","rules","matchedStyles","dom","ParseContext","matches","style","priority","blockTags","ignoreTags","listTags","OPT_PRESERVE_WS","OPT_PRESERVE_WS_FULL","OPT_OPEN_LEFT","wsOptionsFor","preserveWhitespace","NodeContext","solid","fill","wrap","parser","isOpen","topNode","topContext","topOptions","top","preserveWS","nodeBefore","domNodeBefore","matchAfter","outerWS","ruleID","normalizeList","sync","oldNeedsBlock","innerMarks","styles","continueAfter","nodeType","startIn","contentDOM","cx","block","nodeMarks","markMayApply","applyMarks","textNode","parts","useRoot","minDepth","part","$context","deflt","prevItem","selector","DOMSerializer","keep","rendered","add","markDOM","renderSpec","inline","toDOM","structure","xmlNS","blockArraysIn","gatherToDOM","suspiciousAttributeCache","suspiciousAttributes","suspiciousAttributesInner","tagName","suspicious","space","innerContent","emptyOptions","toString","settings","includeImageAlt","includeHtml","all","element","decodeNamedCharacterReference","characterReference","character","splice","items","chunkStart","parameters","push","hasOwnProperty","combineExtensions","extensions","syntaxExtension","extension","hook","left","right","constructs","existing","decodeNumericCharacterReference","normalizeIdentifier","asciiAlpha","regexCheck","asciiAlphanumeric","asciiAtext","asciiControl","asciiDigit","asciiHexDigit","asciiPunctuation","markdownLineEnding","markdownLineEndingOrSpace","markdownSpace","unicodePunctuation","unicodeWhitespace","regex","check","factorySpace","effects","prefix","initializeContent","contentStart","afterContentStartConstruct","paragraphInitial","previous","lineStart","token","document","initializeDocument","containerConstruct","tokenizeContainer","stack","continued","childFlow","childToken","lineStartOffset","documentContinue","checkNewContainers","closeFlow","indexBeforeExits","indexBeforeFlow","point","exitContainers","documentContinued","flowStart","thereIsANewContainer","thereIsNoNewContainer","containerContinue","flowContinue","writeToChild","endOfFile","entry","nok","classifyCharacter","resolveAll","called","attention","resolveAllAttention","tokenizeAttention","openingSequence","closingSequence","use","nextEvents","movePoint","attentionMarkers","marker","inside","autolink","tokenizeAutolink","schemeOrEmailAtext","emailAtext","schemeInsideOrEmailAtext","urlInside","emailAtSignOrDot","emailLabel","emailValue","blankLine","tokenizeBlankLine","blockQuote","tokenizeBlockQuoteContinuation","exit","tokenizeBlockQuoteStart","contStart","contBefore","characterEscape","tokenizeCharacterEscape","tokenizeCharacterReference","test","numeric","nonLazyContinuation","tokenizeNonLazyContinuation","codeFenced","tokenizeCodeFenced","closeStart","tokenizeCloseStart","initialPrefix","sizeOpen","beforeSequenceOpen","tail","sequenceOpen","infoBefore","atNonLazyBreak","info","metaBefore","contentBefore","beforeContentChunk","contentChunk","startBefore","beforeSequenceClose","sequenceClose","sequenceCloseAfter","codeIndented","tokenizeCodeIndented","furtherStart","tokenizeFurtherStart","afterPrefix","atBreak","codeText","resolveCodeText","tokenizeCodeText","tailExitIndex","headEnterIndex","enter","between","SpliceBuffer","initial","stop","deleteCount","count","removed","chunkedPush","subtokenize","eventsArray","jumps","lineIndex","otherIndex","otherEvent","subevents","more","subcontent","eventIndex","startPosition","startPositions","tokenizer","childEvents","gaps","adjust","breaks","resolveContent","tokenizeContent","continuationConstruct","tokenizeContinuation","chunkInside","contentEnd","contentContinue","startLookahead","prefixed","factoryDestination","literalType","literalMarkerType","rawType","stringType","balance","enclosedBefore","raw","enclosed","enclosedEscape","rawEscape","factoryLabel","markerType","labelInside","labelEscape","factoryTitle","begin","escape","factoryWhitespace","definition","tokenizeDefinition","titleBefore","tokenizeTitleBefore","identifier","labelAfter","markerAfter","destinationBefore","destinationAfter","afterWhitespace","beforeMarker","titleAfter","titleAfterOptionalWhitespace","hardBreakEscape","tokenizeHardBreakEscape","headingAtx","resolveHeadingAtx","tokenizeHeadingAtx","sequenceFurther","htmlBlockNames","htmlRawNames","htmlFlow","resolveToHtmlFlow","tokenizeHtmlFlow","blankLineBefore","tokenizeBlankLineBefore","nonLazyContinuationStart","tokenizeNonLazyContinuationStart","closingTag","buffer","markerB","declarationOpen","tagCloseStart","continuationDeclarationInside","commentOpenInside","cdataOpenInside","continuation","slash","basicSelfClosing","completeClosingTagAfter","completeAttributeNameBefore","completeEnd","completeAttributeName","completeAttributeNameAfter","completeAttributeValueBefore","completeAttributeValueQuoted","completeAttributeValueUnquoted","completeAttributeValueQuotedAfter","completeAfter","continuationCommentInside","continuationRawTagOpen","continuationClose","continuationCdataInside","continuationAfter","continuationStart","continuationStartNonLazy","continuationBefore","continuationRawEndTag","htmlText","tokenizeHtmlText","returnState","instruction","tagOpen","declaration","commentEnd","comment","commentClose","lineEndingBefore","cdata","cdataClose","cdataEnd","instructionClose","tagClose","tagCloseBetween","tagOpenBetween","tagOpenAttributeName","tagOpenAttributeNameAfter","tagOpenAttributeValueBefore","tagOpenAttributeValueQuoted","tagOpenAttributeValueUnquoted","tagOpenAttributeValueQuotedAfter","lineEndingAfter","lineEndingAfterPrefix","labelEnd","resolveAllLabelEnd","resolveToLabelEnd","tokenizeLabelEnd","resourceConstruct","tokenizeResource","referenceFullConstruct","tokenizeReferenceFull","referenceCollapsedConstruct","tokenizeReferenceCollapsed","newEvents","media","label","labelStart","defined","labelEndNok","labelEndOk","referenceNotFull","resourceStart","resourceBefore","resourceOpen","resourceEnd","resourceDestinationAfter","resourceDestinationMissing","resourceBetween","resourceTitleAfter","referenceFull","referenceFullAfter","referenceFullMissing","referenceCollapsedStart","referenceCollapsedOpen","labelStartImage","tokenizeLabelStartImage","labelStartLink","tokenizeLabelStartLink","lineEnding","tokenizeLineEnding","thematicBreak","tokenizeThematicBreak","sequence","tokenizeListContinuation","tokenizeListEnd","tokenizeListStart","listItemPrefixWhitespaceConstruct","tokenizeListItemPrefixWhitespace","indentConstruct","tokenizeIndent","initialSize","kind","atMarker","onBlank","endOfPrefix","otherPrefix","notBlank","notInCurrentItem","setextUnderline","resolveToSetextUnderline","tokenizeSetextUnderline","heading","paragraph","flow","initializeFlow","atBlankEnding","afterConstruct","resolver","createResolver","initializeFactory","field","resolveAllLineSuffixes","initializeText","notText","extraResolver","resolveAllText","chunks","bufferIndex","tabs","chunk","contentInitial","flowInitial","insideSpan","resolveText","disable","createTokenizer","initialize","columnStart","resolveAllConstructs","constructFactory","onsuccessfulconstruct","onsuccessfulcheck","consume","defineSkip","sliceSerialize","sliceStream","write","addResult","expandTabs","serializeChunks","sliceChunks","_bufferIndex","_index","line","column","accountForPotentialSkip","chunkIndex","go","fields","construct","onreturn","bogusState","listOfConstructs","constructIndex","currentConstruct","handleListOfConstructs","handleMapOfConstructs","handleConstruct","startPoint","startPrevious","startCurrentConstruct","startEventsIndex","startStack","restore","startBufferIndex","endBufferIndex","view","head","atTab","parse","defaultConstructs","create","creator","postprocess","preprocess","atCarriageReturn","preprocessor","encoding","endPosition","characterEscapeOrReference","decodeString","decode","$0","$1","$2","hex","stringifyPosition","position","own","fromMarkdown","compiler","config","opener","link","onenterdata","codeFlow","emphasis","hardBreak","html","listItem","onenterlistitemvalue","onenterlistordered","onenterreference","strong","closer","onexitatxheadingsequence","onexitautolinkemail","onexitautolinkprotocol","onexitdata","onexitcharacterreferencemarker","onexitcharacterreferencevalue","onexitcharacterreference","onexitcodefenced","onexitcodefencedfence","onexitcodefencedfenceinfo","onexitcodefencedfencemeta","onexitcodeindented","onexitcodetext","onexitdefinitiondestinationstring","onexitdefinitionlabelstring","onexitdefinitiontitlestring","onexithardbreak","onexithtmlflow","onexithtmltext","onexitimage","onexitlabel","onexitlabeltext","onexitlineending","onexitlink","onexitreferencestring","onexitresourcedestinationstring","onexitresourcetitlestring","onexitresource","onexitsetextheading","onexitsetextheadinglinesequence","onexitsetextheadingtext","configure","tree","resume","listStack","prepareList","handler","defaultOnError","containerBalance","listSpread","firstBlankLineIndex","tailIndex","tailEvent","and","errorHandler","onExitError","ancestor","siblings","referenceType","children","combined","remarkParse","zwitch","handlers","blockquote","tracker","blank","patternInScope","pattern","listInScope","none","_1","longestStreak","substring","source","expected","formatCodeAsIndented","checkFence","suffix","subexit","checkQuote","quote","checkEmphasis","encodeCharacterReference","encodeInfo","outside","outsideKind","insideKind","emphasisPeek","betweenHead","betweenTail","convert","castFactory","anyFactory","propsFactory","typeFactory","tests","checks","any","checkAsRecord","nodeAsRecord","testFunction","looksLikeANode","empty","CONTINUE","EXIT","SKIP","visitParents","visitor","reverse","is","factory","parents","visit","subresult","grandparents","toResult","nodeAsParent","testOrVisitor","visitorOrReverse","maybeReverse","overload","formatHeadingAsSetext","literalWithBreak","htmlPeek","imagePeek","imageReference","imageReferencePeek","alt","reference","inlineCode","inlineCodePeek","expression","formatLinkAsAutolink","linkPeek","linkReference","linkReferencePeek","checkBullet","checkBulletOther","bullet","bulletOther","checkBulletOrdered","checkRule","bulletCurrent","useDifferentMarker","firstListItem","checkListItemIndent","listItemIndent","phrasing","root","checkStrong","strongPeek","checkRuleRepetition","repetition","handle","join","joinDefaults","fullPhrasingSpans","unsafe","association","compilePattern","containerPhrasing","indexStack","encodeAfter","encodingInfo","containerFlow","eol","indentLines","safe","positions","infos","numerical","escapeBackslashes","whole","track","lineShift","move","shift","toMarkdown","containerPhrasingBound","containerFlowBound","safeBound","joinDefinition","unknown","remarkStringify","bail","error","hasOwn","toStr","defineProperty","gOPD","arr","isPlainObject","hasOwnConstructor","hasIsPrototypeOf","setProperty","getProperty","extend","copyIsArray","clone","deep","prototype","trough","fns","pipeline","run","middlewareIndex","output","middelware","middleware","wrapped","fnExpectsCallback","exception","then","VFileMessage","causeOrReason","optionsOrParentOrPlace","origin","reason","legacyCause","minpath","basename","dirname","extname","assertPath","seenNonSlash","firstNonSlashEnd","extnameIndex","unmatchedSlash","startPart","startDot","preDotState","segments","normalize","absolute","normalizeString","allowAboveRoot","lastSegmentLength","lastSlash","dots","lastSlashIndex","minproc","cwd","isUrl","fileUrlOrPath","urlToPath","getPathFromURLPosix","pathname","third","order","VFile","isUint8Array","assertNonEmpty","assertPart","stem","CallableInstance","property","proto","apply","Processor","attacher","assertUnfrozen","transformer","realFile","vfile","assertParser","assertCompiler","executor","parseTree","realDone","compileTree","compileResult","looksLikeAValue","complete","assertDone","assertNode","transformers","outputTree","resultingTree","attachers","namespace","addPlugin","addList","addPreset","plugin","plugins","thing","entryIndex","primary","rest","currentPrimary","isPlainObj","unified","frozen","asyncName","looksLikeAVFile","_marks","_hasText","_maybeMerge","_matchTarget","_runNode","_closeNodeAndPush","_addNodeAndPush","_marks2","_matchTarget2","_runProseNode","_runProseMark","_runNode2","_searchType","_maybeMergeChildren","_createMarkdownNode","_moveSpaces","_closeNodeAndPush2","_addNodeAndPush2","_openMark","_closeMark","StackElement","Stack","el","ParserStackElement","_ParserState","topElement","prevNode","currNode","merged","remark","markdown","ParserState","_SerializerStackElement","SerializerStackElement","isFragment","_SerializerState","getPriority","searchNode","node2","_a2","firstChild","nextChildren","currChildren","currRest","prevChildren","prevRest","onPush","startSpaces","endSpaces","findIndex","lastChild","trim","SerializerState","lower16","factor16","makeRecover","recoverIndex","recoverOffset","DEL_BEFORE","DEL_AFTER","DEL_ACROSS","DEL_SIDE","MapResult","delInfo","recover","StepMap","ranges","inverted","diff","assoc","simple","oldSize","newSize","side","del","oldStart","newStart","Mapping","maps","mirror","mirrors","mapping","startSize","mirr","totalSize","inverse","corr","stepsByID","Step","stepClass","StepResult","failed","mapFragment","mapped","AddMarkStep","oldSlice","RemoveMarkStep","AddNodeMarkStep","updated","newSet","RemoveNodeMarkStep","ReplaceStep","contentBetween","ReplaceAroundStep","gapFrom","gapTo","gap","inserted","addMark","tr","added","removing","adding","removeMark","toRemove","clearIncompatible","parentType","clearNewlines","replSteps","allowed","newline","canCut","liftTarget","range","lift","gapStart","gapEnd","splitting","findWrapping","innerRange","around","findWrappingOutside","findWrappingInside","withAttrs","outer","innerMatch","wrappers","setBlockType","mapFrom","attrsHere","canChangeType","convertNewlines","supportLinebreak","replaceLinebreaks","startM","endM","replaceNewlines","$pos","setNodeMarkup","newNode","canSplit","typesAfter","innerType","overrideChild","baseType","split","typeAfter","canJoin","canAppendWithSubstitutedLinebreaks","linebreakReplacement","beforeType","$full","insertPoint","dropPoint","bias","insertPos","fits","wrapping","replaceStep","fitsTrivially","Fitter","unplaced","fit","moveInline","placedSize","startDepth","sliceDepth","contentAt","frontierDepth","openAtEnd","dropFromFragment","taken","openEndCount","closeNodeStart","addToFragment","level","contentAfterFits","dropInner","invalidMarks","definesContent","replaceRange","targetDepths","coveredDepths","preferredTarget","preferredTargetIndex","leftNodes","preferredDepth","leftNode","def","openDepth","targetDepth","closeFragment","startSteps","oldOpen","newOpen","replaceRangeWith","deleteRange","covered","AttrStep","DocAttrStep","TransformError","Transform","classesById","Selection","$anchor","$head","SelectionRange","lastNode","lastParent","selectionToInsertionEnd","dir","textOnly","TextSelection","findSelectionIn","AllSelection","cls","selectionClass","warnedAboutTextSelection","checkTextSelection","TextBookmark","anchor","dPos","NodeSelection","deleted","NodeBookmark","sel","AllBookmark","startLen","_from","_to","_newFrom","newTo","UPDATED_SEL","UPDATED_MARKS","UPDATED_SCROLL","Transaction","selection","time","inheritMarks","bind","FieldDesc","desc","baseFields","instance","_old","prev","Configuration","EditorState","ignore","rootTr","trs","newState","haveNew","oldState","newInstance","$config","pluginFields","bindProps","Plugin","createKey","keys","PluginKey","InputRule","stringHandler","cutOff","undoInputRule","dispatch","undoable","toUndo","wrappingInputRule","regexp","getAttrs","joinPredicate","textblockTypeInputRule","nav","agent","ie_edge","ie_upto10","ie_11up","ie","gecko","_chrome","safari","ios","webkit","textBefore","_matcher","matcher","customInputRulesKey","customInputRules","stored","$cursor","markRule","matchLength","fullMatch","initialStoredMarks","markEnd","captured","textStart","textEnd","equalNodeType","findSelectedNodeOfType","deleteSelection","atBlockStart","joinBackward","$cut","findCutBefore","deleteBarrier","textblockAt","delStep","only","selectNodeBackward","atBlockEnd","joinForward","findCutAfter","selectNodeForward","newlineInCode","defaultBlockAt","exitCode","above","createParagraphNear","liftEmptyBlock","splitBlockAs","splitNode","splitDepth","atEnd","atStart","splitPos","can","$first","splitBlock","selectAll","joinMaybeClear","conn","isolated","canDelAfter","$joinAt","selAfter","at","afterText","afterDepth","selectTextblockSide","selectTextblockStart","selectTextblockEnd","wrapIn","applicable","markApplies","enterAtoms","toggleMark","spaceStart","spaceEnd","chainCommands","commands","backspace","pcBaseKeymap","macBaseKeymap","mac","baseKeymap","keyName","ignoreKey","normalizeKeyName","ctrl","mod","modifiers","keymap","bindings","keydownHandler","baseName","direct","noShift","fromCode","domIndex","parentNode","reusedRange","textRange","clearReusedRange","isEquivalentPosition","targetNode","targetOff","scanFor","atomElements","nodeSize","hasBlockDesc","textNodeBefore$1","textNodeAfter$1","isOnEdge","selectionCollapsed","domSel","keyEvent","keyCode","deepActiveElement","caretFromPoint","ie_version","chrome","chrome_version","windows","android","webkit_version","windowRect","vp","getSide","clientRect","rect","scaleX","scaleY","scrollRectIntoView","startDOM","scrollThreshold","scrollMargin","atTop","bounding","moveX","moveY","startX","startY","dX","dY","storeScrollPos","refDOM","refTop","localRect","scrollStack","resetScrollPos","newRefTop","restoreScrollStack","dTop","preventScrollSupported","focusPreventScroll","findOffsetInNode","coords","closest","dxClosest","coordsClosest","rowBot","rowTop","firstBelow","coordsBelow","childIndex","rects","dx","findOffsetInText","len","singleRect","inRect","targetKludge","posFromElement","posFromCaret","outsideBlock","sawBlock","elementFromPoint","box","startI","posAtCoords","caret","nonZero","BIDI","coordsAtPos","atom","supportEmptyRange","rectBefore","rectAfter","flattenV","takeSide","flattenH","withFlushedState","viewState","endOfTextblockVertical","nearest","boxes","maybeRTL","endOfTextblockHorizontal","oldNode","oldOff","anchorNode","anchorOffset","oldBidiLevel","parentDOM","newOff","cachedState","cachedDir","cachedResult","endOfTextblock","NOT_DIRTY","CHILD_DIRTY","CONTENT_DIRTY","NODE_DIRTY","ViewDesc","widget","outerDeco","innerDeco","nodeName","domBefore","domAfter","onlyNodes","nodeDOM","TrailingHackViewDesc","WidgetViewDesc","fromOffset","toOffset","childBase","force","anchorDOM","headDOM","selRange","brKludge","domSelExtended","mutation","startInside","endInside","dirty","CompositionViewDesc","textDOM","mut","MarkViewDesc","custom","replaceNodes","NodeViewDesc","descObj","applyOuterDeco","CustomNodeViewDesc","TextViewDesc","sameOuterDeco","composition","localComposition","compositionInChild","ViewTreeUpdater","iterDeco","insideNode","compIndex","renderDescs","iosHacks","textPos","findTextInFragment","needsWrap","oldDOM","patchOuterDeco","computeOuterDeco","docViewDesc","docView","skip","descs","written","childDOM","rm","OuterDecoLevel","noDeco","outerDOM","prevComputed","curComputed","curDOM","deco","patchAttributes","prevList","curList","lock","preMatch","maxKeep","markDesc","targetDesc","domNode","nextDOM","locked","ch","hack","parentDesc","curDesc","descI","fI","compareSide","onWidget","onNode","locals","decoIndex","restNode","parentIndex","widgets","cutAt","oldCSS","childStart","selectionFromDOM","nearestDesc","inWidget","nearestDescNode","selectionBetween","editorOwnsSelection","hasSelection","selectionToDOM","syncNodeSelection","curSel","selectCursorWrapper","resetEditableFrom","resetEditableTo","brokenSelectBetweenUneditable","temporarilyEditableNear","resetEditable","removeClassOnSelectionChange","setEditable","clearNodeSelection","hasFocusAndSelection","anchorInRightPlace","moveSelectionBlock","$side","selectHorizontally","mods","$newHead","nodePos","nodeLen","isIgnorable","skipIgnoredNodes","skipIgnoredNodesBefore","skipIgnoredNodesAfter","moveNode","moveOffset","isBlockNode","setSelFocus","textNodeAfter","textNodeBefore","findDirection","mid","selectVertically","beyond","stopNativeHorizontalDelete","nextNode","switchEditable","safariDownArrowBug","focusNode","focusOffset","getMods","captureKeyDown","serializeForClipboard","serializer","detachedDoc","wrapMap","parseFromClipboard","plainText","inCode","asText","parsed","readHTML","restoreReplacedSpaces","contextNode","sliceData","inlineParents","addContext","closeSlice","normalizeSiblings","lastWrap","inLast","addToSibling","closeRight","withWrappers","sibling","closeRange","_detachedDoc","_policy","maybeWrapTrusted","trustedTypes","metas","firstTag","editHandlers","passiveHandlers","InputState","initInput","eventBelongsToView","runCustomHandler","ensureListeners","setSelectionOrigin","destroyInput","currentHandlers","dispatchEvent","_event","inOrNearComposition","eventCoords","isNear","click","dy","runHandlerOnContext","propName","updateSelection","selectClickedLeaf","selectClickedNode","selectedNode","selectAt","handleSingleClick","selectNode","handleDoubleClick","handleTripleClick","defaultTripleClick","forceDOMFlush","endComposition","selectNodeModifier","flushed","MouseDown","targetPos","timeoutComposition","scheduleComposeEnd","delay","clearComposition","timestampFromCustomEvent","findCompositionNode","textAfter","descAfter","lastChanged","descBefore","restarting","captureCopy","brokenClipboardAPI","cut","sliceSingleNode","capturePaste","plain","doPaste","preferPlain","singleNode","getText","clipboardData","uris","Dragging","dragCopyModifier","mouseDown","draggedSlice","dragging","eventPos","$mouse","isNode","beforeInsert","domChangeCount","compareObjs","WidgetType","noSpec","span","oldOffset","Decoration","InlineType","DecorationSet","local","decorations","buildTree","predicate","childOff","newLocal","mapChildren","byPos","childNode","childOffset","baseOffset","takeSpansForNode","moveSpans","withoutNulls","dec","localSet","DecorationGroup","removeOverlap","members","mappedDecos","sorted","oldChildren","moved","oldEnd","newEnd","dSize","mustRebuild","fromLocal","toLocal","mapAndGatherRemainingDecorations","spans","gather","hasNulls","localStart","subtree","working","insertAhead","viewDecorations","observeOptions","useCharData","SelectionState","DOMObserver","handleDOMChange","mutations","take","ancestors","newSel","typeOver","brs","br","blockParent","readSel","checkCSS","previousSibling","nextSibling","cssChecked","cssCheckWarned","rangeToSelectionRange","currentAnchor","safariShadowSelectionRange","read","parseBetween","from_","to_","find","startDoc","ruleFromNode","isInline","readDOMChange","addedNodes","compositionID","shared","compare","preferredPos","preferredSide","change","findDiff","resolveSelection","$fromA","inlineChange","nextSel","looksLikeBackspace","chFrom","chTo","storedMarks","markChange","isMarkChange","parsedSel","curMarks","prevMarks","update","old","$newStart","$newEnd","skipClosingAndOpening","$next","fromEnd","mayOpen","endA","endB","isSurrogatePair","EditorView","checkStateComponent","getEditable","updateCursorWrapper","buildNodeViews","computeDocDeco","prevProps","redraw","updateSel","pluginsChanged","nodeViews","changedNodeViews","scroll","updateDoc","oldScrollPos","forceSelUpdate","selectionContextChanged","chromeKludge","prevState","pluginView","movedPos","dispatchTransaction","sel1","sel2","nA","nB","_enableInspector","_configureList","_onStatusChange","_usrPluginStore","_sysPluginStore","_ctx2","_loadInternal","_prepare","_cleanup","_cleanupInternal","_setStatus","_loadPluginInStore","withMeta","remarkHandlers","editorViewCtx","editorStateCtx","initTimerCtx","editorCtx","inputRulesCtx","prosePluginsCtx","remarkPluginsCtx","nodeViewCtx","markViewCtx","remarkCtx","remarkStringifyOptionsCtx","ConfigReady","ctx","InitReady","init","editor","SchemaReady","schemaTimerCtx","schemaCtx","nodesCtx","marksCtx","extendPriority","processor","acc","plug","key2","schema2","CommandManager","command","createCmdKey","commandsCtx","commandsTimerCtx","CommandsReady","cmd","ParserReady","outOfScope$1","parserCtx","parserTimerCtx","SerializerReady","serializerTimerCtx","outOfScope","serializerCtx","defaultValueCtx","editorStateOptionsCtx","editorStateTimerCtx","EditorStateReady","getDoc","defaultValue","parser2","key$1","overrideBaseKeymap","keymap2","handleBackspace","editorState","optionsOverride","prosePlugins","_tr","_oldState","EditorViewReady","editorViewTimerCtx","editorViewOptionsCtx","rootCtx","rootDOMCtx","rootAttrsCtx","createViewContainer","prepareViewDom","editorView","xs","editorView2","markViews","_Editor","configPlugin","internalPlugins","loader","cleanup","status","enable","_plugins","clearPlugins","Editor","editorInfoCtxKey","useGetEditor","editorRef","getEditor","currentEditorRef","editor2","onUnmounted","Milkdown","defineComponent","domRef","createVNode","MilkdownProvider","slots","editorFactory","useEditor","$command","cmdKey","$inputRule","inputRule","ir","irs","$mark","markSchema","ns","$node","nodeSchema","$prose","prose","prosePlugin","ps","$shortcut","shortcut","k","keymapPlugin","$ctx","$nodeSchema","schemaCtx2","nodeSchema2","$markSchema","markSchema2","ms","$useKeymap","userKeymap","shortcuts2","keymapDef","shortcuts","keymapTuple","targetKey","$nodeAttr","$markAttr","$remark","initialOptions","remarkPlugin","rp","getMarkdown","splitListItem","itemType","itemAttrs","grandParent","depthBefore","depthAfter","nextType","liftListItem","liftToOuterList","liftOutOfList","endOfList","indexBefore","sinkListItem","nestedBefore","definitions","clean","remarkInlineLinks","serializeText","contentArr","emphasisAttr","emphasisSchema","toggleEmphasisCommand","emphasisStarInputRule","emphasisUnderscoreInputRule","emphasisKeymap","commands2","strongAttr","strongSchema","toggleStrongCommand","strongInputRule","strongKeymap","inlineCodeAttr","inlineCodeSchema","toggleInlineCodeCommand","inlineCodeInputRule","inlineCodeKeymap","linkAttr","linkSchema","toggleLinkCommand","updateLinkCommand","linkMark","docSchema","visitImage","ast","remarkPreserveEmptyLinePlugin","paragraphAttr","paragraphSchema","shouldPreserveEmptyLine","shouldPreserveEmptyLine2","turnIntoTextCommand","paragraphKeymap","headingIndex","defaultHeadingIdGenerator","headingIdGenerator","headingAttr","headingSchema","getId","wrapInHeadingInputRule","wrapInHeadingCommand","downgradeHeadingCommand","headingKeymap","blockquoteAttr","blockquoteSchema","wrapInBlockquoteInputRule","wrapInBlockquoteCommand","blockquoteKeymap","codeBlockAttr","codeBlockSchema","language","createCodeBlockInputRule","createCodeBlockCommand","updateCodeBlockLanguageCommand","codeBlockKeymap","imageAttr","imageSchema","insertImageCommand","updateImageCommand","nodeWithPos","newAttrs","insertImageInputRule","hardbreakAttr","hardbreakSchema","insertHardbreakCommand","hardbreakKeymap","hrAttr","hrSchema","insertHrInputRule","insertHrCommand","bulletListAttr","bulletListSchema","ordered","spread","wrapInBulletListInputRule","wrapInBulletListCommand","bulletListKeymap","orderedListAttr","orderedListSchema","wrapInOrderedListInputRule","wrapInOrderedListCommand","orderedListKeymap","listItemAttr","listItemSchema","listType","sinkListItemCommand","liftListItemCommand","splitListItemCommand","liftFirstListItem","parentItem","liftFirstListItemCommand","listItemKeymap","textSchema","htmlAttr","htmlSchema","inputRules","markInputRules","remarkAddOrderInListPlugin","remarkLineBreak","remarkInlineLinkPlugin","isParent","isHTML","flatMapWithDepth","transform","nthChild","remarkHtmlTransformer","remarkMarker","getMarker","inlineNodesCursorPlugin","inlineNodesCursorPluginKey","inlineNodesCursorPlugin2","leftDec","rightDec","hardbreakClearMarkPlugin","hardbreakFilterNodes","hardbreakFilterPlugin","notIn","isInsertHr","curDepth","canApply","syncHeadingIdPlugin","headingIdPluginKey","updateId","idMap","view2","syncListOrderPlugin","syncOrderLabel","orderedListType","bulletListType","listItemType","handleNodeItem","changed","expectedLabel","needDispatch","pos2","_parent","index2","commonmark","GOOD_LEAF_SIZE","RopeSequence","Append","Leaf","prototypeAccessors","leftLen","max_empty_items","Branch","eventCount","preserveItems","remap","remaining","addAfter","addBefore","Item","histOptions","newItems","oldItems","lastItem","overflow","DEPTH_OVERFLOW","cutOffEvents","mirrorPos","rebasedTransform","rebasedCount","rebasedItems","newUntil","iRebased","newMaps","branch","upto","newItem","cutPoint","mirrorOffset","HistoryState","undone","prevRanges","prevTime","prevComposition","applyTransaction","history","historyTr","historyKey","rebased","closeHistoryKey","appended","mustPreserveItems","rangesFor","newGroup","isAdjacentTo","mapRanges","adjacent","histTransaction","redo","pop","newHist","cachedPreserveItems","cachedPreserveItemsPlugins","hist","inputType","undo","buildCommand","undoDepth","redoDepth","undoCommand","redoCommand","historyProviderConfig","historyProviderPlugin","history$1","historyKeymap","FUNC_ERROR_TEXT","NAN","symbolTag","reTrim","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","freeGlobal","global","freeSelf","objectProto","objectToString","nativeMax","nativeMin","debounce","func","wait","lastArgs","lastThis","maxWait","timerId","lastCallTime","lastInvokeTime","leading","maxing","trailing","toNumber","invokeFunc","thisArg","leadingEdge","timerExpired","remainingWait","timeSinceLastCall","timeSinceLastInvoke","shouldInvoke","trailingEdge","cancel","flush","debounced","isInvoking","isObjectLike","isSymbol","isBinary","lodash_debounce","ListenerManager","listenerCtx","listener","listener2","listeners","prevDoc","prevMarkdown","onUpdatePlugin","getStateData","bold","italic","bulletList","orderedList","getSelectionData","replaceAll","setContent","getContent","get","onMarkdownUpdated","onUpdated","md","UndoIcon","RedoIcon","BoldIcon","ItalicIcon","LinkIcon","UnlinkIcon","BulletListIcon","OrderedListIcon","linkDialog","elementId","uniqId","css","useStyleTag","watchEffect","cssRules","onReady","runCommand","focusEditor","toggleLinkDialog","onoff","selectLinkIfCursorIsWithin","addLinkFromDialog","transaction","removeLinkFromDialog","unlinkText","selectPosition","toggleBulletList","toggleOrderedList","MovableIcon","focused","hours","minutes","valid","tryEmitValidDate","selectAmpm","ampm","onFocus","onBlur","tryGuessTimeFromInput","formattedTime","digits","modelTime","modelAmpm","updateTime","dt","showTimeInput","durationContainer","durationHours","durationMinutes","transportationOptions","getTransportationIconClass","updateHours","updateMinutes","ownKeys","object","enumerableOnly","symbols","sym","_objectSpread2","_defineProperty","_typeof","_extends","_objectWithoutPropertiesLoose","excluded","sourceKeys","_objectWithoutProperties","sourceSymbolKeys","userAgent","IE11OrLess","Edge","FireFox","Safari","IOS","ChromeForAndroid","captureMode","on","getParentOrHost","includeCTX","R_SPACE","toggleClass","className","matrix","selfOnly","appliedTransforms","matrixFn","iterator","getWindowScrollingElement","scrollingElement","getRect","relativeToContainingBlock","relativeToNonStaticParent","undoScale","elRect","bottom","containerRect","elMatrix","isScrolledPast","elSide","parentSide","getParentAutoScrollElement","elSideVal","parentSideVal","visible","getChild","childNum","includeDragEl","currentChild","Sortable","getRelativeScrollOffset","offsetLeft","offsetTop","winScroller","indexOfObject","includeSelf","elem","gotSelf","elemCSS","dst","isRectEqual","rect1","rect2","_throttleTimeout","throttle","_this","cancelThrottle","scrollBy","Polymer","$","getChildContainingRectFromElement","ghostEl","_rect$left","_rect$top","_rect$right","_rect$bottom","childRect","expando","AnimationStateManager","animationStates","animationCallbackId","fromRect","childMatrix","animating","animationTime","toRect","prevFromRect","prevToRect","animatingRect","targetMatrix","calculateRealTime","currentRect","translateX","translateY","repaint","PluginManager","eventName","sortable","eventNameGlobal","pluginName","initialized","modified","eventProperties","modifiedValue","_ref","targetEl","cloneEl","toEl","fromEl","oldDraggableIndex","newDraggableIndex","originalEvent","putSortable","extraEventProperties","onName","allEventProperties","_excluded","pluginEvent","dragEl","parentEl","nextEl","lastDownEl","cloneHidden","_hideGhostForTarget","_unhideGhostForTarget","_dispatchEvent","activeGroup","awaitingDragStarted","ignoreNextClick","sortables","tapEvt","touchEvt","lastDx","lastDy","tapDistanceLeft","tapDistanceTop","lastTarget","lastDirection","pastFirstInvertThresh","isCircumstantialInvert","targetMoveDistance","ghostRelativeParent","ghostRelativeParentInitialScroll","_silent","savedInputChecked","documentExists","PositionGhostAbsolutely","CSSFloatProperty","supportDraggable","supportCssPointerEvents","_detectDirection","elCSS","elWidth","child1","child2","firstChildCSS","secondChildCSS","firstChildWidth","secondChildWidth","touchingSideChild2","_dragElInRowColumn","dragRect","targetRect","vertical","dragElS1Opp","dragElS2Opp","dragElOppLength","targetS1Opp","targetS2Opp","targetOppLength","_detectNearestEmptySortable","ret","threshold","insideHorizontally","insideVertically","_prepareGroup","toFn","pull","sameGroup","otherGroup","originalGroup","nearestEmptyInsertDetectEvent","_checkOutsideTargetEl","dataTransfer","preventOnFilter","touch","originalTarget","filter","_saveInputCheckedState","criteria","ownerDocument","dragStartFn","_disableDraggable","_nextTick","fallback","fallbackTolerance","fallbackOffset","ghostMatrix","relativeScrollOffset","cssMatrix","revert","activeSortable","isOwner","canSort","fromSortable","completedFired","dragOverEvent","completed","_onMove","capture","insertion","elLastChild","_ghostIsLast","_ghostIsFirst","direction","targetBeforeFirstSwap","differentLevel","differentRowCol","side1","scrolledPastTop","scrollBefore","_getSwapDirection","dragIndex","moveVector","_unsilent","_cancelNextTick","_globalDragOver","_generateId","useAnimation","willInsertAfter","onMoveFn","retVal","firstElRect","childContainingRect","spacer","lastElRect","swapThreshold","invertedSwapThreshold","invertSwap","isLastTarget","mouseOnAxis","targetLength","targetS1","targetS2","invert","_getInsertDirection","sum","inputs","_len","_key","autoScrolls","scrollEl","scrollRootEl","scrolling","lastAutoScrollX","lastAutoScrollY","touchEvt$1","pointerElemChangedInterval","AutoScrollPlugin","AutoScroll","_ref2","clearPointerElemChangedInterval","clearAutoScrolls","autoScroll","ogElemScroller","newElem","isFallback","sens","speed","scrollThisInstance","scrollCustomFn","layersOut","currentParent","canScrollX","canScrollY","scrollWidth","scrollHeight","scrollPosX","scrollPosY","vx","vy","scrollOffsetY","scrollOffsetX","drop","dispatchSortableEvent","hideGhostForTarget","unhideGhostForTarget","toSortable","Revert","_ref3","Remove","_ref4","parentSortable","accommodations","collapse","notlast","titleEl","ExpandIcon","CollapseIcon","onClick","expandedDates","allExpaned","setInitExpansion","expandAll","collapseAll","toggleExpand","ageThreshold","maxAge","minAge","interestSuggestions","totalAmount","currency","exponent","amount","currencyFormat","revAmount","setModel","getModel","confirmInput","amt","dateRange","dateBeforeMin","dateAfterMax","isLastPaymentDateValid","earliestDate","earliest","setChildren","packageListEl","addPackage","openAndGotoLastPackage","removePackage","addonListEl","addAddon","openAndGotoLastAddon","removeAddon","autofillAddonDates","ArrowLeft","arrivedState","useScroll","timeline","absoluteDate","absoluteTime","diffDays","scrollLeft","scrollRight","storeToRefs","feeOptions","ddlMinDate","onChangeOption","ddl","onChangeFeeOption","dateText","cancellationFeeText","postfix","partialRefundText","ddlLabelText","showTransferSpotExplainer","allowRefund","allowCancel","remainingBalanceTitle","faqs","faqList","faq","addNew","removeFaq","codeMinLength","codeMaxLength","showAddCoupon","discountType","discountTypeOptions","removeCoupon","chooseContainer","uploadImageUrl","watchDeep","pick","setUploadedImages","images","liteModelCmsRoutes","role","isFeatureEnabled","Dashboard","HeroDashboard","PlanTrip","Essentials","Accommodation","Itinerary","Pricing","Addons","Polic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ACD,CACE,KAAM,UAAUL,CAAI,iCACpB,UAAWM,GACX,KAAM,mBACP,EACD,CACE,KAAM,UAAUN,CAAI,6BACpB,UAAWO,GACX,KAAM,eACP,EACD,CACE,KAAM,UAAUP,CAAI,2BACpB,UAAWQ,GACX,KAAM,aACP,EACD,CACE,KAAM,UAAUR,CAAI,0BACpB,UAAWS,GACX,KAAM,YACP,EACD,CACE,KAAM,UAAUT,CAAI,4BACpB,UAAWU,GACX,KAAM,cACP,EACD,CACE,KAAM,UAAUV,CAAI,6BACpB,UAAWW,GACX,KAAM,eACP,CACH,EAAI,CAAE","x_google_ignoreList":[11,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,222]}