@midnight-owl/ui 1.0.0

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 (69) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +68 -0
  3. package/dist/components/buttons/Button.vue.d.ts +44 -0
  4. package/dist/components/buttons/ButtonGroup.vue.d.ts +19 -0
  5. package/dist/components/data-display/Badge.vue.d.ts +34 -0
  6. package/dist/components/data-display/BubbleChat.vue.d.ts +52 -0
  7. package/dist/components/data-display/Image.vue.d.ts +56 -0
  8. package/dist/components/data-display/Pagination.vue.d.ts +60 -0
  9. package/dist/components/data-display/ProgressBar.vue.d.ts +34 -0
  10. package/dist/components/data-display/SkeletonLoader.vue.d.ts +14 -0
  11. package/dist/components/data-display/Table.vue.d.ts +182 -0
  12. package/dist/components/data-display/calendar/Calendar.vue.d.ts +116 -0
  13. package/dist/components/data-display/calendar/CalendarAgendaView.vue.d.ts +31 -0
  14. package/dist/components/data-display/calendar/CalendarEventDetails.vue.d.ts +23 -0
  15. package/dist/components/data-display/calendar/CalendarEventPill.vue.d.ts +39 -0
  16. package/dist/components/data-display/calendar/CalendarEventPopover.vue.d.ts +68 -0
  17. package/dist/components/data-display/calendar/CalendarMonthView.vue.d.ts +54 -0
  18. package/dist/components/data-display/calendar/CalendarTimeGridView.vue.d.ts +47 -0
  19. package/dist/components/data-display/calendar/CalendarYearView.vue.d.ts +17 -0
  20. package/dist/components/data-display/calendar/layout.d.ts +39 -0
  21. package/dist/components/data-display/calendar/providers/google.d.ts +16 -0
  22. package/dist/components/data-display/calendar/providers/ics.d.ts +23 -0
  23. package/dist/components/data-display/calendar/recurrence.d.ts +12 -0
  24. package/dist/components/data-display/calendar/types.d.ts +154 -0
  25. package/dist/components/data-display/calendar/tz.d.ts +17 -0
  26. package/dist/components/data-display/calendar/useCalendar.d.ts +75 -0
  27. package/dist/components/form-element/Autocomplete.vue.d.ts +78 -0
  28. package/dist/components/form-element/Checkbox.vue.d.ts +47 -0
  29. package/dist/components/form-element/DatePicker.vue.d.ts +75 -0
  30. package/dist/components/form-element/FileUpload.vue.d.ts +125 -0
  31. package/dist/components/form-element/InputGroup.vue.d.ts +26 -0
  32. package/dist/components/form-element/InputMask.vue.d.ts +43 -0
  33. package/dist/components/form-element/InputNumber.vue.d.ts +50 -0
  34. package/dist/components/form-element/InputOtp.vue.d.ts +44 -0
  35. package/dist/components/form-element/InputPassword.vue.d.ts +44 -0
  36. package/dist/components/form-element/InputText.vue.d.ts +42 -0
  37. package/dist/components/form-element/Radio.vue.d.ts +42 -0
  38. package/dist/components/form-element/TextEditor.vue.d.ts +44 -0
  39. package/dist/components/form-element/Textarea.vue.d.ts +46 -0
  40. package/dist/components/form-element/Toggle.vue.d.ts +25 -0
  41. package/dist/components/form-element/select/Select.vue.d.ts +168 -0
  42. package/dist/components/form-element/select/SelectOption.vue.d.ts +23 -0
  43. package/dist/components/form-element/text-editor-toolbar.d.ts +5 -0
  44. package/dist/components/panel/Breadcrumb.vue.d.ts +50 -0
  45. package/dist/components/panel/Card.vue.d.ts +28 -0
  46. package/dist/components/panel/Divider.vue.d.ts +28 -0
  47. package/dist/components/panel/DropDown.vue.d.ts +26 -0
  48. package/dist/components/panel/Modal.vue.d.ts +80 -0
  49. package/dist/components/panel/Popover.vue.d.ts +68 -0
  50. package/dist/components/panel/ScrollPanel.vue.d.ts +26 -0
  51. package/dist/components/panel/Stepper.vue.d.ts +179 -0
  52. package/dist/components/panel/Tabs.vue.d.ts +31 -0
  53. package/dist/components/panel/Toolbar.vue.d.ts +30 -0
  54. package/dist/components/panel/accordion/Accordion.vue.d.ts +31 -0
  55. package/dist/components/panel/accordion/AccordionPanel.vue.d.ts +35 -0
  56. package/dist/components/panel/toast/ToastErrorNode.vue.d.ts +10 -0
  57. package/dist/components/panel/toast/ToastItem.vue.d.ts +14 -0
  58. package/dist/components/panel/toast/ToastProvider.vue.d.ts +3 -0
  59. package/dist/components/panel/toast/errorTree.d.ts +12 -0
  60. package/dist/components/panel/toast/useToast.d.ts +164 -0
  61. package/dist/index.d.ts +60 -0
  62. package/dist/plugins/init-icons.d.ts +1 -0
  63. package/dist/plugins/init-theme.d.ts +4 -0
  64. package/dist/theme/presets.d.ts +75 -0
  65. package/dist/theme/remote.d.ts +2 -0
  66. package/dist/ui.css +3 -0
  67. package/dist/ui.es.js +29640 -0
  68. package/dist/ui.umd.js +234 -0
  69. package/package.json +82 -0
package/dist/ui.umd.js ADDED
@@ -0,0 +1,234 @@
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("vue"),require("@iconify/vue"),require("maska/vue"),require("@floating-ui/vue"),require("date-fns")):typeof define==`function`&&define.amd?define([`exports`,`vue`,`@iconify/vue`,`maska/vue`,`@floating-ui/vue`,`date-fns`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.MidnightOwlUI={},e.Vue,e.IconifyVue,e.MaskaVue,e.FloatingVue,e.dateFns))})(this,function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var o=[`disabled`],s={key:2,class:`truncate`},c=(0,t.defineComponent)({__name:`Button`,props:{label:{default:void 0},icon:{default:void 0},iconPos:{default:`left`},badge:{default:void 0},badgeSeverity:{default:`danger`},variant:{default:`solid`},severity:{default:`primary`},size:{default:`sm`},rounded:{type:Boolean,default:!1},block:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},raised:{type:Boolean,default:!1}},setup(e){let r=e,i=(0,t.useSlots)(),a=(0,t.computed)(()=>!r.label&&!i.default),c=(0,t.computed)(()=>{let e=r.block?`w-full flex`:`inline-flex`,t=r.rounded?`rounded-full`:`rounded-md`,n={xs:a.value?`w-7 h-7 text-[11px]`:`px-2.5 py-1 text-[11px]`,sm:a.value?`w-8 h-8 text-xs`:`px-3 py-1.5 text-xs`,md:a.value?`w-10 h-10 text-sm`:`px-4 py-2 text-sm`,lg:a.value?`w-12 h-12 text-base`:`px-6 py-3 text-base`,xl:a.value?`w-14 h-14 text-lg`:`px-8 py-4 text-lg`},i={left:`flex-row`,right:`flex-row-reverse`,top:`flex-col`,bottom:`flex-col-reverse`},o=r.raised?`shadow-md hover:shadow-lg`:r.variant===`solid`?`shadow-sm hover:shadow-md`:``;return[`inline-flex items-center justify-center gap-2 font-medium transition-all duration-200 outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-main disabled:opacity-50 disabled:cursor-not-allowed select-none cursor-pointer`,e,t,n[r.size],i[r.iconPos],o]}),l=(0,t.computed)(()=>{let e=`active:scale-[0.98] transition-all disabled:pointer-events-none disabled:active:scale-100`;return r.variant===`solid`?{primary:`bg-primary text-on-primary hover:brightness-110 focus-visible:ring-primary ${e}`,secondary:`bg-muted text-main border border-main hover:brightness-110 focus-visible:ring-primary ${e}`,success:`bg-success text-on-success hover:brightness-110 focus-visible:ring-success ${e}`,warning:`bg-warning text-on-warning hover:brightness-110 focus-visible:ring-warning ${e}`,danger:`bg-danger text-on-danger hover:brightness-110 focus-visible:ring-danger ${e}`,info:`bg-info text-on-info hover:brightness-110 focus-visible:ring-info ${e}`}[r.severity]:r.variant===`soft`?{primary:`bg-primary/10 text-primary border border-primary/10 hover:bg-primary/20 focus-visible:ring-primary ${e}`,secondary:`bg-muted/20 text-main border border-muted/20 hover:bg-muted/30 focus-visible:ring-primary ${e}`,success:`bg-success/10 text-success border border-success/10 hover:bg-success/20 focus-visible:ring-success ${e}`,warning:`bg-warning/10 text-warning border border-warning/10 hover:bg-warning/20 focus-visible:ring-warning ${e}`,danger:`bg-danger/10 text-danger border border-danger/10 hover:bg-danger/20 focus-visible:ring-danger ${e}`,info:`bg-info/10 text-info border border-info/10 hover:bg-info/20 focus-visible:ring-info ${e}`}[r.severity]:r.variant===`outline`?{primary:`border-2 border-primary text-primary hover:bg-current/10 focus-visible:ring-primary ${e}`,secondary:`border-2 border-main text-main hover:bg-current/10 focus-visible:ring-primary ${e}`,success:`border-2 border-success text-success hover:bg-current/10 focus-visible:ring-success ${e}`,warning:`border-2 border-warning text-warning hover:bg-current/10 focus-visible:ring-warning ${e}`,danger:`border-2 border-danger text-danger hover:bg-current/10 focus-visible:ring-danger ${e}`,info:`border-2 border-info text-info hover:bg-current/10 focus-visible:ring-info ${e}`}[r.severity]:r.variant===`text`?{primary:`text-primary hover:bg-current/10 focus-visible:ring-primary bg-transparent ${e}`,secondary:`text-muted hover:text-main hover:bg-current/10 focus-visible:ring-primary bg-transparent ${e}`,success:`text-success hover:bg-current/10 focus-visible:ring-success bg-transparent ${e}`,warning:`text-warning hover:bg-current/10 focus-visible:ring-warning bg-transparent ${e}`,danger:`text-danger hover:bg-current/10 focus-visible:ring-danger bg-transparent ${e}`,info:`text-info hover:bg-current/10 focus-visible:ring-info bg-transparent ${e}`}[r.severity]:r.variant===`link`?`p-0 h-auto w-auto text-primary hover:underline hover:opacity-80 focus-visible:ring-primary shadow-none bg-transparent ${e}`:``}),u=(0,t.computed)(()=>{let e=`inline-flex items-center justify-center min-w-5 h-5 px-1.5 rounded-full text-[10px] font-bold`,t={primary:`bg-primary text-on-primary`,secondary:`bg-secondary text-on-secondary`,danger:`bg-danger text-on-danger`,success:`bg-success text-on-success`,warning:`bg-warning text-on-warning`,info:`bg-info text-on-info`}[r.badgeSeverity||`danger`];return r.variant===`solid`&&r.severity===`primary`?[e,`bg-(--text-on-primary) text-primary`]:[e,t]});return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,(0,t.mergeProps)({class:[c.value,l.value],disabled:e.disabled||e.loading},r.$attrs),[e.loading?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:loader-2`,class:`h-4 w-4 shrink-0 animate-spin`})):e.icon||r.$slots.icon?(0,t.renderSlot)(r.$slots,`icon`,{key:1},()=>[e.icon?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:e.icon,class:`h-4 w-4 shrink-0`},null,8,[`icon`])):(0,t.createCommentVNode)(``,!0)]):(0,t.createCommentVNode)(``,!0),e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,s,(0,t.toDisplayString)(e.label),1)):(0,t.renderSlot)(r.$slots,`default`,{key:3}),e.badge?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:4,class:(0,t.normalizeClass)(u.value)},(0,t.toDisplayString)(e.badge),3)):(0,t.createCommentVNode)(``,!0)],16,o))}}),l=[`aria-label`],u=(0,t.defineComponent)({__name:`ButtonGroup`,props:{orientation:{default:`horizontal`},size:{}},setup(e){let n=e,r={xs:`[&>button]:!h-7 [&>button]:!px-2.5 [&>button]:!text-[11px]`,sm:`[&>button]:!h-8 [&>button]:!px-3 [&>button]:!text-xs`,md:`[&>button]:!h-10 [&>button]:!px-4 [&>button]:!text-sm`,lg:`[&>button]:!h-12 [&>button]:!px-6 [&>button]:!text-base`,xl:`[&>button]:!h-14 [&>button]:!px-8 [&>button]:!text-lg`},i=(0,t.computed)(()=>{let e=`inline-flex [&>button]:relative [&>button:hover]:z-10 [&>button:focus-visible]:z-10`,t=n.size?r[n.size]:``;return n.orientation===`vertical`?[e,t,`flex-col items-stretch`,`[&>button:not(:first-child)]:-mt-px`,`[&>button:not(:first-child)]:!rounded-t-none`,`[&>button:not(:last-child)]:!rounded-b-none`]:[e,t,`flex-row items-stretch`,`[&>button:not(:first-child)]:-ml-px`,`[&>button:not(:first-child)]:!rounded-l-none`,`[&>button:not(:last-child)]:!rounded-r-none`]});return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)(i.value),role:`group`,"aria-label":`${e.orientation} button group`},[(0,t.renderSlot)(n.$slots,`default`)],10,l))}}),d=[`for`],f={key:0,class:`text-danger`},p={class:`flex w-full min-w-0 flex-col gap-1.5`},m=[`disabled`],h=[`id`,`min`,`max`,`step`,`disabled`,`placeholder`,`aria-invalid`,`value`],g={key:3,class:`flex shrink-0 flex-col`},_=[`disabled`],v=[`disabled`],y=[`disabled`],b={key:0,class:`mt-0.5 flex flex-col gap-1`},x={class:`min-w-0`},S=(0,t.defineComponent)({inheritAttrs:!1,__name:`InputNumber`,props:(0,t.mergeModels)({id:{},label:{},labelPosition:{default:`top`},required:{type:Boolean,default:!1},placeholder:{},disabled:{type:Boolean,default:!1},error:{type:[String,Boolean,Array],default:!1},min:{},max:{},step:{default:1},showButtons:{type:Boolean,default:!0},orientation:{default:`vertical`},incrementIcon:{},decrementIcon:{},prefix:{},suffix:{},size:{default:`sm`},keyfilter:{}},{modelValue:{},modelModifiers:{}}),emits:(0,t.mergeModels)([`focus`,`blur`,`input`,`change`],[`update:modelValue`]),setup(e,{emit:r}){let i=e,a=r,o=(0,t.useModel)(e,`modelValue`),s=i.id||`input-num-${(0,t.useId)()}`,c=e=>{if(!i.keyfilter||e.ctrlKey||e.metaKey||[`Backspace`,`Tab`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Enter`,`Delete`,`Escape`].includes(e.key))return;let t=typeof i.keyfilter==`string`?{int:/[\d\-]/,num:/[\d\-\.]/,alpha:/[a-zA-Z\s]/,alphanum:/[a-zA-Z0-9\s]/}[i.keyfilter]:i.keyfilter;t&&!t.test(e.key)&&e.preventDefault()},l=e=>{if(i.disabled)return;let t=e;i.max!==void 0&&t>i.max&&(t=i.max),i.min!==void 0&&t<i.min&&(t=i.min);let n=i.step.toString().split(`.`)[1]?.length||0;o.value=Number(t.toFixed(n))},u=()=>{l((o.value??0)+i.step),a(`input`,o.value),a(`change`,o.value)},S=()=>{l((o.value??0)-i.step),a(`input`,o.value),a(`change`,o.value)},C=e=>{let t=e.target,n=parseFloat(t.value);isNaN(n)?o.value=null:o.value=n},w=()=>{o.value!==null&&o.value!==void 0&&l(o.value)},T=null,E=null,D=e=>{i.disabled||(e===`inc`?u():S(),T=setTimeout(()=>{E=setInterval(()=>{e===`inc`?u():S()},50)},400))},O=()=>{T&&clearTimeout(T),E&&clearInterval(E),T=null,E=null},k=(0,t.computed)(()=>i.labelPosition===`top`?``:{xs:`sm:pt-1`,sm:`sm:pt-1.5`,md:`sm:pt-2.5`,lg:`sm:pt-3.5`,xl:`sm:pt-4.5`}[i.size]),A=(0,t.computed)(()=>[`flex items-stretch w-full bg-content border rounded-md transition-all duration-200 overflow-hidden group outline-none focus-within:ring-4 focus-within:ring-offset-0`,i.disabled?`bg-muted border-main opacity-70 cursor-not-allowed`:i.error?`border-danger focus-within:border-danger focus-within:ring-danger/20`:`border-main hover:border-primary/50 focus-within:border-primary focus-within:ring-primary/20`,{xs:`h-7`,sm:`h-8`,md:`h-10`,lg:`h-12`,xl:`h-14`}[i.size]]),j=(0,t.computed)(()=>{let e=[`flex-1 w-full h-full bg-transparent p-0 font-medium text-left`,`border-transparent outline-none ring-0 shadow-none`,`focus:border-transparent focus:outline-none focus:ring-0 focus:shadow-none focus:!border-transparent focus:!shadow-none`,`[-moz-appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`].join(` `),t={xs:`text-xs`,sm:`text-xs`,md:`text-sm`,lg:`text-base`,xl:`text-lg`},n=i.disabled?`text-muted placeholder:text-muted placeholder:opacity-50 cursor-not-allowed`:i.error?`text-danger placeholder:text-danger placeholder:opacity-50`:`text-main placeholder:text-muted placeholder:opacity-70`;return[e,t[i.size],n]}),M=(0,t.computed)(()=>[`flex items-center justify-center font-semibold text-muted px-3 select-none`,{xs:`text-[10px]`,sm:`text-xs`,md:`text-sm`,lg:`text-base`,xl:`text-lg`}[i.size],i.disabled?`opacity-50`:``].join(` `)),N=(0,t.computed)(()=>[`flex items-center justify-center bg-transparent text-muted transition-colors select-none`,i.disabled?`cursor-not-allowed opacity-50`:`cursor-pointer hover:text-primary active:brightness-95`,{xs:`w-6`,sm:`w-6`,md:`w-8`,lg:`w-8`,xl:`w-10`}[i.size]].join(` `)),P=(0,t.computed)(()=>i.incrementIcon||(i.orientation===`horizontal`?`lucide:plus`:`lucide:chevron-up`)),F=(0,t.computed)(()=>i.decrementIcon||(i.orientation===`horizontal`?`lucide:minus`:`lucide:chevron-down`)),ee=(0,t.computed)(()=>!i.error||typeof i.error==`boolean`?[]:Array.isArray(i.error)?i.error:[i.error]);return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`flex w-full`,e.labelPosition===`left`?`flex-col gap-1.5 sm:flex-row sm:gap-6`:`flex-col gap-1.5`])},[e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`label`,{key:0,for:(0,t.unref)(s),class:(0,t.normalizeClass)([`flex shrink-0 items-center gap-1 text-[10px] font-bold tracking-wider text-muted uppercase`,e.labelPosition===`left`?`sm:w-1/3 lg:w-1/4 ${k.value}`:``])},[(0,t.createTextVNode)((0,t.toDisplayString)(e.label)+` `,1),e.required?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,f,`*`)):(0,t.createCommentVNode)(``,!0)],10,d)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,p,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)(A.value)},[e.showButtons&&e.orientation===`horizontal`?((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:0,type:`button`,tabindex:`-1`,disabled:e.disabled,"aria-label":`Decrease value`,class:(0,t.normalizeClass)([N.value,`h-full`]),onMousedown:i[0]||=e=>D(`dec`),onMouseup:O,onMouseleave:O,onTouchstart:i[1]||=(0,t.withModifiers)(e=>D(`dec`),[`prevent`]),onTouchend:(0,t.withModifiers)(O,[`prevent`])},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:F.value,class:`h-3.5 w-3.5`},null,8,[`icon`])],42,m)):(0,t.createCommentVNode)(``,!0),e.prefix?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:(0,t.normalizeClass)([M.value,`border-r border-main bg-muted/50`])},(0,t.toDisplayString)(e.prefix),3)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`input`,(0,t.mergeProps)({id:(0,t.unref)(s),type:`number`,min:e.min,max:e.max,step:e.step,disabled:e.disabled,placeholder:e.placeholder,class:[j.value,e.prefix?`pl-3`:e.orientation===`horizontal`&&e.showButtons?`pl-2`:`pl-3`,e.suffix||e.showButtons?`pr-2`:`pr-3`],"aria-invalid":!!e.error,value:o.value,onInput:i[2]||=e=>{C(e),a(`input`,o.value)},onChange:i[3]||=e=>a(`change`,o.value),onBlur:i[4]||=e=>{w(),a(`blur`,e)},onFocus:i[5]||=e=>a(`focus`,e),onKeydown:c},r.$attrs),null,16,h),e.suffix?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:2,class:(0,t.normalizeClass)(M.value)},(0,t.toDisplayString)(e.suffix),3)):(0,t.createCommentVNode)(``,!0),e.showButtons&&e.orientation===`vertical`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,g,[(0,t.createElementVNode)(`button`,{type:`button`,tabindex:`-1`,disabled:e.disabled,"aria-label":`Increase value`,class:(0,t.normalizeClass)([N.value,`flex-1`]),onMousedown:i[6]||=e=>D(`inc`),onMouseup:O,onMouseleave:O,onTouchstart:i[7]||=(0,t.withModifiers)(e=>D(`inc`),[`prevent`]),onTouchend:(0,t.withModifiers)(O,[`prevent`])},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:P.value,class:`h-3.5 w-3.5`},null,8,[`icon`])],42,_),(0,t.createElementVNode)(`button`,{type:`button`,tabindex:`-1`,disabled:e.disabled,"aria-label":`Decrease value`,class:(0,t.normalizeClass)([N.value,`flex-1`]),onMousedown:i[8]||=e=>D(`dec`),onMouseup:O,onMouseleave:O,onTouchstart:i[9]||=(0,t.withModifiers)(e=>D(`dec`),[`prevent`]),onTouchend:(0,t.withModifiers)(O,[`prevent`])},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:F.value,class:`h-3.5 w-3.5`},null,8,[`icon`])],42,v)])):(0,t.createCommentVNode)(``,!0),e.showButtons&&e.orientation===`horizontal`?((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:4,type:`button`,tabindex:`-1`,disabled:e.disabled,"aria-label":`Increase value`,class:(0,t.normalizeClass)([N.value,`h-full`]),onMousedown:i[10]||=e=>D(`inc`),onMouseup:O,onMouseleave:O,onTouchstart:i[11]||=(0,t.withModifiers)(e=>D(`inc`),[`prevent`]),onTouchend:(0,t.withModifiers)(O,[`prevent`])},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:P.value,class:`h-3.5 w-3.5`},null,8,[`icon`])],42,y)):(0,t.createCommentVNode)(``,!0)],2),ee.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,b,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(ee.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r,class:`flex items-start gap-1.5 text-[11px] leading-tight font-medium text-danger`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:alert-circle`,class:`h-3.5 w-3.5 shrink-0`}),(0,t.createElementVNode)(`span`,x,(0,t.toDisplayString)(e),1)]))),128))])):(0,t.createCommentVNode)(``,!0)])],2))}}),C=[`for`],w={key:0,class:`text-danger`},T={class:`flex w-full min-w-0 flex-1 flex-col gap-1.5`},E=[`id`,`type`,`disabled`,`placeholder`,`aria-invalid`],D={key:0,class:`mt-0.5 flex flex-col gap-1`},O={class:`min-w-0`},k=(0,t.defineComponent)({inheritAttrs:!1,__name:`InputText`,props:(0,t.mergeModels)({type:{default:`text`},id:{},label:{},labelPosition:{default:`top`},required:{type:Boolean,default:!1},placeholder:{},disabled:{type:Boolean,default:!1},error:{type:[String,Boolean,Array],default:!1},iconStart:{},iconEnd:{},size:{default:`sm`},keyfilter:{}},{modelValue:{},modelModifiers:{}}),emits:(0,t.mergeModels)([`focus`,`blur`,`input`,`change`],[`update:modelValue`]),setup(e,{emit:r}){let i=e,a=r,o=(0,t.useModel)(e,`modelValue`),s=i.id||`input-${(0,t.useId)()}`,c=e=>{if(!i.keyfilter||e.ctrlKey||e.metaKey||[`Backspace`,`Tab`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Enter`,`Delete`,`Escape`].includes(e.key))return;let t=typeof i.keyfilter==`string`?{int:/[\d\-]/,num:/[\d\-\.]/,alpha:/[a-zA-Z\s]/,alphanum:/[a-zA-Z0-9\s]/}[i.keyfilter]:i.keyfilter;t&&!t.test(e.key)&&e.preventDefault()},l=(0,t.computed)(()=>i.labelPosition===`top`?``:{xs:`sm:pt-1`,sm:`sm:pt-1.5`,md:`sm:pt-2.5`,lg:`sm:pt-3.5`,xl:`sm:pt-4.5`}[i.size]),u=(0,t.computed)(()=>{let e=i.disabled?`bg-muted border-main opacity-70 cursor-not-allowed`:i.error?`border-danger focus-within:border-danger focus-within:ring-danger/20`:`border-main hover:border-primary/50 focus-within:border-primary focus-within:ring-primary/20`,t={xs:`h-7`,sm:`h-8`,md:`h-10`,lg:`h-12`,xl:`h-14`},n=i.size===`xs`?`px-2`:`px-3`,r=i.size===`xs`?`gap-1.5`:`gap-2`;return[`flex items-center w-full bg-content border rounded-md transition-all duration-200 overflow-hidden outline-none focus-within:ring-4 focus-within:ring-offset-0`,e,t[i.size],n,r]}),d=(0,t.computed)(()=>{let e=[`flex-1 w-full h-full bg-transparent p-0 font-medium`,`border-transparent outline-none ring-0 shadow-none`,`focus:border-transparent focus:outline-none focus:ring-0 focus:shadow-none focus:!border-transparent focus:!shadow-none`,`[-moz-appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-search-decoration]:hidden [&::-webkit-search-cancel-button]:hidden [&::-webkit-search-results-button]:hidden [&::-webkit-search-results-decoration]:hidden [&::-ms-reveal]:hidden [&::-ms-clear]:hidden`].join(` `),t={xs:`text-xs`,sm:`text-xs`,md:`text-sm`,lg:`text-base`,xl:`text-lg`},n=i.disabled?`text-muted placeholder:text-muted placeholder:opacity-50 cursor-not-allowed`:i.error?`text-danger placeholder:text-danger placeholder:opacity-50`:`text-main placeholder:text-muted placeholder:opacity-70`;return[e,t[i.size],n]}),f=(0,t.computed)(()=>({xs:`h-3.5 w-3.5`,sm:`h-4 w-4`,md:`h-4 w-4`,lg:`h-5 w-5`,xl:`h-6 w-6`})[i.size]),p=(0,t.computed)(()=>!i.error||typeof i.error==`boolean`?[]:Array.isArray(i.error)?i.error:[i.error]);return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`flex w-full`,e.labelPosition===`left`?`flex-col gap-1.5 sm:flex-row sm:gap-6`:`flex-col gap-1.5`])},[e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`label`,{key:0,for:(0,t.unref)(s),class:(0,t.normalizeClass)([`flex shrink-0 items-center gap-1 text-[10px] font-bold tracking-wider text-muted uppercase`,e.labelPosition===`left`?`sm:w-1/3 lg:w-1/4 ${l.value}`:``])},[(0,t.createTextVNode)((0,t.toDisplayString)(e.label)+` `,1),e.required?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,w,`*`)):(0,t.createCommentVNode)(``,!0)],10,C)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,T,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)(u.value)},[e.iconStart?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:e.iconStart,class:(0,t.normalizeClass)([`shrink-0 transition-colors`,e.error?`text-danger`:`text-muted`,f.value])},null,8,[`icon`,`class`])):(0,t.createCommentVNode)(``,!0),(0,t.withDirectives)((0,t.createElementVNode)(`input`,(0,t.mergeProps)({id:(0,t.unref)(s),type:e.type,disabled:e.disabled,placeholder:e.placeholder,class:d.value,"aria-invalid":!!e.error,"onUpdate:modelValue":i[0]||=e=>o.value=e,onInput:i[1]||=e=>{let t=e.target.value;o.value=t,a(`input`,t)},onChange:i[2]||=e=>a(`change`,e.target.value),onFocus:i[3]||=e=>a(`focus`,e),onBlur:i[4]||=e=>a(`blur`,e),onKeydown:c},r.$attrs),null,16,E),[[t.vModelDynamic,o.value]]),e.iconEnd?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:1,icon:e.iconEnd,class:(0,t.normalizeClass)([`shrink-0 transition-colors`,e.error?`text-danger`:`text-muted`,f.value])},null,8,[`icon`,`class`])):(0,t.createCommentVNode)(``,!0)],2),p.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,D,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(p.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r,class:`flex items-start gap-1.5 text-[11px] leading-tight font-medium text-danger`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:alert-circle`,class:`h-3.5 w-3.5 shrink-0`}),(0,t.createElementVNode)(`span`,O,(0,t.toDisplayString)(e),1)]))),128))])):(0,t.createCommentVNode)(``,!0)])],2))}}),A=[`for`],j={key:0,class:`text-danger`},M={class:`flex w-full min-w-0 flex-1 flex-col gap-1.5`},N=[`id`,`type`,`disabled`,`placeholder`,`aria-invalid`],P=[`disabled`,`aria-label`,`aria-pressed`],F={key:0,class:`mt-0.5 flex flex-col gap-1`},ee={class:`min-w-0`},I=(0,t.defineComponent)({inheritAttrs:!1,__name:`InputPassword`,props:(0,t.mergeModels)({id:{},label:{},labelPosition:{default:`top`},required:{type:Boolean,default:!1},placeholder:{},disabled:{type:Boolean,default:!1},error:{type:[String,Boolean,Array],default:!1},iconStart:{},toggleable:{type:Boolean,default:!0},iconOn:{default:`lucide:eye-off`},iconOff:{default:`lucide:eye`},size:{default:`sm`}},{modelValue:{},modelModifiers:{}}),emits:(0,t.mergeModels)([`focus`,`blur`,`input`,`change`],[`update:modelValue`]),setup(e,{emit:r}){let i=e,a=r,o=(0,t.useModel)(e,`modelValue`),s=i.id||`input-${(0,t.useId)()}`,c=(0,t.ref)(!1),l=(0,t.computed)(()=>c.value?`text`:`password`),u=()=>{i.disabled||(c.value=!c.value)},d=(0,t.computed)(()=>i.labelPosition===`top`?``:{xs:`sm:pt-1`,sm:`sm:pt-1.5`,md:`sm:pt-2.5`,lg:`sm:pt-3.5`,xl:`sm:pt-4.5`}[i.size]),f=(0,t.computed)(()=>{let e=i.disabled?`bg-muted border-main opacity-70 cursor-not-allowed`:i.error?`border-danger focus-within:border-danger focus-within:ring-danger/20`:`border-main hover:border-primary/50 focus-within:border-primary focus-within:ring-primary/20`,t={xs:`h-7`,sm:`h-8`,md:`h-10`,lg:`h-12`,xl:`h-14`},n=i.size===`xs`?`px-2`:`px-3`,r=i.size===`xs`?`gap-1.5`:`gap-2`;return[`flex items-center w-full bg-content border rounded-md transition-all duration-200 overflow-hidden outline-none focus-within:ring-4 focus-within:ring-offset-0`,e,t[i.size],n,r]}),p=(0,t.computed)(()=>{let e=[`flex-1 w-full h-full bg-transparent p-0 font-medium`,`border-transparent outline-none ring-0 shadow-none`,`focus:border-transparent focus:outline-none focus:ring-0 focus:shadow-none focus:!border-transparent focus:!shadow-none`,`[-moz-appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none [&::-ms-reveal]:hidden [&::-ms-clear]:hidden`].join(` `),t={xs:`text-xs`,sm:`text-xs`,md:`text-sm`,lg:`text-base`,xl:`text-lg`},n=i.disabled?`text-muted placeholder:text-muted placeholder:opacity-50 cursor-not-allowed`:i.error?`text-danger placeholder:text-danger placeholder:opacity-50`:`text-main placeholder:text-muted placeholder:opacity-70`;return[e,t[i.size],n]}),m=(0,t.computed)(()=>({xs:`h-3.5 w-3.5`,sm:`h-4 w-4`,md:`h-4 w-4`,lg:`h-5 w-5`,xl:`h-6 w-6`})[i.size]),h=(0,t.computed)(()=>!i.error||typeof i.error==`boolean`?[]:Array.isArray(i.error)?i.error:[i.error]);return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`flex w-full`,e.labelPosition===`left`?`flex-col gap-1.5 sm:flex-row sm:gap-6`:`flex-col gap-1.5`])},[e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`label`,{key:0,for:(0,t.unref)(s),class:(0,t.normalizeClass)([`flex shrink-0 items-center gap-1 text-[10px] font-bold tracking-wider text-muted uppercase`,e.labelPosition===`left`?`sm:w-1/3 lg:w-1/4 ${d.value}`:``])},[(0,t.createTextVNode)((0,t.toDisplayString)(e.label)+` `,1),e.required?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,j,`*`)):(0,t.createCommentVNode)(``,!0)],10,A)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,M,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)(f.value)},[e.iconStart?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:e.iconStart,class:(0,t.normalizeClass)([`shrink-0 transition-colors`,e.error?`text-danger`:`text-muted`,m.value])},null,8,[`icon`,`class`])):(0,t.createCommentVNode)(``,!0),(0,t.withDirectives)((0,t.createElementVNode)(`input`,(0,t.mergeProps)({id:(0,t.unref)(s),type:l.value,disabled:e.disabled,placeholder:e.placeholder,class:p.value,"aria-invalid":!!e.error,"onUpdate:modelValue":i[0]||=e=>o.value=e,onInput:i[1]||=e=>{let t=e.target.value;o.value=t,a(`input`,t)},onChange:i[2]||=e=>a(`change`,e.target.value),onFocus:i[3]||=e=>a(`focus`,e),onBlur:i[4]||=e=>a(`blur`,e)},r.$attrs),null,16,N),[[t.vModelDynamic,o.value]]),e.toggleable?((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:1,type:`button`,disabled:e.disabled,"aria-label":c.value?`Hide password`:`Show password`,"aria-pressed":c.value,tabindex:`-1`,class:`flex shrink-0 cursor-pointer items-center justify-center outline-none disabled:cursor-not-allowed`,onClick:u},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:c.value?e.iconOn:e.iconOff,class:(0,t.normalizeClass)([`shrink-0 transition-colors`,e.error?`text-danger`:`text-muted hover:text-primary`,m.value])},null,8,[`icon`,`class`])],8,P)):(0,t.createCommentVNode)(``,!0)],2),h.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,F,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(h.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r,class:`flex items-start gap-1.5 text-[11px] leading-tight font-medium text-danger`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:alert-circle`,class:`h-3.5 w-3.5 shrink-0`}),(0,t.createElementVNode)(`span`,ee,(0,t.toDisplayString)(e),1)]))),128))])):(0,t.createCommentVNode)(``,!0)])],2))}}),te=[`for`],ne={key:0,class:`text-danger`},re={class:`flex w-full min-w-0 flex-1 flex-col gap-1.5`},L=[`aria-label`],R=[`id`,`type`,`inputmode`,`pattern`,`disabled`,`value`,`aria-label`,`aria-invalid`,`onInput`,`onKeydown`],z={key:0,class:`mt-0.5 flex flex-col gap-1`},ie={class:`min-w-0`},ae=(0,t.defineComponent)({__name:`InputOtp`,props:(0,t.mergeModels)({id:{},label:{},labelPosition:{default:`top`},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},error:{type:[String,Boolean,Array],default:!1},length:{default:6},mask:{type:Boolean,default:!1},integerOnly:{type:Boolean,default:!0},size:{default:`sm`}},{modelValue:{default:``},modelModifiers:{}}),emits:(0,t.mergeModels)([`focus`,`blur`,`input`,`change`,`complete`],[`update:modelValue`]),setup(e,{emit:r}){let i=e,a=r,o=(0,t.useModel)(e,`modelValue`),s=i.id||`input-otp-${(0,t.useId)()}`,c=(0,t.ref)([]),l=(e,t)=>{c.value[t]=e},u=(0,t.computed)(()=>{let e=o.value.split(``);return Array.from({length:i.length},(t,n)=>e[n]??``)}),d=e=>i.integerOnly?/^[0-9]$/.test(e):e.length===1,f=e=>{let t=e.join(``);o.value=t,a(`input`,t),a(`change`,t),t.length===i.length&&!e.includes(``)&&a(`complete`,t)},p=e=>{c.value[e]?.focus(),c.value[e]?.select()},m=(e,t)=>{let n=e.target,r=n.value.slice(-1);if(r&&!d(r)){n.value=u.value[t];return}let a=[...u.value];a[t]=r,f(a),r&&t<i.length-1&&p(t+1)},h=(e,t)=>{if(e.key===`Backspace`&&!u.value[t]&&t>0){e.preventDefault(),p(t-1);let n=[...u.value];n[t-1]=``,f(n);return}e.key===`ArrowLeft`&&t>0&&(e.preventDefault(),p(t-1)),e.key===`ArrowRight`&&t<i.length-1&&(e.preventDefault(),p(t+1))},g=e=>{e.preventDefault();let t=(e.clipboardData?.getData(`text`)??``).split(``).filter(d).slice(0,i.length);t.length&&(f(Array.from({length:i.length},(e,n)=>t[n]??``)),p(Math.min(t.length,i.length-1)))},_=(0,t.computed)(()=>i.labelPosition===`top`?``:{xs:`sm:pt-1`,sm:`sm:pt-1.5`,md:`sm:pt-2.5`,lg:`sm:pt-3.5`,xl:`sm:pt-4.5`}[i.size]),v=(0,t.computed)(()=>({xs:`gap-1.5`,sm:`gap-2`,md:`gap-2`,lg:`gap-3`,xl:`gap-3`})[i.size]),y=(0,t.computed)(()=>[`flex items-center justify-center bg-content border rounded-md text-center font-bold transition-all duration-200 outline-none focus:ring-4 focus:ring-offset-0`,i.disabled?`bg-muted border-main opacity-70 cursor-not-allowed text-muted`:i.error?`border-danger focus:border-danger focus:ring-danger/20 text-danger`:`border-main hover:border-primary/50 focus:border-primary focus:ring-primary/20 text-main`,{xs:`h-7 w-7 text-sm`,sm:`h-8 w-8 text-base`,md:`h-10 w-10 text-lg`,lg:`h-12 w-12 text-xl`,xl:`h-14 w-14 text-2xl`}[i.size]]),b=(0,t.computed)(()=>!i.error||typeof i.error==`boolean`?[]:Array.isArray(i.error)?i.error:[i.error]);return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`flex w-full`,e.labelPosition===`left`?`flex-col gap-1.5 sm:flex-row sm:gap-6`:`flex-col gap-1.5`])},[e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`label`,{key:0,for:`${(0,t.unref)(s)}-0`,class:(0,t.normalizeClass)([`flex shrink-0 items-center gap-1 text-[10px] font-bold tracking-wider text-muted uppercase`,e.labelPosition===`left`?`sm:w-1/3 lg:w-1/4 ${_.value}`:``])},[(0,t.createTextVNode)((0,t.toDisplayString)(e.label)+` `,1),e.required?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,ne,`*`)):(0,t.createCommentVNode)(``,!0)],10,te)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,re,[(0,t.createElementVNode)(`div`,{role:`group`,"aria-label":e.label||`One-time passcode`,class:(0,t.normalizeClass)([`flex`,v.value])},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(u.value,(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`input`,{key:r,ref_for:!0,ref:e=>l(e,r),id:`${(0,t.unref)(s)}-${r}`,type:e.mask?`password`:`text`,inputmode:e.integerOnly?`numeric`:`text`,pattern:e.integerOnly?`[0-9]*`:void 0,autocomplete:`one-time-code`,maxlength:`1`,disabled:e.disabled,value:n,"aria-label":`Digit ${r+1} of ${e.length}`,"aria-invalid":!!e.error,class:(0,t.normalizeClass)(y.value),onInput:e=>m(e,r),onKeydown:e=>h(e,r),onPaste:g,onFocus:i[0]||=e=>a(`focus`,e),onBlur:i[1]||=e=>a(`blur`,e)},null,42,R))),128))],10,L),b.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,z,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(b.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r,class:`flex items-start gap-1.5 text-[11px] leading-tight font-medium text-danger`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:alert-circle`,class:`h-3.5 w-3.5 shrink-0`}),(0,t.createElementVNode)(`span`,ie,(0,t.toDisplayString)(e),1)]))),128))])):(0,t.createCommentVNode)(``,!0)])],2))}}),oe=[`for`],se={key:0,class:`text-danger`},ce={class:`flex w-full min-w-0 flex-col gap-1.5`},le=[`id`,`disabled`,`placeholder`,`aria-invalid`],ue={key:0,class:`mt-0.5 flex flex-col gap-1`},de={class:`min-w-0`},fe=(0,t.defineComponent)({inheritAttrs:!1,__name:`InputMask`,props:(0,t.mergeModels)({id:{},label:{},labelPosition:{default:`top`},required:{type:Boolean,default:!1},placeholder:{},disabled:{type:Boolean,default:!1},error:{type:[String,Boolean,Array],default:!1},iconStart:{},iconEnd:{},size:{default:`sm`},mask:{},tokens:{}},{modelValue:{},modelModifiers:{}}),emits:(0,t.mergeModels)([`focus`,`blur`,`input`,`change`,`maska`],[`update:modelValue`]),setup(e,{emit:i}){let a=e,o=i,s=(0,t.useModel)(e,`modelValue`),c=a.id||`input-${(0,t.useId)()}`,l=(0,t.computed)(()=>({mask:a.mask,tokens:a.tokens,onMaska:e=>o(`maska`,e)})),u=(0,t.computed)(()=>a.labelPosition===`top`?``:{xs:`sm:pt-1`,sm:`sm:pt-1.5`,md:`sm:pt-2.5`,lg:`sm:pt-3.5`,xl:`sm:pt-4.5`}[a.size]),d=(0,t.computed)(()=>{let e=a.disabled?`bg-muted border-main opacity-70 cursor-not-allowed`:a.error?`border-danger focus-within:border-danger focus-within:ring-danger/20`:`border-main hover:border-primary/50 focus-within:border-primary focus-within:ring-primary/20`,t={xs:`h-7`,sm:`h-8`,md:`h-10`,lg:`h-12`,xl:`h-14`},n=a.size===`xs`?`px-2`:`px-3`,r=a.size===`xs`?`gap-1.5`:`gap-2`;return[`flex items-center w-full bg-content border rounded-md transition-all duration-200 overflow-hidden outline-none focus-within:ring-4 focus-within:ring-offset-0`,e,t[a.size],n,r]}),f=(0,t.computed)(()=>{let e=[`flex-1 w-full h-full bg-transparent p-0 font-medium`,`border-transparent outline-none ring-0 shadow-none`,`focus:border-transparent focus:outline-none focus:ring-0 focus:shadow-none focus:!border-transparent focus:!shadow-none`,`[-moz-appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-search-decoration]:hidden [&::-webkit-search-cancel-button]:hidden [&::-webkit-search-results-button]:hidden [&::-webkit-search-results-decoration]:hidden [&::-ms-reveal]:hidden [&::-ms-clear]:hidden`].join(` `),t={xs:`text-xs`,sm:`text-xs`,md:`text-sm`,lg:`text-base`,xl:`text-lg`},n=a.disabled?`text-muted placeholder:text-muted placeholder:opacity-50 cursor-not-allowed`:a.error?`text-danger placeholder:text-danger placeholder:opacity-50`:`text-main placeholder:text-muted placeholder:opacity-70`;return[e,t[a.size],n]}),p=(0,t.computed)(()=>({xs:`h-3.5 w-3.5`,sm:`h-4 w-4`,md:`h-4 w-4`,lg:`h-5 w-5`,xl:`h-6 w-6`})[a.size]),m=(0,t.computed)(()=>!a.error||typeof a.error==`boolean`?[]:Array.isArray(a.error)?a.error:[a.error]);return(i,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`flex w-full`,e.labelPosition===`left`?`flex-col gap-1.5 sm:flex-row sm:gap-6`:`flex-col gap-1.5`])},[e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`label`,{key:0,for:(0,t.unref)(c),class:(0,t.normalizeClass)([`flex shrink-0 items-center gap-1 text-[10px] font-bold tracking-wider text-muted uppercase`,e.labelPosition===`left`?`sm:w-1/3 lg:w-1/4 ${u.value}`:``])},[(0,t.createTextVNode)((0,t.toDisplayString)(e.label)+` `,1),e.required?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,se,`*`)):(0,t.createCommentVNode)(``,!0)],10,oe)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,ce,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)(d.value)},[e.iconStart?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:e.iconStart,class:(0,t.normalizeClass)([`shrink-0 transition-colors`,e.error?`text-danger`:`text-muted`,p.value])},null,8,[`icon`,`class`])):(0,t.createCommentVNode)(``,!0),(0,t.withDirectives)((0,t.createElementVNode)(`input`,(0,t.mergeProps)({id:(0,t.unref)(c),type:`text`,disabled:e.disabled,placeholder:e.placeholder,class:f.value,"aria-invalid":!!e.error,"onUpdate:modelValue":a[0]||=e=>s.value=e,onInput:a[1]||=e=>{let t=e.target.value;s.value=t,o(`input`,t)},onChange:a[2]||=e=>o(`change`,e.target.value),onFocus:a[3]||=e=>o(`focus`,e),onBlur:a[4]||=e=>o(`blur`,e)},i.$attrs),null,16,le),[[t.vModelText,s.value],[(0,t.unref)(r.vMaska),l.value]]),e.iconEnd?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:1,icon:e.iconEnd,class:(0,t.normalizeClass)([`shrink-0 transition-colors`,e.error?`text-danger`:`text-muted`,p.value])},null,8,[`icon`,`class`])):(0,t.createCommentVNode)(``,!0)],2),m.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ue,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(m.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r,class:`flex items-start gap-1.5 text-[11px] leading-tight font-medium text-danger`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:alert-circle`,class:`h-3.5 w-3.5 shrink-0`}),(0,t.createElementVNode)(`span`,de,(0,t.toDisplayString)(e),1)]))),128))])):(0,t.createCommentVNode)(``,!0)])],2))}}),pe=(0,t.defineComponent)({inheritAttrs:!1,__name:`Popover`,props:(0,t.mergeModels)({placement:{default:`bottom`},trigger:{default:`click`},offset:{default:12},disabled:{type:Boolean,default:!1},size:{default:`md`},widthClass:{default:void 0},showArrow:{type:Boolean,default:!0},matchWidth:{type:Boolean,default:!1},triggerClass:{default:`inline-block`},reference:{default:null},autoPlacement:{type:Boolean,default:!1},boundary:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let n=e,r={xs:`w-56`,sm:`w-64`,md:`w-72`,lg:`w-96`,xl:`w-[32rem]`},a=(0,t.computed)(()=>n.widthClass||r[n.size]),o=(0,t.useModel)(e,`modelValue`),s=(0,t.ref)(null),c=(0,t.ref)(null),l=(0,t.ref)(null),u=(0,t.ref)(``),{floatingStyles:d,middlewareData:f,placement:p}=(0,i.useFloating)((0,t.computed)(()=>n.reference??s.value),c,{placement:()=>n.placement,whileElementsMounted:i.autoUpdate,middleware:[(0,i.offset)(n.offset),n.autoPlacement?(0,i.autoPlacement)({allowedPlacements:[`top`,`bottom`,`left`,`right`],padding:12,boundary:n.boundary}):(0,i.flip)({fallbackPlacements:[`bottom`,`top`,`left`,`right`],boundary:n.boundary}),(0,i.shift)({padding:12,boundary:n.boundary}),...n.matchWidth?[(0,i.size)({apply({rects:e,elements:t}){let n=`${Math.round(e.reference.width)}px`;Object.assign(t.floating.style,{width:n}),u.value!==n&&(u.value=n)}})]:[],...n.showArrow?[(0,i.arrow)({element:l,padding:12})]:[],(0,i.hide)()]}),m=(0,t.computed)(()=>({...d.value,...n.matchWidth&&u.value?{width:u.value}:{}})),h,g=(0,t.computed)(()=>p.value.split(`-`)[0]),_=(0,t.computed)(()=>!!f.value.hide?.referenceHidden),v=(0,t.computed)(()=>{let e=f.value.arrow;if(!e)return{};let{x:t,y:n}=e,r={top:`bottom`,right:`left`,bottom:`top`,left:`right`}[g.value];return{left:t==null?``:`${t}px`,top:n==null?``:`${n}px`,right:``,bottom:``,[r]:`-6px`}}),y=()=>{n.disabled||(o.value=!0)},b=()=>{o.value=!1},x=()=>{n.disabled||(o.value=!o.value)},S=()=>{n.trigger!==`hover`||n.disabled||(clearTimeout(h),y())},C=()=>{n.trigger===`hover`&&(h=setTimeout(b,150))},w=e=>{if(!o.value||n.trigger!==`click`)return;let t=e.target,r=(n.reference?.contextElement??s.value)?.contains(t),i=c.value?.contains(t);!r&&!i&&b()},T=e=>{e.key===`Escape`&&o.value&&b()};return(0,t.onMounted)(()=>{document.addEventListener(`mousedown`,w),document.addEventListener(`keydown`,T)}),(0,t.onBeforeUnmount)(()=>{document.removeEventListener(`mousedown`,w),document.removeEventListener(`keydown`,T),clearTimeout(h)}),(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[(0,t.createElementVNode)(`div`,(0,t.mergeProps)({ref_key:`referenceRef`,ref:s},r.$attrs,{class:e.triggerClass,onClick:i[0]||=e=>n.trigger===`click`?x():void 0,onMouseenter:S,onMouseleave:C}),[(0,t.renderSlot)(r.$slots,`trigger`,{isOpen:o.value})],16),((0,t.openBlock)(),(0,t.createBlock)(t.Teleport,{to:`body`},[(0,t.createVNode)(t.Transition,{"leave-active-class":`transition duration-150 ease-in`,"leave-from-class":`opacity-100 scale-100`,"leave-to-class":`opacity-0 scale-95`},{default:(0,t.withCtx)(()=>[o.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,ref_key:`floatingRef`,ref:c,style:(0,t.normalizeStyle)(m.value),class:(0,t.normalizeClass)([`relative z-[10000] flex flex-col rounded-md border border-main bg-content shadow-lg focus:outline-none`,e.matchWidth?``:a.value,e.matchWidth?``:`max-w-[calc(100vw-24px)]`,{"pointer-events-none invisible opacity-0":_.value}]),onMouseenter:S,onMouseleave:C},[e.showArrow?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,ref_key:`arrowRef`,ref:l,class:(0,t.normalizeClass)([`absolute z-10 h-3 w-3 border-t border-l border-main bg-content`,{"rotate-45":g.value===`bottom`,"rotate-[225deg]":g.value===`top`,"rotate-[135deg]":g.value===`left`,"-rotate-45":g.value===`right`}]),style:(0,t.normalizeStyle)(v.value)},null,6)):(0,t.createCommentVNode)(``,!0),(0,t.renderSlot)(r.$slots,`default`,{close:b})],38)):(0,t.createCommentVNode)(``,!0)]),_:3})]))],64))}}),me={class:`flex w-full min-w-0`},he={key:0,class:`flex-1 overflow-y-auto p-1.5 custom-scrollbar`},ge=[`onClick`],_e={class:`flex-1 break-words text-pretty leading-snug truncate`},ve={key:1,class:`flex flex-col items-center justify-center p-8 gap-3 text-center shrink-0`},ye={class:`text-sm text-muted`},be={class:`font-bold text-main`},xe=(0,t.defineComponent)({__name:`Autocomplete`,props:(0,t.mergeModels)({id:{},label:{},labelPosition:{default:`top`},placeholder:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},error:{type:[String,Boolean,Array],default:!1},size:{default:`sm`},options:{},optionLabel:{type:[String,Function],default:`label`},optionValue:{type:[String,Function],default:`value`},filter:{type:Boolean,default:!0},openOnFocus:{type:Boolean,default:!1},maxHeight:{default:320},debounce:{default:300},iconStart:{},iconEnd:{}},{modelValue:{default:``},modelModifiers:{}}),emits:(0,t.mergeModels)([`select`,`search`,`create-new`,`focus`,`blur`,`open`,`close`],[`update:modelValue`]),setup(e,{emit:r}){let i=e,a=r,o=(0,t.useModel)(e,`modelValue`),s=(0,t.ref)(!1),l=(0,t.ref)(-1),u=(0,t.useId)(),d=(0,t.computed)(()=>i.id||`adv-autocomplete-${u}`),f=e=>typeof e==`string`||typeof e==`number`?String(e):typeof i.optionLabel==`function`?i.optionLabel(e):e[i.optionLabel],p=e=>typeof e==`string`||typeof e==`number`?e:typeof i.optionValue==`function`?i.optionValue(e):e[i.optionValue],m=(0,t.computed)(()=>{if(!i.filter||!o.value)return i.options;let e=o.value.toLowerCase();return i.options.filter(t=>f(t).toLowerCase().includes(e))}),h=null;(0,t.watch)(o,e=>{l.value=-1,h&&clearTimeout(h),i.debounce>0?h=setTimeout(()=>{a(`search`,e)},i.debounce):a(`search`,e)}),(0,t.onBeforeUnmount)(()=>{h&&clearTimeout(h)}),(0,t.watch)(s,e=>{e?a(`open`):(a(`close`),l.value=-1)});let g=e=>{i.disabled||i.loading||(o.value=f(e),a(`select`,e),s.value=!1)},_=e=>{i.disabled||i.loading||(e.key===`ArrowDown`?(e.preventDefault(),s.value?l.value=Math.min(l.value+1,m.value.length-1):s.value=!0):e.key===`ArrowUp`?(e.preventDefault(),s.value?l.value=Math.max(l.value-1,0):s.value=!0):e.key===`Enter`?s.value&&l.value>=0&&m.value[l.value]?(e.preventDefault(),g(m.value[l.value])):s.value&&m.value.length===0&&o.value&&(e.preventDefault(),a(`create-new`,o.value),s.value=!1):e.key===`Escape`&&(e.preventDefault(),s.value=!1))},v=e=>{i.openOnFocus&&(s.value=!0),a(`focus`,e)},y=e=>{a(`blur`,e)},b=(0,t.computed)(()=>{let e={xs:{padding:`px-1.5 py-1`,text:`text-[11px]`},sm:{padding:`px-2 py-1`,text:`text-xs`},md:{padding:`px-2.5 py-1.5`,text:`text-sm`},lg:{padding:`px-3 py-2`,text:`text-base`},xl:{padding:`px-3.5 py-2.5`,text:`text-lg`}};return e[i.size]||e.sm});return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,me,[(0,t.createVNode)(pe,{modelValue:s.value,"onUpdate:modelValue":i[4]||=e=>s.value=e,placement:`bottom-start`,disabled:e.disabled||e.loading,"show-arrow":!1,matchWidth:``,triggerClass:`w-full`},{trigger:(0,t.withCtx)(()=>[(0,t.createVNode)(k,{modelValue:o.value,"onUpdate:modelValue":i[0]||=e=>o.value=e,id:d.value,label:e.label,labelPosition:e.labelPosition,placeholder:e.placeholder,required:e.required,disabled:e.disabled,error:e.error,size:e.size,iconStart:e.iconStart,iconEnd:e.loading?`lucide:loader-2`:e.iconEnd,class:(0,t.normalizeClass)({"is-loading":e.loading}),autocomplete:`off`,onInput:i[1]||=e=>s.value=!0,onKeydown:_,onFocus:v,onBlur:y,onClick:i[2]||=(0,t.withModifiers)(e=>s.value=!0,[`stop`])},null,8,[`modelValue`,`id`,`label`,`labelPosition`,`placeholder`,`required`,`disabled`,`error`,`size`,`iconStart`,`iconEnd`,`class`])]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{class:`flex flex-col overflow-hidden bg-content rounded-md shadow-xl border border-main w-full`,style:(0,t.normalizeStyle)({maxHeight:typeof e.maxHeight==`number`?`${e.maxHeight}px`:e.maxHeight})},[m.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,he,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(m.value,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:p(e),onClick:t=>g(e),class:(0,t.normalizeClass)([`cursor-pointer group relative transition-colors duration-150 flex items-center w-full rounded-md`,[b.value.padding,b.value.text,l.value===n?`bg-main/5 ring-2 ring-primary ring-offset-1 text-primary font-medium`:`text-main hover:bg-main/5`]])},[(0,t.createElementVNode)(`div`,_e,[(0,t.renderSlot)(r.$slots,`option`,{option:e,index:n,active:l.value===n},()=>[(0,t.createTextVNode)((0,t.toDisplayString)(f(e)),1)],!0)])],10,ge))),128))])):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ve,[(0,t.renderSlot)(r.$slots,`empty`,{},()=>[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:search-x`,class:`w-8 h-8 text-muted opacity-50`}),(0,t.createElementVNode)(`div`,ye,[i[5]||=(0,t.createTextVNode)(` No results found for `,-1),(0,t.createElementVNode)(`span`,be,`"`+(0,t.toDisplayString)(o.value)+`"`,1)])],!0),(0,t.renderSlot)(r.$slots,`action`,{},()=>[o.value?((0,t.openBlock)(),(0,t.createBlock)(c,{key:0,label:`Add '${o.value}'`,icon:`lucide:plus`,size:e.size,variant:`solid`,severity:`success`,class:`mt-2 shadow-sm`,onClick:i[3]||=e=>{a(`create-new`,o.value),s.value=!1}},null,8,[`label`,`size`])):(0,t.createCommentVNode)(``,!0)],!0)]))],4)]),_:3},8,[`modelValue`,`disabled`])]))}}),Se=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},Ce=Se(xe,[[`__scopeId`,`data-v-b854acf7`]]),we={key:0,class:`flex items-center justify-center px-3 bg-surface border-r border-main text-muted shrink-0 text-sm font-medium`},Te={key:1,class:`flex items-stretch shrink-0 border-l border-main [&_button]:rounded-none [&_button]:border-transparent [&_button]:shadow-none [&_button]:h-full [&_button]:m-0`},Ee=(0,t.defineComponent)({__name:`InputGroup`,props:{size:{default:`sm`},disabled:{type:Boolean,default:!1},error:{type:Boolean,default:!1}},setup(e){let n=e,r=(0,t.computed)(()=>[`flex items-stretch w-full bg-content border rounded-md transition-all duration-200 overflow-hidden outline-none focus-within:ring-4 focus-within:ring-offset-0`,n.disabled?`bg-muted border-main opacity-70 cursor-not-allowed`:n.error?`border-danger focus-within:border-danger focus-within:ring-danger/20`:`border-main hover:border-primary/50 focus-within:border-primary focus-within:ring-primary/20`,{xs:`h-7`,sm:`h-8`,md:`h-10`,lg:`h-12`,xl:`h-14`}[n.size]]),i=(0,t.computed)(()=>{let e=[`[&>input]:flex-1 [&>input]:w-full [&>input]:min-w-0 [&>input]:h-full [&>input]:bg-transparent [&>input]:p-0 [&>input]:border-transparent [&>input]:outline-none [&>input]:ring-0 [&>input]:shadow-none`,`[&_.bg-content]:!border-transparent [&_.bg-content]:!shadow-none [&_.bg-content]:!ring-0 [&_.bg-content]:!bg-transparent [&_.bg-content]:!rounded-none [&_.bg-content]:!px-0`].join(` `),t=n.size===`xs`?`px-2`:`px-3`,r={xs:`[&>input]:text-xs`,sm:`[&>input]:text-xs`,md:`[&>input]:text-sm`,lg:`[&>input]:text-base`,xl:`[&>input]:text-lg`},i=n.disabled?`[&>input]:text-muted [&>input]:placeholder:text-muted [&>input]:placeholder:opacity-50 [&>input]:cursor-not-allowed`:n.error?`[&>input]:text-danger [&>input]:placeholder:text-danger [&>input]:placeholder:opacity-50`:`[&>input]:text-main [&>input]:placeholder:text-muted [&>input]:placeholder:opacity-70`;return[e,t,r[n.size],i].join(` `)});return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)(r.value)},[e.$slots.prepend?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,we,[(0,t.renderSlot)(e.$slots,`prepend`)])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex-1 min-w-0 flex items-center`,i.value])},[(0,t.renderSlot)(e.$slots,`default`)],2),e.$slots.append?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Te,[(0,t.renderSlot)(e.$slots,`append`)])):(0,t.createCommentVNode)(``,!0)],2))}}),De=[`aria-checked`],Oe=(0,t.defineComponent)({__name:`Toggle`,props:(0,t.mergeModels)({size:{default:`sm`},severity:{default:`primary`},disabled:{type:Boolean,default:!1},iconOn:{default:void 0},iconOff:{default:void 0}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:(0,t.mergeModels)([`change`],[`update:modelValue`]),setup(e,{emit:r}){let i=e,a=r,o=(0,t.useModel)(e,`modelValue`),s={xs:{track:`w-8 h-4`,thumb:`w-3 h-3`,translate:`translate-x-4`},sm:{track:`w-10 h-5`,thumb:`w-4 h-4`,translate:`translate-x-5`},md:{track:`w-12 h-6`,thumb:`w-5 h-5`,translate:`translate-x-6`},lg:{track:`w-14 h-7`,thumb:`w-6 h-6`,translate:`translate-x-7`},xl:{track:`w-16 h-8`,thumb:`w-7 h-7`,translate:`translate-x-8`}},c={primary:`bg-primary`,secondary:`bg-muted`,success:`bg-success`,warning:`bg-warning`,danger:`bg-danger`,info:`bg-info`},l={primary:`text-primary`,secondary:`text-main`,success:`text-success`,warning:`text-warning`,danger:`text-danger`,info:`text-info`},u=(0,t.computed)(()=>[`relative rounded-full transition-colors duration-300 flex items-center px-1`,o.value?c[i.severity]:`bg-muted`,i.disabled?`opacity-50 cursor-not-allowed`:`cursor-pointer`,s[i.size].track]),d=(0,t.computed)(()=>[`absolute bg-content rounded-full transition-transform duration-300 shadow-sm flex items-center justify-center`,o.value?s[i.size].translate:`translate-x-0`,s[i.size].thumb]),f=()=>{i.disabled||(o.value=!o.value,a(`change`,o.value))};return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)(u.value),onClick:f,role:`switch`,"aria-checked":o.value},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)(d.value)},[o.value&&e.iconOn?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:e.iconOn,class:(0,t.normalizeClass)([`w-3 h-3`,l[e.severity]])},null,8,[`icon`,`class`])):!o.value&&e.iconOff?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:1,icon:e.iconOff,class:`w-3 h-3 text-muted`},null,8,[`icon`])):(0,t.createCommentVNode)(``,!0)],2)],10,De))}}),ke=`relative inline-flex items-center justify-center gap-1 font-bold z-10 box-border`,Ae=(0,t.defineComponent)({__name:`Badge`,props:{value:{default:void 0},severity:{default:`primary`},variant:{default:`solid`},size:{default:`sm`},rounded:{type:Boolean,default:!0},dot:{type:Boolean,default:!1},ping:{type:Boolean,default:!1},position:{default:void 0}},setup(e){let n=e,r={xs:`w-1.5 h-1.5`,sm:`w-2 h-2`,md:`w-2.5 h-2.5`,lg:`w-3 h-3`,xl:`w-3.5 h-3.5`},i={xs:`min-w-4 h-4 px-1 text-[10px] leading-none`,sm:`min-w-5 h-5 px-1.5 text-xs leading-none`,md:`min-w-6 h-6 px-2 text-sm leading-none`,lg:`min-w-7 h-7 px-2.5 text-base leading-none`,xl:`min-w-8 h-8 px-3 text-lg leading-none`},a={"top-right":`top-0 right-0 translate-x-1/2 -translate-y-1/2`,"top-left":`top-0 left-0 -translate-x-1/2 -translate-y-1/2`,"bottom-right":`bottom-0 right-0 translate-x-1/2 translate-y-1/2`,"bottom-left":`bottom-0 left-0 -translate-x-1/2 translate-y-1/2`},o={solid:{primary:`bg-primary text-on-primary border border-primary`,secondary:`bg-muted text-main border border-muted`,success:`bg-success text-on-success border border-success`,warning:`bg-warning text-on-warning border border-warning`,danger:`bg-danger text-on-danger border border-danger`,info:`bg-info text-on-info border border-info`,contrast:`bg-main text-content border border-main`},soft:{primary:`bg-primary/10 text-primary border border-primary/10`,secondary:`bg-muted/20 text-main border border-muted/20`,success:`bg-success/10 text-success border border-success/10`,warning:`bg-warning/10 text-warning border border-warning/10`,danger:`bg-danger/10 text-danger border border-danger/10`,info:`bg-info/10 text-info border border-info/10`,contrast:`bg-main/5 text-main border border-main/5`},outline:{primary:`bg-content text-primary border border-primary`,secondary:`bg-content text-muted border border-muted`,success:`bg-content text-success border border-success`,warning:`bg-content text-warning border border-warning`,danger:`bg-content text-danger border border-danger`,info:`bg-content text-info border border-info`,contrast:`bg-content text-main border border-main`}},s={primary:`bg-primary`,secondary:`bg-muted`,success:`bg-success`,warning:`bg-warning`,danger:`bg-danger`,info:`bg-info`,contrast:`bg-main`},c=(0,t.computed)(()=>n.dot?r[n.size]:i[n.size]),l=(0,t.computed)(()=>n.dot||n.rounded?`rounded-full`:`rounded-md`),u=(0,t.computed)(()=>n.position?`!absolute transform shadow-sm ${a[n.position]}`:``),d=(0,t.computed)(()=>o[n.variant][n.severity]||``),f=(0,t.computed)(()=>s[n.severity]||``);return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`span`,(0,t.mergeProps)({class:[ke,c.value,l.value,u.value,d.value]},n.$attrs),[e.ping?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:(0,t.normalizeClass)([`absolute inset-0 rounded-full opacity-75 animate-ping -z-10`,f.value])},null,2)):(0,t.createCommentVNode)(``,!0),e.dot?(0,t.createCommentVNode)(``,!0):(0,t.renderSlot)(n.$slots,`icon`,{key:1}),e.dot?(0,t.createCommentVNode)(``,!0):(0,t.renderSlot)(n.$slots,`default`,{key:2},()=>[(0,t.createTextVNode)((0,t.toDisplayString)(e.value),1)])],16))}}),je={class:`flex inline-flex flex-col gap-1`},Me=[`for`],Ne=[`id`,`value`,`true-value`,`false-value`,`disabled`,`required`,`indeterminate`],Pe={key:0,class:`ml-0.5 text-danger`},Fe={key:0,class:`mt-0.5 ml-1 flex flex-col`},Ie={class:`min-w-0`},Le=(0,t.defineComponent)({__name:`Checkbox`,props:(0,t.mergeModels)({id:{},value:{},trueValue:{default:!0},falseValue:{default:!1},label:{},indeterminate:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},error:{type:[String,Boolean,Array],default:!1},size:{default:`sm`},variant:{default:`primary`}},{modelValue:{},modelModifiers:{}}),emits:(0,t.mergeModels)([`change`],[`update:modelValue`]),setup(e,{emit:r}){let i=e,a=r,o=(0,t.useModel)(e,`modelValue`),s=(0,t.useId)(),c=(0,t.computed)(()=>i.id||`adv-checkbox-${s}`),l=(0,t.computed)(()=>!i.error||typeof i.error==`boolean`?[]:Array.isArray(i.error)?i.error:[i.error]),u=(0,t.computed)(()=>Array.isArray(o.value)?o.value.includes(i.value):o.value===i.trueValue),d=(0,t.computed)(()=>{let e={xs:{icon:`w-[14px] h-[14px]`,text:`text-[11px] leading-[14px]`,gap:`gap-1.5`,mt:`mt-0`},sm:{icon:`w-4 h-4`,text:`text-xs leading-4`,gap:`gap-2`,mt:`mt-[1px]`},md:{icon:`w-5 h-5`,text:`text-sm leading-5`,gap:`gap-2`,mt:`mt-[1px]`},lg:{icon:`w-6 h-6`,text:`text-base leading-6`,gap:`gap-2.5`,mt:`mt-[2px]`},xl:{icon:`w-7 h-7`,text:`text-lg leading-7`,gap:`gap-3`,mt:`mt-[2px]`}};return e[i.size]||e.sm}),f={primary:`text-primary`,secondary:`text-main`,success:`text-success`,warning:`text-warning`,danger:`text-danger`,info:`text-info`},p=(0,t.computed)(()=>f[i.variant]||f.primary),m=e=>{a(`change`,o.value,e)};return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,je,[(0,t.createElementVNode)(`label`,{for:c.value,class:(0,t.normalizeClass)([`group relative inline-flex items-start transition-colors duration-150`,[e.disabled?`cursor-not-allowed opacity-50`:`-ml-1 cursor-pointer rounded-md px-1 py-0.5 hover:bg-main/5`,d.value.gap]])},[(0,t.withDirectives)((0,t.createElementVNode)(`input`,{type:`checkbox`,id:c.value,value:e.value,"true-value":e.trueValue,"false-value":e.falseValue,disabled:e.disabled,required:e.required,indeterminate:e.indeterminate,"onUpdate:modelValue":i[0]||=e=>o.value=e,class:`peer sr-only`,onChange:m},null,40,Ne),[[t.vModelCheckbox,o.value]]),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex shrink-0 items-center justify-center rounded-[3px] bg-content transition-all peer-focus-visible:ring-2 peer-focus-visible:ring-offset-1`,[d.value.icon,d.value.mt,e.error?`peer-focus-visible:ring-danger/50`:`peer-focus-visible:ring-${e.variant}/50`]])},[e.indeterminate&&!u.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:minus-square`,class:(0,t.normalizeClass)([`h-full w-full opacity-80`,[e.error?`text-danger`:p.value]])},null,8,[`class`])):u.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:1,icon:`lucide:check-square`,class:(0,t.normalizeClass)([`h-full w-full`,[e.error?`text-danger`:p.value]])},null,8,[`class`])):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:2,icon:`lucide:square`,class:(0,t.normalizeClass)([`h-full w-full transition-colors`,[e.error?`text-danger hover:text-danger/80`:`text-muted/30 group-hover:text-muted`]])},null,8,[`class`]))],2),e.label||r.$slots.default?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`flex-1 text-pretty break-words select-none`,[d.value.text,e.error?`text-danger`:`text-main`]])},[(0,t.renderSlot)(r.$slots,`default`,{},()=>[(0,t.createTextVNode)((0,t.toDisplayString)(e.label),1)]),e.required?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Pe,`*`)):(0,t.createCommentVNode)(``,!0)],2)):(0,t.createCommentVNode)(``,!0)],10,Me),l.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Fe,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(l.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r,class:`flex items-start gap-1.5 text-[11px] leading-tight font-medium text-danger`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:alert-circle`,class:`h-3.5 w-3.5 shrink-0`}),(0,t.createElementVNode)(`span`,Ie,(0,t.toDisplayString)(e),1)]))),128))])):(0,t.createCommentVNode)(``,!0)]))}}),Re={class:`z-10 flex-1 leading-snug text-pretty break-words`},ze={class:`z-10 flex shrink-0 items-center gap-2`},Be={key:1,class:`pointer-events-none flex shrink-0 items-center justify-center`},Ve=(0,t.defineComponent)({__name:`SelectOption`,props:{node:{},level:{default:0}},setup(e){let r=e,i=(0,t.inject)(`ADVANCED_SELECT_CONTEXT`);if(!i)throw Error(`SelectOption must be used within a Select component`);let a=(0,t.computed)(()=>r.node.childrenValues.length>0),o=(0,t.computed)(()=>!i.searchQuery.value||i.visibleNodeValues.value.has(r.node.value)),s=(0,t.computed)(()=>{if(i.isMultiple.value&&!i.parentSelectable.value&&a.value){let e=r.node.leafDescendantValues;return e.length===0?!1:e.every(e=>i.selectedValues.value.has(e))}return i.selectedValues.value.has(r.node.value)}),c=(0,t.computed)(()=>i.expandedNodes.value.has(r.node.value)),l=(0,t.computed)(()=>i.activeValue.value===r.node.value),u=(0,t.computed)(()=>{if(!i.isMultiple.value||!a.value)return!1;let e=i.parentSelectable.value?r.node.descendantValues:r.node.leafDescendantValues,t=e.length;if(t===0)return!1;let n=!1,o=!1,s=i.selectedValues.value;for(let r=0;r<t;r++)if(s.has(e[r])?n=!0:o=!0,n&&o)return!0;return!1}),d={primary:{bg:`bg-primary/10`,text:`text-primary`},secondary:{bg:`bg-surface/50`,text:`text-main`},success:{bg:`bg-success/10`,text:`text-success`},warning:{bg:`bg-warning/10`,text:`text-warning`},danger:{bg:`bg-danger/10`,text:`text-danger`},info:{bg:`bg-info/10`,text:`text-info`}},f=(0,t.computed)(()=>d[i.highlightVariant.value]||d.primary),p=(0,t.computed)(()=>a.value&&!i.parentSelectable.value),m=(0,t.computed)(()=>{let e=`cursor-pointer group relative transition-colors duration-150`,t=l.value?`ring-2 ring-primary ring-offset-1 bg-main/5`:``;return r.node.isDisabled?`${e} opacity-50 cursor-not-allowed ${t}`:p.value?`${e} text-main font-semibold hover:bg-main/5 ${t}`:s.value&&i.selectionVariant.value===`highlight`?`${e} ${f.value.text} ${f.value.bg} font-semibold shadow-sm ${t}`:u.value&&i.selectionVariant.value===`highlight`?`${e} bg-surface/50 text-main font-medium border border-dashed border-main ${t}`:`${e} text-main hover:bg-main/5 ${t}`}),h=(0,t.computed)(()=>i.selectionVariant.value===`checkbox`&&!p.value),g=(0,t.computed)(()=>i.parentSelectable.value?r.node.descendantValues:r.node.leafDescendantValues),_=(0,t.computed)(()=>{if(!a.value)return 0;let e=i.selectedValues.value;return g.value.reduce((t,n)=>t+ +!!e.has(n),0)}),v=(0,t.computed)(()=>g.value.length),y=(0,t.computed)(()=>i.isMultiple.value&&a.value&&_.value>0),b=e=>{e.stopPropagation(),a.value&&i.toggleExpand(r.node.value)},x=e=>{if(e.stopPropagation(),!r.node.isDisabled){if(!i.isMultiple.value&&!i.parentSelectable.value&&a.value){i.toggleExpand(r.node.value);return}i.toggleSelection(r.node.value)}};return(l,d)=>{let f=(0,t.resolveComponent)(`SelectOption`,!0);return(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`relative flex w-full flex-col`,(0,t.unref)(i).sizeConfig.value.rowGap])},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`relative z-10 flex w-full items-center`,(0,t.unref)(i).sizeConfig.value.rowMinHeight])},[(0,t.unref)(i).hasHierarchy.value?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createElementVNode)(`div`,{style:(0,t.normalizeStyle)({width:`${e.level*(0,t.unref)(i).sizeConfig.value.indentStep}px`}),class:`h-full shrink-0`},null,4),(0,t.unref)(i).treeLineStyle.value!==`none`&&e.level>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`absolute top-1/2 h-px -translate-y-1/2 border-t border-main`,style:(0,t.normalizeStyle)({left:`${(e.level-1)*(0,t.unref)(i).sizeConfig.value.indentStep+(0,t.unref)(i).sizeConfig.value.chevronCenter}px`,width:`${(0,t.unref)(i).sizeConfig.value.indentStep}px`,borderTopStyle:(0,t.unref)(i).treeLineStyle.value})},null,4)):(0,t.createCommentVNode)(``,!0),a.value?((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:1,class:`relative z-20 flex shrink-0 cursor-pointer items-center justify-center rounded transition-colors hover:bg-main/10`,style:(0,t.normalizeStyle)({width:`${(0,t.unref)(i).sizeConfig.value.chevronSize}px`,height:`${(0,t.unref)(i).sizeConfig.value.chevronSize}px`}),tabindex:`-1`,onClick:(0,t.withModifiers)(b,[`stop`])},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:chevron-right`,class:(0,t.normalizeClass)([`cursor-pointer transition-transform duration-200`,[(0,t.unref)(i).sizeConfig.value.icon,c.value?`rotate-90 text-primary`:`text-muted`]])},null,8,[`class`])],4)):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:2,class:`shrink-0`,style:(0,t.normalizeStyle)({width:`${(0,t.unref)(i).sizeConfig.value.chevronSize}px`,height:`${(0,t.unref)(i).sizeConfig.value.chevronSize}px`})},null,4))],64)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`ml-1 flex flex-1 items-center justify-between gap-2 self-stretch rounded-md transition-all duration-200`,[m.value,(0,t.unref)(i).sizeConfig.value.contentPadding]]),onClick:x},[(0,t.createElementVNode)(`div`,Re,[(0,t.renderSlot)(l.$slots,`option`,{option:e.node.original,selected:s.value,indeterminate:u.value},()=>[(0,t.createTextVNode)((0,t.toDisplayString)(e.node.label),1)])]),(0,t.createElementVNode)(`div`,ze,[y.value?((0,t.openBlock)(),(0,t.createBlock)(Ae,{key:0,variant:`soft`,severity:(0,t.unref)(i).highlightVariant.value,size:(0,t.unref)(i).sizeConfig.value.badge,class:`pointer-events-none`},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(_.value)+`/`+(0,t.toDisplayString)(v.value),1)]),_:1},8,[`severity`,`size`])):(0,t.createCommentVNode)(``,!0),h.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Be,[(0,t.createVNode)(Le,{modelValue:s.value,indeterminate:u.value,variant:(0,t.unref)(i).highlightVariant.value,size:(0,t.unref)(i).size.value,disabled:r.node.isDisabled,tabindex:`-1`},null,8,[`modelValue`,`indeterminate`,`variant`,`size`,`disabled`])])):(0,t.createCommentVNode)(``,!0)])],2)],2),a.value?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`relative flex w-full flex-col`,(0,t.unref)(i).sizeConfig.value.rowGap])},[(0,t.unref)(i).treeLineStyle.value===`none`?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`absolute border-l border-main`,style:(0,t.normalizeStyle)({left:`${e.level*(0,t.unref)(i).sizeConfig.value.indentStep+(0,t.unref)(i).sizeConfig.value.chevronCenter}px`,top:`0px`,bottom:(0,t.unref)(i).sizeConfig.value.halfRow,borderLeftStyle:(0,t.unref)(i).treeLineStyle.value})},null,4)),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.node.childrenValues,n=>((0,t.openBlock)(),(0,t.createBlock)(f,{key:String(n),node:(0,t.unref)(i).nodeMap.value.get(n),level:e.level+1},{option:(0,t.withCtx)(e=>[(0,t.renderSlot)(l.$slots,`option`,(0,t.mergeProps)({ref_for:!0},e))]),_:3},8,[`node`,`level`]))),128))],2)),[[t.vShow,c.value]]):(0,t.createCommentVNode)(``,!0)],2)),[[t.vShow,o.value]])}}}),He=[`for`],Ue={key:0,class:`text-danger`},We=[`id`,`tabindex`],Ge={key:0,class:`shrink-0 border-b border-main/50 bg-surface/30 p-2`},Ke={key:1,class:`flex shrink-0 items-center justify-between border-b border-main/30 bg-surface/10 p-2`},qe={key:3,class:`flex shrink-0 flex-col items-center justify-center gap-3 p-8 text-center`},Je={class:`text-sm text-muted`},Ye={class:`font-bold text-main`},Xe=[`id`,`tabindex`],Ze={key:0,class:`block w-full truncate`},Qe={key:1,class:`block w-full truncate font-medium`},$e={key:0,class:`inline-flex items-center align-middle text-danger opacity-80`},et={class:`line-through`},tt={key:1},nt={key:2},rt={class:`flex max-w-[250px] flex-col gap-1 rounded-md border border-main bg-content p-3 shadow-lg`},it={class:`truncate pr-4`},at={class:`flex max-w-[250px] flex-col gap-1 rounded-md border border-main bg-content p-3 shadow-lg`},ot={class:`truncate pr-4`},st={class:`ml-auto flex h-full shrink-0 items-center gap-1 pl-2 text-muted`},ct={key:0,class:`shrink-0 border-b border-main/50 bg-surface/30 p-2`},lt={key:1,class:`flex shrink-0 items-center justify-between border-b border-main/30 bg-surface/10 p-2`},ut={key:3,class:`flex shrink-0 flex-col items-center justify-center gap-3 p-8 text-center`},dt={class:`text-sm text-muted`},ft={class:`font-bold text-main`},pt={key:2,class:`mt-0.5 flex flex-col gap-1`},mt={class:`min-w-0`},ht=(0,t.defineComponent)({__name:`Select`,props:(0,t.mergeModels)({id:{},label:{},labelPosition:{default:`top`},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},error:{type:[String,Boolean,Array],default:!1},size:{default:`sm`},rounded:{type:Boolean,default:!1},autofocus:{type:Boolean,default:!1},options:{},optionLabel:{type:[String,Function],default:`label`},optionValue:{type:[String,Function],default:`value`},optionChildren:{default:`children`},optionDisabled:{type:[String,Function],default:`disabled`},inline:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},canDeselect:{type:Boolean,default:!0},closeOnSelect:{type:Boolean},displayMode:{default:`text`},selectionVariant:{default:`highlight`},searchable:{type:Boolean,default:!0},parentSelectable:{type:Boolean,default:!0},showClear:{type:Boolean,default:!0},showExpandCollapse:{type:Boolean,default:!1},treeLineStyle:{default:`none`},highlightVariant:{default:`primary`},placeholder:{default:`Select an option...`},maxHeight:{default:320},maxVisibleTextItems:{default:3}},{modelValue:{default:void 0},modelModifiers:{},search:{default:``},searchModifiers:{}}),emits:(0,t.mergeModels)([`search`,`create-new`,`change`,`focus`,`blur`,`open`,`close`],[`update:modelValue`,`update:search`]),setup(e,{emit:r}){let i=e,a=r,o=(0,t.useModel)(e,`modelValue`),s=(0,t.useModel)(e,`search`),l=(0,t.ref)(!1),u=(0,t.ref)(new Set),d=(0,t.ref)(null),f=(0,t.computed)(()=>i.closeOnSelect??!i.multiple),p=(0,t.computed)(()=>!i.error||typeof i.error==`boolean`?[]:Array.isArray(i.error)?i.error:[i.error]),m={xs:40,sm:50,md:65,lg:85,xl:110},h={xs:{wrapHeight:`h-7`,text:`text-xs`,badge:`xs`,rowMinHeight:`min-h-[28px]`,rowGap:`gap-1`,contentPadding:`py-0.5 px-1.5 text-[11px]`,indentStep:20,chevronSize:20,chevronCenter:10,halfRow:`14px`,icon:`w-3 h-3`},sm:{wrapHeight:`h-8`,text:`text-sm`,badge:`sm`,rowMinHeight:`min-h-[32px]`,rowGap:`gap-1.5`,contentPadding:`py-1 px-2 text-xs`,indentStep:24,chevronSize:24,chevronCenter:12,halfRow:`16px`,icon:`w-4 h-4`},md:{wrapHeight:`h-10`,text:`text-sm`,badge:`md`,rowMinHeight:`min-h-[40px]`,rowGap:`gap-2`,contentPadding:`py-1.5 px-2.5 text-sm`,indentStep:28,chevronSize:28,chevronCenter:14,halfRow:`20px`,icon:`w-4 h-4`},lg:{wrapHeight:`h-12`,text:`text-base`,badge:`lg`,rowMinHeight:`min-h-[48px]`,rowGap:`gap-2`,contentPadding:`py-2 px-3 text-base`,indentStep:32,chevronSize:32,chevronCenter:16,halfRow:`24px`,icon:`w-5 h-5`},xl:{wrapHeight:`h-14`,text:`text-lg`,badge:`lg`,rowMinHeight:`min-h-[56px]`,rowGap:`gap-2.5`,contentPadding:`py-2.5 px-3.5 text-base`,indentStep:36,chevronSize:36,chevronCenter:18,halfRow:`28px`,icon:`w-6 h-6`}},g=(0,t.computed)(()=>h[i.size]||h.sm),_=(0,t.shallowRef)(new Map),v=(0,t.shallowRef)([]),y=e=>typeof i.optionValue==`function`?i.optionValue(e):e[i.optionValue],b=e=>typeof i.optionLabel==`function`?i.optionLabel(e):e[i.optionLabel],x=e=>typeof i.optionDisabled==`function`?i.optionDisabled(e):!!e[i.optionDisabled];(0,t.watch)(()=>i.options,()=>{let e=new Map,t=[],n=(t,r,a)=>{let o=[],s=t.length;for(let c=0;c<s;c++){let s=t[c],l=y(s),u=b(s),d=a.concat(u),f=s[i.optionChildren]||[],p={value:l,label:u,searchLabel:u.toLowerCase(),original:s,parentValue:r,childrenValues:[],descendantValues:[],leafDescendantValues:[],pathLabels:d,isDisabled:x(s)};if(e.set(l,p),o.push(l),f.length){let t=n(f,l,d);p.childrenValues=t;let r=[...t],i=[];for(let n=0;n<t.length;n++){let a=e.get(t[n]);r.push(...a.descendantValues),a.childrenValues.length===0?i.push(t[n]):i.push(...a.leafDescendantValues)}p.descendantValues=r,p.leafDescendantValues=i}}return o};t.push(...n(i.options,null,[])),_.value=e,v.value=t},{deep:!0,immediate:!0});let S=(0,t.computed)(()=>{let e=o.value;if(i.multiple){let t=Array.isArray(e)?e.flat(1/0):e==null?[]:[e];return new Set(t)}return Array.isArray(e)?new Set(e.length>0?[e[0]]:[]):new Set(e==null?[]:[e])}),C=e=>{let t=i.multiple?Array.from(e):e.size>0?Array.from(e)[0]:null;o.value=t,a(`change`,t)},w=e=>{let t=_.value.get(e);if(!t||t.isDisabled)return;if(!i.multiple){i.canDeselect&&S.value.has(e)?C(new Set):C(new Set([e])),f.value&&!i.inline&&(l.value=!1);return}let n=new Set(S.value),r=t.descendantValues.length>0,a=(e,t)=>{t?n.add(e):n.delete(e)};if(r&&!i.parentSelectable){let e=t.leafDescendantValues,r=e.every(e=>_.value.get(e)?.isDisabled?!0:n.has(e));e.forEach(e=>{let t=_.value.get(e);t&&!t.isDisabled&&a(e,!r)})}else{let r=n.has(e);a(e,!r),t.descendantValues.forEach(e=>{let t=_.value.get(e);t&&!t.isDisabled&&a(e,!r)})}C(n),f.value&&!i.inline&&(l.value=!1)},T=e=>{if(!i.multiple)C(new Set);else{let t=new Set(S.value);t.delete(e);let n=_.value.get(e);n&&n.descendantValues.forEach(e=>t.delete(e)),C(t)}},E=e=>e.length===0?``:e.join(` → `),D=(0,t.computed)(()=>Array.from(S.value).map(e=>{let t=_.value.get(e),n=typeof i.optionValue==`string`?i.optionValue:`value`,r=typeof i.optionLabel==`string`?i.optionLabel:`label`,a={[n]:e,[r]:String(e)};return{value:e,label:t&&!i.multiple?E(t.pathLabels):t?t.label:String(e),original:t?.original||a,isUnavailable:!t}})),O=(0,t.shallowRef)(new Set);(0,t.watch)(s,e=>{if(a(`search`,e),!e.trim()){O.value=new Set(_.value.keys());return}let t=e.toLowerCase(),n=new Set,r=new Set(u.value);for(let[e,i]of _.value)if(i.searchLabel.includes(t)){n.add(e);let t=i.parentValue;for(;t&&!n.has(t);)n.add(t),r.add(t),t=_.value.get(t)?.parentValue;let a=i.descendantValues;for(let e=0;e<a.length;e++)n.add(a[e])}O.value=n,u.value=r},{immediate:!0});let A=(0,t.ref)(-1),j=(0,t.computed)(()=>{let e=[],t=O.value,n=u.value,r=_.value,i=a=>{for(let o=0;o<a.length;o++){let s=a[o];if(t.has(s)&&(e.push(s),n.has(s))){let e=r.get(s);e&&e.childrenValues.length>0&&i(e.childrenValues)}}};return i(v.value),e}),M=(0,t.computed)(()=>j.value[A.value]??null);(0,t.watch)(l,e=>{e||(A.value=-1)}),(0,t.watch)([s,u],()=>{A.value=-1});let N=e=>{if(i.disabled||i.loading)return;let t=i.inline||l.value;e.key===`Enter`?(e.preventDefault(),t?M.value!==null&&w(M.value):l.value=!0):e.key===`ArrowDown`?(e.preventDefault(),t?A.value=Math.min(A.value+1,j.value.length-1):l.value=!0):e.key===`ArrowUp`?(e.preventDefault(),t&&(A.value=Math.max(A.value-1,0))):e.key===`Escape`?(e.preventDefault(),i.inline||(l.value=!1)):e.key===` `&&!t&&(e.preventDefault(),l.value=!0)},P=(0,t.ref)(null),F=(0,t.ref)(999),ee=()=>{if(d.value)if(i.displayMode===`chips`&&P.value){let e=P.value,t=e.children,n=t.length;if(n<=1){F.value=D.value.length;return}let r=m[i.size]||50,a=e.clientWidth-r,o=0,s=0;for(let e=0;e<n;e++){let n=t[e];if(!n.classList.contains(`overflow-badge`)){if(o+=n.offsetWidth+6,o>a&&s>0)break;s++}}F.value=Math.min(s,D.value.length)}else F.value=i.maxVisibleTextItems},I=null;(0,t.onMounted)(()=>{I=new ResizeObserver(()=>window.requestAnimationFrame(ee)),d.value&&I.observe(d.value),i.autofocus&&d.value&&d.value.focus()}),(0,t.onBeforeUnmount)(()=>{I&&I.disconnect()}),(0,t.watch)(D,()=>{F.value=D.value.length,(0,t.nextTick)(ee)});let te=(0,t.computed)(()=>D.value.slice(0,F.value)),ne=(0,t.computed)(()=>D.value.slice(F.value)),re=()=>{let e=new Set;_.value.forEach((t,n)=>{t.childrenValues.length>0&&e.add(n)}),u.value=e},L=()=>u.value.clear(),R=(0,t.computed)(()=>{for(let e of _.value.values())if(e.childrenValues.length>0)return!0;return!1});(0,t.provide)(`ADVANCED_SELECT_CONTEXT`,{nodeMap:_,isMultiple:(0,t.computed)(()=>i.multiple),parentSelectable:(0,t.computed)(()=>i.parentSelectable),searchQuery:s,selectedValues:S,expandedNodes:u,visibleNodeValues:O,treeLineStyle:(0,t.computed)(()=>i.treeLineStyle),selectionVariant:(0,t.computed)(()=>i.selectionVariant),highlightVariant:(0,t.computed)(()=>i.highlightVariant),activeValue:M,sizeConfig:g,size:(0,t.computed)(()=>i.size),hasHierarchy:R,toggleSelection:w,toggleExpand:e=>{u.value.has(e)?u.value.delete(e):u.value.add(e)}});let z=i.id||`adv-select-${(0,t.useId)()}`,ie=(0,t.computed)(()=>i.labelPosition===`top`?``:{xs:`sm:pt-1`,sm:`sm:pt-1.5`,md:`sm:pt-2`,lg:`sm:pt-2.5`,xl:`sm:pt-3`}[i.size]),ae=(0,t.computed)(()=>{let e=i.rounded?`rounded-full`:`rounded-md`,t=``;t=i.disabled||i.loading?`bg-muted border-main opacity-70 cursor-not-allowed pointer-events-none`:i.error?l.value?`border-danger ring-4 ring-danger/20`:`border-danger hover:border-danger/80 focus:border-danger focus:ring-danger/20`:l.value?`border-primary ring-4 ring-primary/20`:`border-main hover:border-primary/50 focus:border-primary focus:ring-primary/20`;let n=i.size===`xs`?`px-2`:`px-3`;return[`flex items-center justify-between w-full min-w-0 bg-content border transition-all duration-200 outline-none cursor-pointer group focus:ring-4 focus:ring-offset-0 relative overflow-hidden`,e,t,g.value.wrapHeight,n]}),oe=(0,t.computed)(()=>[`flex flex-col overflow-hidden bg-content rounded-md shadow-sm border transition-all duration-200 outline-none w-full focus-within:ring-4 focus-within:ring-offset-0`,i.disabled||i.loading?`bg-muted border-main opacity-70 cursor-not-allowed pointer-events-none`:i.error?`border-danger focus-within:border-danger focus-within:ring-danger/20`:`border-main hover:border-primary/50 focus-within:border-primary focus-within:ring-primary/20`]),se=(0,t.computed)(()=>[`flex-1 flex items-center gap-1.5 min-w-0 h-full`,g.value.text,i.disabled||i.loading?`text-muted`:i.error?D.value.length?`text-danger`:`text-danger opacity-70`:D.value.length?`text-main`:`text-muted opacity-70`]);(0,t.watch)(l,e=>{a(e?`open`:`close`)});let ce=e=>a(`focus`,e),le=e=>a(`blur`,e);return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`flex w-full min-w-0`,e.labelPosition===`left`?`flex-col gap-1.5 sm:flex-row sm:gap-6`:`flex-col gap-1.5`])},[e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`label`,{key:0,for:(0,t.unref)(z),class:(0,t.normalizeClass)([`flex shrink-0 cursor-pointer items-center gap-1 text-[10px] font-bold tracking-wider text-muted`,e.labelPosition===`left`?`sm:w-1/3 lg:w-1/4 ${ie.value}`:``])},[(0,t.createTextVNode)((0,t.toDisplayString)(e.label)+` `,1),e.required?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Ue,`*`)):(0,t.createCommentVNode)(``,!0)],10,He)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,{class:`flex w-full min-w-0 flex-1 flex-col gap-1.5`,ref_key:`wrapperRef`,ref:d},[e.inline?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,id:(0,t.unref)(z),class:(0,t.normalizeClass)(oe.value),style:(0,t.normalizeStyle)({maxHeight:typeof e.maxHeight==`number`?`${e.maxHeight}px`:e.maxHeight}),tabindex:e.disabled||e.loading?-1:0,onKeydown:(0,t.withModifiers)(N,[`stop`]),onFocus:ce,onBlur:le},[e.searchable?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Ge,[(0,t.createVNode)(k,{modelValue:s.value,"onUpdate:modelValue":i[0]||=e=>s.value=e,size:e.size,placeholder:`Search...`,"icon-start":`lucide:search`},null,8,[`modelValue`,`size`])])):(0,t.createCommentVNode)(``,!0),e.showExpandCollapse&&v.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Ke,[(0,t.createVNode)(c,{label:`Expand All`,size:e.size,variant:`text`,severity:`secondary`,icon:`lucide:chevrons-down`,class:`!px-2`,onClick:re},null,8,[`size`]),(0,t.createVNode)(c,{label:`Collapse All`,size:e.size,variant:`text`,severity:`secondary`,icon:`lucide:chevrons-up`,class:`!px-2`,onClick:L},null,8,[`size`])])):(0,t.createCommentVNode)(``,!0),O.value.size>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:2,class:(0,t.normalizeClass)([`custom-scrollbar flex flex-1 flex-col overflow-y-auto p-1.5`,g.value.rowGap])},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(v.value,e=>((0,t.openBlock)(),(0,t.createBlock)(Ve,{key:String(e),node:_.value.get(e)},{option:(0,t.withCtx)(e=>[(0,t.renderSlot)(r.$slots,`option`,(0,t.mergeProps)({ref_for:!0},e))]),_:3},8,[`node`]))),128))],2)):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,qe,[(0,t.renderSlot)(r.$slots,`empty`,{},()=>[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:search-x`,class:`h-8 w-8 text-muted opacity-50`}),(0,t.createElementVNode)(`div`,Je,[i[9]||=(0,t.createTextVNode)(` No results found for `,-1),(0,t.createElementVNode)(`span`,Ye,`"`+(0,t.toDisplayString)(s.value)+`"`,1)])]),(0,t.renderSlot)(r.$slots,`action`,{},()=>[s.value?((0,t.openBlock)(),(0,t.createBlock)(c,{key:0,label:`Add '${s.value}'`,icon:`lucide:plus`,size:e.size,variant:`solid`,severity:`success`,class:`mt-2 shadow-sm`,onClick:i[1]||=e=>a(`create-new`,s.value)},null,8,[`label`,`size`])):(0,t.createCommentVNode)(``,!0)])]))],46,We)):((0,t.openBlock)(),(0,t.createBlock)(pe,{key:1,modelValue:l.value,"onUpdate:modelValue":i[8]||=e=>l.value=e,placement:`bottom-start`,disabled:e.disabled||e.loading,"show-arrow":!1,matchWidth:``,triggerClass:`w-full min-w-0`},{trigger:(0,t.withCtx)(({isOpen:a})=>[(0,t.createElementVNode)(`div`,{id:(0,t.unref)(z),tabindex:e.disabled||e.loading?-1:0,class:(0,t.normalizeClass)(ae.value),onKeydown:N,onFocus:ce,onBlur:le},[(0,t.renderSlot)(r.$slots,`trigger`,{},()=>[e.displayMode===`text`||D.value.length===0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)(se.value)},[D.value.length===0?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Ze,(0,t.toDisplayString)(e.placeholder),1)):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Qe,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(te.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:e.value},[e.isUnavailable?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,$e,[(0,t.createElementVNode)(`span`,et,(0,t.toDisplayString)(e.label),1),i[10]||=(0,t.createElementVNode)(`span`,{class:`mx-1 text-[10px] !no-underline`},`(Unavailable)`,-1),(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:x`,class:`h-3.5 w-3.5 shrink-0 cursor-pointer text-danger transition-colors hover:text-danger/70`,onClick:(0,t.withModifiers)(t=>T(e.value),[`stop`])},null,8,[`onClick`])])):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,tt,(0,t.toDisplayString)(e.label),1)),r<te.value.length-1?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,nt,`, `)):(0,t.createCommentVNode)(``,!0)],64))),128))])),(0,t.withDirectives)((0,t.createElementVNode)(`div`,{onClick:i[2]||=(0,t.withModifiers)(()=>{},[`stop`]),class:`ml-1 flex shrink-0 items-center`},[(0,t.createVNode)(pe,{placement:`top`,trigger:`click`,widthClass:`w-auto`},{trigger:(0,t.withCtx)(()=>[(0,t.createVNode)(Ae,{variant:`soft`,severity:e.highlightVariant,size:g.value.badge,class:`cursor-pointer`},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)(` +`+(0,t.toDisplayString)(ne.value.length)+` Selected `,1)]),_:1},8,[`severity`,`size`])]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,rt,[i[11]||=(0,t.createElementVNode)(`span`,{class:`mb-1 text-[10px] font-black tracking-wider text-muted uppercase`},`Hidden Selections`,-1),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(ne.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.value,class:`flex items-center justify-between gap-3 border-b border-main/10 py-1.5 text-sm text-main last:border-0`},[(0,t.createElementVNode)(`span`,it,(0,t.toDisplayString)(e.label),1),(0,t.createVNode)(c,{icon:`lucide:x`,variant:`text`,severity:`danger`,size:`xs`,class:`shrink-0 !p-1`,onClick:t=>T(e.value)},null,8,[`onClick`])]))),128))])]),_:1})],512),[[t.vShow,e.multiple&&ne.value.length>0]])],2)):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,ref_key:`chipsContainerRef`,ref:P,class:`flex h-full min-w-0 flex-1 flex-nowrap items-center gap-1.5 overflow-hidden`},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(te.value,i=>((0,t.openBlock)(),(0,t.createBlock)(Ae,{key:i.value,variant:`soft`,severity:i.isUnavailable?`danger`:e.highlightVariant,size:g.value.badge,class:`group/chip flex max-w-[140px] shrink-0 items-center`},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(r.$slots,`chip`,{option:i.original,remove:()=>T(i.value)},()=>[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`block truncate`,i.isUnavailable?`line-through opacity-80`:``])},(0,t.toDisplayString)(i.label),3),(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:x`,class:`ml-1 h-3.5 w-3.5 shrink-0 cursor-pointer transition-colors hover:text-danger`,onClick:(0,t.withModifiers)(e=>T(i.value),[`stop`])},null,8,[`onClick`])])]),_:2},1032,[`severity`,`size`]))),128)),(0,t.withDirectives)((0,t.createElementVNode)(`div`,{onClick:i[3]||=(0,t.withModifiers)(()=>{},[`stop`]),class:`overflow-badge flex shrink-0 items-center`},[(0,t.createVNode)(pe,{placement:`top`,trigger:`click`,widthClass:`w-auto`,triggerClass:`flex items-center justify-center`},{trigger:(0,t.withCtx)(()=>[(0,t.createVNode)(Ae,{variant:`solid`,severity:e.highlightVariant,size:g.value.badge,class:`cursor-pointer`},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)(` +`+(0,t.toDisplayString)(ne.value.length),1)]),_:1},8,[`severity`,`size`])]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,at,[i[12]||=(0,t.createElementVNode)(`span`,{class:`mb-1 text-[10px] font-black tracking-wider text-muted uppercase`},`Hidden Selections`,-1),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(ne.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.value,class:`flex items-center justify-between gap-1 border-b border-main/10 text-sm text-main last:border-0`},[(0,t.createElementVNode)(`span`,ot,(0,t.toDisplayString)(e.label),1),(0,t.createVNode)(c,{icon:`lucide:x`,variant:`text`,severity:`danger`,size:`xs`,class:`shrink-0 !p-1`,onClick:t=>T(e.value)},null,8,[`onClick`])]))),128))])]),_:1})],512),[[t.vShow,ne.value.length>0]])],512)),(0,t.createElementVNode)(`div`,st,[e.showClear&&D.value.length>0&&!e.disabled&&!e.loading?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:x`,class:`shrink-0 cursor-pointer transition-transform duration-200 hover:text-danger`,onClick:i[4]||=(0,t.withModifiers)(e=>C(new Set),[`stop`])})):(0,t.createCommentVNode)(``,!0),e.loading?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:1,icon:`lucide:loader-2`,class:(0,t.normalizeClass)([`shrink-0 animate-spin text-primary`,[e.size===`xs`?`h-3.5 w-3.5`:`h-4 w-4`]])},null,8,[`class`])):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:2,icon:`lucide:chevron-right`,class:(0,t.normalizeClass)([`shrink-0 cursor-pointer transition-transform duration-200 hover:text-primary`,[a?`rotate-90 text-primary`:``,e.size===`xs`?`h-3.5 w-3.5`:`h-4 w-4`]])},null,8,[`class`]))])])],42,Xe)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{class:`flex w-full flex-col overflow-hidden rounded-md border border-main bg-content shadow-xl`,style:(0,t.normalizeStyle)({maxHeight:typeof e.maxHeight==`number`?`${e.maxHeight}px`:e.maxHeight}),onKeydown:i[7]||=(0,t.withModifiers)(()=>{},[`stop`])},[e.searchable?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ct,[(0,t.createVNode)(k,{modelValue:s.value,"onUpdate:modelValue":i[5]||=e=>s.value=e,size:e.size,placeholder:`Search...`,"icon-start":`lucide:search`,autofocus:``},null,8,[`modelValue`,`size`])])):(0,t.createCommentVNode)(``,!0),e.showExpandCollapse&&v.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,lt,[(0,t.createVNode)(c,{label:`Expand All`,size:e.size,variant:`text`,severity:`secondary`,icon:`lucide:chevrons-down`,class:`!px-2`,onClick:re},null,8,[`size`]),(0,t.createVNode)(c,{label:`Collapse All`,size:e.size,variant:`text`,severity:`secondary`,icon:`lucide:chevrons-up`,class:`!px-2`,onClick:L},null,8,[`size`])])):(0,t.createCommentVNode)(``,!0),O.value.size>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:2,class:(0,t.normalizeClass)([`custom-scrollbar flex flex-1 flex-col overflow-y-auto p-1.5`,g.value.rowGap])},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(v.value,e=>((0,t.openBlock)(),(0,t.createBlock)(Ve,{key:String(e),node:_.value.get(e)},{option:(0,t.withCtx)(e=>[(0,t.renderSlot)(r.$slots,`option`,(0,t.mergeProps)({ref_for:!0},e))]),_:3},8,[`node`]))),128))],2)):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ut,[(0,t.renderSlot)(r.$slots,`empty`,{},()=>[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:search-x`,class:`h-8 w-8 text-muted opacity-50`}),(0,t.createElementVNode)(`div`,dt,[i[13]||=(0,t.createTextVNode)(` No results found for `,-1),(0,t.createElementVNode)(`span`,ft,`"`+(0,t.toDisplayString)(s.value)+`"`,1)])]),(0,t.renderSlot)(r.$slots,`action`,{},()=>[s.value?((0,t.openBlock)(),(0,t.createBlock)(c,{key:0,label:`Add '${s.value}'`,icon:`lucide:plus`,size:e.size,variant:`solid`,severity:`success`,class:`mt-2 shadow-sm`,onClick:i[6]||=e=>a(`create-new`,s.value)},null,8,[`label`,`size`])):(0,t.createCommentVNode)(``,!0)])]))],36)]),_:3},8,[`modelValue`,`disabled`])),p.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,pt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(p.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r,class:`flex items-start gap-1.5 text-[11px] leading-tight font-medium text-danger`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:alert-circle`,class:`h-3.5 w-3.5 shrink-0`}),(0,t.createElementVNode)(`span`,mt,(0,t.toDisplayString)(e),1)]))),128))])):(0,t.createCommentVNode)(``,!0)],512)],2))}}),gt={class:`flex inline-flex flex-col gap-1`},_t=[`for`],vt=[`id`,`name`,`value`,`disabled`,`required`],yt={key:0,class:`ml-0.5 text-danger`},bt={key:0,class:`mt-0.5 ml-1 flex flex-col`},xt={class:`min-w-0`},St=(0,t.defineComponent)({__name:`Radio`,props:(0,t.mergeModels)({id:{},name:{},value:{},label:{},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},error:{type:[String,Boolean,Array],default:!1},size:{default:`sm`},variant:{default:`primary`}},{modelValue:{},modelModifiers:{}}),emits:(0,t.mergeModels)([`change`],[`update:modelValue`]),setup(e,{emit:r}){let i=e,a=r,o=(0,t.useModel)(e,`modelValue`),s=(0,t.useId)(),c=(0,t.computed)(()=>i.id||`adv-radio-${s}`),l=(0,t.computed)(()=>i.name||`radio-group-${s}`),u=(0,t.computed)(()=>!i.error||typeof i.error==`boolean`?[]:Array.isArray(i.error)?i.error:[i.error]),d=(0,t.computed)(()=>o.value===i.value),f=(0,t.computed)(()=>{let e={xs:{icon:`w-[14px] h-[14px]`,text:`text-[11px] leading-[14px]`,gap:`gap-1.5`,mt:`mt-0`},sm:{icon:`w-4 h-4`,text:`text-xs leading-4`,gap:`gap-2`,mt:`mt-[1px]`},md:{icon:`w-5 h-5`,text:`text-sm leading-5`,gap:`gap-2`,mt:`mt-[1px]`},lg:{icon:`w-6 h-6`,text:`text-base leading-6`,gap:`gap-2.5`,mt:`mt-[2px]`},xl:{icon:`w-7 h-7`,text:`text-lg leading-7`,gap:`gap-3`,mt:`mt-[2px]`}};return e[i.size]||e.sm}),p={primary:`text-primary`,secondary:`text-main`,success:`text-success`,warning:`text-warning`,danger:`text-danger`,info:`text-info`},m=(0,t.computed)(()=>p[i.variant]||p.primary),h=e=>{a(`change`,i.value,e)};return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,gt,[(0,t.createElementVNode)(`label`,{for:c.value,class:(0,t.normalizeClass)([`group relative inline-flex items-start transition-colors duration-150`,[e.disabled?`cursor-not-allowed opacity-50`:`-ml-1 cursor-pointer rounded-md px-1 py-0.5 hover:bg-main/5`,f.value.gap]])},[(0,t.withDirectives)((0,t.createElementVNode)(`input`,{type:`radio`,id:c.value,name:l.value,value:e.value,disabled:e.disabled,required:e.required,"onUpdate:modelValue":i[0]||=e=>o.value=e,class:`peer sr-only`,onChange:h},null,40,vt),[[t.vModelRadio,o.value]]),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex shrink-0 items-center justify-center rounded-full bg-content transition-all peer-focus-visible:ring-2 peer-focus-visible:ring-offset-1`,[f.value.icon,f.value.mt,e.error?`peer-focus-visible:ring-danger/50`:`peer-focus-visible:ring-${e.variant}/50`]])},[d.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:circle-dot`,class:(0,t.normalizeClass)([`h-full w-full`,[e.error?`text-danger`:m.value]])},null,8,[`class`])):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:1,icon:`lucide:circle`,class:(0,t.normalizeClass)([`h-full w-full transition-colors`,[e.error?`text-danger hover:text-danger/80`:`text-muted/30 group-hover:text-muted`]])},null,8,[`class`]))],2),e.label||r.$slots.default?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`flex-1 text-pretty break-words select-none`,[f.value.text,e.error?`text-danger`:`text-main`]])},[(0,t.renderSlot)(r.$slots,`default`,{},()=>[(0,t.createTextVNode)((0,t.toDisplayString)(e.label),1)]),e.required?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,yt,`*`)):(0,t.createCommentVNode)(``,!0)],2)):(0,t.createCommentVNode)(``,!0)],10,_t),u.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,bt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(u.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r,class:`flex items-start gap-1.5 text-[11px] leading-tight font-medium text-danger`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:alert-circle`,class:`h-3.5 w-3.5 shrink-0`}),(0,t.createElementVNode)(`span`,xt,(0,t.toDisplayString)(e),1)]))),128))])):(0,t.createCommentVNode)(``,!0)]))}}),Ct=[`for`],wt={key:0,class:`text-danger`},Tt={class:`flex w-full min-w-0 flex-1 flex-col gap-1.5`},Et=[`id`,`disabled`,`placeholder`,`rows`,`maxlength`,`aria-invalid`],Dt={key:0,class:`pointer-events-none absolute right-1 bottom-1 p-0.5 text-main/30 transition-colors duration-200 group-focus-within:text-primary/60 group-hover:text-main/50`},Ot={key:0},kt={key:0,class:`mt-0.5 flex flex-col gap-1`},At={class:`min-w-0`},jt=Se((0,t.defineComponent)({inheritAttrs:!1,__name:`Textarea`,props:(0,t.mergeModels)({id:{},label:{},labelPosition:{default:`top`},placeholder:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},error:{type:[String,Boolean,Array],default:!1},size:{default:`sm`},rows:{default:3},autoResize:{type:Boolean,default:!1},resize:{default:`vertical`},maxLength:{},showCount:{type:Boolean,default:!1}},{modelValue:{default:``},modelModifiers:{}}),emits:(0,t.mergeModels)([`focus`,`blur`,`input`,`change`],[`update:modelValue`]),setup(e,{emit:r}){let i=e,a=r,o=(0,t.useModel)(e,`modelValue`),s=(0,t.ref)(null),c=i.id||`textarea-${(0,t.useId)()}`,l=()=>{if(!i.autoResize||!s.value)return;s.value.style.height=`auto`;let e=s.value.scrollHeight;s.value.style.height=`${e}px`};(0,t.watch)(o,()=>{i.autoResize&&(0,t.nextTick)(l)}),(0,t.onMounted)(()=>{i.autoResize&&(0,t.nextTick)(l)});let u=(0,t.computed)(()=>i.labelPosition===`top`?``:{xs:`sm:pt-1`,sm:`sm:pt-1.5`,md:`sm:pt-2.5`,lg:`sm:pt-3.5`,xl:`sm:pt-4.5`}[i.size]),d=(0,t.computed)(()=>[`flex flex-col w-full bg-content border rounded-md transition-colors duration-200 focus-within:ring-4 focus-within:ring-offset-0 relative group`,i.disabled?`bg-muted border-main opacity-70 cursor-not-allowed`:i.error?`border-danger focus-within:border-danger focus-within:ring-danger/20`:`border-main hover:border-primary/50 focus-within:border-primary focus-within:ring-primary/20`]),f=(0,t.computed)(()=>{let e=[`min-w-full w-full bg-transparent font-medium custom-scrollbar min-h-full rounded-md`,`border-transparent outline-none ring-0 shadow-none`,`focus:border-transparent focus:outline-none focus:ring-0 focus:shadow-none focus:!border-transparent focus:!shadow-none`].join(` `),t={xs:`text-xs px-2 pt-2 ${m.value?`pb-6`:`pb-2`}`,sm:`text-xs px-3 pt-3 ${m.value?`pb-7`:`pb-3`}`,md:`text-sm px-3.5 pt-3.5 ${m.value?`pb-8`:`pb-3.5`}`,lg:`text-base px-4 pt-4 ${m.value?`pb-8`:`pb-4`}`,xl:`text-lg px-5 pt-5 ${m.value?`pb-9`:`pb-5`}`},n=i.disabled?`text-muted placeholder:text-muted placeholder:opacity-50 cursor-not-allowed`:i.error?`text-danger placeholder:text-danger placeholder:opacity-50`:`text-main placeholder:text-muted placeholder:opacity-70`,r=`resize-none`;return i.autoResize?r=`resize-none overflow-hidden`:i.resize===`vertical`&&(r=`resize-y`),[e,t[i.size],n,r]}),p=(0,t.computed)(()=>!i.error||typeof i.error==`boolean`?[]:Array.isArray(i.error)?i.error:[i.error]),m=(0,t.computed)(()=>i.showCount||!!i.maxLength),h=(0,t.computed)(()=>o.value?.length||0),g=(0,t.computed)(()=>i.maxLength&&h.value>=i.maxLength*.9),_=(0,t.computed)(()=>i.maxLength&&h.value>=i.maxLength);return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`flex w-full`,e.labelPosition===`left`?`flex-col gap-1.5 sm:flex-row sm:gap-6`:`flex-col gap-1.5`])},[e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`label`,{key:0,for:(0,t.unref)(c),class:(0,t.normalizeClass)([`flex shrink-0 items-center gap-1 text-[10px] font-bold tracking-wider text-muted uppercase`,e.labelPosition===`left`?`sm:w-1/3 lg:w-1/4 ${u.value}`:``])},[(0,t.createTextVNode)((0,t.toDisplayString)(e.label)+` `,1),e.required?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,wt,`*`)):(0,t.createCommentVNode)(``,!0)],10,Ct)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,Tt,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)(d.value)},[(0,t.withDirectives)((0,t.createElementVNode)(`textarea`,(0,t.mergeProps)({ref_key:`textareaRef`,ref:s,id:(0,t.unref)(c),disabled:e.disabled,placeholder:e.placeholder,rows:e.rows,maxlength:e.maxLength,class:f.value,"aria-invalid":!!e.error,"onUpdate:modelValue":i[0]||=e=>o.value=e,onInput:i[1]||=e=>a(`input`,e.target.value),onChange:i[2]||=e=>a(`change`,e.target.value),onFocus:i[3]||=e=>a(`focus`,e),onBlur:i[4]||=e=>a(`blur`,e)},r.$attrs),null,16,Et),[[t.vModelText,o.value]]),!e.autoResize&&e.resize!==`none`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Dt,[...i[5]||=[(0,t.createElementVNode)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[(0,t.createElementVNode)(`path`,{d:`M8 2L2 8`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`}),(0,t.createElementVNode)(`path`,{d:`M8 6L6 8`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`})],-1)]])):(0,t.createCommentVNode)(``,!0),m.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:(0,t.normalizeClass)([`pointer-events-none absolute flex justify-end select-none`,[e.resize!==`none`&&!e.autoResize?`right-3.5 bottom-2.5`:`right-2 bottom-2`]])},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`rounded-sm bg-content/80 px-1 text-[10px] font-bold tracking-wider backdrop-blur-sm transition-colors`,[_.value?`text-danger`:g.value?`text-warning`:`text-muted/60`,e.disabled?`opacity-50`:``]])},[(0,t.createTextVNode)((0,t.toDisplayString)(h.value)+` `,1),e.maxLength?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Ot,` / `+(0,t.toDisplayString)(e.maxLength),1)):(0,t.createCommentVNode)(``,!0)],2)],2)):(0,t.createCommentVNode)(``,!0)],2),p.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,kt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(p.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r,class:`flex items-start gap-1.5 text-[11px] leading-tight font-medium text-danger`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:alert-circle`,class:`h-3.5 w-3.5 shrink-0`}),(0,t.createElementVNode)(`span`,At,(0,t.toDisplayString)(e),1)]))),128))])):(0,t.createCommentVNode)(``,!0)])],2))}}),[[`__scopeId`,`data-v-cc936ae2`]]),Mt={class:`leading-none tracking-tight`},Nt=[`role`,`tabindex`,`aria-label`],Pt=[`src`,`alt`],Ft=[`src`,`alt`,`loading`,`fetchpriority`,`crossorigin`,`srcset`],It={class:`absolute top-4 right-4 z-10 flex items-center gap-2 rounded-full border border-main/20 bg-surface/50 p-1 shadow-lg backdrop-blur-md`},Lt={class:`min-w-[3ch] text-center font-mono text-xs font-bold text-main`},Rt=[`src`,`alt`],zt=Se((0,t.defineComponent)({name:`Image`,inheritAttrs:!1,__name:`Image`,props:{src:{},alt:{default:`Image`},fallback:{},lazy:{type:Boolean,default:!0},fetchpriority:{default:`auto`},crossorigin:{},srcset:{},previewable:{type:Boolean,default:!0},fit:{default:`cover`},shape:{default:`rounded`},width:{},height:{},skeletonClass:{},max:{default:4},stacked:{type:Boolean,default:!0},borderColor:{default:`border-surface`}},emits:[`load`,`error`],setup(e,{emit:r}){let i=e,a=r,o=(0,t.computed)(()=>Array.isArray(i.src)),s=(0,t.computed)(()=>{let e=i.width||(o.value?48:void 0);if(e)return typeof e==`number`||!isNaN(Number(e))?`${e}px`:e}),c=(0,t.computed)(()=>{if(i.shape===`circle`)return s.value;let e=i.height||(o.value?48:void 0);if(e)return typeof e==`number`||!isNaN(Number(e))?`${e}px`:e}),l=(0,t.computed)(()=>{let e=parseInt(String(i.width||48));return e<=24?`text-[9px]`:e<=32?`text-[10px]`:`text-xs`}),u=(0,t.computed)(()=>o.value?i.src.slice(0,i.max).map(e=>typeof e==`object`&&e&&`src`in e&&!(e instanceof Blob)&&!(e instanceof File)?e:{src:e}):[]),d=(0,t.computed)(()=>o.value?Math.max(0,i.src.length-i.max):0),f=(0,t.ref)(`loading`),p=(0,t.ref)(null),m=(0,t.ref)(!1),h=(0,t.ref)(!1),g=(0,t.shallowRef)(null);(0,t.onMounted)(()=>{h.value=!0,o.value||y()});let _=(0,t.computed)(()=>o.value||!i.src?``:typeof i.src==`string`?i.src:(p.value||=URL.createObjectURL(i.src),p.value)),v=()=>{p.value&&=(URL.revokeObjectURL(p.value),null)},y=()=>{!g.value||o.value||g.value.complete&&(g.value.naturalWidth>0?f.value!==`loaded`&&(f.value=`loaded`,a(`load`,new Event(`load`))):_.value&&f.value!==`error`&&(f.value=`error`,a(`error`,new Event(`error`))))};(0,t.watch)(()=>i.src,(e,t)=>{o.value||e!==t&&v()}),(0,t.watch)(()=>_.value,e=>{if(!o.value){if(!e){f.value=`error`;return}f.value=`loading`,(0,t.nextTick)(()=>y())}},{immediate:!0}),(0,t.onBeforeUnmount)(()=>v());let b=e=>{f.value!==`loaded`&&(f.value=`loaded`,a(`load`,e))},x=e=>{f.value!==`error`&&(f.value=`error`,a(`error`,e))},S=(0,t.ref)(1),C=(0,t.ref)(0),w=(0,t.ref)(0),T=(0,t.ref)(!1),E=0,D=0,O=()=>{i.previewable&&f.value===`loaded`&&(m.value=!0,document.body.style.overflow=`hidden`,document.addEventListener(`keydown`,A))},k=()=>{m.value=!1,S.value=1,C.value=0,w.value=0,document.body.style.overflow=``,document.removeEventListener(`keydown`,A)},A=e=>{e.key===`Escape`&&k(),(e.key===`=`||e.key===`+`)&&j(),e.key===`-`&&M()},j=()=>S.value=Math.min(S.value+.25,4),M=()=>S.value=Math.max(S.value-.25,.5),N=e=>{e.preventDefault(),S.value+=e.deltaY*-.005,S.value=Math.min(Math.max(.5,S.value),4)},P=e=>{T.value=!0;let t=`touches`in e?e.touches[0].clientX:e.clientX,n=`touches`in e?e.touches[0].clientY:e.clientY;E=t-C.value,D=n-w.value},F=e=>{if(!T.value)return;let t=`touches`in e?e.touches[0].clientX:e.clientX,n=`touches`in e?e.touches[0].clientY:e.clientY;C.value=t-E,w.value=n-D},ee=()=>T.value=!1,I=(0,t.computed)(()=>({rounded:`rounded-3xl`,circle:`rounded-full aspect-square`,square:`rounded-none`})[i.shape]),te=(0,t.computed)(()=>[`relative overflow-hidden isolate flex items-center justify-center bg-surface shrink-0 transition-opacity max-w-full`,I.value,i.previewable&&f.value===`loaded`?`cursor-zoom-in hover:opacity-90`:``]),ne=(0,t.computed)(()=>({width:s.value,height:c.value}));return(r,i)=>{let a=(0,t.resolveComponent)(`Image`,!0);return o.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,(0,t.mergeProps)({key:0,class:[`flex max-w-full items-center`,[e.stacked?`-space-x-3`:`gap-2`]]},r.$attrs),[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(u.value,(n,r)=>((0,t.openBlock)(),(0,t.createBlock)(a,{key:r,src:n.src,alt:n.alt||e.alt,fallback:n.fallback||e.fallback,shape:e.shape,width:e.width,height:e.height,lazy:e.lazy,previewable:e.previewable,fit:e.fit,skeletonClass:e.skeletonClass,class:(0,t.normalizeClass)([`border-2 transition-transform duration-200`,[e.borderColor,e.stacked?`relative z-0 shadow-sm hover:z-10 hover:scale-110`:``]])},null,8,[`src`,`alt`,`fallback`,`shape`,`width`,`height`,`lazy`,`previewable`,`fit`,`skeletonClass`,`class`]))),128)),d.value>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`relative z-0 flex shrink-0 cursor-default items-center justify-center border-2 bg-surface font-bold text-main transition-transform duration-200 hover:z-10`,[I.value,e.borderColor,l.value]]),style:(0,t.normalizeStyle)({width:s.value||`48px`,height:c.value||`48px`})},[(0,t.createElementVNode)(`span`,Mt,`+`+(0,t.toDisplayString)(d.value),1)],6)):(0,t.createCommentVNode)(``,!0)],16)):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,(0,t.mergeProps)({key:1,class:te.value,style:ne.value},r.$attrs,{onClick:O,role:e.previewable?`button`:`img`,tabindex:e.previewable&&f.value===`loaded`?0:void 0,onKeydown:(0,t.withKeys)(O,[`enter`]),"aria-label":e.alt}),[f.value===`loading`?(0,t.renderSlot)(r.$slots,`loading`,{key:0},()=>[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`absolute inset-0 z-10 flex h-full w-full items-center justify-center overflow-hidden bg-main/5`,e.skeletonClass])},[i[0]||=(0,t.createElementVNode)(`div`,{class:`shimmer-effect absolute inset-0 h-full w-[200%]`},null,-1),(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:image`,class:`relative z-10 h-8 w-8 text-main/20`})],2)],!0):f.value===`error`||!_.value?(0,t.renderSlot)(r.$slots,`error`,{key:1},()=>[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`z-10 flex h-full w-full shrink-0 items-center justify-center border border-main bg-surface text-muted/50`,[I.value,e.fallback?`border-transparent`:`border-dashed`,!e.width&&!e.height?`min-h-[80px] min-w-[80px]`:``]])},[e.fallback?((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:0,src:e.fallback,alt:e.alt,class:(0,t.normalizeClass)([`block h-full w-full shrink-0`,I.value]),style:(0,t.normalizeStyle)({objectFit:e.fit})},null,14,Pt)):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:1,icon:`lucide:image-off`,class:`h-8 w-8`}))],2)],!0):(0,t.createCommentVNode)(``,!0),(0,t.withDirectives)((0,t.createElementVNode)(`img`,{ref_key:`imgRef`,ref:g,src:_.value,alt:e.alt,loading:e.lazy?`lazy`:`eager`,decoding:`async`,fetchpriority:e.fetchpriority,crossorigin:e.crossorigin||void 0,srcset:e.srcset,onLoad:b,onError:x,class:(0,t.normalizeClass)([`z-0 block h-full w-full max-w-full shrink-0 transition-opacity duration-300`,[f.value===`loaded`?`opacity-100`:`opacity-0`,I.value]]),style:(0,t.normalizeStyle)({objectFit:e.fit})},null,46,Ft),[[t.vShow,f.value!==`error`&&_.value]]),h.value&&m.value?((0,t.openBlock)(),(0,t.createBlock)(t.Teleport,{key:2,to:`body`},[(0,t.createElementVNode)(`div`,{class:`bg-background/95 fixed inset-0 z-[9999] flex animate-[fadeIn_0.2s_ease-out] touch-none items-center justify-center backdrop-blur-sm`,onClick:(0,t.withModifiers)(k,[`self`])},[(0,t.createElementVNode)(`div`,It,[(0,t.renderSlot)(r.$slots,`preview-actions`,{},void 0,!0),(0,t.createElementVNode)(`button`,{onClick:M,class:`cursor-pointer rounded-full p-2 text-main transition-colors hover:bg-main/10`,title:`Zoom Out (-)`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:zoom-out`,class:`h-5 w-5`})]),(0,t.createElementVNode)(`span`,Lt,(0,t.toDisplayString)(Math.round(S.value*100))+`%`,1),(0,t.createElementVNode)(`button`,{onClick:j,class:`cursor-pointer rounded-full p-2 text-main transition-colors hover:bg-main/10`,title:`Zoom In (+)`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:zoom-in`,class:`h-5 w-5`})]),i[1]||=(0,t.createElementVNode)(`div`,{class:`mx-1 h-5 w-px bg-main/20`},null,-1),(0,t.createElementVNode)(`button`,{onClick:k,class:`cursor-pointer rounded-full p-2 text-main transition-colors hover:bg-danger hover:text-on-danger`,title:`Close (Esc)`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:x`,class:`h-5 w-5`})])]),(0,t.createElementVNode)(`div`,{class:`relative flex h-full w-full items-center justify-center overflow-hidden`,onWheelPassive:N,onMousedown:P,onMousemove:F,onMouseup:ee,onMouseleave:ee,onTouchstartPassive:P,onTouchmovePassive:F,onTouchendPassive:ee},[(0,t.createElementVNode)(`img`,{src:_.value,alt:e.alt,draggable:`false`,class:(0,t.normalizeClass)([`max-h-[90vh] max-w-[90vw] object-contain shadow-xl transition-transform ease-out will-change-transform select-none`,{"cursor-grab":!T.value,"cursor-grabbing":T.value,"duration-100":!T.value,"duration-0":T.value}]),style:(0,t.normalizeStyle)({transform:`translate3d(${C.value}px, ${w.value}px, 0) scale(${S.value})`})},null,14,Rt)],32)])])):(0,t.createCommentVNode)(``,!0)],16,Nt))}}}),[[`__scopeId`,`data-v-177a7564`]]),Bt=[`aria-label`],Vt={key:0,class:`flex w-full items-end justify-between`},Ht=[`id`],Ut={key:1},Wt={class:`flex w-full items-center gap-3`},Gt=[`aria-labelledby`,`aria-valuenow`,`aria-valuemax`],Kt={key:1,class:`flex w-full justify-end`},qt=Se((0,t.defineComponent)({__name:`ProgressBar`,props:(0,t.mergeModels)({id:{},max:{default:100},label:{},showValue:{type:Boolean,default:!1},valuePosition:{default:`top`},valueFormatter:{},size:{default:`sm`},variant:{default:`primary`},striped:{type:Boolean,default:!1},animated:{type:Boolean,default:!1},indeterminate:{type:Boolean,default:!1}},{modelValue:{default:0},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let n=e,r=(0,t.useModel)(e,`modelValue`),i=(0,t.useId)(),a=(0,t.computed)(()=>n.id||`adv-progress-${i}`),o=(0,t.computed)(()=>{if(n.max<=0)return 0;let e=r.value/n.max*100;return Math.min(Math.max(e,0),100)}),s=(0,t.computed)(()=>n.valueFormatter?n.valueFormatter(r.value,n.max):`${Math.round(o.value)}%`),c=(0,t.computed)(()=>{let e={xs:{height:`h-1.5`,label:`text-[10px]`,insideText:`text-[8px] px-1`},sm:{height:`h-2.5`,label:`text-xs`,insideText:`text-[10px] px-1.5`},md:{height:`h-4`,label:`text-sm`,insideText:`text-xs px-2`},lg:{height:`h-6`,label:`text-base`,insideText:`text-sm px-3`},xl:{height:`h-8`,label:`text-lg`,insideText:`text-base px-3.5`}};return e[n.size]||e.sm}),l={primary:`bg-primary text-on-primary`,secondary:`bg-secondary text-on-secondary`,success:`bg-success text-on-success`,warning:`bg-warning text-on-warning`,danger:`bg-danger text-on-danger`,info:`bg-info text-on-info`},u=(0,t.computed)(()=>l[n.variant]||l.primary),d=(0,t.computed)(()=>{let e=[u.value,`shadow-[inset_0_1px_rgba(255,255,255,0.25)] rounded-full transition-all duration-500 ease-out flex items-center justify-end overflow-hidden`];return n.indeterminate?[...e,`absolute top-0 bottom-0 indeterminate-slide`]:[...e,`h-full`,n.striped?`progress-striped`:``,n.striped&&n.animated?`progress-animated`:``]});return(n,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`flex w-full flex-col gap-1`,"aria-label":e.label,"aria-live":`polite`},[e.label||e.showValue&&e.valuePosition===`top`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Vt,[e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,id:`${a.value}-label`,class:(0,t.normalizeClass)([`truncate pr-4 font-bold tracking-wider text-muted uppercase`,c.value.label])},(0,t.toDisplayString)(e.label),11,Ht)):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Ut)),e.showValue&&e.valuePosition===`top`&&!e.indeterminate?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:2,class:(0,t.normalizeClass)([`shrink-0 font-semibold text-main`,c.value.label])},(0,t.toDisplayString)(s.value),3)):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,Wt,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`relative flex-1 overflow-hidden rounded-full bg-surface shadow-inner`,c.value.height]),role:`progressbar`,"aria-labelledby":e.label?`${a.value}-label`:void 0,"aria-valuenow":e.indeterminate?void 0:r.value,"aria-valuemin":0,"aria-valuemax":e.max},[e.indeterminate?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)(d.value)},null,2)):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:(0,t.normalizeClass)(d.value),style:(0,t.normalizeStyle)({width:`${o.value}%`})},[e.showValue&&e.valuePosition===`inside`&&o.value>8?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:(0,t.normalizeClass)([`font-bold tracking-wide whitespace-nowrap drop-shadow-md select-none`,c.value.insideText])},(0,t.toDisplayString)(s.value),3)):(0,t.createCommentVNode)(``,!0)],6))],10,Gt),e.showValue&&e.valuePosition===`right`&&!e.indeterminate?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:(0,t.normalizeClass)([`w-12 shrink-0 text-right font-semibold text-main`,c.value.label])},(0,t.toDisplayString)(s.value),3)):(0,t.createCommentVNode)(``,!0)]),e.showValue&&e.valuePosition===`bottom`&&!e.indeterminate?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Kt,[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`shrink-0 font-semibold text-muted`,c.value.label])},(0,t.toDisplayString)(s.value),3)])):(0,t.createCommentVNode)(``,!0)],8,Bt))}}),[[`__scopeId`,`data-v-d6082f33`]]),Jt=[`aria-disabled`],Yt={key:0,class:`flex items-baseline justify-between pb-1 pl-1`},Xt=[`for`],Zt={key:0,class:`text-[11px] font-medium tracking-wider text-muted uppercase`},Qt=[`onKeydown`],$t={class:`pointer-events-none flex flex-col items-center justify-center gap-3`},en={class:`text-center`},tn=[`onKeydown`],nn={key:1,class:`mt-0.5 flex flex-col gap-1.5 pl-1`},rn={class:`break-words`},an={key:0,class:`mr-1 font-bold`},on=[`id`,`multiple`,`accept`,`disabled`],sn={key:0,class:`mt-2 flex flex-col gap-2.5`},cn={class:`relative h-11 w-11 shrink-0`},ln={key:1,class:`relative flex h-full w-full flex-col items-center justify-center overflow-hidden rounded-lg border border-main/40 bg-content text-muted shadow-sm`},un={class:`absolute bottom-0 w-full border-t border-main/20 bg-main/5 py-[1px] text-center`},dn={class:`text-[8px] font-black tracking-wider text-main/70 uppercase`},fn={key:0,class:`absolute -top-1.5 -right-1.5 z-10 rounded-full border border-success/20 bg-content p-0.5 shadow-sm`},pn={class:`flex min-w-0 flex-1 flex-col justify-center gap-1.5`},mn={class:`flex items-center justify-between gap-3`},hn=[`title`],gn={class:`shrink-0 font-mono text-[11px] leading-none text-muted`},_n={key:0,class:`flex h-3 w-full items-center`},vn={key:0,class:`flex w-full items-center gap-2`},yn={class:`w-8 text-right font-mono text-[10px] font-bold text-primary`},bn={key:1,class:`flex items-center gap-1 text-[11px] font-medium text-success opacity-80`},xn=(0,t.defineComponent)({__name:`FileUpload`,props:(0,t.mergeModels)({id:{},accept:{},multiple:{type:Boolean,default:!1},maxSize:{default:1/0},maxFiles:{default:1/0},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},isShowProgressBar:{type:Boolean,default:!1},error:{type:[String,Boolean,Array],default:!1},layout:{default:`dropzone`},label:{default:`Upload Files`},hint:{default:`Drag and drop files here or click to browse.`},validator:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:(0,t.mergeModels)([`change`,`error`,`remove`,`exceed-limit`],[`update:modelValue`]),setup(e,{expose:r,emit:i}){let a=e,o=i,s=(0,t.useModel)(e,`modelValue`),l=a.id||`adv-upload-${(0,t.useId)()}`,u=(0,t.ref)(null),d=(0,t.ref)(!1),f=0,p=(0,t.ref)(new Map),m=(0,t.ref)([]),h=(0,t.computed)(()=>{let e=[...m.value];return a.error&&(typeof a.error==`string`?e.push({message:a.error}):Array.isArray(a.error)&&a.error.forEach(t=>e.push({message:t}))),e}),g=(0,t.computed)(()=>h.value.length>0),_=e=>{e&&URL.revokeObjectURL(e)};(0,t.onBeforeUnmount)(()=>{p.value.forEach(e=>_(e.previewUrl))});let v=(e,t)=>{if(!t)return!0;let n=t.split(`,`).map(e=>e.trim().toLowerCase()),r=e.type.toLowerCase(),i=e.name.toLowerCase();return n.some(e=>e.startsWith(`.`)?i.endsWith(e):e.endsWith(`/*`)?r.startsWith(e.replace(`/*`,``)):r===e)},y=async e=>{if(a.accept&&!v(e,a.accept))return`Invalid file type. Allowed: ${a.accept}`;if(e.size>a.maxSize)return`File exceeds maximum size of ${(a.maxSize/(1024*1024)).toFixed(2)}MB.`;if(a.validator){let t=await a.validator(e);if(typeof t==`string`)return t;if(t===!1)return`File validation failed.`}return null},b=async e=>{if(a.disabled||a.loading||!e.length)return;m.value=[];let n=a.multiple?Array.from(e):[e[0]],r=a.multiple?s.value.length:0;if(n.length+r>a.maxFiles){o(`exceed-limit`);let e=`Maximum of ${a.maxFiles} files allowed.`;o(`error`,e),m.value.push({message:e});return}let i=a.multiple?[...s.value]:[],c=new Map(a.multiple?p.value:[]);a.multiple||(c.forEach(e=>_(e.previewUrl)),c.clear());let l=n.map(async e=>({file:e,errorMsg:await y(e),id:`${e.name}-${e.lastModified}-${e.size}`})),u=await Promise.all(l),d=!1;for(let e=0;e<u.length;e++){let{file:n,errorMsg:r,id:a}=u[e];if(!c.has(a))if(r)o(`error`,r,n),m.value.push({fileName:n.name,message:r});else{let e=n.type.startsWith(`image/`),r=n.name.split(`.`).pop()?.substring(0,4).toUpperCase()||`FILE`;i.push(n),c.set(a,{id:a,file:(0,t.markRaw)(n),status:`pending`,progress:0,previewUrl:e?URL.createObjectURL(n):void 0,isImage:e,extension:r}),d=!0}}(d||!a.multiple)&&(p.value=c,s.value=i,o(`change`,i))},x=e=>{e.preventDefault(),!a.disabled&&(f++,d.value=!0)},S=e=>{e.preventDefault(),!a.disabled&&(f--,f===0&&(d.value=!1))},C=e=>e.preventDefault(),w=e=>{e.preventDefault(),f=0,d.value=!1,!(a.disabled||!e.dataTransfer?.files.length)&&b(e.dataTransfer.files)},T=e=>{let t=e.target;t.files?.length&&b(t.files),u.value&&(u.value.value=``)},E=e=>{let t=p.value.get(e);if(!t)return;_(t.previewUrl),p.value.delete(e);let n=s.value.filter(e=>e!==t.file);s.value=n,o(`remove`,t.file),o(`change`,n),n.length===0&&(m.value=[])},D=()=>{!a.disabled&&!a.loading&&u.value?.click()},O=e=>{if(e===0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/t**r).toFixed(2))+` `+n[r]},k=(0,t.computed)(()=>Array.from(p.value.values()));return r({triggerSelect:D,updateProgressBar:(e,t,n)=>{let r=p.value.get(e);r&&(r.progress=Math.min(100,Math.max(0,t)),n&&(r.status=n))}}),(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`flex w-full flex-col gap-3`,"aria-disabled":e.disabled},[e.label&&e.layout===`dropzone`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Yt,[(0,t.createElementVNode)(`label`,{for:(0,t.unref)(l),class:(0,t.normalizeClass)([`text-sm font-bold tracking-wide`,g.value?`text-danger`:`text-main`])},(0,t.toDisplayString)(e.label),11,Xt),e.maxFiles>1&&e.maxFiles!==1/0?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Zt,` Max: `+(0,t.toDisplayString)(e.maxFiles)+` Files `,1)):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0),(0,t.renderSlot)(r.$slots,`trigger`,{trigger:D,isDragging:d.value,disabled:e.disabled,hasError:g.value},()=>[e.layout===`dropzone`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,onDragenter:x,onDragleave:S,onDragover:C,onDrop:w,onClick:D,onKeydown:[(0,t.withKeys)(D,[`enter`]),(0,t.withKeys)((0,t.withModifiers)(D,[`prevent`]),[`space`])],tabindex:`0`,class:(0,t.normalizeClass)([`group relative flex w-full cursor-pointer flex-col items-center justify-center rounded-xl border-2 border-dashed p-10 transition-all duration-300 outline-none focus-visible:border-primary focus-visible:ring-4 focus-visible:ring-primary/20`,[e.disabled||e.loading?`cursor-not-allowed border-main bg-muted opacity-60`:d.value?`scale-[1.01] border-primary bg-primary/5 shadow-inner`:g.value?`border-danger bg-danger/5 hover:border-danger/60`:`border-main/40 bg-surface/30 hover:border-primary/50 hover:bg-surface/80`]])},[(0,t.createElementVNode)(`div`,$t,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`rounded-full p-3 transition-colors duration-300`,g.value&&!d.value?`bg-danger/10`:d.value?`bg-primary/10`:`bg-main/5 group-hover:bg-primary/5`])},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:e.loading?`lucide:loader-2`:g.value&&!d.value?`lucide:alert-circle`:`lucide:cloud-upload`,class:(0,t.normalizeClass)([`h-8 w-8 transition-colors duration-300`,[e.loading?`animate-spin text-primary`:d.value?`text-primary`:g.value?`text-danger group-hover:text-danger/70`:`text-muted group-hover:text-primary`]])},null,8,[`icon`,`class`])],2),(0,t.createElementVNode)(`div`,en,[(0,t.createElementVNode)(`p`,{class:(0,t.normalizeClass)([`text-sm font-bold`,g.value&&!d.value?`text-danger`:`text-main`])},(0,t.toDisplayString)(e.loading?`Processing...`:d.value?`Drop files now`:`Click or drag files to upload`),3),e.hint&&!e.loading&&!d.value?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,{key:0,class:(0,t.normalizeClass)([`mt-1 max-w-xs text-xs leading-relaxed`,g.value?`text-danger/70`:`text-muted`])},(0,t.toDisplayString)(e.hint),3)):(0,t.createCommentVNode)(``,!0),e.accept&&!e.loading&&!d.value?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,{key:1,class:(0,t.normalizeClass)([`mt-3 text-[10px] font-semibold tracking-wider uppercase`,g.value?`text-danger/60`:`text-muted/60`])},(0,t.toDisplayString)(e.accept.replace(/,/g,` • `)),3)):(0,t.createCommentVNode)(``,!0)])])],42,Qt)):e.layout===`button`?((0,t.openBlock)(),(0,t.createBlock)(c,{key:1,label:e.label,icon:`lucide:upload`,variant:g.value?`solid`:`outline`,severity:g.value?`danger`:`secondary`,loading:e.loading,disabled:e.disabled,onClick:D},null,8,[`label`,`variant`,`severity`,`loading`,`disabled`])):e.layout===`compact`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:2,onDragenter:x,onDragleave:S,onDragover:C,onDrop:w,onClick:D,onKeydown:[(0,t.withKeys)(D,[`enter`]),(0,t.withKeys)((0,t.withModifiers)(D,[`prevent`]),[`space`])],tabindex:`0`,class:(0,t.normalizeClass)([`group relative flex w-full cursor-pointer items-center rounded-lg border border-dashed px-4 py-2.5 transition-all duration-200 outline-none focus-visible:ring-4 focus-visible:ring-primary/20`,[e.disabled||e.loading?`cursor-not-allowed border-main/50 bg-muted opacity-60`:d.value?`border-primary bg-primary/5`:g.value?`border-danger bg-danger/5 hover:border-danger/60`:`border-main/50 bg-surface/30 hover:border-primary/50 hover:bg-surface/80`]])},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:e.loading?`lucide:loader-2`:g.value&&!d.value?`lucide:alert-circle`:`lucide:paperclip`,class:(0,t.normalizeClass)([`mr-3 h-4 w-4 shrink-0 transition-colors duration-200`,[e.loading?`animate-spin text-primary`:d.value?`text-primary`:g.value?`text-danger`:`text-muted group-hover:text-primary`]])},null,8,[`icon`,`class`]),(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`flex-1 truncate text-sm font-semibold`,g.value&&!d.value?`text-danger`:`text-main`])},(0,t.toDisplayString)(e.loading?`Processing...`:d.value?`Drop files here`:e.label||`Choose file...`),3),!e.loading&&!d.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:(0,t.normalizeClass)([`ml-3 shrink-0 rounded border bg-content px-2 py-1 text-[11px] font-bold shadow-sm transition-colors`,g.value?`border-danger/30 text-danger group-hover:border-danger/60`:`border-main/30 text-main/70 group-hover:border-main/60`])},` Browse `,2)):(0,t.createCommentVNode)(``,!0)],42,tn)):(0,t.createCommentVNode)(``,!0)]),h.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,nn,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(h.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r,class:`flex items-start gap-1.5 text-[11px] leading-tight font-medium text-danger`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:alert-circle`,class:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,t.createElementVNode)(`span`,rn,[e.fileName?((0,t.openBlock)(),(0,t.createElementBlock)(`strong`,an,(0,t.toDisplayString)(e.fileName)+`:`,1)):(0,t.createCommentVNode)(``,!0),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(e.message),1)])]))),128))])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`input`,{id:(0,t.unref)(l),ref_key:`fileInputRef`,ref:u,type:`file`,multiple:e.multiple,accept:e.accept,disabled:e.disabled||e.loading,class:`hidden`,onChange:T},null,40,on),(0,t.renderSlot)(r.$slots,`file-list`,{files:k.value,remove:E},()=>[k.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,sn,[(0,t.createVNode)(t.TransitionGroup,{"enter-active-class":`transition-all duration-300 ease-out`,"enter-from-class":`opacity-0 translate-y-2`,"enter-to-class":`opacity-100 translate-y-0`,"leave-active-class":`transition-all duration-200 ease-in`,"leave-from-class":`opacity-100 scale-100`,"leave-to-class":`opacity-0 scale-95`,"move-class":`transition-transform duration-300`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(k.value,i=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:i.id,class:`group relative flex items-center gap-4 rounded-xl border border-main/30 bg-surface/50 p-3 shadow-sm transition-all duration-200 hover:border-main/60 hover:bg-surface hover:shadow`},[(0,t.createElementVNode)(`div`,cn,[(0,t.renderSlot)(r.$slots,`preview`,{item:i},()=>[i.isImage&&i.previewUrl?((0,t.openBlock)(),(0,t.createBlock)(zt,{key:0,src:i.previewUrl,alt:i.file.name,shape:`rounded`,class:`h-full w-full border border-main/20 object-cover shadow-sm`},null,8,[`src`,`alt`])):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ln,[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:file`,class:`mb-2 h-4 w-4 opacity-60`}),(0,t.createElementVNode)(`div`,un,[(0,t.createElementVNode)(`span`,dn,(0,t.toDisplayString)(i.extension),1)])]))]),i.status===`success`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,fn,[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:check-circle-2`,class:`h-3.5 w-3.5 text-success`})])):(0,t.createCommentVNode)(``,!0)]),(0,t.createElementVNode)(`div`,pn,[(0,t.createElementVNode)(`div`,mn,[(0,t.createElementVNode)(`span`,{class:`truncate text-sm leading-none font-semibold text-main`,title:i.file.name},(0,t.toDisplayString)(i.file.name),9,hn),(0,t.createElementVNode)(`span`,gn,(0,t.toDisplayString)(O(i.file.size)),1)]),e.isShowProgressBar?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,_n,[i.status===`uploading`||i.status===`pending`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,vn,[(0,t.createVNode)(qt,{"model-value":i.progress,size:`xs`,variant:`primary`,animated:i.status===`uploading`,class:`flex-1`},null,8,[`model-value`,`animated`]),(0,t.createElementVNode)(`span`,yn,(0,t.toDisplayString)(Math.round(i.progress))+`%`,1)])):i.status===`success`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,bn,` Ready `)):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0)]),(0,t.createVNode)(c,{icon:`lucide:trash-2`,variant:`text`,severity:`secondary`,size:`sm`,class:`shrink-0 opacity-40 transition-all group-hover:opacity-100 hover:!bg-danger/10 hover:!text-danger`,title:`Remove file`,onClick:e=>E(i.id)},null,8,[`onClick`])]))),128))]),_:3})])):(0,t.createCommentVNode)(``,!0)])],8,Jt))}}),Sn=[`for`],Cn={key:0,class:`text-danger`},wn={class:`relative flex w-full min-w-0 flex-1 flex-col gap-1.5`},Tn={key:0,class:`custom-scrollbar flex w-full shrink-0 flex-row items-center gap-1.5 overflow-x-auto border-b border-main/30 bg-surface/10 p-2`},En=[`onClick`],Dn={class:`flex w-full flex-col p-3 md:p-4`},On={key:0,class:`mb-3 flex w-full flex-row items-center gap-2 border-b border-main/30 pb-3 sm:mb-4 sm:gap-3 sm:pb-4`},kn={class:`flex w-full flex-col items-center gap-6 md:flex-row md:items-start`},An={class:`mb-4 flex w-full items-center justify-between`},jn={class:`flex flex-1 items-center justify-center gap-1 text-sm font-bold text-main`},Mn={class:`mb-2 grid w-full grid-cols-7`},Nn={class:`grid w-full grid-cols-7 gap-y-1`},Pn=[`disabled`,`onMouseenter`,`onClick`],Fn={key:1,class:`grid w-full grid-cols-3 gap-2`},In=[`onClick`],Ln={key:2,class:`grid w-full grid-cols-3 gap-2`},Rn=[`onClick`],zn={class:`mb-4 flex w-full items-center justify-between`},Bn={class:`flex flex-1 items-center justify-center gap-1 text-sm font-bold text-main`},Vn={class:`mb-2 grid w-full grid-cols-7`},Hn={class:`grid w-full grid-cols-7 gap-y-1`},Un=[`disabled`,`onMouseenter`,`onClick`],Wn={key:1,class:`grid w-full grid-cols-3 gap-2`},Gn=[`onClick`],Kn={key:2,class:`grid w-full grid-cols-3 gap-2`},qn=[`onClick`],Jn={key:1,class:`mt-3 flex w-full items-center justify-between border-t border-main/30 px-1 pt-3`},Yn={class:`flex items-center gap-1.5 text-muted`},Xn={class:`flex items-center gap-2`},Zn={key:2,class:`mt-3 flex w-full items-center justify-end gap-2 border-t border-main/30 pt-3 sm:mt-4 sm:pt-4`},Qn={key:0,class:`custom-scrollbar flex w-full shrink-0 flex-row items-center gap-1.5 overflow-x-auto border-b border-main/30 bg-surface/10 p-2 sm:p-3`},$n=[`onClick`],er={class:`flex w-max min-w-full flex-col p-3 md:p-4`},tr={key:0,class:`mb-3 flex w-full flex-row items-center gap-2 border-b border-main/30 pb-3 sm:mb-4 sm:gap-3 sm:pb-4`},nr={class:`flex w-full flex-col items-center gap-6 md:flex-row md:items-start`},rr={class:`mb-4 flex w-full items-center justify-between`},ir={class:`flex flex-1 items-center justify-center gap-1 text-sm font-bold text-main`},ar={class:`mb-2 grid w-full grid-cols-7`},or={class:`grid w-full grid-cols-7 gap-y-1`},sr=[`disabled`,`onMouseenter`,`onClick`],cr={key:1,class:`grid w-full grid-cols-3 gap-2`},lr=[`onClick`],ur={key:2,class:`grid w-full grid-cols-3 gap-2`},dr=[`onClick`],fr={class:`mb-4 flex w-full items-center justify-between`},pr={class:`flex flex-1 items-center justify-center gap-1 text-sm font-bold text-main`},mr={class:`mb-2 grid w-full grid-cols-7`},hr={class:`grid w-full grid-cols-7 gap-y-1`},gr=[`disabled`,`onMouseenter`,`onClick`],_r={key:1,class:`grid w-full grid-cols-3 gap-2`},vr=[`onClick`],yr={key:2,class:`grid w-full grid-cols-3 gap-2`},br=[`onClick`],xr={key:1,class:`mt-3 flex w-full items-center justify-between border-t border-main/30 px-1 pt-3`},Sr={class:`flex items-center gap-1.5 text-muted`},Cr={class:`flex items-center gap-2`},wr={key:2,class:`mt-3 flex w-full items-center justify-end gap-2 border-t border-main/30 pt-3 sm:mt-4 sm:pt-4`},Tr={key:2,class:`mt-0.5 flex flex-col gap-1`},Er={class:`min-w-0`},Dr=(0,t.defineComponent)({inheritAttrs:!1,__name:`DatePicker`,props:(0,t.mergeModels)({id:{},label:{},labelPosition:{default:`top`},required:{type:Boolean,default:!1},placeholder:{},disabled:{type:Boolean,default:!1},error:{type:[String,Boolean,Array],default:!1},size:{default:`sm`},mode:{default:`single`},pickerType:{default:`date`},inline:{type:Boolean,default:!1},enableTime:{type:Boolean,default:!1},closeOnSelect:{type:Boolean,default:!0},autoApply:{type:Boolean,default:!0},showPresets:{type:Boolean,default:!1},presetRanges:{},displayFormat:{default:`MM/dd/yyyy`},modelFormat:{default:`Date`},rangeKeys:{default:()=>({start:`start`,end:`end`})},minDate:{},maxDate:{},showClear:{type:Boolean,default:!0}},{modelValue:{default:null},modelModifiers:{}}),emits:(0,t.mergeModels)([`focus`,`blur`,`change`,`clear`,`apply`,`cancel`],[`update:modelValue`]),setup(e,{emit:r}){let i=e,o=r,s=(0,t.useModel)(e,`modelValue`),l=i.id||`datepicker-${(0,t.useId)()}`,u=(0,t.ref)(!1),d=(0,t.ref)(``),f=(0,t.ref)(!1),p=(0,t.ref)(i.pickerType===`year`?`years`:i.pickerType===`month`?`months`:`days`),m=(0,t.ref)(i.pickerType===`year`?`years`:i.pickerType===`month`?`months`:`days`),h=(0,t.ref)(new Date),g=(0,t.ref)((0,a.addMonths)(new Date,1)),_=(0,t.ref)(null),v=(0,t.ref)({start:null,end:null}),y=(0,t.ref)(null),b=(0,t.ref)(`start`),x=(0,t.computed)(()=>{if(!i.displayFormat||/(MMM|MMMM|EEE|EEEE)/.test(i.displayFormat))return``;let e=i.displayFormat.replace(/[MdyHms]/g,`#`);return i.mode===`range`?`${e} - ${e}`:e}),C=(0,t.computed)(()=>{if(i.presetRanges)return i.presetRanges;let e=(0,a.startOfDay)(new Date);return[{label:`Today`,range:[e,e]},{label:`Yesterday`,range:[(0,a.subDays)(e,1),(0,a.subDays)(e,1)]},{label:`Last 7 Days`,range:[(0,a.subDays)(e,6),e]},{label:`This Month`,range:[(0,a.startOfMonth)(e),(0,a.endOfMonth)(e)]},{label:`Last Month`,range:[(0,a.startOfMonth)((0,a.subMonths)(e,1)),(0,a.endOfMonth)((0,a.subMonths)(e,1))]}]}),w=e=>i.mode!==`range`||!v.value.start||!v.value.end?!1:(0,a.isSameDay)(v.value.start,e[0])&&(0,a.isSameDay)(v.value.end,e[1]),T=e=>{f.value=!1,v.value.start=e[0],v.value.end=e[1],(0,a.isSameMonth)(e[0],e[1])?(h.value=(0,a.subMonths)(e[0],1),g.value=e[0]):(h.value=e[0],g.value=e[1]),i.autoApply?(N(!0),i.closeOnSelect&&!i.inline&&!i.enableTime&&(u.value=!1)):(f.value=!1,k())},E=e=>{if(!e)return null;if(e instanceof Date)return(0,a.isValid)(e)?e:null;if(typeof e==`number`)return new Date(e);if(typeof e==`string`){if(i.modelFormat===`ISO`)return new Date(e);let t=(0,a.parse)(e,i.modelFormat===`Date`||i.modelFormat===`timestamp`?`yyyy-MM-dd`:i.modelFormat,new Date);return(0,a.isValid)(t)?t:new Date(e)}return null},D=e=>e?i.modelFormat===`Date`?new Date(e):i.modelFormat===`ISO`?e.toISOString():i.modelFormat===`timestamp`?e.getTime():(0,a.format)(e,i.modelFormat):null,O=()=>{if(i.mode===`single`)_.value=E(s.value),_.value&&(h.value=new Date(_.value));else{let e=s.value?.[i.rangeKeys.start],t=s.value?.[i.rangeKeys.end];v.value.start=E(e),v.value.end=E(t),v.value.start&&(h.value=new Date(v.value.start)),v.value.end&&!(0,a.isSameMonth)(v.value.start||new Date,v.value.end)?g.value=new Date(v.value.end):g.value=(0,a.addMonths)(h.value,1)}k()},k=()=>{if(!f.value)if(i.mode===`single`)d.value=_.value?(0,a.format)(_.value,i.displayFormat):``;else{let e=v.value.start?(0,a.format)(v.value.start,i.displayFormat):``,t=v.value.end?(0,a.format)(v.value.end,i.displayFormat):``;d.value=e&&t?`${e} - ${t}`:e?`${e} - `:``}};(0,t.watch)(()=>s.value,O,{immediate:!0,deep:!0}),(0,t.watch)(u,e=>{if(e&&!i.inline){let e=i.pickerType===`year`?`years`:i.pickerType===`month`?`months`:`days`;p.value=e,m.value=e,b.value=`start`,O()}else !e&&!i.inline&&(f.value=!1,i.autoApply?k():O())});let A=null,j=()=>{f.value=!0,A&&clearTimeout(A),A=setTimeout(()=>{let e=d.value.trim();if(!e||e===`-`||e.includes(`_`)||e.includes(`#`)){e===``&&P(!1);return}if(i.mode===`single`){let t=(0,a.parse)(e,i.displayFormat,new Date);(0,a.isValid)(t)&&(0,a.getYear)(t)>1e3&&!L(t)&&(ye(t,!1,!1,!1),h.value=t)}else{let t=e.split(` - `);if(t.length===2){let e=(0,a.parse)(t[0].trim(),i.displayFormat,new Date),n=(0,a.parse)(t[1].trim(),i.displayFormat,new Date),r=!1;if((0,a.isValid)(e)&&(0,a.getYear)(e)>1e3&&!L(e)&&(v.value.start=e,h.value=e,r=!0),(0,a.isValid)(n)&&(0,a.getYear)(n)>1e3&&!L(n)&&(v.value.end=n,g.value=n,r=!0),r){if(v.value.start&&v.value.end&&(0,a.isBefore)(v.value.end,v.value.start)){let e=v.value.start;v.value.start=v.value.end,v.value.end=e}i.autoApply&&N(!1)}}}},150)},M=e=>{f.value=!1,k(),o(`blur`,e)},N=(e=!0)=>{let t={[i.rangeKeys.start]:D(v.value.start),[i.rangeKeys.end]:D(v.value.end)};s.value=t,o(`change`,t),e&&(f.value=!1,k())},P=(e=!0)=>{i.disabled||(s.value=i.mode===`range`?{[i.rangeKeys.start]:null,[i.rangeKeys.end]:null}:null,_.value=null,v.value={start:null,end:null},o(`clear`),o(`change`,s.value),b.value=`start`,e&&(f.value=!1,d.value=``))},F=()=>{v.value.start=null,b.value=`start`,i.autoApply?N(!0):k()},ee=()=>{v.value.end=null,b.value=`end`,i.autoApply?N(!0):k()},I=()=>{if(i.mode===`single`){let e=D(_.value);s.value=e,o(`change`,e),o(`apply`,e)}else{let e={[i.rangeKeys.start]:D(v.value.start),[i.rangeKeys.end]:D(v.value.end)};s.value=e,o(`change`,e),o(`apply`,e)}f.value=!1,k(),i.inline||(u.value=!1)},te=()=>{O(),o(`cancel`),i.inline||(u.value=!1)},ne=(0,t.computed)(()=>i.minDate?(0,a.startOfDay)(E(i.minDate)):null),re=(0,t.computed)(()=>i.maxDate?(0,a.startOfDay)(E(i.maxDate)):null),L=e=>{let t=(0,a.startOfDay)(e);return!!(ne.value&&(0,a.isBefore)(t,ne.value)||re.value&&(0,a.isAfter)(t,re.value))},R=Array.from({length:7}).map((e,t)=>(0,a.format)((0,a.addMonths)((0,a.startOfWeek)(new Date),0).setDate((0,a.startOfWeek)(new Date).getDate()+t),`EE`)),z=Array.from({length:12}).map((e,t)=>(0,a.format)((0,a.setMonth)(new Date,t),`MMM`)),ie=e=>(0,a.eachDayOfInterval)({start:(0,a.startOfWeek)((0,a.startOfMonth)(e)),end:(0,a.endOfWeek)((0,a.endOfMonth)(e))}),ae=(0,t.computed)(()=>ie(h.value)),oe=(0,t.computed)(()=>ie(g.value)),se=(0,t.computed)(()=>Math.floor((0,a.getYear)(h.value)/10)*10),ce=(0,t.computed)(()=>Math.floor((0,a.getYear)(g.value)/10)*10),le=(0,t.computed)(()=>Array.from({length:12}).map((e,t)=>se.value-1+t)),ue=(0,t.computed)(()=>Array.from({length:12}).map((e,t)=>ce.value-1+t)),de=()=>{p.value===`days`?h.value=(0,a.addMonths)(h.value,1):p.value===`years`?h.value=(0,a.setYear)(h.value,(0,a.getYear)(h.value)+10):h.value=(0,a.setYear)(h.value,(0,a.getYear)(h.value)+1)},me=()=>{p.value===`days`?h.value=(0,a.subMonths)(h.value,1):p.value===`years`?h.value=(0,a.setYear)(h.value,(0,a.getYear)(h.value)-10):h.value=(0,a.setYear)(h.value,(0,a.getYear)(h.value)-1)},he=()=>{i.pickerType===`date`&&(p.value===`days`?p.value=`months`:p.value===`months`&&(p.value=`years`))},ge=()=>{m.value===`days`?g.value=(0,a.addMonths)(g.value,1):m.value===`years`?g.value=(0,a.setYear)(g.value,(0,a.getYear)(g.value)+10):g.value=(0,a.setYear)(g.value,(0,a.getYear)(g.value)+1)},_e=()=>{m.value===`days`?g.value=(0,a.subMonths)(g.value,1):m.value===`years`?g.value=(0,a.setYear)(g.value,(0,a.getYear)(g.value)-10):g.value=(0,a.setYear)(g.value,(0,a.getYear)(g.value)-1)},ve=()=>{i.pickerType===`date`&&(m.value===`days`?m.value=`months`:m.value===`months`&&(m.value=`years`))},ye=(e,t=!0,n=!0,r=!0)=>{if(L(e))return;let c=new Date(e);if(r&&i.enableTime&&i.mode===`single`&&_.value&&(c=(0,a.setHours)(c,(0,a.getHours)(_.value)),c=(0,a.setMinutes)(c,(0,a.getMinutes)(_.value))),i.mode===`single`){if(_.value=c,i.autoApply){let e=D(c);s.value=e,o(`change`,e)}n&&(f.value=!1,k()),i.autoApply&&t&&i.closeOnSelect&&!i.inline&&!i.enableTime&&(u.value=!1)}else b.value===`start`?(v.value.start=c,v.value.end&&(0,a.isAfter)(c,v.value.end)&&(v.value.end=null),b.value=`end`):v.value.start&&(0,a.isBefore)(c,v.value.start)?(v.value.start=c,b.value=`end`):(v.value.end=c,b.value=`start`),i.autoApply?(N(n),t&&v.value.start&&v.value.end&&i.closeOnSelect&&!i.inline&&!i.enableTime&&(u.value=!1)):n&&(f.value=!1,k())},be=e=>{h.value=(0,a.setMonth)(h.value,e),i.pickerType===`month`?ye(h.value):p.value=`days`},xe=e=>{h.value=(0,a.setYear)(h.value,e),i.pickerType===`year`?ye(h.value):p.value=i.pickerType===`month`?`months`:`days`},Se=e=>{g.value=(0,a.setMonth)(g.value,e),i.pickerType===`month`?ye(g.value):m.value=`days`},Ce=e=>{g.value=(0,a.setYear)(g.value,e),i.pickerType===`year`?ye(g.value):m.value=i.pickerType===`month`?`months`:`days`},we=(e,t)=>{let n=(0,a.setMonth)(t,e);return i.mode===`single`&&_.value?(0,a.isSameMonth)(n,_.value):i.mode===`range`?v.value.start&&(0,a.isSameMonth)(n,v.value.start)||v.value.end&&(0,a.isSameMonth)(n,v.value.end):!1},Te=e=>i.mode===`single`&&_.value?(0,a.getYear)(_.value)===e:i.mode===`range`?v.value.start&&(0,a.getYear)(v.value.start)===e||v.value.end&&(0,a.getYear)(v.value.end)===e:!1,Ee=e=>i.mode===`range`&&v.value.start&&(0,a.isSameDay)(e,v.value.start),De=e=>i.mode===`range`&&v.value.end&&(0,a.isSameDay)(e,v.value.end),Oe=e=>i.mode===`single`&&_.value&&(0,a.isSameDay)(e,_.value),ke=e=>{if(i.mode!==`range`)return!1;let t=v.value.start,n=v.value.end;if(t&&n)return(0,a.isWithinInterval)(e,{start:t,end:n})&&!(0,a.isSameDay)(e,t)&&!(0,a.isSameDay)(e,n);if(t&&!n&&y.value&&b.value===`end`){let n=(0,a.isBefore)(t,y.value)?t:y.value,r=(0,a.isBefore)(t,y.value)?y.value:t;return(0,a.isWithinInterval)(e,{start:n,end:r})&&!(0,a.isSameDay)(e,n)&&!(0,a.isSameDay)(e,r)}if(!t&&n&&y.value&&b.value===`start`){let t=(0,a.isBefore)(y.value,n)?y.value:n,r=(0,a.isBefore)(y.value,n)?n:y.value;return(0,a.isWithinInterval)(e,{start:t,end:r})&&!(0,a.isSameDay)(e,t)&&!(0,a.isSameDay)(e,r)}return!1},Ae=(e,t)=>e.map(e=>{let n=L(e),r=!!Oe(e),i=!!Ee(e),o=!!De(e);return{date:e,key:e.toISOString(),label:(0,a.format)(e,`d`),sameMonth:(0,a.isSameMonth)(e,t),disabled:n,inRange:ke(e),rangeStartGradient:i&&!!(v.value.end||y.value),rangeEndGradient:o&&!!v.value.start,today:(0,a.isToday)(e)&&!r&&!i&&!o,edgeSelected:r||i||o}}),je=(0,t.computed)(()=>Ae(ae.value,h.value)),Me=(0,t.computed)(()=>Ae(oe.value,g.value)),Ne=(0,t.computed)({get:()=>_.value?(0,a.getHours)(_.value):0,set:e=>{f.value=!1;let t=Math.max(0,Math.min(23,Number(e)));_.value?ye((0,a.setHours)(_.value,t),!1,!0,!1):ye((0,a.setHours)(new Date,t),!1,!0,!1)}}),Pe=(0,t.computed)({get:()=>_.value?(0,a.getMinutes)(_.value):0,set:e=>{f.value=!1;let t=Math.max(0,Math.min(59,Number(e)));_.value?ye((0,a.setMinutes)(_.value,t),!1,!0,!1):ye((0,a.setMinutes)(new Date,t),!1,!0,!1)}}),Fe=(0,t.computed)(()=>i.labelPosition===`top`?``:{xs:`sm:pt-1`,sm:`sm:pt-1.5`,md:`sm:pt-2.5`,lg:`sm:pt-3.5`,xl:`sm:pt-4.5`}[i.size]),Ie=(0,t.computed)(()=>({xs:`h-3.5 w-3.5`,sm:`h-4 w-4`,md:`h-4 w-4`,lg:`h-5 w-5`,xl:`h-6 w-6`})[i.size]),Le=(0,t.computed)(()=>!i.error||typeof i.error==`boolean`?[]:Array.isArray(i.error)?i.error:[i.error]);return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`flex w-full`,e.labelPosition===`left`?`flex-col gap-1.5 sm:flex-row sm:gap-6`:`flex-col gap-1.5`])},[e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`label`,{key:0,for:(0,t.unref)(l),class:(0,t.normalizeClass)([`flex shrink-0 cursor-pointer items-center gap-1 text-[10px] font-bold tracking-wider text-muted uppercase`,e.labelPosition===`left`?`sm:w-1/3 lg:w-1/4 ${Fe.value}`:``])},[(0,t.createTextVNode)((0,t.toDisplayString)(e.label)+` `,1),e.required?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Cn,`*`)):(0,t.createCommentVNode)(``,!0)],10,Sn)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,wn,[e.inline?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:`flex w-full flex-col overflow-x-auto overflow-y-hidden rounded-md border border-main bg-content shadow-sm select-none`,onClick:i[23]||=(0,t.withModifiers)(()=>{},[`stop`])},[e.mode===`range`&&e.showPresets?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Qn,[i[29]||=(0,t.createElementVNode)(`span`,{class:`hidden shrink-0 px-2 text-[10px] font-bold tracking-wider text-muted uppercase sm:inline`},`Presets`,-1),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(C.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e.label,onClick:(0,t.withModifiers)(t=>T(e.range),[`stop`]),class:(0,t.normalizeClass)([`shrink-0 cursor-pointer rounded px-3 py-1.5 text-xs whitespace-nowrap transition-colors`,w(e.range)?`bg-primary/10 font-bold text-primary`:`font-medium text-main hover:bg-primary/10 hover:text-primary`])},(0,t.toDisplayString)(e.label),11,$n))),128))])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,er,[e.mode===`range`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,tr,[(0,t.createElementVNode)(`div`,{class:`group flex min-w-0 flex-1 cursor-pointer flex-col gap-1`,onClick:i[15]||=e=>b.value=`start`},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`truncate text-[10px] font-bold uppercase transition-colors`,b.value===`start`?`text-primary`:`text-muted`])},`Start Date`,2),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex h-8 min-w-0 items-center justify-between rounded border px-2 shadow-sm transition-all`,b.value===`start`?`border-primary bg-surface/30 ring-2 ring-primary/10`:`border-main bg-content`])},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`truncate pr-1 text-xs font-medium`,v.value.start?`text-main`:`text-muted/50`])},(0,t.toDisplayString)(v.value.start?(0,t.unref)(a.format)(v.value.start,e.displayFormat):`Start...`),3),v.value.start?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:x`,class:`z-10 h-3.5 w-3.5 shrink-0 text-muted hover:text-danger`,onClick:(0,t.withModifiers)(F,[`stop`])})):(0,t.createCommentVNode)(``,!0)],2)]),(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:arrow-right`,class:`mt-4 h-4 w-4 shrink-0 text-muted`}),(0,t.createElementVNode)(`div`,{class:`group flex min-w-0 flex-1 cursor-pointer flex-col gap-1`,onClick:i[16]||=e=>b.value=`end`},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`truncate text-[10px] font-bold uppercase transition-colors`,b.value===`end`?`text-primary`:`text-muted`])},`End Date`,2),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex h-8 min-w-0 items-center justify-between rounded border px-2 shadow-sm transition-all`,b.value===`end`?`border-primary bg-surface/30 ring-2 ring-primary/10`:`border-main bg-content`])},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`truncate pr-1 text-xs font-medium`,v.value.end?`text-main`:`text-muted/50`])},(0,t.toDisplayString)(v.value.end?(0,t.unref)(a.format)(v.value.end,e.displayFormat):`End...`),3),v.value.end?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:x`,class:`z-10 h-3.5 w-3.5 shrink-0 text-muted hover:text-danger`,onClick:(0,t.withModifiers)(ee,[`stop`])})):(0,t.createCommentVNode)(``,!0)],2)])])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,nr,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([e.mode===`range`?`w-full md:min-w-0 md:flex-1`:`w-full min-w-[260px]`,e.mode===`range`&&b.value===`end`?`hidden md:block`:``])},[(0,t.createElementVNode)(`div`,rr,[(0,t.createVNode)(c,{icon:`lucide:chevron-left`,variant:`text`,severity:`secondary`,size:`xs`,class:`shrink-0 !p-1 hover:bg-surface/50`,onClick:me}),(0,t.createElementVNode)(`div`,ir,[p.value===`days`||p.value===`months`?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:`cursor-pointer rounded px-1.5 py-0.5 transition-colors hover:bg-primary/5 hover:text-primary`,onClick:he},[p.value===`days`?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a.format)(h.value,`MMMM`)),1)],64)):(0,t.createCommentVNode)(``,!0),p.value===`months`?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a.format)(h.value,`yyyy`)),1)],64)):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0),p.value===`days`?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,class:`cursor-pointer rounded px-1.5 py-0.5 transition-colors hover:bg-primary/5 hover:text-primary`,onClick:i[17]||=e=>p.value=`years`},(0,t.toDisplayString)((0,t.unref)(a.format)(h.value,`yyyy`)),1)):(0,t.createCommentVNode)(``,!0)]),(0,t.createVNode)(c,{icon:`lucide:chevron-right`,variant:`text`,severity:`secondary`,size:`xs`,class:`shrink-0 !p-1 hover:bg-surface/50`,onClick:de})]),p.value===`days`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`w-full`,onMouseleave:i[18]||=e=>y.value=null},[(0,t.createElementVNode)(`div`,ar,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(R),e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e,class:`text-center text-[10px] font-black tracking-wider text-muted uppercase`},(0,t.toDisplayString)(e),1))),128))]),(0,t.createElementVNode)(`div`,or,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(je.value,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n.key,class:(0,t.normalizeClass)([`relative flex h-8 items-center justify-center transition-colors`,[n.inRange?`bg-primary/10`:``,n.rangeStartGradient?`bg-gradient-to-r from-transparent to-primary/10`:``,n.rangeEndGradient?`bg-gradient-to-l from-transparent to-primary/10`:``]])},[(0,t.createElementVNode)(`button`,{type:`button`,disabled:n.disabled,class:(0,t.normalizeClass)([`absolute z-10 mx-auto flex h-8 w-8 items-center justify-center rounded-md text-xs font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1`,[n.sameMonth?`text-main`:`text-muted/40`,n.disabled?`cursor-not-allowed opacity-30`:`cursor-pointer hover:bg-main/10`,n.today?`border border-primary text-primary`:``,n.edgeSelected?`bg-primary text-on-primary shadow-sm hover:bg-primary/90`:``]]),onMouseenter:t=>e.mode===`range`?y.value=n.date:null,onClick:(0,t.withModifiers)(e=>ye(n.date),[`stop`])},(0,t.toDisplayString)(n.label),43,sr)],2))),128))])],32)):(0,t.createCommentVNode)(``,!0),p.value===`months`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,cr,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(z),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e,type:`button`,class:(0,t.normalizeClass)([`w-full rounded-md py-3 text-sm font-semibold transition-colors hover:bg-main/10`,we(n,h.value)?`border border-primary/20 bg-primary/10 text-primary`:`text-main`]),onClick:(0,t.withModifiers)(e=>be(n),[`stop`])},(0,t.toDisplayString)(e),11,lr))),128))])):(0,t.createCommentVNode)(``,!0),p.value===`years`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ur,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(le.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e,type:`button`,class:(0,t.normalizeClass)([`w-full rounded-md py-3 text-sm font-semibold transition-colors hover:bg-main/10`,Te(e)?`border border-primary/20 bg-primary/10 text-primary`:e===se.value-1||e===se.value+10?`text-muted`:`text-main`]),onClick:(0,t.withModifiers)(t=>xe(e),[`stop`])},(0,t.toDisplayString)(e),11,dr))),128))])):(0,t.createCommentVNode)(``,!0)],2),e.mode===`range`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`w-full min-w-0 border-main/30 md:flex-1 md:border-l md:pl-6`,b.value===`start`?`hidden md:block`:``])},[(0,t.createElementVNode)(`div`,fr,[(0,t.createVNode)(c,{icon:`lucide:chevron-left`,variant:`text`,severity:`secondary`,size:`xs`,class:`shrink-0 !p-1 hover:bg-surface/50`,onClick:_e}),(0,t.createElementVNode)(`div`,pr,[(0,t.createElementVNode)(`span`,{class:`cursor-pointer rounded px-1.5 py-0.5 transition-colors hover:bg-primary/5 hover:text-primary`,onClick:ve},[m.value===`days`?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a.format)(g.value,`MMMM`)),1)],64)):(0,t.createCommentVNode)(``,!0),m.value===`months`||m.value===`years`?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a.format)(g.value,`yyyy`)),1)],64)):(0,t.createCommentVNode)(``,!0)]),m.value===`days`?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:`cursor-pointer rounded px-1.5 py-0.5 transition-colors hover:bg-primary/5 hover:text-primary`,onClick:i[19]||=e=>m.value=`years`},(0,t.toDisplayString)((0,t.unref)(a.format)(g.value,`yyyy`)),1)):(0,t.createCommentVNode)(``,!0)]),(0,t.createVNode)(c,{icon:`lucide:chevron-right`,variant:`text`,severity:`secondary`,size:`xs`,class:`shrink-0 !p-1 hover:bg-surface/50`,onClick:ge})]),m.value===`days`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`w-full`,onMouseleave:i[20]||=e=>y.value=null},[(0,t.createElementVNode)(`div`,mr,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(R),e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e,class:`text-center text-[10px] font-black tracking-wider text-muted uppercase`},(0,t.toDisplayString)(e),1))),128))]),(0,t.createElementVNode)(`div`,hr,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(Me.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.key,class:(0,t.normalizeClass)([`relative flex h-8 items-center justify-center transition-colors`,[e.inRange?`bg-primary/10`:``,e.rangeStartGradient?`bg-gradient-to-r from-transparent to-primary/10`:``,e.rangeEndGradient?`bg-gradient-to-l from-transparent to-primary/10`:``]])},[(0,t.createElementVNode)(`button`,{type:`button`,disabled:e.disabled,class:(0,t.normalizeClass)([`absolute z-10 mx-auto flex h-8 w-8 items-center justify-center rounded-md text-xs font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1`,[e.sameMonth?`text-main`:`text-muted/40`,e.disabled?`cursor-not-allowed opacity-30`:`cursor-pointer hover:bg-main/10`,e.today?`border border-primary text-primary`:``,e.edgeSelected?`bg-primary text-on-primary shadow-sm hover:bg-primary/90`:``]]),onMouseenter:t=>y.value=e.date,onClick:(0,t.withModifiers)(t=>ye(e.date),[`stop`])},(0,t.toDisplayString)(e.label),43,gr)],2))),128))])],32)):(0,t.createCommentVNode)(``,!0),m.value===`months`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,_r,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(z),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e,type:`button`,class:(0,t.normalizeClass)([`w-full rounded-md py-3 text-sm font-semibold transition-colors hover:bg-main/10`,we(n,g.value)?`border border-primary/20 bg-primary/10 text-primary`:`text-main`]),onClick:(0,t.withModifiers)(e=>Se(n),[`stop`])},(0,t.toDisplayString)(e),11,vr))),128))])):(0,t.createCommentVNode)(``,!0),m.value===`years`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,yr,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(ue.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e,type:`button`,class:(0,t.normalizeClass)([`w-full rounded-md py-3 text-sm font-semibold transition-colors hover:bg-main/10`,Te(e)?`border border-primary/20 bg-primary/10 text-primary`:e===ce.value-1||e===ce.value+10?`text-muted`:`text-main`]),onClick:(0,t.withModifiers)(t=>Ce(e),[`stop`])},(0,t.toDisplayString)(e),11,br))),128))])):(0,t.createCommentVNode)(``,!0)],2)):(0,t.createCommentVNode)(``,!0)]),e.enableTime&&e.mode===`single`&&e.pickerType===`date`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,xr,[(0,t.createElementVNode)(`div`,Sr,[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:clock`,class:`h-4 w-4 text-primary`}),i[30]||=(0,t.createElementVNode)(`span`,{class:`mt-0.5 text-[10px] font-bold tracking-wider uppercase`},`Time`,-1)]),(0,t.createElementVNode)(`div`,Cr,[(0,t.createVNode)(S,{modelValue:Ne.value,"onUpdate:modelValue":i[21]||=e=>Ne.value=e,min:0,max:23,size:`xs`,showButtons:!0,class:`w-[72px] shadow-sm`},null,8,[`modelValue`]),i[31]||=(0,t.createElementVNode)(`span`,{class:`pb-0.5 font-bold text-main`},`:`,-1),(0,t.createVNode)(S,{modelValue:Pe.value,"onUpdate:modelValue":i[22]||=e=>Pe.value=e,min:0,max:59,size:`xs`,showButtons:!0,class:`w-[72px] shadow-sm`},null,8,[`modelValue`])])])):(0,t.createCommentVNode)(``,!0),e.autoApply?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,wr,[(0,t.createVNode)(c,{variant:`outline`,severity:`secondary`,size:`sm`,onClick:(0,t.withModifiers)(te,[`stop`])},{default:(0,t.withCtx)(()=>[...i[32]||=[(0,t.createTextVNode)(`Cancel`,-1)]]),_:1}),(0,t.createVNode)(c,{variant:`solid`,severity:`primary`,size:`sm`,onClick:(0,t.withModifiers)(I,[`stop`])},{default:(0,t.withCtx)(()=>[...i[33]||=[(0,t.createTextVNode)(`Apply`,-1)]]),_:1})]))])])):((0,t.openBlock)(),(0,t.createBlock)(pe,{key:0,modelValue:u.value,"onUpdate:modelValue":i[14]||=e=>u.value=e,placement:`bottom-start`,matchWidth:!1,widthClass:`w-max max-w-[95vw]`,disabled:e.disabled,triggerClass:`w-full`},{trigger:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{class:`group relative w-full`,onClick:i[4]||=(0,t.withModifiers)(t=>e.disabled?null:u.value=!0,[`stop`,`prevent`])},[(0,t.createVNode)(fe,(0,t.mergeProps)({id:(0,t.unref)(l),disabled:e.disabled,placeholder:e.placeholder||(e.mode===`range`?`${e.displayFormat} - ${e.displayFormat}`:e.displayFormat),size:e.size,error:!!e.error,mask:x.value,iconEnd:`lucide:calendar`,modelValue:d.value,"onUpdate:modelValue":i[0]||=e=>d.value=e,onMaska:j,onKeydown:(0,t.withKeys)((0,t.withModifiers)(j,[`prevent`]),[`enter`]),onFocus:i[1]||=e=>{u.value=!0,o(`focus`,e)},onBlur:M},r.$attrs),null,16,[`id`,`disabled`,`placeholder`,`size`,`error`,`mask`,`modelValue`,`onKeydown`]),e.showClear&&(_.value||v.value.start||v.value.end)&&!e.disabled?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`absolute top-0 bottom-0 z-10 flex items-center justify-center bg-transparent px-1.5`,[{xs:`right-6`,sm:`right-7`,md:`right-9`,lg:`right-11`,xl:`right-13`}[e.size]]]),onMousedown:i[2]||=(0,t.withModifiers)(()=>{},[`stop`,`prevent`]),onClick:i[3]||=(0,t.withModifiers)(e=>P(!0),[`stop`,`prevent`])},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:x`,class:(0,t.normalizeClass)([`cursor-pointer rounded-full bg-content p-0.5 text-muted opacity-0 transition-colors group-hover:opacity-100 hover:text-danger`,Ie.value])},null,8,[`class`])],34)):(0,t.createCommentVNode)(``,!0)])]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{class:`flex w-max max-w-[95vw] flex-col overflow-hidden rounded-md border border-main bg-content shadow-xl select-none`,onClick:i[13]||=(0,t.withModifiers)(()=>{},[`stop`])},[e.mode===`range`&&e.showPresets?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Tn,[i[24]||=(0,t.createElementVNode)(`span`,{class:`hidden shrink-0 px-2 text-[10px] font-bold tracking-wider text-muted uppercase sm:inline`},`Presets`,-1),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(C.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e.label,onClick:(0,t.withModifiers)(t=>T(e.range),[`stop`]),class:(0,t.normalizeClass)([`shrink-0 cursor-pointer rounded px-3 py-1.5 text-xs whitespace-nowrap transition-colors`,w(e.range)?`bg-primary/10 font-bold text-primary`:`font-medium text-main hover:bg-primary/10 hover:text-primary`])},(0,t.toDisplayString)(e.label),11,En))),128))])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,Dn,[e.mode===`range`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,On,[(0,t.createElementVNode)(`div`,{class:`group flex min-w-0 flex-1 cursor-pointer flex-col gap-1`,onClick:i[5]||=e=>b.value=`start`},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`truncate text-[10px] font-bold uppercase transition-colors`,b.value===`start`?`text-primary`:`text-muted`])},`Start Date`,2),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex h-8 min-w-0 items-center justify-between rounded border px-2 shadow-sm transition-all`,b.value===`start`?`border-primary bg-surface/30 ring-2 ring-primary/10`:`border-main bg-content`])},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`truncate pr-1 text-xs font-medium`,v.value.start?`text-main`:`text-muted/50`])},(0,t.toDisplayString)(v.value.start?(0,t.unref)(a.format)(v.value.start,e.displayFormat):`Select start...`),3),v.value.start?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:x`,class:`z-10 h-3.5 w-3.5 shrink-0 text-muted hover:text-danger`,onClick:(0,t.withModifiers)(F,[`stop`])})):(0,t.createCommentVNode)(``,!0)],2)]),(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:arrow-right`,class:`mt-4 h-4 w-4 shrink-0 text-muted`}),(0,t.createElementVNode)(`div`,{class:`group flex min-w-0 flex-1 cursor-pointer flex-col gap-1`,onClick:i[6]||=e=>b.value=`end`},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`truncate text-[10px] font-bold uppercase transition-colors`,b.value===`end`?`text-primary`:`text-muted`])},`End Date`,2),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex h-8 min-w-0 items-center justify-between rounded border px-2 shadow-sm transition-all`,b.value===`end`?`border-primary bg-surface/30 ring-2 ring-primary/10`:`border-main bg-content`])},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`truncate pr-1 text-xs font-medium`,v.value.end?`text-main`:`text-muted/50`])},(0,t.toDisplayString)(v.value.end?(0,t.unref)(a.format)(v.value.end,e.displayFormat):`Select end...`),3),v.value.end?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:x`,class:`z-10 h-3.5 w-3.5 shrink-0 text-muted hover:text-danger`,onClick:(0,t.withModifiers)(ee,[`stop`])})):(0,t.createCommentVNode)(``,!0)],2)])])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,kn,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`w-full`,e.mode===`range`?`md:min-w-0 md:flex-1`:`shrink-0 md:w-[260px]`,e.mode===`range`&&b.value===`end`?`hidden md:block`:``])},[(0,t.createElementVNode)(`div`,An,[(0,t.createVNode)(c,{icon:`lucide:chevron-left`,variant:`text`,severity:`secondary`,size:`xs`,class:`shrink-0 !p-1 hover:bg-surface/50`,onClick:me}),(0,t.createElementVNode)(`div`,jn,[p.value===`days`||p.value===`months`?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:`cursor-pointer rounded px-1.5 py-0.5 transition-colors hover:bg-primary/5 hover:text-primary`,onClick:he},[p.value===`days`?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a.format)(h.value,`MMMM`)),1)],64)):(0,t.createCommentVNode)(``,!0),p.value===`months`?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a.format)(h.value,`yyyy`)),1)],64)):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0),p.value===`days`?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,class:`cursor-pointer rounded px-1.5 py-0.5 transition-colors hover:bg-primary/5 hover:text-primary`,onClick:i[7]||=e=>p.value=`years`},(0,t.toDisplayString)((0,t.unref)(a.format)(h.value,`yyyy`)),1)):(0,t.createCommentVNode)(``,!0)]),(0,t.createVNode)(c,{icon:`lucide:chevron-right`,variant:`text`,severity:`secondary`,size:`xs`,class:`shrink-0 !p-1 hover:bg-surface/50`,onClick:de})]),p.value===`days`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`w-full`,onMouseleave:i[8]||=e=>y.value=null},[(0,t.createElementVNode)(`div`,Mn,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(R),e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e,class:`text-center text-[10px] font-black tracking-wider text-muted uppercase`},(0,t.toDisplayString)(e),1))),128))]),(0,t.createElementVNode)(`div`,Nn,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(je.value,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n.key,class:(0,t.normalizeClass)([`relative flex h-8 items-center justify-center transition-colors`,[n.inRange?`bg-primary/10`:``,n.rangeStartGradient?`bg-gradient-to-r from-transparent to-primary/10`:``,n.rangeEndGradient?`bg-gradient-to-l from-transparent to-primary/10`:``]])},[(0,t.createElementVNode)(`button`,{type:`button`,disabled:n.disabled,class:(0,t.normalizeClass)([`absolute z-10 mx-auto flex h-8 w-8 items-center justify-center rounded-md text-xs font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1`,[n.sameMonth?`text-main`:`text-muted/40`,n.disabled?`cursor-not-allowed opacity-30`:`cursor-pointer hover:bg-main/10`,n.today?`border border-primary text-primary`:``,n.edgeSelected?`bg-primary text-on-primary shadow-sm hover:bg-primary/90`:``]]),onMouseenter:t=>e.mode===`range`?y.value=n.date:null,onClick:(0,t.withModifiers)(e=>ye(n.date),[`stop`])},(0,t.toDisplayString)(n.label),43,Pn)],2))),128))])],32)):(0,t.createCommentVNode)(``,!0),p.value===`months`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Fn,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(z),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e,type:`button`,class:(0,t.normalizeClass)([`w-full rounded-md py-3 text-sm font-semibold transition-colors hover:bg-main/10`,we(n,h.value)?`border border-primary/20 bg-primary/10 text-primary`:`text-main`]),onClick:(0,t.withModifiers)(e=>be(n),[`stop`])},(0,t.toDisplayString)(e),11,In))),128))])):(0,t.createCommentVNode)(``,!0),p.value===`years`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Ln,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(le.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e,type:`button`,class:(0,t.normalizeClass)([`w-full rounded-md py-3 text-sm font-semibold transition-colors hover:bg-main/10`,Te(e)?`border border-primary/20 bg-primary/10 text-primary`:e===se.value-1||e===se.value+10?`text-muted`:`text-main`]),onClick:(0,t.withModifiers)(t=>xe(e),[`stop`])},(0,t.toDisplayString)(e),11,Rn))),128))])):(0,t.createCommentVNode)(``,!0)],2),e.mode===`range`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`w-full min-w-0 border-main/30 md:flex-1 md:border-l md:pl-6`,b.value===`start`?`hidden md:block`:``])},[(0,t.createElementVNode)(`div`,zn,[(0,t.createVNode)(c,{icon:`lucide:chevron-left`,variant:`text`,severity:`secondary`,size:`xs`,class:`shrink-0 !p-1 hover:bg-surface/50`,onClick:_e}),(0,t.createElementVNode)(`div`,Bn,[(0,t.createElementVNode)(`span`,{class:`cursor-pointer rounded px-1.5 py-0.5 transition-colors hover:bg-primary/5 hover:text-primary`,onClick:ve},[m.value===`days`?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a.format)(g.value,`MMMM`)),1)],64)):(0,t.createCommentVNode)(``,!0),m.value===`months`||m.value===`years`?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a.format)(g.value,`yyyy`)),1)],64)):(0,t.createCommentVNode)(``,!0)]),m.value===`days`?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:`cursor-pointer rounded px-1.5 py-0.5 transition-colors hover:bg-primary/5 hover:text-primary`,onClick:i[9]||=e=>m.value=`years`},(0,t.toDisplayString)((0,t.unref)(a.format)(g.value,`yyyy`)),1)):(0,t.createCommentVNode)(``,!0)]),(0,t.createVNode)(c,{icon:`lucide:chevron-right`,variant:`text`,severity:`secondary`,size:`xs`,class:`shrink-0 !p-1 hover:bg-surface/50`,onClick:ge})]),m.value===`days`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`w-full`,onMouseleave:i[10]||=e=>y.value=null},[(0,t.createElementVNode)(`div`,Vn,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(R),e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e,class:`text-center text-[10px] font-black tracking-wider text-muted uppercase`},(0,t.toDisplayString)(e),1))),128))]),(0,t.createElementVNode)(`div`,Hn,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(Me.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.key,class:(0,t.normalizeClass)([`relative flex h-8 items-center justify-center transition-colors`,[e.inRange?`bg-primary/10`:``,e.rangeStartGradient?`bg-gradient-to-r from-transparent to-primary/10`:``,e.rangeEndGradient?`bg-gradient-to-l from-transparent to-primary/10`:``]])},[(0,t.createElementVNode)(`button`,{type:`button`,disabled:e.disabled,class:(0,t.normalizeClass)([`absolute z-10 mx-auto flex h-8 w-8 items-center justify-center rounded-md text-xs font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1`,[e.sameMonth?`text-main`:`text-muted/40`,e.disabled?`cursor-not-allowed opacity-30`:`cursor-pointer hover:bg-main/10`,e.today?`border border-primary text-primary`:``,e.edgeSelected?`bg-primary text-on-primary shadow-sm hover:bg-primary/90`:``]]),onMouseenter:t=>y.value=e.date,onClick:(0,t.withModifiers)(t=>ye(e.date),[`stop`])},(0,t.toDisplayString)(e.label),43,Un)],2))),128))])],32)):(0,t.createCommentVNode)(``,!0),m.value===`months`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Wn,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(z),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e,type:`button`,class:(0,t.normalizeClass)([`w-full rounded-md py-3 text-sm font-semibold transition-colors hover:bg-main/10`,we(n,g.value)?`border border-primary/20 bg-primary/10 text-primary`:`text-main`]),onClick:(0,t.withModifiers)(e=>Se(n),[`stop`])},(0,t.toDisplayString)(e),11,Gn))),128))])):(0,t.createCommentVNode)(``,!0),m.value===`years`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Kn,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(ue.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e,type:`button`,class:(0,t.normalizeClass)([`w-full rounded-md py-3 text-sm font-semibold transition-colors hover:bg-main/10`,Te(e)?`border border-primary/20 bg-primary/10 text-primary`:e===ce.value-1||e===ce.value+10?`text-muted`:`text-main`]),onClick:(0,t.withModifiers)(t=>Ce(e),[`stop`])},(0,t.toDisplayString)(e),11,qn))),128))])):(0,t.createCommentVNode)(``,!0)],2)):(0,t.createCommentVNode)(``,!0)]),e.enableTime&&e.mode===`single`&&e.pickerType===`date`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Jn,[(0,t.createElementVNode)(`div`,Yn,[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:clock`,class:`h-4 w-4`}),i[25]||=(0,t.createElementVNode)(`span`,{class:`mt-0.5 text-[10px] font-bold tracking-wider uppercase`},`Time`,-1)]),(0,t.createElementVNode)(`div`,Xn,[(0,t.createVNode)(S,{modelValue:Ne.value,"onUpdate:modelValue":i[11]||=e=>Ne.value=e,min:0,max:23,size:`xs`,showButtons:!0,class:`w-[72px] shadow-sm`},null,8,[`modelValue`]),i[26]||=(0,t.createElementVNode)(`span`,{class:`pb-0.5 font-bold text-main/50`},`:`,-1),(0,t.createVNode)(S,{modelValue:Pe.value,"onUpdate:modelValue":i[12]||=e=>Pe.value=e,min:0,max:59,size:`xs`,showButtons:!0,class:`w-[72px] shadow-sm`},null,8,[`modelValue`])])])):(0,t.createCommentVNode)(``,!0),e.autoApply?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Zn,[(0,t.createVNode)(c,{variant:`outline`,severity:`secondary`,size:`sm`,onClick:(0,t.withModifiers)(te,[`stop`])},{default:(0,t.withCtx)(()=>[...i[27]||=[(0,t.createTextVNode)(`Cancel`,-1)]]),_:1}),(0,t.createVNode)(c,{variant:`solid`,severity:`primary`,size:`sm`,onClick:(0,t.withModifiers)(I,[`stop`])},{default:(0,t.withCtx)(()=>[...i[28]||=[(0,t.createTextVNode)(`Apply`,-1)]]),_:1})]))])])]),_:1},8,[`modelValue`,`disabled`])),Le.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Tr,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(Le.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r,class:`flex items-start gap-1.5 text-[11px] leading-tight font-medium text-danger`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:alert-circle`,class:`h-3.5 w-3.5 shrink-0`}),(0,t.createElementVNode)(`span`,Er,(0,t.toDisplayString)(e),1)]))),128))])):(0,t.createCommentVNode)(``,!0)])],2))}});function Or(e){this.content=e}Or.prototype={constructor:Or,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new Or(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new Or(n)},addToStart:function(e,t){return new Or([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Or(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new Or(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=Or.from(e),e.size?new Or(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=Or.from(e),e.size?new Or(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Or.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},Or.from=function(e){if(e instanceof Or)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Or(t)};function kr(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&Mr(e.charCodeAt(r-1))&&jr(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=kr(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Ar(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&Mr(e.charCodeAt(i-1))&&jr(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=Ar(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function jr(e){return e>=56320&&e<57344}function Mr(e){return e>=55296&&e<56320}var B=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.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 RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return kr(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Ar(this,e,t,n)}findIndex(e){if(e==0)return Pr(0,e);if(e==this.size)return Pr(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?Pr(t+1,i):Pr(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};B.empty=new B([],0);var Nr={index:0,offset:0};function Pr(e,t){return Nr.index=e,Nr.offset=t,Nr}function Fr(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Fr(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Fr(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var V=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||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&&Fr(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 RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};V.none=[];var Ir=class extends Error{},H=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=Rr(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Lr(this.content,t+this.openStart,n+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(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(B.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};H.empty=new H(B.empty,0,0);function Lr(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(Lr(a.content,t-i-1,n-i-1)))}function Rr(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=Rr(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function zr(e,t,n){if(n.openStart>e.depth)throw new Ir(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Ir(`Inconsistent open depths`);return Br(e,t,n,0)}function Br(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=Br(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return Gr(a,qr(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return Gr(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=Jr(n,e);return Gr(a,Kr(e,i,o,t,r))}}function Vr(e,t){if(!t.type.compatibleContent(e.type))throw new Ir(`Cannot join `+t.type.name+` onto `+e.type.name)}function Hr(e,t,n){let r=e.node(n);return Vr(r,t.node(n)),r}function Ur(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Wr(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(Ur(e.nodeAfter,r),a++));for(let e=a;e<o;e++)Ur(i.child(e),r);t&&t.depth==n&&t.textOffset&&Ur(t.nodeBefore,r)}function Gr(e,t){if(!e.type.validContent(t))throw new Ir(`Invalid content for node `+e.type.name);return e.copy(t)}function Kr(e,t,n,r,i){let a=e.depth>i&&Hr(e,t,i+1),o=r.depth>i&&Hr(n,r,i+1),s=[];return Wr(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(Vr(a,o),Ur(Gr(a,Kr(e,t,n,r,i+1)),s)):(a&&Ur(Gr(a,qr(e,t,i+1)),s),Wr(t,n,i,s),o&&Ur(Gr(o,qr(n,r,i+1)),s)),Wr(r,null,i,s),new B(s)}function qr(e,t,n){let r=[];return Wr(null,e,n,r),e.depth>n&&Ur(Gr(Hr(e,t,n+1),qr(e,t,n+1)),r),Wr(t,null,n,r),new B(r)}function Jr(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(B.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Yr=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,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 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 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 n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}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 n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return V.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}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 n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new $r(this,e,n);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(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=Qr.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else Qr.set(t,r=new Xr);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Zr,i}},Xr=class{constructor(){this.elts=[],this.i=0}},Zr=12,Qr=new WeakMap,$r=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}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)}},ei=Object.create(null),ti=class e{constructor(e,t,n,r=V.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||B.empty}get children(){return this.content.content}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,n,r=0){this.content.nodesBetween(e,t,n,r,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,n,r){return this.content.textBetween(e,t,n,r)}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,n){return this.type==e&&Fr(this.attrs,t||e.defaultAttrs||ei)&&V.sameSet(this.marks,n||V.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}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,n=!1){if(e==t)return H.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new H(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return zr(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return Yr.resolveCached(this,e)}resolveNoCache(e){return Yr.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}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()+`)`),ri(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=B.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.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),this.type.checkAttrs(this.attrs);let e=V.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!V.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.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(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=B.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};ti.prototype.text=void 0;var ni=class e extends ti{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):ri(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(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,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 ri(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var ii=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new ai(t,n);if(r.next==null)return e.empty;let i=oi(r);r.next&&r.err(`Unexpected trailing text`);let a=gi(pi(i));return _i(a,r),a}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,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}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 n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return B.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
2
+ `)}};ii.empty=new ii(!0);var ai=class{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 SyntaxError(e+` (in content expression '`+this.string+`')`)}};function oi(e){let t=[];do t.push(si(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function si(e){let t=[];do t.push(ci(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function ci(e){let t=fi(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=ui(e,t);else break;return t}function li(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function ui(e,t){let n=li(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:li(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function di(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function fi(e){if(e.eat(`(`)){let t=oi(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=di(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function pi(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function mi(e,t){return t-e}function hi(e,t){let n=[];return r(t),n.sort(mi);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function gi(e){let t=Object.create(null);return n(hi(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);hi(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new ii(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(mi);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function _i(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function vi(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function yi(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function bi(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}function xi(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new wi(e,r,t[r]);return n}var Si=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=xi(e,n.attrs),this.defaultAttrs=vi(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ii.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}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:yi(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new ti(this,this.computeAttrs(e),B.from(t),V.setFrom(n))}createChecked(e=null,t,n){return t=B.from(t),this.checkContent(t),new ti(this,this.computeAttrs(e),t,V.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=B.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(B.empty,!0);return i?new ti(this,e,t.append(i),V.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){bi(this.attrs,e,`node`,this.name)}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 n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:V.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function Ci(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var wi=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?Ci(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},Ti=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=xi(e,r.attrs),this.excluded=null;let i=vi(this.attrs);this.instance=i?new V(this,i):null}create(e=null){return!e&&this.instance?this.instance:new V(this,yi(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),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]}checkAttrs(e){bi(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},Ei=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=Or.from(e.nodes),t.marks=Or.from(e.marks||{}),this.nodes=Si.compile(this.spec.nodes,this),this.marks=Ti.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=ii.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?Di(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:Di(this,n.split(` `))}this.nodeFromJSON=e=>ti.fromJSON(this,e),this.markFromJSON=e=>V.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof Si))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new ni(n,n.defaultAttrs,e,V.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function Di(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function Oi(e){return e.tag!=null}function ki(e){return e.style!=null}var Ai=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(Oi(e))this.tags.push(e);else if(ki(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new zi(this,t,!1);return n.addAll(e,V.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new zi(this,t,!0);return n.addAll(e,V.none,t.from,t.to),H.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Vi(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Hi(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Hi(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},ji={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},Mi={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ni={ol:!0,ul:!0},Pi=1,Fi=2,Ii=4;function Li(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?Pi:0)|(t===`full`?Fi:0)}var Ri=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=V.none,this.match=i||(a&Ii?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(B.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Pi)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=B.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(B.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ji.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},zi=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=Li(null,t.preserveWhitespace,0)|(n?Ii:0);i=r?new Ri(r.type,r.attrs,V.none,!0,t.topMatch||r.type.contentMatch,a):n?new Ri(null,null,V.none,!0,null,a):new Ri(e.schema.topNodeType,null,V.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&Fi?`full`:this.localPreserveWS||(r.options&Pi)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
3
+ `);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;Ni.hasOwnProperty(a)&&this.parser.normalizeLists&&Bi(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:Mi.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);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 n,r=this.needsBlock;if(ji.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
+ `),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=V.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):Ui(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=Li(e,i,a.options);a.options&Ii&&a.content.length==0&&(o|=Ii);let s=V.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):Ui(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new Ri(e,t,s,r,null,o)),this.open++,n}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;else this.localPreserveWS&&(this.nodes[t].options|=Pi);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].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,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].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(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function Bi(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&Ni.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function Vi(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Hi(e){let t={};for(let n in e)t[n]=e[n];return t}function Ui(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var Wi=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=Ki(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return Ki(t).createTextNode(e.text);let{dom:n,contentDOM:r}=Xi(Ki(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Xi(Ki(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t==`string`?{dom:e.createTextNode(t)}:Xi(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=Gi(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return Gi(e.marks)}};function Gi(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Ki(e){return e.document||window.document}var qi=new WeakMap;function Ji(e){let t=qi.get(e);return t===void 0&&qi.set(e,t=Yi(e)),t}function Yi(e){let t=null;function n(e){if(e&&typeof e==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}function Xi(e,t,n,r){if(t.nodeType==1)return{dom:t};if(t.dom&&t.dom.nodeType==1)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=Ji(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else if(typeof a==`string`)c.appendChild(e.createTextNode(a));else{let{dom:t,contentDOM:i}=Xi(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var Zi=65535,Qi=2**16;function $i(e,t){return e+t*Qi}function ea(e){return e&Zi}function ta(e){return(e-(e&Zi))/Qi}var na=1,ra=2,ia=4,aa=8,oa=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&aa)>0}get deletedBefore(){return(this.delInfo&5)>0}get deletedAfter(){return(this.delInfo&6)>0}get deletedAcross(){return(this.delInfo&ia)>0}},sa=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=ea(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+ta(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:$i(o/3,e-s),f=e==s?ra:e==u?na:ia;return(t<0?e!=s:e!=u)&&(f|=aa),new oa(a,f,d)}r+=l-c}return n?e+r:new oa(e+r,0,null)}touches(e,t){let n=0,r=ea(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};sa.empty=new sa([]);var ca=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r: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.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new oa(e,r,null)}},la=Object.create(null),ua=class{getMap(){return sa.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=la[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in la)throw RangeError(`Duplicate use of step JSON ID `+e);return la[e]=t,t.prototype.jsonID=e,t}},da=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof Ir)return e.fail(t.message);throw t}}};function fa(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(fa(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return B.fromArray(r)}var pa=class e extends ua{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new H(fa(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return da.fromReplace(e,this.from,this.to,i)}invert(){return new ma(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};ua.jsonID(`addMark`,pa);var ma=class e extends ua{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new H(fa(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return da.fromReplace(e,this.from,this.to,n)}invert(){return new pa(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};ua.jsonID(`removeMark`,ma);var ha=class e extends ua{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return da.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return da.fromReplace(e,this.pos,this.pos+1,new H(B.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new ga(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};ua.jsonID(`addNodeMark`,ha);var ga=class e extends ua{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return da.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return da.fromReplace(e,this.pos,this.pos+1,new H(B.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new ha(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};ua.jsonID(`removeNodeMark`,ga);var _a=class e extends ua{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&ya(e,this.from,this.to)?da.fail(`Structure replace would overwrite content`):da.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new sa([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?H.empty:new H(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?H.empty:new H(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,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(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,H.fromJSON(t,n.slice),!!n.structure)}};_a.MAP_BIAS=1,ua.jsonID(`replace`,_a);var va=class e extends ua{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(ya(e,this.from,this.gapFrom)||ya(e,this.gapTo,this.to)))return da.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return da.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?da.fromReplace(e,this.from,this.to,n):da.fail(`Content does not fit in gap`)}getMap(){return new sa([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,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(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(t,n.slice),n.insert,!!n.structure)}};ua.jsonID(`replaceAround`,va);function ya(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function ba(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new ma(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new pa(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function xa(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof Ti){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new ma(t.from,t.to,t.style)))}function Sa(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new _a(s,l,H.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new ma(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new H(B.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new _a(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(B.empty,!0);e.replace(s,s,new H(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function Ca(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function wa(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!Ca(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function Ta(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=B.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=B.from(r.node(e).copy(u)),d++):c--;let f=B.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=B.from(i.node(e).copy(f)),p++):l++;e.step(new va(c,l,o,s,new H(u.append(f),d,p),u.size-d,!0))}function Ea(e,t,n=null,r=e){let i=Oa(e,t),a=i&&ka(r,t);return a?i.map(Da).concat({type:t,attrs:n}).concat(a.map(Da)):null}function Da(e){return{type:e,attrs:null}}function Oa(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function ka(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function Aa(e,t,n){let r=B.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=B.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new va(i,a,i,a,new H(r,0,0),n.length,!0))}function ja(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&Pa(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&Na(e,t,n,a),Sa(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new va(c,l,c+1,l-1,new H(B.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&Ma(e,t,n,a),!1}})}function Ma(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function Na(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
5
+ `))}})}function Pa(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function Fa(e,t,n,r,i){let a=e.doc.nodeAt(t);if(!a)throw RangeError(`No node at given position`);n||=a.type;let o=n.create(r,null,i||a.marks);if(a.isLeaf)return e.replaceWith(t,t+a.nodeSize,o);if(!n.validContent(a.content))throw RangeError(`Invalid content for node type `+n.name);e.step(new va(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new H(B.from(o),0,0),1,!0))}function Ia(e,t,n=1,r){let i=e.resolve(t),a=i.depth-n,o=r&&r[r.length-1]||i.parent;if(a<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 e=i.depth-1,t=n-2;e>a;e--,t--){let n=i.node(e),a=i.index(e);if(n.type.spec.isolating)return!1;let o=n.content.cutByIndex(a,n.childCount),s=r&&r[t+1];s&&(o=o.replaceChild(0,s.type.create(s.attrs)));let c=r&&r[t]||n;if(!n.canReplace(a+1,n.childCount)||!c.type.validContent(o))return!1}let s=i.indexAfter(a),c=r&&r[0];return i.node(a).canReplaceWith(s,s,c?c.type:i.node(a+1).type)}function La(e,t,n=1,r){let i=e.doc.resolve(t),a=B.empty,o=B.empty;for(let e=i.depth,t=i.depth-n,s=n-1;e>t;e--,s--){a=B.from(i.node(e).copy(a));let t=r&&r[s];o=B.from(t?t.type.create(t.attrs,o):i.node(e).copy(o))}e.step(new _a(t,t,new H(a.append(o),n,n),!0))}function Ra(e,t){let n=e.resolve(t),r=n.index();return Ba(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function za(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let a=t.child(i),o=a.type==r?e.type.schema.nodes.text:a.type;if(n=n.matchType(o),!n||!e.type.allowsMarks(a.marks))return!1}return n.validEnd}function Ba(e,t){return!!(e&&t&&!e.isLeaf&&za(e,t))}function Va(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,a,o=r.index(e);if(e==r.depth?(i=r.nodeBefore,a=r.nodeAfter):n>0?(i=r.node(e+1),o++,a=r.node(e).maybeChild(o)):(i=r.node(e).maybeChild(o-1),a=r.node(e+1)),i&&!i.isTextblock&&Ba(i,a)&&r.node(e).canReplace(o,o+1))return t;if(e==0)break;t=n<0?r.before(e):r.after(e)}}function Ha(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,a=e.doc.resolve(t-n),o=a.node().type;if(i&&o.inlineContent){let e=o.whitespace==`pre`,t=!!o.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let s=e.steps.length;if(r===!1){let r=e.doc.resolve(t+n);Na(e,r.node(),r.before(),s)}o.inlineContent&&Sa(e,t+n-1,o,a.node().contentMatchAt(a.index()),r==null);let c=e.mapping.slice(s),l=c.map(t-n);if(e.step(new _a(l,c.map(t+n,-1),H.empty,!0)),r===!0){let t=e.doc.resolve(l);Ma(e,t.node(),t.before(),e.steps.length)}return e}function Ua(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}function Wa(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(n.openStart==0&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,a=r.index(t)+ +(n>0),o=r.node(t),s=!1;if(e==1)s=o.canReplace(a,a,i);else{let e=o.contentMatchAt(a).findWrapping(i.firstChild.type);s=e&&o.canReplaceWith(a,a,e[0])}if(s)return n==0?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function Ga(e,t,n=t,r=H.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),a=e.resolve(n);return Ka(i,a,r)?new _a(t,n,r):new qa(i,a,r).fit()}function Ka(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}var qa=class{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=B.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=B.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,a=n.depth,o=r.depth;for(;a&&o&&i.childCount==1;)i=i.firstChild.content,a--,o--;let s=new H(i,a,o);return e>-1?new va(n.pos,e,this.$to.pos,this.$to.end(),s,t):s.size||n.pos!=this.$to.pos?new _a(n.pos,r.pos,s):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=Xa(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let{type:a,match:o}=this.frontier[e],s,c=null;if(t==1&&(i?o.matchType(i.type)||(c=o.fillBefore(B.from(i),!1)):r&&a.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:c};if(t==2&&i&&(s=o.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:s};if(r&&o.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Xa(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new H(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Xa(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new H(Ja(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new H(Ja(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let a=this.unplaced,o=n?n.content:a.content,s=a.openStart-e,c=0,l=[],{match:u,type:d}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)l.push(r.child(e));u=u.matchFragment(r)}let f=o.size+e-(a.content.size-a.openEnd);for(;c<o.childCount;){let e=o.child(c),t=u.matchType(e.type);if(!t)break;c++,(c>1||s==0||e.content.size)&&(u=t,l.push(Za(e.mark(d.allowedMarks(e.marks)),c==1?s:0,c==o.childCount?f:-1)))}let p=c==o.childCount;p||(f=-1),this.placed=Ya(this.placed,t,B.from(l)),this.frontier[t].match=u,p&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=o;e<f;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=p?e==0?H.empty:new H(Ja(a.content,e-1,1),e-1,f<0?a.openEnd:e-1):new H(Ja(a.content,e,c),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Qa(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:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){scan:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=Qa(e,t,r,n,i);if(a){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=Qa(e,n,r,t,!0);if(!i||i.childCount)continue scan}return{depth:t,fit:a,move:i?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=Ya(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Ya(this.placed,this.depth,B.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(B.empty,!0);e.childCount&&(this.placed=Ya(this.placed,this.frontier.length,e))}};function Ja(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Ja(e.firstChild.content,t-1,n)))}function Ya(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Ya(e.lastChild.content,t-1,n)))}function Xa(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function Za(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,Za(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(B.empty,!0)))),e.copy(r)}function Qa(e,t,n,r,i){let a=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==a.childCount&&!n.compatibleContent(a.type))return null;let s=r.fillBefore(a.content,!0,o);return s&&!$a(n,a.content,o)?s:null}function $a(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function eo(e){return e.spec.defining||e.spec.definingForContent}function to(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),a=e.doc.resolve(n);if(Ka(i,a,r))return e.step(new _a(t,n,r));let o=ao(i,a);o[o.length-1]==0&&o.pop();let s=-(i.depth+1);o.unshift(s);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;o.indexOf(e)>-1?s=e:i.before(e)==t&&o.splice(1,0,-e)}let c=o.indexOf(s),l=[],u=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(l.push(n),t==r.openStart)break;e=n.content}for(let e=u-1;e>=0;e--){let t=l[e],n=eo(t.type);if(n&&!t.sameMarkup(i.node(Math.abs(s)-1)))u=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let s=(t+u+1)%(r.openStart+1),d=l[s];if(d)for(let t=0;t<o.length;t++){let l=o[(t+c)%o.length],u=!0;l<0&&(u=!1,l=-l);let f=i.node(l-1),p=i.index(l-1);if(f.canReplaceWith(p,p,d.type,d.marks))return e.replace(i.before(l),u?a.after(l):n,new H(no(r.content,0,r.openStart,s),s,r.openEnd))}}let d=e.steps.length;for(let s=o.length-1;s>=0&&(e.replace(t,n,r),!(e.steps.length>d));s--){let e=o[s];e<0||(t=i.before(e),n=a.after(e))}}function no(e,t,n,r,i){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(no(i.content,t+1,n,r,i)))}if(t>r){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(B.empty,!0))}return e}function ro(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=Ua(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new H(B.from(r),0,0))}function io(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let a=r.sharedDepth(n),o=!1;for(let e=r.depth;e>a;e--)r.node(e).type.spec.isolating&&(o=!0);for(let e=i.depth;e>a;e--)i.node(e).type.spec.isolating&&(o=!0);if(!o){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=i.depth;e>0&&n==i.start(e);e--)n=i.before(e);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let a=ao(r,i);for(let t=0;t<a.length;t++){let n=a[t],o=t==a.length-1;if(o&&n==0||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(o||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(t-r.start(a)==r.depth-a&&n>r.end(a)&&i.end(a)-n!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return e.delete(r.before(a),n);e.delete(t,n)}function ao(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}var oo=class e extends ua{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return da.fail(`No node at attribute step's position`);let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return da.fromReplace(e,this.pos,this.pos+1,new H(B.from(r),0,+!t.isLeaf))}getMap(){return sa.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:`attr`,pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!=`number`||typeof n.attr!=`string`)throw RangeError(`Invalid input for AttrStep.fromJSON`);return new e(n.pos,n.attr,n.value)}};ua.jsonID(`attr`,oo);var so=class e extends ua{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return da.ok(n)}getMap(){return sa.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new e(n.attr,n.value)}};ua.jsonID(`docAttr`,so);var co=class extends Error{};co=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},co.prototype=Object.create(Error.prototype),co.prototype.constructor=co,co.prototype.name=`TransformError`;var lo=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ca}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new co(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}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,i,a)=>{e=Math.min(e,i),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=H.empty){let r=Ga(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new H(B.from(n),0,0))}delete(e,t){return this.replace(e,t,H.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return to(this,e,t,n),this}replaceRangeWith(e,t,n){return ro(this,e,t,n),this}deleteRange(e,t){return io(this,e,t),this}lift(e,t){return Ta(this,e,t),this}join(e,t=1){return Ha(this,e,t),this}wrap(e,t){return Aa(this,e,t),this}setBlockType(e,t=e,n,r=null){return ja(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return Fa(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new oo(e,t,n)),this}setDocAttribute(e,t){return this.step(new so(e,t)),this}addNodeMark(e,t){return this.step(new ha(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError(`No node at position `+e);if(t instanceof V)t.isInSet(n.marks)&&this.step(new ga(e,t));else{let r=n.marks,i,a=[];for(;i=t.isInSet(r);)a.push(new ga(e,i)),r=i.removeFromSet(r);for(let e=a.length-1;e>=0;e--)this.step(a[e])}return this}split(e,t=1,n){return La(this,e,t,n),this}addMark(e,t,n){return ba(this,e,t,n),this}removeMark(e,t,n){return xa(this,e,t,n),this}clearIncompatible(e,t,n){return Sa(this,e,t,n),this}},uo=Object.create(null),U=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new fo(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=H.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,a=this.ranges;for(let o=0;o<a.length;o++){let{$from:s,$to:c}=a[o],l=e.mapping.slice(i);e.replaceRange(l.map(s.pos),l.map(c.pos),o?H.empty:t),o==0&&bo(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n),c=s.map(a.pos),l=s.map(o.pos);i?e.deleteRange(c,l):(e.replaceRangeWith(c,l,t),bo(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new W(e):yo(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?yo(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):yo(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new _o(e.node(0))}static atStart(e){return yo(e,e,0,0,1)||new _o(e)}static atEnd(e){return yo(e,e,e.content.size,e.childCount,-1)||new _o(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=uo[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in uo)throw RangeError(`Duplicate use of selection JSON ID `+e);return uo[e]=t,t.prototype.jsonID=e,t}getBookmark(){return W.between(this.$anchor,this.$head).getBookmark()}};U.prototype.visible=!0;var fo=class{constructor(e,t){this.$from=e,this.$to=t}},po=!1;function mo(e){!po&&!e.parent.inlineContent&&(po=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var W=class e extends U{constructor(e,t=e){mo(e),mo(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return U.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=H.empty){if(super.replace(e,t),t==H.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new ho(this.anchor,this.head)}toJSON(){return{type:`text`,anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!=`number`||typeof n.head!=`number`)throw RangeError(`Invalid input for TextSelection.fromJSON`);return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let e=U.findFrom(n,r,!0)||U.findFrom(n,-r,!0);if(e)n=e.$head;else return U.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(U.findFrom(t,-r,!0)||U.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};U.jsonID(`text`,W);var ho=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return W.between(e.resolve(this.anchor),e.resolve(this.head))}},G=class e extends U{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),a=t.resolve(i);return r?U.near(a):new e(a)}content(){return new H(B.from(this.node),0,0)}eq(t){return t instanceof e&&t.anchor==this.anchor}toJSON(){return{type:`node`,anchor:this.anchor}}getBookmark(){return new go(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!=`number`)throw RangeError(`Invalid input for NodeSelection.fromJSON`);return new e(t.resolve(n.anchor))}static create(t,n){return new e(t.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};G.prototype.visible=!1,U.jsonID(`node`,G);var go=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new ho(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&G.isSelectable(n)?new G(t):U.near(t)}},_o=class e extends U{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=H.empty){if(t==H.empty){e.delete(0,e.doc.content.size);let t=U.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:`all`}}static fromJSON(t){return new e(t)}map(t){return new e(t)}eq(t){return t instanceof e}getBookmark(){return vo}};U.jsonID(`all`,_o);var vo={map(){return this},resolve(e){return new _o(e)}};function yo(e,t,n,r,i,a=!1){if(t.inlineContent)return W.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(!r.isAtom){let t=yo(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&G.isSelectable(r))return G.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function bo(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof _a||i instanceof va))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(U.near(e.doc.resolve(o),n))}var xo=1,So=2,Co=4,wo=class extends lo{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 RangeError(`Selection passed to setSelection must point at the current document`);return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|xo)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&xo)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=So,this}ensureMarks(e){return V.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&So)>0}addStep(e,t){super.addStep(e,t),this.updated&=-3,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||V.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(n??=t,!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(U.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|=Co,this}get scrolledIntoView(){return(this.updated&Co)>0}};function To(e,t){return!t||!e?e:e.bind(t)}var Eo=class{constructor(e,t,n){this.name=e,this.init=To(t.init,n),this.apply=To(t.apply,n)}},Do=[new Eo(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new Eo(`selection`,{init(e,t){return e.selection||U.atStart(t.doc)},apply(e){return e.selection}}),new Eo(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new Eo(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],Oo=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Do.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError(`Adding different instances of a keyed plugin (`+e.key+`)`);this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new Eo(e.key,e.spec.state,e))})}},ko=class e{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 n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let a=0;a<this.config.plugins.length;a++){let o=this.config.plugins[a];if(o.spec.appendTransaction){let s=r?r[a].n:0,c=r?r[a].state:this,l=s<t.length&&o.spec.appendTransaction.call(o,s?t.slice(s):t,c,n);if(l&&n.filterTransaction(l,a)){if(l.setMeta(`appendedTransaction`,e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<a?{state:n,n:t.length}:{state:this,n:0})}t.push(l),n=n.applyInner(l),i=!0}r&&(r[a]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(t){if(!t.before.eq(this.doc))throw RangeError(`Applying a mismatched transaction`);let n=new e(this.config),r=this.config.fields;for(let e=0;e<r.length;e++){let i=r[e];n[i.name]=i.apply(t,this[i.name],this,n)}return n}get tr(){return new wo(this)}static create(t){let n=new Oo(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new e(n);for(let e=0;e<n.fields.length;e++)r[n.fields[e].name]=n.fields[e].init(t,r);return r}reconfigure(t){let n=new Oo(this.schema,t.plugins),r=n.fields,i=new e(n);for(let e=0;e<r.length;e++){let n=r[e].name;i[n]=this.hasOwnProperty(n)?this[n]:r[e].init(t,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&typeof e==`object`)for(let n in e){if(n==`doc`||n==`selection`)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(t,n,r){if(!n)throw RangeError(`Invalid input for EditorState.fromJSON`);if(!t.schema)throw RangeError(`Required config field 'schema' missing`);let i=new Oo(t.schema,t.plugins),a=new e(i);return i.fields.forEach(e=>{if(e.name==`doc`)a.doc=ti.fromJSON(t.schema,n.doc);else if(e.name==`selection`)a.selection=U.fromJSON(a.doc,n.selection);else if(e.name==`storedMarks`)n.storedMarks&&(a.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let i in r){let o=r[i],s=o.spec.state;if(o.key==e.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){a[e.name]=s.fromJSON.call(o,t,n[i],a);return}}a[e.name]=e.init(t,a)}}),a}};function Ao(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r==`handleDOMEvents`&&(i=Ao(i,t,{})),n[r]=i}return n}var K=class{constructor(e){this.spec=e,this.props={},e.props&&Ao(e.props,this,this.props),this.key=e.key?e.key.key:Mo(`plugin`)}getState(e){return e[this.key]}},jo=Object.create(null);function Mo(e){return e in jo?e+`$`+ ++jo[e]:(jo[e]=0,e+`$`)}var q=class{constructor(e=`key`){this.key=Mo(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}},No=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Po(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`backward`,e):n.parentOffset>0)?null:n}var Fo=(e,t,n)=>{let r=Po(e,n);if(!r)return!1;let i=Vo(r);if(!i){let n=r.blockRange(),i=n&&wa(n);return i==null?!1:(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let a=i.nodeBefore;if(as(e,i,t,-1))return!0;if(r.parent.content.size==0&&(zo(a,`end`)||G.isSelectable(a)))for(let n=r.depth;;n--){let o=Ga(e.doc,r.before(n),r.after(n),H.empty);if(o&&o.slice.size<o.to-o.from){if(t){let n=e.tr.step(o);n.setSelection(zo(a,`end`)?U.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):G.create(n.doc,i.pos-a.nodeSize)),t(n.scrollIntoView())}return!0}if(n==1||r.node(n-1).childCount>1)break}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},Io=(e,t,n)=>{let r=Po(e,n);if(!r)return!1;let i=Vo(r);return i?Ro(e,i,t):!1},Lo=(e,t,n)=>{let r=Ho(e,n);if(!r)return!1;let i=Go(r);return i?Ro(e,i,t):!1};function Ro(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let a=t.nodeAfter,o=t.pos+1;for(;!a.isTextblock;o++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let s=Ga(e.doc,i,o,H.empty);if(!s||s.from!=i||s instanceof _a&&s.slice.size>=o-i)return!1;if(n){let t=e.tr.step(s);t.setSelection(W.create(t.doc,i)),n(t.scrollIntoView())}return!0}function zo(e,t,n=!1){for(let r=e;r;r=t==`start`?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var Bo=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`backward`,e):r.parentOffset>0)return!1;a=Vo(r)}let o=a&&a.nodeBefore;return!o||!G.isSelectable(o)?!1:(t&&t(e.tr.setSelection(G.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function Vo(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function Ho(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`forward`,e):n.parentOffset<n.parent.content.size)?null:n}var Uo=(e,t,n)=>{let r=Ho(e,n);if(!r)return!1;let i=Go(r);if(!i)return!1;let a=i.nodeAfter;if(as(e,i,t,1))return!0;if(r.parent.content.size==0&&(zo(a,`start`)||G.isSelectable(a))){let n=Ga(e.doc,r.before(),r.after(),H.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(zo(a,`start`)?U.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):G.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),!0):!1},Wo=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`forward`,e):r.parentOffset<r.parent.content.size)return!1;a=Go(r)}let o=a&&a.nodeAfter;return!o||!G.isSelectable(o)?!1:(t&&t(e.tr.setSelection(G.create(e.doc,a.pos)).scrollIntoView()),!0)};function Go(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}var Ko=(e,t)=>{let n=e.selection,r=n instanceof G,i;if(r){if(n.node.isTextblock||!Ra(e.doc,n.from))return!1;i=n.from}else if(i=Va(e.doc,n.from,-1),i==null)return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(G.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0},qo=(e,t)=>{let n=e.selection,r;if(n instanceof G){if(n.node.isTextblock||!Ra(e.doc,n.to))return!1;r=n.to}else if(r=Va(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},Jo=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),a=i&&wa(i);return a==null?!1:(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)},Yo=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
6
+ `).scrollIntoView()),!0)};function Xo(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var Zo=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),a=n.indexAfter(-1),o=Xo(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,o.createAndFill());i.setSelection(U.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},Qo=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof _o||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=Xo(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,o=e.tr.insert(n,a.createAndFill());o.setSelection(W.create(o.doc,n+1)),t(o.scrollIntoView())}return!0},$o=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(Ia(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&wa(r);return i==null?!1:(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function es(e){return(t,n)=>{let{$from:r,$to:i}=t.selection;if(t.selection instanceof G&&t.selection.node.isBlock)return!r.parentOffset||!Ia(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let a=[],o,s,c=!1,l=!1;for(let t=r.depth;;t--)if(r.node(t).isBlock){c=r.end(t)==r.pos+(r.depth-t),l=r.start(t)==r.pos-(r.depth-t),s=Xo(r.node(t-1).contentMatchAt(r.indexAfter(t-1)));let n=e&&e(i.parent,c,r);a.unshift(n||(c&&s?{type:s}:null)),o=t;break}else{if(t==1)return!1;a.unshift(null)}let u=t.tr;(t.selection instanceof W||t.selection instanceof _o)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Ia(u.doc,d,a.length,a);if(f||=(a[0]=s?{type:s}:null,Ia(u.doc,d,a.length,a)),!f)return!1;if(u.split(d,a.length,a),!c&&l&&r.node(o).type!=s){let e=u.mapping.map(r.before(o)),t=u.doc.resolve(e);s&&r.node(o-1).canReplaceWith(t.index(),t.index()+1,s)&&u.setNodeMarkup(u.mapping.map(r.before(o)),s)}return n&&n(u.scrollIntoView()),!0}}var ts=es(),ns=(e,t)=>{let{$from:n,to:r}=e.selection,i,a=n.sharedDepth(r);return a==0?!1:(i=n.before(a),t&&t(e.tr.setSelection(G.create(e.doc,i))),!0)},rs=(e,t)=>(t&&t(e.tr.setSelection(new _o(e.doc))),!0);function is(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,a=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(a,a+1)||!(i.isTextblock||Ra(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function as(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,c=i.type.spec.isolating||a.type.spec.isolating;if(!c&&is(e,t,n))return!0;let l=!c&&t.parent.canReplace(t.index(),t.index()+1);if(l&&(o=(s=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&s.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,s=B.empty;for(let e=o.length-1;e>=0;e--)s=B.from(o[e].create(null,s));s=B.from(i.copy(s));let c=e.tr.step(new va(t.pos-1,r,t.pos,r,new H(s,1,0),o.length,!0)),l=c.doc.resolve(r+2*o.length);l.nodeAfter&&l.nodeAfter.type==i.type&&Ra(c.doc,l.pos)&&c.join(l.pos),n(c.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&c?null:U.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&wa(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(l&&zo(a,`start`,!0)&&zo(i,`end`)){let r=i,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let s=a,c=1;for(;!s.isTextblock;s=s.firstChild)c++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=B.empty;for(let e=o.length-1;e>=0;e--)r=B.from(o[e].copy(r));n(e.tr.step(new va(t.pos-o.length,t.pos+a.nodeSize,t.pos+c,t.pos+a.nodeSize-c,new H(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function ss(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(n&&n(t.tr.setSelection(W.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var cs=ss(-1),ls=ss(1);function us(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),s=o&&Ea(o,e,t);return s?(r&&r(n.tr.wrap(o,s).scrollIntoView()),!0):!1}}function ds(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];n.doc.nodesBetween(a,o,(r,a)=>{if(i)return!1;if(!(!r.isTextblock||r.hasMarkup(e,t)))if(r.type==e)i=!0;else{let t=n.doc.resolve(a),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];i.setBlockType(a,o,e,t)}r(i.scrollIntoView())}return!0}}function fs(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}var ps=fs(No,Fo,Bo),ms=fs(No,Uo,Wo),hs={Enter:fs(Yo,Qo,$o,ts),"Mod-Enter":Zo,Backspace:ps,"Mod-Backspace":ps,"Shift-Backspace":ps,Delete:ms,"Mod-Delete":ms,"Mod-a":rs},gs={"Ctrl-h":hs.Backspace,"Alt-Backspace":hs[`Mod-Backspace`],"Ctrl-d":hs.Delete,"Ctrl-Alt-Backspace":hs[`Mod-Delete`],"Alt-Delete":hs[`Mod-Delete`],"Alt-d":hs[`Mod-Delete`],"Ctrl-a":cs,"Ctrl-e":ls};for(let e in hs)gs[e]=hs[e];typeof navigator<`u`?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<`u`&&os.platform&&os.platform();function _s(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a);if(!o)return!1;let s=r?n.tr:null;return vs(s,o,e,t)?(r&&r(s.scrollIntoView()),!0):!1}}function vs(e,t,n,r=null){let i=!1,a=t,o=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let e=o.resolve(t.start-2);a=new $r(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new $r(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let s=Ea(a,n,r,t);return s?(e&&ys(e,t,s,i,n),!0):!1}function ys(e,t,n,r,i){let a=B.empty;for(let e=n.length-1;e>=0;e--)a=B.from(n[e].type.create(n[e].attrs,a));e.step(new va(t.start-(r?2:0),t.end,t.start,t.end,new H(a,0,0),n.length,!0));let o=0;for(let e=0;e<n.length;e++)n[e].type==i&&(o=e+1);let s=n.length-o,c=t.start+n.length-(r?2:0),l=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&Ia(e.doc,c,s)&&(e.split(c,s),c+=2*s),c+=l.child(n).nodeSize;return e}function bs(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?xs(t,n,e,a):Ss(t,n,a):!0:!1}}function xs(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new va(a-1,o,a,o,new H(B.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new $r(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let s=wa(r);if(s==null)return!1;i.lift(r,s);let c=i.doc.resolve(i.mapping.map(a,-1)-1);return Ra(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),t(i.scrollIntoView()),!0}function Ss(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,a=n.startIndex;t>a;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,c=n.endIndex==i.childCount,l=a.node(-1),u=a.index(-1);if(!l.canReplace(u+ +!s,u+1,o.content.append(c?B.empty:B.from(i))))return!1;let d=a.pos,f=d+o.nodeSize;return r.step(new va(d-+!!s,f+ +!!c,d+1,f-1,new H((s?B.empty:B.from(i.copy(B.empty))).append(c?B.empty:B.from(i.copy(B.empty))),+!s,+!c),+!s)),t(r.scrollIntoView()),!0}function Cs(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,c=s.child(o-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==s.type,i=B.from(r?e.create():null),o=new H(B.from(e.create(null,B.from(s.type.create(null,i)))),r?3:1,0),l=a.start,u=a.end;n(t.tr.step(new va(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}var ws=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Ts=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},Es=null,Ds=function(e,t,n){let r=Es||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},Os=function(){Es=null},ks=function(e,t,n,r){return n&&(js(e,t,n,r,-1)||js(e,t,n,r,1))},As=/^(img|br|input|textarea|hr)$/i;function js(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Ms(e))){let n=e.parentNode;if(!n||n.nodeType!=1||Is(e)||As.test(e.nodeName)||e.contentEditable==`false`)return!1;t=ws(e)+(i<0?0:1),e=n}else if(e.nodeType==1){let n=e.childNodes[t+(i<0?-1:0)];if(n.nodeType==1&&n.contentEditable==`false`)if(n.pmViewDesc?.ignoreForSelection)t+=i;else return!1;else e=n,t=i<0?Ms(e):0}else return!1}}function Ms(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Ns(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable==`false`)return null;e=e.childNodes[t-1],t=Ms(e)}else if(e.parentNode&&!Is(e))t=ws(e),e=e.parentNode;else return null}}function Ps(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable==`false`)return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!Is(e))t=ws(e)+1,e=e.parentNode;else return null}}function Fs(e,t,n){for(let r=t==0,i=t==Ms(e);r||i;){if(e==n)return!0;let t=ws(e);if(e=e.parentNode,!e)return!1;r&&=t==0,i&&=t==Ms(e)}}function Is(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var Ls=function(e){return e.focusNode&&ks(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Rs(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function zs(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function Bs(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Ms(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Ms(r.startContainer),r.startOffset)}}}var Vs=typeof navigator<`u`?navigator:null,Hs=typeof document<`u`?document:null,Us=Vs&&Vs.userAgent||``,Ws=/Edge\/(\d+)/.exec(Us),Gs=/MSIE \d/.exec(Us),Ks=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Us),qs=!!(Gs||Ks||Ws),Js=Gs?document.documentMode:Ks?+Ks[1]:Ws?+Ws[1]:0,Ys=!qs&&/gecko\/(\d+)/i.test(Us);Ys&&+(/Firefox\/(\d+)/.exec(Us)||[0,0])[1];var Xs=!qs&&/Chrome\/(\d+)/.exec(Us),Zs=!!Xs,Qs=Xs?+Xs[1]:0,$s=!qs&&!!Vs&&/Apple Computer/.test(Vs.vendor),ec=$s&&(/Mobile\/\w+/.test(Us)||!!Vs&&Vs.maxTouchPoints>2),tc=ec||(Vs?/Mac/.test(Vs.platform):!1),nc=Vs?/Win/.test(Vs.platform):!1,rc=/Android \d/.test(Us),ic=!!Hs&&`webkitFontSmoothing`in Hs.documentElement.style,ac=ic?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function oc(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function sc(e,t){return typeof e==`number`?e:e[t]}function cc(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function lc(e,t,n){let r=e.someProp(`scrollThreshold`)||0,i=e.someProp(`scrollMargin`)||5,a=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(o.nodeType!=1){o=Ts(o);continue}let e=o,n=e==a.body,s=n?oc(a):cc(e),c=0,l=0;if(t.top<s.top+sc(r,`top`)?l=-(s.top-t.top+sc(i,`top`)):t.bottom>s.bottom-sc(r,`bottom`)&&(l=t.bottom-t.top>s.bottom-s.top?t.top+sc(i,`top`)-s.top:t.bottom-s.bottom+sc(i,`bottom`)),t.left<s.left+sc(r,`left`)?c=-(s.left-t.left+sc(i,`left`)):t.right>s.right-sc(r,`right`)&&(c=t.right-s.right+sc(i,`right`)),c||l)if(n)a.defaultView.scrollBy(c,l);else{let n=e.scrollLeft,r=e.scrollTop;l&&(e.scrollTop+=l),c&&(e.scrollLeft+=c);let i=e.scrollLeft-n,a=e.scrollTop-r;t={left:t.left-i,top:t.top-a,right:t.right-i,bottom:t.bottom-a}}let u=n?`fixed`:getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(u))break;o=u==`absolute`?o.offsetParent:Ts(o)}}function uc(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let a=(t.left+t.right)/2,o=n+1;o<Math.min(innerHeight,t.bottom);o+=5){let t=e.root.elementFromPoint(a,o);if(!t||t==e.dom||!e.dom.contains(t))continue;let s=t.getBoundingClientRect();if(s.top>=n-20){r=t,i=s.top;break}}return{refDOM:r,refTop:i,stack:dc(e.dom)}}function dc(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Ts(r));return t}function fc({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;pc(n,r==0?0:r-t)}function pc(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:a}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=a&&(r.scrollLeft=a)}}var mc=null;function hc(e){if(e.setActive)return e.setActive();if(mc)return e.focus(mc);let t=dc(e);e.focus(mc==null?{get preventScroll(){return mc={preventScroll:!0},!0}}:void 0),mc||(mc=!1,pc(t,0))}function gc(e,t){let n,r=2e8,i,a=0,o=t.top,s=t.top,c,l;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let e;if(u.nodeType==1)e=u.getClientRects();else if(u.nodeType==3)e=Ds(u).getClientRects();else continue;for(let f=0;f<e.length;f++){let p=e[f];if(p.top<=o&&p.bottom>=s){o=Math.max(p.bottom,o),s=Math.min(p.top,s);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<r){n=u,r=e,i=e&&n.nodeType==3?{left:p.right<t.left?p.right:p.left,top:t.top}:t,u.nodeType==1&&e&&(a=d+ +(t.left>=(p.left+p.right)/2));continue}}else p.top>t.top&&!c&&p.left<=t.left&&p.right>=t.left&&(c=u,l={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&c&&(n=c,i=l,r=0),n&&n.nodeType==3?_c(n,i):!n||r&&n.nodeType==1?{node:e,offset:a}:gc(n,i)}function _c(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let a=0;a<n;a++){r.setEnd(e,a+1),r.setStart(e,a);let n=Tc(r,1);if(n.top!=n.bottom&&vc(t,n)){i={node:e,offset:a+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}function vc(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function yc(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function bc(e,t,n){let{node:r,offset:i}=gc(t,n),a=-1;if(r.nodeType==1&&!r.firstChild){let e=r.getBoundingClientRect();a=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,a)}function xc(e,t,n,r){let i=-1;for(let n=t,a=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),o;if(!t)return null;if(t.dom.nodeType==1&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!a&&o.left>r.left||o.top>r.top?i=t.posBefore:(!a&&o.right<r.left||o.bottom<r.top)&&(i=t.posAfter),a=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(o.top+o.bottom)/2:r.left<(o.left+o.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}function Sc(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),a=i;;){let n=e.childNodes[a];if(n.nodeType==1){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(vc(t,i))return Sc(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function Cc(e,t){let n=e.dom.ownerDocument,r,i=0,a=Bs(n,t.left,t.top);a&&({node:r,offset:i}=a);let o=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),s;if(!o||!e.dom.contains(o.nodeType==1?o:o.parentNode)){let n=e.dom.getBoundingClientRect();if(!vc(t,n)||(o=Sc(e.dom,t,n),!o))return null}if($s)for(let e=o;r&&e;e=Ts(e))e.draggable&&(r=void 0);if(o=yc(o,t),r){if(Ys&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let e=r.childNodes[i],n;e.nodeName==`IMG`&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&i++}let n;ic&&i&&r.nodeType==1&&(n=r.childNodes[i-1]).nodeType==1&&n.contentEditable==`false`&&n.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!=`BR`)&&(s=xc(e,r,i,t))}s??=bc(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function wc(e){return e.top<e.bottom||e.left<e.right}function Tc(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(wc(e))return e}return Array.prototype.find.call(n,wc)||e.getBoundingClientRect()}var Ec=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Dc(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=ic||Ys;if(r.nodeType==3)if(o&&(Ec.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=Tc(Ds(r,i,i),n);if(Ys&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=Tc(Ds(r,i-1,i-1),-1);if(t.top==e.top){let n=Tc(Ds(r,i,i+1),-1);if(n.top!=e.top)return Oc(n,n.left<t.left)}}return e}else{let e=i,t=i,a=n<0?1:-1;return n<0&&!i?(t++,a=-1):n>=0&&i==r.nodeValue.length?(e--,a=1):n<0?e--:t++,Oc(Tc(Ds(r,e,t),a),a<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==Ms(r))){let e=r.childNodes[i-1];if(e.nodeType==1)return kc(e.getBoundingClientRect(),!1)}if(a==null&&i<Ms(r)){let e=r.childNodes[i];if(e.nodeType==1)return kc(e.getBoundingClientRect(),!0)}return kc(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==Ms(r))){let e=r.childNodes[i-1],t=e.nodeType==3?Ds(e,Ms(e)-+!o):e.nodeType==1&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return Oc(Tc(t,1),!1)}if(a==null&&i<Ms(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?e.nodeType==3?Ds(e,0,+!o):e.nodeType==1?e:null:null;if(t)return Oc(Tc(t,-1),!0)}return Oc(Tc(r.nodeType==3?Ds(r):r,-n),n>=0)}function Oc(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function kc(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Ac(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function jc(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return Ac(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,n==`up`?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=Dc(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(e.nodeType==1)t=e.getClientRects();else if(e.nodeType==3)t=Ds(e,0,e.nodeValue.length).getClientRects();else continue;for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&(n==`up`?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})}var Mc=/[\u0590-\u08ac]/;function Nc(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!Mc.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:Ac(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:a,anchorOffset:o}=e.domSelectionRange(),c=s.caretBidiLevel;s.modify(`move`,n,`character`);let l=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),f=u&&!l.contains(u.nodeType==1?u:u.parentNode)||t==u&&i==d;try{s.collapse(a,o),t&&(t!=a||i!=o)&&s.extend&&s.extend(t,i)}catch{}return c!=null&&(s.caretBidiLevel=c),f}):r.pos==r.start()||r.pos==r.end()}var Pc=null,Fc=null,Ic=!1;function Lc(e,t,n){return Pc==t&&Fc==n?Ic:(Pc=t,Fc=n,Ic=n==`up`||n==`down`?jc(e,t,n):Nc(e,t,n))}var Rc=0,zc=1,Bc=2,Vc=3,Hc=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=Rc,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){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,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.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,n){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}else{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=t>ws(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return r??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),a;if(i&&(!t||i.node))if(n&&(a=i.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))n=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],a=t+i.size;if(a>e||i instanceof Yc){r=e-t;break}t=a}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof Uc&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,!(!e||e.dom.parentNode==this.contentDOM);n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?ws(e.dom)+1:0}}else{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,!(!e||e.dom.parentNode==this.contentDOM);n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?ws(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let a=n,o=0;;o++){let n=this.children[o],s=a+n.size;if(r==-1&&e<=s){let i=a+n.border;if(e>=i&&t<=s-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=a;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=ws(n.dom)+1;break}e-=n.size}r==-1&&(r=0)}if(r>-1&&(s>t||o==this.children.length-1)){t=s;for(let e=o+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=ws(n.dom);break}t+=n.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=s}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}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:n}=this.domFromPos(e,0);if(t.nodeType!=1||n==t.childNodes.length)throw RangeError(`No node after pos `+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),a=Math.max(e,t);for(let o=0,s=0;o<this.children.length;o++){let c=this.children[o],l=s+c.size;if(i>s&&a<l)return c.setSelection(e-s-c.border,t-s-c.border,n,r);s=l}let o=this.domFromPos(e,e?-1:1),s=t==e?o:this.domFromPos(t,t?-1:1),c=n.root.getSelection(),l=n.domSelectionRange(),u=!1;if((Ys||$s)&&e==t){let{node:e,offset:t}=o;if(e.nodeType==3){if(u=!!(t&&e.nodeValue[t-1]==`
7
+ `),u&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){n.nodeName==`BR`&&(o=s={node:n.parentNode,offset:ws(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];u=n&&(n.nodeName==`BR`||n.contentEditable==`false`)}}if(Ys&&l.focusNode&&l.focusNode!=s.node&&l.focusNode.nodeType==1){let e=l.focusNode.childNodes[l.focusOffset];e&&e.contentEditable==`false`&&(r=!0)}if(!(r||u&&$s)&&ks(o.node,o.offset,l.anchorNode,l.anchorOffset)&&ks(s.node,s.offset,l.focusNode,l.focusOffset))return;let d=!1;if((c.extend||e==t)&&!(u&&Ys)){c.collapse(o.node,o.offset);try{e!=t&&c.extend(s.node,s.offset),d=!0}catch{}}if(!d){if(e>t){let e=o;o=s,s=e}let n=document.createRange();n.setEnd(s.node,s.offset),n.setStart(o.node,o.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&e.type!=`selection`}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],a=n+i.size;if(n==a?e<=a&&t>=n:e<a&&t>n){let r=n+i.border,o=a-i.border;if(e>=r&&t<=o){this.dirty=e==n||t==a?Bc:zc,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Vc:i.markDirty(e-r,t-r);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Bc:Vc}n=a}this.dirty=Bc}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?Bc:zc;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},Uc=class extends Hc{constructor(e,t,n,r){let i,a=t.type.toDOM;if(typeof a==`function`&&(a=a(n,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(a.nodeType!=1){let e=document.createElement(`span`);e.appendChild(a),a=e}a.contentEditable=`false`,a.classList.add(`ProseMirror-widget`)}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==Rc&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!=`selection`||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},Wc=class extends Hc{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e==this.textDOM?this.posAtStart+t:this.posAtStart+(t?this.size:0)}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type===`characterData`&&e.target.nodeValue==e.oldValue}},Gc=class e extends Hc{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(t,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return(!o||!o.dom)&&(o=Wi.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new e(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Vc||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Vc&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Rc){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=Rc}}slice(t,n,r){let i=e.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;n<o&&(a=fl(a,n,o,r)),t>0&&(a=fl(a,0,t,r));for(let e=0;e<a.length;e++)a[e].parent=i;return i.children=a,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},Kc=class e extends Hc{constructor(e,t,n,r,i,a,o,s,c){super(e,[],i,a),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}static create(t,n,r,i,a,o){let s=a.nodeViews[n.type.name],c,l=s&&s(n,a,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw RangeError(`Text must be rendered as a DOM text node`)}else if(!u){let e=Wi.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs);({dom:u,contentDOM:d}=e)}!d&&!n.isText&&u.nodeName!=`BR`&&(u.hasAttribute(`contenteditable`)||(u.contentEditable=`false`),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=rl(u,r,n),l?c=new Xc(t,n,r,i,u,d||null,f,l,a,o+1):n.isText?new Jc(t,n,r,i,u,f,a):new e(t,n,r,i,u,d||null,f,a,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace==`pre`&&(e.preserveWhitespace=`full`),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>B.empty)}return e}matchesNode(e,t,n){return this.dirty==Rc&&e.eq(this.node)&&il(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new ol(this,a&&a.node,e);ll(this.node,this.innerDeco,(t,i,a)=>{t.spec.marks?s.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!a&&s.syncToMarks(i==this.node.childCount?V.none:this.node.child(i).marks,n,e,i),s.placeWidget(t,e,r)},(t,a,c,l)=>{s.syncToMarks(t.marks,n,e,l);let u;s.findNodeMatch(t,a,c,l)||o&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(u=s.findIndexWithChild(i.node))>-1&&s.updateNodeAt(t,a,c,u,e)||s.updateNextNode(t,a,c,e,l,r)||s.addNode(t,a,c,e,r),r+=t.nodeSize}),s.syncToMarks([],n,e,0),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||this.dirty==Bc)&&(a&&this.protectLocalComposition(e,a),Zc(this.contentDOM,this.children,e),ec&&ul(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof W)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,a=dl(this.node.content,e,n-t,r-t);return a<0?null:{node:i,pos:a,text:e}}else return{node:i,pos:-1,text:``}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&=void 0}let a=new Wc(this,i,t,r);e.input.compositionNodes.push(a),this.children=fl(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==Vc||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=Rc}updateOuterDeco(e){if(il(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=tl(this.dom,this.nodeDOM,el(this.outerDeco,this.node,t),el(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute(`draggable`))}get domAtom(){return this.node.isAtom}};function qc(e,t,n,r,i){rl(r,t,e);let a=new Kc(void 0,e,t,n,r,r,r,i,0);return a.contentDOM&&a.updateChildren(i,0),a}var Jc=class e extends Kc{constructor(e,t,n,r,i,a,o){super(e,t,n,r,i,null,a,o,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return this.dirty==Vc||this.dirty!=Rc&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Rc||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=Rc,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!=`characterData`&&e.type!=`selection`}slice(t,n,r){let i=this.node.cut(t,n),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Vc)}get domAtom(){return!1}isText(e){return this.node.text==e}},Yc=class extends Hc{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Rc&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},Xc=class extends Kc{constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,c,l),this.spec=s}update(e,t,n,r){if(this.dirty==Vc)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}else if(!this.contentDOM&&!e.isLeaf)return!1;else return super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function Zc(e,t,n){let r=e.firstChild,i=!1;for(let a=0;a<t.length;a++){let o=t[a],s=o.dom;if(s.parentNode==e){for(;s!=r;)r=al(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof Gc){let t=r?r.previousSibling:e.lastChild;Zc(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=al(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var Qc=function(e){e&&(this.nodeName=e)};Qc.prototype=Object.create(null);var $c=[new Qc];function el(e,t,n){if(e.length==0)return $c;let r=n?$c[0]:new Qc,i=[r];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o){o.nodeName&&i.push(r=new Qc(o.nodeName));for(let e in o){let a=o[e];a!=null&&(n&&i.length==1&&i.push(r=new Qc(t.isInline?`span`:`div`)),e==`class`?r.class=(r.class?r.class+` `:``)+a:e==`style`?r.style=(r.style?r.style+`;`:``)+a:e!=`nodeName`&&(r[e]=a))}}}return i}function tl(e,t,n,r){if(n==$c&&r==$c)return t;let i=t;for(let t=0;t<r.length;t++){let a=r[t],o=n[t];if(t){let t;o&&o.nodeName==a.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==a.nodeName?i=t:(t=document.createElement(a.nodeName),t.pmIsDeco=!0,t.appendChild(i),o=$c[0],i=t)}nl(i,o||$c[0],a)}return i}function nl(e,t,n){for(let r in t)r!=`class`&&r!=`style`&&r!=`nodeName`&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!=`class`&&r!=`style`&&r!=`nodeName`&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(` `).filter(Boolean):[],i=n.class?n.class.split(` `).filter(Boolean):[];for(let t=0;t<r.length;t++)i.indexOf(r[t])==-1&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)r.indexOf(i[t])==-1&&e.classList.add(i[t]);e.classList.length==0&&e.removeAttribute(`class`)}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}function rl(e,t,n){return tl(e,e,$c,el(t,n,e.nodeType!=1))}function il(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function al(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var ol=class{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=sl(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,a=this.stack.length>>1,o=Math.min(a,e.length);for(;i<o&&(i==a-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<a;)this.destroyRest(),this.top.dirty=Rc,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let i=-1,o=this.top.children.length;r<this.preMatch.index&&(o=Math.min(this.index+3,o));for(let t=this.index;t<o;t++){let n=this.top.children[t];if(n.matchesMark(e[a])&&!this.isLocked(n.dom)){i=t;break}}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=Gc.create(this.top,e[a],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,a++}}findNodeMatch(e,t,n,r){let i=-1,a;if(r>=this.preMatch.index&&(a=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,n))i=this.top.children.indexOf(a,this.index);else for(let r=this.index,a=Math.min(this.top.children.length,r+5);r<a;r++){let a=this.top.children[r];if(a.matchesNode(e,t,n)&&!this.preMatch.matched.has(a)){i=r;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let a=this.top.children[r];return a.dirty==Vc&&a.dom==a.contentDOM&&(a.dirty=Bc),a.update(e,t,n,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return-1}e=t}}updateNextNode(e,t,n,r,i,a){for(let o=this.index;o<this.top.children.length;o++){let s=this.top.children[o];if(s instanceof Kc){let c=this.preMatch.matched.get(s);if(c!=null&&c!=i)return!1;let l=s.dom,u,d=this.isLocked(l)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&s.dirty!=Vc&&il(t,s.outerDeco));if(!d&&s.update(e,t,n,r))return this.destroyBetween(this.index,o),s.dom!=l&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(s,e,t,n,r,a)))return this.destroyBetween(this.index,o),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=Bc,u.updateChildren(r,a+1),u.dirty=Rc),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!il(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=Kc.create(this.top,t,n,r,i,a);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,t,n,r,i){let a=Kc.create(this.top,e,t,n,r,i);a.contentDOM&&a.updateChildren(r,i+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new Uc(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Gc;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Jc)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&(($s||Zs)&&e&&e.dom.contentEditable==`false`&&this.addHackNode(`IMG`,t),this.addHackNode(`BR`,this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e==`IMG`&&(n.className=`ProseMirror-separator`,n.alt=``),e==`BR`&&(n.className=`ProseMirror-trailingBreak`);let r=new Yc(this.top,[],n,null);t==this.top?t.children.splice(this.index++,0,r):t.children.push(r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}};function sl(e,t){let n=t,r=n.children.length,i=e.childCount,a=new Map,o=[];outer:for(;i>0;){let s;for(;;)if(r){let e=n.children[r-1];if(e instanceof Gc)n=e,r=e.children.length;else{s=e,r--;break}}else if(n==t)break outer;else r=n.parent.children.indexOf(n),n=n.parent;let c=s.node;if(c){if(c!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function cl(e,t){return e.type.side-t.type.side}function ll(e,t,n,r){let i=t.locals(e),a=0;if(i.length==0){for(let n=0;n<e.childCount;n++){let o=e.child(n);r(o,i,t.forChild(a,o),n),a+=o.nodeSize}return}let o=0,s=[],c=null;for(let l=0;;){let u,d;for(;o<i.length&&i[o].to==a;){let e=i[o++];e.widget&&(u?(d||=[u]).push(e):u=e)}if(u)if(d){d.sort(cl);for(let e=0;e<d.length;e++)n(d[e],l,!!c)}else n(u,l,!!c);let f,p;if(c)p=-1,f=c,c=null;else if(l<e.childCount)p=l,f=e.child(l++);else break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1);for(;o<i.length&&i[o].from<=a&&i[o].to>a;)s.push(i[o++]);let m=a+f.nodeSize;if(f.isText){let e=m;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<s.length;t++)s[t].to<e&&(e=s[t].to);e<m&&(c=f.cut(e-a),f=f.cut(0,e-a),m=e,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let h=f.isInline&&!f.isLeaf?s.filter(e=>!e.inline):s.slice();r(f,h,t.forChild(a,f),p),a=m}}function ul(e){if(e.nodeName==`UL`||e.nodeName==`OL`){let t=e.style.cssText;e.style.cssText=t+`; list-style: square !important`,window.getComputedStyle(e).listStyle,e.style.cssText=t}}function dl(e,t,n,r){for(let i=0,a=0;i<e.childCount&&a<=r;){let o=e.child(i++),s=a;if(a+=o.nodeSize,!o.isText)continue;let c=o.text;for(;i<e.childCount;){let t=e.child(i++);if(a+=t.nodeSize,!t.isText)break;c+=t.text}if(a>=n){if(a>=r&&c.slice(r-t.length-s,r-s)==t)return r-t.length;let e=s<r?c.lastIndexOf(t,r-s-1):-1;if(e>=0&&e+t.length+s>=n)return s+e;if(n==r&&c.length>=r+t.length-s&&c.slice(r-s,r-s+t.length)==t)return r}}return-1}function fl(e,t,n,r,i){let a=[];for(let o=0,s=0;o<e.length;o++){let c=e[o],l=s,u=s+=c.size;l>=n||u<=t?a.push(c):(l<t&&a.push(c.slice(0,t-l,r)),i&&=(a.push(i),void 0),u>n&&a.push(c.slice(n-l,c.size,r)))}return a}function pl(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let s=r.resolve(o),c,l;if(Ls(n)){for(c=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&G.isSelectable(e)&&i.parent&&!(e.isInline&&Fs(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new G(o==e?s:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=o,i=o;for(let r=0;r<n.rangeCount;r++){let a=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(a.startContainer,a.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(a.endContainer,a.endOffset,-1))}if(t<0)return null;[c,o]=i==e.state.selection.anchor?[i,t]:[t,i],s=r.resolve(o)}else c=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!l){let n=t==`pointer`||e.state.selection.head<s.pos&&!a?1:-1;l=wl(e,u,s,n)}return l}function ml(e){return e.editable?e.hasFocus():El(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function hl(e,t=!1){let n=e.state.selection;if(Sl(e,n),!ml(e))return;let r=e.input.mouseDown;if(!t&&Zs&&r){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&ks(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)&&r.delaySelUpdate()){e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)xl(e);else{let{anchor:r,head:i}=n,a,o;gl&&!(n instanceof W)&&(n.$from.parent.inlineContent||(a=_l(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=_l(e,n.to))),e.docView.setSelection(r,i,e,t),gl&&(a&&yl(a),o&&yl(o)),n.visible?e.dom.classList.remove(`ProseMirror-hideselection`):(e.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&bl(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}var gl=$s||Zs&&Qs<63;function _l(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,a=r?n.childNodes[r-1]:null;if($s&&i&&i.contentEditable==`false`)return vl(i);if((!i||i.contentEditable==`false`)&&(!a||a.contentEditable==`false`)){if(i)return vl(i);if(a)return vl(a)}}function vl(e){return e.contentEditable=`true`,$s&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function yl(e){e.contentEditable=`false`,e.wasDraggable&&=(e.draggable=!0,null)}function bl(e){let t=e.dom.ownerDocument;t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener(`selectionchange`,e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard),setTimeout(()=>{(!ml(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function xl(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName==`IMG`;r?t.collapse(n.parentNode,ws(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&qs&&Js<=11&&(n.disabled=!0,n.disabled=!1)}function Sl(e,t){if(t instanceof G){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Cl(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Cl(e)}function Cl(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function wl(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||W.between(t,n,r)}function Tl(e){return e.editable&&!e.hasFocus()?!1:El(e)}function El(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function Dl(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return ks(t.node,t.offset,n.anchorNode,n.anchorOffset)}function Ol(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&U.findFrom(a,t)}function kl(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Al(e,t,n){let r=e.state.selection;if(r instanceof W){if(n.indexOf(`s`)>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let a=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return kl(e,new W(r.$anchor,a))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=Ol(e.state,t);return n&&n instanceof G?kl(e,n):!1}else if(!(tc&&n.indexOf(`m`)>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,a;if(!i||i.isText)return!1;let o=t<0?n.pos-i.nodeSize:n.pos;return i.isAtom||(a=e.docView.descAt(o))&&!a.contentDOM?G.isSelectable(i)?kl(e,new G(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):ic?kl(e,new W(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1:!1}}else if(r instanceof G&&r.node.isInline)return kl(e,new W(t>0?r.$to:r.$from));else{let n=Ol(e.state,t);return n?kl(e,n):!1}}function jl(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Ml(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`)}function Nl(e,t){return t<0?Pl(e):Fl(e)}function Pl(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for(Ys&&n.nodeType==1&&r<jl(n)&&Ml(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let e=n.childNodes[r-1];if(Ml(e,-1))i=n,a=--r;else if(e.nodeType==3)n=e,r=n.nodeValue.length;else break}}else if(Il(n))break;else{let t=n.previousSibling;for(;t&&Ml(t,-1);)i=n.parentNode,a=ws(t),t=t.previousSibling;if(t)n=t,r=jl(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?zl(e,n,r):i&&zl(e,i,a)}function Fl(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=jl(n),a,o;for(;;)if(r<i){if(n.nodeType!=1)break;let e=n.childNodes[r];if(Ml(e,1))a=n,o=++r;else break}else if(Il(n))break;else{let t=n.nextSibling;for(;t&&Ml(t,1);)a=t.parentNode,o=ws(t)+1,t=t.nextSibling;if(t)n=t,r=0,i=jl(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&zl(e,a,o)}function Il(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Ll(e,t){for(;e&&t==e.childNodes.length&&!Is(e);)t=ws(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=0}}function Rl(e,t){for(;e&&!t&&!Is(e);)t=ws(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=e.childNodes.length}}function zl(e,t,n){if(t.nodeType!=3){let e,r;(r=Ll(t,n))?(t=r,n=0):(e=Rl(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(Ls(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&hl(e)},50)}function Bl(e,t){let n=e.state.doc.resolve(t);if(!(Zs||nc)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?`ltr`:`rtl`}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?`ltr`:`rtl`}}return getComputedStyle(e.dom).direction==`rtl`?`rtl`:`ltr`}function Vl(e,t,n){let r=e.state.selection;if(r instanceof W&&!r.empty||n.indexOf(`s`)>-1||tc&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=Ol(e.state,t);if(n&&n instanceof G)return kl(e,n)}if(!i.parent.inlineContent){let n=t<0?i:a,o=r instanceof _o?U.near(n,t):U.findFrom(n,t);return o?kl(e,o):!1}return!1}function Hl(e,t){if(!(e.state.selection instanceof W))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`))return!0;let a=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let r=e.state.tr;return t<0?r.delete(n.pos-a.nodeSize,n.pos):r.delete(n.pos,n.pos+a.nodeSize),e.dispatch(r),!0}return!1}function Ul(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Wl(e){if(!$s||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable==`false`){let n=t.firstChild;Ul(e,n,`true`),setTimeout(()=>Ul(e,n,`false`),20)}return!1}function Gl(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function Kl(e,t){let n=t.keyCode,r=Gl(t);if(n==8||tc&&n==72&&r==`c`)return Hl(e,-1)||Nl(e,-1);if(n==46&&!t.shiftKey||tc&&n==68&&r==`c`)return Hl(e,1)||Nl(e,1);if(n==13||n==27)return!0;if(n==37||tc&&n==66&&r==`c`){let t=n==37?Bl(e,e.state.selection.from)==`ltr`?-1:1:-1;return Al(e,t,r)||Nl(e,t)}else if(n==39||tc&&n==70&&r==`c`){let t=n==39?Bl(e,e.state.selection.from)==`ltr`?1:-1:1;return Al(e,t,r)||Nl(e,t)}else if(n==38||tc&&n==80&&r==`c`)return Vl(e,-1,r)||Nl(e,-1);else if(n==40||tc&&n==78&&r==`c`)return Wl(e)||Vl(e,1,r)||Nl(e,1);else if(r==(tc?`m`:`c`)&&(n==66||n==73||n==89||n==90))return!0;return!1}function ql(e,t){e.someProp(`transformCopied`,n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let e=r.firstChild;n.push(e.type.name,e.attrs==e.type.defaultAttrs?null:e.attrs),r=e.content}let o=e.someProp(`clipboardSerializer`)||Wi.fromSchema(e.state.schema),s=iu(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&l.nodeType==1&&(u=nu[l.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=s.createElement(u[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),d++}l=c.firstChild}return l&&l.nodeType==1&&l.setAttribute(`data-pm-slice`,`${i} ${a}${d?` -${d}`:``} ${JSON.stringify(n)}`),{dom:c,text:e.someProp(`clipboardTextSerializer`,n=>n(t,e))||t.content.textBetween(0,t.content.size,`
8
+
9
+ `),slice:t}}function Jl(e,t,n,r,i){let a=i.parent.type.spec.code,o,s;if(!n&&!t)return null;let c=!!t&&(r||a||!n);if(c){if(e.someProp(`transformPastedText`,n=>{t=n(t,a||r,e)}),a)return s=new H(B.from(e.state.schema.text(t.replace(/\r\n?/g,`
10
+ `))),0,0),e.someProp(`transformPasted`,t=>{s=t(s,e,!0)}),s;let n=e.someProp(`clipboardTextParser`,n=>n(t,i,r,e));if(n)s=n;else{let n=i.marks(),{schema:r}=e.state,a=Wi.fromSchema(r);o=document.createElement(`div`),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement(`p`));e&&t.appendChild(a.serializeNode(r.text(e,n)))})}}else e.someProp(`transformPastedHTML`,t=>{n=t(n,e)}),o=su(n),ic&&cu(o);let l=o&&o.querySelector(`[data-pm-slice]`),u=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute(`data-pm-slice`)||``);if(u&&u[3])for(let e=+u[3];e>0;e--){let e=o.firstChild;for(;e&&e.nodeType!=1;)e=e.nextSibling;if(!e)break;o=e}if(s||=(e.someProp(`clipboardParser`)||e.someProp(`domParser`)||Ai.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!Yl.test(e.parentNode.nodeName)?{ignore:!0}:null}}),u)s=lu(tu(s,+u[1],+u[2]),u[4]);else if(s=H.maxOpen(Xl(s.content,i),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=tu(s,e,t)}return e.someProp(`transformPasted`,t=>{s=t(s,e,c)}),s}var Yl=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Xl(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),i,a=[];if(e.forEach(e=>{if(!a)return;let t=r.findWrapping(e.type),n;if(!t)return a=null;if(n=a.length&&i.length&&Ql(t,i,e,a[a.length-1],0))a[a.length-1]=n;else{a.length&&(a[a.length-1]=$l(a[a.length-1],i.length));let n=Zl(e,t);a.push(n),r=r.matchType(n.type),i=t}}),a)return B.from(a)}return e}function Zl(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,B.from(e));return e}function Ql(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let a=Ql(e,t,n,r.lastChild,i+1);if(a)return r.copy(r.content.replaceChild(r.childCount-1,a));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(B.from(Zl(n,e,i+1))))}}function $l(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,$l(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(B.empty,!0);return e.copy(n.append(r))}function eu(e,t,n,r,i,a){let o=t<0?e.firstChild:e.lastChild,s=o.content;return e.childCount>1&&(a=0),i<r-1&&(s=eu(s,t,n,r,i+1,a)),i>=n&&(s=t<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(B.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function tu(e,t,n){return t<e.openStart&&(e=new H(eu(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new H(eu(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var nu={thead:[`table`],tbody:[`table`],tfoot:[`table`],caption:[`table`],colgroup:[`table`],col:[`table`,`colgroup`],tr:[`table`,`tbody`],td:[`table`,`tbody`,`tr`],th:[`table`,`tbody`,`tr`]},ru=null;function iu(){return ru||=document.implementation.createHTMLDocument(`title`)}var au=null;function ou(e){let t=window.trustedTypes;return t?(au||=t.defaultPolicy||t.createPolicy(`ProseMirrorClipboard`,{createHTML:e=>e}),au.createHTML(e)):e}function su(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=iu().createElement(`div`),r=/<([a-z][^>\s]+)/i.exec(e),i;if((i=r&&nu[r[1].toLowerCase()])&&(e=i.map(e=>`<`+e+`>`).join(``)+e+i.map(e=>`</`+e+`>`).reverse().join(``)),n.innerHTML=ou(e),i)for(let e=0;e<i.length;e++)n=n.querySelector(i[e])||n;return n}function cu(e){let t=e.querySelectorAll(Zs?`span:not([class]):not([style])`:`span.Apple-converted-space`);for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==`\xA0`&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(` `),r)}}function lu(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:i,openStart:a,openEnd:o}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;i=B.from(t.create(r[e+1],i)),a++,o++}return new H(i,a,o)}var uu={},du={},fu={touchstart:!0,touchmove:!0},pu=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:``,button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function mu(e){for(let t in uu){let n=uu[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{yu(e,t)&&!vu(e,t)&&(e.editable||!(t.type in du))&&n(e,t)},fu[t]?{passive:!0}:void 0)}$s&&e.dom.addEventListener(`input`,()=>null),_u(e)}function hu(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function gu(e){e.input.mouseDown&&e.input.mouseDown.done(),e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function _u(e){e.someProp(`handleDOMEvents`,t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>vu(e,t))})}function vu(e,t){return e.someProp(`handleDOMEvents`,n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function yu(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function bu(e,t){!vu(e,t)&&uu[t.type]&&(e.editable||!(t.type in du))&&uu[t.type](e,t)}du.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!Lu(e)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(rc&&Zs&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),ec&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp(`handleKeyDown`,t=>t(e,Rs(13,`Enter`))),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,t=>t(e,n))||Kl(e,n)?n.preventDefault():hu(e,`key`)},du.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},du.keypress=(e,t)=>{let n=t;if(Lu(e)||!n.charCode||n.ctrlKey&&!n.altKey||tc&&n.metaKey)return;if(e.someProp(`handleKeyPress`,t=>t(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof W)||!r.$from.sameParent(r.$to)){let t=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(t).scrollIntoView();!/[\r\n]/.test(t)&&!e.someProp(`handleTextInput`,n=>n(e,r.$from.pos,r.$to.pos,t,i))&&e.dispatch(i()),n.preventDefault()}};function xu(e){return{left:e.clientX,top:e.clientY}}function Su(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function Cu(e,t,n,r,i){if(r==-1)return!1;let a=e.state.doc.resolve(r);for(let r=a.depth+1;r>0;r--)if(e.someProp(t,t=>r>a.depth?t(e,n,a.nodeAfter,a.before(r),i,!0):t(e,n,a.node(r),a.before(r),i,!1)))return!0;return!1}function wu(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);n==`pointer`&&r.setMeta(`pointer`,!0),e.dispatch(r)}function Tu(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&G.isSelectable(r)?(wu(e,new G(n),`pointer`),!0):!1}function Eu(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof G&&(r=n.node);let a=e.state.doc.resolve(t);for(let e=a.depth+1;e>0;e--){let t=e>a.depth?a.nodeAfter:a.node(e);if(G.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?a.before(n.$from.depth):a.before(e);break}}return i==null?!1:(wu(e,G.create(e.state.doc,i),`pointer`),!0)}function Du(e,t,n,r,i){return Cu(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,n=>n(e,t,r))||(i?Eu(e,n):Tu(e,n))}function Ou(e,t,n,r){return Cu(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,n=>n(e,t,r))}function ku(e,t,n,r){return Cu(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,n=>n(e,t,r))||Au(e,n,r)}function Au(e,t,n){if(n.button!=0)return!1;let r=ju(e,t,!0),i=e.state.doc;return r?(wu(e,r,`pointer`),r instanceof W&&i.eq(e.state.doc)&&(e.input.mouseDown=new Iu(e,r)),!0):!1}function ju(e,t,n){let r=e.state.doc;if(t==-1)return r.inlineContent?W.create(r,0,r.content.size):null;let i=r.resolve(t);for(let e=i.depth+1;e>0;e--){let t=e>i.depth?i.nodeAfter:i.node(e),a=i.before(e);if(t.inlineContent)return W.create(r,a+1,a+1+t.content.size);if(n&&G.isSelectable(t))return G.create(r,a)}return null}function Mu(e){return Uu(e)}var Nu=tc?`metaKey`:`ctrlKey`;uu.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=Mu(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&Su(n,e.input.lastClick)&&!n[Nu]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type==`singleClick`?a=`doubleClick`:e.input.lastClick.type==`doubleClick`&&(a=`tripleClick`)),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button},e.input.mouseDown&&e.input.mouseDown.done();let o=e.posAtCoords(xu(n));o&&(a==`singleClick`?e.input.mouseDown=new Fu(e,o,n,!!r):(a==`doubleClick`?Ou:ku)(e,o.pos,o.inside,n)?n.preventDefault():hu(e,`pointer`))};var Pu=class{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener(`mouseup`,this.up=this.up.bind(this)),e.root.addEventListener(`mousemove`,this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener(`mouseup`,this.up),this.view.root.removeEventListener(`mousemove`,this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}},Fu=class extends Pu{constructor(e,t,n,r){super(e),this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!n[Nu],this.allowDefault=n.shiftKey;let i,a;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,a=n.depth?n.before():0}let o=r?null:n.target,s=o?e.docView.nearestDesc(o,!0):null;this.target=s&&s.nodeDOM.nodeType==1?s.nodeDOM:null;let{selection:c}=e.state;n.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof G&&c.from<=a&&c.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ys&&!this.target.hasAttribute(`contentEditable`))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute(`contentEditable`,`false`)},20),this.view.domObserver.start()),hu(e,`pointer`)}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute(`draggable`),this.mightDrag.setUneditable&&this.target.removeAttribute(`contentEditable`),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||hl(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(xu(e))),this.updateAllowDefault(e),this.allowDefault||!t?hu(this.view,`pointer`):Du(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||$s&&this.mightDrag&&!this.mightDrag.node.isAtom||Zs&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(wu(this.view,U.near(this.view.state.doc.resolve(t.pos)),`pointer`),e.preventDefault()):hu(this.view,`pointer`)}move(e){this.updateAllowDefault(e),hu(this.view,`pointer`),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}},Iu=class extends Pu{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),hu(this.view,`pointer`);let t=this.view.posAtCoords(xu(e)),n=t&&ju(this.view,t.inside,!1);if(!n)return;let{doc:r}=this.view.state,i=this.startSelection,[a,o]=n.from<i.from?[i.to,n.from]:[i.from,n.to];wu(this.view,W.create(r,a,o),`pointer`)}};uu.touchstart=e=>{e.input.lastTouch=Date.now(),Mu(e),hu(e,`pointer`)},uu.touchmove=e=>{e.input.lastTouch=Date.now(),hu(e,`pointer`)},uu.contextmenu=e=>Mu(e);function Lu(e,t){return e.composing?!0:$s&&Math.abs(Date.now()-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var Ru=rc?5e3:-1;du.compositionstart=du.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof W&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>e.type.spec.inclusive===!1)||Zs&&nc&&zu(e)))e.markCursor=e.state.storedMarks||n.marks(),Uu(e,!0),e.markCursor=null;else if(Uu(e,!t.selection.empty),Ys&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&n.nodeType==1&&r!=0;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(t.nodeType==3){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}else n=t,r=-1}}e.input.composing=!0}Bu(e,Ru)};function zu(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return r.nodeType==1&&r.contentEditable==`false`}du.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,Bu(e,20))};function Bu(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Uu(e),t))}function Vu(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Hu(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=Ns(t.focusNode,t.focusOffset),r=Ps(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}function Uu(e,t=!1){if(!(rc&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Vu(e),t||e.docView&&e.docView.dirty){let n=pl(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function Wu(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement(`div`));n.appendChild(t),n.style.cssText=`position: fixed; left: -10000px; top: 10px`;let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}var Gu=qs&&Js<15||ec&&ac<604;uu.copy=du.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type==`cut`;if(r.empty)return;let a=Gu?null:n.clipboardData,{dom:o,text:s}=ql(e,r.content());a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,o.innerHTML),a.setData(`text/plain`,s)):Wu(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))};function Ku(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function qu(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?`textarea`:`div`));n||(r.contentEditable=`true`),r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Ju(e,r.value,null,i,t):Ju(e,r.textContent,r.innerHTML,i,t)},50)}function Ju(e,t,n,r,i){let a=Jl(e,t,n,r,e.state.selection.$from);if(e.someProp(`handlePaste`,t=>t(e,i,a||H.empty)))return!0;if(!a)return!1;let o=Ku(a),s=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(a);return e.dispatch(s.scrollIntoView().setMeta(`paste`,!0).setMeta(`uiEvent`,`paste`)),!0}function Yu(e){let t=e.getData(`text/plain`)||e.getData(`Text`);if(t)return t;let n=e.getData(`text/uri-list`);return n?n.replace(/\r?\n/g,` `):``}du.paste=(e,t)=>{let n=t;if(e.composing&&!rc)return;let r=Gu?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&Ju(e,Yu(r),r.getData(`text/html`),i,n)?n.preventDefault():qu(e,n)};var Xu=class{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}},Zu=tc?`altKey`:`ctrlKey`;function Qu(e,t){let n;return e.someProp(`dragCopies`,e=>{n||=e(t)}),n==null?!t[Zu]:!n}uu.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,a=i.empty?null:e.posAtCoords(xu(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof G?i.to-1:i.to))){if(r&&r.mightDrag)o=G.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=G.create(e.state.doc,t.posBefore))}}let{dom:s,text:c,slice:l}=ql(e,(o||e.state.selection).content());(!n.dataTransfer.files.length||!Zs||Qs>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Gu?`Text`:`text/html`,s.innerHTML),n.dataTransfer.effectAllowed=`copyMove`,Gu||n.dataTransfer.setData(`text/plain`,c),e.dragging=new Xu(l,Qu(e,n),o)},uu.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},du.dragover=du.dragenter=(e,t)=>t.preventDefault(),du.drop=(e,t)=>{try{$u(e,t,e.dragging)}finally{e.dragging=null}};function $u(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(xu(t));if(!r)return;let i=e.state.doc.resolve(r.pos),a=n&&n.slice;a?e.someProp(`transformPasted`,t=>{a=t(a,e,!1)}):a=Jl(e,Yu(t.dataTransfer),Gu?null:t.dataTransfer.getData(`text/html`),!1,i);let o=!!(n&&Qu(e,t));if(e.someProp(`handleDrop`,n=>n(e,t,a||H.empty,o))){t.preventDefault();return}if(!a)return;t.preventDefault();let s=a?Wa(e.state.doc,i.pos,a):i.pos;s??=i.pos;let c=e.state.tr;if(o){let{node:e}=n;e?e.replace(c):c.deleteSelection()}let l=c.mapping.map(s),u=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,d=c.doc;if(u?c.replaceRangeWith(l,l,a.content.firstChild):c.replaceRange(l,l,a),c.doc.eq(d))return;let f=c.doc.resolve(l);if(u&&G.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new G(f));else{let t=c.mapping.map(s);c.mapping.maps[c.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),c.setSelection(wl(e,f,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta(`uiEvent`,`drop`))}uu.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add(`ProseMirror-focused`),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&hl(e)},20))},uu.blur=(e,t)=>{let n=t;e.focused&&=(e.domObserver.stop(),e.dom.classList.remove(`ProseMirror-focused`),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),!1)},uu.beforeinput=(e,t)=>{if(Zs&&rc&&t.inputType==`deleteContentBackward`){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp(`handleKeyDown`,t=>t(e,Rs(8,`Backspace`)))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in du)uu[e]=du[e];function ed(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}var td=class e{constructor(e,t){this.toDOM=e,this.spec=t||od,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:a}=e.mapResult(t.from+r,this.side<0?-1:1);return a?null:new id(i-n,i-n,this)}valid(){return!0}eq(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&ed(this.spec,t.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},nd=class e{constructor(e,t){this.attrs=e,this.spec=t||od}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,a=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=a?null:new id(i,a,this)}valid(e,t){return t.from<t.to}eq(t){return this==t||t instanceof e&&ed(this.attrs,t.attrs)&&ed(this.spec,t.spec)}static is(t){return t.type instanceof e}destroy(){}},rd=class e{constructor(e,t){this.attrs=e,this.spec=t||od}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let a=e.mapResult(t.to+r,-1);return a.deleted||a.pos<=i.pos?null:new id(i.pos-n,a.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(t){return this==t||t instanceof e&&ed(this.attrs,t.attrs)&&ed(this.spec,t.spec)}destroy(){}},id=class e{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(t,n){return new e(t,n,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(t,n,r){return new e(t,t,new td(n,r))}static inline(t,n,r,i){return new e(t,n,new nd(r,i))}static node(t,n,r,i){return new e(t,n,new rd(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof nd}get widget(){return this.type instanceof td}},ad=[],od={},sd=class e{constructor(e,t){this.local=e.length?e:ad,this.children=t.length?t:ad}static create(e,t){return t.length?hd(t,e,0,od):cd}find(e,t,n){let r=[];return this.findInner(e??0,t??1e9,r,0,n),r}findInner(e,t,n,r,i){for(let a=0;a<this.local.length;a++){let o=this.local[a];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let o=this.children[a]+1;this.children[a+2].findInner(e-o,t-o,n,r+o,i)}}map(e,t,n){return this==cd||e.maps.length==0?this:this.mapInner(e,t,0,0,n||od)}mapInner(t,n,r,i,a){let o;for(let e=0;e<this.local.length;e++){let s=this.local[e].map(t,r,i);s&&s.type.valid(n,s)?(o||=[]).push(s):a.onRemove&&a.onRemove(this.local[e].spec)}return this.children.length?ud(this.children,o||[],t,n,r,i,a):o?new e(o.sort(gd),ad):cd}add(t,n){return n.length?this==cd?e.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let i,a=0;t.forEach((e,t)=>{let o=t+r,s;if(s=pd(n,e,o)){for(i||=this.children.slice();a<i.length&&i[a]<t;)a+=3;i[a]==t?i[a+2]=i[a+2].addInner(e,s,o+1):i.splice(a,0,t,t+e.nodeSize,hd(s,e,o+1,od)),a+=3}});let o=dd(a?md(n):n,-r);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||o.splice(e--,1);return new e(o.length?this.local.concat(o).sort(gd):this.local,i||this.children)}remove(e){return e.length==0||this==cd?this:this.removeInner(e,0)}removeInner(t,n){let r=this.children,i=this.local;for(let e=0;e<r.length;e+=3){let i,a=r[e]+n,o=r[e+1]+n;for(let e=0,n;e<t.length;e++)(n=t[e])&&n.from>a&&n.to<o&&(t[e]=null,(i||=[]).push(n));if(!i)continue;r==this.children&&(r=this.children.slice());let s=r[e+2].removeInner(i,a+1);s==cd?(r.splice(e,3),e-=3):r[e+2]=s}if(i.length){for(let e=0,r;e<t.length;e++)if(r=t[e])for(let e=0;e<i.length;e++)i[e].eq(r,n)&&(i==this.local&&(i=this.local.slice()),i.splice(e--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new e(i,r):cd}forChild(t,n){if(this==cd)return this;if(n.isLeaf)return e.empty;let r,i;for(let e=0;e<this.children.length;e+=3)if(this.children[e]>=t){this.children[e]==t&&(r=this.children[e+2]);break}let a=t+1,o=a+n.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>a&&t.type instanceof nd){let e=Math.max(a,t.from)-a,n=Math.min(o,t.to)-a;e<n&&(i||=[]).push(t.copy(e,n))}}if(i){let t=new e(i.sort(gd),ad);return r?new ld([t,r]):t}return r||cd}eq(t){if(this==t)return!0;if(!(t instanceof e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(e){return _d(this.localsInner(e))}localsInner(e){if(this==cd)return ad;if(e.inlineContent||!this.local.some(nd.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof nd||t.push(this.local[e]);return t}forEachSet(e){e(this)}};sd.empty=new sd([],[]),sd.removeOverlap=_d;var cd=sd.empty,ld=class e{constructor(e){this.members=e}map(t,n){let r=this.members.map(e=>e.map(t,n,od));return e.from(r)}forChild(t,n){if(n.isLeaf)return sd.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(t,n);a!=cd&&(a instanceof e?r=r.concat(a.members):r.push(a))}return e.from(r)}eq(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!t)t=i;else{n&&=(t=t.slice(),!1);for(let e=0;e<i.length;e++)t.push(i[e])}}return t?_d(n?t:t.sort(gd)):ad}static from(t){switch(t.length){case 0:return cd;case 1:return t[0];default:return new e(t.every(e=>e instanceof sd)?t:t.reduce((e,t)=>e.concat(t instanceof sd?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function ud(e,t,n,r,i,a,o){let s=e.slice();for(let e=0,t=a;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,a)=>{let o=a-i-(n-e);for(let i=0;i<s.length;i+=3){let a=s[i+1];if(a<0||e>a+t-r)continue;let c=s[i]+t-r;n>=c?s[i+1]=e<=c?-2:-1:e>=t&&o&&(s[i]+=o,s[i+1]+=o)}r+=o}),t=n.maps[e].map(t,-1)}let c=!1;for(let t=0;t<s.length;t+=3)if(s[t+1]<0){if(s[t+1]==-2){c=!0,s[t+1]=-1;continue}let l=n.map(e[t]+a),u=l-i;if(u<0||u>=r.content.size){c=!0;continue}let d=n.map(e[t+1]+a,-1)-i,{index:f,offset:p}=r.content.findIndex(u),m=r.maybeChild(f);if(m&&p==u&&p+m.nodeSize==d){let r=s[t+2].mapInner(n,m,l+1,e[t]+a+1,o);r==cd?(s[t+1]=-2,c=!0):(s[t]=u,s[t+1]=d,s[t+2]=r)}else c=!0}if(c){let c=hd(fd(s,e,t,n,i,a,o),r,0,o);t=c.local;for(let e=0;e<s.length;e+=3)s[e+1]<0&&(s.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<s.length&&s[t]<n;)t+=3;s.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new sd(t.sort(gd),s)}function dd(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new id(i.from+t,i.to+t,i.type))}return n}function fd(e,t,n,r,i,a,o){function s(e,t){for(let a=0;a<e.local.length;a++){let s=e.local[a].map(r,i,t);s?n.push(s):o.onRemove&&o.onRemove(e.local[a].spec)}for(let n=0;n<e.children.length;n+=3)s(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)e[n+1]==-1&&s(e[n+2],t[n]+a+1);return n}function pd(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,a;t<e.length;t++)(a=e[t])&&a.from>n&&a.to<r&&((i||=[]).push(a),e[t]=null);return i}function md(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function hd(e,t,n,r){let i=[],a=!1;t.forEach((t,o)=>{let s=pd(e,t,o+n);if(s){a=!0;let e=hd(s,t,n+o+1,r);e!=cd&&i.push(o,o+t.nodeSize,e)}});let o=dd(a?md(e):e,-n).sort(gd);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||(r.onRemove&&r.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new sd(o,i):cd}function gd(e,t){return e.from-t.from||e.to-t.to}function _d(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let a=t[i];if(a.from==r.from){a.to!=r.to&&(t==e&&(t=e.slice()),t[i]=a.copy(a.from,r.to),vd(t,i+1,a.copy(r.to,a.to)));continue}else{a.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,a.from),vd(t,i,r.copy(a.from,r.to)));break}}}return t}function vd(e,t,n){for(;t<e.length&&gd(n,e[t])>0;)t++;e.splice(t,0,n)}function yd(e){let t=[];return e.someProp(`decorations`,n=>{let r=n(e.state);r&&r!=cd&&t.push(r)}),e.cursorWrapper&&t.push(sd.create(e.state.doc,[e.cursorWrapper.deco])),ld.from(t)}var bd={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},xd=qs&&Js<=11,Sd=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}},Cd=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Sd,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);qs&&Js<=11&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():$s&&e.composing&&t.some(e=>e.type==`childList`&&e.target.nodeName==`TR`)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),xd&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,bd)),this.onCharData&&this.view.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener(`DOMCharacterDataModified`,this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener(`selectionchange`,this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener(`selectionchange`,this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Tl(this.view)){if(this.suppressingSelectionUpdates)return hl(this.view);if(qs&&Js<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ks(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let n=e.focusNode;n;n=Ts(n))t.add(n);for(let r=e.anchorNode;r;r=Ts(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:`selection`,target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&Tl(e)&&!this.ignoreSelectionChange(n),i=-1,a=-1,o=!1,s=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],s);n&&(i=i<0?n.from:Math.min(n.from,i),a=a<0?n.to:Math.max(n.to,a),n.typeOver&&(o=!0))}if(s.some(e=>e.nodeName==`BR`)&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||Zs&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&t.some(e=>e.type==`childList`&&e.removedNodes.length))){for(let e of s)if(e.nodeName==`BR`&&e.parentNode){let t=e.nextSibling;for(;t&&t.nodeType==1;){if(t.contentEditable==`false`){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(Ys&&s.length){let t=s.filter(e=>e.nodeName==`BR`);if(t.length==2){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;t&&t.nodeName==`LI`&&(!n||kd(e,n)!=t)&&r.remove()}}}let c=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ls(n)&&(c=pl(e))&&c.eq(U.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,hl(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),Ed(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Ad(e,s)),this.handleDOMChange(i,a,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||hl(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type==`attributes`&&(n==this.view.docView||e.attributeName==`contenteditable`||e.attributeName==`style`&&!e.oldValue&&!e.target.getAttribute(`style`))||!n||n.ignoreMutation(e))return null;if(e.type==`childList`){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),r.nodeType==3&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(qs&&Js<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:a}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!a||Array.prototype.indexOf.call(e.addedNodes,a)<0)&&(i=a)}let a=r&&r.parentNode==e.target?ws(r)+1:0,o=n.localPosFromDOM(e.target,a,-1),s=i&&i.parentNode==e.target?ws(i):e.target.childNodes.length;return{from:o,to:n.localPosFromDOM(e.target,s,1)}}else if(e.type==`attributes`)return{from:n.posAtStart-n.border,to:n.posAtEnd+n.border};else return this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}},wd=new WeakMap,Td=!1;function Ed(e){if(!wd.has(e)&&(wd.set(e,null),[`normal`,`nowrap`,`pre-line`].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=Ys,Td)return;console.warn(`ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.`),Td=!0}}function Dd(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return ks(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function Od(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Dd(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener(`beforeinput`,r,!0),document.execCommand(`indent`),e.dom.removeEventListener(`beforeinput`,r,!0),n?Dd(e,n):null}function kd(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function Ad(e,t){let{focusNode:n,focusOffset:r}=e.domSelectionRange();for(let i of t)if(i.parentNode?.nodeName==`TR`){let t=i.nextSibling;for(;t&&t.nodeName!=`TD`&&t.nodeName!=`TH`;)t=t.nextSibling;if(t){let a=t;for(;;){let e=a.firstChild;if(!e||e.nodeType!=1||e.contentEditable==`false`||/^(BR|IMG)$/.test(e.nodeName))break;a=e}a.insertBefore(i,a.firstChild),n==i&&e.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function jd(e,t,n){let{node:r,fromOffset:i,toOffset:a,from:o,to:s}=e.docView.parseRange(t,n),c=e.domSelectionRange(),l,u=c.anchorNode;if(u&&e.dom.contains(u.nodeType==1?u:u.parentNode)&&(l=[{node:u,offset:c.anchorOffset}],Ls(c)||l.push({node:c.focusNode,offset:c.focusOffset})),Zs&&e.input.lastKeyCode===8)for(let e=a;e>i;e--){let t=r.childNodes[e-1],n=t.pmViewDesc;if(t.nodeName==`BR`&&!n){a=e;break}if(!n||n.size)break}let d=e.state.doc,f=e.someProp(`domParser`)||Ai.fromSchema(e.state.schema),p=d.resolve(o),m=null,h=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:a,preserveWhitespace:p.parent.type.whitespace==`pre`?`full`:!0,findPositions:l,ruleFromNode:Md,context:p});if(l&&l[0].pos!=null){let e=l[0].pos,t=l[1]&&l[1].pos;t??=e,m={anchor:e+o,head:t+o}}return{doc:h,sel:m,from:o,to:s}}function Md(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName==`BR`&&e.parentNode){if($s&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement(`div`);return e.appendChild(document.createElement(`li`)),{skip:e}}else if(e.parentNode.lastChild==e||$s&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName==`IMG`&&e.getAttribute(`mark-placeholder`))return{ignore:!0};return null}var Nd=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Pd(e,t,n,r,i){let a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=pl(e,t);if(n&&!e.state.selection.eq(n)){if(Zs&&rc&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp(`handleKeyDown`,t=>t(e,Rs(13,`Enter`))))return;let r=e.state.tr.setSelection(n);t==`pointer`?r.setMeta(`pointer`,!0):t==`key`&&r.scrollIntoView(),a&&r.setMeta(`composition`,a),e.dispatch(r)}return}let o=e.state.doc.resolve(t),s=o.sharedDepth(n);t=o.before(s+1),n=e.state.doc.resolve(n).after(s+1);let c=e.state.selection,l=jd(e,t,n),u=e.state.doc,d=u.slice(l.from,l.to),f,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,p=`end`):(f=e.state.selection.from,p=`start`),e.input.lastKeyCode=null;let m=zd(d.content,l.doc.content,l.from,f,p);if(m&&e.input.domChangeCount++,(ec&&e.input.lastIOSEnter>Date.now()-225||rc)&&i.some(e=>e.nodeType==1&&!Nd.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp(`handleKeyDown`,t=>t(e,Rs(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof W&&!c.empty&&c.$head.sameParent(c.$anchor)&&!e.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(l.sel){let t=Fd(e,e.state.doc,l.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);a&&n.setMeta(`composition`,a),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof W&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=l.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=l.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),qs&&Js<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>l.from&&l.doc.textBetween(m.start-l.from-1,m.start-l.from+1)==` \xA0`&&(m.start--,m.endA--,m.endB--);let h=l.doc.resolveNoCache(m.start-l.from),g=l.doc.resolveNoCache(m.endB-l.from),_=u.resolve(m.start),v=h.sameParent(g)&&h.parent.inlineContent&&_.end()>=m.endA;if((ec&&e.input.lastIOSEnter>Date.now()-225&&(!v||i.some(e=>e.nodeName==`DIV`||e.nodeName==`P`))||!v&&h.pos<l.doc.content.size&&(!h.sameParent(g)||!h.parent.inlineContent)&&h.pos<g.pos&&!/\S/.test(l.doc.textBetween(h.pos,g.pos,``,``)))&&e.someProp(`handleKeyDown`,t=>t(e,Rs(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&Ld(u,m.start,m.endA,h,g)&&e.someProp(`handleKeyDown`,t=>t(e,Rs(8,`Backspace`)))){rc&&Zs&&e.domObserver.suppressSelectionUpdates();return}Zs&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),rc&&!v&&h.start()!=g.start()&&g.parentOffset==0&&h.depth==g.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==m.endA&&(m.endB-=2,g=l.doc.resolveNoCache(m.endB-l.from),setTimeout(()=>{e.someProp(`handleKeyDown`,function(t){return t(e,Rs(13,`Enter`))})},20));let y=m.start,b=m.endA,x=t=>{let n=t||e.state.tr.replace(y,b,l.doc.slice(m.start-l.from,m.endB-l.from));if(l.sel){let t=Fd(e,n.doc,l.sel);t&&!(Zs&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==y||t.head==n.mapping.map(b)-1)||qs&&t.empty&&t.head==y)&&n.setSelection(t)}return a&&n.setMeta(`composition`,a),n.scrollIntoView()},S;if(v)if(h.pos==g.pos){qs&&Js<=11&&h.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>hl(e),20));let t=x(e.state.tr.delete(y,b)),n=u.resolve(m.start).marksAcross(u.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.endB&&(S=Id(h.parent.content.cut(h.parentOffset,g.parentOffset),_.parent.content.cut(_.parentOffset,m.endA-_.start())))){let t=x(e.state.tr);S.type==`add`?t.addMark(y,b,S.mark):t.removeMark(y,b,S.mark),e.dispatch(t)}else if(h.parent.child(h.index()).isText&&h.index()==g.index()-+!g.textOffset){let t=h.parent.textBetween(h.parentOffset,g.parentOffset),n=()=>x(e.state.tr.insertText(t,y,b));e.someProp(`handleTextInput`,r=>r(e,y,b,t,n))||e.dispatch(n())}else e.dispatch(x());else e.dispatch(x())}function Fd(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:wl(e,t.resolve(n.anchor),t.resolve(n.head))}function Id(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,a=r,o,s,c;for(let e=0;e<r.length;e++)i=r[e].removeFromSet(i);for(let e=0;e<n.length;e++)a=n[e].removeFromSet(a);if(i.length==1&&a.length==0)s=i[0],o=`add`,c=e=>e.mark(s.addToSet(e.marks));else if(i.length==0&&a.length==1)s=a[0],o=`remove`,c=e=>e.mark(s.removeFromSet(e.marks));else return null;let l=[];for(let e=0;e<t.childCount;e++)l.push(c(t.child(e)));if(B.from(l).eq(e))return{mark:s,type:o}}function Ld(e,t,n,r,i){if(n-t<=i.pos-r.pos||Rd(r,!0,!1)<i.pos)return!1;let a=e.resolve(t);if(!r.parent.isTextblock){let e=a.nodeAfter;return e!=null&&n==t+e.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let o=e.resolve(Rd(a,!0,!0));return!o.parent.isTextblock||o.pos>n||Rd(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Rd(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function zd(e,t,n,r,i){let a=e.findDiffStart(t,n),o=n+e.size,s=n+t.size;if(a==null)return null;let{a:c,b:l}=e.findDiffEnd(t,o,s);if(i==`end`){let e=Math.max(0,a-Math.min(c,l));r-=c+e-a}if(c<a&&o<s){let e=r<=a&&r>=c?a-r:0;a-=e,l=a+(l-c),c=a}else if(l<a){let e=r<=a&&r>=l?a-r:0;a-=e,c=a+(c-l),l=a}return{start:a,endA:c,endB:l}}var Bd=class{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new pu,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(qd),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement(`div`),e&&(e.appendChild?e.appendChild(this.dom):typeof e==`function`?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Ud(this),Hd(this),this.nodeViews=Gd(this),this.docView=qc(this.state.doc,Vd(this),yd(this),this.dom,this),this.domObserver=new Cd(this,(e,t,n,r)=>Pd(this,e,t,n,r)),this.domObserver.start(),mu(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&_u(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(qd),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){let n=this.state,r=!1,i=!1;e.storedMarks&&this.composing&&(Vu(this),i=!0),this.state=e;let a=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=Gd(this);Kd(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&_u(this),this.editable=Ud(this),Hd(this);let o=yd(this),s=Vd(this),c=n.plugins!=e.plugins&&!n.doc.eq(e.doc)?`reset`:e.scrollToSelection>n.scrollToSelection?`to selection`:`preserve`,l=r||!this.docView.matchesNode(e.doc,s,o);(l||!e.selection.eq(n.selection))&&(i=!0);let u=c==`preserve`&&i&&this.dom.style.overflowAnchor==null&&uc(this);if(i){this.domObserver.stop();let t=l&&(qs||Zs)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&Wd(n.selection,e.selection);if(l){let n=Zs?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Hu(this)),(r||!this.docView.update(e.doc,s,o,this))&&(this.docView.updateOuterDeco(s),this.docView.destroy(),this.docView=qc(e.doc,s,o,this.dom,this)),n&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(t=!0)}let i=this.input.mouseDown;t||!(i&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Dl(this)&&i.delaySelUpdate())?hl(this,t):(Sl(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),this.dragging?.node&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),c==`reset`?this.dom.scrollTop=0:c==`to selection`?this.scrollToSelection():u&&fc(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))&&!this.someProp(`handleScrollToSelection`,e=>e(this)))if(this.state.selection instanceof G){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&lc(this,t.getBoundingClientRect(),e)}else lc(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new Xu(e.slice,e.move,r<0?void 0:G.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(n!=null&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(i!=null&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let a=i[n].props[e];if(a!=null&&(r=t?t(a):a))return r}}hasFocus(){if(qs){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable==`false`)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&hc(this.dom),hl(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let e=this.dom.parentNode;e;e=e.parentNode)if(e.nodeType==9||e.nodeType==11&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Cc(this,e)}coordsAtPos(e,t=1){return Dc(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(r==null)throw RangeError(`DOM position not inside the editor`);return r}endOfTextblock(e,t){return Lc(this,t||this.state,e)}pasteHTML(e,t){return Ju(this,``,e,!1,t||new ClipboardEvent(`paste`))}pasteText(e,t){return Ju(this,e,null,!0,t||new ClipboardEvent(`paste`))}serializeForClipboard(e){return ql(this,e)}destroy(){this.docView&&(gu(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],yd(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Os())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return bu(this,e)}domSelectionRange(){let e=this.domSelection();return e?$s&&this.root.nodeType===11&&zs(this.dom.ownerDocument)==this.dom&&Od(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};Bd.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function Vd(e){let t=Object.create(null);return t.class=`ProseMirror`,t.contenteditable=String(e.editable),e.someProp(`attributes`,n=>{if(typeof n==`function`&&(n=n(e.state)),n)for(let e in n)e==`class`?t.class+=` `+n[e]:e==`style`?t.style=(t.style?t.style+`;`:``)+n[e]:!t[e]&&e!=`contenteditable`&&e!=`nodeName`&&(t[e]=String(n[e]))}),t.translate||=`no`,[id.node(0,e.state.doc.content.size,t)]}function Hd(e){if(e.markCursor){let t=document.createElement(`img`);t.className=`ProseMirror-separator`,t.setAttribute(`mark-placeholder`,`true`),t.setAttribute(`alt`,``),e.cursorWrapper={dom:t,deco:id.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Ud(e){return!e.someProp(`editable`,t=>t(e.state)===!1)}function Wd(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function Gd(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp(`nodeViews`,n),e.someProp(`markViews`,n),t}function Kd(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r}function qd(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError(`Plugins passed directly to the view must not have a state component`)}for(var Jd={8:`Backspace`,9:`Tab`,10:`Enter`,12:`NumLock`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,44:`PrintScreen`,45:`Insert`,46:`Delete`,59:`;`,61:`=`,91:`Meta`,92:`Meta`,106:`*`,107:`+`,108:`,`,109:`-`,110:`.`,111:`/`,144:`NumLock`,145:`ScrollLock`,160:`Shift`,161:`Shift`,162:`Control`,163:`Control`,164:`Alt`,165:`Alt`,173:`-`,186:`;`,187:`=`,188:`,`,189:`-`,190:`.`,191:`/`,192:"`",219:`[`,220:`\\`,221:`]`,222:`'`},Yd={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},Xd=typeof navigator<`u`&&/Mac/.test(navigator.platform),Zd=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Qd=0;Qd<10;Qd++)Jd[48+Qd]=Jd[96+Qd]=String(Qd);for(var Qd=1;Qd<=24;Qd++)Jd[Qd+111]=`F`+Qd;for(var Qd=65;Qd<=90;Qd++)Jd[Qd]=String.fromCharCode(Qd+32),Yd[Qd]=String.fromCharCode(Qd);for(var $d in Jd)Yd.hasOwnProperty($d)||(Yd[$d]=Jd[$d]);function ef(e){var t=!(Xd&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Zd&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?Yd:Jd)[e.keyCode]||e.key||`Unidentified`;return t==`Esc`&&(t=`Escape`),t==`Del`&&(t=`Delete`),t==`Left`&&(t=`ArrowLeft`),t==`Up`&&(t=`ArrowUp`),t==`Right`&&(t=`ArrowRight`),t==`Down`&&(t=`ArrowDown`),t}var tf=typeof navigator<`u`&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),nf=typeof navigator<`u`&&/Win/.test(navigator.platform);function rf(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n==`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e++){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))tf?o=!0:i=!0;else throw Error(`Unrecognized modifier name: `+n)}return r&&(n=`Alt-`+n),i&&(n=`Ctrl-`+n),o&&(n=`Meta-`+n),a&&(n=`Shift-`+n),n}function af(e){let t=Object.create(null);for(let n in e)t[rf(n)]=e[n];return t}function of(e,t,n=!0){return t.altKey&&(e=`Alt-`+e),t.ctrlKey&&(e=`Ctrl-`+e),t.metaKey&&(e=`Meta-`+e),n&&t.shiftKey&&(e=`Shift-`+e),e}function sf(e){return new K({props:{handleKeyDown:cf(e)}})}function cf(e){let t=af(e);return function(e,n){let r=ef(n),i,a=t[of(r,n)];if(a&&a(e.state,e.dispatch,e))return!0;if(r.length==1&&r!=` `){if(n.shiftKey){let i=t[of(r,n,!1)];if(i&&i(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(nf&&n.ctrlKey&&n.altKey)&&(i=Jd[n.keyCode])&&i!=r){let r=t[of(i,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}var lf=Object.defineProperty,uf=(e,t)=>{for(var n in t)lf(e,n,{get:t[n],enumerable:!0})};function df(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:a}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return a},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,a=n.storedMarks,n}}}var ff=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(a);return!i.getMeta(`preventDispatch`)&&!this.hasCustomState&&r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],s=!!e,c=e||i.tr,l=()=>(!s&&t&&!c.getMeta(`preventDispatch`)&&!this.hasCustomState&&a.dispatch(c),o.every(e=>e===!0)),u={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(c,t),i=n(...e)(r);return o.push(i),u}])),run:l};return u}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:e,editor:r,view:a,state:df({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(o)]))}};return o}},pf={};uf(pf,{blur:()=>mf,clearContent:()=>hf,clearNodes:()=>gf,command:()=>_f,createParagraphNear:()=>vf,cut:()=>yf,deleteCurrentNode:()=>bf,deleteNode:()=>Sf,deleteRange:()=>Cf,deleteSelection:()=>Df,enter:()=>Of,exitCode:()=>kf,extendMarkRange:()=>If,first:()=>Lf,focus:()=>Wf,forEach:()=>Gf,insertContent:()=>Kf,insertContentAt:()=>Qf,joinBackward:()=>tp,joinDown:()=>ep,joinForward:()=>np,joinItemBackward:()=>rp,joinItemForward:()=>ip,joinTextblockBackward:()=>ap,joinTextblockForward:()=>op,joinUp:()=>$f,keyboardShortcut:()=>lp,lift:()=>dp,liftEmptyBlock:()=>fp,liftListItem:()=>pp,newlineInCode:()=>mp,resetAttributes:()=>_p,scrollIntoView:()=>vp,selectAll:()=>yp,selectNodeBackward:()=>bp,selectNodeForward:()=>xp,selectParentNode:()=>Sp,selectTextblockEnd:()=>Cp,selectTextblockStart:()=>wp,setContent:()=>Ep,setMark:()=>vm,setMeta:()=>ym,setNode:()=>bm,setNodeSelection:()=>xm,setTextDirection:()=>Sm,setTextSelection:()=>Cm,sinkListItem:()=>wm,splitBlock:()=>Em,splitListItem:()=>Dm,toggleList:()=>Nm,toggleMark:()=>Pm,toggleNode:()=>Fm,toggleWrap:()=>Im,undoInputRule:()=>Lm,unsetAllMarks:()=>Rm,unsetMark:()=>zm,unsetTextDirection:()=>Bm,updateAttributes:()=>Vm,wrapIn:()=>Hm,wrapInList:()=>Um});var mf=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),hf=(e=!0)=>({commands:t})=>t.setContent(``,{emitUpdate:e}),gf=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,a=r.resolve(i.map(n)),o=r.resolve(i.map(n+e.nodeSize)),s=a.blockRange(o);if(!s)return;let c=wa(s);if(e.type.isTextblock){let{defaultType:e}=a.parent.contentMatchAt(a.index());t.setNodeMarkup(s.start,e)}(c||c===0)&&t.lift(s,c)})}),!0},_f=e=>t=>e(t),vf=()=>({state:e,dispatch:t})=>Qo(e,t),yf=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,a=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,a.content),r.setSelection(new W(r.doc.resolve(Math.max(o-1,0)))),!0},bf=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;--n)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function xf(e,t){if(typeof e==`string`){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var Sf=e=>({tr:t,state:n,dispatch:r})=>{let i=xf(e,n.schema),a=t.selection.$anchor;for(let e=a.depth;e>0;--e)if(a.node(e).type===i){if(r){let n=a.before(e),r=a.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},Cf=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},wf=e=>e.content?/^text(\*|\+)/.test(e.content):!1,Tf=(e,t,n)=>{if(!e.parent.isInline||n===`left`&&e.pos>e.start()||n===`right`&&e.pos<e.end())return e.pos;let r=t.nodes[e.parent.type.name].spec;return wf(r)?n===`left`?e.start()-1:e.end()+1:e.pos},Ef=(e,t,n)=>({from:Tf(e,n,`left`),to:Tf(t,n,`right`)}),Df=()=>({state:e,dispatch:t})=>{if(e.selection.empty)return!1;if(t){let n=e.tr,{ranges:r}=e.selection,i=n.steps.length;r.forEach(t=>{let r=n.mapping.slice(i),{from:a,to:o}=Ef(n.doc.resolve(r.map(t.$from.pos)),n.doc.resolve(r.map(t.$to.pos)),e.schema);n.deleteRange(a,o)}),n.scrollIntoView(),t(n)}return!0},Of=()=>({commands:e})=>e.keyboardShortcut(`Enter`),kf=()=>({state:e,dispatch:t})=>Zo(e,t);function Af(e){return Object.prototype.toString.call(e)===`[object RegExp]`}function jf(e,t,n={strict:!0}){let r=Object.keys(t);return r.length?r.every(r=>n.strict?t[r]===e[r]:Af(t[r])?t[r].test(e[r]):t[r]===e[r]):!0}function Mf(e,t,n={}){return e.find(e=>e.type===t&&jf(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function Nf(e,t,n={}){return!!Mf(e,t,n)}function Pf(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if((!r.node||!r.node.marks.some(e=>e.type===t))&&(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!Mf([...r.node.marks],t,n))return;let i=r.index,a=e.start()+r.offset,o=i+1,s=a+r.node.nodeSize;for(;i>0&&Nf([...e.parent.child(i-1).marks],t,n);)--i,a-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&Nf([...e.parent.child(o).marks],t,n);)s+=e.parent.child(o).nodeSize,o+=1;return{from:a,to:s}}function Ff(e,t){if(typeof e==`string`){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var If=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=Ff(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=Pf(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=W.create(o,e.from,e.to);n.setSelection(t)}}return!0},Lf=e=>t=>{let n=typeof e==`function`?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function Rf(e){return e instanceof W}function zf(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function Bf(e,t=null){if(!t)return null;let n=U.atStart(e),r=U.atEnd(e);if(t===`start`||t===!0)return n;if(t===`end`)return r;let i=n.from,a=r.to;return t===`all`?W.create(e,zf(0,i,a),zf(e.content.size,i,a)):W.create(e,zf(t,i,a),zf(t,i,a))}function Vf(){return navigator.platform===`Android`||/android/i.test(navigator.userAgent)}function Hf(){return[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`].includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`ontouchend`in document}function Uf(){return typeof navigator<`u`?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var Wf=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(Hf()||Vf())&&r.dom.focus(),Uf()&&!Hf()&&!Vf()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(a&&e===null&&!Rf(n.state.selection))return o(),!0;let s=Bf(i.doc,e)||n.state.selection,c=n.state.selection.eq(s);return a&&(c||i.setSelection(s),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},Gf=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),Kf=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),qf=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;--n){let r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&qf(r)}return e};function Jf(e){if(typeof window>`u`)throw Error(`[tiptap error]: there is no window object available, so this function cannot be used`);let t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,`text/html`).body;return qf(n)}function Yf(e,t,n){if(e instanceof ti||e instanceof B)return e;n={slice:!0,parseOptions:{},...n};let r=typeof e==`object`&&!!e,i=typeof e==`string`;if(r)try{if(Array.isArray(e)&&e.length>0)return B.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error(`[tiptap error]: Invalid JSON content`,{cause:r});return console.warn(`[tiptap warn]: Invalid content.`,`Passed value:`,e,`Error:`,r),Yf(``,t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i=``,a=new Ei({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:`inline*`,group:`block`,parseDOM:[{tag:`*`,getAttrs:e=>(r=!0,i=typeof e==`string`?e:e.outerHTML,null)}]}})});if(n.slice?Ai.fromSchema(a).parseSlice(Jf(e),n.parseOptions):Ai.fromSchema(a).parse(Jf(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error(`[tiptap error]: Invalid HTML content`,{cause:Error(`Invalid element found: ${i}`)})}let r=Ai.fromSchema(t);return n.slice?r.parseSlice(Jf(e),n.parseOptions).content:r.parse(Jf(e),n.parseOptions)}return Yf(``,t,n)}function Xf(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof _a||i instanceof va))return;let a=e.mapping.maps[r],o=0;a.forEach((e,t,n,r)=>{o===0&&(o=r)}),e.setSelection(U.near(e.doc.resolve(o),n))}var Zf=e=>!(`type`in e),Qf=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i,o=e=>{a.emit(`contentError`,{editor:a,error:e,disableCollaboration:()=>{`collaboration`in a.storage&&typeof a.storage.collaboration==`object`&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},s={preserveWhitespace:`full`,...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{Yf(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=Yf(t,a.schema,{parseOptions:s,errorOnInvalidContent:n.errorOnInvalidContent??a.options.enableContentCheck})}catch(e){return o(e),!1}let{from:c,to:l}=typeof e==`number`?{from:e,to:e}:{from:e.from,to:e.to},u=!0,d=!0;if((Zf(i)?i:[i]).forEach(e=>{e.check(),u=u?e.isText&&e.marks.length===0:!1,d=d?e.isBlock:!1}),c===l&&d){let{parent:e}=r.doc.resolve(c);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(--c,l+=1)}let f;if(u){if(Array.isArray(t))f=t.map(e=>e.text||``).join(``);else if(t instanceof B){let e=``;t.forEach(t=>{t.text&&(e+=t.text)}),f=e}else f=typeof t==`object`&&t&&t.text?t.text:t;r.insertText(f,c,l)}else{f=i;let e=r.doc.resolve(c),t=e.node(),n=e.parentOffset===0,a=t.isText||t.isTextblock,o=t.content.size>0;n&&a&&o&&d&&(c=Math.max(0,c-1)),r.replaceWith(c,l,f)}n.updateSelection&&Xf(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta(`applyInputRules`,{from:c,text:f}),n.applyPasteRules&&r.setMeta(`applyPasteRules`,{from:c,text:f})}return!0},$f=()=>({state:e,dispatch:t})=>Ko(e,t),ep=()=>({state:e,dispatch:t})=>qo(e,t),tp=()=>({state:e,dispatch:t})=>Fo(e,t),np=()=>({state:e,dispatch:t})=>Uo(e,t),rp=()=>({state:e,dispatch:t,tr:n})=>{try{let r=Va(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},ip=()=>({state:e,dispatch:t,tr:n})=>{try{let r=Va(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},ap=()=>({state:e,dispatch:t})=>Io(e,t),op=()=>({state:e,dispatch:t})=>Lo(e,t);function sp(){return typeof navigator<`u`?/Mac/.test(navigator.platform):!1}function cp(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n===`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e+=1){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))Hf()||sp()?o=!0:i=!0;else throw Error(`Unrecognized modifier name: ${n}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),a&&(n=`Shift-${n}`),n}var lp=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=cp(e).split(/-(?!$)/),o=a.find(e=>![`Alt`,`Ctrl`,`Meta`,`Shift`].includes(e)),s=new KeyboardEvent(`keydown`,{key:o===`Space`?` `:o,altKey:a.includes(`Alt`),ctrlKey:a.includes(`Ctrl`),metaKey:a.includes(`Meta`),shiftKey:a.includes(`Shift`),bubbles:!0,cancelable:!0});return t.captureTransaction(()=>{n.someProp(`handleKeyDown`,e=>e(n,s))})?.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function up(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?xf(t,e.schema):null,s=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);s.push({node:e,from:n,to:a})});let c=i-r,l=s.filter(e=>o?o.name===e.node.type.name:!0).filter(e=>jf(e.node.attrs,n,{strict:!1}));return a?!!l.length:l.reduce((e,t)=>e+t.to-t.from,0)>=c}var dp=(e,t={})=>({state:n,dispatch:r})=>up(n,xf(e,n.schema),t)?Jo(n,r):!1,fp=()=>({state:e,dispatch:t})=>$o(e,t),pp=e=>({state:t,dispatch:n})=>bs(xf(e,t.schema))(t,n),mp=()=>({state:e,dispatch:t})=>Yo(e,t);function hp(e,t){return t.nodes[e]?`node`:t.marks[e]?`mark`:null}function gp(e,t){let n=typeof t==`string`?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var _p=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=hp(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=xf(e,r.schema)),s===`mark`&&(o=Ff(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,gp(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(a=>{o===a.type&&(c=!0,i&&n.addMark(r,r+e.nodeSize,o.create(gp(a.attrs,t))))})})}),c},vp=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),yp=()=>({tr:e,dispatch:t})=>{if(t){let t=new _o(e.doc);e.setSelection(t)}return!0},bp=()=>({state:e,dispatch:t})=>Bo(e,t),xp=()=>({state:e,dispatch:t})=>Wo(e,t),Sp=()=>({state:e,dispatch:t})=>ns(e,t),Cp=()=>({state:e,dispatch:t})=>ls(e,t),wp=()=>({state:e,dispatch:t})=>cs(e,t);function Tp(e,t,n={},r={}){return Yf(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var Ep=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:c}=a;if(r.preserveWhitespace!==`full`){let s=Tp(e,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});return o&&a.replaceWith(0,c.content.size,s).setMeta(`preventUpdate`,!n),!0}return o&&a.setMeta(`preventUpdate`,!n),s.insertContentAt({from:0,to:c.content.size},e,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})};function Dp(e,t){let n=Ff(t,e.schema),{from:r,to:i,empty:a}=e.selection,o=[];a?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{o.push(...e.marks)});let s=o.find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}function Op(e,t){let n=new lo(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function kp(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Ap(e,t){for(let n=e.depth;n>0;--n){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function jp(e){return t=>Ap(t.$from,e)}function J(e,t,n){return e.config[t]===void 0&&e.parent?J(e.parent,t,n):typeof e.config[t]==`function`?e.config[t].bind({...n,parent:e.parent?J(e.parent,t,n):null}):e.config[t]}function Mp(e){return e.map(e=>{let t=J(e,`addExtensions`,{name:e.name,options:e.options,storage:e.storage});return t?[e,...Mp(t())]:e}).flat(10)}function Np(e,t){let n=Wi.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement(`div`);return r.appendChild(n),r.innerHTML}function Pp(e){return typeof e==`function`}function Y(e,t=void 0,...n){return Pp(e)?t?e.bind(t)(...n):e(...n):e}function Fp(e={}){return Object.keys(e).length===0&&e.constructor===Object}function Ip(e){return{baseExtensions:e.filter(e=>e.type===`extension`),nodeExtensions:e.filter(e=>e.type===`node`),markExtensions:e.filter(e=>e.type===`mark`)}}function Lp(e){let t=[],{nodeExtensions:n,markExtensions:r}=Ip(e),i=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(e=>e.name!==`text`).map(e=>e.name),s=r.map(e=>e.name),c=[...o,...s];return e.forEach(e=>{let n=J(e,`addGlobalAttributes`,{name:e.name,options:e.options,storage:e.storage,extensions:i});n&&n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:e.types===`*`?c:e.types===`nodes`?o:e.types===`marks`?s:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...a,...r}})})})})}),i.forEach(e=>{let n=J(e,`addAttributes`,{name:e.name,options:e.options,storage:e.storage});if(!n)return;let r=n();Object.entries(r).forEach(([n,r])=>{let i={...a,...r};typeof i?.default==`function`&&(i.default=i.default()),i?.isRequired&&i?.default===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function Rp(e){let t=[],n=``,r=!1,i=!1,a=0,o=e.length;for(let s=0;s<o;s+=1){let o=e[s];if(o===`'`&&!i){r=!r,n+=o;continue}if(o===`"`&&!r){i=!i,n+=o;continue}if(!r&&!i){if(o===`(`){a+=1,n+=o;continue}if(o===`)`&&a>0){--a,n+=o;continue}if(o===`;`&&a===0){t.push(n),n=``;continue}}n+=o}return n&&t.push(n),t}function zp(e){let t=[],n=Rp(e||``),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],i=r.indexOf(`:`);if(i===-1)continue;let a=r.slice(0,i).trim(),o=r.slice(i+1).trim();a&&o&&t.push([a,o])}return t}function Bp(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(!n[e]){n[e]=t;return}if(e===`class`){let r=t?String(t).split(` `):[],i=n[e]?n[e].split(` `):[],a=r.filter(e=>!i.includes(e));n[e]=[...i,...a].join(` `)}else if(e===`style`){let r=new Map([...zp(n[e]),...zp(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join(`; `)}else n[e]=t}),n},{})}function Vp(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>Bp(e,t),{})}function Hp(e){return typeof e==`string`?e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e===`true`?!0:e===`false`?!1:e:e}function Up(e,t){return`style`in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;let i=t.reduce((e,t)=>{let r=t.attribute.parseHTML?t.attribute.parseHTML(n):Hp(n.getAttribute(t.name));return r==null?e:{...e,[t.name]:r}},{});return{...r,...i}}}}function Wp(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>e===`attrs`&&Fp(t)?!1:t!=null))}function Gp(e){let t={};return!e?.attribute?.isRequired&&`default`in(e?.attribute||{})&&(t.default=e.attribute.default),e?.attribute?.validate!==void 0&&(t.validate=e.attribute.validate),[e.name,t]}function Kp(e,t){let n=Lp(e),{nodeExtensions:r,markExtensions:i}=Ip(e);return new Ei({topNode:r.find(e=>J(e,`topNode`))?.name,nodes:Object.fromEntries(r.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=Wp({...e.reduce((e,t)=>{let n=J(t,`extendNodeSchema`,a);return{...e,...n?n(r):{}}},{}),content:Y(J(r,`content`,a)),marks:Y(J(r,`marks`,a)),group:Y(J(r,`group`,a)),inline:Y(J(r,`inline`,a)),atom:Y(J(r,`atom`,a)),selectable:Y(J(r,`selectable`,a)),draggable:Y(J(r,`draggable`,a)),code:Y(J(r,`code`,a)),whitespace:Y(J(r,`whitespace`,a)),linebreakReplacement:Y(J(r,`linebreakReplacement`,a)),defining:Y(J(r,`defining`,a)),isolating:Y(J(r,`isolating`,a)),attrs:Object.fromEntries(i.map(Gp))}),s=Y(J(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>Up(e,i)));let c=J(r,`renderHTML`,a);c&&(o.toDOM=e=>c({node:e,HTMLAttributes:Vp(e,i)}));let l=J(r,`renderText`,a);return l&&(o.toText=l),[r.name,o]})),marks:Object.fromEntries(i.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=Wp({...e.reduce((e,t)=>{let n=J(t,`extendMarkSchema`,a);return{...e,...n?n(r):{}}},{}),inclusive:Y(J(r,`inclusive`,a)),excludes:Y(J(r,`excludes`,a)),group:Y(J(r,`group`,a)),spanning:Y(J(r,`spanning`,a)),code:Y(J(r,`code`,a)),attrs:Object.fromEntries(i.map(Gp))}),s=Y(J(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>Up(e,i)));let c=J(r,`renderHTML`,a);return c&&(o.toDOM=e=>c({mark:e,HTMLAttributes:Vp(e,i)})),[r.name,o]}))})}function qp(e){let t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}function Jp(e){return e.sort((e,t)=>{let n=J(e,`priority`)||100,r=J(t,`priority`)||100;return n>r?-1:+(n<r)})}function Yp(e){let t=Jp(Mp(e)),n=qp(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(`, `)}]. This can lead to issues.`),t}function Xp(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=`
11
+
12
+ `,textSerializers:o={}}=n||{},s=``;return e.nodesBetween(r,i,(e,n,c,l)=>{e.isBlock&&n>r&&(s+=a);let u=o?.[e.type.name];if(u)return c&&(s+=u({node:e,pos:n,parent:c,index:l,range:t})),!1;e.isText&&(s+=(e?.text)?.slice(Math.max(r,n)-n,i-n))}),s}function Zp(e,t){return Xp(e,{from:0,to:e.content.size},t)}function Qp(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function $p(e,t){let n=xf(t,e.schema),{from:r,to:i}=e.selection,a=[];e.doc.nodesBetween(r,i,e=>{a.push(e)});let o=a.reverse().find(e=>e.type.name===n.name);return o?{...o.attrs}:{}}function em(e,t){let n=hp(typeof t==`string`?t:t.name,e.schema);return n===`node`?$p(e,t):n===`mark`?Dp(e,t):{}}function tm(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function nm(e){let t=tm(e);return t.length===1?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function rm(e){let{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,i)=>{let a=[];if(e.ranges.length)e.forEach((e,t)=>{a.push({from:e,to:t})});else{let{from:e,to:t}=n[i];if(e===void 0||t===void 0)return;a.push({from:e,to:t})}a.forEach(({from:e,to:n})=>{let a=t.slice(i).map(e,-1),o=t.slice(i).map(n),s=t.invert().map(a,-1),c=t.invert().map(o);r.push({oldRange:{from:s,to:c},newRange:{from:a,to:o}})})}),nm(r)}function im(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=Pf(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{!e||e?.nodeSize===void 0||r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}function am(e,t){return t.nodes[e]||t.marks[e]||null}function om(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return r?r.attribute.keepOnSplit:!1}))}var sm=(e,t=500)=>{let n=``,r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,a)=>{var o;let s=(o=e.type.spec).toText?.call(o,{node:e,pos:t,parent:i,index:a})||e.textContent||`%leaf%`;n+=e.isAtom&&!e.isText?s:s.slice(0,Math.max(0,r-t))}),n};function cm(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?Ff(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>a?a.name===e.type.name:!0).find(e=>jf(e.attrs,n,{strict:!1}));let o=0,s=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(a&&e.inlineContent&&!e.type.allowsMarkType(a))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),c=Math.min(i,t+e.nodeSize),l=c-n;o+=l,s.push(...e.marks.map(e=>({mark:e,from:n,to:c})))})}),o===0)return!1;let c=s.filter(e=>a?a.name===e.mark.type.name:!0).filter(e=>jf(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),l=s.filter(e=>a?e.mark.type!==a&&e.mark.type.excludes(a):!0).reduce((e,t)=>e+t.to-t.from,0);return(c>0?c+l:c)>=o}function lm(e,t,n={}){if(!t)return up(e,null,n)||cm(e,null,n);let r=hp(t,e.schema);return r===`node`?up(e,t,n):r===`mark`?cm(e,t,n):!1}function um(e,t){return Array.isArray(t)?t.some(t=>(typeof t==`string`?t:t.name)===e.name):t}function dm(e,t){let{nodeExtensions:n}=Ip(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=Y(J(r,`group`,{name:r.name,options:r.options,storage:r.storage}));return typeof i==`string`?i.split(` `).includes(`list`):!1}function fm(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if(e.type.name===`hardBreak`)return!0;if(e.isText)return!/\S/.test(e.text??``)}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let r=!0;return e.content.forEach(e=>{r!==!1&&(fm(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function pm(e){return e instanceof G}var mm=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function hm(e,t){let n=t.mapping.mapResult(e.position);return{position:new mm(n.pos),mapResult:n}}function gm(e){return new mm(e)}function _m(e,t,n){let{selection:r}=t,i=null;if(Rf(r)&&(i=r.$cursor),i){let t=e.storedMarks??i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:a}=r;return a.some(({$from:t,$to:r})=>{let i=t.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),a=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&a}return!i}),i})}var vm=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=Ff(e,r.schema);if(i)if(o){let e=Dp(r,c);n.addStoredMark(c.create({...e,...t}))}else s.forEach(e=>{let i=e.$from.pos,a=e.$to.pos;r.doc.nodesBetween(i,a,(e,r)=>{let o=Math.max(r,i),s=Math.min(r+e.nodeSize,a);e.marks.find(e=>e.type===c)?e.marks.forEach(e=>{c===e.type&&n.addMark(o,s,c.create({...e.attrs,...t}))}):n.addMark(o,s,c.create(t))})});return _m(r,n,c)},ym=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),bm=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=xf(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>ds(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>ds(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},xm=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=zf(e,0,n.content.size),i=G.create(n,r);t.setSelection(i)}return!0},Sm=(e,t)=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=r,o,s;return typeof t==`number`?(o=t,s=t):t&&`from`in t&&`to`in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},Cm=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=W.atStart(n).from,o=W.atEnd(n).to,s=zf(r,a,o),c=zf(i,a,o),l=W.create(n,s,c);t.setSelection(l)}return!0},wm=e=>({state:t,dispatch:n})=>Cs(xf(e,t.schema))(t,n);function Tm(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>t?.includes(e.type.name));e.tr.ensureMarks(r)}}var Em=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:a,doc:o}=t,{$from:s,$to:c}=a,l=i.extensionManager.attributes,u=om(l,s.node().type.name,s.node().attrs);if(a instanceof G&&a.node.isBlock)return!s.parentOffset||!Ia(o,s.pos)?!1:(r&&(e&&Tm(n,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;let d=c.parentOffset===c.parent.content.size,f=s.depth===0?void 0:kp(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,m=Ia(t.doc,t.mapping.map(s.pos),1,p);if(!p&&!m&&Ia(t.doc,t.mapping.map(s.pos),1,f?[{type:f}]:void 0)&&(m=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(m&&(a instanceof W&&t.deleteSelection(),t.split(t.mapping.map(s.pos),1,p),f&&!d&&!s.parentOffset&&s.parent.type!==f)){let e=t.mapping.map(s.before()),n=t.doc.resolve(e);s.node(-1).canReplaceWith(n.index(),n.index()+1,f)&&t.setNodeMarkup(t.mapping.map(s.before()),f)}e&&Tm(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return m},Dm=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{let o=xf(e,r.schema),{$from:s,$to:c}=r.selection,l=r.selection.node;if(l&&l.isBlock||s.depth<2||!s.sameParent(c))return!1;let u=s.node(-1);if(u.type!==o)return!1;let d=a.extensionManager.attributes;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==o||s.index(-2)!==s.node(-2).childCount-1)return!1;if(i){let e=B.empty,r=s.index(-1)?1:s.index(-2)?2:3;for(let t=s.depth-r;t>=s.depth-3;--t)e=B.from(s.node(t).copy(e));let i=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3,a={...om(d,s.node().type.name,s.node().attrs),...t},c=o.contentMatch.defaultType?.createAndFill(a)||void 0;e=e.append(B.from(o.createAndFill(null,c)||void 0));let l=s.before(s.depth-(r-1));n.replace(l,s.after(-i),new H(e,4-r,0));let u=-1;n.doc.nodesBetween(l,n.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&e.content.size===0&&(u=t+1)}),u>-1&&n.setSelection(W.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=c.pos===s.end()?u.contentMatchAt(0).defaultType:null,p={...om(d,u.type.name,u.attrs),...t},m={...om(d,s.node().type.name,s.node().attrs),...t};n.delete(s.pos,c.pos);let h=f?[{type:o,attrs:p},{type:f,attrs:m}]:[{type:o,attrs:p}];if(!Ia(n.doc,s.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:o}=a.extensionManager,c=t||e.$to.parentOffset&&e.$from.marks();if(n.split(s.pos,2,h).scrollIntoView(),!c||!i)return!0;let l=c.filter(e=>o.includes(e.type.name));n.ensureMarks(l)}return!0};function Om(e){return!e||e===`1`?null:e}function km(e,t){return Om(e)===Om(t)}var Am=(e,t)=>{let n=jp(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===i?.type&&Ra(e.doc,n.pos))||!km(n.node.attrs.type,i?.attrs.type)||e.join(n.pos),!0},jm=(e,t)=>{let n=jp(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===i?.type&&Ra(e.doc,r))||!km(n.node.attrs.type,i?.attrs.type)||e.join(r),!0};function Mm(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return W.between(r,i)}var Nm=(e,t,n,r={})=>({editor:i,tr:a,state:o,dispatch:s,chain:c,commands:l,can:u})=>{let{extensions:d,splittableMarks:f}=i.extensionManager,p=xf(e,o.schema),m=xf(t,o.schema),{selection:h,storedMarks:g}=o,{$from:_,$to:v}=h,y=_.blockRange(v),b=g||h.$to.parentOffset&&h.$from.marks();if(!y)return!1;let x=jp(e=>dm(e.type.name,d))(h),S=h.from===0&&h.to===o.doc.content.size,C=o.doc.content.content,w=C.length===1?C[0]:null,T=S&&w&&dm(w.type.name,d)?{node:w,pos:0,depth:0}:null,E=x??T,D=!!x&&y.depth>=1&&y.depth-x.depth<=1,O=!!T;if((D||O)&&E){if(E.node.type===p)return S&&O?c().command(({tr:e,dispatch:t})=>{let n=Mm(e);return n?(e.setSelection(n),t&&t(e),!0):!1}).liftListItem(m).run():l.liftListItem(m);if(dm(E.node.type.name,d)&&p.validContent(E.node.content))return c().command(()=>(a.setNodeMarkup(E.pos,p),!0)).command(()=>Am(a,p)).command(()=>jm(a,p)).run()}return!n||!b||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>Am(a,p)).command(()=>jm(a,p)).run():c().command(()=>{let e=u().wrapInList(p,r),t=b.filter(e=>f.includes(e.type.name));return a.ensureMarks(t),e?!0:l.clearNodes()}).wrapInList(p,r).command(()=>Am(a,p)).command(()=>jm(a,p)).run()},Pm=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=Ff(e,r.schema);return cm(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},Fm=(e,t,n={})=>({state:r,commands:i})=>{let a=xf(e,r.schema),o=xf(t,r.schema),s=up(r,a,n),c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),s?i.setNode(o,c):i.setNode(a,{...c,...n})},Im=(e,t={})=>({state:n,commands:r})=>{let i=xf(e,n.schema);return up(n,i,t)?r.lift(i):r.wrapIn(i,t)},Lm=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i=n[r],a;if(i.spec.isInputRules&&(a=i.getState(e))){if(t){let t=e.tr,n=a.transform;for(let e=n.steps.length-1;e>=0;--e)t.step(n.steps[e].invert(n.docs[e]));if(a.text){let n=t.doc.resolve(a.from).marks();t.replaceWith(a.from,a.to,e.schema.text(a.text,n))}else t.delete(a.from,a.to)}return!0}}return!1},Rm=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{ignoreClearable:i=!1}=e,{selection:a}=t,{empty:o,ranges:s}=a;if(o)return!0;let{nonClearableMarks:c}=r.extensionManager;if(n){let e=Object.values(r.schema.marks).filter(e=>i||!c.includes(e.name));s.forEach(n=>{for(let r of e)t.removeMark(n.$from.pos,n.$to.pos,r)})}return!0},zm=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=Ff(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){let{from:e,to:t}=o,r=Pf(c,s,c.marks().find(e=>e.type===s)?.attrs);r&&(e=r.from,t=r.to),n.removeMark(e,t,s)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,s)});return n.removeStoredMark(s),!0},Bm=e=>({tr:t,state:n,dispatch:r})=>{let{selection:i}=n,a,o;return typeof e==`number`?(a=e,o=e):e&&`from`in e&&`to`in e?(a=e.from,o=e.to):(a=i.from,o=i.to),r&&t.doc.nodesBetween(a,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},Vm=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=hp(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=xf(e,r.schema)),s===`mark`&&(o=Ff(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{let s=e.$from.pos,l=e.$to.pos,u,d,f,p;n.selection.empty?r.doc.nodesBetween(s,l,(e,t)=>{a&&a===e.type&&(c=!0,f=Math.max(t,s),p=Math.min(t+e.nodeSize,l),u=t,d=e)}):r.doc.nodesBetween(s,l,(e,r)=>{r<s&&a&&a===e.type&&(c=!0,f=Math.max(r,s),p=Math.min(r+e.nodeSize,l),u=r,d=e),r>=s&&r<=l&&(a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),o&&e.marks.length&&e.marks.forEach(a=>{if(o===a.type&&(c=!0,i)){let i=Math.max(r,s),c=Math.min(r+e.nodeSize,l);n.addMark(i,c,o.create({...a.attrs,...t}))}}))}),d&&(u!==void 0&&i&&n.setNodeMarkup(u,void 0,{...d.attrs,...t}),o&&d.marks.length&&d.marks.forEach(e=>{o===e.type&&i&&n.addMark(f,p,o.create({...e.attrs,...t}))}))}),c},Hm=(e,t={})=>({state:n,dispatch:r})=>us(xf(e,n.schema),t)(n,r),Um=(e,t={})=>({state:n,dispatch:r})=>_s(xf(e,n.schema),t)(n,r),Wm=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}};function Gm(e,t,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:``}]`);if(r!==null)return r;let i=document.createElement(`style`);return t&&i.setAttribute(`nonce`,t),i.setAttribute(`data-tiptap-style${n?`-${n}`:``}`,``),i.innerHTML=e,document.getElementsByTagName(`head`)[0].appendChild(i),i}function Km(e,t){let n=e.getAttribute(`style`);if(!n)return null;let r=n.split(`;`).map(e=>e.trim()).filter(Boolean),i=t.toLowerCase();for(let e=r.length-1;e>=0;--e){let t=r[e],n=t.indexOf(`:`);if(n!==-1&&t.slice(0,n).trim().toLowerCase()===i)return t.slice(n+1).trim()}return null}function qm(e){return typeof e==`number`}function Jm(e){return Object.prototype.toString.call(e).slice(8,-1)}function Ym(e){return Jm(e)===`Object`?e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype:!1}uf({},{createAtomBlockMarkdownSpec:()=>Qm,createBlockMarkdownSpec:()=>$m,createInlineMarkdownSpec:()=>nh,parseAttributes:()=>Xm,parseIndentedBlocks:()=>rh,renderNestedMarkdownContent:()=>ih,serializeAttributes:()=>Zm});function Xm(e){if(!e?.trim())return{};let t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([\w-]+)/g);i&&(t.class=i.map(e=>e.trim().slice(1)).join(` `));let a=r.match(/(?:^|\s)#([\w-]+)/);a&&(t.id=a[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{let i=n[parseInt(r.match(/__QUOTED_(\d+)__/)?.[1]||`0`,10)];i&&(t[e]=i.slice(1,-1))});let o=r.replace(/(?:^|\s)\.([\w-]+)/g,``).replace(/(?:^|\s)#([\w-]+)/g,``).replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,``).trim();return o&&o.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function Zm(e){if(!e||Object.keys(e).length===0)return``;let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{e===`class`||e===`id`||(n===!0?t.push(e):n!==!1&&n!=null&&t.push(`${e}="${String(n)}"`))}),t.join(` `)}function Qm(e){let{nodeName:t,name:n,parseAttributes:r=Xm,serializeAttributes:i=Zm,defaultAttributes:a={},requiredAttributes:o=[],allowedAttributes:s}=e,c=n||t,l=e=>{if(!s)return e;let t={};return s.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let r={...a,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:`block`,start(e){let t=RegExp(`^:::${c}(?:\\s|$)`,`m`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,i){let a=RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),s=e.match(a);if(!s)return;let l=r(s[1]||``);if(!o.find(e=>!(e in l)))return{type:t,raw:s[0],attributes:l}}},renderMarkdown:e=>{let t=i(l(e.attrs||{}));return`:::${c}${t?` {${t}}`:``} :::`}}}function $m(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=Xm,serializeAttributes:a=Zm,defaultAttributes:o={},content:s=`block`,allowedAttributes:c}=e,l=n||t,u=e=>{if(!c)return e;let t={};return c.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let i;if(r){let t=r(e);i=typeof t==`string`?[{type:`text`,text:t}]:t}else i=s===`block`?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);let a={...o,...e.attributes};return n.createNode(t,a,i)},markdownTokenizer:{name:t,level:`block`,start(e){let t=RegExp(`^:::${l}`,`m`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,r){let a=RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),o=e.match(a);if(!o)return;let[c,u=``]=o,d=i(u),f=1,p=c.length,m=``,h=/^:::([\w-]*)(\s.*)?/gm,g=e.slice(p);for(h.lastIndex=0;;){let n=h.exec(g);if(n===null)break;let i=n.index,a=n[1];if(!n[2]?.endsWith(`:::`)){if(a)f+=1;else if(--f,f===0){let a=g.slice(0,i);m=a.trim();let o=e.slice(0,p+i+n[0].length),c=[];if(m)if(s===`block`)for(c=r.blockTokens(a),c.forEach(e=>{e.text&&(!e.tokens||e.tokens.length===0)&&(e.tokens=r.inlineTokens(e.text))});c.length>0;){let e=c[c.length-1];if(e.type===`paragraph`&&(!e.text||e.text.trim()===``))c.pop();else break}else c=r.inlineTokens(m);return{type:t,raw:o,attributes:d,content:m,tokens:c}}}}}},renderMarkdown:(e,t)=>{let n=a(u(e.attrs||{}));return`:::${l}${n?` {${n}}`:``}
13
+
14
+ ${t.renderChildren(e.content||[],`
15
+
16
+ `)}
17
+
18
+ :::`}}}function eh(e){if(!e.trim())return{};let t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;r!==null;){let[,i,a,o]=r;t[i]=a||o,r=n.exec(e)}return t}function th(e){return Object.entries(e).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(` `)}function nh(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=eh,serializeAttributes:a=th,defaultAttributes:o={},selfClosing:s=!1,allowedAttributes:c}=e,l=n||t,u=e=>{if(!c)return e;let t={};return c.forEach(n=>{let r=typeof n==`string`?n:n.name,i=typeof n==`string`?void 0:n.skipIfDefault;if(r in e){let n=e[r];if(i!==void 0&&n===i)return;t[r]=n}}),t},d=l.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return{parseMarkdown:(e,n)=>{let i={...o,...e.attributes};if(s)return n.createNode(t,i);let a=r?r(e):e.content||``;return a?n.createNode(t,i,[n.createTextNode(a)]):n.createNode(t,i,[])},markdownTokenizer:{name:t,level:`inline`,start(e){let t=RegExp(s?`\\[${d}\\s*[^\\]]*\\]`:`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,r){let a=RegExp(s?`^\\[${d}\\s*([^\\]]*)\\]`:`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),o=e.match(a);if(!o)return;let c=``,l=``;if(s){let[,e]=o;l=e}else{let[,e,t]=o;l=e,c=t||``}let u=i(l.trim());return{type:t,raw:o[0],content:c.trim(),attributes:u}}},renderMarkdown:e=>{let t=``;r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>e.type===`text`).map(e=>e.text).join(``));let n=a(u(e.attrs||{})),i=n?` ${n}`:``;return s?`[${l}${i}]`:`[${l}${i}]${t}[/${l}]`}}}function rh(e,t,n){let r=e.split(`
19
+ `),i=[],a=``,o=0,s=t.baseIndentSize||2;for(;o<r.length;){let e=r[o],c=e.match(t.itemPattern);if(!c){if(i.length>0)break;if(e.trim()===``){o+=1,a=`${a}${e}
20
+ `;continue}else return}let l=t.extractItemData(c),{indentLevel:u,mainContent:d}=l;a=`${a}${e}
21
+ `;let f=[d];for(o+=1;o<r.length;){let e=r[o];if(e.trim()===``){let t=r.slice(o+1).findIndex(e=>e.trim()!==``);if(t===-1)break;if((r[o+1+t].match(/^(\s*)/)?.[1]?.length||0)>u){f.push(e),a=`${a}${e}
22
+ `,o+=1;continue}else break}if((e.match(/^(\s*)/)?.[1]?.length||0)>u)f.push(e),a=`${a}${e}
23
+ `,o+=1;else break}let p,m=f.slice(1);if(m.length>0){let e=m.map(e=>e.slice(u+s)).join(`
24
+ `);e.trim()&&(p=t.customNestedParser?t.customNestedParser(e):n.blockTokens(e))}let h=t.createToken(l,p);i.push(h)}if(i.length!==0)return{items:i,raw:a}}function ih(e,t,n,r){if(!e||!Array.isArray(e.content))return``;let i=typeof n==`function`?n(r):n,[a,...o]=e.content,s=`${i}${t.renderChildren([a])}`;return o&&o.length>0&&o.forEach((e,n)=>{let r=t.renderChild?.call(t,e,n+1)??t.renderChildren([e]);if(r!=null){let n=r.split(`
25
+ `).map(e=>e?t.indent(e):t.indent(``)).join(`
26
+ `);s+=e.type===`paragraph`?`
27
+
28
+ ${n}`:`
29
+ ${n}`}}),s}function ah(e,t){let n={...e};return Ym(e)&&Ym(t)&&Object.keys(t).forEach(r=>{Ym(t[r])&&Ym(e[r])?n[r]=ah(e[r],t[r]):n[r]=t[r]}),n}function oh(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants((t,r)=>{let i=a.mapping.map(r),s=a.mapping.map(r)+t.nodeSize,c=null;if(t.marks.forEach(e=>{if(e!==o)return!1;c=e}),!c)return;let l=!1;if(Object.keys(n).forEach(e=>{n[e]!==c.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});a.removeMark(i,s,e.type),a.addMark(i,s,t)}}),a.docChanged&&t.view.dispatch(a)}var sh=class{constructor(e){this.find=e.find,this.handler=e.handler,this.undoable=e.undoable??!0}},ch=(e,t)=>{if(Af(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn(`[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".`),r.push(n.replaceWith)),r};function lh(e){let{editor:t,from:n,to:r,text:i,rules:a,plugin:o}=e,{view:s}=t;if(s.composing)return!1;let c=s.state.doc.resolve(n);if(c.parent.type.spec.code||(c.nodeBefore||c.nodeAfter)?.marks.find(e=>e.type.spec.code))return!1;let l=!1,u=sm(c)+i;return a.forEach(e=>{if(l)return;let a=ch(u,e.find);if(!a)return;let c=s.state.tr,d=df({state:s.state,transaction:c}),f={from:n-(a[0].length-i.length),to:r},{commands:p,chain:m,can:h}=new ff({editor:t,state:d});e.handler({state:d,range:f,match:a,commands:p,chain:m,can:h})===null||!c.steps.length||(e.undoable&&c.setMeta(o,{transform:c,from:n,to:r,text:i}),s.dispatch(c),l=!0)}),l}function uh(e){let{editor:t,rules:n}=e,r=new K({state:{init(){return null},apply(e,i,a){let o=e.getMeta(r);if(o)return o;let s=e.getMeta(`applyInputRules`);return s&&setTimeout(()=>{let{text:e}=s;e=typeof e==`string`?e:Np(B.from(e),a.schema);let{from:i}=s;lh({editor:t,from:i,to:i+e.length,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput(e,i,a,o){return lh({editor:t,from:i,to:a,text:o,rules:n,plugin:r})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&lh({editor:t,from:i.pos,to:i.pos,text:``,rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if(i.key!==`Enter`)return!1;let{$cursor:a}=e.state.selection;return a?lh({editor:t,from:a.pos,to:a.pos,text:`
30
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var dh=class{constructor(e={}){this.type=`extendable`,this.parent=null,this.child=null,this.name=``,this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...Y(J(this,`addOptions`,{name:this.name}))}}get storage(){return{...Y(J(this,`addStorage`,{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>ah(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name=`name`in e?e.name:t.parent.name,t}},fh=class e extends dh{constructor(){super(...arguments),this.type=`mark`}static create(t={}){return new e(typeof t==`function`?t():t)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>e?.type.name===t.name))return!1;let a=i.find(e=>e?.type.name===t.name);return a&&n.removeStoredMark(a),n.insertText(` `,r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},ph=class{constructor(e){this.find=e.find,this.handler=e.handler}},mh=(e,t,n)=>{if(Af(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn(`[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".`),n.push(t.replaceWith)),n}):[]};function hh(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:c,chain:l,can:u}=new ff({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,i,(e,t)=>{if(e.type?.spec?.code||!(e.isText||e.isTextblock||e.isInline))return;let f=e.content?.size??e.nodeSize??0,p=Math.max(r,t),m=Math.min(i,t+f);p>=m||mh(e.isText?e.text||``:e.textBetween(p-t,m-t,void 0,``),a.find,o).forEach(e=>{if(e.index===void 0)return;let t=p+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},f=a.handler({state:n,range:i,match:e,commands:c,chain:l,can:u,pasteEvent:o,dropEvent:s});d.push(f)})}),d.every(e=>e!==null)}var gh=null,_h=e=>{var t;let n=new ClipboardEvent(`paste`,{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData(`text/html`,e),n};function vh(e){let{editor:t,rules:n}=e,r=null,i=!1,a=!1,o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,s;try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}let c=({state:e,from:n,to:r,rule:i,pasteEvt:a})=>{let c=e.tr;if(!(!hh({editor:t,state:df({state:e,transaction:c}),from:Math.max(n-1,0),to:r.b-1,rule:i,pasteEvent:a,dropEvent:s})||!c.steps.length)){try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}return o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,c}};return n.map(e=>new K({view(e){let n=n=>{r=e.dom.parentElement?.contains(n.target)?e.dom.parentElement:null,r&&(gh=t)},i=()=>{gh&&=null};return window.addEventListener(`dragstart`,n),window.addEventListener(`dragend`,i),{destroy(){window.removeEventListener(`dragstart`,n),window.removeEventListener(`dragend`,i)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(a=r===e.dom.parentElement,s=t,!a){let e=gh;e?.isEditable&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{let n=t.clipboardData?.getData(`text/html`);return o=t,i=!!n?.includes(`data-pm-slice`),!1}}},appendTransaction:(t,n,r)=>{let s=t[0],l=s.getMeta(`uiEvent`)===`paste`&&!i,u=s.getMeta(`uiEvent`)===`drop`&&!a,d=s.getMeta(`applyPasteRules`),f=!!d;if(!l&&!u&&!f)return;if(f){let{text:t}=d;t=typeof t==`string`?t:Np(B.from(t),r.schema);let{from:n}=d,i=n+t.length,a=_h(t);return c({rule:e,state:r,from:n,to:{b:i},pasteEvt:a})}let p=n.doc.content.findDiffStart(r.doc.content),m=n.doc.content.findDiffEnd(r.doc.content);if(!(!qm(p)||!m||p===m.b))return c({rule:e,state:r,from:p,to:m,pasteEvt:o})}}))}var yh=class{constructor(e,t){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=Yp(e),this.schema=Kp(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n=J(t,`addCommands`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:am(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this;return Jp([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:am(t.name,this.schema)},r=[],i=J(t,`addKeyboardShortcuts`,n),a={};if(t.type===`mark`&&J(t,`exitable`,n)&&(a.ArrowRight=()=>fh.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));a={...a,...t}}let o=sf(a);r.push(o);let s=J(t,`addInputRules`,n);if(um(t,e.options.enableInputRules)&&s){let t=s();if(t&&t.length){let n=uh({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let c=J(t,`addPasteRules`,n);if(um(t,e.options.enablePasteRules)&&c){let t=c();if(t&&t.length){let n=vh({editor:e,rules:t});r.push(...n)}}let l=J(t,`addProseMirrorPlugins`,n);if(l){let e=l();r.push(...e)}return r})}get attributes(){return Lp(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=Ip(this.extensions);return Object.fromEntries(t.filter(e=>!!J(e,`addNodeView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=J(t,`addNodeView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:xf(t.name,this.schema)});if(!r)return[];let i=r();return i?[t.name,(r,a,o,s,c)=>i({node:r,view:a,getPos:o,decorations:s,innerDecorations:c,editor:e,extension:t,HTMLAttributes:Vp(r,n)})]:[]}))}dispatchTransaction(e){let{editor:t}=this;return Jp([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:am(n.name,this.schema)},i=J(n,`dispatchTransaction`,r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return Jp([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:am(n.name,this.schema)},i=J(n,`transformPastedHTML`,r);return i?(t,n)=>{let a=e(t,n);return i.call(r,a)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=Ip(this.extensions);return Object.fromEntries(t.filter(e=>!!J(e,`addMarkView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=J(t,`addMarkView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Ff(t.name,this.schema)});return r?[t.name,(i,a,o)=>{let s=Vp(i,n);return r()({mark:i,view:a,inline:o,editor:e,extension:t,HTMLAttributes:s,updateAttributes:t=>{oh(i,e,t)}})}]:[]}))}destroy(){this.extensions.forEach(e=>{let t=e;for(;t.parent;){let e=t.parent;e.child===t&&(e.child=null),t=e}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{let t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:am(e.name,this.schema)};e.type===`mark`&&((Y(J(e,`keepOnSplit`,t))??!0)&&this.splittableMarks.push(e.name),(Y(J(e,`clearable`,t))??!0)||this.nonClearableMarks.push(e.name));let n=J(e,`onBeforeCreate`,t),r=J(e,`onCreate`,t),i=J(e,`onUpdate`,t),a=J(e,`onSelectionUpdate`,t),o=J(e,`onTransaction`,t),s=J(e,`onFocus`,t),c=J(e,`onBlur`,t),l=J(e,`onDestroy`,t);n&&this.editor.on(`beforeCreate`,n),r&&this.editor.on(`create`,r),i&&this.editor.on(`update`,i),a&&this.editor.on(`selectionUpdate`,a),o&&this.editor.on(`transaction`,o),s&&this.editor.on(`focus`,s),c&&this.editor.on(`blur`,c),l&&this.editor.on(`destroy`,l)})}};yh.resolve=Yp,yh.sort=Jp,yh.flatten=Mp,uf({},{ClipboardTextSerializer:()=>xh,Commands:()=>Sh,Delete:()=>Ch,Drop:()=>wh,Editable:()=>Th,FocusEvents:()=>Dh,Keymap:()=>Oh,Paste:()=>kh,Tabindex:()=>Ah,TextDirection:()=>jh,focusEventsPluginKey:()=>Eh});var bh=class e extends dh{constructor(){super(...arguments),this.type=`extension`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},xh=bh.create({name:`clipboardTextSerializer`,addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new K({key:new q(`clipboardTextSerializer`),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,a=Qp(n),{blockSeparator:o}=this.options,s={...o===void 0?{}:{blockSeparator:o},textSerializers:a};return[...i.ranges].sort((e,t)=>e.$from.pos-t.$from.pos).map(({$from:e,$to:t})=>Xp(r,{from:e.pos,to:t.pos},s)).join(o??`
31
+
32
+ `)}}})]}}),Sh=bh.create({name:`commands`,addCommands(){return{...pf}}}),Ch=bh.create({name:`delete`,onUpdate({transaction:e,appendedTransactions:t}){let n=()=>{var n;if(((n=this.editor.options.coreExtensionOptions?.delete)?.filterTransaction)?.call(n,e)??e.getMeta(`y-sync$`))return;let r=Op(e.before,[e,...t]);rm(r).forEach(t=>{r.mapping.mapResult(t.oldRange.from).deletedAfter&&r.mapping.mapResult(t.oldRange.to).deletedBefore&&r.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,i)=>{let a=i+n.nodeSize-2,o=t.oldRange.from<=i&&a<=t.oldRange.to;this.editor.emit(`delete`,{type:`node`,node:n,from:i,to:a,newFrom:r.mapping.map(i),newTo:r.mapping.map(a),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:r})})});let i=r.mapping;r.steps.forEach((t,n)=>{if(t instanceof ma){let a=i.slice(n).map(t.from,-1),o=i.slice(n).map(t.to),s=i.invert().map(a,-1),c=i.invert().map(o),l=a>0?r.doc.nodeAt(a-1)?.marks.some(e=>e.eq(t.mark)):!1,u=r.doc.nodeAt(o)?.marks.some(e=>e.eq(t.mark));this.editor.emit(`delete`,{type:`mark`,mark:t.mark,from:t.from,to:t.to,deletedRange:{from:s,to:c},newRange:{from:a,to:o},partial:!!(u||l),editor:this.editor,transaction:e,combinedTransform:r})}})};this.editor.options.coreExtensionOptions?.delete?.async??!0?setTimeout(n,0):n()}}),wh=bh.create({name:`drop`,addProseMirrorPlugins(){return[new K({key:new q(`tiptapDrop`),props:{handleDrop:(e,t,n,r)=>{this.editor.emit(`drop`,{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),Th=bh.create({name:`editable`,addProseMirrorPlugins(){return[new K({key:new q(`editable`),props:{editable:()=>this.editor.options.editable}})]}}),Eh=new q(`focusEvents`),Dh=bh.create({name:`focusEvents`,addProseMirrorPlugins(){let{editor:e}=this;return[new K({key:Eh,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta(`focus`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta(`blur`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1}}}})]}}),Oh=bh.create({name:`keymap`,addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:a}=n,{pos:o,parent:s}=a,c=a.parent.isTextblock&&o>0?t.doc.resolve(o-1):a,l=c.parent.type.spec.isolating,u=a.pos-a.parentOffset,d=l&&c.parent.childCount===1?u===a.pos:U.atStart(r).from===o;return!i||!s.type.isTextblock||s.textContent.length||!d||d&&a.parent.type.name===`paragraph`?!1:e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Hf()||sp()?i:r},addProseMirrorPlugins(){return[new K({key:new q(`clearDocument`),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta(`composition`)))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta(`preventClearDocument`));if(!r||i)return;let{empty:a,from:o,to:s}=t.selection,c=U.atStart(t.doc).from,l=U.atEnd(t.doc).to;if(a||!(o===c&&s===l)||!fm(n.doc))return;let u=n.tr,d=df({state:n,transaction:u}),{commands:f}=new ff({editor:this.editor,state:d});if(f.clearNodes(),u.steps.length)return u}})]}}),kh=bh.create({name:`paste`,addProseMirrorPlugins(){return[new K({key:new q(`tiptapPaste`),props:{handlePaste:(e,t,n)=>{this.editor.emit(`paste`,{editor:this.editor,event:t,slice:n})}}})]}}),Ah=bh.create({name:`tabindex`,addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new K({key:new q(`tabindex`),props:{attributes:()=>!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:this.options.value??`0`}}})]}}),jh=bh.create({name:`textDirection`,addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=Ip(this.extensions);return[{types:e.filter(e=>e.name!==`text`).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute(`dir`);return t&&(t===`ltr`||t===`rtl`||t===`auto`)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new K({key:new q(`textDirection`),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),Mh=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){return this.actualDepth??this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(this.depth===0)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(t),this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=n.isInline,s=this.pos+r+ +!a;if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;let c=this.resolvedPos.doc.resolve(s);if(!i&&!o&&c.depth<=this.depth)return;let l=new e(c,this.editor,i,i||o?n:null);i&&(l.actualDepth=this.depth+1),t.push(l)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||this.children.length===0)return r;let i=Object.keys(t);return this.children.forEach(a=>{n&&r.length>0||(a.node.type.name===e&&i.every(e=>t[e]===a.node.attrs[e])&&r.push(a),!(n&&r.length>0)&&(r=r.concat(a.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},Nh=`.ProseMirror {
33
+ position: relative;
34
+ }
35
+
36
+ .ProseMirror {
37
+ word-wrap: break-word;
38
+ white-space: pre-wrap;
39
+ white-space: break-spaces;
40
+ -webkit-font-variant-ligatures: none;
41
+ font-variant-ligatures: none;
42
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
43
+ }
44
+
45
+ .ProseMirror [contenteditable="false"] {
46
+ white-space: normal;
47
+ }
48
+
49
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
50
+ white-space: pre-wrap;
51
+ }
52
+
53
+ .ProseMirror pre {
54
+ white-space: pre-wrap;
55
+ }
56
+
57
+ img.ProseMirror-separator {
58
+ display: inline !important;
59
+ border: none !important;
60
+ margin: 0 !important;
61
+ width: 0 !important;
62
+ height: 0 !important;
63
+ }
64
+
65
+ .ProseMirror-gapcursor {
66
+ display: none;
67
+ pointer-events: none;
68
+ position: absolute;
69
+ margin: 0;
70
+ }
71
+
72
+ .ProseMirror-gapcursor:after {
73
+ content: "";
74
+ display: block;
75
+ position: absolute;
76
+ top: -2px;
77
+ width: 20px;
78
+ border-top: 1px solid black;
79
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
80
+ }
81
+
82
+ @keyframes ProseMirror-cursor-blink {
83
+ to {
84
+ visibility: hidden;
85
+ }
86
+ }
87
+
88
+ .ProseMirror-hideselection *::selection {
89
+ background: transparent;
90
+ }
91
+
92
+ .ProseMirror-hideselection *::-moz-selection {
93
+ background: transparent;
94
+ }
95
+
96
+ .ProseMirror-hideselection * {
97
+ caret-color: transparent;
98
+ }
99
+
100
+ .ProseMirror-focused .ProseMirror-gapcursor {
101
+ display: block;
102
+ }`,Ph=class extends Wm{constructor(e={}){super(),this.css=null,this.className=`tiptap`,this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<`u`?document.createElement(`div`):null,content:``,injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:hm,createMappablePosition:gm},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on(`beforeCreate`,this.options.onBeforeCreate),this.emit(`beforeCreate`,{editor:this}),this.on(`mount`,this.options.onMount),this.on(`unmount`,this.options.onUnmount),this.on(`contentError`,this.options.onContentError),this.on(`create`,this.options.onCreate),this.on(`update`,this.options.onUpdate),this.on(`selectionUpdate`,this.options.onSelectionUpdate),this.on(`transaction`,this.options.onTransaction),this.on(`focus`,this.options.onFocus),this.on(`blur`,this.options.onBlur),this.on(`destroy`,this.options.onDestroy),this.on(`drop`,({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on(`paste`,({event:e,slice:t})=>this.options.onPaste(e,t)),this.on(`delete`,this.options.onDelete);let t=this.createDoc(),n=Bf(t,this.options.autofocus);this.editorState=ko.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>`u`)throw Error(`[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`);this.createView(e),this.emit(`mount`,{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit(`create`,{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){let e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove==`function`?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn(`Failed to remove CSS element:`,e)}this.css=null,this.emit(`unmount`,{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<`u`&&(this.css=Gm(Nh,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit(`update`,{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t===`state`)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=Pp(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t=typeof e==`string`?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){let e=[...this.options.enableCoreExtensions?[Th,xh.configure({blockSeparator:this.options.coreExtensionOptions?.clipboardTextSerializer?.blockSeparator}),Sh,Dh,Oh,Ah.configure({value:this.options.coreExtensionOptions?.tabindex?.value}),wh,kh,Ch,jh.configure({direction:this.options.textDirection})].filter(e=>typeof this.options.enableCoreExtensions==`object`?this.options.enableCoreExtensions[e.name]!==!1:!0):[],...this.options.extensions].filter(e=>[`extension`,`node`,`mark`].includes(e?.type));this.extensionManager=new yh(e,this)}createCommandManager(){this.commandManager=new ff({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Tp(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||![`[tiptap error]: Invalid JSON content`,`[tiptap error]: Invalid HTML content`].includes(t.message))throw t;this.emit(`contentError`,{editor:this,error:t,disableCollaboration:()=>{`collaboration`in this.storage&&typeof this.storage.collaboration==`object`&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>e.name!==`collaboration`),this.createExtensionManager()}}),e=Tp(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,a=t.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new Bd(e,{...t,attributes:{role:`textbox`,...t?.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();let c=this.view.dom;c.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>this.capturedTransaction?.step(e));return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),a=this.state;if(this.emit(`beforeTransaction`,{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit(`transaction`,{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit(`selectionUpdate`,{editor:this,transaction:e});let o=n.findLast(e=>e.getMeta(`focus`)||e.getMeta(`blur`)),s=o?.getMeta(`focus`),c=o?.getMeta(`blur`);s&&this.emit(`focus`,{editor:this,event:s.event,transaction:o}),c&&this.emit(`blur`,{editor:this,event:c.event,transaction:o}),!(e.getMeta(`preventUpdate`)||!n.some(e=>e.docChanged)||a.doc.eq(t.doc))&&this.emit(`update`,{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return em(this.state,e)}isActive(e,t){let n=typeof e==`string`?e:null,r=typeof e==`string`?t:e;return lm(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Np(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=`
103
+
104
+ `,textSerializers:n={}}=e||{};return Zp(this.state.doc,{blockSeparator:t,textSerializers:{...Qp(this.schema),...n}})}get isEmpty(){return fm(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit(`destroy`),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){return this.editorView?.isDestroyed??!0}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText?t.nodeAfter:null;return new Mh(t,this,!1,n)}get $doc(){return this.$pos(0)}};function Fh(e){return new sh({find:e.find,handler:({state:t,range:n,match:r})=>{let i=Y(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if(im(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;l<n.to&&a.delete(l,n.to),c>n.from&&a.delete(n.from+r,c);let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function Ih(e){return new ph({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=Y(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let i=c.search(/\S/),u=n.from+c.indexOf(s),d=u+s.length;if(im(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>u).length)return null;d<n.to&&o.delete(d,n.to),u>n.from&&o.delete(n.from+i,u),l=n.from+i+s.length,o.addMark(n.from+i,l,e.type.create(a||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(e.type)}}})}function Lh(e){return(0,t.customRef)((t,n)=>({get(){return t(),e},set(t){e=t,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}var Rh=class extends Ph{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=Lh(this.view.state),this.reactiveExtensionStorage=Lh(this.extensionStorage),this.on(`beforeTransaction`,({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage}),(0,t.markRaw)(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,t){let n=super.registerPlugin(e,t);return this.reactiveState&&(this.reactiveState.value=n),n}unregisterPlugin(e){let t=super.unregisterPlugin(e);return this.reactiveState&&t&&(this.reactiveState.value=t),t}},zh=(0,t.defineComponent)({name:`EditorContent`,props:{editor:{default:null,type:Object}},setup(e){let n=(0,t.ref)(),r=(0,t.getCurrentInstance)();return(0,t.watchEffect)(()=>{let i=e.editor;i&&i.options.element&&n.value&&(0,t.nextTick)(()=>{if(!n.value||!i.view.dom?.parentNode)return;let e=(0,t.unref)(n.value);n.value.append(...i.view.dom.parentNode.childNodes),i.contentComponent=r.ctx._,r&&(i.appContext={...r.appContext,provides:r.provides}),i.setOptions({element:e}),i.createNodeViews()})}),(0,t.onBeforeUnmount)(()=>{let t=e.editor;t&&(t.contentComponent=null,t.appContext=null)}),{rootEl:n}},render(){return(0,t.h)(`div`,{ref:e=>{this.rootEl=e}})}});(0,t.defineComponent)({name:`NodeViewContent`,props:{as:{type:String,default:`div`}},inject:{nodeViewContentRef:{default:void 0}},mounted(){let e=this.nodeViewContentRef;e&&this.$el&&e(this.$el)},beforeUnmount(){let e=this.nodeViewContentRef;e&&e(null)},render(){return(0,t.h)(this.as,{style:{whiteSpace:`pre-wrap`},"data-node-view-content":``})}}),(0,t.defineComponent)({name:`NodeViewWrapper`,props:{as:{type:String,default:`div`}},inject:[`onDragStart`,`decorationClasses`],render(){var e;return(0,t.h)(this.as,{class:this.decorationClasses,style:{whiteSpace:`normal`},"data-node-view-wrapper":``,onDragstart:this.onDragStart},(e=this.$slots).default?.call(e))}});var Bh=(e={})=>{let n=(0,t.shallowRef)();return(0,t.onMounted)(()=>{n.value=new Rh(e)}),(0,t.onBeforeUnmount)(()=>{var e;(e=n.value)==null||e.destroy()}),n};(0,t.defineComponent)({name:`MarkViewContent`,props:{as:{type:String,default:`span`}},render(){return(0,t.h)(this.as,{style:{whiteSpace:`inherit`},"data-mark-view-content":``})}});var Vh=Object.defineProperty,Hh=(e,t)=>{for(var n in t)Vh(e,n,{get:t[n],enumerable:!0})};function Uh(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:a}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return a},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,a=n.storedMarks,n}}}var Wh=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(a);return!i.getMeta(`preventDispatch`)&&!this.hasCustomState&&r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],s=!!e,c=e||i.tr,l=()=>(!s&&t&&!c.getMeta(`preventDispatch`)&&!this.hasCustomState&&a.dispatch(c),o.every(e=>e===!0)),u={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(c,t),i=n(...e)(r);return o.push(i),u}])),run:l};return u}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:e,editor:r,view:a,state:Uh({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(o)]))}};return o}},Gh={};Hh(Gh,{blur:()=>Kh,clearContent:()=>qh,clearNodes:()=>Jh,command:()=>Yh,createParagraphNear:()=>Xh,cut:()=>Zh,deleteCurrentNode:()=>Qh,deleteNode:()=>eg,deleteRange:()=>tg,deleteSelection:()=>ag,enter:()=>og,exitCode:()=>sg,extendMarkRange:()=>mg,first:()=>hg,focus:()=>Sg,forEach:()=>Cg,insertContent:()=>wg,insertContentAt:()=>Ag,joinBackward:()=>Ng,joinDown:()=>Mg,joinForward:()=>Pg,joinItemBackward:()=>Fg,joinItemForward:()=>Ig,joinTextblockBackward:()=>Lg,joinTextblockForward:()=>Rg,joinUp:()=>jg,keyboardShortcut:()=>Vg,lift:()=>Ug,liftEmptyBlock:()=>Wg,liftListItem:()=>Gg,newlineInCode:()=>Kg,resetAttributes:()=>Yg,scrollIntoView:()=>Xg,selectAll:()=>Zg,selectNodeBackward:()=>Qg,selectNodeForward:()=>$g,selectParentNode:()=>e_,selectTextblockEnd:()=>t_,selectTextblockStart:()=>n_,setContent:()=>i_,setMark:()=>Y_,setMeta:()=>X_,setNode:()=>Z_,setNodeSelection:()=>Q_,setTextDirection:()=>$_,setTextSelection:()=>ev,sinkListItem:()=>tv,splitBlock:()=>rv,splitListItem:()=>iv,toggleList:()=>uv,toggleMark:()=>dv,toggleNode:()=>fv,toggleWrap:()=>pv,undoInputRule:()=>mv,unsetAllMarks:()=>hv,unsetMark:()=>gv,unsetTextDirection:()=>_v,updateAttributes:()=>vv,wrapIn:()=>yv,wrapInList:()=>bv});var Kh=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),qh=(e=!0)=>({commands:t})=>t.setContent(``,{emitUpdate:e}),Jh=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,a=r.resolve(i.map(n)),o=r.resolve(i.map(n+e.nodeSize)),s=a.blockRange(o);if(!s)return;let c=wa(s);if(e.type.isTextblock){let{defaultType:e}=a.parent.contentMatchAt(a.index());t.setNodeMarkup(s.start,e)}(c||c===0)&&t.lift(s,c)})}),!0},Yh=e=>t=>e(t),Xh=()=>({state:e,dispatch:t})=>Qo(e,t),Zh=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,a=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,a.content),r.setSelection(new W(r.doc.resolve(Math.max(o-1,0)))),!0},Qh=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;--n)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function $h(e,t){if(typeof e==`string`){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var eg=e=>({tr:t,state:n,dispatch:r})=>{let i=$h(e,n.schema),a=t.selection.$anchor;for(let e=a.depth;e>0;--e)if(a.node(e).type===i){if(r){let n=a.before(e),r=a.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},tg=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},ng=e=>e.content?/^text(\*|\+)/.test(e.content):!1,rg=(e,t,n)=>{if(!e.parent.isInline||n===`left`&&e.pos>e.start()||n===`right`&&e.pos<e.end())return e.pos;let r=t.nodes[e.parent.type.name].spec;return ng(r)?n===`left`?e.start()-1:e.end()+1:e.pos},ig=(e,t,n)=>({from:rg(e,n,`left`),to:rg(t,n,`right`)}),ag=()=>({state:e,dispatch:t})=>{if(e.selection.empty)return!1;if(t){let n=e.tr,{ranges:r}=e.selection,i=n.steps.length;r.forEach(t=>{let r=n.mapping.slice(i),{from:a,to:o}=ig(n.doc.resolve(r.map(t.$from.pos)),n.doc.resolve(r.map(t.$to.pos)),e.schema);n.deleteRange(a,o)}),n.scrollIntoView(),t(n)}return!0},og=()=>({commands:e})=>e.keyboardShortcut(`Enter`),sg=()=>({state:e,dispatch:t})=>Zo(e,t);function cg(e){return Object.prototype.toString.call(e)===`[object RegExp]`}function lg(e,t,n={strict:!0}){let r=Object.keys(t);return r.length?r.every(r=>n.strict?t[r]===e[r]:cg(t[r])?t[r].test(e[r]):t[r]===e[r]):!0}function ug(e,t,n={}){return e.find(e=>e.type===t&&lg(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function dg(e,t,n={}){return!!ug(e,t,n)}function fg(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if((!r.node||!r.node.marks.some(e=>e.type===t))&&(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!ug([...r.node.marks],t,n))return;let i=r.index,a=e.start()+r.offset,o=i+1,s=a+r.node.nodeSize;for(;i>0&&dg([...e.parent.child(i-1).marks],t,n);)--i,a-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&dg([...e.parent.child(o).marks],t,n);)s+=e.parent.child(o).nodeSize,o+=1;return{from:a,to:s}}function pg(e,t){if(typeof e==`string`){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var mg=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=pg(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=fg(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=W.create(o,e.from,e.to);n.setSelection(t)}}return!0},hg=e=>t=>{let n=typeof e==`function`?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function gg(e){return e instanceof W}function _g(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function vg(e,t=null){if(!t)return null;let n=U.atStart(e),r=U.atEnd(e);if(t===`start`||t===!0)return n;if(t===`end`)return r;let i=n.from,a=r.to;return t===`all`?W.create(e,_g(0,i,a),_g(e.content.size,i,a)):W.create(e,_g(t,i,a),_g(t,i,a))}function yg(){return navigator.platform===`Android`||/android/i.test(navigator.userAgent)}function bg(){return[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`].includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`ontouchend`in document}function xg(){return typeof navigator<`u`?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var Sg=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(bg()||yg())&&r.dom.focus(),xg()&&!bg()&&!yg()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(a&&e===null&&!gg(n.state.selection))return o(),!0;let s=vg(i.doc,e)||n.state.selection,c=n.state.selection.eq(s);return a&&(c||i.setSelection(s),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},Cg=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),wg=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),Tg=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;--n){let r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&Tg(r)}return e};function Eg(e){if(typeof window>`u`)throw Error(`[tiptap error]: there is no window object available, so this function cannot be used`);let t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,`text/html`).body;return Tg(n)}function Dg(e,t,n){if(e instanceof ti||e instanceof B)return e;n={slice:!0,parseOptions:{},...n};let r=typeof e==`object`&&!!e,i=typeof e==`string`;if(r)try{if(Array.isArray(e)&&e.length>0)return B.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error(`[tiptap error]: Invalid JSON content`,{cause:r});return console.warn(`[tiptap warn]: Invalid content.`,`Passed value:`,e,`Error:`,r),Dg(``,t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i=``,a=new Ei({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:`inline*`,group:`block`,parseDOM:[{tag:`*`,getAttrs:e=>(r=!0,i=typeof e==`string`?e:e.outerHTML,null)}]}})});if(n.slice?Ai.fromSchema(a).parseSlice(Eg(e),n.parseOptions):Ai.fromSchema(a).parse(Eg(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error(`[tiptap error]: Invalid HTML content`,{cause:Error(`Invalid element found: ${i}`)})}let r=Ai.fromSchema(t);return n.slice?r.parseSlice(Eg(e),n.parseOptions).content:r.parse(Eg(e),n.parseOptions)}return Dg(``,t,n)}function Og(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof _a||i instanceof va))return;let a=e.mapping.maps[r],o=0;a.forEach((e,t,n,r)=>{o===0&&(o=r)}),e.setSelection(U.near(e.doc.resolve(o),n))}var kg=e=>!(`type`in e),Ag=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i,o=e=>{a.emit(`contentError`,{editor:a,error:e,disableCollaboration:()=>{`collaboration`in a.storage&&typeof a.storage.collaboration==`object`&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},s={preserveWhitespace:`full`,...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{Dg(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=Dg(t,a.schema,{parseOptions:s,errorOnInvalidContent:n.errorOnInvalidContent??a.options.enableContentCheck})}catch(e){return o(e),!1}let{from:c,to:l}=typeof e==`number`?{from:e,to:e}:{from:e.from,to:e.to},u=!0,d=!0;if((kg(i)?i:[i]).forEach(e=>{e.check(),u=u?e.isText&&e.marks.length===0:!1,d=d?e.isBlock:!1}),c===l&&d){let{parent:e}=r.doc.resolve(c);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(--c,l+=1)}let f;if(u){if(Array.isArray(t))f=t.map(e=>e.text||``).join(``);else if(t instanceof B){let e=``;t.forEach(t=>{t.text&&(e+=t.text)}),f=e}else f=typeof t==`object`&&t&&t.text?t.text:t;r.insertText(f,c,l)}else{f=i;let e=r.doc.resolve(c),t=e.node(),n=e.parentOffset===0,a=t.isText||t.isTextblock,o=t.content.size>0;n&&a&&o&&d&&(c=Math.max(0,c-1)),r.replaceWith(c,l,f)}n.updateSelection&&Og(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta(`applyInputRules`,{from:c,text:f}),n.applyPasteRules&&r.setMeta(`applyPasteRules`,{from:c,text:f})}return!0},jg=()=>({state:e,dispatch:t})=>Ko(e,t),Mg=()=>({state:e,dispatch:t})=>qo(e,t),Ng=()=>({state:e,dispatch:t})=>Fo(e,t),Pg=()=>({state:e,dispatch:t})=>Uo(e,t),Fg=()=>({state:e,dispatch:t,tr:n})=>{try{let r=Va(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},Ig=()=>({state:e,dispatch:t,tr:n})=>{try{let r=Va(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},Lg=()=>({state:e,dispatch:t})=>Io(e,t),Rg=()=>({state:e,dispatch:t})=>Lo(e,t);function zg(){return typeof navigator<`u`?/Mac/.test(navigator.platform):!1}function Bg(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n===`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e+=1){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))bg()||zg()?o=!0:i=!0;else throw Error(`Unrecognized modifier name: ${n}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),a&&(n=`Shift-${n}`),n}var Vg=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=Bg(e).split(/-(?!$)/),o=a.find(e=>![`Alt`,`Ctrl`,`Meta`,`Shift`].includes(e)),s=new KeyboardEvent(`keydown`,{key:o===`Space`?` `:o,altKey:a.includes(`Alt`),ctrlKey:a.includes(`Ctrl`),metaKey:a.includes(`Meta`),shiftKey:a.includes(`Shift`),bubbles:!0,cancelable:!0});return t.captureTransaction(()=>{n.someProp(`handleKeyDown`,e=>e(n,s))})?.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function Hg(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?$h(t,e.schema):null,s=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);s.push({node:e,from:n,to:a})});let c=i-r,l=s.filter(e=>o?o.name===e.node.type.name:!0).filter(e=>lg(e.node.attrs,n,{strict:!1}));return a?!!l.length:l.reduce((e,t)=>e+t.to-t.from,0)>=c}var Ug=(e,t={})=>({state:n,dispatch:r})=>Hg(n,$h(e,n.schema),t)?Jo(n,r):!1,Wg=()=>({state:e,dispatch:t})=>$o(e,t),Gg=e=>({state:t,dispatch:n})=>bs($h(e,t.schema))(t,n),Kg=()=>({state:e,dispatch:t})=>Yo(e,t);function qg(e,t){return t.nodes[e]?`node`:t.marks[e]?`mark`:null}function Jg(e,t){let n=typeof t==`string`?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var Yg=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=qg(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=$h(e,r.schema)),s===`mark`&&(o=pg(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,Jg(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(a=>{o===a.type&&(c=!0,i&&n.addMark(r,r+e.nodeSize,o.create(Jg(a.attrs,t))))})})}),c},Xg=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),Zg=()=>({tr:e,dispatch:t})=>{if(t){let t=new _o(e.doc);e.setSelection(t)}return!0},Qg=()=>({state:e,dispatch:t})=>Bo(e,t),$g=()=>({state:e,dispatch:t})=>Wo(e,t),e_=()=>({state:e,dispatch:t})=>ns(e,t),t_=()=>({state:e,dispatch:t})=>ls(e,t),n_=()=>({state:e,dispatch:t})=>cs(e,t);function r_(e,t,n={},r={}){return Dg(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var i_=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:c}=a;if(r.preserveWhitespace!==`full`){let s=r_(e,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});return o&&a.replaceWith(0,c.content.size,s).setMeta(`preventUpdate`,!n),!0}return o&&a.setMeta(`preventUpdate`,!n),s.insertContentAt({from:0,to:c.content.size},e,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})};function a_(e,t){let n=pg(t,e.schema),{from:r,to:i,empty:a}=e.selection,o=[];a?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{o.push(...e.marks)});let s=o.find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}function o_(e,t){let n=new lo(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function s_(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function c_(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function l_(e,t){for(let n=e.depth;n>0;--n){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function u_(e){return t=>l_(t.$from,e)}function X(e,t,n){return e.config[t]===void 0&&e.parent?X(e.parent,t,n):typeof e.config[t]==`function`?e.config[t].bind({...n,parent:e.parent?X(e.parent,t,n):null}):e.config[t]}function d_(e){return e.map(e=>{let t=X(e,`addExtensions`,{name:e.name,options:e.options,storage:e.storage});return t?[e,...d_(t())]:e}).flat(10)}function f_(e,t){let n=Wi.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement(`div`);return r.appendChild(n),r.innerHTML}function p_(e){return typeof e==`function`}function Z(e,t=void 0,...n){return p_(e)?t?e.bind(t)(...n):e(...n):e}function m_(e={}){return Object.keys(e).length===0&&e.constructor===Object}function h_(e){return{baseExtensions:e.filter(e=>e.type===`extension`),nodeExtensions:e.filter(e=>e.type===`node`),markExtensions:e.filter(e=>e.type===`mark`)}}function g_(e){let t=[],{nodeExtensions:n,markExtensions:r}=h_(e),i=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(e=>e.name!==`text`).map(e=>e.name),s=r.map(e=>e.name),c=[...o,...s];return e.forEach(e=>{let n=X(e,`addGlobalAttributes`,{name:e.name,options:e.options,storage:e.storage,extensions:i});n&&n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:e.types===`*`?c:e.types===`nodes`?o:e.types===`marks`?s:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...a,...r}})})})})}),i.forEach(e=>{let n=X(e,`addAttributes`,{name:e.name,options:e.options,storage:e.storage});if(!n)return;let r=n();Object.entries(r).forEach(([n,r])=>{let i={...a,...r};typeof i?.default==`function`&&(i.default=i.default()),i?.isRequired&&i?.default===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function __(e){let t=[],n=``,r=!1,i=!1,a=0,o=e.length;for(let s=0;s<o;s+=1){let o=e[s];if(o===`'`&&!i){r=!r,n+=o;continue}if(o===`"`&&!r){i=!i,n+=o;continue}if(!r&&!i){if(o===`(`){a+=1,n+=o;continue}if(o===`)`&&a>0){--a,n+=o;continue}if(o===`;`&&a===0){t.push(n),n=``;continue}}n+=o}return n&&t.push(n),t}function v_(e){let t=[],n=__(e||``),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],i=r.indexOf(`:`);if(i===-1)continue;let a=r.slice(0,i).trim(),o=r.slice(i+1).trim();a&&o&&t.push([a,o])}return t}function y_(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(!n[e]){n[e]=t;return}if(e===`class`){let r=t?String(t).split(` `):[],i=n[e]?n[e].split(` `):[],a=r.filter(e=>!i.includes(e));n[e]=[...i,...a].join(` `)}else if(e===`style`){let r=new Map([...v_(n[e]),...v_(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join(`; `)}else n[e]=t}),n},{})}function b_(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>y_(e,t),{})}function x_(e){return typeof e==`string`?e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e===`true`?!0:e===`false`?!1:e:e}function S_(e,t){return`style`in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;let i=t.reduce((e,t)=>{let r=t.attribute.parseHTML?t.attribute.parseHTML(n):x_(n.getAttribute(t.name));return r==null?e:{...e,[t.name]:r}},{});return{...r,...i}}}}function C_(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>e===`attrs`&&m_(t)?!1:t!=null))}function w_(e){let t={};return!e?.attribute?.isRequired&&`default`in(e?.attribute||{})&&(t.default=e.attribute.default),e?.attribute?.validate!==void 0&&(t.validate=e.attribute.validate),[e.name,t]}function T_(e,t){let n=g_(e),{nodeExtensions:r,markExtensions:i}=h_(e);return new Ei({topNode:r.find(e=>X(e,`topNode`))?.name,nodes:Object.fromEntries(r.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=C_({...e.reduce((e,t)=>{let n=X(t,`extendNodeSchema`,a);return{...e,...n?n(r):{}}},{}),content:Z(X(r,`content`,a)),marks:Z(X(r,`marks`,a)),group:Z(X(r,`group`,a)),inline:Z(X(r,`inline`,a)),atom:Z(X(r,`atom`,a)),selectable:Z(X(r,`selectable`,a)),draggable:Z(X(r,`draggable`,a)),code:Z(X(r,`code`,a)),whitespace:Z(X(r,`whitespace`,a)),linebreakReplacement:Z(X(r,`linebreakReplacement`,a)),defining:Z(X(r,`defining`,a)),isolating:Z(X(r,`isolating`,a)),attrs:Object.fromEntries(i.map(w_))}),s=Z(X(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>S_(e,i)));let c=X(r,`renderHTML`,a);c&&(o.toDOM=e=>c({node:e,HTMLAttributes:b_(e,i)}));let l=X(r,`renderText`,a);return l&&(o.toText=l),[r.name,o]})),marks:Object.fromEntries(i.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=C_({...e.reduce((e,t)=>{let n=X(t,`extendMarkSchema`,a);return{...e,...n?n(r):{}}},{}),inclusive:Z(X(r,`inclusive`,a)),excludes:Z(X(r,`excludes`,a)),group:Z(X(r,`group`,a)),spanning:Z(X(r,`spanning`,a)),code:Z(X(r,`code`,a)),attrs:Object.fromEntries(i.map(w_))}),s=Z(X(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>S_(e,i)));let c=X(r,`renderHTML`,a);return c&&(o.toDOM=e=>c({mark:e,HTMLAttributes:b_(e,i)})),[r.name,o]}))})}function E_(e){let t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}function D_(e){return e.sort((e,t)=>{let n=X(e,`priority`)||100,r=X(t,`priority`)||100;return n>r?-1:+(n<r)})}function O_(e){let t=D_(d_(e)),n=E_(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(`, `)}]. This can lead to issues.`),t}function k_(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=`
105
+
106
+ `,textSerializers:o={}}=n||{},s=``;return e.nodesBetween(r,i,(e,n,c,l)=>{e.isBlock&&n>r&&(s+=a);let u=o?.[e.type.name];if(u)return c&&(s+=u({node:e,pos:n,parent:c,index:l,range:t})),!1;e.isText&&(s+=(e?.text)?.slice(Math.max(r,n)-n,i-n))}),s}function A_(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function j_(e,t){let n=$h(t,e.schema),{from:r,to:i}=e.selection,a=[];e.doc.nodesBetween(r,i,e=>{a.push(e)});let o=a.reverse().find(e=>e.type.name===n.name);return o?{...o.attrs}:{}}function M_(e,t){let n=qg(typeof t==`string`?t:t.name,e.schema);return n===`node`?j_(e,t):n===`mark`?a_(e,t):{}}function N_(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function P_(e){let t=N_(e);return t.length===1?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function F_(e){let{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,i)=>{let a=[];if(e.ranges.length)e.forEach((e,t)=>{a.push({from:e,to:t})});else{let{from:e,to:t}=n[i];if(e===void 0||t===void 0)return;a.push({from:e,to:t})}a.forEach(({from:e,to:n})=>{let a=t.slice(i).map(e,-1),o=t.slice(i).map(n),s=t.invert().map(a,-1),c=t.invert().map(o);r.push({oldRange:{from:s,to:c},newRange:{from:a,to:o}})})}),P_(r)}function I_(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=fg(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{!e||e?.nodeSize===void 0||r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}var L_=(e,t,n,r=20)=>{let i=e.doc.resolve(n),a=r,o=null;for(;a>0&&o===null;){let e=i.node(a);e?.type.name===t?o=e:--a}return[o,a]};function R_(e,t){return t.nodes[e]||t.marks[e]||null}function z_(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return r?r.attribute.keepOnSplit:!1}))}var B_=(e,t=500)=>{let n=``,r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,a)=>{var o;let s=(o=e.type.spec).toText?.call(o,{node:e,pos:t,parent:i,index:a})||e.textContent||`%leaf%`;n+=e.isAtom&&!e.isText?s:s.slice(0,Math.max(0,r-t))}),n};function V_(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?pg(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>a?a.name===e.type.name:!0).find(e=>lg(e.attrs,n,{strict:!1}));let o=0,s=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(a&&e.inlineContent&&!e.type.allowsMarkType(a))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),c=Math.min(i,t+e.nodeSize),l=c-n;o+=l,s.push(...e.marks.map(e=>({mark:e,from:n,to:c})))})}),o===0)return!1;let c=s.filter(e=>a?a.name===e.mark.type.name:!0).filter(e=>lg(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),l=s.filter(e=>a?e.mark.type!==a&&e.mark.type.excludes(a):!0).reduce((e,t)=>e+t.to-t.from,0);return(c>0?c+l:c)>=o}var H_=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=u_(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},U_=e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function W_(e,t){return Array.isArray(t)?t.some(t=>(typeof t==`string`?t:t.name)===e.name):t}function G_(e,t){let{nodeExtensions:n}=h_(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=Z(X(r,`group`,{name:r.name,options:r.options,storage:r.storage}));return typeof i==`string`?i.split(` `).includes(`list`):!1}function K_(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if(e.type.name===`hardBreak`)return!0;if(e.isText)return!/\S/.test(e.text??``)}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let r=!0;return e.content.forEach(e=>{r!==!1&&(K_(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function q_(e){return e instanceof G}function J_(e,t,n){let{selection:r}=t,i=null;if(gg(r)&&(i=r.$cursor),i){let t=e.storedMarks??i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:a}=r;return a.some(({$from:t,$to:r})=>{let i=t.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),a=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&a}return!i}),i})}var Y_=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=pg(e,r.schema);if(i)if(o){let e=a_(r,c);n.addStoredMark(c.create({...e,...t}))}else s.forEach(e=>{let i=e.$from.pos,a=e.$to.pos;r.doc.nodesBetween(i,a,(e,r)=>{let o=Math.max(r,i),s=Math.min(r+e.nodeSize,a);e.marks.find(e=>e.type===c)?e.marks.forEach(e=>{c===e.type&&n.addMark(o,s,c.create({...e.attrs,...t}))}):n.addMark(o,s,c.create(t))})});return J_(r,n,c)},X_=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),Z_=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=$h(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>ds(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>ds(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},Q_=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=_g(e,0,n.content.size),i=G.create(n,r);t.setSelection(i)}return!0},$_=(e,t)=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=r,o,s;return typeof t==`number`?(o=t,s=t):t&&`from`in t&&`to`in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},ev=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=W.atStart(n).from,o=W.atEnd(n).to,s=_g(r,a,o),c=_g(i,a,o),l=W.create(n,s,c);t.setSelection(l)}return!0},tv=e=>({state:t,dispatch:n})=>Cs($h(e,t.schema))(t,n);function nv(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>t?.includes(e.type.name));e.tr.ensureMarks(r)}}var rv=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:a,doc:o}=t,{$from:s,$to:c}=a,l=i.extensionManager.attributes,u=z_(l,s.node().type.name,s.node().attrs);if(a instanceof G&&a.node.isBlock)return!s.parentOffset||!Ia(o,s.pos)?!1:(r&&(e&&nv(n,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;let d=c.parentOffset===c.parent.content.size,f=s.depth===0?void 0:s_(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,m=Ia(t.doc,t.mapping.map(s.pos),1,p);if(!p&&!m&&Ia(t.doc,t.mapping.map(s.pos),1,f?[{type:f}]:void 0)&&(m=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(m&&(a instanceof W&&t.deleteSelection(),t.split(t.mapping.map(s.pos),1,p),f&&!d&&!s.parentOffset&&s.parent.type!==f)){let e=t.mapping.map(s.before()),n=t.doc.resolve(e);s.node(-1).canReplaceWith(n.index(),n.index()+1,f)&&t.setNodeMarkup(t.mapping.map(s.before()),f)}e&&nv(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return m},iv=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{let o=$h(e,r.schema),{$from:s,$to:c}=r.selection,l=r.selection.node;if(l&&l.isBlock||s.depth<2||!s.sameParent(c))return!1;let u=s.node(-1);if(u.type!==o)return!1;let d=a.extensionManager.attributes;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==o||s.index(-2)!==s.node(-2).childCount-1)return!1;if(i){let e=B.empty,r=s.index(-1)?1:s.index(-2)?2:3;for(let t=s.depth-r;t>=s.depth-3;--t)e=B.from(s.node(t).copy(e));let i=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3,a={...z_(d,s.node().type.name,s.node().attrs),...t},c=o.contentMatch.defaultType?.createAndFill(a)||void 0;e=e.append(B.from(o.createAndFill(null,c)||void 0));let l=s.before(s.depth-(r-1));n.replace(l,s.after(-i),new H(e,4-r,0));let u=-1;n.doc.nodesBetween(l,n.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&e.content.size===0&&(u=t+1)}),u>-1&&n.setSelection(W.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=c.pos===s.end()?u.contentMatchAt(0).defaultType:null,p={...z_(d,u.type.name,u.attrs),...t},m={...z_(d,s.node().type.name,s.node().attrs),...t};n.delete(s.pos,c.pos);let h=f?[{type:o,attrs:p},{type:f,attrs:m}]:[{type:o,attrs:p}];if(!Ia(n.doc,s.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:o}=a.extensionManager,c=t||e.$to.parentOffset&&e.$from.marks();if(n.split(s.pos,2,h).scrollIntoView(),!c||!i)return!0;let l=c.filter(e=>o.includes(e.type.name));n.ensureMarks(l)}return!0};function av(e){return!e||e===`1`?null:e}function ov(e,t){return av(e)===av(t)}var sv=(e,t)=>{let n=u_(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===i?.type&&Ra(e.doc,n.pos))||!ov(n.node.attrs.type,i?.attrs.type)||e.join(n.pos),!0},cv=(e,t)=>{let n=u_(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===i?.type&&Ra(e.doc,r))||!ov(n.node.attrs.type,i?.attrs.type)||e.join(r),!0};function lv(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return W.between(r,i)}var uv=(e,t,n,r={})=>({editor:i,tr:a,state:o,dispatch:s,chain:c,commands:l,can:u})=>{let{extensions:d,splittableMarks:f}=i.extensionManager,p=$h(e,o.schema),m=$h(t,o.schema),{selection:h,storedMarks:g}=o,{$from:_,$to:v}=h,y=_.blockRange(v),b=g||h.$to.parentOffset&&h.$from.marks();if(!y)return!1;let x=u_(e=>G_(e.type.name,d))(h),S=h.from===0&&h.to===o.doc.content.size,C=o.doc.content.content,w=C.length===1?C[0]:null,T=S&&w&&G_(w.type.name,d)?{node:w,pos:0,depth:0}:null,E=x??T,D=!!x&&y.depth>=1&&y.depth-x.depth<=1,O=!!T;if((D||O)&&E){if(E.node.type===p)return S&&O?c().command(({tr:e,dispatch:t})=>{let n=lv(e);return n?(e.setSelection(n),t&&t(e),!0):!1}).liftListItem(m).run():l.liftListItem(m);if(G_(E.node.type.name,d)&&p.validContent(E.node.content))return c().command(()=>(a.setNodeMarkup(E.pos,p),!0)).command(()=>sv(a,p)).command(()=>cv(a,p)).run()}return!n||!b||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>sv(a,p)).command(()=>cv(a,p)).run():c().command(()=>{let e=u().wrapInList(p,r),t=b.filter(e=>f.includes(e.type.name));return a.ensureMarks(t),e?!0:l.clearNodes()}).wrapInList(p,r).command(()=>sv(a,p)).command(()=>cv(a,p)).run()},dv=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=pg(e,r.schema);return V_(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},fv=(e,t,n={})=>({state:r,commands:i})=>{let a=$h(e,r.schema),o=$h(t,r.schema),s=Hg(r,a,n),c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),s?i.setNode(o,c):i.setNode(a,{...c,...n})},pv=(e,t={})=>({state:n,commands:r})=>{let i=$h(e,n.schema);return Hg(n,i,t)?r.lift(i):r.wrapIn(i,t)},mv=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i=n[r],a;if(i.spec.isInputRules&&(a=i.getState(e))){if(t){let t=e.tr,n=a.transform;for(let e=n.steps.length-1;e>=0;--e)t.step(n.steps[e].invert(n.docs[e]));if(a.text){let n=t.doc.resolve(a.from).marks();t.replaceWith(a.from,a.to,e.schema.text(a.text,n))}else t.delete(a.from,a.to)}return!0}}return!1},hv=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{ignoreClearable:i=!1}=e,{selection:a}=t,{empty:o,ranges:s}=a;if(o)return!0;let{nonClearableMarks:c}=r.extensionManager;if(n){let e=Object.values(r.schema.marks).filter(e=>i||!c.includes(e.name));s.forEach(n=>{for(let r of e)t.removeMark(n.$from.pos,n.$to.pos,r)})}return!0},gv=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=pg(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){let{from:e,to:t}=o,r=fg(c,s,c.marks().find(e=>e.type===s)?.attrs);r&&(e=r.from,t=r.to),n.removeMark(e,t,s)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,s)});return n.removeStoredMark(s),!0},_v=e=>({tr:t,state:n,dispatch:r})=>{let{selection:i}=n,a,o;return typeof e==`number`?(a=e,o=e):e&&`from`in e&&`to`in e?(a=e.from,o=e.to):(a=i.from,o=i.to),r&&t.doc.nodesBetween(a,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},vv=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=qg(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=$h(e,r.schema)),s===`mark`&&(o=pg(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{let s=e.$from.pos,l=e.$to.pos,u,d,f,p;n.selection.empty?r.doc.nodesBetween(s,l,(e,t)=>{a&&a===e.type&&(c=!0,f=Math.max(t,s),p=Math.min(t+e.nodeSize,l),u=t,d=e)}):r.doc.nodesBetween(s,l,(e,r)=>{r<s&&a&&a===e.type&&(c=!0,f=Math.max(r,s),p=Math.min(r+e.nodeSize,l),u=r,d=e),r>=s&&r<=l&&(a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),o&&e.marks.length&&e.marks.forEach(a=>{if(o===a.type&&(c=!0,i)){let i=Math.max(r,s),c=Math.min(r+e.nodeSize,l);n.addMark(i,c,o.create({...a.attrs,...t}))}}))}),d&&(u!==void 0&&i&&n.setNodeMarkup(u,void 0,{...d.attrs,...t}),o&&d.marks.length&&d.marks.forEach(e=>{o===e.type&&i&&n.addMark(f,p,o.create({...e.attrs,...t}))}))}),c},yv=(e,t={})=>({state:n,dispatch:r})=>us($h(e,n.schema),t)(n,r),bv=(e,t={})=>({state:n,dispatch:r})=>_s($h(e,n.schema),t)(n,r);function xv(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof G){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;--i}return!1}function Sv(e,t,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:``}]`);if(r!==null)return r;let i=document.createElement(`style`);return t&&i.setAttribute(`nonce`,t),i.setAttribute(`data-tiptap-style${n?`-${n}`:``}`,``),i.innerHTML=e,document.getElementsByTagName(`head`)[0].appendChild(i),i}function Cv(e){return typeof e==`number`}function wv(e){return Object.prototype.toString.call(e).slice(8,-1)}function Tv(e){return wv(e)===`Object`?e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype:!1}Hh({},{createAtomBlockMarkdownSpec:()=>Ov,createBlockMarkdownSpec:()=>kv,createInlineMarkdownSpec:()=>Mv,parseAttributes:()=>Ev,parseIndentedBlocks:()=>Nv,renderNestedMarkdownContent:()=>Pv,serializeAttributes:()=>Dv});function Ev(e){if(!e?.trim())return{};let t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([\w-]+)/g);i&&(t.class=i.map(e=>e.trim().slice(1)).join(` `));let a=r.match(/(?:^|\s)#([\w-]+)/);a&&(t.id=a[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{let i=n[parseInt(r.match(/__QUOTED_(\d+)__/)?.[1]||`0`,10)];i&&(t[e]=i.slice(1,-1))});let o=r.replace(/(?:^|\s)\.([\w-]+)/g,``).replace(/(?:^|\s)#([\w-]+)/g,``).replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,``).trim();return o&&o.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function Dv(e){if(!e||Object.keys(e).length===0)return``;let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{e===`class`||e===`id`||(n===!0?t.push(e):n!==!1&&n!=null&&t.push(`${e}="${String(n)}"`))}),t.join(` `)}function Ov(e){let{nodeName:t,name:n,parseAttributes:r=Ev,serializeAttributes:i=Dv,defaultAttributes:a={},requiredAttributes:o=[],allowedAttributes:s}=e,c=n||t,l=e=>{if(!s)return e;let t={};return s.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let r={...a,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:`block`,start(e){let t=RegExp(`^:::${c}(?:\\s|$)`,`m`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,i){let a=RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),s=e.match(a);if(!s)return;let l=r(s[1]||``);if(!o.find(e=>!(e in l)))return{type:t,raw:s[0],attributes:l}}},renderMarkdown:e=>{let t=i(l(e.attrs||{}));return`:::${c}${t?` {${t}}`:``} :::`}}}function kv(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=Ev,serializeAttributes:a=Dv,defaultAttributes:o={},content:s=`block`,allowedAttributes:c}=e,l=n||t,u=e=>{if(!c)return e;let t={};return c.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let i;if(r){let t=r(e);i=typeof t==`string`?[{type:`text`,text:t}]:t}else i=s===`block`?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);let a={...o,...e.attributes};return n.createNode(t,a,i)},markdownTokenizer:{name:t,level:`block`,start(e){let t=RegExp(`^:::${l}`,`m`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,r){let a=RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),o=e.match(a);if(!o)return;let[c,u=``]=o,d=i(u),f=1,p=c.length,m=``,h=/^:::([\w-]*)(\s.*)?/gm,g=e.slice(p);for(h.lastIndex=0;;){let n=h.exec(g);if(n===null)break;let i=n.index,a=n[1];if(!n[2]?.endsWith(`:::`)){if(a)f+=1;else if(--f,f===0){let a=g.slice(0,i);m=a.trim();let o=e.slice(0,p+i+n[0].length),c=[];if(m)if(s===`block`)for(c=r.blockTokens(a),c.forEach(e=>{e.text&&(!e.tokens||e.tokens.length===0)&&(e.tokens=r.inlineTokens(e.text))});c.length>0;){let e=c[c.length-1];if(e.type===`paragraph`&&(!e.text||e.text.trim()===``))c.pop();else break}else c=r.inlineTokens(m);return{type:t,raw:o,attributes:d,content:m,tokens:c}}}}}},renderMarkdown:(e,t)=>{let n=a(u(e.attrs||{}));return`:::${l}${n?` {${n}}`:``}
107
+
108
+ ${t.renderChildren(e.content||[],`
109
+
110
+ `)}
111
+
112
+ :::`}}}function Av(e){if(!e.trim())return{};let t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;r!==null;){let[,i,a,o]=r;t[i]=a||o,r=n.exec(e)}return t}function jv(e){return Object.entries(e).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(` `)}function Mv(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=Av,serializeAttributes:a=jv,defaultAttributes:o={},selfClosing:s=!1,allowedAttributes:c}=e,l=n||t,u=e=>{if(!c)return e;let t={};return c.forEach(n=>{let r=typeof n==`string`?n:n.name,i=typeof n==`string`?void 0:n.skipIfDefault;if(r in e){let n=e[r];if(i!==void 0&&n===i)return;t[r]=n}}),t},d=l.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return{parseMarkdown:(e,n)=>{let i={...o,...e.attributes};if(s)return n.createNode(t,i);let a=r?r(e):e.content||``;return a?n.createNode(t,i,[n.createTextNode(a)]):n.createNode(t,i,[])},markdownTokenizer:{name:t,level:`inline`,start(e){let t=RegExp(s?`\\[${d}\\s*[^\\]]*\\]`:`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,r){let a=RegExp(s?`^\\[${d}\\s*([^\\]]*)\\]`:`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),o=e.match(a);if(!o)return;let c=``,l=``;if(s){let[,e]=o;l=e}else{let[,e,t]=o;l=e,c=t||``}let u=i(l.trim());return{type:t,raw:o[0],content:c.trim(),attributes:u}}},renderMarkdown:e=>{let t=``;r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>e.type===`text`).map(e=>e.text).join(``));let n=a(u(e.attrs||{})),i=n?` ${n}`:``;return s?`[${l}${i}]`:`[${l}${i}]${t}[/${l}]`}}}function Nv(e,t,n){let r=e.split(`
113
+ `),i=[],a=``,o=0,s=t.baseIndentSize||2;for(;o<r.length;){let e=r[o],c=e.match(t.itemPattern);if(!c){if(i.length>0)break;if(e.trim()===``){o+=1,a=`${a}${e}
114
+ `;continue}else return}let l=t.extractItemData(c),{indentLevel:u,mainContent:d}=l;a=`${a}${e}
115
+ `;let f=[d];for(o+=1;o<r.length;){let e=r[o];if(e.trim()===``){let t=r.slice(o+1).findIndex(e=>e.trim()!==``);if(t===-1)break;if((r[o+1+t].match(/^(\s*)/)?.[1]?.length||0)>u){f.push(e),a=`${a}${e}
116
+ `,o+=1;continue}else break}if((e.match(/^(\s*)/)?.[1]?.length||0)>u)f.push(e),a=`${a}${e}
117
+ `,o+=1;else break}let p,m=f.slice(1);if(m.length>0){let e=m.map(e=>e.slice(u+s)).join(`
118
+ `);e.trim()&&(p=t.customNestedParser?t.customNestedParser(e):n.blockTokens(e))}let h=t.createToken(l,p);i.push(h)}if(i.length!==0)return{items:i,raw:a}}function Pv(e,t,n,r){if(!e||!Array.isArray(e.content))return``;let i=typeof n==`function`?n(r):n,[a,...o]=e.content,s=`${i}${t.renderChildren([a])}`;return o&&o.length>0&&o.forEach((e,n)=>{let r=t.renderChild?.call(t,e,n+1)??t.renderChildren([e]);if(r!=null){let n=r.split(`
119
+ `).map(e=>e?t.indent(e):t.indent(``)).join(`
120
+ `);s+=e.type===`paragraph`?`
121
+
122
+ ${n}`:`
123
+ ${n}`}}),s}function Fv(e,t){let n={...e};return Tv(e)&&Tv(t)&&Object.keys(t).forEach(r=>{Tv(t[r])&&Tv(e[r])?n[r]=Fv(e[r],t[r]):n[r]=t[r]}),n}function Iv(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants((t,r)=>{let i=a.mapping.map(r),s=a.mapping.map(r)+t.nodeSize,c=null;if(t.marks.forEach(e=>{if(e!==o)return!1;c=e}),!c)return;let l=!1;if(Object.keys(n).forEach(e=>{n[e]!==c.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});a.removeMark(i,s,e.type),a.addMark(i,s,t)}}),a.docChanged&&t.view.dispatch(a)}var Lv=class{constructor(e){this.find=e.find,this.handler=e.handler,this.undoable=e.undoable??!0}},Rv=(e,t)=>{if(cg(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn(`[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".`),r.push(n.replaceWith)),r};function zv(e){let{editor:t,from:n,to:r,text:i,rules:a,plugin:o}=e,{view:s}=t;if(s.composing)return!1;let c=s.state.doc.resolve(n);if(c.parent.type.spec.code||(c.nodeBefore||c.nodeAfter)?.marks.find(e=>e.type.spec.code))return!1;let l=!1,u=B_(c)+i;return a.forEach(e=>{if(l)return;let a=Rv(u,e.find);if(!a)return;let c=s.state.tr,d=Uh({state:s.state,transaction:c}),f={from:n-(a[0].length-i.length),to:r},{commands:p,chain:m,can:h}=new Wh({editor:t,state:d});e.handler({state:d,range:f,match:a,commands:p,chain:m,can:h})===null||!c.steps.length||(e.undoable&&c.setMeta(o,{transform:c,from:n,to:r,text:i}),s.dispatch(c),l=!0)}),l}function Bv(e){let{editor:t,rules:n}=e,r=new K({state:{init(){return null},apply(e,i,a){let o=e.getMeta(r);if(o)return o;let s=e.getMeta(`applyInputRules`);return s&&setTimeout(()=>{let{text:e}=s;e=typeof e==`string`?e:f_(B.from(e),a.schema);let{from:i}=s;zv({editor:t,from:i,to:i+e.length,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput(e,i,a,o){return zv({editor:t,from:i,to:a,text:o,rules:n,plugin:r})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&zv({editor:t,from:i.pos,to:i.pos,text:``,rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if(i.key!==`Enter`)return!1;let{$cursor:a}=e.state.selection;return a?zv({editor:t,from:a.pos,to:a.pos,text:`
124
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var Vv=class{constructor(e={}){this.type=`extendable`,this.parent=null,this.child=null,this.name=``,this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...Z(X(this,`addOptions`,{name:this.name}))}}get storage(){return{...Z(X(this,`addStorage`,{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>Fv(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name=`name`in e?e.name:t.parent.name,t}},Hv=class e extends Vv{constructor(){super(...arguments),this.type=`mark`}static create(t={}){return new e(typeof t==`function`?t():t)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>e?.type.name===t.name))return!1;let a=i.find(e=>e?.type.name===t.name);return a&&n.removeStoredMark(a),n.insertText(` `,r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},Uv=class{constructor(e){this.find=e.find,this.handler=e.handler}},Wv=(e,t,n)=>{if(cg(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn(`[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".`),n.push(t.replaceWith)),n}):[]};function Gv(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:c,chain:l,can:u}=new Wh({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,i,(e,t)=>{if(e.type?.spec?.code||!(e.isText||e.isTextblock||e.isInline))return;let f=e.content?.size??e.nodeSize??0,p=Math.max(r,t),m=Math.min(i,t+f);p>=m||Wv(e.isText?e.text||``:e.textBetween(p-t,m-t,void 0,``),a.find,o).forEach(e=>{if(e.index===void 0)return;let t=p+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},f=a.handler({state:n,range:i,match:e,commands:c,chain:l,can:u,pasteEvent:o,dropEvent:s});d.push(f)})}),d.every(e=>e!==null)}var Kv=null,qv=e=>{var t;let n=new ClipboardEvent(`paste`,{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData(`text/html`,e),n};function Jv(e){let{editor:t,rules:n}=e,r=null,i=!1,a=!1,o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,s;try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}let c=({state:e,from:n,to:r,rule:i,pasteEvt:a})=>{let c=e.tr;if(!(!Gv({editor:t,state:Uh({state:e,transaction:c}),from:Math.max(n-1,0),to:r.b-1,rule:i,pasteEvent:a,dropEvent:s})||!c.steps.length)){try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}return o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,c}};return n.map(e=>new K({view(e){let n=n=>{r=e.dom.parentElement?.contains(n.target)?e.dom.parentElement:null,r&&(Kv=t)},i=()=>{Kv&&=null};return window.addEventListener(`dragstart`,n),window.addEventListener(`dragend`,i),{destroy(){window.removeEventListener(`dragstart`,n),window.removeEventListener(`dragend`,i)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(a=r===e.dom.parentElement,s=t,!a){let e=Kv;e?.isEditable&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{let n=t.clipboardData?.getData(`text/html`);return o=t,i=!!n?.includes(`data-pm-slice`),!1}}},appendTransaction:(t,n,r)=>{let s=t[0],l=s.getMeta(`uiEvent`)===`paste`&&!i,u=s.getMeta(`uiEvent`)===`drop`&&!a,d=s.getMeta(`applyPasteRules`),f=!!d;if(!l&&!u&&!f)return;if(f){let{text:t}=d;t=typeof t==`string`?t:f_(B.from(t),r.schema);let{from:n}=d,i=n+t.length,a=qv(t);return c({rule:e,state:r,from:n,to:{b:i},pasteEvt:a})}let p=n.doc.content.findDiffStart(r.doc.content),m=n.doc.content.findDiffEnd(r.doc.content);if(!(!Cv(p)||!m||p===m.b))return c({rule:e,state:r,from:p,to:m,pasteEvt:o})}}))}var Yv=class{constructor(e,t){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=O_(e),this.schema=T_(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n=X(t,`addCommands`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:R_(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this;return D_([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:R_(t.name,this.schema)},r=[],i=X(t,`addKeyboardShortcuts`,n),a={};if(t.type===`mark`&&X(t,`exitable`,n)&&(a.ArrowRight=()=>Hv.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));a={...a,...t}}let o=sf(a);r.push(o);let s=X(t,`addInputRules`,n);if(W_(t,e.options.enableInputRules)&&s){let t=s();if(t&&t.length){let n=Bv({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let c=X(t,`addPasteRules`,n);if(W_(t,e.options.enablePasteRules)&&c){let t=c();if(t&&t.length){let n=Jv({editor:e,rules:t});r.push(...n)}}let l=X(t,`addProseMirrorPlugins`,n);if(l){let e=l();r.push(...e)}return r})}get attributes(){return g_(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=h_(this.extensions);return Object.fromEntries(t.filter(e=>!!X(e,`addNodeView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=X(t,`addNodeView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:$h(t.name,this.schema)});if(!r)return[];let i=r();return i?[t.name,(r,a,o,s,c)=>i({node:r,view:a,getPos:o,decorations:s,innerDecorations:c,editor:e,extension:t,HTMLAttributes:b_(r,n)})]:[]}))}dispatchTransaction(e){let{editor:t}=this;return D_([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:R_(n.name,this.schema)},i=X(n,`dispatchTransaction`,r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return D_([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:R_(n.name,this.schema)},i=X(n,`transformPastedHTML`,r);return i?(t,n)=>{let a=e(t,n);return i.call(r,a)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=h_(this.extensions);return Object.fromEntries(t.filter(e=>!!X(e,`addMarkView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=X(t,`addMarkView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:pg(t.name,this.schema)});return r?[t.name,(i,a,o)=>{let s=b_(i,n);return r()({mark:i,view:a,inline:o,editor:e,extension:t,HTMLAttributes:s,updateAttributes:t=>{Iv(i,e,t)}})}]:[]}))}destroy(){this.extensions.forEach(e=>{let t=e;for(;t.parent;){let e=t.parent;e.child===t&&(e.child=null),t=e}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{let t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:R_(e.name,this.schema)};e.type===`mark`&&((Z(X(e,`keepOnSplit`,t))??!0)&&this.splittableMarks.push(e.name),(Z(X(e,`clearable`,t))??!0)||this.nonClearableMarks.push(e.name));let n=X(e,`onBeforeCreate`,t),r=X(e,`onCreate`,t),i=X(e,`onUpdate`,t),a=X(e,`onSelectionUpdate`,t),o=X(e,`onTransaction`,t),s=X(e,`onFocus`,t),c=X(e,`onBlur`,t),l=X(e,`onDestroy`,t);n&&this.editor.on(`beforeCreate`,n),r&&this.editor.on(`create`,r),i&&this.editor.on(`update`,i),a&&this.editor.on(`selectionUpdate`,a),o&&this.editor.on(`transaction`,o),s&&this.editor.on(`focus`,s),c&&this.editor.on(`blur`,c),l&&this.editor.on(`destroy`,l)})}};Yv.resolve=O_,Yv.sort=D_,Yv.flatten=d_,Hh({},{ClipboardTextSerializer:()=>Zv,Commands:()=>Qv,Delete:()=>$v,Drop:()=>ey,Editable:()=>ty,FocusEvents:()=>ry,Keymap:()=>iy,Paste:()=>ay,Tabindex:()=>oy,TextDirection:()=>sy,focusEventsPluginKey:()=>ny});var Xv=class e extends Vv{constructor(){super(...arguments),this.type=`extension`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},Zv=Xv.create({name:`clipboardTextSerializer`,addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new K({key:new q(`clipboardTextSerializer`),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,a=A_(n),{blockSeparator:o}=this.options,s={...o===void 0?{}:{blockSeparator:o},textSerializers:a};return[...i.ranges].sort((e,t)=>e.$from.pos-t.$from.pos).map(({$from:e,$to:t})=>k_(r,{from:e.pos,to:t.pos},s)).join(o??`
125
+
126
+ `)}}})]}}),Qv=Xv.create({name:`commands`,addCommands(){return{...Gh}}}),$v=Xv.create({name:`delete`,onUpdate({transaction:e,appendedTransactions:t}){let n=()=>{var n;if(((n=this.editor.options.coreExtensionOptions?.delete)?.filterTransaction)?.call(n,e)??e.getMeta(`y-sync$`))return;let r=o_(e.before,[e,...t]);F_(r).forEach(t=>{r.mapping.mapResult(t.oldRange.from).deletedAfter&&r.mapping.mapResult(t.oldRange.to).deletedBefore&&r.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,i)=>{let a=i+n.nodeSize-2,o=t.oldRange.from<=i&&a<=t.oldRange.to;this.editor.emit(`delete`,{type:`node`,node:n,from:i,to:a,newFrom:r.mapping.map(i),newTo:r.mapping.map(a),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:r})})});let i=r.mapping;r.steps.forEach((t,n)=>{if(t instanceof ma){let a=i.slice(n).map(t.from,-1),o=i.slice(n).map(t.to),s=i.invert().map(a,-1),c=i.invert().map(o),l=a>0?r.doc.nodeAt(a-1)?.marks.some(e=>e.eq(t.mark)):!1,u=r.doc.nodeAt(o)?.marks.some(e=>e.eq(t.mark));this.editor.emit(`delete`,{type:`mark`,mark:t.mark,from:t.from,to:t.to,deletedRange:{from:s,to:c},newRange:{from:a,to:o},partial:!!(u||l),editor:this.editor,transaction:e,combinedTransform:r})}})};this.editor.options.coreExtensionOptions?.delete?.async??!0?setTimeout(n,0):n()}}),ey=Xv.create({name:`drop`,addProseMirrorPlugins(){return[new K({key:new q(`tiptapDrop`),props:{handleDrop:(e,t,n,r)=>{this.editor.emit(`drop`,{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),ty=Xv.create({name:`editable`,addProseMirrorPlugins(){return[new K({key:new q(`editable`),props:{editable:()=>this.editor.options.editable}})]}}),ny=new q(`focusEvents`),ry=Xv.create({name:`focusEvents`,addProseMirrorPlugins(){let{editor:e}=this;return[new K({key:ny,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta(`focus`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta(`blur`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1}}}})]}}),iy=Xv.create({name:`keymap`,addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:a}=n,{pos:o,parent:s}=a,c=a.parent.isTextblock&&o>0?t.doc.resolve(o-1):a,l=c.parent.type.spec.isolating,u=a.pos-a.parentOffset,d=l&&c.parent.childCount===1?u===a.pos:U.atStart(r).from===o;return!i||!s.type.isTextblock||s.textContent.length||!d||d&&a.parent.type.name===`paragraph`?!1:e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return bg()||zg()?i:r},addProseMirrorPlugins(){return[new K({key:new q(`clearDocument`),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta(`composition`)))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta(`preventClearDocument`));if(!r||i)return;let{empty:a,from:o,to:s}=t.selection,c=U.atStart(t.doc).from,l=U.atEnd(t.doc).to;if(a||!(o===c&&s===l)||!K_(n.doc))return;let u=n.tr,d=Uh({state:n,transaction:u}),{commands:f}=new Wh({editor:this.editor,state:d});if(f.clearNodes(),u.steps.length)return u}})]}}),ay=Xv.create({name:`paste`,addProseMirrorPlugins(){return[new K({key:new q(`tiptapPaste`),props:{handlePaste:(e,t,n)=>{this.editor.emit(`paste`,{editor:this.editor,event:t,slice:n})}}})]}}),oy=Xv.create({name:`tabindex`,addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new K({key:new q(`tabindex`),props:{attributes:()=>!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:this.options.value??`0`}}})]}}),sy=Xv.create({name:`textDirection`,addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=h_(this.extensions);return[{types:e.filter(e=>e.name!==`text`).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute(`dir`);return t&&(t===`ltr`||t===`rtl`||t===`auto`)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new K({key:new q(`textDirection`),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}});function cy(e){return new Lv({find:e.find,handler:({state:t,range:n,match:r})=>{let i=Z(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if(I_(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;l<n.to&&a.delete(l,n.to),c>n.from&&a.delete(n.from+r,c);let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function ly(e){return new Lv({find:e.find,handler:({state:t,range:n,match:r})=>{let i=Z(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()},undoable:e.undoable})}function uy(e){return new Lv({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=Z(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,a)},undoable:e.undoable})}function dy(e){return new Lv({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=Z(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&Ea(s,e.type,a);if(!c)return null;if(o.wrap(s,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,a=r||n.$to.parentOffset&&n.$from.marks();if(a){let e=a.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t=e.type.name===`bulletList`||e.type.name===`orderedList`?`listItem`:`taskList`;i().updateAttributes(t,a).run()}let l=o.doc.resolve(n.from-1).nodeBefore;l&&l.type===e.type&&Ra(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)},undoable:e.undoable})}var fy=class e extends Vv{constructor(){super(...arguments),this.type=`node`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}};function py(e){return new Uv({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=Z(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let i=c.search(/\S/),u=n.from+c.indexOf(s),d=u+s.length;if(I_(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>u).length)return null;d<n.to&&o.delete(d,n.to),u>n.from&&o.delete(n.from+i,u),l=n.from+i+s.length,o.addMark(n.from+i,l,e.type.create(a||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(e.type)}}})}var my=(e,t)=>{if(e===`slot`)return 0;if(e instanceof Function)return e(t);let{children:n,...r}=t??{};if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);return[e,r,n]};function hy(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&vy(e.charCodeAt(r-1))&&_y(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=hy(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function gy(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&vy(e.charCodeAt(i-1))&&_y(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=gy(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function _y(e){return e>=56320&&e<57344}function vy(e){return e>=55296&&e<56320}var yy=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.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 RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return hy(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return gy(this,e,t,n)}findIndex(e){if(e==0)return xy(0,e);if(e==this.size)return xy(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?xy(t+1,i):xy(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};yy.empty=new yy([],0);var by={index:0,offset:0};function xy(e,t){return by.index=e,by.offset=t,by}function Sy(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Sy(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Sy(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var Cy=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||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&&Sy(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 RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};Cy.none=[];var wy=class extends Error{},Ty=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=Dy(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Ey(this.content,t+this.openStart,n+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(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(yy.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};Ty.empty=new Ty(yy.empty,0,0);function Ey(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(Ey(a.content,t-i-1,n-i-1)))}function Dy(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=Dy(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function Oy(e,t,n){if(n.openStart>e.depth)throw new wy(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new wy(`Inconsistent open depths`);return ky(e,t,n,0)}function ky(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=ky(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return Py(a,Iy(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return Py(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=Ly(n,e);return Py(a,Fy(e,i,o,t,r))}}function Ay(e,t){if(!t.type.compatibleContent(e.type))throw new wy(`Cannot join `+t.type.name+` onto `+e.type.name)}function jy(e,t,n){let r=e.node(n);return Ay(r,t.node(n)),r}function My(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Ny(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(My(e.nodeAfter,r),a++));for(let e=a;e<o;e++)My(i.child(e),r);t&&t.depth==n&&t.textOffset&&My(t.nodeBefore,r)}function Py(e,t){if(!e.type.validContent(t))throw new wy(`Invalid content for node `+e.type.name);return e.copy(t)}function Fy(e,t,n,r,i){let a=e.depth>i&&jy(e,t,i+1),o=r.depth>i&&jy(n,r,i+1),s=[];return Ny(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(Ay(a,o),My(Py(a,Fy(e,t,n,r,i+1)),s)):(a&&My(Py(a,Iy(e,t,i+1)),s),Ny(t,n,i,s),o&&My(Py(o,Iy(n,r,i+1)),s)),Ny(r,null,i,s),new yy(s)}function Iy(e,t,n){let r=[];return Ny(null,e,n,r),e.depth>n&&My(Py(jy(e,t,n+1),Iy(e,t,n+1)),r),Ny(t,null,n,r),new yy(r)}function Ly(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(yy.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Ry=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,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 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 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 n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}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 n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Cy.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}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 n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new Hy(this,e,n);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(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=Vy.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else Vy.set(t,r=new zy);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%By,i}},zy=class{constructor(){this.elts=[],this.i=0}},By=12,Vy=new WeakMap,Hy=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}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)}},Uy=Object.create(null),Wy=class e{constructor(e,t,n,r=Cy.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||yy.empty}get children(){return this.content.content}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,n,r=0){this.content.nodesBetween(e,t,n,r,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,n,r){return this.content.textBetween(e,t,n,r)}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,n){return this.type==e&&Sy(this.attrs,t||e.defaultAttrs||Uy)&&Cy.sameSet(this.marks,n||Cy.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}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,n=!1){if(e==t)return Ty.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new Ty(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return Oy(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return Ry.resolveCached(this,e)}resolveNoCache(e){return Ry.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}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()+`)`),Gy(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=yy.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.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),this.type.checkAttrs(this.attrs);let e=Cy.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Cy.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.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(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=yy.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};Wy.prototype.text=void 0;function Gy(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var Ky=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new qy(t,n);if(r.next==null)return e.empty;let i=Jy(r);r.next&&r.err(`Unexpected trailing text`);let a=ib(tb(i));return ab(a,r),a}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,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}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 n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return yy.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
127
+ `)}};Ky.empty=new Ky(!0);var qy=class{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 SyntaxError(e+` (in content expression '`+this.string+`')`)}};function Jy(e){let t=[];do t.push(Yy(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function Yy(e){let t=[];do t.push(Xy(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function Xy(e){let t=eb(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=Qy(e,t);else break;return t}function Zy(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function Qy(e,t){let n=Zy(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:Zy(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function $y(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function eb(e){if(e.eat(`(`)){let t=Jy(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=$y(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function tb(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function nb(e,t){return t-e}function rb(e,t){let n=[];return r(t),n.sort(nb);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function ib(e){let t=Object.create(null);return n(rb(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);rb(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new Ky(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(nb);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function ab(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}var ob=65535,sb=2**16;function cb(e,t){return e+t*sb}function lb(e){return e&ob}function ub(e){return(e-(e&ob))/sb}var db=1,fb=2,pb=4,mb=8,hb=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&mb)>0}get deletedBefore(){return(this.delInfo&(db|pb))>0}get deletedAfter(){return(this.delInfo&(fb|pb))>0}get deletedAcross(){return(this.delInfo&pb)>0}},gb=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=lb(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+ub(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:cb(o/3,e-s),f=e==s?fb:e==u?db:pb;return(t<0?e!=s:e!=u)&&(f|=mb),new hb(a,f,d)}r+=l-c}return n?e+r:new hb(e+r,0,null)}touches(e,t){let n=0,r=lb(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};gb.empty=new gb([]);var _b=Object.create(null),vb=class{getMap(){return gb.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=_b[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in _b)throw RangeError(`Duplicate use of step JSON ID `+e);return _b[e]=t,t.prototype.jsonID=e,t}},yb=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof wy)return e.fail(t.message);throw t}}};function bb(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(bb(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return yy.fromArray(r)}var xb=class e extends vb{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new Ty(bb(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return yb.fromReplace(e,this.from,this.to,i)}invert(){return new Sb(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};vb.jsonID(`addMark`,xb);var Sb=class e extends vb{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new Ty(bb(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return yb.fromReplace(e,this.from,this.to,n)}invert(){return new xb(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};vb.jsonID(`removeMark`,Sb);var Cb=class e extends vb{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return yb.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return yb.fromReplace(e,this.pos,this.pos+1,new Ty(yy.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new wb(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};vb.jsonID(`addNodeMark`,Cb);var wb=class e extends vb{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return yb.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return yb.fromReplace(e,this.pos,this.pos+1,new Ty(yy.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Cb(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};vb.jsonID(`removeNodeMark`,wb);var Tb=class e extends vb{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&Db(e,this.from,this.to)?yb.fail(`Structure replace would overwrite content`):yb.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new gb([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?Ty.empty:new Ty(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?Ty.empty:new Ty(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,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(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,Ty.fromJSON(t,n.slice),!!n.structure)}};Tb.MAP_BIAS=1,vb.jsonID(`replace`,Tb);var Eb=class e extends vb{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(Db(e,this.from,this.gapFrom)||Db(e,this.gapTo,this.to)))return yb.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return yb.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?yb.fromReplace(e,this.from,this.to,n):yb.fail(`Content does not fit in gap`)}getMap(){return new gb([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,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(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,Ty.fromJSON(t,n.slice),n.insert,!!n.structure)}};vb.jsonID(`replaceAround`,Eb);function Db(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}var Ob=class e extends vb{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return yb.fail(`No node at attribute step's position`);let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return yb.fromReplace(e,this.pos,this.pos+1,new Ty(yy.from(r),0,+!t.isLeaf))}getMap(){return gb.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:`attr`,pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!=`number`||typeof n.attr!=`string`)throw RangeError(`Invalid input for AttrStep.fromJSON`);return new e(n.pos,n.attr,n.value)}};vb.jsonID(`attr`,Ob);var kb=class e extends vb{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return yb.ok(n)}getMap(){return gb.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new e(n.attr,n.value)}};vb.jsonID(`docAttr`,kb);var Ab=class extends Error{};Ab=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},Ab.prototype=Object.create(Error.prototype),Ab.prototype.constructor=Ab,Ab.prototype.name=`TransformError`;var jb=Object.create(null),Mb=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Nb(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=Ty.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,a=this.ranges;for(let o=0;o<a.length;o++){let{$from:s,$to:c}=a[o],l=e.mapping.slice(i);e.replaceRange(l.map(s.pos),l.map(c.pos),o?Ty.empty:t),o==0&&Ub(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n),c=s.map(a.pos),l=s.map(o.pos);i?e.deleteRange(c,l):(e.replaceRangeWith(c,l,t),Ub(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new Ib(e):Hb(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?Hb(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):Hb(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Bb(e.node(0))}static atStart(e){return Hb(e,e,0,0,1)||new Bb(e)}static atEnd(e){return Hb(e,e,e.content.size,e.childCount,-1)||new Bb(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=jb[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in jb)throw RangeError(`Duplicate use of selection JSON ID `+e);return jb[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Ib.between(this.$anchor,this.$head).getBookmark()}};Mb.prototype.visible=!0;var Nb=class{constructor(e,t){this.$from=e,this.$to=t}},Pb=!1;function Fb(e){!Pb&&!e.parent.inlineContent&&(Pb=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var Ib=class e extends Mb{constructor(e,t=e){Fb(e),Fb(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return Mb.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=Ty.empty){if(super.replace(e,t),t==Ty.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new Lb(this.anchor,this.head)}toJSON(){return{type:`text`,anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!=`number`||typeof n.head!=`number`)throw RangeError(`Invalid input for TextSelection.fromJSON`);return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let e=Mb.findFrom(n,r,!0)||Mb.findFrom(n,-r,!0);if(e)n=e.$head;else return Mb.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(Mb.findFrom(t,-r,!0)||Mb.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};Mb.jsonID(`text`,Ib);var Lb=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return Ib.between(e.resolve(this.anchor),e.resolve(this.head))}},Rb=class e extends Mb{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),a=t.resolve(i);return r?Mb.near(a):new e(a)}content(){return new Ty(yy.from(this.node),0,0)}eq(t){return t instanceof e&&t.anchor==this.anchor}toJSON(){return{type:`node`,anchor:this.anchor}}getBookmark(){return new zb(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!=`number`)throw RangeError(`Invalid input for NodeSelection.fromJSON`);return new e(t.resolve(n.anchor))}static create(t,n){return new e(t.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};Rb.prototype.visible=!1,Mb.jsonID(`node`,Rb);var zb=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new Lb(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&Rb.isSelectable(n)?new Rb(t):Mb.near(t)}},Bb=class e extends Mb{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=Ty.empty){if(t==Ty.empty){e.delete(0,e.doc.content.size);let t=Mb.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:`all`}}static fromJSON(t){return new e(t)}map(t){return new e(t)}eq(t){return t instanceof e}getBookmark(){return Vb}};Mb.jsonID(`all`,Bb);var Vb={map(){return this},resolve(e){return new Bb(e)}};function Hb(e,t,n,r,i,a=!1){if(t.inlineContent)return Ib.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(!r.isAtom){let t=Hb(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&Rb.isSelectable(r))return Rb.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function Ub(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof Tb||i instanceof Eb))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(Mb.near(e.doc.resolve(o),n))}function Wb(e,t){return!t||!e?e:e.bind(t)}var Gb=class{constructor(e,t,n){this.name=e,this.init=Wb(t.init,n),this.apply=Wb(t.apply,n)}};new Gb(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new Gb(`selection`,{init(e,t){return e.selection||Mb.atStart(t.doc)},apply(e){return e.selection}}),new Gb(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new Gb(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}});var Kb=(e,t)=>{let{state:n,view:r}=e,{selection:i}=n;if(!i.empty)return!1;let{$from:a}=i;if(a.parentOffset!==0)return!1;let o=a.depth-1,s=a.node(o),c=a.index(o);if(c===0)return!1;if(s.type===t)return e.commands.lift(t.name);let l=s.child(c-1);if(l.type!==t||!l.lastChild?.isTextblock)return!1;let u=a.before(),d=u-1-1,{tr:f}=n;return f.delete(u,a.after()).insert(d,a.parent.content),f.setSelection(Ib.create(f.doc,d)),r.dispatch(f.scrollIntoView()),!0},qb=/^\s*>\s$/,Jb=fy.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return my(`blockquote`,{...y_(this.options.HTMLAttributes,e),children:my(`slot`,{})})},parseMarkdown:(e,t)=>{let n=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach((e,r)=>{let i=(t.renderChild?.call(t,e,r)??t.renderChildren([e])).split(`
128
+ `).map(e=>e.trim()===``?`>`:`> ${e}`);n.push(i.join(`
129
+ `))}),n.join(`
130
+ >
131
+ `)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>Kb(this.editor,this.type)}},addInputRules(){return[dy({find:qb,type:this.type})]}}),Yb=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Xb=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Zb=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Qb=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,$b=Hv.create({name:`bold`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!==`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name===this.name},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return my(`strong`,{...y_(this.options.HTMLAttributes,e),children:my(`slot`,{})})},markdownTokenName:`strong`,parseMarkdown:(e,t)=>t.applyMark(`bold`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<strong>`,close:`</strong>`}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[cy({find:Yb,type:this.type}),cy({find:Zb,type:this.type})]},addPasteRules(){return[py({find:Xb,type:this.type}),py({find:Qb,type:this.type})]}}),ex=e=>{let t=/`([^`]+)`(?!`)$/.exec(e);return!t||t.index>0&&e[t.index-1]==="`"?null:{index:t.index,text:t[0],replaceWith:t[1]}},tx=e=>{let t=/`([^`]+)`(?!`)/g,n=[],r;for(;(r=t.exec(e))!==null;)r.index>0&&e[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n},nx=Hv.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,y_(this.options.HTMLAttributes,e),0]},markdownTokenName:`codespan`,parseMarkdown:(e,t)=>t.applyMark(`code`,[{type:`text`,text:e.text||``}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:``,addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[cy({find:ex,type:this.type})]},addPasteRules(){return[py({find:tx,type:this.type})]}}),rx=4,ix=/^```([a-z]+)?[\s\n]$/,ax=/^~~~([a-z]+)?[\s\n]$/,ox=fy.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:rx,HTMLAttributes:{}}},content:`text*`,marks:``,group:`block`,code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{let{languageClassPrefix:t}=this.options;return t&&[...e.firstElementChild?.classList||[]].filter(e=>e.startsWith(t)).map(e=>e.replace(t,``))[0]||null},rendered:!1}}},parseHTML(){return[{tag:`pre`,preserveWhitespace:`full`}]},renderHTML({node:e,HTMLAttributes:t}){return[`pre`,y_(this.options.HTMLAttributes,t),[`code`,{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:`code`,parseMarkdown:(e,t)=>e.raw?.startsWith("```")===!1&&e.raw?.startsWith(`~~~`)===!1&&e.codeBlockStyle!==`indented`?[]:t.createNode(`codeBlock`,{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[]),renderMarkdown:(e,t)=>{let n=``,r=e.attrs?.language||``;return n=e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join(`
132
+ `):`\`\`\`${r}
133
+
134
+ \`\`\``,n},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,`paragraph`,e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??rx,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;if(i.parent.type!==this.type)return!1;let o=` `.repeat(t);return a?e.commands.insertContent(o):e.commands.command(({tr:e})=>{let{from:t,to:i}=r,a=n.doc.textBetween(t,i,`
135
+ `,`
136
+ `).split(`
137
+ `).map(e=>o+e).join(`
138
+ `);return e.replaceWith(t,i,n.schema.text(a)),!0})},"Shift-Tab":({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??rx,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;return i.parent.type===this.type?a?e.commands.command(({tr:e})=>{let{pos:r}=i,a=i.start(),o=i.end(),s=n.doc.textBetween(a,o,`
139
+ `,`
140
+ `).split(`
141
+ `),c=0,l=0,u=r-a;for(let e=0;e<s.length;e+=1){if(l+s[e].length>=u){c=e;break}l+=s[e].length+1}let d=s[c].match(/^ */)?.[0]||``,f=Math.min(d.length,t);if(f===0)return!0;let p=a;for(let e=0;e<c;e+=1)p+=s[e].length+1;return e.delete(p,p+f),r-p<=f&&e.setSelection(W.create(e.doc,p)),!0}):e.commands.command(({tr:e})=>{let{from:i,to:a}=r,o=n.doc.textBetween(i,a,`
142
+ `,`
143
+ `).split(`
144
+ `).map(e=>{let n=e.match(/^ */)?.[0]||``,r=Math.min(n.length,t);return e.slice(r)}).join(`
145
+ `);return e.replaceWith(i,a,n.schema.text(o)),!0}):!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let a=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
146
+
147
+ `);return!a||!o?!1:e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:a}=n;if(!a||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return o===void 0?!1:r.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(U.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[uy({find:ix,type:this.type,getAttributes:e=>({language:e[1]})}),uy({find:ax,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new K({key:new q(`codeBlockVSCodeHandler`),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData(`text/plain`),r=t.clipboardData.getData(`vscode-editor-data`),i=(r?JSON.parse(r):void 0)?.mode;if(!n||!i)return!1;let{tr:a,schema:o}=e.state,s=o.text(n.replace(/\r\n?/g,`
148
+ `));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type&&a.setSelection(W.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}}),sx=fy.create({name:`doc`,topNode:!0,content:`block+`,renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
149
+
150
+ `):``}),cx=fy.create({name:`hardBreak`,markdownTokenName:`br`,addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:`inline`,selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:`br`}]},renderHTML({HTMLAttributes:e}){return[`br`,y_(this.options.HTMLAttributes,e)]},renderText(){return`
151
+ `},renderMarkdown:()=>`
152
+ `,parseMarkdown:()=>({type:`hardBreak`}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:a}=this.options,{splittableMarks:o}=r.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&s&&a){let t=s.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),lx=fy.create({name:`heading`,addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:`inline*`,group:`block`,defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,y_(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode(`heading`,{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{let n=e.attrs?.level?parseInt(e.attrs.level,10):1,r=`#`.repeat(n);return e.content?`${r} ${t.renderChildren(e.content)}`:``},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,`paragraph`,e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>uy({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),ux=fy.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,y_(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!xv(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return q_(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(W.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(G.create(t.doc,n.pos)):t.setSelection(W.create(t.doc,n.pos));else{let i=(e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType)?.create();i&&(t.insert(r,i),t.setSelection(W.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[ly({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),dx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,fx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,px=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,mx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,hx=Hv.create({name:`italic`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`em`},{tag:`i`,getAttrs:e=>e.style.fontStyle!==`normal`&&null},{style:`font-style=normal`,clearMark:e=>e.type.name===this.name},{style:`font-style=italic`}]},renderHTML({HTMLAttributes:e}){return[`em`,y_(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:`em`,parseMarkdown:(e,t)=>t.applyMark(`italic`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<em>`,close:`</em>`}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[cy({find:dx,type:this.type}),cy({find:px,type:this.type})]},addPasteRules(){return[py({find:fx,type:this.type}),py({find:mx,type:this.type})]}}),gx=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,_x=`ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2`,vx=`numeric`,yx=`ascii`,bx=`alpha`,xx=`asciinumeric`,Sx=`alphanumeric`,Cx=`domain`,wx=`emoji`,Tx=`scheme`,Ex=`slashscheme`,Dx=`whitespace`;function Ox(e,t){return e in t||(t[e]=[]),t[e]}function kx(e,t,n){t[vx]&&(t[xx]=!0,t[Sx]=!0),t[yx]&&(t[xx]=!0,t[bx]=!0),t[xx]&&(t[Sx]=!0),t[bx]&&(t[Sx]=!0),t[Sx]&&(t[Cx]=!0),t[wx]&&(t[Cx]=!0);for(let r in t){let t=Ox(r,n);t.indexOf(e)<0&&t.push(e)}}function Ax(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function jx(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}jx.groups={},jx.prototype={accepts(){return!!this.t},go(e){let t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){let r=t.jr[n][0],i=t.jr[n][1];if(i&&r.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){r||=jx.groups;let i;return t&&t.j?i=t:(i=new jx(t),n&&r&&kx(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,a=e.length;if(!a)return i;for(let t=0;t<a-1;t++)i=i.tt(e[t]);return i.tt(e[a-1],t,n,r)},tt(e,t,n,r){r||=jx.groups;let i=this;if(t&&t.j)return i.j[e]=t,t;let a=t,o,s=i.go(e);return s?(o=new jx,Object.assign(o.j,s.j),o.jr.push.apply(o.jr,s.jr),o.jd=s.jd,o.t=s.t):o=new jx,a&&(r&&(o.t&&typeof o.t==`string`?kx(a,Object.assign(Ax(o.t,r),n),r):n&&kx(a,n,r)),o.t=a),i.j[e]=o,o}};var Q=(e,t,n,r,i)=>e.ta(t,n,r,i),Mx=(e,t,n,r,i)=>e.tr(t,n,r,i),Nx=(e,t,n,r,i)=>e.ts(t,n,r,i),$=(e,t,n,r,i)=>e.tt(t,n,r,i),Px=`WORD`,Fx=`UWORD`,Ix=`ASCIINUMERICAL`,Lx=`ALPHANUMERICAL`,Rx=`LOCALHOST`,zx=`TLD`,Bx=`UTLD`,Vx=`SCHEME`,Hx=`SLASH_SCHEME`,Ux=`NUM`,Wx=`WS`,Gx=`NL`,Kx=`OPENBRACE`,qx=`CLOSEBRACE`,Jx=`OPENBRACKET`,Yx=`CLOSEBRACKET`,Xx=`OPENPAREN`,Zx=`CLOSEPAREN`,Qx=`OPENANGLEBRACKET`,$x=`CLOSEANGLEBRACKET`,eS=`FULLWIDTHLEFTPAREN`,tS=`FULLWIDTHRIGHTPAREN`,nS=`LEFTCORNERBRACKET`,rS=`RIGHTCORNERBRACKET`,iS=`LEFTWHITECORNERBRACKET`,aS=`RIGHTWHITECORNERBRACKET`,oS=`FULLWIDTHLESSTHAN`,sS=`FULLWIDTHGREATERTHAN`,cS=`AMPERSAND`,lS=`APOSTROPHE`,uS=`ASTERISK`,dS=`AT`,fS=`BACKSLASH`,pS=`BACKTICK`,mS=`CARET`,hS=`COLON`,gS=`COMMA`,_S=`DOLLAR`,vS=`DOT`,yS=`EQUALS`,bS=`EXCLAMATION`,xS=`HYPHEN`,SS=`PERCENT`,CS=`PIPE`,wS=`PLUS`,TS=`POUND`,ES=`QUERY`,DS=`QUOTE`,OS=`FULLWIDTHMIDDLEDOT`,kS=`SEMI`,AS=`SLASH`,jS=`TILDE`,MS=`UNDERSCORE`,NS=`EMOJI`,PS=`SYM`,FS=Object.freeze({__proto__:null,ALPHANUMERICAL:Lx,AMPERSAND:cS,APOSTROPHE:lS,ASCIINUMERICAL:Ix,ASTERISK:uS,AT:dS,BACKSLASH:fS,BACKTICK:pS,CARET:mS,CLOSEANGLEBRACKET:$x,CLOSEBRACE:qx,CLOSEBRACKET:Yx,CLOSEPAREN:Zx,COLON:hS,COMMA:gS,DOLLAR:_S,DOT:vS,EMOJI:NS,EQUALS:yS,EXCLAMATION:bS,FULLWIDTHGREATERTHAN:sS,FULLWIDTHLEFTPAREN:eS,FULLWIDTHLESSTHAN:oS,FULLWIDTHMIDDLEDOT:OS,FULLWIDTHRIGHTPAREN:tS,HYPHEN:xS,LEFTCORNERBRACKET:nS,LEFTWHITECORNERBRACKET:iS,LOCALHOST:Rx,NL:Gx,NUM:Ux,OPENANGLEBRACKET:Qx,OPENBRACE:Kx,OPENBRACKET:Jx,OPENPAREN:Xx,PERCENT:SS,PIPE:CS,PLUS:wS,POUND:TS,QUERY:ES,QUOTE:DS,RIGHTCORNERBRACKET:rS,RIGHTWHITECORNERBRACKET:aS,SCHEME:Vx,SEMI:kS,SLASH:AS,SLASH_SCHEME:Hx,SYM:PS,TILDE:jS,TLD:zx,UNDERSCORE:MS,UTLD:Bx,UWORD:Fx,WORD:Px,WS:Wx}),IS=/[a-z]/,LS=/\p{L}/u,RS=/\p{Emoji}/u,zS=/\d/,BS=/\s/,VS=`\r`,HS=`
153
+ `,US=`️`,WS=`‍`,GS=``,KS=null,qS=null;function JS(e=[]){let t={};jx.groups=t;let n=new jx;KS??=QS(gx),qS??=QS(_x),$(n,`'`,lS),$(n,`{`,Kx),$(n,`}`,qx),$(n,`[`,Jx),$(n,`]`,Yx),$(n,`(`,Xx),$(n,`)`,Zx),$(n,`<`,Qx),$(n,`>`,$x),$(n,`(`,eS),$(n,`)`,tS),$(n,`「`,nS),$(n,`」`,rS),$(n,`『`,iS),$(n,`』`,aS),$(n,`<`,oS),$(n,`>`,sS),$(n,`&`,cS),$(n,`*`,uS),$(n,`@`,dS),$(n,"`",pS),$(n,`^`,mS),$(n,`:`,hS),$(n,`,`,gS),$(n,`$`,_S),$(n,`.`,vS),$(n,`=`,yS),$(n,`!`,bS),$(n,`-`,xS),$(n,`%`,SS),$(n,`|`,CS),$(n,`+`,wS),$(n,`#`,TS),$(n,`?`,ES),$(n,`"`,DS),$(n,`/`,AS),$(n,`;`,kS),$(n,`~`,jS),$(n,`_`,MS),$(n,`\\`,fS),$(n,`・`,OS);let r=Mx(n,zS,Ux,{[vx]:!0});Mx(r,zS,r);let i=Mx(r,IS,Ix,{[xx]:!0}),a=Mx(r,LS,Lx,{[Sx]:!0}),o=Mx(n,IS,Px,{[yx]:!0});Mx(o,zS,i),Mx(o,IS,o),Mx(i,zS,i),Mx(i,IS,i);let s=Mx(n,LS,Fx,{[bx]:!0});Mx(s,IS),Mx(s,zS,a),Mx(s,LS,s),Mx(a,zS,a),Mx(a,IS),Mx(a,LS,a);let c=$(n,HS,Gx,{[Dx]:!0}),l=$(n,VS,Wx,{[Dx]:!0}),u=Mx(n,BS,Wx,{[Dx]:!0});$(n,GS,u),$(l,HS,c),$(l,GS,u),Mx(l,BS,u),$(u,VS),$(u,HS),Mx(u,BS,u),$(u,GS,u);let d=Mx(n,RS,NS,{[wx]:!0});$(d,`#`),Mx(d,RS,d),$(d,US,d);let f=$(d,WS);$(f,`#`),Mx(f,RS,d);let p=[[IS,o],[zS,i]],m=[[IS,null],[LS,s],[zS,a]];for(let e=0;e<KS.length;e++)ZS(n,KS[e],zx,Px,p);for(let e=0;e<qS.length;e++)ZS(n,qS[e],Bx,Fx,m);kx(zx,{tld:!0,ascii:!0},t),kx(Bx,{utld:!0,alpha:!0},t),ZS(n,`file`,Vx,Px,p),ZS(n,`mailto`,Vx,Px,p),ZS(n,`http`,Hx,Px,p),ZS(n,`https`,Hx,Px,p),ZS(n,`ftp`,Hx,Px,p),ZS(n,`ftps`,Hx,Px,p),kx(Vx,{scheme:!0,ascii:!0},t),kx(Hx,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{[Tx]:!0}:{[Ex]:!0};r.indexOf(`-`)>=0?i[Cx]=!0:IS.test(r)?zS.test(r)?i[xx]=!0:i[yx]=!0:i[vx]=!0,Nx(n,r,r,i)}return Nx(n,`localhost`,Rx,{ascii:!0}),n.jd=new jx(PS),{start:n,tokens:Object.assign({groups:t},FS)}}function YS(e,t){let n=XS(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],a=0,o=0;for(;o<r;){let s=e,c=null,l=0,u=null,d=-1,f=-1;for(;o<r&&(c=s.go(n[o]));)s=c,s.accepts()?(d=0,f=0,u=s):d>=0&&(d+=n[o].length,f++),l+=n[o].length,a+=n[o].length,o++;a-=d,o-=f,l-=d,i.push({t:u.t,v:t.slice(a-l,a),s:a-l,e:a})}return i}function XS(e){let t=[],n=e.length,r=0;for(;r<n;){let i=e.charCodeAt(r),a,o=i<55296||i>56319||r+1===n||(a=e.charCodeAt(r+1))<56320||a>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function ZS(e,t,n,r,i){let a,o=t.length;for(let n=0;n<o-1;n++){let o=t[n];e.j[o]?a=e.j[o]:(a=new jx(r),a.jr=i.slice(),e.j[o]=a),e=a}return a=new jx(n),a.jr=i.slice(),e.j[t[o-1]]=a,a}function QS(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;`0123456789`.indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(``));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}var $S={defaultProtocol:`http`,events:null,format:tC,formatHref:tC,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function eC(e,t=null){let n=Object.assign({},$S);e&&(n=Object.assign(n,e instanceof eC?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}eC.prototype={o:$S,ignoreTags:[],defaultRender(e){return e},check(e){return this.get(`validate`,e.toString(),e)},get(e,t,n){let r=t!=null,i=this.o[e];return i&&(typeof i==`object`?(i=n.t in i?i[n.t]:$S[e],typeof i==`function`&&r&&(i=i(t,n))):typeof i==`function`&&r&&(i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r==`function`&&t!=null&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get(`render`,null,e)||this.defaultRender)(t,e.t,e)}};function tC(e){return e}function nC(e,t){this.t=`token`,this.v=e,this.tk=t}nC.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get(`truncate`,t,this),r=e.get(`format`,t,this);return n&&r.length>n?r.substring(0,n)+`…`:r},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=$S.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,n=this.toHref(e.get(`defaultProtocol`)),r=e.get(`formatHref`,n,this),i=e.get(`tagName`,n,t),a=this.toFormattedString(e),o={},s=e.get(`className`,n,t),c=e.get(`target`,n,t),l=e.get(`rel`,n,t),u=e.getObj(`attributes`,n,t),d=e.getObj(`events`,n,t);return o.href=r,s&&(o.class=s),c&&(o.target=c),l&&(o.rel=l),u&&Object.assign(o,u),{tagName:i,attributes:o,content:a,eventListeners:d}}};function rC(e,t){class n extends nC{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}var iC=rC(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),aC=rC(`text`),oC=rC(`nl`),sC=rC(`url`,{isLink:!0,toHref(e=$S.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==Rx&&e[1].t===hS}}),cC=e=>new jx(e);function lC({groups:e}){let t=e.domain.concat([cS,uS,dS,fS,pS,mS,_S,yS,xS,Ux,SS,CS,wS,TS,AS,PS,jS,MS]),n=[lS,hS,gS,vS,bS,SS,ES,DS,kS,Qx,$x,Kx,qx,Yx,Jx,Xx,Zx,eS,tS,nS,rS,iS,aS,oS,sS],r=[cS,lS,uS,fS,pS,mS,_S,yS,xS,Kx,qx,SS,CS,wS,TS,ES,AS,PS,jS,MS],i=cC(),a=$(i,jS);Q(a,r,a),Q(a,e.domain,a);let o=cC(),s=cC(),c=cC();Q(i,e.domain,o),Q(i,e.scheme,s),Q(i,e.slashscheme,c),Q(o,r,a),Q(o,e.domain,o);let l=$(o,dS);$(a,dS,l),$(s,dS,l),$(c,dS,l);let u=$(a,vS);Q(u,r,a),Q(u,e.domain,a);let d=cC();Q(l,e.domain,d),Q(d,e.domain,d);let f=$(d,vS);Q(f,e.domain,d);let p=cC(iC);Q(f,e.tld,p),Q(f,e.utld,p),$(l,Rx,p);let m=$(d,xS);$(m,xS,m),Q(m,e.domain,d),Q(p,e.domain,d),$(p,vS,f),$(p,xS,m);let h=$(o,xS),g=$(o,vS);$(h,xS,h),Q(h,e.domain,o),Q(g,r,a),Q(g,e.domain,o);let _=cC(sC);Q(g,e.tld,_),Q(g,e.utld,_),Q(_,e.domain,o),Q(_,r,a),$(_,vS,g),$(_,xS,h),$(_,dS,l);let v=$(_,hS),y=cC(sC);Q(v,e.numeric,y);let b=cC(sC),x=cC();Q(b,t,b),Q(b,n,x),Q(x,t,b),Q(x,n,x),$(_,AS,b),$(y,AS,b);let S=$(s,hS),C=$($($(c,hS),AS),AS);Q(s,e.domain,o),$(s,vS,g),$(s,xS,h),Q(c,e.domain,o),$(c,vS,g),$(c,xS,h),Q(S,e.domain,b),$(S,AS,b),$(S,ES,b),Q(C,e.domain,b),Q(C,t,b),$(C,AS,b);let w=[[Kx,qx],[Jx,Yx],[Xx,Zx],[Qx,$x],[eS,tS],[nS,rS],[iS,aS],[oS,sS]];for(let e=0;e<w.length;e++){let[r,i]=w[e],a=$(b,r);$(x,r,a);let o=cC(sC);Q(a,t,o);let s=cC();Q(a,n,s),$(a,i,b),Q(o,t,o),Q(o,n,s),Q(s,t,o),Q(s,n,s),$(o,i,b),$(s,i,b)}return $(i,Rx,_),$(i,Gx,oC),{start:i,tokens:FS}}function uC(e,t,n){let r=n.length,i=0,a=[],o=[];for(;i<r;){let s=e,c=null,l=null,u=0,d=null,f=-1;for(;i<r&&!(c=s.go(n[i].t));)o.push(n[i++]);for(;i<r&&(l=c||s.go(n[i].t));)c=null,s=l,s.accepts()?(f=0,d=s):f>=0&&f++,i++,u++;if(f<0)i-=u,i<r&&(o.push(n[i]),i++);else{o.length>0&&(a.push(dC(aC,t,o)),o=[]),i-=f,u-=f;let e=d.t,r=n.slice(i-u,i);a.push(dC(e,t,r))}}return o.length>0&&a.push(dC(aC,t,o)),a}function dC(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}var fC=typeof console<`u`&&console&&console.warn||(()=>{}),pC=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,mC={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function hC(){return jx.groups={},mC.scanner=null,mC.parser=null,mC.tokenQueue=[],mC.pluginQueue=[],mC.customSchemes=[],mC.initialized=!1,mC}function gC(e,t=!1){if(mC.initialized&&fC(`linkifyjs: already initialized - will not register custom scheme "${e}" ${pC}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
154
+ 1. Must only contain digits, lowercase ASCII letters or "-"
155
+ 2. Cannot start or end with "-"
156
+ 3. "-" cannot repeat`);mC.customSchemes.push([e,t])}function _C(){mC.scanner=JS(mC.customSchemes);for(let e=0;e<mC.tokenQueue.length;e++)mC.tokenQueue[e][1]({scanner:mC.scanner});mC.parser=lC(mC.scanner.tokens);for(let e=0;e<mC.pluginQueue.length;e++)mC.pluginQueue[e][1]({scanner:mC.scanner,parser:mC.parser});return mC.initialized=!0,mC}function vC(e){return mC.initialized||_C(),uC(mC.parser.start,e,YS(mC.scanner.start,e))}vC.scan=YS;function yC(e,t=null,n=null){if(t&&typeof t==`object`){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new eC(n),i=vC(e),a=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&a.push(n.toFormattedObject(r))}return a}var bC=`[\0- \xA0 ᠎ -\u2029  ]`,xC=new RegExp(bC),SC=RegExp(`${bC}$`),CC=new RegExp(bC,`g`);function wC(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function TC(e){return new K({key:new q(`autolink`),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),a=t.some(e=>e.getMeta(`preventAutolink`));if(!i||a)return;let{tr:o}=r;if(F_(o_(n.doc,[...t])).forEach(({newRange:t})=>{let n=c_(r.doc,t,e=>e.isTextblock),i,a;if(n.length>1)i=n[0],a=r.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0,` `);else if(n.length){let e=r.doc.textBetween(t.from,t.to,` `,` `);if(!SC.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i&&a){let t=a.split(xC).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],s=i.pos+a.lastIndexOf(n);if(!n)return!1;let c=vC(n).map(t=>t.toObject(e.defaultProtocol));if(!wC(c))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>r.schema.marks.code?!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code):!0).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{I_(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}})}function EC(e){return new K({key:new q(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=M_(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r&&(window.open(r,o),a=!0)}return a}}})}function DC(e){return new K({key:new q(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=yC(c,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===c);return!c||!l||i!==void 0&&!i(l.value)?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function OC(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(CC,``).match(RegExp(`^(?:(?:${n.map(e=>e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)).join(`|`)}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,`i`))}var kC=Hv.create({name:`link`,priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e==`string`){gC(e);return}gC(e.scheme,e.optionalSlashes)})},onDestroy(){hC()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer nofollow`,class:null},isAllowedUri:(e,t)=>!!OC(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes(`@`))return!0;let r=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute(`href`)}},target:{default:this.options.HTMLAttributes.target??null},rel:{default:this.options.HTMLAttributes.rel??null},class:{default:this.options.HTMLAttributes.class??null},title:{default:null}}},parseHTML(){return[{tag:`a[href]`,getAttrs:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!OC(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!OC(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,y_(this.options.HTMLAttributes,e),0]:[`a`,y_(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{let n=e.attrs?.href??``,r=e.attrs?.title??``,i=t.renderChildren(e);return r?`[${i}](${n} "${r}")`:`[${i}](${n})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!OC(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!OC(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addPasteRules(){return[py({find:e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options,i=yC(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!OC(e,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(TC({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!OC(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(EC({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(DC({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),AC=Object.defineProperty,jC=(e,t)=>{for(var n in t)AC(e,n,{get:t[n],enumerable:!0})},MC=`listItem`,NC=`textStyle`,PC=/^\s*([-+*])\s$/,FC=fy.create({name:`bulletList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul`}]},renderHTML({HTMLAttributes:e}){return[`ul`,y_(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>e.type!==`list`||e.ordered?[]:{type:`bulletList`,content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
157
+ `):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(MC,this.editor.getAttributes(NC)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=dy({find:PC,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=dy({find:PC,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(NC),editor:this.editor})),[e]}}),IC=(e,t,n)=>{let{selection:r}=e;if(!r.empty)return null;let{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let a=-1;for(let e=i.depth;e>0;--e)if(i.node(e).type.name===t){a=e;break}if(a<0)return null;let o=i.node(a),s=i.index(a);if(s+1>=o.childCount)return null;let c=o.child(s+1);if(!n.includes(c.type.name))return null;let l=e.schema.nodes[t],u=!1;if(c.forEach(e=>{e.type===l&&e.childCount>1&&(u=!0)}),!u)return null;let d=e.doc.resolve(i.after()).nodeAfter;if(!d||!n.includes(d.type.name))return null;let f=[];return d.forEach(e=>{f.push(e)}),f.length===0?null:{listItemDepth:a,nestedList:d,nestedListPos:i.after(),insertPos:i.after(a),items:f}},LC=(e,t,n,r)=>{let i=IC(e,n,r);if(!i)return!1;let{selection:a}=e,{nestedList:o,nestedListPos:s,insertPos:c,items:l}=i,u=e.tr;u.delete(s,s+o.nodeSize);let d=u.mapping.map(c);return u.insert(d,B.from(l)),u.setSelection(a.map(u.doc,u.mapping)),t&&t(u),!0},RC=(e,t,n)=>LC(e.state,e.view.dispatch,t,n),zC=(e,t)=>Xv.create({name:`${e}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){let n=()=>RC(this.editor,e,t);return{Delete:n,"Mod-Delete":n}}}),BC=[[1e3,`m`],[900,`cm`],[500,`d`],[400,`cd`],[100,`c`],[90,`xc`],[50,`l`],[40,`xl`],[10,`x`],[9,`ix`],[5,`v`],[4,`iv`],[1,`i`]],VC=`abcdefghijklmnopqrstuvwxyz`,HC=String.raw`\d+|[ivxlcdmIVXLCDM]+|${`[a-zA-Z]{1,2}`}`;function UC(e){let t=e,n=``;for(let[e,r]of BC)for(;t>=e;)n+=r,t-=e;return n}function WC(e){return UC(e).toUpperCase()}function GC(e){let t=e.toLowerCase(),n=0,r=0;for(;n<t.length;){let e=!1;for(let[i,a]of BC)if(t.startsWith(a,n)){r+=i,n+=a.length,e=!0;break}if(!e)return 0}return r}function KC(e){if(!/^[ivxlcdmIVXLCDM]+$/.test(e))return!1;let t=GC(e);return t<=0?!1:(e===e.toLowerCase()?UC(t):WC(t))===e}function qC(e){let t=e.toLowerCase();if(t.length===1)return t.charCodeAt(0)-97+1;if(t.length===2){let e=t.charCodeAt(0)-97,n=t.charCodeAt(1)-97;return(e+1)*26+n+1}return 0}function JC(e){if(e<=26)return VC[e-1];let t=Math.floor((e-1)/26)-1,n=(e-1)%26;return t<0?VC[n]:VC[t]+VC[n]}function YC(e){if(!(!e||/^\d+$/.test(e))){if(KC(e))return e===e.toLowerCase()?`i`:`I`;if(/^[a-z]{1,2}$/.test(e))return`a`;if(/^[A-Z]{1,2}$/.test(e))return`A`}}function XC(e){if(/^\d+$/.test(e))return parseInt(e,10);let t=YC(e);if(t===`i`||t===`I`)return GC(e);if(t===`a`||t===`A`){let t=qC(e);return t>0?t:1}let n=parseInt(e,10);return Number.isNaN(n)?1:n}function ZC(e,t){if(e===`numeric`)return String(t);switch(e){case`a`:return JC(t);case`A`:return JC(t).toUpperCase();case`i`:return UC(t);case`I`:return WC(t);default:return String(t)}}function QC(e){if(e.length===0)return!1;let t=YC(e[0])??`numeric`,n=XC(e[0]);if(n<1)return!1;for(let r=0;r<e.length;r++){let i=ZC(t,n+r);if(e[r]!==i)return!1}return!0}function $C(e){return{type:YC(e),start:XC(e)}}function ew(e){let{type:t,start:n}=$C(e),r={};return t&&(r.type=t),n!==1&&(r.start=n),r}function tw(e,t,n=`. `){let r=t+1;if(!e||e===`1`)return`${r}${n}`;switch(e){case`a`:return`${JC(r)}${n}`;case`A`:return`${JC(r).toUpperCase()}${n}`;case`i`:return`${UC(r)}${n}`;case`I`:return`${WC(r)}${n}`;default:return`${r}${n}`}}function nw(e){let t=e.tokens?.[0];return!!(e.text&&e.tokens?.length===1&&t?.type===`list`&&t.ordered&&t.raw===e.text)}function rw(e,t){return t.tokenizeInline?t.parseInline(t.tokenizeInline(e)):t.parseInline([{type:`text`,raw:e,text:e}])}var iw=fy.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,y_(this.options.HTMLAttributes,e),0]},markdownTokenName:`list_item`,parseMarkdown:(e,t)=>{if(e.type!==`list_item`)return[];let n=t.parseBlockChildren??t.parseChildren,r=[];if(e.tokens&&e.tokens.length>0){if(nw(e))return{type:`listItem`,content:[{type:`paragraph`,content:rw(e.text||``,t)}]};if(e.tokens.some(e=>e.type===`paragraph`))r=n(e.tokens);else{let i=e.tokens[0];if(i&&i.type===`text`&&i.tokens&&i.tokens.length>0){if(r=[{type:`paragraph`,content:t.parseInline(i.tokens)}],e.tokens.length>1){let t=n(e.tokens.slice(1));r.push(...t)}}else r=n(e.tokens)}}return r.length===0&&(r=[{type:`paragraph`,content:[]}]),{type:`listItem`,content:r}},renderMarkdown:(e,t,n)=>Pv(e,t,e=>{if(e.parentType===`bulletList`)return`- `;if(e.parentType===`orderedList`){let t=e.meta?.parentAttrs?.start||1;return tw(e.meta?.parentAttrs?.type,t-1+(e.index||0),`. `)}return`- `},n),addExtensions(){return[zC(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});jC({},{findListItemPos:()=>aw,getNextListDepth:()=>ow,handleBackspace:()=>cw,handleDelete:()=>dw,hasListBefore:()=>sw,hasListItemAfter:()=>fw,hasListItemBefore:()=>pw,listItemHasSubList:()=>mw,nextListIsDeeper:()=>lw,nextListIsHigher:()=>uw});var aw=(e,t)=>{let{$from:n}=t.selection,r=$h(e,t.schema),i=null,a=n.depth,o=n.pos,s=null;for(;a>0&&s===null;)i=n.node(a),i.type===r?s=a:(--a,--o);return s===null?null:{$pos:t.doc.resolve(o),depth:s}},ow=(e,t)=>{let n=aw(e,t);if(!n)return!1;let[,r]=L_(t,e,n.$pos.pos+4);return r},sw=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),a=e.doc.resolve(i).node();return!(!a||!n.includes(a.type.name))},cw=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!Hg(e.state,t)&&sw(e.state,t,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let a=i.at(-1);if(!a)return!1;let o=e.state.doc.resolve(r.start()+a.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},o.end()).joinForward().run()}return!Hg(e.state,t)||!U_(e.state)?!1:e.chain().liftListItem(t).run()},lw=(e,t)=>{let n=ow(e,t),r=aw(e,t);return!r||!n?!1:n>r.depth},uw=(e,t)=>{let n=ow(e,t),r=aw(e,t);return!r||!n?!1:n<r.depth},dw=(e,t)=>{if(!Hg(e.state,t)||!H_(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:lw(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():uw(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},fw=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-n.parentOffset-2);return!(r.index()===r.parent.childCount-1||r.nodeAfter?.type.name!==e)},pw=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-2);return!(r.index()===0||r.nodeBefore?.type.name!==e)},mw=(e,t,n)=>{if(!n)return!1;let r=$h(e,t.schema),i=!1;return n.descendants(e=>{e.type===r&&(i=!0)}),i},hw=Xv.create({name:`listKeymap`,addOptions(){return{listTypes:[{itemName:`listItem`,wrapperNames:[`bulletList`,`orderedList`]},{itemName:`taskItem`,wrapperNames:[`taskList`]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&dw(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&dw(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&cw(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&cw(e,n,r)&&(t=!0)}),t}}}}),gw=RegExp(`^(\\s*)(${HC})([.)])\\s+(.*)$`),_w=RegExp(`^(\\s*)(${HC})([.)])\\s+`),vw=/^\s/,yw={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function bw(e){return gw.test(e.trimStart())}function xw(e){let t=e.trimStart();return yw.bulletItem.test(t)||bw(t)||yw.heading.test(t)||yw.thematicBreak.test(t)&&!t.startsWith(`-`)||/^>\s?/.test(t)||yw.codeFence.test(t)}function Sw(e){return Object.values(yw).some(t=>t.test(e))}function Cw(e){let t=[],n=[],r=!1;return e.forEach(e=>{if(r){n.push(e);return}if(e.trim()===``){r=!0,n.push(e);return}if(t.length>0&&xw(e)){r=!0,n.push(e);return}t.push(e)}),{paragraphLines:t,blockLines:n}}function ww(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],a=i.match(gw);if(!a)break;let[,o,s,c,l]=a,u=o.length,d=parseInt(s,10),f=isNaN(d)?YC(s):void 0,p=isNaN(d)?XC(s):d,m=[l],h=n+1,g=[i],_=!1;for(;h<e.length;){let t=e[h];if(t.match(gw))break;if(t.trim()===``)g.push(t),m.push(``),_=!0,h+=1;else if(t.match(vw)){let e=t.length-t.trimStart().length,n=u+s.length+1;g.push(t),m.push(t.slice(Math.min(e,n))),h+=1}else{if(_||Sw(t))break;g.push(t),m.push(t),h+=1}}t.push({indent:u,number:p,type:f,content:m.join(`
158
+ `).trim(),contentLines:m,raw:g.join(`
159
+ `)}),r=h,n=h}return[t,r]}var Tw=RegExp(`^(${HC})([.)])\\s+(.+)$`);function Ew(e){let t=e.split(`
160
+ `).filter(e=>e.trim().length>0);if(t.length===0)return null;let n=[];for(let e of t){let t=e.trim().match(Tw);if(!t)return null;n.push({marker:t[1],content:t[3]})}return QC(n.map(e=>e.marker))?{type:`orderedList`,attrs:ew(n[0].marker),content:n.map(e=>({type:`listItem`,content:[{type:`paragraph`,content:[{type:`text`,text:e.content}]}]}))}:null}function Dw(e,t,n){let r=[],i=0;for(;i<e.length;){let a=e[i];if(a.indent===t){let{paragraphLines:o,blockLines:s}=Cw(a.contentLines),c=o.join(`
161
+ `).trim(),l=[];c&&l.push({type:`paragraph`,raw:c,tokens:n.inlineTokens(c)});let u=s.join(`
162
+ `).trim();if(u){let e=n.blockTokens(u);l.push(...e)}let d=i+1,f=[];for(;d<e.length&&e[d].indent>t;)f.push(e[d]),d+=1;if(f.length>0){let e=Dw(f,Math.min(...f.map(e=>e.indent)),n);l.push({type:`list`,ordered:!0,start:f[0].number,typeMarker:f[0].type,items:e,raw:f.map(e=>e.raw).join(`
163
+ `)})}r.push({type:`list_item`,raw:a.raw,tokens:l}),i=d}else i+=1}return r}function Ow(e,t){return e.map(e=>{if(e.type!==`list_item`)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if(e.type===`paragraph`||e.type===`list`||e.type===`blockquote`||e.type===`code`)n.push(...t.parseChildren([e]));else if(e.type===`text`&&e.tokens){let r=t.parseChildren([e]);n.push({type:`paragraph`,content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:`listItem`,content:n}})}var kw=`listItem`,Aw=`textStyle`,jw=/^(\d+)\.\s$/;function Mw(e){let t=e.match(/list-style-type\s*:\s*([^;]+)/i);if(!t)return null;switch(t[1].trim().toLowerCase()){case`upper-roman`:return`I`;case`lower-roman`:return`i`;case`upper-alpha`:case`upper-latin`:return`A`;case`lower-alpha`:case`lower-latin`:return`a`;default:return null}}var Nw=fy.create({name:`orderedList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>{let t=e.getAttribute(`type`);if(t)return t;let n=e.getAttribute(`style`);if(n){let e=Mw(n);if(e)return e}let r=e.querySelector(`li`);if(r){let e=r.getAttribute(`style`);if(e){let t=Mw(e);if(t)return t}}return null}}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,type:n,...r}=e,i=y_(this.options.HTMLAttributes,r);return t!==1&&(i.start=t),n&&n!==`1`&&(i.type=n),[`ol`,i,0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[];let n=e.start||1,r=e.typeMarker,i=e.items?Ow(e.items,t):[],a={};return n!==1&&(a.start=n),r&&(a.type=r),Object.keys(a).length>0?{type:`orderedList`,attrs:a,content:i}:{type:`orderedList`,content:i}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
164
+ `):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:e=>{let t=e.match(_w)?.index;return t===void 0?-1:t},tokenize:(e,t,n)=>{let r=e.split(`
165
+ `),[i,a]=ww(r);if(i.length===0)return;let o=Dw(i,i[0].indent,n);if(o.length!==0)return{type:`list`,ordered:!0,start:i[0]?.number||1,typeMarker:i[0]?.type,items:o,raw:r.slice(0,a).join(`
166
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(kw,this.editor.getAttributes(Aw)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new K({props:{handlePaste:(e,t)=>{if((t.clipboardData?.getData(`text/html`))?.trim())return!1;let n=t.clipboardData?.getData(`text/plain`);if(!n)return!1;let r=Ew(n);if(!r)return!1;try{let t=e.state.schema.nodeFromJSON(r),n=e.state.tr.replaceSelectionWith(t);return e.dispatch(n),!0}catch{return!1}}}})]},addInputRules(){let e=(e,t)=>(!t.attrs.type||t.attrs.type===`1`)&&t.childCount+t.attrs.start===+e[1],t=dy({find:jw,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:e});return(this.options.keepMarks||this.options.keepAttributes)&&(t=dy({find:jw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Aw)}),joinPredicate:e,editor:this.editor})),[t]}}),Pw=/^\s*(\[([( |x])?\])\s$/,Fw=fy.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,y_(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>Pv(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addExtensions(){return this.options.nested?[zC(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`),l=e=>{var t;s.ariaLabel=((t=this.options.a11y)?.checkboxLabel)?.call(t,e,s.checked)||`Task item checkbox for ${e.textContent||`empty task item`}`};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=b_(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[dy({find:Pw,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),Iw=fy.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,y_(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
167
+ `):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=Nv(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:`taskList`,raw:t.raw,items:t.items}]:n.blockTokens(e)},i=Nv(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Xv.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(FC.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(iw.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(hw.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(Nw.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(Fw.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(Iw.configure(this.options.taskList)),e}});var Lw=`&nbsp;`,Rw=`\xA0`,zw=fy.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,y_(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===Lw||n[0].text===Lw||n[0].raw===Rw||n[0].text===Rw)&&r.length===1&&r[0].type===`text`&&(r[0].text===Lw||r[0].text===Rw)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){let e=Array.isArray(n?.previousNode?.content)?n.previousNode.content:[];return n?.previousNode?.type===`paragraph`&&e.length===0?Lw:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Bw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Vw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Hw=Hv.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,y_(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[cy({find:Bw,type:this.type})]},addPasteRules(){return[py({find:Vw,type:this.type})]}}),Uw=fy.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),Ww=Hv.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,y_(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Gw(e={}){return new K({view(t){return new Kw(t,e)}})}var Kw=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=Wa(this.editorView.state.doc,e,this.editorView.dragging.slice);t!=null&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},qw=class e extends U{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):U.near(r)}content(){return H.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new Jw(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!Xw(e)||!Zw(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!G.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};qw.prototype.visible=!1,qw.findFrom=qw.findGapCursorFrom,U.jsonID(`gapcursor`,qw);var Jw=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return qw.valid(t)?new qw(t):U.near(t)}};function Yw(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function Xw(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||Yw(e.type))return!0;if(e.inlineContent)return!1}}return!0}function Zw(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||Yw(e.type))return!0;if(e.inlineContent)return!1}}return!0}function Qw(){return new K({props:{decorations:rT,createSelectionBetween(e,t,n){return t.pos==n.pos&&qw.valid(n)?new qw(n):null},handleClick:tT,handleKeyDown:$w,handleDOMEvents:{beforeinput:nT}}})}var $w=cf({ArrowLeft:eT(`horiz`,-1),ArrowRight:eT(`horiz`,1),ArrowUp:eT(`vert`,-1),ArrowDown:eT(`vert`,1)});function eT(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof W){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=qw.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new qw(c))),!0):!1}}function tT(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!qw.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&G.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new qw(r))),!0)}function nT(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof qw))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=B.empty;for(let e=r.length-1;e>=0;e--)i=B.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new H(i,0,0));return a.setSelection(W.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function rT(e){if(!(e.selection instanceof qw))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,sd.create(e.doc,[id.widget(e.selection.head,t,{key:`gapcursor`})])}var iT=200,aT=function(){};aT.prototype.append=function(e){return e.length?(e=aT.from(e),!this.length&&e||e.length<iT&&this.leafAppend(e)||this.length<iT&&e.leafPrepend(this)||this.appendInner(e)):this},aT.prototype.prepend=function(e){return e.length?aT.from(e).append(this):this},aT.prototype.appendInner=function(e){return new sT(this,e)},aT.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?aT.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},aT.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},aT.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},aT.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},aT.from=function(e){return e instanceof aT?e:e&&e.length?new oT(e):aT.empty};var oT=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=iT)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=iT)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(aT);aT.empty=new oT([]);var sT=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(aT),cT=500,lT=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new dT(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new dT(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new dT(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>pT&&(s=uT(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new ca;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new dT(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new dT(i,o,l))}else r.push(new dT(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new dT(a.maps[e]));let u=new e(this.items.slice(0,i).append(l).append(r),s);return u.emptyItemCount()>cT&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new dT(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(aT.from(i.reverse()),a)}};lT.empty=new lT(aT.empty,0);function uT(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var dT=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},fT=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},pT=20;function mT(e,t,n,r){let i=n.getMeta(ST),a;if(i)return i.historyState;n.getMeta(CT)&&(e=new fT(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(ST))return o.getMeta(ST).redo?new fT(e.done.addTransform(n,void 0,r,xT(t)),e.undone,gT(n.mapping.maps),e.prevTime,e.prevComposition):new fT(e.done,e.undone.addTransform(n,void 0,r,xT(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!hT(n,e.prevRanges)),s=o?_T(e.prevRanges,n.mapping):gT(n.mapping.maps);return new fT(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,xT(t)),lT.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new fT(e.done.rebased(n,a),e.undone.rebased(n,a),_T(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new fT(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),_T(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function hT(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function gT(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function _T(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function vT(e,t,n){let r=xT(t),i=ST.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new fT(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(ST,{redo:n,historyState:c})}var yT=!1,bT=null;function xT(e){let t=e.plugins;if(bT!=t){yT=!1,bT=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){yT=!0;break}}return yT}var ST=new q(`history`),CT=new q(`closeHistory`);function wT(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new K({key:ST,state:{init(){return new fT(lT.empty,lT.empty,null,0,-1)},apply(t,n,r){return mT(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?ET:n==`historyRedo`?DT:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function TT(e,t){return(n,r)=>{let i=ST.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=vT(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var ET=TT(!1,!0),DT=TT(!0,!0);Xv.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new K({key:new q(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var OT=Xv.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[Gw(this.options)]}});Xv.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new K({key:new q(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return sd.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(id.node(t,t+e.nodeSize,{class:this.options.className}))}),sd.create(e,a)}}})]}});var kT=Xv.create({name:`gapCursor`,addProseMirrorPlugins(){return[Qw()]},extendNodeSchema(e){return{allowGapCursor:Z(X(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),AT=`placeholder`,jT=new q(`tiptap__placeholder`);function MT(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),id.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function NT(e,t){return typeof e==`function`?e(t):e}function PT({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:a,to:o}){let{anchor:s}=i,c=[],l=e.isEmpty;return r.nodesBetween(a,o,(r,i)=>{let a=s>=i&&s<=i+r.nodeSize,o=!r.isLeaf&&K_(r);return r.type.isTextblock&&(a||!t.showOnlyCurrent)&&o&&c.push(MT({editor:e,isEmptyDoc:l,dataAttribute:n,hasAnchor:a,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:NT(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:a})},node:r,pos:i})),t.includeChildren}),c}function FT({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!(e.isEditable||!t.showOnlyWhenEditable))return null;let{anchor:a}=i,o=[],s=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),c=i.depth>0?i.node(1):i.nodeAfter,l=i.depth>0?i.before(1):a;if(c&&c.type.isTextblock&&K_(c)){let r=a>=l&&a<=l+c.nodeSize;o.push(MT({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:NT(t.emptyNodeClass,{editor:e,node:c,pos:l,hasAnchor:r})},node:c,pos:l}))}}else o.push(...PT({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return sd.create(r,o)}function IT(e,t){let n=e.resolve(t);if(n.depth===0){let e=n.nodeAfter??n.nodeBefore;if(!e)return{from:t,to:t};let r=n.nodeAfter?t:t-e.nodeSize;return{from:r,to:r+e.nodeSize}}let r=n.before(1);return{from:r,to:r+n.node(1).nodeSize}}function LT(e,t){return{from:Math.max(0,t.from-1),to:Math.min(e.content.size,t.to-1)}}function RT(e,t,n){let r=[];return e.forEach((e,i)=>{let a=i,o=a+e.nodeSize,s=a+1,c=o+1;s<n&&c>t&&r.push({from:a,to:o})}),r}function zT(e){if(e.length===0)return[];let t=[...e].sort((e,t)=>e.from-t.from),n=[{...t[0]}];for(let e=1;e<t.length;e+=1){let r=n[n.length-1],i=t[e];i.from<=r.to?r.to=Math.max(r.to,i.to):n.push({...i})}return n}function BT(e,t){let n=RT(e,t.from,t.to);return n.push(LT(e,IT(e,t.from))),t.to>t.from?n.push(LT(e,IT(e,Math.min(t.to,e.content.size+1)-1))):t.from<e.content.size+1&&n.push(LT(e,IT(e,Math.min(t.from+1,e.content.size)))),n}function VT(e,t,n){let r=[];if(e.docChanged){let t=F_(e);for(let e of t)r.push(...BT(n.doc,e.newRange))}return e.selectionSet&&(r.push(LT(n.doc,IT(n.doc,e.mapping.map(t.selection.anchor)))),r.push(LT(n.doc,IT(n.doc,n.selection.anchor)))),zT(r)}function HT(e,t,n){let r=Math.max(0,Math.min(e,n.content.size));return{from:r,to:Math.max(r,Math.min(t,n.content.size))}}function UT({decorations:e,ranges:t,editor:n,options:r,dataAttribute:i,doc:a,selection:o}){let s=e;for(let e of t){let{from:t,to:c}=HT(e.from,e.to,a),l=s.find(t,c).filter(e=>e.from>=t&&e.to<=c);l.length&&(s=s.remove(l));let u=PT({editor:n,options:r,dataAttribute:i,doc:a,selection:o,from:t,to:c});u.length&&(s=s.add(a,u))}return s}function WT({editor:e,options:t,dataAttribute:n}){return{init(r,i){return FT({editor:e,options:t,dataAttribute:n,doc:i.doc,selection:i.selection})??sd.empty},apply(r,i,a,o){return!r.docChanged&&!r.selectionSet?i:UT({decorations:i.map(r.mapping,r.doc),ranges:VT(r,a,o),editor:e,options:t,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function GT(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function KT({editor:e,options:t}){let n=t.dataAttribute?`data-${GT(t.dataAttribute)}`:`data-${AT}`,r=t.showOnlyCurrent&&!t.includeChildren;return new K({key:jT,...r?{}:{state:WT({editor:e,options:t,dataAttribute:n})},props:{decorations:r?({doc:r,selection:i})=>FT({editor:e,options:t,dataAttribute:n,doc:r,selection:i}):n=>t.showOnlyWhenEditable&&!e.isEditable?sd.empty:jT.getState(n)??sd.empty}})}Xv.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:AT,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[KT({editor:this.editor,options:this.options})]}});var qT=`.ProseMirror:not(.ProseMirror-focused) *::selection {
168
+ background: transparent;
169
+ }
170
+
171
+ .ProseMirror:not(.ProseMirror-focused) *::-moz-selection {
172
+ background: transparent;
173
+ }`;Xv.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return e.options.injectCSS&&typeof document<`u`&&Sv(qT,e.options.injectNonce,`selection`),[new K({key:new q(`selection`),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||q_(n.selection)||e.view.dragging?null:sd.create(n.doc,[id.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function JT({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var YT=Xv.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new q(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new K({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!JT({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!JT({node:r,types:n})}}})]}}),XT=Xv.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>ET(e,t),redo:()=>({state:e,dispatch:t})=>DT(e,t)}},addProseMirrorPlugins(){return[wT(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),ZT=Xv.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push($b.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(Jb.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(FC.configure(this.options.bulletList)),this.options.code!==!1&&e.push(nx.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(ox.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(sx.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(OT.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(kT.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(cx.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(lx.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(XT.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(ux.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(hx.configure(this.options.italic)),this.options.listItem!==!1&&e.push(iw.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(hw.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(kC.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(Nw.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(zw.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(Hw.configure(this.options.strike)),this.options.text!==!1&&e.push(Uw.configure(this.options.text)),this.options.underline!==!1&&e.push(Ww.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(YT.configure(this.options?.trailingNode)),e}});bh.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new K({key:new q(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}}),bh.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[Gw(this.options)]}}),bh.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new K({key:new q(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return sd.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(id.node(t,t+e.nodeSize,{class:this.options.className}))}),sd.create(e,a)}}})]}}),bh.create({name:`gapCursor`,addProseMirrorPlugins(){return[Qw()]},extendNodeSchema(e){return{allowGapCursor:Y(J(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}});var QT=`placeholder`,$T=new q(`tiptap__placeholder`);function eE(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),id.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function tE(e,t){return typeof e==`function`?e(t):e}function nE({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:a,to:o}){let{anchor:s}=i,c=[],l=e.isEmpty;return r.nodesBetween(a,o,(r,i)=>{let a=s>=i&&s<=i+r.nodeSize,o=!r.isLeaf&&fm(r);return r.type.isTextblock&&(a||!t.showOnlyCurrent)&&o&&c.push(eE({editor:e,isEmptyDoc:l,dataAttribute:n,hasAnchor:a,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:tE(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:a})},node:r,pos:i})),t.includeChildren}),c}function rE({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!(e.isEditable||!t.showOnlyWhenEditable))return null;let{anchor:a}=i,o=[],s=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),c=i.depth>0?i.node(1):i.nodeAfter,l=i.depth>0?i.before(1):a;if(c&&c.type.isTextblock&&fm(c)){let r=a>=l&&a<=l+c.nodeSize;o.push(eE({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:tE(t.emptyNodeClass,{editor:e,node:c,pos:l,hasAnchor:r})},node:c,pos:l}))}}else o.push(...nE({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return sd.create(r,o)}function iE(e,t){let n=e.resolve(t);if(n.depth===0){let e=n.nodeAfter??n.nodeBefore;if(!e)return{from:t,to:t};let r=n.nodeAfter?t:t-e.nodeSize;return{from:r,to:r+e.nodeSize}}let r=n.before(1);return{from:r,to:r+n.node(1).nodeSize}}function aE(e,t){return{from:Math.max(0,t.from-1),to:Math.min(e.content.size,t.to-1)}}function oE(e,t,n){let r=[];return e.forEach((e,i)=>{let a=i,o=a+e.nodeSize,s=a+1,c=o+1;s<n&&c>t&&r.push({from:a,to:o})}),r}function sE(e){if(e.length===0)return[];let t=[...e].sort((e,t)=>e.from-t.from),n=[{...t[0]}];for(let e=1;e<t.length;e+=1){let r=n[n.length-1],i=t[e];i.from<=r.to?r.to=Math.max(r.to,i.to):n.push({...i})}return n}function cE(e,t){let n=oE(e,t.from,t.to);return n.push(aE(e,iE(e,t.from))),t.to>t.from?n.push(aE(e,iE(e,Math.min(t.to,e.content.size+1)-1))):t.from<e.content.size+1&&n.push(aE(e,iE(e,Math.min(t.from+1,e.content.size)))),n}function lE(e,t,n){let r=[];if(e.docChanged){let t=rm(e);for(let e of t)r.push(...cE(n.doc,e.newRange))}return e.selectionSet&&(r.push(aE(n.doc,iE(n.doc,e.mapping.map(t.selection.anchor)))),r.push(aE(n.doc,iE(n.doc,n.selection.anchor)))),sE(r)}function uE(e,t,n){let r=Math.max(0,Math.min(e,n.content.size));return{from:r,to:Math.max(r,Math.min(t,n.content.size))}}function dE({decorations:e,ranges:t,editor:n,options:r,dataAttribute:i,doc:a,selection:o}){let s=e;for(let e of t){let{from:t,to:c}=uE(e.from,e.to,a),l=s.find(t,c).filter(e=>e.from>=t&&e.to<=c);l.length&&(s=s.remove(l));let u=nE({editor:n,options:r,dataAttribute:i,doc:a,selection:o,from:t,to:c});u.length&&(s=s.add(a,u))}return s}function fE({editor:e,options:t,dataAttribute:n}){return{init(r,i){return rE({editor:e,options:t,dataAttribute:n,doc:i.doc,selection:i.selection})??sd.empty},apply(r,i,a,o){return!r.docChanged&&!r.selectionSet?i:dE({decorations:i.map(r.mapping,r.doc),ranges:lE(r,a,o),editor:e,options:t,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function pE(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function mE({editor:e,options:t}){let n=t.dataAttribute?`data-${pE(t.dataAttribute)}`:`data-${QT}`,r=t.showOnlyCurrent&&!t.includeChildren;return new K({key:$T,...r?{}:{state:fE({editor:e,options:t,dataAttribute:n})},props:{decorations:r?({doc:r,selection:i})=>rE({editor:e,options:t,dataAttribute:n,doc:r,selection:i}):n=>t.showOnlyWhenEditable&&!e.isEditable?sd.empty:$T.getState(n)??sd.empty}})}var hE=bh.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:QT,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[mE({editor:this.editor,options:this.options})]}}),gE=`.ProseMirror:not(.ProseMirror-focused) *::selection {
174
+ background: transparent;
175
+ }
176
+
177
+ .ProseMirror:not(.ProseMirror-focused) *::-moz-selection {
178
+ background: transparent;
179
+ }`;bh.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return e.options.injectCSS&&typeof document<`u`&&Gm(gE,e.options.injectNonce,`selection`),[new K({key:new q(`selection`),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||pm(n.selection)||e.view.dragging?null:sd.create(n.doc,[id.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function _E({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}bh.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new q(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new K({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!_E({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!_E({node:r,types:n})}}})]}}),bh.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>ET(e,t),redo:()=>({state:e,dispatch:t})=>DT(e,t)}},addProseMirrorPlugins(){return[wT(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}});var vE=hE,yE=bh.create({name:`textAlign`,addOptions(){return{types:[],alignments:[`left`,`center`,`right`,`justify`],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{let t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>this.options.alignments.includes(e)?this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).some(e=>e):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,`textAlign`)).some(e=>e),toggleTextAlign:e=>({editor:t,commands:n})=>this.options.alignments.includes(e)?t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign(`left`),"Mod-Shift-e":()=>this.editor.commands.setTextAlign(`center`),"Mod-Shift-r":()=>this.editor.commands.setTextAlign(`right`),"Mod-Shift-j":()=>this.editor.commands.setTextAlign(`justify`)}}}),bE=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,xE=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,SE=fh.create({name:`highlight`,addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute(`data-color`)||Km(e,`background-color`)||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:`mark`}]},renderHTML({HTMLAttributes:e}){return[`mark`,Bp(this.options.HTMLAttributes,e),0]},renderMarkdown:(e,t)=>`==${t.renderChildren(e)}==`,parseMarkdown:(e,t)=>t.applyMark(`highlight`,t.parseInline(e.tokens||[])),markdownTokenizer:{name:`highlight`,level:`inline`,start:e=>e.indexOf(`==`),tokenize(e,t,n){let r=/^(==)([^=]+)(==)/.exec(e);if(r){let e=r[2].trim(),t=n.inlineTokens(e);return{type:`highlight`,raw:r[0],text:e,tokens:t}}}},addCommands(){return{setHighlight:e=>({commands:t})=>t.setMark(this.name,e),toggleHighlight:e=>({commands:t})=>t.toggleMark(this.name,e),unsetHighlight:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Fh({find:bE,type:this.type})]},addPasteRules(){return[Ih({find:xE,type:this.type})]}}),CE=`heading1.heading2.heading3.|.bold.italic.underline.strike.highlight.code.|.alignLeft.alignCenter.alignRight.alignJustify.|.bulletList.orderedList.blockquote.codeBlock.|.link.horizontalRule.clearFormat.|.undo.redo`.split(`.`),wE=[`for`],TE={key:0,class:`text-danger`},EE={class:`flex w-full min-w-0 flex-1 flex-col gap-1.5`},DE={key:0,class:`flex flex-wrap items-center gap-1 border-b border-main p-1.5`},OE={class:`flex flex-col gap-2 p-3`},kE={class:`flex justify-end gap-2`},AE={key:0,class:`h-5 w-0 border-l border-main`},jE=[`id`,`aria-invalid`],ME={key:0,class:`pointer-events-none absolute right-2 bottom-2 flex justify-end select-none`},NE={key:0},PE={key:0,class:`mt-0.5 flex flex-col gap-1`},FE={class:`min-w-0`},IE=(0,t.defineComponent)({__name:`TextEditor`,props:(0,t.mergeModels)({id:{},label:{},labelPosition:{default:`top`},placeholder:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},error:{type:[String,Boolean,Array],default:!1},size:{default:`sm`},toolbar:{default:()=>CE},minHeight:{},maxLength:{},showCount:{type:Boolean,default:!1}},{modelValue:{default:``},modelModifiers:{}}),emits:(0,t.mergeModels)([`focus`,`blur`,`input`,`change`],[`update:modelValue`]),setup(e,{emit:r}){let i=e,a=r,o=(0,t.useModel)(e,`modelValue`),s=i.id||`text-editor-${(0,t.useId)()}`,l={xs:`6rem`,sm:`8rem`,md:`10rem`,lg:`14rem`,xl:`18rem`},d=bh.create({name:`maxLengthGuard`,addProseMirrorPlugins(){return[new K({key:new q(`maxLengthGuard`),filterTransaction:(e,t)=>{let n=i.maxLength;if(!n||!e.docChanged)return!0;let r=e.doc.textBetween(0,e.doc.content.size,`
180
+ `).length;return r<=n?!0:r<=t.doc.textBetween(0,t.doc.content.size,`
181
+ `).length}})]}}),f=Bh({content:o.value,editable:!i.disabled,extensions:[ZT,vE.configure({placeholder:()=>i.placeholder??``}),yE.configure({types:[`heading`,`paragraph`]}),SE,d],editorProps:{attributes:{class:[`min-h-full w-full font-medium outline-none`,`[&_p]:my-1 first:[&_p]:mt-0 last:[&_p]:mb-0`,`[&_ul]:list-disc [&_ul]:ps-5 [&_ol]:list-decimal [&_ol]:ps-5 [&_li]:my-0.5`,`[&_blockquote]:border-s-2 [&_blockquote]:border-main [&_blockquote]:ps-3 [&_blockquote]:italic [&_blockquote]:text-muted`,`[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:text-[0.9em]`,`[&_pre]:my-2 [&_pre]:rounded-md [&_pre]:bg-muted [&_pre]:p-3 [&_pre_code]:bg-transparent [&_pre_code]:p-0`,`[&_hr]:my-3 [&_hr]:border-main`,`[&_a]:text-primary [&_a]:underline [&_a]:underline-offset-2`,`[&_mark]:rounded-sm [&_mark]:bg-warning/40 [&_mark]:px-0.5 [&_mark]:text-inherit`,`[&_h1]:mt-3 [&_h1]:mb-1.5 [&_h1]:text-2xl [&_h1]:font-bold`,`[&_h2]:mt-3 [&_h2]:mb-1.5 [&_h2]:text-xl [&_h2]:font-bold`,`[&_h3]:mt-2 [&_h3]:mb-1 [&_h3]:text-lg [&_h3]:font-bold`,`[&_h4]:mt-2 [&_h4]:mb-1 [&_h4]:text-base [&_h4]:font-bold`,`[&_h5]:mt-2 [&_h5]:mb-1 [&_h5]:text-sm [&_h5]:font-bold`,`[&_h6]:mt-2 [&_h6]:mb-1 [&_h6]:text-xs [&_h6]:font-bold [&_h6]:tracking-wide [&_h6]:uppercase`,`[&_p.is-editor-empty:first-child::before]:pointer-events-none [&_p.is-editor-empty:first-child::before]:float-left [&_p.is-editor-empty:first-child::before]:h-0 [&_p.is-editor-empty:first-child::before]:text-muted [&_p.is-editor-empty:first-child::before]:opacity-70 [&_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]`].join(` `)}},onUpdate:({editor:e})=>{let t=e.getHTML();o.value=t,a(`input`,t)},onFocus:()=>a(`focus`),onBlur:({editor:e})=>{a(`blur`),a(`change`,e.getHTML())}});(0,t.watch)(o,e=>{f.value&&f.value.getHTML()!==e&&f.value.commands.setContent(e||``,{emitUpdate:!1})}),(0,t.watch)(()=>i.disabled,e=>f.value?.setEditable(!e));let p=(0,t.computed)(()=>i.showCount||!!i.maxLength),m=(0,t.computed)(()=>{let e=f.value?.state;return e?e.doc.textBetween(0,e.doc.content.size,`
182
+ `).length:0}),h=(0,t.computed)(()=>!!i.maxLength&&m.value>=i.maxLength*.9),g=(0,t.computed)(()=>!!i.maxLength&&m.value>=i.maxLength),_=(e,t)=>!!f.value?.isActive(e,t),v=e=>{!i.disabled&&f.value&&e(f.value)},y=[1,2,3,4,5,6],b=[{key:`alignLeft`,value:`left`,icon:`lucide:text-align-start`,label:`Align left`},{key:`alignCenter`,value:`center`,icon:`lucide:text-align-center`,label:`Align center`},{key:`alignRight`,value:`right`,icon:`lucide:text-align-end`,label:`Align right`},{key:`alignJustify`,value:`justify`,icon:`lucide:text-align-justify`,label:`Justify`}],x=(0,t.computed)(()=>{let e=Object.fromEntries(y.map(e=>[`heading${e}`,{key:`heading${e}`,icon:`lucide:heading-${e}`,label:`Heading ${e}`,run:()=>v(t=>t.chain().focus().toggleHeading({level:e}).run()),active:()=>_(`heading`,{level:e})}])),t=Object.fromEntries(b.map(({key:e,value:t,icon:n,label:r})=>[e,{key:e,icon:n,label:r,run:()=>v(e=>e.chain().focus().setTextAlign(t).run()),active:()=>!!f.value?.isActive({textAlign:t})}]));return{...e,bold:{key:`bold`,icon:`lucide:bold`,label:`Bold`,run:()=>v(e=>e.chain().focus().toggleBold().run()),active:()=>_(`bold`)},italic:{key:`italic`,icon:`lucide:italic`,label:`Italic`,run:()=>v(e=>e.chain().focus().toggleItalic().run()),active:()=>_(`italic`)},underline:{key:`underline`,icon:`lucide:underline`,label:`Underline`,run:()=>v(e=>e.chain().focus().toggleUnderline().run()),active:()=>_(`underline`)},strike:{key:`strike`,icon:`lucide:strikethrough`,label:`Strikethrough`,run:()=>v(e=>e.chain().focus().toggleStrike().run()),active:()=>_(`strike`)},highlight:{key:`highlight`,icon:`lucide:highlighter`,label:`Highlight`,run:()=>v(e=>e.chain().focus().toggleHighlight().run()),active:()=>_(`highlight`)},code:{key:`code`,icon:`lucide:code`,label:`Inline code`,run:()=>v(e=>e.chain().focus().toggleCode().run()),active:()=>_(`code`)},...t,bulletList:{key:`bulletList`,icon:`lucide:list`,label:`Bullet list`,run:()=>v(e=>e.chain().focus().toggleBulletList().run()),active:()=>_(`bulletList`)},orderedList:{key:`orderedList`,icon:`lucide:list-ordered`,label:`Ordered list`,run:()=>v(e=>e.chain().focus().toggleOrderedList().run()),active:()=>_(`orderedList`)},blockquote:{key:`blockquote`,icon:`lucide:quote`,label:`Blockquote`,run:()=>v(e=>e.chain().focus().toggleBlockquote().run()),active:()=>_(`blockquote`)},codeBlock:{key:`codeBlock`,icon:`lucide:square-code`,label:`Code block`,run:()=>v(e=>e.chain().focus().toggleCodeBlock().run()),active:()=>_(`codeBlock`)},link:{key:`link`,icon:`lucide:link`,label:`Link`,run:()=>{},active:()=>_(`link`)},horizontalRule:{key:`horizontalRule`,icon:`lucide:separator-horizontal`,label:`Horizontal rule`,run:()=>v(e=>e.chain().focus().setHorizontalRule().run())},clearFormat:{key:`clearFormat`,icon:`lucide:eraser`,label:`Clear formatting`,run:()=>v(e=>e.chain().focus().clearNodes().unsetAllMarks().run())},undo:{key:`undo`,icon:`lucide:undo-2`,label:`Undo`,run:()=>v(e=>e.chain().focus().undo().run()),disabled:()=>!f.value?.can().undo()},redo:{key:`redo`,icon:`lucide:redo-2`,label:`Redo`,run:()=>v(e=>e.chain().focus().redo().run()),disabled:()=>!f.value?.can().redo()}}}),S=(0,t.computed)(()=>{let e=[[]];for(let t of i.toolbar){if(t===`|`){e.push([]);continue}let n=x.value[t];n&&e[e.length-1].push(n)}return e.filter(e=>e.length>0)}),C=(0,t.ref)(!1),w=(0,t.ref)(``);(0,t.watch)(C,e=>{e&&(w.value=f.value?.getAttributes(`link`).href||``)});let T=e=>{if(!f.value)return;let t=w.value.trim();t?f.value.chain().focus().extendMarkRange(`link`).setLink({href:t}).run():f.value.chain().focus().unsetLink().run(),e()},E=e=>{f.value?.chain().focus().unsetLink().run(),e()},D={xs:`xs`,sm:`xs`,md:`sm`,lg:`sm`,xl:`md`},O=(0,t.computed)(()=>D[i.size]),A=(0,t.computed)(()=>i.labelPosition===`top`?``:{xs:`sm:pt-1`,sm:`sm:pt-1.5`,md:`sm:pt-2.5`,lg:`sm:pt-3.5`,xl:`sm:pt-4.5`}[i.size]),j=(0,t.computed)(()=>[`flex w-full flex-col overflow-hidden rounded-md border bg-content transition-colors duration-200 focus-within:ring-4 focus-within:ring-offset-0`,i.disabled?`border-main bg-muted opacity-70`:i.error?`border-danger focus-within:border-danger focus-within:ring-danger/20`:`border-main hover:border-primary/50 focus-within:border-primary focus-within:ring-primary/20`]),M=(0,t.computed)(()=>{let e=i.disabled?`text-muted cursor-not-allowed`:i.error?`text-danger`:`text-main`;return[`custom-scrollbar relative overflow-y-auto`,{xs:`text-xs px-2 pt-2 ${p.value?`pb-6`:`pb-2`}`,sm:`text-xs px-3 pt-3 ${p.value?`pb-7`:`pb-3`}`,md:`text-sm px-3.5 pt-3.5 ${p.value?`pb-8`:`pb-3.5`}`,lg:`text-base px-4 pt-4 ${p.value?`pb-8`:`pb-4`}`,xl:`text-lg px-5 pt-5 ${p.value?`pb-9`:`pb-5`}`}[i.size],e]}),N=(0,t.computed)(()=>!i.error||typeof i.error==`boolean`?[]:Array.isArray(i.error)?i.error:[i.error]);return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`flex w-full`,e.labelPosition===`left`?`flex-col gap-1.5 sm:flex-row sm:gap-6`:`flex-col gap-1.5`])},[e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`label`,{key:0,for:(0,t.unref)(s),class:(0,t.normalizeClass)([`flex shrink-0 items-center gap-1 text-[10px] font-bold tracking-wider text-muted uppercase`,e.labelPosition===`left`?`sm:w-1/3 lg:w-1/4 ${A.value}`:``])},[(0,t.createTextVNode)((0,t.toDisplayString)(e.label)+` `,1),e.required?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,TE,`*`)):(0,t.createCommentVNode)(``,!0)],10,wE)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,EE,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)(j.value)},[S.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,DE,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(S.value,(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:r},[(0,t.createVNode)(u,null,{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(n,n=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:n.key},[n.key===`link`?((0,t.openBlock)(),(0,t.createBlock)(pe,{key:0,modelValue:C.value,"onUpdate:modelValue":i[1]||=e=>C.value=e,placement:`bottom-start`,"width-class":`w-64`},{trigger:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{icon:n.icon,"aria-label":n.label,title:n.label,type:`button`,size:O.value,variant:n.active?.()?`solid`:`text`,severity:n.active?.()?`primary`:`secondary`,disabled:e.disabled},null,8,[`icon`,`aria-label`,`title`,`size`,`variant`,`severity`,`disabled`])]),default:(0,t.withCtx)(({close:e})=>[(0,t.createElementVNode)(`div`,OE,[(0,t.createVNode)(k,{modelValue:w.value,"onUpdate:modelValue":i[0]||=e=>w.value=e,size:`xs`,placeholder:`https://example.com`,onKeydown:(0,t.withKeys)(t=>T(e),[`enter`])},null,8,[`modelValue`,`onKeydown`]),(0,t.createElementVNode)(`div`,kE,[n.active?.()?((0,t.openBlock)(),(0,t.createBlock)(c,{key:0,label:`Remove`,variant:`text`,severity:`danger`,size:`xs`,type:`button`,onClick:t=>E(e)},null,8,[`onClick`])):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(c,{label:`Apply`,severity:`primary`,size:`xs`,type:`button`,onClick:t=>T(e)},null,8,[`onClick`])])])]),_:2},1032,[`modelValue`])):((0,t.openBlock)(),(0,t.createBlock)(c,{key:1,icon:n.icon,"aria-label":n.label,title:n.label,type:`button`,size:O.value,variant:n.active?.()?`solid`:`text`,severity:n.active?.()?`primary`:`secondary`,disabled:e.disabled||n.disabled?.(),onClick:e=>n.run()},null,8,[`icon`,`aria-label`,`title`,`size`,`variant`,`severity`,`disabled`,`onClick`]))],64))),128))]),_:2},1024),r<S.value.length-1?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,AE)):(0,t.createCommentVNode)(``,!0)],64))),128))])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,{id:(0,t.unref)(s),class:(0,t.normalizeClass)(M.value),style:(0,t.normalizeStyle)({minHeight:e.minHeight||l[e.size]}),"aria-invalid":!!e.error},[(0,t.createVNode)((0,t.unref)(zh),{editor:(0,t.unref)(f)},null,8,[`editor`]),p.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ME,[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`rounded-sm bg-content/80 px-1 text-[10px] font-bold tracking-wider backdrop-blur-sm transition-colors`,[g.value?`text-danger`:h.value?`text-warning`:`text-muted/60`,e.disabled?`opacity-50`:``]])},[(0,t.createTextVNode)((0,t.toDisplayString)(m.value)+` `,1),e.maxLength?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,NE,` / `+(0,t.toDisplayString)(e.maxLength),1)):(0,t.createCommentVNode)(``,!0)],2)])):(0,t.createCommentVNode)(``,!0)],14,jE)],2),N.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,PE,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(N.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r,class:`flex items-start gap-1.5 text-[11px] leading-tight font-medium text-danger`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:alert-circle`,class:`h-3.5 w-3.5 shrink-0`}),(0,t.createElementVNode)(`span`,FE,(0,t.toDisplayString)(e),1)]))),128))])):(0,t.createCommentVNode)(``,!0)])],2))}}),LE=[`data-tab-id`,`aria-selected`,`aria-disabled`,`disabled`,`tabindex`,`onClick`],RE=(0,t.defineComponent)({__name:`Tabs`,props:(0,t.mergeModels)({tabs:{},variant:{default:`underline`},size:{default:`md`},fitted:{type:Boolean,default:!1}},{modelValue:{required:!0},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let r=e,i=(0,t.useModel)(e,`modelValue`),a={primary:`bg-primary text-inverse`,secondary:`bg-muted text-main border border-main`,danger:`bg-danger text-on-danger`,success:`bg-success text-on-success`,warning:`bg-warning text-on-warning`,info:`bg-info text-on-info`},o={xs:`px-1 py-1.5 text-xs`,sm:`px-1 py-2 text-xs`,md:`px-1 py-3 text-sm`,lg:`px-1 py-3.5 text-base`,xl:`px-1 py-4 text-lg`},s={xs:`px-2.5 py-1 text-xs`,sm:`px-3 py-1 text-xs`,md:`px-4 py-1.5 text-sm`,lg:`px-5 py-2 text-base`,xl:`px-6 py-2.5 text-lg`},c={xs:`px-2.5 py-1.5 text-xs`,sm:`px-3 py-2 text-xs`,md:`px-4 py-2.5 text-sm`,lg:`px-5 py-3 text-base`,xl:`px-6 py-3.5 text-lg`},l={xs:`px-2.5 py-1 text-xs`,sm:`px-3 py-1.5 text-xs`,md:`px-4 py-2 text-sm`,lg:`px-5 py-2.5 text-base`,xl:`px-6 py-3 text-lg`},u={xs:`h-3.5 w-3.5`,sm:`h-3.5 w-3.5`,md:`h-4 w-4`,lg:`h-5 w-5`,xl:`h-5 w-5`},d={xs:`gap-1.5`,sm:`gap-1.5`,md:`gap-2`,lg:`gap-2.5`,xl:`gap-2.5`},f={xs:`min-w-4 h-4 text-[9px]`,sm:`min-w-4 h-4 text-[9px]`,md:`min-w-5 h-5 text-[10px]`,lg:`min-w-6 h-6 text-xs`,xl:`min-w-6 h-6 text-xs`},p=e=>{e.disabled||(i.value=e.id)},m=e=>{let t=e.currentTarget,n=e.target;if(n.getAttribute(`role`)!==`tab`)return;let i=Array.from(t.querySelectorAll(`[role="tab"]:not([aria-disabled="true"])`)),a=i.indexOf(n);if(a===-1)return;let o=-1;if(e.key===`ArrowRight`?o=(a+1)%i.length:e.key===`ArrowLeft`?o=(a-1+i.length)%i.length:e.key===`Home`?o=0:e.key===`End`&&(o=i.length-1),o!==-1){e.preventDefault();let t=i[o];t.focus();let n=t.getAttribute(`data-tab-id`),a=r.tabs.find(e=>String(e.id)===n);a&&p(a)}},h=(0,t.computed)(()=>{let e=`flex w-full overflow-x-auto overflow-y-hidden snap-x custom-scrollbar`;return r.variant===`pill`?[e,`p-1 space-x-1 bg-muted rounded-lg border border-main`]:r.variant===`enclosed`?[e,`border-b border-main pt-1 px-1 items-end`]:r.variant===`text`?[e,`gap-2`]:[e,`border-b border-main`]}),g=e=>{let t=i.value===e.id,n=[`relative flex items-center justify-center whitespace-nowrap snap-start transition-all duration-200 outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-surface-background`,d[r.size],r.fitted?`flex-1`:``,e.disabled?`opacity-50 cursor-not-allowed`:`cursor-pointer`];return r.variant===`pill`?[...n,s[r.size],`rounded-md font-medium`,t?`bg-content text-main shadow-sm ring-1 ring-primary`:`text-muted hover:text-main hover:bg-content/50`]:r.variant===`enclosed`?[...n,c[r.size],`font-medium border-t border-l border-r first:rounded-tl-md last:rounded-tr-md`,t?`bg-content text-primary border-main z-10 translate-y-px font-semibold shadow-[0_-2px_6px_-3px_rgb(0_0_0/0.12)]`:`border-transparent text-muted bg-muted/30 hover:bg-muted hover:text-main`]:r.variant===`text`?[...n,l[r.size],`font-medium rounded-md`,t?`bg-primary/10 text-primary font-bold`:`text-muted hover:bg-muted hover:text-main`]:[...n,o[r.size],`font-medium border-b-2`,r.fitted?``:`mr-6 last:mr-0`,t?`border-primary text-primary`:`border-transparent text-muted hover:text-main hover:border-main`]},_=e=>{let t=i.value===e.id,n=e.badgeSeverity||`primary`,o=`inline-flex items-center justify-center px-1.5 rounded-full font-bold transition-colors`;return t?[o,f[r.size],a[n]||a.primary]:[o,f[r.size],`bg-muted border border-main text-muted`]};return(r,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)(h.value),role:`tablist`,"aria-orientation":`horizontal`,onKeydown:m},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.tabs,r=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:r.id,role:`tab`,"data-tab-id":String(r.id),"aria-selected":i.value===r.id,"aria-disabled":r.disabled,disabled:r.disabled,tabindex:i.value===r.id?0:-1,class:(0,t.normalizeClass)(g(r)),onClick:e=>p(r)},[r.icon?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:r.icon,class:(0,t.normalizeClass)([u[e.size],`shrink-0`,i.value===r.id?``:`opacity-70`])},null,8,[`icon`,`class`])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(r.label),1),r.badge?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,class:(0,t.normalizeClass)(_(r))},(0,t.toDisplayString)(r.badge),3)):(0,t.createCommentVNode)(``,!0)],10,LE))),128))],34))}}),zE=(0,t.defineComponent)({__name:`DropDown`,props:{align:{default:`right`},size:{default:`md`},width:{default:void 0}},setup(e){let n=e,r={xs:`w-40`,sm:`w-44`,md:`w-48`,lg:`w-56`,xl:`w-64`},i=(0,t.computed)(()=>n.width||r[n.size]),a=(0,t.ref)(!1),o=(0,t.ref)(null),s=()=>{a.value=!a.value},c=()=>{a.value=!1},l=e=>{o.value&&!o.value.contains(e.target)&&c()},u=e=>{a.value&&e.key===`Escape`&&c()};return(0,t.onMounted)(()=>{document.addEventListener(`click`,l),document.addEventListener(`keydown`,u)}),(0,t.onUnmounted)(()=>{document.removeEventListener(`click`,l),document.removeEventListener(`keydown`,u)}),(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{ref_key:`dropdownRef`,ref:o,class:`relative inline-flex items-stretch text-left`},[(0,t.createElementVNode)(`div`,{onClick:(0,t.withModifiers)(s,[`stop`]),class:`flex w-full cursor-pointer items-stretch`},[(0,t.renderSlot)(e.$slots,`trigger`,{isOpen:a.value})]),(0,t.createVNode)(t.Transition,{"enter-active-class":`transition duration-100 ease-out`,"enter-from-class":`transform scale-95 opacity-0`,"enter-to-class":`transform scale-100 opacity-100`,"leave-active-class":`transition duration-75 ease-in`,"leave-from-class":`transform scale-100 opacity-100`,"leave-to-class":`transform scale-95 opacity-0`},{default:(0,t.withCtx)(()=>[(0,t.withDirectives)((0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`absolute top-full z-9999 mt-1 rounded-md border border-main bg-content shadow-lg focus:outline-none`,i.value,n.align===`right`?`right-0 origin-top-right`:`left-0 origin-top-left`])},[(0,t.createElementVNode)(`div`,{class:`flex flex-col py-1`,role:`menu`,"aria-orientation":`vertical`,onClick:(0,t.withModifiers)(c,[`stop`])},[(0,t.renderSlot)(e.$slots,`default`)])],2),[[t.vShow,a.value]])]),_:3})],512))}}),BE=(0,t.defineComponent)({__name:`Accordion`,props:(0,t.mergeModels)({multiple:{type:Boolean,default:!1},variant:{default:`default`},size:{default:`sm`}},{modelValue:{default:null},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let n=e,r=(0,t.useModel)(e,`modelValue`),i=(0,t.ref)(new Set);return(0,t.watch)(r,e=>{i.value.clear(),e!=null&&(Array.isArray(e)?e.forEach(e=>i.value.add(e)):i.value.add(e))},{immediate:!0,deep:!0}),(0,t.provide)(`accordionContext`,{activeKeys:i,togglePanel:e=>{let t=new Set(i.value);t.has(e)?t.delete(e):(n.multiple||t.clear(),t.add(e)),i.value=t,r.value=n.multiple?Array.from(t):t.size?Array.from(t)[0]:null},variant:n.variant,size:n.size}),(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`flex flex-col w-full transition-all duration-300`,e.variant===`separated`?`gap-sm`:`rounded-lg border border-main bg-content shadow-sm overflow-hidden`])},[(0,t.renderSlot)(n.$slots,`default`)],2))}}),VE=[`aria-expanded`,`aria-disabled`],HE={class:`flex items-center gap-md min-w-0 pr-4`},UE={class:`truncate block`},WE={class:`overflow-hidden transition-[height,opacity] duration-300 ease-in-out will-change-[height,opacity]`},GE=(0,t.defineComponent)({__name:`AccordionPanel`,props:{header:{default:void 0},value:{},disabled:{type:Boolean,default:!1},icon:{default:void 0}},setup(e){let r=e,i=(0,t.inject)(`accordionContext`);if(!i)throw Error(`AccordionPanel must be used inside an Accordion component`);let a=(0,t.computed)(()=>i.activeKeys.value.has(r.value)),o=()=>{r.disabled||i.togglePanel(r.value)},s=(0,t.computed)(()=>({xs:{header:`px-sm py-xs text-xs`,content:`px-sm py-xs text-[11px]`,icon:`w-3.5 h-3.5`},sm:{header:`px-md py-sm text-sm`,content:`px-md py-sm text-xs`,icon:`w-4 h-4`},md:{header:`px-lg py-md text-base`,content:`px-lg py-md text-sm`,icon:`w-5 h-5`},lg:{header:`px-xl py-lg text-lg`,content:`px-xl py-lg text-base`,icon:`w-6 h-6`},xl:{header:`px-2xl py-xl text-xl`,content:`px-2xl py-xl text-lg`,icon:`w-7 h-7`}})[i.size]),c=(0,t.computed)(()=>i.variant===`separated`?`rounded-lg border border-main bg-content shadow-sm transition-all duration-200`:`border-b border-main last:border-b-0`),l=(0,t.computed)(()=>{let e=`w-full flex items-center justify-between text-left transition-colors duration-200 outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-inset ${s.value.header}`;if(r.disabled)return`${e} opacity-50 cursor-not-allowed bg-muted/50 text-muted`;let t=`${e} cursor-pointer`;return{default:a.value?`${t} bg-surface text-primary font-semibold`:`${t} bg-transparent text-main hover:bg-surface/50 font-medium`,filled:a.value?`${t} bg-primary text-on-primary font-semibold`:`${t} bg-surface text-main hover:bg-surface-hover font-medium`,separated:a.value?`${t} bg-primary text-on-primary font-semibold rounded-t-lg`:`${t} bg-surface text-main hover:bg-surface-hover font-medium rounded-lg`}[i.variant]}),u=(0,t.computed)(()=>{let e=`text-muted leading-loose bg-content ${s.value.content}`;return i.variant===`separated`?`${e} rounded-b-lg border-t border-main`:`${e} border-t border-main`}),d=e=>{e.style.height=`0`,e.style.opacity=`0`},f=e=>{e.style.height=e.scrollHeight+`px`,e.style.opacity=`1`},p=e=>{e.style.height=`auto`},m=e=>{e.style.height=e.scrollHeight+`px`,e.offsetHeight,e.style.height=`0`,e.style.opacity=`0`};return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`flex flex-col relative`,c.value])},[(0,t.createElementVNode)(`button`,{onClick:o,"aria-expanded":a.value,"aria-disabled":e.disabled,class:(0,t.normalizeClass)(l.value),type:`button`},[(0,t.createElementVNode)(`div`,HE,[(0,t.renderSlot)(r.$slots,`icon`,{isOpen:a.value},()=>[e.icon?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:e.icon,class:(0,t.normalizeClass)([s.value.icon,`shrink-0`])},null,8,[`icon`,`class`])):(0,t.createCommentVNode)(``,!0)]),(0,t.createElementVNode)(`span`,UE,[(0,t.renderSlot)(r.$slots,`header`,{isOpen:a.value},()=>[(0,t.createTextVNode)((0,t.toDisplayString)(e.header),1)])])]),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`shrink-0 transition-transform duration-300 ease-in-out`,{"rotate-90":a.value}])},[(0,t.renderSlot)(r.$slots,`toggleicon`,{isOpen:a.value},()=>[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:chevron-right`,class:(0,t.normalizeClass)(s.value.icon)},null,8,[`class`])])],2)],10,VE),(0,t.createVNode)(t.Transition,{onBeforeEnter:d,onEnter:f,onAfterEnter:p,onLeave:m},{default:(0,t.withCtx)(()=>[(0,t.withDirectives)((0,t.createElementVNode)(`div`,WE,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)(u.value)},[(0,t.renderSlot)(r.$slots,`default`)],2)],512),[[t.vShow,a.value]])]),_:3})],2))}}),KE={key:0,class:`flex w-full items-center py-4`},qE={key:1,class:`inline-flex flex-col items-center px-4 self-stretch min-h-[24px]`},JE=(0,t.defineComponent)({__name:`Divider`,props:{layout:{default:`horizontal`},align:{default:`center`},variant:{default:`solid`},severity:{default:void 0},size:{default:`sm`}},setup(e){let n=e,r=(0,t.useSlots)(),i={xs:1,sm:2,md:4,lg:8,xl:16},a={xs:`border-t-[1px]`,sm:`border-t-2`,md:`border-t-4`,lg:`border-t-8`,xl:`border-t-[16px]`},o={xs:`border-l-[1px]`,sm:`border-l-2`,md:`border-l-4`,lg:`border-l-8`,xl:`border-l-[16px]`},s={xs:`text-xs`,sm:`text-sm`,md:`text-base`,lg:`text-lg`,xl:`text-xl`},c=(0,t.computed)(()=>{if(n.variant===`solid`)return{};let e=n.layout===`horizontal`?`to right`:`to bottom`,t=i[n.size],r=0,a=0;n.variant===`dashed`?(r=t*4,a=r*2):n.variant===`dotted`&&(r=t,a=t*3);let o=`repeating-linear-gradient(${e}, black 0, black ${r}px, transparent ${r}px, transparent ${a}px)`;return{WebkitMaskImage:o,maskImage:o}}),l={primary:{line:`border-primary`,text:`text-primary`},secondary:{line:`border-secondary`,text:`text-secondary`},success:{line:`border-success`,text:`text-success`},warning:{line:`border-warning`,text:`text-warning`},danger:{line:`border-danger`,text:`text-danger`},info:{line:`border-info`,text:`text-info`}},u=(0,t.computed)(()=>n.severity&&l[n.severity]?l[n.severity]:{line:`border-main`,text:`text-muted`}),d=(0,t.computed)(()=>`border-solid h-0 ${a[n.size]} ${u.value.line}`),f=(0,t.computed)(()=>`border-solid w-0 ${o[n.size]} ${u.value.line}`),p=(0,t.computed)(()=>`${s[n.size]} ${u.value.text}`),m=(0,t.computed)(()=>n.align===`left`?`w-8 shrink-0`:`flex-1 min-w-0`),h=(0,t.computed)(()=>n.align===`right`?`w-8 shrink-0`:`flex-1 min-w-0`),g=(0,t.computed)(()=>n.align===`top`?`h-8 shrink-0`:`flex-1 min-h-0`),_=(0,t.computed)(()=>n.align===`bottom`?`h-8 shrink-0`:`flex-1 min-h-0`);return(n,i)=>e.layout===`horizontal`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,KE,[(0,t.unref)(r).default?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`transition-all`,d.value,m.value]),style:(0,t.normalizeStyle)(c.value)},null,6),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`px-4 font-medium shrink-0 whitespace-nowrap`,p.value])},[(0,t.renderSlot)(n.$slots,`default`)],2),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`transition-all`,d.value,h.value]),style:(0,t.normalizeStyle)(c.value)},null,6)],64)):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`w-full transition-all`,d.value]),style:(0,t.normalizeStyle)(c.value)},null,6))])):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,qE,[(0,t.unref)(r).default?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`transition-all`,f.value,g.value]),style:(0,t.normalizeStyle)(c.value)},null,6),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`py-4 font-medium shrink-0 whitespace-nowrap`,p.value])},[(0,t.renderSlot)(n.$slots,`default`)],2),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`transition-all`,f.value,_.value]),style:(0,t.normalizeStyle)(c.value)},null,6)],64)):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`flex-1 w-full transition-all`,f.value]),style:(0,t.normalizeStyle)(c.value)},null,6))]))}}),YE=(0,t.defineComponent)({__name:`Toolbar`,props:{orientation:{default:`horizontal`},wrap:{type:Boolean,default:!0},gap:{default:`sm`},size:{default:`md`},variant:{default:`surface`}},setup(e){let n=e,r={flat:`bg-transparent border-transparent`,outline:`bg-transparent border border-main rounded-md`,surface:`bg-content border border-main rounded-md shadow-sm`},i={xs:`gap-1`,sm:`gap-2`,md:`gap-4`,lg:`gap-6`,xl:`gap-8`},a={xs:`p-1.5`,sm:`p-2`,md:`p-3`,lg:`p-4`,xl:`p-6`},o=(0,t.computed)(()=>[`flex transition-all duration-300`,a[n.size],n.orientation===`horizontal`?`flex-row items-center justify-between`:`flex-col items-stretch`,n.wrap?`flex-wrap`:`flex-nowrap`,!n.wrap&&n.orientation===`horizontal`?`overflow-x-auto overflow-y-hidden custom-scrollbar`:``,!n.wrap&&n.orientation===`vertical`?`overflow-y-auto overflow-x-hidden custom-scrollbar`:``,r[n.variant],i[n.gap]]),s=(0,t.computed)(()=>[`flex items-center min-w-0`,n.orientation===`horizontal`?`flex-row`:`flex-col`,n.wrap?`flex-wrap`:`flex-shrink-0 whitespace-nowrap`,i[n.gap]]);return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)(o.value),role:`toolbar`,"aria-label":`Command Toolbar`},[e.$slots.start?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([s.value,`justify-start`])},[(0,t.renderSlot)(e.$slots,`start`)],2)):(0,t.createCommentVNode)(``,!0),e.$slots.center?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:(0,t.normalizeClass)([s.value,`flex-1 justify-center`])},[(0,t.renderSlot)(e.$slots,`center`)],2)):(0,t.createCommentVNode)(``,!0),e.$slots.end?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:2,class:(0,t.normalizeClass)([s.value,`justify-end`])},[(0,t.renderSlot)(e.$slots,`end`)],2)):(0,t.createCommentVNode)(``,!0)],2))}}),XE=[`aria-labelledby`],ZE={class:`flex min-w-0 flex-1 flex-col gap-0.5 pr-4`},QE={key:0,class:`mt-0.5 truncate text-xs text-muted sm:text-sm`},$E={class:`flex shrink-0 items-center gap-1`},eD=(0,t.defineComponent)({__name:`Modal`,props:(0,t.mergeModels)({title:{default:``},description:{default:``},size:{default:`md`},position:{default:`center`},scrollBehavior:{default:`inside`},dismissableMask:{type:Boolean,default:!0},closeOnEscape:{type:Boolean,default:!0},showCloseIcon:{type:Boolean,default:!0},blockScroll:{type:Boolean,default:!0},hideBackdrop:{type:Boolean,default:!1},maximizable:{type:Boolean,default:!1},minimizable:{type:Boolean,default:!1},zIndex:{default:9999},contentClass:{},overlayClass:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{},isMaximized:{type:Boolean,default:!1},isMaximizedModifiers:{},isMinimized:{type:Boolean,default:!1},isMinimizedModifiers:{}}),emits:(0,t.mergeModels)([`open`,`close`,`maximize`,`minimize`],[`update:modelValue`,`update:isMaximized`,`update:isMinimized`]),setup(e,{emit:n}){let r=e,i=(0,t.useModel)(e,`modelValue`),a=(0,t.useModel)(e,`isMaximized`),o=(0,t.useModel)(e,`isMinimized`),s=n,c=(0,t.ref)(null),l=(0,t.ref)(null),u=()=>{i.value=!1,s(`close`)},d=()=>{a.value=!a.value,a.value&&(o.value=!1),s(`maximize`,a.value)},f=()=>{o.value=!o.value,o.value&&(a.value=!1),s(`minimize`,o.value)},p=()=>{r.dismissableMask&&!r.hideBackdrop&&u()},m=e=>{r.closeOnEscape&&i.value&&e.key===`Escape`&&u()};(0,t.watch)(o,e=>{r.blockScroll&&(e?document.body.style.overflow=``:i.value&&(document.body.style.overflow=`hidden`))}),(0,t.watch)(()=>i.value,async e=>{e?(performance.mark(`modal-watch-start`),s(`open`),c.value=document.activeElement,performance.mark(`modal-before-overflow`),r.blockScroll&&!o.value&&(document.body.style.overflow=`hidden`),performance.mark(`modal-after-overflow`),await(0,t.nextTick)(),performance.mark(`modal-after-nexttick`),l.value&&l.value.focus({preventScroll:!0}),performance.mark(`modal-after-focus`),performance.measure(`modal:emit+overflow`,`modal-watch-start`,`modal-before-overflow`),performance.measure(`modal:overflow-write`,`modal-before-overflow`,`modal-after-overflow`),performance.measure(`modal:nextTick-wait`,`modal-after-overflow`,`modal-after-nexttick`),performance.measure(`modal:focus-call`,`modal-after-nexttick`,`modal-after-focus`)):(r.blockScroll&&(document.body.style.overflow=``),c.value&&c.value.focus(),setTimeout(()=>{a.value=!1,o.value=!1},300))}),(0,t.onMounted)(()=>document.addEventListener(`keydown`,m)),(0,t.onUnmounted)(()=>{document.removeEventListener(`keydown`,m),r.blockScroll&&(document.body.style.overflow=``)});let h=(0,t.computed)(()=>r.position===`left`||r.position===`right`),g=(0,t.computed)(()=>!h.value&&r.size===`full`||a.value),_=(0,t.computed)(()=>g.value?`flex-col items-center justify-center p-0`:r.scrollBehavior===`outside`?`flex-col items-start justify-center py-12 sm:py-24 px-4`:{center:`flex-col items-center justify-center p-4 sm:p-6`,top:`flex-col items-center justify-start p-4 sm:p-6`,bottom:`flex-col items-center justify-end p-4 sm:p-6`,left:`flex-row items-stretch justify-start p-0 sm:pr-16`,right:`flex-row items-stretch justify-end p-0 sm:pl-16`,"bottom-right":`flex-col items-end justify-end p-4 sm:p-6`,"bottom-left":`flex-col items-start justify-end p-4 sm:p-6`,"top-right":`flex-col items-end justify-start p-4 sm:p-6`,"top-left":`flex-col items-start justify-start p-4 sm:p-6`}[r.position]),v=(0,t.computed)(()=>g.value||h.value?``:r.position===`center`?`m-auto`:r.position===`top`?`mx-auto mt-0 mb-auto`:r.position===`bottom`?`mx-auto mt-auto mb-0`:``),y=(0,t.computed)(()=>h.value?{auto:`w-auto`,xs:`w-64`,sm:`w-80`,md:`w-96`,lg:`w-[32rem]`,xl:`w-[48rem]`,full:`w-full`}[r.size]:g.value?`w-full max-w-none`:{auto:`w-auto`,xs:`w-full max-w-xs`,sm:`w-full max-w-sm`,md:`w-full max-w-md sm:max-w-lg`,lg:`w-full max-w-3xl`,xl:`w-full max-w-5xl`,full:`w-full max-w-none`}[r.size]),b=(0,t.computed)(()=>h.value||g.value?`h-full rounded-none flex-col`:r.scrollBehavior===`inside`&&!o.value?`max-h-[calc(100vh-2rem)] sm:max-h-[calc(100vh-4rem)] flex-col`:`h-auto flex-col`),x=(0,t.computed)(()=>r.position.includes(`right`)&&!r.position.includes(`bottom`)&&!r.position.includes(`top`)?{enterActiveClass:`transition-transform ease-out duration-300`,enterFromClass:`translate-x-full`,enterToClass:`translate-x-0`,leaveActiveClass:`transition-transform ease-in duration-200`,leaveFromClass:`translate-x-0`,leaveToClass:`translate-x-full`}:r.position.includes(`left`)&&!r.position.includes(`bottom`)&&!r.position.includes(`top`)?{enterActiveClass:`transition-transform ease-out duration-300`,enterFromClass:`-translate-x-full`,enterToClass:`translate-x-0`,leaveActiveClass:`transition-transform ease-in duration-200`,leaveFromClass:`translate-x-0`,leaveToClass:`-translate-x-full`}:r.position.includes(`bottom`)?{enterActiveClass:`transition-all ease-out duration-300`,enterFromClass:`translate-y-full opacity-0`,enterToClass:`translate-y-0 opacity-100`,leaveActiveClass:`transition-all ease-in duration-200`,leaveFromClass:`translate-y-0 opacity-100`,leaveToClass:`translate-y-full opacity-0`}:r.position.includes(`top`)?{enterActiveClass:`transition-all ease-out duration-300`,enterFromClass:`-translate-y-full opacity-0`,enterToClass:`translate-y-0 opacity-100`,leaveActiveClass:`transition-all ease-in duration-200`,leaveFromClass:`translate-y-0 opacity-100`,leaveToClass:`-translate-y-full opacity-0`}:{enterActiveClass:`transition-all ease-[cubic-bezier(0.34,1.56,0.64,1)] duration-300`,enterFromClass:`opacity-0 scale-95 translate-y-4`,enterToClass:`opacity-100 scale-100 translate-y-0`,leaveActiveClass:`transition-all ease-in duration-200`,leaveFromClass:`opacity-100 scale-100 translate-y-0`,leaveToClass:`opacity-0 scale-95 translate-y-4`});return(n,s)=>{let c=(0,t.resolveComponent)(`Button`);return(0,t.openBlock)(),(0,t.createBlock)(t.Teleport,{to:`body`},[(0,t.createVNode)(t.Transition,{"enter-active-class":`transition-opacity ease-linear duration-300`,"enter-from-class":`opacity-0`,"enter-to-class":`opacity-100`,"leave-active-class":`transition-opacity ease-linear duration-200`,"leave-from-class":`opacity-100`,"leave-to-class":`opacity-0`},{default:(0,t.withCtx)(()=>[i.value&&!e.hideBackdrop&&!o.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`bg-background/60 pointer-events-auto fixed inset-0 backdrop-blur-sm`,style:(0,t.normalizeStyle)({zIndex:Number(r.zIndex)-1}),onClick:p,"aria-hidden":`true`},null,4)):(0,t.createCommentVNode)(``,!0)]),_:1}),(0,t.createVNode)(t.Transition,(0,t.normalizeProps)((0,t.guardReactiveProps)(x.value)),{default:(0,t.withCtx)(()=>[i.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`fixed inset-0 w-full`,[r.scrollBehavior===`outside`&&!o.value?`pointer-events-auto h-full overflow-y-auto overscroll-contain`:`pointer-events-none h-full overflow-hidden`,e.overlayClass]]),style:(0,t.normalizeStyle)({zIndex:r.zIndex}),role:`dialog`,"aria-modal":`true`,"aria-labelledby":e.title?`modal-title`:void 0,tabindex:`-1`,ref_key:`modalContainer`,ref:l},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`pointer-events-none flex w-full`,[r.scrollBehavior===`outside`&&!o.value?`min-h-full`:`h-full`,_.value]])},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`pointer-events-auto relative flex bg-content shadow-xl transition-all duration-300`,[!h.value&&!g.value&&`rounded-md border border-main`,h.value&&`border-main shadow-[0_0_40px_rgba(0,0,0,0.1)]`,h.value&&e.position===`right`&&`border-l`,h.value&&e.position===`left`&&`border-r`,y.value,b.value,v.value,e.contentClass]])},[n.$slots.header?(0,t.renderSlot)(n.$slots,`header`,{key:0,isMinimized:o.value}):n.$slots.title||e.title?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,role:`toolbar`,"aria-label":`Command Toolbar`,class:(0,t.normalizeClass)([`flex w-full flex-shrink-0 flex-row flex-nowrap items-center justify-between gap-2 border-main/50 bg-surface/30 px-4 transition-all duration-200`,[o.value?`cursor-pointer rounded-t-md border-b-0 py-2 hover:bg-surface/50`:`border-b py-3`,!h.value&&!g.value?`rounded-t-md`:``]]),onClick:s[0]||=e=>o.value?f():null},[(0,t.createElementVNode)(`div`,ZE,[(0,t.renderSlot)(n.$slots,`title`,{isMinimized:o.value},()=>[(0,t.createElementVNode)(`h3`,{id:`modal-title`,class:(0,t.normalizeClass)([`truncate leading-tight font-bold text-main transition-all duration-200`,o.value?`text-sm`:`text-base md:text-lg`])},(0,t.toDisplayString)(e.title),3),e.description&&!o.value?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,QE,(0,t.toDisplayString)(e.description),1)):(0,t.createCommentVNode)(``,!0)])]),(0,t.createElementVNode)(`div`,$E,[e.minimizable&&!h.value?((0,t.openBlock)(),(0,t.createBlock)(c,{key:0,"aria-label":`Minimize modal`,size:`sm`,rounded:``,variant:`text`,severity:`secondary`,icon:o.value?`lucide:chevron-up`:`lucide:minus`,onClick:(0,t.withModifiers)(f,[`stop`])},null,8,[`icon`])):(0,t.createCommentVNode)(``,!0),e.maximizable&&!h.value&&!o.value?((0,t.openBlock)(),(0,t.createBlock)(c,{key:1,"aria-label":`Maximize modal`,size:`sm`,rounded:``,variant:`text`,severity:`secondary`,icon:a.value?`lucide:minimize`:`lucide:maximize`,onClick:(0,t.withModifiers)(d,[`stop`])},null,8,[`icon`])):(0,t.createCommentVNode)(``,!0),e.showCloseIcon?((0,t.openBlock)(),(0,t.createBlock)(c,{key:2,"aria-label":`Close modal`,size:`sm`,rounded:``,variant:`text`,severity:`secondary`,icon:`lucide:x`,onClick:(0,t.withModifiers)(u,[`stop`])})):(0,t.createCommentVNode)(``,!0)])],2)):(0,t.createCommentVNode)(``,!0),(0,t.withDirectives)((0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`p-4 sm:p-5`,[r.scrollBehavior===`inside`||h.value||g.value?`custom-scrollbar min-h-0 flex-1 overflow-y-auto`:`flex-none overflow-visible`]])},[(0,t.renderSlot)(n.$slots,`default`)],2),[[t.vShow,!o.value]]),(0,t.withDirectives)((0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex w-full flex-shrink-0 items-center border-t border-main/50 bg-surface/30 px-4 py-3 sm:px-5 sm:py-3.5`,!h.value&&!g.value&&r.position!==`bottom`&&`rounded-b-md`])},[(0,t.renderSlot)(n.$slots,`footer`,{isMinimized:o.value})],2),[[t.vShow,!o.value&&n.$slots.footer]])],2)],2)],14,XE)):(0,t.createCommentVNode)(``,!0)]),_:3},16)])}}}),tD={"aria-label":`Progress`,class:`block w-full max-w-full font-sans`},nD={class:`flex w-full flex-col sm:hidden`},rD={key:0,class:`mb-4 w-full`},iD={class:`m-0 flex w-full min-w-0 list-none items-center justify-between rounded-xl border border-main bg-surface/50 p-0 p-3 shadow-sm`},aD=[`disabled`,`onClick`],oD={class:`flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-content text-sm`},sD={key:3,class:`absolute inset-0 flex items-center justify-center leading-none`},cD={class:`flex min-w-0 flex-col pr-0 text-left`},lD={class:`truncate`},uD={key:0,class:`mt-0.5 w-full truncate text-[10px] leading-tight text-muted`},dD={key:1,class:`mt-4 w-full min-w-0 flex-1`},fD={key:2,class:`mt-4 w-full`},pD={key:0,class:`m-0 -my-2 hidden w-full min-w-0 list-none items-start justify-between overflow-hidden p-0 py-2 sm:flex`},mD={class:`flex w-full items-center`},hD=[`disabled`,`onClick`],gD={key:3,class:`absolute inset-0 flex items-center justify-center leading-none`},_D={class:`mt-3 flex w-full max-w-[140px] flex-col items-center px-2 pb-2 text-center break-words`},vD={key:0,class:`mt-1 shrink-0 rounded bg-main/10 px-1.5 py-[1px] text-[9px] font-bold tracking-wider text-muted uppercase`},yD=[`disabled`,`onClick`],bD={key:3,class:`absolute inset-0 flex items-center justify-center leading-none`},xD={class:`flex min-w-0 flex-col pr-2 text-left`},SD={class:`truncate`},CD={key:0,class:`shrink-0 rounded bg-main/10 px-1.5 py-[1px] text-[9px] font-bold tracking-wider text-muted uppercase`},wD={key:1,class:`m-0 hidden w-full list-none flex-col p-0 pt-2 sm:flex`},TD={class:`flex shrink-0 flex-col items-center`},ED=[`disabled`,`onClick`],DD={key:3,class:`absolute inset-0 flex items-center justify-center leading-none`},OD=[`onClick`],kD={class:`truncate`},AD={key:0,class:`hidden shrink-0 rounded bg-main/10 px-1.5 py-[1px] text-[9px] font-bold tracking-wider text-muted uppercase sm:block`},jD={class:`h-full w-full pb-2`},MD={key:2,class:`m-0 hidden w-full gap-6 p-0 pt-1 sm:flex lg:gap-8`},ND={class:`flex h-fit w-56 shrink-0 flex-col gap-4 rounded-xl border border-main bg-content p-5 shadow-sm lg:w-64`},PD={class:`m-0 flex w-full list-none flex-col p-0`},FD={class:`flex shrink-0 flex-col items-center`},ID=[`disabled`,`onClick`],LD={key:3,class:`absolute inset-0 flex items-center justify-center leading-none`},RD=[`onClick`],zD={class:`truncate`},BD={key:0,class:`hidden shrink-0 rounded bg-main/10 px-1.5 py-[1px] text-[9px] font-bold tracking-wider text-muted uppercase lg:block`},VD={class:`flex min-w-0 flex-1 flex-col`},HD=(0,t.defineComponent)({__name:`Stepper`,props:{items:{},modelValue:{default:0},orientation:{default:`horizontal`},labelPosition:{default:`right`},variant:{default:`solid`},linear:{type:Boolean,default:!0},size:{default:`md`},severity:{default:`primary`}},emits:[`update:modelValue`,`change`],setup(e,{emit:r}){let i=e,a=r,o=e=>e===i.modelValue,s=e=>e<i.modelValue,c=e=>!!i.items[e]?.error,l=e=>!!(i.items[e]?.disabled||i.linear&&e>i.modelValue),u=e=>{l(e)||o(e)||(a(`change`,e,i.modelValue),a(`update:modelValue`,e))},d=(0,t.computed)(()=>{let e=i.items.length;return e<=2?0:i.modelValue>=e-1?e-2:i.modelValue}),f=(0,t.computed)(()=>Math.min(i.items.length-1,d.value+1)),p=e=>e===d.value||e===f.value,m={xs:{node:`w-6 h-6 text-[10px]`,border:`border-2`,icon:`w-3 h-3`,title:`text-[10px] sm:text-[11px]`,desc:`text-[9px]`,lineHor:`border-t-2`,lineVer:`border-l-2`},sm:{node:`w-7 h-7 text-[11px]`,border:`border-2`,icon:`w-3.5 h-3.5`,title:`text-[11px] sm:text-xs`,desc:`text-[10px]`,lineHor:`border-t-2`,lineVer:`border-l-2`},md:{node:`w-9 h-9 text-sm`,border:`border-2`,icon:`w-4.5 h-4.5`,title:`text-xs sm:text-sm`,desc:`text-[11px] sm:text-xs`,lineHor:`border-t-2`,lineVer:`border-l-2`},lg:{node:`w-12 h-12 text-lg`,border:`border-[3px]`,icon:`w-6 h-6`,title:`text-sm sm:text-base`,desc:`text-xs sm:text-sm`,lineHor:`border-t-[3px]`,lineVer:`border-l-[3px]`},xl:{node:`w-14 h-14 text-xl`,border:`border-[3px]`,icon:`w-7 h-7`,title:`text-base sm:text-lg`,desc:`text-sm sm:text-base`,lineHor:`border-t-[3px]`,lineVer:`border-l-[3px]`}},h={solid:{primary:{active:`bg-primary border-primary text-on-primary ring-4 ring-primary/20 scale-110 shadow-md`,completed:`bg-primary border-primary text-on-primary`},secondary:{active:`bg-muted border-main text-main ring-4 ring-main/20 scale-110 shadow-md`,completed:`bg-muted border-main text-main`},success:{active:`bg-success border-success text-on-success ring-4 ring-success/20 scale-110 shadow-md`,completed:`bg-success border-success text-on-success`},info:{active:`bg-info border-info text-on-info ring-4 ring-info/20 scale-110 shadow-md`,completed:`bg-info border-info text-on-info`},warning:{active:`bg-warning border-warning text-on-warning ring-4 ring-warning/20 scale-110 shadow-md`,completed:`bg-warning border-warning text-on-warning`},danger:{active:`bg-danger border-danger text-on-danger ring-4 ring-danger/20 scale-110 shadow-md`,completed:`bg-danger border-danger text-on-danger`}},soft:{primary:{active:`bg-primary/15 border-primary/30 text-primary ring-4 ring-primary/10 scale-110`,completed:`bg-primary/15 border-primary/30 text-primary`},secondary:{active:`bg-muted/40 border-main/30 text-main ring-4 ring-main/10 scale-110`,completed:`bg-muted/40 border-main/30 text-main`},success:{active:`bg-success/15 border-success/30 text-success ring-4 ring-success/10 scale-110`,completed:`bg-success/15 border-success/30 text-success`},info:{active:`bg-info/15 border-info/30 text-info ring-4 ring-info/10 scale-110`,completed:`bg-info/15 border-info/30 text-info`},warning:{active:`bg-warning/15 border-warning/30 text-warning ring-4 ring-warning/10 scale-110`,completed:`bg-warning/15 border-warning/30 text-warning`},danger:{active:`bg-danger/15 border-danger/30 text-danger ring-4 ring-danger/10 scale-110`,completed:`bg-danger/15 border-danger/30 text-danger`}},outline:{primary:{active:`bg-surface border-primary text-primary ring-4 ring-primary/10 scale-110 shadow-sm`,completed:`bg-surface border-primary text-primary`},secondary:{active:`bg-surface border-main text-main ring-4 ring-main/10 scale-110 shadow-sm`,completed:`bg-surface border-main text-main`},success:{active:`bg-surface border-success text-success ring-4 ring-success/10 scale-110 shadow-sm`,completed:`bg-surface border-success text-success`},info:{active:`bg-surface border-info text-info ring-4 ring-info/10 scale-110 shadow-sm`,completed:`bg-surface border-info text-info`},warning:{active:`bg-surface border-warning text-warning ring-4 ring-warning/10 scale-110 shadow-sm`,completed:`bg-surface border-warning text-warning`},danger:{active:`bg-surface border-danger text-danger ring-4 ring-danger/10 scale-110 shadow-sm`,completed:`bg-surface border-danger text-danger`}}},g={primary:`text-primary`,secondary:`text-main`,success:`text-success`,info:`text-info`,warning:`text-warning`,danger:`text-danger`},_={primary:`border-primary`,secondary:`border-main`,success:`border-success`,info:`border-info`,warning:`border-warning`,danger:`border-danger`},v=e=>{let t=`relative flex items-center justify-center rounded-full font-bold transition-all duration-300 z-10 box-border shrink-0 outline-none w-full h-full`,n=i.severity;return c(e)?`${t} bg-danger/10 border-danger/50 text-danger`:o(e)?`${t} ${h[i.variant][n].active}`:s(e)?`${t} ${h[i.variant][n].completed}`:`${t} bg-surface border-main/30 text-muted`},y=e=>s(e)?_[i.severity]:`border-main/20`;return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`nav`,tD,[(0,t.createElementVNode)(`div`,nD,[r.$slots[`sidebar-header`]&&e.orientation===`sidebar`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,rD,[(0,t.renderSlot)(r.$slots,`sidebar-header`)])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`ol`,iD,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.items,(i,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`li`,{key:a,class:(0,t.normalizeClass)([`relative max-w-full`,[p(a)?`flex items-center`:`hidden`,a===f.value?`shrink-0`:`min-w-0 flex-1`]])},[(0,t.createElementVNode)(`button`,{type:`button`,class:(0,t.normalizeClass)([`relative z-10 flex max-w-full min-w-0 shrink items-center gap-2 rounded-md transition-all outline-none focus:outline-none`,[l(a)?`cursor-not-allowed opacity-50`:`cursor-pointer active:scale-95`]]),disabled:l(a),onClick:e=>u(a)},[(0,t.createElementVNode)(`div`,oD,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`h-8 w-8 border-2 text-sm`,v(a)])},[(0,t.renderSlot)(r.$slots,`icon`,{step:i,index:a,active:o(a),completed:s(a),error:c(a)},()=>[c(a)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:alert-triangle`,class:`h-4 w-4`})):s(a)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:1,icon:`lucide:check`,class:`h-4 w-4`})):i.icon?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:2,icon:i.icon,class:`h-4 w-4`},null,8,[`icon`])):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,sD,(0,t.toDisplayString)(a+1),1))])],2)]),(0,t.createElementVNode)(`div`,cD,[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`flex w-full items-center gap-2 truncate text-xs font-bold tracking-tight transition-colors duration-200`,[o(a)?g[e.severity]:c(a)?`text-danger`:`text-main`]])},[(0,t.createElementVNode)(`span`,lD,(0,t.toDisplayString)(i.label),1)],2),i.description?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,uD,(0,t.toDisplayString)(i.description),1)):(0,t.createCommentVNode)(``,!0)])],10,aD),a!==e.items.length-1&&p(a+1)?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`h-[2px] min-w-[12px] flex-1 shrink self-center transition-colors duration-500`,y(a)])},null,2)):(0,t.createCommentVNode)(``,!0)],2))),128))]),e.orientation!==`horizontal`&&r.$slots.content?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,dD,[(0,t.renderSlot)(r.$slots,`content`,{step:e.items[e.modelValue],index:e.modelValue,active:!0,completed:s(e.modelValue),error:c(e.modelValue)})])):(0,t.createCommentVNode)(``,!0),r.$slots[`sidebar-footer`]&&e.orientation===`sidebar`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,fD,[(0,t.renderSlot)(r.$slots,`sidebar-footer`)])):(0,t.createCommentVNode)(``,!0)]),e.orientation===`horizontal`?((0,t.openBlock)(),(0,t.createElementBlock)(`ol`,pD,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.items,(i,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`li`,{key:a,class:(0,t.normalizeClass)([`relative flex max-w-full`,[e.labelPosition===`bottom`?`flex-1 flex-col items-center`:`min-w-0 items-center`,e.labelPosition===`right`&&a!==e.items.length-1?`flex-1`:e.labelPosition===`right`?`shrink-0`:``]])},[e.labelPosition===`bottom`?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createElementVNode)(`div`,mD,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex-1 transition-colors duration-500`,[m[e.size].lineHor,a===0?`border-transparent`:y(a-1)]])},null,2),(0,t.createElementVNode)(`button`,{type:`button`,class:(0,t.normalizeClass)([`group relative z-10 mx-2 shrink-0 rounded-full transition-all outline-none focus:outline-none`,[l(a)?`cursor-not-allowed opacity-50`:`cursor-pointer`]]),disabled:l(a),onClick:e=>u(a)},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex shrink-0 items-center justify-center rounded-full bg-content`,m[e.size].node])},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([m[e.size].node,m[e.size].border,v(a),!l(a)&&!o(a)&&`group-hover:brightness-95`])},[(0,t.renderSlot)(r.$slots,`icon`,{step:i,index:a,active:o(a),completed:s(a),error:c(a)},()=>[c(a)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:alert-triangle`,class:(0,t.normalizeClass)(m[e.size].icon)},null,8,[`class`])):s(a)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:1,icon:`lucide:check`,class:(0,t.normalizeClass)(m[e.size].icon)},null,8,[`class`])):i.icon?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:2,icon:i.icon,class:(0,t.normalizeClass)(m[e.size].icon)},null,8,[`icon`,`class`])):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,gD,(0,t.toDisplayString)(a+1),1))])],2)],2)],10,hD),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex-1 transition-colors duration-500`,[m[e.size].lineHor,a===e.items.length-1?`border-transparent`:y(a)]])},null,2)]),(0,t.createElementVNode)(`div`,_D,[(0,t.renderSlot)(r.$slots,`title`,{step:i,index:a,active:o(a),completed:s(a),error:c(a)},()=>[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`w-full leading-tight font-bold tracking-tight transition-colors duration-200`,[m[e.size].title,o(a)?g[e.severity]:c(a)?`text-danger`:`text-main`]])},(0,t.toDisplayString)(i.label),3),i.optional?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,vD,`Optional`)):(0,t.createCommentVNode)(``,!0)]),(0,t.renderSlot)(r.$slots,`description`,{step:i,index:a,active:o(a),completed:s(a),error:c(a)},()=>[i.description?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:(0,t.normalizeClass)([`mt-1.5 w-full leading-tight text-muted`,m[e.size].desc])},(0,t.toDisplayString)(i.description),3)):(0,t.createCommentVNode)(``,!0)])])],64)):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createElementVNode)(`button`,{type:`button`,class:(0,t.normalizeClass)([`relative z-10 flex max-w-full min-w-0 shrink items-center gap-3 rounded-md p-1 transition-all outline-none focus:outline-none`,[l(a)?`cursor-not-allowed opacity-50`:`cursor-pointer hover:bg-surface/50`]]),disabled:l(a),onClick:e=>u(a)},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex shrink-0 items-center justify-center rounded-full bg-content`,m[e.size].node])},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([m[e.size].node,m[e.size].border,v(a)])},[(0,t.renderSlot)(r.$slots,`icon`,{step:i,index:a,active:o(a),completed:s(a),error:c(a)},()=>[c(a)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:alert-triangle`,class:(0,t.normalizeClass)(m[e.size].icon)},null,8,[`class`])):s(a)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:1,icon:`lucide:check`,class:(0,t.normalizeClass)(m[e.size].icon)},null,8,[`class`])):i.icon?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:2,icon:i.icon,class:(0,t.normalizeClass)(m[e.size].icon)},null,8,[`icon`,`class`])):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,bD,(0,t.toDisplayString)(a+1),1))])],2)],2),(0,t.createElementVNode)(`div`,xD,[(0,t.renderSlot)(r.$slots,`title`,{step:i,index:a,active:o(a),completed:s(a),error:c(a)},()=>[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`flex w-full items-center gap-2 truncate font-bold tracking-tight transition-colors duration-200`,[m[e.size].title,o(a)?g[e.severity]:c(a)?`text-danger`:`text-main`]])},[(0,t.createElementVNode)(`span`,SD,(0,t.toDisplayString)(i.label),1),i.optional?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,CD,`Opt`)):(0,t.createCommentVNode)(``,!0)],2)]),(0,t.renderSlot)(r.$slots,`description`,{step:i,index:a,active:o(a),completed:s(a),error:c(a)},()=>[i.description?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:(0,t.normalizeClass)([`mt-0.5 w-full truncate leading-tight text-muted`,m[e.size].desc])},(0,t.toDisplayString)(i.description),3)):(0,t.createCommentVNode)(``,!0)])])],10,yD),a===e.items.length-1?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`mx-4 min-w-[16px] flex-1 shrink self-center rounded-full transition-colors duration-500`,[m[e.size].lineHor,y(a)]])},null,2))],64))],2))),128))])):e.orientation===`vertical`?((0,t.openBlock)(),(0,t.createElementBlock)(`ol`,wD,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.items,(i,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`li`,{key:a,class:`relative flex gap-4`},[(0,t.createElementVNode)(`div`,TD,[(0,t.createElementVNode)(`button`,{type:`button`,class:(0,t.normalizeClass)([`group mt-0.5 rounded-full transition-transform outline-none focus:outline-none`,[l(a)?`cursor-not-allowed opacity-50`:`cursor-pointer`]]),disabled:l(a),onClick:e=>u(a)},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex shrink-0 items-center justify-center rounded-full bg-content`,m[e.size].node])},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([m[e.size].node,m[e.size].border,v(a),!l(a)&&!o(a)&&`group-hover:brightness-95`])},[(0,t.renderSlot)(r.$slots,`icon`,{step:i,index:a,active:o(a),completed:s(a),error:c(a)},()=>[c(a)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:alert-triangle`,class:(0,t.normalizeClass)(m[e.size].icon)},null,8,[`class`])):s(a)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:1,icon:`lucide:check`,class:(0,t.normalizeClass)(m[e.size].icon)},null,8,[`class`])):i.icon?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:2,icon:i.icon,class:(0,t.normalizeClass)(m[e.size].icon)},null,8,[`icon`,`class`])):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,DD,(0,t.toDisplayString)(a+1),1))])],2)],2)],10,ED),a===e.items.length-1?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`my-1.5 min-h-[20px] flex-1 rounded-full transition-colors duration-500`,[m[e.size].lineVer,y(a)]])},null,2))]),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex min-w-0 flex-1 flex-col pt-0.5`,a===e.items.length-1?``:`pb-6`])},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex max-w-full flex-col transition-colors select-none`,[l(a)?`cursor-not-allowed opacity-50`:`cursor-pointer`]]),onClick:e=>u(a)},[(0,t.renderSlot)(r.$slots,`title`,{step:i,index:a,active:o(a),completed:s(a),error:c(a)},()=>[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`flex items-center gap-2 font-bold tracking-tight transition-colors duration-200`,[m[e.size].title,o(a)?g[e.severity]:c(a)?`text-danger`:`text-main`]])},[(0,t.createElementVNode)(`span`,kD,(0,t.toDisplayString)(i.label),1),i.optional?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,AD,`Optional`)):(0,t.createCommentVNode)(``,!0)],2)]),(0,t.renderSlot)(r.$slots,`description`,{step:i,index:a,active:o(a),completed:s(a),error:c(a)},()=>[i.description?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:(0,t.normalizeClass)([`mt-0.5 max-w-[90%] leading-relaxed text-muted`,m[e.size].desc])},(0,t.toDisplayString)(i.description),3)):(0,t.createCommentVNode)(``,!0)])],10,OD),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`w-full overflow-hidden transition-all duration-400 ease-in-out`,o(a)?`mt-3 max-h-[2500px] opacity-100`:`max-h-0 opacity-0`])},[(0,t.createElementVNode)(`div`,jD,[(0,t.renderSlot)(r.$slots,`content`,{step:i,index:a,active:o(a),completed:s(a),error:c(a)})])],2)],2)]))),128))])):e.orientation===`sidebar`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,MD,[(0,t.createElementVNode)(`div`,ND,[(0,t.renderSlot)(r.$slots,`sidebar-header`),(0,t.createElementVNode)(`ol`,PD,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.items,(i,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`li`,{key:a,class:`relative flex gap-3`},[(0,t.createElementVNode)(`div`,FD,[(0,t.createElementVNode)(`button`,{type:`button`,class:(0,t.normalizeClass)([`group mt-0.5 rounded-full transition-transform outline-none focus:outline-none`,[l(a)?`cursor-not-allowed opacity-50`:`cursor-pointer`]]),disabled:l(a),onClick:e=>u(a)},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex shrink-0 items-center justify-center rounded-full bg-content`,m[e.size].node])},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([m[e.size].node,m[e.size].border,v(a),!l(a)&&!o(a)&&`group-hover:brightness-95`])},[(0,t.renderSlot)(r.$slots,`icon`,{step:i,index:a,active:o(a),completed:s(a),error:c(a)},()=>[c(a)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:alert-triangle`,class:(0,t.normalizeClass)(m[e.size].icon)},null,8,[`class`])):s(a)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:1,icon:`lucide:check`,class:(0,t.normalizeClass)(m[e.size].icon)},null,8,[`class`])):i.icon?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:2,icon:i.icon,class:(0,t.normalizeClass)(m[e.size].icon)},null,8,[`icon`,`class`])):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,LD,(0,t.toDisplayString)(a+1),1))])],2)],2)],10,ID),a===e.items.length-1?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`my-1 min-h-[16px] flex-1 rounded-full transition-colors duration-500`,[m[e.size].lineVer,y(a)]])},null,2))]),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex min-w-0 flex-1 flex-col pt-0.5`,a===e.items.length-1?``:`pb-4`])},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex max-w-full flex-col transition-colors select-none`,[l(a)?`cursor-not-allowed opacity-50`:`cursor-pointer`]]),onClick:e=>u(a)},[(0,t.renderSlot)(r.$slots,`title`,{step:i,index:a,active:o(a),completed:s(a),error:c(a)},()=>[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`flex items-center gap-1.5 font-bold tracking-tight transition-colors duration-200`,[m[e.size].title,o(a)?g[e.severity]:c(a)?`text-danger`:`text-main`]])},[(0,t.createElementVNode)(`span`,zD,(0,t.toDisplayString)(i.label),1),i.optional?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,BD,`Opt`)):(0,t.createCommentVNode)(``,!0)],2)]),(0,t.renderSlot)(r.$slots,`description`,{step:i,index:a,active:o(a),completed:s(a),error:c(a)},()=>[i.description?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:(0,t.normalizeClass)([`mt-0.5 max-w-full truncate leading-relaxed text-muted`,m[e.size].desc])},(0,t.toDisplayString)(i.description),3)):(0,t.createCommentVNode)(``,!0)])],10,RD)],2)]))),128))]),(0,t.renderSlot)(r.$slots,`sidebar-footer`)]),(0,t.createElementVNode)(`div`,VD,[(0,t.renderSlot)(r.$slots,`content`,{step:e.items[e.modelValue],index:e.modelValue,active:!0,completed:s(e.modelValue),error:c(e.modelValue)})])])):(0,t.createCommentVNode)(``,!0)]))}}),UD=24,WD=(0,t.defineComponent)({__name:`ScrollPanel`,props:{height:{default:void 0},orientation:{default:`vertical`},size:{default:`sm`},severity:{default:void 0},autoHide:{type:Boolean,default:!0}},setup(e){let n=e,r={xs:4,sm:6,md:8,lg:10,xl:14},i={primary:`bg-primary`,secondary:`bg-secondary`,success:`bg-success`,warning:`bg-warning`,danger:`bg-danger`,info:`bg-info`},a=(0,t.computed)(()=>r[n.size]),o=(0,t.computed)(()=>n.severity&&i[n.severity]||`bg-muted`),s=e=>{if(e!=null)return typeof e==`number`||!isNaN(Number(e))?`${e}px`:e},c=(0,t.computed)(()=>{let e=s(n.height);return e?{height:e}:{}}),l=(0,t.computed)(()=>[n.orientation===`horizontal`?`overflow-y-hidden`:`overflow-y-auto`,n.orientation===`vertical`?`overflow-x-hidden`:`overflow-x-auto`]),u=(0,t.ref)(null),d=(0,t.ref)(null),f=(0,t.ref)(0),p=(0,t.ref)(0),m=(0,t.ref)(0),h=(0,t.ref)(0),g=(0,t.ref)(0),_=(0,t.ref)(0),v=()=>{let e=u.value;e&&(m.value=e.clientHeight,h.value=e.clientWidth,g.value=e.scrollHeight,_.value=e.scrollWidth,f.value=e.scrollTop,p.value=e.scrollLeft)},y=(0,t.ref)(!1),b=(0,t.ref)(!1),x=(0,t.ref)(!1),S,C=(0,t.computed)(()=>!n.autoHide||y.value||b.value||x.value),w=()=>{x.value=!0,clearTimeout(S),S=setTimeout(()=>{x.value=!1},700)},T=()=>{let e=u.value;e&&(f.value=e.scrollTop,p.value=e.scrollLeft,w())},E=(0,t.computed)(()=>n.orientation!==`horizontal`&&g.value>m.value+1),D=(0,t.computed)(()=>n.orientation!==`vertical`&&_.value>h.value+1),O=(0,t.computed)(()=>{let e=m.value;if(!e||g.value<=0)return{size:0,offset:0};let t=Math.max(UD,Math.round(e/g.value*e)),n=g.value-e,r=e-t;return{size:t,offset:n>0?f.value/n*r:0}}),k=(0,t.computed)(()=>{let e=h.value;if(!e||_.value<=0)return{size:0,offset:0};let t=Math.max(UD,Math.round(e/_.value*e)),n=_.value-e,r=e-t;return{size:t,offset:n>0?p.value/n*r:0}}),A=(0,t.computed)(()=>({width:`${a.value}px`,height:`${O.value.size}px`,transform:`translateY(${O.value.offset}px)`})),j=(0,t.computed)(()=>({height:`${a.value}px`,width:`${k.value.size}px`,transform:`translateX(${k.value.offset}px)`})),M=(0,t.ref)(null),N={pos:0,scroll:0},P=e=>{let t=u.value;if(!(!t||!M.value))if(M.value===`vertical`){let n=g.value-m.value,r=Math.max(1,m.value-O.value.size),i=e.clientY-N.pos;t.scrollTop=N.scroll+n/r*i}else{let n=_.value-h.value,r=Math.max(1,h.value-k.value.size),i=e.clientX-N.pos;t.scrollLeft=N.scroll+n/r*i}},F=()=>{M.value=null,b.value=!1,window.removeEventListener(`pointermove`,P),window.removeEventListener(`pointerup`,F)},ee=(e,t)=>{t.preventDefault(),M.value=e,b.value=!0,N.pos=e===`vertical`?t.clientY:t.clientX,N.scroll=e===`vertical`?f.value:p.value,window.addEventListener(`pointermove`,P),window.addEventListener(`pointerup`,F)},I=null;return(0,t.onMounted)(()=>{v(),typeof window<`u`&&window.ResizeObserver&&u.value&&d.value&&(I=new ResizeObserver(()=>v()),I.observe(u.value),I.observe(d.value))}),(0,t.onBeforeUnmount)(()=>{I?.disconnect(),window.removeEventListener(`pointermove`,P),window.removeEventListener(`pointerup`,F),clearTimeout(S)}),(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`relative min-h-0 min-w-0 overflow-hidden`,e.height?`w-full`:`h-full w-full`]),style:(0,t.normalizeStyle)(c.value),onMouseenter:r[2]||=e=>y.value=!0,onMouseleave:r[3]||=e=>y.value=!1},[(0,t.createElementVNode)(`div`,{ref_key:`viewportRef`,ref:u,class:(0,t.normalizeClass)([`custom-scrollbar-hide h-full w-full`,l.value]),onScroll:T},[(0,t.createElementVNode)(`div`,{ref_key:`contentRef`,ref:d},[(0,t.renderSlot)(n.$slots,`default`)],512)],34),E.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`absolute end-0.5 top-0.5 bottom-0.5 z-10`,style:(0,t.normalizeStyle)({width:`${a.value}px`})},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`cursor-grab touch-none rounded-full transition-opacity duration-300 select-none active:cursor-grabbing`,[o.value,C.value?`opacity-100`:`opacity-0`]]),style:(0,t.normalizeStyle)(A.value),onPointerdown:r[0]||=e=>ee(`vertical`,e)},null,38)],4)):(0,t.createCommentVNode)(``,!0),D.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:`absolute start-0.5 end-0.5 bottom-0.5 z-10`,style:(0,t.normalizeStyle)({height:`${a.value}px`})},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`cursor-grab touch-none rounded-full transition-opacity duration-300 select-none active:cursor-grabbing`,[o.value,C.value?`opacity-100`:`opacity-0`]]),style:(0,t.normalizeStyle)(j.value),onPointerdown:r[1]||=e=>ee(`horizontal`,e)},null,38)],4)):(0,t.createCommentVNode)(``,!0)],38))}}),GD={class:`flex flex-col p-xs`},KD=[`href`],qD={key:1,class:`flex items-center gap-2 px-md py-sm text-sm font-medium text-muted`},JD={class:`flex flex-col p-xs`},YD=[`href`],XD={key:1,class:`flex items-center gap-2 px-md py-sm text-sm font-medium text-muted`},ZD=[`href`],QD=3,$D=8,eO=(0,t.defineComponent)({__name:`Breadcrumb`,props:{items:{},icon:{type:[String,Boolean],default:`lucide:book-open`},separatorIcon:{default:`lucide:chevron-right`},size:{default:`sm`},variant:{default:`default`},align:{default:`left`},severity:{default:`secondary`},showRefresh:{type:Boolean,default:!1}},emits:[`refresh`],setup(e,{emit:r}){let i=e,a=r,o={xs:{nav:`gap-1 px-1.5 py-0.5 text-[10px]`,icon:`h-2.5 w-2.5`,item:`px-0.5`},sm:{nav:`gap-1.5 px-2 py-1 text-[11px]`,icon:`h-3 w-3`,item:`px-1`},md:{nav:`gap-2 px-2.5 py-1.5 text-xs`,icon:`h-3.5 w-3.5`,item:`px-1`},lg:{nav:`gap-2 px-3 py-1.5 text-sm`,icon:`h-4 w-4`,item:`px-1.5`},xl:{nav:`gap-2.5 px-3.5 py-2 text-base`,icon:`h-5 w-5`,item:`px-1.5`}},s={default:{link:`font-medium`,current:`font-semibold`},minimal:{link:`font-medium`,current:`font-semibold`}},l={primary:{border:`border-primary/20`,bg:`bg-primary/10`,text:`text-primary`},secondary:{border:`border-main/50`,bg:`bg-muted/40`,text:`text-muted`},success:{border:`border-success/20`,bg:`bg-success/10`,text:`text-success`},warning:{border:`border-warning/20`,bg:`bg-warning/10`,text:`text-warning`},danger:{border:`border-danger/20`,bg:`bg-danger/10`,text:`text-danger`},info:{border:`border-info/20`,bg:`bg-info/10`,text:`text-info`}},u=(0,t.computed)(()=>{let e=l[i.severity];return i.variant===`minimal`?`border-transparent bg-transparent ${e.text}`:`${e.border} ${e.bg} ${e.text}`}),d=(0,t.computed)(()=>`${s[i.variant].current} ${i.severity===`secondary`?`text-main`:l[i.severity].text}`),f=(0,t.computed)(()=>s[i.variant].link),p=(0,t.computed)(()=>i.align===`full`?`flex w-full`:i.align===`center`?`flex w-fit mx-auto`:i.align===`right`?`flex w-fit ml-auto`:`inline-flex w-max`),m=(0,t.computed)(()=>i.align===`full`?`flex-1 justify-between`:``),h=(0,t.ref)(null),g=(0,t.ref)(null),_=(0,t.ref)(null),v=(0,t.ref)(null),y=(0,t.ref)(null),b=(0,t.ref)(null),x=(0,t.ref)([]),S=(e,t)=>{x.value[t]=e??null},C=e=>{b.value=e??null},w=(0,t.ref)(!1),T=(0,t.ref)(0),E=(0,t.ref)(0),D=(0,t.ref)(0),O=(0,t.ref)(0),k=(0,t.ref)(0),A=(0,t.ref)(0),j=(0,t.ref)(0),M=(0,t.ref)([]),N=(e,t)=>e.length!==t.length||e.some((e,n)=>e!==t[n]),P=()=>{if(T.value=h.value?.parentElement?.clientWidth??0,E.value=g.value?.getBoundingClientRect().width??0,_.value){let e=getComputedStyle(_.value);D.value=parseFloat(e.paddingLeft||`0`)+parseFloat(e.paddingRight||`0`),O.value=parseFloat(e.columnGap||`0`)}k.value=v.value?.getBoundingClientRect().width??0,A.value=b.value?.getBoundingClientRect().width??0,j.value=y.value?.getBoundingClientRect().width??0;let e=x.value.map(e=>e?.getBoundingClientRect().width??0);N(M.value,e)&&(M.value=e),w.value=!0},F=null;(0,t.onMounted)(()=>{P();let e=h.value?.parentElement;typeof window<`u`&&window.ResizeObserver&&e&&(F=new ResizeObserver(P),F.observe(e))}),(0,t.onUpdated)(P),(0,t.onBeforeUnmount)(()=>F?.disconnect());let ee=e=>{let t=i.items.length,n=t-1-e>=1,r=M.value.slice(t-e),a=1+ +!!n+r.length,o=a-1,s=+!!i.icon+a+o,c=Math.max(0,s-1)*O.value;return D.value+k.value+(M.value[0]??0)+(n?j.value:0)+r.reduce((e,t)=>e+t,0)+o*A.value+c},I=(0,t.computed)(()=>{let e=i.items.length;if(e<QD)return null;if(!w.value)return{from:1,to:e-2};let t=T.value-E.value-$D;if(t<=0)return{from:1,to:e-2};for(let n=e-1;n>=1;n--)if(ee(n)<=t){let t=e-1-n;return t>=1?{from:1,to:t}:null}return{from:1,to:e-2}}),te=(0,t.computed)(()=>{let e=I.value;return e?i.items.slice(e.from,e.to+1):[]}),ne=(0,t.computed)(()=>{let e=I.value,t=[];for(let n=0;n<i.items.length;n++){if(e&&n===e.from){t.push({type:`ellipsis`}),n=e.to;continue}t.push({type:`item`,item:i.items[n],index:n})}return t});return(r,s)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{ref_key:`wrapRef`,ref:h,class:(0,t.normalizeClass)([`relative inline-flex items-center gap-2`,p.value])},[(0,t.createElementVNode)(`nav`,{ref_key:`navRef`,ref:_,"aria-label":`Breadcrumb`,class:(0,t.normalizeClass)([`items-center rounded-md border font-medium`,i.align===`full`?`flex`:`inline-flex`,u.value,f.value,o[i.size].nav,m.value])},[i.icon?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:i.icon,class:(0,t.normalizeClass)(o[i.size].icon)},null,8,[`icon`,`class`])):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(ne.value,(e,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:a},[e.type===`ellipsis`?((0,t.openBlock)(),(0,t.createBlock)(zE,{key:0,size:`sm`,align:`left`},{trigger:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`inline-flex cursor-pointer items-center rounded transition-colors hover:text-primary`,o[i.size].item]),"aria-label":`Show hidden breadcrumb items`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:ellipsis`,class:(0,t.normalizeClass)(o[i.size].icon)},null,8,[`class`])],2)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,GD,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(te.value,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:r},[e.to?((0,t.openBlock)(),(0,t.createElementBlock)(`a`,{key:0,href:e.to,class:`flex items-center gap-2 rounded px-md py-sm text-sm font-medium text-muted transition-colors hover:bg-current/10 hover:text-primary`},[e.icon?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:e.icon,class:`h-3.5 w-3.5`},null,8,[`icon`])):(0,t.createCommentVNode)(``,!0),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(e.label),1)],8,KD)):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,qD,[e.icon?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:e.icon,class:`h-3.5 w-3.5`},null,8,[`icon`])):(0,t.createCommentVNode)(``,!0),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(e.label),1)]))],64))),128))])]),_:1})):(0,t.renderSlot)(r.$slots,`item`,{key:1,item:e.item,index:e.index,isLast:e.index===i.items.length-1},()=>[e.item.children?.length?((0,t.openBlock)(),(0,t.createBlock)(zE,{key:0,size:`sm`,align:`left`},{trigger:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`inline-flex cursor-pointer items-center gap-1 rounded transition-colors hover:text-primary`,o[i.size].item])},[e.item.icon?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:e.item.icon,class:(0,t.normalizeClass)(o[i.size].icon)},null,8,[`icon`,`class`])):(0,t.createCommentVNode)(``,!0),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(e.item.label)+` `,1),(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:chevron-down`,class:(0,t.normalizeClass)(o[i.size].icon)},null,8,[`class`])],2)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,JD,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.item.children,e=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:e.label},[e.to?((0,t.openBlock)(),(0,t.createElementBlock)(`a`,{key:0,href:e.to,class:`flex items-center gap-2 rounded px-md py-sm text-sm font-medium text-muted transition-colors hover:bg-current/10 hover:text-primary`},(0,t.toDisplayString)(e.label),9,YD)):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,XD,(0,t.toDisplayString)(e.label),1))],64))),128))])]),_:2},1024)):e.item.to&&e.index<i.items.length-1?((0,t.openBlock)(),(0,t.createElementBlock)(`a`,{key:1,href:e.item.to,class:(0,t.normalizeClass)([`inline-flex items-center gap-1 rounded transition-colors hover:text-primary focus-visible:ring-2 focus-visible:ring-primary focus-visible:outline-none`,o[i.size].item])},[e.item.icon?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:e.item.icon,class:(0,t.normalizeClass)(o[i.size].icon)},null,8,[`icon`,`class`])):(0,t.createCommentVNode)(``,!0),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(e.item.label),1)],10,ZD)):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:2,class:(0,t.normalizeClass)([`inline-flex items-center gap-1`,d.value,o[i.size].item]),"aria-current":`page`},[e.item.icon?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:e.item.icon,class:(0,t.normalizeClass)(o[i.size].icon)},null,8,[`icon`,`class`])):(0,t.createCommentVNode)(``,!0),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(e.item.label),1)],2))]),a<ne.value.length-1?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:2,icon:i.separatorIcon,class:(0,t.normalizeClass)([o[i.size].icon,`opacity-50`])},null,8,[`icon`,`class`])):(0,t.createCommentVNode)(``,!0)],64))),128))],2),e.showRefresh||r.$slots.actions?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,ref_key:`trailingRef`,ref:g,class:`flex items-center gap-1`},[e.showRefresh?((0,t.openBlock)(),(0,t.createBlock)(c,{key:0,icon:`lucide:refresh-cw`,variant:`text`,severity:`secondary`,size:e.size,"aria-label":`Refresh`,onClick:s[0]||=e=>a(`refresh`)},null,8,[`size`])):(0,t.createCommentVNode)(``,!0),(0,t.renderSlot)(r.$slots,`actions`)],512)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`nav`,{"aria-hidden":`true`,class:(0,t.normalizeClass)([`pointer-events-none invisible absolute top-0 left-0 -z-10 items-center rounded-md border font-medium`,[`inline-flex`,o[i.size].nav]])},[i.icon?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,ref_key:`measureIconRef`,ref:v,class:`inline-flex items-center`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:i.icon,class:(0,t.normalizeClass)(o[i.size].icon)},null,8,[`icon`,`class`])],512)):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(i.items,(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:r},[(0,t.createElementVNode)(`span`,{ref_for:!0,ref:e=>S(e,r),class:(0,t.normalizeClass)([`inline-flex items-center gap-1`,o[i.size].item,r===i.items.length-1?d.value:f.value])},[e.icon?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:e.icon,class:(0,t.normalizeClass)(o[i.size].icon)},null,8,[`icon`,`class`])):(0,t.createCommentVNode)(``,!0),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(e.label)+` `,1),e.children?.length?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:1,icon:`lucide:chevron-down`,class:(0,t.normalizeClass)(o[i.size].icon)},null,8,[`class`])):(0,t.createCommentVNode)(``,!0)],2),r<i.items.length-1?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,ref_for:!0,ref:r===0?C:void 0,class:`inline-flex items-center opacity-50`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:i.separatorIcon,class:(0,t.normalizeClass)(o[i.size].icon)},null,8,[`icon`,`class`])],512)):(0,t.createCommentVNode)(``,!0)],64))),128)),(0,t.createElementVNode)(`span`,{ref_key:`measureEllipsisRef`,ref:y,class:(0,t.normalizeClass)([`inline-flex items-center`,o[i.size].item])},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:ellipsis`,class:(0,t.normalizeClass)(o[i.size].icon)},null,8,[`class`])],2)],2)],2))}}),tO={key:0,class:`rounded-t-xl border-b border-main bg-surface/50 px-5 py-3`},nO={key:1,class:`rounded-b-xl border-t border-main bg-surface/50 px-5 py-3`},rO=(0,t.defineComponent)({__name:`Card`,props:{variant:{default:`solid`},size:{default:`md`},padded:{type:Boolean,default:!0},overflow:{default:`hidden`}},setup(e){let n=e,r={solid:`bg-content border border-main shadow-sm`,outline:`bg-transparent border border-main shadow-none`,glass:`bg-content/80 backdrop-blur-xl border border-main/20 shadow-sm`},i={xs:`p-3`,sm:`p-4`,md:`p-6`,lg:`p-8`,xl:`p-10`},a={hidden:`overflow-hidden`,visible:`overflow-visible`},o=(0,t.computed)(()=>[`rounded-xl`,a[n.overflow],r[n.variant]]),s=(0,t.computed)(()=>n.padded?i[n.size]:``);return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)(o.value)},[e.$slots.header?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,tO,[(0,t.renderSlot)(e.$slots,`header`)])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)(s.value)},[(0,t.renderSlot)(e.$slots,`default`)],2),e.$slots.footer?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,nO,[(0,t.renderSlot)(e.$slots,`footer`)])):(0,t.createCommentVNode)(``,!0)],2))}}),iO=e=>e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase()),aO=e=>e&&typeof e==`object`&&!Array.isArray(e)&&(`message`in e||`messages`in e||`onNavigate`in e||`canNavigate`in e||`label`in e||`title`in e||`children`in e),oO=(e,t,n=[])=>{if(!e)return[];if(Array.isArray(e)&&e.every(e=>typeof e==`string`))return[{id:n.join(`-`)||`root`,label:n.length?iO(n[n.length-1]):`Errors`,messages:e,children:[],canNavigate:t}];let r=aO(e)?[e]:e;return Array.isArray(r)?r.flatMap((e,r)=>{if(aO(e)){let i=e.key||`${n.join(`-`)}-${r}`,a=e.messages||e.message||[],o=Array.isArray(a)?a:[a],s=e.label||e.title||iO(e.key||String(r));return[{id:i,label:s,messages:o,children:e.children?oO(e.children,t,[...n,s]):[],canNavigate:e.canNavigate??(!!e.onNavigate||t),onNavigate:e.onNavigate}]}return oO(e,t,[...n,String(r)])}):typeof e==`object`?Object.entries(e).flatMap(([e,r])=>{let i=iO(e),a=[...n,i];if(typeof r==`string`)return[{id:e,label:i,messages:[r],children:[],canNavigate:t}];if(Array.isArray(r)&&r.every(e=>typeof e==`string`))return[{id:e,label:i,messages:r,children:[],canNavigate:t}];if(aO(r)){let n=r.key||e,o=r.messages||r.message||[],s=Array.isArray(o)?o:[o];return[{id:n,label:r.label||r.title||i,messages:s,children:r.children?oO(r.children,t,a):[],canNavigate:r.canNavigate??(!!r.onNavigate||t),onNavigate:r.onNavigate}]}return[{id:e,label:i,messages:[],children:oO(r,t,a),canNavigate:t}]}):[]},sO=e=>e.messages.length+e.children.reduce((e,t)=>e+sO(t),0),cO=e=>e.canNavigate||e.children.some(cO),lO={class:`flex w-full min-w-0 flex-col`},uO={class:`flex h-7 w-full min-w-0 items-center gap-2`},dO=[`aria-expanded`,`aria-label`],fO={key:1,class:`w-4 shrink-0`},pO=[`aria-label`],mO={key:0,class:`relative ml-2 flex min-w-0 flex-col`},hO={class:`relative flex items-center gap-2 py-1 pl-6`},gO={class:`text-[12px] font-medium opacity-80`},_O={class:`min-w-0 flex-1 pr-1 font-medium break-words`},vO=`border-dashed border-current opacity-40`,yO=(0,t.defineComponent)({__name:`ToastErrorNode`,props:{node:{},toastVariant:{},onNavigate:{type:Function}},setup(e){let r=e,i=(0,t.ref)(!0),a=(0,t.computed)(()=>r.node.children.length>0||r.node.messages.length>0),o=(0,t.computed)(()=>sO(r.node)),s=(0,t.computed)(()=>cO(r.node)),c=(0,t.computed)(()=>r.node.messages.length+r.node.children.length),l=e=>e===c.value-1,u=(0,t.computed)(()=>r.toastVariant===`solid`),d=(0,t.computed)(()=>u.value?`secondary`:`danger`),f=(0,t.computed)(()=>u.value?`bg-current opacity-80`:`bg-danger dark:bg-danger-400`);return(r,u)=>{let p=(0,t.resolveComponent)(`ToastErrorNode`,!0);return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,lO,[(0,t.createElementVNode)(`div`,uO,[a.value?((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:0,type:`button`,class:`flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center opacity-80 transition-opacity hover:opacity-100`,"aria-expanded":i.value,"aria-label":`${i.value?`Collapse`:`Expand`} ${e.node.label}`,onClick:u[0]||=e=>i.value=!i.value},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:i.value?`lucide:chevron-down`:`lucide:chevron-right`,class:`h-4 w-4`},null,8,[`icon`])],8,dO)):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,fO)),(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`min-w-0 flex-1 truncate text-[13px] font-bold tracking-wide`,a.value?`cursor-pointer`:``]),onClick:u[1]||=e=>a.value?i.value=!i.value:void 0},(0,t.toDisplayString)(e.node.label),3),s.value?((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:2,type:`button`,class:`flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center opacity-60 transition-opacity hover:opacity-100`,"aria-label":`Go to ${e.node.label}`,onClick:u[2]||=t=>e.onNavigate(e.node)},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:external-link`,class:`h-4 w-4`})],8,pO)):(0,t.createCommentVNode)(``,!0)]),a.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,mO,[(0,t.createElementVNode)(`div`,hO,[i.value&&c.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`absolute top-0 bottom-0 left-0 border-l`,vO])})):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(Ae,{value:String(o.value),size:`xs`,variant:`soft`,severity:d.value},null,8,[`value`,`severity`]),(0,t.createElementVNode)(`span`,gO,` validation issue`+(0,t.toDisplayString)(o.value===1?``:`s`)+` found `,1)]),i.value?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.node.messages,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:`msg-${n}`,class:`relative flex min-w-0 items-start gap-2 py-1 pl-6 text-[13px] leading-relaxed`},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`absolute top-0 left-0 border-l`,[vO,l(n)?`h-3.5`:`bottom-0`]])},null,2),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`absolute top-3.5 left-0 w-4 border-t`,vO])}),(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`mt-1.5 h-2 w-2 shrink-0 rounded-full`,f.value])},null,2),(0,t.createElementVNode)(`span`,_O,(0,t.toDisplayString)(e),1)]))),128)),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.node.children,(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n.id,class:`relative min-w-0 pl-6`},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`absolute top-0 left-0 border-l`,[vO,l(e.node.messages.length+r)?`h-3.5`:`bottom-0`]])},null,2),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`absolute top-3.5 left-0 w-4 border-t`,vO])}),(0,t.createVNode)(p,{node:n,"toast-variant":e.toastVariant,"on-navigate":e.onNavigate},null,8,[`node`,`toast-variant`,`on-navigate`])]))),128))],64)):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0)])}}}),bO={class:`flex w-full items-start justify-between gap-2`},xO=[`innerHTML`],SO={key:1},CO=[`innerHTML`],wO={key:1},TO=[`innerHTML`],EO={key:1},DO={key:2,class:`mt-2 flex w-full flex-col gap-2`},OO={class:`text-[13px] font-semibold`},kO={key:0,class:`absolute bottom-[-1px] left-0 z-0 w-full opacity-70 transition-opacity group-hover:opacity-100 [&>div>div]:!rounded-b-none`},AO=`shadow-[0_20px_40px_-15px_rgba(0,0,0,0.12)] dark:shadow-[0_20px_40px_-15px_rgba(0,0,0,0.55)]`,jO=`shadow-[0_16px_32px_-12px_rgba(0,0,0,0.35)]`,MO=`text-muted hover:text-main hover:bg-main/10`,NO=(0,t.defineComponent)({__name:`ToastItem`,props:{toast:{},index:{},total:{},stacked:{type:Boolean}},emits:[`close`],setup(e,{emit:r}){let i=e,a=r,o=e=>{if(i.toast.variant===`solid`&&e.severity===i.toast.severity)return`secondary`;let t=e.severity||(i.toast.variant===`solid`?`secondary`:i.toast.severity);return!t||t===`surface`?`primary`:t},s=(0,t.ref)(0),l=(0,t.ref)(!1),u=0,d=e=>{i.toast.closable!==!1&&(i.stacked&&i.index!==0||(u=e.touches[0].clientX,l.value=!0,A()))},f=e=>{l.value&&(s.value=e.touches[0].clientX-u)},p=()=>{l.value&&(l.value=!1,Math.abs(s.value)>80?(s.value=s.value>0?window.innerWidth:-window.innerWidth,setTimeout(()=>a(`close`),250)):(s.value=0,k()))},m={xs:`w-[min(280px,calc(100vw-2rem))]`,sm:`w-[min(360px,calc(100vw-2rem))]`,md:`w-[min(460px,calc(100vw-2rem))]`,lg:`w-[min(580px,calc(100vw-2rem))]`,xl:`w-[min(720px,calc(100vw-2rem))]`},h={xs:`h-[160px]`,sm:`h-[240px]`,md:`h-[360px]`,lg:`h-[480px]`,xl:`h-[600px]`},g=(0,t.computed)(()=>m[i.toast.size||`sm`]),_=(0,t.computed)(()=>h[i.toast.size||`sm`]),v=(0,t.computed)(()=>{switch(i.toast.actionAlign){case`center`:return`justify-center`;case`end`:return`justify-end`;default:return`justify-start`}}),y=(0,t.computed)(()=>{let e={transition:l.value?`none`:`all 0.3s cubic-bezier(0.22, 1, 0.36, 1)`},t=``;if(s.value!==0&&(t+=`translateX(${s.value}px) `),i.stacked&&i.index>0){let n=i.toast.position||`bottom-right`,r=n.includes(`top`)?1:-1,a=i.index*12*r,o=Math.max(0,1-i.index*.05);e.position=`absolute`,e.top=`0`,n.includes(`left`)?e.left=`0`:n.includes(`right`)?e.right=`0`:(e.left=`50%`,t+=`translateX(-50%) `),t+=`translateY(${a}px) scale(${o}) `,e.zIndex=100-i.index,e.opacity=i.index>2?0:1-i.index*.2}else e.zIndex=100,e.position=`relative`;return t&&(e.transform=t.trim()),e}),b=(0,t.ref)(null);(0,t.watch)(y,e=>{(0,t.nextTick)(()=>{b.value&&(b.value.style.transform=e.transform||``,b.value.style.transition=e.transition)})});let x=(0,t.ref)(100),S=0,C=0,w=!1,T=null,E=(0,t.computed)(()=>i.toast.duration||0),D=(0,t.computed)(()=>E.value>0&&!i.toast.loading),O=e=>{if(w)return;S||=e-C;let t=e-S,n=Math.max(0,E.value-t);x.value=n/E.value*100,n>0?T=requestAnimationFrame(O):a(`close`)},k=()=>{D.value&&(w=!1,S=0,T=requestAnimationFrame(O))},A=()=>{D.value&&(w=!0,T&&cancelAnimationFrame(T),C=E.value-E.value*(x.value/100))};(0,t.onMounted)(()=>{D.value&&k()}),(0,t.onBeforeUnmount)(()=>{T&&cancelAnimationFrame(T)}),(0,t.watch)(()=>[i.toast.loading,i.toast.duration],()=>{!i.toast.loading&&i.toast.duration&&i.toast.duration>0&&k()});let j=(0,t.computed)(()=>!!i.toast.title?.trim()),M=(0,t.computed)(()=>!!i.toast.message?.trim()||!!i.toast.component||!!i.toast.errorList),N=(0,t.computed)(()=>!!i.toast.actions?.length),P=(0,t.computed)(()=>i.toast.component||i.toast.errorList?!1:j.value&&!M.value||!j.value&&M.value),F=(0,t.computed)(()=>oO(i.toast.errorList,!!i.toast.onNavigate)),ee=(0,t.computed)(()=>F.value.reduce((e,t)=>e+sO(t),0)),I=e=>{if(e.onNavigate){e.onNavigate();return}if(e.canNavigate){if(i.toast.onNavigate){i.toast.onNavigate({key:e.id,label:e.label,messages:e.messages});return}let t=document.getElementById(e.id)||document.querySelector(`[name="${e.id}"]`);if(t){t.scrollIntoView({behavior:`smooth`,block:`center`}),t.focus({preventScroll:!0});return}}let t=e.children.find(cO);t&&I(t)},te={primary:`lucide:bell-ring`,success:`lucide:check-circle-2`,warning:`lucide:alert-triangle`,danger:`lucide:octagon-alert`,info:`lucide:info`,secondary:`lucide:loader-2`,surface:`lucide:message-square`},ne={primary:`bg-primary/10 text-primary`,success:`bg-success/10 text-success`,warning:`bg-warning/10 text-warning`,danger:`bg-danger/10 text-danger`,info:`bg-info/10 text-info`,secondary:`bg-main/15 text-main`,surface:`bg-main/10 text-main`},re={surface:{box:`bg-content border-main ${AO}`,iconBox:ne,title:`text-main`,desc:`text-muted`,close:MO},soft:{box:{primary:`bg-content bg-gradient-to-br from-primary/15 via-primary/5 to-transparent border-primary/30 ${AO}`,success:`bg-content bg-gradient-to-br from-success/15 via-success/5 to-transparent border-success/30 ${AO}`,warning:`bg-content bg-gradient-to-br from-warning/15 via-warning/5 to-transparent border-warning/30 ${AO}`,danger:`bg-content bg-gradient-to-br from-danger/15 via-danger/5 to-transparent border-danger/30 ${AO}`,info:`bg-content bg-gradient-to-br from-info/15 via-info/5 to-transparent border-info/30 ${AO}`,secondary:`bg-content bg-gradient-to-br from-main/10 via-main/5 to-transparent border-main ${AO}`,surface:`bg-content bg-gradient-to-br from-main/10 via-main/5 to-transparent border-main ${AO}`},iconBox:{primary:`bg-primary/15 text-primary`,success:`bg-success/15 text-success`,warning:`bg-warning/15 text-warning`,danger:`bg-danger/15 text-danger`,info:`bg-info/15 text-info`,secondary:`bg-main/15 text-main`,surface:`bg-main/10 text-main`},title:`text-main`,desc:`text-muted`,close:MO},solid:{box:{primary:`bg-primary border-white/10 text-on-primary ${jO}`,success:`bg-success border-white/10 text-on-success ${jO}`,warning:`bg-warning border-white/10 text-on-warning ${jO}`,danger:`bg-danger border-white/10 text-on-danger ${jO}`,info:`bg-info border-white/10 text-on-info ${jO}`,secondary:`bg-surface border-main text-main ${AO}`,surface:`bg-content border-main text-main ${AO}`},iconBox:`bg-white/20 dark:bg-white/15 text-inherit`,title:`text-inherit`,desc:`text-inherit opacity-90`,close:`text-inherit opacity-70 hover:opacity-100 hover:bg-black/10 dark:hover:bg-white/10`},outline:{box:{primary:`bg-content border-primary ${AO}`,success:`bg-content border-success ${AO}`,warning:`bg-content border-warning ${AO}`,danger:`bg-content border-danger ${AO}`,info:`bg-content border-info ${AO}`,secondary:`bg-content border-main ${AO}`,surface:`bg-content border-main ${AO}`},iconBox:ne,title:{primary:`text-primary`,success:`text-success`,warning:`text-warning`,danger:`text-danger`,info:`text-info`,secondary:`text-main`,surface:`text-main`},desc:`text-muted`,close:MO}},L=(e,t)=>typeof e==`string`?e:e[t],R=(0,t.computed)(()=>{let e=i.toast.severity||`info`,t=i.toast.variant||`surface`,n=re[t],r=e===`surface`||e===`secondary`?`primary`:e,a=t===`solid`?`secondary`:e===`surface`?`primary`:e;return{box:L(n.box,e),iconBox:L(n.iconBox,e),title:L(n.title,e),desc:n.desc,close:n.close,icon:te[e],badgeSev:r,progressSev:a}}),z=e=>{e.onClick(),a(`close`)};return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{ref_key:`rootEl`,ref:b,class:(0,t.normalizeClass)([`group pointer-events-auto flex touch-pan-y flex-col ease-out will-change-transform`,g.value]),style:(0,t.normalizeStyle)(y.value),onMouseenter:A,onMouseleave:k,onTouchstart:d,onTouchmove:f,onTouchend:p},[e.stacked&&e.index===0&&e.total>1?((0,t.openBlock)(),(0,t.createBlock)(Ae,{key:0,value:`+${e.total-1}`,position:`top-right`,severity:R.value.badgeSev,variant:`solid`,size:`sm`,class:`z-50 animate-fade-in shadow-md`},null,8,[`value`,`severity`])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`relative flex w-full flex-col overflow-hidden rounded-xl border transition-all duration-300`,R.value.box])},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`relative z-10 flex gap-3 p-3 sm:p-4`,P.value&&!N.value?`items-center`:`items-start`])},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg transition-colors duration-200`,R.value.iconBox])},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:e.toast.icon||R.value.icon,class:(0,t.normalizeClass)([`h-4.5 w-4.5`,e.toast.loading?`animate-spin`:``])},null,8,[`icon`,`class`])],2),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex w-full min-w-0 flex-col`,P.value&&!N.value?``:`gap-1.5`])},[(0,t.createElementVNode)(`div`,bO,[j.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:(0,t.normalizeClass)([`pr-2 font-sans text-[14.5px] leading-tight font-bold tracking-tight break-words`,R.value.title])},[e.toast.html?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,innerHTML:e.toast.title},null,8,xO)):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,SO,(0,t.toDisplayString)(e.toast.title),1))],2)):M.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,class:(0,t.normalizeClass)([`pr-2 font-sans text-[14px] leading-tight font-semibold tracking-tight break-words`,R.value.title])},[e.toast.html?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,innerHTML:e.toast.message},null,8,CO)):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,wO,(0,t.toDisplayString)(e.toast.message),1))],2)):(0,t.createCommentVNode)(``,!0),e.toast.closable===!1?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:2,onClick:i[0]||=e=>r.$emit(`close`),class:(0,t.normalizeClass)([`-mr-1 flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center rounded-md transition-colors outline-none focus-visible:ring-2 focus-visible:ring-primary`,[R.value.close,P.value&&!N.value?``:`-mt-0.5`]])},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:x`,class:`h-3.5 w-3.5`})],2))]),j.value&&e.toast.message?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`text-[13px] leading-relaxed break-words`,R.value.desc])},[e.toast.html?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,innerHTML:e.toast.message},null,8,TO)):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,EO,(0,t.toDisplayString)(e.toast.message),1))],2)):(0,t.createCommentVNode)(``,!0),e.toast.component?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:(0,t.normalizeClass)([`mt-1 w-full`,R.value.desc])},[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.toast.component),(0,t.mergeProps)(e.toast.componentProps,{onClose:i[1]||=e=>r.$emit(`close`)}),null,16))],2)):(0,t.createCommentVNode)(``,!0),F.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,DO,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex items-center gap-2`,R.value.title])},[(0,t.createVNode)(Ae,{value:String(ee.value),size:`sm`,variant:`soft`,severity:e.toast.variant===`solid`?`secondary`:`danger`},null,8,[`value`,`severity`]),(0,t.createElementVNode)(`span`,OO,` validation issue`+(0,t.toDisplayString)(ee.value===1?``:`s`)+` found `,1)],2),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`custom-scrollbar flex flex-col gap-2 overflow-y-auto pr-1 pb-1`,_.value])},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(F.value,n=>((0,t.openBlock)(),(0,t.createBlock)(yO,{key:n.id,node:n,"toast-variant":e.toast.variant,"on-navigate":I},null,8,[`node`,`toast-variant`]))),128))],2)])):(0,t.createCommentVNode)(``,!0),N.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:3,class:(0,t.normalizeClass)([`mt-3 flex w-full flex-wrap items-center gap-2`,v.value])},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.toast.actions,n=>((0,t.openBlock)(),(0,t.createBlock)(c,{key:n.label,label:n.label,size:`xs`,severity:o(n),variant:n.variant||(e.toast.variant===`solid`?`text`:`outline`),class:`!rounded border-current !px-2.5 !py-1 !text-[12px] shadow-none`,onClick:e=>z(n)},null,8,[`label`,`severity`,`variant`,`onClick`]))),128))],2)):(0,t.createCommentVNode)(``,!0)],2)],2),D.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,kO,[(0,t.createVNode)(qt,{"model-value":x.value,max:100,size:`xs`,variant:R.value.progressSev,class:`!gap-0`},null,8,[`model-value`,`variant`])])):(0,t.createCommentVNode)(``,!0)],2)],38))}}),PO=(0,t.ref)([]),FO=(0,t.ref)(!0),IO=0,LO=8,RO=20,zO=!1,BO={primary:{duration:4e3},secondary:{duration:4e3},success:{duration:4e3},info:{duration:4e3},surface:{duration:4e3},warning:{duration:5e3},danger:{duration:6e3}},VO=()=>{if(zO||typeof document>`u`)return;let e=document.createElement(`div`);e.id=`midnight-owl-toast-root`,document.body.appendChild(e),(0,t.render)((0,t.h)(ZO,{stacked:!0}),e),zO=!0},HO=e=>{VO();let t=e.id||`toast-${Date.now()}-${IO++}`,n=e.severity??`surface`,r={id:t,severity:`surface`,variant:`surface`,size:`sm`,position:`top-center`,actionAlign:`start`,...BO[n],...e,duration:e.loading?0:e.duration??BO[n].duration??4e3,closable:e.closable??!0,overlay:e.overlay??!1};PO.value.push(r);let i=PO.value.filter(e=>e.position===r.position);if(i.length>LO){let e=i.find(e=>(e.duration??0)>0);if(e){let t=PO.value.findIndex(t=>t.id===e.id);t!==-1&&PO.value.splice(t,1)}}let a=i.filter(e=>(e.duration??0)===0);if(a.length>RO){let e=a[0].id,t=PO.value.findIndex(t=>t.id===e);t!==-1&&PO.value.splice(t,1)}return t},UO=(e,t)=>{let n=PO.value.findIndex(t=>t.id===e);n!==-1&&(PO.value[n]={...PO.value[n],...t})},WO=e=>{let t=PO.value.findIndex(t=>t.id===e);t!==-1&&PO.value.splice(t,1)},GO={toasts:PO,globalStacked:FO,add:HO,update:UO,remove:WO,clearAll:()=>PO.value=[],promise:async(e,t,n)=>{let r=HO({message:t.loading,loading:!0,severity:`secondary`,...n,closable:n?.closable??!1});try{let i=await e;return t.success?UO(r,{message:typeof t.success==`function`?t.success(i):t.success,severity:`success`,loading:!1,closable:!0,duration:n?.duration??BO.success.duration}):WO(r),i}catch(e){throw t.error?UO(r,{message:typeof t.error==`function`?t.error(e):t.error,severity:`danger`,loading:!1,closable:!0,duration:n?.duration??BO.danger.duration}):WO(r),e}},confirm:({buttons:e,...t})=>new Promise(n=>{HO({...t,severity:t.severity??`surface`,variant:t.variant??`surface`,icon:t.icon??`lucide:circle-help`,position:t.position??`center`,duration:0,overlay:t.overlay??!0,closable:!1,actions:e.map(e=>({variant:`solid`,...e,onClick:()=>n(e.value??e.label)}))})}),primary:(e,t)=>HO({message:e,severity:`primary`,...t}),success:(e,t)=>HO({message:e,severity:`success`,...t}),warning:(e,t)=>HO({message:e,severity:`warning`,...t}),danger:(e,t)=>HO({message:e,severity:`danger`,...t}),info:(e,t)=>HO({message:e,severity:`info`,...t}),surface:(e,t)=>HO({message:e,severity:`surface`,...t}),error:(e,t)=>HO({message:e,severity:`danger`,...t}),loading:(e,t)=>HO({message:e,severity:`secondary`,loading:!0,...t})},KO=()=>GO,qO={class:`midnight-owl-toast-layer`},JO={key:0,class:`pointer-events-auto fixed inset-0 z-[9998] bg-main/40 backdrop-blur-sm dark:bg-black/50`},YO={class:`pointer-events-none fixed inset-0 z-[9999] flex`},XO=`ease-[cubic-bezier(0.22,1,0.36,1)]`,ZO=(0,t.defineComponent)({__name:`ToastProvider`,setup(e){let{toasts:n,remove:r,globalStacked:i}=KO(),a={leaveActiveClass:`!transition-all !duration-200 !ease-out !absolute`,leaveFromClass:`opacity-100 scale-100`,leaveToClass:`opacity-0 scale-95`},o=e=>{if(e===`center`)return{enterActiveClass:`transition-all duration-300 ${XO}`,enterFromClass:`opacity-0 scale-95`,enterToClass:`opacity-100 scale-100`,...a,moveClass:`transition-all duration-300 ${XO}`};let t=e.includes(`right`),n=e.includes(`left`),r=e.includes(`top`),i=`opacity-0 scale-95 `;return t?i+=`translate-x-8`:n?i+=`-translate-x-8`:r?i+=`-translate-y-8`:i+=`translate-y-8`,{enterActiveClass:`transition-all duration-300 ${XO}`,enterFromClass:i,enterToClass:`opacity-100 scale-100 translate-x-0 translate-y-0`,...a,moveClass:`transition-all duration-300 ${XO}`}},s=[{key:`top-left`,wrapperClass:`absolute top-6 left-4 z-50 flex w-[calc(100vw-2rem)] flex-col items-start gap-4 sm:top-8 sm:left-8 sm:w-auto`},{key:`top-center`,wrapperClass:`absolute top-6 left-1/2 z-50 flex w-[calc(100vw-2rem)] -translate-x-1/2 flex-col items-center gap-4 sm:top-8 sm:w-auto`},{key:`top-right`,wrapperClass:`absolute top-6 right-4 z-50 flex w-[calc(100vw-2rem)] flex-col items-end gap-4 sm:top-8 sm:right-8 sm:w-auto`},{key:`center`,wrapperClass:`absolute top-1/2 left-1/2 z-50 flex w-[calc(100vw-2rem)] -translate-x-1/2 -translate-y-1/2 flex-col items-center gap-4 sm:w-auto`},{key:`bottom-left`,wrapperClass:`absolute bottom-6 left-4 z-50 flex w-[calc(100vw-2rem)] flex-col-reverse items-start gap-4 sm:bottom-8 sm:left-8 sm:w-auto`},{key:`bottom-center`,wrapperClass:`absolute bottom-6 left-1/2 z-50 flex w-[calc(100vw-2rem)] -translate-x-1/2 flex-col-reverse items-center gap-4 sm:bottom-8 sm:w-auto`},{key:`bottom-right`,wrapperClass:`absolute right-4 bottom-6 z-50 flex w-[calc(100vw-2rem)] flex-col-reverse items-end gap-4 sm:right-8 sm:bottom-8 sm:w-auto`}],c=Object.fromEntries(s.map(e=>[e.key,o(e.key)])),l=(0,t.computed)(()=>i.value?Object.fromEntries(Object.entries(c).map(([e,{moveClass:t,...n}])=>[e,n])):c),u=(0,t.computed)(()=>{let e=Object.fromEntries(s.map(e=>[e.key,[]]));for(let t of n.value){let n=t.position||`bottom-right`;(e[n]??=[]).push(t)}for(let t of Object.keys(e))e[t].reverse();return e}),d=(0,t.computed)(()=>n.value.some(e=>e.overlay));return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,qO,[(0,t.createVNode)(t.Transition,{"enter-active-class":`transition-opacity duration-300`,"enter-from-class":`opacity-0`,"leave-active-class":`transition-opacity duration-300`,"leave-to-class":`opacity-0`},{default:(0,t.withCtx)(()=>[d.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,JO)):(0,t.createCommentVNode)(``,!0)]),_:1}),(0,t.createElementVNode)(`div`,YO,[((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(s,e=>(0,t.createElementVNode)(`div`,{key:e.key,class:(0,t.normalizeClass)(e.wrapperClass)},[(0,t.createVNode)(t.TransitionGroup,(0,t.mergeProps)({ref_for:!0},l.value[e.key]),{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(u.value[e.key],(n,a)=>((0,t.openBlock)(),(0,t.createBlock)(NO,{key:n.id,toast:n,index:a,total:u.value[e.key].length,stacked:(0,t.unref)(i),onClose:e=>(0,t.unref)(r)(n.id)},null,8,[`toast`,`index`,`total`,`stacked`,`onClose`]))),128))]),_:2},1040)],2)),64))])]))}}),QO={key:0,class:`bg-background/50 pointer-events-auto absolute inset-0 z-[60] flex items-center justify-center backdrop-blur-[3px]`},$O={class:`flex animate-fade-in-up items-center gap-3 rounded-full border border-main bg-content px-6 py-3 font-semibold tracking-wide text-primary shadow-xl`},ek={class:`w-full table-auto border-separate border-spacing-0 text-left`,style:{"min-width":`100%`}},tk={class:`sticky top-0 z-40 bg-surface/95 text-xs text-muted uppercase shadow-[0_1px_0_var(--border-main)] backdrop-blur-md`},nk=[`rowspan`],rk=[`rowspan`],ik={class:`flex w-full items-center justify-center px-3`},ak=[`checked`,`indeterminate`],ok=[`rowspan`],sk=[`data-pinned-col-key`,`colspan`,`rowspan`,`draggable`,`onDragstart`,`onDragover`,`onDrop`,`onClick`],ck={key:0,class:`mr-1.5 h-5 w-5 shrink-0`,"aria-hidden":`true`},lk=[`rowspan`],uk={key:0,class:`bg-surface/40`},dk={class:`relative z-0 bg-content text-main`},fk=[`colspan`],pk={class:`flex flex-col items-center justify-center gap-3 opacity-60`},mk={class:`font-medium`},hk={class:`flex w-full items-center justify-center px-3`},gk={class:`flex w-full items-center justify-center px-3`},_k=[`checked`,`onChange`],vk={class:`flex w-full items-center justify-center px-3`},yk={key:0,class:`w-7`},bk={key:2,class:`border-b border-main/30 bg-surface/10`},xk=[`colspan`],Sk={class:`animate-fade-in-up overflow-hidden px-6 py-4 shadow-inner`},Ck={key:0,class:`sticky bottom-0 z-40 border-t border-main bg-surface/95 shadow-[0_-1px_0_var(--border-main)] backdrop-blur-md`},wk=[`colspan`],Tk={class:`relative z-10 w-full shrink-0 bg-content`},Ek=`[&>td]:bg-content [&>td]:before:content-[''] [&>td]:before:absolute [&>td]:before:inset-0 [&>td]:before:-z-10 [&>td]:before:pointer-events-none [&>td]:before:transition-colors [&>td]:before:duration-200 [&>td]:border-t [&>td]:border-t-transparent [&>td:first-child]:border-l-[3px] [&>td:first-child]:border-l-transparent`,Dk=(0,t.defineComponent)({__name:`Table`,props:(0,t.mergeModels)({columns:{default:()=>[]},rowKey:{default:`id`},sortKey:{default:``},sortDirection:{default:null},maxHeight:{default:`auto`},rowSelection:{type:Boolean,default:!1},reorderableColumns:{type:Boolean,default:!1},reorderableRows:{type:[Boolean,Function],default:!1},expandableRows:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},loadingMessage:{default:`Loading records...`},emptyMessage:{default:`No records found.`},emptyStateIcon:{default:`lucide:inbox`},treeNodeKey:{default:`children`},rowClass:{},stripedRows:{type:Boolean,default:!0},bordered:{type:Boolean,default:!1},seamless:{type:Boolean,default:!1},size:{default:`sm`},highlightOnHover:{type:Boolean,default:!0},rtlDirection:{type:Boolean,default:!1}},{records:{default:()=>[]},recordsModifiers:{}}),emits:(0,t.mergeModels)([`row-click`,`row-contextmenu`,`selection-change`,`sort-change`,`column-drop`,`row-drop`],[`update:records`]),setup(e,{emit:r}){let i=e,a=(0,t.useModel)(e,`records`),o=r,s=(0,t.useSlots)(),c=(0,t.ref)(new Set),l=(0,t.ref)(new Set),u=(0,t.ref)(new Set),d=(0,t.ref)(null),f=(0,t.ref)([...i.columns||[]]);(0,t.watch)(()=>i.columns,e=>{f.value=[...e||[]]},{deep:!0}),(0,t.computed)(()=>m.value.some(e=>e&&e.key&&!!s[`filter-${e.key}`]));let p=(0,t.computed)(()=>{let e=[],t=0,n=(e,r=1)=>{!e||!Array.isArray(e)||(t=Math.max(t,r),e.forEach(e=>{e&&e.children&&e.children.length>0&&n(e.children,r+1)}))};n(f.value);for(let n=0;n<t;n++)e.push([]);let r=e=>!e||e.hidden?0:!e.children||e.children.length===0?1:e.children.reduce((e,t)=>e+r(t),0),i=(n,a)=>{!n||!Array.isArray(n)||n.forEach(n=>{if(!n||n.hidden)return;let o=n.children&&n.children.length>0,s=o?r(n):1;if(s===0)return;let c=o?1:t-a;e[a].push({...n,colSpan:s,rowSpan:c,isGroup:o}),o&&i(n.children,a+1)})};return i(f.value,0),e}),m=(0,t.computed)(()=>{let e=[],t=n=>{!n||!Array.isArray(n)||n.forEach(n=>{!n||n.hidden||(n.children&&n.children.length>0?t(n.children):e.push(n))})};return t(f.value),e}),h=(0,t.computed)(()=>{let e=m.value.length;return i.rowSelection&&e++,i.expandableRows&&e++,i.reorderableRows&&e++,s.action&&e++,e}),g=new Map,_=(0,t.computed)(()=>{let e=[];g.clear();let t=(n,r)=>{if(!(!n||!Array.isArray(n)))for(let a=0;a<n.length;a++){let o=n[a];if(!o)continue;let s=o[i.rowKey];e.push(o),g.set(s,r),l.value.has(s)&&o[i.treeNodeKey]&&Array.isArray(o[i.treeNodeKey])&&t(o[i.treeNodeKey],r+1)}};return t(a.value||[],0),e}),v=e=>{let t=e[i.rowKey],n=new Set(c.value);n.has(t)?n.delete(t):n.add(t),c.value=n,o(`selection-change`,_.value.filter(e=>n.has(e[i.rowKey])))},y=()=>{if(b.value)c.value=new Set,o(`selection-change`,[]);else{let e=_.value.map(e=>e[i.rowKey]);c.value=new Set(e),o(`selection-change`,[..._.value])}},b=(0,t.computed)(()=>_.value.length>0&&c.value.size===_.value.length),x=(0,t.computed)(()=>c.value.size>0&&c.value.size<_.value.length),S=(e,t)=>{t&&t.stopPropagation();let n=e[i.rowKey],r=new Set(l.value);r.has(n)?r.delete(n):r.add(n),l.value=r},C=(e,t)=>{t&&t.stopPropagation();let n=e[i.rowKey],r=new Set(u.value);r.has(n)?r.delete(n):r.add(n),u.value=r},w=e=>{if(!e.sortable||e.isGroup)return;let t=e.key,n=`asc`;i.sortKey===t&&(n=i.sortDirection===`asc`?`desc`:i.sortDirection===`desc`?null:`asc`),o(`sort-change`,{key:n?t:``,direction:n})},T=(0,t.ref)(!1),E=(0,t.ref)(null),D=(0,t.ref)({position:`absolute`,top:`0px`,left:`0px`,width:`0px`,height:`0px`,pointerEvents:`none`,zIndex:`-1`}),O=async(e,n)=>{if(!s[`context-menu`])return;n.preventDefault(),T.value=!1,await(0,t.nextTick)();let r=d.value;if(r){let e=r.getBoundingClientRect(),t=n.clientX-e.left+r.scrollLeft,i=n.clientY-e.top+r.scrollTop;D.value.top=`${i}px`,D.value.left=`${t}px`}E.value=e,await(0,t.nextTick)(),T.value=!0,o(`row-contextmenu`,e,n)};(0,t.watch)(T,e=>{e||setTimeout(()=>E.value=null,200)});let k=(0,t.ref)(null),A=(0,t.ref)(null),j=(e,t)=>{i.reorderableColumns&&(k.value=e,t.dataTransfer&&(t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/column`,e)))},M=e=>{if(!i.reorderableColumns||!k.value||k.value===e){A.value=null,k.value=null;return}o(`column-drop`,k.value,e),k.value=null,A.value=null},N=(0,t.ref)(null),P=(0,t.ref)(null),F=e=>typeof i.reorderableRows==`function`?i.reorderableRows(e):i.reorderableRows,ee=(e,t)=>{F(e)&&(N.value=e[i.rowKey],t.dataTransfer&&(t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/row`,String(e[i.rowKey]))))},I=e=>{P.value=e[i.rowKey]},te=(e,t)=>{let n=t.dataTransfer?.getData(`text/row`),r=e[i.rowKey];n&&String(n)!==String(r)&&o(`row-drop`,isNaN(Number(n))?n:Number(n),r),N.value=null,P.value=null},ne=e=>{let t=e.dataTransfer?.getData(`text/row`);t&&o(`row-drop`,isNaN(Number(t))?t:Number(t),null)},re=()=>{N.value=null,P.value=null},L=e=>e?typeof e==`number`?`${e}px`:e:`150px`,R=(0,t.computed)(()=>({xs:32,sm:40,md:48,lg:48,xl:56})[i.size]),z=(0,t.computed)(()=>({xs:64,sm:80,md:96,lg:96,xl:112})[i.size]),ie=(0,t.ref)(null),ae=(0,t.ref)(null),oe=(0,t.ref)(null),se=(0,t.ref)(null),ce=(0,t.ref)(0),le=(0,t.ref)(0),ue=(0,t.ref)(0),de=(0,t.ref)(0),fe=null,me=e=>Array.isArray(e)?e[0]||null:e;(0,t.watch)([ie,ae,oe,se],()=>{if(typeof window>`u`||!window.ResizeObserver)return;fe&&fe.disconnect();let e=me(ie.value),t=me(ae.value),n=me(oe.value),r=me(se.value);fe=new ResizeObserver(i=>{for(let a of i){let i=a.target,o=i.getBoundingClientRect().width;i===e&&(ce.value=o),i===t&&(le.value=o),i===n&&(ue.value=o),i===r&&(de.value=o)}}),e&&fe.observe(e),t&&fe.observe(t),n&&fe.observe(n),r&&fe.observe(r)},{flush:`post`}),(0,t.onBeforeUnmount)(()=>{fe&&fe.disconnect(),_e&&_e.disconnect()});let he=new Map,ge=(0,t.ref)({}),_e=null,ve=()=>{_e||typeof window>`u`||!window.ResizeObserver||(_e=new ResizeObserver(e=>{for(let t of e){let e=t.target.dataset.pinnedColKey;e&&(ge.value[e]=t.target.getBoundingClientRect().width)}}))},ye=(e,t)=>{let n=he.get(e);if(n&&_e&&_e.unobserve(n),!t){he.delete(e);return}ve();let r=t;he.set(e,r),_e?.observe(r)},be=e=>{let t=ge.value[e.key];return t?`${t}px`:L(e.width)},xe=(0,t.computed)(()=>0),Se=(0,t.computed)(()=>i.expandableRows?ce.value||R.value:0),Ce=(0,t.computed)(()=>{let e=0;return i.expandableRows&&(e+=ce.value||R.value),i.rowSelection&&(e+=le.value||R.value),e}),we=(0,t.computed)(()=>{let e={},t=Ce.value;i.reorderableRows&&(t+=ue.value||R.value);let n=`${t}px`;return m.value.forEach(t=>{t&&t.pinned===`left`&&(e[t.key]=n.includes(`calc`)?n:`calc(${n})`,n=`calc(${n} + ${be(t)})`)}),e}),Te=(0,t.computed)(()=>{let e={},t=s.action?`${de.value||z.value}px`:`0px`;return[...m.value].reverse().forEach(n=>{n&&n.pinned===`right`&&(e[n.key]=t.includes(`calc`)?t:`calc(${t})`,t=`calc(${t} + ${be(n)})`)}),e}),Ee=e=>e===`center`?`text-center justify-center`:e===`right`?`text-right justify-end`:`text-left justify-start`,De=(0,t.computed)(()=>({xs:`px-2 py-1 text-[11px]`,sm:`px-2.5 py-1.5 text-xs`,md:`px-4 py-3 text-sm`,lg:`px-5 py-4 text-base`,xl:`px-6 py-5 text-lg`})[i.size]),Oe=(0,t.computed)(()=>({xs:`px-4 py-6`,sm:`px-4 py-8`,md:`px-4 py-12`,lg:`px-4 py-14`,xl:`px-4 py-16`})[i.size]),ke=new Map,Ae=(e,t)=>{if(!e)return``;let n=c.value.has(e[i.rowKey]),r=i.stripedRows&&t%2==0,a=P.value===e[i.rowKey],o=E.value&&E.value[i.rowKey]===e[i.rowKey],s=t>0?_.value[t-1]:null,l=s?c.value.has(s[i.rowKey]):!1,u=`${n}-${r}-${a}-${o}-${l}-${i.bordered}`,d=ke.get(u);if(!d){let e=[Ek];o?e.push(`[&>td]:before:bg-primary/20`):a?e.push(`[&>td]:before:bg-primary/30`):r?e.push(`[&>td]:before:bg-surface/40 group-hover:[&>td]:before:bg-surface/60`):e.push(`group-hover:[&>td]:before:bg-surface/30`),i.bordered?e.push(`[&>td]:border-b [&>td]:border-b-main/30 [&>td]:border-r [&>td]:border-r-main/30`):e.push(`[&>td]:border-b [&>td]:border-b-transparent [&>td:last-child]:border-r [&>td:last-child]:border-r-transparent`),n&&(e.push(`[&>td]:before:!bg-primary/10 group-hover:[&>td]:before:!bg-primary/20`),e.push(`[&>td]:!border-b-primary [&>td:first-child]:!border-l-primary [&>td:last-child]:!border-r [&>td:last-child]:!border-r-primary`),l||e.push(`[&>td]:!border-t-primary`)),d=e.join(` `),ke.set(u,d)}if(i.rowClass){let n=typeof i.rowClass==`function`?i.rowClass(e,t):i.rowClass;if(n)return`${d} ${n}`}return d};return(r,a)=>{let s=(0,t.resolveComponent)(`Button`);return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`relative flex transform-gpu flex-col overflow-hidden bg-content transition-all duration-300`,[i.seamless?``:`rounded-md border border-main shadow-sm [clip-path:inset(0_round_var(--radius-md))]`,i.maxHeight===`auto`?`h-full min-h-0 flex-1`:``,i.rtlDirection?`rtl`:`ltr`]]),style:(0,t.normalizeStyle)(i.maxHeight===`auto`?{}:{maxHeight:typeof i.maxHeight==`number`?`${i.maxHeight}px`:i.maxHeight})},[(0,t.renderSlot)(r.$slots,`toolbar`),(0,t.createVNode)(t.Transition,{"enter-active-class":`transition-opacity duration-300`,"enter-from-class":`opacity-0`,"leave-active-class":`transition-opacity duration-200`,"leave-to-class":`opacity-0`},{default:(0,t.withCtx)(()=>[e.loading?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,QO,[(0,t.createElementVNode)(`div`,$O,[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:loader-2`,class:`h-5 w-5 animate-spin`}),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(e.loadingMessage),1)])])):(0,t.createCommentVNode)(``,!0)]),_:1}),(0,t.createElementVNode)(`div`,{ref_key:`scrollContainerRef`,ref:d,class:`custom-scrollbar relative h-full min-h-0 w-full flex-1 overflow-auto`},[(0,t.createElementVNode)(`table`,ek,[(0,t.createElementVNode)(`thead`,tk,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(p.value,(o,s)=>((0,t.openBlock)(),(0,t.createElementBlock)(`tr`,{key:`header-row-${s}`},[e.expandableRows&&s===0?((0,t.openBlock)(),(0,t.createElementBlock)(`th`,{key:0,ref_for:!0,ref_key:`expandThRef`,ref:ie,rowspan:p.value.length,class:(0,t.normalizeClass)([`sticky left-0 z-50 transform-gpu border-b border-main/50 bg-surface/95 align-middle shadow-[1px_0_0_rgba(0,0,0,0.05)] backdrop-blur-md`,[i.bordered?`border-r border-main/30`:``,i.seamless?``:`overflow-hidden rounded-ss-md`]]),style:(0,t.normalizeStyle)({width:`1%`,whiteSpace:`nowrap`,padding:0,left:`${xe.value}px`})},[(0,t.renderSlot)(r.$slots,`header-expand`)],14,nk)):(0,t.createCommentVNode)(``,!0),e.rowSelection&&s===0?((0,t.openBlock)(),(0,t.createElementBlock)(`th`,{key:1,ref_for:!0,ref_key:`selectionThRef`,ref:ae,rowspan:p.value.length,class:(0,t.normalizeClass)([`sticky z-50 transform-gpu border-b border-main/50 bg-surface/95 align-middle shadow-[1px_0_0_rgba(0,0,0,0.05)] backdrop-blur-md`,[i.bordered?`border-r border-main/30`:``,!i.seamless&&!e.expandableRows?`overflow-hidden rounded-ss-md`:``]]),style:(0,t.normalizeStyle)({width:`1%`,whiteSpace:`nowrap`,padding:0,left:`${Se.value}px`})},[(0,t.renderSlot)(r.$slots,`header-selection`,{checked:b.value,indeterminate:x.value,toggle:y},()=>[(0,t.createElementVNode)(`div`,ik,[(0,t.createElementVNode)(`input`,{type:`checkbox`,class:`cursor-pointer rounded border-main text-primary focus:ring-primary/50`,checked:b.value,indeterminate:x.value,onChange:y},null,40,ak)])])],14,rk)):(0,t.createCommentVNode)(``,!0),e.reorderableRows&&s===0?((0,t.openBlock)(),(0,t.createElementBlock)(`th`,{key:2,ref_for:!0,ref_key:`dragThRef`,ref:oe,rowspan:p.value.length,class:(0,t.normalizeClass)([`sticky z-50 transform-gpu border-b border-main/50 bg-surface/95 align-middle shadow-[1px_0_0_rgba(0,0,0,0.05)] backdrop-blur-md`,[i.bordered?`border-r border-main/30`:``,!i.seamless&&!e.expandableRows&&!e.rowSelection?`overflow-hidden rounded-ss-md`:``]]),style:(0,t.normalizeStyle)({width:`1%`,whiteSpace:`nowrap`,padding:0,left:`${Ce.value}px`})},[(0,t.renderSlot)(r.$slots,`header-drag-handle`)],14,ok)):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(o,(c,l)=>((0,t.openBlock)(),(0,t.createElementBlock)(`th`,{key:c.key||c.header,ref_for:!0,ref:e=>{c.pinned&&!c.isGroup&&ye(c.key,e)},"data-pinned-col-key":c.pinned&&!c.isGroup?c.key:void 0,colspan:c.colSpan,rowspan:c.rowSpan,class:(0,t.normalizeClass)([`group border-b border-main/50 bg-surface/95 align-middle font-semibold tracking-wider backdrop-blur-md transition-all select-none`,[De.value,c.headerClass,c.isGroup?`text-center`:Ee(c.align),i.bordered?`border-r border-main/30 last:border-r-0`:``,c.width?`leading-snug break-words whitespace-normal`:`whitespace-nowrap`,c.sortable&&!c.isGroup?`cursor-pointer hover:bg-surface/60 hover:text-main`:``,i.reorderableColumns&&!c.isGroup?`cursor-grab hover:bg-surface/60 hover:text-main active:cursor-grabbing`:``,c.pinned===`left`?`sticky z-50 transform-gpu shadow-[1px_0_0_rgba(0,0,0,0.05)]`:``,c.pinned===`right`?`sticky z-50 transform-gpu shadow-[-1px_0_0_rgba(0,0,0,0.05)]`:``,k.value===c.key?`scale-[0.98] bg-surface opacity-30 shadow-inner`:``,A.value===c.key?`!bg-primary/20 ring-1 ring-primary ring-inset`:``,!i.seamless&&s===0&&l===0&&!e.expandableRows&&!e.rowSelection&&!e.reorderableRows?`overflow-hidden rounded-ss-md`:``,!i.seamless&&s===0&&l===o.length-1&&!r.$slots.action?`overflow-hidden rounded-se-md`:``]]),style:(0,t.normalizeStyle)({width:L(c.width),minWidth:L(c.width),maxWidth:L(c.width),left:c.pinned===`left`?we.value[c.key]:void 0,right:c.pinned===`right`?Te.value[c.key]:void 0}),draggable:e.reorderableColumns&&!c.isGroup,onDragstart:e=>c.isGroup?null:j(c.key,e),onDragover:(0,t.withModifiers)(e=>c.isGroup?null:A.value=c.key,[`prevent`]),onDragenter:a[0]||=(0,t.withModifiers)(()=>{},[`prevent`]),onDragleave:a[1]||=e=>A.value=null,onDrop:e=>c.isGroup?null:M(c.key),onClick:e=>c.sortable&&!c.isGroup?w(c):null},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex w-full items-center gap-2`,[c.isGroup?`justify-center text-center`:Ee(c.align)]])},[c.sortable&&!c.isGroup&&c.align===`center`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ck)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([c.width?`min-w-0 flex-1`:`truncate`,i.sortKey===c.key?`text-primary`:``])},[(0,t.renderSlot)(r.$slots,`header-${c.key}`,{column:c},()=>[(0,t.createTextVNode)((0,t.toDisplayString)(c.header),1)])],2),c.sortable&&!c.isGroup?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:(0,t.normalizeClass)([`ml-1.5 flex h-5 w-5 shrink-0 flex-col items-center justify-center -space-y-1.5 rounded opacity-40 transition-all group-hover:opacity-100`,i.sortKey===c.key?`!opacity-100`:``])},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:chevron-up`,class:(0,t.normalizeClass)([`h-3.5 w-3.5 transition-colors`,i.sortKey===c.key&&i.sortDirection===`asc`?`text-primary`:`text-main`])},null,8,[`class`]),(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:chevron-down`,class:(0,t.normalizeClass)([`h-3.5 w-3.5 transition-colors`,i.sortKey===c.key&&i.sortDirection===`desc`?`text-primary`:`text-main`])},null,8,[`class`])],2)):(0,t.createCommentVNode)(``,!0)],2)],46,sk))),128)),r.$slots.action&&s===0?((0,t.openBlock)(),(0,t.createElementBlock)(`th`,{key:3,ref_for:!0,ref_key:`actionThRef`,ref:se,rowspan:p.value.length,class:(0,t.normalizeClass)([`sticky right-0 z-50 transform-gpu border-b border-main/50 bg-surface/95 text-center align-middle shadow-[-1px_0_0_rgba(0,0,0,0.05)] backdrop-blur-md`,[i.bordered?`border-l border-main/30`:``,i.seamless?``:`overflow-hidden rounded-se-md`]]),style:(0,t.normalizeStyle)({width:`${z.value}px`,minWidth:`${z.value}px`,maxWidth:`${z.value}px`,padding:0})},[(0,t.renderSlot)(r.$slots,`header-action`,{},()=>[a[14]||=(0,t.createTextVNode)(`Actions`,-1)])],14,lk)):(0,t.createCommentVNode)(``,!0)]))),128)),r.$slots[`filter-${m.value[0]?.key}`]||Object.keys(r.$slots).some(e=>e.startsWith(`filter-`))?((0,t.openBlock)(),(0,t.createElementBlock)(`tr`,uk,[e.expandableRows?((0,t.openBlock)(),(0,t.createElementBlock)(`th`,{key:0,class:(0,t.normalizeClass)([`sticky left-0 z-40 transform-gpu border-b border-main/50 bg-surface/95 shadow-[1px_0_0_rgba(0,0,0,0.05)] backdrop-blur-md`,i.bordered?`border-r border-main/30`:``]),style:(0,t.normalizeStyle)({width:`1%`,whiteSpace:`nowrap`,padding:0,left:`${xe.value}px`})},null,6)):(0,t.createCommentVNode)(``,!0),e.rowSelection?((0,t.openBlock)(),(0,t.createElementBlock)(`th`,{key:1,class:(0,t.normalizeClass)([`sticky z-40 transform-gpu border-b border-main/50 bg-surface/95 shadow-[1px_0_0_rgba(0,0,0,0.05)] backdrop-blur-md`,i.bordered?`border-r border-main/30`:``]),style:(0,t.normalizeStyle)({width:`1%`,whiteSpace:`nowrap`,padding:0,left:`${Se.value}px`})},null,6)):(0,t.createCommentVNode)(``,!0),e.reorderableRows?((0,t.openBlock)(),(0,t.createElementBlock)(`th`,{key:2,class:(0,t.normalizeClass)([`sticky z-40 transform-gpu border-b border-main/50 bg-surface/95 shadow-[1px_0_0_rgba(0,0,0,0.05)] backdrop-blur-md`,i.bordered?`border-r border-main/30`:``]),style:(0,t.normalizeStyle)({width:`1%`,whiteSpace:`nowrap`,padding:0,left:`${Ce.value}px`})},null,6)):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(m.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`th`,{key:`filter-${e.key}`,class:(0,t.normalizeClass)([`border-b border-main/50 px-2 py-1.5 align-middle font-normal normal-case`,[i.bordered?`border-r border-main/30 last:border-r-0`:``,e.pinned===`left`?`sticky z-40 transform-gpu bg-surface/95 shadow-[1px_0_0_rgba(0,0,0,0.05)] backdrop-blur-md`:`bg-surface/80 backdrop-blur-md`,e.pinned===`right`?`sticky z-40 transform-gpu bg-surface/95 shadow-[-1px_0_0_rgba(0,0,0,0.05)] backdrop-blur-md`:``]]),style:(0,t.normalizeStyle)({left:e.pinned===`left`?we.value[e.key]:void 0,right:e.pinned===`right`?Te.value[e.key]:void 0})},[(0,t.renderSlot)(r.$slots,`filter-${e.key}`,{column:e})],6))),128)),r.$slots.action?((0,t.openBlock)(),(0,t.createElementBlock)(`th`,{key:3,class:(0,t.normalizeClass)([`sticky right-0 z-40 transform-gpu border-b border-main/50 bg-surface/95 shadow-[-1px_0_0_rgba(0,0,0,0.05)] backdrop-blur-md`,i.bordered?`border-l border-main/30`:``]),style:(0,t.normalizeStyle)({width:`${z.value}px`,minWidth:`${z.value}px`,maxWidth:`${z.value}px`,padding:0})},null,6)):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0)]),(0,t.createElementVNode)(`tbody`,dk,[(0,t.renderSlot)(r.$slots,`tbody-start`,{colspan:h.value}),_.value.length===0?((0,t.openBlock)(),(0,t.createElementBlock)(`tr`,{key:0,onDragover:a[2]||=(0,t.withModifiers)(()=>{},[`prevent`]),onDrop:a[3]||=e=>ne(e)},[(0,t.createElementVNode)(`td`,{colspan:h.value,class:(0,t.normalizeClass)([`text-center align-middle text-muted`,[Oe.value,i.bordered?`border-b border-dashed border-main/30`:``]])},[(0,t.renderSlot)(r.$slots,`empty`,{},()=>[(0,t.createElementVNode)(`div`,pk,[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:e.emptyStateIcon,class:`h-8 w-8`},null,8,[`icon`]),(0,t.createElementVNode)(`span`,mk,(0,t.toDisplayString)(e.emptyMessage),1)])])],10,fk)],32)):((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,{key:1},(0,t.renderList)(_.value,(d,f)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:d?d[i.rowKey]:f},[r.$slots.row&&d&&Array.isArray(d[i.treeNodeKey])?(0,t.withMemo)([f,l.value.has(d[i.rowKey]),i.bordered],()=>((0,t.openBlock)(),(0,t.createElementBlock)(`tr`,{key:0,class:(0,t.normalizeClass)([`group cursor-pointer transition-all hover:[&>td]:bg-surface/20`,[i.bordered?`[&>td]:border-b [&>td]:border-b-main/30`:`[&>td]:border-b [&>td]:border-b-transparent`]]),onClick:e=>S(d,e)},[(0,t.renderSlot)(r.$slots,`row`,{row:d,index:f,expanded:l.value.has(d[i.rowKey]),toggle:e=>S(d,e),colspan:h.value})],10,[`onClick`])),a,4):(0,t.withMemo)([f,c.value.has(d[i.rowKey]),f>0&&_.value[f-1]?c.value.has(_.value[f-1][i.rowKey]):!1,N.value===d[i.rowKey],P.value===d[i.rowKey],E.value&&E.value[i.rowKey]===d[i.rowKey],u.value.has(d[i.rowKey]),l.value.has(d[i.rowKey]),i.bordered,i.stripedRows,De.value,xe.value,Se.value,Ce.value],()=>((0,t.openBlock)(),(0,t.createElementBlock)(`tr`,{key:1,class:(0,t.normalizeClass)([`group`,[i.highlightOnHover&&!N.value?`cursor-pointer`:``,d&&N.value===d[i.rowKey]?`scale-[0.995] opacity-30 shadow-inner`:``,d&&E.value&&E.value[i.rowKey]===d[i.rowKey]?`relative z-20 shadow-md ring-1 ring-primary ring-inset`:``,Ae(d,f)]]),draggable:F(d),onDragstart:e=>ee(d,e),onDragover:(0,t.withModifiers)(e=>I(d),[`prevent`]),onDragenter:a[10]||=(0,t.withModifiers)(()=>{},[`prevent`]),onDragleave:a[11]||=e=>P.value=null,onDrop:e=>te(d,e),onDragend:re,onClick:e=>o(`row-click`,d,e),onContextmenu:e=>O(d,e)},[e.expandableRows?((0,t.openBlock)(),(0,t.createElementBlock)(`td`,{key:0,class:`sticky left-0 z-10 transform-gpu !bg-content align-middle shadow-[1px_0_0_rgba(0,0,0,0.05)]`,style:(0,t.normalizeStyle)({width:`1%`,whiteSpace:`nowrap`,padding:0,left:`${xe.value}px`}),onClick:a[5]||=(0,t.withModifiers)(()=>{},[`stop`])},[(0,t.renderSlot)(r.$slots,`cell-expand`,{row:d,expanded:u.value.has(d[i.rowKey]),toggle:e=>C(d,e)},()=>[(0,t.createElementVNode)(`div`,hk,[d?((0,t.openBlock)(),(0,t.createBlock)(s,{key:0,variant:`text`,severity:`secondary`,size:`xs`,icon:u.value.has(d[i.rowKey])?`lucide:chevron-down`:`lucide:chevron-right`,class:`mx-auto block !h-5 !w-5`,onClick:e=>C(d,e)},null,8,[`icon`,`onClick`])):(0,t.createCommentVNode)(``,!0)])])],4)):(0,t.createCommentVNode)(``,!0),e.rowSelection?((0,t.openBlock)(),(0,t.createElementBlock)(`td`,{key:1,class:`sticky z-10 transform-gpu !bg-content align-middle shadow-[1px_0_0_rgba(0,0,0,0.05)]`,style:(0,t.normalizeStyle)({width:`1%`,whiteSpace:`nowrap`,padding:0,left:`${Se.value}px`}),onClick:a[6]||=(0,t.withModifiers)(()=>{},[`stop`])},[(0,t.renderSlot)(r.$slots,`cell-selection`,{row:d,checked:c.value.has(d[i.rowKey]),toggle:()=>v(d)},()=>[(0,t.createElementVNode)(`div`,gk,[d?((0,t.openBlock)(),(0,t.createElementBlock)(`input`,{key:0,type:`checkbox`,class:`cursor-pointer rounded border-main text-primary focus:ring-primary/50`,checked:c.value.has(d[i.rowKey]),onChange:e=>v(d)},null,40,_k)):(0,t.createCommentVNode)(``,!0)])])],4)):(0,t.createCommentVNode)(``,!0),e.reorderableRows?((0,t.openBlock)(),(0,t.createElementBlock)(`td`,{key:2,class:`sticky z-10 transform-gpu !bg-content align-middle shadow-[1px_0_0_rgba(0,0,0,0.05)]`,style:(0,t.normalizeStyle)({width:`1%`,whiteSpace:`nowrap`,padding:0,left:`${Ce.value}px`}),onClick:a[7]||=(0,t.withModifiers)(()=>{},[`stop`])},[F(d)?(0,t.renderSlot)(r.$slots,`cell-drag-handle`,{key:0,row:d},()=>[(0,t.createElementVNode)(`div`,vk,[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:grip-vertical`,class:`h-4 w-4 cursor-grab text-muted/40 transition-colors hover:text-primary active:cursor-grabbing`})])]):(0,t.createCommentVNode)(``,!0)],4)):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(m.value,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`td`,{key:e.key||n,class:(0,t.normalizeClass)([`align-middle`,[De.value,typeof e.cellClass==`function`?e.cellClass(d):e.cellClass,Ee(e.align),e.pinned===`left`?`sticky z-10 transform-gpu shadow-[1px_0_0_rgba(0,0,0,0.05)]`:`relative z-0`,e.pinned===`right`?`sticky z-10 transform-gpu shadow-[-1px_0_0_rgba(0,0,0,0.05)]`:``,d&&P.value===d[i.rowKey]?`!bg-primary/20`:e.pinned?`!bg-content`:``]]),style:(0,t.normalizeStyle)({width:L(e.width),minWidth:L(e.width),maxWidth:L(e.width),left:e.pinned===`left`?we.value[e.key]:void 0,right:e.pinned===`right`?Te.value[e.key]:void 0})},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex w-full items-center gap-1.5`,[Ee(e.align)]]),onDragstart:a[8]||=(0,t.withModifiers)(()=>{},[`stop`])},[d&&n===0&&(((0,t.unref)(g).get(d[i.rowKey])||0)>0||d[i.treeNodeKey]&&d[i.treeNodeKey].length>0)?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`flex items-center`,style:(0,t.normalizeStyle)({paddingLeft:`${((0,t.unref)(g).get(d[i.rowKey])||0)*20}px`})},[(0,t.renderSlot)(r.$slots,`body-tree-toggle`,{row:d,expanded:l.value.has(d[i.rowKey]),toggle:e=>S(d,e)},()=>[d[i.treeNodeKey]&&d[i.treeNodeKey].length>0?((0,t.openBlock)(),(0,t.createBlock)(s,{key:0,variant:`text`,severity:`secondary`,size:`xs`,icon:l.value.has(d[i.rowKey])?`lucide:chevron-down`:`lucide:chevron-right`,class:`mr-2 !h-5 !w-5 shrink-0`,onClick:(0,t.withModifiers)(e=>S(d,e),[`stop`])},null,8,[`icon`,`onClick`])):(0,t.createCommentVNode)(``,!0)]),d[i.treeNodeKey]&&d[i.treeNodeKey].length>0?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,yk))],4)):(0,t.createCommentVNode)(``,!0),d?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:(0,t.normalizeClass)(e.width?`min-w-0 flex-1 break-words whitespace-normal`:`w-full truncate`)},[(0,t.renderSlot)(r.$slots,`cell-${e.key}`,{row:d,column:e,index:f},()=>[(0,t.createTextVNode)((0,t.toDisplayString)(d[e.key]),1)])],2)):(0,t.createCommentVNode)(``,!0)],34)],6))),128)),r.$slots.action?((0,t.openBlock)(),(0,t.createElementBlock)(`td`,{key:3,class:(0,t.normalizeClass)([`sticky right-0 z-10 transform-gpu text-center align-middle shadow-[-1px_0_0_rgba(0,0,0,0.05)]`,[d&&P.value===d[i.rowKey]?`!bg-primary/20`:`!bg-content`]]),style:(0,t.normalizeStyle)({width:`${z.value}px`,minWidth:`${z.value}px`,maxWidth:`${z.value}px`,padding:0}),onClick:a[9]||=(0,t.withModifiers)(()=>{},[`stop`])},[d?(0,t.renderSlot)(r.$slots,`action`,{key:0,row:d,index:f}):(0,t.createCommentVNode)(``,!0)],6)):(0,t.createCommentVNode)(``,!0)],42,[`draggable`,`onDragstart`,`onDragover`,`onDrop`,`onClick`,`onContextmenu`])),a,12),d&&e.expandableRows&&u.value.has(d[i.rowKey])?((0,t.openBlock)(),(0,t.createElementBlock)(`tr`,bk,[(0,t.createElementVNode)(`td`,{colspan:h.value,class:`p-0`},[(0,t.createElementVNode)(`div`,Sk,[(0,t.renderSlot)(r.$slots,`expanded-row`,{row:d,index:f})])],8,xk)])):(0,t.createCommentVNode)(``,!0)],64))),128)),(0,t.renderSlot)(r.$slots,`tbody-end`,{colspan:h.value})]),r.$slots.footer?((0,t.openBlock)(),(0,t.createElementBlock)(`tfoot`,Ck,[(0,t.createElementVNode)(`tr`,null,[(0,t.createElementVNode)(`td`,{colspan:h.value,class:`border-t border-main px-4 py-3 align-middle`},[(0,t.renderSlot)(r.$slots,`footer`)],8,wk)])])):(0,t.createCommentVNode)(``,!0)]),r.$slots[`context-menu`]?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,style:(0,t.normalizeStyle)(D.value)},[(0,t.createVNode)(pe,{modelValue:T.value,"onUpdate:modelValue":a[13]||=e=>T.value=e,placement:`bottom-start`,widthClass:`w-48`,offset:0},{trigger:(0,t.withCtx)(()=>[...a[15]||=[(0,t.createElementVNode)(`div`,{class:`h-px w-px`},null,-1)]]),default:(0,t.withCtx)(({close:e})=>[(0,t.renderSlot)(r.$slots,`context-menu`,{row:E.value,close:e})]),_:3},8,[`modelValue`])],4)):(0,t.createCommentVNode)(``,!0)],512),(0,t.createElementVNode)(`div`,Tk,[(0,t.renderSlot)(r.$slots,`pagination`)])],6)}}}),Ok={class:`font-semibold text-main`},kk={class:`font-semibold text-main`},Ak={class:`font-semibold text-main`},jk={key:0,class:`flex shrink-0 items-center gap-2`},Mk={key:1,class:`flex shrink-0 items-center gap-2`},Nk=8,Pk=32,Fk=24,Ik=16,Lk=(0,t.defineComponent)({__name:`Pagination`,props:{totalRecords:{},currentPage:{},rowsPerPage:{default:10},rowsPerPageOptions:{default:()=>[10,20,50,100]},showRowsPerPage:{type:Boolean,default:!0},showJumpToPage:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},size:{default:`lg`},variant:{default:`soft`},severity:{default:`primary`},rounded:{type:Boolean,default:!1}},emits:[`update:currentPage`,`update:rowsPerPage`,`page-change`],setup(e,{emit:r}){let i=e,a=r,o=(0,t.computed)(()=>Math.max(1,Math.ceil(i.totalRecords/i.rowsPerPage))),s=(0,t.computed)(()=>i.totalRecords===0?0:(i.currentPage-1)*i.rowsPerPage+1),l=(0,t.computed)(()=>Math.min(i.currentPage*i.rowsPerPage,i.totalRecords)),u=(e,t)=>Array.from({length:t-e+1},(t,n)=>e+n),d=(e,t)=>{let n=o.value,r=i.currentPage;if(n<=t*2+e*2+3)return u(1,n);let a=Math.max(Math.min(r-e,n-t-e*2-1),t+2),s=Math.min(Math.max(r+e,t+e*2+2),n-t-1);return[...u(1,t),a>t+2?null:t+1,...u(a,s),s<n-t-1?null:n-t,...u(n-t+1,n)]},f=()=>{let e=o.value,t=i.currentPage;if(e<=3)return u(1,e);let n=[1];return t>2&&n.push(t===3?2:null),t>1&&t<e&&n.push(t),t<e-1&&n.push(t===e-2?e-1:null),n.push(e),n},p=(0,t.computed)(()=>i.rowsPerPageOptions.map(e=>({label:`${e} / page`,value:e}))),m=e=>{i.disabled||e<1||e>o.value||e===i.currentPage||(a(`update:currentPage`,e),a(`page-change`,{page:e,rowsPerPage:i.rowsPerPage}))},h=e=>{if(i.disabled||!e||e===i.rowsPerPage)return;let t=(i.currentPage-1)*i.rowsPerPage,n=Math.floor(t/e)+1;a(`update:rowsPerPage`,e),a(`update:currentPage`,n),a(`page-change`,{page:n,rowsPerPage:e})},g=(0,t.ref)(null),_=()=>{if(i.disabled)return;let e=g.value;e!=null&&Number.isFinite(e)&&m(Math.min(Math.max(Math.trunc(e),1),o.value)),g.value=null},v=(0,t.computed)(()=>g.value!=null&&Number.isFinite(g.value)&&g.value>=1&&g.value<=o.value),y={xs:{text:`text-[11px]`,navBtn:`!h-7 !w-7 !p-0`,pageBtn:`!h-7 !min-w-7 !px-1 !py-0 !text-[11px]`,select:`w-[6.25rem]`,jump:`w-12`,jumpValidPad:`[&_input]:!pr-5`,checkIcon:`h-3 w-3 right-1.5`},sm:{text:`text-xs`,navBtn:`!h-8 !w-8 !p-0`,pageBtn:`!h-8 !min-w-8 !px-1.5 !py-0 !text-xs`,select:`w-[6.75rem]`,jump:`w-14`,jumpValidPad:`[&_input]:!pr-5`,checkIcon:`h-3 w-3 right-2`},md:{text:`text-sm`,navBtn:`!h-10 !w-10 !p-0`,pageBtn:`!h-10 !min-w-10 !px-2 !py-0 !text-sm`,select:`w-[7.5rem]`,jump:`w-16`,jumpValidPad:`[&_input]:!pr-6`,checkIcon:`h-3.5 w-3.5 right-2`},lg:{text:`text-sm`,navBtn:`!h-11 !w-11 !p-0`,pageBtn:`!h-11 !min-w-11 !px-2 !py-0 !text-sm`,select:`w-[8rem]`,jump:`w-[4.5rem]`,jumpValidPad:`[&_input]:!pr-6`,checkIcon:`h-3.5 w-3.5 right-2.5`},xl:{text:`text-base`,navBtn:`!h-13 !w-13 !p-0`,pageBtn:`!h-13 !min-w-13 !px-2.5 !py-0 !text-base`,select:`w-[9rem]`,jump:`w-20`,jumpValidPad:`[&_input]:!pr-7`,checkIcon:`h-4 w-4 right-3`}},b=(0,t.computed)(()=>y[i.size]),x=(0,t.computed)(()=>i.variant===`text`),C=(0,t.computed)(()=>x.value?[`border border-main bg-content p-1 shadow-xs`,i.rounded?`rounded-full`:`rounded-lg`]:``),w=(0,t.computed)(()=>i.variant===`outline`?`!border`:``),T=(0,t.computed)(()=>i.severity===`secondary`?`!border-secondary-600 !bg-secondary-600 !text-on-secondary hover:!brightness-110`:``),E=(0,t.computed)(()=>i.rounded?`[&>div>div>div]:!rounded-full`:``),D=(0,t.computed)(()=>v.value?[`[&>div>div>div]:!border-success [&>div>div>div]:!ring-success/20`,b.value.jumpValidPad]:``),O=(0,t.useSlots)(),k=(0,t.computed)(()=>i.showRowsPerPage||i.showJumpToPage||!!O.middle||!!O.end),A=(0,t.ref)(null),j=(0,t.ref)(null),M=(0,t.ref)(null),N=(0,t.ref)(0),P=(0,t.ref)(0),F=(0,t.ref)(0),ee=()=>{N.value=Math.round(A.value?.clientWidth??0),P.value=Math.round(j.value?.offsetWidth??0),F.value=Math.round(M.value?.offsetWidth??0)},I=null;(0,t.onMounted)(()=>{ee(),typeof window<`u`&&window.ResizeObserver&&A.value&&(I=new ResizeObserver(ee),I.observe(A.value))}),(0,t.onUpdated)(ee),(0,t.onBeforeUnmount)(()=>I?.disconnect());let te={xs:{btn:28,digit:6.5,padX:4},sm:{btn:32,digit:7,padX:6},md:{btn:40,digit:8,padX:8},lg:{btn:44,digit:8,padX:8},xl:{btn:52,digit:9.5,padX:10}},ne=(0,t.computed)(()=>{let e=te[i.size],t=String(o.value).length;return Math.max(e.btn,t*e.digit+e.padX*2)}),re=e=>{let t=te[i.size];return(x.value?10:0)+t.btn*2+e*ne.value+(e+1)*Nk},L=e=>{for(let t=7;t>=1;t--){let n=d(t,1);if(re(n.length)<=e)return n}return f()},R=(0,t.computed)(()=>{let e=N.value-Pk-Ik;if(N.value===0)return{stacked:!0,pages:f()};let t=e-P.value-Fk-(k.value?F.value+Fk:0);return re(f().length)<=t?{stacked:!1,pages:L(t)}:{stacked:!0,pages:L(e)}});return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{ref_key:`containerRef`,ref:A,class:(0,t.normalizeClass)([`w-full border-t border-main bg-surface/30 px-4 py-3`,b.value.text])},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex w-full flex-wrap items-center gap-x-6 gap-y-3`,R.value.stacked?`justify-center`:`justify-between`])},[(0,t.createElementVNode)(`nav`,{class:(0,t.normalizeClass)([`order-2 flex items-center justify-center`,R.value.stacked?`w-full`:`flex-1`]),"aria-label":`Pagination`},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex items-center gap-2`,C.value])},[(0,t.createVNode)(c,{icon:`lucide:chevron-left`,variant:e.variant,severity:`secondary`,size:e.size,rounded:e.rounded,disabled:e.disabled||e.currentPage<=1,"aria-label":`Previous page`,class:(0,t.normalizeClass)([`shrink-0`,[b.value.navBtn,w.value]]),onClick:i[0]||=t=>m(e.currentPage-1)},null,8,[`variant`,`size`,`rounded`,`disabled`,`class`]),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(R.value.pages,(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:r===null?`gap-${i}`:`page-${r}`},[r===null?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,class:(0,t.normalizeClass)([`flex shrink-0 items-center justify-center text-muted/60 select-none`,b.value.navBtn]),"aria-hidden":`true`},[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:ellipsis`,class:`h-4 w-4`})],2)):((0,t.openBlock)(),(0,t.createBlock)(c,{key:0,label:r.toString(),variant:r===e.currentPage?`solid`:e.variant,severity:r===e.currentPage?e.severity:`secondary`,size:e.size,rounded:e.rounded,disabled:e.disabled,"aria-label":`Page ${r}`,"aria-current":r===e.currentPage?`page`:void 0,class:(0,t.normalizeClass)([`shrink-0 !font-semibold`,[b.value.pageBtn,r===e.currentPage?T.value:w.value]]),onClick:e=>m(r)},null,8,[`label`,`variant`,`severity`,`size`,`rounded`,`disabled`,`aria-label`,`aria-current`,`class`,`onClick`]))],64))),128)),(0,t.createVNode)(c,{icon:`lucide:chevron-right`,variant:e.variant,severity:`secondary`,size:e.size,rounded:e.rounded,disabled:e.disabled||e.currentPage>=o.value,"aria-label":`Next page`,class:(0,t.normalizeClass)([`shrink-0`,[b.value.navBtn,w.value]]),onClick:i[1]||=t=>m(e.currentPage+1)},null,8,[`variant`,`size`,`rounded`,`disabled`,`class`])],2)],2),(0,t.createElementVNode)(`div`,{ref_key:`metaRef`,ref:j,class:`order-1 flex max-w-full min-w-0 items-center gap-3`},[(0,t.renderSlot)(r.$slots,`start`),(0,t.createElementVNode)(`p`,{class:(0,t.normalizeClass)([`min-w-0 truncate font-medium text-muted`,R.value.stacked?`text-center`:`text-left`])},[(0,t.renderSlot)(r.$slots,`meta`,{start:s.value,end:l.value,total:e.totalRecords},()=>[(0,t.createElementVNode)(`span`,Ok,(0,t.toDisplayString)(s.value),1),i[3]||=(0,t.createTextVNode)(` to `,-1),(0,t.createElementVNode)(`span`,kk,(0,t.toDisplayString)(l.value),1),i[4]||=(0,t.createTextVNode)(` of `,-1),(0,t.createElementVNode)(`span`,Ak,(0,t.toDisplayString)(e.totalRecords.toLocaleString()),1),i[5]||=(0,t.createTextVNode)(` records `,-1)])],2)],512),k.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,ref_key:`controlsRef`,ref:M,class:`order-3 flex flex-wrap items-center justify-center gap-x-4 gap-y-2`},[(0,t.renderSlot)(r.$slots,`middle`),e.showRowsPerPage?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,jk,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)(b.value.select)},[(0,t.createVNode)(ht,{"model-value":e.rowsPerPage,options:p.value,size:e.size,rounded:e.rounded,disabled:e.disabled,searchable:!1,"show-clear":!1,"can-deselect":!1,"selection-variant":`highlight`,"aria-label":`Rows per page`,onChange:h},null,8,[`model-value`,`options`,`size`,`rounded`,`disabled`])],2)])):(0,t.createCommentVNode)(``,!0),e.showJumpToPage?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Mk,[i[6]||=(0,t.createElementVNode)(`span`,{class:`font-medium whitespace-nowrap text-muted`},`Go to`,-1),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`relative`,[b.value.jump,E.value,D.value]])},[(0,t.createVNode)(S,{modelValue:g.value,"onUpdate:modelValue":i[2]||=e=>g.value=e,min:1,max:o.value,size:e.size,disabled:e.disabled,"show-buttons":!1,placeholder:e.currentPage.toString(),"aria-label":`Go to page`,onKeydown:(0,t.withKeys)(_,[`enter`]),onChange:_},null,8,[`modelValue`,`max`,`size`,`disabled`,`placeholder`]),v.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:check`,class:(0,t.normalizeClass)([`pointer-events-none absolute top-1/2 -translate-y-1/2 text-success`,b.value.checkIcon]),"aria-hidden":`true`},null,8,[`class`])):(0,t.createCommentVNode)(``,!0)],2)])):(0,t.createCommentVNode)(``,!0),(0,t.renderSlot)(r.$slots,`end`)],512)):(0,t.createCommentVNode)(``,!0)],2)],2))}}),Rk={key:0,class:`flex h-8 w-8 shrink-0 items-end`},zk={key:0,class:`px-1 text-[10px] font-black tracking-wider text-muted uppercase`},Bk={key:0,class:`pointer-events-none mb-1.5 flex flex-col gap-0.5 overflow-hidden rounded border-l-2 border-current bg-current/5 p-1.5 text-[0.8em] opacity-90 select-none`},Vk=[`innerHTML`],Hk={key:2,class:`break-words whitespace-pre-wrap select-text`},Uk={key:0,class:`hidden shrink-0 items-center gap-0.5 opacity-0 transition-opacity duration-200 group-hover/msg:opacity-100 focus-within:opacity-100 lg:flex`},Wk={key:0,class:`text-[10px] font-medium whitespace-nowrap text-muted/60 select-none`},Gk={key:1,class:`flex shrink-0 items-center justify-center`},Kk=(0,t.defineComponent)({__name:`BubbleChat`,props:{content:{},parseHtml:{type:Boolean,default:!0},autoLink:{type:Boolean,default:!0},blockLinks:{type:Boolean,default:!1},placement:{default:`start`},groupPosition:{default:`single`},variant:{default:`surface`},size:{default:`md`},time:{},sender:{},avatar:{},showAvatar:{type:Boolean,default:!0}},emits:[`click`,`dblclick`,`longpress`],setup(e,{emit:n}){let r=e,i=n,a=null,o=(0,t.ref)(!1),s=e=>{e instanceof MouseEvent&&e.button!==0||(o.value=!0,a=setTimeout(()=>{o.value=!1,i(`longpress`,e)},500))},c=()=>{a&&clearTimeout(a),o.value=!1};(0,t.onBeforeUnmount)(()=>c());let l=(0,t.computed)(()=>{if(!r.content)return``;let e=r.content;e=e.replace(/</g,`&lt;`).replace(/>/g,`&gt;`),r.parseHtml&&(e=e.replace(/&lt;(\/?(?:b|i|em|strong|br))&gt;/gi,`<$1>`));let t=/(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/g;if(r.blockLinks){let n=`
183
+ <span class="relative inline-flex items-center justify-center gap-1 font-black z-10 box-border min-w-4 h-4 px-1.5 text-[10px] leading-none rounded mx-0.5 align-middle cursor-not-allowed select-none border shadow-sm transition-colors ${r.variant===`primary`||r.variant===`secondary`?`bg-(--text-on-primary) text-danger border-(--text-on-primary)/50 hover:bg-(--text-on-primary)/90`:`bg-danger text-on-danger border-danger/50 hover:bg-danger/90`}" title="Link blocked for security">
184
+ <svg class="w-2.5 h-2.5 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"></path></svg>
185
+ Blocked
186
+ </span>`;e=e.replace(t,n)}else r.autoLink&&(e=e.replace(t,`<a href="$1" target="_blank" rel="noopener noreferrer" class="underline underline-offset-2 decoration-current/40 hover:decoration-current transition-colors">$1</a>`));return e}),u=(0,t.computed)(()=>{let e={xs:`px-2.5 py-1.5 text-[11px] leading-relaxed gap-0.5`,sm:`px-3 py-2 text-xs leading-relaxed gap-1`,md:`px-4 py-2.5 text-sm leading-snug gap-1.5`,lg:`px-5 py-3 text-base leading-snug gap-2`,xl:`px-6 py-3.5 text-lg leading-snug gap-2.5`},t={primary:`bg-primary text-on-primary border-primary/10 [&_a]:text-on-primary`,secondary:`bg-secondary text-on-secondary border-secondary/10 [&_a]:text-on-secondary`,surface:`bg-content text-main border-main/40 [&_a]:text-primary`,ghost:`bg-transparent text-main border-transparent shadow-none !p-0 [&_a]:text-primary`},n=``;if(r.placement===`start`){let e=`rounded-2xl`;n=r.groupPosition===`first`?`${e} rounded-bl-sm`:r.groupPosition===`middle`?`rounded-r-2xl rounded-l-sm`:r.groupPosition===`last`?`${e} rounded-tl-sm`:`${e} rounded-bl-sm`}else{let e=`rounded-2xl`;n=r.groupPosition===`first`?`${e} rounded-br-sm`:r.groupPosition===`middle`?`rounded-l-2xl rounded-r-sm`:r.groupPosition===`last`?`${e} rounded-tr-sm`:`${e} rounded-br-sm`}let i=o.value?`scale-[0.98] brightness-95`:`cursor-text`;return[`relative flex flex-col w-fit max-w-full break-words whitespace-pre-wrap transition-all duration-200 shadow-sm border [&_b]:font-bold [&_strong]:font-bold [&_i]:italic [&_em]:italic shrink min-w-0`,e[r.size],t[r.variant],n,i]});return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`group/msg mb-0.5 flex w-fit max-w-full items-end gap-2`,e.placement===`end`?`ml-auto flex-row-reverse`:`mr-auto flex-row`])},[e.showAvatar?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Rk,[e.groupPosition===`last`||e.groupPosition===`single`?(0,t.renderSlot)(n.$slots,`avatar`,{key:0},()=>[(0,t.createVNode)(zt,{src:e.avatar,shape:`circle`,width:`32`,height:`32`,fit:`cover`,class:`border border-main/20 shadow-sm`},null,8,[`src`])]):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex max-w-full min-w-0 flex-col gap-1`,e.placement===`end`?`items-end`:`items-start`])},[e.sender&&(e.groupPosition===`first`||e.groupPosition===`single`)?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,zk,(0,t.toDisplayString)(e.sender),1)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flex max-w-full items-center gap-1.5`,e.placement===`end`?`flex-row-reverse`:`flex-row`])},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)(u.value),style:{"-webkit-touch-callout":`none`},onMousedown:s,onMouseup:c,onMouseleave:c,onTouchstartPassive:s,onTouchendPassive:c,onTouchcancelPassive:c,onClick:r[0]||=e=>n.$emit(`click`,e),onDblclick:r[1]||=e=>n.$emit(`dblclick`,e)},[n.$slots.reply?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Bk,[(0,t.renderSlot)(n.$slots,`reply`)])):(0,t.createCommentVNode)(``,!0),e.content?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:`break-words whitespace-pre-wrap select-text`,innerHTML:l.value},null,8,Vk)):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Hk,[(0,t.renderSlot)(n.$slots,`default`)]))],34),n.$slots.actions?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Uk,[(0,t.renderSlot)(n.$slots,`actions`)])):(0,t.createCommentVNode)(``,!0)],2),e.time||n.$slots.status?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:(0,t.normalizeClass)([`mt-0.5 flex items-center gap-1.5 px-1`,e.placement===`end`?`flex-row-reverse`:`flex-row`])},[e.time?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Wk,(0,t.toDisplayString)(e.time),1)):(0,t.createCommentVNode)(``,!0),n.$slots.status?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Gk,[(0,t.renderSlot)(n.$slots,`status`)])):(0,t.createCommentVNode)(``,!0)],2)):(0,t.createCommentVNode)(``,!0)],2)],2))}}),qk=(0,t.defineComponent)({name:`SkeletonLoader`,inheritAttrs:!1,__name:`SkeletonLoader`,props:{shape:{default:`text`},width:{},height:{},animation:{default:`pulse`},count:{default:1}},setup(e){let n=e,r=e=>{if(e!=null)return typeof e==`number`||!isNaN(Number(e))?`${e}px`:e},i={text:`rounded-full`,circle:`rounded-full aspect-square`,rectangle:`rounded-none`,rounded:`rounded-xl`},a={pulse:`animate-pulse`,wave:`animate-shimmer bg-gradient-to-r from-transparent via-white/35 to-transparent bg-[length:200%_100%]`,none:``},o=(0,t.computed)(()=>i[n.shape]),s=(0,t.computed)(()=>a[n.animation]),c=(0,t.computed)(()=>n.height?r(n.height):n.shape===`circle`?r(n.width)??`2.5rem`:n.shape===`text`?`1em`:`6rem`),l=e=>n.shape===`circle`?c.value:n.width?r(n.width):n.shape===`text`&&n.count>1&&e===n.count-1?`60%`:`100%`;return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,(0,t.mergeProps)({class:`flex flex-col gap-2`,role:`status`,"aria-live":`polite`,"aria-busy":`true`},n.$attrs),[r[0]||=(0,t.createElementVNode)(`span`,{class:`sr-only`},`Loading…`,-1),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.count,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e,class:(0,t.normalizeClass)([`block shrink-0 bg-surface`,[o.value,s.value]]),style:(0,t.normalizeStyle)({width:l(e-1),height:c.value}),"aria-hidden":`true`},null,6))),128))],16))}}),Jk=[`title`],Yk={key:1,class:`shrink-0 font-semibold tabular-nums opacity-80`},Xk={class:`truncate font-medium`},Zk=[`title`],Qk={key:0,class:`flex items-baseline gap-1 overflow-hidden leading-none`},$k={class:`truncate font-semibold`},eA={key:1,class:`shrink-0 text-[10px] opacity-90`},tA={class:`flex items-center gap-1 truncate leading-tight font-semibold`},nA={class:`truncate`},rA={key:0,class:`truncate leading-tight opacity-90`},iA={key:1,class:`flex items-center gap-0.5 truncate opacity-80`},aA=[`title`],oA={key:1,class:`shrink-0 font-semibold tabular-nums opacity-90`},sA={class:`truncate`},cA={key:3,class:`group flex cursor-pointer items-center gap-3 rounded-lg border border-main/60 bg-content p-3 transition-colors hover:border-main hover:bg-surface/40`},lA={class:`flex min-w-0 flex-1 flex-col`},uA={class:`flex items-center gap-1 truncate text-sm font-semibold text-main`},dA={class:`truncate`},fA={key:0,class:`truncate text-xs text-muted`},pA={key:1,class:`flex items-center gap-1 text-xs text-muted`},mA={class:`shrink-0 text-right text-xs font-medium text-muted tabular-nums`},hA=(0,t.defineComponent)({__name:`CalendarEventPill`,props:{event:{},display:{default:`dot`},timeLabel:{default:``},size:{default:`sm`},compact:{type:Boolean,default:!1},continuesBefore:{type:Boolean,default:!1},continuesAfter:{type:Boolean,default:!1},forceShowTimeLabel:{type:Boolean,default:!1}},setup(e){let r=e,i={primary:`bg-primary`,secondary:`bg-muted`,success:`bg-success`,warning:`bg-warning`,danger:`bg-danger`,info:`bg-info`},a={primary:`bg-primary/10 text-primary hover:bg-primary/20`,secondary:`bg-muted/15 text-main hover:bg-muted/25`,success:`bg-success/10 text-success hover:bg-success/20`,warning:`bg-warning/10 text-warning hover:bg-warning/20`,danger:`bg-danger/10 text-danger hover:bg-danger/20`,info:`bg-info/10 text-info hover:bg-info/20`},o={primary:`bg-primary text-on-primary`,secondary:`bg-muted text-main`,success:`bg-success text-on-success`,warning:`bg-warning text-on-warning`,danger:`bg-danger text-on-danger`,info:`bg-info text-on-info`},s={xs:`text-[10px]`,sm:`text-[11px]`,md:`text-xs`,lg:`text-sm`,xl:`text-sm`},c=(0,t.computed)(()=>r.event.severity??`primary`),l=e=>r.event.isOccurrence?`${e} · Part of a recurring series`:e;return(r,u)=>e.display===`dot`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`flex w-full cursor-pointer items-center gap-1.5 rounded px-1.5 py-0.5 transition-colors`,[a[c.value],s[e.size]]]),title:l(e.event.title)},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`h-1.5 w-1.5 shrink-0 rounded-full`,i[c.value]])},null,2),e.event.isOccurrence?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:repeat`,"aria-hidden":`true`,class:`h-2.5 w-2.5 shrink-0 opacity-70`})):(0,t.createCommentVNode)(``,!0),e.timeLabel&&!e.event.allDay?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Yk,(0,t.toDisplayString)(e.timeLabel),1)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,Xk,(0,t.toDisplayString)(e.event.title),1)],10,Jk)):e.display===`block`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:(0,t.normalizeClass)([`flex h-full w-full cursor-pointer flex-col overflow-hidden rounded-md px-1.5 shadow-sm ring-1 ring-black/5 transition-transform hover:z-10 hover:brightness-105`,[o[c.value],s[e.size],e.compact?`justify-center py-0`:`py-1`]]),title:l(e.timeLabel?`${e.event.title} · ${e.timeLabel}`:e.event.title)},[e.compact?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Qk,[e.event.isOccurrence?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:repeat`,"aria-hidden":`true`,class:`h-2.5 w-2.5 shrink-0 opacity-80`})):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,$k,(0,t.toDisplayString)(e.event.title),1),e.timeLabel?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,eA,(0,t.toDisplayString)(e.timeLabel),1)):(0,t.createCommentVNode)(``,!0)])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createElementVNode)(`span`,tA,[e.event.isOccurrence?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:repeat`,"aria-hidden":`true`,class:`h-2.5 w-2.5 shrink-0 opacity-80`})):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,nA,(0,t.toDisplayString)(e.event.title),1)]),e.timeLabel?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,rA,(0,t.toDisplayString)(e.timeLabel),1)):(0,t.createCommentVNode)(``,!0),e.event.location?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,iA,[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:map-pin`,class:`h-2.5 w-2.5 shrink-0`}),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(e.event.location),1)])):(0,t.createCommentVNode)(``,!0)],64))],10,Zk)):e.display===`bar`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:2,class:(0,t.normalizeClass)([`flex h-full w-full items-center gap-1 overflow-hidden px-1.5 font-medium transition-colors`,[o[c.value],s[e.size],e.continuesBefore?`rounded-l-none`:`rounded-l`,e.continuesAfter?`rounded-r-none`:`rounded-r`]]),title:l(e.timeLabel&&(!e.event.allDay||e.forceShowTimeLabel)?`${e.event.title} · ${e.timeLabel}`:e.event.title)},[e.continuesBefore?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:chevron-left`,class:`h-3 w-3 shrink-0 opacity-80`})):(0,t.createCommentVNode)(``,!0),e.timeLabel&&(!e.event.allDay||e.forceShowTimeLabel)&&!e.continuesBefore?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,oA,(0,t.toDisplayString)(e.timeLabel),1)):(0,t.createCommentVNode)(``,!0),e.event.isOccurrence?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:2,icon:`lucide:repeat`,"aria-hidden":`true`,class:`h-2.5 w-2.5 shrink-0 opacity-80`})):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,sA,(0,t.toDisplayString)(e.event.title),1),e.continuesAfter?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:3,icon:`lucide:chevron-right`,class:`ml-auto h-3 w-3 shrink-0 opacity-80`})):(0,t.createCommentVNode)(``,!0)],10,aA)):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,cA,[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`h-full min-h-[2.5rem] w-1 shrink-0 rounded-full`,i[c.value]])},null,2),(0,t.createElementVNode)(`div`,lA,[(0,t.createElementVNode)(`span`,uA,[e.event.isOccurrence?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:0,icon:`lucide:repeat`,"aria-hidden":`true`,class:`h-3 w-3 shrink-0 opacity-70`})):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,dA,(0,t.toDisplayString)(e.event.title),1)]),e.event.description?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,fA,(0,t.toDisplayString)(e.event.description),1)):(0,t.createCommentVNode)(``,!0),e.event.location?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,pA,[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:map-pin`,class:`h-3 w-3 shrink-0`}),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(e.event.location),1)])):(0,t.createCommentVNode)(``,!0)]),(0,t.createElementVNode)(`span`,mA,(0,t.toDisplayString)(e.event.allDay?`All day`:e.timeLabel),1)]))}}),gA={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6},_A=new Map,vA=e=>{let t=_A.get(e);return t||(t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,hour12:!1,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,weekday:`short`}),_A.set(e,t)),t};function yA(e,t){if(!t)return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),weekday:e.getDay()};let n=vA(t).formatToParts(e),r=e=>n.find(t=>t.type===e)?.value??`0`,i=Number(r(`hour`))%24;return{year:Number(r(`year`)),month:Number(r(`month`)),day:Number(r(`day`)),hour:i,minute:Number(r(`minute`)),weekday:gA[r(`weekday`)]??e.getDay()}}function bA(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function xA(e,t){let n=yA(e,t);return n.hour*60+n.minute}function SA(e,t){let n=t.dayStartHour*60,r=t.dayEndHour*60,i=Math.max(1,r-n),a=t.minHeightPct??1.5,o=e.map(e=>{let i=Math.max(n,xA(e.start,t.timeZone)),a=xA(e.end,t.timeZone),o=Math.min(r,a<=i?i+30:a);return{event:e,start:i,end:Math.max(o,i+1)}}).sort((e,t)=>e.start-t.start||t.end-e.end),s=[],c=[],l=-1/0,u=()=>{if(!c.length)return;let e=[],t=new Map;for(let n of c){let r=e.findIndex(e=>e<=n.start);r===-1?(r=e.length,e.push(n.end)):e[r]=n.end,t.set(n,r)}let r=e.length;for(let e of c)s.push({event:e.event,top:(e.start-n)/i*100,height:Math.max(a,(e.end-e.start)/i*100),lane:t.get(e)??0,lanes:r});c=[],l=-1/0};for(let e of o)e.start>=l&&c.length&&u(),c.push(e),l=Math.max(l,e.end);return u(),s}function CA(e,t){if(!e.length||!t.length)return{segments:[],laneCount:0};let n=(0,a.startOfDay)(e[0]),r=e.length-1,i=(e,t,n)=>Math.max(t,Math.min(n,e)),o=t.map(e=>{let t=(0,a.differenceInCalendarDays)((0,a.startOfDay)(e.start),n),o=(0,a.differenceInCalendarDays)((0,a.startOfDay)(e.end),n);return{event:e,startCol:i(t,0,r),endCol:i(o,0,r),continuesBefore:t<0,continuesAfter:o>r}}).sort((e,t)=>t.endCol-t.startCol-(e.endCol-e.startCol)||e.startCol-t.startCol),s=[];return{segments:o.map(e=>{let t=s.findIndex(t=>t<e.startCol);return t===-1?(t=s.length,s.push(e.endCol)):s[t]=e.endCol,{...e,lane:t}}),laneCount:s.length}}var wA={class:`flex min-w-[36rem] flex-col overflow-hidden rounded-lg border border-main bg-content`},TA={class:`grid grid-cols-7 border-b border-main bg-surface/40`},EA=[`data-cell-date`,`onPointerdown`],DA={class:`flex h-6 items-center justify-between`},OA={class:`flex min-h-0 flex-col gap-0.5`},kA=[`onPointerdown`,`onKeydown`],AA={class:`flex max-h-64 flex-col gap-1 overflow-y-auto p-1.5`},jA={class:`px-1 pb-1 text-[10px] font-bold tracking-wider text-muted uppercase`},MA=[`onClick`],NA={key:0,class:`pointer-events-none absolute inset-0`},PA=[`onPointerdown`,`onKeydown`],FA=[`onPointerdown`],IA=[`onPointerdown`],LA=2,RA=3,zA=2,BA=4,VA=(0,t.defineComponent)({__name:`CalendarMonthView`,props:{cal:{},size:{default:`md`},editable:{type:Boolean,default:!0},maxPerCell:{default:3}},emits:[`event-click`,`date-click`,`event-drag`,`event-resize`,`range-select`],setup(e,{emit:n}){let r=e,i=n,o={xs:`min-h-[64px]`,sm:`min-h-[80px]`,md:`min-h-[104px]`,lg:`min-h-[128px]`,xl:`min-h-[152px]`},s={xs:`text-[11px]`,sm:`text-xs`,md:`text-sm`,lg:`text-sm`,xl:`text-base`},c={xs:14,sm:15,md:18,lg:20,xl:22},l=(0,t.computed)(()=>r.cal.weekdayNames.value),u=(0,t.computed)(()=>r.cal.monthWeeks.value),d=(0,t.computed)(()=>c[r.size]),f=(0,t.computed)(()=>33),p=e=>r.editable&&e.editable&&!e.isOccurrence,m=e=>{let t=new Set,n=[];for(let r of e.days)for(let e of r.events)(e.allDay||e.isMultiDay)&&!t.has(e.key)&&(t.add(e.key),n.push(e));return n},h=(0,t.computed)(()=>u.value.map(e=>{let{segments:t,laneCount:n}=CA(e.days.map(e=>e.date),m(e));return{week:e,segments:t,laneCount:n,shownLanes:Math.min(n,r.maxPerCell)}})),g=e=>e.shownLanes>0?RA+e.shownLanes*(d.value+LA):0,_=e=>Math.max(0,r.maxPerCell-e.shownLanes),v=e=>r.cal.getTimedEventsForDay(e.date),y=(e,t)=>v(t).slice(0,_(e)),b=(e,t,n)=>e.segments.filter(t=>t.lane>=e.shownLanes&&t.startCol<=n&&t.endCol>=n).length+Math.max(0,v(t).length-_(e)),x=(e,t,n)=>{let r=e.segments.filter(t=>t.lane>=e.shownLanes&&t.startCol<=n&&t.endCol>=n).map(e=>e.event),i=v(t).slice(_(e));return[...r,...i]},S=(e,t,n)=>{i(`event-click`,e,t),n()},C=e=>e.segments.filter(t=>t.lane<e.shownLanes),w=e=>{let t=e.continuesBefore?0:zA,n=e.continuesAfter?0:zA;return{left:`calc(${e.startCol/7*100}% + ${t}px)`,width:`calc(${(e.endCol-e.startCol+1)/7*100}% - ${t+n}px)`,top:`${f.value+e.lane*(d.value+LA)}px`,height:`${d.value}px`}},T=(0,t.ref)(null),E=(e,t,n)=>Math.max(t,Math.min(n,e)),D=(e,t)=>{let n=(document.elementFromPoint(e,t)?.closest(`[data-cell-date]`))?.getAttribute(`data-cell-date`);if(!n)return null;let[r,i,a]=n.split(`-`).map(Number);return new Date(r,i-1,a)},O=(e,t,n)=>{let r=e.getBoundingClientRect();return n[E(Math.floor((t-r.left)/r.width*n.length),0,n.length-1)]},k=(e,t)=>{let n=new Date(e.getFullYear(),e.getMonth(),e.getDate());return n.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()),n},A=(e,t,n,r)=>{p(t)&&(r.stopPropagation(),T.value={mode:e,event:t,originDate:n,pointerStartX:r.clientX,pointerStartY:r.clientY,dropDate:n,moved:!1},ne())},j=(e,t,n,r)=>{if(!p(t))return;let i=r.currentTarget.closest(`[data-week-row]`);A(e,t,i?O(i,r.clientX,n):t.start,r)},M=(e,t)=>{t.pointerType!==`touch`&&(T.value={mode:`create`,originDate:e,pointerStartX:t.clientX,pointerStartY:t.clientY,dropDate:e,moved:!1},ne())},N=null,P=null,F=e=>{let t=T.value;if(!t)return;(Math.abs(e.clientX-t.pointerStartX)>BA||Math.abs(e.clientY-t.pointerStartY)>BA)&&(t.moved=!0);let n=D(e.clientX,e.clientY);if(n)if(t.mode===`resize-end`){let e=(0,a.startOfDay)(t.event.start);t.dropDate=n.getTime()<e.getTime()?e:n}else if(t.mode===`resize-start`){let e=(0,a.startOfDay)(t.event.end);t.dropDate=n.getTime()>e.getTime()?e:n}else t.dropDate=n},ee=e=>{P=e,N??=requestAnimationFrame(()=>{N=null,P&&F(P)})},I=()=>{N!=null&&cancelAnimationFrame(N),N=null,P=null},te=e=>{let t=T.value;if(I(),re(),T.value=null,t){if(t.mode===`create`){if(t.moved){let[e,n]=[t.originDate,t.dropDate].sort((e,t)=>e.getTime()-t.getTime());i(`range-select`,{start:new Date(e.getFullYear(),e.getMonth(),e.getDate()),end:new Date(n.getFullYear(),n.getMonth(),n.getDate()),allDay:!0})}else i(`date-click`,t.originDate);return}if(t.event){if(!t.moved){i(`event-click`,t.event,e);return}if(t.mode===`move`){let e=(0,a.differenceInCalendarDays)(t.dropDate,t.originDate);e!==0&&i(`event-drag`,t.event,{start:(0,a.addDays)(t.event.start,e),end:(0,a.addDays)(t.event.end,e)})}else t.mode===`resize-end`?i(`event-resize`,t.event,{start:t.event.start,end:k(t.dropDate,t.event.end)}):i(`event-resize`,t.event,{start:k(t.dropDate,t.event.start),end:t.event.end})}}},ne=()=>{document.addEventListener(`pointermove`,ee),document.addEventListener(`pointerup`,te)},re=()=>{document.removeEventListener(`pointermove`,ee),document.removeEventListener(`pointerup`,te)};(0,t.onBeforeUnmount)(()=>{I(),re()});let L=e=>{let t=T.value;if(!t||!t.moved)return!1;if(t.mode===`create`){let n=Math.min(t.originDate.getTime(),t.dropDate.getTime()),r=Math.max(t.originDate.getTime(),t.dropDate.getTime()),i=e.date.getTime();return i>=n&&i<=r}return e.date.getTime()===t.dropDate.getTime()},R=(0,t.computed)(()=>{let e=T.value;if(!e||!e.event||e.mode===`create`||!e.moved)return null;if(e.mode===`move`){let t=(0,a.differenceInCalendarDays)(e.dropDate,e.originDate);return{event:e.event,start:(0,a.addDays)(e.event.start,t),end:(0,a.addDays)(e.event.end,t)}}return e.mode===`resize-end`?{event:e.event,start:e.event.start,end:k(e.dropDate,e.event.end)}:{event:e.event,start:k(e.dropDate,e.event.start),end:e.event.end}}),z=(e,t,n)=>{let r=(0,a.startOfDay)(e[0]),i=e.length-1,o=(0,a.differenceInCalendarDays)((0,a.startOfDay)(t),r),s=(0,a.differenceInCalendarDays)((0,a.startOfDay)(n),r);return s<0||o>i?null:{startCol:E(o,0,i),endCol:E(s,0,i),continuesBefore:o<0,continuesAfter:s>i}},ie=e=>{let t=R.value;return t?z(e.week.days.map(e=>e.date),t.start,t.end):null},ae=e=>{let t=e.continuesBefore?0:zA,n=e.continuesAfter?0:zA;return{left:`calc(${e.startCol/7*100}% + ${t}px)`,width:`calc(${(e.endCol-e.startCol+1)/7*100}% - ${t+n}px)`,top:`${f.value}px`,height:`${d.value+2}px`}},oe=e=>(0,a.isSameDay)(e.start,e.end)?(0,a.format)(e.start,`MMM d`):`${(0,a.format)(e.start,`MMM d`)} – ${(0,a.format)(e.end,`MMM d`)}`;return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,wA,[(0,t.createElementVNode)(`div`,TA,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(l.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e,class:`px-2 py-2 text-center text-[10px] font-bold tracking-wider text-muted uppercase`},(0,t.toDisplayString)(e),1))),128))]),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(h.value,(c,l)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:c.week.key,"data-week-row":``,class:(0,t.normalizeClass)([`relative grid grid-cols-7`,l<h.value.length-1?`border-b border-main`:``])},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(c.week.days,(l,u)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:l.key,"data-cell-date":l.key,class:(0,t.normalizeClass)([`group flex touch-pan-x flex-col border-r border-main/60 p-1.5 transition-colors last:border-r-0 hover:bg-surface/30`,[o[e.size],l.isCurrentMonth?`bg-content`:`bg-surface/20`,l.isWeekend&&l.isCurrentMonth?`bg-surface/10`:``,L(l)?`ring-2 ring-primary/50 ring-inset`:``]]),onPointerdown:e=>M(l.date,e)},[(0,t.renderSlot)(n.$slots,`dayCell`,{cell:l},()=>[(0,t.createElementVNode)(`div`,DA,[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`flex h-6 w-6 items-center justify-center rounded-full font-semibold tabular-nums`,[s[e.size],l.isToday?`bg-primary text-on-primary`:``,l.isCurrentMonth?`text-main`:`text-muted/60`]])},(0,t.toDisplayString)(l.date.getDate()),3)]),g(c)?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,style:(0,t.normalizeStyle)({height:`${g(c)}px`})},null,4)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,OA,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(y(c,l),r=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r.key,"data-cal-pill":``,tabindex:`0`,role:`button`,class:(0,t.normalizeClass)([`relative touch-none focus:outline-none focus-visible:ring-2 focus-visible:ring-primary`,[p(r)?`cursor-grab active:cursor-grabbing`:`cursor-pointer`,R.value?.event.key===r.key?`opacity-30`:``]]),onPointerdown:e=>A(`move`,r,l.date,e),onKeydown:(0,t.withKeys)((0,t.withModifiers)(e=>i(`event-click`,r,e),[`prevent`]),[`enter`,`space`])},[(0,t.renderSlot)(n.$slots,`event`,{event:r,timeLabel:e.cal.formatTime(r.start),compact:!1,display:`dot`},()=>[(0,t.createVNode)(hA,{event:r,display:`dot`,size:e.size,"time-label":e.cal.formatTime(r.start)},null,8,[`event`,`size`,`time-label`])])],42,kA))),128)),b(c,l,u)>0?((0,t.openBlock)(),(0,t.createBlock)(pe,{key:0,placement:`bottom`,size:`xs`,trigger:`click`,"show-arrow":!1},{trigger:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{type:`button`,class:`mt-0.5 cursor-pointer rounded px-1.5 text-left text-[10px] font-semibold text-muted hover:text-primary`,onPointerdown:r[0]||=(0,t.withModifiers)(()=>{},[`stop`])},` +`+(0,t.toDisplayString)(b(c,l,u))+` more `,33)]),default:(0,t.withCtx)(({close:n})=>[(0,t.createElementVNode)(`div`,AA,[(0,t.createElementVNode)(`div`,jA,(0,t.toDisplayString)((0,t.unref)(a.format)(l.date,`EEE, MMM d`)),1),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(x(c,l,u),r=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:r.key,type:`button`,class:`w-full cursor-pointer rounded text-left`,onClick:e=>S(r,e,n)},[(0,t.createVNode)(hA,{event:r,display:`dot`,size:e.size,"time-label":e.cal.formatTime(r.start)},null,8,[`event`,`size`,`time-label`])],8,MA))),128))])]),_:2},1024)):(0,t.createCommentVNode)(``,!0)])])],42,EA))),128)),n.$slots.dayCell?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,NA,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(C(c),a=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:a.event.key,"data-cal-pill":``,tabindex:`0`,role:`button`,class:(0,t.normalizeClass)([`group/bar absolute touch-none focus:outline-none focus-visible:ring-2 focus-visible:ring-primary`,[T.value?`pointer-events-none`:`pointer-events-auto`,p(a.event)?`cursor-grab active:cursor-grabbing`:`cursor-pointer`,R.value?.event.key===a.event.key?`opacity-30`:``]]),style:(0,t.normalizeStyle)(w(a)),onPointerdown:e=>j(`move`,a.event,c.week.days.map(e=>e.date),e),onKeydown:(0,t.withKeys)((0,t.withModifiers)(e=>i(`event-click`,a.event,e),[`prevent`]),[`enter`,`space`])},[(0,t.renderSlot)(n.$slots,`event`,{event:a.event,timeLabel:e.cal.formatTime(a.event.start),compact:!1,display:`bar`},()=>[(0,t.createVNode)(hA,{event:a.event,display:`bar`,size:e.size,"time-label":e.cal.formatTime(a.event.start),"continues-before":a.continuesBefore,"continues-after":a.continuesAfter},null,8,[`event`,`size`,`time-label`,`continues-before`,`continues-after`])]),p(a.event)?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[a.continuesBefore?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:`absolute inset-y-0 left-0 flex w-3 cursor-ew-resize items-center justify-center opacity-60 transition-opacity group-hover/bar:opacity-100`,onPointerdown:e=>j(`resize-start`,a.event,c.week.days.map(e=>e.date),e)},[...r[1]||=[(0,t.createElementVNode)(`span`,{class:`h-full w-1 rounded-full bg-black/30`},null,-1)]],40,FA)),a.continuesAfter?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,class:`absolute inset-y-0 right-0 flex w-3 cursor-ew-resize items-center justify-center opacity-60 transition-opacity group-hover/bar:opacity-100`,onPointerdown:e=>j(`resize-end`,a.event,c.week.days.map(e=>e.date),e)},[...r[2]||=[(0,t.createElementVNode)(`span`,{class:`h-full w-1 rounded-full bg-black/30`},null,-1)]],40,IA))],64)):(0,t.createCommentVNode)(``,!0)],46,PA))),128)),ie(c)?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`pointer-events-none absolute z-30 rounded-md shadow-lg ring-2 ring-primary/70`,style:(0,t.normalizeStyle)(ae(ie(c)))},[(0,t.createVNode)(hA,{event:R.value.event,display:`bar`,size:e.size,"force-show-time-label":``,"time-label":oe(R.value),"continues-before":ie(c).continuesBefore,"continues-after":ie(c).continuesAfter},null,8,[`event`,`size`,`time-label`,`continues-before`,`continues-after`])],4)):(0,t.createCommentVNode)(``,!0)]))],2))),128))]))}}),HA={class:`flex flex-col overflow-hidden rounded-lg border border-main bg-content`},UA={class:`max-h-[68vh] overflow-y-auto print:max-h-none print:overflow-visible`},WA={class:`sticky top-0 z-40 bg-content print:static print:z-auto`},GA=[`onClick`],KA={class:`text-[10px] font-bold tracking-wider text-muted uppercase`},qA={class:`grid border-b border-main bg-surface/20`,style:{gridTemplateColumns:`3.5rem minmax(0, 1fr)`}},JA={class:`pointer-events-none absolute inset-0`},YA=[`onClick`,`onKeydown`],XA={class:`border-r border-main/60`},ZA={class:`absolute -top-2 right-1.5 bg-content px-0.5 text-[10px] text-muted`},QA=[`onPointerdown`],$A=[`onPointerdown`,`onKeydown`],ej=[`onPointerdown`],tj=15,nj=4,rj=2,ij=4,aj=(0,t.defineComponent)({__name:`CalendarTimeGridView`,props:{cal:{},size:{default:`md`},editable:{type:Boolean,default:!0}},emits:[`event-click`,`date-click`,`event-drag`,`event-resize`,`range-select`],setup(e,{emit:n}){let r=e,i=n,o={xs:36,sm:44,md:52,lg:60,xl:72},s=(0,t.computed)(()=>r.cal.hours.value[0]??0),c=(0,t.computed)(()=>s.value+r.cal.hours.value.length),l=(0,t.computed)(()=>s.value*60),u=(0,t.computed)(()=>c.value*60),d=(0,t.computed)(()=>o[r.size]),f=(0,t.computed)(()=>d.value/60),p=(0,t.computed)(()=>r.cal.hours.value.length*d.value),m=(0,t.computed)(()=>r.cal.dayColumns.value),h=(0,t.computed)(()=>m.value.map(e=>({day:e,positioned:SA(r.cal.getTimedEventsForDay(e),{dayStartHour:s.value,dayEndHour:c.value,timeZone:r.cal.timeZone.value})}))),g={xs:16,sm:17,md:18,lg:20,xl:22},_=(0,t.computed)(()=>g[r.size]),v=(0,t.computed)(()=>{let e=new Set,t=[];for(let n of m.value)for(let i of r.cal.getAllDayEventsForDay(n))e.has(i.key)||(e.add(i.key),t.push(i));return t}),y=(0,t.computed)(()=>CA(m.value,v.value)),b=(0,t.computed)(()=>{let e=y.value.laneCount;return Math.max(28,ij*2+e*(_.value+rj))}),x=e=>{let t=m.value.length,n=e.continuesBefore?0:2,r=e.continuesAfter?0:2;return{left:`calc(${e.startCol/t*100}% + ${n}px)`,width:`calc(${(e.endCol-e.startCol+1)/t*100}% - ${n+r}px)`,top:`${ij+e.lane*(_.value+rj)}px`,height:`${_.value}px`}},S=e=>e/100*p.value<40,C=e=>r.editable&&e.editable&&!e.isOccurrence,w=(0,t.ref)(null),T={move:`grabbing`,resize:`ns-resize`,create:`ns-resize`},E=e=>{typeof document>`u`||(document.body.style.cursor=e??``,document.body.style.userSelect=e?`none`:``)},D=(e,t,n)=>Math.max(t,Math.min(n,e)),O=e=>Math.round(e/tj)*tj,k=(e,t)=>{let n=new Date(e.getFullYear(),e.getMonth(),e.getDate());return n.setMinutes(t),n},A=(e,t)=>D(O(l.value+(e-t)/d.value*60),l.value,u.value),j=(e,t,n,i)=>{C(t)&&(i.stopPropagation(),w.value={mode:e,event:t,dayKey:n.toISOString(),day:n,pointerStartX:i.clientX,pointerStartY:i.clientY,columnTop:0,origStartMin:D(xA(t.start,r.cal.timeZone.value),l.value,u.value),origEndMin:D(xA(t.end,r.cal.timeZone.value),l.value,u.value),previewStartMin:0,previewEndMin:0,moved:!1},w.value.previewStartMin=w.value.origStartMin,w.value.previewEndMin=w.value.origEndMin,E(T[e]),ne())},M=(e,t)=>{if(t.pointerType===`touch`)return;let n=t.currentTarget.getBoundingClientRect().top,r=A(t.clientY,n);w.value={mode:`create`,dayKey:e.toISOString(),day:e,pointerStartX:t.clientX,pointerStartY:t.clientY,columnTop:n,origStartMin:r,origEndMin:r,previewStartMin:r,previewEndMin:r,moved:!1},E(T.create),ne()},N=e=>{let t=w.value;if(!t)return;if(Math.abs(e.clientY-t.pointerStartY)>nj&&(t.moved=!0),t.mode===`create`){let n=A(e.clientY,t.columnTop);t.previewStartMin=Math.min(t.origStartMin,n),t.previewEndMin=Math.max(t.origStartMin,n);return}let n=O((e.clientY-t.pointerStartY)/f.value),r=t.origEndMin-t.origStartMin;if(t.mode===`move`){let e=D(t.origStartMin+n,l.value,u.value-r);t.previewStartMin=e,t.previewEndMin=e+r}else t.previewEndMin=D(t.origEndMin+n,t.origStartMin+tj,u.value)},P=null,F=null,ee=e=>{F=e,P??=requestAnimationFrame(()=>{P=null,F&&N(F)})},I=()=>{P!=null&&cancelAnimationFrame(P),P=null,F=null},te=e=>{let t=w.value;if(I(),re(),E(null),w.value=null,!t)return;if(t.mode===`create`){t.moved&&t.previewEndMin-t.previewStartMin>=tj?i(`range-select`,{start:k(t.day,t.previewStartMin),end:k(t.day,t.previewEndMin),allDay:!1}):i(`date-click`,k(t.day,t.previewStartMin));return}if(!t.event)return;if(!t.moved){i(`event-click`,t.event,e);return}let n={start:k(t.day,t.previewStartMin),end:k(t.day,t.previewEndMin)};t.mode===`move`?i(`event-drag`,t.event,n):i(`event-resize`,t.event,n)},ne=()=>{document.addEventListener(`pointermove`,ee),document.addEventListener(`pointerup`,te)},re=()=>{document.removeEventListener(`pointermove`,ee),document.removeEventListener(`pointerup`,te)};(0,t.onBeforeUnmount)(()=>{I(),re(),E(null)});let L=(e,t)=>({top:`${e}%`,height:`${t}%`,minHeight:`1.25rem`}),R=(e,t)=>{let n=w.value;return!!(n&&n.event?.key===e.event.key&&n.dayKey===t&&n.mode!==`create`)},z=(e,t)=>{let n=w.value,r=n&&n.event?.key===e.event.key&&n.dayKey===t&&n.mode!==`create`;return{...L(r?(n.previewStartMin-l.value)/(u.value-l.value)*100:e.top,r?(n.previewEndMin-n.previewStartMin)/(u.value-l.value)*100:e.height),...fe(e.lane,e.lanes),zIndex:r?30:void 0}},ie=(e,t)=>{let n=w.value;return n&&n.event?.key===e.event.key&&n.dayKey===t&&n.mode!==`create`?`${r.cal.formatTime(k(n.day,n.previewStartMin))} – ${r.cal.formatTime(k(n.day,n.previewEndMin))}`:r.cal.formatTime(e.event.start)},ae=e=>{let t=w.value;if(!t||t.mode!==`create`||t.dayKey!==e||!t.moved)return null;let n=(t.previewStartMin-l.value)/(u.value-l.value)*100,r=(t.previewEndMin-t.previewStartMin)/(u.value-l.value)*100;return{top:`${n}%`,height:`${r}%`}},oe=(0,t.computed)(()=>r.cal.businessHours.value),se=e=>{let t=oe.value;if(!t||!(t.daysOfWeek??[1,2,3,4,5]).includes(e.getDay()))return null;let n=u.value-l.value,r=(t.startMinute-l.value)/n*100,i=(t.endMinute-t.startMinute)/n*100;return{top:Math.max(0,r),height:Math.min(100-Math.max(0,r),i)}},ce=(0,t.ref)(null),le=null;(0,t.onMounted)(()=>{ce.value=new Date,le=setInterval(()=>ce.value=new Date,6e4)}),(0,t.onBeforeUnmount)(()=>{le&&clearInterval(le)});let ue=(0,t.computed)(()=>{if(!ce.value)return null;let e=xA(ce.value,r.cal.timeZone.value);return e<l.value||e>u.value?null:(e-l.value)/(u.value-l.value)*100}),de=e=>{let t=new Date;return t.setHours(e,0,0,0),(0,a.format)(t,`h a`)},fe=(e,t)=>({left:`calc(${e/t*100}% + ${e===0?0:2/2}px)`,width:`calc(${100/t}% - 2px)`});return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,HA,[(0,t.createElementVNode)(`div`,UA,[(0,t.createElementVNode)(`div`,WA,[(0,t.createElementVNode)(`div`,{class:`grid border-b border-main bg-surface/40`,style:(0,t.normalizeStyle)({gridTemplateColumns:`3.5rem repeat(${m.value.length}, minmax(0, 1fr))`})},[r[0]||=(0,t.createElementVNode)(`div`,{class:`border-r border-main/60`},null,-1),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(m.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e.toISOString(),type:`button`,class:`flex cursor-pointer flex-col items-center gap-0.5 border-r border-main/60 py-2 transition-colors last:border-r-0 hover:bg-surface/60`,onClick:t=>i(`date-click`,e)},[(0,t.createElementVNode)(`span`,KA,(0,t.toDisplayString)((0,t.unref)(a.format)(e,`EEE`)),1),(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`flex h-7 w-7 items-center justify-center rounded-full text-sm font-semibold tabular-nums`,(0,t.unref)(a.isToday)(e)?`bg-primary text-on-primary`:`text-main`])},(0,t.toDisplayString)(e.getDate()),3)],8,GA))),128))],4),(0,t.createElementVNode)(`div`,qA,[r[1]||=(0,t.createElementVNode)(`div`,{class:`flex items-start justify-end border-r border-main/60 px-1.5 py-1 text-[9px] font-bold tracking-wider text-muted uppercase`},` All day `,-1),(0,t.createElementVNode)(`div`,{class:`relative grid`,style:(0,t.normalizeStyle)({gridTemplateColumns:`repeat(${m.value.length}, minmax(0, 1fr))`,minHeight:`${b.value}px`})},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(m.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.toISOString(),class:`border-r border-main/60 last:border-r-0`}))),128)),(0,t.createElementVNode)(`div`,JA,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(y.value.segments,r=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r.event.key,"data-cal-pill":``,tabindex:`0`,role:`button`,class:`pointer-events-auto absolute cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-primary`,style:(0,t.normalizeStyle)(x(r)),onClick:(0,t.withModifiers)(e=>i(`event-click`,r.event,e),[`stop`]),onKeydown:(0,t.withKeys)((0,t.withModifiers)(e=>i(`event-click`,r.event,e),[`prevent`]),[`enter`,`space`])},[(0,t.renderSlot)(n.$slots,`event`,{event:r.event,timeLabel:e.cal.formatTime(r.event.start),compact:!1,display:`bar`},()=>[(0,t.createVNode)(hA,{event:r.event,display:`bar`,size:e.size,"time-label":e.cal.formatTime(r.event.start),"continues-before":r.continuesBefore,"continues-after":r.continuesAfter},null,8,[`event`,`size`,`time-label`,`continues-before`,`continues-after`])])],44,YA))),128))])],4)])]),(0,t.createElementVNode)(`div`,{class:`grid`,style:(0,t.normalizeStyle)({gridTemplateColumns:`3.5rem repeat(${m.value.length}, minmax(0, 1fr))`})},[(0,t.createElementVNode)(`div`,XA,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.cal.hours.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e,class:`relative border-b border-main/40 text-right`,style:(0,t.normalizeStyle)({height:`${d.value}px`})},[(0,t.createElementVNode)(`span`,ZA,(0,t.toDisplayString)(e===s.value?``:de(e)),1)],4))),128))]),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(h.value,o=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:o.day.toISOString(),class:`relative touch-pan-y border-r border-main/60 last:border-r-0`,style:(0,t.normalizeStyle)({height:`${p.value}px`}),onPointerdown:e=>M(o.day,e)},[se(o.day)?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`pointer-events-none absolute inset-x-0 bg-primary/[0.04]`,style:(0,t.normalizeStyle)({top:`${se(o.day).top}%`,height:`${se(o.day).height}%`})},null,4)):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.cal.hours.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e,class:`border-b border-main/40`,style:(0,t.normalizeStyle)({height:`${d.value}px`})},null,4))),128)),ae(o.day.toISOString())?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:`pointer-events-none absolute inset-x-0.5 z-20 rounded-md border-2 border-dashed border-primary bg-primary/10`,style:(0,t.normalizeStyle)(ae(o.day.toISOString()))},null,4)):(0,t.createCommentVNode)(``,!0),(0,t.unref)(a.isToday)(o.day)&&ue.value!==null?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:2,class:`pointer-events-none absolute inset-x-0 z-20 flex items-center`,style:(0,t.normalizeStyle)({top:`${ue.value}%`})},[...r[2]||=[(0,t.createElementVNode)(`span`,{class:`-ml-1 h-2 w-2 rounded-full bg-danger`},null,-1),(0,t.createElementVNode)(`span`,{class:`h-px w-full bg-danger`},null,-1)]],4)):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(o.positioned,a=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:a.event.key,"data-cal-pill":``,tabindex:`0`,role:`button`,class:(0,t.normalizeClass)([`absolute touch-none px-px focus:outline-none focus-visible:ring-2 focus-visible:ring-primary`,[C(a.event)?`cursor-grab active:cursor-grabbing`:`cursor-pointer`,R(a,o.day.toISOString())?`z-30 rounded-md opacity-90 shadow-xl ring-2 ring-primary/60 transition-[top,height] duration-100 ease-out will-change-[top,height] [&_*]:transition-none`:``]]),style:(0,t.normalizeStyle)(z(a,o.day.toISOString())),onPointerdown:e=>j(`move`,a.event,o.day,e),onKeydown:(0,t.withKeys)((0,t.withModifiers)(e=>i(`event-click`,a.event,e),[`prevent`]),[`enter`,`space`])},[(0,t.renderSlot)(n.$slots,`event`,{event:a.event,timeLabel:ie(a,o.day.toISOString()),compact:S(a.height),display:`block`},()=>[(0,t.createVNode)(hA,{event:a.event,display:`block`,size:e.size,"time-label":ie(a,o.day.toISOString()),compact:S(a.height)},null,8,[`event`,`size`,`time-label`,`compact`])]),C(a.event)?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`absolute inset-x-0 -bottom-1 h-3.5 cursor-ns-resize`,onPointerdown:e=>j(`resize`,a.event,o.day,e)},[...r[3]||=[(0,t.createElementVNode)(`span`,{class:`mx-auto mt-1 block h-1 w-6 rounded-full bg-black/25`},null,-1)]],40,ej)):(0,t.createCommentVNode)(``,!0)],46,$A))),128))],44,QA))),128))],4)])]))}}),oj={class:`flex flex-col overflow-hidden rounded-lg border border-main bg-content`},sj=[`onClick`],cj={class:`flex flex-col sm:mt-1`},lj={class:`text-sm font-semibold text-main`},uj={class:`text-xs text-muted`},dj={class:`flex min-w-0 flex-1 flex-col gap-2`},fj=[`onClick`,`onKeydown`],pj={class:`flex flex-col items-center justify-center gap-3 px-6 py-16 text-center`},mj=(0,t.defineComponent)({__name:`CalendarAgendaView`,props:{cal:{},size:{}},emits:[`event-click`,`date-click`],setup(e,{emit:r}){let i=r;return(r,o)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,oj,[e.cal.agendaDays.value.length?((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,{key:0},(0,t.renderList)(e.cal.agendaDays.value,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n.key,class:`flex flex-col gap-2 border-b border-main p-4 last:border-b-0 sm:flex-row sm:gap-6`},[(0,t.createElementVNode)(`button`,{type:`button`,class:`flex shrink-0 cursor-pointer items-center gap-3 text-left sm:w-40 sm:flex-col sm:items-start sm:gap-0.5`,onClick:e=>i(`date-click`,n.date)},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`flex h-10 w-10 items-center justify-center rounded-lg text-lg font-bold tabular-nums sm:h-12 sm:w-12 sm:text-2xl`,(0,t.unref)(a.isToday)(n.date)?`bg-primary text-on-primary`:`bg-surface/60 text-main`])},(0,t.toDisplayString)(n.date.getDate()),3),(0,t.createElementVNode)(`span`,cj,[(0,t.createElementVNode)(`span`,lj,(0,t.toDisplayString)((0,t.unref)(a.format)(n.date,`EEEE`)),1),(0,t.createElementVNode)(`span`,uj,(0,t.toDisplayString)((0,t.unref)(a.format)(n.date,`MMMM yyyy`)),1)])],8,sj),(0,t.createElementVNode)(`div`,dj,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(n.events,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n.key,"data-cal-pill":``,tabindex:`0`,role:`button`,class:`cursor-pointer rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-primary`,onClick:e=>i(`event-click`,n,e),onKeydown:(0,t.withKeys)((0,t.withModifiers)(e=>i(`event-click`,n,e),[`prevent`]),[`enter`,`space`])},[(0,t.renderSlot)(r.$slots,`event`,{event:n,timeLabel:e.cal.formatTime(n.start),display:`list`},()=>[(0,t.createVNode)(hA,{event:n,display:`list`,size:e.size,"time-label":e.cal.formatTime(n.start)},null,8,[`event`,`size`,`time-label`])])],40,fj))),128))])]))),128)):(0,t.renderSlot)(r.$slots,`empty`,{key:1},()=>[(0,t.createElementVNode)(`div`,pj,[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:calendar-x`,class:`h-10 w-10 text-muted/50`}),o[0]||=(0,t.createElementVNode)(`p`,{class:`text-sm font-medium text-main`},`No upcoming events`,-1),o[1]||=(0,t.createElementVNode)(`p`,{class:`max-w-xs text-xs text-muted`},` There's nothing scheduled in this window. Events you add will show up here. `,-1)])])]))}}),hj={class:`grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4`},gj=[`onClick`],_j={class:`text-sm font-bold text-main`},vj={key:0,class:`rounded-full bg-primary/10 px-1.5 py-0.5 text-[10px] font-semibold text-primary tabular-nums`},yj={class:`grid grid-cols-7 gap-y-0.5`},bj=[`onClick`],xj={key:0,class:`absolute bottom-0.5 h-1 w-1 rounded-full bg-primary`},Sj=(0,t.defineComponent)({__name:`CalendarYearView`,props:{cal:{},size:{default:`md`}},emits:[`date-click`,`month-click`],setup(e,{emit:n}){let r=e,i=n,o=(0,t.computed)(()=>r.cal.firstDayOfWeek.value),s=(0,t.computed)(()=>r.cal.yearMonths.value.map(e=>{let t=(0,a.startOfWeek)((0,a.startOfMonth)(e.date),{weekStartsOn:o.value}),n=(0,a.endOfWeek)((0,a.endOfMonth)(e.date),{weekStartsOn:o.value}),i=e.date.getMonth(),s=(0,a.eachDayOfInterval)({start:t,end:n}).map(e=>({date:e,key:e.toISOString(),inMonth:e.getMonth()===i,isToday:(0,a.isToday)(e),hasEvents:r.cal.getEventsForDay(e).length>0}));return{...e,days:s}})),c=(0,t.computed)(()=>r.cal.weekdayNames.value.map(e=>e.charAt(0)));return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,hj,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(s.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.key,class:`flex flex-col gap-2 rounded-lg border border-main bg-content p-3 transition-colors hover:border-primary/40`},[(0,t.createElementVNode)(`button`,{type:`button`,class:`flex cursor-pointer items-center justify-between text-left`,onClick:t=>i(`month-click`,e.date)},[(0,t.createElementVNode)(`span`,_j,(0,t.toDisplayString)((0,t.unref)(a.format)(e.date,`MMMM`)),1),e.eventCount?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,vj,(0,t.toDisplayString)(e.eventCount),1)):(0,t.createCommentVNode)(``,!0)],8,gj),(0,t.createElementVNode)(`div`,yj,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(c.value,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:`h-${n}`,class:`text-center text-[9px] font-bold text-muted/70 uppercase`},(0,t.toDisplayString)(e),1))),128)),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.days,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e.key,type:`button`,class:(0,t.normalizeClass)([`relative flex h-6 cursor-pointer items-center justify-center rounded text-[10px] tabular-nums transition-colors hover:bg-surface/60`,[e.inMonth?`text-main`:`text-muted/40`,e.isToday?`bg-primary font-bold text-on-primary hover:bg-primary/90`:``]]),onClick:t=>i(`date-click`,e.date)},[(0,t.createTextVNode)((0,t.toDisplayString)(e.date.getDate())+` `,1),e.hasEvents&&!e.isToday?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,xj)):(0,t.createCommentVNode)(``,!0)],10,bj))),128))])]))),128))]))}}),Cj={class:`flex flex-col gap-3 p-4`},wj={class:`flex items-start gap-2.5`},Tj={class:`flex min-w-0 flex-1 flex-col`},Ej={class:`leading-snug font-bold text-main`},Dj={key:0,class:`mt-0.5 text-xs text-muted`},Oj={key:0,class:`flex flex-col gap-2 pl-5.5`},kj={key:0,class:`flex items-center gap-1.5 text-sm text-main`},Aj={key:1,class:`flex items-start gap-1.5 text-sm text-muted`},jj={class:`min-w-0`},Mj={key:1,class:`flex items-center gap-1.5 pl-5.5 text-xs text-muted`},Nj={key:2,class:`mt-1 flex items-center justify-end gap-2 border-t border-main/40 pt-3`},Pj=(0,t.defineComponent)({__name:`CalendarEventDetails`,props:{event:{},whenText:{default:``},editable:{type:Boolean,default:!1},canDelete:{type:Boolean,default:!1}},emits:[`edit`,`delete`],setup(e,{emit:r}){let i=e,a=r,o={primary:`bg-primary`,secondary:`bg-muted`,success:`bg-success`,warning:`bg-warning`,danger:`bg-danger`,info:`bg-info`},s=(0,t.computed)(()=>i.event.severity??`primary`);return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Cj,[(0,t.createElementVNode)(`div`,wj,[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`mt-1 h-3 w-3 shrink-0 rounded-full`,o[s.value]])},null,2),(0,t.createElementVNode)(`div`,Tj,[(0,t.createElementVNode)(`h4`,Ej,(0,t.toDisplayString)(e.event.title),1),e.whenText?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,Dj,(0,t.toDisplayString)(e.whenText),1)):(0,t.createCommentVNode)(``,!0)])]),e.event.location||e.event.description?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Oj,[e.event.location?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,kj,[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:map-pin`,class:`h-4 w-4 shrink-0 text-muted`}),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(e.event.location),1)])):(0,t.createCommentVNode)(``,!0),e.event.description?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,Aj,[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:align-left`,class:`mt-0.5 h-4 w-4 shrink-0`}),(0,t.createElementVNode)(`span`,jj,(0,t.toDisplayString)(e.event.description),1)])):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0),e.event.isOccurrence?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Mj,[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:repeat`,class:`h-3.5 w-3.5`}),i[2]||=(0,t.createTextVNode)(` Part of a recurring series `,-1)])):(0,t.createCommentVNode)(``,!0),e.editable?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Nj,[e.canDelete?((0,t.openBlock)(),(0,t.createBlock)(c,{key:0,label:`Delete`,icon:`lucide:trash-2`,variant:`text`,severity:`danger`,size:`sm`,onClick:i[0]||=e=>a(`delete`)})):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(c,{label:`Edit`,icon:`lucide:pencil`,variant:`solid`,severity:`primary`,size:`sm`,onClick:i[1]||=e=>a(`edit`)})])):(0,t.createCommentVNode)(``,!0)]))}}),Fj={key:0,class:`print:hidden`},Ij={key:0,class:`fixed inset-x-0 bottom-0 z-[10000] mx-auto max-w-[calc(100vw-24px)] rounded-t-2xl border border-main bg-content shadow-xl print:hidden`,role:`dialog`,"aria-modal":`true`},Lj=(0,t.defineComponent)({__name:`CalendarEventPopover`,props:(0,t.mergeModels)({reference:{default:null},event:{default:null},whenText:{default:``},editable:{type:Boolean,default:!1},canDelete:{type:Boolean,default:!1},mobile:{type:Boolean,default:!1},size:{},boundary:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:(0,t.mergeModels)([`edit`,`delete`,`close`],[`update:modelValue`]),setup(e,{emit:n}){let r=e,i=(0,t.useModel)(e,`modelValue`),a=n,o=()=>{i.value=!1,a(`close`)},s=e=>{r.mobile&&e.key===`Escape`&&i.value&&o()};return(0,t.onMounted)(()=>document.addEventListener(`keydown`,s)),(0,t.onBeforeUnmount)(()=>document.removeEventListener(`keydown`,s)),(n,r)=>e.mobile?((0,t.openBlock)(),(0,t.createBlock)(t.Teleport,{key:1,to:`body`},[(0,t.createVNode)(t.Transition,{"enter-active-class":`transition-opacity duration-200`,"enter-from-class":`opacity-0`,"enter-to-class":`opacity-100`,"leave-active-class":`transition-opacity duration-150`,"leave-from-class":`opacity-100`,"leave-to-class":`opacity-0`},{default:(0,t.withCtx)(()=>[i.value&&e.event?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`bg-background/60 fixed inset-0 z-[9999] backdrop-blur-sm print:hidden`,onClick:o})):(0,t.createCommentVNode)(``,!0)]),_:1}),(0,t.createVNode)(t.Transition,{"enter-active-class":`transition-transform duration-300 ease-out`,"enter-from-class":`translate-y-full`,"enter-to-class":`translate-y-0`,"leave-active-class":`transition-transform duration-200 ease-in`,"leave-from-class":`translate-y-0`,"leave-to-class":`translate-y-full`},{default:(0,t.withCtx)(()=>[i.value&&e.event?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Ij,[r[6]||=(0,t.createElementVNode)(`div`,{class:`flex justify-center pt-2.5`},[(0,t.createElementVNode)(`span`,{class:`h-1 w-10 rounded-full bg-muted/40`})],-1),(0,t.renderSlot)(n.$slots,`default`,{event:e.event,close:o,edit:()=>a(`edit`,e.event),delete:()=>a(`delete`,e.event)},()=>[(0,t.createVNode)(Pj,{event:e.event,"when-text":e.whenText,editable:e.editable,"can-delete":e.canDelete,onEdit:r[3]||=t=>a(`edit`,e.event),onDelete:r[4]||=t=>a(`delete`,e.event)},null,8,[`event`,`when-text`,`editable`,`can-delete`])])])):(0,t.createCommentVNode)(``,!0)]),_:3})])):((0,t.openBlock)(),(0,t.createBlock)(pe,{key:0,modelValue:i.value,"onUpdate:modelValue":r[2]||=e=>i.value=e,reference:e.reference,"auto-placement":!0,boundary:e.boundary,size:`sm`,"show-arrow":!0,"trigger-class":`hidden`},{trigger:(0,t.withCtx)(()=>[...r[5]||=[(0,t.createElementVNode)(`span`,null,null,-1)]]),default:(0,t.withCtx)(()=>[e.event?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Fj,[(0,t.renderSlot)(n.$slots,`default`,{event:e.event,close:o,edit:()=>a(`edit`,e.event),delete:()=>a(`delete`,e.event)},()=>[(0,t.createVNode)(Pj,{event:e.event,"when-text":e.whenText,editable:e.editable,"can-delete":e.canDelete,onEdit:r[0]||=t=>a(`edit`,e.event),onDelete:r[1]||=t=>a(`delete`,e.event)},null,8,[`event`,`when-text`,`editable`,`can-delete`])])])):(0,t.createCommentVNode)(``,!0)]),_:3},8,[`modelValue`,`reference`,`boundary`]))}}),Rj={su:0,mo:1,tu:2,we:3,th:4,fr:5,sa:6},zj=e=>typeof e==`number`?e:Rj[e]??0,Bj=e=>e instanceof Date?e:new Date(e),Vj=(e,t)=>(0,a.set)(e,{hours:t.getHours(),minutes:t.getMinutes(),seconds:t.getSeconds(),milliseconds:t.getMilliseconds()}),Hj=5e3;function Uj(e,t,n){let r=Math.max(1,Math.floor(t.interval??1)),i=t.until?(0,a.startOfDay)(Bj(t.until)):null,o=t.byWeekday?.length?new Set(t.byWeekday.map(zj)):null,s=t.byMonthday?.length?t.byMonthday:null,c=new Set((t.exceptions??[]).map(e=>(0,a.startOfDay)(Bj(e)).getTime())),l=[],u=t.count==null,d=0,f=e=>i&&(0,a.isAfter)((0,a.startOfDay)(e),i)||(d++,t.count!=null&&d>t.count)||(0,a.isAfter)(e,n.end)?`stop`:((0,a.isBefore)(e,n.start)||c.has((0,a.startOfDay)(e).getTime())||l.push(e),`continue`);if(t.freq===`weekly`&&o){let t=(0,a.startOfWeek)(e,{weekStartsOn:0});if(u){let e=Math.floor((0,a.differenceInCalendarDays)((0,a.startOfWeek)(n.start,{weekStartsOn:0}),t)/(7*r));e>0&&(t=(0,a.addWeeks)(t,e*r))}for(let i=0;i<Hj;i++){let i=!1;for(let n=0;n<7;n++){let r=(0,a.addDays)(t,n);if(!o.has(r.getDay()))continue;let s=Vj(r,e);if(!(0,a.isBefore)((0,a.startOfDay)(s),(0,a.startOfDay)(e))&&f(s)===`stop`){i=!0;break}}if(i||(0,a.isAfter)(t,n.end))break;t=(0,a.addWeeks)(t,r)}return l}if(t.freq===`monthly`&&s){let t=(0,a.startOfDay)((0,a.setDate)(e,1));if(u){let i=(n.start.getFullYear()-e.getFullYear())*12+(n.start.getMonth()-e.getMonth()),o=Math.floor(Math.max(0,i)/r)*r;o>0&&(t=(0,a.addMonths)(t,o))}for(let i=0;i<Hj;i++){let i=!1,o=(0,a.getDaysInMonth)(t);for(let n of s){if(n<1||n>o)continue;let r=Vj((0,a.setDate)(t,n),e);if(!(0,a.isBefore)((0,a.startOfDay)(r),(0,a.startOfDay)(e))&&f(r)===`stop`){i=!0;break}}if(i||(0,a.isAfter)(t,n.end))break;t=(0,a.addMonths)(t,r)}return l}let p=e=>{switch(t.freq){case`daily`:return(0,a.addDays)(e,r);case`weekly`:return(0,a.addWeeks)(e,r);case`monthly`:return(0,a.addMonths)(e,r);case`yearly`:return(0,a.addYears)(e,r)}},m=e;if(u&&(0,a.isBefore)(m,n.start)){if(t.freq===`daily`){let e=Math.floor((0,a.differenceInCalendarDays)(n.start,m)/r);e>0&&(m=(0,a.addDays)(m,e*r))}else if(t.freq===`weekly`){let e=Math.floor((0,a.differenceInCalendarDays)(n.start,m)/(7*r));e>0&&(m=(0,a.addWeeks)(m,e*r))}else if(t.freq===`monthly`){let e=(n.start.getFullYear()-m.getFullYear())*12+(n.start.getMonth()-m.getMonth()),t=Math.floor(Math.max(0,e)/r);t>0&&(m=(0,a.addMonths)(m,t*r))}else if(t.freq===`yearly`){let e=Math.floor(Math.max(0,n.start.getFullYear()-m.getFullYear())/r);e>0&&(m=(0,a.addYears)(m,e*r))}}for(let e=0;e<Hj&&f(m)!==`stop`;e++)m=p(m);return l}var Wj={daysOfWeek:[1,2,3,4,5],startMinute:540,endMinute:1020},Gj=e=>e instanceof Date?e:new Date(e),Kj={month:{step:(e,t)=>(0,a.addMonths)(e,t),range:(e,t)=>({start:(0,a.startOfWeek)((0,a.startOfMonth)(e),{weekStartsOn:t}),end:(0,a.endOfWeek)((0,a.endOfMonth)(e),{weekStartsOn:t})})},week:{step:(e,t)=>(0,a.addWeeks)(e,t),range:(e,t)=>({start:(0,a.startOfWeek)(e,{weekStartsOn:t}),end:(0,a.endOfWeek)(e,{weekStartsOn:t})})},day:{step:(e,t)=>(0,a.addDays)(e,t),range:e=>({start:(0,a.startOfDay)(e),end:(0,a.endOfDay)(e)})},agenda:{step:(e,t)=>(0,a.addDays)(e,t*7),range:e=>({start:(0,a.startOfDay)(e),end:(0,a.endOfDay)(e)})},year:{step:(e,t)=>(0,a.addYears)(e,t),range:e=>({start:(0,a.startOfYear)(e),end:(0,a.endOfYear)(e)})}};function qj(e={}){let n=(0,t.ref)(e.view??`month`),r=(0,t.ref)(e.date?Gj(e.date):new Date),i=(0,t.ref)(e.firstDayOfWeek??0),o=(0,t.ref)(e.timeZone),s=e.locale,c=(0,t.ref)(Math.max(0,e.dayStartHour??0)),l=(0,t.ref)(Math.min(24,e.dayEndHour??24)),u=(0,t.ref)(e.agendaDayCount??30),d=(0,t.ref)(e.businessHours),f=e.provider,p=(0,t.ref)([]),m=(0,t.ref)(!1),h=(0,t.ref)(null),g=(0,t.ref)(!1),_=(0,t.computed)(()=>{let e=d.value;return e===!1||e==null?null:e===!0?Wj:e}),v=(0,t.computed)(()=>n.value===`agenda`?{start:(0,a.startOfDay)(r.value),end:(0,a.endOfDay)((0,a.addDays)(r.value,u.value-1))}:Kj[n.value].range(r.value,i.value)),y=(0,t.computed)(()=>({start:(0,a.subDays)(v.value.start,1),end:(0,a.addDays)(v.value.end,1)})),b=(0,t.computed)(()=>[...(e.events?(0,t.toValue)(e.events):[])??[],...p.value]),x=(0,t.computed)(()=>{let e=y.value,t=[],n=(t,n)=>t<=e.end&&n>=e.start,r=(e,t,n,r)=>({key:r?`${e.id}__${t.toISOString()}`:e.id,id:e.id,title:e.title,start:t,end:n,allDay:!!e.allDay,severity:e.severity??`primary`,location:e.location,description:e.description,editable:e.editable??!0,isOccurrence:r,isMultiDay:!(0,a.isSameDay)(t,n),source:e});for(let i of b.value){let a=Gj(i.start),o=i.end?Gj(i.end):new Date(a),s=Math.max(0,o.getTime()-a.getTime());if(i.recurrence){let o=Uj(a,i.recurrence,e);for(let e of o){let a=new Date(e.getTime()+s);n(e,a)&&t.push(r(i,e,a,!0))}}else n(a,o)&&t.push(r(i,a,o,!1))}return t.sort((e,t)=>e.start.getTime()-t.start.getTime())}),S=(0,t.computed)(()=>{let e=new Map,t=(e,t)=>{let n=yA(e,t?void 0:o.value);return new Date(n.year,n.month-1,n.day)};for(let n of x.value){let r=(0,a.eachDayOfInterval)({start:t(n.start,n.allDay),end:t(n.end,n.allDay)});for(let t of r){let r=bA(t),i=e.get(r);i?i.push(n):e.set(r,[n])}}return e}),C=e=>S.value.get(bA(e))??[],w=e=>C(e).filter(e=>e.allDay||e.isMultiDay),T=e=>C(e).filter(e=>!e.allDay&&!e.isMultiDay),E=(0,t.computed)(()=>{let e=(0,a.startOfWeek)(new Date,{weekStartsOn:i.value});return Array.from({length:7},(t,n)=>(0,a.format)((0,a.addDays)(e,n),`EEE`,{locale:s}))}),D=(0,t.computed)(()=>{let e=Kj.month.range(r.value,i.value),t=(0,a.eachDayOfInterval)({start:e.start,end:e.end}),n=r.value.getMonth(),o=[];for(let e=0;e<t.length;e+=7){let r=t.slice(e,e+7).map(e=>{let t=e.getDay();return{date:e,key:bA(e),isToday:(0,a.isToday)(e),isCurrentMonth:e.getMonth()===n,isWeekend:t===0||t===6,events:C(e)}});o.push({key:r[0].key,days:r})}return o}),O=(0,t.computed)(()=>{if(n.value===`day`)return[(0,a.startOfDay)(r.value)];let e=Kj.week.range(r.value,i.value);return(0,a.eachDayOfInterval)({start:e.start,end:e.end})}),k=(0,t.computed)(()=>Array.from({length:Math.max(0,l.value-c.value)},(e,t)=>c.value+t)),A=(0,t.computed)(()=>(0,a.eachDayOfInterval)({start:(0,a.startOfDay)(r.value),end:(0,a.addDays)((0,a.startOfDay)(r.value),u.value-1)}).map(e=>({date:e,key:bA(e),events:C(e)})).filter(e=>e.events.length>0)),j=(0,t.computed)(()=>{let e=(0,a.startOfYear)(r.value);return Array.from({length:12},(t,n)=>{let r=(0,a.addMonths)(e,n),i=(0,a.endOfMonth)(r),o=x.value.filter(e=>e.start<=i&&e.end>=(0,a.startOfMonth)(r)).length;return{date:r,key:bA(r),label:(0,a.format)(r,`MMM`,{locale:s}),eventCount:o}})}),M={month:e=>(0,a.format)(e,`MMMM yyyy`,{locale:s}),week:e=>{let t=(0,a.startOfWeek)(e,{weekStartsOn:i.value}),n=(0,a.endOfWeek)(e,{weekStartsOn:i.value});return t.getMonth()===n.getMonth()?`${(0,a.format)(t,`MMM d`,{locale:s})} – ${(0,a.format)(n,`d, yyyy`,{locale:s})}`:`${(0,a.format)(t,`MMM d`,{locale:s})} – ${(0,a.format)(n,`MMM d, yyyy`,{locale:s})}`},day:e=>(0,a.format)(e,`EEEE, MMMM d, yyyy`,{locale:s}),agenda:e=>`${(0,a.format)(e,`MMM d`,{locale:s})} – ${(0,a.format)((0,a.addDays)(e,u.value-1),`MMM d, yyyy`,{locale:s})}`,year:e=>(0,a.format)(e,`yyyy`,{locale:s})},N=(0,t.computed)(()=>M[n.value](r.value)),P=e=>o.value?new Intl.DateTimeFormat(`en-US`,{timeZone:o.value,hour:`numeric`,minute:`2-digit`,hour12:!0}).format(e):(0,a.format)(e,`h:mm a`,{locale:s}),F=()=>{r.value=Kj[n.value].step(r.value,1)},ee=()=>{r.value=Kj[n.value].step(r.value,-1)},I=()=>{r.value=new Date},te=e=>{r.value=Gj(e)},ne=e=>{n.value=e},re=async()=>{if(f){m.value=!0,h.value=null;try{p.value=await f.fetchEvents(v.value)}catch(e){h.value=e instanceof Error?e:Error(String(e))}finally{m.value=!1}}},L=async()=>{f?.auth?.authenticate&&(await f.auth.authenticate(),g.value=await f.auth.isAuthenticated?.()??!0,g.value&&await re())},R=async()=>{f?.auth?.signOut&&(await f.auth.signOut(),g.value=!1,p.value=[])},z=e=>{p.value.findIndex(t=>t.id===e.id)===-1?p.value=[...p.value,e]:p.value=p.value.map(t=>t.id===e.id?e:t)};return f&&(0,t.watch)(()=>[v.value.start.getTime(),v.value.end.getTime()],()=>{re()},{immediate:!0}),{view:n,currentDate:r,firstDayOfWeek:i,timeZone:o,dayStartHour:c,dayEndHour:l,agendaDayCount:u,businessHoursOption:d,isLoading:m,error:h,title:N,visibleRange:v,events:x,weekdayNames:E,monthWeeks:D,dayColumns:O,hours:k,agendaDays:A,yearMonths:j,businessHours:_,isConnected:g,provider:f,next:F,prev:ee,today:I,goToDate:te,setView:ne,getEventsForDay:C,getTimedEventsForDay:T,getAllDayEventsForDay:w,addEvent:async e=>{f?.createEvent?z(await f.createEvent(e)):z(e)},updateEvent:async e=>{f?.updateEvent?z(await f.updateEvent(e)):z(e)},removeEvent:async e=>{f?.deleteEvent&&await f.deleteEvent(e),p.value=p.value.filter(t=>t.id!==e)},refresh:re,connect:L,disconnect:R,formatTime:P}}var Jj={key:0,class:`flex flex-wrap items-center justify-between gap-3 print:hidden`},Yj={class:`flex items-center gap-2`},Xj={key:0,class:`flex items-center gap-1`},Zj={key:2,class:`ml-1 text-base font-bold text-main sm:text-lg`},Qj={class:`flex items-center gap-2`},$j={class:`flex flex-col gap-1.5 p-2 text-xs`},eM={class:`rounded bg-surface/60 px-1.5 py-0.5 font-mono font-semibold text-main`},tM={class:`text-muted`},nM={key:3,class:`w-32 sm:w-36`},rM={key:0,class:`flex items-center gap-2 rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-sm text-danger print:hidden`},iM={class:`min-w-0 flex-1 truncate`},aM={class:`w-full overflow-x-auto print:overflow-visible`},oM=`[data-cal-pill]`,sM=(0,t.defineComponent)({__name:`Calendar`,props:{view:{default:`month`},date:{},events:{},size:{default:`md`},firstDayOfWeek:{default:0},timeZone:{},locale:{},provider:{},dayStartHour:{},dayEndHour:{},agendaDayCount:{},businessHours:{type:[Object,Boolean]},availableViews:{default:()=>[`month`,`week`,`day`,`agenda`,`year`]},showToolbar:{type:Boolean,default:!0},showNav:{type:Boolean,default:!0},showToday:{type:Boolean,default:!0},showTitle:{type:Boolean,default:!0},mobileFallback:{type:Boolean,default:!0},editable:{type:Boolean,default:!0},showPopover:{type:Boolean,default:!0},printable:{type:Boolean,default:!0},loading:{type:Boolean,default:!1},error:{default:null},keyboardShortcuts:{type:Boolean,default:!0}},emits:[`update:view`,`update:date`,`event-click`,`date-click`,`view-change`,`event-drag`,`event-resize`,`range-select`,`event-edit`,`event-delete`,`retry`],setup(e,{emit:r}){let i=e,o=r,s=qj({view:i.view,date:i.date,events:()=>i.events??[],firstDayOfWeek:i.firstDayOfWeek,timeZone:i.timeZone,locale:i.locale,provider:i.provider,dayStartHour:i.dayStartHour,dayEndHour:i.dayEndHour,agendaDayCount:i.agendaDayCount,businessHours:i.businessHours});(0,t.watch)(()=>i.view,e=>{e&&e!==s.view.value&&s.setView(e)}),(0,t.watch)(()=>i.date,e=>{e&&s.goToDate(e)}),(0,t.watch)(()=>i.firstDayOfWeek,e=>s.firstDayOfWeek.value=e??0),(0,t.watch)(()=>i.timeZone,e=>s.timeZone.value=e),(0,t.watch)(()=>i.dayStartHour,e=>{e!=null&&(s.dayStartHour.value=Math.max(0,e))}),(0,t.watch)(()=>i.dayEndHour,e=>{e!=null&&(s.dayEndHour.value=Math.min(24,e))}),(0,t.watch)(()=>i.agendaDayCount,e=>{e!=null&&(s.agendaDayCount.value=e)}),(0,t.watch)(()=>i.businessHours,e=>s.businessHoursOption.value=e),(0,t.watch)(s.view,e=>{o(`update:view`,e),o(`view-change`,e)}),(0,t.watch)(s.currentDate,e=>o(`update:date`,e));let l=(0,t.ref)(!1),u=null,d=e=>l.value=e.matches;(0,t.onMounted)(()=>{typeof window>`u`||!window.matchMedia||(u=window.matchMedia(`(max-width: 640px)`),d(u),u.addEventListener(`change`,d))}),(0,t.onBeforeUnmount)(()=>u?.removeEventListener(`change`,d));let f={month:`agenda`,week:`day`,day:`day`,agenda:`agenda`,year:`year`},p=(0,t.computed)(()=>i.mobileFallback&&l.value?f[s.view.value]:s.view.value),m={month:VA,week:aj,day:aj,agenda:mj,year:Sj},h=(0,t.computed)(()=>m[p.value]),g={month:{label:`Month`,icon:`lucide:calendar-days`},week:{label:`Week`,icon:`lucide:calendar-range`},day:{label:`Day`,icon:`lucide:calendar-clock`},agenda:{label:`Agenda`,icon:`lucide:list`},year:{label:`Year`,icon:`lucide:calendar`}},_=(0,t.computed)(()=>i.availableViews.map(e=>({label:g[e].label,value:e}))),v=(0,t.computed)({get:()=>s.view.value,set:e=>{e&&s.setView(e)}}),y=(0,t.ref)(!1),b=(0,t.ref)(null),x=(0,t.ref)(null),S=e=>{let t=e.target;if(t&&typeof t.getBoundingClientRect==`function`){let e=t.getBoundingClientRect();return{getBoundingClientRect:()=>{let n=t.getBoundingClientRect();return n.width||n.height?n:e},contextElement:t}}let n=e.clientX,r=e.clientY;return{getBoundingClientRect:()=>({x:n,y:r,top:r,left:n,right:n,bottom:r,width:0,height:0})}},C=(0,t.computed)(()=>i.editable&&!!b.value?.editable&&!b.value?.isOccurrence),w=(0,t.computed)(()=>{let e=b.value;return e?e.allDay?(0,a.isSameDay)(e.start,e.end)?`All day · ${(0,a.format)(e.start,`EEE, MMM d`)}`:`${(0,a.format)(e.start,`MMM d`)} – ${(0,a.format)(e.end,`MMM d, yyyy`)}`:`${(0,a.format)(e.start,`EEE, MMM d`)} · ${s.formatTime(e.start)} – ${s.formatTime(e.end)}`:``}),T=(e,t)=>{o(`event-click`,e,t),i.showPopover&&(b.value=e,x.value=S(t),y.value=!0)},E=e=>{o(`date-click`,e)},D=e=>{s.goToDate(e),s.setView(`month`)},O=(e,t)=>{let n={...e.source,start:t.start,end:t.end};i.provider?.updateEvent&&s.updateEvent(n)},k=(e,t)=>{O(e,t),o(`event-drag`,e,t)},A=(e,t)=>{O(e,t),o(`event-resize`,e,t)},j=e=>o(`range-select`,e),M=e=>{y.value=!1,o(`event-edit`,e)},N=e=>{y.value=!1,i.provider?.deleteEvent&&s.removeEvent(e.id),o(`event-delete`,e)},P=(0,t.ref)(null),F=()=>{if(typeof window>`u`)return;let e=()=>{document.body.classList.remove(`mo-calendar-printing`),P.value?.classList.remove(`mo-calendar-print-target`),window.removeEventListener(`afterprint`,e)};document.body.classList.add(`mo-calendar-printing`),P.value?.classList.add(`mo-calendar-print-target`),window.addEventListener(`afterprint`,e),window.print()},ee=(0,t.computed)(()=>!!i.provider?.auth?.authenticate),I=(0,t.computed)(()=>i.loading||s.isLoading.value),te=(0,t.computed)(()=>s.error.value?s.error.value:i.error?i.error instanceof Error?i.error:Error(i.error):null),ne=()=>{s.refresh(),o(`retry`)},re=e=>{let t=P.value;if(!t)return;let n=Array.from(t.querySelectorAll(oM)),r=n.indexOf(document.activeElement);if(r===-1)return;e.preventDefault();let i=e.key===`ArrowRight`||e.key===`ArrowDown`?1:-1;n[Math.min(n.length-1,Math.max(0,r+i))]?.focus()},L=e=>{i.availableViews.includes(e)&&s.setView(e)},R={t:()=>s.today(),arrowleft:()=>s.prev(),arrowright:()=>s.next(),m:()=>L(`month`),w:()=>L(`week`),d:()=>L(`day`)},z=e=>{let t=e.target;if(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable)||e.ctrlKey||e.metaKey||e.altKey)return;let n=P.value;if(!n||!n.contains(document.activeElement))return;if(document.activeElement?.matches?.(oM)&&[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`].includes(e.key)){re(e);return}if(!i.keyboardShortcuts)return;let r=R[e.key.toLowerCase()];r&&(e.preventDefault(),r())},ie=()=>{P.value?.contains(document.activeElement)||P.value?.focus()};(0,t.onMounted)(()=>document.addEventListener(`keydown`,z)),(0,t.onBeforeUnmount)(()=>document.removeEventListener(`keydown`,z));let ae=[{keys:`T`,label:`Today`},{keys:`← / →`,label:`Previous / Next`},{keys:`M / W / D`,label:`Month / Week / Day`}];return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{ref_key:`rootRef`,ref:P,tabindex:`-1`,class:`flex w-full flex-col gap-3 focus:outline-none`,onPointerdown:ie},[(0,t.renderSlot)(r.$slots,`toolbar`,{cal:(0,t.unref)(s),title:(0,t.unref)(s).title.value,view:(0,t.unref)(s).view.value,next:(0,t.unref)(s).next,prev:(0,t.unref)(s).prev,today:(0,t.unref)(s).today,setView:(0,t.unref)(s).setView},()=>[e.showToolbar?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Jj,[(0,t.createElementVNode)(`div`,Yj,[e.showNav?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Xj,[(0,t.createVNode)(c,{icon:`lucide:chevron-left`,variant:`outline`,severity:`secondary`,size:e.size===`xs`?`xs`:`sm`,"aria-label":`Previous`,onClick:i[0]||=e=>(0,t.unref)(s).prev()},null,8,[`size`]),(0,t.createVNode)(c,{icon:`lucide:chevron-right`,variant:`outline`,severity:`secondary`,size:e.size===`xs`?`xs`:`sm`,"aria-label":`Next`,onClick:i[1]||=e=>(0,t.unref)(s).next()},null,8,[`size`])])):(0,t.createCommentVNode)(``,!0),e.showToday?((0,t.openBlock)(),(0,t.createBlock)(c,{key:1,label:`Today`,variant:`outline`,severity:`secondary`,size:e.size===`xs`?`xs`:`sm`,onClick:i[2]||=e=>(0,t.unref)(s).today()},null,8,[`size`])):(0,t.createCommentVNode)(``,!0),e.showTitle?((0,t.openBlock)(),(0,t.createElementBlock)(`h2`,Zj,(0,t.toDisplayString)((0,t.unref)(s).title.value),1)):(0,t.createCommentVNode)(``,!0),I.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.Icon),{key:3,icon:`lucide:loader-circle`,class:`h-4 w-4 animate-spin text-muted`})):(0,t.createCommentVNode)(``,!0)]),(0,t.createElementVNode)(`div`,Qj,[e.keyboardShortcuts?((0,t.openBlock)(),(0,t.createBlock)(pe,{key:0,placement:`bottom-end`,size:`xs`,trigger:`click`,"show-arrow":!1},{trigger:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{icon:`lucide:keyboard`,variant:`outline`,severity:`secondary`,size:e.size===`xs`?`xs`:`sm`,"aria-label":`Keyboard shortcuts`},null,8,[`size`])]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,$j,[i[7]||=(0,t.createElementVNode)(`div`,{class:`pb-1 font-bold tracking-wider text-muted uppercase`},` Keyboard shortcuts `,-1),((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(ae,e=>(0,t.createElementVNode)(`div`,{key:e.label,class:`flex items-center gap-2`},[(0,t.createElementVNode)(`span`,eM,(0,t.toDisplayString)(e.keys),1),(0,t.createElementVNode)(`span`,tM,(0,t.toDisplayString)(e.label),1)])),64))])]),_:1})):(0,t.createCommentVNode)(``,!0),e.printable?((0,t.openBlock)(),(0,t.createBlock)(c,{key:1,icon:`lucide:printer`,variant:`outline`,severity:`secondary`,size:e.size===`xs`?`xs`:`sm`,"aria-label":`Print calendar`,onClick:i[3]||=e=>F()},null,8,[`size`])):(0,t.createCommentVNode)(``,!0),ee.value?((0,t.openBlock)(),(0,t.createBlock)(c,{key:2,label:(0,t.unref)(s).isConnected.value?`Disconnect`:`Connect`,icon:(0,t.unref)(s).isConnected.value?`lucide:unplug`:`lucide:plug`,variant:`outline`,severity:(0,t.unref)(s).isConnected.value?`secondary`:`primary`,size:e.size===`xs`?`xs`:`sm`,onClick:i[4]||=e=>(0,t.unref)(s).isConnected.value?(0,t.unref)(s).disconnect():(0,t.unref)(s).connect()},null,8,[`label`,`icon`,`severity`,`size`])):(0,t.createCommentVNode)(``,!0),e.availableViews.length>1?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,nM,[(0,t.createVNode)(ht,{modelValue:v.value,"onUpdate:modelValue":i[5]||=e=>v.value=e,options:_.value,size:e.size===`xs`?`xs`:`sm`,searchable:!1,"show-clear":!1,"can-deselect":!1,"selection-variant":`highlight`,"aria-label":`Change view`},null,8,[`modelValue`,`options`,`size`])])):(0,t.createCommentVNode)(``,!0)])])):(0,t.createCommentVNode)(``,!0)]),te.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,rM,[(0,t.createVNode)((0,t.unref)(n.Icon),{icon:`lucide:alert-triangle`,class:`h-4 w-4 shrink-0`}),(0,t.createElementVNode)(`span`,iM,(0,t.toDisplayString)(te.value.message),1),(0,t.createElementVNode)(`button`,{type:`button`,class:`cursor-pointer font-semibold underline hover:no-underline`,onClick:ne},` Retry `)])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,aM,[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(h.value),{cal:(0,t.unref)(s),size:e.size,editable:e.editable,onEventClick:T,onDateClick:E,onMonthClick:D,onEventDrag:k,onEventResize:A,onRangeSelect:j},(0,t.createSlots)({_:2},[r.$slots.event?{name:`event`,fn:(0,t.withCtx)(e=>[(0,t.renderSlot)(r.$slots,`event`,(0,t.normalizeProps)((0,t.guardReactiveProps)(e)))]),key:`0`}:void 0,r.$slots.dayCell?{name:`dayCell`,fn:(0,t.withCtx)(e=>[(0,t.renderSlot)(r.$slots,`dayCell`,(0,t.normalizeProps)((0,t.guardReactiveProps)(e)))]),key:`1`}:void 0,r.$slots.empty?{name:`empty`,fn:(0,t.withCtx)(()=>[(0,t.renderSlot)(r.$slots,`empty`)]),key:`2`}:void 0]),1064,[`cal`,`size`,`editable`]))]),e.showPopover?((0,t.openBlock)(),(0,t.createBlock)(Lj,{key:1,modelValue:y.value,"onUpdate:modelValue":i[6]||=e=>y.value=e,reference:x.value,event:b.value,"when-text":w.value,editable:C.value,"can-delete":e.editable,mobile:l.value,size:e.size,boundary:`clippingAncestors`,onEdit:M,onDelete:N},(0,t.createSlots)({_:2},[r.$slots.eventPopover?{name:`default`,fn:(0,t.withCtx)(e=>[(0,t.renderSlot)(r.$slots,`eventPopover`,(0,t.normalizeProps)((0,t.guardReactiveProps)(e)))]),key:`0`}:void 0]),1032,[`modelValue`,`reference`,`event`,`when-text`,`editable`,`can-delete`,`mobile`,`size`])):(0,t.createCommentVNode)(``,!0)],544))}}),cM=e=>e.replace(/\r\n/g,`
187
+ `).replace(/\n[ \t]/g,``).split(`
188
+ `).filter(Boolean),lM=e=>e.replace(/\\n/gi,`
189
+ `).replace(/\\,/g,`,`).replace(/\\;/g,`;`).replace(/\\\\/g,`\\`),uM=e=>{let t=e.indexOf(`:`),n=e.slice(0,t),r=e.slice(t+1),[i,...a]=n.split(`;`),o={};for(let e of a){let t=e.indexOf(`=`);t!==-1&&(o[e.slice(0,t).toUpperCase()]=e.slice(t+1))}return{name:i.toUpperCase(),params:o,value:r}},dM=e=>{let t=e.value.trim(),n=e.params.VALUE===`DATE`||/^\d{8}$/.test(t),r=Number(t.slice(0,4)),i=Number(t.slice(4,6))-1,a=Number(t.slice(6,8));if(n)return{date:new Date(r,i,a),allDay:!0};let o=Number(t.slice(9,11)),s=Number(t.slice(11,13)),c=Number(t.slice(13,15))||0;return t.endsWith(`Z`)?{date:new Date(Date.UTC(r,i,a,o,s,c)),allDay:!1}:{date:new Date(r,i,a,o,s,c),allDay:!1}},fM={SU:`su`,MO:`mo`,TU:`tu`,WE:`we`,TH:`th`,FR:`fr`,SA:`sa`},pM=e=>{let t={};for(let n of e.split(`;`)){let e=n.indexOf(`=`);e!==-1&&(t[n.slice(0,e).toUpperCase()]=n.slice(e+1))}let n=t.FREQ?.toLowerCase();if(n!==`daily`&&n!==`weekly`&&n!==`monthly`&&n!==`yearly`)return;let r={freq:n};return t.INTERVAL&&(r.interval=Number(t.INTERVAL)),t.COUNT&&(r.count=Number(t.COUNT)),t.UNTIL&&(r.until=dM({name:`UNTIL`,params:{},value:t.UNTIL}).date),t.BYDAY&&(r.byWeekday=t.BYDAY.split(`,`).map(e=>fM[e.replace(/^[+-]?\d+/,``).toUpperCase()]).filter(Boolean)),t.BYMONTHDAY&&(r.byMonthday=t.BYMONTHDAY.split(`,`).map(Number).filter(Boolean)),r};function mM(e){let t=cM(e),n=[],r={},i=!1,a=0;for(let e of t){let t=uM(e);if(t.name===`BEGIN`&&t.value===`VEVENT`){i=!0,r={};continue}if(t.name===`END`&&t.value===`VEVENT`){r.start&&(r._exdate?.length&&r.recurrence&&(r.recurrence={...r.recurrence,exceptions:r._exdate}),delete r._exdate,n.push({id:r.id??`ics-${a++}`,title:r.title??`(untitled)`,start:r.start,end:r.end,allDay:r.allDay,location:r.location,description:r.description,recurrence:r.recurrence,severity:r.severity})),i=!1;continue}if(i)switch(t.name){case`UID`:r.id=t.value;break;case`SUMMARY`:r.title=lM(t.value);break;case`DESCRIPTION`:r.description=lM(t.value);break;case`LOCATION`:r.location=lM(t.value);break;case`DTSTART`:{let e=dM(t);r.start=e.date,r.allDay=e.allDay;break}case`DTEND`:r.end=dM(t).date;break;case`RRULE`:r.recurrence=pM(t.value);break;case`EXDATE`:r._exdate=[...r._exdate??[],dM(t).date];break;case`CATEGORIES`:r.severity=hM(t.value);break}}return n}var hM=e=>{let t=e.toLowerCase(),n={success:`success`,green:`success`,warning:`warning`,orange:`warning`,danger:`danger`,red:`danger`,info:`info`,blue:`info`,secondary:`secondary`,gray:`secondary`};for(let e in n)if(t.includes(e))return n[e]},gM=(e,t=2)=>String(e).padStart(t,`0`),_M=(e,t)=>t?`${e.getFullYear()}${gM(e.getMonth()+1)}${gM(e.getDate())}`:`${e.getUTCFullYear()}${gM(e.getUTCMonth()+1)}${gM(e.getUTCDate())}T${gM(e.getUTCHours())}${gM(e.getUTCMinutes())}${gM(e.getUTCSeconds())}Z`,vM=e=>e.replace(/\\/g,`\\\\`).replace(/;/g,`\\;`).replace(/,/g,`\\,`).replace(/\n/g,`\\n`),yM={su:`SU`,mo:`MO`,tu:`TU`,we:`WE`,th:`TH`,fr:`FR`,sa:`SA`},bM=e=>{let t=[`FREQ=${e.freq.toUpperCase()}`];if(e.interval&&e.interval>1&&t.push(`INTERVAL=${e.interval}`),e.count&&t.push(`COUNT=${e.count}`),e.until){let n=e.until instanceof Date?e.until:new Date(e.until);t.push(`UNTIL=${_M(n,!1)}`)}if(e.byWeekday?.length){let n=e.byWeekday.map(e=>typeof e==`number`?[`SU`,`MO`,`TU`,`WE`,`TH`,`FR`,`SA`][e]:yM[e]);t.push(`BYDAY=${n.join(`,`)}`)}return e.byMonthday?.length&&t.push(`BYMONTHDAY=${e.byMonthday.join(`,`)}`),t.join(`;`)},xM=e=>{if(e.length<=75)return e;let t=[],n=e;for(t.push(n.slice(0,75)),n=n.slice(75);n.length>74;)t.push(` `+n.slice(0,74)),n=n.slice(74);return n&&t.push(` `+n),t.join(`\r
190
+ `)};function SM(e,t={}){let n=e=>e instanceof Date?e:new Date(e),r=[`BEGIN:VCALENDAR`,`VERSION:2.0`,`PRODID:${t.prodId??`-//Midnight Owl UI//Calendar//EN`}`,`CALSCALE:GREGORIAN`];t.calName&&r.push(`X-WR-CALNAME:${vM(t.calName)}`);let i=_M(new Date,!1);for(let t of e){let e=n(t.start),a=t.end?n(t.end):void 0;r.push(`BEGIN:VEVENT`),r.push(`UID:${t.id}`),r.push(`DTSTAMP:${i}`),r.push(t.allDay?`DTSTART;VALUE=DATE:${_M(e,!0)}`:`DTSTART:${_M(e,!1)}`),a&&r.push(t.allDay?`DTEND;VALUE=DATE:${_M(a,!0)}`:`DTEND:${_M(a,!1)}`),r.push(`SUMMARY:${vM(t.title)}`),t.location&&r.push(`LOCATION:${vM(t.location)}`),t.description&&r.push(`DESCRIPTION:${vM(t.description)}`),t.severity&&r.push(`CATEGORIES:${t.severity}`),t.recurrence&&r.push(`RRULE:${bM(t.recurrence)}`),r.push(`END:VEVENT`)}return r.push(`END:VCALENDAR`),r.map(xM).join(`\r
191
+ `)}function CM(e){return{name:e.name??`ICS`,async fetchEvents(t){return mM(typeof e.source==`function`?await e.source():e.source).filter(e=>{if(e.recurrence)return!0;let n=e.start instanceof Date?e.start:new Date(e.start),r=e.end?e.end instanceof Date?e.end:new Date(e.end):n;return n<=t.end&&r>=t.start})}}}var wM=`https://www.googleapis.com/calendar/v3`,TM=e=>e.date?new Date(`${e.date}T00:00:00`):new Date(e.dateTime),EM=e=>{let t=e?.find(e=>e.startsWith(`RRULE:`));if(!t)return;let n={};for(let e of t.replace(`RRULE:`,``).split(`;`)){let t=e.indexOf(`=`);t!==-1&&(n[e.slice(0,t).toUpperCase()]=e.slice(t+1))}let r=n.FREQ?.toLowerCase();if(r!==`daily`&&r!==`weekly`&&r!==`monthly`&&r!==`yearly`)return;let i={freq:r};if(n.INTERVAL&&(i.interval=Number(n.INTERVAL)),n.COUNT&&(i.count=Number(n.COUNT)),n.UNTIL){let e=n.UNTIL;i.until=new Date(Date.UTC(Number(e.slice(0,4)),Number(e.slice(4,6))-1,Number(e.slice(6,8)),Number(e.slice(9,11))||0,Number(e.slice(11,13))||0))}if(n.BYDAY){let e={SU:`su`,MO:`mo`,TU:`tu`,WE:`we`,TH:`th`,FR:`fr`,SA:`sa`};i.byWeekday=n.BYDAY.split(`,`).map(t=>e[t.replace(/^[+-]?\d+/,``).toUpperCase()]).filter(Boolean)}return i},DM=e=>{let t=!!e.start.date,n=TM(e.end);return t&&n.setDate(n.getDate()-1),{id:e.id,title:e.summary??`(no title)`,start:TM(e.start),end:n,allDay:t,location:e.location,description:e.description,recurrence:EM(e.recurrence),meta:{source:`google`}}},OM=e=>{let t=e=>e instanceof Date?e:new Date(e),n=t(e.start),r=e.end?t(e.end):n,i=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;return{summary:e.title,description:e.description,location:e.location,start:e.allDay?{date:i(n)}:{dateTime:n.toISOString()},end:e.allDay?{date:i((e=>{let t=new Date(e);return t.setDate(t.getDate()+1),t})(r))}:{dateTime:r.toISOString()}}};function kM(e){let t=encodeURIComponent(e.calendarId??`primary`),n=async(t,n={})=>{let r=await e.getAccessToken(),i=await fetch(`${wM}${t}`,{...n,headers:{Authorization:`Bearer ${r}`,"Content-Type":`application/json`,...n.headers}});if(!i.ok)throw Error(`[google-calendar] ${n.method??`GET`} ${t} → ${i.status}`);return i};return{name:e.name??`Google Calendar`,auth:e.auth,async fetchEvents(e){return((await(await n(`/calendars/${t}/events?${new URLSearchParams({timeMin:e.start.toISOString(),timeMax:e.end.toISOString(),singleEvents:`false`,maxResults:`2500`}).toString()}`)).json()).items??[]).filter(e=>e.status!==`cancelled`&&e.start).map(DM)},async createEvent(e){return DM(await(await n(`/calendars/${t}/events`,{method:`POST`,body:JSON.stringify(OM(e))})).json())},async updateEvent(e){return DM(await(await n(`/calendars/${t}/events/${encodeURIComponent(e.id)}`,{method:`PATCH`,body:JSON.stringify(OM(e))})).json())},async deleteEvent(e){await n(`/calendars/${t}/events/${encodeURIComponent(e)}`,{method:`DELETE`})}}}var AM={colors:{primary:{50:`#f0f8ff`,100:`#dff0ff`,200:`#b8e2ff`,300:`#79c8ff`,400:`#32abff`,500:`#0192fe`,600:`#0074d4`,700:`#005caa`,800:`#044e8c`,900:`#0a4172`,950:`#07294b`},secondary:{50:`#f8fafc`,100:`#f1f5f9`,200:`#e2e8f0`,300:`#cbd5e1`,400:`#94a3b8`,500:`#64748b`,600:`#475569`,700:`#26354d`,800:`#11213b`,900:`#0b1730`,950:`#060d1d`},success:{50:`#ecfdf5`,100:`#d0f7e4`,200:`#a3efca`,300:`#6ce0ac`,400:`#2fcb8c`,500:`#059e6b`,600:`#058659`,700:`#066b49`,800:`#07543b`,900:`#074632`,950:`#02281c`},warning:{50:`#fff8eb`,100:`#fdecc8`,200:`#fbd88c`,300:`#f8be4f`,400:`#f0a121`,500:`#e08a09`,600:`#bd6e06`,700:`#975209`,800:`#7c420e`,900:`#68370f`,950:`#3c1c03`},danger:{50:`#fff1f3`,100:`#ffe0e6`,200:`#fdc7d2`,300:`#fa9fb2`,400:`#f56b88`,500:`#e11d48`,600:`#c4143b`,700:`#a31232`,800:`#88142f`,900:`#74152c`,950:`#410814`},info:{50:`#ecfeff`,100:`#cffafe`,200:`#a5f3fc`,300:`#67e8f9`,400:`#22d3ee`,500:`#06b6d4`,600:`#0891b2`,700:`#0e7490`,800:`#155e75`,900:`#164e63`,950:`#083344`},surface:{50:`#f8fafc`,100:`#f1f5f9`,200:`#e2e8f0`,300:`#cbd5e1`,400:`#94a3b8`,500:`#64748b`,600:`#475569`,700:`#26354d`,800:`#11213b`,900:`#0b1730`,950:`#060d1d`}},light:{primary:`var(--color-primary-600)`,secondary:`var(--color-secondary-600)`,success:`var(--color-success-600)`,warning:`var(--color-warning-600)`,danger:`var(--color-danger-600)`,info:`var(--color-info-600)`,background:{main:`#f6f9fc`,content:`#ffffff`,surface:`#eaf2f8`,muted:`var(--color-surface-200)`,inverse:`var(--color-surface-900)`},text:{main:`var(--color-surface-700)`,content:`var(--color-surface-600)`,surface:`var(--color-surface-500)`,muted:`var(--color-surface-400)`,inverse:`var(--color-surface-50)`,onPrimary:`var(--color-surface-50)`,onSecondary:`var(--color-surface-50)`,onSuccess:`#ffffff`,onWarning:`var(--color-warning-50)`,onDanger:`#ffffff`,onInfo:`#ffffff`,onSurface:`var(--color-surface-900)`},border:{main:`var(--color-surface-300)`,content:`var(--color-surface-300)`,surface:`var(--color-surface-400)`,muted:`var(--color-surface-200)`,inverse:`var(--color-surface-900)`}},dark:{primary:`var(--color-primary-600)`,secondary:`var(--color-secondary-600)`,success:`var(--color-success-600)`,warning:`var(--color-warning-600)`,danger:`var(--color-danger-600)`,info:`var(--color-info-600)`,background:{main:`#050b13`,content:`#0b1521`,surface:`#142131`,muted:`var(--color-surface-700)`,inverse:`var(--color-surface-50)`},text:{main:`var(--color-surface-200)`,content:`var(--color-surface-300)`,surface:`var(--color-surface-500)`,muted:`var(--color-surface-400)`,inverse:`var(--color-surface-950)`,onPrimary:`var(--color-surface-50)`,onSecondary:`var(--color-surface-50)`,onSuccess:`var(--color-success-50)`,onWarning:`var(--color-warning-50)`,onDanger:`var(--color-danger-50)`,onInfo:`var(--color-info-50)`,onSurface:`var(--color-surface-50)`},border:{main:`var(--color-surface-700)`,content:`var(--color-surface-700)`,surface:`var(--color-surface-600)`,muted:`var(--color-surface-800)`,inverse:`#ffffff`}},layout:{fontFamily:{sans:`Inter, system-ui, -apple-system, sans-serif`,mono:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`},fontSize:{xs:`0.75rem`,sm:`0.875rem`,base:`1rem`,lg:`1.125rem`,xl:`1.25rem`,"2xl":`1.5rem`,"3xl":`1.875rem`},lineHeight:{none:`1`,tight:`1.25`,normal:`1.5`,loose:`2`},fontWeight:{light:`300`,regular:`400`,medium:`500`,semibold:`600`,bold:`700`},spacing:{xs:`0.25rem`,sm:`0.5rem`,md:`1rem`,lg:`1.5rem`,xl:`2rem`,"2xl":`3rem`},borderRadius:{none:`0px`,sm:`0.25rem`,md:`0.375rem`,lg:`0.5rem`,xl:`0.75rem`,full:`9999px`},borderWidth:{default:`1px`,marker:`2px`,thick:`4px`},boxShadow:{none:`none`,xs:`0 1px 2px 0 rgb(15 23 42 / 0.06)`,sm:`0 1px 3px 0 rgb(15 23 42 / 0.08), 0 1px 2px -1px rgb(15 23 42 / 0.06)`,md:`0 4px 8px -2px rgb(15 23 42 / 0.1), 0 2px 4px -2px rgb(15 23 42 / 0.06)`,lg:`0 16px 28px -6px rgb(15 23 42 / 0.18), 0 6px 12px -6px rgb(15 23 42 / 0.12)`,xl:`0 32px 56px -12px rgb(15 23 42 / 0.28), 0 12px 24px -10px rgb(15 23 42 / 0.18)`}}};function jM(e,t){let n={...e,...t};for(let r of Object.keys(t))t[r]instanceof Object&&r in e&&(n[r]=jM(e[r],t[r]));return n}function MM(e,t=AM){let n={};for(let r of Object.keys(e)){let i=e[r],a=t?.[r];if(i&&typeof i==`object`&&!Array.isArray(i)&&a&&typeof a==`object`){let e=MM(i,a);Object.keys(e).length>0&&(n[r]=e)}else i!==a&&(n[r]=i)}return n}function NM(e={}){let t=jM(AM,e),n=`:root {
192
+ `;n+=` /* RAW COLOR SCALES */
193
+ `,Object.entries(t.colors).forEach(([e,t])=>{Object.entries(t).forEach(([t,r])=>{n+=` --color-${e}-${t}: ${r};\n`})}),n+=`
194
+ /* LAYOUT TOKENS */
195
+ `,Object.entries(t.layout.fontFamily).forEach(([e,t])=>n+=` --ow-font-${e}: ${t};\n`),Object.entries(t.layout.fontSize).forEach(([e,t])=>n+=` --fs-${e}: ${t};\n`),Object.entries(t.layout.lineHeight).forEach(([e,t])=>n+=` --lh-${e}: ${t};\n`),Object.entries(t.layout.fontWeight).forEach(([e,t])=>n+=` --fw-${e}: ${t};\n`),Object.entries(t.layout.spacing).forEach(([e,t])=>n+=` --space-${e}: ${t};\n`),Object.entries(t.layout.borderRadius).forEach(([e,t])=>n+=` --ow-radius-${e}: ${t};\n`),Object.entries(t.layout.borderWidth).forEach(([e,t])=>n+=` --bw-${e}: ${t};\n`),Object.entries(t.layout.boxShadow).forEach(([e,t])=>n+=` --ow-shadow-${e}: ${t};\n`);let r=e=>`
196
+ /* Unified Brand Tokens */
197
+ --theme-primary: ${e.primary};
198
+ --theme-secondary: ${e.secondary};
199
+ --theme-success: ${e.success};
200
+ --theme-warning: ${e.warning};
201
+ --theme-danger: ${e.danger};
202
+ --theme-info: ${e.info};
203
+
204
+ /* Structural Tokens */
205
+ --bg-main: ${e.background.main};
206
+ --bg-content: ${e.background.content};
207
+ --bg-surface: ${e.background.surface};
208
+ --bg-muted: ${e.background.muted};
209
+ --bg-inverse: ${e.background.inverse};
210
+
211
+ --text-main: ${e.text.main};
212
+ --text-content: ${e.text.content};
213
+ --text-surface: ${e.text.surface};
214
+ --text-muted: ${e.text.muted};
215
+ --text-inverse: ${e.text.inverse};
216
+
217
+ --text-on-primary: ${e.text.onPrimary};
218
+ --text-on-secondary: ${e.text.onSecondary};
219
+ --text-on-success: ${e.text.onSuccess};
220
+ --text-on-warning: ${e.text.onWarning};
221
+ --text-on-danger: ${e.text.onDanger};
222
+ --text-on-info: ${e.text.onInfo};
223
+ --text-on-surface: ${e.text.onSurface};
224
+
225
+ --border-main: ${e.border.main};
226
+ --border-content: ${e.border.content};
227
+ --border-surface: ${e.border.surface};
228
+ --border-muted: ${e.border.muted};
229
+ --border-inverse: ${e.border.inverse};
230
+ `;return n+=r(t.light),n+=`}
231
+
232
+ [data-theme="dark"], .dark {
233
+ `,n+=r(t.dark),n+=`}
234
+ `,n}var PM={prefix:`lucide`,width:24,height:24,icons:JSON.parse(`{"heading-1":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M4 12h8m-8 6V6m8 12V6m5 6l3-2v8\\"/>"},"heading-2":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M4 12h8m-8 6V6m8 12V6m9 12h-4c0-4 4-3 4-6c0-1.5-2-2.5-4-1\\"/>"},"heading-3":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M4 12h8m-8 6V6m8 12V6m5.5 4.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2m-2 3.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2\\"/>"},"heading-4":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M12 18V6m5 4v3a1 1 0 0 0 1 1h3m0-4v8M4 12h8m-8 6V6\\"/>"},"heading-5":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M4 12h8m-8 6V6m8 12V6m5 7v-3h4m-4 7.7c.4.2.8.3 1.3.3c1.5 0 2.7-1.1 2.7-2.5S19.8 13 18.3 13H17\\"/>"},"heading-6":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><path d=\\"M4 12h8m-8 6V6m8 12V6\\"/><circle cx=\\"19\\" cy=\\"16\\" r=\\"2\\"/><path d=\\"M20 10c-2 2-3 3.5-3 6\\"/></g>"},"loader-circle":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M21 12a9 9 0 1 1-6.219-8.56\\"/>"},"image":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><rect width=\\"18\\" height=\\"18\\" x=\\"3\\" y=\\"3\\" rx=\\"2\\" ry=\\"2\\"/><circle cx=\\"9\\" cy=\\"9\\" r=\\"2\\"/><path d=\\"m21 15l-3.086-3.086a2 2 0 0 0-2.828 0L6 21\\"/></g>"},"image-off":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><path d=\\"m2 2l20 20M10.41 10.41a2 2 0 1 1-2.83-2.83m5.92 5.92L6 21m12-9l3 3\\"/><path d=\\"M3.59 3.59A2 2 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59M21 15V5a2 2 0 0 0-2-2H9\\"/></g>"},"zoom-out":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><circle cx=\\"11\\" cy=\\"11\\" r=\\"8\\"/><path d=\\"m21 21l-4.35-4.35M8 11h6\\"/></g>"},"zoom-in":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><circle cx=\\"11\\" cy=\\"11\\" r=\\"8\\"/><path d=\\"m21 21l-4.35-4.35M11 8v6m-3-3h6\\"/></g>"},"x":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M18 6L6 18M6 6l12 12\\"/>"},"chevrons-left":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"m11 17l-5-5l5-5m7 10l-5-5l5-5\\"/>"},"chevron-left":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"m15 18l-6-6l6-6\\"/>"},"chevron-right":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"m9 18l6-6l-6-6\\"/>"},"chevrons-right":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"m6 17l5-5l-5-5m7 10l5-5l-5-5\\"/>"},"inbox":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><path d=\\"M22 12h-6l-2 3h-4l-2-3H2\\"/><path d=\\"M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11\\"/></g>"},"chevron-up":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"m18 15l-6-6l-6 6\\"/>"},"chevron-down":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"m6 9l6 6l6-6\\"/>"},"grip-vertical":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><circle cx=\\"9\\" cy=\\"12\\" r=\\"1\\"/><circle cx=\\"9\\" cy=\\"5\\" r=\\"1\\"/><circle cx=\\"9\\" cy=\\"19\\" r=\\"1\\"/><circle cx=\\"15\\" cy=\\"12\\" r=\\"1\\"/><circle cx=\\"15\\" cy=\\"5\\" r=\\"1\\"/><circle cx=\\"15\\" cy=\\"19\\" r=\\"1\\"/></g>"},"search-x":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><path d=\\"m13.5 8.5l-5 5m0-5l5 5\\"/><circle cx=\\"11\\" cy=\\"11\\" r=\\"8\\"/><path d=\\"m21 21l-4.3-4.3\\"/></g>"},"plus":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M5 12h14m-7-7v14\\"/>"},"square-minus":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><rect width=\\"18\\" height=\\"18\\" x=\\"3\\" y=\\"3\\" rx=\\"2\\"/><path d=\\"M8 12h8\\"/></g>"},"square-check-big":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><path d=\\"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344\\"/><path d=\\"m9 11l3 3L22 4\\"/></g>"},"square":{"body":"<rect width=\\"18\\" height=\\"18\\" x=\\"3\\" y=\\"3\\" fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" rx=\\"2\\"/>"},"circle-alert":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><circle cx=\\"12\\" cy=\\"12\\" r=\\"10\\"/><path d=\\"M12 8v4m0 4h.01\\"/></g>"},"calendar":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><path d=\\"M8 2v4m8-4v4\\"/><rect width=\\"18\\" height=\\"18\\" x=\\"3\\" y=\\"4\\" rx=\\"2\\"/><path d=\\"M3 10h18\\"/></g>"},"arrow-right":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M5 12h14m-7-7l7 7l-7 7\\"/>"},"arrow-down":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M12 5v14m7-7l-7 7l-7-7\\"/>"},"clock":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><circle cx=\\"12\\" cy=\\"12\\" r=\\"10\\"/><path d=\\"M12 6v6l4 2\\"/></g>"},"cloud-upload":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><path d=\\"M12 13v8m-8-6.101A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242\\"/><path d=\\"m8 17l4-4l4 4\\"/></g>"},"upload":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M12 3v12m5-7l-5-5l-5 5m14 7v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\\"/>"},"paperclip":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"m16 6l-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551\\"/>"},"file":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><path d=\\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\\"/><path d=\\"M14 2v5a1 1 0 0 0 1 1h5\\"/></g>"},"circle-check":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><circle cx=\\"12\\" cy=\\"12\\" r=\\"10\\"/><path d=\\"m9 12l2 2l4-4\\"/></g>"},"trash-2":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M10 11v6m4-6v6m5-11v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\\"/>"},"eye-off":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><path d=\\"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575a1 1 0 0 1 0 .696a10.8 10.8 0 0 1-1.444 2.49m-6.41-.679a3 3 0 0 1-4.242-4.242\\"/><path d=\\"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 4.446-5.143M2 2l20 20\\"/></g>"},"eye":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><path d=\\"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0\\"/><circle cx=\\"12\\" cy=\\"12\\" r=\\"3\\"/></g>"},"circle-dot":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><circle cx=\\"12\\" cy=\\"12\\" r=\\"10\\"/><circle cx=\\"12\\" cy=\\"12\\" r=\\"1\\"/></g>"},"circle":{"body":"<circle cx=\\"12\\" cy=\\"12\\" r=\\"10\\" fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"/>"},"text-align-start":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M21 5H3m12 7H3m14 7H3\\"/>"},"text-align-center":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M21 5H3m14 7H7m12 7H5\\"/>"},"text-align-end":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M21 5H3m18 7H9m12 7H7\\"/>"},"text-align-justify":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M3 5h18M3 12h18M3 19h18\\"/>"},"bold":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8\\"/>"},"italic":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M19 4h-9m4 16H5M15 4L9 20\\"/>"},"underline":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M6 4v6a6 6 0 0 0 12 0V4M4 20h16\\"/>"},"strikethrough":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M16 4H9a3 3 0 0 0-2.83 4M14 12a4 4 0 0 1 0 8H6m-2-8h16\\"/>"},"highlighter":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><path d=\\"m9 11l-6 6v3h9l3-3\\"/><path d=\\"m22 12l-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4\\"/></g>"},"code":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"m16 18l6-6l-6-6M8 6l-6 6l6 6\\"/>"},"list":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M3 5h.01M3 12h.01M3 19h.01M8 5h13M8 12h13M8 19h13\\"/>"},"list-ordered":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M11 5h10m-10 7h10m-10 7h10M4 4h1v5M4 9h2m.5 11H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02\\"/>"},"quote":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1a6 6 0 0 0 6-6V5a2 2 0 0 0-2-2zM5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1a6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z\\"/>"},"square-code":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><path d=\\"m10 9l-3 3l3 3m4 0l3-3l-3-3\\"/><rect width=\\"18\\" height=\\"18\\" x=\\"3\\" y=\\"3\\" rx=\\"2\\"/></g>"},"link":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><path d=\\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\\"/><path d=\\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\\"/></g>"},"separator-horizontal":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"m16 16l-4 4l-4-4m-5-4h18M8 8l4-4l4 4\\"/>"},"eraser":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21m-7.752-9.91l8.828 8.828\\"/>"},"undo-2":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><path d=\\"M9 14L4 9l5-5\\"/><path d=\\"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11\\"/></g>"},"redo-2":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><path d=\\"m15 14l5-5l-5-5\\"/><path d=\\"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13\\"/></g>"},"search":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><path d=\\"m21 21l-4.34-4.34\\"/><circle cx=\\"11\\" cy=\\"11\\" r=\\"8\\"/></g>"},"chevrons-down":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"m7 6l5 5l5-5M7 13l5 5l5-5\\"/>"},"chevrons-up":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"m17 11l-5-5l-5 5m10 7l-5-5l-5 5\\"/>"},"book-open":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M12 7v14m-9-3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4a4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3a3 3 0 0 0-3-3z\\"/>"},"minus":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M5 12h14\\"/>"},"minimize":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3M3 16h3a2 2 0 0 1 2 2v3m8 0v-3a2 2 0 0 1 2-2h3\\"/>"},"maximize":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3M3 16v3a2 2 0 0 0 2 2h3m8 0h3a2 2 0 0 0 2-2v-3\\"/>"},"triangle-alert":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"m21.73 18l-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3M12 9v4m0 4h.01\\"/>"},"check":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M20 6L9 17l-5-5\\"/>"},"bell-ring":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M10.268 21a2 2 0 0 0 3.464 0M22 8c0-2.3-.8-4.3-2-6M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326M4 2C2.8 3.7 2 5.7 2 8\\"/>"},"octagon-alert":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M12 16h.01M12 8v4m3.312-10a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z\\"/>"},"info":{"body":"<g fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\"><circle cx=\\"12\\" cy=\\"12\\" r=\\"10\\"/><path d=\\"M12 16v-4m0-4h.01\\"/></g>"},"message-square":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z\\"/>"},"arrow-up-right":{"body":"<path fill=\\"none\\" stroke=\\"currentColor\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" stroke-width=\\"2\\" d=\\"M7 7h10v10M7 17L17 7\\"/>"}}`),aliases:{"loader-2":{parent:`loader-circle`},"minus-square":{parent:`square-minus`},"check-square":{parent:`square-check-big`},"alert-circle":{parent:`circle-alert`},"check-circle-2":{parent:`circle-check`},"alert-triangle":{parent:`triangle-alert`}}},FM=!1;function IM(){FM||=((0,n.addCollection)(PM),!0)}var LM=NM;function RM(e,t){IM();let n=NM(t);if(typeof document<`u`){let e=`midnight-owl-ui-theme`,t=document.getElementById(e);t||(t=document.createElement(`style`),t.id=e,document.head.appendChild(t)),t.innerHTML=n}e.provide(`midnight-owl-theme-css`,n)}var zM=`https://midnightowl.dev`;async function BM(e,t=zM){let n=`${t.replace(/\/$/,``)}/api/theme/${encodeURIComponent(e)}`,r=await fetch(n);if(!r.ok){let e=await r.json().catch(()=>null),t=e?.statusMessage??e?.message??`Request failed with status ${r.status}`;throw Error(`fetchRemoteTheme: ${t}`)}let{tokens:i}=await r.json();return i??{}}var VM={Button:c,ButtonGroup:u,InputNumber:S,InputText:k,InputPassword:I,InputOtp:ae,Autocomplete:Ce,Select:ht,Checkbox:Le,Radio:St,Textarea:jt,InputGroup:Ee,Toggle:Oe,Tabs:RE,DropDown:zE,InputMask:fe,Accordion:BE,AccordionPanel:GE,Popover:pe,Divider:JE,Toolbar:YE,Modal:eD,ToastProvider:ZO,Table:Dk,Pagination:Lk,Badge:Ae,ProgressBar:qt,Image:zt,BubbleChat:Kk,SkeletonLoader:qk,FileUpload:xn,DatePicker:Dr,TextEditor:IE,Stepper:HD,ScrollPanel:WD,Breadcrumb:eO,Card:rO,Calendar:sM,CalendarEventPopover:Lj};e.Accordion=BE,e.AccordionPanel=GE,e.Autocomplete=Ce,e.Badge=Ae,e.Breadcrumb=eO,e.BubbleChat=Kk,e.Button=c,e.ButtonGroup=u,e.Calendar=sM,e.CalendarEventPopover=Lj,e.Card=rO,e.Checkbox=Le,e.DEFAULT_TEXT_EDITOR_TOOLBAR=CE,e.DatePicker=Dr,e.Divider=JE,e.DropDown=zE,e.FileUpload=xn,e.Image=zt,e.InputGroup=Ee,e.InputMask=fe,e.InputNumber=S,e.InputOtp=ae,e.InputPassword=I,e.InputText=k,e.MidnightOwlUI={install(e,t){RM(e,t);for(let t in VM)e.component(t,VM[t])}},e.Modal=eD,e.Pagination=Lk,e.Popover=pe,e.ProgressBar=qt,e.Radio=St,e.ScrollPanel=WD,e.Select=ht,e.SkeletonLoader=qk,e.Stepper=HD,e.Table=Dk,e.Tabs=RE,e.TextEditor=IE,e.Textarea=jt,e.ToastProvider=ZO,e.Toggle=Oe,e.Toolbar=YE,e.createGoogleAdapter=kM,e.createIcsAdapter=CM,e.defaultTheme=AM,e.diffTheme=MM,e.expandRecurrence=Uj,e.fetchRemoteTheme=BM,e.generateCssVariables=NM,e.generateIcs=SM,e.generateThemeCss=LM,e.parseIcs=mM,e.useCalendar=qj,e.useToast=KO});