@dialpad/dialtone 9.14.1 → 9.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/css/CHANGELOG.json +1 -1
  2. package/dist/css/dialtone.css +6 -6
  3. package/dist/css/dialtone.min.css +1 -1
  4. package/dist/tokens/android/java/tokens-dark.kt +1 -1
  5. package/dist/tokens/android/java/tokens-light.kt +1 -1
  6. package/dist/tokens/android/res/values/colors-dark.xml +1 -1
  7. package/dist/tokens/android/res/values/colors-light.xml +1 -1
  8. package/dist/tokens/android/res/values/dimens.xml +1 -1
  9. package/dist/tokens/css/variables-dark.css +1 -1
  10. package/dist/tokens/css/variables-light.css +1 -1
  11. package/dist/tokens/ios/tokens-dark.swift +1 -1
  12. package/dist/tokens/ios/tokens-light.swift +1 -1
  13. package/dist/tokens/less/variables-dark.less +1 -1
  14. package/dist/tokens/less/variables-light.less +1 -1
  15. package/dist/vue2/dialtone-vue.cjs +1 -1
  16. package/dist/vue2/dialtone-vue.js +2 -2
  17. package/dist/vue2/directives.cjs +1 -1
  18. package/dist/vue2/directives.js +23 -16
  19. package/dist/vue2/message_input.cjs +1 -1
  20. package/dist/vue2/message_input.js +1 -1
  21. package/dist/vue2/{rich_text_editor-Clr7o_AW.cjs → rich_text_editor-DhEmmg9W.cjs} +1 -1
  22. package/dist/vue2/{rich_text_editor-a7U8J5Ft.js → rich_text_editor-WaW2IVbb.js} +4 -2
  23. package/dist/vue2/types/directives/tooltip/tooltip.d.ts.map +1 -1
  24. package/dist/vue3/dialtone-vue.cjs +1 -1
  25. package/dist/vue3/dialtone-vue.js +2 -2
  26. package/dist/vue3/directives.cjs +1 -1
  27. package/dist/vue3/directives.js +30 -23
  28. package/dist/vue3/message_input.cjs +1 -1
  29. package/dist/vue3/message_input.js +1 -1
  30. package/dist/vue3/{rich_text_editor-0vqsSbEc.cjs → rich_text_editor-CkZ82uQY.cjs} +1 -1
  31. package/dist/vue3/{rich_text_editor-j80_b13f.js → rich_text_editor-G1GLwWlk.js} +4 -2
  32. package/dist/vue3/types/directives/tooltip/tooltip.d.ts.map +1 -1
  33. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  "use strict";const N=require("./tooltip-8utqWHHH.cjs"),X=require("./emoji-HI8urLsM.cjs"),m=require("vue"),kt={BUSY:"busy",AWAY:"away",OFFLINE:"offline",ACTIVE:"active"},Do=[kt.BUSY,kt.AWAY,kt.OFFLINE,kt.ACTIVE],Ba={name:"DtPresence",props:{presence:{type:String,default:kt.ACTIVE,validator:n=>Do.includes(n)},srText:{type:String,default:null}}},_a=["aria-live"],Fa={key:0,"data-qa":"dt-presence-sr-text",class:"sr-only"};function za(n,e,t,r,i,s){return m.openBlock(),m.createElementBlock("div",{class:"d-presence","data-qa":"dt-presence",role:"status","aria-live":n.$attrs.ariaLive||"off"},[t.srText?(m.openBlock(),m.createElementBlock("span",Fa,m.toDisplayString(t.srText),1)):m.createCommentVNode("",!0),m.createElementVNode("div",{class:m.normalizeClass(["d-presence__inner",{"d-presence__inner--active":t.presence==="active","d-presence__inner--away":t.presence==="away","d-presence__inner--busy":t.presence==="busy","d-presence__inner--offline":t.presence==="offline"}])},null,2)],8,_a)}const Io=N._export_sfc(Ba,[["render",za]]),mn={xs:"d-avatar--xs",sm:"d-avatar--sm",md:"d-avatar--md",lg:"d-avatar--lg",xl:"d-avatar--xl"},Ro={default:"",icon:"d-avatar__icon",initials:"d-avatar__initials"},Po={md:"d-avatar__presence--md",lg:"d-avatar__presence--lg"},Qr={NONE:"",BUSY:"busy",AWAY:"away",OFFLINE:"offline",ACTIVE:"active"},Lo={xs:"100",sm:"200",md:"300",lg:"500",xl:"600"},Bo=["100","200","300","400","500","600","700","800","900","1000","1100","1200","1300","1400","1500","1600","1700","1800"],Zr=n=>n>1;function Ha(){return[void 0,...X.iconNames]}const Va=n=>{if(typeof n!="string"||!n.trim())return"";const e=n.trim().split(/\s+/g);return e.length===1?e.join("").substring(0,2):e.filter((t,r)=>r===0||r===e.length-1).map(t=>t.slice(0,1).toUpperCase()).join("")},$a=Ha(),ja={name:"DtAvatar",components:{DtPresence:Io,DtIcon:X.DtIcon},inheritAttrs:!1,props:{id:{type:String,default(){return N.getUniqueString()}},seed:{type:String,default:void 0},color:{type:String,default:void 0},size:{type:String,default:"md",validator:n=>Object.keys(mn).includes(n)},avatarClass:{type:[String,Array,Object],default:""},canvasClass:{type:[String,Array,Object],default:""},iconClass:{type:[String,Array,Object],default:""},presence:{type:String,default:Qr.NONE,validator:n=>Object.values(Qr).includes(n)},presenceProps:{type:Object,default:()=>({})},group:{type:Number,default:void 0,validator:n=>Zr(n)},overlayIcon:{type:String,default:""},overlayText:{type:String,default:""},overlayClass:{type:[String,Array,Object],default:""},imageSrc:{type:String,default:""},imageAlt:{type:String,default:""},iconName:{type:String,default:void 0,validator:n=>$a.includes(n)},iconSize:{type:String,default:"",validator:n=>!n||Object.keys(X.ICON_SIZE_MODIFIERS).includes(n)},fullName:{type:String,default:""},clickable:{type:Boolean,default:!1}},emits:["click"],data(){return{AVATAR_SIZE_MODIFIERS:mn,AVATAR_KIND_MODIFIERS:Ro,AVATAR_PRESENCE_SIZE_MODIFIERS:Po,AVATAR_ICON_SIZES:Lo,imageLoadedSuccessfully:null,formattedInitials:"",initializing:!1}},computed:{isNotIconType(){return!this.iconName},avatarClasses(){return["d-avatar",mn[this.validatedSize],this.avatarClass,{"d-avatar--group":this.showGroup,[`d-avatar--color-${this.getColor()}`]:this.isNotIconType,"d-avatar--clickable":this.clickable}]},overlayClasses(){return["d-avatar__overlay",this.overlayClass]},showGroup(){return Zr(this.group)},formattedGroup(){return this.group>99?"99+":this.group},validatedSize(){return this.group?"xs":this.size},showImage(){return this.imageLoadedSuccessfully!==!1&&this.imageSrc},buttonAriaLabel(){if(this.clickable)return this.fullName||this.imageAlt||this.$attrs["aria-label"]}},watch:{fullName:{immediate:!0,handler(n){this.formatInitials(n)}},imageSrc(n){this.imageLoadedSuccessfully=null,n&&(this.validateProps(),this.setImageListeners())}},mounted(){this.validateProps(),this.setImageListeners()},methods:{async setImageListeners(){await this.$nextTick();const n=this.$refs.avatarImage;n&&(n.addEventListener("load",()=>this._loadedImageEventHandler(n),{once:!0}),n.addEventListener("error",()=>this._erroredImageEventHandler(n),{once:!0}))},formatInitials(n){const e=Va(n);this.validatedSize==="xs"?this.formattedInitials="":this.validatedSize==="sm"?this.formattedInitials=e[0]:this.formattedInitials=e},getColor(){return this.color??N.getRandomElement(Bo,this.seed)},_loadedImageEventHandler(n){this.imageLoadedSuccessfully=!0,n.classList.remove("d-d-none")},_erroredImageEventHandler(n){this.imageLoadedSuccessfully=!1,n.classList.add("d-d-none")},validateProps(){if(this.imageSrc&&!(this.fullName||this.imageAlt))throw new Error("full-name or image-alt must be set if image-src is provided")},handleClick(n){this.clickable&&this.$emit("click",n)}}},Ka=["src","alt"],qa={key:1,class:"d-avatar__overlay-text"},Wa={key:1,class:"d-avatar__count","data-qa":"dt-avatar-count"};function Ua(n,e,t,r,i,s){const o=m.resolveComponent("dt-icon"),l=m.resolveComponent("dt-presence");return m.openBlock(),m.createBlock(m.resolveDynamicComponent(t.clickable?"button":"div"),{id:t.id,class:m.normalizeClass(s.avatarClasses),"data-qa":"dt-avatar","aria-label":s.buttonAriaLabel,onClick:s.handleClick},{default:m.withCtx(()=>[m.createElementVNode("div",{ref:"canvas",class:m.normalizeClass([t.canvasClass,"d-avatar__canvas",{"d-avatar--image-loaded":i.imageLoadedSuccessfully}])},[s.showImage?(m.openBlock(),m.createElementBlock("img",{key:0,ref:"avatarImage",class:"d-avatar__image","data-qa":"dt-avatar-image",src:t.imageSrc,alt:t.imageAlt||t.fullName},null,8,Ka)):t.iconName?(m.openBlock(),m.createBlock(o,{key:1,name:t.iconName,size:t.iconSize||i.AVATAR_ICON_SIZES[t.size],class:m.normalizeClass([t.iconClass,i.AVATAR_KIND_MODIFIERS.icon]),"data-qa":"dt-avatar-icon"},null,8,["name","size","class"])):(m.openBlock(),m.createElementBlock("span",{key:2,class:m.normalizeClass([i.AVATAR_KIND_MODIFIERS.initials])},m.toDisplayString(i.formattedInitials),3))],2),t.overlayIcon||t.overlayText?(m.openBlock(),m.createElementBlock("div",{key:0,class:m.normalizeClass(s.overlayClasses)},[t.overlayIcon?(m.openBlock(),m.createBlock(o,{key:0,class:"d-avatar__overlay-icon",name:t.overlayIcon},null,8,["name"])):t.overlayText?(m.openBlock(),m.createElementBlock("p",qa,m.toDisplayString(t.overlayText),1)):m.createCommentVNode("",!0)],2)):m.createCommentVNode("",!0),s.showGroup?(m.openBlock(),m.createElementBlock("span",Wa,m.toDisplayString(s.formattedGroup),1)):m.createCommentVNode("",!0),t.presence&&!s.showGroup?(m.openBlock(),m.createBlock(l,m.mergeProps({key:2,presence:t.presence,class:["d-avatar__presence",i.AVATAR_PRESENCE_SIZE_MODIFIERS[t.size]]},t.presenceProps,{"data-qa":"dt-presence"}),null,16,["presence","class"])):m.createCommentVNode("",!0)]),_:1},8,["id","class","aria-label","onClick"])}const _o=N._export_sfc(ja,[["render",Ua]]),Ja={name:"DtLink",props:{kind:{type:String,default:"",validator(n){return X.LINK_VARIANTS.includes(n)}}},data(){return{LINK_KIND_MODIFIERS:X.LINK_KIND_MODIFIERS}}},Ga=["href"];function Ya(n,e,t,r,i,s){return m.openBlock(),m.createElementBlock("a",{class:m.normalizeClass(["d-link",i.LINK_KIND_MODIFIERS[t.kind]]),"data-qa":"dt-link",href:"href"in n.$attrs?n.$attrs.href:"javascript:void(0)"},[m.renderSlot(n.$slots,"default")],10,Ga)}const Fo=N._export_sfc(Ja,[["render",Ya]]),zo={props:{visuallyHiddenClose:{type:Boolean,default:!1},visuallyHiddenCloseLabel:{type:String,default:null}},watch:{$props:{immediate:!0,deep:!0,handler(){this.validateVisuallyHiddenCloseProps()}}},computed:{showVisuallyHiddenClose(){return this.visuallyHiddenClose&&this.visuallyHiddenCloseLabel!=null}},methods:{validateVisuallyHiddenCloseProps(){this.visuallyHiddenClose&&!this.visuallyHiddenCloseLabel&&console.error(`If visuallyHiddenClose prop is true, the component includes
2
- a visually hidden close button and you must set the visuallyHiddenCloseLabel prop.`)}}},Xa={name:"SrOnlyCloseButton",components:{DtIcon:X.DtIcon,DtButton:X.DtButton},props:{visuallyHiddenCloseLabel:{type:String,default:null}},emits:["close"],methods:{close(){this.$emit("close")}}};function Qa(n,e,t,r,i,s){const o=m.resolveComponent("dt-icon"),l=m.resolveComponent("dt-button");return m.openBlock(),m.createBlock(l,{id:"sr-only-close-button","data-qa":"dt-sr-only-close-button",class:"d-vi-visible-sr","aria-label":t.visuallyHiddenCloseLabel,onClick:s.close,onKeydown:m.withKeys(m.withModifiers(s.close,["prevent","stop"]),["space"])},{default:m.withCtx(()=>[m.createVNode(o,{name:"close"})]),_:1},8,["aria-label","onClick","onKeydown"])}const Ho=N._export_sfc(Xa,[["render",Qa]]),Vo=':not(:disabled):not([aria-disabled="true"]):not([role="presentation"])',Za=`${Vo}:not([tabindex="-1"])`,ec="button,[href],input,select,textarea,details,[tabindex]",$o={methods:{async getFirstFocusableElement(n){await this.$nextTick();const e=this._getFocusableElements(n,!0);return this._getFirstFocusElement(e)},async focusFirstElement(n){const e=await this.getFirstFocusableElement(n);e==null||e.focus({preventScroll:!0})},_getFirstFocusElement(n){if(!n.length)return;let e=n[0];return e.matches('[type="radio"]:not(:checked)')&&(e=n.find(t=>t.checked&&t.name===e.name)||e),e},_getFocusableElements(n=this.$el,e=!1){return n?[...n.querySelectorAll(ec)].filter(r=>{const i=window.getComputedStyle(r);return i.getPropertyValue("display")!=="none"&&i.getPropertyValue("visibility")!=="hidden"&&r.matches(e?Vo:Za)}):[]},focusTrappedTabPress(n,e){if(!(n.key==="Tab"))return;const r=this._getFocusableElements(e);if(!r.length){n.preventDefault();return}const i=this._getFirstFocusElement(r),s=r[r.length-1];n.shiftKey?document.activeElement===i&&(s.focus(),n.preventDefault()):document.activeElement===s&&(i.focus(),n.preventDefault())}}},gn={DEFAULT:"default",CUSTOM:"custom"},Lt={ARROW_KEYS:"arrow-keys",TAB:"tab",NONE:"none"},tc={name:"DtItemLayout",props:{as:{type:String,default:"div"}}},nc={key:0,"data-qa":"dt-item-layout-left-wrapper",class:"dt-item-layout--left"},rc={"data-qa":"dt-item-layout-content-wrapper",class:"dt-item-layout--content"},ic={key:0,"data-qa":"dt-item-layout-title-wrapper",class:"dt-item-layout--title"},sc={key:2,"data-qa":"dt-item-layout-bottom-wrapper",class:"dt-item-layout--bottom"},oc={key:1,"data-qa":"dt-item-layout-right-wrapper",class:"dt-item-layout--right"},lc={key:2,"data-qa":"dt-item-layout-selected-wrapper",class:"dt-item-layout--selected"};function ac(n,e,t,r,i,s){return m.openBlock(),m.createBlock(m.resolveDynamicComponent(t.as),{class:"dt-item-layout"},{default:m.withCtx(()=>[n.$slots.left?(m.openBlock(),m.createElementBlock("section",nc,[m.renderSlot(n.$slots,"left",{},void 0,!0)])):m.createCommentVNode("",!0),m.createElementVNode("section",rc,[n.$slots.default?(m.openBlock(),m.createElementBlock("div",ic,[m.renderSlot(n.$slots,"default",{},void 0,!0)])):m.createCommentVNode("",!0),n.$slots.subtitle?(m.openBlock(),m.createElementBlock("div",{key:1,"data-qa":"dt-item-layout-subtitle-wrapper",class:m.normalizeClass(["dt-item-layout--subtitle",{"dt-item-layout--subtitle--with-title":n.$slots.default}])},[m.renderSlot(n.$slots,"subtitle",{},void 0,!0)],2)):m.createCommentVNode("",!0),n.$slots.bottom?(m.openBlock(),m.createElementBlock("div",sc,[m.renderSlot(n.$slots,"bottom",{},void 0,!0)])):m.createCommentVNode("",!0)]),n.$slots.right?(m.openBlock(),m.createElementBlock("section",oc,[m.renderSlot(n.$slots,"right",{},void 0,!0)])):m.createCommentVNode("",!0),n.$slots.selected?(m.openBlock(),m.createElementBlock("section",lc,[m.renderSlot(n.$slots,"selected",{},void 0,!0)])):m.createCommentVNode("",!0)]),_:3})}const ei=N._export_sfc(tc,[["render",ac],["__scopeId","data-v-411cb81e"]]),cc={name:"DtListItem",components:{DtItemLayout:ei,DtIcon:X.DtIcon},inject:{highlightId:{default:null}},props:{id:{type:String,default(){return N.utils.getUniqueString()}},role:{type:String,default:"listitem"},elementType:{type:String,default:"li"},type:{type:String,default:gn.DEFAULT,validator:n=>Object.values(gn).includes(n)},navigationType:{type:String,default:Lt.NONE,validator:n=>Object.values(Lt).includes(n)},selected:{type:Boolean,default:!1}},emits:["keydown","mousemove","mouseleave","mousedown"],data(){return{injected:!1,mouseHighlighted:!1}},computed:{listItemType(){switch(this.type){case gn.DEFAULT:return ei;default:return null}},listItemListeners(){return{keydown:n=>{["enter","space"].includes(n.code.toLowerCase())&&this.onClick(n),this.$emit("keydown",n)},mousemove:n=>{this.onMouseHover(n),this.$emit("mousemove",n)},mouseleave:n=>{this.onMouseLeave(n),this.$emit("mouseleave",n)}}},isHighlighted(){return this.isHoverable?this.highlightId&&this.highlightId()?this.id===this.highlightId():this.mouseHighlighted:!1},isFocusable(){return this.navigationType===Lt.TAB},isHoverable(){return this.navigationType!==Lt.NONE}},methods:{onClick(n){this.$emit("click",n)},onMouseHover(){this.mouseHighlighted=!0},onMouseLeave(){this.mouseHighlighted=!1}}};function dc(n,e,t,r,i,s){const o=m.resolveComponent("dt-icon");return m.openBlock(),m.createBlock(m.resolveDynamicComponent(t.elementType),m.mergeProps({id:t.id,class:["dt-list-item",{"dt-list-item--focusable":s.isFocusable,"dt-list-item--highlighted":s.isHighlighted,"dt-list-item--static":!s.isHoverable}],tabindex:s.isFocusable?0:-1,role:t.role,"aria-selected":s.isHighlighted},m.toHandlers(s.listItemListeners)),{default:m.withCtx(()=>[s.listItemType?(m.openBlock(),m.createBlock(m.resolveDynamicComponent(s.listItemType),{key:0},m.createSlots({_:2},[m.renderList(n.$slots,(l,a)=>({name:a,fn:m.withCtx(()=>[m.renderSlot(n.$slots,a)])})),t.selected?{name:"selected",fn:m.withCtx(()=>[m.createVNode(o,{name:"check",size:"400",class:"dt-list-item--selected-icon"})]),key:"0"}:void 0]),1024)):m.renderSlot(n.$slots,"default",{key:1})]),_:3},16,["id","class","tabindex","role","aria-selected"])}const jo=N._export_sfc(cc,[["render",dc]]),Ge={default:"column",column:"column",row:"row","row-reverse":"row-reverse","column-reverse":"column-reverse"},Ai=["sm","md","lg","xl"],dr=["0","100","200","300","400","450","500","600"],ti={none:void 0,small:"d-p4",medium:"d-p8",large:"d-p16"},Ko={none:void 0,small:"d-pl4",medium:"d-pl8",large:"d-pl16"},qo=["dialog","menu","listbox","tree","grid"],Wo=["","anchor"],Uo=["none","dialog","first"],Jo=["parent","body"],Go=[...N.TIPPY_STICKY_VALUES],uc=[...N.BASE_TIPPY_DIRECTIONS],hc={name:"PopoverHeaderFooter",components:{DtButton:X.DtButton,DtIcon:X.DtIcon},props:{type:{type:String,validator:function(n){return["header","footer"].includes(n)}},contentClass:{type:[String,Array,Object],default:""},showCloseButton:{type:Boolean,default:!1},closeButtonProps:{type:Object,default:()=>{}}},emits:["close"],data(){return{hasSlotContent:N.hasSlotContent}},methods:{focusCloseButton(){var e;const n=(e=this.$refs["popover__close-button"])==null?void 0:e.$el;n==null||n.focus()}}};function fc(n,e,t,r,i,s){const o=m.resolveComponent("dt-icon"),l=m.resolveComponent("dt-button");return m.openBlock(),m.createElementBlock("div",{"data-qa":"dt-popover-header-footer",class:m.normalizeClass({"d-popover__header":t.type==="header","d-popover__footer":t.type==="footer"})},[i.hasSlotContent(n.$slots.content)?(m.openBlock(),m.createElementBlock("div",{key:0,"data-qa":"dt-popover-header-footer-content",class:m.normalizeClass([{"d-popover__header__content":t.type==="header","d-popover__footer__content":t.type==="footer"},t.contentClass])},[m.renderSlot(n.$slots,"content")],2)):m.createCommentVNode("",!0),t.showCloseButton?(m.openBlock(),m.createBlock(l,m.mergeProps({key:1,ref:"popover__close-button","data-qa":"dt-popover-close",class:{"d-popover__header__close-button":t.type==="header","d-popover__footer__close-button":t.type==="footer"},importance:"outlined",kind:"muted",circle:""},t.closeButtonProps,{onClick:e[0]||(e[0]=a=>n.$emit("close"))}),{icon:m.withCtx(()=>[m.createVNode(o,{name:"close",size:"300"})]),_:1},16,["class"])):m.createCommentVNode("",!0)],2)}const pc=N._export_sfc(hc,[["render",fc]]),mc={name:"DtPopover",components:{SrOnlyCloseButton:Ho,DtLazyShow:N.DtLazyShow,PopoverHeaderFooter:pc},mixins:[$o,zo],props:{open:{type:Boolean,default:null},openOnContext:{type:Boolean,default:!1},elementType:{type:String,default:"div"},transition:{type:String,default:"fade"},role:{type:String,default:"dialog",validator:n=>qo.includes(n)},ariaLabelledby:{type:String,default:null},ariaLabel:{type:String,default:null},closeButtonProps:{type:Object,default:()=>({})},padding:{type:String,default:"large",validator:n=>Object.keys(ti).some(e=>e===n)},contentClass:{type:[String,Array,Object],default:""},contentWidth:{type:String,default:"",validator:n=>Wo.includes(n)},contentAppear:{type:Boolean,default:null},contentTabindex:{type:Number||null,default:-1},externalAnchor:{type:String,default:""},id:{type:String,default(){return N.getUniqueString()}},offset:{type:Array,default:()=>[0,4]},hideOnClick:{type:Boolean,default:!0},modal:{type:Boolean,default:!0},fallbackPlacements:{type:Array,default:()=>["auto"]},placement:{type:String,default:"bottom-end"},tether:{type:Boolean,default:!0},sticky:{type:[Boolean,String],default:!1,validator:n=>Go.includes(n)},maxHeight:{type:String,default:""},maxWidth:{type:String,default:""},showCloseButton:{type:Boolean,default:!1},headerClass:{type:[String,Array,Object],default:""},footerClass:{type:[String,Array,Object],default:""},dialogClass:{type:[String,Array,Object],default:""},initialFocusElement:{type:[String,HTMLElement],default:"first",validator:n=>Uo.includes(n)||n instanceof HTMLElement||n.startsWith("#")},openWithArrowKeys:{type:Boolean,default:!1},appendTo:{type:[HTMLElement,String],default:"body",validator:n=>Jo.includes(n)||n instanceof HTMLElement},hovercard:{type:Boolean,default:!1},timer:{type:[Object,null],default:null,validator:n=>n===null||n.enter&&n.leave&&Object.keys(n).includes("current")}},emits:["keydown","update:open","opened"],data(){return{POPOVER_PADDING_CLASSES:ti,POPOVER_HEADER_FOOTER_PADDING_CLASSES:Ko,intersectionObserver:null,isOutsideViewport:!1,isOpen:!1,toAppear:!1,anchorEl:null,popoverContentEl:null,hasSlotContent:N.hasSlotContent,inTimer:null,outTimer:null}},computed:{popoverListeners(){return{keydown:n=>{this.onKeydown(n)},"after-leave":n=>{this.onLeaveTransitionComplete()},"after-enter":n=>{this.onEnterTransitionComplete()}}},calculatedMaxHeight(){return this.isOutsideViewport&&this.modal?"calc(100vh - var(--dt-space-300))":this.maxHeight},labelledBy(){return this.ariaLabelledby||!this.ariaLabel&&N.getUniqueString("DtPopover__anchor")},currentHovercard(){var n;return(n=this.timer)==null?void 0:n.current}},watch:{$props:{immediate:!0,deep:!0,handler(){this.validateProps()}},modal(n){var e;(e=this.tip)==null||e.setProps({zIndex:n?650:this.calculateAnchorZindex()})},offset(n){var e;(e=this.tip)==null||e.setProps({offset:n})},sticky(n){var e;(e=this.tip)==null||e.setProps({sticky:n})},fallbackPlacements(){var n;(n=this.tip)==null||n.setProps({popperOptions:this.popperOptions()})},tether(){var n;(n=this.tip)==null||n.setProps({popperOptions:this.popperOptions()})},placement(n){var e;(e=this.tip)==null||e.setProps({placement:n})},open:{handler:function(n){n!==null&&(this.isOpen=n),n===!0&&(this.toAppear=!0)},immediate:!0},contentAppear:{handler:function(n){n!==null&&(this.toAppear=n)}},isOpen(n,e){n?(this.initTippyInstance(),this.tip.show()):!n&&e!==n&&(this.removeEventListeners(),this.tip.hide())},currentHovercard(){this.hovercard&&this.timer&&(this.currentHovercard===this.id?this.isOpen=!0:this.isOpen=!1)}},mounted(){const n=this.externalAnchor?this.$refs.anchor.getRootNode().querySelector(`#${this.externalAnchor}`):null;this.anchorEl=n??this.$refs.anchor.children[0],this.popoverContentEl=this.$refs.content.$el,this.isOpen&&(this.initTippyInstance(),this.tip.show()),this.intersectionObserver=new IntersectionObserver(this.hasIntersectedViewport),this.intersectionObserver.observe(this.popoverContentEl)},beforeUnmount(){var n;(n=this.tip)==null||n.destroy(),this.intersectionObserver.disconnect(),this.removeReferences(),this.removeEventListeners()},methods:{hasIntersectedViewport(n){var r;const e=(r=n==null?void 0:n[0])==null?void 0:r.target;if(!e)return;const t=N.isOutOfViewPort(e);this.isOutsideViewport=t.bottom||t.top},popperOptions(){return N.getPopperOptions({fallbackPlacements:this.fallbackPlacements,tether:this.tether,hasHideModifierEnabled:!0})},validateProps(){this.modal&&this.initialFocusElement==="none"&&console.error('If the popover is modal you must set the initialFocusElement prop. Possible values: "dialog", "first", HTMLElement')},calculateAnchorZindex(){var n;return this.$el.getRootNode().querySelector('.d-modal[aria-hidden="false"], .d-modal--transparent[aria-hidden="false"]')||(n=this.anchorEl)!=null&&n.closest(".d-zi-drawer")?650:300},defaultToggleOpen(n){var e,t,r;if(!this.hovercard&&!this.openOnContext&&(this.open===null||this.open===void 0)){if(!((e=this.anchorEl)!=null&&e.contains(n.target))&&!((t=this.anchorEl)!=null&&t.isEqualNode(n.target))||(r=this.anchorEl)!=null&&r.disabled)return;this.toggleOpen()}},async onContext(n){this.openOnContext&&(n.preventDefault(),this.isOpen=!0,await this.$nextTick(),this.tip.setProps({placement:"right-start",getReferenceClientRect:()=>({width:0,height:0,top:n.clientY,bottom:n.clientY,left:n.clientX,right:n.clientX})}))},toggleOpen(){this.isOpen=!this.isOpen},onArrowKeyPress(n){var e;this.open===null&&(this.openWithArrowKeys&&((e=this.anchorEl)!=null&&e.contains(n.target))&&(this.isOpen||(this.isOpen=!0)),this.$emit("keydown",n))},addEventListeners(){window.addEventListener("dt-popover-close",this.closePopover),this.contentWidth==="anchor"&&window.addEventListener("resize",this.onResize)},removeEventListeners(){window.removeEventListener("dt-popover-close",this.closePopover),this.contentWidth==="anchor"&&window.removeEventListener("resize",this.onResize)},closePopover(){this.isOpen=!1},preventScrolling(){var n;if(this.modal){const e=(n=this.anchorEl)==null?void 0:n.closest("body, .tippy-box");e.tagName.toLowerCase()==="body"?(e.classList.add("d-of-hidden"),this.tip.setProps({offset:this.offset})):e.classList.add("d-zi-popover")}},enableScrolling(){var e,t;const n=(e=this.anchorEl)==null?void 0:e.closest("body, .tippy-box");n&&(((t=n.tagName)==null?void 0:t.toLowerCase())==="body"?(n.classList.remove("d-of-hidden"),this.tip.setProps({offset:this.offset})):n.classList.remove("d-zi-popover"))},removeReferences(){this.anchorEl=null,this.popoverContentEl=null,this.tip=null},async onShow(){this.contentWidth==="anchor"&&await this.setPopoverContentAnchorWidth(),this.contentWidth===null&&(this.popoverContentEl.style.width="auto"),this.addEventListeners()},async onLeaveTransitionComplete(){var n;this.modal&&(await this.focusFirstElement(this.$refs.anchor),await this.$nextTick(),this.enableScrolling()),(n=this.tip)==null||n.unmount(),this.$emit("opened",!1),this.open!==null&&this.$emit("update:open",!1)},async onEnterTransitionComplete(){this.focusInitialElement(),await this.$nextTick(),this.preventScrolling(),this.$emit("opened",!0,this.$refs.popover__content),this.open!==null&&this.$emit("update:open",!0)},focusInitialElement(){this.initialFocusElement==="dialog"&&this.$refs.content.$el.focus(),this.initialFocusElement.startsWith("#")&&this.focusInitialElementById(),this.initialFocusElement==="first"&&this.focusFirstElementIfNeeded(this.$refs.popover__content),this.initialFocusElement instanceof HTMLElement&&this.initialFocusElement.focus()},focusInitialElementById(){var e,t,r;const n=(t=(e=this.$refs.content)==null?void 0:e.$el)==null?void 0:t.querySelector(this.initialFocusElement);n?n.focus():console.warn('Could not find the element specified in dt-popover prop "initialFocusElement". Defaulting to focusing the dialog.'),n?n.focus():(r=this.$refs.content)==null||r.$el.focus()},onResize(){this.closePopover()},onClickOutside(){if(!this.hideOnClick)return;this.popoverContentEl.querySelector(".d-popover__anchor--opened")||this.closePopover()},onKeydown(n){n.key==="Tab"&&this.modal&&this.focusTrappedTabPress(n,this.popoverContentEl),n.key==="Escape"&&this.closePopover(),this.$emit("keydown",n)},async setPopoverContentAnchorWidth(){var n;await this.$nextTick(),this.popoverContentEl.style.width=`${(n=this.anchorEl)==null?void 0:n.clientWidth}px`},focusFirstElementIfNeeded(n){var t,r;this._getFocusableElements(n,!0).length!==0?this.focusFirstElement(n):this.showCloseButton?(t=this.$refs.popover__header)==null||t.focusCloseButton():(r=this.$refs.content)==null||r.$el.focus()},initTippyInstance(){var n,e;this.tip=N.createTippy(this.anchorEl,{popperOptions:this.popperOptions(),contentElement:this.popoverContentEl,placement:this.placement,offset:this.offset,sticky:this.sticky,appendTo:this.appendTo==="body"?(e=(n=this.anchorEl)==null?void 0:n.getRootNode())==null?void 0:e.querySelector("body"):this.appendTo,interactive:!0,trigger:"manual",hideOnClick:!1,zIndex:this.modal?650:this.calculateAnchorZindex(),onClickOutside:this.onClickOutside,onShow:this.onShow})},setInTimer(){this.inTimer=setTimeout(()=>{this.isOpen=!0},N.TOOLTIP_DELAY_MS)},setOutTimer(){this.outTimer=setTimeout(()=>{this.isOpen=!1},N.TOOLTIP_DELAY_MS)},onEnterAnchor(){this.hovercard&&(this.timer?this.timer.enter(this.id):(clearTimeout(this.outTimer),this.setInTimer()))},onLeaveAnchor(){this.hovercard&&(this.timer?this.timer.leave():(clearTimeout(this.inTimer),this.setOutTimer()))},onEnterContent(){this.hovercard&&(this.timer?this.timer.enter(this.id):clearTimeout(this.outTimer))},onLeaveContent(){this.hovercard&&(this.timer?this.timer.leave():this.setOutTimer())}}},gc=["aria-hidden"],yc=["id","data-qa","tabindex"],bc=["data-qa"];function kc(n,e,t,r,i,s){const o=m.resolveComponent("popover-header-footer"),l=m.resolveComponent("sr-only-close-button"),a=m.resolveComponent("dt-lazy-show");return m.openBlock(),m.createElementBlock("div",null,[t.modal&&i.isOpen?(m.openBlock(),m.createBlock(m.Teleport,{key:0,to:"body"},[m.createElementVNode("div",{class:"d-modal--transparent","aria-hidden":t.modal&&i.isOpen?"false":"true",onClick:e[0]||(e[0]=m.withModifiers(()=>{},["prevent","stop"]))},null,8,gc)])):m.createCommentVNode("",!0),(m.openBlock(),m.createBlock(m.resolveDynamicComponent(t.elementType),{ref:"popover",class:m.normalizeClass(["d-popover",{"d-popover__anchor--opened":i.isOpen}]),"data-qa":"dt-popover-container"},{default:m.withCtx(()=>[m.createElementVNode("div",{id:!t.ariaLabelledby&&s.labelledBy,ref:"anchor","data-qa":n.$attrs["data-qa"]?`${n.$attrs["data-qa"]}-anchor`:"dt-popover-anchor",tabindex:t.openOnContext?0:void 0,onClickCapture:e[1]||(e[1]=(...c)=>s.defaultToggleOpen&&s.defaultToggleOpen(...c)),onContextmenu:e[2]||(e[2]=(...c)=>s.onContext&&s.onContext(...c)),onKeydown:[e[3]||(e[3]=m.withKeys(m.withModifiers((...c)=>s.onArrowKeyPress&&s.onArrowKeyPress(...c),["prevent"]),["up"])),e[4]||(e[4]=m.withKeys(m.withModifiers((...c)=>s.onArrowKeyPress&&s.onArrowKeyPress(...c),["prevent"]),["down"])),e[6]||(e[6]=m.withKeys(c=>n.$emit("keydown",c),["enter"])),e[7]||(e[7]=m.withKeys(c=>n.$emit("keydown",c),["space"]))],onKeydownCapture:e[5]||(e[5]=m.withKeys((...c)=>s.closePopover&&s.closePopover(...c),["escape"])),onMouseenter:e[8]||(e[8]=(...c)=>s.onEnterAnchor&&s.onEnterAnchor(...c)),onMouseleave:e[9]||(e[9]=(...c)=>s.onLeaveAnchor&&s.onLeaveAnchor(...c))},[m.renderSlot(n.$slots,"anchor",{attrs:{"aria-expanded":i.isOpen.toString(),"aria-controls":t.id,"aria-haspopup":t.role}})],40,yc),m.createVNode(a,m.mergeProps({id:t.id,ref:"content",role:t.role,"data-qa":n.$attrs["data-qa"]?`${n.$attrs["data-qa"]}__dialog`:"dt-popover","aria-hidden":`${!i.isOpen}`,"aria-labelledby":s.labelledBy,"aria-label":t.ariaLabel,"aria-modal":`${!t.modal}`,transition:t.transition,show:i.isOpen,appear:i.toAppear,class:["d-popover__dialog",{"d-popover__dialog--modal":t.modal},t.dialogClass],style:{"max-height":s.calculatedMaxHeight,"max-width":t.maxWidth},css:n.$attrs.css,tabindex:t.contentTabindex},m.toHandlers(s.popoverListeners),{onMouseenter:s.onEnterContent,onMouseleave:s.onLeaveContent}),{default:m.withCtx(()=>[i.hasSlotContent(n.$slots.headerContent)||t.showCloseButton?(m.openBlock(),m.createBlock(o,{key:0,ref:"popover__header",class:m.normalizeClass(i.POPOVER_HEADER_FOOTER_PADDING_CLASSES[t.padding]),"content-class":t.headerClass,type:"header","show-close-button":t.showCloseButton,"close-button-props":t.closeButtonProps,onClose:s.closePopover},{content:m.withCtx(()=>[m.renderSlot(n.$slots,"headerContent",{close:s.closePopover})]),_:3},8,["class","content-class","show-close-button","close-button-props","onClose"])):m.createCommentVNode("",!0),m.createElementVNode("div",{ref:"popover__content","data-qa":n.$attrs["data-qa"]?`${n.$attrs["data-qa"]}-content`:"dt-popover-content",class:m.normalizeClass(["d-popover__content",i.POPOVER_PADDING_CLASSES[t.padding],t.contentClass])},[m.renderSlot(n.$slots,"content",{close:s.closePopover})],10,bc),i.hasSlotContent(n.$slots.footerContent)?(m.openBlock(),m.createBlock(o,{key:1,ref:"popover__footer",type:"footer",class:m.normalizeClass(i.POPOVER_HEADER_FOOTER_PADDING_CLASSES[t.padding]),"content-class":t.footerClass},{content:m.withCtx(()=>[m.renderSlot(n.$slots,"footerContent",{close:s.closePopover})]),_:3},8,["class","content-class"])):m.createCommentVNode("",!0),n.showVisuallyHiddenClose?(m.openBlock(),m.createBlock(l,{key:2,"visually-hidden-close-label":n.visuallyHiddenCloseLabel,onClose:s.closePopover},null,8,["visually-hidden-close-label","onClose"])):m.createCommentVNode("",!0)]),_:3},16,["id","role","data-qa","aria-hidden","aria-labelledby","aria-label","aria-modal","transition","show","appear","class","style","css","tabindex","onMouseenter","onMouseleave"])]),_:3},8,["class"]))])}const Sc=N._export_sfc(mc,[["render",kc]]);function ss(n){return n===Ge.default}function ls(n){if(Ut(n)==="string")return ss(n)?null:Ge[n];if(Ut(n)==="object"){const{default:e}=n;return ss(e)?null:Ge[e]}else return null}function Ut(n){return typeof n}function xc(n){return ls(n)?`d-stack--${Ge[ls(n)]}`:null}function Cc(n){return Ut(n)==="object"?[...Ai.map(e=>n[e]?`d-stack--${e}--${n[e]}`:null)]:null}function Ec(n){return dr.includes(n)?`d-stack--gap-${n}`:null}function Tc(n){if(Ut(n)==="string")return Object.keys(Ge).includes(n);if(Ut(n)==="object"){const{default:e}=n;return Object.keys(Ge).includes(e)}else return null}function Oc(n){return dr.includes(n)}const Mc={name:"DtStack",props:{direction:{type:[String,Object],default:"column",validator:n=>Tc(n)},as:{type:String,default:"div"},gap:{type:String,default:"0",validator:n=>Oc(n)}},data(){return{DT_STACK_DIRECTION:Ge,DT_STACK_GAP:dr,DT_STACK_RESPONSIVE_BREAKPOINTS:Ai}},computed:{stackGap(){return Ec(this.gap)},defaultDirection(){return xc(this.direction)},stackResponsive(){return Cc(this.direction)}}};function wc(n,e,t,r,i,s){return m.openBlock(),m.createBlock(m.resolveDynamicComponent(t.as),{class:m.normalizeClass(["d-stack",s.defaultDirection,s.stackResponsive,s.stackGap])},{default:m.withCtx(()=>[m.renderSlot(n.$slots,"default")]),_:3},8,["class"])}const Ni=N._export_sfc(Mc,[["render",wc]]);function K(n){this.content=n}K.prototype={constructor:K,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),s=r.content.slice();return i==-1?s.push(t||n,e):(s[i+1]=e,t&&(s[i]=t)),new K(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new K(t)},addToStart:function(n,e){return new K([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new K(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),s=r.find(n);return i.splice(s==-1?i.length:s,0,e,t),new K(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=K.from(n),n.size?new K(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=K.from(n),n.size?new K(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=K.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};K.from=function(n){if(n instanceof K)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new K(e)};function Yo(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=Yo(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Xo(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,d=Math.min(o.text.length,l.text.length);for(;c<d&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=Xo(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class k{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,s){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,i+l,s||null,o)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),r,i+d)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{l.isText?(s+=l.text.slice(Math.max(e,a)-a,t-a),o=!r):l.isLeaf?(i?s+=typeof i=="function"?i(l):i:l.type.spec.leafText&&(s+=l.type.spec.leafText(l)),o=!r):!o&&l.isBlock&&(s+=r,o=!0)},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new k(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),i+=l.nodeSize),o=a}return new k(r,i)}cutByIndex(e,t){return e==t?k.empty:e==0&&t==this.content.length?this:new k(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new k(i,s)}addToStart(e){return new k([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new k(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return Yo(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Xo(this,e,t,r)}findIndex(e,t=-1){if(e==0)return an(0,e);if(e==this.size)return an(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let s=this.child(r),o=i+s.nodeSize;if(o>=e)return o==e||t>0?an(r+1,o):an(r,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return k.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new k(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return k.empty;let t,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new k(t||e,r)}static from(e){if(!e)return k.empty;if(e instanceof k)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new k([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}k.empty=new k([],0);const wr={index:0,offset:0};function an(n,e){return wr.index=n,wr.offset=e,wr}function xn(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!xn(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!xn(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let _=class ni{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&xn(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return ni.none;if(e instanceof ni)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};_.none=[];class Cn extends Error{}class x{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Zo(this.content,e+this.openStart,t);return r&&new x(r,this.openStart,this.openEnd)}removeBetween(e,t){return new x(Qo(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return x.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new x(k.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new x(e,r,i)}}x.empty=new x(k.empty,0,0);function Qo(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(i==e||s.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(Qo(s.content,e-i-1,t-i-1)))}function Zo(n,e,t,r){let{index:i,offset:s}=n.findIndex(e),o=n.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Zo(o.content,e-s-1,t);return l&&n.replaceChild(i,o.copy(l))}function vc(n,e,t){if(t.openStart>n.depth)throw new Cn("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Cn("Inconsistent open depths");return el(n,e,t,0)}function el(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let o=el(n,e,t,r+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return ot(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Ac(t,n);return ot(s,nl(n,o,l,e,r))}else return ot(s,En(n,e,r))}function tl(n,e){if(!e.type.compatibleContent(n.type))throw new Cn("Cannot join "+e.type.name+" onto "+n.type.name)}function ri(n,e,t){let r=n.node(t);return tl(r,e.node(t)),r}function st(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function zt(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(st(n.nodeAfter,r),s++));for(let l=s;l<o;l++)st(i.child(l),r);e&&e.depth==t&&e.textOffset&&st(e.nodeBefore,r)}function ot(n,e){return n.type.checkContent(e),n.copy(e)}function nl(n,e,t,r,i){let s=n.depth>i&&ri(n,e,i+1),o=r.depth>i&&ri(t,r,i+1),l=[];return zt(null,n,i,l),s&&o&&e.index(i)==t.index(i)?(tl(s,o),st(ot(s,nl(n,e,t,r,i+1)),l)):(s&&st(ot(s,En(n,e,i+1)),l),zt(e,t,i,l),o&&st(ot(o,En(t,r,i+1)),l)),zt(r,null,i,l),new k(l)}function En(n,e,t){let r=[];if(zt(null,n,t,r),n.depth>t){let i=ri(n,e,t+1);st(ot(i,En(n,e,t+1)),r)}return zt(e,null,t,r),new k(r)}function Ac(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(k.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class Jt{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return _.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let l=r;r=i,i=l}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Tn(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(r.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new Jt(t,r,s)}static resolveCached(e,t){for(let i=0;i<vr.length;i++){let s=vr[i];if(s.pos==t&&s.doc==e)return s}let r=vr[Ar]=Jt.resolve(e,t);return Ar=(Ar+1)%Nc,r}}let vr=[],Ar=0,Nc=12;class Tn{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Dc=Object.create(null);let lt=class ii{constructor(e,t,r,i=_.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||k.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,i=0){this.content.nodesBetween(e,t,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,i){return this.content.textBetween(e,t,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&xn(this.attrs,t||e.defaultAttrs||Dc)&&_.sameSet(this.marks,r||_.none)}copy(e=null){return e==this.content?this:new ii(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ii(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return x.empty;let i=this.resolve(e),s=this.resolve(t),o=r?0:i.sharedDepth(t),l=i.start(o),c=i.node(o).content.cut(i.pos-l,s.pos-l);return new x(c,i.depth-o,s.depth-o)}replace(e,t,r){return vc(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return Jt.resolveCached(this,e)}resolveNoCache(e){return Jt.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),rl(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=k.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;a<s;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content);let e=_.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!_.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=k.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,i,r)}};lt.prototype.text=void 0;class On extends lt{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):rl(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new On(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new On(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function rl(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class dt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Ic(e,t);if(r.next==null)return dt.empty;let i=il(r);r.next&&r.err("Unexpected trailing text");let s=zc(Fc(i));return Hc(s,r),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let i=this;for(let s=t;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function s(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return k.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:d,next:u}=o.next[c];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(u)==-1){i.push(u);let h=s(u,l.concat(d));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let l=i;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:a}=s.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!i.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
2
+ a visually hidden close button and you must set the visuallyHiddenCloseLabel prop.`)}}},Xa={name:"SrOnlyCloseButton",components:{DtIcon:X.DtIcon,DtButton:X.DtButton},props:{visuallyHiddenCloseLabel:{type:String,default:null}},emits:["close"],methods:{close(){this.$emit("close")}}};function Qa(n,e,t,r,i,s){const o=m.resolveComponent("dt-icon"),l=m.resolveComponent("dt-button");return m.openBlock(),m.createBlock(l,{id:"sr-only-close-button","data-qa":"dt-sr-only-close-button",class:"d-vi-visible-sr","aria-label":t.visuallyHiddenCloseLabel,onClick:s.close,onKeydown:m.withKeys(m.withModifiers(s.close,["prevent","stop"]),["space"])},{default:m.withCtx(()=>[m.createVNode(o,{name:"close"})]),_:1},8,["aria-label","onClick","onKeydown"])}const Ho=N._export_sfc(Xa,[["render",Qa]]),Vo=':not(:disabled):not([aria-disabled="true"]):not([role="presentation"])',Za=`${Vo}:not([tabindex="-1"])`,ec="button,[href],input,select,textarea,details,[tabindex]",$o={methods:{async getFirstFocusableElement(n){await this.$nextTick();const e=this._getFocusableElements(n,!0);return this._getFirstFocusElement(e)},async focusFirstElement(n){const e=await this.getFirstFocusableElement(n);e==null||e.focus({preventScroll:!0})},_getFirstFocusElement(n){if(!n.length)return;let e=n[0];return e.matches('[type="radio"]:not(:checked)')&&(e=n.find(t=>t.checked&&t.name===e.name)||e),e},_getFocusableElements(n=this.$el,e=!1){return n?[...n.querySelectorAll(ec)].filter(r=>{const i=window.getComputedStyle(r);return i.getPropertyValue("display")!=="none"&&i.getPropertyValue("visibility")!=="hidden"&&r.matches(e?Vo:Za)}):[]},focusTrappedTabPress(n,e){if(!(n.key==="Tab"))return;const r=this._getFocusableElements(e);if(!r.length){n.preventDefault();return}const i=this._getFirstFocusElement(r),s=r[r.length-1];n.shiftKey?document.activeElement===i&&(s.focus(),n.preventDefault()):document.activeElement===s&&(i.focus(),n.preventDefault())}}},gn={DEFAULT:"default",CUSTOM:"custom"},Lt={ARROW_KEYS:"arrow-keys",TAB:"tab",NONE:"none"},tc={name:"DtItemLayout",props:{as:{type:String,default:"div"}}},nc={key:0,"data-qa":"dt-item-layout-left-wrapper",class:"dt-item-layout--left"},rc={"data-qa":"dt-item-layout-content-wrapper",class:"dt-item-layout--content"},ic={key:0,"data-qa":"dt-item-layout-title-wrapper",class:"dt-item-layout--title"},sc={key:2,"data-qa":"dt-item-layout-bottom-wrapper",class:"dt-item-layout--bottom"},oc={key:1,"data-qa":"dt-item-layout-right-wrapper",class:"dt-item-layout--right"},lc={key:2,"data-qa":"dt-item-layout-selected-wrapper",class:"dt-item-layout--selected"};function ac(n,e,t,r,i,s){return m.openBlock(),m.createBlock(m.resolveDynamicComponent(t.as),{class:"dt-item-layout"},{default:m.withCtx(()=>[n.$slots.left?(m.openBlock(),m.createElementBlock("section",nc,[m.renderSlot(n.$slots,"left",{},void 0,!0)])):m.createCommentVNode("",!0),m.createElementVNode("section",rc,[n.$slots.default?(m.openBlock(),m.createElementBlock("div",ic,[m.renderSlot(n.$slots,"default",{},void 0,!0)])):m.createCommentVNode("",!0),n.$slots.subtitle?(m.openBlock(),m.createElementBlock("div",{key:1,"data-qa":"dt-item-layout-subtitle-wrapper",class:m.normalizeClass(["dt-item-layout--subtitle",{"dt-item-layout--subtitle--with-title":n.$slots.default}])},[m.renderSlot(n.$slots,"subtitle",{},void 0,!0)],2)):m.createCommentVNode("",!0),n.$slots.bottom?(m.openBlock(),m.createElementBlock("div",sc,[m.renderSlot(n.$slots,"bottom",{},void 0,!0)])):m.createCommentVNode("",!0)]),n.$slots.right?(m.openBlock(),m.createElementBlock("section",oc,[m.renderSlot(n.$slots,"right",{},void 0,!0)])):m.createCommentVNode("",!0),n.$slots.selected?(m.openBlock(),m.createElementBlock("section",lc,[m.renderSlot(n.$slots,"selected",{},void 0,!0)])):m.createCommentVNode("",!0)]),_:3})}const ei=N._export_sfc(tc,[["render",ac],["__scopeId","data-v-411cb81e"]]),cc={name:"DtListItem",components:{DtItemLayout:ei,DtIcon:X.DtIcon},inject:{highlightId:{default:null}},props:{id:{type:String,default(){return N.utils.getUniqueString()}},role:{type:String,default:"listitem"},elementType:{type:String,default:"li"},type:{type:String,default:gn.DEFAULT,validator:n=>Object.values(gn).includes(n)},navigationType:{type:String,default:Lt.NONE,validator:n=>Object.values(Lt).includes(n)},selected:{type:Boolean,default:!1}},emits:["keydown","mousemove","mouseleave","mousedown"],data(){return{injected:!1,mouseHighlighted:!1}},computed:{listItemType(){switch(this.type){case gn.DEFAULT:return ei;default:return null}},listItemListeners(){return{keydown:n=>{["enter","space"].includes(n.code.toLowerCase())&&this.onClick(n),this.$emit("keydown",n)},mousemove:n=>{this.onMouseHover(n),this.$emit("mousemove",n)},mouseleave:n=>{this.onMouseLeave(n),this.$emit("mouseleave",n)}}},isHighlighted(){return this.isHoverable?this.highlightId&&this.highlightId()?this.id===this.highlightId():this.mouseHighlighted:!1},isFocusable(){return this.navigationType===Lt.TAB},isHoverable(){return this.navigationType!==Lt.NONE}},methods:{onClick(n){this.$emit("click",n)},onMouseHover(){this.mouseHighlighted=!0},onMouseLeave(){this.mouseHighlighted=!1}}};function dc(n,e,t,r,i,s){const o=m.resolveComponent("dt-icon");return m.openBlock(),m.createBlock(m.resolveDynamicComponent(t.elementType),m.mergeProps({id:t.id,class:["dt-list-item",{"dt-list-item--focusable":s.isFocusable,"dt-list-item--highlighted":s.isHighlighted,"dt-list-item--static":!s.isHoverable}],tabindex:s.isFocusable?0:-1,role:t.role,"aria-selected":s.isHighlighted},m.toHandlers(s.listItemListeners)),{default:m.withCtx(()=>[s.listItemType?(m.openBlock(),m.createBlock(m.resolveDynamicComponent(s.listItemType),{key:0},m.createSlots({_:2},[m.renderList(n.$slots,(l,a)=>({name:a,fn:m.withCtx(()=>[m.renderSlot(n.$slots,a)])})),t.selected?{name:"selected",fn:m.withCtx(()=>[m.createVNode(o,{name:"check",size:"400",class:"dt-list-item--selected-icon"})]),key:"0"}:void 0]),1024)):m.renderSlot(n.$slots,"default",{key:1})]),_:3},16,["id","class","tabindex","role","aria-selected"])}const jo=N._export_sfc(cc,[["render",dc]]),Ge={default:"column",column:"column",row:"row","row-reverse":"row-reverse","column-reverse":"column-reverse"},Ai=["sm","md","lg","xl"],dr=["0","100","200","300","400","450","500","600"],ti={none:void 0,small:"d-p4",medium:"d-p8",large:"d-p16"},Ko={none:void 0,small:"d-pl4",medium:"d-pl8",large:"d-pl16"},qo=["dialog","menu","listbox","tree","grid"],Wo=["","anchor"],Uo=["none","dialog","first"],Jo=["parent","body"],Go=[...N.TIPPY_STICKY_VALUES],uc=[...N.BASE_TIPPY_DIRECTIONS],hc={name:"PopoverHeaderFooter",components:{DtButton:X.DtButton,DtIcon:X.DtIcon},props:{type:{type:String,validator:function(n){return["header","footer"].includes(n)}},contentClass:{type:[String,Array,Object],default:""},showCloseButton:{type:Boolean,default:!1},closeButtonProps:{type:Object,default:()=>{}}},emits:["close"],data(){return{hasSlotContent:N.hasSlotContent}},methods:{focusCloseButton(){var e;const n=(e=this.$refs["popover__close-button"])==null?void 0:e.$el;n==null||n.focus()}}};function fc(n,e,t,r,i,s){const o=m.resolveComponent("dt-icon"),l=m.resolveComponent("dt-button");return m.openBlock(),m.createElementBlock("div",{"data-qa":"dt-popover-header-footer",class:m.normalizeClass({"d-popover__header":t.type==="header","d-popover__footer":t.type==="footer"})},[i.hasSlotContent(n.$slots.content)?(m.openBlock(),m.createElementBlock("div",{key:0,"data-qa":"dt-popover-header-footer-content",class:m.normalizeClass([{"d-popover__header__content":t.type==="header","d-popover__footer__content":t.type==="footer"},t.contentClass])},[m.renderSlot(n.$slots,"content")],2)):m.createCommentVNode("",!0),t.showCloseButton?(m.openBlock(),m.createBlock(l,m.mergeProps({key:1,ref:"popover__close-button","data-qa":"dt-popover-close",class:{"d-popover__header__close-button":t.type==="header","d-popover__footer__close-button":t.type==="footer"},importance:"outlined",kind:"muted",circle:""},t.closeButtonProps,{onClick:e[0]||(e[0]=a=>n.$emit("close"))}),{icon:m.withCtx(()=>[m.createVNode(o,{name:"close",size:"300"})]),_:1},16,["class"])):m.createCommentVNode("",!0)],2)}const pc=N._export_sfc(hc,[["render",fc]]),mc={name:"DtPopover",components:{SrOnlyCloseButton:Ho,DtLazyShow:N.DtLazyShow,PopoverHeaderFooter:pc},mixins:[$o,zo],props:{open:{type:Boolean,default:null},openOnContext:{type:Boolean,default:!1},elementType:{type:String,default:"div"},transition:{type:String,default:"fade"},role:{type:String,default:"dialog",validator:n=>qo.includes(n)},ariaLabelledby:{type:String,default:null},ariaLabel:{type:String,default:null},closeButtonProps:{type:Object,default:()=>({})},padding:{type:String,default:"large",validator:n=>Object.keys(ti).some(e=>e===n)},contentClass:{type:[String,Array,Object],default:""},contentWidth:{type:String,default:"",validator:n=>Wo.includes(n)},contentAppear:{type:Boolean,default:null},contentTabindex:{type:Number||null,default:-1},externalAnchor:{type:String,default:""},id:{type:String,default(){return N.getUniqueString()}},offset:{type:Array,default:()=>[0,4]},hideOnClick:{type:Boolean,default:!0},modal:{type:Boolean,default:!0},fallbackPlacements:{type:Array,default:()=>["auto"]},placement:{type:String,default:"bottom-end"},tether:{type:Boolean,default:!0},sticky:{type:[Boolean,String],default:!1,validator:n=>Go.includes(n)},maxHeight:{type:String,default:""},maxWidth:{type:String,default:""},showCloseButton:{type:Boolean,default:!1},headerClass:{type:[String,Array,Object],default:""},footerClass:{type:[String,Array,Object],default:""},dialogClass:{type:[String,Array,Object],default:""},initialFocusElement:{type:[String,HTMLElement],default:"first",validator:n=>Uo.includes(n)||n instanceof HTMLElement||n.startsWith("#")},openWithArrowKeys:{type:Boolean,default:!1},appendTo:{type:[HTMLElement,String],default:"body",validator:n=>Jo.includes(n)||n instanceof HTMLElement},hovercard:{type:Boolean,default:!1},timer:{type:[Object,null],default:null,validator:n=>n===null||n.enter&&n.leave&&Object.keys(n).includes("current")}},emits:["keydown","update:open","opened"],data(){return{POPOVER_PADDING_CLASSES:ti,POPOVER_HEADER_FOOTER_PADDING_CLASSES:Ko,intersectionObserver:null,isOutsideViewport:!1,isOpen:!1,toAppear:!1,anchorEl:null,popoverContentEl:null,hasSlotContent:N.hasSlotContent,inTimer:null,outTimer:null}},computed:{popoverListeners(){return{keydown:n=>{this.onKeydown(n)},"after-leave":n=>{this.onLeaveTransitionComplete()},"after-enter":n=>{this.onEnterTransitionComplete()}}},calculatedMaxHeight(){return this.isOutsideViewport&&this.modal?"calc(100vh - var(--dt-space-300))":this.maxHeight},labelledBy(){return this.ariaLabelledby||!this.ariaLabel&&N.getUniqueString("DtPopover__anchor")},currentHovercard(){var n;return(n=this.timer)==null?void 0:n.current}},watch:{$props:{immediate:!0,deep:!0,handler(){this.validateProps()}},modal(n){var e;(e=this.tip)==null||e.setProps({zIndex:n?650:this.calculateAnchorZindex()})},offset(n){var e;(e=this.tip)==null||e.setProps({offset:n})},sticky(n){var e;(e=this.tip)==null||e.setProps({sticky:n})},fallbackPlacements(){var n;(n=this.tip)==null||n.setProps({popperOptions:this.popperOptions()})},tether(){var n;(n=this.tip)==null||n.setProps({popperOptions:this.popperOptions()})},placement(n){var e;(e=this.tip)==null||e.setProps({placement:n})},open:{handler:function(n){n!==null&&(this.isOpen=n),n===!0&&(this.toAppear=!0)},immediate:!0},contentAppear:{handler:function(n){n!==null&&(this.toAppear=n)}},isOpen(n,e){n?(this.initTippyInstance(),this.tip.show()):!n&&e!==n&&(this.removeEventListeners(),this.tip.hide())},currentHovercard(){this.hovercard&&this.timer&&(this.currentHovercard===this.id?this.isOpen=!0:this.isOpen=!1)}},mounted(){var e;const n=this.externalAnchor?this.$refs.anchor.getRootNode().querySelector(`#${this.externalAnchor}`):null;this.anchorEl=n??this.$refs.anchor.children[0],this.popoverContentEl=(e=this.$refs.content)==null?void 0:e.$el,this.isOpen&&(this.initTippyInstance(),this.tip.show()),this.intersectionObserver=new IntersectionObserver(this.hasIntersectedViewport),this.intersectionObserver.observe(this.popoverContentEl)},beforeUnmount(){var n;(n=this.tip)==null||n.destroy(),this.intersectionObserver.disconnect(),this.removeReferences(),this.removeEventListeners()},methods:{hasIntersectedViewport(n){var r;const e=(r=n==null?void 0:n[0])==null?void 0:r.target;if(!e)return;const t=N.isOutOfViewPort(e);this.isOutsideViewport=t.bottom||t.top},popperOptions(){return N.getPopperOptions({fallbackPlacements:this.fallbackPlacements,tether:this.tether,hasHideModifierEnabled:!0})},validateProps(){this.modal&&this.initialFocusElement==="none"&&console.error('If the popover is modal you must set the initialFocusElement prop. Possible values: "dialog", "first", HTMLElement')},calculateAnchorZindex(){var n;return this.$el.getRootNode().querySelector('.d-modal[aria-hidden="false"], .d-modal--transparent[aria-hidden="false"]')||(n=this.anchorEl)!=null&&n.closest(".d-zi-drawer")?650:300},defaultToggleOpen(n){var e,t,r;if(!this.hovercard&&!this.openOnContext&&(this.open===null||this.open===void 0)){if(!((e=this.anchorEl)!=null&&e.contains(n.target))&&!((t=this.anchorEl)!=null&&t.isEqualNode(n.target))||(r=this.anchorEl)!=null&&r.disabled)return;this.toggleOpen()}},async onContext(n){this.openOnContext&&(n.preventDefault(),this.isOpen=!0,await this.$nextTick(),this.tip.setProps({placement:"right-start",getReferenceClientRect:()=>({width:0,height:0,top:n.clientY,bottom:n.clientY,left:n.clientX,right:n.clientX})}))},toggleOpen(){this.isOpen=!this.isOpen},onArrowKeyPress(n){var e;this.open===null&&(this.openWithArrowKeys&&((e=this.anchorEl)!=null&&e.contains(n.target))&&(this.isOpen||(this.isOpen=!0)),this.$emit("keydown",n))},addEventListeners(){window.addEventListener("dt-popover-close",this.closePopover),this.contentWidth==="anchor"&&window.addEventListener("resize",this.onResize)},removeEventListeners(){window.removeEventListener("dt-popover-close",this.closePopover),this.contentWidth==="anchor"&&window.removeEventListener("resize",this.onResize)},closePopover(){this.isOpen=!1},preventScrolling(){var n;if(this.modal){const e=(n=this.anchorEl)==null?void 0:n.closest("body, .tippy-box");e.tagName.toLowerCase()==="body"?(e.classList.add("d-of-hidden"),this.tip.setProps({offset:this.offset})):e.classList.add("d-zi-popover")}},enableScrolling(){var e,t;const n=(e=this.anchorEl)==null?void 0:e.closest("body, .tippy-box");n&&(((t=n.tagName)==null?void 0:t.toLowerCase())==="body"?(n.classList.remove("d-of-hidden"),this.tip.setProps({offset:this.offset})):n.classList.remove("d-zi-popover"))},removeReferences(){this.anchorEl=null,this.popoverContentEl=null,this.tip=null},async onShow(){this.contentWidth==="anchor"&&await this.setPopoverContentAnchorWidth(),this.contentWidth===null&&(this.popoverContentEl.style.width="auto"),this.addEventListeners()},async onLeaveTransitionComplete(){var n;this.modal&&(await this.focusFirstElement(this.$refs.anchor),await this.$nextTick(),this.enableScrolling()),(n=this.tip)==null||n.unmount(),this.$emit("opened",!1),this.open!==null&&this.$emit("update:open",!1)},async onEnterTransitionComplete(){this.focusInitialElement(),await this.$nextTick(),this.preventScrolling(),this.$emit("opened",!0,this.$refs.popover__content),this.open!==null&&this.$emit("update:open",!0)},focusInitialElement(){var n,e;this.initialFocusElement==="dialog"&&((e=(n=this.$refs.content)==null?void 0:n.$el)==null||e.focus()),this.initialFocusElement.startsWith("#")&&this.focusInitialElementById(),this.initialFocusElement==="first"&&this.focusFirstElementIfNeeded(this.$refs.popover__content),this.initialFocusElement instanceof HTMLElement&&this.initialFocusElement.focus()},focusInitialElementById(){var e,t,r;const n=(t=(e=this.$refs.content)==null?void 0:e.$el)==null?void 0:t.querySelector(this.initialFocusElement);n?n.focus():console.warn('Could not find the element specified in dt-popover prop "initialFocusElement". Defaulting to focusing the dialog.'),n?n.focus():(r=this.$refs.content)==null||r.$el.focus()},onResize(){this.closePopover()},onClickOutside(){if(!this.hideOnClick)return;this.popoverContentEl.querySelector(".d-popover__anchor--opened")||this.closePopover()},onKeydown(n){n.key==="Tab"&&this.modal&&this.focusTrappedTabPress(n,this.popoverContentEl),n.key==="Escape"&&this.closePopover(),this.$emit("keydown",n)},async setPopoverContentAnchorWidth(){var n;await this.$nextTick(),this.popoverContentEl.style.width=`${(n=this.anchorEl)==null?void 0:n.clientWidth}px`},focusFirstElementIfNeeded(n){var t,r;this._getFocusableElements(n,!0).length!==0?this.focusFirstElement(n):this.showCloseButton?(t=this.$refs.popover__header)==null||t.focusCloseButton():(r=this.$refs.content)==null||r.$el.focus()},initTippyInstance(){var n,e;this.tip=N.createTippy(this.anchorEl,{popperOptions:this.popperOptions(),contentElement:this.popoverContentEl,placement:this.placement,offset:this.offset,sticky:this.sticky,appendTo:this.appendTo==="body"?(e=(n=this.anchorEl)==null?void 0:n.getRootNode())==null?void 0:e.querySelector("body"):this.appendTo,interactive:!0,trigger:"manual",hideOnClick:!1,zIndex:this.modal?650:this.calculateAnchorZindex(),onClickOutside:this.onClickOutside,onShow:this.onShow})},setInTimer(){this.inTimer=setTimeout(()=>{this.isOpen=!0},N.TOOLTIP_DELAY_MS)},setOutTimer(){this.outTimer=setTimeout(()=>{this.isOpen=!1},N.TOOLTIP_DELAY_MS)},onEnterAnchor(){this.hovercard&&(this.timer?this.timer.enter(this.id):(clearTimeout(this.outTimer),this.setInTimer()))},onLeaveAnchor(){this.hovercard&&(this.timer?this.timer.leave():(clearTimeout(this.inTimer),this.setOutTimer()))},onEnterContent(){this.hovercard&&(this.timer?this.timer.enter(this.id):clearTimeout(this.outTimer))},onLeaveContent(){this.hovercard&&(this.timer?this.timer.leave():this.setOutTimer())}}},gc=["aria-hidden"],yc=["id","data-qa","tabindex"],bc=["data-qa"];function kc(n,e,t,r,i,s){const o=m.resolveComponent("popover-header-footer"),l=m.resolveComponent("sr-only-close-button"),a=m.resolveComponent("dt-lazy-show");return m.openBlock(),m.createElementBlock("div",null,[t.modal&&i.isOpen?(m.openBlock(),m.createBlock(m.Teleport,{key:0,to:"body"},[m.createElementVNode("div",{class:"d-modal--transparent","aria-hidden":t.modal&&i.isOpen?"false":"true",onClick:e[0]||(e[0]=m.withModifiers(()=>{},["prevent","stop"]))},null,8,gc)])):m.createCommentVNode("",!0),(m.openBlock(),m.createBlock(m.resolveDynamicComponent(t.elementType),{ref:"popover",class:m.normalizeClass(["d-popover",{"d-popover__anchor--opened":i.isOpen}]),"data-qa":"dt-popover-container"},{default:m.withCtx(()=>[m.createElementVNode("div",{id:!t.ariaLabelledby&&s.labelledBy,ref:"anchor","data-qa":n.$attrs["data-qa"]?`${n.$attrs["data-qa"]}-anchor`:"dt-popover-anchor",tabindex:t.openOnContext?0:void 0,onClickCapture:e[1]||(e[1]=(...c)=>s.defaultToggleOpen&&s.defaultToggleOpen(...c)),onContextmenu:e[2]||(e[2]=(...c)=>s.onContext&&s.onContext(...c)),onKeydown:[e[3]||(e[3]=m.withKeys(m.withModifiers((...c)=>s.onArrowKeyPress&&s.onArrowKeyPress(...c),["prevent"]),["up"])),e[4]||(e[4]=m.withKeys(m.withModifiers((...c)=>s.onArrowKeyPress&&s.onArrowKeyPress(...c),["prevent"]),["down"])),e[6]||(e[6]=m.withKeys(c=>n.$emit("keydown",c),["enter"])),e[7]||(e[7]=m.withKeys(c=>n.$emit("keydown",c),["space"]))],onKeydownCapture:e[5]||(e[5]=m.withKeys((...c)=>s.closePopover&&s.closePopover(...c),["escape"])),onMouseenter:e[8]||(e[8]=(...c)=>s.onEnterAnchor&&s.onEnterAnchor(...c)),onMouseleave:e[9]||(e[9]=(...c)=>s.onLeaveAnchor&&s.onLeaveAnchor(...c))},[m.renderSlot(n.$slots,"anchor",{attrs:{"aria-expanded":i.isOpen.toString(),"aria-controls":t.id,"aria-haspopup":t.role}})],40,yc),m.createVNode(a,m.mergeProps({id:t.id,ref:"content",role:t.role,"data-qa":n.$attrs["data-qa"]?`${n.$attrs["data-qa"]}__dialog`:"dt-popover","aria-hidden":`${!i.isOpen}`,"aria-labelledby":s.labelledBy,"aria-label":t.ariaLabel,"aria-modal":`${!t.modal}`,transition:t.transition,show:i.isOpen,appear:i.toAppear,class:["d-popover__dialog",{"d-popover__dialog--modal":t.modal},t.dialogClass],style:{"max-height":s.calculatedMaxHeight,"max-width":t.maxWidth},css:n.$attrs.css,tabindex:t.contentTabindex},m.toHandlers(s.popoverListeners),{onMouseenter:s.onEnterContent,onMouseleave:s.onLeaveContent}),{default:m.withCtx(()=>[i.hasSlotContent(n.$slots.headerContent)||t.showCloseButton?(m.openBlock(),m.createBlock(o,{key:0,ref:"popover__header",class:m.normalizeClass(i.POPOVER_HEADER_FOOTER_PADDING_CLASSES[t.padding]),"content-class":t.headerClass,type:"header","show-close-button":t.showCloseButton,"close-button-props":t.closeButtonProps,onClose:s.closePopover},{content:m.withCtx(()=>[m.renderSlot(n.$slots,"headerContent",{close:s.closePopover})]),_:3},8,["class","content-class","show-close-button","close-button-props","onClose"])):m.createCommentVNode("",!0),m.createElementVNode("div",{ref:"popover__content","data-qa":n.$attrs["data-qa"]?`${n.$attrs["data-qa"]}-content`:"dt-popover-content",class:m.normalizeClass(["d-popover__content",i.POPOVER_PADDING_CLASSES[t.padding],t.contentClass])},[m.renderSlot(n.$slots,"content",{close:s.closePopover})],10,bc),i.hasSlotContent(n.$slots.footerContent)?(m.openBlock(),m.createBlock(o,{key:1,ref:"popover__footer",type:"footer",class:m.normalizeClass(i.POPOVER_HEADER_FOOTER_PADDING_CLASSES[t.padding]),"content-class":t.footerClass},{content:m.withCtx(()=>[m.renderSlot(n.$slots,"footerContent",{close:s.closePopover})]),_:3},8,["class","content-class"])):m.createCommentVNode("",!0),n.showVisuallyHiddenClose?(m.openBlock(),m.createBlock(l,{key:2,"visually-hidden-close-label":n.visuallyHiddenCloseLabel,onClose:s.closePopover},null,8,["visually-hidden-close-label","onClose"])):m.createCommentVNode("",!0)]),_:3},16,["id","role","data-qa","aria-hidden","aria-labelledby","aria-label","aria-modal","transition","show","appear","class","style","css","tabindex","onMouseenter","onMouseleave"])]),_:3},8,["class"]))])}const Sc=N._export_sfc(mc,[["render",kc]]);function ss(n){return n===Ge.default}function ls(n){if(Ut(n)==="string")return ss(n)?null:Ge[n];if(Ut(n)==="object"){const{default:e}=n;return ss(e)?null:Ge[e]}else return null}function Ut(n){return typeof n}function xc(n){return ls(n)?`d-stack--${Ge[ls(n)]}`:null}function Cc(n){return Ut(n)==="object"?[...Ai.map(e=>n[e]?`d-stack--${e}--${n[e]}`:null)]:null}function Ec(n){return dr.includes(n)?`d-stack--gap-${n}`:null}function Tc(n){if(Ut(n)==="string")return Object.keys(Ge).includes(n);if(Ut(n)==="object"){const{default:e}=n;return Object.keys(Ge).includes(e)}else return null}function Oc(n){return dr.includes(n)}const Mc={name:"DtStack",props:{direction:{type:[String,Object],default:"column",validator:n=>Tc(n)},as:{type:String,default:"div"},gap:{type:String,default:"0",validator:n=>Oc(n)}},data(){return{DT_STACK_DIRECTION:Ge,DT_STACK_GAP:dr,DT_STACK_RESPONSIVE_BREAKPOINTS:Ai}},computed:{stackGap(){return Ec(this.gap)},defaultDirection(){return xc(this.direction)},stackResponsive(){return Cc(this.direction)}}};function wc(n,e,t,r,i,s){return m.openBlock(),m.createBlock(m.resolveDynamicComponent(t.as),{class:m.normalizeClass(["d-stack",s.defaultDirection,s.stackResponsive,s.stackGap])},{default:m.withCtx(()=>[m.renderSlot(n.$slots,"default")]),_:3},8,["class"])}const Ni=N._export_sfc(Mc,[["render",wc]]);function K(n){this.content=n}K.prototype={constructor:K,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),s=r.content.slice();return i==-1?s.push(t||n,e):(s[i+1]=e,t&&(s[i]=t)),new K(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new K(t)},addToStart:function(n,e){return new K([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new K(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),s=r.find(n);return i.splice(s==-1?i.length:s,0,e,t),new K(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=K.from(n),n.size?new K(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=K.from(n),n.size?new K(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=K.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};K.from=function(n){if(n instanceof K)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new K(e)};function Yo(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=Yo(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Xo(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,d=Math.min(o.text.length,l.text.length);for(;c<d&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=Xo(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class k{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,s){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,i+l,s||null,o)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),r,i+d)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{l.isText?(s+=l.text.slice(Math.max(e,a)-a,t-a),o=!r):l.isLeaf?(i?s+=typeof i=="function"?i(l):i:l.type.spec.leafText&&(s+=l.type.spec.leafText(l)),o=!r):!o&&l.isBlock&&(s+=r,o=!0)},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new k(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),i+=l.nodeSize),o=a}return new k(r,i)}cutByIndex(e,t){return e==t?k.empty:e==0&&t==this.content.length?this:new k(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new k(i,s)}addToStart(e){return new k([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new k(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return Yo(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Xo(this,e,t,r)}findIndex(e,t=-1){if(e==0)return an(0,e);if(e==this.size)return an(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let s=this.child(r),o=i+s.nodeSize;if(o>=e)return o==e||t>0?an(r+1,o):an(r,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return k.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new k(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return k.empty;let t,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new k(t||e,r)}static from(e){if(!e)return k.empty;if(e instanceof k)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new k([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}k.empty=new k([],0);const wr={index:0,offset:0};function an(n,e){return wr.index=n,wr.offset=e,wr}function xn(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!xn(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!xn(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let _=class ni{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&xn(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return ni.none;if(e instanceof ni)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};_.none=[];class Cn extends Error{}class x{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Zo(this.content,e+this.openStart,t);return r&&new x(r,this.openStart,this.openEnd)}removeBetween(e,t){return new x(Qo(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return x.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new x(k.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new x(e,r,i)}}x.empty=new x(k.empty,0,0);function Qo(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(i==e||s.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(Qo(s.content,e-i-1,t-i-1)))}function Zo(n,e,t,r){let{index:i,offset:s}=n.findIndex(e),o=n.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Zo(o.content,e-s-1,t);return l&&n.replaceChild(i,o.copy(l))}function vc(n,e,t){if(t.openStart>n.depth)throw new Cn("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Cn("Inconsistent open depths");return el(n,e,t,0)}function el(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let o=el(n,e,t,r+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return ot(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Ac(t,n);return ot(s,nl(n,o,l,e,r))}else return ot(s,En(n,e,r))}function tl(n,e){if(!e.type.compatibleContent(n.type))throw new Cn("Cannot join "+e.type.name+" onto "+n.type.name)}function ri(n,e,t){let r=n.node(t);return tl(r,e.node(t)),r}function st(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function zt(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(st(n.nodeAfter,r),s++));for(let l=s;l<o;l++)st(i.child(l),r);e&&e.depth==t&&e.textOffset&&st(e.nodeBefore,r)}function ot(n,e){return n.type.checkContent(e),n.copy(e)}function nl(n,e,t,r,i){let s=n.depth>i&&ri(n,e,i+1),o=r.depth>i&&ri(t,r,i+1),l=[];return zt(null,n,i,l),s&&o&&e.index(i)==t.index(i)?(tl(s,o),st(ot(s,nl(n,e,t,r,i+1)),l)):(s&&st(ot(s,En(n,e,i+1)),l),zt(e,t,i,l),o&&st(ot(o,En(t,r,i+1)),l)),zt(r,null,i,l),new k(l)}function En(n,e,t){let r=[];if(zt(null,n,t,r),n.depth>t){let i=ri(n,e,t+1);st(ot(i,En(n,e,t+1)),r)}return zt(e,null,t,r),new k(r)}function Ac(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(k.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class Jt{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return _.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let l=r;r=i,i=l}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Tn(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(r.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new Jt(t,r,s)}static resolveCached(e,t){for(let i=0;i<vr.length;i++){let s=vr[i];if(s.pos==t&&s.doc==e)return s}let r=vr[Ar]=Jt.resolve(e,t);return Ar=(Ar+1)%Nc,r}}let vr=[],Ar=0,Nc=12;class Tn{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Dc=Object.create(null);let lt=class ii{constructor(e,t,r,i=_.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||k.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,i=0){this.content.nodesBetween(e,t,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,i){return this.content.textBetween(e,t,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&xn(this.attrs,t||e.defaultAttrs||Dc)&&_.sameSet(this.marks,r||_.none)}copy(e=null){return e==this.content?this:new ii(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ii(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return x.empty;let i=this.resolve(e),s=this.resolve(t),o=r?0:i.sharedDepth(t),l=i.start(o),c=i.node(o).content.cut(i.pos-l,s.pos-l);return new x(c,i.depth-o,s.depth-o)}replace(e,t,r){return vc(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return Jt.resolveCached(this,e)}resolveNoCache(e){return Jt.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),rl(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=k.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;a<s;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content);let e=_.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!_.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=k.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,i,r)}};lt.prototype.text=void 0;class On extends lt{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):rl(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new On(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new On(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function rl(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class dt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Ic(e,t);if(r.next==null)return dt.empty;let i=il(r);r.next&&r.err("Unexpected trailing text");let s=zc(Fc(i));return Hc(s,r),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let i=this;for(let s=t;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function s(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return k.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:d,next:u}=o.next[c];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(u)==-1){i.push(u);let h=s(u,l.concat(d));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let l=i;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:a}=s.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!i.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
3
3
  `)}}dt.empty=new dt(!0);class Ic{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function il(n){let e=[];do e.push(Rc(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Rc(n){let e=[];do e.push(Pc(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Pc(n){let e=_c(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Lc(n,e);else break;return e}function as(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Lc(n,e){let t=as(n),r=t;return n.eat(",")&&(n.next!="}"?r=as(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Bc(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.groups.indexOf(e)>-1&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function _c(n){if(n.eat("(")){let e=il(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Bc(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Fc(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function i(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=s(o.exprs[a],l);if(a==o.exprs.length-1)return c;i(c,l=t())}else if(o.type=="star"){let a=t();return r(l,a),i(s(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return i(s(o.expr,l),a),i(s(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let d=t();i(s(o.expr,a),d),a=d}if(o.max==-1)i(s(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let d=t();r(a,d),i(s(o.expr,a),d),a=d}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function sl(n,e){return e-n}function cs(n,e){let t=[];return r(e),t.sort(sl);function r(i){let s=n[i];if(s.length==1&&!s[0].term)return r(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:l,to:a}=s[o];!l&&t.indexOf(a)==-1&&r(a)}}}function zc(n){let e=Object.create(null);return t(cs(n,0));function t(r){let i=[];r.forEach(o=>{n[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let d=0;d<i.length;d++)i[d][0]==l&&(c=i[d][1]);cs(n,a).forEach(d=>{c||i.push([l,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let s=e[r.join(",")]=new dt(r.indexOf(n.length-1)>-1);for(let o=0;o<i.length;o++){let l=i[o][1].sort(sl);s.next.push({type:i[o][0],next:e[l.join(",")]||t(l)})}return s}}function Hc(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],s=!i.validEnd,o=[];for(let l=0;l<i.next.length;l++){let{type:a,next:c}=i.next[l];o.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function ol(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function ll(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let s=n[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function al(n){let e=Object.create(null);if(n)for(let t in n)e[t]=new Vc(n[t]);return e}let ds=class cl{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=al(r.attrs),this.defaultAttrs=ol(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==dt.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:ll(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new lt(this,this.computeAttrs(e),k.from(t),_.setFrom(r))}createChecked(e=null,t,r){return t=k.from(t),this.checkContent(t),new lt(this,this.computeAttrs(e),t,_.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=k.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(k.empty,!0);return s?new lt(this,e,t.append(s),_.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:_.none:e}static compile(e,t){let r=Object.create(null);e.forEach((s,o)=>r[s]=new cl(s,t,o));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class Vc{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class ur{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=al(i.attrs),this.excluded=null;let s=ol(this.attrs);this.instance=s?new _(this,s):null}create(e=null){return!e&&this.instance?this.instance:new _(this,ll(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new ur(s,i++,t,o)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}excludes(e){return this.excluded.indexOf(e)>-1}}class $c{constructor(e){this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=K.from(e.nodes),t.marks=K.from(e.marks||{}),this.nodes=ds.compile(this.spec.nodes,this),this.marks=ur.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",l=s.spec.marks;s.contentMatch=r[o]||(r[o]=dt.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.markSet=l=="_"?null:l?us(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:us(this,o.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof ds){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,i)}text(e,t){let r=this.nodes.text;return new On(r,r.defaultAttrs,e,_.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return lt.fromJSON(this,e)}markFromJSON(e){return _.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function us(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],s=n.marks[i],o=s;if(s)t.push(s);else for(let l in n.marks){let a=n.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}let Di=class si{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach(r=>{r.tag?this.tags.push(r):r.style&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new fs(this,t,!1);return r.addAll(e,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new fs(this,t,!0);return r.addAll(e,t.from,t.to),x.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(qc(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<s)break}t.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=ps(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=ps(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new si(e,si.schemaRules(e)))}};const dl={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},jc={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ul={ol:!0,ul:!0},Mn=1,wn=2,Ht=4;function hs(n,e,t){return e!=null?(e?Mn:0)|(e==="full"?wn:0):n&&n.whitespace=="pre"?Mn|wn:t&~Ht}class cn{constructor(e,t,r,i,s,o,l){this.type=e,this.attrs=t,this.marks=r,this.pendingMarks=i,this.solid=s,this.options=l,this.content=[],this.activeMarks=_.none,this.stashMarks=[],this.match=o||(l&Ht?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(k.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Mn)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=k.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(k.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,r=this.pendingMarks;t<r.length;t++){let i=r[t];(this.type?this.type.allowsMarkType(i.type):Uc(i.type,e))&&!i.isInSet(this.activeMarks)&&(this.activeMarks=i.addToSet(this.activeMarks),this.pendingMarks=i.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!dl.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class fs{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0;let i=t.topNode,s,o=hs(null,t.preserveWhitespace,0)|(r?Ht:0);i?s=new cn(i.type,i.attrs,_.none,_.none,!0,t.topMatch||i.type.contentMatch,o):r?s=new cn(null,null,_.none,_.none,!0,null,o):s=new cn(e.schema.topNodeType,null,_.none,_.none,!0,null,o),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){e.nodeType==3?this.addTextNode(e):e.nodeType==1&&this.addElement(e)}withStyleRules(e,t){let r=e.getAttribute("style");if(!r)return t();let i=this.readStyles(Wc(r));if(!i)return;let[s,o]=i,l=this.top;for(let a=0;a<o.length;a++)this.removePendingMark(o[a],l);for(let a=0;a<s.length;a++)this.addPendingMark(s[a]);t();for(let a=0;a<s.length;a++)this.removePendingMark(s[a],l);for(let a=0;a<o.length;a++)this.addPendingMark(o[a])}addTextNode(e){let t=e.nodeValue,r=this.top;if(r.options&wn||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(t)){if(r.options&Mn)r.options&wn?t=t.replace(/\r\n?/g,`
4
4
  `):t=t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){let i=r.content[r.content.length-1],s=e.previousSibling;(!i||s&&s.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)}addElement(e,t){let r=e.nodeName.toLowerCase(),i;ul.hasOwnProperty(r)&&this.parser.normalizeLists&&Kc(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,t));if(s?s.ignore:jc.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let o,l=this.top,a=this.needsBlock;if(dl.hasOwnProperty(r))l.content.length&&l.content[0].isInline&&this.open&&(this.open--,l=this.top),o=!0,l.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e);return}s&&s.skip?this.addAll(e):this.withStyleRules(e,()=>this.addAll(e)),o&&this.sync(l),this.needsBlock=a}else this.withStyleRules(e,()=>{this.addElementByRule(e,s,s.consuming===!1?i:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
5
5
  `))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=_.none,r=_.none;for(let i=0;i<e.length;i+=2)for(let s=void 0;;){let o=this.parser.matchStyle(e[i],e[i+1],this,s);if(!o)break;if(o.ignore)return null;if(o.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach(l=>{o.clearMark(l)&&(r=l.addToSet(r))}):t=this.parser.schema.marks[o.mark].create(o.attrs).addToSet(t),o.consuming===!1)s=o;else break}return[t,r]}addElementByRule(e,t,r){let i,s,o;t.node?(s=this.parser.schema.nodes[t.node],s.isLeaf?this.insertNode(s.create(t.attrs))||this.leafFallback(e):i=this.enter(s,t.attrs||null,t.preserveWhitespace)):(o=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(o));let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a)}i&&this.sync(l)&&this.open--,o&&this.removePendingMark(o,l)}addAll(e,t,r){let i=t||0;for(let s=t?e.childNodes[t]:e.firstChild,o=r==null?null:e.childNodes[r];s!=o;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s);this.findAtPoint(e,i)}findPlace(e){let t,r;for(let i=this.open;i>=0;i--){let s=this.nodes[i],o=s.findWrapping(e);if(o&&(!t||t.length>o.length)&&(t=o,r=s,!o.length)||s.solid)break}if(!t)return!1;this.sync(r);for(let i=0;i<t.length;i++)this.enterInner(t[i],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&this.enterInner(t)}if(this.findPlace(e)){this.closeExtra();let t=this.top;t.applyPending(e.type),t.match&&(t.match=t.match.matchType(e.type));let r=t.activeMarks;for(let i=0;i<e.marks.length;i++)(!t.type||t.type.allowsMarkType(e.marks[i].type))&&(r=e.marks[i].addToSet(r));return t.content.push(e.mark(r)),!0}return!1}enter(e,t,r){let i=this.findPlace(e.create(t));return i&&this.enterInner(e,t,!0,r),i}enterInner(e,t=null,r=!1,i){this.closeExtra();let s=this.top;s.applyPending(e),s.match=s.match&&s.match.matchType(e);let o=hs(e,i,s.options);s.options&Ht&&s.content.length==0&&(o|=Ht),this.nodes.push(new cn(e,t,s.activeMarks,s.pendingMarks,r,null,o)),this.open++}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let d=a>0||a==0&&i?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!d||d.name!=c&&d.groups.indexOf(c)==-1)return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let t=Jc(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(e)>-1)i.pendingMarks=e.removeFromSet(i.pendingMarks);else{i.activeMarks=e.removeFromSet(i.activeMarks);let o=i.popFromStashMark(e);o&&i.type&&i.type.allowsMarkType(o.type)&&(i.activeMarks=o.addToSet(i.activeMarks))}if(i==t)break}}}function Kc(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&ul.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function qc(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Wc(n){let e=/\s*([\w-]+)\s*:\s*([^;]+)/g,t,r=[];for(;t=e.exec(n);)r.push(t[1],t[2].trim());return r}function ps(n){let e={};for(let t in n)e[t]=n[t];return e}function Uc(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=l=>{s.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:d}=l.edge(a);if(c==e||s.indexOf(d)<0&&o(d))return!0}};if(o(i.contentMatch))return!0}}function Jc(n,e){for(let t=0;t<e.length;t++)if(n.eq(e[t]))return e[t]}class Te{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Nr(t).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let l=0,a=0;for(;l<s.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(s[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<s.length;)i=s.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],d=this.serializeMark(c,o.isInline,t);d&&(s.push([c,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=Te.renderSpec(Nr(t),this.nodes[e.type.name](e));if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&Te.renderSpec(Nr(r),i(e,t))}static renderSpec(e,t,r=null){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let i=t[0],s=i.indexOf(" ");s>0&&(r=i.slice(0,s),i=i.slice(s+1));let o,l=r?e.createElementNS(r,i):e.createElement(i),a=t[1],c=1;if(a&&typeof a=="object"&&a.nodeType==null&&!Array.isArray(a)){c=2;for(let d in a)if(a[d]!=null){let u=d.indexOf(" ");u>0?l.setAttributeNS(d.slice(0,u),d.slice(u+1),a[d]):l.setAttribute(d,a[d])}}for(let d=c;d<t.length;d++){let u=t[d];if(u===0){if(d<t.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:f}=Te.renderSpec(e,u,r);if(l.appendChild(h),f){if(o)throw new RangeError("Multiple content holes");o=f}}}return{dom:l,contentDOM:o}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Te(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=ms(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return ms(e.marks)}}function ms(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Nr(n){return n.document||window.document}const hl=65535,fl=Math.pow(2,16);function Gc(n,e){return n+e*fl}function gs(n){return n&hl}function Yc(n){return(n-(n&hl))/fl}const pl=1,ml=2,yn=4,gl=8;class oi{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&gl)>0}get deletedBefore(){return(this.delInfo&(pl|yn))>0}get deletedAfter(){return(this.delInfo&(ml|yn))>0}get deletedAcross(){return(this.delInfo&yn)>0}}class ae{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&ae.empty)return ae.empty}recover(e){let t=0,r=gs(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+Yc(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let c=this.ranges[l+s],d=this.ranges[l+o],u=a+c;if(e<=u){let h=c?e==a?-1:e==u?1:t:t,f=a+i+(h<0?0:d);if(r)return f;let p=e==(t<0?a:u)?null:Gc(l/3,e-a),g=e==a?ml:e==u?pl:yn;return(t<0?e!=a:e!=u)&&(g|=gl),new oi(f,g,p)}i+=d-c}return r?e+i:new oi(e+i,0,null)}touches(e,t){let r=0,i=gs(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+s],d=a+c;if(e<=d&&l==i*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],l=o-(this.inverted?s:0),a=o+(this.inverted?0:s),c=this.ranges[i+t],d=this.ranges[i+r];e(l,l+c,a,a+d),s+=d-c}}invert(){return new ae(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?ae.empty:new ae(e<0?[0,-e,0]:[0,0,e])}}ae.empty=new ae([]);class Vt{constructor(e=[],t,r=0,i=e.length){this.maps=e,this.mirror=t,this.from=r,this.to=i}slice(e=0,t=this.maps.length){return new Vt(this.maps,this.mirror,e,t)}copy(){return new Vt(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,r=this.maps.length;t<e.maps.length;t++){let i=e.getMirror(t);this.appendMap(e.maps[t],i!=null&&i<t?r+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this.maps.length+e.maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new Vt;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this.maps[s],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(s);if(a!=null&&a>s&&a<this.to){s=a,e=this.maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new oi(e,i,null)}}const Dr=Object.create(null);class Z{getMap(){return ae.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Dr[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Dr)throw new RangeError("Duplicate use of step JSON ID "+e);return Dr[e]=t,t.prototype.jsonID=e,t}}class V{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new V(e,null)}static fail(e){return new V(null,e)}static fromReplace(e,t,r,i){try{return V.ok(e.replace(t,r,i))}catch(s){if(s instanceof Cn)return V.fail(s.message);throw s}}}function Ii(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy(Ii(s.content,e,s))),s.isInline&&(s=e(s,t,i)),r.push(s)}return k.fromArray(r)}class je extends Z{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new x(Ii(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return V.fromReplace(e,this.from,this.to,s)}invert(){return new Oe(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new je(t.pos,r.pos,this.mark)}merge(e){return e instanceof je&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new je(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new je(t.from,t.to,e.markFromJSON(t.mark))}}Z.jsonID("addMark",je);class Oe extends Z{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new x(Ii(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return V.fromReplace(e,this.from,this.to,r)}invert(){return new je(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Oe(t.pos,r.pos,this.mark)}merge(e){return e instanceof Oe&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Oe(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Oe(t.from,t.to,e.markFromJSON(t.mark))}}Z.jsonID("removeMark",Oe);class Ke extends Z{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return V.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return V.fromReplace(e,this.pos,this.pos+1,new x(k.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new Ke(this.pos,t.marks[i]);return new Ke(this.pos,this.mark)}}return new Ot(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ke(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Ke(t.pos,e.markFromJSON(t.mark))}}Z.jsonID("addNodeMark",Ke);class Ot extends Z{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return V.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return V.fromReplace(e,this.pos,this.pos+1,new x(k.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Ke(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ot(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Ot(t.pos,e.markFromJSON(t.mark))}}Z.jsonID("removeNodeMark",Ot);class q extends Z{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&li(e,this.from,this.to)?V.fail("Structure replace would overwrite content"):V.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ae([this.from,this.to-this.from,this.slice.size])}invert(e){return new q(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new q(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof q)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?x.empty:new x(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new q(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?x.empty:new x(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new q(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new q(t.from,t.to,x.fromJSON(e,t.slice),!!t.structure)}}Z.jsonID("replace",q);class $ extends Z{constructor(e,t,r,i,s,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=l}apply(e){if(this.structure&&(li(e,this.from,this.gapFrom)||li(e,this.gapTo,this.to)))return V.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return V.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?V.fromReplace(e,this.from,this.to,r):V.fail("Content does not fit in gap")}getMap(){return new ae([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new $(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=e.map(this.gapFrom,-1),s=e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||s>r.pos?null:new $(t.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new $(t.from,t.to,t.gapFrom,t.gapTo,x.fromJSON(e,t.slice),t.insert,!!t.structure)}}Z.jsonID("replaceAround",$);function li(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function Xc(n,e,t,r){let i=[],s=[],o,l;n.doc.nodesBetween(e,t,(a,c,d)=>{if(!a.isInline)return;let u=a.marks;if(!r.isInSet(u)&&d.type.allowsMarkType(r.type)){let h=Math.max(c,e),f=Math.min(c+a.nodeSize,t),p=r.addToSet(u);for(let g=0;g<u.length;g++)u[g].isInSet(p)||(o&&o.to==h&&o.mark.eq(u[g])?o.to=f:i.push(o=new Oe(h,f,u[g])));l&&l.to==h?l.to=f:s.push(l=new je(h,f,r))}}),i.forEach(a=>n.step(a)),s.forEach(a=>n.step(a))}function Qc(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(r instanceof ur){let c=o.marks,d;for(;d=r.isInSet(c);)(a||(a=[])).push(d),c=d.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let d=0;d<a.length;d++){let u=a[d],h;for(let f=0;f<i.length;f++){let p=i[f];p.step==s-1&&u.eq(i[f].style)&&(h=p)}h?(h.to=c,h.step=s):i.push({style:u,from:Math.max(l,e),to:c,step:s})}}}),i.forEach(o=>n.step(new Oe(o.from,o.to,o.style)))}function Zc(n,e,t,r=t.contentMatch){let i=n.doc.nodeAt(e),s=[],o=e+1;for(let l=0;l<i.childCount;l++){let a=i.child(l),c=o+a.nodeSize,d=r.matchType(a.type);if(!d)s.push(new q(o,c,x.empty));else{r=d;for(let u=0;u<a.marks.length;u++)t.allowsMarkType(a.marks[u].type)||n.step(new Oe(o,c,a.marks[u]));if(a.isText&&!t.spec.code){let u,h=/\r?\n|\r/g,f;for(;u=h.exec(a.text);)f||(f=new x(k.from(t.schema.text(" ",t.allowedMarks(a.marks))),0,0)),s.push(new q(o+u.index,o+u.index+u[0].length,f))}}o=c}if(!r.validEnd){let l=r.fillBefore(k.empty,!0);n.replace(o,o,new x(l,0,0))}for(let l=s.length-1;l>=0;l--)n.step(s[l])}function ed(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Dt(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),s=n.$from.index(r),o=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(s,o,t))return r;if(r==0||i.type.spec.isolating||!ed(i,s,o))break}return null}function td(n,e,t){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),l=i.after(s+1),a=o,c=l,d=k.empty,u=0;for(let p=s,g=!1;p>t;p--)g||r.index(p)>0?(g=!0,d=k.from(r.node(p).copy(d)),u++):a--;let h=k.empty,f=0;for(let p=s,g=!1;p>t;p--)g||i.after(p+1)<i.end(p)?(g=!0,h=k.from(i.node(p).copy(h)),f++):c++;n.step(new $(a,c,o,l,new x(d.append(h),u,f),d.size-u,!0))}function Ri(n,e,t=null,r=n){let i=nd(n,e),s=i&&rd(r,e);return s?i.map(ys).concat({type:e,attrs:t}).concat(s.map(ys)):null}function ys(n){return{type:n,attrs:null}}function nd(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(r,i,o)?s:null}function rd(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;a&&c<i;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:o}function id(n,e,t){let r=k.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let l=t[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=k.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new $(i,s,i,s,new x(r,0,0),t.length,!0))}function sd(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,l)=>{if(o.isTextblock&&!o.hasMarkup(r,i)&&od(n.doc,n.mapping.slice(s).map(l),r)){n.clearIncompatible(n.mapping.slice(s).map(l,1),r);let a=n.mapping.slice(s),c=a.map(l,1),d=a.map(l+o.nodeSize,1);return n.step(new $(c,d,c+1,d-1,new x(k.from(r.create(i,null,o.marks)),0,0),1,!0)),!1}})}function od(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function ld(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new $(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new x(k.from(o),0,0),1,!0))}function Ct(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,d=t-2;c>s;c--,d--){let u=i.node(c),h=i.index(c);if(u.type.spec.isolating)return!1;let f=u.content.cutByIndex(h,u.childCount),p=r&&r[d+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let g=r&&r[d]||u;if(!u.canReplace(h+1,u.childCount)||!g.type.validContent(f))return!1}let l=i.indexAfter(s),a=r&&r[0];return i.node(s).canReplaceWith(l,l,a?a.type:i.node(s+1).type)}function ad(n,e,t=1,r){let i=n.doc.resolve(e),s=k.empty,o=k.empty;for(let l=i.depth,a=i.depth-t,c=t-1;l>a;l--,c--){s=k.from(i.node(l).copy(s));let d=r&&r[c];o=k.from(d?d.type.create(d.attrs,o):i.node(l).copy(o))}n.step(new q(e,e,new x(s.append(o),t,t),!0))}function Xe(n,e){let t=n.resolve(e),r=t.index();return yl(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function yl(n,e){return!!(n&&e&&!n.isLeaf&&n.canAppend(e))}function bl(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let s,o,l=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):t>0?(s=r.node(i+1),l++,o=r.node(i).maybeChild(l)):(s=r.node(i).maybeChild(l-1),o=r.node(i+1)),s&&!s.isTextblock&&yl(s,o)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function cd(n,e,t){let r=new q(e-t,e+t,x.empty,!0);n.step(r)}function dd(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function ud(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let o=r.depth;o>=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),c=r.node(o),d=!1;if(s==1)d=c.canReplace(a,a,i);else{let u=c.contentMatchAt(a).findWrapping(i.firstChild.type);d=u&&c.canReplaceWith(a,a,u[0])}if(d)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}function Pi(n,e,t=e,r=x.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return kl(i,s,r)?new q(e,t,r):new hd(i,s,r).fit()}function kl(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class hd{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=k.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=k.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,l=i.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let a=new x(s,o,l);return e>-1?new $(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new q(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Ir(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],d,u=null;if(t==1&&(o?c.matchType(o.type)||(u=c.fillBefore(k.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:u};if(t==2&&o&&(d=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:d};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Ir(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new x(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Ir(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new x(Bt(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new x(Bt(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let g=0;g<s.length;g++)this.openFrontierNode(s[g]);let o=this.unplaced,l=r?r.content:o.content,a=o.openStart-e,c=0,d=[],{match:u,type:h}=this.frontier[t];if(i){for(let g=0;g<i.childCount;g++)d.push(i.child(g));u=u.matchFragment(i)}let f=l.size+e-(o.content.size-o.openEnd);for(;c<l.childCount;){let g=l.child(c),y=u.matchType(g.type);if(!y)break;c++,(c>1||a==0||g.content.size)&&(u=y,d.push(Sl(g.mark(h.allowedMarks(g.marks)),c==1?a:0,c==l.childCount?f:-1)))}let p=c==l.childCount;p||(f=-1),this.placed=_t(this.placed,t,k.from(d)),this.frontier[t].match=u,p&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=l;g<f;g++){let b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=p?e==0?x.empty:new x(Bt(o.content,e-1,1),e-1,f<0?o.openEnd:e-1):new x(Bt(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Rr(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=Rr(e,t,i,r,s);if(o){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],d=Rr(e,l,c,a,!0);if(!d||d.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=_t(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=_t(this.placed,this.depth,k.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(k.empty,!0);t.childCount&&(this.placed=_t(this.placed,this.frontier.length,t))}}function Bt(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Bt(n.firstChild.content,e-1,t)))}function _t(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(_t(n.lastChild.content,e-1,t)))}function Ir(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Sl(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,Sl(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(k.empty,!0)))),n.copy(r)}function Rr(n,e,t,r,i){let s=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,o);return l&&!fd(t,s.content,o)?l:null}function fd(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function pd(n){return n.spec.defining||n.spec.definingForContent}function md(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),s=n.doc.resolve(t);if(kl(i,s,r))return n.step(new q(e,t,r));let o=Cl(i,n.doc.resolve(t));o[o.length-1]==0&&o.pop();let l=-(i.depth+1);o.unshift(l);for(let h=i.depth,f=i.pos-1;h>0;h--,f--){let p=i.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(h)>-1?l=h:i.before(h)==f&&o.splice(1,0,-h)}let a=o.indexOf(l),c=[],d=r.openStart;for(let h=r.content,f=0;;f++){let p=h.firstChild;if(c.push(p),f==r.openStart)break;h=p.content}for(let h=d-1;h>=0;h--){let f=c[h],p=pd(f.type);if(p&&!f.sameMarkup(i.node(Math.abs(l)-1)))d=h;else if(p||!f.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let f=(h+d+1)%(r.openStart+1),p=c[f];if(p)for(let g=0;g<o.length;g++){let y=o[(g+a)%o.length],b=!0;y<0&&(b=!1,y=-y);let C=i.node(y-1),O=i.index(y-1);if(C.canReplaceWith(O,O,p.type,p.marks))return n.replace(i.before(y),b?s.after(y):t,new x(xl(r.content,0,r.openStart,f),f,r.openEnd))}}let u=n.steps.length;for(let h=o.length-1;h>=0&&(n.replace(e,t,r),!(n.steps.length>u));h--){let f=o[h];f<0||(e=i.before(f),t=s.after(f))}}function xl(n,e,t,r,i){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(xl(s.content,e+1,t,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(k.empty,!0))}return n}function gd(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=dd(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new x(k.from(r),0,0))}function yd(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),s=Cl(r,i);for(let o=0;o<s.length;o++){let l=s[o],a=o==s.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return n.delete(r.start(l),i.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return n.delete(r.before(l),i.after(l))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&i.end(o)-t!=i.depth-o)return n.delete(r.before(o),t);n.delete(e,t)}function Cl(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(s<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class Et extends Z{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return V.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return V.fromReplace(e,this.pos,this.pos+1,new x(k.from(i),0,t.isLeaf?0:1))}getMap(){return ae.empty}invert(e){return new Et(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Et(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Et(t.pos,t.attr,t.value)}}Z.jsonID("attr",Et);class Gt extends Z{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return V.ok(r)}getMap(){return ae.empty}invert(e){return new Gt(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Gt(t.attr,t.value)}}Z.jsonID("docAttr",Gt);let Mt=class extends Error{};Mt=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Mt.prototype=Object.create(Error.prototype);Mt.prototype.constructor=Mt;Mt.prototype.name="TransformError";class El{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Vt}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Mt(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=x.empty){let i=Pi(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new x(k.from(r),0,0))}delete(e,t){return this.replace(e,t,x.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return md(this,e,t,r),this}replaceRangeWith(e,t,r){return gd(this,e,t,r),this}deleteRange(e,t){return yd(this,e,t),this}lift(e,t){return td(this,e,t),this}join(e,t=1){return cd(this,e,t),this}wrap(e,t){return id(this,e,t),this}setBlockType(e,t=e,r,i=null){return sd(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return ld(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Et(e,t,r)),this}setDocAttribute(e,t){return this.step(new Gt(e,t)),this}addNodeMark(e,t){return this.step(new Ke(e,t)),this}removeNodeMark(e,t){if(!(t instanceof _)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new Ot(e,t)),this}split(e,t=1,r){return ad(this,e,t,r),this}addMark(e,t,r){return Xc(this,e,t,r),this}removeMark(e,t,r){return Qc(this,e,t,r),this}clearIncompatible(e,t,r){return Zc(this,e,t,r),this}}const Pr=Object.create(null);class D{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new bd(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=x.empty){let r=t.content.lastChild,i=null;for(let l=0;l<t.openEnd;l++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:a,$to:c}=o[l],d=e.mapping.slice(s);e.replaceRange(d.map(a.pos),d.map(c.pos),l?x.empty:t),l==0&&Ss(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:l}=i[s],a=e.mapping.slice(r),c=a.map(o.pos),d=a.map(l.pos);s?e.deleteRange(c,d):(e.replaceRangeWith(c,d,t),Ss(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new I(e):gt(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=t<0?gt(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):gt(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new be(e.node(0))}static atStart(e){return gt(e,e,0,0,1)||new be(e)}static atEnd(e){return gt(e,e,e.content.size,e.childCount,-1)||new be(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Pr[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Pr)throw new RangeError("Duplicate use of selection JSON ID "+e);return Pr[e]=t,t.prototype.jsonID=e,t}getBookmark(){return I.between(this.$anchor,this.$head).getBookmark()}}D.prototype.visible=!0;class bd{constructor(e,t){this.$from=e,this.$to=t}}let bs=!1;function ks(n){!bs&&!n.parent.inlineContent&&(bs=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class I extends D{constructor(e,t=e){ks(e),ks(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return D.near(r);let i=e.resolve(t.map(this.anchor));return new I(i.parent.inlineContent?i:r,r)}replace(e,t=x.empty){if(super.replace(e,t),t==x.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof I&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new hr(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new I(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let s=D.findFrom(t,r,!0)||D.findFrom(t,-r,!0);if(s)t=s.$head;else return D.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(D.findFrom(e,-r,!0)||D.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new I(e,t)}}D.jsonID("text",I);class hr{constructor(e,t){this.anchor=e,this.head=t}map(e){return new hr(e.map(this.anchor),e.map(this.head))}resolve(e){return I.between(e.resolve(this.anchor),e.resolve(this.head))}}class w extends D{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:i}=t.mapResult(this.anchor),s=e.resolve(i);return r?D.near(s):new w(s)}content(){return new x(k.from(this.node),0,0)}eq(e){return e instanceof w&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Li(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new w(e.resolve(t.anchor))}static create(e,t){return new w(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}w.prototype.visible=!1;D.jsonID("node",w);class Li{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new hr(r,r):new Li(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&w.isSelectable(r)?new w(t):D.near(t)}}class be extends D{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=x.empty){if(t==x.empty){e.delete(0,e.doc.content.size);let r=D.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new be(e)}map(e){return new be(e)}eq(e){return e instanceof be}getBookmark(){return kd}}D.jsonID("all",be);const kd={map(){return this},resolve(n){return new be(n)}};function gt(n,e,t,r,i,s=!1){if(e.inlineContent)return I.create(n,t);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let l=e.child(o);if(l.isAtom){if(!s&&w.isSelectable(l))return w.create(n,t-(i<0?l.nodeSize:0))}else{let a=gt(n,l,t+i,i<0?l.childCount:0,i,s);if(a)return a}t+=l.nodeSize*i}return null}function Ss(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof q||i instanceof $))return;let s=n.mapping.maps[r],o;s.forEach((l,a,c,d)=>{o==null&&(o=d)}),n.setSelection(D.near(n.doc.resolve(o),t))}const xs=1,dn=2,Cs=4;class Sd extends El{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|xs)&~dn,this.storedMarks=null,this}get selectionSet(){return(this.updated&xs)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=dn,this}ensureMarks(e){return _.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&dn)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~dn,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||_.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,s)),this.selection.empty||this.setSelection(D.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Cs,this}get scrolledIntoView(){return(this.updated&Cs)>0}}function Es(n,e){return!e||!n?n:n.bind(e)}class Ft{constructor(e,t,r){this.name=e,this.init=Es(t.init,r),this.apply=Es(t.apply,r)}}const xd=[new Ft("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Ft("selection",{init(n,e){return n.selection||D.atStart(e.doc)},apply(n){return n.selection}}),new Ft("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Ft("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Lr{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=xd.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Ft(r.key,r.spec.state,r))})}}class St{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let l=this.config.plugins[o];if(l.spec.appendTransaction){let a=i?i[o].n:0,c=i?i[o].state:this,d=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,c,r);if(d&&r.filterTransaction(d,o)){if(d.setMeta("appendedTransaction",e),!i){i=[];for(let u=0;u<this.config.plugins.length;u++)i.push(u<o?{state:r,n:t.length}:{state:this,n:0})}t.push(d),r=r.applyInner(d),s=!0}i&&(i[o]={state:r,n:t.length})}}if(!s)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new St(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new Sd(this)}static create(e){let t=new Lr(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new St(t);for(let i=0;i<t.fields.length;i++)r[t.fields[i].name]=t.fields[i].init(e,r);return r}reconfigure(e){let t=new Lr(this.schema,e.plugins),r=t.fields,i=new St(t);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(t[r]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Lr(e.schema,e.plugins),s=new St(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=lt.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=D.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){s[o.name]=c.fromJSON.call(a,e,t[l],s);return}}s[o.name]=o.init(e,s)}}),s}}function Tl(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Tl(i,e,{})),t[r]=i}return t}class U{constructor(e){this.spec=e,this.props={},e.props&&Tl(e.props,this,this.props),this.key=e.key?e.key.key:Ol("plugin")}getState(e){return e[this.key]}}const Br=Object.create(null);function Ol(n){return n in Br?n+"$"+ ++Br[n]:(Br[n]=0,n+"$")}class ee{constructor(e="key"){this.key=Ol(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const te=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Yt=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Ts=null;const Ne=function(n,e,t){let r=Ts||(Ts=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},ut=function(n,e,t,r){return t&&(Os(n,e,t,r,-1)||Os(n,e,t,r,1))},Cd=/^(img|br|input|textarea|hr)$/i;function Os(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Ee(n))){let s=n.parentNode;if(!s||s.nodeType!=1||Bi(n)||Cd.test(n.nodeName)||n.contentEditable=="false")return!1;e=te(n)+(i<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?Ee(n):0}else return!1}}function Ee(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Ed(n,e,t){for(let r=e==0,i=e==Ee(n);r||i;){if(n==t)return!0;let s=te(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,i=i&&s==Ee(n)}}function Bi(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const fr=function(n){return n.focusNode&&ut(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function tt(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Td(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Od(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:r.startOffset}}}const Me=typeof navigator<"u"?navigator:null,Ms=typeof document<"u"?document:null,Qe=Me&&Me.userAgent||"",ai=/Edge\/(\d+)/.exec(Qe),Ml=/MSIE \d/.exec(Qe),ci=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Qe),oe=!!(Ml||ci||ai),We=Ml?document.documentMode:ci?+ci[1]:ai?+ai[1]:0,ke=!oe&&/gecko\/(\d+)/i.test(Qe);ke&&+(/Firefox\/(\d+)/.exec(Qe)||[0,0])[1];const di=!oe&&/Chrome\/(\d+)/.exec(Qe),Y=!!di,Md=di?+di[1]:0,ne=!oe&&!!Me&&/Apple Computer/.test(Me.vendor),wt=ne&&(/Mobile\/\w+/.test(Qe)||!!Me&&Me.maxTouchPoints>2),fe=wt||(Me?/Mac/.test(Me.platform):!1),wd=Me?/Win/.test(Me.platform):!1,ye=/Android \d/.test(Qe),on=!!Ms&&"webkitFontSmoothing"in Ms.documentElement.style,vd=on?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Ad(n){return{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function ve(n,e){return typeof n=="number"?n:n[e]}function Nd(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function ws(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let o=t||n.dom;o;o=Yt(o)){if(o.nodeType!=1)continue;let l=o,a=l==s.body,c=a?Ad(s):Nd(l),d=0,u=0;if(e.top<c.top+ve(r,"top")?u=-(c.top-e.top+ve(i,"top")):e.bottom>c.bottom-ve(r,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+ve(i,"top")-c.top:e.bottom-c.bottom+ve(i,"bottom")),e.left<c.left+ve(r,"left")?d=-(c.left-e.left+ve(i,"left")):e.right>c.right-ve(r,"right")&&(d=e.right-c.right+ve(i,"right")),d||u)if(a)s.defaultView.scrollBy(d,u);else{let h=l.scrollLeft,f=l.scrollTop;u&&(l.scrollTop+=u),d&&(l.scrollLeft+=d);let p=l.scrollLeft-h,g=l.scrollTop-f;e={left:e.left-p,top:e.top-g,right:e.right-p,bottom:e.bottom-g}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function Dd(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let l=n.root.elementFromPoint(s,o);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:wl(n.dom)}}function wl(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Yt(r));return e}function Id({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;vl(t,r==0?0:r-e)}function vl(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:s}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let ft=null;function Rd(n){if(n.setActive)return n.setActive();if(ft)return n.focus(ft);let e=wl(n);n.focus(ft==null?{get preventScroll(){return ft={preventScroll:!0},!0}}:void 0),ft||(ft=!1,vl(e,0))}function Al(n,e){let t,r=2e8,i,s=0,o=e.top,l=e.top,a,c;for(let d=n.firstChild,u=0;d;d=d.nextSibling,u++){let h;if(d.nodeType==1)h=d.getClientRects();else if(d.nodeType==3)h=Ne(d).getClientRects();else continue;for(let f=0;f<h.length;f++){let p=h[f];if(p.top<=o&&p.bottom>=l){o=Math.max(p.bottom,o),l=Math.min(p.top,l);let g=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(g<r){t=d,r=g,i=g&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,d.nodeType==1&&g&&(s=u+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=d,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=u+1)}}return!t&&a&&(t=a,i=c,r=0),t&&t.nodeType==3?Pd(t,i):!t||r&&t.nodeType==1?{node:n,offset:s}:Al(t,i)}function Pd(n,e){let t=n.nodeValue.length,r=document.createRange();for(let i=0;i<t;i++){r.setEnd(n,i+1),r.setStart(n,i);let s=Fe(r,1);if(s.top!=s.bottom&&_i(e,s))return{node:n,offset:i+(e.left>=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}function _i(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function Ld(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function Bd(n,e,t){let{node:r,offset:i}=Al(e,t),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,i,s)}function _d(n,e,t,r){let i=-1;for(let s=e,o=!1;s!=n.dom;){let l=n.docView.nearestDesc(s,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent&&!o||!l.contentDOM)){let a=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&!o&&(o=!0,a.left>r.left||a.top>r.top?i=l.posBefore:(a.right<r.left||a.bottom<r.top)&&(i=l.posAfter)),!l.contentDOM&&i<0&&!l.node.isText)return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter}s=l.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function Nl(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),s=i;;){let o=n.childNodes[s];if(o.nodeType==1){let l=o.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(_i(e,c))return Nl(o,e,c)}}if((s=(s+1)%r)==i)break}return n}function Fd(n,e){let t=n.dom.ownerDocument,r,i=0,s=Od(t,e.left,e.top);s&&({node:r,offset:i}=s);let o=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!o||!n.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=n.dom.getBoundingClientRect();if(!_i(e,c)||(o=Nl(n.dom,e,c),!o))return null}if(ne)for(let c=o;r&&c;c=Yt(c))c.draggable&&(r=void 0);if(o=Ld(o,e),r){if(ke&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let d=r.childNodes[i],u;d.nodeName=="IMG"&&(u=d.getBoundingClientRect()).right<=e.left&&u.bottom>e.top&&i++}let c;on&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=_d(n,r,i,e))}l==null&&(l=Bd(n,o,e));let a=n.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function vs(n){return n.top<n.bottom||n.left<n.right}function Fe(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(vs(r))return r}return Array.prototype.find.call(t,vs)||n.getBoundingClientRect()}const zd=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Dl(n,e,t){let{node:r,offset:i,atom:s}=n.docView.domFromPos(e,t<0?-1:1),o=on||ke;if(r.nodeType==3)if(o&&(zd.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let a=Fe(Ne(r,i,i),t);if(ke&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=Fe(Ne(r,i-1,i-1),-1);if(c.top==a.top){let d=Fe(Ne(r,i,i+1),-1);if(d.top!=a.top)return Pt(d,d.left<c.left)}}return a}else{let a=i,c=i,d=t<0?1:-1;return t<0&&!i?(c++,d=-1):t>=0&&i==r.nodeValue.length?(a--,d=1):t<0?a--:c++,Pt(Fe(Ne(r,a,c),d),d<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==Ee(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return _r(a.getBoundingClientRect(),!1)}if(s==null&&i<Ee(r)){let a=r.childNodes[i];if(a.nodeType==1)return _r(a.getBoundingClientRect(),!0)}return _r(r.getBoundingClientRect(),t>=0)}if(s==null&&i&&(t<0||i==Ee(r))){let a=r.childNodes[i-1],c=a.nodeType==3?Ne(a,Ee(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return Pt(Fe(c,1),!1)}if(s==null&&i<Ee(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?Ne(a,0,o?0:1):a.nodeType==1?a:null:null;if(c)return Pt(Fe(c,-1),!0)}return Pt(Fe(r.nodeType==3?Ne(r):r,-t),t>=0)}function Pt(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function _r(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function Il(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function Hd(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return Il(n,e,()=>{let{node:s}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=Dl(n,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=Ne(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let d=a[c];if(d.bottom>d.top+1&&(t=="up"?o.top-d.top>(d.bottom-o.top)*2:d.bottom-o.bottom>(o.bottom-d.top)*2))return!1}}return!0})}const Vd=/[\u0590-\u08ac]/;function $d(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,l=n.domSelection();return!Vd.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?s:o:Il(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:d,anchorOffset:u}=n.domSelectionRange(),h=l.caretBidiLevel;l.modify("move",t,"character");let f=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:g}=n.domSelectionRange(),y=p&&!f.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==g;try{l.collapse(d,u),a&&(a!=d||c!=u)&&l.extend&&l.extend(a,c)}catch{}return h!=null&&(l.caretBidiLevel=h),y})}let As=null,Ns=null,Ds=!1;function jd(n,e,t){return As==e&&Ns==t?Ds:(As=e,Ns=t,Ds=t=="up"||t=="down"?Hd(n,e,t):$d(n,e,t))}const pe=0,Is=1,nt=2,we=3;class ln{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=pe,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let i=this.children[t];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>te(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let i=this.children[t],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)i=i.children[0];return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.size;if(l>e||o instanceof Pl){i=e-s;break}s=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof Rl&&s.side>=0;r--);if(t<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?te(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?te(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,l=0;;l++){let a=this.children[l],c=o+a.size;if(i==-1&&e<=c){let d=o+a.border;if(e>=d&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,d);e=o;for(let u=l;u>0;u--){let h=this.children[u-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=te(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(c>t||l==this.children.length-1)){t=c;for(let d=l+1;d<this.children.length;d++){let u=this.children[d];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(-1)){s=te(u.dom);break}t+=u.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,i=!1){let s=Math.min(e,t),o=Math.max(e,t);for(let h=0,f=0;h<this.children.length;h++){let p=this.children[h],g=f+p.size;if(s>f&&o<g)return p.setSelection(e-f-p.border,t-f-p.border,r,i);f=g}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),c=r.getSelection(),d=!1;if((ke||ne)&&e==t){let{node:h,offset:f}=l;if(h.nodeType==3){if(d=!!(f&&h.nodeValue[f-1]==`
@@ -1460,8 +1460,9 @@ const md = /* @__PURE__ */ de(fd, [["render", pd]]), gd = {
1460
1460
  }
1461
1461
  },
1462
1462
  mounted() {
1463
+ var e;
1463
1464
  const n = this.externalAnchor ? this.$refs.anchor.getRootNode().querySelector(`#${this.externalAnchor}`) : null;
1464
- this.anchorEl = n ?? this.$refs.anchor.children[0], this.popoverContentEl = this.$refs.content.$el, this.isOpen && (this.initTippyInstance(), this.tip.show()), this.intersectionObserver = new IntersectionObserver(this.hasIntersectedViewport), this.intersectionObserver.observe(this.popoverContentEl);
1465
+ this.anchorEl = n ?? this.$refs.anchor.children[0], this.popoverContentEl = (e = this.$refs.content) == null ? void 0 : e.$el, this.isOpen && (this.initTippyInstance(), this.tip.show()), this.intersectionObserver = new IntersectionObserver(this.hasIntersectedViewport), this.intersectionObserver.observe(this.popoverContentEl);
1465
1466
  },
1466
1467
  beforeUnmount() {
1467
1468
  var n;
@@ -1567,7 +1568,8 @@ const md = /* @__PURE__ */ de(fd, [["render", pd]]), gd = {
1567
1568
  this.focusInitialElement(), await this.$nextTick(), this.preventScrolling(), this.$emit("opened", !0, this.$refs.popover__content), this.open !== null && this.$emit("update:open", !0);
1568
1569
  },
1569
1570
  focusInitialElement() {
1570
- this.initialFocusElement === "dialog" && this.$refs.content.$el.focus(), this.initialFocusElement.startsWith("#") && this.focusInitialElementById(), this.initialFocusElement === "first" && this.focusFirstElementIfNeeded(this.$refs.popover__content), this.initialFocusElement instanceof HTMLElement && this.initialFocusElement.focus();
1571
+ var n, e;
1572
+ this.initialFocusElement === "dialog" && ((e = (n = this.$refs.content) == null ? void 0 : n.$el) == null || e.focus()), this.initialFocusElement.startsWith("#") && this.focusInitialElementById(), this.initialFocusElement === "first" && this.focusFirstElementIfNeeded(this.$refs.popover__content), this.initialFocusElement instanceof HTMLElement && this.initialFocusElement.focus();
1571
1573
  },
1572
1574
  focusInitialElementById() {
1573
1575
  var e, t, r;
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../../directives/tooltip/tooltip.js"],"names":[],"mappings":";;IAME,iCAgFC"}
1
+ {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../../directives/tooltip/tooltip.js"],"names":[],"mappings":";;IAME,iCAkGC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dialpad/dialtone",
3
- "version": "9.14.1",
3
+ "version": "9.14.2",
4
4
  "description": "Dialpad's Dialtone design system monorepo",
5
5
  "devDependencies": {
6
6
  "@commitlint/cli": "^18.4.3",