wiki-viewer 2.1.0 → 2.1.1

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 (94) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +3 -3
  3. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  4. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  5. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  6. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  7. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  11. package/.next/standalone/.next/server/app/_not-found.rsc +1 -1
  12. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  14. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  15. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  16. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  17. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  18. package/.next/standalone/.next/server/app/api/agent/activity/route.js.nft.json +1 -1
  19. package/.next/standalone/.next/server/app/api/agent/events/[...path]/route.js.nft.json +1 -1
  20. package/.next/standalone/.next/server/app/api/agent/files/[...path]/route.js.nft.json +1 -1
  21. package/.next/standalone/.next/server/app/api/agent/fs/file/[...path]/route.js.nft.json +1 -1
  22. package/.next/standalone/.next/server/app/api/agent/fs/ls/[[...path]]/route.js.nft.json +1 -1
  23. package/.next/standalone/.next/server/app/api/agent/fs/move/route.js.nft.json +1 -1
  24. package/.next/standalone/.next/server/app/api/agent/fs/search/route.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/api/agent/internal/span/route.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/api/agent/settings/route.js.nft.json +1 -1
  27. package/.next/standalone/.next/server/app/api/agent/sidecar/[...path]/route.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/api/assets/[...path]/route.js.nft.json +1 -1
  29. package/.next/standalone/.next/server/app/api/share/[token]/route.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/api/share/route.js.nft.json +1 -1
  31. package/.next/standalone/.next/server/app/api/system/reveal/route.js.nft.json +1 -1
  32. package/.next/standalone/.next/server/app/api/system/set-root/route.js.nft.json +1 -1
  33. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/open/route.js.nft.json +1 -1
  34. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/refresh/route.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/route.js.nft.json +1 -1
  36. package/.next/standalone/.next/server/app/api/system/workspaces/route.js.nft.json +1 -1
  37. package/.next/standalone/.next/server/app/api/upload/[...path]/route.js.nft.json +1 -1
  38. package/.next/standalone/.next/server/app/api/wiki/app/route.js.nft.json +1 -1
  39. package/.next/standalone/.next/server/app/api/wiki/backlinks/route.js.nft.json +1 -1
  40. package/.next/standalone/.next/server/app/api/wiki/content/route.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/api/wiki/download/route.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/api/wiki/file/route.js.nft.json +1 -1
  43. package/.next/standalone/.next/server/app/api/wiki/folder/route.js.nft.json +1 -1
  44. package/.next/standalone/.next/server/app/api/wiki/git-branches/route.js.nft.json +1 -1
  45. package/.next/standalone/.next/server/app/api/wiki/git-checkout/route.js.nft.json +1 -1
  46. package/.next/standalone/.next/server/app/api/wiki/git-diff/route.js.nft.json +1 -1
  47. package/.next/standalone/.next/server/app/api/wiki/git-file-info/route.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/api/wiki/git-history/route.js.nft.json +1 -1
  49. package/.next/standalone/.next/server/app/api/wiki/git-pull/route.js.nft.json +1 -1
  50. package/.next/standalone/.next/server/app/api/wiki/move/route.js.nft.json +1 -1
  51. package/.next/standalone/.next/server/app/api/wiki/new-file/route.js.nft.json +1 -1
  52. package/.next/standalone/.next/server/app/api/wiki/outlinks/route.js.nft.json +1 -1
  53. package/.next/standalone/.next/server/app/api/wiki/page/route.js.nft.json +1 -1
  54. package/.next/standalone/.next/server/app/api/wiki/presence/route.js.nft.json +1 -1
  55. package/.next/standalone/.next/server/app/api/wiki/route.js.nft.json +1 -1
  56. package/.next/standalone/.next/server/app/api/wiki/search/route.js.nft.json +1 -1
  57. package/.next/standalone/.next/server/app/api/wiki/slugs/route.js.nft.json +1 -1
  58. package/.next/standalone/.next/server/app/api/wiki/upload/route.js.nft.json +1 -1
  59. package/.next/standalone/.next/server/app/api/wiki/watch/route.js.nft.json +1 -1
  60. package/.next/standalone/.next/server/app/index.html +1 -1
  61. package/.next/standalone/.next/server/app/index.rsc +2 -2
  62. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  63. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +2 -2
  64. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  65. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  66. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  67. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  68. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  69. package/.next/standalone/.next/server/app/s/[token]/page.js.nft.json +1 -1
  70. package/.next/standalone/.next/server/app/s/[token]/page_client-reference-manifest.js +1 -1
  71. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0w~__xz._.js +1 -1
  72. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__10m6c40._.js → [root-of-the-server]__0g2q.m9._.js} +1 -1
  73. package/.next/standalone/.next/server/chunks/ssr/{_0yevh-d._.js → _026lnd.._.js} +7 -7
  74. package/.next/standalone/.next/server/chunks/ssr/_06rf50_._.js +3 -0
  75. package/.next/standalone/.next/server/chunks/ssr/{_0~a9dyk._.js → _0hpi._s._.js} +6 -6
  76. package/.next/standalone/.next/server/chunks/ssr/_0jdop6l._.js +3 -0
  77. package/.next/standalone/.next/server/chunks/ssr/src_app_page_tsx_0ss2.w7._.js +1 -1
  78. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  79. package/.next/standalone/.next/server/middleware-manifest.json +1 -1
  80. package/.next/standalone/.next/server/pages/404.html +1 -1
  81. package/.next/standalone/.next/server/pages/500.html +1 -1
  82. package/.next/standalone/.next/static/chunks/0_p-~rp2hak3c.js +113 -0
  83. package/.next/standalone/.next/static/chunks/0lrkdb9w.6kl1.js +1 -0
  84. package/.next/standalone/.next/static/chunks/{0ey6h_rkpuzxs.js → 0oy4xayqkedl5.js} +5 -5
  85. package/.next/standalone/.next/static/chunks/{0pp0hzrlj1yi7.js → 0r0fa52s8puxv.js} +1 -1
  86. package/.next/standalone/.next/static/chunks/14_efa7172tp-.js +1 -0
  87. package/.next/standalone/package.json +1 -1
  88. package/package.json +1 -1
  89. package/.next/standalone/.next/server/chunks/ssr/_0wmhtx3._.js +0 -3
  90. package/.next/standalone/.next/static/chunks/0jt1z17mjmjde.js +0 -113
  91. package/.next/standalone/.next/static/chunks/0wxju9pxda4c2.js +0 -1
  92. /package/.next/standalone/.next/static/{5iz1YmQTAv0BLREsRdrEO → XIglKqX0BlS2ovM_Stm9Z}/_buildManifest.js +0 -0
  93. /package/.next/standalone/.next/static/{5iz1YmQTAv0BLREsRdrEO → XIglKqX0BlS2ovM_Stm9Z}/_clientMiddlewareManifest.js +0 -0
  94. /package/.next/standalone/.next/static/{5iz1YmQTAv0BLREsRdrEO → XIglKqX0BlS2ovM_Stm9Z}/_ssgManifest.js +0 -0
@@ -1,113 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,425732,605993,e=>{"use strict";var t=e.i(101685);let n=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)},r=(...e)=>e.filter((e,t,n)=>!!e&&""!==e.trim()&&n.indexOf(e)===t).join(" ").trim();var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,t.forwardRef)(({color:e="currentColor",size:n=24,strokeWidth:o=2,absoluteStrokeWidth:s,className:a="",children:l,iconNode:c,...d},u)=>(0,t.createElement)("svg",{ref:u,...i,width:n,height:n,stroke:e,strokeWidth:s?24*Number(o)/Number(n):o,className:r("lucide",a),...!l&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0})(d)&&{"aria-hidden":"true"},...d},[...c.map(([e,n])=>(0,t.createElement)(e,n)),...Array.isArray(l)?l:[l]])),s=(e,i)=>{let s=(0,t.forwardRef)(({className:s,...a},l)=>(0,t.createElement)(o,{ref:l,iconNode:i,className:r(`lucide-${n(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,s),...a}));return s.displayName=n(e),s};e.s(["default",0,s],605993);let a=s("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["AlertCircle",0,a],425732)},43240,367092,e=>{"use strict";var t=e.i(605993);let n=(0,t.default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["Check",0,n],43240);let r=(0,t.default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);e.s(["ChevronDown",0,r],367092)},10137,e=>{"use strict";let t=(0,e.i(605993).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",0,t],10137)},391548,e=>{"use strict";let t=(0,e.i(605993).default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["Copy",0,t],391548)},73302,e=>{"use strict";let t=(0,e.i(605993).default)("file",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);e.s(["File",0,t],73302)},530229,e=>{"use strict";let t=(0,e.i(605993).default)("file-plus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);e.s(["FilePlus",0,t],530229)},764143,e=>{"use strict";let t=(0,e.i(605993).default)("file-text",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);e.s(["FileText",0,t],764143)},916767,845478,e=>{"use strict";var t=e.i(605993);let n=(0,t.default)("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);e.s(["Folder",0,n],916767);let r=(0,t.default)("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);e.s(["Globe",0,r],845478)},375707,e=>{"use strict";let t=(0,e.i(605993).default)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);e.s(["default",0,t])},702166,e=>{"use strict";let t=(0,e.i(605993).default)("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);e.s(["Link",0,t],702166)},691520,e=>{"use strict";let t=(0,e.i(605993).default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);e.s(["Loader2",0,t],691520)},301138,e=>{"use strict";let t=(0,e.i(605993).default)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);e.s(["Eye",0,t],301138)},920978,e=>{"use strict";let t=(0,e.i(605993).default)("trash-2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);e.s(["Trash2",0,t],920978)},924782,e=>{"use strict";let t=(0,e.i(605993).default)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);e.s(["Upload",0,t],924782)},22245,e=>{"use strict";let t=(0,e.i(605993).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["X",0,t],22245)},519455,967928,206102,294237,975157,e=>{"use strict";var t=e.i(44501),n=e.i(101685);function r(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function i(...e){return t=>{let n=!1,i=e.map(e=>{let i=r(e,t);return n||"function"!=typeof i||(n=!0),i});if(n)return()=>{for(let t=0;t<i.length;t++){let n=i[t];"function"==typeof n?n():r(e[t],null)}}}}e.s(["composeRefs",0,i,"useComposedRefs",0,function(...e){return n.useCallback(i(...e),e)}],967928);var o=Symbol.for("react.lazy"),s=n[" use ".trim().toString()];function a(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===o&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}function l(e){var r;let o,l=(r=e,(o=n.forwardRef((e,t)=>{let{children:r,...o}=e;if(a(r)&&"function"==typeof s&&(r=s(r._payload)),n.isValidElement(r)){var l;let e,s,a=(l=r,(s=(e=Object.getOwnPropertyDescriptor(l.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?l.ref:(s=(e=Object.getOwnPropertyDescriptor(l,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?l.props.ref:l.props.ref||l.ref),c=function(e,t){let n={...t};for(let r in t){let i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...e)=>{let t=o(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...o}:"className"===r&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}(o,r.props);return r.type!==n.Fragment&&(c.ref=t?i(t,a):a),n.cloneElement(r,c)}return n.Children.count(r)>1?n.Children.only(null):null})).displayName=`${r}.SlotClone`,o),c=n.forwardRef((e,r)=>{let{children:i,...o}=e;a(i)&&"function"==typeof s&&(i=s(i._payload));let c=n.Children.toArray(i),d=c.find(u);if(d){let e=d.props.children,i=c.map(t=>t!==d?t:n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null);return(0,t.jsx)(l,{...o,ref:r,children:n.isValidElement(e)?n.cloneElement(e,void 0,i):null})}return(0,t.jsx)(l,{...o,ref:r,children:i})});return c.displayName=`${e}.Slot`,c}var c=l("Slot"),d=Symbol("radix.slottable");function u(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===d}function h(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=function e(t){var n,r,i="";if("string"==typeof t||"number"==typeof t)i+=t;else if("object"==typeof t)if(Array.isArray(t)){var o=t.length;for(n=0;n<o;n++)t[n]&&(r=e(t[n]))&&(i&&(i+=" "),i+=r)}else for(r in t)t[r]&&(i&&(i+=" "),i+=r);return i}(e))&&(r&&(r+=" "),r+=t);return r}e.s(["Slot",0,c,"createSlot",0,l],206102);let p=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,f=(e,t)=>n=>{var r;if((null==t?void 0:t.variants)==null)return h(e,null==n?void 0:n.class,null==n?void 0:n.className);let{variants:i,defaultVariants:o}=t,s=Object.keys(i).map(e=>{let t=null==n?void 0:n[e],r=null==o?void 0:o[e];if(null===t)return null;let s=p(t)||p(r);return i[e][s]}),a=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return void 0===r||(e[n]=r),e},{});return h(e,s,null==t||null==(r=t.compoundVariants)?void 0:r.reduce((e,t)=>{let{class:n,className:r,...i}=t;return Object.entries(i).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...o,...a}[t]):({...o,...a})[t]===n})?[...e,n,r]:e},[]),null==n?void 0:n.class,null==n?void 0:n.className)};e.s(["cva",0,f],294237);let m=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),g=[],y=(e,t,n)=>{if(0==e.length-t)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=y(e,t+1,i);if(n)return n}let o=n.validators;if(null===o)return;let s=0===t?e.join("-"):e.slice(t).join("-"),a=o.length;for(let e=0;e<a;e++){let t=o[e];if(t.validator(s))return t.classGroupId}},b=(e,t)=>{let n=m();for(let r in e)v(e[r],n,r,t);return n},v=(e,t,n,r)=>{let i=e.length;for(let o=0;o<i;o++)w(e[o],t,n,r)},w=(e,t,n,r)=>{"string"==typeof e?x(e,t,n):"function"==typeof e?k(e,t,n,r):S(e,t,n,r)},x=(e,t,n)=>{(""===e?t:C(t,e)).classGroupId=n},k=(e,t,n,r)=>{E(e)?v(e(r),t,n,r):(null===t.validators&&(t.validators=[]),t.validators.push({classGroupId:n,validator:e}))},S=(e,t,n,r)=>{let i=Object.entries(e),o=i.length;for(let e=0;e<o;e++){let[o,s]=i[e];v(s,C(t,o),n,r)}},C=(e,t)=>{let n=e,r=t.split("-"),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=m(),n.nextPart.set(t,i)),n=i}return n},E=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,M=[],N=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),A=/\s+/,T=e=>{let t;if("string"==typeof e)return e;let n="";for(let r=0;r<e.length;r++)e[r]&&(t=T(e[r]))&&(n&&(n+=" "),n+=t);return n},R=[],O=e=>{let t=t=>t[e]||R;return t.isThemeGetter=!0,t},D=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,j=/^\((?:(\w[\w-]*):)?(.+)\)$/i,I=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,P=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,L=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,z=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,$=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,H=e=>I.test(e),B=e=>!!e&&!Number.isNaN(Number(e)),F=e=>!!e&&Number.isInteger(Number(e)),V=e=>e.endsWith("%")&&B(e.slice(0,-1)),U=e=>P.test(e),W=()=>!0,K=e=>L.test(e)&&!z.test(e),q=()=>!1,J=e=>_.test(e),G=e=>$.test(e),X=e=>!Q(e)&&!ea(e),Z=e=>e.startsWith("@container")&&("/"===e[10]&&void 0!==e[11]||"s"===e[11]&&void 0!==e[16]&&e.startsWith("-size/",10)||"n"===e[11]&&void 0!==e[18]&&e.startsWith("-normal/",10)),Y=e=>em(e,ev,q),Q=e=>D.test(e),ee=e=>em(e,ew,K),et=e=>em(e,ex,B),en=e=>em(e,eS,W),er=e=>em(e,ek,q),ei=e=>em(e,ey,q),eo=e=>em(e,eb,G),es=e=>em(e,eC,J),ea=e=>j.test(e),el=e=>eg(e,ew),ec=e=>eg(e,ek),ed=e=>eg(e,ey),eu=e=>eg(e,ev),eh=e=>eg(e,eb),ep=e=>eg(e,eC,!0),ef=e=>eg(e,eS,!0),em=(e,t,n)=>{let r=D.exec(e);return!!r&&(r[1]?t(r[1]):n(r[2]))},eg=(e,t,n=!1)=>{let r=j.exec(e);return!!r&&(r[1]?t(r[1]):n)},ey=e=>"position"===e||"percentage"===e,eb=e=>"image"===e||"url"===e,ev=e=>"length"===e||"size"===e||"bg-size"===e,ew=e=>"length"===e,ex=e=>"number"===e,ek=e=>"family-name"===e,eS=e=>"number"===e||"weight"===e,eC=e=>"shadow"===e,eE=((e,...t)=>{let n,r,i,o,s=e=>{let t=r(e);if(t)return t;let o=((e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:o,postfixLookupClassGroupIds:s}=t,a=[],l=e.trim().split(A),c="";for(let e=l.length-1;e>=0;e-=1){let t,d=l[e],{isExternal:u,modifiers:h,hasImportantModifier:p,baseClassName:f,maybePostfixModifierPosition:m}=n(d);if(u){c=d+(c.length>0?" "+c:c);continue}let g=!!m;if(g){let e=(t=r(f.substring(0,m)))&&s[t]?r(f):void 0;e&&e!==t&&(t=e,g=!1)}else t=r(f);if(!t){if(!g||!(t=r(f))){c=d+(c.length>0?" "+c:c);continue}g=!1}let y=0===h.length?"":1===h.length?h[0]:o(h).join(":"),b=p?y+"!":y,v=b+t;if(a.indexOf(v)>-1)continue;a.push(v);let w=i(t,g);for(let e=0;e<w.length;++e){let t=w[e];a.push(b+t)}c=d+(c.length>0?" "+c:c)}return c})(e,n);return i(e,o),o};return o=a=>{var l;let c;return r=(n={cache:(e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,o)=>{n[i]=o,++t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];return void 0!==t?t:void 0!==(t=r[e])?(i(e,t),t):void 0},set(e,t){e in n?n[e]=t:i(e,t)}}})((l=t.reduce((e,t)=>t(e),e())).cacheSize),parseClassName:(e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t,n=[],r=0,i=0,o=0,s=e.length;for(let a=0;a<s;a++){let s=e[a];if(0===r&&0===i){if(":"===s){n.push(e.slice(o,a)),o=a+1;continue}if("/"===s){t=a;continue}}"["===s?r++:"]"===s?r--:"("===s?i++:")"===s&&i--}let a=0===n.length?e:e.slice(o),l=a,c=!1;return a.endsWith("!")?(l=a.slice(0,-1),c=!0):a.startsWith("!")&&(l=a.slice(1),c=!0),N(n,c,l,t&&t>o?t-o:void 0)};if(t){let e=t+":",n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):N(M,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r})(l),sortModifiers:(c=new Map,l.orderSensitiveModifiers.forEach((e,t)=>{c.set(e,1e6+t)}),e=>{let t=[],n=[];for(let r=0;r<e.length;r++){let i=e[r],o="["===i[0],s=c.has(i);o||s?(n.length>0&&(n.sort(),t.push(...n),n=[]),t.push(i)):n.push(i)}return n.length>0&&(n.sort(),t.push(...n)),t}),postfixLookupClassGroupIds:(e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t})(l),...(e=>{let t=(e=>{let{theme:t,classGroups:n}=e;return b(n,t)})(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]")){var n;let t,r,i;return -1===(n=e).slice(1,-1).indexOf(":")?void 0:(r=(t=n.slice(1,-1)).indexOf(":"),(i=t.slice(0,r))?"arbitrary.."+i:void 0)}let r=e.split("-"),i=+(""===r[0]&&r.length>1);return y(r,i,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];if(t){if(i){let e=Array(i.length+t.length);for(let t=0;t<i.length;t++)e[t]=i[t];for(let n=0;n<t.length;n++)e[i.length+n]=t[n];return e}return t}return i||g}return n[e]||g}}})(l)}).cache.get,i=n.cache.set,o=s,s(a)},(...e)=>o(((...e)=>{let t,n,r=0,i="";for(;r<e.length;)(t=e[r++])&&(n=T(t))&&(i&&(i+=" "),i+=n);return i})(...e))})(()=>{let e=O("color"),t=O("font"),n=O("text"),r=O("font-weight"),i=O("tracking"),o=O("leading"),s=O("breakpoint"),a=O("container"),l=O("spacing"),c=O("radius"),d=O("shadow"),u=O("inset-shadow"),h=O("text-shadow"),p=O("drop-shadow"),f=O("blur"),m=O("perspective"),g=O("aspect"),y=O("ease"),b=O("animate"),v=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],x=()=>[...w(),ea,Q],k=()=>["auto","hidden","clip","visible","scroll"],S=()=>["auto","contain","none"],C=()=>[ea,Q,l],E=()=>[H,"full","auto",...C()],M=()=>[F,"none","subgrid",ea,Q],N=()=>["auto",{span:["full",F,ea,Q]},F,ea,Q],A=()=>[F,"auto",ea,Q],T=()=>["auto","min","max","fr",ea,Q],R=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],D=()=>["start","end","center","stretch","center-safe","end-safe"],j=()=>["auto",...C()],I=()=>[H,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...C()],P=()=>[H,"screen","full","dvw","lvw","svw","min","max","fit",...C()],L=()=>[H,"screen","full","lh","dvh","lvh","svh","min","max","fit",...C()],z=()=>[e,ea,Q],_=()=>[...w(),ed,ei,{position:[ea,Q]}],$=()=>["no-repeat",{repeat:["","x","y","space","round"]}],K=()=>["auto","cover","contain",eu,Y,{size:[ea,Q]}],q=()=>[V,el,ee],J=()=>["","none","full",c,ea,Q],G=()=>["",B,el,ee],em=()=>["solid","dashed","dotted","double"],eg=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ey=()=>[B,V,ed,ei],eb=()=>["","none",f,ea,Q],ev=()=>["none",B,ea,Q],ew=()=>["none",B,ea,Q],ex=()=>[B,ea,Q],ek=()=>[H,"full",...C()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[U],breakpoint:[U],color:[W],container:[U],"drop-shadow":[U],ease:["in","out","in-out"],font:[X],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[U],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[U],shadow:[U],spacing:["px",B],text:[U],"text-shadow":[U],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",H,Q,ea,g]}],container:["container"],"container-type":[{"@container":["","normal","size",ea,Q]}],"container-named":[Z],columns:[{columns:[B,Q,ea,a]}],"break-after":[{"break-after":v()}],"break-before":[{"break-before":v()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:x()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:E()}],"inset-x":[{"inset-x":E()}],"inset-y":[{"inset-y":E()}],start:[{"inset-s":E(),start:E()}],end:[{"inset-e":E(),end:E()}],"inset-bs":[{"inset-bs":E()}],"inset-be":[{"inset-be":E()}],top:[{top:E()}],right:[{right:E()}],bottom:[{bottom:E()}],left:[{left:E()}],visibility:["visible","invisible","collapse"],z:[{z:[F,"auto",ea,Q]}],basis:[{basis:[H,"full","auto",a,...C()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[B,H,"auto","initial","none",Q]}],grow:[{grow:["",B,ea,Q]}],shrink:[{shrink:["",B,ea,Q]}],order:[{order:[F,"first","last","none",ea,Q]}],"grid-cols":[{"grid-cols":M()}],"col-start-end":[{col:N()}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":M()}],"row-start-end":[{row:N()}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":T()}],"auto-rows":[{"auto-rows":T()}],gap:[{gap:C()}],"gap-x":[{"gap-x":C()}],"gap-y":[{"gap-y":C()}],"justify-content":[{justify:[...R(),"normal"]}],"justify-items":[{"justify-items":[...D(),"normal"]}],"justify-self":[{"justify-self":["auto",...D()]}],"align-content":[{content:["normal",...R()]}],"align-items":[{items:[...D(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...D(),{baseline:["","last"]}]}],"place-content":[{"place-content":R()}],"place-items":[{"place-items":[...D(),"baseline"]}],"place-self":[{"place-self":["auto",...D()]}],p:[{p:C()}],px:[{px:C()}],py:[{py:C()}],ps:[{ps:C()}],pe:[{pe:C()}],pbs:[{pbs:C()}],pbe:[{pbe:C()}],pt:[{pt:C()}],pr:[{pr:C()}],pb:[{pb:C()}],pl:[{pl:C()}],m:[{m:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mbs:[{mbs:j()}],mbe:[{mbe:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":C()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":C()}],"space-y-reverse":["space-y-reverse"],size:[{size:I()}],"inline-size":[{inline:["auto",...P()]}],"min-inline-size":[{"min-inline":["auto",...P()]}],"max-inline-size":[{"max-inline":["none",...P()]}],"block-size":[{block:["auto",...L()]}],"min-block-size":[{"min-block":["auto",...L()]}],"max-block-size":[{"max-block":["none",...L()]}],w:[{w:[a,"screen",...I()]}],"min-w":[{"min-w":[a,"screen","none",...I()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[s]},...I()]}],h:[{h:["screen","lh",...I()]}],"min-h":[{"min-h":["screen","lh","none",...I()]}],"max-h":[{"max-h":["screen","lh",...I()]}],"font-size":[{text:["base",n,el,ee]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ef,en]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",V,Q]}],"font-family":[{font:[ec,er,t]}],"font-features":[{"font-features":[Q]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,ea,Q]}],"line-clamp":[{"line-clamp":[B,"none",ea,et]}],leading:[{leading:[o,...C()]}],"list-image":[{"list-image":["none",ea,Q]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ea,Q]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:z()}],"text-color":[{text:z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...em(),"wavy"]}],"text-decoration-thickness":[{decoration:[B,"from-font","auto",ea,ee]}],"text-decoration-color":[{decoration:z()}],"underline-offset":[{"underline-offset":[B,"auto",ea,Q]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:C()}],"tab-size":[{tab:[F,ea,Q]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ea,Q]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ea,Q]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:_()}],"bg-repeat":[{bg:$()}],"bg-size":[{bg:K()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},F,ea,Q],radial:["",ea,Q],conic:[F,ea,Q]},eh,eo]}],"bg-color":[{bg:z()}],"gradient-from-pos":[{from:q()}],"gradient-via-pos":[{via:q()}],"gradient-to-pos":[{to:q()}],"gradient-from":[{from:z()}],"gradient-via":[{via:z()}],"gradient-to":[{to:z()}],rounded:[{rounded:J()}],"rounded-s":[{"rounded-s":J()}],"rounded-e":[{"rounded-e":J()}],"rounded-t":[{"rounded-t":J()}],"rounded-r":[{"rounded-r":J()}],"rounded-b":[{"rounded-b":J()}],"rounded-l":[{"rounded-l":J()}],"rounded-ss":[{"rounded-ss":J()}],"rounded-se":[{"rounded-se":J()}],"rounded-ee":[{"rounded-ee":J()}],"rounded-es":[{"rounded-es":J()}],"rounded-tl":[{"rounded-tl":J()}],"rounded-tr":[{"rounded-tr":J()}],"rounded-br":[{"rounded-br":J()}],"rounded-bl":[{"rounded-bl":J()}],"border-w":[{border:G()}],"border-w-x":[{"border-x":G()}],"border-w-y":[{"border-y":G()}],"border-w-s":[{"border-s":G()}],"border-w-e":[{"border-e":G()}],"border-w-bs":[{"border-bs":G()}],"border-w-be":[{"border-be":G()}],"border-w-t":[{"border-t":G()}],"border-w-r":[{"border-r":G()}],"border-w-b":[{"border-b":G()}],"border-w-l":[{"border-l":G()}],"divide-x":[{"divide-x":G()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":G()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...em(),"hidden","none"]}],"divide-style":[{divide:[...em(),"hidden","none"]}],"border-color":[{border:z()}],"border-color-x":[{"border-x":z()}],"border-color-y":[{"border-y":z()}],"border-color-s":[{"border-s":z()}],"border-color-e":[{"border-e":z()}],"border-color-bs":[{"border-bs":z()}],"border-color-be":[{"border-be":z()}],"border-color-t":[{"border-t":z()}],"border-color-r":[{"border-r":z()}],"border-color-b":[{"border-b":z()}],"border-color-l":[{"border-l":z()}],"divide-color":[{divide:z()}],"outline-style":[{outline:[...em(),"none","hidden"]}],"outline-offset":[{"outline-offset":[B,ea,Q]}],"outline-w":[{outline:["",B,el,ee]}],"outline-color":[{outline:z()}],shadow:[{shadow:["","none",d,ep,es]}],"shadow-color":[{shadow:z()}],"inset-shadow":[{"inset-shadow":["none",u,ep,es]}],"inset-shadow-color":[{"inset-shadow":z()}],"ring-w":[{ring:G()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:z()}],"ring-offset-w":[{"ring-offset":[B,ee]}],"ring-offset-color":[{"ring-offset":z()}],"inset-ring-w":[{"inset-ring":G()}],"inset-ring-color":[{"inset-ring":z()}],"text-shadow":[{"text-shadow":["none",h,ep,es]}],"text-shadow-color":[{"text-shadow":z()}],opacity:[{opacity:[B,ea,Q]}],"mix-blend":[{"mix-blend":[...eg(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":eg()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[B]}],"mask-image-linear-from-pos":[{"mask-linear-from":ey()}],"mask-image-linear-to-pos":[{"mask-linear-to":ey()}],"mask-image-linear-from-color":[{"mask-linear-from":z()}],"mask-image-linear-to-color":[{"mask-linear-to":z()}],"mask-image-t-from-pos":[{"mask-t-from":ey()}],"mask-image-t-to-pos":[{"mask-t-to":ey()}],"mask-image-t-from-color":[{"mask-t-from":z()}],"mask-image-t-to-color":[{"mask-t-to":z()}],"mask-image-r-from-pos":[{"mask-r-from":ey()}],"mask-image-r-to-pos":[{"mask-r-to":ey()}],"mask-image-r-from-color":[{"mask-r-from":z()}],"mask-image-r-to-color":[{"mask-r-to":z()}],"mask-image-b-from-pos":[{"mask-b-from":ey()}],"mask-image-b-to-pos":[{"mask-b-to":ey()}],"mask-image-b-from-color":[{"mask-b-from":z()}],"mask-image-b-to-color":[{"mask-b-to":z()}],"mask-image-l-from-pos":[{"mask-l-from":ey()}],"mask-image-l-to-pos":[{"mask-l-to":ey()}],"mask-image-l-from-color":[{"mask-l-from":z()}],"mask-image-l-to-color":[{"mask-l-to":z()}],"mask-image-x-from-pos":[{"mask-x-from":ey()}],"mask-image-x-to-pos":[{"mask-x-to":ey()}],"mask-image-x-from-color":[{"mask-x-from":z()}],"mask-image-x-to-color":[{"mask-x-to":z()}],"mask-image-y-from-pos":[{"mask-y-from":ey()}],"mask-image-y-to-pos":[{"mask-y-to":ey()}],"mask-image-y-from-color":[{"mask-y-from":z()}],"mask-image-y-to-color":[{"mask-y-to":z()}],"mask-image-radial":[{"mask-radial":[ea,Q]}],"mask-image-radial-from-pos":[{"mask-radial-from":ey()}],"mask-image-radial-to-pos":[{"mask-radial-to":ey()}],"mask-image-radial-from-color":[{"mask-radial-from":z()}],"mask-image-radial-to-color":[{"mask-radial-to":z()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[B]}],"mask-image-conic-from-pos":[{"mask-conic-from":ey()}],"mask-image-conic-to-pos":[{"mask-conic-to":ey()}],"mask-image-conic-from-color":[{"mask-conic-from":z()}],"mask-image-conic-to-color":[{"mask-conic-to":z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:_()}],"mask-repeat":[{mask:$()}],"mask-size":[{mask:K()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ea,Q]}],filter:[{filter:["","none",ea,Q]}],blur:[{blur:eb()}],brightness:[{brightness:[B,ea,Q]}],contrast:[{contrast:[B,ea,Q]}],"drop-shadow":[{"drop-shadow":["","none",p,ep,es]}],"drop-shadow-color":[{"drop-shadow":z()}],grayscale:[{grayscale:["",B,ea,Q]}],"hue-rotate":[{"hue-rotate":[B,ea,Q]}],invert:[{invert:["",B,ea,Q]}],saturate:[{saturate:[B,ea,Q]}],sepia:[{sepia:["",B,ea,Q]}],"backdrop-filter":[{"backdrop-filter":["","none",ea,Q]}],"backdrop-blur":[{"backdrop-blur":eb()}],"backdrop-brightness":[{"backdrop-brightness":[B,ea,Q]}],"backdrop-contrast":[{"backdrop-contrast":[B,ea,Q]}],"backdrop-grayscale":[{"backdrop-grayscale":["",B,ea,Q]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[B,ea,Q]}],"backdrop-invert":[{"backdrop-invert":["",B,ea,Q]}],"backdrop-opacity":[{"backdrop-opacity":[B,ea,Q]}],"backdrop-saturate":[{"backdrop-saturate":[B,ea,Q]}],"backdrop-sepia":[{"backdrop-sepia":["",B,ea,Q]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":C()}],"border-spacing-x":[{"border-spacing-x":C()}],"border-spacing-y":[{"border-spacing-y":C()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ea,Q]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[B,"initial",ea,Q]}],ease:[{ease:["linear","initial",y,ea,Q]}],delay:[{delay:[B,ea,Q]}],animate:[{animate:["none",b,ea,Q]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,ea,Q]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ev()}],"rotate-x":[{"rotate-x":ev()}],"rotate-y":[{"rotate-y":ev()}],"rotate-z":[{"rotate-z":ev()}],scale:[{scale:ew()}],"scale-x":[{"scale-x":ew()}],"scale-y":[{"scale-y":ew()}],"scale-z":[{"scale-z":ew()}],"scale-3d":["scale-3d"],skew:[{skew:ex()}],"skew-x":[{"skew-x":ex()}],"skew-y":[{"skew-y":ex()}],transform:[{transform:[ea,Q,"","none","gpu","cpu"]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ek()}],"translate-x":[{"translate-x":ek()}],"translate-y":[{"translate-y":ek()}],"translate-z":[{"translate-z":ek()}],"translate-none":["translate-none"],zoom:[{zoom:[F,ea,Q]}],accent:[{accent:z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:z()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ea,Q]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":z()}],"scrollbar-track-color":[{"scrollbar-track":z()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":C()}],"scroll-mx":[{"scroll-mx":C()}],"scroll-my":[{"scroll-my":C()}],"scroll-ms":[{"scroll-ms":C()}],"scroll-me":[{"scroll-me":C()}],"scroll-mbs":[{"scroll-mbs":C()}],"scroll-mbe":[{"scroll-mbe":C()}],"scroll-mt":[{"scroll-mt":C()}],"scroll-mr":[{"scroll-mr":C()}],"scroll-mb":[{"scroll-mb":C()}],"scroll-ml":[{"scroll-ml":C()}],"scroll-p":[{"scroll-p":C()}],"scroll-px":[{"scroll-px":C()}],"scroll-py":[{"scroll-py":C()}],"scroll-ps":[{"scroll-ps":C()}],"scroll-pe":[{"scroll-pe":C()}],"scroll-pbs":[{"scroll-pbs":C()}],"scroll-pbe":[{"scroll-pbe":C()}],"scroll-pt":[{"scroll-pt":C()}],"scroll-pr":[{"scroll-pr":C()}],"scroll-pb":[{"scroll-pb":C()}],"scroll-pl":[{"scroll-pl":C()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ea,Q]}],fill:[{fill:["none",...z()]}],"stroke-w":[{stroke:[B,el,ee,et]}],stroke:[{stroke:["none",...z()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function eM(...e){return eE(h(e))}e.s(["cn",0,eM],975157);let eN=f("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium normal-case transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-e-1 hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-e-1 hover:bg-destructive/90",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-e-1 hover:bg-secondary/80",ghost:"bg-transparent hover:bg-accent/10 text-foreground",link:"text-foreground underline underline-offset-4 hover:text-accent"},size:{default:"h-10 p-3 rounded-full",sm:"h-8 rounded-full px-3 text-xs",lg:"h-10 rounded-full px-8",icon:"h-9 w-9 rounded-full"}},defaultVariants:{variant:"default",size:"default"}}),eA=n.forwardRef(({className:e,variant:n,size:r,asChild:i=!1,...o},s)=>(0,t.jsx)(i?c:"button",{className:eM(eN({variant:n,size:r,className:e})),ref:s,...o}));eA.displayName="Button",e.s(["Button",0,eA],519455)},291967,543250,672687,e=>{"use strict";"u">typeof window&&window.document&&window.document.createElement,e.s(["composeEventHandlers",0,function(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}],291967);var t=e.i(101685),n=e.i(44501);e.s(["createContext",0,function(e,r){let i=t.createContext(r),o=e=>{let{children:r,...o}=e,s=t.useMemo(()=>o,Object.values(o));return(0,n.jsx)(i.Provider,{value:s,children:r})};return o.displayName=e+"Provider",[o,function(n){let o=t.useContext(i);if(o)return o;if(void 0!==r)return r;throw Error(`\`${n}\` must be used within \`${e}\``)}]},"createContextScope",0,function(e,r=[]){let i=[],o=()=>{let n=i.map(e=>t.createContext(e));return function(r){let i=r?.[e]||n;return t.useMemo(()=>({[`__scope${e}`]:{...r,[e]:i}}),[r,i])}};return o.scopeName=e,[function(r,o){let s=t.createContext(o),a=i.length;i=[...i,o];let l=r=>{let{scope:i,children:o,...l}=r,c=i?.[e]?.[a]||s,d=t.useMemo(()=>l,Object.values(l));return(0,n.jsx)(c.Provider,{value:d,children:o})};return l.displayName=r+"Provider",[l,function(n,i){let l=i?.[e]?.[a]||s,c=t.useContext(l);if(c)return c;if(void 0!==o)return o;throw Error(`\`${n}\` must be used within \`${r}\``)}]},function(...e){let n=e[0];if(1===e.length)return n;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let i=r.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return t.useMemo(()=>({[`__scope${n.scopeName}`]:i}),[i])}};return r.scopeName=n.scopeName,r}(o,...r)]}],543250);var r=globalThis?.document?t.useLayoutEffect:()=>{};e.s(["useLayoutEffect",0,r],672687)},433616,e=>{"use strict";var t=e.i(101685),n=e.i(672687),r=t[" useId ".trim().toString()]||(()=>void 0),i=0;e.s(["useId",0,function(e){let[o,s]=t.useState(r());return(0,n.useLayoutEffect)(()=>{e||s(e=>e??String(i++))},[e]),e||(o?`radix-${o}`:"")}])},417256,652053,980939,e=>{"use strict";var t=e.i(101685),n=e.i(672687);t[" useEffectEvent ".trim().toString()],t[" useInsertionEffect ".trim().toString()];var r=t[" useInsertionEffect ".trim().toString()]||n.useLayoutEffect;Symbol("RADIX:SYNC_STATE"),e.s(["useControllableState",0,function({prop:e,defaultProp:n,onChange:i=()=>{},caller:o}){let[s,a,l]=function({defaultProp:e,onChange:n}){let[i,o]=t.useState(e),s=t.useRef(i),a=t.useRef(n);return r(()=>{a.current=n},[n]),t.useEffect(()=>{s.current!==i&&(a.current?.(i),s.current=i)},[i,s]),[i,o,a]}({defaultProp:n,onChange:i}),c=void 0!==e,d=c?e:s;{let n=t.useRef(void 0!==e);t.useEffect(()=>{let e=n.current;if(e!==c){let t=c?"controlled":"uncontrolled";console.warn(`${o} is changing from ${e?"controlled":"uncontrolled"} to ${t}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}n.current=c},[c,o])}return[d,t.useCallback(t=>{if(c){let n="function"==typeof t?t(e):t;n!==e&&l.current?.(n)}else a(t)},[c,e,a,l])]}],417256);var i=e.i(380560),o=e.i(967928),s=e.i(44501);function a(e){var n;let r,i=(n=e,(r=t.forwardRef((e,n)=>{let{children:r,...i}=e;if(t.isValidElement(r)){var s;let e,a,l=(s=r,(a=(e=Object.getOwnPropertyDescriptor(s.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.ref:(a=(e=Object.getOwnPropertyDescriptor(s,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.props.ref:s.props.ref||s.ref),c=function(e,t){let n={...t};for(let r in t){let i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...e)=>{let t=o(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...o}:"className"===r&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}(i,r.props);return r.type!==t.Fragment&&(c.ref=n?(0,o.composeRefs)(n,l):l),t.cloneElement(r,c)}return t.Children.count(r)>1?t.Children.only(null):null})).displayName=`${n}.SlotClone`,r),a=t.forwardRef((e,n)=>{let{children:r,...o}=e,a=t.Children.toArray(r),l=a.find(c);if(l){let e=l.props.children,r=a.map(n=>n!==l?n:t.Children.count(e)>1?t.Children.only(null):t.isValidElement(e)?e.props.children:null);return(0,s.jsx)(i,{...o,ref:n,children:t.isValidElement(e)?t.cloneElement(e,void 0,r):null})}return(0,s.jsx)(i,{...o,ref:n,children:r})});return a.displayName=`${e}.Slot`,a}var l=Symbol("radix.slottable");function c(e){return t.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===l}e.s(["createSlot",0,a],652053);var d=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,n)=>{let r=a(`Primitive.${n}`),i=t.forwardRef((e,t)=>{let{asChild:i,...o}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,s.jsx)(i?r:n,{...o,ref:t})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{});e.s(["Primitive",0,d,"dispatchDiscreteCustomEvent",0,function(e,t){e&&i.flushSync(()=>e.dispatchEvent(t))}],980939)},348989,136131,e=>{"use strict";var t,n=e.i(101685),r=e.i(291967),i=e.i(980939),o=e.i(967928);function s(e){let t=n.useRef(e);return n.useEffect(()=>{t.current=e}),n.useMemo(()=>(...e)=>t.current?.(...e),[])}e.s(["useCallbackRef",0,s],136131);var a=e.i(44501),l="dismissableLayer.update",c=n.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),d=n.forwardRef((e,d)=>{let{disableOutsidePointerEvents:p=!1,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:g,onInteractOutside:y,onDismiss:b,...v}=e,w=n.useContext(c),[x,k]=n.useState(null),S=x?.ownerDocument??globalThis?.document,[,C]=n.useState({}),E=(0,o.useComposedRefs)(d,e=>k(e)),M=Array.from(w.layers),[N]=[...w.layersWithOutsidePointerEventsDisabled].slice(-1),A=M.indexOf(N),T=x?M.indexOf(x):-1,R=w.layersWithOutsidePointerEventsDisabled.size>0,O=T>=A,D=function(e,t=globalThis?.document){let r=s(e),i=n.useRef(!1),o=n.useRef(()=>{});return n.useEffect(()=>{let e=e=>{if(e.target&&!i.current){let n=function(){h("dismissableLayer.pointerDownOutside",r,i,{discrete:!0})},i={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=n,t.addEventListener("click",o.current,{once:!0})):n()}else t.removeEventListener("click",o.current);i.current=!1},n=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(n),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>i.current=!0}}(e=>{let t=e.target,n=[...w.branches].some(e=>e.contains(t));O&&!n&&(m?.(e),y?.(e),e.defaultPrevented||b?.())},S),j=function(e,t=globalThis?.document){let r=s(e),i=n.useRef(!1);return n.useEffect(()=>{let e=e=>{e.target&&!i.current&&h("dismissableLayer.focusOutside",r,{originalEvent:e},{discrete:!1})};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}(e=>{let t=e.target;![...w.branches].some(e=>e.contains(t))&&(g?.(e),y?.(e),e.defaultPrevented||b?.())},S);return!function(e,t=globalThis?.document){let r=s(e);n.useEffect(()=>{let e=e=>{"Escape"===e.key&&r(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[r,t])}(e=>{T===w.layers.size-1&&(f?.(e),!e.defaultPrevented&&b&&(e.preventDefault(),b()))},S),n.useEffect(()=>{if(x)return p&&(0===w.layersWithOutsidePointerEventsDisabled.size&&(t=S.body.style.pointerEvents,S.body.style.pointerEvents="none"),w.layersWithOutsidePointerEventsDisabled.add(x)),w.layers.add(x),u(),()=>{p&&1===w.layersWithOutsidePointerEventsDisabled.size&&(S.body.style.pointerEvents=t)}},[x,S,p,w]),n.useEffect(()=>()=>{x&&(w.layers.delete(x),w.layersWithOutsidePointerEventsDisabled.delete(x),u())},[x,w]),n.useEffect(()=>{let e=()=>C({});return document.addEventListener(l,e),()=>document.removeEventListener(l,e)},[]),(0,a.jsx)(i.Primitive.div,{...v,ref:E,style:{pointerEvents:R?O?"auto":"none":void 0,...e.style},onFocusCapture:(0,r.composeEventHandlers)(e.onFocusCapture,j.onFocusCapture),onBlurCapture:(0,r.composeEventHandlers)(e.onBlurCapture,j.onBlurCapture),onPointerDownCapture:(0,r.composeEventHandlers)(e.onPointerDownCapture,D.onPointerDownCapture)})});function u(){let e=new CustomEvent(l);document.dispatchEvent(e)}function h(e,t,n,{discrete:r}){let o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?(0,i.dispatchDiscreteCustomEvent)(o,s):o.dispatchEvent(s)}d.displayName="DismissableLayer",n.forwardRef((e,t)=>{let r=n.useContext(c),s=n.useRef(null),l=(0,o.useComposedRefs)(t,s);return n.useEffect(()=>{let e=s.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}},[r.branches]),(0,a.jsx)(i.Primitive.div,{...e,ref:l})}).displayName="DismissableLayerBranch",e.s(["DismissableLayer",0,d],348989)},445424,e=>{"use strict";let t;var n=e.i(101685),r=e.i(967928),i=e.i(980939),o=e.i(136131),s=e.i(44501),a="focusScope.autoFocusOnMount",l="focusScope.autoFocusOnUnmount",c={bubbles:!1,cancelable:!0},d=n.forwardRef((e,t)=>{let{loop:d=!1,trapped:m=!1,onMountAutoFocus:g,onUnmountAutoFocus:y,...b}=e,[v,w]=n.useState(null),x=(0,o.useCallbackRef)(g),k=(0,o.useCallbackRef)(y),S=n.useRef(null),C=(0,r.useComposedRefs)(t,e=>w(e)),E=n.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;n.useEffect(()=>{if(m){let e=function(e){if(E.paused||!v)return;let t=e.target;v.contains(t)?S.current=t:p(S.current,{select:!0})},t=function(e){if(E.paused||!v)return;let t=e.relatedTarget;null!==t&&(v.contains(t)||p(S.current,{select:!0}))};document.addEventListener("focusin",e),document.addEventListener("focusout",t);let n=new MutationObserver(function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&p(v)});return v&&n.observe(v,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),n.disconnect()}}},[m,v,E.paused]),n.useEffect(()=>{if(v){f.add(E);let e=document.activeElement;if(!v.contains(e)){let t=new CustomEvent(a,c);v.addEventListener(a,x),v.dispatchEvent(t),t.defaultPrevented||(function(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(p(r,{select:t}),document.activeElement!==n)return}(u(v).filter(e=>"A"!==e.tagName),{select:!0}),document.activeElement===e&&p(v))}return()=>{v.removeEventListener(a,x),setTimeout(()=>{let t=new CustomEvent(l,c);v.addEventListener(l,k),v.dispatchEvent(t),t.defaultPrevented||p(e??document.body,{select:!0}),v.removeEventListener(l,k),f.remove(E)},0)}}},[v,x,k,E]);let M=n.useCallback(e=>{if(!d&&!m||E.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,n=document.activeElement;if(t&&n){var r;let t,i=e.currentTarget,[o,s]=[h(t=u(r=i),r),h(t.reverse(),r)];o&&s?e.shiftKey||n!==s?e.shiftKey&&n===o&&(e.preventDefault(),d&&p(s,{select:!0})):(e.preventDefault(),d&&p(o,{select:!0})):n===i&&e.preventDefault()}},[d,m,E.paused]);return(0,s.jsx)(i.Primitive.div,{tabIndex:-1,...b,ref:C,onKeyDown:M})});function u(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function h(e,t){for(let n of e)if(!function(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===t||e!==t);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(n,{upTo:t}))return n}function p(e,{select:t=!1}={}){if(e&&e.focus){var n;let r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&(n=e)instanceof HTMLInputElement&&"select"in n&&t&&e.select()}}d.displayName="FocusScope";var f=(t=[],{add(e){let n=t[0];e!==n&&n?.pause(),(t=m(t,e)).unshift(e)},remove(e){t=m(t,e),t[0]?.resume()}});function m(e,t){let n=[...e],r=n.indexOf(t);return -1!==r&&n.splice(r,1),n}e.s(["FocusScope",0,d])},332374,190088,e=>{"use strict";var t=e.i(101685),n=e.i(380560),r=e.i(980939),i=e.i(672687),o=e.i(44501),s=t.forwardRef((e,s)=>{let{container:a,...l}=e,[c,d]=t.useState(!1);(0,i.useLayoutEffect)(()=>d(!0),[]);let u=a||c&&globalThis?.document?.body;return u?n.default.createPortal((0,o.jsx)(r.Primitive.div,{...l,ref:s}),u):null});s.displayName="Portal",e.s(["Portal",0,s],332374);var a=e.i(967928),l=e=>{var n;let r,o,{present:s,children:l}=e,d=function(e){var n,r;let[o,s]=t.useState(),a=t.useRef(null),l=t.useRef(e),d=t.useRef("none"),[u,h]=(n=e?"mounted":"unmounted",r={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},t.useReducer((e,t)=>r[e][t]??e,n));return t.useEffect(()=>{let e=c(a.current);d.current="mounted"===u?e:"none"},[u]),(0,i.useLayoutEffect)(()=>{let t=a.current,n=l.current;if(n!==e){let r=d.current,i=c(t);e?h("MOUNT"):"none"===i||t?.display==="none"?h("UNMOUNT"):n&&r!==i?h("ANIMATION_OUT"):h("UNMOUNT"),l.current=e}},[e,h]),(0,i.useLayoutEffect)(()=>{if(o){let e,t=o.ownerDocument.defaultView??window,n=n=>{let r=c(a.current).includes(CSS.escape(n.animationName));if(n.target===o&&r&&(h("ANIMATION_END"),!l.current)){let n=o.style.animationFillMode;o.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===o.style.animationFillMode&&(o.style.animationFillMode=n)})}},r=e=>{e.target===o&&(d.current=c(a.current))};return o.addEventListener("animationstart",r),o.addEventListener("animationcancel",n),o.addEventListener("animationend",n),()=>{t.clearTimeout(e),o.removeEventListener("animationstart",r),o.removeEventListener("animationcancel",n),o.removeEventListener("animationend",n)}}h("ANIMATION_END")},[o,h]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:t.useCallback(e=>{a.current=e?getComputedStyle(e):null,s(e)},[])}}(s),u="function"==typeof l?l({present:d.isPresent}):t.Children.only(l),h=(0,a.useComposedRefs)(d.ref,(n=u,(o=(r=Object.getOwnPropertyDescriptor(n.props,"ref")?.get)&&"isReactWarning"in r&&r.isReactWarning)?n.ref:(o=(r=Object.getOwnPropertyDescriptor(n,"ref")?.get)&&"isReactWarning"in r&&r.isReactWarning)?n.props.ref:n.props.ref||n.ref));return"function"==typeof l||d.isPresent?t.cloneElement(u,{ref:h}):null};function c(e){return e?.animationName||"none"}l.displayName="Presence",e.s(["Presence",0,l],190088)},539340,e=>{"use strict";var t=e.i(101685),n=0;function r(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}e.s(["useFocusGuards",0,function(){t.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??r()),document.body.insertAdjacentElement("beforeend",e[1]??r()),n++,()=>{1===n&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),n--}},[])}])},206500,e=>{"use strict";var t,n,r,i,o,s,a,l=e.i(824627),c=e.i(101685),d="right-scroll-bar-position",u="width-before-scroll-bar";function h(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var p="u">typeof window?c.useLayoutEffect:c.useEffect,f=new WeakMap,m=(void 0===t&&(t={}),(void 0===n&&(n=function(e){return e}),r=[],i=!1,o={read:function(){if(i)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:null},useMedium:function(e){var t=n(e,i);return r.push(t),function(){r=r.filter(function(e){return e!==t})}},assignSyncMedium:function(e){for(i=!0;r.length;){var t=r;r=[],t.forEach(e)}r={push:function(t){return e(t)},filter:function(){return r}}},assignMedium:function(e){i=!0;var t=[];if(r.length){var n=r;r=[],n.forEach(e),t=r}var o=function(){var n=t;t=[],n.forEach(e)},s=function(){return Promise.resolve().then(o)};s(),r={push:function(e){t.push(e),s()},filter:function(e){return t=t.filter(e),r}}}}).options=(0,l.__assign)({async:!0,ssr:!1},t),o),g=function(){},y=c.forwardRef(function(e,t){var n,r,i,o,s=c.useRef(null),a=c.useState({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:g}),d=a[0],u=a[1],y=e.forwardProps,b=e.children,v=e.className,w=e.removeScrollBar,x=e.enabled,k=e.shards,S=e.sideCar,C=e.noRelative,E=e.noIsolation,M=e.inert,N=e.allowPinchZoom,A=e.as,T=e.gapMode,R=(0,l.__rest)(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=(n=[s,t],r=function(e){return n.forEach(function(t){return h(t,e)})},(i=(0,c.useState)(function(){return{value:null,callback:r,facade:{get current(){return i.value},set current(value){var e=i.value;e!==value&&(i.value=value,i.callback(value,e))}}}})[0]).callback=r,o=i.facade,p(function(){var e=f.get(o);if(e){var t=new Set(e),r=new Set(n),i=o.current;t.forEach(function(e){r.has(e)||h(e,null)}),r.forEach(function(e){t.has(e)||h(e,i)})}f.set(o,n)},[n]),o),D=(0,l.__assign)((0,l.__assign)({},R),d);return c.createElement(c.Fragment,null,x&&c.createElement(S,{sideCar:m,removeScrollBar:w,shards:k,noRelative:C,noIsolation:E,inert:M,setCallbacks:u,allowPinchZoom:!!N,lockRef:s,gapMode:T}),y?c.cloneElement(c.Children.only(b),(0,l.__assign)((0,l.__assign)({},D),{ref:O})):c.createElement(void 0===A?"div":A,(0,l.__assign)({},D,{className:v,ref:O}),b))});y.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},y.classNames={fullWidth:u,zeroRight:d};var b=function(e){var t=e.sideCar,n=(0,l.__rest)(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error("Sidecar medium not found");return c.createElement(r,(0,l.__assign)({},n))};b.isSideCarExport=!0;var v=function(){var e=0,t=null;return{add:function(n){if(0==e&&(t=function(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=a||("u">typeof __webpack_nonce__?__webpack_nonce__:void 0);return t&&e.setAttribute("nonce",t),e}())){var r,i;(r=t).styleSheet?r.styleSheet.cssText=n:r.appendChild(document.createTextNode(n)),i=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(i)}e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},w=function(){var e=v();return function(t,n){c.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},x=function(){var e=w();return function(t){return e(t.styles,t.dynamic),null}},k={left:0,top:0,right:0,gap:0},S=function(e){return parseInt(e||"",10)||0},C=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],i=t["padding"===e?"paddingRight":"marginRight"];return[S(n),S(r),S(i)]},E=function(e){if(void 0===e&&(e="margin"),"u"<typeof window)return k;var t=C(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},M=x(),N="data-scroll-locked",A=function(e,t,n,r){var i=e.left,o=e.top,s=e.right,a=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(a,"px ").concat(r,";\n }\n body[").concat(N,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(i,"px;\n padding-top: ").concat(o,"px;\n padding-right: ").concat(s,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(a,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(d," {\n right: ").concat(a,"px ").concat(r,";\n }\n \n .").concat(u," {\n margin-right: ").concat(a,"px ").concat(r,";\n }\n \n .").concat(d," .").concat(d," {\n right: 0 ").concat(r,";\n }\n \n .").concat(u," .").concat(u," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(N,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(a,"px;\n }\n")},T=function(){var e=parseInt(document.body.getAttribute(N)||"0",10);return isFinite(e)?e:0},R=function(){c.useEffect(function(){return document.body.setAttribute(N,(T()+1).toString()),function(){var e=T()-1;e<=0?document.body.removeAttribute(N):document.body.setAttribute(N,e.toString())}},[])},O=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=void 0===r?"margin":r;R();var o=c.useMemo(function(){return E(i)},[i]);return c.createElement(M,{styles:A(o,!t,i,n?"":"!important")})},D=!1;if("u">typeof window)try{var j=Object.defineProperty({},"passive",{get:function(){return D=!0,!0}});window.addEventListener("test",j,j),window.removeEventListener("test",j,j)}catch(e){D=!1}var I=!!D&&{passive:!1},P=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return"hidden"!==n[t]&&(n.overflowY!==n.overflowX||"TEXTAREA"===e.tagName||"visible"!==n[t])},L=function(e,t){var n=t.ownerDocument,r=t;do{if("u">typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),z(e,r)){var i=_(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body)return!1},z=function(e,t){return"v"===e?P(t,"overflowY"):P(t,"overflowX")},_=function(e,t){return"v"===e?[t.scrollTop,t.scrollHeight,t.clientHeight]:[t.scrollLeft,t.scrollWidth,t.clientWidth]},$=function(e,t,n,r,i){var o,s=(o=window.getComputedStyle(t).direction,"h"===e&&"rtl"===o?-1:1),a=s*r,l=n.target,c=t.contains(l),d=!1,u=a>0,h=0,p=0;do{if(!l)break;var f=_(e,l),m=f[0],g=f[1]-f[2]-s*m;(m||g)&&z(e,l)&&(h+=g,p+=m);var y=l.parentNode;l=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!c&&l!==document.body||c&&(t.contains(l)||t===l))return u&&(i&&1>Math.abs(h)||!i&&a>h)?d=!0:!u&&(i&&1>Math.abs(p)||!i&&-a>p)&&(d=!0),d},H=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},B=function(e){return[e.deltaX,e.deltaY]},F=function(e){return e&&"current"in e?e.current:e},V=0,U=[];let W=(s=function(e){var t=c.useRef([]),n=c.useRef([0,0]),r=c.useRef(),i=c.useState(V++)[0],o=c.useState(x)[0],s=c.useRef(e);c.useEffect(function(){s.current=e},[e]),c.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var t=(0,l.__spreadArray)([e.lockRef.current],(e.shards||[]).map(F),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=c.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!s.current.allowPinchZoom;var i,o=H(e),a=n.current,l="deltaX"in e?e.deltaX:a[0]-o[0],c="deltaY"in e?e.deltaY:a[1]-o[1],d=e.target,u=Math.abs(l)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===u&&"range"===d.type)return!1;var h=window.getSelection(),p=h&&h.anchorNode;if(p&&(p===d||p.contains(d)))return!1;var f=L(u,d);if(!f)return!0;if(f?i=u:(i="v"===u?"h":"v",f=L(u,d)),!f)return!1;if(!r.current&&"changedTouches"in e&&(l||c)&&(r.current=i),!i)return!0;var m=r.current||i;return $(m,t,e,"h"===m?l:c,!0)},[]),d=c.useCallback(function(e){if(U.length&&U[U.length-1]===o){var n="deltaY"in e?B(e):H(e),r=t.current.filter(function(t){var r;return t.name===e.type&&(t.target===e.target||e.target===t.shadowParent)&&(r=t.delta,r[0]===n[0]&&r[1]===n[1])})[0];if(r&&r.should){e.cancelable&&e.preventDefault();return}if(!r){var i=(s.current.shards||[]).map(F).filter(Boolean).filter(function(t){return t.contains(e.target)});(i.length>0?a(e,i[0]):!s.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),u=c.useCallback(function(e,n,r,i){var o={name:e,delta:n,target:r,should:i,shadowParent:function(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}(r)};t.current.push(o),setTimeout(function(){t.current=t.current.filter(function(e){return e!==o})},1)},[]),h=c.useCallback(function(e){n.current=H(e),r.current=void 0},[]),p=c.useCallback(function(t){u(t.type,B(t),t.target,a(t,e.lockRef.current))},[]),f=c.useCallback(function(t){u(t.type,H(t),t.target,a(t,e.lockRef.current))},[]);c.useEffect(function(){return U.push(o),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:f}),document.addEventListener("wheel",d,I),document.addEventListener("touchmove",d,I),document.addEventListener("touchstart",h,I),function(){U=U.filter(function(e){return e!==o}),document.removeEventListener("wheel",d,I),document.removeEventListener("touchmove",d,I),document.removeEventListener("touchstart",h,I)}},[]);var m=e.removeScrollBar,g=e.inert;return c.createElement(c.Fragment,null,g?c.createElement(o,{styles:"\n .block-interactivity-".concat(i," {pointer-events: none;}\n .allow-interactivity-").concat(i," {pointer-events: all;}\n")}):null,m?c.createElement(O,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},m.useMedium(s),b);var K=c.forwardRef(function(e,t){return c.createElement(y,(0,l.__assign)({},e,{ref:t,sideCar:W}))});K.classNames=y.classNames,e.s(["RemoveScroll",0,K],206500)},73772,e=>{"use strict";var t=new WeakMap,n=new WeakMap,r={},i=0,o=function(e){return e&&(e.host||o(e.parentNode))},s=function(e,s,a,l){var c=(Array.isArray(e)?e:[e]).map(function(e){if(s.contains(e))return e;var t=o(e);return t&&s.contains(t)?t:(console.error("aria-hidden",e,"in not contained inside",s,". Doing nothing"),null)}).filter(function(e){return!!e});r[a]||(r[a]=new WeakMap);var d=r[a],u=[],h=new Set,p=new Set(c),f=function(e){!e||h.has(e)||(h.add(e),f(e.parentNode))};c.forEach(f);var m=function(e){!e||p.has(e)||Array.prototype.forEach.call(e.children,function(e){if(h.has(e))m(e);else try{var r=e.getAttribute(l),i=null!==r&&"false"!==r,o=(t.get(e)||0)+1,s=(d.get(e)||0)+1;t.set(e,o),d.set(e,s),u.push(e),1===o&&i&&n.set(e,!0),1===s&&e.setAttribute(a,"true"),i||e.setAttribute(l,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return m(s),h.clear(),i++,function(){u.forEach(function(e){var r=t.get(e)-1,i=d.get(e)-1;t.set(e,r),d.set(e,i),r||(n.has(e)||e.removeAttribute(l),n.delete(e)),i||e.removeAttribute(a)}),--i||(t=new WeakMap,t=new WeakMap,n=new WeakMap,r={})}};e.s(["hideOthers",0,function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=t||("u"<typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),s(r,i,n,"aria-hidden")):function(){return null}}])},46951,e=>{"use strict";var t=e.i(101685),n=e.i(291967),r=e.i(967928),i=e.i(543250),o=e.i(433616),s=e.i(417256),a=e.i(348989),l=e.i(445424),c=e.i(332374),d=e.i(190088),u=e.i(980939),h=e.i(539340),p=e.i(206500),f=e.i(73772),m=e.i(652053),g=e.i(44501),y="Dialog",[b,v]=(0,i.createContextScope)(y),[w,x]=b(y),k=e=>{let{__scopeDialog:n,children:r,open:i,defaultOpen:a,onOpenChange:l,modal:c=!0}=e,d=t.useRef(null),u=t.useRef(null),[h,p]=(0,s.useControllableState)({prop:i,defaultProp:a??!1,onChange:l,caller:y});return(0,g.jsx)(w,{scope:n,triggerRef:d,contentRef:u,contentId:(0,o.useId)(),titleId:(0,o.useId)(),descriptionId:(0,o.useId)(),open:h,onOpenChange:p,onOpenToggle:t.useCallback(()=>p(e=>!e),[p]),modal:c,children:r})};k.displayName=y;var S="DialogTrigger",C=t.forwardRef((e,t)=>{let{__scopeDialog:i,...o}=e,s=x(S,i),a=(0,r.useComposedRefs)(t,s.triggerRef);return(0,g.jsx)(u.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":U(s.open),...o,ref:a,onClick:(0,n.composeEventHandlers)(e.onClick,s.onOpenToggle)})});C.displayName=S;var E="DialogPortal",[M,N]=b(E,{forceMount:void 0}),A=e=>{let{__scopeDialog:n,forceMount:r,children:i,container:o}=e,s=x(E,n);return(0,g.jsx)(M,{scope:n,forceMount:r,children:t.Children.map(i,e=>(0,g.jsx)(d.Presence,{present:r||s.open,children:(0,g.jsx)(c.Portal,{asChild:!0,container:o,children:e})}))})};A.displayName=E;var T="DialogOverlay",R=t.forwardRef((e,t)=>{let n=N(T,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=x(T,e.__scopeDialog);return o.modal?(0,g.jsx)(d.Presence,{present:r||o.open,children:(0,g.jsx)(D,{...i,ref:t})}):null});R.displayName=T;var O=(0,m.createSlot)("DialogOverlay.RemoveScroll"),D=t.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=x(T,n);return(0,g.jsx)(p.RemoveScroll,{as:O,allowPinchZoom:!0,shards:[i.contentRef],children:(0,g.jsx)(u.Primitive.div,{"data-state":U(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),j="DialogContent",I=t.forwardRef((e,t)=>{let n=N(j,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=x(j,e.__scopeDialog);return(0,g.jsx)(d.Presence,{present:r||o.open,children:o.modal?(0,g.jsx)(P,{...i,ref:t}):(0,g.jsx)(L,{...i,ref:t})})});I.displayName=j;var P=t.forwardRef((e,i)=>{let o=x(j,e.__scopeDialog),s=t.useRef(null),a=(0,r.useComposedRefs)(i,o.contentRef,s);return t.useEffect(()=>{let e=s.current;if(e)return(0,f.hideOthers)(e)},[]),(0,g.jsx)(z,{...e,ref:a,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,n.composeEventHandlers)(e.onCloseAutoFocus,e=>{e.preventDefault(),o.triggerRef.current?.focus()}),onPointerDownOutside:(0,n.composeEventHandlers)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:(0,n.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault())})}),L=t.forwardRef((e,n)=>{let r=x(j,e.__scopeDialog),i=t.useRef(!1),o=t.useRef(!1);return(0,g.jsx)(z,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(i.current||r.triggerRef.current?.focus(),t.preventDefault()),i.current=!1,o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(i.current=!0,"pointerdown"===t.detail.originalEvent.type&&(o.current=!0));let n=t.target;r.triggerRef.current?.contains(n)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&o.current&&t.preventDefault()}})}),z=t.forwardRef((e,n)=>{let{__scopeDialog:i,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:c,...d}=e,u=x(j,i),p=t.useRef(null),f=(0,r.useComposedRefs)(n,p);return(0,h.useFocusGuards)(),(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(l.FocusScope,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:s,onUnmountAutoFocus:c,children:(0,g.jsx)(a.DismissableLayer,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":U(u.open),...d,ref:f,onDismiss:()=>u.onOpenChange(!1)})}),(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(J,{titleId:u.titleId}),(0,g.jsx)(G,{contentRef:p,descriptionId:u.descriptionId})]})]})}),_="DialogTitle",$=t.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=x(_,n);return(0,g.jsx)(u.Primitive.h2,{id:i.titleId,...r,ref:t})});$.displayName=_;var H="DialogDescription",B=t.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=x(H,n);return(0,g.jsx)(u.Primitive.p,{id:i.descriptionId,...r,ref:t})});B.displayName=H;var F="DialogClose",V=t.forwardRef((e,t)=>{let{__scopeDialog:r,...i}=e,o=x(F,r);return(0,g.jsx)(u.Primitive.button,{type:"button",...i,ref:t,onClick:(0,n.composeEventHandlers)(e.onClick,()=>o.onOpenChange(!1))})});function U(e){return e?"open":"closed"}V.displayName=F;var W="DialogTitleWarning",[K,q]=(0,i.createContext)(W,{contentName:j,titleName:_,docsSlug:"dialog"}),J=({titleId:e})=>{let n=q(W),r=`\`${n.contentName}\` requires a \`${n.titleName}\` for the component to be accessible for screen reader users.
2
-
3
- If you want to hide the \`${n.titleName}\`, you can wrap it with our VisuallyHidden component.
4
-
5
- For more information, see https://radix-ui.com/primitives/docs/components/${n.docsSlug}`;return t.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},G=({contentRef:e,descriptionId:n})=>{let r=q("DialogDescriptionWarning"),i=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${r.contentName}}.`;return t.useEffect(()=>{let t=e.current?.getAttribute("aria-describedby");n&&t&&(document.getElementById(n)||console.warn(i))},[i,e,n]),null};e.s(["Close",0,V,"Content",0,I,"Description",0,B,"Overlay",0,R,"Portal",0,A,"Root",0,k,"Title",0,$,"Trigger",0,C])},776639,e=>{"use strict";var t=e.i(44501),n=e.i(46951),r=e.i(22245),i=e.i(101685),o=e.i(975157);let s=n.Root;n.Trigger;let a=n.Portal;n.Close;let l=i.forwardRef(({className:e,...r},i)=>(0,t.jsx)(n.Overlay,{ref:i,className:(0,o.cn)("fixed inset-0 z-40 bg-overlay backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...r}));l.displayName=n.Overlay.displayName;let c=i.forwardRef(({className:e,children:i,...s},c)=>(0,t.jsxs)(a,{children:[(0,t.jsx)(l,{}),(0,t.jsxs)(n.Content,{ref:c,className:(0,o.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-card p-6 shadow-golden rounded-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",e),...s,children:[i,(0,t.jsxs)(n.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,t.jsx)(r.X,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));function d({className:e,...n}){return(0,t.jsx)("div",{className:(0,o.cn)("flex flex-col space-y-1.5 text-center sm:text-left",e),...n})}function u({className:e,...n}){return(0,t.jsx)("div",{className:(0,o.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...n})}c.displayName=n.Content.displayName,d.displayName="DialogHeader",u.displayName="DialogFooter";let h=i.forwardRef(({className:e,...r},i)=>(0,t.jsx)(n.Title,{ref:i,className:(0,o.cn)("text-lg font-normal leading-none tracking-tight",e),...r}));h.displayName=n.Title.displayName;let p=i.forwardRef(({className:e,...r},i)=>(0,t.jsx)(n.Description,{ref:i,className:(0,o.cn)("text-sm text-muted-foreground",e),...r}));p.displayName=n.Description.displayName,e.s(["Dialog",0,s,"DialogContent",0,c,"DialogDescription",0,p,"DialogFooter",0,u,"DialogHeader",0,d,"DialogTitle",0,h])},313393,e=>{"use strict";let t=(0,e.i(605993).default)("code-xml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);e.s(["Code2",0,t],313393)},671485,e=>{"use strict";let t=["/api/wiki","/api/assets/","/api/upload/","/api/system/reveal"],n=["/api/agent/admin","/api/agent/register","/api/agents"];function r(){return new URLSearchParams(window.location.search).get("ws")}function i(e){let i=r();if(!i)return e;let o=e.indexOf("?"),s=-1===o?e:e.slice(0,o),a=-1===o?"":e.slice(o+1);if(!function(e){for(let t of n)if(e===t||e.startsWith(t+"/"))return!1;if(e.startsWith("/api/agent/"))return!0;for(let n of t)if(e.startsWith(n))return!0;return!1}(s))return e;let l=new URLSearchParams(a);return l.has("ws")?e:(l.set("ws",i),`${s}?${l.toString()}`)}e.s(["getActiveWorkspaceId",0,r,"withWs",0,i,"wsFetch",0,function(e,t){return fetch(i(e),t)}])},804150,(e,t,n)=>{"use strict";var r=e.r(101685),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=r.useState,s=r.useEffect,a=r.useLayoutEffect,l=r.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch(e){return!0}}var d="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=o({inst:{value:n,getSnapshot:t}}),i=r[0].inst,d=r[1];return a(function(){i.value=n,i.getSnapshot=t,c(i)&&d({inst:i})},[e,n,t]),s(function(){return c(i)&&d({inst:i}),e(function(){c(i)&&d({inst:i})})},[e]),l(n),n};n.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:d},3909,(e,t,n)=>{"use strict";t.exports=e.r(804150)},757890,(e,t,n)=>{"use strict";var r=e.r(101685),i=e.r(3909),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=i.useSyncExternalStore,a=r.useRef,l=r.useEffect,c=r.useMemo,d=r.useDebugValue;n.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var u=a(null);if(null===u.current){var h={hasValue:!1,value:null};u.current=h}else h=u.current;var p=s(e,(u=c(function(){function e(e){if(!l){if(l=!0,s=e,e=r(e),void 0!==i&&h.hasValue){var t=h.value;if(i(t,e))return a=t}return a=e}if(t=a,o(s,e))return t;var n=r(e);return void 0!==i&&i(t,n)?(s=e,t):(s=e,a=n)}var s,a,l=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,n,r,i]))[0],u[1]);return l(function(){h.hasValue=!0,h.value=p},[p]),d(p),p}},383835,(e,t,n)=>{"use strict";t.exports=e.r(757890)},150663,644575,605842,111092,362615,202008,608926,343603,885047,e=>{"use strict";let t,n;function r(e){this.content=e}r.prototype={constructor:r,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 -1==t?void 0:this.content[t+1]},update:function(e,t,n){var i=n&&n!=e?this.remove(n):this,o=i.find(e),s=i.content.slice();return -1==o?s.push(n||e,t):(s[o+1]=t,n&&(s[o]=n)),new r(s)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new r(n)},addToStart:function(e,t){return new r([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new r(n)},addBefore:function(e,t,n){var i=this.remove(t),o=i.content.slice(),s=i.find(e);return o.splice(-1==s?o.length:s,0,t,n),new r(o)},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=r.from(e)).size?new r(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=r.from(e)).size?new r(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=r.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}},r.from=function(e){if(e instanceof r)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new r(t)};class i{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let o=0,s=0;s<t;o++){let a=this.content[o],l=s+a.nodeSize;if(l>e&&!1!==n(a,r+s,i||null,o)&&a.content.size){let i=s+1;a.nodesBetween(Math.max(0,e-i),Math.min(a.content.size,t-i),n,r+i)}s=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i="",o=!0;return this.nodesBetween(e,t,(s,a)=>{let l=s.isText?s.text.slice(Math.max(e,a)-a,t-a):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&l||s.isTextblock)&&n&&(o?o=!1:i+=n),i+=l},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),o=1);o<e.content.length;o++)r.push(e.content[o]);return new i(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let i=0,o=0;o<t;i++){let s=this.content[i],a=o+s.nodeSize;a>e&&((o<e||a>t)&&(s=s.isText?s.cut(Math.max(0,e-o),Math.min(s.text.length,t-o)):s.cut(Math.max(0,e-o-1),Math.min(s.content.size,t-o-1))),n.push(s),r+=s.nodeSize),o=a}return new i(n,r)}cutByIndex(e,t){return e==t?i.empty:0==e&&t==this.content.length?this:new i(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),o=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new i(r,o)}addToStart(e){return new i([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new i(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw 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 function e(t,n,r){for(let i=0;;i++){if(i==t.childCount||i==n.childCount)return t.childCount==n.childCount?null:r;let o=t.child(i),s=n.child(i);if(o==s){r+=o.nodeSize;continue}if(!o.sameMarkup(s))return r;if(o.isText&&o.text!=s.text){for(let e=0;o.text[e]==s.text[e];e++)r++;return r}if(o.content.size||s.content.size){let t=e(o.content,s.content,r+1);if(null!=t)return t}r+=o.nodeSize}}(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return function e(t,n,r,i){for(let o=t.childCount,s=n.childCount;;){if(0==o||0==s)return o==s?null:{a:r,b:i};let a=t.child(--o),l=n.child(--s),c=a.nodeSize;if(a==l){r-=c,i-=c;continue}if(!a.sameMarkup(l))return{a:r,b:i};if(a.isText&&a.text!=l.text){let e=0,t=Math.min(a.text.length,l.text.length);for(;e<t&&a.text[a.text.length-e-1]==l.text[l.text.length-e-1];)e++,r--,i--;return{a:r,b:i}}if(a.content.size||l.content.size){let t=e(a.content,l.content,r-1,i-1);if(t)return t}r-=c,i-=c}}(this,e,t,n)}findIndex(e){if(0==e)return s(0,e);if(e==this.size)return s(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=n+this.child(t).nodeSize;if(r>=e){if(r==e)return s(t+1,r);return s(t,n)}n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return i.empty;if(!Array.isArray(t))throw RangeError("Invalid input for Fragment.fromJSON");return i.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return i.empty;let t,n=0;for(let r=0;r<e.length;r++){let i=e[r];n+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(t||(t=e.slice(0,r)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new i(t||e,n)}static from(e){if(!e)return i.empty;if(e instanceof i)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new i([e],e.nodeSize);throw RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}i.empty=new i([],0);let o={index:0,offset:0};function s(e,t){return o.index=e,o.offset=t,o}function a(e,t){if(e===t)return!0;if(!(e&&"object"==typeof e)||!(t&&"object"==typeof t))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(!a(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!a(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class l{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||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!n&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(i)}}return t||(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&&a(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(e){if(!e||Array.isArray(e)&&0==e.length)return l.none;if(e instanceof l)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}l.none=[];class c extends Error{}class d{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=function e(t,n,r,i,o,s){let{index:a,offset:l}=t.findIndex(n),c=t.maybeChild(a);if(l==n||c.isText)return s&&i<=0&&o<=0&&!s.canReplace(a,a,r)?null:t.cut(0,n).append(r).append(t.cut(n));let d=e(c.content,n-l-1,r,0==a?i-1:0,a==t.childCount-1?o-1:0,c);return d&&t.replaceChild(a,c.copy(d))}(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return n&&new d(n,this.openStart,this.openEnd)}removeBetween(e,t){return new d(function e(t,n,r){let{index:i,offset:o}=t.findIndex(n),s=t.maybeChild(i),{index:a,offset:l}=t.findIndex(r);if(o==n||s.isText){if(l!=r&&!t.child(a).isText)throw RangeError("Removing non-flat range");return t.cut(0,n).append(t.cut(r))}if(i!=a)throw RangeError("Removing non-flat range");return t.replaceChild(i,s.copy(e(s.content,n-o-1,r-o-1)))}(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return d.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw RangeError("Invalid input for Slice.fromJSON");return new d(i.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=e.lastChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.lastChild)r++;return new d(e,n,r)}}function u(e,t){if(!t.type.compatibleContent(e.type))throw new c("Cannot join "+t.type.name+" onto "+e.type.name)}function h(e,t,n){let r=e.node(n);return u(r,t.node(n)),r}function p(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 f(e,t,n,r){let i=(t||e).node(n),o=0,s=t?t.index(n):i.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(p(e.nodeAfter,r),o++));for(let e=o;e<s;e++)p(i.child(e),r);t&&t.depth==n&&t.textOffset&&p(t.nodeBefore,r)}function m(e,t){return e.type.checkContent(t),e.copy(t)}function g(e,t,n){let r=[];return f(null,e,n,r),e.depth>n&&p(m(h(e,t,n+1),g(e,t,n+1)),r),f(t,null,n,r),new i(r)}d.empty=new d(i.empty,0,0);class y{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?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[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].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):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-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(0==e.content.size)return l.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 o=0;o<i.length;o++)!1!==i[o].type.spec.inclusive||r&&i[o].isInSet(r.marks)||(i=i[o--].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++)!1!==n[i].type.spec.inclusive||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 x(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(e,t){if(!(t>=0&&t<=e.content.size))throw RangeError("Position "+t+" out of range");let n=[],r=0,i=t;for(let t=e;;){let{index:e,offset:o}=t.content.findIndex(i),s=i-o;if(n.push(t,e,r+o),!s||(t=t.child(e)).isText)break;i=s-1,r+=o+1}return new y(t,n,i)}static resolveCached(e,t){let n=w.get(e);if(n)for(let e=0;e<n.elts.length;e++){let r=n.elts[e];if(r.pos==t)return r}else w.set(e,n=new b);let r=n.elts[n.i]=y.resolve(e,t);return n.i=(n.i+1)%v,r}}class b{constructor(){this.elts=[],this.i=0}}let v=12,w=new WeakMap;class x{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)}}let k=Object.create(null);class S{constructor(e,t,n,r=l.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||i.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&&a(this.attrs,t||e.defaultAttrs||k)&&l.sameSet(this.marks,n||l.none)}copy(e=null){return e==this.content?this:new S(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new S(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return d.empty;let r=this.resolve(e),i=this.resolve(t),o=n?0:r.sharedDepth(t),s=r.start(o);return new d(r.node(o).content.cut(r.pos-s,i.pos-s),r.depth-o,i.depth-o)}replace(e,t,n){var r=this.resolve(e),o=this.resolve(t);if(n.openStart>r.depth)throw new c("Inserted content deeper than insertion position");if(r.depth-n.openStart!=o.depth-n.openEnd)throw new c("Inconsistent open depths");return function e(t,n,r,o){let s=t.index(o),a=t.node(o);if(s==n.index(o)&&o<t.depth-r.openStart){let i=e(t,n,r,o+1);return a.copy(a.content.replaceChild(s,i))}if(!r.content.size)return m(a,g(t,n,o));if(r.openStart||r.openEnd||t.depth!=o||n.depth!=o){let{start:e,end:s}=function(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(i.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(r,t);return m(a,function e(t,n,r,o,s){let a=t.depth>s&&h(t,n,s+1),l=o.depth>s&&h(r,o,s+1),c=[];return f(null,t,s,c),a&&l&&n.index(s)==r.index(s)?(u(a,l),p(m(a,e(t,n,r,o,s+1)),c)):(a&&p(m(a,g(t,n,s+1)),c),f(n,r,s,c),l&&p(m(l,g(r,o,s+1)),c)),f(o,null,s,c),new i(c)}(t,e,s,n,o))}{let e=t.parent,i=e.content;return m(e,i.cut(0,t.parentOffset).append(r.content).append(i.cut(n.parentOffset)))}}(r,o,n,0)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(!(t=t.maybeChild(n)))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(0==e)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 y.resolveCached(this,e)}resolveNoCache(e){return y.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()+")"),E(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=i.empty,r=0,o=n.childCount){let s=this.contentMatchAt(e).matchFragment(n,r,o),a=s&&s.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let e=r;e<o;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),o=i&&i.matchFragment(this.content,t);return!!o&&o.validEnd}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=l.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(!l.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){let n;if(!t)throw RangeError("Invalid input for Node.fromJSON");if(t.marks){if(!Array.isArray(t.marks))throw RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=i.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,r,n);return o.type.checkAttrs(o.attrs),o}}S.prototype.text=void 0;class C extends S{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):E(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new C(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new C(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&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 E(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class M{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){var n;let r,i=new N(e,t);if(null==i.next)return M.empty;let o=function e(t){let n=[];do n.push(function(t){let n=[];do n.push(function(t){let n=function(t){if(t.eat("(")){let n=e(t);return t.eat(")")||t.err("Missing closing paren"),n}if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=(function(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 0==i.length&&e.err("No node type or group '"+t+"' found"),i})(t,t.next).map(e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}}(t);for(;;)if(t.eat("+"))n={type:"plus",expr:n};else if(t.eat("*"))n={type:"star",expr:n};else if(t.eat("?"))n={type:"opt",expr:n};else if(t.eat("{"))n=function(e,t){let n=A(e),r=n;return e.eat(",")&&(r="}"!=e.next?A(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}(t,n);else break;return n}(t));while(t.next&&")"!=t.next&&"|"!=t.next)return 1==n.length?n[0]:{type:"seq",exprs:n}}(t));while(t.eat("|"))return 1==n.length?n[0]:{type:"choice",exprs:n}}(i);i.next&&i.err("Unexpected trailing text");let s=(n=function(e){let t=[[]];return i(function e(t,o){if("choice"==t.type)return t.exprs.reduce((t,n)=>t.concat(e(n,o)),[]);if("seq"==t.type)for(let r=0;;r++){let s=e(t.exprs[r],o);if(r==t.exprs.length-1)return s;i(s,o=n())}else if("star"==t.type){let s=n();return r(o,s),i(e(t.expr,s),s),[r(s)]}else if("plus"==t.type){let s=n();return i(e(t.expr,o),s),i(e(t.expr,s),s),[r(s)]}else if("opt"==t.type)return[r(o)].concat(e(t.expr,o));else if("range"==t.type){let s=o;for(let r=0;r<t.min;r++){let r=n();i(e(t.expr,s),r),s=r}if(-1==t.max)i(e(t.expr,s),s);else for(let o=t.min;o<t.max;o++){let o=n();r(s,o),i(e(t.expr,s),o),s=o}return[r(s)]}else if("name"==t.type)return[r(o,void 0,t.value)];else throw Error("Unknown expr type")}(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)}}(o),r=Object.create(null),function e(t){let i=[];t.forEach(e=>{n[e].forEach(({term:e,to:t})=>{let r;if(e){for(let t=0;t<i.length;t++)i[t][0]==e&&(r=i[t][1]);R(n,t).forEach(t=>{r||i.push([e,r=[]]),-1==r.indexOf(t)&&r.push(t)})}})});let o=r[t.join(",")]=new M(t.indexOf(n.length-1)>-1);for(let t=0;t<i.length;t++){let n=i[t][1].sort(T);o.next.push({type:i[t][0],next:r[n.join(",")]||e(n)})}return o}(R(n,0)));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,o=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];o.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),-1==r.indexOf(s)&&r.push(s)}i&&t.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(s,i),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,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 0!=this.next.length&&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];return function o(s,a){let l=s.matchFragment(e,n);if(l&&(!t||l.validEnd))return i.from(a.map(e=>e.createAndFill()));for(let e=0;e<s.next.length;e++){let{type:t,next:n}=s.next[e];if(!(t.isText||t.hasRequiredAttrs())&&-1==r.indexOf(n)){r.push(n);let e=o(n,a.concat(t));if(e)return e}}return null}(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:o,next:s}=i.next[e];o.isLeaf||o.hasRequiredAttrs()||o.name in t||r.type&&!s.validEnd||(n.push({match:o.contentMatch,type:o,via:r}),t[o.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=[];return!function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(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("\n")}}M.empty=new M(!0);class N{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 A(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function T(e,t){return t-e}function R(e,t){let n=[];return function t(r){let i=e[r];if(1==i.length&&!i[0].term)return t(i[0].to);n.push(r);for(let e=0;e<i.length;e++){let{term:r,to:o}=i[e];r||-1!=n.indexOf(o)||t(o)}}(t),n.sort(T)}function O(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 D(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(void 0===i){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 j(e,t,n,r){for(let r in t)if(!(r in e))throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function I(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new L(e,r,t[r]);return n}class P{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=I(e,n.attrs),this.defaultAttrs=O(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==M.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:D(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error("NodeType.create can't construct text nodes");return new S(this,this.computeAttrs(e),i.from(t),l.setFrom(n))}createChecked(e=null,t,n){return t=i.from(t),this.checkContent(t),new S(this,this.computeAttrs(e),t,l.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=i.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),o=r&&r.fillBefore(i.empty,!0);return o?new S(this,e,t.append(o),l.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){j(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){let t;if(null==this.markSet)return e;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:l.none:e}static compile(e,t){let n=Object.create(null);e.forEach((e,r)=>n[e]=new P(e,t,r));let r=t.spec.topNode||"doc";if(!n[r])throw RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw RangeError("Every schema needs a 'text' type");for(let e in n.text.attrs)throw RangeError("The text node type should not have attributes");return n}}class L{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(e,t,n){let r=n.split("|");return n=>{let i=null===n?"null":typeof n;if(0>r.indexOf(i))throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class z{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=I(e,r.attrs),this.excluded=null;let i=O(this.attrs);this.instance=i?new l(this,i):null}create(e=null){return!e&&this.instance?this.instance:new l(this,D(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,i)=>n[e]=new z(e,r++,t,i)),n}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){j(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}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=r.from(e.nodes),t.marks=r.from(e.marks||{}),this.nodes=P.compile(this.spec.nodes,this),this.marks=z.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]=M.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?$(this,i.split(" ")):""!=i&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=null==n?[t]:""==n?[]:$(this,n.split(" "))}this.nodeFromJSON=e=>S.fromJSON(this,e),this.markFromJSON=e=>l.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else if(e instanceof P){if(e.schema!=this)throw RangeError("Node type from different schema used ("+e.name+")")}else throw RangeError("Invalid node type: "+e);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new C(n,n.defaultAttrs,e,l.setFrom(t))}mark(e,t){return"string"==typeof e&&(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 $(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],o=e.marks[i],s=o;if(o)n.push(o);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(s=r)}if(!s)throw SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class H{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(null!=e.tag)this.tags.push(e);else if(null!=e.style){let t=/[^=]*/.exec(e.style)[0];0>n.indexOf(t)&&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 K(this,t,!1);return n.addAll(e,l.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new K(this,t,!0);return n.addAll(e,l.none,t.from,t.to),d.maxOpen(n.finish())}matchTag(e,t,n){for(let o=n?this.tags.indexOf(n)+1:0;o<this.tags.length;o++){var r,i;let n=this.tags[o];if(r=e,i=n.tag,(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,i)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)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],o=r.style;if(0==o.indexOf(e)&&(!r.context||n.matchesContext(r.context))&&(!(o.length>e.length)||61==o.charCodeAt(e.length)&&o.slice(e.length+1)==t)){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?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=q(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=q(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new H(e,H.schemaRules(e)))}}let B={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},F={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},V={ol:!0,ul:!0};function U(e,t,n){return null!=t?!!t|2*("full"===t):e&&"pre"==e.whitespace?3:-5&n}class W{constructor(e,t,n,r,i,o){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=o,this.content=[],this.activeMarks=l.none,this.match=i||(4&o?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(i.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(!(1&this.options)){let e=this.content[this.content.length-1],t;e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))&&(e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=e.withText(e.text.slice(0,e.text.length-t[0].length)))}let t=i.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(i.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&&!B.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class K{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,o=U(null,t.preserveWhitespace,0)|4*!!n;i=r?new W(r.type,r.attrs,l.none,!0,t.topMatch||r.type.contentMatch,o):n?new W(null,null,l.none,!0,null,o):new W(e.schema.topNodeType,null,l.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,{schema:o}=this.parser;if("full"===i||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(i)if("full"===i)n=n.replace(/\r\n?/g,"\n");else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(o.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(o.text(e[n]),t,!/\S/.test(e[n]));n=""}else n=n.replace(/\r?\n|\r/g," ");else 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&&"BR"==i.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}n&&this.insertNode(o.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),s;V.hasOwnProperty(o)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&V.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(s=this.parser.matchTag(e,this,n));e:if(a?a.ignore:F.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let n,r=this.needsBlock;if(B.hasOwnProperty(o))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 e}let s=a&&a.skip?t:this.readStyles(e,t);s&&this.addAll(e,s),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,a,n,!1===a.consuming?s:void 0)}this.localPreserveWS=r}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||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)),!1===n.consuming)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,o;if(t.node)if((o=this.parser.schema.nodes[t.node]).isLeaf)this.insertNode(o.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(o,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 s=this.top;if(o&&o.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;"string"==typeof t.contentElement?r=e.querySelector(t.contentElement):"function"==typeof t.contentElement?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(s)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let o=n?e.childNodes[n]:e.firstChild,s=null==r?null:e.childNodes[r];o!=s;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,o=0;t>=0;t--){let s=this.nodes[t],a=s.findWrapping(e);if(a&&(!r||r.length>a.length+o)&&(r=a,i=s,!a.length))break;if(s.solid){if(n)break;o+=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=t.match.matchType(e.type));let n=l.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):J(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&&(i=this.enterInner(e,t,n,!0,r)),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let s=U(e,i,o.options);4&o.options&&0==o.content.length&&(s|=4);let a=l.none;return n=n.filter(t=>(o.type?!o.type.allowsMarkType(t.type):!J(t.type,e))||(a=t.addToSet(a),!1)),this.nodes.push(new W(e,t,a,r,null,s)),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|=1);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++)null==this.find[t].pos&&1==e.nodeType&&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++)null==this.find[r].pos&&1==e.nodeType&&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,o=(e,s)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;s>=i;s--)if(o(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=i?n.node(s-i).type:null;if(!e||e.name!=a&&!e.isInGroup(a))return!1;s--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let 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 q(e){let t={};for(let n in e)t[n]=e[n];return t}function J(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let o=[],s=e=>{o.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||0>o.indexOf(i)&&s(i))return!0}};if(s(i.contentMatch))return!0}}class G{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Z(t).createDocumentFragment());let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,o=0;for(;n<i.length&&o<e.marks.length;){let t=e.marks[o];if(!this.marks[t.type.name]){o++;continue}if(!t.eq(i[n][0])||!1===t.type.spec.spanning)break;n++,o++}for(;n<i.length;)r=i.pop()[1];for(;o<e.marks.length;){let n=e.marks[o++],s=this.serializeMark(n,e.isInline,t);s&&(i.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return Z(t).createTextNode(e.text);let{dom:n,contentDOM:r}=Q(Z(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&&Q(Z(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return"string"==typeof t?{dom:e.createTextNode(t)}:Q(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new G(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=X(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return X(e.marks)}}function X(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Z(e){return e.document||window.document}let Y=new WeakMap;function Q(e,t,n,r){let i,o,s;if(1==t.nodeType)return{dom:t};if(t.dom&&1==t.dom.nodeType)return t;let a=t[0],l;if("string"!=typeof a)throw RangeError("Invalid array passed to renderSpec");if(r&&(void 0===(o=Y.get(r))&&Y.set(r,(s=null,!function e(t){if(t&&"object"==typeof t)if(Array.isArray(t))if("string"==typeof t[0])s||(s=[]),s.push(t);else for(let n=0;n<t.length;n++)e(t[n]);else for(let n in t)e(t[n])}(r),o=s)),l=o)&&l.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 c=a.indexOf(" ");c>0&&(n=a.slice(0,c),a=a.slice(c+1));let d=n?e.createElementNS(n,a):e.createElement(a),u=t[1],h=1;if(u&&"object"==typeof u&&null==u.nodeType&&!Array.isArray(u)){for(let e in h=2,u)if(null!=u[e]){let t=e.indexOf(" ");t>0?d.setAttributeNS(e.slice(0,t),e.slice(t+1),u[e]):"style"==e&&d.style?d.style.cssText=u[e]:d.setAttribute(e,u[e])}}for(let o=h;o<t.length;o++){let s=t[o];if(0===s){if(o<t.length-1||o>h)throw RangeError("Content hole must be the only child of its parent node");return{dom:d,contentDOM:d}}if("string"==typeof s)d.appendChild(e.createTextNode(s));else{let{dom:t,contentDOM:o}=Q(e,s,n,r);if(d.appendChild(t),o){if(i)throw RangeError("Multiple content holes");i=o}}}return{dom:d,contentDOM:i}}e.s(["DOMParser",0,H,"DOMSerializer",0,G,"Fragment",0,i,"Mark",0,l,"MarkType",0,z,"Node",0,S,"NodeRange",0,x,"ReplaceError",0,c,"Schema",0,_,"Slice",0,d],644575);class ee{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class et{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&et.empty)return et.empty}recover(e){let t=0,n=65535&e;if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+t+(e-(65535&e))/65536}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,o=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let a=this.ranges[s]-(this.inverted?r:0);if(a>e)break;let l=this.ranges[s+i],c=this.ranges[s+o],d=a+l;if(e<=d){let i=l?e==a?-1:e==d?1:t:t,o=a+r+(i<0?0:c);if(n)return o;let u=e==(t<0?a:d)?null:s/3+(e-a)*65536,h=e==a?2:e==d?1:4;return(t<0?e!=a:e!=d)&&(h|=8),new ee(o,h,u)}r+=c-l}return n?e+r:new ee(e+r,0,null)}touches(e,t){let n=0,r=65535&t,i=this.inverted?2:1,o=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let s=this.ranges[t]-(this.inverted?n:0);if(s>e)break;let a=this.ranges[t+i];if(e<=s+a&&t==3*r)return!0;n+=this.ranges[t+o]-a}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 o=this.ranges[r],s=o-(this.inverted?i:0),a=o+(this.inverted?0:i),l=this.ranges[r+t],c=this.ranges[r+n];e(s,s+l,a,a+c),i+=c-l}}invert(){return new et(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?et.empty:new et(e<0?[0,-e,0]:[0,0,e])}}et.empty=new et([]);class en{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(e=0,t=this.maps.length){return new en(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&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],null!=r&&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=[]),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(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new en;return e.appendMappingInverted(this),e}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(null!=i.recover){let t=this.getMirror(n);if(null!=t&&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 ee(e,r,null)}}let er=Object.create(null);class ei{getMap(){return et.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError("Invalid input for Step.fromJSON");let n=er[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in er)throw RangeError("Duplicate use of step JSON ID "+e);return er[e]=t,t.prototype.jsonID=e,t}}class eo{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new eo(e,null)}static fail(e){return new eo(null,e)}static fromReplace(e,t,n,r){try{return eo.ok(e.replace(t,n,r))}catch(e){if(e instanceof c)return eo.fail(e.message);throw e}}}function es(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let o=e.child(i);o.content.size&&(o=o.copy(es(o.content,t,o))),o.isInline&&(o=t(o,n,i)),r.push(o)}return i.fromArray(r)}class ea extends ei{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 d(es(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,r),t.openStart,t.openEnd);return eo.fromReplace(e,this.from,this.to,i)}invert(){return new el(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new ea(t.pos,n.pos,this.mark)}merge(e){return e instanceof ea&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ea(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for AddMarkStep.fromJSON");return new ea(t.from,t.to,e.markFromJSON(t.mark))}}ei.jsonID("addMark",ea);class el extends ei{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 d(es(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return eo.fromReplace(e,this.from,this.to,n)}invert(){return new ea(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new el(t.pos,n.pos,this.mark)}merge(e){return e instanceof el&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new el(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for RemoveMarkStep.fromJSON");return new el(t.from,t.to,e.markFromJSON(t.mark))}}ei.jsonID("removeMark",el);class ec extends ei{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return eo.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return eo.fromReplace(e,this.pos,this.pos+1,new d(i.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new ec(this.pos,t.marks[n]);return new ec(this.pos,this.mark)}}return new ed(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ec(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ec(t.pos,e.markFromJSON(t.mark))}}ei.jsonID("addNodeMark",ec);class ed extends ei{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return eo.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return eo.fromReplace(e,this.pos,this.pos+1,new d(i.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new ec(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ed(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new ed(t.pos,e.markFromJSON(t.mark))}}ei.jsonID("removeNodeMark",ed);class eu extends ei{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&ep(e,this.from,this.to)?eo.fail("Structure replace would overwrite content"):eo.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new et([this.from,this.to-this.from,this.slice.size])}invert(e){return new eu(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),n=this.from==this.to&&eu.MAP_BIAS<0?t:e.mapResult(this.from,1);return n.deletedAcross&&t.deletedAcross?null:new eu(n.pos,Math.max(n.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof eu)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart)if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;else{let t=this.slice.size+e.slice.size==0?d.empty:new d(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new eu(e.from,this.to,t,this.structure)}{let t=this.slice.size+e.slice.size==0?d.empty:new d(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new eu(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for ReplaceStep.fromJSON");return new eu(t.from,t.to,d.fromJSON(e,t.slice),!!t.structure)}}eu.MAP_BIAS=1,ei.jsonID("replace",eu);class eh extends ei{constructor(e,t,n,r,i,o,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=o,this.structure=s}apply(e){if(this.structure&&(ep(e,this.from,this.gapFrom)||ep(e,this.gapTo,this.to)))return eo.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return eo.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?eo.fromReplace(e,this.from,this.to,n):eo.fail("Content does not fit in gap")}getMap(){return new et([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new eh(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||i>n.pos?null:new eh(t.pos,n.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new eh(t.from,t.to,t.gapFrom,t.gapTo,d.fromJSON(e,t.slice),t.insert,!!t.structure)}}function ep(e,t,n){let r=e.resolve(t),i=n-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let e=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function ef(e,t,n,r=n.contentMatch,o=!0){let s=e.doc.nodeAt(t),a=[],l=t+1;for(let t=0;t<s.childCount;t++){let c=s.child(t),u=l+c.nodeSize,h=r.matchType(c.type);if(h){r=h;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new el(l,u,c.marks[t]));if(o&&c.isText&&"pre"!=n.whitespace){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||(r=new d(i.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),a.push(new eu(l+e.index,l+e.index+e[0].length,r))}}else a.push(new eu(l,u,d.empty));l=u}if(!r.validEnd){let t=r.fillBefore(i.empty,!0);e.replace(l,l,new d(t,0,0))}for(let t=a.length-1;t>=0;t--)e.step(a[t])}function em(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let o=e.$from.node(n),s=e.$from.index(n)+r,a=e.$to.indexAfter(n)-i;if(n<e.depth&&o.canReplace(s,a,t))return n;if(0==n||o.type.spec.isolating||!((0==s||o.canReplace(s,o.childCount))&&(a==o.childCount||o.canReplace(0,a))))break;s&&(r=1),a<o.childCount&&(i=1)}return null}function eg(e,t,n=null,r=e){let i=function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.contentMatchAt(r).findWrapping(t);if(!o)return null;let s=o.length?o[0]:t;return n.canReplaceWith(r,i,s)?o:null}(e,t),o=i&&function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.child(r),s=t.contentMatch.findWrapping(o.type);if(!s)return null;let a=(s.length?s[s.length-1]:t).contentMatch;for(let e=r;a&&e<i;e++)a=a.matchType(n.child(e).type);return a&&a.validEnd?s:null}(r,t);return o?i.map(ey).concat({type:t,attrs:n}).concat(o.map(ey)):null}function ey(e){return{type:e,attrs:null}}function eb(e,t,n,r){t.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let i=e.mapping.slice(r).map(n+1+o+s.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function ev(e,t,n,r){t.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+o);e.replaceWith(i,i+1,t.type.schema.text("\n"))}})}function ew(e,t,n=1,r){let i=e.resolve(t),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>o;e--,t--){let n=i.node(e),o=i.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(o,n.childCount),a=r&&r[t+1];a&&(s=s.replaceChild(0,a.type.create(a.attrs)));let l=r&&r[t]||n;if(!n.canReplace(o+1,n.childCount)||!l.type.validContent(s))return!1}let a=i.indexAfter(o),l=r&&r[0];return i.node(o).canReplaceWith(a,a,l?l.type:i.node(o+1).type)}function ex(e,t){let n=e.resolve(t),r=n.index();return ek(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function ek(e,t){return!!(e&&t&&!e.isLeaf&&function(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 o=t.child(i),s=o.type==r?e.type.schema.nodes.text:o.type;if(!(n=n.matchType(s))||!e.type.allowsMarks(o.marks))return!1}return n.validEnd}(e,t))}function eS(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,o,s=r.index(e);if(e==r.depth?(i=r.nodeBefore,o=r.nodeAfter):n>0?(i=r.node(e+1),s++,o=r.node(e).maybeChild(s)):(i=r.node(e).maybeChild(s-1),o=r.node(e+1)),i&&!i.isTextblock&&ek(i,o)&&r.node(e).canReplace(s,s+1))return t;if(0==e)break;t=n<0?r.before(e):r.after(e)}}function eC(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<=(0==n.openStart&&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,o=r.index(t)+ +(n>0),s=r.node(t),a=!1;if(1==e)a=s.canReplace(o,o,i);else{let e=s.contentMatchAt(o).findWrapping(i.firstChild.type);a=e&&s.canReplaceWith(o,o,e[0])}if(a)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function eE(e,t,n=t,r=d.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),o=e.resolve(n);return eM(i,o,r)?new eu(t,n,r):new eN(i,o,r).fit()}function eM(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}ei.jsonID("replaceAround",eh);class eN{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=i.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=i.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,o=n.depth,s=r.depth;for(;o&&s&&1==i.childCount;)i=i.firstChild.content,o--,s--;let a=new d(i,o,s);return e>-1?new eh(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new eu(n.pos,r.pos,a):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=1==t?e:this.unplaced.openStart;n>=0;n--){let e=null,r=(n?(e=eR(this.unplaced.content,n-1).firstChild).content:this.unplaced.content).firstChild;for(let o=this.depth;o>=0;o--){let{type:s,match:a}=this.frontier[o],l,c=null;if(1==t&&(r?a.matchType(r.type)||(c=a.fillBefore(i.from(r),!1)):e&&s.compatibleContent(e.type)))return{sliceDepth:n,frontierDepth:o,parent:e,inject:c};if(2==t&&r&&(l=a.findWrapping(r.type)))return{sliceDepth:n,frontierDepth:o,parent:e,wrap:l};if(e&&a.matchType(e.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=eR(e,t);return!!r.childCount&&!r.firstChild.isLeaf&&(this.unplaced=new d(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=eR(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new d(eA(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new d(eA(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let e=0;e<o.length;e++)this.openFrontierNode(o[e]);let s=this.unplaced,a=n?n.content:s.content,l=s.openStart-e,c=0,u=[],{match:h,type:p}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)u.push(r.child(e));h=h.matchFragment(r)}let f=a.size+e-(s.content.size-s.openEnd);for(;c<a.childCount;){let e=a.child(c),t=h.matchType(e.type);if(!t)break;(++c>1||0==l||e.content.size)&&(h=t,u.push(function e(t,n,r){if(n<=0)return t;let o=t.content;return n>1&&(o=o.replaceChild(0,e(o.firstChild,n-1,1==o.childCount?r-1:0))),n>0&&(o=t.type.contentMatch.fillBefore(o).append(o),r<=0&&(o=o.append(t.type.contentMatch.matchFragment(o).fillBefore(i.empty,!0)))),t.copy(o)}(e.mark(p.allowedMarks(e.marks)),1==c?l:0,c==a.childCount?f:-1)))}let m=c==a.childCount;m||(f=-1),this.placed=eT(this.placed,t,i.from(u)),this.frontier[t].match=h,m&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=a;e<f;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=m?0==e?d.empty:new d(eA(s.content,e-1,1),e-1,f<0?s.openEnd:e-1):new d(eA(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return -1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!eO(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){t: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)),o=eO(e,t,r,n,i);if(o){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=eO(e,n,r,t,!0);if(!i||i.childCount)continue t}return{depth:t,fit:o,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=eT(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=eT(this.placed,this.depth,i.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(i.empty,!0);e.childCount&&(this.placed=eT(this.placed,this.frontier.length,e))}}function eA(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(eA(e.firstChild.content,t-1,n)))}function eT(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(eT(e.lastChild.content,t-1,n)))}function eR(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function eO(e,t,n,r,i){let o=e.node(t),s=i?e.indexAfter(t):e.index(t);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,o.content,s)?a:null}function eD(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}class ej extends ei{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 eo.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 eo.fromReplace(e,this.pos,this.pos+1,new d(i.from(r),0,+!t.isLeaf))}getMap(){return et.empty}invert(e){return new ej(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ej(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw RangeError("Invalid input for AttrStep.fromJSON");return new ej(t.pos,t.attr,t.value)}}ei.jsonID("attr",ej);class eI extends ei{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 eo.ok(n)}getMap(){return et.empty}invert(e){return new eI(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw RangeError("Invalid input for DocAttrStep.fromJSON");return new eI(t.attr,t.value)}}ei.jsonID("docAttr",eI);let eP=class extends Error{};(eP=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n}).prototype=Object.create(Error.prototype),eP.prototype.constructor=eP,eP.prototype.name="TransformError";class eL{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new en}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new eP(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,o)=>{e=Math.min(e,i),t=Math.max(t,o)})}return 1e9==e?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=d.empty){let r=eE(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new d(i.from(n),0,0))}delete(e,t){return this.replace(e,t,d.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return!function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let o=e.doc.resolve(t),s=e.doc.resolve(n);if(eM(o,s,r))return e.step(new eu(t,n,r));let a=eD(o,s);0==a[a.length-1]&&a.pop();let l=-(o.depth+1);a.unshift(l);for(let e=o.depth,t=o.pos-1;e>0;e--,t--){let n=o.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;a.indexOf(e)>-1?l=e:o.before(e)==t&&a.splice(1,0,-e)}let c=a.indexOf(l),u=[],h=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(u.push(n),t==r.openStart)break;e=n.content}for(let e=h-1;e>=0;e--){var p;let t=u[e],n=(p=t.type).spec.defining||p.spec.definingForContent;if(n&&!t.sameMarkup(o.node(Math.abs(l)-1)))h=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let l=(t+h+1)%(r.openStart+1),p=u[l];if(p)for(let t=0;t<a.length;t++){let u=a[(t+c)%a.length],h=!0;u<0&&(h=!1,u=-u);let f=o.node(u-1),m=o.index(u-1);if(f.canReplaceWith(m,m,p.type,p.marks))return e.replace(o.before(u),h?s.after(u):n,new d(function e(t,n,r,o,s){if(n<r){let i=t.firstChild;t=t.replaceChild(0,i.copy(e(i.content,n+1,r,o,i)))}if(n>o){let e=s.contentMatchAt(0),n=e.fillBefore(t).append(t);t=n.append(e.matchFragment(n).fillBefore(i.empty,!0))}return t}(r.content,0,r.openStart,l),l,r.openEnd))}}let f=e.steps.length;for(let i=a.length-1;i>=0&&(e.replace(t,n,r),!(e.steps.length>f));i--){let e=a[i];e<0||(t=o.before(e),n=s.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){var r=e,o=t;if(!n.isInline&&r==o&&this.doc.resolve(r).parent.content.size){let e=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)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)break}return null}(this.doc,r,n.type);null!=e&&(r=o=e)}return this.replaceRange(r,o,new d(i.from(n),0,0)),this}deleteRange(e,t){return!function(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()&&0==r.parentOffset&&0==i.parentOffset){let o=r.sharedDepth(n),s=!1;for(let e=r.depth;e>o;e--)r.node(e).type.spec.isolating&&(s=!0);for(let e=i.depth;e>o;e--)i.node(e).type.spec.isolating&&(s=!0);if(!s){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 o=eD(r,i);for(let t=0;t<o.length;t++){let n=o[t],s=t==o.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(t-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return e.delete(r.before(o),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return!function(e,t,n){let{$from:r,$to:o,depth:s}=t,a=r.before(s+1),l=o.after(s+1),c=a,u=l,h=i.empty,p=0;for(let e=s,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,h=i.from(r.node(e).copy(h)),p++):c--;let f=i.empty,m=0;for(let e=s,t=!1;e>n;e--)t||o.after(e+1)<o.end(e)?(t=!0,f=i.from(o.node(e).copy(f)),m++):u++;e.step(new eh(c,u,a,l,new d(h.append(f),p,m),h.size-p,!0))}(this,e,t),this}join(e,t=1){return!function(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,o=e.doc.resolve(t-n),s=o.node().type;if(i&&s.inlineContent){let e="pre"==s.whitespace,t=!!s.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let a=e.steps.length;if(!1===r){let r=e.doc.resolve(t+n);ev(e,r.node(),r.before(),a)}s.inlineContent&&ef(e,t+n-1,s,o.node().contentMatchAt(o.index()),null==r);let l=e.mapping.slice(a),c=l.map(t-n);if(e.step(new eu(c,l.map(t+n,-1),d.empty,!0)),!0===r){let t=e.doc.resolve(c);eb(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return!function(e,t,n){let r=i.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=i.from(n[e].type.create(n[e].attrs,r))}let o=t.start,s=t.end;e.step(new eh(o,s,o,s,new d(r,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,r=null){var o=this;if(!n.isTextblock)throw RangeError("Type given to setBlockType should be a textblock");let s=o.steps.length;return o.doc.nodesBetween(e,t,(e,t)=>{var a,l,c;let u,h,p="function"==typeof r?r(e):r;if(e.isTextblock&&!e.hasMarkup(n,p)&&(a=o.doc,l=o.mapping.slice(s).map(t),c=n,h=(u=a.resolve(l)).index(),u.parent.canReplaceWith(h,h+1,c))){let r=null;if(n.schema.linebreakReplacement){let e="pre"==n.whitespace,t=!!n.contentMatch.matchType(n.schema.linebreakReplacement);e&&!t?r=!1:!e&&t&&(r=!0)}!1===r&&ev(o,e,t,s),ef(o,o.mapping.slice(s).map(t,1),n,void 0,null===r);let a=o.mapping.slice(s),l=a.map(t,1),c=a.map(t+e.nodeSize,1);return o.step(new eh(l,c,l+1,c-1,new d(i.from(n.create(p,null,e.marks)),0,0),1,!0)),!0===r&&eb(o,e,t,s),!1}}),this}setNodeMarkup(e,t,n=null,r){return!function(e,t,n,r,o){let s=e.doc.nodeAt(t);if(!s)throw RangeError("No node at given position");n||(n=s.type);let a=n.create(r,null,o||s.marks);if(s.isLeaf)return e.replaceWith(t,t+s.nodeSize,a);if(!n.validContent(s.content))throw RangeError("Invalid content for node type "+n.name);e.step(new eh(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new d(i.from(a),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new ej(e,t,n)),this}setDocAttribute(e,t){return this.step(new eI(e,t)),this}addNodeMark(e,t){return this.step(new ec(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError("No node at position "+e);if(t instanceof l)t.isInSet(n.marks)&&this.step(new ed(e,t));else{let r=n.marks,i,o=[];for(;i=t.isInSet(r);)o.push(new ed(e,i)),r=i.removeFromSet(r);for(let e=o.length-1;e>=0;e--)this.step(o[e])}return this}split(e,t=1,n){return!function(e,t,n=1,r){let o=e.doc.resolve(t),s=i.empty,a=i.empty;for(let e=o.depth,t=o.depth-n,l=n-1;e>t;e--,l--){s=i.from(o.node(e).copy(s));let t=r&&r[l];a=i.from(t?t.type.create(t.attrs,a):o.node(e).copy(a))}e.step(new eu(t,t,new d(s.append(a),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){var r;let i,o,s,a;return r=this,s=[],a=[],r.doc.nodesBetween(e,t,(r,l,c)=>{if(!r.isInline)return;let d=r.marks;if(!n.isInSet(d)&&c.type.allowsMarkType(n.type)){let c=Math.max(l,e),u=Math.min(l+r.nodeSize,t),h=n.addToSet(d);for(let e=0;e<d.length;e++)d[e].isInSet(h)||(i&&i.to==c&&i.mark.eq(d[e])?i.to=u:s.push(i=new el(c,u,d[e])));o&&o.to==c?o.to=u:a.push(o=new ea(c,u,n))}}),s.forEach(e=>r.step(e)),a.forEach(e=>r.step(e)),this}removeMark(e,t,n){var r;let i,o;return r=this,i=[],o=0,r.doc.nodesBetween(e,t,(r,s)=>{if(!r.isInline)return;o++;let a=null;if(n instanceof z){let e=r.marks,t;for(;t=n.isInSet(e);)(a||(a=[])).push(t),e=t.removeFromSet(e)}else n?n.isInSet(r.marks)&&(a=[n]):a=r.marks;if(a&&a.length){let n=Math.min(s+r.nodeSize,t);for(let t=0;t<a.length;t++){let r=a[t],l;for(let e=0;e<i.length;e++){let t=i[e];t.step==o-1&&r.eq(i[e].style)&&(l=t)}l?(l.to=n,l.step=o):i.push({style:r,from:Math.max(s,e),to:n,step:o})}}}),i.forEach(e=>r.step(new el(e.from,e.to,e.style))),this}clearIncompatible(e,t,n){return ef(this,e,t,n),this}}e.s(["Mapping",0,en,"RemoveMarkStep",0,el,"ReplaceAroundStep",0,eh,"ReplaceStep",0,eu,"Transform",0,eL,"canJoin",0,ex,"canSplit",0,ew,"dropPoint",0,eC,"findWrapping",0,eg,"joinPoint",0,eS,"liftTarget",0,em,"replaceStep",0,eE],605842);let ez=Object.create(null);class e_{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new e$(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=d.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,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:a,$to:l}=o[s],c=e.mapping.slice(i);e.replaceRange(c.map(a.pos),c.map(l.pos),s?d.empty:t),0==s&&eG(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:o,$to:s}=r[i],a=e.mapping.slice(n),l=a.map(o.pos),c=a.map(s.pos);i?e.deleteRange(l,c):(e.replaceRangeWith(l,c,t),eG(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new eF(e):eJ(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?eJ(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):eJ(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 eK(e.node(0))}static atStart(e){return eJ(e,e,0,0,1)||new eK(e)}static atEnd(e){return eJ(e,e,e.content.size,e.childCount,-1)||new eK(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError("Invalid input for Selection.fromJSON");let n=ez[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in ez)throw RangeError("Duplicate use of selection JSON ID "+e);return ez[e]=t,t.prototype.jsonID=e,t}getBookmark(){return eF.between(this.$anchor,this.$head).getBookmark()}}e_.prototype.visible=!0;class e${constructor(e,t){this.$from=e,this.$to=t}}let eH=!1;function eB(e){eH||e.parent.inlineContent||(eH=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class eF extends e_{constructor(e,t=e){eB(e),eB(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return e_.near(n);let r=e.resolve(t.map(this.anchor));return new eF(r.parent.inlineContent?r:n,n)}replace(e,t=d.empty){if(super.replace(e,t),t==d.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof eF&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new eV(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw RangeError("Invalid input for TextSelection.fromJSON");return new eF(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if((!n||r)&&(n=r>=0?1:-1),!t.parent.inlineContent){let e=e_.findFrom(t,n,!0)||e_.findFrom(t,-n,!0);if(!e)return e_.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r?e=t:(e=(e_.findFrom(e,-n,!0)||e_.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0&&(e=t)),new eF(e,t)}}e_.jsonID("text",eF);class eV{constructor(e,t){this.anchor=e,this.head=t}map(e){return new eV(e.map(this.anchor),e.map(this.head))}resolve(e){return eF.between(e.resolve(this.anchor),e.resolve(this.head))}}class eU extends e_{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),i=e.resolve(r);return n?e_.near(i):new eU(i)}content(){return new d(i.from(this.node),0,0)}eq(e){return e instanceof eU&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new eW(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw RangeError("Invalid input for NodeSelection.fromJSON");return new eU(e.resolve(t.anchor))}static create(e,t){return new eU(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}eU.prototype.visible=!1,e_.jsonID("node",eU);class eW{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new eV(n,n):new eW(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&eU.isSelectable(n)?new eU(t):e_.near(t)}}class eK extends e_{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=d.empty){if(t==d.empty){e.delete(0,e.doc.content.size);let t=e_.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new eK(e)}map(e){return new eK(e)}eq(e){return e instanceof eK}getBookmark(){return eq}}e_.jsonID("all",eK);let eq={map(){return this},resolve:e=>new eK(e)};function eJ(e,t,n,r,i,o=!1){if(t.inlineContent)return eF.create(e,n);for(let s=r-(i>0?0:1);i>0?s<t.childCount:s>=0;s+=i){let r=t.child(s);if(r.isAtom){if(!o&&eU.isSelectable(r))return eU.create(e,n-(i<0?r.nodeSize:0))}else{let t=eJ(e,r,n+i,i<0?r.childCount:0,i,o);if(t)return t}n+=r.nodeSize*i}return null}function eG(e,t,n){let r,i=e.steps.length-1;if(i<t)return;let o=e.steps[i];(o instanceof eu||o instanceof eh)&&(e.mapping.maps[i].forEach((e,t,n,i)=>{null==r&&(r=i)}),e.setSelection(e_.near(e.doc.resolve(r),n)))}class eX extends eL{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(1|this.updated)&-3,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return l.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(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,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)||l.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(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(e_.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function eZ(e,t){return t&&e?e.bind(t):e}class eY{constructor(e,t,n){this.name=e,this.init=eZ(t.init,n),this.apply=eZ(t.apply,n)}}let eQ=[new eY("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new eY("selection",{init:(e,t)=>e.selection||e_.atStart(t.doc),apply:e=>e.selection}),new eY("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new eY("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class e0{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=eQ.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 eY(e.key,e.spec.state,e))})}}class e1{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 o=0;o<this.config.plugins.length;o++){let s=this.config.plugins[o];if(s.spec.appendTransaction){let a=r?r[o].n:0,l=r?r[o].state:this,c=a<t.length&&s.spec.appendTransaction.call(s,a?t.slice(a):t,l,n);if(c&&n.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<o?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),i=!0}r&&(r[o]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw RangeError("Applying a mismatched transaction");let t=new e1(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let i=n[r];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new eX(this)}static create(e){let t=new e0(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new e1(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new e0(this.schema,e.plugins),n=t.fields,r=new e1(t);for(let t=0;t<n.length;t++){let i=n[t].name;r[i]=this.hasOwnProperty(i)?this[i]:n[t].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)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(e,t,n){if(!t)throw RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw RangeError("Required config field 'schema' missing");let r=new e0(e.schema,e.plugins),i=new e1(r);return r.fields.forEach(r=>{if("doc"==r.name)i.doc=S.fromJSON(e.schema,t.doc);else if("selection"==r.name)i.selection=e_.fromJSON(i.doc,t.selection);else if("storedMarks"==r.name)t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let o in n){let s=n[o],a=s.spec.state;if(s.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,o)){i[r.name]=a.fromJSON.call(s,e,t[o],i);return}}i[r.name]=r.init(e,i)}}),i}}class e2{constructor(e){this.spec=e,this.props={},e.props&&function e(t,n,r){for(let i in t){let o=t[i];o instanceof Function?o=o.bind(n):"handleDOMEvents"==i&&(o=e(o,n,{})),r[i]=o}return r}(e.props,this,this.props),this.key=e.key?e.key.key:e3("plugin")}getState(e){return e[this.key]}}let e5=Object.create(null);function e3(e){return e in e5?e+"$"+ ++e5[e]:(e5[e]=0,e+"$")}class e4{constructor(e="key"){this.key=e3(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}e.s(["AllSelection",0,eK,"EditorState",0,e1,"NodeSelection",0,eU,"Plugin",0,e2,"PluginKey",0,e4,"Selection",0,e_,"SelectionRange",0,e$,"TextSelection",0,eF],111092);let e6=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},e9=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},e7=null,e8=function(e,t,n){let r=e7||(e7=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},te=function(){e7=null},tt=function(e,t,n,r){return n&&(tr(e,t,n,r,-1)||tr(e,t,n,r,1))},tn=/^(img|br|input|textarea|hr)$/i;function tr(e,t,n,r,i){for(var o;;){if(e==n&&t==r)return!0;if(t==(i<0?0:ti(e))){let n=e.parentNode;if(!n||1!=n.nodeType||to(e)||tn.test(e.nodeName)||"false"==e.contentEditable)return!1;t=e6(e)+(i<0?0:1),e=n}else{if(1!=e.nodeType)return!1;let n=e.childNodes[t+(i<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable)if(null==(o=n.pmViewDesc)||!o.ignoreForSelection)return!1;else t+=i;else e=n,t=i<0?ti(e):0}}}function ti(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function to(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)}let ts=function(e){return e.focusNode&&tt(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function ta(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}let tl="u">typeof navigator?navigator:null,tc="u">typeof document?document:null,td=tl&&tl.userAgent||"",tu=/Edge\/(\d+)/.exec(td),th=/MSIE \d/.exec(td),tp=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(td),tf=!!(th||tp||tu),tm=th?document.documentMode:tp?+tp[1]:tu?+tu[1]:0,tg=!tf&&/gecko\/(\d+)/i.test(td);tg&&(/Firefox\/(\d+)/.exec(td)||[0,0])[1];let ty=!tf&&/Chrome\/(\d+)/.exec(td),tb=!!ty,tv=ty?+ty[1]:0,tw=!tf&&!!tl&&/Apple Computer/.test(tl.vendor),tx=tw&&(/Mobile\/\w+/.test(td)||!!tl&&tl.maxTouchPoints>2),tk=tx||!!tl&&/Mac/.test(tl.platform),tS=!!tl&&/Win/.test(tl.platform),tC=/Android \d/.test(td),tE=!!tc&&"webkitFontSmoothing"in tc.documentElement.style,tM=tE?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function tN(e,t){return"number"==typeof e?e:e[t]}function tA(e,t,n){let r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument;for(let s=n||e.dom;s;){if(1!=s.nodeType){s=e9(s);continue}let e=s,n=e==o.body,a=n?function(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}}(o):function(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}}(e),l=0,c=0;if(t.top<a.top+tN(r,"top")?c=-(a.top-t.top+tN(i,"top")):t.bottom>a.bottom-tN(r,"bottom")&&(c=t.bottom-t.top>a.bottom-a.top?t.top+tN(i,"top")-a.top:t.bottom-a.bottom+tN(i,"bottom")),t.left<a.left+tN(r,"left")?l=-(a.left-t.left+tN(i,"left")):t.right>a.right-tN(r,"right")&&(l=t.right-a.right+tN(i,"right")),l||c)if(n)o.defaultView.scrollBy(l,c);else{let n=e.scrollLeft,r=e.scrollTop;c&&(e.scrollTop+=c),l&&(e.scrollLeft+=l);let i=e.scrollLeft-n,o=e.scrollTop-r;t={left:t.left-i,top:t.top-o,right:t.right-i,bottom:t.bottom-o}}let d=n?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(d))break;s="absolute"==d?s.offsetParent:e9(s)}}function tT(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=e9(r));return t}function tR(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:o}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=o&&(r.scrollLeft=o)}}let tO=null;function tD(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function tj(e){return e.top<e.bottom||e.left<e.right}function tI(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(tj(e))return e}return Array.prototype.find.call(n,tj)||e.getBoundingClientRect()}let tP=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function tL(e,t,n){let{node:r,offset:i,atom:o}=e.docView.domFromPos(t,n<0?-1:1),s=tE||tg;if(3==r.nodeType)if(s&&(tP.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=tI(e8(r,i,i),n);if(tg&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=tI(e8(r,i-1,i-1),-1);if(t.top==e.top){let n=tI(e8(r,i,i+1),-1);if(n.top!=e.top)return tz(n,n.left<t.left)}}return e}else{let e=i,t=i,o=n<0?1:-1;return n<0&&!i?(t++,o=-1):n>=0&&i==r.nodeValue.length?(e--,o=1):n<0?e--:t++,tz(tI(e8(r,e,t),o),o<0)}if(!e.state.doc.resolve(t-(o||0)).parent.inlineContent){if(null==o&&i&&(n<0||i==ti(r))){let e=r.childNodes[i-1];if(1==e.nodeType)return t_(e.getBoundingClientRect(),!1)}if(null==o&&i<ti(r)){let e=r.childNodes[i];if(1==e.nodeType)return t_(e.getBoundingClientRect(),!0)}return t_(r.getBoundingClientRect(),n>=0)}if(null==o&&i&&(n<0||i==ti(r))){let e=r.childNodes[i-1],t=3==e.nodeType?e8(e,ti(e)-!s):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return tz(tI(t,1),!1)}if(null==o&&i<ti(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?e8(e,0,+!s):1==e.nodeType?e:null:null;if(t)return tz(tI(t,-1),!0)}return tz(tI(3==r.nodeType?e8(r):r,-n),n>=0)}function tz(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function t_(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function t$(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()}}let tH=/[\u0590-\u08ac]/,tB=null,tF=null,tV=!1;class tU{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,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){let r;if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?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}if(e==this.dom&&this.contentDOM)r=t>e6(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),o;if(i&&(!t||i.node))if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;else n=!1}}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],o=t+i.size;if(o>e||i instanceof tZ){r=e-t;break}t=o}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 tW&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;(e=n?this.children[n-1]:null)&&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?e6(e.dom)+1:0}}{let e,r=!0;for(;(e=n<this.children.length?this.children[n]:null)&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?e6(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let o=n,s=0;;s++){let n=this.children[s],a=o+n.size;if(-1==r&&e<=a){let i=o+n.border;if(e>=i&&t<=a-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=o;for(let t=s;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=e6(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(a>t||s==this.children.length-1)){t=a;for(let e=s+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=e6(n.dom);break}t+=n.size}-1==i&&(i=this.contentDOM.childNodes.length);break}o=a}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 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||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),o=Math.max(e,t);for(let s=0,a=0;s<this.children.length;s++){let l=this.children[s],c=a+l.size;if(i>a&&o<c)return l.setSelection(e-a-l.border,t-a-l.border,n,r);a=c}let s=this.domFromPos(e,e?-1:1),a=t==e?s:this.domFromPos(t,t?-1:1),l=n.root.getSelection(),c=n.domSelectionRange(),d=!1;if((tg||tw)&&e==t){let{node:e,offset:t}=s;if(3==e.nodeType){if((d=!!(t&&"\n"==e.nodeValue[t-1]))&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){"BR"==n.nodeName&&(s=a={node:n.parentNode,offset:e6(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];d=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(tg&&c.focusNode&&c.focusNode!=a.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||d&&tw)&&tt(s.node,s.offset,c.anchorNode,c.anchorOffset)&&tt(a.node,a.offset,c.focusNode,c.focusOffset))return;let u=!1;if((l.extend||e==t)&&!(d&&tg)){l.collapse(s.node,s.offset);try{e!=t&&l.extend(a.node,a.offset),u=!0}catch(e){}}if(!u){if(e>t){let e=s;s=a,a=e}let n=document.createRange();n.setEnd(a.node,a.offset),n.setStart(s.node,s.offset),l.removeAllRanges(),l.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}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],o=n+i.size;if(n==o?e<=o&&t>=n:e<o&&t>n){let r=n+i.border,s=o-i.border;if(e>=r&&t<=s){this.dirty=e==n||t==o?2:1,e==r&&t==s&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=3:i.markDirty(e-r,t-r);return}i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}n=o}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class tW extends tU{constructor(e,t,n,r){let i,o=t.type.toDOM;if("function"==typeof o&&(o=o(n,()=>i?i.parent?i.parent.posBeforeChild(i):void 0:r)),!t.type.spec.raw){if(1!=o.nodeType){let e=document.createElement("span");e.appendChild(o),o=e}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class tK extends tU{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.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class tq extends tU{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(e,t,n,r){let i=r.nodeViews[t.type.name],o=i&&i(t,r,n);return o&&o.dom||(o=G.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new tq(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=tq.create(this.parent,this.mark,!0,n),i=this.children,o=this.size;t<o&&(i=t7(i,t,o,n)),e>0&&(i=t7(i,0,e,n));for(let e=0;e<i.length;e++)i[e].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class tJ extends tU{constructor(e,t,n,r,i,o,s,a,l){super(e,[],i,o),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s}static create(e,t,n,r,i,o){let s=i.nodeViews[t.type.name],a,l=s&&s(t,i,()=>a?a.parent?a.parent.posBeforeChild(a):void 0:o,n,r),c=l&&l.dom,d=l&&l.contentDOM;if(t.isText)if(c){if(3!=c.nodeType)throw RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(t.text);else if(!c){let e=G.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:c,contentDOM:d}=e)}d||t.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let u=c;return(c=t5(c,n,t),l)?a=new tY(e,t,n,r,c,d||null,u,l,i,o+1):t.isText?new tX(e,t,n,r,c,u,i):new tJ(e,t,n,r,c,d||null,u,i,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){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=()=>i.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&t3(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,o=i&&i.pos>-1?i:null,s=i&&i.pos<0,a=new t6(this,o&&o.node,e);(function(e,t,n,r){let i=t.locals(e),o=0;if(0==i.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);r(s,i,t.forChild(o,s),n),o+=s.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let d,u,h,p;for(;s<i.length&&i[s].to==o;){let e=i[s++];e.widget&&(d?(u||(u=[d])).push(e):d=e)}if(d)if(u){u.sort(t9);for(let e=0;e<u.length;e++)n(u[e],c,!!l)}else n(d,c,!!l);if(l)p=-1,h=l,l=null;else if(c<e.childCount)p=c,h=e.child(c++);else break;for(let e=0;e<a.length;e++)a[e].to<=o&&a.splice(e--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)a.push(i[s++]);let f=o+h.nodeSize;if(h.isText){let e=f;s<i.length&&i[s].from<e&&(e=i[s].from);for(let t=0;t<a.length;t++)a[t].to<e&&(e=a[t].to);e<f&&(l=h.cut(e-o),h=h.cut(0,e-o),f=e,p=-1)}else for(;s<i.length&&i[s].to<f;)s++;let m=h.isInline&&!h.isLeaf?a.filter(e=>!e.inline):a.slice();r(h,m,t.forChild(o,h),p),o=f}})(this.node,this.innerDeco,(t,i,o)=>{t.spec.marks?a.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!o&&a.syncToMarks(i==this.node.childCount?l.none:this.node.child(i).marks,n,e,i),a.placeWidget(t,e,r)},(t,o,l,c)=>{let d;a.syncToMarks(t.marks,n,e,c),a.findNodeMatch(t,o,l,c)||s&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(d=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(t,o,l,d,e)||a.updateNextNode(t,o,l,e,c,r)||a.addNode(t,o,l,e,r),r+=t.nodeSize}),a.syncToMarks([],n,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(o&&this.protectLocalComposition(e,o),function e(t,n,r){let i=t.firstChild,o=!1;for(let s=0;s<n.length;s++){let a=n[s],l=a.dom;if(l.parentNode==t){for(;l!=i;)i=t4(i),o=!0;i=i.nextSibling}else o=!0,t.insertBefore(l,i);if(a instanceof tq){let n=i?i.previousSibling:t.lastChild;e(a.contentDOM,a.children,r),i=n?n.nextSibling:t.firstChild}}for(;i;)i=t4(i),o=!0;o&&r.trackWrites==t&&(r.trackWrites=null)}(this.contentDOM,this.children,e),tx&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof eF)||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)return{node:i,pos:-1,text:""};{let e=i.nodeValue,o=function(e,t,n,r){for(let i=0,o=0;i<e.childCount&&o<=r;){let s=e.child(i++),a=o;if(o+=s.nodeSize,!s.isText)continue;let l=s.text;for(;i<e.childCount;){let t=e.child(i++);if(o+=t.nodeSize,!t.isText)break;l+=t.text}if(o>=n){if(o>=r&&l.slice(r-t.length-a,r-a)==t)return r-t.length;let e=a<r?l.lastIndexOf(t,r-a-1):-1;if(e>=0&&e+t.length+a>=n)return a+e;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return -1}(this.node.content,e,n-t,r-t);return o<0?null:{node:i,pos:o,text:e}}}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&&(i.pmViewDesc=void 0)}let o=new tK(this,i,t,r);e.input.compositionNodes.push(o),this.children=t7(this.children,n,n+r.length,e,o)}update(e,t,n,r){return 3!=this.dirty&&!!e.sameMarkup(this.node)&&(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=0}updateOuterDeco(e){if(t3(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=t2(this.dom,this.nodeDOM,t1(this.outerDeco,this.node,t),t1(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function tG(e,t,n,r,i){t5(r,t,e);let o=new tJ(void 0,e,t,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class tX extends tJ{constructor(e,t,n,r,i,o,s){super(e,t,n,r,i,null,o,s,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 3!=this.dirty&&(0==this.dirty||!!this.inParent())&&!!e.sameMarkup(this.node)&&(this.updateOuterDeco(t),(0!=this.dirty||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=0,!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"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),i=document.createTextNode(r.text);return new tX(this.parent,r,this.outerDeco,this.innerDeco,i,i,n)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(0==e||t==this.nodeDOM.nodeValue.length)&&(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class tZ extends tU{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class tY extends tJ{constructor(e,t,n,r,i,o,s,a,l,c){super(e,t,n,r,i,o,s,l,c),this.spec=a}update(e,t,n,r){if(3==this.dirty)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}return(!!this.contentDOM||!!e.isLeaf)&&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)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}let tQ=function(e){e&&(this.nodeName=e)};tQ.prototype=Object.create(null);let t0=[new tQ];function t1(e,t,n){if(0==e.length)return t0;let r=n?t0[0]:new tQ,i=[r];for(let o=0;o<e.length;o++){let s=e[o].type.attrs;if(s)for(let e in s.nodeName&&i.push(r=new tQ(s.nodeName)),s){let o=s[e];null!=o&&(n&&1==i.length&&i.push(r=new tQ(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+o:"style"==e?r.style=(r.style?r.style+";":"")+o:"nodeName"!=e&&(r[e]=o))}}return i}function t2(e,t,n,r){if(n==t0&&r==t0)return t;let i=t;for(let t=0;t<r.length;t++){let o=r[t],s=n[t];if(t){let t;s&&s.nodeName==o.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==o.nodeName||((t=document.createElement(o.nodeName)).pmIsDeco=!0,t.appendChild(i),s=t0[0]),i=t}!function(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&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++)-1==i.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)-1==r.indexOf(i[t])&&e.classList.add(i[t]);0==e.classList.length&&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)}}(i,s||t0[0],o)}return i}function t5(e,t,n){return t2(e,e,t0,t1(t,n,1!=e.nodeType))}function t3(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 t4(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class t6{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,i=e.childCount,o=new Map,s=[];n:for(;i>0;){let a;for(;;)if(r){let e=n.children[r-1];if(e instanceof tq)n=e,r=e.children.length;else{a=e,r--;break}}else if(n==t)break n;else r=n.parent.children.indexOf(n),n=n.parent;let l=a.node;if(l){if(l!=e.child(i-1))break;--i,o.set(a,i),s.push(a)}}return{index:i,matched:o,matches:s.reverse()}}(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,o=this.stack.length>>1,s=Math.min(o,e.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&!1!==e[i].type.spec.spanning;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let i=-1,s=this.top.children.length;r<this.preMatch.index&&(s=Math.min(this.index+3,s));for(let t=this.index;t<s;t++){let n=this.top.children[t];if(n.matchesMark(e[o])&&!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=tq.create(this.top,e[o],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,n,r){let i=-1,o;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(let r=this.index,o=Math.min(this.top.children.length,r+5);r<o;r++){let o=this.top.children[r];if(o.matchesNode(e,t,n)&&!this.preMatch.matched.has(o)){i=r;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let o=this.top.children[r];return 3==o.dirty&&o.dom==o.contentDOM&&(o.dirty=2),!!o.update(e,t,n,i)&&(this.destroyBetween(this.index,r),this.index++,!0)}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,o){for(let s=this.index;s<this.top.children.length;s++){let a=this.top.children[s];if(a instanceof tJ){let l=this.preMatch.matched.get(a);if(null!=l&&l!=i)return!1;let c=a.dom,d,u=this.isLocked(c)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&t3(t,a.outerDeco));if(!u&&a.update(e,t,n,r))return this.destroyBetween(this.index,s),a.dom!=c&&(this.changed=!0),this.index++,!0;if(!u&&(d=this.recreateWrapper(a,e,t,n,r,o)))return this.destroyBetween(this.index,s),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=2,d.updateChildren(r,o+1),d.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!t3(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let s=tJ.create(this.top,t,n,r,i,o);if(s.contentDOM)for(let t of(s.children=e.children,e.children=[],s.children))t.parent=s;return e.destroy(),s}addNode(e,t,n,r,i){let o=tJ.create(this.top,e,t,n,r,i);o.contentDOM&&o.updateChildren(r,i+1),this.top.children.splice(this.index++,0,o),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 tW(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 tq;)e=(t=e).children[t.children.length-1];(!e||!(e instanceof tX)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((tw||tb)&&e&&"false"==e.dom.contentEditable&&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);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new tZ(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function t9(e,t){return e.type.side-t.type.side}function t7(e,t,n,r,i){let o=[];for(let s=0,a=0;s<e.length;s++){let l=e[s],c=a,d=a+=l.size;c>=n||d<=t?o.push(l):(c<t&&o.push(l.slice(0,t-c,r)),i&&(o.push(i),i=void 0),d>n&&o.push(l.slice(n-c,l.size,r)))}return o}function t8(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),o=i&&0==i.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,c;if(ts(n)){for(l=s;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&eU.isSelectable(e)&&i.parent&&!(e.isInline&&function(e,t,n){for(let r=0==t,i=t==ti(e);r||i;){if(e==n)return!0;let t=e6(e);if(!(e=e.parentNode))return!1;r=r&&0==t,i=i&&t==ti(e)}}(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;c=new eU(s==e?a:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=s,i=s;for(let r=0;r<n.rangeCount;r++){let o=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(o.startContainer,o.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(o.endContainer,o.endOffset,-1))}if(t<0)return null;[l,s]=i==e.state.selection.anchor?[i,t]:[t,i],a=r.resolve(s)}else l=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let d=r.resolve(l);if(!c){let n="pointer"==t||e.state.selection.head<a.pos&&!o?1:-1;c=nl(e,d,a,n)}return c}function ne(e){return e.editable?e.hasFocus():nd(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function nt(e,t=!1){let n=e.state.selection;if(ns(e,n),ne(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&tb){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&tt(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r="IMG"==n.nodeName;r?t.collapse(n.parentNode,e6(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&tf&&tm<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{var r;let i,o,s,a,{anchor:l,head:c}=n,d,u;nn&&!(n instanceof eF)&&(n.$from.parent.inlineContent||(d=nr(e,n.from)),n.empty||n.$from.parent.inlineContent||(u=nr(e,n.to))),e.docView.setSelection(l,c,e,t),nn&&(d&&no(d),u&&no(u)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&((i=(r=e).dom.ownerDocument).removeEventListener("selectionchange",r.input.hideSelectionGuard),s=(o=r.domSelectionRange()).anchorNode,a=o.anchorOffset,i.addEventListener("selectionchange",r.input.hideSelectionGuard=()=>{(o.anchorNode!=s||o.anchorOffset!=a)&&(i.removeEventListener("selectionchange",r.input.hideSelectionGuard),setTimeout(()=>{(!ne(r)||r.state.selection.visible)&&r.dom.classList.remove("ProseMirror-hideselection")},20))})))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}let nn=tw||tb&&tv<63;function nr(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(tw&&i&&"false"==i.contentEditable)return ni(i);if((!i||"false"==i.contentEditable)&&(!o||"false"==o.contentEditable)){if(i)return ni(i);else if(o)return ni(o)}}function ni(e){return e.contentEditable="true",tw&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function no(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function ns(e,t){if(t instanceof eU){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(na(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else na(e)}function na(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function nl(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||eF.between(t,n,r)}function nc(e){return(!e.editable||!!e.hasFocus())&&nd(e)}function nd(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function nu(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return o&&e_.findFrom(o,t)}function nh(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function np(e,t,n){let r=e.state.selection;if(r instanceof eF){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 o=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return nh(e,new eF(r.$anchor,o))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?"forward":"backward")){let n=nu(e.state,t);return!!n&&n instanceof eU&&nh(e,n)}else if(!(tk&&n.indexOf("m")>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,o;if(!i||i.isText)return!1;let s=t<0?n.pos-i.nodeSize:n.pos;return!!(i.isAtom||(o=e.docView.descAt(s))&&!o.contentDOM)&&(eU.isSelectable(i)?nh(e,new eU(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):!!tE&&nh(e,new eF(e.state.doc.resolve(t<0?s:s+i.nodeSize))))}}else{if(r instanceof eU&&r.node.isInline)return nh(e,new eF(t>0?r.$to:r.$from));let n=nu(e.state,t);return!!n&&nh(e,n)}}function nf(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function nm(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function ng(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,o,s=!1;for(tg&&1==n.nodeType&&r<nf(n)&&nm(n.childNodes[r],-1)&&(s=!0);;)if(r>0)if(1!=n.nodeType)break;else{let e=n.childNodes[r-1];if(nm(e,-1))i=n,o=--r;else if(3==e.nodeType)r=(n=e).nodeValue.length;else break}else if(ny(n))break;else{let t=n.previousSibling;for(;t&&nm(t,-1);)i=n.parentNode,o=e6(t),t=t.previousSibling;if(t)r=nf(n=t);else{if((n=n.parentNode)==e.dom)break;r=0}}s?nb(e,n,r):i&&nb(e,i,o)}(e):function(e){let t,n,r=e.domSelectionRange(),i=r.focusNode,o=r.focusOffset;if(!i)return;let s=nf(i);for(;;)if(o<s){if(1!=i.nodeType)break;if(nm(i.childNodes[o],1))t=i,n=++o;else break}else if(ny(i))break;else{let r=i.nextSibling;for(;r&&nm(r,1);)t=r.parentNode,n=e6(r)+1,r=r.nextSibling;if(r)o=0,s=nf(i=r);else{if((i=i.parentNode)==e.dom)break;o=s=0}}t&&nb(e,t,n)}(e)}function ny(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function nb(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!to(e);)t=e6(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=r,n=0):(e=function(e,t){for(;e&&!t&&!to(e);)t=e6(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(ts(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&&nt(e)},50)}function nv(e,t){let n=e.state.doc.resolve(t);if(!(tb||tS)&&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"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function nw(e,t,n){let r=e.state.selection;if(r instanceof eF&&!r.empty||n.indexOf("s")>-1||tk&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=nu(e.state,t);if(n&&n instanceof eU)return nh(e,n)}if(!i.parent.inlineContent){let n=t<0?i:o,s=r instanceof eK?e_.near(n,t):e_.findFrom(n,t);return!!s&&nh(e,s)}return!1}function nx(e,t){if(!(e.state.selection instanceof eF))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 o=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let r=e.state.tr;return t<0?r.delete(n.pos-o.nodeSize,n.pos):r.delete(n.pos,n.pos+o.nodeSize),e.dispatch(r),!0}return!1}function nk(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function nS(e,t){e.someProp("transformCopied",n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:o}=t;for(;i>1&&o>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,o--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let s=e.someProp("clipboardSerializer")||G.fromSchema(e.state.schema),a=nO(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,d,u=0;for(;c&&1==c.nodeType&&(d=nT[c.nodeName.toLowerCase()]);){for(let e=d.length-1;e>=0;e--){let t=a.createElement(d[e]);for(;l.firstChild;)t.appendChild(l.firstChild);l.appendChild(t),u++}c=l.firstChild}return c&&1==c.nodeType&&c.setAttribute("data-pm-slice",`${i} ${o}${u?` -${u}`:""} ${JSON.stringify(n)}`),{dom:l,text:e.someProp("clipboardTextSerializer",n=>n(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function nC(e,t,n,r,o){let s,a,l=o.parent.type.spec.code;if(!n&&!t)return null;let c=!!t&&(r||l||!n);if(c){if(e.someProp("transformPastedText",n=>{t=n(t,l||r,e)}),l)return a=new d(i.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{a=t(a,e,!0)}),a;let n=e.someProp("clipboardTextParser",n=>n(t,o,r,e));if(n)a=n;else{let n=o.marks(),{schema:r}=e.state,i=G.fromSchema(r);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=s.appendChild(document.createElement("p"));e&&t.appendChild(i.serializeNode(r.text(e,n)))})}}else e.someProp("transformPastedHTML",t=>{n=t(n,e)}),s=function(e){var t;let n,r=/^(\s*<meta [^>]*>)*/.exec(e);r&&(e=e.slice(r[0].length));let i=nO().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e),s;if((s=o&&nT[o[1].toLowerCase()])&&(e=s.map(e=>"<"+e+">").join("")+e+s.map(e=>"</"+e+">").reverse().join("")),i.innerHTML=(t=e,(n=window.trustedTypes)?(nD||(nD=n.defaultPolicy||n.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})),nD.createHTML(t)):t),s)for(let e=0;e<s.length;e++)i=i.querySelector(s[e])||i;return i}(n),tE&&function(e){let t=e.querySelectorAll(tb?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(s);let u=s&&s.querySelector("[data-pm-slice]"),h=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let e=+h[3];e>0;e--){let e=s.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;s=e}if(a||(a=(e.someProp("clipboardParser")||e.someProp("domParser")||H.fromSchema(e.state.schema)).parseSlice(s,{preserveWhitespace:!!(c||h),context:o,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||nE.test(e.parentNode.nodeName)?null:{ignore:!0}})),h)a=function(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch(t){return e}let{content:o,openStart:s,openEnd:a}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;o=i.from(t.create(r[e+1],o)),s++,a++}return new d(o,s,a)}(nA(a,+h[1],+h[2]),h[4]);else if((a=d.maxOpen(function(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)),o,s=[];if(e.forEach(e=>{if(!s)return;let t=r.findWrapping(e.type),n;if(!t)return s=null;if(n=s.length&&o.length&&function e(t,n,r,o,s){if(s<t.length&&s<n.length&&t[s]==n[s]){let a=e(t,n,r,o.lastChild,s+1);if(a)return o.copy(o.content.replaceChild(o.childCount-1,a));if(o.contentMatchAt(o.childCount).matchType(s==t.length-1?r.type:t[s+1]))return o.copy(o.content.append(i.from(nM(r,t,s+1))))}}(t,o,e,s[s.length-1],0))s[s.length-1]=n;else{s.length&&(s[s.length-1]=function e(t,n){if(0==n)return t;let r=t.content.replaceChild(t.childCount-1,e(t.lastChild,n-1)),o=t.contentMatchAt(t.childCount).fillBefore(i.empty,!0);return t.copy(r.append(o))}(s[s.length-1],o.length));let n=nM(e,t);s.push(n),r=r.matchType(n.type),o=t}}),s)return i.from(s)}return e}(a.content,o),!0)).openStart||a.openEnd){let e=0,t=0;for(let t=a.content.firstChild;e<a.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=a.content.lastChild;t<a.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);a=nA(a,e,t)}return e.someProp("transformPasted",t=>{a=t(a,e,c)}),a}let nE=/^(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 nM(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,i.from(e));return e}function nN(e,t,n,r,o,s){let a=t<0?e.firstChild:e.lastChild,l=a.content;return e.childCount>1&&(s=0),o<r-1&&(l=nN(l,t,n,r,o+1,s)),o>=n&&(l=t<0?a.contentMatchAt(0).fillBefore(l,s<=o).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(i.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,a.copy(l))}function nA(e,t,n){return t<e.openStart&&(e=new d(nN(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new d(nN(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}let nT={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},nR=null;function nO(){return nR||(nR=document.implementation.createHTMLDocument("title"))}let nD=null,nj={},nI={},nP={touchstart:!0,touchmove:!0};class nL{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 nz(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function n_(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>n$(e,t))})}function n$(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function nH(e){return{left:e.clientX,top:e.clientY}}function nB(e,t,n,r,i){if(-1==r)return!1;let o=e.state.doc.resolve(r);for(let r=o.depth+1;r>0;r--)if(e.someProp(t,t=>r>o.depth?t(e,n,o.nodeAfter,o.before(r),i,!0):t(e,n,o.node(r),o.before(r),i,!1)))return!0;return!1}function nF(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}nI.keydown=(e,t)=>{if((e.input.shiftKey=16==t.keyCode||t.shiftKey,!nW(e,t))&&(e.input.lastKeyCode=t.keyCode,e.input.lastKeyCodeTime=Date.now(),!tC||!tb||13!=t.keyCode))if(229!=t.keyCode&&e.domObserver.forceFlush(),!tx||13!=t.keyCode||t.ctrlKey||t.altKey||t.metaKey)e.someProp("handleKeyDown",n=>n(e,t))||function(e,t){let n,r=t.keyCode,i=(n="",t.ctrlKey&&(n+="c"),t.metaKey&&(n+="m"),t.altKey&&(n+="a"),t.shiftKey&&(n+="s"),n);if(8==r||tk&&72==r&&"c"==i)return nx(e,-1)||ng(e,-1);if(46==r&&!t.shiftKey||tk&&68==r&&"c"==i)return nx(e,1)||ng(e,1);if(13==r||27==r)return!0;if(37==r||tk&&66==r&&"c"==i){let t=37==r?"ltr"==nv(e,e.state.selection.from)?-1:1:-1;return np(e,t,i)||ng(e,t)}if(39==r||tk&&70==r&&"c"==i){let t=39==r?"ltr"==nv(e,e.state.selection.from)?1:-1:1;return np(e,t,i)||ng(e,t)}else if(38==r||tk&&80==r&&"c"==i)return nw(e,-1,i)||ng(e,-1);else if(40==r||tk&&78==r&&"c"==i)return function(e){if(!tw||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;nk(e,n,"true"),setTimeout(()=>nk(e,n,"false"),20)}return!1}(e)||nw(e,1,i)||ng(e,1);else if(i==(tk?"m":"c")&&(66==r||73==r||89==r||90==r))return!0;return!1}(e,t)?t.preventDefault():nz(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,ta(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},nI.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},nI.keypress=(e,t)=>{if(nW(e,t)||!t.charCode||t.ctrlKey&&!t.altKey||tk&&t.metaKey)return;if(e.someProp("handleKeyPress",n=>n(e,t)))return void t.preventDefault();let n=e.state.selection;if(!(n instanceof eF)||!n.$from.sameParent(n.$to)){let r=String.fromCharCode(t.charCode),i=()=>e.state.tr.insertText(r).scrollIntoView();/[\r\n]/.test(r)||e.someProp("handleTextInput",t=>t(e,n.$from.pos,n.$to.pos,r,i))||e.dispatch(i()),t.preventDefault()}};let nV=tk?"metaKey":"ctrlKey";nj.mousedown=(e,t)=>{var n;let r,i;e.input.shiftKey=t.shiftKey;let o=nG(e),s=Date.now(),a="singleClick";s-e.input.lastClick.time<500&&(r=(n=e.input.lastClick).x-t.clientX)*r+(i=n.y-t.clientY)*i<100&&!t[nV]&&e.input.lastClick.button==t.button&&("singleClick"==e.input.lastClick.type?a="doubleClick":"doubleClick"==e.input.lastClick.type&&(a="tripleClick")),e.input.lastClick={time:s,x:t.clientX,y:t.clientY,type:a,button:t.button};let l=e.posAtCoords(nH(t));l&&("singleClick"==a?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new nU(e,l,t,!!o)):("doubleClick"==a?function(e,t,n,r){return nB(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}:function(e,t,n,r){return nB(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",n=>n(e,t,r))||function(e,t,n){if(0!=n.button)return!1;let r=e.state.doc;if(-1==t)return!!r.inlineContent&&(nF(e,eF.create(r,0,r.content.size),"pointer"),!0);let i=r.resolve(t);for(let t=i.depth+1;t>0;t--){let n=t>i.depth?i.nodeAfter:i.node(t),o=i.before(t);if(n.inlineContent)nF(e,eF.create(r,o+1,o+1+n.content.size),"pointer");else{if(!eU.isSelectable(n))continue;nF(e,eU.create(r,o),"pointer")}return!0}}(e,n,r)})(e,l.pos,l.inside,t)?t.preventDefault():nz(e,"pointer"))};class nU{constructor(e,t,n,r){let i,o;if(this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[nV],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,o=n.depth?n.before():0}const s=r?null:n.target,a=s?e.docView.nearestDesc(s,!0):null;this.target=a&&1==a.nodeDOM.nodeType?a.nodeDOM:null;let{selection:l}=e.state;0==n.button&&(i.type.spec.draggable&&!1!==i.type.spec.selectable||l instanceof eU&&l.from<=o&&l.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&tg&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),nz(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>nt(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;if(this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(nH(e))),this.updateAllowDefault(e),this.allowDefault||!t)nz(this.view,"pointer");else{var n,r,i,o;(n=this.view,r=t.pos,i=t.inside,o=this.selectNode,nB(n,"handleClickOn",r,i,e)||n.someProp("handleClick",t=>t(n,r,e))||(o?function(e,t){if(-1==t)return!1;let n=e.state.selection,r,i;n instanceof eU&&(r=n.node);let o=e.state.doc.resolve(t);for(let e=o.depth+1;e>0;e--){let t=e>o.depth?o.nodeAfter:o.node(e);if(eU.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?o.before(n.$from.depth):o.before(e);break}}return null!=i&&(nF(e,eU.create(e.state.doc,i),"pointer"),!0)}(n,i):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&eU.isSelectable(r))&&(nF(e,new eU(n),"pointer"),!0)}(n,i)))?e.preventDefault():0==e.button&&(this.flushed||tw&&this.mightDrag&&!this.mightDrag.node.isAtom||tb&&!this.view.state.selection.visible&&2>=Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to)))?(nF(this.view,e_.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):nz(this.view,"pointer")}}move(e){this.updateAllowDefault(e),nz(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function nW(e,t){return!!e.composing||!!(tw&&500>Math.abs(t.timeStamp-e.input.compositionEndedAt))&&(e.input.compositionEndedAt=-2e8,!0)}nj.touchstart=e=>{e.input.lastTouch=Date.now(),nG(e),nz(e,"pointer")},nj.touchmove=e=>{e.input.lastTouch=Date.now(),nz(e,"pointer")},nj.contextmenu=e=>nG(e);let nK=tC?5e3:-1;function nq(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>nG(e),t))}function nJ(e){let t;for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=((t=document.createEvent("Event")).initEvent("event",!0,!0),t.timeStamp));e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function nG(e,t=!1){if(!tC||!(e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),nJ(e),t||e.docView&&e.docView.dirty){let n=t8(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}}nI.compositionstart=nI.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof eF&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||tb&&tS&&function(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||1!=t.nodeType||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return 1==r.nodeType&&"false"==r.contentEditable}(e)))e.markCursor=e.state.storedMarks||n.marks(),nG(e,!0),e.markCursor=null;else if(nG(e,!t.selection.empty),tg&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}nq(e,nK)},nI.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,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++,nq(e,20))};let nX=tf&&tm<15||tx&&tM<604;function nZ(e,t,n,r,i){let o=nC(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,i,o||d.empty)))return!0;if(!o)return!1;let s=0==o.openStart&&0==o.openEnd&&1==o.content.childCount?o.content.firstChild:null,a=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(o);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function nY(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," "):""}nj.copy=nI.cut=(e,t)=>{let n=e.state.selection,r="cut"==t.type;if(n.empty)return;let i=nX?null:t.clipboardData,{dom:o,text:s}=nS(e,n.content());i?(t.preventDefault(),i.clearData(),i.setData("text/html",o.innerHTML),i.setData("text/plain",s)):function(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)}(e,o),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},nI.paste=(e,t)=>{if(e.composing&&!tC)return;let n=nX?null:t.clipboardData,r=e.input.shiftKey&&45!=e.input.lastKeyCode;n&&nZ(e,nY(n),n.getData("text/html"),r,t)?t.preventDefault():function(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&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?nZ(e,r.value,null,i,t):nZ(e,r.textContent,r.innerHTML,i,t)},50)}(e,t)};class nQ{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}let n0=tk?"altKey":"ctrlKey";function n1(e,t){let n;return e.someProp("dragCopies",e=>{n=n||e(t)}),null!=n?!n:!t[n0]}for(let e in nj.dragstart=(e,t)=>{let n,r=e.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=e.state.selection,o=i.empty?null:e.posAtCoords(nH(t));if(o&&o.pos>=i.from&&o.pos<=(i instanceof eU?i.to-1:i.to));else if(r&&r.mightDrag)n=eU.create(e.state.doc,r.mightDrag.pos);else if(t.target&&1==t.target.nodeType){let r=e.docView.nearestDesc(t.target,!0);r&&r.node.type.spec.draggable&&r!=e.docView&&(n=eU.create(e.state.doc,r.posBefore))}let s=(n||e.state.selection).content(),{dom:a,text:l,slice:c}=nS(e,s);t.dataTransfer.files.length&&tb&&!(tv>120)||t.dataTransfer.clearData(),t.dataTransfer.setData(nX?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",nX||t.dataTransfer.setData("text/plain",l),e.dragging=new nQ(c,n1(e,t),n)},nj.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},nI.dragover=nI.dragenter=(e,t)=>t.preventDefault(),nI.drop=(e,t)=>{try{!function(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(nH(t));if(!r)return;let i=e.state.doc.resolve(r.pos),o=n&&n.slice;o?e.someProp("transformPasted",t=>{o=t(o,e,!1)}):o=nC(e,nY(t.dataTransfer),nX?null:t.dataTransfer.getData("text/html"),!1,i);let s=!!(n&&n1(e,t));if(e.someProp("handleDrop",n=>n(e,t,o||d.empty,s)))return t.preventDefault();if(!o)return;t.preventDefault();let a=o?eC(e.state.doc,i.pos,o):i.pos;null==a&&(a=i.pos);let l=e.state.tr;if(s){let{node:e}=n;e?e.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,h=l.doc;if(u?l.replaceRangeWith(c,c,o.content.firstChild):l.replaceRange(c,c,o),l.doc.eq(h))return;let p=l.doc.resolve(c);if(u&&eU.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new eU(p));else{let t=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),l.setSelection(nl(e,p,l.doc.resolve(t)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},nj.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())&&nt(e)},20))},nj.blur=(e,t)=>{e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),t.relatedTarget&&e.dom.contains(t.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},nj.beforeinput=(e,t)=>{if(tb&&tC&&"deleteContentBackward"==t.inputType){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,ta(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)}},nI)nj[e]=nI[e];function n2(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}class n5{constructor(e,t){this.toDOM=e,this.spec=t||n7,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:o}=e.mapResult(t.from+r,this.side<0?-1:1);return o?null:new n6(i-n,i-n,this)}valid(){return!0}eq(e){return this==e||e instanceof n5&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&n2(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class n3{constructor(e,t){this.attrs=e,this.spec=t||n7}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=o?null:new n6(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof n3&&n2(this.attrs,e.attrs)&&n2(this.spec,e.spec)}static is(e){return e.type instanceof n3}destroy(){}}class n4{constructor(e,t){this.attrs=e,this.spec=t||n7}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let o=e.mapResult(t.to+r,-1);return o.deleted||o.pos<=i.pos?null:new n6(i.pos-n,o.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(e){return this==e||e instanceof n4&&n2(this.attrs,e.attrs)&&n2(this.spec,e.spec)}destroy(){}}class n6{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new n6(e,t,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(e,t,n){return new n6(e,e,new n5(t,n))}static inline(e,t,n,r){return new n6(e,t,new n3(n,r))}static node(e,t,n,r){return new n6(e,t,new n4(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof n3}get widget(){return this.type instanceof n5}}let n9=[],n7={};class n8{constructor(e,t){this.local=e.length?e:n9,this.children=t.length?t:n9}static create(e,t){return t.length?ro(t,e,0,n7):re}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,i){for(let o=0;o<this.local.length;o++){let s=this.local[o];s.from<=t&&s.to>=e&&(!i||i(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let s=this.children[o]+1;this.children[o+2].findInner(e-s,t-s,n,r+s,i)}}map(e,t,n){return this==re||0==e.maps.length?this:this.mapInner(e,t,0,0,n||n7)}mapInner(e,t,n,r,i){let o;for(let s=0;s<this.local.length;s++){let a=this.local[s].map(e,n,r);a&&a.type.valid(t,a)?(o||(o=[])).push(a):i.onRemove&&i.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,i,o,s){let a=e.slice();for(let e=0,t=o;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,o)=>{let s=o-i-(n-e);for(let i=0;i<a.length;i+=3){let o=a[i+1];if(o<0||e>o+t-r)continue;let l=a[i]+t-r;n>=l?a[i+1]=e<=l?-2:-1:e>=t&&s&&(a[i]+=s,a[i+1]+=s)}r+=s}),t=n.maps[e].map(t,-1)}let l=!1;for(let t=0;t<a.length;t+=3)if(a[t+1]<0){if(-2==a[t+1]){l=!0,a[t+1]=-1;continue}let c=n.map(e[t]+o),d=c-i;if(d<0||d>=r.content.size){l=!0;continue}let u=n.map(e[t+1]+o,-1)-i,{index:h,offset:p}=r.content.findIndex(d),f=r.maybeChild(h);if(f&&p==d&&p+f.nodeSize==u){let r=a[t+2].mapInner(n,f,c+1,e[t]+o+1,s);r!=re?(a[t]=d,a[t+1]=u,a[t+2]=r):(a[t+1]=-2,l=!0)}else l=!0}if(l){let l=ro(function(e,t,n,r,i,o,s){for(let a=0;a<e.length;a+=3)-1==e[a+1]&&function e(t,o){for(let e=0;e<t.local.length;e++){let a=t.local[e].map(r,i,o);a?n.push(a):s.onRemove&&s.onRemove(t.local[e].spec)}for(let n=0;n<t.children.length;n+=3)e(t.children[n+2],t.children[n]+o+1)}(e[a+2],t[a]+o+1);return n}(a,e,t,n,i,o,s),r,0,s);t=l.local;for(let e=0;e<a.length;e+=3)a[e+1]<0&&(a.splice(e,3),e-=3);for(let e=0,t=0;e<l.children.length;e+=3){let n=l.children[e];for(;t<a.length&&a[t]<n;)t+=3;a.splice(t,0,l.children[e],l.children[e+1],l.children[e+2])}}return new n8(t.sort(rs),a)}(this.children,o||[],e,t,n,r,i):o?new n8(o.sort(rs),n9):re}add(e,t){return t.length?this==re?n8.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,i=0;e.forEach((e,o)=>{let s=o+n,a;if(a=rr(t,e,s)){for(r||(r=this.children.slice());i<r.length&&r[i]<o;)i+=3;r[i]==o?r[i+2]=r[i+2].addInner(e,a,s+1):r.splice(i,0,o,o+e.nodeSize,ro(a,e,s+1,n7)),i+=3}});let o=rn(i?ri(t):t,-n);for(let t=0;t<o.length;t++)o[t].type.valid(e,o[t])||o.splice(t--,1);return new n8(o.length?this.local.concat(o).sort(rs):this.local,r||this.children)}remove(e){return 0==e.length||this==re?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let i,o=n[r]+t,s=n[r+1]+t;for(let t=0,n;t<e.length;t++)(n=e[t])&&n.from>o&&n.to<s&&(e[t]=null,(i||(i=[])).push(n));if(!i)continue;n==this.children&&(n=this.children.slice());let a=n[r+2].removeInner(i,o+1);a!=re?n[r+2]=a:(n.splice(r,3),r-=3)}if(r.length){for(let n=0,i;n<e.length;n++)if(i=e[n])for(let e=0;e<r.length;e++)r[e].eq(i,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1))}return n==this.children&&r==this.local?this:r.length||n.length?new n8(r,n):re}forChild(e,t){let n,r;if(this==re)return this;if(t.isLeaf)return n8.empty;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(n=this.children[t+2]);break}let i=e+1,o=i+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>i&&t.type instanceof n3){let e=Math.max(i,t.from)-i,n=Math.min(o,t.to)-i;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let e=new n8(r.sort(rs),n9);return n?new rt([e,n]):e}return n||re}eq(e){if(this==e)return!0;if(!(e instanceof n8)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return ra(this.localsInner(e))}localsInner(e){if(this==re)return n9;if(e.inlineContent||!this.local.some(n3.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof n3||t.push(this.local[e]);return t}forEachSet(e){e(this)}}n8.empty=new n8([],[]),n8.removeOverlap=ra;let re=n8.empty;class rt{constructor(e){this.members=e}map(e,t){let n=this.members.map(n=>n.map(e,t,n7));return rt.from(n)}forChild(e,t){if(t.isLeaf)return n8.empty;let n=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=re&&(i instanceof rt?n=n.concat(i.members):n.push(i))}return rt.from(n)}eq(e){if(!(e instanceof rt)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))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){n&&(t=t.slice(),n=!1);for(let e=0;e<i.length;e++)t.push(i[e])}else t=i}return t?ra(n?t:t.sort(rs)):n9}static from(e){switch(e.length){case 0:return re;case 1:return e[0];default:return new rt(e.every(e=>e instanceof n8)?e:e.reduce((e,t)=>e.concat(t instanceof n8?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function rn(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 n6(i.from+t,i.to+t,i.type))}return n}function rr(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,o;t<e.length;t++)(o=e[t])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),e[t]=null);return i}function ri(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function ro(e,t,n,r){let i=[],o=!1;t.forEach((t,s)=>{let a=rr(e,t,s+n);if(a){o=!0;let e=ro(a,t,n+s+1,r);e!=re&&i.push(s,s+t.nodeSize,e)}});let s=rn(o?ri(e):e,-n).sort(rs);for(let e=0;e<s.length;e++)s[e].type.valid(t,s[e])||(r.onRemove&&r.onRemove(s[e].spec),s.splice(e--,1));return s.length||i.length?new n8(s,i):re}function rs(e,t){return e.from-t.from||e.to-t.to}function ra(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 o=t[i];if(o.from==r.from){o.to!=r.to&&(t==e&&(t=e.slice()),t[i]=o.copy(o.from,r.to),rl(t,i+1,o.copy(r.to,o.to)));continue}o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),rl(t,i,r.copy(o.from,r.to)));break}}return t}function rl(e,t,n){for(;t<e.length&&rs(n,e[t])>0;)t++;e.splice(t,0,n)}function rc(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=re&&t.push(r)}),e.cursorWrapper&&t.push(n8.create(e.state.doc,[e.cursorWrapper.deco])),rt.from(t)}let rd={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},ru=tf&&tm<=11;class rh{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class rp{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new rh,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]);tf&&tm<=11&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():tw&&e.composing&&t.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),ru&&(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,rd)),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(nc(this.view)){if(this.suppressingSelectionUpdates)return nt(this.view);if(tf&&tm<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&tt(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=e9(n))t.add(n);for(let r=e.anchorNode;r;r=e9(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:"selection",target:3==n.nodeType?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(){var e;let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&nc(t)&&!this.ignoreSelectionChange(r),o=-1,s=-1,a=!1,l=[];if(t.editable)for(let e=0;e<n.length;e++){let t=this.registerMutation(n[e],l);t&&(o=o<0?t.from:Math.min(t.from,o),s=s<0?t.to:Math.max(t.to,s),t.typeOver&&(a=!0))}if(l.some(e=>"BR"==e.nodeName)&&(8==t.input.lastKeyCode||46==t.input.lastKeyCode)){for(let e of l)if("BR"==e.nodeName&&e.parentNode){let t=e.nextSibling;for(;t&&1==t.nodeType;){if("false"==t.contentEditable){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(tg&&l.length){let e=l.filter(e=>"BR"==e.nodeName);if(2==e.length){let[t,n]=e;t.parentNode&&t.parentNode.parentNode==n.parentNode?n.remove():t.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of e){let e=r.parentNode;e&&"LI"==e.nodeName&&(!n||function(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}(t,n)!=e)&&r.remove()}}}let c=null;o<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&ts(r)&&(c=t8(t))&&c.eq(e_.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,nt(t),this.currentSelection.set(r),t.scrollToSelection()):(o>-1||i)&&(o>-1&&(t.docView.markDirty(o,s),e=t,!rf.has(e)&&(rf.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))&&(e.requiresGeckoHackNode=tg,rm||(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."),rm=!0))),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,function(e,t){var n;let{focusNode:r,focusOffset:i}=e.domSelectionRange();for(let o of t)if((null==(n=o.parentNode)?void 0:n.nodeName)=="TR"){let t=o.nextSibling;for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.nextSibling;if(t){let n=t;for(;;){let e=n.firstChild;if(!e||1!=e.nodeType||"false"==e.contentEditable||/^(BR|IMG)$/.test(e.nodeName))break;n=e}n.insertBefore(o,n.firstChild),r==o&&e.domSelection().collapse(o,i)}else o.parentNode.removeChild(o)}}(t,l)),this.handleDOMChange(o,s,a,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||nt(t),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style"))||!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),3==r.nodeType&&(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(tf&&tm<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:o}=e.addedNodes[t];(!n||0>Array.prototype.indexOf.call(e.addedNodes,n))&&(r=n),(!o||0>Array.prototype.indexOf.call(e.addedNodes,o))&&(i=o)}let o=r&&r.parentNode==e.target?e6(r)+1:0,s=n.localPosFromDOM(e.target,o,-1),a=i&&i.parentNode==e.target?e6(i):e.target.childNodes.length;return{from:s,to:n.localPosFromDOM(e.target,a,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let rf=new WeakMap,rm=!1;function rg(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,o=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return tt(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function ry(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(tw&&/^(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||tw&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}let rb=/^(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 rv(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:nl(e,t.resolve(n.anchor),t.resolve(n.head))}function rw(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 rx(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class rk{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 nL,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(rN),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=rE(this),rC(this),this.nodeViews=rM(this),this.docView=tG(this.state.doc,rS(this),rc(this),this.dom,this),this.domObserver=new rp(this,(e,t,n,r)=>(function(e,t,n,r,o){let s,a,l,c=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=t8(e,t);if(n&&!e.state.selection.eq(n)){if(tb&&tC&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,ta(13,"Enter"))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),c&&r.setMeta("composition",c),e.dispatch(r)}return}let d=e.state.doc.resolve(t),u=d.sharedDepth(n);t=d.before(u+1),n=e.state.doc.resolve(n).after(u+1);let h=e.state.selection,p=function(e,t,n){let r,{node:i,fromOffset:o,toOffset:s,from:a,to:l}=e.docView.parseRange(t,n),c=e.domSelectionRange(),d=c.anchorNode;if(d&&e.dom.contains(1==d.nodeType?d:d.parentNode)&&(r=[{node:d,offset:c.anchorOffset}],ts(c)||r.push({node:c.focusNode,offset:c.focusOffset})),tb&&8===e.input.lastKeyCode)for(let e=s;e>o;e--){let t=i.childNodes[e-1],n=t.pmViewDesc;if("BR"==t.nodeName&&!n){s=e;break}if(!n||n.size)break}let u=e.state.doc,h=e.someProp("domParser")||H.fromSchema(e.state.schema),p=u.resolve(a),f=null,m=h.parse(i,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:s,preserveWhitespace:"pre"!=p.parent.type.whitespace||"full",findPositions:r,ruleFromNode:ry,context:p});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),f={anchor:e+a,head:t+a}}return{doc:m,sel:f,from:a,to:l}}(e,t,n),f=e.state.doc,m=f.slice(p.from,p.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(s=e.state.selection.to,a="end"):(s=e.state.selection.from,a="start"),e.input.lastKeyCode=null;let g=function(e,t,n,r,i){let o=e.findDiffStart(t,n);if(null==o)return null;let{a:s,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if("end"==i){let e=Math.max(0,o-Math.min(s,a));r-=s+e-o}if(s<o&&e.size<t.size){let e=r<=o&&r>=s?o-r:0;(o-=e)&&o<t.size&&rx(t.textBetween(o-1,o+1))&&(o+=e?1:-1),a=o+(a-s),s=o}else if(a<o){let t=r<=o&&r>=a?o-r:0;(o-=t)&&o<e.size&&rx(e.textBetween(o-1,o+1))&&(o+=t?1:-1),s=o+(s-a),a=o}return{start:o,endA:s,endB:a}}(m.content,p.doc.content,p.from,s,a);if(g&&e.input.domChangeCount++,(tx&&e.input.lastIOSEnter>Date.now()-225||tC)&&o.some(e=>1==e.nodeType&&!rb.test(e.nodeName))&&(!g||g.endA>=g.endB)&&e.someProp("handleKeyDown",t=>t(e,ta(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!g)if(r&&h instanceof eF&&!h.empty&&h.$head.sameParent(h.$anchor)&&!e.composing&&!(p.sel&&p.sel.anchor!=p.sel.head))g={start:h.from,endA:h.to,endB:h.to};else{if(p.sel){let t=rv(e,e.state.doc,p.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);c&&n.setMeta("composition",c),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&g.start==g.endB&&e.state.selection instanceof eF&&(g.start>e.state.selection.from&&g.start<=e.state.selection.from+2&&e.state.selection.from>=p.from?g.start=e.state.selection.from:g.endA<e.state.selection.to&&g.endA>=e.state.selection.to-2&&e.state.selection.to<=p.to&&(g.endB+=e.state.selection.to-g.endA,g.endA=e.state.selection.to)),tf&&tm<=11&&g.endB==g.start+1&&g.endA==g.start&&g.start>p.from&&"  "==p.doc.textBetween(g.start-p.from-1,g.start-p.from+1)&&(g.start--,g.endA--,g.endB--);let y=p.doc.resolveNoCache(g.start-p.from),b=p.doc.resolveNoCache(g.endB-p.from),v=f.resolve(g.start),w=y.sameParent(b)&&y.parent.inlineContent&&v.end()>=g.endA;if((tx&&e.input.lastIOSEnter>Date.now()-225&&(!w||o.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!w&&y.pos<p.doc.content.size&&(!y.sameParent(b)||!y.parent.inlineContent)&&y.pos<b.pos&&!/\S/.test(p.doc.textBetween(y.pos,b.pos,"","")))&&e.someProp("handleKeyDown",t=>t(e,ta(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>g.start&&function(e,t,n,r,i){if(n-t<=i.pos-r.pos||rw(r,!0,!1)<i.pos)return!1;let o=e.resolve(t);if(!r.parent.isTextblock){let e=o.nodeAfter;return null!=e&&n==t+e.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=e.resolve(rw(o,!0,!0));return!(!s.parent.isTextblock||s.pos>n||rw(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(f,g.start,g.endA,y,b)&&e.someProp("handleKeyDown",t=>t(e,ta(8,"Backspace")))){tC&&tb&&e.domObserver.suppressSelectionUpdates();return}tb&&g.endB==g.start&&(e.input.lastChromeDelete=Date.now()),tC&&!w&&y.start()!=b.start()&&0==b.parentOffset&&y.depth==b.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==g.endA&&(g.endB-=2,b=p.doc.resolveNoCache(g.endB-p.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,ta(13,"Enter"))})},20));let x=g.start,k=g.endA,S=t=>{let n=t||e.state.tr.replace(x,k,p.doc.slice(g.start-p.from,g.endB-p.from));if(p.sel){let t=rv(e,n.doc,p.sel);t&&!(tb&&e.composing&&t.empty&&(g.start!=g.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==x||t.head==n.mapping.map(k)-1)||tf&&t.empty&&t.head==x)&&n.setSelection(t)}return c&&n.setMeta("composition",c),n.scrollIntoView()};if(w)if(y.pos==b.pos){tf&&tm<=11&&0==y.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>nt(e),20));let t=S(e.state.tr.delete(x,k)),n=f.resolve(g.start).marksAcross(f.resolve(g.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(g.endA==g.endB&&(l=function(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,o=n,s=r,a,l,c;for(let e=0;e<r.length;e++)o=r[e].removeFromSet(o);for(let e=0;e<n.length;e++)s=n[e].removeFromSet(s);if(1==o.length&&0==s.length)l=o[0],a="add",c=e=>e.mark(l.addToSet(e.marks));else{if(0!=o.length||1!=s.length)return null;l=s[0],a="remove",c=e=>e.mark(l.removeFromSet(e.marks))}let d=[];for(let e=0;e<t.childCount;e++)d.push(c(t.child(e)));if(i.from(d).eq(e))return{mark:l,type:a}}(y.parent.content.cut(y.parentOffset,b.parentOffset),v.parent.content.cut(v.parentOffset,g.endA-v.start())))){let t=S(e.state.tr);"add"==l.type?t.addMark(x,k,l.mark):t.removeMark(x,k,l.mark),e.dispatch(t)}else if(y.parent.child(y.index()).isText&&y.index()==b.index()-!b.textOffset){let t=y.parent.textBetween(y.parentOffset,b.parentOffset),n=()=>S(e.state.tr.insertText(t,x,k));e.someProp("handleTextInput",r=>r(e,x,k,t,n))||e.dispatch(n())}else e.dispatch(S());else e.dispatch(S())})(this,e,t,n,r)),this.domObserver.start(),function(e){for(let t in nj){let n=nj[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!function(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||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}(e,t)||n$(e,t)||!e.editable&&t.type in nI||n(e,t)},nP[t]?{passive:!0}:void 0)}tw&&e.dom.addEventListener("input",()=>null),n_(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;for(let t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&n_(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(rN),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];for(let n in t.state=this.state,e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n,r,i;let o=this.state,s=!1,a=!1;e.storedMarks&&this.composing&&(nJ(this),a=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=rM(this);(function(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})(e,this.nodeViews)&&(this.nodeViews=e,s=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&n_(this),this.editable=rE(this),rC(this);let c=rc(this),d=rS(this),u=o.plugins==e.plugins||o.doc.eq(e.doc)?e.scrollToSelection>o.scrollToSelection?"to selection":"preserve":"reset",h=s||!this.docView.matchesNode(e.doc,d,c);(h||!e.selection.eq(o.selection))&&(a=!0);let p="preserve"==u&&a&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),i=Math.max(0,r.top);for(let o=(r.left+r.right)/2,s=i+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=e.root.elementFromPoint(o,s);if(!r||r==e.dom||!e.dom.contains(r))continue;let a=r.getBoundingClientRect();if(a.top>=i-20){t=r,n=a.top;break}}return{refDOM:t,refTop:n,stack:tT(e.dom)}}(this);if(a){let t,n,a;this.domObserver.stop();let l=h&&(tf||tb)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&(r=o.selection,i=e.selection,a=Math.min(r.$anchor.sharedDepth(r.head),i.$anchor.sharedDepth(i.head)),r.$anchor.start(a)!=i.$anchor.start(a));if(h){let t=tb?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=ti(e=e.childNodes[t-1])}else{if(!e.parentNode||to(e))return null;t=e6(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||to(e))return null;t=e6(e)+1,e=e.parentNode}}}(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}(this)),(s||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=tG(e.doc,d,c,this.dom,this)),!t||this.trackWrites&&this.dom.contains(this.trackWrites)||(l=!0)}l||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&(t=this.docView.domFromPos(this.state.selection.anchor,0),n=this.domSelectionRange(),tt(t.node,t.offset,n.anchorNode,n.anchorOffset)))?nt(this,l):(ns(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),(null==(n=this.dragging)?void 0:n.node)&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),"reset"==u?this.dom.scrollTop=0:"to selection"==u?this.scrollToSelection():p&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;tR(n,0==r?0:r-t)}(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof eU){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&tA(this,t.getBoundingClientRect(),e)}else tA(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)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{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))}}}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 nQ(e.slice,e.move,r<0?void 0:eU.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(null!=n&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(null!=i&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let o=i[n].props[e];if(null!=o&&(r=t?t(o):o))return r}}hasFocus(){if(tf){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("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(tO)return e.focus(tO);let t=tT(e);e.focus(null==tO?{get preventScroll(){return tO={preventScroll:!0},!0}}:void 0),tO||(tO=!1,tR(t,0))}(this.dom),nt(this),this.domObserver.start()}get root(){let e=this._root;if(null==e){for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&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 function(e,t){var n;let r,i,o=e.dom.ownerDocument,s,a=0,l=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(ti(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(ti(r.startContainer),r.startOffset)}}}(o,t.left,t.top);l&&({node:s,offset:a}=l);let c=(e.root.elementFromPoint?e.root:o).elementFromPoint(t.left,t.top);if(!c||!e.dom.contains(1!=c.nodeType?c.parentNode:c)){let n=e.dom.getBoundingClientRect();if(!tD(t,n)||!(c=function e(t,n,r){let i=t.childNodes.length;if(i&&r.top<r.bottom)for(let o=Math.max(0,Math.min(i-1,Math.floor(i*(n.top-r.top)/(r.bottom-r.top))-2)),s=o;;){let r=t.childNodes[s];if(1==r.nodeType){let t=r.getClientRects();for(let i=0;i<t.length;i++){let o=t[i];if(tD(n,o))return e(r,n,o)}}if((s=(s+1)%i)==o)break}return t}(e.dom,t,n)))return null}if(tw)for(let e=c;s&&e;e=e9(e))e.draggable&&(s=void 0);if(c=(r=(n=c).parentNode)&&/^li$/i.test(r.nodeName)&&t.left<n.getBoundingClientRect().left?r:n,s){let n;if(tg&&1==s.nodeType&&(a=Math.min(a,s.childNodes.length))<s.childNodes.length){let e=s.childNodes[a],n;"IMG"==e.nodeName&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&a++}tE&&a&&1==s.nodeType&&1==(n=s.childNodes[a-1]).nodeType&&"false"==n.contentEditable&&n.getBoundingClientRect().top>=t.top&&a--,s==e.dom&&a==s.childNodes.length-1&&1==s.lastChild.nodeType&&t.top>s.lastChild.getBoundingClientRect().bottom?i=e.state.doc.content.size:(0==a||1!=s.nodeType||"BR"!=s.childNodes[a-1].nodeName)&&(i=function(e,t,n,r){let i=-1;for(let n=t,o=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),s;if(!t)return null;if(1==t.dom.nodeType&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((s=t.dom.getBoundingClientRect()).width||s.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!o&&s.left>r.left||s.top>r.top?i=t.posBefore:(!o&&s.right<r.left||s.bottom<r.top)&&(i=t.posAfter),o=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(s.top+s.bottom)/2:r.left<(s.left+s.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}(e,s,a,t))}null==i&&(i=function(e,t,n){let{node:r,offset:i}=function e(t,n){let r,i,o,s=2e8,a,l=0,c=n.top,d=n.top;for(let e=t.firstChild,u=0;e;e=e.nextSibling,u++){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=e8(e).getClientRects()}for(let h=0;h<t.length;h++){let p=t[h];if(p.top<=c&&p.bottom>=d){c=Math.max(p.bottom,c),d=Math.min(p.top,d);let t=p.left>n.left?p.left-n.left:p.right<n.left?n.left-p.right:0;if(t<s){o=e,s=t,a=t&&3==o.nodeType?{left:p.right<n.left?p.right:p.left,top:n.top}:n,1==e.nodeType&&t&&(l=u+ +(n.left>=(p.left+p.right)/2));continue}}else p.top>n.top&&!r&&p.left<=n.left&&p.right>=n.left&&(r=e,i={left:Math.max(p.left,Math.min(p.right,n.left)),top:p.top});!o&&(n.left>=p.right&&n.top>=p.top||n.left>=p.left&&n.top>=p.bottom)&&(l=u+1)}}return(!o&&r&&(o=r,a=i,s=0),o&&3==o.nodeType)?function(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);let n=tI(r,1);if(n.top!=n.bottom&&tD(t,n)){i={node:e,offset:o+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}(o,a):!o||s&&1==o.nodeType?{node:t,offset:l}:e(o,a)}(t,n),o=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();o=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,o)}(e,c,t));let d=e.docView.nearestDesc(c,!0);return{pos:i,inside:d?d.posAtStart-d.border:-1}}(this,e)}coordsAtPos(e,t=1){return tL(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(null==r)throw RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return function(e,t,n){let r,i;return tB==t&&tF==n?tV:(tB=t,tF=n,tV="up"==n||"down"==n?(r=t.selection,i="up"==n?r.$from:r.$to,t$(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,"up"==n?-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=tL(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=e8(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&("up"==n?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=i==r.parent.content.size,s=e.domSelection();return s?tH.test(r.parent.textContent)&&s.modify?t$(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:o,anchorOffset:a}=e.domSelectionRange(),l=s.caretBidiLevel;s.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:d,focusOffset:u}=e.domSelectionRange(),h=d&&!c.contains(1==d.nodeType?d:d.parentNode)||t==d&&i==u;try{s.collapse(o,a),t&&(t!=o||i!=a)&&s.extend&&s.extend(t,i)}catch(e){}return null!=l&&(s.caretBidiLevel=l),h}):"left"==n||"backward"==n?!i:o:r.pos==r.start()||r.pos==r.end()}(e,t,n))}(this,t||this.state,e)}pasteHTML(e,t){return nZ(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return nZ(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return nS(this,e)}destroy(){if(this.docView){for(let e in this.domObserver.stop(),this.input.eventHandlers)this.dom.removeEventListener(e,this.input.eventHandlers[e]);clearTimeout(this.input.composingTimeout),clearTimeout(this.input.lastIOSEnterFallbackTimeout),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],rc(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,te()}}get isDestroyed(){return null==this.docView}dispatchEvent(e){!n$(this,e)&&nj[e.type]&&(this.editable||!(e.type in nI))&&nj[e.type](this,e)}domSelectionRange(){let e=this.domSelection();return e?tw&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){let n;if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return rg(e,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?rg(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function rS(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))}),t.translate||(t.translate="no"),[n6.node(0,e.state.doc.content.size,t)]}function rC(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:n6.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function rE(e){return!e.someProp("editable",t=>!1===t(e.state))}function rM(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 rN(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")}rk.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))},e.s(["Decoration",0,n6,"DecorationSet",0,n8,"EditorView",0,rk],362615);for(var rA={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:"'"},rT={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},rR="u">typeof navigator&&/Mac/.test(navigator.platform),rO="u">typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),rD=0;rD<10;rD++)rA[48+rD]=rA[96+rD]=String(rD);for(var rD=1;rD<=24;rD++)rA[rD+111]="F"+rD;for(var rD=65;rD<=90;rD++)rA[rD]=String.fromCharCode(rD+32),rT[rD]=String.fromCharCode(rD);for(var rj in rA)rT.hasOwnProperty(rj)||(rT[rj]=rA[rj]);let rI="u">typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),rP="u">typeof navigator&&/Win/.test(navigator.platform);function rL(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 rz(e){return new e2({props:{handleKeyDown:r_(e)}})}function r_(e){let t=function(e){let t=Object.create(null);for(let n in e)t[function(e){let t,n,r,i,o=e.split(/-(?!$)/),s=o[o.length-1];"Space"==s&&(s=" ");for(let e=0;e<o.length-1;e++){let s=o[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else if(/^mod$/i.test(s))rI?i=!0:n=!0;else throw Error("Unrecognized modifier name: "+s)}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),i&&(s="Meta-"+s),r&&(s="Shift-"+s),s}(n)]=e[n];return t}(e);return function(e,n){var r;let i=("Esc"==(r=!(rR&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||rO&&n.shiftKey&&n.key&&1==n.key.length||"Unidentified"==n.key)&&n.key||(n.shiftKey?rT:rA)[n.keyCode]||n.key||"Unidentified")&&(r="Escape"),"Del"==r&&(r="Delete"),"Left"==r&&(r="ArrowLeft"),"Up"==r&&(r="ArrowUp"),"Right"==r&&(r="ArrowRight"),"Down"==r&&(r="ArrowDown"),r),o,s=t[rL(i,n)];if(s&&s(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(n.shiftKey){let r=t[rL(i,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(rP&&n.ctrlKey&&n.altKey)&&(o=rA[n.keyCode])&&o!=i){let r=t[rL(o,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}if(e.s(["keydownHandler",0,r_,"keymap",0,rz],202008),"u">typeof WeakMap){let e=new WeakMap;t=t=>e.get(t),n=(t,n)=>(e.set(t,n),n)}else{let e=[],r=0;t=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},n=(t,n)=>(10==r&&(r=0),e[r++]=t,e[r++]=n)}var r$=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,o=r+1,s=i+1;for(let e=1;o<this.width&&this.map[t+e]==n;e++)o++;for(let e=1;s<this.height&&this.map[t+this.width*e]==n;e++)s++;return{left:r,top:i,right:o,bottom:s}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:o,bottom:s}=this.findCell(e);return"horiz"==t?(n<0?0==r:i==this.width)?null:this.map[o*this.width+(n<0?r-1:i)]:(n<0?0==o:s==this.height)?null:this.map[r+this.width*(n<0?o-1:s)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:o}=this.findCell(e),{left:s,right:a,top:l,bottom:c}=this.findCell(t);return{left:Math.min(n,s),top:Math.min(i,l),right:Math.max(r,a),bottom:Math.max(o,c)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let o=r*this.width+i,s=this.map[o];!n[s]&&(n[s]=!0,i==e.left&&i&&this.map[o-1]==s||r==e.top&&r&&this.map[o-this.width]==s||t.push(s))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let o=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?o-1:this.map[n]}i=o}}static get(e){return t(e)||n(e,function(e){if("table"!=e.type.spec.tableRole)throw RangeError("Not a table node: "+e.type.name);let t=function(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),o=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(o+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);o+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}-1==t?t=o:t!=o&&(t=Math.max(t,o))}return t}(e),n=e.childCount,r=[],i=0,o=null,s=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let a=0,l=0;a<n;a++){let c=e.child(a);l++;for(let e=0;;e++){for(;i<r.length&&0!=r[i];)i++;if(e==c.childCount)break;let d=c.child(e),{colspan:u,rowspan:h,colwidth:p}=d.attrs;for(let e=0;e<h;e++){if(e+a>=n){(o||(o=[])).push({type:"overlong_rowspan",pos:l,n:h-e});break}let c=i+e*t;for(let e=0;e<u;e++){0==r[c+e]?r[c+e]=l:(o||(o=[])).push({type:"collision",row:a,pos:l,n:u-e});let n=p&&p[e];if(n){let r=(c+e)%t*2,i=s[r];null==i||i!=n&&1==s[r+1]?(s[r]=n,s[r+1]=1):i==n&&s[r+1]++}}}i+=u,l+=d.nodeSize}let d=(a+1)*t,u=0;for(;i<d;)0==r[i++]&&u++;u&&(o||(o=[])).push({type:"missing",row:a,n:u}),l++}(0===t||0===n)&&(o||(o=[])).push({type:"zero_sized"});let a=new r$(t,n,r,o),l=!1;for(let e=0;!l&&e<s.length;e+=2)null!=s[e]&&s[e+1]<n&&(l=!0);return l&&function(e,t,n){e.problems||(e.problems=[]);let r={};for(let i=0;i<e.map.length;i++){let o=e.map[i];if(r[o])continue;r[o]=!0;let s=n.nodeAt(o);if(!s)throw RangeError(`No cell with offset ${o} found`);let a=null,l=s.attrs;for(let n=0;n<l.colspan;n++){let r=t[(i+n)%e.width*2];null==r||l.colwidth&&l.colwidth[n]==r||((a||(a=function(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}(l)))[n]=r)}a&&e.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:a})}}(a,s,e),a}(e))}};function rH(e){let t=e.cached.tableNodeTypes;if(!t)for(let n in t=e.cached.tableNodeTypes={},e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}return t}let rB=new e4("selectingCells");function rF(e){for(let t=e.depth-1;t>0;t--)if("row"==e.node(t).type.spec.tableRole)return e.node(0).resolve(e.before(t+1));return null}function rV(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if("row"==t.node(e).type.spec.tableRole)return!0;return!1}function rU(e){let t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&"cell"==t.node.type.spec.tableRole)return t.$anchor;let n=rF(t.$head)||function(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n-t.nodeSize)}}(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function rW(e){return"row"==e.parent.type.spec.tableRole&&!!e.nodeAfter}function rK(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function rq(e,t,n){let r=e.node(-1),i=r$.get(r),o=e.start(-1),s=i.nextCell(e.pos-o,t,n);return null==s?null:e.node(0).resolve(o+s)}function rJ(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function rG(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}var rX=class e extends e_{constructor(e,t=e){const n=e.node(-1),r=r$.get(n),i=e.start(-1),o=r.rectBetween(e.pos-i,t.pos-i),s=e.node(0),a=r.cellsInRect(o).filter(e=>e!=t.pos-i);a.unshift(t.pos-i);const l=a.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new e$(s.resolve(r),s.resolve(r+t.content.size))});super(l[0].$from,l[0].$to,l),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(rW(r)&&rW(i)&&rK(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return eF.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=r$.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),o={},s=[];for(let n=r.top;n<r.bottom;n++){let a=[];for(let i=n*t.width+r.left,s=r.left;s<r.right;s++,i++){let n=t.map[i];if(o[n])continue;o[n]=!0;let s=t.findCell(n),l=e.nodeAt(n);if(!l)throw RangeError(`No cell with offset ${n} found`);let c=r.left-s.left,d=s.right-r.right;if(c>0||d>0){let e=l.attrs;if(c>0&&(e=rJ(e,0,c)),d>0&&(e=rJ(e,e.colspan-d,d)),s.left<r.left){if(!(l=l.type.createAndFill(e)))throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else l=l.type.create(e,l.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...l.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};l=s.top<r.top?l.type.createAndFill(e):l.type.create(e,l.content)}a.push(l)}s.push(e.child(n).copy(i.from(a)))}let a=this.isColSelection()&&this.isRowSelection()?e:s;return new d(i.from(a),1,1)}replace(e,t=d.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:o,$to:s}=r[i],a=e.mapping.slice(n);e.replace(a.map(o.pos),a.map(s.pos),i?d.empty:t)}let i=e_.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new d(i.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=r$.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);return!(Math.min(e,t)>0)&&Math.max(e+this.$anchorCell.nodeAfter.attrs.rowspan,t+this.$headCell.nodeAfter.attrs.rowspan)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=r$.get(r),o=t.start(-1),s=i.findCell(t.pos-o),a=i.findCell(n.pos-o),l=t.node(0);return s.top<=a.top?(s.top>0&&(t=l.resolve(o+i.map[s.left])),a.bottom<i.height&&(n=l.resolve(o+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(o+i.map[a.left])),s.bottom<i.height&&(t=l.resolve(o+i.map[i.width*(i.height-1)+s.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=r$.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);return!(Math.min(r,i)>0)&&Math.max(r+this.$anchorCell.nodeAfter.attrs.colspan,i+this.$headCell.nodeAfter.attrs.colspan)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=r$.get(r),o=t.start(-1),s=i.findCell(t.pos-o),a=i.findCell(n.pos-o),l=t.node(0);return s.left<=a.left?(s.left>0&&(t=l.resolve(o+i.map[s.top*i.width])),a.right<i.width&&(n=l.resolve(o+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(o+i.map[a.top*i.width])),s.right<i.width&&(t=l.resolve(o+i.map[i.width*(s.top+1)-1]))),new e(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new rZ(this.$anchorCell.pos,this.$headCell.pos)}};rX.prototype.visible=!1,e_.jsonID("cell",rX);var rZ=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){let t=e.resolve(this.anchor),n=e.resolve(this.head);return"row"==t.parent.type.spec.tableRole&&"row"==n.parent.type.spec.tableRole&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&rK(t,n)?new rX(t,n):e_.near(n,1)}};function rY(e){if(!(e.selection instanceof rX))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(n6.node(n,n+e.nodeSize,{class:"selectedCell"}))}),n8.create(e.doc,t)}let rQ=new e4("fix-tables");function r0(e,t){let n,r=(t,r)=>{"table"==t.type.spec.tableRole&&(n=function(e,t,n,r){let i,o,s=r$.get(t);if(!s.problems)return r;r||(r=e.tr);let a=[];for(let e=0;e<s.height;e++)a.push(0);for(let e=0;e<s.problems.length;e++){let i=s.problems[e];if("collision"==i.type){let e=t.nodeAt(i.pos);if(!e)continue;let o=e.attrs;for(let e=0;e<o.rowspan;e++)a[i.row+e]+=i.n;r.setNodeMarkup(r.mapping.map(n+1+i.pos),null,rJ(o,o.colspan-i.n,i.n))}else if("missing"==i.type)a[i.row]+=i.n;else if("overlong_rowspan"==i.type){let e=t.nodeAt(i.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+i.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-i.n})}else if("colwidth mismatch"==i.type){let e=t.nodeAt(i.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+i.pos),null,{...e.attrs,colwidth:i.colwidth})}else if("zero_sized"==i.type){let e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}for(let e=0;e<a.length;e++)a[e]&&(null==i&&(i=e),o=e);for(let l=0,c=n+1;l<s.height;l++){let n=t.child(l),s=c+n.nodeSize,d=a[l];if(d>0){let t="cell";n.firstChild&&(t=n.firstChild.type.spec.tableRole);let a=[];for(let n=0;n<d;n++){let n=rH(e.schema)[t].createAndFill();n&&a.push(n)}let u=(0==l||i==l-1)&&o==l?c+1:s-1;r.insert(r.mapping.map(u),a)}c=s}return r.setMeta(rQ,{fixTables:!0})}(e,t,r,n))};return t?t.doc!=e.doc&&function e(t,n,r,i){let o=t.childCount,s=n.childCount;n:for(let a=0,l=0;a<s;a++){let s=n.child(a);for(let e=l,n=Math.min(o,a+3);e<n;e++)if(t.child(e)==s){l=e+1,r+=s.nodeSize;continue n}i(s,r),l<o&&t.child(l).sameMarkup(s)?e(t.child(l),s,r+1,i):s.nodesBetween(0,s.content.size,i,r+1),r+=s.nodeSize}}(t.doc,e.doc,0,r):e.doc.descendants(r),n}function r1(e){let t=r$.get(e),n=[],r=t.height,i=t.width;for(let o=0;o<r;o++){let r=[];for(let n=0;n<i;n++){let s=o*i+n,a=t.map[s];if(o>0){let e=s-i;if(a===t.map[e]){r.push(null);continue}}if(n>0){let e=s-1;if(a===t.map[e]){r.push(null);continue}}r.push(e.nodeAt(a))}n.push(r)}return n}function r2(e,t){let n=[],r=r$.get(e),i=r.height,o=r.width;for(let s=0;s<i;s++){let i=e.child(s),a=[];for(let n=0;n<o;n++){let i=t[s][n];if(!i)continue;let o=r.map[s*r.width+n],l=e.nodeAt(o);if(!l)continue;let c=l.type.createChecked(i.attrs,i.content,i.marks);a.push(c)}let l=i.type.createChecked(i.attrs,a,i.marks);n.push(l)}return e.type.createChecked(e.attrs,n,e.marks)}function r5(e,t,n,r){let i,o=t[0]>n[0]?-1:1,s=e.splice(t[0],t.length),a=+(s.length%2==0);return i=-1===r&&1===o?n[0]-1:1===r&&-1===o?n[n.length-1]-a+1:-1===o?n[0]:n[n.length-1]-a,e.splice(i,0,...s),e}function r3(e){var t=e;for(let e=t.depth;e>=0;e-=1){let n=t.node(e);if((e=>"table"===e.type.spec.tableRole)(n))return{node:n,pos:0===e?0:t.before(e),start:t.start(e),depth:e}}return null}function r4(e,t){let n=r3(t.$from);if(!n)return;let r=r$.get(n.node);if(!(e<0)&&!(e>r.width-1))return r.cellsInRect({left:e,right:e+1,top:0,bottom:r.height}).map(e=>{let t=n.node.nodeAt(e),r=e+n.start;return{pos:r,start:r+1,node:t,depth:n.depth+2}})}function r6(e,t){let n=r3(t.$from);if(!n)return;let r=r$.get(n.node);if(!(e<0)&&!(e>r.height-1))return r.cellsInRect({left:0,right:r.width,top:e,bottom:e+1}).map(e=>{let t=n.node.nodeAt(e),r=e+n.start;return{pos:r,start:r+1,node:t,depth:n.depth+2}})}function r9(e,t,n=t){let r,i=t,o=n;for(let n=t;n>=0;n--){let t=r4(n,e.selection);t&&t.forEach(e=>{let t=e.node.attrs.colspan+n-1;t>=i&&(i=n),t>o&&(o=t)})}for(let n=t;n<=o;n++){let t=r4(n,e.selection);t&&t.forEach(e=>{let t=e.node.attrs.colspan+n-1;e.node.attrs.colspan>1&&t>o&&(o=t)})}let s=[];for(let t=i;t<=o;t++){let n=r4(t,e.selection);n&&n.length>0&&s.push(t)}i=s[0],o=s[s.length-1];let a=r4(i,e.selection),l=r6(0,e.selection);if(!a||!l)return;let c=e.doc.resolve(a[a.length-1].pos);for(let t=o;t>=i;t--){let n=r4(t,e.selection);if(n&&n.length>0){for(let e=l.length-1;e>=0;e--)if(l[e].pos===n[0].pos){r=n[0];break}if(r)break}}if(r)return{$anchor:c,$head:e.doc.resolve(r.pos),indexes:s}}function r7(e,t,n=t){let r,i=t,o=n;for(let n=t;n>=0;n--){let t=r6(n,e.selection);t&&t.forEach(e=>{let t=e.node.attrs.rowspan+n-1;t>=i&&(i=n),t>o&&(o=t)})}for(let n=t;n<=o;n++){let t=r6(n,e.selection);t&&t.forEach(e=>{let t=e.node.attrs.rowspan+n-1;e.node.attrs.rowspan>1&&t>o&&(o=t)})}let s=[];for(let t=i;t<=o;t++){let n=r6(t,e.selection);n&&n.length>0&&s.push(t)}i=s[0],o=s[s.length-1];let a=r6(i,e.selection),l=r4(0,e.selection);if(!a||!l)return;let c=e.doc.resolve(a[a.length-1].pos);for(let t=o;t>=i;t--){let n=r6(t,e.selection);if(n&&n.length>0){for(let e=l.length-1;e>=0;e--)if(l[e].pos===n[0].pos){r=n[0];break}if(r)break}}if(r)return{$anchor:c,$head:e.doc.resolve(r.pos),indexes:s}}function r8(e){return e[0].map((t,n)=>e.map(e=>e[n]))}function ie(e){let t=e.selection,n=rU(e),r=n.node(-1),i=n.start(-1),o=r$.get(r);return{...t instanceof rX?o.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):o.findCell(n.pos-i),tableStart:i,map:o,table:r}}function it(e,{map:t,tableStart:n,table:r},i){let o=i>0?-1:0;(function(e,t,n){let r=rH(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0})(t,r,i+o)&&(o=0==i||i==t.width?null:0);for(let s=0;s<t.height;s++){let a=s*t.width+i;if(i>0&&i<t.width&&t.map[a-1]==t.map[a]){let o=t.map[a],l=r.nodeAt(o);e.setNodeMarkup(e.mapping.map(n+o),null,rG(l.attrs,i-t.colCount(o))),s+=l.attrs.rowspan-1}else{let l=null==o?rH(r.type.schema).cell:r.nodeAt(t.map[a+o]).type,c=t.positionAt(s,i,r);e.insert(e.mapping.map(n+c),l.createAndFill())}}return e}function ir(e,{map:t,tableStart:n,table:r},i){let o=n;for(let e=0;e<i;e++)o+=r.child(e).nodeSize;let s=[],a=i>0?-1:0;(function(e,t,n){var r;let i=rH(t.type.schema).header_cell;for(let o=0;o<e.width;o++)if((null==(r=t.nodeAt(e.map[o+n*e.width]))?void 0:r.type)!=i)return!1;return!0})(t,r,i+a)&&(a=0==i||i==t.height?null:0);for(let o=0,c=t.width*i;o<t.width;o++,c++)if(i>0&&i<t.height&&t.map[c]==t.map[c-t.width]){let i=t.map[c],s=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...s,rowspan:s.rowspan+1}),o+=s.colspan-1}else{var l;let e=null==a?rH(r.type.schema).cell:null==(l=r.nodeAt(t.map[c+a*t.width]))?void 0:l.type,n=null==e?void 0:e.createAndFill();n&&s.push(n)}return e.insert(o,rH(r.type.schema).row.create(null,s)),e}function ii(e){let t=e.content;return 1==t.childCount&&t.child(0).isTextblock&&0==t.child(0).childCount}function io(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:"row"==e?t.map.width:1,bottom:"column"==e?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function is(e,t){if((t=t||{useDeprecatedLogic:!1}).useDeprecatedLogic)return function(t,n){if(!rV(t))return!1;if(n){let r=rH(t.schema),i=ie(t),o=t.tr,s=i.map.cellsInRect("column"==e?{left:i.left,top:0,right:i.right,bottom:i.map.height}:"row"==e?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=s.map(e=>i.table.nodeAt(e));for(let e=0;e<s.length;e++)a[e].type==r.header_cell&&o.setNodeMarkup(i.tableStart+s[e],r.cell,a[e].attrs);if(0===o.steps.length)for(let e=0;e<s.length;e++)o.setNodeMarkup(i.tableStart+s[e],r.header_cell,a[e].attrs);n(o)}return!0};return function(t,n){if(!rV(t))return!1;if(n){let r=rH(t.schema),i=ie(t),o=t.tr,s=io("row",i,r),a=io("column",i,r),l=+("column"===e?!!s:"row"===e&&!!a),c="column"==e?{left:0,top:l,right:1,bottom:i.map.height}:"row"==e?{left:l,top:0,right:i.map.width,bottom:1}:i,d="column"==e?a?r.cell:r.header_cell:"row"==e?s?r.cell:r.header_cell:r.cell;i.map.cellsInRect(c).forEach(e=>{let t=e+i.tableStart,n=o.doc.nodeAt(t);n&&o.setNodeMarkup(t,d,n.attrs)}),n(o)}return!0}}is("row",{useDeprecatedLogic:!0}),is("column",{useDeprecatedLogic:!0});let ia=is("cell",{useDeprecatedLogic:!0});function il(e,t){let n=e.selection;if(!(n instanceof rX))return!1;if(t){let r=e.tr,i=rH(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new d(i,0,0))}),r.docChanged&&t(r)}return!0}function ic(e,t){let n=e.createAndFill();return new eL(n).replace(0,n.content.size,t).doc}function id(e,t,n,r,i,o,s,a){if(0==s||s==t.height)return!1;let l=!1;for(let c=i;c<o;c++){let i=s*t.width+c,o=t.map[i];if(t.map[i-t.width]==o){l=!0;let i=n.nodeAt(o),{top:d,left:u}=t.findCell(o);e.setNodeMarkup(e.mapping.slice(a).map(o+r),null,{...i.attrs,rowspan:s-d}),e.insert(e.mapping.slice(a).map(t.positionAt(s,u,n)),i.type.createAndFill({...i.attrs,rowspan:d+i.attrs.rowspan-s})),c+=i.attrs.colspan-1}}return l}function iu(e,t,n,r,i,o,s,a){if(0==s||s==t.width)return!1;let l=!1;for(let c=i;c<o;c++){let i=c*t.width+s,o=t.map[i];if(t.map[i-1]==o){l=!0;let i=n.nodeAt(o),d=t.colCount(o),u=e.mapping.slice(a).map(o+r);e.setNodeMarkup(u,null,rJ(i.attrs,s-d,i.attrs.colspan-(s-d))),e.insert(u+i.nodeSize,i.type.createAndFill(rJ(i.attrs,0,s-d))),c+=i.attrs.rowspan-1}}return l}function ih(e,t,n,r,o){let s=n?e.doc.nodeAt(n-1):e.doc;if(!s)throw Error("No table found");let a=r$.get(s),{top:l,left:c}=r,u=c+o.width,h=l+o.height,p=e.tr,f=0;function m(){if(!(s=n?p.doc.nodeAt(n-1):p.doc))throw Error("No table found");a=r$.get(s),f=p.mapping.maps.length}(function(e,t,n,r,o,s){let a,l,c=rH(e.doc.type.schema);if(o>t.width)for(let i=0,s=0;i<t.height;i++){let d,u=n.child(i);s+=u.nodeSize;let h=[];d=null==u.lastChild||u.lastChild.type==c.cell?a||(a=c.cell.createAndFill()):l||(l=c.header_cell.createAndFill());for(let e=t.width;e<o;e++)h.push(d);e.insert(e.mapping.slice(0).map(s-1+r),h)}if(s>t.height){let d=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,o);e++){let i=!(e>=t.width)&&n.nodeAt(t.map[r+e]).type==c.header_cell;d.push(i?l||(l=c.header_cell.createAndFill()):a||(a=c.cell.createAndFill()))}let u=c.row.create(null,i.from(d)),h=[];for(let e=t.height;e<s;e++)h.push(u);e.insert(e.mapping.slice(0).map(r+n.nodeSize-2),h)}return!!(a||l)})(p,a,s,n,u,h)&&m(),id(p,a,s,n,c,u,l,f)&&m(),id(p,a,s,n,c,u,h,f)&&m(),iu(p,a,s,n,l,h,c,f)&&m(),iu(p,a,s,n,l,h,u,f)&&m();for(let e=l;e<h;e++){let t=a.positionAt(e,c,s),r=a.positionAt(e,u,s);p.replace(p.mapping.slice(f).map(t+n),p.mapping.slice(f).map(r+n),new d(o.rows[e-l],0,0))}m(),p.setSelection(new rX(p.doc.resolve(n+a.positionAt(l,c,s)),p.doc.resolve(n+a.positionAt(h-1,u-1,s)))),t(p)}let ip=r_({ArrowLeft:ig("horiz",-1),ArrowRight:ig("horiz",1),ArrowUp:ig("vert",-1),ArrowDown:ig("vert",1),"Shift-ArrowLeft":iy("horiz",-1),"Shift-ArrowRight":iy("horiz",1),"Shift-ArrowUp":iy("vert",-1),"Shift-ArrowDown":iy("vert",1),Backspace:il,"Mod-Backspace":il,Delete:il,"Mod-Delete":il});function im(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function ig(e,t){return(n,r,i)=>{if(!i)return!1;let o=n.selection;if(o instanceof rX)return im(n,r,e_.near(o.$headCell,t));if("horiz"!=e&&!o.empty)return!1;let s=ix(i,e,t);if(null==s)return!1;if("horiz"==e)return im(n,r,e_.near(n.doc.resolve(o.head+t),t));{let i,o=n.doc.resolve(s),a=rq(o,e,t);return i=a?e_.near(a,1):t<0?e_.near(n.doc.resolve(o.before(-1)),-1):e_.near(n.doc.resolve(o.after(-1)),1),im(n,r,i)}}}function iy(e,t){return(n,r,i)=>{let o;if(!i)return!1;let s=n.selection;if(s instanceof rX)o=s;else{let r=ix(i,e,t);if(null==r)return!1;o=new rX(n.doc.resolve(r))}let a=rq(o.$headCell,e,t);return!!a&&im(n,r,new rX(o.$anchorCell,a))}}function ib(e,t){let n=rF(e.state.doc.resolve(t));return!!n&&(e.dispatch(e.state.tr.setSelection(new rX(n))),!0)}function iv(e,t,n){if(!rV(e.state))return!1;let r=function(e){if(0===e.size)return null;let{content:t,openStart:n,openEnd:r}=e;for(;1==t.childCount&&(n>0&&r>0||"table"==t.child(0).type.spec.tableRole);)n--,r--,t=t.child(0).content;let o=t.child(0),s=o.type.spec.tableRole,a=o.type.schema,l=[];if("row"==s)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,o=e?0:Math.max(0,n-1),s=e<t.childCount-1?0:Math.max(0,r-1);(o||s)&&(i=ic(rH(a).row,new d(i,o,s)).content),l.push(i)}else{if("cell"!=s&&"header_cell"!=s)return null;l.push(n||r?ic(rH(a).row,new d(t,n,r)).content:t)}return function(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:o}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+o}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let o=0;o<n.length;o++)if(o>=t.length&&t.push(i.empty),n[o]<r){let s=rH(e).cell.createAndFill(),a=[];for(let e=n[o];e<r;e++)a.push(s);t[o]=t[o].append(i.from(a))}return{height:t.length,width:r,rows:t}}(a,l)}(n),o=e.state.selection;if(o instanceof rX){r||(r={width:1,height:1,rows:[i.from(ic(rH(e.state.schema).cell,n))]});let t=o.$anchorCell.node(-1),s=o.$anchorCell.start(-1),a=r$.get(t).rectBetween(o.$anchorCell.pos-s,o.$headCell.pos-s);return r=function({width:e,height:t,rows:n},r,o){if(e!=r){let t=[],o=[];for(let e=0;e<n.length;e++){let s=n[e],a=[];for(let n=t[e]||0,i=0;n<r;i++){let o=s.child(i%s.childCount);n+o.attrs.colspan>r&&(o=o.type.createChecked(rJ(o.attrs,o.attrs.colspan,n+o.attrs.colspan-r),o.content)),a.push(o),n+=o.attrs.colspan;for(let n=1;n<o.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+o.attrs.colspan}o.push(i.from(a))}n=o,e=r}if(t!=o){let e=[];for(let r=0,s=0;r<o;r++,s++){let a=[],l=n[s%t];for(let e=0;e<l.childCount;e++){let t=l.child(e);r+t.attrs.rowspan>o&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,o-t.attrs.rowspan)},t.content)),a.push(t)}e.push(i.from(a))}n=e,t=o}return{width:e,height:t,rows:n}}(r,a.right-a.left,a.bottom-a.top),ih(e.state,e.dispatch,s,a,r),!0}if(!r)return!1;{let t=rU(e.state),n=t.start(-1);return ih(e.state,e.dispatch,n,r$.get(t.node(-1)).findCell(t.pos-n),r),!0}}function iw(e,t){var n;let r;if(0!=t.button||t.ctrlKey||t.metaKey)return;let i=ik(e,t.target);if(t.shiftKey&&e.state.selection instanceof rX)o(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&i&&null!=(r=rF(e.state.selection.$anchor))&&(null==(n=iS(e,t))?void 0:n.pos)!=r.pos)o(r,t),t.preventDefault();else if(!i)return;function o(t,n){let r=iS(e,n),i=null==rB.getState(e.state);if(!r||!rK(t,r))if(!i)return;else r=t;let o=new rX(t,r);if(i||!e.state.selection.eq(o)){let n=e.state.tr.setSelection(o);i&&n.setMeta(rB,t.pos),e.dispatch(n)}}function s(){e.root.removeEventListener("mouseup",s),e.root.removeEventListener("dragstart",s),e.root.removeEventListener("mousemove",a),null!=rB.getState(e.state)&&e.dispatch(e.state.tr.setMeta(rB,-1))}function a(n){let r,a=rB.getState(e.state);if(null!=a)r=e.state.doc.resolve(a);else if(ik(e,n.target)!=i&&!(r=iS(e,t)))return s();r&&o(r,n)}e.root.addEventListener("mouseup",s),e.root.addEventListener("dragstart",s),e.root.addEventListener("mousemove",a)}function ix(e,t,n){if(!(e.state.selection instanceof eF))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let o=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:o.childCount))break;if("cell"==o.type.spec.tableRole||"header_cell"==o.type.spec.tableRole){let o=r.before(i),s="vert"==t?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(s)?o:null}}return null}function ik(e,t){for(;t&&t!=e.dom;t=t.parentNode)if("TD"==t.nodeName||"TH"==t.nodeName)return t;return null}function iS(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&rF(e.state.doc.resolve(r))||rF(e.state.doc.resolve(i))}var iC=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),iE(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type==this.node.type&&(this.node=e,iE(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return"attributes"==e.type&&(e.target==this.table||this.colgroup.contains(e.target))}};function iE(e,t,n,r,i,o){let s=0,a=!0,l=t.firstChild,c=e.firstChild;if(c){for(let e=0,n=0;e<c.childCount;e++){let{colspan:d,colwidth:u}=c.child(e).attrs;for(let e=0;e<d;e++,n++){let c=i==n?o:u&&u[e],d=c?c+"px":"";if(s+=c||r,c||(a=!1),l)l.style.width!=d&&(l.style.width=d),l=l.nextSibling;else{let e=document.createElement("col");e.style.width=d,t.appendChild(e)}}}for(;l;){var d;let e=l.nextSibling;null==(d=l.parentNode)||d.removeChild(l),l=e}a?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}let iM=new e4("tableColumnResizing");var iN=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=t.getMeta(iM);if(n&&null!=n.setHandle)return new e(n.setHandle,!1);if(n&&void 0!==n.setDragging)return new e(this.activeHandle,n.setDragging);if(this.activeHandle>-1&&t.docChanged){let n=t.mapping.map(this.activeHandle,-1);return rW(t.doc.resolve(n))||(n=-1),new e(n,this.dragging)}return this}};function iA(e,t,n,r){let i=e.posAtCoords({left:t.clientX+("right"==n?-r:r),top:t.clientY});if(!i)return -1;let{pos:o}=i,s=rF(e.state.doc.resolve(o));if(!s)return -1;if("right"==n)return s.pos;let a=r$.get(s.node(-1)),l=s.start(-1),c=a.map.indexOf(s.pos-l);return c%a.width==0?-1:l+a.map[c-1]}function iT(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function iR(e,t){e.dispatch(e.state.tr.setMeta(iM,{setHandle:t}))}function iO(e,t,n,r){let i=e.state.doc.resolve(t),o=i.node(-1),s=i.start(-1),a=r$.get(o).colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1,l=e.domAtPos(i.start(-1)).node;for(;l&&"TABLE"!=l.nodeName;)l=l.parentNode;l&&iE(o,l.firstChild,l,r,a,n)}e.s(["CellSelection",0,rX,"addColumnAfter",0,function(e,t){if(!rV(e))return!1;if(t){let n=ie(e);t(it(e.tr,n,n.right))}return!0},"addColumnBefore",0,function(e,t){if(!rV(e))return!1;if(t){let n=ie(e);t(it(e.tr,n,n.left))}return!0},"addRowAfter",0,function(e,t){if(!rV(e))return!1;if(t){let n=ie(e);t(ir(e.tr,n,n.bottom))}return!0},"addRowBefore",0,function(e,t){if(!rV(e))return!1;if(t){let n=ie(e);t(ir(e.tr,n,n.top))}return!0},"cellAround",0,rF,"columnResizing",0,function({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=iC,lastColumnResizable:i=!0}={}){let o=new e2({key:iM,state:{init(e,t){var i;let s=null==(i=o.spec)||null==(i=i.props)?void 0:i.nodeViews,a=rH(t.schema).table.name;return r&&s&&(s[a]=(e,t)=>new r(e,n,t)),new iN(-1,!1)},apply:(e,t)=>t.apply(e)},props:{attributes:e=>{let t=iM.getState(e);return t&&t.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(t,n)=>{!function(e,t,n,r){if(!e.editable)return;let i=iM.getState(e.state);if(i&&!i.dragging){let o=function(e){for(;e&&"TD"!=e.nodeName&&"TH"!=e.nodeName;)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}(t.target),s=-1;if(o){let{left:r,right:i}=o.getBoundingClientRect();t.clientX-r<=n?s=iA(e,t,"left",n):i-t.clientX<=n&&(s=iA(e,t,"right",n))}if(s!=i.activeHandle){if(!r&&-1!==s){let t=e.state.doc.resolve(s),n=t.node(-1),r=r$.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}iR(e,s)}}}(t,n,e,i)},mouseleave:e=>{!function(e){if(!e.editable)return;let t=iM.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&iR(e,-1)}(e)},mousedown:(e,r)=>{!function(e,t,n,r){var i;if(!e.editable)return;let o=null!=(i=e.dom.ownerDocument.defaultView)?i:window,s=iM.getState(e.state);if(!s||-1==s.activeHandle||s.dragging)return;let a=e.state.doc.nodeAt(s.activeHandle),l=function(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let o=e.domAtPos(t),s=o.node.childNodes[o.offset].offsetWidth,a=n;if(r)for(let e=0;e<n;e++)r[e]&&(s-=r[e],a--);return s/a}(e,s.activeHandle,a.attrs);function c(t){o.removeEventListener("mouseup",c),o.removeEventListener("mousemove",d);let r=iM.getState(e.state);(null==r?void 0:r.dragging)&&(function(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),o=r$.get(i),s=r.start(-1),a=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,l=e.state.tr;for(let e=0;e<o.height;e++){let t=e*o.width+a;if(e&&o.map[t]==o.map[t-o.width])continue;let r=o.map[t],c=i.nodeAt(r).attrs,d=1==c.colspan?0:a-o.colCount(r);if(c.colwidth&&c.colwidth[d]==n)continue;let u=c.colwidth?c.colwidth.slice():Array(c.colspan).fill(0);u[d]=n,l.setNodeMarkup(s+r,null,{...c,colwidth:u})}l.docChanged&&e.dispatch(l)}(e,r.activeHandle,iT(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(iM,{setDragging:null})))}function d(t){if(!t.which)return c(t);let i=iM.getState(e.state);if(i&&i.dragging){let o=iT(i.dragging,t,n);iO(e,i.activeHandle,o,r)}}e.dispatch(e.state.tr.setMeta(iM,{setDragging:{startX:t.clientX,startWidth:l}})),iO(e,s.activeHandle,l,r),o.addEventListener("mouseup",c),o.addEventListener("mousemove",d),t.preventDefault()}(e,r,t,n)}},decorations:e=>{let t=iM.getState(e);if(t&&t.activeHandle>-1)return function(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return n8.empty;let o=r$.get(i),s=r.start(-1),a=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<o.height;t++){let r=a+t*o.width;if((a==o.width-1||o.map[r]!=o.map[r+1])&&(0==t||o.map[r]!=o.map[r-o.width])){var l;let t=o.map[r],a=s+t+i.nodeAt(t).nodeSize-1,c=document.createElement("div");c.className="column-resize-handle",(null==(l=iM.getState(e))?void 0:l.dragging)&&n.push(n6.node(s+t,s+t+i.nodeAt(t).nodeSize,{class:"column-resize-dragging"})),n.push(n6.widget(a,c))}}return n8.create(e.doc,n)}(e,t.activeHandle)},nodeViews:{}}});return o},"deleteColumn",0,function(e,t){if(!rV(e))return!1;if(t){let n=ie(e),r=e.tr;if(0==n.left&&n.right==n.map.width)return!1;for(let e=n.right-1;!function(e,{map:t,table:n,tableStart:r},i){let o=e.mapping.maps.length;for(let s=0;s<t.height;){let a=s*t.width+i,l=t.map[a],c=n.nodeAt(l),d=c.attrs;if(i>0&&t.map[a-1]==l||i<t.width-1&&t.map[a+1]==l)e.setNodeMarkup(e.mapping.slice(o).map(r+l),null,rJ(d,i-t.colCount(l)));else{let t=e.mapping.slice(o).map(r+l);e.delete(t,t+c.nodeSize)}s+=d.rowspan}}(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=r$.get(e)}t(r)}return!0},"deleteRow",0,function(e,t){if(!rV(e))return!1;if(t){let n=ie(e),r=e.tr;if(0==n.top&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;!function(e,{map:t,table:n,tableStart:r},i){let o=0;for(let e=0;e<i;e++)o+=n.child(e).nodeSize;let s=o+n.child(i).nodeSize,a=e.mapping.maps.length;e.delete(o+r,s+r);let l=new Set;for(let o=0,s=i*t.width;o<t.width;o++,s++){let c=t.map[s];if(!l.has(c)){if(l.add(c),i>0&&c==t.map[s-t.width]){let t=n.nodeAt(c).attrs;e.setNodeMarkup(e.mapping.slice(a).map(c+r),null,{...t,rowspan:t.rowspan-1}),o+=t.colspan-1}else if(i<t.height&&c==t.map[s+t.width]){let s=n.nodeAt(c),l=s.attrs,d=s.type.create({...l,rowspan:s.attrs.rowspan-1},s.content),u=t.positionAt(i+1,o,n);e.insert(e.mapping.slice(a).map(r+u),d),o+=l.colspan-1}}}}(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=r$.get(n.table)}t(r)}return!0},"deleteTable",0,function(e,t){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if("table"==n.node(r).type.spec.tableRole)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1},"fixTables",0,r0,"goToNextCell",0,function(e){return function(t,n){if(!rV(t))return!1;let r=function(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}(rU(t),e);if(null==r)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(eF.between(e,e.node(0).resolve(e.pos+e.nodeAfter.nodeSize))).scrollIntoView())}return!0}},"isInTable",0,rV,"mergeCells",0,function(e,t){let n=e.selection;if(!(n instanceof rX)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=ie(e),{map:o}=r;if(function({width:e,height:t,map:n},r){let i=r.top*e+r.left,o=i,s=(r.bottom-1)*e+r.left,a=i+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[o]==n[o-1]||r.right<e&&n[a]==n[a+1])return!0;o+=e,a+=e}for(let o=r.left;o<r.right;o++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[s]==n[s+e])return!0;i++,s++}return!1}(o,r))return!1;if(t){let n,s,a=e.tr,l={},c=i.empty;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let i=o.map[e*o.width+t],d=r.table.nodeAt(i);if(!l[i]&&d)if(l[i]=!0,null==n)n=i,s=d;else{ii(d)||(c=c.append(d.content));let e=a.mapping.map(i+r.tableStart);a.delete(e,e+d.nodeSize)}}if(null==n||null==s)return!0;if(a.setNodeMarkup(n+r.tableStart,null,{...rG(s.attrs,s.attrs.colspan,r.right-r.left-s.attrs.colspan),rowspan:r.bottom-r.top}),c.size>0){let e=n+1+s.content.size,t=ii(s)?n+1:e;a.replaceWith(t+r.tableStart,e+r.tableStart,c)}a.setSelection(new rX(a.doc.resolve(n+r.tableStart))),t(a)}return!0},"moveTableColumn",0,function(e){return(t,n)=>{let{from:r,to:i,select:o=!0,pos:s=t.selection.from}=e,a=t.tr;return!!function(e){var t,n,r,i,o;let s,{tr:a,originIndex:l,targetIndex:c,select:d,pos:u}=e,h=r3(a.doc.resolve(u));if(!h)return!1;let p=null==(t=r9(a,l))?void 0:t.indexes,f=null==(n=r9(a,c))?void 0:n.indexes;if(!p||!f||p.includes(c))return!1;let m=(r=h.node,i=p,o=f,s=r8(r1(r)),r2(r,s=r8(s=r5(s,i,o,0))));if(a.replaceWith(h.pos,h.pos+h.node.nodeSize,m),!d)return!0;let g=r$.get(m),y=h.start,b=g.positionAt(g.height-1,c,m),v=a.doc.resolve(y+b),w=g.positionAt(0,c,m),x=a.doc.resolve(y+w);return a.setSelection(rX.colSelection(v,x)),!0}({tr:a,originIndex:r,targetIndex:i,select:o,pos:s})&&(null==n||n(a),!0)}},"moveTableRow",0,function(e){return(t,n)=>{let{from:r,to:i,select:o=!0,pos:s=t.selection.from}=e,a=t.tr;return!!function(e){var t,n,r,i,o;let s,{tr:a,originIndex:l,targetIndex:c,select:d,pos:u}=e,h=r3(a.doc.resolve(u));if(!h)return!1;let p=null==(t=r7(a,l))?void 0:t.indexes,f=null==(n=r7(a,c))?void 0:n.indexes;if(!p||!f||p.includes(c))return!1;let m=(r=h.node,i=p,o=f,s=r1(r),r2(r,s=r5(s,i,o,0)));if(a.replaceWith(h.pos,h.pos+h.node.nodeSize,m),!d)return!0;let g=r$.get(m),y=h.start,b=g.positionAt(c,g.width-1,m),v=a.doc.resolve(y+b),w=g.positionAt(c,0,m),x=a.doc.resolve(y+w);return a.setSelection(rX.rowSelection(v,x)),!0}({tr:a,originIndex:r,targetIndex:i,select:o,pos:s})&&(null==n||n(a),!0)}},"selectedRect",0,ie,"setCellAttr",0,function(e,t){return function(n,r){if(!rV(n))return!1;let i=rU(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let o=n.tr;n.selection instanceof rX?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&o.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(o)}return!0}},"splitCell",0,function(e,t){var n;let r=rH(e.schema);return(n=({node:e})=>r[e.type.spec.tableRole],(e,t)=>{let r,i,o=e.selection;if(o instanceof rX){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;r=o.$anchorCell.nodeAfter,i=o.$anchorCell.pos}else{var s;if(!(r=function(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if("cell"===n||"header_cell"===n)return e.node(t)}return null}(o.$from)))return!1;i=null==(s=rF(o.$from))?void 0:s.pos}if(null==r||null==i||1==r.attrs.colspan&&1==r.attrs.rowspan)return!1;if(t){let s,a=r.attrs,l=[],c=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});let d=ie(e),u=e.tr;for(let e=0;e<d.right-d.left;e++)l.push(c?{...a,colwidth:c&&c[e]?[c[e]]:null}:a);for(let e=d.top;e<d.bottom;e++){let t=d.map.positionAt(e,d.left,d.table);e==d.top&&(t+=r.nodeSize);for(let i=d.left,o=0;i<d.right;i++,o++)(i!=d.left||e!=d.top)&&u.insert(s=u.mapping.map(t+d.tableStart,1),n({node:r,row:e,col:i}).createAndFill(l[o]))}u.setNodeMarkup(i,n({node:r,row:d.top,col:d.left}),l[0]),o instanceof rX&&u.setSelection(new rX(u.doc.resolve(o.$anchorCell.pos),s?u.doc.resolve(s):void 0)),t(u)}return!0})(e,t)},"tableEditing",0,function({allowTableNodeSelection:e=!1}={}){return new e2({key:rB,state:{init:()=>null,apply(e,t){let n=e.getMeta(rB);if(null!=n)return -1==n?null:n;if(null==t||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:rY,handleDOMEvents:{mousedown:iw},createSelectionBetween:e=>null!=rB.getState(e.state)?e.state.selection:null,handleTripleClick:ib,handleKeyDown:ip,handlePaste:iv},appendTransaction:(t,n,r)=>(function(e,t,n){let r,i,o=(t||e).selection,s=(t||e).doc;if(o instanceof eU&&(i=o.node.type.spec.tableRole)){if("cell"==i||"header_cell"==i)r=rX.create(s,o.from);else if("row"==i){let e=s.resolve(o.from+1);r=rX.rowSelection(e,e)}else if(!n){let e=r$.get(o.node),t=o.from+1,n=t+e.map[e.width*e.height-1];r=rX.create(s,t+1,n)}}else o instanceof eF&&function({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}(o)?r=eF.create(s,o.from):o instanceof eF&&function({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if("cell"===r.type.spec.tableRole||"header_cell"===r.type.spec.tableRole){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if("cell"===n.type.spec.tableRole||"header_cell"===n.type.spec.tableRole){r=n;break}}return n!==r&&0===t.parentOffset}(o)&&(r=eF.create(s,o.$from.start(),o.$from.end()));return r&&(t||(t=e.tr)).setSelection(r),t})(r,r0(r,n),e)})},"toggleHeader",0,is,"toggleHeaderCell",0,ia],608926),e.s([],150663),e.i(335884);var iD=e.i(101685),ij=e.i(380560),iI=e.i(3909),iP=e.i(44501);let iL=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function iz(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("backward",e):!(n.parentOffset>0))?n:null}let i_=(e,t,n)=>{let r=iz(e,n);if(!r)return!1;let i=iF(r);if(!i){let n=r.blockRange(),i=n&&em(n);return null!=i&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let o=i.nodeBefore;if(iY(e,i,t,-1))return!0;if(0==r.parent.content.size&&(iH(o,"end")||eU.isSelectable(o)))for(let n=r.depth;;n--){let s=eE(e.doc,r.before(n),r.after(n),d.empty);if(s&&s.slice.size<s.to-s.from){if(t){let n=e.tr.step(s);n.setSelection(iH(o,"end")?e_.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):eU.create(n.doc,i.pos-o.nodeSize)),t(n.scrollIntoView())}return!0}if(1==n||r.node(n-1).childCount>1)break}return!!o.isAtom&&i.depth==r.depth-1&&(t&&t(e.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0)};function i$(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 o=t.nodeAfter,s=t.pos+1;for(;!o.isTextblock;s++){if(o.type.spec.isolating)return!1;let e=o.firstChild;if(!e)return!1;o=e}let a=eE(e.doc,i,s,d.empty);if(!a||a.from!=i||a instanceof eu&&a.slice.size>=s-i)return!1;if(n){let t=e.tr.step(a);t.setSelection(eF.create(t.doc,i)),n(t.scrollIntoView())}return!0}function iH(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)break}return!1}let iB=(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;o=iF(r)}let s=o&&o.nodeBefore;return!!s&&!!eU.isSelectable(s)&&(t&&t(e.tr.setSelection(eU.create(e.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function iF(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 iV(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("forward",e):!(n.parentOffset<n.parent.content.size))?n:null}let iU=(e,t,n)=>{let r=iV(e,n);if(!r)return!1;let i=iK(r);if(!i)return!1;let o=i.nodeAfter;if(iY(e,i,t,1))return!0;if(0==r.parent.content.size&&(iH(o,"start")||eU.isSelectable(o))){let n=eE(e.doc,r.before(),r.after(),d.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(iH(o,"start")?e_.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):eU.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return!!o.isAtom&&i.depth==r.depth-1&&(t&&t(e.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0)},iW=(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;o=iK(r)}let s=o&&o.nodeAfter;return!!s&&!!eU.isSelectable(s)&&(t&&t(e.tr.setSelection(eU.create(e.doc,o.pos)).scrollIntoView()),!0)};function iK(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}let iq=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!!n.parent.type.spec.code&&!!n.sameParent(r)&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)};function iJ(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}let iG=(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),o=n.indexAfter(-1),s=iJ(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,s.createAndFill());i.setSelection(e_.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},iX=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof eK||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=iJ(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,s=e.tr.insert(n,o.createAndFill());s.setSelection(eF.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},iZ=(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(ew(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&em(r);return null!=i&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function iY(e,t,n,r){let o,s,a,l=t.nodeBefore,c=t.nodeAfter,u,h,p=l.type.spec.isolating||c.type.spec.isolating;if(!p&&(o=t.nodeBefore,s=t.nodeAfter,a=t.index(),o&&s&&o.type.compatibleContent(s.type)&&(!o.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-o.nodeSize,t.pos).scrollIntoView()),!0):!!t.parent.canReplace(a,a+1)&&!!(s.isTextblock||ex(e.doc,t.pos))&&(n&&n(e.tr.join(t.pos).scrollIntoView()),!0))))return!0;let f=!p&&t.parent.canReplace(t.index(),t.index()+1);if(f&&(u=(h=l.contentMatchAt(l.childCount)).findWrapping(c.type))&&h.matchType(u[0]||c.type).validEnd){if(n){let r=t.pos+c.nodeSize,o=i.empty;for(let e=u.length-1;e>=0;e--)o=i.from(u[e].create(null,o));o=i.from(l.copy(o));let s=e.tr.step(new eh(t.pos-1,r,t.pos,r,new d(o,1,0),u.length,!0)),a=s.doc.resolve(r+2*u.length);a.nodeAfter&&a.nodeAfter.type==l.type&&ex(s.doc,a.pos)&&s.join(a.pos),n(s.scrollIntoView())}return!0}let m=c.type.spec.isolating||r>0&&p?null:e_.findFrom(t,1),g=m&&m.$from.blockRange(m.$to),y=g&&em(g);if(null!=y&&y>=t.depth)return n&&n(e.tr.lift(g,y).scrollIntoView()),!0;if(f&&iH(c,"start",!0)&&iH(l,"end")){let r=l,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let s=c,a=1;for(;!s.isTextblock;s=s.firstChild)a++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=i.empty;for(let e=o.length-1;e>=0;e--)r=i.from(o[e].copy(r));n(e.tr.step(new eh(t.pos-o.length,t.pos+c.nodeSize,t.pos+a,t.pos+c.nodeSize-a,new d(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function iQ(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return!!i.node(o).isTextblock&&(n&&n(t.tr.setSelection(eF.create(t.doc,e<0?i.start(o):i.end(o)))),!0)}}let i0=iQ(-1),i1=iQ(1);function i2(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:o},$to:{pos:s}}=n.selection.ranges[r];n.doc.nodesBetween(o,s,(r,o)=>{if(i)return!1;if(!(!r.isTextblock||r.hasMarkup(e,t)))if(r.type==e)i=!0;else{let t=n.doc.resolve(o),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:o},$to:{pos:s}}=n.selection.ranges[r];i.setBlockType(o,s,e,t)}r(i.scrollIntoView())}return!0}}function i5(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}let i3=i5(iL,i_,iB),i4=i5(iL,iU,iW),i6={Enter:i5(iq,iX,iZ,(e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof eU&&e.selection.node.isBlock)return!!n.parentOffset&&!!ew(e.doc,n.pos)&&(t&&t(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let i=[],o,s,a=!1,l=!1;for(let e=n.depth;;e--){if(n.node(e).isBlock){let t;a=n.end(e)==n.pos+(n.depth-e),l=n.start(e)==n.pos-(n.depth-e),s=iJ(n.node(e-1).contentMatchAt(n.indexAfter(e-1)));i.unshift(t||(a&&s?{type:s}:null)),o=e;break}if(1==e)return!1;i.unshift(null)}let c=e.tr;(e.selection instanceof eF||e.selection instanceof eK)&&c.deleteSelection();let d=c.mapping.map(n.pos),u=ew(c.doc,d,i.length,i);if(u||(i[0]=s?{type:s}:null,u=ew(c.doc,d,i.length,i)),!u)return!1;if(c.split(d,i.length,i),!a&&l&&n.node(o).type!=s){let e=c.mapping.map(n.before(o)),t=c.doc.resolve(e);s&&n.node(o-1).canReplaceWith(t.index(),t.index()+1,s)&&c.setNodeMarkup(c.mapping.map(n.before(o)),s)}return t&&t(c.scrollIntoView()),!0}),"Mod-Enter":iG,Backspace:i3,"Mod-Backspace":i3,"Shift-Backspace":i3,Delete:i4,"Mod-Delete":i4,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new eK(e.doc))),!0)},i9={"Ctrl-h":i6.Backspace,"Alt-Backspace":i6["Mod-Backspace"],"Ctrl-d":i6.Delete,"Ctrl-Alt-Backspace":i6["Mod-Delete"],"Alt-Delete":i6["Mod-Delete"],"Alt-d":i6["Mod-Delete"],"Ctrl-a":i0,"Ctrl-e":i1};for(let e in i6)i9[e]=i6[e];"u">typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"u">typeof os&&os.platform&&os.platform();var i7=Object.defineProperty,i8=(e,t)=>{for(var n in t)i7(e,n,{get:t[n],enumerable:!0})};function oe(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:o}=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 o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}var ot=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,o=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(o);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:o}=r,s=[],a=!!e,l=e||i.tr,c=()=>(a||!t||l.getMeta("preventDispatch")||this.hasCustomState||o.dispatch(l),s.every(e=>!0===e)),d={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(l,t),i=n(...e)(r);return s.push(i),d}])),run:c};return d}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:o}=r,s={tr:e,editor:r,view:o,state:oe({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)(s)]))}};return s}},on={};i8(on,{blur:()=>or,clearContent:()=>oi,clearNodes:()=>oo,command:()=>oa,createParagraphNear:()=>ol,cut:()=>oc,deleteCurrentNode:()=>od,deleteNode:()=>oh,deleteRange:()=>op,deleteSelection:()=>om,enter:()=>og,exitCode:()=>oy,extendMarkRange:()=>oC,first:()=>oE,focus:()=>oO,forEach:()=>oD,insertContent:()=>oj,insertContentAt:()=>oz,joinBackward:()=>oH,joinDown:()=>o$,joinForward:()=>oB,joinItemBackward:()=>oF,joinItemForward:()=>oV,joinTextblockBackward:()=>oU,joinTextblockForward:()=>oW,joinUp:()=>o_,keyboardShortcut:()=>oq,lift:()=>oG,liftEmptyBlock:()=>oX,liftListItem:()=>oZ,newlineInCode:()=>oY,resetAttributes:()=>o1,scrollIntoView:()=>o2,selectAll:()=>o5,selectNodeBackward:()=>o3,selectNodeForward:()=>o4,selectParentNode:()=>o6,selectTextblockEnd:()=>o9,selectTextblockStart:()=>o7,setContent:()=>se,setMark:()=>sL,setMeta:()=>sz,setNode:()=>s_,setNodeSelection:()=>s$,setTextDirection:()=>sH,setTextSelection:()=>sB,sinkListItem:()=>sF,splitBlock:()=>sU,splitListItem:()=>sW,toggleList:()=>sJ,toggleMark:()=>sG,toggleNode:()=>sX,toggleWrap:()=>sZ,undoInputRule:()=>sY,unsetAllMarks:()=>sQ,unsetMark:()=>s0,unsetTextDirection:()=>s1,updateAttributes:()=>s2,wrapIn:()=>s5,wrapInList:()=>s3});var or=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())}),!0),oi=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),oo=()=>({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,o=r.resolve(i.map(n)),s=r.resolve(i.map(n+e.nodeSize)),a=o.blockRange(s);if(!a)return;let l=em(a);if(e.type.isTextblock){let{defaultType:e}=o.parent.contentMatchAt(o.index());t.setNodeMarkup(a.start,e)}(l||0===l)&&t.lift(a,l)})}),!0)},oa=e=>t=>e(t),ol=()=>({state:e,dispatch:t})=>iX(e,t),oc=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,o=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let s=r.mapping.map(t);return r.insert(s,o.content),r.setSelection(new eF(r.doc.resolve(Math.max(s-1,0)))),!0},od=()=>({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-=1)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 ou(e,t){if("string"==typeof e){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 oh=e=>({tr:t,state:n,dispatch:r})=>{let i=ou(e,n.schema),o=t.selection.$anchor;for(let e=o.depth;e>0;e-=1)if(o.node(e).type===i){if(r){let n=o.before(e),r=o.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},op=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},of=(e,t,n)=>{var r;return!e.parent.isInline||"left"===n&&e.pos>e.start()||"right"===n&&e.pos<e.end()?e.pos:(r=t.nodes[e.parent.type.name].spec).content&&/^text(\*|\+)/.test(r.content)?"left"===n?e.start()-1:e.end()+1:e.pos},om=()=>({state:e,dispatch:t})=>{var n;let{$from:r,$to:i}=e.selection;if(e.selection.empty)return!1;let{from:o,to:s}={from:of(r,n=e.schema,"left"),to:of(i,n,"right")};return t&&(e.tr.deleteRange(o,s).scrollIntoView(),t(e.tr)),!0},og=()=>({commands:e})=>e.keyboardShortcut("Enter"),oy=()=>({state:e,dispatch:t})=>iG(e,t);function ob(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function ov(e,t,n={strict:!0}){let r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:ob(t[r])?t[r].test(e[r]):t[r]===e[r])}function ow(e,t,n={}){return e.find(e=>e.type===t&&ov(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function ox(e,t,n={}){return!!ow(e,t,n)}function ok(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(!ow([...r.node.marks],t,n))return;let i=r.index,o=e.start()+r.offset,s=i+1,a=o+r.node.nodeSize;for(;i>0&&ox([...e.parent.child(i-1).marks],t,n);)i-=1,o-=e.parent.child(i).nodeSize;for(;s<e.parent.childCount&&ox([...e.parent.child(s).marks],t,n);)a+=e.parent.child(s).nodeSize,s+=1;return{from:o,to:a}}function oS(e,t){if("string"==typeof e){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 oC=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o=oS(e,r.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:d}=a;if(i){let e=ok(l,o,t);if(e&&e.from<=c&&e.to>=d){let t=eF.create(s,e.from,e.to);n.setSelection(t)}}return!0},oE=e=>t=>{let n="function"==typeof e?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function oM(e){return e instanceof eF}function oN(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function oA(e,t=null){if(!t)return null;let n=e_.atStart(e),r=e_.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;let i=n.from,o=r.to;return"all"===t?eF.create(e,oN(0,i,o),oN(e.content.size,i,o)):eF.create(e,oN(t,i,o),oN(t,i,o))}function oT(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function oR(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var oO=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:o})=>{t={scrollIntoView:!0,...t};let s=()=>{(oR()||oT())&&r.dom.focus(),"u">typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!oR()&&!oT()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{!n.isDestroyed&&(r.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&null===e||!1===e)return!0}catch{return!1}if(o&&null===e&&!oM(n.state.selection))return s(),!0;let a=oA(i.doc,e)||n.state.selection,l=n.state.selection.eq(a);return o&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},oD=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),oj=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),oI=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){let r=t[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):1===r.nodeType&&oI(r)}return e};function oP(e){if("u"<typeof window)throw Error("[tiptap error]: there is no window object available, so this function cannot be used");let t=`<body>${e}</body>`;return oI(new window.DOMParser().parseFromString(t,"text/html").body)}function oL(e,t,n){if(e instanceof S||e instanceof i)return e;n={slice:!0,parseOptions:{},...n};let r="object"==typeof e&&null!==e,o="string"==typeof e;if(r)try{if(Array.isArray(e)&&e.length>0)return i.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),oL("",t,n)}if(o){if(n.errorOnInvalidContent){let r=!1,i="",o=new _({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="string"==typeof e?e:e.outerHTML,null)}]}})});if(n.slice?H.fromSchema(o).parseSlice(oP(e),n.parseOptions):H.fromSchema(o).parse(oP(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error("[tiptap error]: Invalid HTML content",{cause:Error(`Invalid element found: ${i}`)})}let r=H.fromSchema(t);return n.slice?r.parseSlice(oP(e),n.parseOptions).content:r.parse(oP(e),n.parseOptions)}return oL("",t,n)}var oz=(e,t,n)=>({tr:r,dispatch:o,editor:s})=>{var a;if(o){let o,l;n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c=e=>{s.emit("contentError",{editor:s,error:e,disableCollaboration:()=>{"collaboration"in s.storage&&"object"==typeof s.storage.collaboration&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{oL(t,s.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(e){c(e)}try{o=oL(t,s.schema,{parseOptions:d,errorOnInvalidContent:null!=(a=n.errorOnInvalidContent)?a:s.options.enableContentCheck})}catch(e){return c(e),!1}let{from:u,to:h}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},p=!0,f=!0;if((!("type"in o)?o:[o]).forEach(e=>{e.check(),p=!!p&&e.isText&&0===e.marks.length,f=!!f&&e.isBlock}),u===h&&f){let{parent:e}=r.doc.resolve(u);!e.isTextblock||e.type.spec.code||e.childCount||(u-=1,h+=1)}if(p){if(Array.isArray(t))l=t.map(e=>e.text||"").join("");else if(t instanceof i){let e="";t.forEach(t=>{t.text&&(e+=t.text)}),l=e}else l="object"==typeof t&&t&&t.text?t.text:t;r.insertText(l,u,h)}else{l=o;let e=r.doc.resolve(u),t=e.node(),n=0===e.parentOffset,i=t.isText||t.isTextblock,s=t.content.size>0;n&&i&&s&&f&&(u=Math.max(0,u-1)),r.replaceWith(u,h,l)}n.updateSelection&&function(e,t){let n=e.steps.length-1;if(n<t)return;let r=e.steps[n];if(!(r instanceof eu||r instanceof eh))return;let i=e.mapping.maps[n],o=0;i.forEach((e,t,n,r)=>{0===o&&(o=r)}),e.setSelection(e_.near(e.doc.resolve(o),-1))}(r,r.steps.length-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:l}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:l})}return!0},o_=()=>({state:e,dispatch:t})=>((e,t)=>{let n=e.selection,r=n instanceof eU,i;if(r){if(n.node.isTextblock||!ex(e.doc,n.from))return!1;i=n.from}else if(null==(i=eS(e.doc,n.from,-1)))return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(eU.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0})(e,t),o$=()=>({state:e,dispatch:t})=>((e,t)=>{let n=e.selection,r;if(n instanceof eU){if(n.node.isTextblock||!ex(e.doc,n.to))return!1;r=n.to}else if(null==(r=eS(e.doc,n.to,1)))return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0})(e,t),oH=()=>({state:e,dispatch:t})=>i_(e,t),oB=()=>({state:e,dispatch:t})=>iU(e,t),oF=()=>({state:e,dispatch:t,tr:n})=>{try{let r=eS(e.doc,e.selection.$from.pos,-1);if(null==r)return!1;return n.join(r,2),t&&t(n),!0}catch{return!1}},oV=()=>({state:e,dispatch:t,tr:n})=>{try{let r=eS(e.doc,e.selection.$from.pos,1);if(null==r)return!1;return n.join(r,2),t&&t(n),!0}catch{return!1}},oU=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=iz(e,n);if(!r)return!1;let i=iF(r);return!!i&&i$(e,i,t)})(e,t),oW=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=iV(e,n);if(!r)return!1;let i=iK(r);return!!i&&i$(e,i,t)})(e,t);function oK(){return"u">typeof navigator&&/Mac/.test(navigator.platform)}var oq=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let o=(function(e){let t,n,r,i,o=e.split(/-(?!$)/),s=o[o.length-1];"Space"===s&&(s=" ");for(let e=0;e<o.length-1;e+=1){let s=o[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else if(/^mod$/i.test(s))oR()||oK()?i=!0:n=!0;else throw Error(`Unrecognized modifier name: ${s}`)}return t&&(s=`Alt-${s}`),n&&(s=`Ctrl-${s}`),i&&(s=`Meta-${s}`),r&&(s=`Shift-${s}`),s})(e).split(/-(?!$)/),s=o.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),a=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,a))});return null==l||l.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function oJ(e,t,n={}){let{from:r,to:i,empty:o}=e.selection,s=t?ou(t,e.schema):null,a=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),o=Math.min(i,t+e.nodeSize);a.push({node:e,from:n,to:o})});let l=i-r,c=a.filter(e=>!s||s.name===e.node.type.name).filter(e=>ov(e.node.attrs,n,{strict:!1}));return o?!!c.length:c.reduce((e,t)=>e+t.to-t.from,0)>=l}var oG=(e,t={})=>({state:n,dispatch:r})=>{let i=ou(e,n.schema);return!!oJ(n,i,t)&&((e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),o=i&&em(i);return null!=o&&(t&&t(e.tr.lift(i,o).scrollIntoView()),!0)})(n,r)},oX=()=>({state:e,dispatch:t})=>iZ(e,t),oZ=e=>({state:t,dispatch:n})=>{var r;return(r=ou(e,t.schema),function(e,t){let{$from:n,$to:o}=e.selection,s=n.blockRange(o,e=>e.childCount>0&&e.firstChild.type==r);return!!s&&(!t||(n.node(s.depth-1).type==r?function(e,t,n,r){let o=e.tr,s=r.end,a=r.$to.end(r.depth);s<a&&(o.step(new eh(s-1,a,s,a,new d(i.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new x(o.doc.resolve(r.$from.pos),o.doc.resolve(a),r.depth));let l=em(r);if(null==l)return!1;o.lift(r,l);let c=o.doc.resolve(o.mapping.map(s,-1)-1);return ex(o.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&o.join(c.pos),t(o.scrollIntoView()),!0}(e,t,r,s):function(e,t,n){let r=e.tr,o=n.parent;for(let e=n.end,t=n.endIndex-1,i=n.startIndex;t>i;t--)e-=o.child(t).nodeSize,r.delete(e-1,e+1);let s=r.doc.resolve(n.start),a=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let l=0==n.startIndex,c=n.endIndex==o.childCount,u=s.node(-1),h=s.index(-1);if(!u.canReplace(h+ +!l,h+1,a.content.append(c?i.empty:i.from(o))))return!1;let p=s.pos,f=p+a.nodeSize;return r.step(new eh(p-!!l,f+ +!!c,p+1,f-1,new d((l?i.empty:i.from(o.copy(i.empty))).append(c?i.empty:i.from(o.copy(i.empty))),+!l,+!c),+!l)),t(r.scrollIntoView()),!0}(e,t,s)))})(t,n)},oY=()=>({state:e,dispatch:t})=>iq(e,t);function oQ(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function o0(e,t){let n="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var o1=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,a=oQ("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(o=ou(e,r.schema)),"mark"===a&&(s=oS(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{o&&o===e.type&&(l=!0,i&&n.setNodeMarkup(r,void 0,o0(e.attrs,t))),s&&e.marks.length&&e.marks.forEach(o=>{s===o.type&&(l=!0,i&&n.addMark(r,r+e.nodeSize,s.create(o0(o.attrs,t))))})})}),l},o2=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),o5=()=>({tr:e,dispatch:t})=>{if(t){let t=new eK(e.doc);e.setSelection(t)}return!0},o3=()=>({state:e,dispatch:t})=>iB(e,t),o4=()=>({state:e,dispatch:t})=>iW(e,t),o6=()=>({state:e,dispatch:t})=>((e,t)=>{let{$from:n,to:r}=e.selection,i,o=n.sharedDepth(r);return 0!=o&&(i=n.before(o),t&&t(e.tr.setSelection(eU.create(e.doc,i))),!0)})(e,t),o9=()=>({state:e,dispatch:t})=>i1(e,t),o7=()=>({state:e,dispatch:t})=>i0(e,t);function o8(e,t,n={},r={}){return oL(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var se=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:o,dispatch:s,commands:a})=>{let{doc:l}=o;if("full"!==r.preserveWhitespace){let a=o8(e,i.schema,r,{errorOnInvalidContent:null!=t?t:i.options.enableContentCheck});return s&&o.replaceWith(0,l.content.size,a).setMeta("preventUpdate",!n),!0}return s&&o.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},e,{parseOptions:r,errorOnInvalidContent:null!=t?t:i.options.enableContentCheck})};function st(e,t){let n=oS(t,e.schema),{from:r,to:i,empty:o}=e.selection,s=[];o?(e.storedMarks&&s.push(...e.storedMarks),s.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{s.push(...e.marks)});let a=s.find(e=>e.type.name===n.name);return a?{...a.attrs}:{}}function sn(e,t){let n=new eL(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function sr(e,t){for(let n=e.depth;n>0;n-=1){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 si(e){return t=>sr(t.$from,e)}function so(e,t,n){return void 0===e.config[t]&&e.parent?so(e.parent,t,n):"function"==typeof e.config[t]?e.config[t].bind({...n,parent:e.parent?so(e.parent,t,n):null}):e.config[t]}function ss(e){return e.map(e=>{let t={name:e.name,options:e.options,storage:e.storage},n=so(e,"addExtensions",t);return n?[e,...ss(n())]:e}).flat(10)}function sa(e,t){let n=G.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function sl(e){return"function"==typeof e}function sc(e,t,...n){return sl(e)?t?e.bind(t)(...n):e(...n):e}function sd(e){let t=e.filter(e=>"extension"===e.type);return{baseExtensions:t,nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function su(e){let t=[],{nodeExtensions:n,markExtensions:r}=sd(e),i=[...n,...r],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=n.filter(e=>"text"!==e.name).map(e=>e.name),a=r.map(e=>e.name),l=[...s,...a];return e.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage,extensions:i},r=so(e,"addGlobalAttributes",n);r&&r().forEach(e=>{(Array.isArray(e.types)?e.types:"*"===e.types?l:"nodes"===e.types?s:"marks"===e.types?a:[]).forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...o,...r}})})})})}),i.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage},r=so(e,"addAttributes",n);r&&Object.entries(r()).forEach(([n,r])=>{let i={...o,...r};"function"==typeof(null==i?void 0:i.default)&&(i.default=i.default()),(null==i?void 0:i.isRequired)&&(null==i?void 0:i.default)===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function sh(e){let t=[],n=function(e){let t=[],n="",r=!1,i=!1,o=0,s=e.length;for(let a=0;a<s;a+=1){let s=e[a];if("'"===s&&!i){r=!r,n+=s;continue}if('"'===s&&!r){i=!i,n+=s;continue}if(!r&&!i){if("("===s){o+=1,n+=s;continue}if(")"===s&&o>0){o-=1,n+=s;continue}if(";"===s&&0===o){t.push(n),n="";continue}}n+=s}return n&&t.push(n),t}(e||""),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],i=r.indexOf(":");if(-1===i)continue;let o=r.slice(0,i).trim(),s=r.slice(i+1).trim();o&&s&&t.push([o,s])}return t}function sp(...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("class"===e){let r=t?String(t).split(" "):[],i=n[e]?n[e].split(" "):[],o=r.filter(e=>!i.includes(e));n[e]=[...i,...o].join(" ")}else if("style"===e){let r=new Map([...sh(n[e]),...sh(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else n[e]=t}),n},{})}function sf(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)=>sp(e,t),{})}function sm(e,t){return"style"in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;let i=t.reduce((e,t)=>{var r;let i=t.attribute.parseHTML?t.attribute.parseHTML(n):"string"!=typeof(r=n.getAttribute(t.name))?r:r.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(r):"true"===r||"false"!==r&&r;return null==i?e:{...e,[t.name]:i}},{});return{...r,...i}}}}function sg(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>!("attrs"===e&&function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(t))&&null!=t))}function sy(e){var t,n;let r={};return!(null==(t=null==e?void 0:e.attribute)?void 0:t.isRequired)&&"default"in((null==e?void 0:e.attribute)||{})&&(r.default=e.attribute.default),(null==(n=null==e?void 0:e.attribute)?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function sb(e){return e.sort((e,t)=>{let n=so(e,"priority")||100,r=so(t,"priority")||100;return n>r?-1:+(n<r)})}function sv(e){var t;let n=sb(ss(e)),r=Array.from(new Set((t=n.map(e=>e.name)).filter((e,n)=>t.indexOf(e)!==n)));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),n}function sw(e,t,n){let{from:r,to:i}=t,{blockSeparator:o="\n\n",textSerializers:s={}}=n||{},a="";return e.nodesBetween(r,i,(e,n,l,c)=>{var d;e.isBlock&&n>r&&(a+=o);let u=null==s?void 0:s[e.type.name];if(u)return l&&(a+=u({node:e,pos:n,parent:l,index:c,range:t})),!1;e.isText&&(a+=null==(d=null==e?void 0:e.text)?void 0:d.slice(Math.max(r,n)-n,i-n))}),a}function sx(e,t){let n={from:0,to:e.content.size};return sw(e,n,t)}function sk(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function sS(e,t){let n=oQ("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){let n=ou(t,e.schema),{from:r,to:i}=e.selection,o=[];e.doc.nodesBetween(r,i,e=>{o.push(e)});let s=o.reverse().find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}(e,t):"mark"===n?st(e,t):{}}function sC(e){let t,{mapping:n,steps:r}=e,i=[];return n.maps.forEach((e,t)=>{let o=[];if(e.ranges.length)e.forEach((e,t)=>{o.push({from:e,to:t})});else{let{from:e,to:n}=r[t];if(void 0===e||void 0===n)return;o.push({from:e,to:n})}o.forEach(({from:e,to:r})=>{let o=n.slice(t).map(e,-1),s=n.slice(t).map(r),a=n.invert().map(o,-1),l=n.invert().map(s);i.push({oldRange:{from:a,to:l},newRange:{from:o,to:s}})})}),1===(t=function(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)})}(i)).length?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 sE(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=ok(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{e&&(null==e?void 0:e.nodeSize)!==void 0&&r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}function sM(e,t){return t.nodes[e]||t.marks[e]||null}function sN(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}))}function sA(e,t,n={}){let{empty:r,ranges:i}=e.selection,o=t?oS(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!o||o.name===e.type.name).find(e=>ov(e.attrs,n,{strict:!1}));let s=0,a=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(o&&e.inlineContent&&!e.type.allowsMarkType(o))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),l=Math.min(i,t+e.nodeSize);s+=l-n,a.push(...e.marks.map(e=>({mark:e,from:n,to:l})))})}),0===s)return!1;let l=a.filter(e=>!o||o.name===e.mark.type.name).filter(e=>ov(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),c=a.filter(e=>!o||e.mark.type!==o&&e.mark.type.excludes(o)).reduce((e,t)=>e+t.to-t.from,0);return(l>0?l+c:l)>=s}function sT(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function sR(e,t){let{nodeExtensions:n}=sd(t),r=n.find(t=>t.name===e);if(!r)return!1;let i={name:r.name,options:r.options,storage:r.storage},o=sc(so(r,"group",i));return"string"==typeof o&&o.split(" ").includes("list")}function sO(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if("hardBreak"===e.type.name)return!0;if(e.isText)return!/\S/.test(null!=(r=e.text)?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(t){let r=!0;return e.content.forEach(e=>{!1!==r&&(sO(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function sD({selection:e,pos:t,nodeSize:n,selectedOnTextSelection:r=!1}){let{from:i,to:o}=e;return!!(i<=t&&o>=t+n||r&&oM(e)&&i>t&&o<t+n)}var sj=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function sI(e,t){let n=t.mapping.mapResult(e.position);return{position:new sj(n.pos),mapResult:n}}function sP(e){return new sj(e)}var sL=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:o}=n,{empty:s,ranges:a}=o,l=oS(e,r.schema);if(i)if(s){let e=st(r,l);n.addStoredMark(l.create({...e,...t}))}else a.forEach(e=>{let i=e.$from.pos,o=e.$to.pos;r.doc.nodesBetween(i,o,(e,r)=>{let s=Math.max(r,i),a=Math.min(r+e.nodeSize,o);e.marks.find(e=>e.type===l)?e.marks.forEach(e=>{l===e.type&&n.addMark(s,a,l.create({...e.attrs,...t}))}):n.addMark(s,a,l.create(t))})});return function(e,t,n){var r;let{selection:i}=t,o=null;if(oM(i)&&(o=i.$cursor),o){let t=null!=(r=e.storedMarks)?r:o.marks();return o.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:s}=i;return s.some(({$from:t,$to:r})=>{let i=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);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),o=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&o}return!i}),i})}(r,n,l)},sz=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),s_=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let o,s=ou(e,n.schema);return(n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock)?i().command(({commands:e})=>!!i2(s,{...o,...t})(n)||e.clearNodes()).command(({state:e})=>i2(s,{...o,...t})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},s$=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=oN(e,0,n.content.size),i=eU.create(n,r);t.setSelection(i)}return!0},sH=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o,s,{selection:a}=r;return"number"==typeof t?(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},sB=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}="number"==typeof e?{from:e,to:e}:e,o=eF.atStart(n).from,s=eF.atEnd(n).to,a=oN(r,o,s),l=oN(i,o,s),c=eF.create(n,a,l);t.setSelection(c)}return!0},sF=e=>({state:t,dispatch:n})=>{var r;return(r=ou(e,t.schema),function(e,t){let{$from:n,$to:o}=e.selection,s=n.blockRange(o,e=>e.childCount>0&&e.firstChild.type==r);if(!s)return!1;let a=s.startIndex;if(0==a)return!1;let l=s.parent,c=l.child(a-1);if(c.type!=r)return!1;if(t){let n=c.lastChild&&c.lastChild.type==l.type,o=i.from(n?r.create():null),a=new d(i.from(r.create(null,i.from(l.type.create(null,o)))),n?3:1,0),u=s.start,h=s.end;t(e.tr.step(new eh(u-(n?3:1),h,u,h,a,1,!0)).scrollIntoView())}return!0})(t,n)};function sV(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(r)}}var sU=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:o,doc:s}=t,{$from:a,$to:l}=o,c=sN(i.extensionManager.attributes,a.node().type.name,a.node().attrs);if(o instanceof eU&&o.node.isBlock)return!!a.parentOffset&&!!ew(s,a.pos)&&(r&&(e&&sV(n,i.extensionManager.splittableMarks),t.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;let d=l.parentOffset===l.parent.content.size,u=0===a.depth?void 0:function(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}(a.node(-1).contentMatchAt(a.indexAfter(-1))),h=d&&u?[{type:u,attrs:c}]:void 0,p=ew(t.doc,t.mapping.map(a.pos),1,h);if(!h&&!p&&ew(t.doc,t.mapping.map(a.pos),1,u?[{type:u}]:void 0)&&(p=!0,h=u?[{type:u,attrs:c}]:void 0),r){if(p&&(o instanceof eF&&t.deleteSelection(),t.split(t.mapping.map(a.pos),1,h),u&&!d&&!a.parentOffset&&a.parent.type!==u)){let e=t.mapping.map(a.before()),n=t.doc.resolve(e);a.node(-1).canReplaceWith(n.index(),n.index()+1,u)&&t.setNodeMarkup(t.mapping.map(a.before()),u)}e&&sV(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return p},sW=(e,t={})=>({tr:n,state:r,dispatch:o,editor:s})=>{var a;let l=ou(e,r.schema),{$from:c,$to:u}=r.selection,h=r.selection.node;if(h&&h.isBlock||c.depth<2||!c.sameParent(u))return!1;let p=c.node(-1);if(p.type!==l)return!1;let f=s.extensionManager.attributes;if(0===c.parent.content.size&&c.node(-1).childCount===c.indexAfter(-1)){if(2===c.depth||c.node(-3).type!==l||c.index(-2)!==c.node(-2).childCount-1)return!1;if(o){let e=i.empty,r=c.index(-1)?1:c.index(-2)?2:3;for(let t=c.depth-r;t>=c.depth-3;t-=1)e=i.from(c.node(t).copy(e));let o=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,s={...sN(f,c.node().type.name,c.node().attrs),...t},u=(null==(a=l.contentMatch.defaultType)?void 0:a.createAndFill(s))||void 0;e=e.append(i.from(l.createAndFill(null,u)||void 0));let h=c.before(c.depth-(r-1));n.replace(h,c.after(-o),new d(e,4-r,0));let p=-1;n.doc.nodesBetween(h,n.doc.content.size,(e,t)=>{if(p>-1)return!1;e.isTextblock&&0===e.content.size&&(p=t+1)}),p>-1&&n.setSelection(eF.near(n.doc.resolve(p))),n.scrollIntoView()}return!0}let m=u.pos===c.end()?p.contentMatchAt(0).defaultType:null,g={...sN(f,p.type.name,p.attrs),...t},y={...sN(f,c.node().type.name,c.node().attrs),...t};n.delete(c.pos,u.pos);let b=m?[{type:l,attrs:g},{type:m,attrs:y}]:[{type:l,attrs:g}];if(!ew(n.doc,c.pos,2))return!1;if(o){let{selection:e,storedMarks:t}=r,{splittableMarks:i}=s.extensionManager,a=t||e.$to.parentOffset&&e.$from.marks();if(n.split(c.pos,2,b).scrollIntoView(),!a||!o)return!0;let l=a.filter(e=>i.includes(e.type.name));n.ensureMarks(l)}return!0},sK=(e,t)=>{let n=si(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(void 0===r)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===(null==i?void 0:i.type)&&ex(e.doc,n.pos))||(e.join(n.pos),!0)},sq=(e,t)=>{let n=si(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(void 0===r)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===(null==i?void 0:i.type)&&ex(e.doc,r))||(e.join(r),!0)},sJ=(e,t,n,r={})=>({editor:i,tr:o,state:s,dispatch:a,chain:l,commands:c,can:d})=>{let{extensions:u,splittableMarks:h}=i.extensionManager,p=ou(e,s.schema),f=ou(t,s.schema),{selection:m,storedMarks:g}=s,{$from:y,$to:b}=m,v=y.blockRange(b),w=g||m.$to.parentOffset&&m.$from.marks();if(!v)return!1;let x=si(e=>sR(e.type.name,u))(m),k=0===m.from&&m.to===s.doc.content.size,S=s.doc.content.content,C=1===S.length?S[0]:null,E=k&&C&&sR(C.type.name,u)?{node:C,pos:0,depth:0}:null,M=null!=x?x:E,N=!!x&&v.depth>=1&&v.depth-x.depth<=1,A=!!E;if((N||A)&&M){if(M.node.type===p)return k&&A?l().command(({tr:e,dispatch:t})=>{let n=function(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return eF.between(r,i)}(e);return!!n&&(e.setSelection(n),t&&t(e),!0)}).liftListItem(f).run():c.liftListItem(f);if(sR(M.node.type.name,u)&&p.validContent(M.node.content))return l().command(()=>(o.setNodeMarkup(M.pos,p),!0)).command(()=>sK(o,p)).command(()=>sq(o,p)).run()}return n&&w&&a?l().command(()=>{let e=d().wrapInList(p,r),t=w.filter(e=>h.includes(e.type.name));return o.ensureMarks(t),!!e||c.clearNodes()}).wrapInList(p,r).command(()=>sK(o,p)).command(()=>sq(o,p)).run():l().command(()=>!!d().wrapInList(p,r)||c.clearNodes()).wrapInList(p,r).command(()=>sK(o,p)).command(()=>sq(o,p)).run()},sG=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:o=!1}=n,s=oS(e,r.schema);return sA(r,s,t)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,t)},sX=(e,t,n={})=>({state:r,commands:i})=>{let o,s=ou(e,r.schema),a=ou(t,r.schema),l=oJ(r,s,n);return(r.selection.$anchor.sameParent(r.selection.$head)&&(o=r.selection.$anchor.parent.attrs),l)?i.setNode(a,o):i.setNode(s,{...o,...n})},sZ=(e,t={})=>({state:n,commands:r})=>{let i=ou(e,n.schema);return oJ(n,i,t)?r.lift(i):r.wrapIn(i,t)},sY=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i,o=n[r];if(o.spec.isInputRules&&(i=o.getState(e))){if(t){let t=e.tr,n=i.transform;for(let e=n.steps.length-1;e>=0;e-=1)t.step(n.steps[e].invert(n.docs[e]));if(i.text){let n=t.doc.resolve(i.from).marks();t.replaceWith(i.from,i.to,e.schema.text(i.text,n))}else t.delete(i.from,i.to)}return!0}}return!1},sQ=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,{empty:r,ranges:i}=n;return!!r||(t&&i.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0)},s0=(e,t={})=>({tr:n,state:r,dispatch:i})=>{var o;let{extendEmptyMarkRange:s=!1}=t,{selection:a}=n,l=oS(e,r.schema),{$from:c,empty:d,ranges:u}=a;if(!i)return!0;if(d&&s){let{from:e,to:t}=a,r=null==(o=c.marks().find(e=>e.type===l))?void 0:o.attrs,i=ok(c,l,r);i&&(e=i.from,t=i.to),n.removeMark(e,t,l)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,l)});return n.removeStoredMark(l),!0},s1=e=>({tr:t,state:n,dispatch:r})=>{let i,o,{selection:s}=n;return"number"==typeof e?(i=e,o=e):e&&"from"in e&&"to"in e?(i=e.from,o=e.to):(i=s.from,o=s.to),r&&t.doc.nodesBetween(i,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},s2=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,a=oQ("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(o=ou(e,r.schema)),"mark"===a&&(s=oS(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{let a,c,d,u,h=e.$from.pos,p=e.$to.pos;n.selection.empty?r.doc.nodesBetween(h,p,(e,t)=>{o&&o===e.type&&(l=!0,d=Math.max(t,h),u=Math.min(t+e.nodeSize,p),a=t,c=e)}):r.doc.nodesBetween(h,p,(e,r)=>{r<h&&o&&o===e.type&&(l=!0,d=Math.max(r,h),u=Math.min(r+e.nodeSize,p),a=r,c=e),r>=h&&r<=p&&(o&&o===e.type&&(l=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),s&&e.marks.length&&e.marks.forEach(o=>{if(s===o.type&&(l=!0,i)){let i=Math.max(r,h),a=Math.min(r+e.nodeSize,p);n.addMark(i,a,s.create({...o.attrs,...t}))}}))}),c&&(void 0!==a&&i&&n.setNodeMarkup(a,void 0,{...c.attrs,...t}),s&&c.marks.length&&c.marks.forEach(e=>{s===e.type&&i&&n.addMark(d,u,s.create({...e.attrs,...t}))}))}),l},s5=(e,t={})=>({state:n,dispatch:r})=>(function(e,t=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),a=s&&eg(s,e,t);return!!a&&(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0)}})(ou(e,n.schema),t)(n,r),s3=(e,t={})=>({state:n,dispatch:r})=>(function(e,t=null){return function(n,r){let{$from:o,$to:s}=n.selection,a=o.blockRange(s);if(!a)return!1;let l=r?n.tr:null;return!!function(e,t,n,r=null){let o=!1,s=t,a=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&0==t.startIndex){if(0==t.$from.index(t.depth-1))return!1;let e=a.resolve(t.start-2);s=new x(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new x(t.$from,a.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let l=eg(s,n,r,t);return!!l&&(e&&function(e,t,n,r,o){let s=i.empty;for(let e=n.length-1;e>=0;e--)s=i.from(n[e].type.create(n[e].attrs,s));e.step(new eh(t.start-2*!!r,t.end,t.start,t.end,new d(s,0,0),n.length,!0));let a=0;for(let e=0;e<n.length;e++)n[e].type==o&&(a=e+1);let l=n.length-a,c=t.start+n.length-2*!!r,u=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&ew(e.doc,c,l)&&(e.split(c,l),c+=2*l),c+=u.child(n).nodeSize}(e,t,l,o,n),!0)}(l,a,e,t)&&(r&&r(l.scrollIntoView()),!0)}})(ou(e,n.schema),t)(n,r),s4=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={}}},s6=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}};function s9(e){var t;let{editor:n,from:r,to:i,text:o,rules:s,plugin:a}=e,{view:l}=n;if(l.composing)return!1;let c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(null==(t=c.nodeBefore||c.nodeAfter)?void 0:t.marks.find(e=>e.type.spec.code)))return!1;let d=!1,u=((e,t=500)=>{let n="",r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,o)=>{var s,a;let l=(null==(a=(s=e.type.spec).toText)?void 0:a.call(s,{node:e,pos:t,parent:i,index:o}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?l:l.slice(0,Math.max(0,r-t))}),n})(c)+o;return s.forEach(e=>{if(d)return;let t=((e,t)=>{if(ob(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})(u,e.find);if(!t)return;let s=l.state.tr,c=oe({state:l.state,transaction:s}),h={from:r-(t[0].length-o.length),to:i},{commands:p,chain:f,can:m}=new ot({editor:n,state:c});null!==e.handler({state:c,range:h,match:t,commands:p,chain:f,can:m})&&s.steps.length&&(e.undoable&&s.setMeta(a,{transform:s,from:r,to:i,text:o}),l.dispatch(s),d=!0)}),d}function s7(e){return"Object"===Object.prototype.toString.call(e).slice(8,-1)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}var s8=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{...sc(so(this,"addOptions",{name:this.name}))}}get storage(){return{...sc(so(this,"addStorage",{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>(function e(t,n){let r={...t};return s7(t)&&s7(n)&&Object.keys(n).forEach(i=>{s7(n[i])&&s7(t[i])?r[i]=e(t[i],n[i]):r[i]=n[i]}),r})(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}},ae=class e extends s8{constructor(){super(...arguments),this.type="mark"}static create(t={}){return new e("function"==typeof t?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=>(null==e?void 0:e.type.name)===t.name))return!1;let o=i.find(e=>(null==e?void 0:e.type.name)===t.name);return o&&n.removeStoredMark(o),n.insertText(" ",r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},at=class{constructor(e){this.find=e.find,this.handler=e.handler}},an=null,ar=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=sv(e),this.schema=function(e,t){var n;let r=su(e),{nodeExtensions:i,markExtensions:o}=sd(e),s=null==(n=i.find(e=>so(e,"topNode")))?void 0:n.name;return new _({topNode:s,nodes:Object.fromEntries(i.map(n=>{let i=r.filter(e=>e.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:t},s=sg({...e.reduce((e,t)=>{let r=so(t,"extendNodeSchema",o);return{...e,...r?r(n):{}}},{}),content:sc(so(n,"content",o)),marks:sc(so(n,"marks",o)),group:sc(so(n,"group",o)),inline:sc(so(n,"inline",o)),atom:sc(so(n,"atom",o)),selectable:sc(so(n,"selectable",o)),draggable:sc(so(n,"draggable",o)),code:sc(so(n,"code",o)),whitespace:sc(so(n,"whitespace",o)),linebreakReplacement:sc(so(n,"linebreakReplacement",o)),defining:sc(so(n,"defining",o)),isolating:sc(so(n,"isolating",o)),attrs:Object.fromEntries(i.map(sy))}),a=sc(so(n,"parseHTML",o));a&&(s.parseDOM=a.map(e=>sm(e,i)));let l=so(n,"renderHTML",o);l&&(s.toDOM=e=>l({node:e,HTMLAttributes:sf(e,i)}));let c=so(n,"renderText",o);return c&&(s.toText=c),[n.name,s]})),marks:Object.fromEntries(o.map(n=>{let i=r.filter(e=>e.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:t},s=sg({...e.reduce((e,t)=>{let r=so(t,"extendMarkSchema",o);return{...e,...r?r(n):{}}},{}),inclusive:sc(so(n,"inclusive",o)),excludes:sc(so(n,"excludes",o)),group:sc(so(n,"group",o)),spanning:sc(so(n,"spanning",o)),code:sc(so(n,"code",o)),attrs:Object.fromEntries(i.map(sy))}),a=sc(so(n,"parseHTML",o));a&&(s.parseDOM=a.map(e=>sm(e,i)));let l=so(n,"renderHTML",o);return l&&(s.toDOM=e=>l({mark:e,HTMLAttributes:sf(e,i)})),[n.name,s]}))})}(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:sM(t.name,this.schema)},r=so(t,"addCommands",n);return r?{...e,...r()}:e},{})}get plugins(){let{editor:e}=this;return sb([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:sM(t.name,this.schema)},r=[],o=so(t,"addKeyboardShortcuts",n),s={};if("mark"===t.type&&so(t,"exitable",n)&&(s.ArrowRight=()=>ae.handleExit({editor:e,mark:t})),o){let t=Object.fromEntries(Object.entries(o()).map(([t,n])=>[t,()=>n({editor:e})]));s={...s,...t}}let a=rz(s);r.push(a);let l=so(t,"addInputRules",n);if(sT(t,e.options.enableInputRules)&&l){let t=l();if(t&&t.length){let n=function(e){let{editor:t,rules:n}=e,r=new e2({state:{init:()=>null,apply(e,o,s){let a=e.getMeta(r);if(a)return a;let l=e.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:e}=l;"string"==typeof e||(e=sa(i.from(e),s.schema));let{from:o}=l,a=o+e.length;s9({editor:t,from:o,to:a,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:o}},props:{handleTextInput:(e,i,o,s)=>s9({editor:t,from:i,to:o,text:s,rules:n,plugin:r}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&s9({editor:t,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if("Enter"!==i.key)return!1;let{$cursor:o}=e.state.selection;return!!o&&s9({editor:t,from:o.pos,to:o.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}({editor:e,rules:t}),o=Array.isArray(n)?n:[n];r.push(...o)}}let c=so(t,"addPasteRules",n);if(sT(t,e.options.enablePasteRules)&&c){let t=c();if(t&&t.length){let n=function(e){let t,{editor:n,rules:r}=e,o=null,s=!1,a=!1,l="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}let c=({state:e,from:r,to:i,rule:o,pasteEvt:s})=>{let a=e.tr;if(function(e){let{editor:t,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:a}=e,{commands:l,chain:c,can:d}=new ot({editor:t,state:n}),u=[];return n.doc.nodesBetween(r,i,(e,t)=>{var h,p,f,m,g;if((null==(p=null==(h=e.type)?void 0:h.spec)?void 0:p.code)||!(e.isText||e.isTextblock||e.isInline))return;let y=null!=(g=null!=(m=null==(f=e.content)?void 0:f.size)?m:e.nodeSize)?g:0,b=Math.max(r,t),v=Math.min(i,t+y);b>=v||((e,t,n)=>{if(ob(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}):[]})(e.isText?e.text||"":e.textBetween(b-t,v-t,void 0,""),o.find,s).forEach(e=>{if(void 0===e.index)return;let t=b+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},h=o.handler({state:n,range:i,match:e,commands:l,chain:c,can:d,pasteEvent:s,dropEvent:a});u.push(h)})}),u.every(e=>null!==e)}({editor:n,state:oe({state:e,transaction:a}),from:Math.max(r-1,0),to:i.b-1,rule:o,pasteEvent:s,dropEvent:t})&&a.steps.length){try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}return l="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null,a}};return r.map(e=>new e2({view(e){let t=t=>{var r;(o=(null==(r=e.dom.parentElement)?void 0:r.contains(t.target))?e.dom.parentElement:null)&&(an=n)},r=()=>{an&&(an=null)};return window.addEventListener("dragstart",t),window.addEventListener("dragend",r),{destroy(){window.removeEventListener("dragstart",t),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:(e,n)=>{if(a=o===e.dom.parentElement,t=n,!a){let e=an;(null==e?void 0:e.isEditable)&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{var n;let r=null==(n=t.clipboardData)?void 0:n.getData("text/html");return l=t,s=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{let o=t[0],d="paste"===o.getMeta("uiEvent")&&!s,u="drop"===o.getMeta("uiEvent")&&!a,h=o.getMeta("applyPasteRules"),p=!!h;if(!d&&!u&&!p)return;if(p){var f,m;let t,{text:n}=h;"string"==typeof n||(n=sa(i.from(n),r.schema));let{from:o}=h,s=o+n.length;return c({rule:e,state:r,from:o,to:{b:s},pasteEvt:(f=n,null==(m=(t=new ClipboardEvent("paste",{clipboardData:new DataTransfer})).clipboardData)||m.setData("text/html",f),t)})}let g=n.doc.content.findDiffStart(r.doc.content),y=n.doc.content.findDiffEnd(r.doc.content);if("number"==typeof g&&y&&g!==y.b)return c({rule:e,state:r,from:g,to:y,pasteEvt:l})}}))}({editor:e,rules:t});r.push(...n)}}let d=so(t,"addProseMirrorPlugins",n);if(d){let e=d();r.push(...e)}return r})}get attributes(){return su(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=sd(this.extensions);return Object.fromEntries(t.filter(e=>!!so(e,"addNodeView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:ou(t.name,this.schema)},i=so(t,"addNodeView",r);if(!i)return[];let o=i();return o?[t.name,(r,i,s,a,l)=>{let c=sf(r,n);return o({node:r,view:i,getPos:s,decorations:a,innerDecorations:l,editor:e,extension:t,HTMLAttributes:c})}]:[]}))}dispatchTransaction(e){let{editor:t}=this;return sb([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:sM(n.name,this.schema)},i=so(n,"dispatchTransaction",r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return sb([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:sM(n.name,this.schema)},i=so(n,"transformPastedHTML",r);return i?(t,n)=>{let o=e(t,n);return i.call(r,o)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=sd(this.extensions);return Object.fromEntries(t.filter(e=>!!so(e,"addMarkView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:oS(t.name,this.schema)},i=so(t,"addMarkView",r);return i?[t.name,(r,o,s)=>{let a=sf(r,n);return i()({mark:r,view:o,inline:s,editor:e,extension:t,HTMLAttributes:a,updateAttributes:t=>{aT(r,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=>{var t;let n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:sM(e.name,this.schema)};"mark"===e.type&&(null==(t=sc(so(e,"keepOnSplit",n)))||t)&&this.splittableMarks.push(e.name);let r=so(e,"onBeforeCreate",n),i=so(e,"onCreate",n),o=so(e,"onUpdate",n),s=so(e,"onSelectionUpdate",n),a=so(e,"onTransaction",n),l=so(e,"onFocus",n),c=so(e,"onBlur",n),d=so(e,"onDestroy",n);r&&this.editor.on("beforeCreate",r),i&&this.editor.on("create",i),o&&this.editor.on("update",o),s&&this.editor.on("selectionUpdate",s),a&&this.editor.on("transaction",a),l&&this.editor.on("focus",l),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)})}};ar.resolve=sv,ar.sort=sb,ar.flatten=ss,i8({},{ClipboardTextSerializer:()=>ao,Commands:()=>as,Delete:()=>aa,Drop:()=>al,Editable:()=>ac,FocusEvents:()=>au,Keymap:()=>ah,Paste:()=>ap,Tabindex:()=>af,TextDirection:()=>am,focusEventsPluginKey:()=>ad});var ai=class e extends s8{constructor(){super(...arguments),this.type="extension"}static create(t={}){return new e("function"==typeof t?t():t)}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},ao=ai.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new e2({key:new e4("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,{ranges:o}=i,s=Math.min(...o.map(e=>e.$from.pos)),a=Math.max(...o.map(e=>e.$to.pos)),l=sk(n);return sw(r,{from:s,to:a},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),as=ai.create({name:"commands",addCommands:()=>({...on})}),aa=ai.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r,i;let o=()=>{var n,r,i,o;if(null!=(o=null==(i=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.filterTransaction)?void 0:i.call(r,e))?o:e.getMeta("y-sync$"))return;let s=sn(e.before,[e,...t]);sC(s).forEach(t=>{s.mapping.mapResult(t.oldRange.from).deletedAfter&&s.mapping.mapResult(t.oldRange.to).deletedBefore&&s.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{let i=r+n.nodeSize-2,o=t.oldRange.from<=r&&i<=t.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:i,newFrom:s.mapping.map(r),newTo:s.mapping.map(i),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:s})})});let a=s.mapping;s.steps.forEach((t,n)=>{var r,i;if(t instanceof el){let o=a.slice(n).map(t.from,-1),l=a.slice(n).map(t.to),c=a.invert().map(o,-1),d=a.invert().map(l),u=o>0&&(null==(r=s.doc.nodeAt(o-1))?void 0:r.marks.some(e=>e.eq(t.mark))),h=null==(i=s.doc.nodeAt(l))?void 0:i.marks.some(e=>e.eq(t.mark));this.editor.emit("delete",{type:"mark",mark:t.mark,from:t.from,to:t.to,deletedRange:{from:c,to:d},newRange:{from:o,to:l},partial:!!(h||u),editor:this.editor,transaction:e,combinedTransform:s})}})};null==(i=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.async)||i?setTimeout(o,0):o()}}),al=ai.create({name:"drop",addProseMirrorPlugins(){return[new e2({key:new e4("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),ac=ai.create({name:"editable",addProseMirrorPlugins(){return[new e2({key:new e4("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ad=new e4("focusEvents"),au=ai.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:e}=this;return[new e2({key:ad,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}}}})]}}),ah=ai.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:o}=n,{pos:s,parent:a}=o,l=o.parent.isTextblock&&s>0?t.doc.resolve(s-1):o,c=l.parent.type.spec.isolating,d=o.pos-o.parentOffset,u=c&&1===l.parent.childCount?d===o.pos:e_.atStart(r).from===s;return!!i&&!!a.type.isTextblock&&!a.textContent.length&&!!u&&(!u||"paragraph"!==o.parent.type.name)&&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 oR()||oK()?i:r},addProseMirrorPlugins(){return[new e2({key:new e4("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:o,from:s,to:a}=t.selection,l=e_.atStart(t.doc).from,c=e_.atEnd(t.doc).to;if(o||s!==l||a!==c||!sO(n.doc))return;let d=n.tr,u=oe({state:n,transaction:d}),{commands:h}=new ot({editor:this.editor,state:u});if(h.clearNodes(),d.steps.length)return d}})]}}),ap=ai.create({name:"paste",addProseMirrorPlugins(){return[new e2({key:new e4("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),af=ai.create({name:"tabindex",addOptions:()=>({value:void 0}),addProseMirrorPlugins(){return[new e2({key:new e4("tabindex"),props:{attributes:()=>{var e;return this.editor.isEditable||void 0!==this.options.value?{tabindex:null!=(e=this.options.value)?e:"0"}:{}}}})]}}),am=ai.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=sd(this.extensions);return[{types:e.filter(e=>"text"!==e.name).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute("dir");return t&&("ltr"===t||"rtl"===t||"auto"===t)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new e2({key:new e4("textDirection"),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),ag=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(){var e;return null!=(e=this.actualDepth)?e: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(0===this.content.size)return void console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);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(0===this.depth)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,o=n.isAtom&&!n.isText,s=n.isInline,a=this.pos+r+ +!o;if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;let l=this.resolvedPos.doc.resolve(a);if(!i&&!s&&l.depth<=this.depth)return;let c=new e(l,this.editor,i,i||s?n:null);i&&(c.actualDepth=this.depth+1),t.push(c)}),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||0===this.children.length)return r;let i=Object.keys(t);return this.children.forEach(o=>{n&&r.length>0||(o.node.type.name===e&&i.every(e=>t[e]===o.node.attrs[e])&&r.push(o),n&&r.length>0||(r=r.concat(o.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)}},ay=`.ProseMirror {
6
- position: relative;
7
- }
8
-
9
- .ProseMirror {
10
- word-wrap: break-word;
11
- white-space: pre-wrap;
12
- white-space: break-spaces;
13
- -webkit-font-variant-ligatures: none;
14
- font-variant-ligatures: none;
15
- font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
16
- }
17
-
18
- .ProseMirror [contenteditable="false"] {
19
- white-space: normal;
20
- }
21
-
22
- .ProseMirror [contenteditable="false"] [contenteditable="true"] {
23
- white-space: pre-wrap;
24
- }
25
-
26
- .ProseMirror pre {
27
- white-space: pre-wrap;
28
- }
29
-
30
- img.ProseMirror-separator {
31
- display: inline !important;
32
- border: none !important;
33
- margin: 0 !important;
34
- width: 0 !important;
35
- height: 0 !important;
36
- }
37
-
38
- .ProseMirror-gapcursor {
39
- display: none;
40
- pointer-events: none;
41
- position: absolute;
42
- margin: 0;
43
- }
44
-
45
- .ProseMirror-gapcursor:after {
46
- content: "";
47
- display: block;
48
- position: absolute;
49
- top: -2px;
50
- width: 20px;
51
- border-top: 1px solid black;
52
- animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
53
- }
54
-
55
- @keyframes ProseMirror-cursor-blink {
56
- to {
57
- visibility: hidden;
58
- }
59
- }
60
-
61
- .ProseMirror-hideselection *::selection {
62
- background: transparent;
63
- }
64
-
65
- .ProseMirror-hideselection *::-moz-selection {
66
- background: transparent;
67
- }
68
-
69
- .ProseMirror-hideselection * {
70
- caret-color: transparent;
71
- }
72
-
73
- .ProseMirror-focused .ProseMirror-gapcursor {
74
- display: block;
75
- }`,ab=class extends s4{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:"u">typeof document?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:sI,createMappablePosition:sP},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);const t=this.createDoc(),n=oA(t,this.options.autofocus);this.editorState=e1.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if("u"<typeof document)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||(!1!==this.options.autofocus&&null!==this.options.autofocus&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){let e=this.editorView.dom;(null==e?void 0:e.editor)&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{"function"==typeof this.css.remove?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&&"u">typeof document&&(this.css=function(e,t){let n=document.querySelector("style[data-tiptap-style]");if(null!==n)return n;let r=document.createElement("style");return t&&r.setAttribute("nonce",t),r.setAttribute("data-tiptap-style",""),r.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(r),r}(ay,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("state"===t)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=sl(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="string"==typeof e?`${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(){var e,t,n,r;let i=[...this.options.enableCoreExtensions?[ac,ao.configure({blockSeparator:null==(t=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:t.blockSeparator}),as,au,ah,af.configure({value:null==(r=null==(n=this.options.coreExtensionOptions)?void 0:n.tabindex)?void 0:r.value}),al,ap,aa,am.configure({direction:this.options.textDirection})].filter(e=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[e.name]):[],...this.options.extensions].filter(e=>["extension","node","mark"].includes(null==e?void 0:e.type));this.extensionManager=new ar(i,this)}createCommandManager(){this.commandManager=new ot({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=o8(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&&"object"==typeof this.storage.collaboration&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>"collaboration"!==e.name),this.createExtensionManager()}}),e=o8(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,o=t.transformPastedHTML,s=this.extensionManager.transformPastedHTML(o);this.editorView=new rk(e,{...t,attributes:{role:"textbox",...null==t?void 0:t.attributes},dispatchTransaction:i,transformPastedHTML:s,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS(),this.view.dom.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=>{var t;return null==(t=this.capturedTransaction)?void 0:t.step(e)});return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),o=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 s=n.findLast(e=>e.getMeta("focus")||e.getMeta("blur")),a=null==s?void 0:s.getMeta("focus"),l=null==s?void 0:s.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:s}),l&&this.emit("blur",{editor:this,event:l.event,transaction:s}),e.getMeta("preventUpdate")||!n.some(e=>e.docChanged)||o.doc.eq(t.doc)||this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return sS(this.state,e)}isActive(e,t){let n="string"==typeof e?e:null,r="string"==typeof e?t:e;return function(e,t,n={}){if(!t)return oJ(e,null,n)||sA(e,null,n);let r=oQ(t,e.schema);return"node"===r?oJ(e,t,n):"mark"===r&&sA(e,t,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return sa(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t="\n\n",textSerializers:n={}}=e||{};return sx(this.state.doc,{blockSeparator:t,textSerializers:{...sk(this.schema),...n}})}get isEmpty(){return sO(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(){var e,t;return null==(t=null==(e=this.editorView)?void 0:e.isDestroyed)||t}$node(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return(null==(n=this.$doc)?void 0:n.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 ag(t,this,!1,n)}get $doc(){return this.$pos(0)}},av=class{constructor(e){var t,n,r,i,o,s;this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.clientX-this.startX,n=e.clientY-this.startY;this.handleResize(t,n)},this.handleTouchMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.touches[0];if(!t)return;let n=t.clientX-this.startX,r=t.clientY-this.startY;this.handleResize(n,r)},this.handleMouseUp=()=>{if(!this.isResizing)return;let e=this.element.offsetWidth,t=this.element.offsetHeight;this.onCommit(e,t),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=e=>{"Shift"===e.key&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=e=>{"Shift"===e.key&&(this.isShiftKeyPressed=!1)},this.node=e.node,this.editor=e.editor,this.element=e.element,this.contentElement=e.contentElement,this.getPos=e.getPos,this.onResize=e.onResize,this.onCommit=e.onCommit,this.onUpdate=e.onUpdate,(null==(t=e.options)?void 0:t.min)&&(this.minSize={...this.minSize,...e.options.min}),(null==(n=e.options)?void 0:n.max)&&(this.maxSize=e.options.max),(null==(r=null==e?void 0:e.options)?void 0:r.directions)&&(this.directions=e.options.directions),(null==(i=e.options)?void 0:i.preserveAspectRatio)&&(this.preserveAspectRatio=e.options.preserveAspectRatio),(null==(o=e.options)?void 0:o.className)&&(this.classNames={container:e.options.className.container||"",wrapper:e.options.className.wrapper||"",handle:e.options.className.handle||"",resizing:e.options.className.resizing||""}),(null==(s=e.options)?void 0:s.createCustomHandle)&&(this.createCustomHandle=e.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var e;return null!=(e=this.contentElement)?e:null}handleEditorUpdate(){let e=this.editor.isEditable;e!==this.lastEditableState&&(this.lastEditableState=e,e?e&&0===this.handleMap.size&&this.attachHandles():this.removeHandles())}update(e,t,n){return e.type===this.node.type&&(this.node=e,!this.onUpdate||this.onUpdate(e,t,n))}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){let e=document.createElement("div");return e.dataset.resizeContainer="",e.dataset.node=this.node.type.name,e.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(e.className=this.classNames.container),e.appendChild(this.wrapper),e}createWrapper(){let e=document.createElement("div");return e.style.position="relative",e.style.display="block",e.dataset.resizeWrapper="",this.classNames.wrapper&&(e.className=this.classNames.wrapper),e.appendChild(this.element),e}createHandle(e){let t=document.createElement("div");return t.dataset.resizeHandle=e,t.style.position="absolute",this.classNames.handle&&(t.className=this.classNames.handle),t}positionHandle(e,t){let n=t.includes("top"),r=t.includes("bottom"),i=t.includes("left"),o=t.includes("right");n&&(e.style.top="0"),r&&(e.style.bottom="0"),i&&(e.style.left="0"),o&&(e.style.right="0"),("top"===t||"bottom"===t)&&(e.style.left="0",e.style.right="0"),("left"===t||"right"===t)&&(e.style.top="0",e.style.bottom="0")}attachHandles(){this.directions.forEach(e=>{let t;(t=this.createCustomHandle?this.createCustomHandle(e):this.createHandle(e))instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${e}") did not return an HTMLElement. Falling back to default handle.`),t=this.createHandle(e)),this.createCustomHandle||this.positionHandle(t,e),t.addEventListener("mousedown",t=>this.handleResizeStart(t,e)),t.addEventListener("touchstart",t=>this.handleResizeStart(t,e)),this.handleMap.set(e,t),this.wrapper.appendChild(t)})}removeHandles(){this.handleMap.forEach(e=>e.remove()),this.handleMap.clear()}applyInitialSize(){let e=this.node.attrs.width,t=this.node.attrs.height;e?(this.element.style.width=`${e}px`,this.initialWidth=e):this.initialWidth=this.element.offsetWidth,t?(this.element.style.height=`${t}px`,this.initialHeight=t):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(e,t){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.activeHandle=t,"touches"in e?(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY):(this.startX=e.clientX,this.startY=e.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(e,t){if(!this.activeHandle)return;let n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,e,t),o=this.applyConstraints(r,i,n);this.element.style.width=`${o.width}px`,this.element.style.height=`${o.height}px`,this.onResize&&this.onResize(o.width,o.height)}calculateNewDimensions(e,t,n){let r=this.startWidth,i=this.startHeight,o=e.includes("right"),s=e.includes("left"),a=e.includes("bottom"),l=e.includes("top");return(o?r=this.startWidth+t:s&&(r=this.startWidth-t),a?i=this.startHeight+n:l&&(i=this.startHeight-n),("right"===e||"left"===e)&&(r=this.startWidth+(o?t:-t)),("top"===e||"bottom"===e)&&(i=this.startHeight+(a?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed)?this.applyAspectRatio(r,i,e):{width:r,height:i}}applyConstraints(e,t,n){var r,i,o,s;if(!n){let n=Math.max(this.minSize.width,e),o=Math.max(this.minSize.height,t);return(null==(r=this.maxSize)?void 0:r.width)&&(n=Math.min(this.maxSize.width,n)),(null==(i=this.maxSize)?void 0:i.height)&&(o=Math.min(this.maxSize.height,o)),{width:n,height:o}}let a=e,l=t;return a<this.minSize.width&&(l=(a=this.minSize.width)/this.aspectRatio),l<this.minSize.height&&(a=(l=this.minSize.height)*this.aspectRatio),(null==(o=this.maxSize)?void 0:o.width)&&a>this.maxSize.width&&(l=(a=this.maxSize.width)/this.aspectRatio),(null==(s=this.maxSize)?void 0:s.height)&&l>this.maxSize.height&&(a=(l=this.maxSize.height)*this.aspectRatio),{width:a,height:l}}applyAspectRatio(e,t,n){return"left"===n||"right"===n?{width:e,height:e/this.aspectRatio}:"top"===n||"bottom"===n?{width:t*this.aspectRatio,height:t}:{width:e,height:e/this.aspectRatio}}};function aw(e){if(!(null==e?void 0:e.trim()))return{};let t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);i&&(t.class=i.map(e=>e.trim().slice(1)).join(" "));let o=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);o&&(t.id=o[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{var i;let o=n[parseInt((null==(i=r.match(/__QUOTED_(\d+)__/))?void 0:i[1])||"0",10)];o&&(t[e]=o.slice(1,-1))});let s=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return s&&s.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function ax(e){if(!e||0===Object.keys(e).length)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])=>{"class"!==e&&"id"!==e&&(!0===n?t.push(e):!1!==n&&null!=n&&t.push(`${e}="${String(n)}"`))}),t.join(" ")}function ak(e){let{nodeName:t,name:n,parseAttributes:r=aw,serializeAttributes:i=ax,defaultAttributes:o={},requiredAttributes:s=[],allowedAttributes:a}=e,l=n||t;return{parseMarkdown:(e,n)=>{let r={...o,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:"block",start(e){var t;let n=RegExp(`^:::${l}(?:\\s|$)`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,i){let o=RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),a=e.match(o);if(!a)return;let c=r(a[1]||"");if(!s.find(e=>!(e in c)))return{type:t,raw:a[0],attributes:c}}},renderMarkdown:e=>{let t=i((e=>{if(!a)return e;let t={};return a.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{})),n=t?` {${t}}`:"";return`:::${l}${n} :::`}}}function aS(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=aw,serializeAttributes:o=ax,defaultAttributes:s={},content:a="block",allowedAttributes:l}=e,c=n||t;return{parseMarkdown:(e,n)=>{let i;if(r){let t=r(e);i="string"==typeof t?[{type:"text",text:t}]:t}else i="block"===a?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);let o={...s,...e.attributes};return n.createNode(t,o,i)},markdownTokenizer:{name:t,level:"block",start(e){var t;let n=RegExp(`^:::${c}`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,r){var o;let s=RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),l=e.match(s);if(!l)return;let[d,u=""]=l,h=i(u),p=1,f=d.length,m="",g=/^:::([\w-]*)(\s.*)?/gm,y=e.slice(f);for(g.lastIndex=0;;){let n=g.exec(y);if(null===n)break;let i=n.index,s=n[1];if(null==(o=n[2])||!o.endsWith(":::")){if(s)p+=1;else if(0==(p-=1)){let o=y.slice(0,i);m=o.trim();let s=e.slice(0,f+i+n[0].length),l=[];if(m)if("block"===a)for((l=r.blockTokens(o)).forEach(e=>{e.text&&(!e.tokens||0===e.tokens.length)&&(e.tokens=r.inlineTokens(e.text))});l.length>0;){let e=l[l.length-1];if("paragraph"!==e.type||e.text&&""!==e.text.trim())break;l.pop()}else l=r.inlineTokens(m);return{type:t,raw:s,attributes:h,content:m,tokens:l}}}}}},renderMarkdown:(e,t)=>{let n=o((e=>{if(!l)return e;let t={};return l.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{})),r=n?` {${n}}`:"",i=t.renderChildren(e.content||[],"\n\n");return`:::${c}${r}
76
-
77
- ${i}
78
-
79
- :::`}}}function aC(e){if(!e.trim())return{};let t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;null!==r;){let[,i,o,s]=r;t[i]=o||s,r=n.exec(e)}return t}function aE(e){return Object.entries(e).filter(([,e])=>null!=e).map(([e,t])=>`${e}="${t}"`).join(" ")}function aM(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=aC,serializeAttributes:o=aE,defaultAttributes:s={},selfClosing:a=!1,allowedAttributes:l}=e,c=n||t,d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(e,n)=>{let i={...s,...e.attributes};if(a)return n.createNode(t,i);let o=r?r(e):e.content||"";return o?n.createNode(t,i,[n.createTextNode(o)]):n.createNode(t,i,[])},markdownTokenizer:{name:t,level:"inline",start(e){let t=a?RegExp(`\\[${d}\\s*[^\\]]*\\]`):RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),n=e.match(t),r=null==n?void 0:n.index;return void 0!==r?r:-1},tokenize(e,n,r){let o=a?RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),s=e.match(o);if(!s)return;let l="",c="";if(a){let[,e]=s;c=e}else{let[,e,t]=s;c=e,l=t||""}let u=i(c.trim());return{type:t,raw:s[0],content:l.trim(),attributes:u}}},renderMarkdown:e=>{let t="";r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>"text"===e.type).map(e=>e.text).join(""));let n=o((e=>{if(!l)return e;let t={};return l.forEach(n=>{let r="string"==typeof n?n:n.name,i="string"==typeof n?void 0:n.skipIfDefault;if(r in e){let n=e[r];if(void 0!==i&&n===i)return;t[r]=n}}),t})(e.attrs||{})),i=n?` ${n}`:"";return a?`[${c}${i}]`:`[${c}${i}]${t}[/${c}]`}}}function aN(e,t,n){var r,i,o,s;let a=e.split("\n"),l=[],c="",d=0,u=t.baseIndentSize||2;for(;d<a.length;){let e,h=a[d],p=h.match(t.itemPattern);if(!p)if(l.length>0)break;else{if(""!==h.trim())return;d+=1,c=`${c}${h}
80
- `;continue}let f=t.extractItemData(p),{indentLevel:m,mainContent:g}=f;c=`${c}${h}
81
- `;let y=[g];for(d+=1;d<a.length;){let e=a[d];if(""===e.trim()){let t=a.slice(d+1).findIndex(e=>""!==e.trim());if(-1===t)break;if(((null==(i=null==(r=a[d+1+t].match(/^(\s*)/))?void 0:r[1])?void 0:i.length)||0)>m){y.push(e),c=`${c}${e}
82
- `,d+=1;continue}break}if(((null==(s=null==(o=e.match(/^(\s*)/))?void 0:o[1])?void 0:s.length)||0)>m)y.push(e),c=`${c}${e}
83
- `,d+=1;else break}let b=y.slice(1);if(b.length>0){let r=b.map(e=>e.slice(m+u)).join("\n");r.trim()&&(e=t.customNestedParser?t.customNestedParser(r):n.blockTokens(r))}let v=t.createToken(f,e);l.push(v)}if(0!==l.length)return{items:l,raw:c}}function aA(e,t,n,r){if(!e||!Array.isArray(e.content))return"";let i="function"==typeof n?n(r):n,[o,...s]=e.content,a=t.renderChildren([o]),l=`${i}${a}`;return s&&s.length>0&&s.forEach((e,n)=>{var r,i;let o=null!=(i=null==(r=t.renderChild)?void 0:r.call(t,e,n+1))?i:t.renderChildren([e]);if(null!=o){let n=o.split("\n").map(e=>e?t.indent(e):t.indent("")).join("\n");l+="paragraph"===e.type?`
84
-
85
- ${n}`:`
86
- ${n}`}}),l}function aT(e,t,n={}){let{state:r}=t,{doc:i,tr:o}=r;i.descendants((t,r)=>{let i=o.mapping.map(r),s=o.mapping.map(r)+t.nodeSize,a=null;if(t.marks.forEach(t=>{if(t!==e)return!1;a=t}),!a)return;let l=!1;if(Object.keys(n).forEach(e=>{n[e]!==a.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});o.removeMark(i,s,e.type),o.addMark(i,s,t)}}),o.docChanged&&t.view.dispatch(o)}i8({},{createAtomBlockMarkdownSpec:()=>ak,createBlockMarkdownSpec:()=>aS,createInlineMarkdownSpec:()=>aM,parseAttributes:()=>aw,parseIndentedBlocks:()=>aN,renderNestedMarkdownContent:()=>aA,serializeAttributes:()=>ax});var aR=class{constructor(e,t,n){this.component=e,this.editor=t.editor,this.options={...n},this.mark=t.mark,this.HTMLAttributes=t.HTMLAttributes}get dom(){return this.editor.view.dom}get contentDOM(){return null}updateAttributes(e,t){aT(t||this.mark,this.editor,e)}ignoreMutation(e){return!this.dom||!this.contentDOM||("function"==typeof this.options.ignoreMutation?this.options.ignoreMutation({mutation:e}):!("selection"===e.type||this.dom.contains(e.target)&&"childList"===e.type&&(oR()||oT())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable))&&(this.contentDOM===e.target&&"attributes"===e.type||!this.contentDOM.contains(e.target)))}},aO=class e extends s8{constructor(){super(...arguments),this.type="node"}static create(t={}){return new e("function"==typeof t?t():t)}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},aD=class{constructor(e,t,n){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=t.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t,n,r,i,o,s,a;let{view:l}=this.editor,c=e.target,d=3===c.nodeType?null==(t=c.parentElement)?void 0:t.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(null==(n=this.contentDOM)?void 0:n.contains(c))||!d)return;let u=0,h=0;if(this.dom!==d){let t=this.dom.getBoundingClientRect(),n=d.getBoundingClientRect(),a=null!=(i=e.offsetX)?i:null==(r=e.nativeEvent)?void 0:r.offsetX,l=null!=(s=e.offsetY)?s:null==(o=e.nativeEvent)?void 0:o.offsetY;u=n.x-t.x+a,h=n.y-t.y+l}let p=this.dom.cloneNode(!0);try{let e=this.dom.getBoundingClientRect();p.style.width=`${Math.round(e.width)}px`,p.style.height=`${Math.round(e.height)}px`,p.style.boxSizing="border-box",p.style.pointerEvents="none"}catch{}let f=null;try{(f=document.createElement("div")).style.position="absolute",f.style.top="-9999px",f.style.left="-9999px",f.style.pointerEvents="none",f.appendChild(p),document.body.appendChild(f),null==(a=e.dataTransfer)||a.setDragImage(p,u,h)}finally{f&&setTimeout(()=>{try{null==f||f.remove()}catch{}},0)}let m=this.getPos();if("number"!=typeof m)return;let g=eU.create(l.state.doc,m),y=l.state.tr.setSelection(g);l.dispatch(y)}stopEvent(e){var t;if(!this.dom)return!1;if("function"==typeof this.options.stopEvent)return this.options.stopEvent({event:e});let n=e.target;if(!(this.dom.contains(n)&&!(null==(t=this.contentDOM)?void 0:t.contains(n))))return!1;let r=e.type.startsWith("drag"),i="dragover"===e.type||"dragenter"===e.type,o="drop"===e.type;if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!o&&!r)return!0;let{isEditable:s}=this.editor,{isDragging:a}=this,l=!!this.node.type.spec.draggable,c=eU.isSelectable(this.node),d="copy"===e.type,u="paste"===e.type,h="cut"===e.type,p="mousedown"===e.type;if(!l&&c&&r&&e.target===this.dom&&e.preventDefault(),l&&r&&!a&&e.target===this.dom)return e.preventDefault(),!1;if(l&&s&&!a&&p){let e=n.closest("[data-drag-handle]");e&&(this.dom===e||this.dom.contains(e))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!a&&!i&&!o&&!d&&!u&&!h&&(!p||!c)&&!0}ignoreMutation(e){return!this.dom||!this.contentDOM||("function"==typeof this.options.ignoreMutation?this.options.ignoreMutation({mutation:e}):!!this.node.isLeaf||!!this.node.isAtom||!("selection"===e.type||this.dom.contains(e.target)&&"childList"===e.type&&(oR()||oT())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable))&&(this.contentDOM===e.target&&"attributes"===e.type||!this.contentDOM.contains(e.target)))}updateAttributes(e){this.editor.commands.command(({tr:t})=>{let n=this.getPos();return"number"==typeof n&&(t.setNodeMarkup(n,void 0,{...this.node.attrs,...e}),!0)})}deleteNode(){let e=this.getPos();if("number"!=typeof e)return;let t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};e.s(["Editor",0,ab,"Extension",0,ai,"InputRule",0,s6,"Mark",0,ae,"MarkView",0,aR,"Node",0,aO,"NodeView",0,aD,"ResizableNodeView",0,av,"callOrReturn",0,sc,"canInsertNode",0,function(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof eU){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-=1}return!1},"combineTransactionSteps",0,sn,"findChildren",0,function(e,t){let n=[];return e.descendants((e,r)=>{t(e)&&n.push({node:e,pos:r})}),n},"findChildrenInRange",0,function(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r},"findParentNodeClosestToPos",0,sr,"getAttributes",0,sS,"getChangedRanges",0,sC,"getExtensionField",0,so,"getMarksBetween",0,sE,"getNodeAtPosition",0,(e,t,n,r=20)=>{let i=e.doc.resolve(n),o=r,s=null;for(;o>0&&null===s;){let e=i.node(o);(null==e?void 0:e.type.name)===t?s=e:o-=1}return[s,o]},"getNodeType",0,ou,"getRenderedAttributes",0,sf,"getText",0,sx,"getTextSerializersFromSchema",0,sk,"isAtEndOfNode",0,(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=si(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},"isAtStartOfNode",0,e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0)&&t.pos===n.pos},"isNodeActive",0,oJ,"isNodeEmpty",0,sO,"isNodeSelection",0,function(e){return e instanceof eU},"isNodeViewSelected",0,sD,"isTextSelection",0,oM,"markInputRule",0,function(e){return new s6({find:e.find,handler:({state:t,range:n,match:r})=>{let i=sc(e.getAttributes,void 0,r);if(!1===i||null===i)return null;let{tr:o}=t,s=r[r.length-1],a=r[0];if(s){let r=a.search(/\S/),l=n.from+a.indexOf(s),c=l+s.length;if(sE(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>l).length)return null;c<n.to&&o.delete(c,n.to),l>n.from&&o.delete(n.from+r,l);let d=n.from+r+s.length;o.addMark(n.from+r,d,e.type.create(i||{})),o.removeStoredMark(e.type)}},undoable:e.undoable})},"markPasteRule",0,function(e){return new at({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let o=sc(e.getAttributes,void 0,r,i);if(!1===o||null===o)return null;let{tr:s}=t,a=r[r.length-1],l=r[0],c=n.to;if(a){let i=l.search(/\S/),d=n.from+l.indexOf(a),u=d+a.length;if(sE(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>d).length)return null;u<n.to&&s.delete(u,n.to),d>n.from&&s.delete(n.from+i,d),c=n.from+i+a.length,s.addMark(n.from+i,c,e.type.create(o||{})),void 0!==r.index&&void 0!==r.input&&r.index+r[0].length>=r.input.length||s.removeStoredMark(e.type)}}})},"mergeAttributes",0,sp,"nodeInputRule",0,function(e){return new s6({find:e.find,handler:({state:t,range:n,match:r})=>{let i=sc(e.getAttributes,void 0,r)||{},{tr:o}=t,s=n.from,a=n.to,l=e.type.create(i);if(r[1]){let e=s+r[0].lastIndexOf(r[1]);e>a?e=a:a=e+r[1].length;let t=r[0][r[0].length-1];o.insertText(t,s+r[0].length-1),o.replaceWith(e,a,l)}else if(r[0]){let t=e.type.isInline?s:s-1;o.insert(t,e.type.create(i)).delete(o.mapping.map(s),o.mapping.map(a))}o.scrollIntoView()},undoable:e.undoable})},"parseIndentedBlocks",0,aN,"posToDOMRect",0,function(e,t,n){let r=e.state.doc.content.size,i=oN(t,0,r),o=oN(n,0,r),s=e.coordsAtPos(i),a=e.coordsAtPos(o,-1),l=Math.min(s.top,a.top),c=Math.max(s.bottom,a.bottom),d=Math.min(s.left,a.left),u=Math.max(s.right,a.right),h={top:l,bottom:c,left:d,right:u,width:u-d,height:c-l,x:d,y:l};return{...h,toJSON:()=>h}},"renderNestedMarkdownContent",0,aA,"textblockTypeInputRule",0,function(e){return new s6({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),o=sc(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,o)},undoable:e.undoable})},"wrappingInputRule",0,function(e){return new s6({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let o=sc(e.getAttributes,void 0,r)||{},s=t.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&eg(a,e.type,o);if(!l)return null;if(s.wrap(a,l),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,o=r||n.$to.parentOffset&&n.$from.marks();if(o){let e=o.filter(e=>i.includes(e.type.name));s.ensureMarks(e)}}if(e.keepAttributes){let t="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";i().updateAttributes(t,o).run()}let c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===e.type&&ex(s.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,c))&&s.join(n.from-1)},undoable:e.undoable})}],343603);let{getOwnPropertyNames:aj,getOwnPropertySymbols:aI}=Object,{hasOwnProperty:aP}=Object.prototype;function aL(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function az(e){return function(t,n,r){if(!t||!n||"object"!=typeof t||"object"!=typeof n)return e(t,n,r);let{cache:i}=r,o=i.get(t),s=i.get(n);if(o&&s)return o===n&&s===t;i.set(t,n),i.set(n,t);let a=e(t,n,r);return i.delete(t),i.delete(n),a}}function a_(e){return aj(e).concat(aI(e))}let a$=Object.hasOwn||((e,t)=>aP.call(e,t));function aH(e,t){return e===t||!e&&!t&&e!=e&&t!=t}let{getOwnPropertyDescriptor:aB,keys:aF}=Object;function aV(e,t){return e.byteLength===t.byteLength&&a1(new Uint8Array(e),new Uint8Array(t))}function aU(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function aW(e,t){return e.byteLength===t.byteLength&&a1(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function aK(e,t){return aH(e.getTime(),t.getTime())}function aq(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function aJ(e,t){return e===t}function aG(e,t,n){let r,i,o=e.size;if(o!==t.size)return!1;if(!o)return!0;let s=Array(o),a=e.entries(),l=0;for(;(r=a.next())&&!r.done;){let o=t.entries(),a=!1,c=0;for(;(i=o.next())&&!i.done;){if(s[c]){c++;continue}let o=r.value,d=i.value;if(n.equals(o[0],d[0],l,c,e,t,n)&&n.equals(o[1],d[1],o[0],d[0],e,t,n)){a=s[c]=!0;break}c++}if(!a)return!1;l++}return!0}function aX(e,t,n){let r=aF(e),i=r.length;if(aF(t).length!==i)return!1;for(;i-- >0;)if(!a5(e,t,n,r[i]))return!1;return!0}function aZ(e,t,n){let r,i,o,s=a_(e),a=s.length;if(a_(t).length!==a)return!1;for(;a-- >0;)if(!a5(e,t,n,r=s[a])||(i=aB(e,r),o=aB(t,r),(i||o)&&(!i||!o||i.configurable!==o.configurable||i.enumerable!==o.enumerable||i.writable!==o.writable)))return!1;return!0}function aY(e,t){return aH(e.valueOf(),t.valueOf())}function aQ(e,t){return e.source===t.source&&e.flags===t.flags}function a0(e,t,n){let r,i,o=e.size;if(o!==t.size)return!1;if(!o)return!0;let s=Array(o),a=e.values();for(;(r=a.next())&&!r.done;){let o=t.values(),a=!1,l=0;for(;(i=o.next())&&!i.done;){if(!s[l]&&n.equals(r.value,i.value,r.value,i.value,e,t,n)){a=s[l]=!0;break}l++}if(!a)return!1}return!0}function a1(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function a2(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function a5(e,t,n,r){return("_owner"===r||"__o"===r||"__v"===r)&&(!!e.$$typeof||!!t.$$typeof)||a$(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}let a3={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},a4=Object.prototype.toString,a6=a9();function a9(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,o=function({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:o,areMapsEqual:s,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:c,areRegExpsEqual:d,areSetsEqual:u,areTypedArraysEqual:h,areUrlsEqual:p,unknownTagComparators:f}){return function(m,g,y){if(m===g)return!0;if(null==m||null==g)return!1;let b=typeof m;if(b!==typeof g)return!1;if("object"!==b)return"number"===b?a(m,g,y):"function"===b&&o(m,g,y);let v=m.constructor;if(v!==g.constructor)return!1;if(v===Object)return l(m,g,y);if(Array.isArray(m))return t(m,g,y);if(v===Date)return r(m,g,y);if(v===RegExp)return d(m,g,y);if(v===Map)return s(m,g,y);if(v===Set)return u(m,g,y);let w=a4.call(m);if("[object Date]"===w)return r(m,g,y);if("[object RegExp]"===w)return d(m,g,y);if("[object Map]"===w)return s(m,g,y);if("[object Set]"===w)return u(m,g,y);if("[object Object]"===w)return"function"!=typeof m.then&&"function"!=typeof g.then&&l(m,g,y);if("[object URL]"===w)return p(m,g,y);if("[object Error]"===w)return i(m,g,y);if("[object Arguments]"===w)return l(m,g,y);if(a3[w])return h(m,g,y);if("[object ArrayBuffer]"===w)return e(m,g,y);if("[object DataView]"===w)return n(m,g,y);if("[object Boolean]"===w||"[object Number]"===w||"[object String]"===w)return c(m,g,y);if(f){let e=f[w];if(!e){let t=null!=m?m[Symbol.toStringTag]:void 0;t&&(e=f[t])}if(e)return e(m,g,y)}return!1}}(function({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:aV,areArraysEqual:n?aZ:aU,areDataViewsEqual:aW,areDatesEqual:aK,areErrorsEqual:aq,areFunctionsEqual:aJ,areMapsEqual:n?aL(aG,aZ):aG,areNumbersEqual:aH,areObjectsEqual:n?aZ:aX,arePrimitiveWrappersEqual:aY,areRegExpsEqual:aQ,areSetsEqual:n?aL(a0,aZ):a0,areTypedArraysEqual:n?aL(a1,aZ):a1,areUrlsEqual:a2,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=az(r.areArraysEqual),t=az(r.areMapsEqual),n=az(r.areObjectsEqual),i=az(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}(e)),s=n?n(o):function(e,t,n,r,i,s,a){return o(e,t,a)};return function({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(o,s){let{cache:a=e?new WeakMap:void 0,meta:l}=n();return t(o,s,{cache:a,equals:r,meta:l,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let o={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,o)}}({circular:t,comparator:o,createState:r,equals:s,strict:i})}a9({strict:!0}),a9({circular:!0}),a9({circular:!0,strict:!0}),a9({createInternalComparator:()=>aH}),a9({strict:!0,createInternalComparator:()=>aH}),a9({circular:!0,createInternalComparator:()=>aH}),a9({circular:!0,createInternalComparator:()=>aH,strict:!0});var a7=e.i(383835),a8=({contentComponent:e})=>{let t=(0,iI.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,iP.jsx)(iP.Fragment,{children:Object.values(t)})},le=class extends iD.default.Component{constructor(e){super(e),this.editorContentRef=iD.default.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;let t=this.props.editor;if(t&&!t.isDestroyed&&(null==(e=t.view.dom)?void 0:e.parentNode)){let e,n;if(t.contentComponent)return;let r=this.editorContentRef.current;r.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:r}),e=new Set,n={},t.contentComponent={subscribe:t=>(e.add(t),()=>{e.delete(t)}),getSnapshot:()=>n,getServerSnapshot:()=>n,setRenderer(t,r){n={...n,[t]:ij.default.createPortal(r.reactElement,r.element,t)},e.forEach(e=>e())},removeRenderer(t){let r={...n};delete r[t],n=r,e.forEach(e=>e())}},t.createNodeViews(),t.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var e;let t=this.props.editor;if(t){t.isEditorContentInitialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),t.contentComponent=null;try{if(!(null==(e=t.view.dom)?void 0:e.parentNode))return;let n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,iP.jsxs)(iP.Fragment,{children:[(0,iP.jsx)("div",{ref:((...e)=>t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})})(t,this.editorContentRef),...n}),(null==e?void 0:e.contentComponent)&&(0,iP.jsx)(a8,{contentComponent:e.contentComponent})]})}},lt=(0,iD.forwardRef)((e,t)=>{let n=iD.default.useMemo(()=>Math.floor(0xffffffff*Math.random()).toString(),[e.editor]);return iD.default.createElement(le,{key:n,innerRef:t,...e})}),ln=iD.default.memo(lt),lr="u">typeof window?iD.useLayoutEffect:iD.useEffect,li=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber||(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber}),this.lastSnapshot}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}},lo="u"<typeof window,ls=lo||!!("u">typeof window&&window.next),la=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){let e=this.options.current.immediatelyRender,t=null==e||e;return lo?t=!1:ls&&void 0===e&&(t=!1),t?this.createEditor():null}createEditor(){return new ab({...this.options.current,onBeforeCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBeforeCreate)?void 0:n.call(t,...e)},onBlur:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBlur)?void 0:n.call(t,...e)},onCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onCreate)?void 0:n.call(t,...e)},onDestroy:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDestroy)?void 0:n.call(t,...e)},onFocus:(...e)=>{var t,n;return null==(n=(t=this.options.current).onFocus)?void 0:n.call(t,...e)},onSelectionUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onSelectionUpdate)?void 0:n.call(t,...e)},onTransaction:(...e)=>{var t,n;return null==(n=(t=this.options.current).onTransaction)?void 0:n.call(t,...e)},onUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onUpdate)?void 0:n.call(t,...e)},onContentError:(...e)=>{var t,n;return null==(n=(t=this.options.current).onContentError)?void 0:n.call(t,...e)},onDrop:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDrop)?void 0:n.call(t,...e)},onPaste:(...e)=>{var t,n;return null==(n=(t=this.options.current).onPaste)?void 0:n.call(t,...e)},onDelete:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDelete)?void 0:n.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>!!["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)||("extensions"===n&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every((e,n)=>{var r;return e===(null==(r=t.extensions)?void 0:r[n])}):e[n]===t[n]))}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&0===t.length?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(null===this.previousDeps){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}},ll=(0,iD.createContext)({editor:null});ll.Consumer;var lc=(0,iD.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),ld=iD.default.forwardRef((e,t)=>{let{onDragStart:n}=(0,iD.useContext)(lc),r=e.as||"div";return(0,iP.jsx)(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});function lu(e){return!!("function"==typeof e&&e.prototype&&e.prototype.isReactComponent)}function lh(e){return!!("object"==typeof e&&e.$$typeof&&("Symbol(react.forward_ref)"===e.$$typeof.toString()||"react.forward_ref"===e.$$typeof.description))}var lp=class{constructor(e,{editor:t,props:n={},as:r="div",className:i=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(0xffffffff*Math.random()).toString(),this.component=e,this.editor=t,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),i&&this.element.classList.add(...i.split(" ")),this.editor.isEditorContentInitialized?(0,ij.flushSync)(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var e;if(this.destroyed)return;let t=this.component,n=this.props,r=this.editor,i=function(){try{if(iD.version)return parseInt(iD.version.split(".")[0],10)>=19}catch{}return!1}(),o=function(e){if(lu(e)||lh(e))return!0;if("object"==typeof e&&e.$$typeof&&("Symbol(react.memo)"===e.$$typeof.toString()||"react.memo"===e.$$typeof.description)){let t=e.type;if(t)return lu(t)||lh(t)}return!1}(t),s={...n};s.ref&&!(i||o)&&delete s.ref,!s.ref&&(i||o)&&(s.ref=e=>{this.ref=e}),this.reactElement=(0,iP.jsx)(t,{...s}),null==(e=null==r?void 0:r.contentComponent)||e.setRenderer(this.id,this)}updateProps(e={}){if(this.destroyed)return;let t=!1,n=Object.keys(e);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==this.props[i]){t=!0;break}}t&&(this.props={...this.props,...e},this.render())}destroy(){var e;this.destroyed=!0;let t=this.editor;null==(e=null==t?void 0:t.contentComponent)||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}};iD.default.createContext({markViewContentRef:()=>{}});var lf=class extends aD{constructor(e,t,n){if(super(e,t,n),this.selectionRafId=null,this.handlePositionUpdate=()=>{let e=this.getPos();"number"==typeof e&&e!==this.currentPos&&(this.currentPos=e,this.renderer.updateProps({getPos:()=>this.getPos()}),"function"==typeof this.options.attrs&&this.updateElementAttributes())},this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const e=this.dom.querySelector("[data-node-view-content]");if(!e)return;e.appendChild(this.contentDOMElement)}this.options.trackNodeViewPosition&&this.editor.on("update",this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){let e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(n,r,i){var o;return"storage"===r?null!=(o=e.storage[t.name])?o:{}:Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){let e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(e={})=>this.updateAttributes(e),deleteNode:()=>this.deleteNode(),ref:(0,iD.createRef)()};if(!this.component.displayName){let e;this.component.displayName=(e=this.extension.name).charAt(0).toUpperCase()+e.substring(1)}let t={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:e=>{e&&this.contentDOMElement&&e.firstChild!==this.contentDOMElement&&(e.hasAttribute("data-node-view-wrapper")&&e.removeAttribute("data-node-view-wrapper"),e.appendChild(this.contentDOMElement))}},n=this.component,r=(0,iD.memo)(e=>(0,iP.jsx)(lc.Provider,{value:t,children:(0,iD.createElement)(n,e)}));r.displayName="ReactNodeView";let i=this.node.isInline?"span":"div";this.options.as&&(i=this.options.as);let{className:o=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new lp(r,{editor:this.editor,props:e,as:i,className:`node-${this.node.type.name} ${o}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes(),this.currentPos=this.getPos()}get dom(){var e;if(this.renderer.element.firstElementChild&&!(null==(e=this.renderer.element.firstElementChild)?void 0:e.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;let e=this.currentPos;if("number"==typeof e)if(sD({selection:this.editor.state.selection,pos:e,nodeSize:this.node.nodeSize,selectedOnTextSelection:this.options.selectedOnTextSelection})){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(e,t,n){let r=e=>{this.renderer.updateProps(e),"function"==typeof this.options.attrs&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if("function"==typeof this.options.update){let i=this.node,o=this.decorations,s=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=this.getPos(),this.options.update({oldNode:i,oldDecorations:o,newNode:e,newDecorations:t,oldInnerDecorations:s,innerDecorations:n,updateProps:()=>r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}if(e===this.node)return this.node=e,this.decorations=t,this.innerDecorations=n,!0;let i=this.getPos();this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=i;let o={node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(o.getPos=()=>this.getPos()),r(o),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.options.trackNodeViewPosition&&this.editor.off("update",this.handlePositionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let e={};if("function"==typeof this.options.attrs){let t=this.editor.extensionManager.attributes,n=sf(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:n})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}},lm=(0,iD.createContext)({get editor(){throw Error("useTiptap must be used within a <Tiptap> provider")}});function lg({editor:e,instance:t,children:n}){let r=null!=e?e:t;if(!r)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let i=(0,iD.useMemo)(()=>({editor:r}),[r]),o=(0,iD.useMemo)(()=>({editor:r}),[r]);return(0,iP.jsx)(ll.Provider,{value:o,children:(0,iP.jsx)(lm.Provider,{value:i,children:n})})}function ly({...e}){let{editor:t}=(0,iD.useContext)(lm);return(0,iP.jsx)(ln,{editor:t,...e})}lm.displayName="TiptapContext",lg.displayName="Tiptap",ly.displayName="Tiptap.Content",Object.assign(lg,{Content:ly}),e.s(["EditorContent",0,ln,"NodeViewWrapper",0,ld,"ReactNodeViewRenderer",0,function(e,t){return n=>n.editor.contentComponent?new lf(e,n,t):{}},"useCurrentEditor",0,()=>(0,iD.useContext)(ll),"useEditor",0,function(e={},t=[]){let n=(0,iD.useRef)(e);n.current=e;let[r]=(0,iD.useState)(()=>new la(n)),i=(0,iI.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,iD.useDebugValue)(i),(0,iD.useEffect)(r.onRender(t)),!function(e){var t;let[n]=(0,iD.useState)(()=>new li(e.editor)),r=(0,a7.useSyncExternalStoreWithSelector)(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,null!=(t=e.equalityFn)?t:a6);lr(()=>n.watch(e.editor),[e.editor,n]),(0,iD.useDebugValue)(r)}({editor:i,selector:({transactionNumber:t})=>!1===e.shouldRerenderOnTransaction||void 0===e.shouldRerenderOnTransaction?null:e.immediatelyRender&&0===t?0:t+1}),i}],885047)},231597,417068,660885,490275,534537,e=>{"use strict";let t=(0,e.i(605993).default)("sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);function n(e,t){return Array(t+1).join(e)}function r(e){return e.replace(/^\n*/,"")}function i(e){for(var t=e.length;t>0&&"\n"===e[t-1];)t--;return e.substring(0,t)}e.s(["Sparkles",0,t],231597),e.s(["findNodeByPath",0,function e(t,n){for(let r of t){if(r.path===n)return r;if(r.children){let t=e(r.children,n);if(t)return t}}return null}],417068);var o,s,a=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function l(e){return h(e,a)}var c=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function d(e){return h(e,c)}var u=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function h(e,t){return t.indexOf(e.nodeName)>=0}function p(e,t){return e.getElementsByTagName&&t.some(function(t){return e.getElementsByTagName(t).length})}var f=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function m(e){return f.reduce(function(e,t){return e.replace(t[0],t[1])},e)}var g={};function y(e){return e?e.replace(/(\n+\s*)+/g,"\n"):""}function b(e){var t=e.replace(/([<>()])/g,"\\$1");return t.indexOf(" ")>=0?"<"+t+">":t}function v(e){return e.replace(/"/g,'\\"')}function w(e){for(var t in this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[],e.rules)this.array.push(e.rules[t])}function x(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(function(e,t,n){var r=e.filter;if("string"==typeof r){if(r===t.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(t.nodeName.toLowerCase())>-1)return!0}else if("function"==typeof r){if(r.call(e,t,n))return!0}else throw TypeError("`filter` needs to be a string, array, or function")}(i,t,n))return i}}function k(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function S(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}g.paragraph={filter:"p",replacement:function(e){return"\n\n"+e+"\n\n"}},g.lineBreak={filter:"br",replacement:function(e,t,n){return n.br+"\n"}},g.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,t,r){var i=Number(t.nodeName.charAt(1));if("setext"!==r.headingStyle||!(i<3))return"\n\n"+n("#",i)+" "+e+"\n\n";var o=n(1===i?"=":"-",e.length);return"\n\n"+e+"\n"+o+"\n\n"}},g.blockquote={filter:"blockquote",replacement:function(e){return"\n\n"+(e=i(r(e)).replace(/^/gm,"> "))+"\n\n"}},g.list={filter:["ul","ol"],replacement:function(e,t){var n=t.parentNode;return"LI"===n.nodeName&&n.lastElementChild===t?"\n"+e:"\n\n"+e+"\n\n"}},g.listItem={filter:"li",replacement:function(e,t,n){var o=n.bulletListMarker+" ",s=t.parentNode;if("OL"===s.nodeName){var a=s.getAttribute("start"),l=Array.prototype.indexOf.call(s.children,t);o=(a?Number(a)+l:l+1)+". "}var c=/\n$/.test(e);return e=(e=i(r(e))+(c?"\n":"")).replace(/\n/gm,"\n"+" ".repeat(o.length)),o+e+(t.nextSibling?"\n":"")}},g.indentedCodeBlock={filter:function(e,t){return"indented"===t.codeBlockStyle&&"PRE"===e.nodeName&&e.firstChild&&"CODE"===e.firstChild.nodeName},replacement:function(e,t,n){return"\n\n "+t.firstChild.textContent.replace(/\n/g,"\n ")+"\n\n"}},g.fencedCodeBlock={filter:function(e,t){return"fenced"===t.codeBlockStyle&&"PRE"===e.nodeName&&e.firstChild&&"CODE"===e.firstChild.nodeName},replacement:function(e,t,r){for(var i,o=((t.firstChild.getAttribute("class")||"").match(/language-(\S+)/)||[null,""])[1],s=t.firstChild.textContent,a=r.fence.charAt(0),l=3,c=RegExp("^"+a+"{3,}","gm");i=c.exec(s);)i[0].length>=l&&(l=i[0].length+1);var d=n(a,l);return"\n\n"+d+o+"\n"+s.replace(/\n$/,"")+"\n"+d+"\n\n"}},g.horizontalRule={filter:"hr",replacement:function(e,t,n){return"\n\n"+n.hr+"\n\n"}},g.inlineLink={filter:function(e,t){return"inlined"===t.linkStyle&&"A"===e.nodeName&&e.getAttribute("href")},replacement:function(e,t){var n=b(t.getAttribute("href")),r=v(y(t.getAttribute("title")));return"["+e+"]("+n+(r?' "'+r+'"':"")+")"}},g.referenceLink={filter:function(e,t){return"referenced"===t.linkStyle&&"A"===e.nodeName&&e.getAttribute("href")},replacement:function(e,t,n){var r,i,o=b(t.getAttribute("href")),s=y(t.getAttribute("title"));switch(s&&(s=' "'+v(s)+'"'),n.linkReferenceStyle){case"collapsed":r="["+e+"][]",i="["+e+"]: "+o+s;break;case"shortcut":r="["+e+"]",i="["+e+"]: "+o+s;break;default:var a=this.references.length+1;r="["+e+"]["+a+"]",i="["+a+"]: "+o+s}return this.references.push(i),r},references:[],append:function(e){var t="";return this.references.length&&(t="\n\n"+this.references.join("\n")+"\n\n",this.references=[]),t}},g.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}},g.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}},g.code={filter:function(e){var t=e.previousSibling||e.nextSibling,n="PRE"===e.parentNode.nodeName&&!t;return"CODE"===e.nodeName&&!n},replacement:function(e){if(!e)return"";e=e.replace(/\r?\n|\r/g," ");for(var t=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"",n="`",r=e.match(/`+/gm)||[];-1!==r.indexOf(n);)n+="`";return n+t+e+t+n}},g.image={filter:"img",replacement:function(e,t){var n=m(y(t.getAttribute("alt"))),r=b(t.getAttribute("src")||""),i=y(t.getAttribute("title")),o=i?' "'+v(i)+'"':"";return r?"!["+n+"]("+r+o+")":""}},w.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){var t;return e.isBlank?this.blankRule:(t=x(this.array,e,this.options))||(t=x(this._keep,e,this.options))||(t=x(this._remove,e,this.options))?t:this.defaultRule},forEach:function(e){for(var t=0;t<this.array.length;t++)e(this.array[t],t)}};var C="u">typeof window?window:{},E=!function(){var e=C.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch(e){}return t}()?(o=function(){},!function(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch(t){C.ActiveXObject&&(e=!0)}return e}()?o.prototype.parseFromString=function(e){var t=document.implementation.createHTMLDocument("");return t.open(),t.write(e),t.close(),t}:o.prototype.parseFromString=function(e){var t=new window.ActiveXObject("htmlfile");return t.designMode="on",t.open(),t.write(e),t.close(),t},o):C.DOMParser;function M(e,t){var n;return!function(e){var t=e.element,n=e.isBlock,r=e.isVoid,i=e.isPre||function(e){return"PRE"===e.nodeName};if(!(!t.firstChild||i(t))){for(var o=null,s=!1,a=null,l=S(null,t,i);l!==t;){if(3===l.nodeType||4===l.nodeType){var c=l.data.replace(/[ \r\n\t]+/g," ");if((!o||/ $/.test(o.data))&&!s&&" "===c[0]&&(c=c.substr(1)),!c){l=k(l);continue}l.data=c,o=l}else if(1===l.nodeType)n(l)||"BR"===l.nodeName?(o&&(o.data=o.data.replace(/ $/,"")),o=null,s=!1):r(l)||i(l)?(o=null,s=!0):o&&(s=!1);else{l=k(l);continue}var d=S(a,l,i);a=l,l=d}o&&(o.data=o.data.replace(/ $/,""),o.data||k(o))}}({element:n="string"==typeof e?(s=s||new E).parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html").getElementById("turndown-root"):e.cloneNode(!0),isBlock:l,isVoid:d,isPre:t.preformattedCode?N:null}),n}function N(e){return"PRE"===e.nodeName||"CODE"===e.nodeName}function A(e,t){var n;return e.isBlock=l(e),e.isCode="CODE"===e.nodeName||e.parentNode.isCode,e.isBlank=!d(n=e)&&!h(n,u)&&/^\s*$/i.test(n.textContent)&&!p(n,c)&&!p(n,u),e.flankingWhitespace=function(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n,r={leading:(n=e.textContent.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/))[1],leadingAscii:n[2],leadingNonAscii:n[3],trailing:n[4],trailingNonAscii:n[5],trailingAscii:n[6]};return r.leadingAscii&&T("left",e,t)&&(r.leading=r.leadingNonAscii),r.trailingAscii&&T("right",e,t)&&(r.trailing=r.trailingNonAscii),{leading:r.leading,trailing:r.trailing}}(e,t),e}function T(e,t,n){var r,i,o;return"left"===e?(r=t.previousSibling,i=/ $/):(r=t.nextSibling,i=/^ /),r&&(3===r.nodeType?o=i.test(r.nodeValue):n.preformattedCode&&"CODE"===r.nodeName?o=!1:1!==r.nodeType||l(r)||(o=i.test(r.textContent))),o}var R=Array.prototype.reduce;function O(e){if(!(this instanceof O))return new O(e);this.options=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}({},{rules:g,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(e,t){return t.isBlock?"\n\n":""},keepReplacement:function(e,t){return t.isBlock?"\n\n"+t.outerHTML+"\n\n":t.outerHTML},defaultReplacement:function(e,t){return t.isBlock?"\n\n"+e+"\n\n":e}},e),this.rules=new w(this.options)}function D(e){var t=this;return R.call(e.childNodes,function(e,n){n=new A(n,t.options);var r="";return 3===n.nodeType?r=n.isCode?n.nodeValue:t.escape(n.nodeValue):1===n.nodeType&&(r=I.call(t,n)),P(e,r)},"")}function j(e){var t=this;return this.rules.forEach(function(n){"function"==typeof n.append&&(e=P(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function I(e){var t=this.rules.forNode(e),n=D.call(this,e),r=e.flankingWhitespace;return(r.leading||r.trailing)&&(n=n.trim()),r.leading+t.replacement(n,e,this.options)+r.trailing}function P(e,t){var n=i(e),o=r(t),s=Math.max(e.length-n.length,t.length-o.length);return n+"\n\n".substring(0,s)+o}O.prototype={turndown:function(e){var t;if(!(null!=(t=e)&&("string"==typeof t||t.nodeType&&(1===t.nodeType||9===t.nodeType||11===t.nodeType))))throw TypeError(e+" is not a string, or an element/document/fragment node.");return""===e?"":j.call(this,D.call(this,new M(e,this.options)))},use:function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.use(e[t]);else if("function"==typeof e)e(this);else throw TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(e,t){return this.rules.add(e,t),this},keep:function(e){return this.rules.keep(e),this},remove:function(e){return this.rules.remove(e),this},escape:function(e){return m(e)}};var L=/highlight-(?:text|source)-([a-z0-9]+)/;function z(e){e.addRule("highlightedCodeBlock",{filter:function(e){var t=e.firstChild;return"DIV"===e.nodeName&&L.test(e.className)&&t&&"PRE"===t.nodeName},replacement:function(e,t,n){var r=((t.className||"").match(L)||[null,""])[1];return"\n\n"+n.fence+r+"\n"+t.firstChild.textContent+"\n"+n.fence+"\n\n"}})}function _(e){e.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(e){return"~"+e+"~"}})}var $=Array.prototype.indexOf,H=Array.prototype.every,B={};function F(e){var t,n,r=e.parentNode;return"THEAD"===r.nodeName||r.firstChild===e&&("TABLE"===r.nodeName||(n=(t=r).previousSibling,"TBODY"===t.nodeName&&(!n||"THEAD"===n.nodeName&&/^\s*$/i.test(n.textContent))))&&H.call(e.childNodes,function(e){return"TH"===e.nodeName})}function V(e,t){var n=$.call(t.parentNode.childNodes,t),r=" ";return 0===n&&(r="| "),r+e+" |"}function U(e){for(var t in e.keep(function(e){return"TABLE"===e.nodeName&&!F(e.rows[0])}),B)e.addRule(t,B[t])}function W(e){e.addRule("taskListItems",{filter:function(e){return"checkbox"===e.type&&"LI"===e.parentNode.nodeName},replacement:function(e,t){return(t.checked?"[x]":"[ ]")+" "}})}B.tableCell={filter:["th","td"],replacement:function(e,t){return V(e,t)}},B.tableRow={filter:"tr",replacement:function(e,t){var n="",r={left:":--",right:"--:",center:":-:"};if(F(t))for(var i=0;i<t.childNodes.length;i++){var o="---",s=(t.childNodes[i].getAttribute("align")||"").toLowerCase();s&&(o=r[s]||o),n+=V(o,t.childNodes[i])}return"\n"+e+(n?"\n"+n:"")}},B.table={filter:function(e){return"TABLE"===e.nodeName&&F(e.rows[0])},replacement:function(e){return"\n\n"+(e=e.replace("\n\n","\n"))+"\n\n"}},B.tableSection={filter:["thead","tbody","tfoot"],replacement:function(e){return e}};var K=e.i(319814);let q=new O({headingStyle:"atx",hr:"---",bulletListMarker:"-",codeBlockStyle:"fenced",fence:"```",emDelimiter:"*",strongDelimiter:"**"});for(let e of(q.use(function(e){e.use([z,_,U,W])}),q.addRule("codeBlock",{filter:e=>"PRE"===e.nodeName&&null!==e.firstChild&&"CODE"===e.firstChild.nodeName,replacement:(e,t)=>{let n=t.firstChild,r=n.getAttribute("class")?.replace("language-","")||"",i=n.textContent||"";return`
87
- \`\`\`${r}
88
- ${i}
89
- \`\`\`
90
- `}}),q.addRule("wikiLink",{filter:e=>"A"===e.nodeName&&"true"===e.getAttribute("data-wiki-link"),replacement:(e,t)=>{let n=t.getAttribute("data-slug")??"",r=t.getAttribute("data-alias"),i=t.getAttribute("data-anchor");return r?`[[${n}|${r}]]`:i?`[[${n}#${i}]]`:`[[${n}]]`}}),q.addRule("proofSpan",{filter:e=>"PROOF-SPAN"===e.nodeName,replacement:(e,t)=>{let n=[];for(let e of Array.from(t.attributes))n.push(`${e.name}="${e.value.replace(/"/g,"&quot;")}"`);return`<proof-span${n.length?" "+n.join(" "):""}>${e}</proof-span>`}}),q.addRule("styledSpan",{filter:e=>"SPAN"===e.nodeName&&!!e.getAttribute("style"),replacement:(e,t)=>{let n=t.getAttribute("style")??"";return`<span style="${n}">${e}</span>`}}),q.addRule("lucideIcon",{filter:e=>"SPAN"===e.nodeName&&e.hasAttribute("data-lucide"),replacement:(e,t)=>{let n=t.getAttribute("data-lucide")??"file",r=t.getAttribute("data-color")??"gray";return`<span data-lucide="${n}" data-color="${r}">&nbsp;</span>`}}),q.addRule("mark",{filter:"mark",replacement:(e,t)=>{let n=[];for(let e of Array.from(t.attributes))n.push(`${e.name}="${e.value.replace(/"/g,"&quot;")}"`);return`<mark${n.length?` ${n.join(" ")}`:""}>${e}</mark>`}}),["u","sub","sup"]))q.addRule(e,{filter:e,replacement:t=>`<${e}>${t}</${e}>`});q.addRule("video",{filter:"video",replacement:(e,t)=>{let n=t.getAttribute("src")??"",r=n?(0,K.detectEmbed)(n):null;if(r&&"video"!==r.provider){let e=r.aspectRatio?` data-aspect-ratio="${r.aspectRatio}"`:"";return`
91
- <div data-embed="true" data-provider="${r.provider}" data-src="${r.embedUrl}" data-original-url="${r.originalUrl}"${e}><iframe src="${r.embedUrl}" data-embed-provider="${r.provider}" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen" allowfullscreen loading="lazy" frameborder="0"></iframe></div>
92
- `}let i=[];for(let e of Array.from(t.attributes))i.push(`${e.name}="${e.value.replace(/"/g,"&quot;")}"`);return`<video${i.length?` ${i.join(" ")}`:""}></video>`}}),q.addRule("embedBlock",{filter:e=>"DIV"===e.nodeName&&"true"===e.getAttribute("data-embed"),replacement:(e,t)=>{let n=t.getAttribute("data-provider")??"iframe",r=t.getAttribute("data-src")??"",i=t.getAttribute("data-original-url")??"",o=t.getAttribute("data-aspect-ratio")??"";if("video"===n)return`
93
- <video src="${r}" controls></video>
94
- `;let s=['data-embed="true"',`data-provider="${n}"`,`data-src="${r}"`,i?`data-original-url="${i}"`:"",o?`data-aspect-ratio="${o}"`:""].filter(Boolean).join(" ");return`
95
- <div ${s}><iframe src="${r}" data-embed-provider="${n}" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen" allowfullscreen loading="lazy" frameborder="0"></iframe></div>
96
- `}}),q.addRule("twitterEmbed",{filter:e=>"BLOCKQUOTE"===e.nodeName&&e.classList.contains("twitter-tweet"),replacement:(e,t)=>{let n=t.querySelector("a"),r=n?.getAttribute("href")??"";return`
97
- <blockquote class="twitter-tweet" data-theme="auto"><a href="${r}">${r}</a></blockquote>
98
- `}}),q.addRule("sizedImage",{filter:e=>{if("IMG"!==e.nodeName)return!1;let t=e.getAttribute("width")??e.style.width,n=e.getAttribute("data-align");return!!(t||n)},replacement:(e,t)=>{let n=[];for(let e of Array.from(t.attributes))n.push(`${e.name}="${e.value.replace(/"/g,"&quot;")}"`);return`<img ${n.join(" ")} />`}}),q.addRule("resizableImageWrapper",{filter:e=>"DIV"===e.nodeName&&e.classList.contains("resizable-image"),replacement:e=>e}),q.addRule("inlineMath",{filter:e=>{if("SPAN"!==e.nodeName)return!1;let t=e.getAttribute("data-type");return"inline-math"===t||"inlineMath"===t},replacement:(e,t)=>{let n=t.getAttribute("data-latex")??"";return`$${n}$`}}),q.addRule("alignedBlock",{filter:e=>{if(!["P","H1","H2","H3","H4","H5","H6"].includes(e.nodeName))return!1;let t=e.getAttribute("style")??"";return/text-align:\s*(center|right|justify)/.test(t)},replacement:(e,t)=>{let n=t.nodeName.toLowerCase(),r=t.getAttribute("style")??"";return`
99
- <${n} style="${r}">${e}</${n}>
100
- `}}),e.s(["htmlToMarkdown",0,function(e){return q.turndown(e)}],660885);let J=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/;function G(e){let t=e.trim();if(""===t)return"";if("true"===t)return!0;if("false"===t)return!1;if("null"===t||"~"===t)return null;if(/^-?\d+$/.test(t)||/^-?\d*\.\d+$/.test(t))return Number(t);if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);if(t.startsWith("[")&&t.endsWith("]")){let e=t.slice(1,-1).trim();return""===e?[]:e.split(",").map(e=>G(e))}return t}e.s(["parseFrontmatter",0,function(e){let t=J.exec(e);if(!t)return{data:{},body:e};let n=t[1],r=e.slice(t[0].length),i=n.split(/\r?\n/).find(e=>""!==e.trim())??"";if(/^\s*(#{1,6}\s|<|>|-\s|\*\s|\d+\.\s)/.test(i))return{data:{},body:e};let o={},s=n.split(/\r?\n/),a=0;for(;a<s.length;){let e=s[a];if(!e||/^\s*#/.test(e)){a+=1;continue}let t=/^([A-Za-z_][\w-]*)\s*:\s*(.*)$/.exec(e);if(!t){a+=1;continue}let n=t[1],r=t[2];if(""===r.trim()){let e=[],t=a+1;for(;t<s.length&&/^\s+-\s+/.test(s[t]);){let n=/^\s+-\s+(.*)$/.exec(s[t]);n&&e.push(G(n[1])),t+=1}if(e.length>0){o[n]=e,a=t;continue}o[n]="",a+=1;continue}o[n]=G(r),a+=1}return 0===Object.keys(o).length?{data:{},body:e}:{data:o,body:r}}],490275);var X=e.i(101685);let Z=e=>{let t,n=new Set,r=(e,r)=>{let i="function"==typeof e?e(t):e;if(!Object.is(i,t)){let e=t;t=(null!=r?r:"object"!=typeof i||null===i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,o={setState:r,getState:i,getInitialState:()=>s,subscribe:e=>(n.add(e),()=>n.delete(e))},s=t=e(r,i,o);return o},Y=e=>{let t=e?Z(e):Z,n=e=>(function(e,t=e=>e){let n=X.default.useSyncExternalStore(e.subscribe,X.default.useCallback(()=>t(e.getState()),[e,t]),X.default.useCallback(()=>t(e.getInitialState()),[e,t]));return X.default.useDebugValue(n),n})(t,e);return Object.assign(n,t),n};e.s(["create",0,e=>e?Y(e):Y],534537)},24800,562199,96701,990791,395624,246542,592185,926732,417385,e=>{"use strict";var t=e.i(534537),n=e.i(671485);function r(){return{}}e.s(["authHeaders",0,r],562199);let i=(0,t.create)(e=>({isOpen:!1,open:()=>e({isOpen:!0}),close:()=>e({isOpen:!1}),toggle:()=>e(e=>({isOpen:!e.isOpen})),clearMessages:()=>{},activity:[],connections:[],hasToken:!1,pollIntervalMs:1e4,rateLimit:null,loadActivity:async()=>{let t=localStorage.getItem("wiki-agent-token")??null,i=!!(t&&t.trim());try{let t=await (0,n.wsFetch)("/api/agent/activity?limit=50",{headers:r()});if(!t.ok)return void e({hasToken:i});let o=(await t.json()).events??[],s=function(e){let t=new Date(Date.now()-3e5).toISOString(),n=new Map;for(let r of e){if(r.at<t)continue;let e=n.get(r.by);e?n.set(r.by,{opCount:e.opCount+1,lastSeen:r.at>e.lastSeen?r.at:e.lastSeen}):n.set(r.by,{opCount:1,lastSeen:r.at})}return Array.from(n.entries()).map(([e,t])=>({by:e,...t})).sort((e,t)=>e.lastSeen<t.lastSeen?1:-1)}(o),a=null;try{let e=await (0,n.wsFetch)("/api/agent/settings",{headers:r()});e.ok&&(a=(await e.json()).rateLimit??null)}catch{}e({activity:o,connections:s,hasToken:i,rateLimit:a})}catch{e({hasToken:i})}}}));e.s(["useAIPanelStore",0,i],24800);class o extends Error{status;constructor(e,t){super(e),this.status=t,this.name="FetchPageError"}}async function s(e,t){let r=await (0,n.wsFetch)(`/api/wiki/content?path=${encodeURIComponent(e)}`,{signal:t});if(!r.ok)throw new o(`Failed to fetch page: ${e}`,r.status);let i=await r.json(),s=r.headers.get("X-Wiki-Revision"),a=null!==s?Number(s):null;return{path:e,content:i.content,frontmatter:null,revision:a}}class a extends Error{currentRevision;serverContent;constructor(e,t){super("File was modified externally. Reloaded with latest content."),this.currentRevision=e,this.serverContent=t,this.name="StaleRevisionError"}}async function l(e,t,r){let i={path:e,content:t};null!==r&&(i.baseRevision=r);let o=await (0,n.wsFetch)("/api/wiki/content",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(409===o.status){let r=await o.json(),i=await (0,n.wsFetch)(`/api/wiki/content?path=${encodeURIComponent(e)}`),s=i.ok?(await i.json()).content:t;throw new a(r.currentRevision??0,s)}if(!o.ok)throw Error("Failed to save page");return{revision:(await o.json()).revision??null}}async function c(e,t=""){await l(e,t,null)}let d="kb-page-cache",u=new Map,h=new Map;function p(e){if(u.delete(e.path),u.set(e.path,e),u.size>30){let e=u.keys().next().value;void 0!==e&&u.delete(e)}}function f(e){try{localStorage.setItem(d,JSON.stringify(e))}catch{}}let m="kb-edit-mode",g=null,y=null,b=null,v=(0,t.create)((e,t)=>({currentPath:null,content:"",frontmatter:null,saveStatus:"idle",loadStatus:"idle",isDirty:!1,isLoading:!1,lastSavedAt:null,currentRevision:null,editMode:"suggesting"===localStorage.getItem(m)?"suggesting":"editing",setEditMode:t=>{localStorage.setItem(m,t),e({editMode:t})},loadPage:async n=>{let r,i=t();i.isDirty&&i.currentPath&&i.currentPath!==n&&await t().save(),e({currentPath:n,isLoading:!0,loadStatus:"loading",isDirty:!1,content:"",currentRevision:null});let a=(r=u.get(n))?(u.delete(n),u.set(n,r),r):null,l=a??function(e){try{let t=localStorage.getItem(d);if(!t)return null;let n=JSON.parse(t);if(n.path!==e)return null;return n}catch{return null}}(n);l&&e({content:l.content,frontmatter:l.frontmatter,isLoading:!1,loadStatus:"ok",...a?{currentRevision:a.revision}:{}});let c=h.get(n);if(c)try{let r=await c;if(t().currentPath!==n)return;e({content:r.content,frontmatter:r.frontmatter,isLoading:!1,loadStatus:"ok",currentRevision:r.revision}),f({path:n,content:r.content,frontmatter:r.frontmatter});return}catch{}b?.abort();let m=new AbortController;b=m;try{let r=await s(n,m.signal);if(p(r),t().currentPath!==n)return;e({content:r.content,frontmatter:r.frontmatter,isLoading:!1,loadStatus:"ok",currentRevision:r.revision}),f({path:n,content:r.content,frontmatter:r.frontmatter})}catch(r){if(r instanceof DOMException&&"AbortError"===r.name||t().currentPath!==n)return;r instanceof o&&404===r.status?e({isLoading:!1,loadStatus:"missing",content:""}):e({isLoading:!1,loadStatus:"error"})}},updateContent:n=>{"suggesting"===t().editMode?e({content:n}):(e({content:n,isDirty:!0}),g&&clearTimeout(g),g=setTimeout(()=>{t().save()},500))},updateFrontmatter:n=>{e({frontmatter:{...t().frontmatter,...n},isDirty:!0}),g&&clearTimeout(g),g=setTimeout(()=>{t().save()},500)},save:async()=>{let{currentPath:n,content:r,isDirty:i,currentRevision:o,editMode:s}=t();if(n&&i&&"suggesting"!==s){e({saveStatus:"saving"});try{let i=await l(n,r,o);e({saveStatus:"saved",isDirty:!1,lastSavedAt:Date.now(),currentRevision:i.revision??o}),f({path:n,content:r,frontmatter:t().frontmatter}),p({path:n,content:r,frontmatter:t().frontmatter,revision:i.revision??o}),y&&clearTimeout(y),y=setTimeout(()=>{"saved"===t().saveStatus&&e({saveStatus:"idle"})},2e3)}catch(r){r instanceof a?(e({content:r.serverContent,isDirty:!1,saveStatus:"error",currentRevision:r.currentRevision}),f({path:n,content:r.serverContent,frontmatter:t().frontmatter})):e({saveStatus:"error"})}}},createMissingPage:async n=>{let{currentPath:r}=t();if(!r)return;let i=`# ${n}
101
-
102
- `;try{await c(`${r}/index.md`,i),e({content:i,isDirty:!1,loadStatus:"ok"}),f({path:r,content:i,frontmatter:null})}catch{}},clear:()=>{g&&clearTimeout(g),y&&clearTimeout(y),e({currentPath:null,content:"",frontmatter:null,saveStatus:"idle",loadStatus:"idle",isDirty:!1,isLoading:!1,lastSavedAt:null,currentRevision:null})},syncRevision:t=>{e({currentRevision:t})}}));e.s(["prefetchPage",0,function(e){if(u.has(e)||h.has(e))return;let t=s(e).then(e=>(p(e),e)).finally(()=>{h.delete(e)});h.set(e,t),t.catch(()=>{})},"useEditorStore",0,v],96701);let w=(0,t.create)((e,t)=>({nodes:[],selectedPath:null,expandedPaths:new Set,loadTree:async()=>{},selectPage:t=>{e({selectedPath:t})},expandPath:n=>{let{expandedPaths:r}=t();if(!r.has(n)){let t=new Set(r);t.add(n),e({expandedPaths:t})}},focusPath:n=>{let{expandedPaths:r}=t(),i=new Set(r),o=n.split("/");for(let e=1;e<o.length;e++)i.add(o.slice(0,e).join("/"));e({selectedPath:n,expandedPaths:i})}}));e.s(["useTreeStore",0,w],990791);let x="wiki-view-width",k="wiki-view-align",S=["narrow","normal","wide"],C=(0,t.create)(e=>{let t,n;return{width:"narrow"===(t=localStorage.getItem(x))||"normal"===t||"wide"===t?t:"normal",align:"center"===(n=localStorage.getItem(k))||"left"===n?n:"center",setWidth:t=>{localStorage.setItem(x,t),e({width:t})},setAlign:t=>{localStorage.setItem(k,t),e({align:t})},cycle:()=>e(e=>{let t=S.indexOf(e.width),n=S[(t+1)%S.length];return localStorage.setItem(x,n),{width:n}})}});e.s(["VIEW_ALIGN_CLASS",0,{center:"mx-auto",left:"mr-auto"},"VIEW_ALIGN_LABEL",0,{center:"Center",left:"Left"},"VIEW_ALIGN_ML",0,{center:"auto",left:"0"},"VIEW_ALIGN_ORDER",0,["center","left"],"VIEW_WIDTH_CLASS",0,{narrow:"max-w-2xl",normal:"max-w-5xl",wide:"max-w-[90rem]"},"VIEW_WIDTH_CSS",0,{narrow:"42rem",normal:"64rem",wide:"90rem"},"VIEW_WIDTH_LABEL",0,{narrow:"Narrow",normal:"Normal",wide:"Wide"},"VIEW_WIDTH_ORDER",0,S,"useViewWidthStore",0,C],395624);let E=(0,t.create)((e,t)=>({slugs:new Set,slugDir:new Map,loadedAt:null,loading:!1,load:async()=>{let{loadedAt:r,loading:i}=t();if(!i&&!(null!==r&&Date.now()-r<1e4)){e({loading:!0});try{let t=await (0,n.wsFetch)("/api/wiki/slugs");if(!t.ok)throw Error("Failed to fetch wiki slugs");let r=await t.json(),i=new Set,o=new Map;for(let e of["entities","concepts","comparisons","root"])for(let t of r[e])i.add(t),o.has(t)||o.set(t,e);e({slugs:i,slugDir:o,loadedAt:Date.now(),loading:!1})}catch{e({loading:!1})}}},has:e=>t().slugs.has(e),getDir:e=>t().slugDir.get(e)??null,invalidate(){e({loadedAt:null})}}));function M(){return{sidecar:null,snapshotRevision:0,lastEventId:0,snapshotBlocks:[]}}e.s(["useWikiSlugsStore",0,E],246542);let N=(0,t.create)((e,t)=>({byPath:{},loadSidecar:async t=>{let i=encodeURIComponent(t).replace(/%2F/g,"/");try{let o=await (0,n.wsFetch)(`/api/agent/sidecar/${i}`,{headers:r()});if(!o.ok)return;let s=await o.json();e(e=>({byPath:{...e.byPath,[t]:{...e.byPath[t]??M(),sidecar:s,snapshotRevision:s.revision,lastEventId:s.nextEventId-1}}}))}catch{}},loadSnapshot:async t=>{let i=encodeURIComponent(t).replace(/%2F/g,"/");try{let o=await (0,n.wsFetch)(`/api/agent/files/${i}`,{headers:r()});if(!o.ok)return;let s=await o.json();e(e=>({byPath:{...e.byPath,[t]:{...e.byPath[t]??M(),snapshotBlocks:s.blocks,snapshotRevision:s.revision}}}));let a=v.getState();a.currentPath===t&&a.syncRevision(s.revision)}catch{}},pollEvents:async e=>{let i=t().byPath[e]??M(),o=encodeURIComponent(e).replace(/%2F/g,"/");try{let s=await (0,n.wsFetch)(`/api/agent/events/${o}?after=${i.lastEventId}`,{headers:r()});if(!s.ok)return;for(let n of(await s.json()).events)t().applyEvent(e,n)}catch{}},applyEvent:(t,n)=>{e(e=>{let r=e.byPath[t]??M();return{byPath:{...e.byPath,[t]:{...r,lastEventId:Math.max(r.lastEventId,n.id)}}}})},reset:t=>{e(e=>{let n={...e.byPath};return delete n[t],{byPath:n}})}}));async function A(e,t,n){let i=encodeURIComponent(e).replace(/%2F/g,"/"),o=await fetch(`/api/agent/files/${i}`,{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":crypto.randomUUID(),...r()},body:JSON.stringify({baseRevision:t,by:"human",ops:[n]})});if(409===o.status){let e=await o.json();return"STALE_REVISION"===e.code&&e.snapshot?.revision!==void 0?{ok:!1,stale:!0,newRevision:e.snapshot.revision}:{ok:!1,stale:!1}}return{ok:o.ok,stale:!1}}async function T(e){let{path:t,ref:n,kind:r,markdown:i,basisDetail:o,getRevision:s,refresh:a}=e,l={type:"suggestion.add",ref:n,kind:r,basis:"suggested"};"delete"!==r&&(l.markdown=i??""),o&&(l.basisDetail=o);let c=await A(t,s(),l);return!c.ok&&c.stale&&void 0!==c.newRevision&&(await a(),c=await A(t,c.newRevision,l)),c.ok}e.s(["useProofStore",0,N],592185),e.s(["captureSuggestion",0,T],926732);var R=e.i(187014);e.s(["showError",0,function(e,t){R.toast.error(e,t)},"showSuccess",0,function(e,t){R.toast.success(e,t)}],417385)},278928,e=>{"use strict";let t,n=["top","right","bottom","left"],r=n.reduce((e,t)=>e.concat(t,t+"-start",t+"-end"),[]),i=Math.min,o=Math.max,s=Math.round,a=Math.floor,l=e=>({x:e,y:e}),c={left:"right",right:"left",bottom:"top",top:"bottom"};function d(e,t){return"function"==typeof e?e(t):e}function u(e){return e.split("-")[0]}function h(e){return e.split("-")[1]}function p(e){return"x"===e?"y":"x"}function f(e){return"y"===e?"height":"width"}function m(e){let t=e[0];return"t"===t||"b"===t?"y":"x"}function g(e,t,n){void 0===n&&(n=!1);let r=h(e),i=p(m(e)),o=f(i),s="x"===i?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=k(s)),[s,k(s)]}function y(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}let b=["left","right"],v=["right","left"],w=["top","bottom"],x=["bottom","top"];function k(e){let t=u(e);return c[t]+e.slice(t.length)}function S(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function C(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function E(e,t,n){let r,{reference:i,floating:o}=e,s=m(t),a=p(m(t)),l=f(a),c=u(t),d="y"===s,g=i.x+i.width/2-o.width/2,y=i.y+i.height/2-o.height/2,b=i[l]/2-o[l]/2;switch(c){case"top":r={x:g,y:i.y-o.height};break;case"bottom":r={x:g,y:i.y+i.height};break;case"right":r={x:i.x+i.width,y:y};break;case"left":r={x:i.x-o.width,y:y};break;default:r={x:i.x,y:i.y}}switch(h(t)){case"start":r[a]-=b*(n&&d?-1:1);break;case"end":r[a]+=b*(n&&d?-1:1)}return r}async function M(e,t){var n;void 0===t&&(t={});let{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:p=!1,padding:f=0}=d(t,e),m=S(f),g=a[p?"floating"===h?"reference":"floating":h],y=C(await o.getClippingRect({element:null==(n=await (null==o.isElement?void 0:o.isElement(g)))||n?g:g.contextElement||await (null==o.getDocumentElement?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),b="floating"===h?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,v=await (null==o.getOffsetParent?void 0:o.getOffsetParent(a.floating)),w=await (null==o.isElement?void 0:o.isElement(v))&&await (null==o.getScale?void 0:o.getScale(v))||{x:1,y:1},x=C(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:v,strategy:l}):b);return{top:(y.top-x.top+m.top)/w.y,bottom:(x.bottom-y.bottom+m.bottom)/w.y,left:(y.left-x.left+m.left)/w.x,right:(x.right-y.right+m.right)/w.x}}let N=async(e,t,n)=>{let{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=s.detectOverflow?s:{...s,detectOverflow:M},l=await (null==s.isRTL?void 0:s.isRTL(t)),c=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:u}=E(c,r,l),h=r,p=0,f={};for(let n=0;n<o.length;n++){let m=o[n];if(!m)continue;let{name:g,fn:y}=m,{x:b,y:v,data:w,reset:x}=await y({x:d,y:u,initialPlacement:r,placement:h,strategy:i,middlewareData:f,rects:c,platform:a,elements:{reference:e,floating:t}});d=null!=b?b:d,u=null!=v?v:u,f[g]={...f[g],...w},x&&p<50&&(p++,"object"==typeof x&&(x.placement&&(h=x.placement),x.rects&&(c=!0===x.rects?await s.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:d,y:u}=E(c,h,l)),n=-1)}return{x:d,y:u,placement:h,strategy:i,middlewareData:f}};function A(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function T(e){return n.some(t=>e[t]>=0)}function R(e){let t=i(...e.map(e=>e.left)),n=i(...e.map(e=>e.top));return{x:t,y:n,width:o(...e.map(e=>e.right))-t,height:o(...e.map(e=>e.bottom))-n}}let O=new Set(["left","top"]);async function D(e,t){let{placement:n,platform:r,elements:i}=e,o=await (null==r.isRTL?void 0:r.isRTL(i.floating)),s=u(n),a=h(n),l="y"===m(n),c=O.has(s)?-1:1,p=o&&l?-1:1,f=d(t,e),{mainAxis:g,crossAxis:y,alignmentAxis:b}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&"number"==typeof b&&(y="end"===a?-1*b:b),l?{x:y*p,y:g*c}:{x:g*c,y:y*p}}function j(){return"u">typeof window}function I(e){return z(e)?(e.nodeName||"").toLowerCase():"#document"}function P(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function L(e){var t;return null==(t=(z(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function z(e){return!!j()&&(e instanceof Node||e instanceof P(e).Node)}function _(e){return!!j()&&(e instanceof Element||e instanceof P(e).Element)}function $(e){return!!j()&&(e instanceof HTMLElement||e instanceof P(e).HTMLElement)}function H(e){return!(!j()||"u"<typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof P(e).ShadowRoot)}function B(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=G(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&"inline"!==i&&"contents"!==i}function F(e){try{if(e.matches(":popover-open"))return!0}catch(e){}try{return e.matches(":modal")}catch(e){return!1}}let V=/transform|translate|scale|rotate|perspective|filter/,U=/paint|layout|strict|content/,W=e=>!!e&&"none"!==e;function K(e){let t=_(e)?G(e):e;return W(t.transform)||W(t.translate)||W(t.scale)||W(t.rotate)||W(t.perspective)||!q()&&(W(t.backdropFilter)||W(t.filter))||V.test(t.willChange||"")||U.test(t.contain||"")}function q(){return null==t&&(t="u">typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),t}function J(e){return/^(html|body|#document)$/.test(I(e))}function G(e){return P(e).getComputedStyle(e)}function X(e){return _(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Z(e){if("html"===I(e))return e;let t=e.assignedSlot||e.parentNode||H(e)&&e.host||L(e);return H(t)?t.host:t}function Y(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);let i=function e(t){let n=Z(t);return J(n)?t.ownerDocument?t.ownerDocument.body:t.body:$(n)&&B(n)?n:e(n)}(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),s=P(i);if(!o)return t.concat(i,Y(i,[],n));{let e=Q(s);return t.concat(s,s.visualViewport||[],B(i)?i:[],e&&n?Y(e):[])}}function Q(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ee(e){let t=G(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=$(e),o=i?e.offsetWidth:n,a=i?e.offsetHeight:r,l=s(n)!==o||s(r)!==a;return l&&(n=o,r=a),{width:n,height:r,$:l}}function et(e){return _(e)?e:e.contextElement}function en(e){let t=et(e);if(!$(t))return l(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:o}=ee(t),a=(o?s(n.width):n.width)/r,c=(o?s(n.height):n.height)/i;return a&&Number.isFinite(a)||(a=1),c&&Number.isFinite(c)||(c=1),{x:a,y:c}}let er=l(0);function ei(e){let t=P(e);return q()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:er}function eo(e,t,n,r){var i;void 0===t&&(t=!1),void 0===n&&(n=!1);let o=e.getBoundingClientRect(),s=et(e),a=l(1);t&&(r?_(r)&&(a=en(r)):a=en(e));let c=(void 0===(i=n)&&(i=!1),r&&(!i||r===P(s))&&i)?ei(s):l(0),d=(o.left+c.x)/a.x,u=(o.top+c.y)/a.y,h=o.width/a.x,p=o.height/a.y;if(s){let e=P(s),t=r&&_(r)?P(r):r,n=e,i=Q(n);for(;i&&r&&t!==n;){let e=en(i),t=i.getBoundingClientRect(),r=G(i),o=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,s=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;d*=e.x,u*=e.y,h*=e.x,p*=e.y,d+=o,u+=s,i=Q(n=P(i))}}return C({width:h,height:p,x:d,y:u})}function es(e,t){let n=X(e).scrollLeft;return t?t.left+n:eo(L(e)).left+n}function ea(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-es(e,n),y:n.top+t.scrollTop}}function el(e,t,n){var r;let i;if("viewport"===t)i=function(e,t){let n=P(e),r=L(e),i=n.visualViewport,o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;let e=q();(!e||e&&"fixed"===t)&&(a=i.offsetLeft,l=i.offsetTop)}let c=es(r);if(c<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,s=Math.abs(r.clientWidth-t.clientWidth-i);s<=25&&(o-=s)}else c<=25&&(o+=c);return{width:o,height:s,x:a,y:l}}(e,n);else if("document"===t){let t,n,s,a,l,c,d;r=L(e),t=L(r),n=X(r),s=r.ownerDocument.body,a=o(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),l=o(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight),c=-n.scrollLeft+es(r),d=-n.scrollTop,"rtl"===G(s).direction&&(c+=o(t.clientWidth,s.clientWidth)-a),i={width:a,height:l,x:c,y:d}}else if(_(t)){let e,r,o,s,a,c;r=(e=eo(t,!0,"fixed"===n)).top+t.clientTop,o=e.left+t.clientLeft,s=$(t)?en(t):l(1),a=t.clientWidth*s.x,c=t.clientHeight*s.y,i={width:a,height:c,x:o*s.x,y:r*s.y}}else{let n=ei(e);i={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return C(i)}function ec(e){return"static"===G(e).position}function ed(e,t){if(!$(e)||"fixed"===G(e).position)return null;if(t)return t(e);let n=e.offsetParent;return L(e)===n&&(n=n.ownerDocument.body),n}function eu(e,t){var n;let r=P(e);if(F(e))return r;if(!$(e)){let t=Z(e);for(;t&&!J(t);){if(_(t)&&!ec(t))return t;t=Z(t)}return r}let i=ed(e,t);for(;i&&(n=i,/^(table|td|th)$/.test(I(n)))&&ec(i);)i=ed(i,t);return i&&J(i)&&ec(i)&&!K(i)?r:i||function(e){let t=Z(e);for(;$(t)&&!J(t);){if(K(t))return t;if(F(t))break;t=Z(t)}return null}(e)||r}let eh=async function(e){let t=this.getOffsetParent||eu,n=this.getDimensions,r=await n(e.floating);return{reference:function(e,t,n){let r=$(t),i=L(t),o="fixed"===n,s=eo(e,!0,o,t),a={scrollLeft:0,scrollTop:0},c=l(0);if(r||!r&&!o)if(("body"!==I(t)||B(i))&&(a=X(t)),r){let e=eo(t,!0,o,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&(c.x=es(i));o&&!r&&i&&(c.x=es(i));let d=!i||r||o?l(0):ea(i,a);return{x:s.left+a.scrollLeft-c.x-d.x,y:s.top+a.scrollTop-c.y-d.y,width:s.width,height:s.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},ep={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,o="fixed"===i,s=L(r),a=!!t&&F(t.floating);if(r===s||a&&o)return n;let c={scrollLeft:0,scrollTop:0},d=l(1),u=l(0),h=$(r);if((h||!h&&!o)&&(("body"!==I(r)||B(s))&&(c=X(r)),h)){let e=eo(r);d=en(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let p=!s||h||o?l(0):ea(s,c);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+u.x+p.x,y:n.y*d.y-c.scrollTop*d.y+u.y+p.y}},getDocumentElement:L,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e,a=[..."clippingAncestors"===n?F(t)?[]:function(e,t){let n=t.get(e);if(n)return n;let r=Y(e,[],!1).filter(e=>_(e)&&"body"!==I(e)),i=null,o="fixed"===G(e).position,s=o?Z(e):e;for(;_(s)&&!J(s);){let t=G(s),n=K(s);n||"fixed"!==t.position||(i=null),(o?n||i:!(!n&&"static"===t.position&&i&&("absolute"===i.position||"fixed"===i.position)||B(s)&&!n&&function e(t,n){let r=Z(t);return!(r===n||!_(r)||J(r))&&("fixed"===G(r).position||e(r,n))}(e,s)))?i=t:r=r.filter(e=>e!==s),s=Z(s)}return t.set(e,r),r}(t,this._c):[].concat(n),r],l=el(t,a[0],s),c=l.top,d=l.right,u=l.bottom,h=l.left;for(let e=1;e<a.length;e++){let n=el(t,a[e],s);c=o(n.top,c),d=i(n.right,d),u=i(n.bottom,u),h=o(n.left,h)}return{width:d-h,height:u-c,x:h,y:c}},getOffsetParent:eu,getElementRects:eh,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:n}=ee(e);return{width:t,height:n}},getScale:en,isElement:_,isRTL:function(e){return"rtl"===G(e).direction}};function ef(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}e.s(["arrow",0,e=>({name:"arrow",options:e,async fn(t){let{x:n,y:r,placement:s,rects:a,platform:l,elements:c,middlewareData:u}=t,{element:g,padding:y=0}=d(e,t)||{};if(null==g)return{};let b=S(y),v={x:n,y:r},w=p(m(s)),x=f(w),k=await l.getDimensions(g),C="y"===w,E=C?"clientHeight":"clientWidth",M=a.reference[x]+a.reference[w]-v[w]-a.floating[x],N=v[w]-a.reference[w],A=await (null==l.getOffsetParent?void 0:l.getOffsetParent(g)),T=A?A[E]:0;T&&await (null==l.isElement?void 0:l.isElement(A))||(T=c.floating[E]||a.floating[x]);let R=T/2-k[x]/2-1,O=i(b[C?"top":"left"],R),D=i(b[C?"bottom":"right"],R),j=T-k[x]-D,I=T/2-k[x]/2+(M/2-N/2),P=o(O,i(I,j)),L=!u.arrow&&null!=h(s)&&I!==P&&a.reference[x]/2-(I<O?O:D)-k[x]/2<0,z=L?I<O?I-O:I-j:0;return{[w]:v[w]+z,data:{[w]:P,centerOffset:I-P-z,...L&&{alignmentOffset:z}},reset:L}}}),"autoPlacement",0,function(e){return void 0===e&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,i,o,s;let{rects:a,middlewareData:l,placement:c,platform:p,elements:f}=t,{crossAxis:m=!1,alignment:b,allowedPlacements:v=r,autoAlignment:w=!0,...x}=d(e,t),k=void 0!==b||v===r?((s=b||null)?[...v.filter(e=>h(e)===s),...v.filter(e=>h(e)!==s)]:v.filter(e=>u(e)===e)).filter(e=>!s||h(e)===s||!!w&&y(e)!==e):v,S=await p.detectOverflow(t,x),C=(null==(n=l.autoPlacement)?void 0:n.index)||0,E=k[C];if(null==E)return{};let M=g(E,a,await (null==p.isRTL?void 0:p.isRTL(f.floating)));if(c!==E)return{reset:{placement:k[0]}};let N=[S[u(E)],S[M[0]],S[M[1]]],A=[...(null==(i=l.autoPlacement)?void 0:i.overflows)||[],{placement:E,overflows:N}],T=k[C+1];if(T)return{data:{index:C+1,overflows:A},reset:{placement:T}};let R=A.map(e=>{let t=h(e.placement);return[e.placement,t&&m?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),O=(null==(o=R.filter(e=>e[2].slice(0,h(e[0])?2:3).every(e=>e<=0))[0])?void 0:o[0])||R[0][0];return O!==c?{data:{index:C+1,overflows:A},reset:{placement:O}}:{}}}},"autoUpdate",0,function(e,t,n,r){let s;void 0===r&&(r={});let{ancestorScroll:l=!0,ancestorResize:c=!0,elementResize:d="function"==typeof ResizeObserver,layoutShift:u="function"==typeof IntersectionObserver,animationFrame:h=!1}=r,p=et(e),f=l||c?[...p?Y(p):[],...t?Y(t):[]]:[];f.forEach(e=>{l&&e.addEventListener("scroll",n,{passive:!0}),c&&e.addEventListener("resize",n)});let m=p&&u?function(e,t){let n,r=null,s=L(e);function l(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return!function c(d,u){void 0===d&&(d=!1),void 0===u&&(u=1),l();let h=e.getBoundingClientRect(),{left:p,top:f,width:m,height:g}=h;if(d||t(),!m||!g)return;let y={rootMargin:-a(f)+"px "+-a(s.clientWidth-(p+m))+"px "+-a(s.clientHeight-(f+g))+"px "+-a(p)+"px",threshold:o(0,i(1,u))||1},b=!0;function v(t){let r=t[0].intersectionRatio;if(r!==u){if(!b)return c();r?c(!1,r):n=setTimeout(()=>{c(!1,1e-7)},1e3)}1!==r||ef(h,e.getBoundingClientRect())||c(),b=!1}try{r=new IntersectionObserver(v,{...y,root:s.ownerDocument})}catch(e){r=new IntersectionObserver(v,y)}r.observe(e)}(!0),l}(p,n):null,g=-1,y=null;d&&(y=new ResizeObserver(e=>{let[r]=e;r&&r.target===p&&y&&t&&(y.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var e;null==(e=y)||e.observe(t)})),n()}),p&&!h&&y.observe(p),t&&y.observe(t));let b=h?eo(e):null;return h&&function t(){let r=eo(e);b&&!ef(b,r)&&n(),b=r,s=requestAnimationFrame(t)}(),n(),()=>{var e;f.forEach(e=>{l&&e.removeEventListener("scroll",n),c&&e.removeEventListener("resize",n)}),null==m||m(),null==(e=y)||e.disconnect(),y=null,h&&cancelAnimationFrame(s)}},"computePosition",0,(e,t,n)=>{let r=new Map,i={platform:ep,...n},o={...i.platform,_c:r};return N(e,t,{...i,platform:o})},"flip",0,function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r,i,o,s;let a,l,c,{placement:p,middlewareData:f,rects:S,initialPlacement:C,platform:E,elements:M}=t,{mainAxis:N=!0,crossAxis:A=!0,fallbackPlacements:T,fallbackStrategy:R="bestFit",fallbackAxisSideDirection:O="none",flipAlignment:D=!0,...j}=d(e,t);if(null!=(n=f.arrow)&&n.alignmentOffset)return{};let I=u(p),P=m(C),L=u(C)===C,z=await (null==E.isRTL?void 0:E.isRTL(M.floating)),_=T||(L||!D?[k(C)]:(a=k(C),[y(C),a,y(a)])),$="none"!==O;!T&&$&&_.push(...(l=h(C),c=function(e,t,n){switch(e){case"top":case"bottom":if(n)return t?v:b;return t?b:v;case"left":case"right":return t?w:x;default:return[]}}(u(C),"start"===O,z),l&&(c=c.map(e=>e+"-"+l),D&&(c=c.concat(c.map(y)))),c));let H=[C,..._],B=await E.detectOverflow(t,j),F=[],V=(null==(r=f.flip)?void 0:r.overflows)||[];if(N&&F.push(B[I]),A){let e=g(p,S,z);F.push(B[e[0]],B[e[1]])}if(V=[...V,{placement:p,overflows:F}],!F.every(e=>e<=0)){let e=((null==(i=f.flip)?void 0:i.index)||0)+1,t=H[e];if(t&&("alignment"!==A||P===m(t)||V.every(e=>m(e.placement)!==P||e.overflows[0]>0)))return{data:{index:e,overflows:V},reset:{placement:t}};let n=null==(o=V.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:o.placement;if(!n)switch(R){case"bestFit":{let e=null==(s=V.filter(e=>{if($){let t=m(e.placement);return t===P||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:s[0];e&&(n=e);break}case"initialPlacement":n=C}if(p!==n)return{reset:{placement:n}}}return{}}}},"hide",0,function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i="referenceHidden",...o}=d(e,t);switch(i){case"referenceHidden":{let e=A(await r.detectOverflow(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:T(e)}}}case"escaped":{let e=A(await r.detectOverflow(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:T(e)}}}default:return{}}}}},"inline",0,function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){let{placement:n,elements:r,rects:s,platform:a,strategy:l}=t,{padding:c=2,x:h,y:p}=d(e,t),f=Array.from(await (null==a.getClientRects?void 0:a.getClientRects(r.reference))||[]),g=function(e){let t=e.slice().sort((e,t)=>e.y-t.y),n=[],r=null;for(let e=0;e<t.length;e++){let i=t[e];!r||i.y-r.y>r.height/2?n.push([i]):n[n.length-1].push(i),r=i}return n.map(e=>C(R(e)))}(f),y=C(R(f)),b=S(c),v=await a.getElementRects({reference:{getBoundingClientRect:function(){if(2===g.length&&g[0].left>g[1].right&&null!=h&&null!=p)return g.find(e=>h>e.left-b.left&&h<e.right+b.right&&p>e.top-b.top&&p<e.bottom+b.bottom)||y;if(g.length>=2){if("y"===m(n)){let e=g[0],t=g[g.length-1],r="top"===u(n),i=e.top,o=t.bottom,s=r?e.left:t.left,a=r?e.right:t.right;return{top:i,bottom:o,left:s,right:a,width:a-s,height:o-i,x:s,y:i}}let e="left"===u(n),t=o(...g.map(e=>e.right)),r=i(...g.map(e=>e.left)),s=g.filter(n=>e?n.left===r:n.right===t),a=s[0].top,l=s[s.length-1].bottom;return{top:a,bottom:l,left:r,right:t,width:t-r,height:l-a,x:r,y:a}}return y}},floating:r.floating,strategy:l});return s.reference.x!==v.reference.x||s.reference.y!==v.reference.y||s.reference.width!==v.reference.width||s.reference.height!==v.reference.height?{reset:{rects:v}}:{}}}},"limitShift",0,function(e){return void 0===e&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:o,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=d(e,t),h={x:n,y:r},f=m(i),g=p(f),y=h[g],b=h[f],v=d(a,t),w="number"==typeof v?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(l){let e="y"===g?"height":"width",t=o.reference[g]-o.floating[e]+w.mainAxis,n=o.reference[g]+o.reference[e]-w.mainAxis;y<t?y=t:y>n&&(y=n)}if(c){var x,k;let e="y"===g?"width":"height",t=O.has(u(i)),n=o.reference[f]-o.floating[e]+(t&&(null==(x=s.offset)?void 0:x[f])||0)+(t?0:w.crossAxis),r=o.reference[f]+o.reference[e]+(t?0:(null==(k=s.offset)?void 0:k[f])||0)-(t?w.crossAxis:0);b<n?b=n:b>r&&(b=r)}return{[g]:y,[f]:b}}}},"offset",0,function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;let{x:i,y:o,placement:s,middlewareData:a}=t,l=await D(t,e);return s===(null==(n=a.offset)?void 0:n.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},"shift",0,function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){let{x:n,y:r,placement:s,platform:a}=t,{mainAxis:l=!0,crossAxis:c=!1,limiter:h={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...f}=d(e,t),g={x:n,y:r},y=await a.detectOverflow(t,f),b=m(u(s)),v=p(b),w=g[v],x=g[b];if(l){let e="y"===v?"top":"left",t="y"===v?"bottom":"right",n=w+y[e],r=w-y[t];w=o(n,i(w,r))}if(c){let e="y"===b?"top":"left",t="y"===b?"bottom":"right",n=x+y[e],r=x-y[t];x=o(n,i(x,r))}let k=h.fn({...t,[v]:w,[b]:x});return{...k,data:{x:k.x-n,y:k.y-r,enabled:{[v]:l,[b]:c}}}}}},"size",0,function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;let s,a,{placement:l,rects:c,platform:p,elements:f}=t,{apply:g=()=>{},...y}=d(e,t),b=await p.detectOverflow(t,y),v=u(l),w=h(l),x="y"===m(l),{width:k,height:S}=c.floating;"top"===v||"bottom"===v?(s=v,a=w===(await (null==p.isRTL?void 0:p.isRTL(f.floating))?"start":"end")?"left":"right"):(a=v,s="end"===w?"top":"bottom");let C=S-b.top-b.bottom,E=k-b.left-b.right,M=i(S-b[s],C),N=i(k-b[a],E),A=!t.middlewareData.shift,T=M,R=N;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(R=E),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(T=C),A&&!w){let e=o(b.left,0),t=o(b.right,0),n=o(b.top,0),r=o(b.bottom,0);x?R=k-2*(0!==e||0!==t?e+t:o(b.left,b.right)):T=S-2*(0!==n||0!==r?n+r:o(b.top,b.bottom))}await g({...t,availableWidth:R,availableHeight:T});let O=await p.getDimensions(f.floating);return k!==O.width||S!==O.height?{reset:{rects:!0}}:{}}}}],278928)},153840,580330,792934,85741,464675,419943,674155,425275,891734,187080,253190,73313,736586,132807,412473,e=>{"use strict";var t=e.i(343603),n=e.i(278928),r=e.i(111092);e.i(150663);var i=e.i(608926),o=class{constructor({editor:e,element:n,view:r,pluginKey:i="bubbleMenu",updateDelay:o=250,resizeDelay:s=60,shouldShow:a,appendTo:l,getReferencedVirtualElement:c,options:d}){var u;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:n,from:r,to:i})=>{let{doc:o,selection:s}=n,{empty:a}=s,l=!o.textBetween(r,i).length&&(0,t.isTextSelection)(n.selection),c=this.element.contains(document.activeElement);return!!(e.hasFocus()||c)&&!a&&!l&&!!this.editor.isEditable},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{var t;if(this.editor.isDestroyed)return void this.destroy();if(this.preventHide){this.preventHide=!1;return}(null==e?void 0:e.relatedTarget)&&(null==(t=this.element.parentNode)?void 0:t.contains(e.relatedTarget))||(null==e?void 0:e.relatedTarget)!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!(null==t?void 0:t.selection.eq(e.state.selection)),r=!(null==t?void 0:t.doc.eq(e.state.doc));(n||r)&&(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;!i&&(t||n)&&(this.getShouldShow(r)?(this.show(),this.updatePosition()):this.hide())},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);"updatePosition"===t?this.updatePosition():t&&"object"==typeof t&&"updateOptions"===t.type?this.updateOptions(t.options):"hide"===t?this.hide():"show"===t&&(this.updatePosition(),this.show())},this.editor=e,this.element=n,this.view=r,this.pluginKey=i,this.updateDelay=o,this.resizeDelay=s,this.appendTo=l,this.scrollTarget=null!=(u=null==d?void 0:d.scrollTarget)?u:window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...d},this.element.tabIndex=0,a&&(this.shouldShow=a),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(r,r.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push((0,n.flip)("boolean"!=typeof this.floatingUIOptions.flip?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push((0,n.shift)("boolean"!=typeof this.floatingUIOptions.shift?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push((0,n.offset)("boolean"!=typeof this.floatingUIOptions.offset?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push((0,n.arrow)(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push((0,n.size)("boolean"!=typeof this.floatingUIOptions.size?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push((0,n.autoPlacement)("boolean"!=typeof this.floatingUIOptions.autoPlacement?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push((0,n.hide)("boolean"!=typeof this.floatingUIOptions.hide?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push((0,n.inline)("boolean"!=typeof this.floatingUIOptions.inline?this.floatingUIOptions.inline:void 0)),e}get virtualElement(){var e,n,o,s,a;let{selection:l}=this.editor.state,c=null==(e=this.getReferencedVirtualElement)?void 0:e.call(this);if(c)return c;if(!(null==(o=null==(n=this.view)?void 0:n.dom)?void 0:o.parentNode))return;let d=(0,t.posToDOMRect)(this.view,l.from,l.to),u={getBoundingClientRect:()=>d,getClientRects:()=>[d]};if(l instanceof r.NodeSelection){let e=this.view.nodeDOM(l.from),t=e.dataset.nodeViewWrapper?e:e.querySelector("[data-node-view-wrapper]");t&&(e=t),e&&(u={getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>[e.getBoundingClientRect()]})}if(l instanceof i.CellSelection){let e,t,n,{$anchorCell:r,$headCell:i}=l,o=r?r.pos:i.pos,c=i?i.pos:r.pos,d=this.view.nodeDOM(o),h=this.view.nodeDOM(c);if(!d||!h)return;let p=d===h?d.getBoundingClientRect():(s=d.getBoundingClientRect(),a=h.getBoundingClientRect(),e=Math.min(s.top,a.top),t=Math.max(s.bottom,a.bottom),n=Math.min(s.left,a.left),new DOMRect(n,e,Math.max(s.right,a.right)-n,t-e));u={getBoundingClientRect:()=>p,getClientRects:()=>[p]}}return u}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&(0,n.computePosition)(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{var i,o;if(this.isVisible&&!this.editor.isDestroyed&&this.element.isConnected){if((null==(i=r.hide)?void 0:i.referenceHidden)||(null==(o=r.hide)?void 0:o.escaped)){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r)return void this.handleDebouncedUpdate(e,t);let i=!(null==t?void 0:t.selection.eq(e.state.selection)),o=!(null==t?void 0:t.doc.eq(e.state.doc));this.updateHandler(e,i,o,t)}getShouldShow(e){var t;let{state:n}=this.view,{selection:r}=n,{ranges:i}=r,o=Math.min(...i.map(e=>e.$from.pos)),s=Math.max(...i.map(e=>e.$to.pos));return(null==(t=this.shouldShow)?void 0:t.call(this,{editor:this.editor,element:this.element,view:this.view,state:n,oldState:e,from:o,to:s}))||!1}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";let t="function"==typeof this.appendTo?this.appendTo():this.appendTo;null==(e=null!=t?t:this.view.dom.parentElement)||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(e){var t;if(void 0!==e.updateDelay&&(this.updateDelay=e.updateDelay),void 0!==e.resizeDelay&&(this.resizeDelay=e.resizeDelay),void 0!==e.appendTo&&(this.appendTo=e.appendTo),void 0!==e.getReferencedVirtualElement&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),void 0!==e.shouldShow&&e.shouldShow&&(this.shouldShow=e.shouldShow),void 0!==e.options){let n=null!=(t=e.options.scrollTarget)?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},s=e=>new r.Plugin({key:"string"==typeof e.pluginKey?new r.PluginKey(e.pluginKey):e.pluginKey,view:t=>new o({view:t,...e})});t.Extension.create({name:"bubbleMenu",addOptions:()=>({element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}),addProseMirrorPlugins(){return this.options.element?[s({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var a=e.i(885047),l=e.i(101685),c=e.i(380560),d=class{constructor({editor:e,element:t,view:n,pluginKey:r="floatingMenu",updateDelay:i=250,resizeDelay:o=60,options:s,appendTo:a,shouldShow:l}){var c;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,o=1===r.depth,s=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&0===r.parent.childCount&&!this.getTextContent(r.parent);return!!e.hasFocus()&&!!i&&!!o&&!!s&&!!this.editor.isEditable},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;!i&&(t||n)&&(this.getShouldShow(r)?(this.updatePosition(),this.show()):this.hide())},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{var t;if(this.preventHide){this.preventHide=!1;return}(null==e?void 0:e.relatedTarget)&&(null==(t=this.element.parentNode)?void 0:t.contains(e.relatedTarget))||(null==e?void 0:e.relatedTarget)!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);"updatePosition"===t?this.updatePosition():t&&"object"==typeof t&&"updateOptions"===t.type?this.updateOptions(t.options):"hide"===t?this.hide():"show"===t&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=o,this.appendTo=a,this.scrollTarget=null!=(c=null==s?void 0:s.scrollTarget)?c:window,this.floatingUIOptions={...this.floatingUIOptions,...s},this.element.tabIndex=0,l&&(this.shouldShow=l),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return(0,t.getText)(e,{textSerializers:(0,t.getTextSerializersFromSchema)(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push((0,n.flip)("boolean"!=typeof this.floatingUIOptions.flip?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push((0,n.shift)("boolean"!=typeof this.floatingUIOptions.shift?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push((0,n.offset)("boolean"!=typeof this.floatingUIOptions.offset?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push((0,n.arrow)(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push((0,n.size)("boolean"!=typeof this.floatingUIOptions.size?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push((0,n.autoPlacement)("boolean"!=typeof this.floatingUIOptions.autoPlacement?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push((0,n.hide)("boolean"!=typeof this.floatingUIOptions.hide?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push((0,n.inline)("boolean"!=typeof this.floatingUIOptions.inline?this.floatingUIOptions.inline:void 0)),e}getShouldShow(e){var t;let{state:n}=this.view,{selection:r}=n,{ranges:i}=r,o=Math.min(...i.map(e=>e.$from.pos)),s=Math.max(...i.map(e=>e.$to.pos));return null==(t=this.shouldShow)?void 0:t.call(this,{editor:this.editor,view:this.view,state:n,oldState:e,from:o,to:s})}updateOptions(e){var t;if(void 0!==e.updateDelay&&(this.updateDelay=e.updateDelay),void 0!==e.resizeDelay&&(this.resizeDelay=e.resizeDelay),void 0!==e.appendTo&&(this.appendTo=e.appendTo),void 0!==e.shouldShow&&e.shouldShow&&(this.shouldShow=e.shouldShow),void 0!==e.options){let n=null!=(t=e.options.scrollTarget)?t:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){var e,r;if(!(null==(r=null==(e=this.view)?void 0:e.dom)?void 0:r.parentNode))return;let{selection:i}=this.editor.state,o=(0,t.posToDOMRect)(this.view,i.from,i.to);(0,n.computePosition)({getBoundingClientRect:()=>o,getClientRects:()=>[o]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{var i,o;if((null==(i=r.hide)?void 0:i.referenceHidden)||(null==(o=r.hide)?void 0:o.escaped)){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!(null==t?void 0:t.selection.eq(e.state.selection)),r=!(null==t?void 0:t.doc.eq(e.state.doc));this.updateHandler(e,n,r,t)}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";let t="function"==typeof this.appendTo?this.appendTo():this.appendTo;null==(e=null!=t?t:this.view.dom.parentElement)||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},u=e=>new r.Plugin({key:"string"==typeof e.pluginKey?new r.PluginKey(e.pluginKey):e.pluginKey,view:t=>new d({view:t,...e})});function h(e,t){return null!=e?e:new r.PluginKey(t)}t.Extension.create({name:"floatingMenu",addOptions:()=>({element:null,options:{},pluginKey:"floatingMenu",updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}),addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,"updatePosition"),!0)}},addProseMirrorPlugins(){return this.options.element?[u({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});var p="u">typeof window?l.useLayoutEffect:l.useEffect,f=new Set(["left","opacity","position","top","visibility","width"]),m=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","columnCount","columns","fillOpacity","flex","flexGrow","flexShrink","fontWeight","gridArea","gridColumn","gridColumnEnd","gridColumnStart","gridRow","gridRowEnd","gridRowStart","lineClamp","lineHeight","opacity","order","orphans","scale","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","tabSize","widows","zIndex","zoom"]),g=new Set(["children","className","style"]),y=new Set(["tabIndex"]),b=new Set(["accessKey","autoCapitalize","contentEditable","contextMenu","dir","draggable","enterKeyHint","hidden","id","lang","nonce","role","slot","spellCheck","tabIndex","title","translate"]),v={Blur:"focusout",DoubleClick:"dblclick",Focus:"focusin",MouseEnter:"mouseenter",MouseLeave:"mouseleave"};function w(e,t){return/^on[A-Z]/.test(e)&&"function"==typeof t}function x(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function k(e,t,n){if("tabIndex"===t){e.tabIndex=Number(n);return}e[t]=n}function S(e,t){let n=(0,l.useRef)({}),r=(0,l.useRef)([]);p(()=>{var i,o,s;let a,l,c,d=n.current;return!function(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute("class")}}(e,d.className,t.className),i=d.style,o=t.style,a=null!=i?i:{},l=null!=o?o:{},new Set([...Object.keys(a),...Object.keys(l)]).forEach(t=>{let n=a[t],r=l[t];if(n!==r){if(null==r)return void(!f.has(t)&&e.style.removeProperty(x(t)));f.has(t)||e.style.setProperty(x(t),"number"!=typeof r||0===r||t.startsWith("--")||m.has(t)?String(r):`${r}px`)}}),new Set([...Object.keys(d),...Object.keys(t)]).forEach(n=>{if(g.has(n)||!(n.startsWith("aria-")||n.startsWith("data-")||b.has(n))||w(n,d[n])||w(n,t[n]))return;let r=d[n],i=t[n];if(r===i)return;let o=(n.startsWith("aria-")||n.startsWith("data-"),n);if(null==i||!1===i){y.has(n)&&function(e,t){if("tabIndex"===t)return e.removeAttribute("tabindex");let n=e[t];if("boolean"==typeof n){e[t]=!1;return}if("number"==typeof n){e[t]=0;return}e[t]=""}(e,n),e.removeAttribute(o);return}if(!0===i){y.has(n)&&k(e,n,!0),e.setAttribute(o,"");return}y.has(n)?k(e,n,i):e.setAttribute(o,String(i))}),s=r.current,s.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)}),c=[],Object.entries(t).forEach(([t,n])=>{var r;let i,o;if(!w(t,n))return;let{eventName:s,options:a}={eventName:null!=(r=v[o=((i=t.endsWith("Capture"))?t.slice(0,-7):t).slice(2)])?r:o.toLowerCase(),options:i?{capture:!0}:void 0},l=t=>{let r,i,o;n((r=t.defaultPrevented,i=!1,Object.defineProperties(o=Object.create(t),{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>void 0},isDefaultPrevented:{value:()=>r},isPropagationStopped:{value:()=>i},preventDefault:{value:()=>{r=!0,t.preventDefault()}},stopPropagation:{value:()=>{i=!0,t.stopPropagation()}}}),o))};e.addEventListener(s,l,a),c.push({eventName:s,listener:l,options:a})}),r.current=c,n.current=t,()=>{r.current.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)}),r.current=[]}},[e,t])}var C=l.default.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:o=null,getReferencedVirtualElement:d,options:u,children:p,...f},m)=>{let g=(0,l.useRef)(document.createElement("div")),y=(0,l.useRef)(h(e,"bubbleMenu")).current;S(g.current,f),"function"==typeof m?m(g.current):m&&(m.current=g.current);let{editor:b}=(0,a.useCurrentEditor)(),v=t||b,w={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:y,shouldShow:o,getReferencedVirtualElement:d,options:u},x=(0,l.useRef)(w);x.current=w;let[k,C]=(0,l.useState)(!1),E=(0,l.useRef)(!0);return(0,l.useEffect)(()=>{if(null==v?void 0:v.isDestroyed)return;if(!v)return void console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");let e=g.current;e.style.visibility="hidden",e.style.position="absolute";let t=s({...x.current,editor:v,element:e});v.registerPlugin(t);let n=x.current.pluginKey;return E.current=!0,C(!0),()=>{C(!1),v.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[v]),(0,l.useEffect)(()=>{if(k&&v&&!v.isDestroyed){if(E.current){E.current=!1;return}v.view.dispatch(v.state.tr.setMeta(y,{type:"updateOptions",options:x.current}))}},[k,v,n,r,o,u,i,d,y]),(0,c.createPortal)(p,g.current)});l.default.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:o=null,options:s,children:d,...p},f)=>{let m=(0,l.useRef)(document.createElement("div")),g=(0,l.useRef)(h(e,"floatingMenu")).current;S(m.current,p),"function"==typeof f?f(m.current):f&&(f.current=m.current);let{editor:y}=(0,a.useCurrentEditor)(),b=t||y,v={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:g,shouldShow:o,options:s},w=(0,l.useRef)(v);w.current=v;let[x,k]=(0,l.useState)(!1),C=(0,l.useRef)(!0);return(0,l.useEffect)(()=>{if(null==b?void 0:b.isDestroyed)return;if(!b)return void console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");let e=m.current;e.style.visibility="hidden",e.style.position="absolute";let t=u({...w.current,editor:b,element:e});b.registerPlugin(t);let n=w.current.pluginKey;return C.current=!0,k(!0),()=>{k(!1),b.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[b]),(0,l.useEffect)(()=>{if(x&&b&&!b.isDestroyed){if(C.current){C.current=!1;return}b.view.dispatch(b.state.tr.setMeta(g,{type:"updateOptions",options:w.current}))}},[x,b,n,r,o,s,i,g]),(0,c.createPortal)(d,m.current)}),e.s(["BubbleMenu",0,C],153840);var E=e.i(605993);let M=(0,E.default)("align-center",[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);e.s(["AlignCenter",0,M],580330);let N=(0,E.default)("align-justify",[["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M3 6h18",key:"d0wm0j"}]]);e.s(["AlignJustify",0,N],792934);let A=(0,E.default)("align-left",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);e.s(["AlignLeft",0,A],85741);let T=(0,E.default)("align-right",[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);e.s(["AlignRight",0,T],464675);let R=(0,E.default)("bold",[["path",{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",key:"mg9rjx"}]]);e.s(["Bold",0,R],419943);let O=(0,E.default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);e.s(["Code",0,O],674155);let D=(0,E.default)("italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);e.s(["Italic",0,D],425275);let j=(0,E.default)("message-circle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);e.s(["MessageCircle",0,j],891734);let I=(0,E.default)("message-square-plus",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);e.s(["MessageSquarePlus",0,I],187080);let P=(0,E.default)("strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);e.s(["Strikethrough",0,P],253190);let L=(0,E.default)("subscript",[["path",{d:"m4 5 8 8",key:"1eunvl"}],["path",{d:"m12 5-8 8",key:"1ah0jp"}],["path",{d:"M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07",key:"e8ta8j"}]]);e.s(["Subscript",0,L],73313);let z=(0,E.default)("superscript",[["path",{d:"m4 19 8-8",key:"hr47gm"}],["path",{d:"m12 19-8-8",key:"1dhhmo"}],["path",{d:"M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06",key:"1dfcux"}]]);e.s(["Superscript",0,z],736586);let _=(0,E.default)("underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]);e.s(["Underline",0,_],132807);let $=(0,E.default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);e.s(["ExternalLink",0,$],412473)},582612,933850,987027,307154,148623,395330,398441,977112,e=>{"use strict";var t=e.i(44501),n=e.i(153840),r=e.i(580330),i=e.i(792934),o=e.i(85741),s=e.i(464675),a=e.i(419943),l=e.i(674155),c=e.i(425275),d=e.i(702166),u=e.i(891734),h=e.i(187080),p=e.i(253190),f=e.i(73313),m=e.i(736586),g=e.i(132807),y=e.i(101685),b=e.i(975157),v=e.i(412473),w=e.i(920978);function x({anchor:e,initialUrl:n="",onCancel:r,onApply:i,onRemove:o}){let[s,a]=(0,y.useState)(n);(0,y.useEffect)(()=>{let e=e=>{"Escape"===e.key&&r()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[r]);let l=()=>{let e=s.trim();e?i(e):r()};return(0,t.jsxs)("div",{className:"absolute z-50 w-[340px] bg-popover border border-border rounded-lg shadow-xl overflow-hidden",style:{top:e.top,left:e.left},onMouseDown:e=>e.stopPropagation(),children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-[12px] font-medium",children:[(0,t.jsx)(d.Link,{className:"w-3.5 h-3.5"}),n?"Edit link":"Add link"]}),(0,t.jsx)("button",{type:"button",onClick:r,className:"text-[11px] text-muted-foreground hover:text-foreground",children:"Cancel"})]}),(0,t.jsxs)("div",{className:"p-3 space-y-2",children:[(0,t.jsx)("input",{type:"url",autoFocus:!0,value:s,placeholder:"https://example.com",onChange:e=>a(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),l())},className:"w-full bg-background border border-border rounded-md px-2.5 py-1.5 text-[12px] focus:outline-none focus:ring-2 focus:ring-primary/30"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("button",{type:"button",onClick:l,disabled:!s.trim(),className:"flex-1 py-1.5 text-[12px] rounded-md bg-primary text-primary-foreground disabled:opacity-50 hover:bg-primary/90",children:n?"Update":"Add link"}),n&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("a",{href:n,target:"_blank",rel:"noreferrer noopener",className:"p-1.5 rounded-md border border-border hover:bg-accent text-muted-foreground hover:text-foreground",title:"Open link",children:(0,t.jsx)(v.ExternalLink,{className:"w-3.5 h-3.5"})}),o&&(0,t.jsx)("button",{type:"button",onClick:o,className:"p-1.5 rounded-md border border-border hover:bg-accent text-destructive",title:"Remove link",children:(0,t.jsx)(w.Trash2,{className:"w-3.5 h-3.5"})})]})]})]})]})}e.s(["LinkPopover",0,x],933850),e.s(["EditorBubbleMenu",0,function({editor:e,onSuggestEdit:v,onComment:w,readOnly:k}){let[S,C]=(0,y.useState)(null);if((0,y.useEffect)(()=>{if(!S)return;let e=e=>{let t=e.target;t?.closest("[data-bubble-popover='true']")||C(null)},t=window.setTimeout(()=>window.addEventListener("mousedown",e),10);return()=>{window.clearTimeout(t),window.removeEventListener("mousedown",e)}},[S]),!e)return null;let E=e=>(0,b.cn)("h-9 w-9 sm:h-7 sm:w-7 flex items-center justify-center rounded hover:bg-accent text-foreground/80 transition-colors",e&&"bg-accent text-foreground"),M=()=>{let{from:t,to:n}=e.state.selection;return{from:t,to:n}},N=t=>e.chain().focus().setTextSelection(t).run(),A=e=>t=>{t.preventDefault(),e()},T=t=>{S?.type==="align"&&(N(S.range),e.chain().focus().setTextAlign(t).run(),C(null))};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.BubbleMenu,{editor:e,options:{placement:"top",offset:8},className:"flex items-center gap-0.5 px-1 py-1 bg-popover border border-border rounded-sm shadow-lg",children:[!k&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{type:"button",className:E(e.isActive("bold")),onMouseDown:e=>e.preventDefault(),onClick:A(()=>e.chain().focus().toggleBold().run()),"aria-label":"Bold",children:(0,t.jsx)(a.Bold,{className:"w-3.5 h-3.5"})}),(0,t.jsx)("button",{type:"button",className:E(e.isActive("italic")),onMouseDown:e=>e.preventDefault(),onClick:A(()=>e.chain().focus().toggleItalic().run()),"aria-label":"Italic",children:(0,t.jsx)(c.Italic,{className:"w-3.5 h-3.5"})}),(0,t.jsx)("button",{type:"button",className:E(e.isActive("underline")),onMouseDown:e=>e.preventDefault(),onClick:A(()=>e.chain().focus().toggleUnderline().run()),"aria-label":"Underline",children:(0,t.jsx)(g.Underline,{className:"w-3.5 h-3.5"})}),(0,t.jsx)("button",{type:"button",className:E(e.isActive("strike")),onMouseDown:e=>e.preventDefault(),onClick:A(()=>e.chain().focus().toggleStrike().run()),"aria-label":"Strikethrough",children:(0,t.jsx)(p.Strikethrough,{className:"w-3.5 h-3.5"})}),(0,t.jsx)("button",{type:"button",className:E(e.isActive("code")),onMouseDown:e=>e.preventDefault(),onClick:A(()=>e.chain().focus().toggleCode().run()),"aria-label":"Inline code",children:(0,t.jsx)(l.Code,{className:"w-3.5 h-3.5"})}),(0,t.jsx)("div",{className:"w-px h-5 bg-border mx-1"}),(0,t.jsx)("button",{type:"button",className:E(e.isActive("superscript")),onMouseDown:e=>e.preventDefault(),onClick:A(()=>e.chain().focus().toggleSuperscript().run()),"aria-label":"Superscript",children:(0,t.jsx)(m.Superscript,{className:"w-3.5 h-3.5"})}),(0,t.jsx)("button",{type:"button",className:E(e.isActive("subscript")),onMouseDown:e=>e.preventDefault(),onClick:A(()=>e.chain().focus().toggleSubscript().run()),"aria-label":"Subscript",children:(0,t.jsx)(f.Subscript,{className:"w-3.5 h-3.5"})}),(0,t.jsx)("div",{className:"w-px h-5 bg-border mx-1"}),(0,t.jsx)("button",{type:"button",className:E(e.isActive("link")),onMouseDown:e=>e.preventDefault(),onClick:t=>{t.preventDefault();let n=e.getAttributes("link")?.href??"",r=t.currentTarget.getBoundingClientRect();C({type:"link",range:M(),existing:n,anchor:{top:r.bottom+6,left:r.left}})},"aria-label":"Link",children:(0,t.jsx)(d.Link,{className:"w-3.5 h-3.5"})}),(v||w)&&(0,t.jsx)("div",{className:"w-px h-5 bg-border mx-1"}),w&&(0,t.jsx)("button",{type:"button",className:E(!1),onMouseDown:e=>e.preventDefault(),onClick:e=>{e.preventDefault(),w()},"aria-label":"Comment",title:"Comment",children:(0,t.jsx)(u.MessageCircle,{className:"w-3.5 h-3.5"})}),v&&(0,t.jsx)("button",{type:"button",className:E(!1),onMouseDown:e=>e.preventDefault(),onClick:e=>{e.preventDefault(),v()},"aria-label":"Suggest edit",title:"Suggest edit",children:(0,t.jsx)(h.MessageSquarePlus,{className:"w-3.5 h-3.5"})}),(0,t.jsx)("div",{className:"w-px h-5 bg-border mx-1"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("button",{type:"button",className:E(!1),onMouseDown:e=>e.preventDefault(),onClick:e=>{e.preventDefault(),C({type:"align",range:M()})},"aria-label":"Align",children:(0,t.jsx)(o.AlignLeft,{className:"w-3.5 h-3.5"})}),S?.type==="align"&&(0,t.jsxs)("div",{"data-bubble-popover":"true",className:"absolute top-full left-0 mt-1 z-50 bg-popover border border-border rounded-sm shadow-lg p-1 flex gap-0.5",children:[(0,t.jsx)("button",{type:"button",className:E(e.isActive({textAlign:"left"})),onMouseDown:e=>e.preventDefault(),onClick:()=>T("left"),"aria-label":"Align left",children:(0,t.jsx)(o.AlignLeft,{className:"w-3.5 h-3.5"})}),(0,t.jsx)("button",{type:"button",className:E(e.isActive({textAlign:"center"})),onMouseDown:e=>e.preventDefault(),onClick:()=>T("center"),"aria-label":"Align center",children:(0,t.jsx)(r.AlignCenter,{className:"w-3.5 h-3.5"})}),(0,t.jsx)("button",{type:"button",className:E(e.isActive({textAlign:"right"})),onMouseDown:e=>e.preventDefault(),onClick:()=>T("right"),"aria-label":"Align right",children:(0,t.jsx)(s.AlignRight,{className:"w-3.5 h-3.5"})}),(0,t.jsx)("button",{type:"button",className:E(e.isActive({textAlign:"justify"})),onMouseDown:e=>e.preventDefault(),onClick:()=>T("justify"),"aria-label":"Justify",children:(0,t.jsx)(i.AlignJustify,{className:"w-3.5 h-3.5"})})]})]})]}),k&&w&&(0,t.jsx)("button",{type:"button",className:E(!1),onMouseDown:e=>e.preventDefault(),onClick:e=>{e.preventDefault(),w()},"aria-label":"Comment",title:"Add comment",children:(0,t.jsx)(u.MessageCircle,{className:"w-3.5 h-3.5"})})]}),S?.type==="link"&&(0,t.jsx)("div",{"data-bubble-popover":"true",style:{position:"fixed",top:S.anchor.top,left:S.anchor.left,zIndex:60},children:(0,t.jsx)(x,{anchor:{top:0,left:0},initialUrl:S.existing,onCancel:()=>C(null),onApply:t=>{S?.type==="link"&&(N(S.range),e.chain().focus().extendMarkRange("link").setLink({href:t}).run(),C(null))},onRemove:S.existing?()=>{S?.type==="link"&&(N(S.range),e.chain().focus().unsetLink().run(),C(null))}:void 0})})]})}],582612);var k=e.i(605993);let S=(0,k.default)("square-check-big",[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);e.s(["CheckSquare",0,S],987027);let C=(0,k.default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);e.s(["ChevronLeft",0,C],307154);let E=(0,k.default)("file-code",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);e.s(["FileCode",0,E],148623);let M=(0,k.default)("heading-1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]);e.s(["Heading1",0,M],395330);let N=(0,k.default)("heading-2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);e.s(["Heading2",0,N],398441);let A=(0,k.default)("heading-3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);e.s(["Heading3",0,A],977112)},799916,853840,864255,991685,67667,733716,703550,492622,579767,978375,750110,772436,374435,e=>{"use strict";var t=e.i(375707);e.s(["ImageIcon",()=>t.default],799916);var n=e.i(605993);let r=(0,n.default)("list",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);e.s(["List",0,r],853840);let i=(0,n.default)("list-ordered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);e.s(["ListOrdered",0,i],864255);let o=(0,n.default)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);e.s(["Minus",0,o],991685);let s=(0,n.default)("pilcrow-left",[["path",{d:"M14 3v11",key:"mlfb7b"}],["path",{d:"M14 9h-3a3 3 0 0 1 0-6h9",key:"1ulc19"}],["path",{d:"M18 3v11",key:"1phi0r"}],["path",{d:"M22 18H2l4-4",key:"yt65j9"}],["path",{d:"m6 22-4-4",key:"6jgyf5"}]]);e.s(["PilcrowLeft",0,s],67667);let a=(0,n.default)("pilcrow-right",[["path",{d:"M10 3v11",key:"o3l5kj"}],["path",{d:"M10 9H7a1 1 0 0 1 0-6h8",key:"1wb1nc"}],["path",{d:"M14 3v11",key:"mlfb7b"}],["path",{d:"m18 14 4 4H2",key:"4r8io1"}],["path",{d:"m22 18-4 4",key:"1hjjrd"}]]);e.s(["PilcrowRight",0,a],733716);let l=(0,n.default)("quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);e.s(["Quote",0,l],703550);let c=(0,n.default)("redo",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);e.s(["Redo",0,c],492622);let d=(0,n.default)("undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]);e.s(["Undo",0,d],579767);let u=(0,n.default)("video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);e.s(["Video",0,u],978375);var h=e.i(44501),p=e.i(101685);e.i(380560);var f=e.i(206102),m=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let n=(0,f.createSlot)(`Primitive.${t}`),r=p.forwardRef((e,r)=>{let{asChild:i,...o}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,h.jsx)(i?n:t,{...o,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});e.s(["Primitive",0,m],750110);var g="horizontal",y=["horizontal","vertical"],b=p.forwardRef((e,t)=>{var n;let{decorative:r,orientation:i=g,...o}=e,s=(n=i,y.includes(n))?i:g;return(0,h.jsx)(m.div,{"data-orientation":s,...r?{role:"none"}:{"aria-orientation":"vertical"===s?s:void 0,role:"separator"},...o,ref:t})});b.displayName="Separator";var v=e.i(975157);let w=p.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},i)=>(0,h.jsx)(b,{ref:i,decorative:n,orientation:t,className:(0,v.cn)("shrink-0 bg-border","horizontal"===t?"h-[1px] w-full":"h-full w-[1px]",e),...r}));w.displayName=b.displayName,e.s(["Separator",0,w],772436);let x=(0,n.default)("clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]);e.s(["Clipboard",0,x],374435)},454184,(e,t,n)=>{class r{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function i(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function o(e,...t){let n=Object.create(null);for(let t in e)n[t]=e[t];return t.forEach(function(e){for(let t in e)n[t]=e[t]}),n}class s{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=i(e)}openNode(e){if(!e.scope)return;let t=((e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){let n=e.split(".");return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${"_".repeat(t+1)}`)].join(" ")}return`${t}${e}`})(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){e.scope&&(this.buffer+="</span>")}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}}let a=(e={})=>{let t={children:[]};return Object.assign(t,e),t};class l{constructor(){this.rootNode=a(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t=a({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(e){"string"==typeof e||e.children&&(e.children.every(e=>"string"==typeof e)?e.children=[e.children.join("")]:e.children.forEach(e=>{l._collapse(e)}))}}class c extends l{constructor(e){super(),this.options=e}addText(e){""!==e&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){let n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new s(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function d(e){return e?"string"==typeof e?e:e.source:null}function u(e){return f("(?=",e,")")}function h(e){return f("(?:",e,")*")}function p(e){return f("(?:",e,")?")}function f(...e){return e.map(e=>d(e)).join("")}function m(...e){let t;return"("+(("object"==typeof(t=e[e.length-1])&&t.constructor===Object?(e.splice(e.length-1,1),t):{}).capture?"":"?:")+e.map(e=>d(e)).join("|")+")"}function g(e){return RegExp(e.toString()+"|").exec("").length-1}let y=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function b(e,{joinWith:t}){let n=0;return e.map(e=>{let t=n+=1,r=d(e),i="";for(;r.length>0;){let e=y.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?i+="\\"+String(Number(e[1])+t):(i+=e[0],"("===e[0]&&n++)}return i}).map(e=>`(${e})`).join(t)}let v="[a-zA-Z]\\w*",w="[a-zA-Z_]\\w*",x="\\b\\d+(\\.\\d+)?",k="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",S="\\b(0b[01]+)",C={begin:"\\\\[\\s\\S]",relevance:0},E=function(e,t,n={}){let r=o({scope:"comment",begin:e,end:t,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=m("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:f(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},M=E("//","$"),N=E("/\\*","\\*/"),A=E("#","$");var T=Object.freeze({__proto__:null,APOS_STRING_MODE:{scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[C]},BACKSLASH_ESCAPE:C,BINARY_NUMBER_MODE:{scope:"number",begin:S,relevance:0},BINARY_NUMBER_RE:S,COMMENT:E,C_BLOCK_COMMENT_MODE:N,C_LINE_COMMENT_MODE:M,C_NUMBER_MODE:{scope:"number",begin:k,relevance:0},C_NUMBER_RE:k,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:A,IDENT_RE:v,MATCH_NOTHING_RE:/\b\B/,METHOD_GUARD:{begin:"\\.\\s*"+w,relevance:0},NUMBER_MODE:{scope:"number",begin:x,relevance:0},NUMBER_RE:x,PHRASAL_WORDS_MODE:{begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},QUOTE_STRING_MODE:{scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[C]},REGEXP_MODE:{scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[C,{begin:/\[/,end:/\]/,relevance:0,contains:[C]}]},RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",SHEBANG:(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=f(t,/.*\b/,e.binary,/\b.*/)),o({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{0!==e.index&&t.ignoreMatch()}},e)},TITLE_MODE:{scope:"title",begin:v,relevance:0},UNDERSCORE_IDENT_RE:w,UNDERSCORE_TITLE_MODE:{scope:"title",begin:w,relevance:0}});function R(e,t){"."===e.input[e.index-1]&&t.ignoreMatch()}function O(e,t){void 0!==e.className&&(e.scope=e.className,delete e.className)}function D(e,t){!t||e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=R,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,void 0===e.relevance&&(e.relevance=0))}function j(e,t){Array.isArray(e.illegal)&&(e.illegal=m(...e.illegal))}function I(e,t){if(e.match){if(e.begin||e.end)throw Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function P(e,t){void 0===e.relevance&&(e.relevance=1)}let L=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw Error("beforeMatch cannot be used with starts");let n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=f(n.beforeMatch,u(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},z=["of","and","for","in","not","or","if","then","parent","list","value"],_={},$=e=>{console.error(e)},H=(e,...t)=>{console.log(`WARN: ${e}`,...t)},B=(e,t)=>{_[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),_[`${e}/${t}`]=!0)},F=Error();function V(e,t,{key:n}){let r=0,i=e[n],o={},s={};for(let e=1;e<=t.length;e++)s[e+r]=i[e],o[e+r]=!0,r+=g(t[e-1]);e[n]=s,e[n]._emit=o,e[n]._multi=!0}function U(e){if(e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope,delete e.scope),"string"==typeof e.beginScope&&(e.beginScope={_wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope}),Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw $("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),F;if("object"!=typeof e.beginScope||null===e.beginScope)throw $("beginScope must be object"),F;V(e,e.begin,{key:"beginScope"}),e.begin=b(e.begin,{joinWith:""})}if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw $("skip, excludeEnd, returnEnd not compatible with endScope: {}"),F;if("object"!=typeof e.endScope||null===e.endScope)throw $("endScope must be object"),F;V(e,e.end,{key:"endScope"}),e.end=b(e.end,{joinWith:""})}}class W extends Error{constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}}let K=Symbol("nomatch"),q=function(e){let t=Object.create(null),n=Object.create(null),s=[],a=!0,l="Could not find the language '{}', did you forget to load/include a language module?",y={disableAutodetect:!0,name:"Plain text",contains:[]},v={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:c};function w(e){return v.noHighlightRe.test(e)}function x(e,t,n){let r="",i="";"object"==typeof t?(r=e,n=t.ignoreIllegals,i=t.language):(B("10.7.0","highlight(lang, code, ...args) has been deprecated."),B("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),i=e,r=t),void 0===n&&(n=!0);let o={code:r,language:i};_("before:highlight",o);let s=o.result?o.result:k(o.language,o.code,n);return s.code=o.code,_("after:highlight",s),s}function k(e,n,s,c){let u=Object.create(null);function h(){if(!A.keywords)return void R.addText(H);let e=0;A.keywordPatternRe.lastIndex=0;let t=A.keywordPatternRe.exec(H),n="";for(;t;){n+=H.substring(e,t.index);let r=C.case_insensitive?t[0].toLowerCase():t[0],i=A.keywords[r];if(i){let[e,o]=i;if(R.addText(n),n="",u[r]=(u[r]||0)+1,u[r]<=7&&(B+=o),e.startsWith("_"))n+=t[0];else{let n=C.classNameAliases[e]||e;f(t[0],n)}}else n+=t[0];e=A.keywordPatternRe.lastIndex,t=A.keywordPatternRe.exec(H)}n+=H.substring(e),R.addText(n)}function p(){null!=A.subLanguage?function(){if(""===H)return;let e=null;if("string"==typeof A.subLanguage){if(!t[A.subLanguage])return R.addText(H);e=k(A.subLanguage,H,!0,T[A.subLanguage]),T[A.subLanguage]=e._top}else e=S(H,A.subLanguage.length?A.subLanguage:null);A.relevance>0&&(B+=e.relevance),R.__addSublanguage(e._emitter,e.language)}():h(),H=""}function f(e,t){""!==e&&(R.startScope(t),R.addText(e),R.endScope())}function m(e,t){let n=1,r=t.length-1;for(;n<=r;){if(!e._emit[n]){n++;continue}let r=C.classNameAliases[e[n]]||e[n],i=t[n];r?f(i,r):(H=i,h(),H=""),n++}}function y(e,t){return e.scope&&"string"==typeof e.scope&&R.openNode(C.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(f(H,C.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),H=""):e.beginScope._multi&&(m(e.beginScope,t),H="")),A=Object.create(e,{parent:{value:A}})}let w={};function x(t,i){let o=i&&i[0];if(H+=t,null==o)return p(),0;if("begin"===w.type&&"end"===i.type&&w.index===i.index&&""===o){if(H+=n.slice(i.index,i.index+1),!a){let t=Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=w.rule,t}return 1}if(w=i,"begin"===i.type){let e=i[0],t=i.rule,n=new r(t);for(let r of[t.__beforeBegin,t["on:begin"]])if(r&&(r(i,n),n.isMatchIgnored))return 0===A.matcher.regexIndex?(H+=e[0],1):(W=!0,0);return t.skip?H+=e:(t.excludeBegin&&(H+=e),p(),t.returnBegin||t.excludeBegin||(H=e)),y(t,i),t.returnBegin?0:e.length}if("illegal"!==i.type||s){if("end"===i.type){let e=function(e){let t=e[0],i=n.substring(e.index),o=function e(t,n,i){var o;let s,a=(o=t.endRe,(s=o&&o.exec(i))&&0===s.index);if(a){if(t["on:end"]){let e=new r(t);t["on:end"](n,e),e.isMatchIgnored&&(a=!1)}if(a){for(;t.endsParent&&t.parent;)t=t.parent;return t}}if(t.endsWithParent)return e(t.parent,n,i)}(A,e,i);if(!o)return K;let s=A;A.endScope&&A.endScope._wrap?(p(),f(t,A.endScope._wrap)):A.endScope&&A.endScope._multi?(p(),m(A.endScope,e)):s.skip?H+=t:(s.returnEnd||s.excludeEnd||(H+=t),p(),s.excludeEnd&&(H=t));do A.scope&&R.closeNode(),A.skip||A.subLanguage||(B+=A.relevance),A=A.parent;while(A!==o.parent)return o.starts&&y(o.starts,e),s.returnEnd?0:t.length}(i);if(e!==K)return e}}else{let e=Error('Illegal lexeme "'+o+'" for mode "'+(A.scope||"<unnamed>")+'"');throw e.mode=A,e}if("illegal"===i.type&&""===o)return H+="\n",1;if(V>1e5&&V>3*i.index)throw Error("potential infinite loop, way more iterations than matches");return H+=o,o.length}let C=N(e);if(!C)throw $(l.replace("{}",e)),Error('Unknown language: "'+e+'"');let E=function(e){function t(t,n){return RegExp(d(t),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(n?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=g(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null);let e=this.regexes.map(e=>e[1]);this.matcherRe=t(b(e,{joinWith:"|"}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;let t=this.matcherRe.exec(e);if(!t)return null;let n=t.findIndex((e,t)=>t>0&&void 0!==e),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];let t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){let t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{let t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=o(e.classNameAliases||{}),function n(i,s){let a;if(i.isCompiled)return i;[O,I,U,L].forEach(e=>e(i,s)),e.compilerExtensions.forEach(e=>e(i,s)),i.__beforeBegin=null,[D,j,P].forEach(e=>e(i,s)),i.isCompiled=!0;let l=null;return"object"==typeof i.keywords&&i.keywords.$pattern&&(i.keywords=Object.assign({},i.keywords),l=i.keywords.$pattern,delete i.keywords.$pattern),l=l||/\w+/,i.keywords&&(i.keywords=function e(t,n,r="keyword"){let i=Object.create(null);return"string"==typeof t?o(r,t.split(" ")):Array.isArray(t)?o(r,t):Object.keys(t).forEach(function(r){Object.assign(i,e(t[r],n,r))}),i;function o(e,t){n&&(t=t.map(e=>e.toLowerCase())),t.forEach(function(t){var n,r,o;let s=t.split("|");i[s[0]]=[e,(n=s[0],(r=s[1])?Number(r):+(o=n,!z.includes(o.toLowerCase())))]})}}(i.keywords,e.case_insensitive)),i.keywordPatternRe=t(l,!0),s&&(i.begin||(i.begin=/\B|\b/),i.beginRe=t(i.begin),i.end||i.endsWithParent||(i.end=/\B|\b/),i.end&&(i.endRe=t(i.end)),i.terminatorEnd=d(i.end)||"",i.endsWithParent&&s.terminatorEnd&&(i.terminatorEnd+=(i.end?"|":"")+s.terminatorEnd)),i.illegal&&(i.illegalRe=t(i.illegal)),i.contains||(i.contains=[]),i.contains=[].concat(...i.contains.map(function(e){var t;return((t="self"===e?i:e).variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return o(t,{variants:null},e)})),t.cachedVariants)?t.cachedVariants:!function e(t){return!!t&&(t.endsWithParent||e(t.starts))}(t)?Object.isFrozen(t)?o(t):t:o(t,{starts:t.starts?o(t.starts):null})})),i.contains.forEach(function(e){n(e,i)}),i.starts&&n(i.starts,s),a=new r,i.contains.forEach(e=>a.addRule(e.begin,{rule:e,type:"begin"})),i.terminatorEnd&&a.addRule(i.terminatorEnd,{type:"end"}),i.illegal&&a.addRule(i.illegal,{type:"illegal"}),i.matcher=a,i}(e)}(C),M="",A=c||E,T={},R=new v.__emitter(v),_=[];for(let e=A;e!==C;e=e.parent)e.scope&&_.unshift(e.scope);_.forEach(e=>R.openNode(e));let H="",B=0,F=0,V=0,W=!1;try{if(C.__emitTokens)C.__emitTokens(n,R);else{for(A.matcher.considerAll();;){V++,W?W=!1:A.matcher.considerAll(),A.matcher.lastIndex=F;let e=A.matcher.exec(n);if(!e)break;let t=n.substring(F,e.index),r=x(t,e);F=e.index+r}x(n.substring(F))}return R.finalize(),M=R.toHTML(),{language:e,value:M,relevance:B,illegal:!1,_emitter:R,_top:A}}catch(t){if(t.message&&t.message.includes("Illegal"))return{language:e,value:i(n),illegal:!0,relevance:0,_illegalBy:{message:t.message,index:F,context:n.slice(F-100,F+100),mode:t.mode,resultSoFar:M},_emitter:R};if(a)return{language:e,value:i(n),illegal:!1,relevance:0,errorRaised:t,_emitter:R,_top:A};throw t}}function S(e,n){let r;n=n||v.languages||Object.keys(t);let o=((r={value:i(e),illegal:!1,relevance:0,_top:y,_emitter:new v.__emitter(v)})._emitter.addText(e),r),s=n.filter(N).filter(R).map(t=>k(t,e,!1));s.unshift(o);let[a,l]=s.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(N(e.language).supersetOf===t.language)return 1;else if(N(t.language).supersetOf===e.language)return -1}return 0});return a.secondBest=l,a}function C(e){var t;let r,i=function(e){let t=e.className+" ";t+=e.parentNode?e.parentNode.className:"";let n=v.languageDetectRe.exec(t);if(n){let t=N(n[1]);return t||(H(l.replace("{}",n[1])),H("Falling back to no-highlight mode for this block.",e)),t?n[1]:"no-highlight"}return t.split(/\s+/).find(e=>w(e)||N(e))}(e);if(w(i))return;if(_("before:highlightElement",{el:e,language:i}),e.dataset.highlighted)return void console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);if(e.children.length>0&&(v.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(e)),v.throwUnescapedHTML))throw new W("One of your code blocks includes unescaped HTML.",e.innerHTML);let o=e.textContent,s=i?x(o,{language:i,ignoreIllegals:!0}):S(o);e.innerHTML=s.value,e.dataset.highlighted="yes",t=s.language,r=i&&n[i]||t,e.classList.add("hljs"),e.classList.add(`language-${r}`),e.result={language:s.language,re:s.relevance,relevance:s.relevance},s.secondBest&&(e.secondBest={language:s.secondBest.language,relevance:s.secondBest.relevance}),_("after:highlightElement",{el:e,result:s,text:o})}let E=!1;function M(){if("loading"===document.readyState){E||window.addEventListener("DOMContentLoaded",function(){M()},!1),E=!0;return}document.querySelectorAll(v.cssSelector).forEach(C)}function N(e){return t[e=(e||"").toLowerCase()]||t[n[e]]}function A(e,{languageName:t}){"string"==typeof e&&(e=[e]),e.forEach(e=>{n[e.toLowerCase()]=t})}function R(e){let t=N(e);return t&&!t.disableAutodetect}function _(e,t){s.forEach(function(n){n[e]&&n[e](t)})}for(let r in Object.assign(e,{highlight:x,highlightAuto:S,highlightAll:M,highlightElement:C,highlightBlock:function(e){return B("10.7.0","highlightBlock will be removed entirely in v12.0"),B("10.7.0","Please use highlightElement now."),C(e)},configure:function(e){v=o(v,e)},initHighlighting:()=>{M(),B("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")},initHighlightingOnLoad:function(){M(),B("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")},registerLanguage:function(n,r){let i=null;try{i=r(e)}catch(e){if($("Language definition for '{}' could not be registered.".replace("{}",n)),a)$(e);else throw e;i=y}i.name||(i.name=n),t[n]=i,i.rawDefinition=r.bind(null,e),i.aliases&&A(i.aliases,{languageName:n})},unregisterLanguage:function(e){for(let r of(delete t[e],Object.keys(n)))n[r]===e&&delete n[r]},listLanguages:function(){return Object.keys(t)},getLanguage:N,registerAliases:A,autoDetection:R,inherit:o,addPlugin:function(e){var t;(t=e)["before:highlightBlock"]&&!t["before:highlightElement"]&&(t["before:highlightElement"]=e=>{t["before:highlightBlock"](Object.assign({block:e.el},e))}),t["after:highlightBlock"]&&!t["after:highlightElement"]&&(t["after:highlightElement"]=e=>{t["after:highlightBlock"](Object.assign({block:e.el},e))}),s.push(e)},removePlugin:function(e){let t=s.indexOf(e);-1!==t&&s.splice(t,1)}}),e.debugMode=function(){a=!1},e.safeMode=function(){a=!0},e.versionString="11.11.1",e.regex={concat:f,lookahead:u,either:m,optional:p,anyNumberOfTimes:h},T)"object"==typeof T[r]&&function e(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(n=>{let r=t[n],i=typeof r;"object"!==i&&"function"!==i||Object.isFrozen(r)||e(r)}),t}(T[r]);return Object.assign(e,T),e},J=q({});J.newInstance=()=>q({}),t.exports=J,J.HighlightJS=J,J.default=J},240409,512527,944404,334609,265590,441228,576500,194633,32033,623568,42420,278909,532270,503658,185503,993667,314206,388503,284766,965837,582966,25688,770271,e=>{"use strict";var t=e.i(44501),n=e.i(580330),r=e.i(792934),i=e.i(85741),o=e.i(464675),s=e.i(419943),a=e.i(987027),l=e.i(307154),c=e.i(10137),d=e.i(674155),u=e.i(148623),h=e.i(395330),p=e.i(398441),f=e.i(977112),m=e.i(799916),g=e.i(425275),y=e.i(702166),b=e.i(853840),v=e.i(864255),w=e.i(991685),x=e.i(67667),k=e.i(733716),S=e.i(703550),C=e.i(492622),E=e.i(253190),M=e.i(73313),N=e.i(736586),A=e.i(132807),T=e.i(579767),R=e.i(978375),O=e.i(101685),D=e.i(772436),j=e.i(975157),I=e.i(96701),P=e.i(933850),L=e.i(374435),z=e.i(924782),_=e.i(671485);async function $(e,t){let n=new FormData;n.append("file",t);try{let t=await (0,_.wsFetch)(`/api/upload/${e}`,{method:"POST",body:n});if(!t.ok)return null;let r=await t.json();return{url:r.url,filename:r.filename}}catch{return null}}function H({kind:e,pagePath:n,onCancel:r,onInsert:i,anchor:o}){let[s,a]=(0,O.useState)("upload"),[l,c]=(0,O.useState)(""),[d,u]=(0,O.useState)(!1),[h,p]=(0,O.useState)(null),f=(0,O.useRef)(null),m=async e=>{if(e&&0!==e.length){u(!0),p(null);try{let t=e[0],r=await $(n,t);if(!r)return void p("Upload failed.");i({url:r.url,alt:t.name,mimeType:t.type})}finally{u(!1)}}},g=()=>{let e=l.trim();e&&i({url:e})};return(0,t.jsxs)("div",{className:"absolute z-50 w-[360px] bg-popover border border-border rounded-xl shadow-e-4 overflow-hidden",style:{top:o.top,left:o.left},onMouseDown:e=>e.stopPropagation(),children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[(0,t.jsx)("div",{className:"text-[12px] font-medium",children:"image"===e?"Insert image":"video"===e?"Insert video":"Attach file"}),(0,t.jsx)("button",{type:"button",onClick:r,className:"text-[11px] text-muted-foreground hover:text-foreground",children:"Cancel"})]}),(0,t.jsxs)("div",{className:"flex border-b border-border bg-muted/30",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>a("upload"),className:(0,j.cn)("flex-1 py-1.5 text-[11px] flex items-center justify-center gap-1.5 transition-colors","upload"===s?"bg-background text-foreground border-b-2 border-primary":"text-muted-foreground hover:text-foreground"),children:[(0,t.jsx)(z.Upload,{className:"w-3 h-3"})," Upload"]}),(0,t.jsxs)("button",{type:"button",onClick:()=>a("url"),className:(0,j.cn)("flex-1 py-1.5 text-[11px] flex items-center justify-center gap-1.5 transition-colors","url"===s?"bg-background text-foreground border-b-2 border-primary":"text-muted-foreground hover:text-foreground"),children:[(0,t.jsx)(y.Link,{className:"w-3 h-3"})," From URL"]})]}),"upload"===s?(0,t.jsxs)("div",{className:"p-4",onDragOver:e=>{e.preventDefault(),e.stopPropagation()},onDrop:e=>{e.preventDefault(),e.stopPropagation(),m(e.dataTransfer.files)},children:[(0,t.jsxs)("button",{type:"button",onClick:()=>f.current?.click(),disabled:d,className:"w-full border-2 border-dashed border-border rounded-sm py-6 flex flex-col items-center justify-center text-muted-foreground hover:bg-accent/30 transition-colors",children:[(0,t.jsx)(z.Upload,{className:"w-5 h-5 mb-1.5"}),(0,t.jsx)("span",{className:"text-[12px] font-medium",children:d?"Uploading…":`Click to upload ${e}`}),(0,t.jsx)("span",{className:"text-[10px] mt-0.5",children:"or drop a file here"})]}),(0,t.jsx)("input",{ref:f,type:"file",accept:"image"===e?"image/*":"video"===e?"video/*":"*/*",className:"hidden",onChange:e=>m(e.target.files)}),h&&(0,t.jsx)("div",{className:"mt-2 text-[11px] text-destructive",children:h})]}):(0,t.jsxs)("div",{className:"p-3 space-y-2",children:[(0,t.jsx)("input",{type:"url",autoFocus:!0,value:l,placeholder:"image"===e?"https://example.com/image.png":"video"===e?"https://example.com/video.mp4":"https://example.com/file",onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),g()):"Escape"===e.key&&r()},className:"w-full bg-background border border-border rounded-sm px-2.5 py-1.5 text-[12px] focus:outline-none focus:ring-2 focus:ring-primary/30"}),(0,t.jsx)("button",{type:"button",onClick:g,disabled:!l.trim(),className:"w-full py-1.5 text-[12px] rounded-sm bg-primary text-primary-foreground disabled:opacity-50 hover:bg-primary/90",children:"Insert"})]}),(0,t.jsxs)("div",{className:"px-3 py-2 border-t border-border bg-muted/30 text-[10px] text-muted-foreground flex items-start gap-1.5",children:[(0,t.jsx)(L.Clipboard,{className:"w-3 h-3 shrink-0 mt-[1px]"}),(0,t.jsxs)("span",{children:["Tip: you can also"," ",(0,t.jsx)("strong",{className:"text-foreground/80",children:"paste"})," or"," ",(0,t.jsx)("strong",{className:"text-foreground/80",children:"drag & drop"}),"files directly into the page — they'll be saved alongside this page automatically."]})]})]})}function B({label:e,icon:n,active:r,disabled:i,style:o,onAction:s}){return(0,t.jsx)("button",{type:"button","aria-label":e,title:e,disabled:i,style:o,onMouseDown:e=>{e.preventDefault()},onClick:e=>{e.preventDefault(),s(e)},className:(0,j.cn)("h-8 w-8 shrink-0 inline-flex items-center justify-center rounded-md text-foreground/80 hover:bg-accent hover:text-accent-foreground transition-colors disabled:opacity-40",r&&"bg-accent text-accent-foreground ring-1 ring-inset ring-foreground/15"),children:(0,t.jsx)(n,{className:"h-4 w-4"})})}function F({onClose:e}){return(0,O.useEffect)(()=>{let t=window.setTimeout(()=>{let t=t=>{let n=t.target;n?.closest('[data-editor-popover="true"]')||e()};window.addEventListener("mousedown",t),window.__editorPopClose=()=>window.removeEventListener("mousedown",t)},10);return()=>{window.clearTimeout(t);let e=window;e.__editorPopClose&&(e.__editorPopClose(),e.__editorPopClose=void 0)}},[e]),null}e.s(["MediaPopover",0,H],512527),e.s(["EditorToolbar",0,function({editor:e}){let j=(0,I.useEditorStore)(e=>e.frontmatter),L=(0,I.useEditorStore)(e=>e.updateFrontmatter),z=(0,I.useEditorStore)(e=>e.currentPath),_=j?.dir==="rtl",[$,V]=(0,O.useState)(null),U=(0,O.useRef)(null),[W,K]=(0,O.useState)(!1),[q,J]=(0,O.useState)(!1),[,G]=(0,O.useState)(0);(0,O.useEffect)(()=>{if(!e)return;let t=()=>G(e=>e+1);return e.on("selectionUpdate",t),e.on("transaction",t),()=>{e.off("selectionUpdate",t),e.off("transaction",t)}},[e]);let X=(0,O.useCallback)(()=>{let e=U.current;e&&(K(e.scrollLeft>4),J(e.scrollLeft+e.clientWidth<e.scrollWidth-4))},[]);(0,O.useEffect)(()=>{if(!e)return;let t=U.current;if(!t)return;let n=requestAnimationFrame(X),r=()=>X();window.addEventListener("resize",r),t.addEventListener("scroll",X);let i=new ResizeObserver(()=>X());for(let e of(i.observe(t),Array.from(t.children)))i.observe(e);return()=>{cancelAnimationFrame(n),window.removeEventListener("resize",r),t.removeEventListener("scroll",X),i.disconnect()}},[e,X]);let Z=e=>{let t=U.current;t&&t.scrollBy({left:e*Math.max(160,.6*t.clientWidth),behavior:"smooth"})};if(!e)return null;let Y=(t,n)=>{e.chain().focus().setTextSelection(t).run(),n()},Q=(t,n)=>{let r=t.currentTarget.getBoundingClientRect();V(n({top:r.bottom+6,left:r.left},(()=>{let{from:t,to:n}=e.state.selection;return{from:t,to:n}})()))},ee=[{icon:h.Heading1,action:()=>e.chain().focus().toggleHeading({level:1}).run(),isActive:e.isActive("heading",{level:1}),label:"Heading 1"},{icon:p.Heading2,action:()=>e.chain().focus().toggleHeading({level:2}).run(),isActive:e.isActive("heading",{level:2}),label:"Heading 2"},{icon:f.Heading3,action:()=>e.chain().focus().toggleHeading({level:3}).run(),isActive:e.isActive("heading",{level:3}),label:"Heading 3"},{separator:!0},{icon:s.Bold,action:()=>e.chain().focus().toggleBold().run(),isActive:e.isActive("bold"),label:"Bold"},{icon:g.Italic,action:()=>e.chain().focus().toggleItalic().run(),isActive:e.isActive("italic"),label:"Italic"},{icon:A.Underline,action:()=>e.chain().focus().toggleUnderline().run(),isActive:e.isActive("underline"),label:"Underline"},{icon:E.Strikethrough,action:()=>e.chain().focus().toggleStrike().run(),isActive:e.isActive("strike"),label:"Strikethrough"},{icon:d.Code,action:()=>e.chain().focus().toggleCode().run(),isActive:e.isActive("code"),label:"Inline code"},{icon:y.Link,action:t=>{let n=e.getAttributes("link")?.href??"";Q(t,(e,t)=>({type:"link",anchor:e,range:t,existing:n}))},isActive:e.isActive("link"),label:"Link"},{separator:!0},{icon:b.List,action:()=>e.chain().focus().toggleBulletList().run(),isActive:e.isActive("bulletList"),label:"Bullet list"},{icon:v.ListOrdered,action:()=>e.chain().focus().toggleOrderedList().run(),isActive:e.isActive("orderedList"),label:"Ordered list"},{icon:S.Quote,action:()=>e.chain().focus().toggleBlockquote().run(),isActive:e.isActive("blockquote"),label:"Blockquote"},{icon:a.CheckSquare,action:()=>e.chain().focus().toggleTaskList().run(),isActive:e.isActive("taskList"),label:"Checklist"},{icon:u.FileCode,action:()=>e.chain().focus().toggleCodeBlock().run(),isActive:e.isActive("codeBlock"),label:"Code block"},{icon:w.Minus,action:()=>e.chain().focus().setHorizontalRule().run(),isActive:!1,label:"Divider"}],et=[{icon:i.AlignLeft,action:()=>e.chain().focus().setTextAlign("left").run(),isActive:e.isActive({textAlign:"left"}),label:"Align left"},{icon:n.AlignCenter,action:()=>e.chain().focus().setTextAlign("center").run(),isActive:e.isActive({textAlign:"center"}),label:"Align center"},{icon:o.AlignRight,action:()=>e.chain().focus().setTextAlign("right").run(),isActive:e.isActive({textAlign:"right"}),label:"Align right"},{icon:r.AlignJustify,action:()=>e.chain().focus().setTextAlign("justify").run(),isActive:e.isActive({textAlign:"justify"}),label:"Justify"},{separator:!0},{icon:N.Superscript,action:()=>e.chain().focus().toggleSuperscript().run(),isActive:e.isActive("superscript"),label:"Superscript"},{icon:M.Subscript,action:()=>e.chain().focus().toggleSubscript().run(),isActive:e.isActive("subscript"),label:"Subscript"},{separator:!0},{icon:m.ImageIcon,action:e=>Q(e,e=>({type:"media",kind:"image",anchor:e})),isActive:!1,label:"Insert image"},{icon:R.Video,action:e=>Q(e,e=>({type:"media",kind:"video",anchor:e})),isActive:!1,label:"Insert video"},{separator:!0},{icon:T.Undo,action:()=>e.chain().focus().undo().run(),isActive:!1,label:"Undo"},{icon:C.Redo,action:()=>e.chain().focus().redo().run(),isActive:!1,label:"Redo"},{separator:!0},{icon:_?x.PilcrowLeft:k.PilcrowRight,action:()=>L({dir:_?void 0:"rtl"}),isActive:_,label:_?"Switch to LTR":"Switch to RTL"}];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"relative border-b border-border bg-background/50",children:[W&&(0,t.jsx)("button",{type:"button","aria-label":"Scroll toolbar left",onMouseDown:e=>e.preventDefault(),onClick:()=>Z(-1),className:"absolute left-0 top-0 bottom-0 w-6 z-10 flex items-center justify-start pl-0.5 bg-gradient-to-r from-background via-background/80 to-transparent text-muted-foreground hover:text-foreground transition-colors",children:(0,t.jsx)(l.ChevronLeft,{className:"h-4 w-4"})}),q&&(0,t.jsx)("button",{type:"button","aria-label":"Scroll toolbar right",onMouseDown:e=>e.preventDefault(),onClick:()=>Z(1),className:"absolute right-0 top-0 bottom-0 w-6 z-10 flex items-center justify-end pr-0.5 bg-gradient-to-l from-background via-background/80 to-transparent text-muted-foreground hover:text-foreground transition-colors",children:(0,t.jsx)(c.ChevronRight,{className:"h-4 w-4"})}),(0,t.jsx)("div",{ref:U,onWheel:e=>{let t=U.current;t&&Math.abs(e.deltaY)>Math.abs(e.deltaX)&&(t.scrollLeft+=e.deltaY)},className:"flex items-center gap-0.5 px-2 pt-1 pb-1.5 overflow-x-scroll overflow-y-hidden editor-toolbar-scroll",children:[...ee,{separator:!0},...et].map((e,n)=>"separator"in e?(0,t.jsx)(D.Separator,{orientation:"vertical",className:"mx-1 h-6 shrink-0"},n):(0,t.jsx)(B,{label:e.label,icon:e.icon,active:e.isActive,style:e.style,onAction:e.action},n))})]}),$?.type==="link"&&(0,t.jsx)("div",{"data-editor-popover":"true",style:{position:"fixed",top:$.anchor.top,left:$.anchor.left,zIndex:60},children:(0,t.jsx)(P.LinkPopover,{anchor:{top:0,left:0},initialUrl:$.existing,onCancel:()=>V(null),onApply:t=>{$?.type==="link"&&(Y($.range,()=>{e.chain().focus().extendMarkRange("link").setLink({href:t}).run()}),V(null))},onRemove:$.existing?()=>{$?.type==="link"&&(Y($.range,()=>{e.chain().focus().unsetLink().run()}),V(null))}:void 0})}),$?.type==="media"&&z&&(0,t.jsx)("div",{"data-editor-popover":"true",style:{position:"fixed",top:$.anchor.top,left:$.anchor.left,zIndex:60},children:(0,t.jsx)(H,{kind:$.kind,pagePath:z,anchor:{top:0,left:0},onCancel:()=>V(null),onInsert:t=>((t,n)=>{let{url:r,alt:i,mimeType:o}=n;"image"===t||(o??"").startsWith("image/")||/\.(png|jpe?g|gif|webp|svg|avif)(\?|$)/i.test(r)?e.chain().focus().setImage({src:r,alt:i??""}).run():e.chain().focus().insertContent(`<a href="${r}">${i??r}</a>`).run(),V(null)})($.kind,t)})}),$&&(0,t.jsx)(F,{onClose:()=>V(null)})]})}],240409);var V=e.i(343603),U=e.i(111092),W=/^```([a-z]+)?[\s\n]$/,K=/^~~~([a-z]+)?[\s\n]$/,q=V.Node.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;let{languageClassPrefix:n}=this.options;if(!n)return null;let r=[...(null==(t=e.firstElementChild)?void 0:t.classList)||[]].filter(e=>e.startsWith(n)).map(e=>e.replace(n,""))[0];return r||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:t}){return["pre",(0,V.mergeAttributes)(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var n,r;return(null==(n=e.raw)?void 0:n.startsWith("```"))===!1&&(null==(r=e.raw)?void 0:r.startsWith("~~~"))===!1&&"indented"!==e.codeBlockStyle?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var n;let r=(null==(n=e.attrs)?void 0:n.language)||"";return e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join("\n"):`\`\`\`${r}
103
-
104
- \`\`\``},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=1===t.pos;return!!e&&t.parent.type.name===this.name&&(!!n||!t.parent.textContent.length)&&this.editor.commands.clearNodes()},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;let n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:i}=r,{$from:o,empty:s}=i;if(o.parent.type!==this.type)return!1;let a=" ".repeat(n);return s?e.commands.insertContent(a):e.commands.command(({tr:e})=>{let{from:t,to:n}=i,o=r.doc.textBetween(t,n,"\n","\n").split("\n").map(e=>a+e).join("\n");return e.replaceWith(t,n,r.schema.text(o)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;let n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:i}=r,{$from:o,empty:s}=i;return o.parent.type===this.type&&(s?e.commands.command(({tr:e})=>{var t;let{pos:i}=o,s=o.start(),a=o.end(),l=r.doc.textBetween(s,a,"\n","\n").split("\n"),c=0,d=0,u=i-s;for(let e=0;e<l.length;e+=1){if(d+l[e].length>=u){c=e;break}d+=l[e].length+1}let h=Math.min(((null==(t=l[c].match(/^ */))?void 0:t[0])||"").length,n);if(0===h)return!0;let p=s;for(let e=0;e<c;e+=1)p+=l[e].length+1;return e.delete(p,p+h),i-p<=h&&e.setSelection(U.TextSelection.create(e.doc,p)),!0}):e.commands.command(({tr:e})=>{let{from:t,to:o}=i,s=r.doc.textBetween(t,o,"\n","\n").split("\n").map(e=>{var t;let r=Math.min(((null==(t=e.match(/^ */))?void 0:t[0])||"").length,n);return e.slice(r)}).join("\n");return e.replaceWith(t,o,r.schema.text(s)),!0}))},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 o=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith("\n\n");return!!o&&!!s&&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:o}=n;if(!o||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let s=i.after();return void 0!==s&&(r.nodeAt(s)?e.commands.command(({tr:e})=>(e.setSelection(U.Selection.near(r.resolve(s))),!0)):e.commands.exitCode())}}},addInputRules(){return[(0,V.textblockTypeInputRule)({find:W,type:this.type,getAttributes:e=>({language:e[1]})}),(0,V.textblockTypeInputRule)({find:K,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new U.Plugin({key:new U.PluginKey("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,o=null==i?void 0:i.mode;if(!n||!o)return!1;let{tr:s,schema:a}=e.state,l=a.text(n.replace(/\r\n?/g,"\n"));return s.replaceSelectionWith(this.type.create({language:o},l)),s.selection.$from.parent.type!==this.type&&s.setSelection(U.TextSelection.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),e.dispatch(s),!0}}})]}}),J=e.i(362615);let G=e.i(454184).default;function X(e){return e.value||e.children||[]}function Z({doc:e,name:t,lowlight:n,defaultLanguage:r}){let i=[];return(0,V.findChildren)(e,e=>e.type.name===t).forEach(e=>{var t;let o=e.pos+1,s=e.node.attrs.language||r,a=n.listLanguages();(function e(t,n=[]){return t.flatMap(t=>{let r=[...n,...t.properties?t.properties.className:[]];return t.children?e(t.children,r):{text:t.value,classes:r}})})(s&&(a.includes(s)||G.getLanguage(s)||(null==(t=n.registered)?void 0:t.call(n,s)))?X(n.highlight(s,e.node.textContent)):X(n.highlightAuto(e.node.textContent))).forEach(e=>{let t=o+e.text.length;if(e.classes.length){let n=J.Decoration.inline(o,t,{class:e.classes.join(" ")});i.push(n)}o=t})}),J.DecorationSet.create(e,i)}var Y=q.extend({addOptions(){var e;return{...null==(e=this.parent)?void 0:e.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},addProseMirrorPlugins(){var e;return[...(null==(e=this.parent)?void 0:e.call(this))||[],function({name:e,lowlight:t,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(e=>"function"==typeof t[e]))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");let r=new U.Plugin({key:new U.PluginKey("lowlight"),state:{init:(r,{doc:i})=>Z({doc:i,name:e,lowlight:t,defaultLanguage:n}),apply:(r,i,o,s)=>{let a=o.selection.$head.parent.type.name,l=s.selection.$head.parent.type.name,c=(0,V.findChildren)(o.doc,t=>t.type.name===e),d=(0,V.findChildren)(s.doc,t=>t.type.name===e);return r.docChanged&&([a,l].includes(e)||d.length!==c.length||r.steps.some(e=>void 0!==e.from&&void 0!==e.to&&c.some(t=>t.pos>=e.from&&t.pos+t.node.nodeSize<=e.to)))?Z({doc:r.doc,name:e,lowlight:t,defaultLanguage:n}):i.map(r.mapping,r.doc)}},props:{decorations:e=>r.getState(e)}});return r}({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}});let Q="numeric",ee="ascii",et="alpha",en="asciinumeric",er="alphanumeric",ei="domain",eo="emoji",es="whitespace";function ea(e,t,n){for(let r in t[Q]&&(t[en]=!0,t[er]=!0),t[ee]&&(t[en]=!0,t[et]=!0),t[en]&&(t[er]=!0),t[et]&&(t[er]=!0),t[er]&&(t[ei]=!0),t[eo]&&(t[ei]=!0),t){let t=(r in n||(n[r]=[]),n[r]);0>t.indexOf(e)&&t.push(e)}}function el(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}el.groups={},el.prototype={accepts(){return!!this.t},go(e){let t=this.j[e];if(t)return t;for(let t=0;t<this.jr.length;t++){let n=this.jr[t][0],r=this.jr[t][1];if(r&&n.test(e))return r}return this.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){let i;return r=r||el.groups,t&&t.j?i=t:(i=new el(t),n&&r&&ea(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,o=e.length;if(!o)return i;for(let t=0;t<o-1;t++)i=i.tt(e[t]);return i.tt(e[o-1],t,n,r)},tt(e,t,n,r){if(r=r||el.groups,t&&t.j)return this.j[e]=t,t;let i,o=this.go(e);return o?(Object.assign((i=new el).j,o.j),i.jr.push.apply(i.jr,o.jr),i.jd=o.jd,i.t=o.t):i=new el,t&&(r&&(i.t&&"string"==typeof i.t?ea(t,Object.assign(function(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}(i.t,r),n),r):n&&ea(t,n,r)),i.t=t),this.j[e]=i,i}};let ec=(e,t,n,r,i)=>e.ta(t,n,r,i),ed=(e,t,n,r,i)=>e.tr(t,n,r,i),eu=(e,t,n,r,i)=>e.ts(t,n,r,i),eh=(e,t,n,r,i)=>e.tt(t,n,r,i),ep="WORD",ef="UWORD",em="ASCIINUMERICAL",eg="ALPHANUMERICAL",ey="LOCALHOST",eb="UTLD",ev="SCHEME",ew="SLASH_SCHEME",ex="OPENBRACE",ek="CLOSEBRACE",eS="OPENBRACKET",eC="CLOSEBRACKET",eE="OPENPAREN",eM="CLOSEPAREN",eN="OPENANGLEBRACKET",eA="CLOSEANGLEBRACKET",eT="FULLWIDTHLEFTPAREN",eR="FULLWIDTHRIGHTPAREN",eO="LEFTCORNERBRACKET",eD="RIGHTCORNERBRACKET",ej="LEFTWHITECORNERBRACKET",eI="RIGHTWHITECORNERBRACKET",eP="FULLWIDTHLESSTHAN",eL="FULLWIDTHGREATERTHAN",ez="AMPERSAND",e_="APOSTROPHE",e$="ASTERISK",eH="BACKSLASH",eB="BACKTICK",eF="CARET",eV="COLON",eU="COMMA",eW="DOLLAR",eK="EQUALS",eq="EXCLAMATION",eJ="HYPHEN",eG="PERCENT",eX="PIPE",eZ="PLUS",eY="POUND",eQ="QUERY",e0="QUOTE",e1="FULLWIDTHMIDDLEDOT",e2="SEMI",e5="SLASH",e3="TILDE",e4="UNDERSCORE",e6="EMOJI";var e9=Object.freeze({__proto__:null,ALPHANUMERICAL:eg,AMPERSAND:ez,APOSTROPHE:e_,ASCIINUMERICAL:em,ASTERISK:e$,AT:"AT",BACKSLASH:eH,BACKTICK:eB,CARET:eF,CLOSEANGLEBRACKET:eA,CLOSEBRACE:ek,CLOSEBRACKET:eC,CLOSEPAREN:eM,COLON:eV,COMMA:eU,DOLLAR:eW,DOT:"DOT",EMOJI:e6,EQUALS:eK,EXCLAMATION:eq,FULLWIDTHGREATERTHAN:eL,FULLWIDTHLEFTPAREN:eT,FULLWIDTHLESSTHAN:eP,FULLWIDTHMIDDLEDOT:e1,FULLWIDTHRIGHTPAREN:eR,HYPHEN:eJ,LEFTCORNERBRACKET:eO,LEFTWHITECORNERBRACKET:ej,LOCALHOST:ey,NL:"NL",NUM:"NUM",OPENANGLEBRACKET:eN,OPENBRACE:ex,OPENBRACKET:eS,OPENPAREN:eE,PERCENT:eG,PIPE:eX,PLUS:eZ,POUND:eY,QUERY:eQ,QUOTE:e0,RIGHTCORNERBRACKET:eD,RIGHTWHITECORNERBRACKET:eI,SCHEME:ev,SEMI:e2,SLASH:e5,SLASH_SCHEME:ew,SYM:"SYM",TILDE:e3,TLD:"TLD",UNDERSCORE:e4,UTLD:eb,UWORD:ef,WORD:ep,WS:"WS"});let e7=/[a-z]/,e8=/\p{L}/u,te=/\p{Emoji}/u,tt=/\d/,tn=/\s/,tr=null,ti=null;function to(e,t){let n=function(e){let t=[],n=e.length,r=0;for(;r<n;){let i,o=e.charCodeAt(r),s=o<55296||o>56319||r+1===n||(i=e.charCodeAt(r+1))<56320||i>57343?e[r]:e.slice(r,r+2);t.push(s),r+=s.length}return t}(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],o=0,s=0;for(;s<r;){let a=e,l=null,c=0,d=null,u=-1,h=-1;for(;s<r&&(l=a.go(n[s]));)(a=l).accepts()?(u=0,h=0,d=a):u>=0&&(u+=n[s].length,h++),c+=n[s].length,o+=n[s].length,s++;o-=u,s-=h,c-=u,i.push({t:d.t,v:t.slice(o-c,o),s:o-c,e:o})}return i}function ts(e,t,n,r,i){let o,s=t.length;for(let n=0;n<s-1;n++){let s=t[n];e.j[s]?o=e.j[s]:((o=new el(r)).jr=i.slice(),e.j[s]=o),e=o}return(o=new el(n)).jr=i.slice(),e.j[t[s-1]]=o,o}function ta(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}let tl={defaultProtocol:"http",events:null,format:td,formatHref:td,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function tc(e,t=null){let n=Object.assign({},tl);e&&(n=Object.assign(n,e instanceof tc?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}function td(e){return e}function tu(e,t){this.t="token",this.v=e,this.tk=t}function th(e,t){class n extends tu{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}tc.prototype={o:tl,ignoreTags:[],defaultRender:e=>e,check(e){return this.get("validate",e.toString(),e)},get(e,t,n){let r=null!=t,i=this.o[e];return i&&("object"==typeof i?"function"==typeof(i=n.t in i?i[n.t]:tl[e])&&r&&(i=i(t,n)):"function"==typeof i&&r&&(i=i(t,n.t,n))),i},getObj(e,t,n){let r=this.o[e];return"function"==typeof r&&null!=t&&(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)}},tu.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=tl.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.toHref(e.get("defaultProtocol")),n=e.get("formatHref",t,this),r=e.get("tagName",t,this),i=this.toFormattedString(e),o={},s=e.get("className",t,this),a=e.get("target",t,this),l=e.get("rel",t,this),c=e.getObj("attributes",t,this),d=e.getObj("events",t,this);return o.href=n,s&&(o.class=s),a&&(o.target=a),l&&(o.rel=l),c&&Object.assign(o,c),{tagName:r,attributes:o,content:i,eventListeners:d}}};let tp=th("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),tf=th("text"),tm=th("nl"),tg=th("url",{isLink:!0,toHref(e=tl.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==ey&&e[1].t===eV}}),ty=e=>new el(e);function tb(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}let tv="u">typeof console&&console&&console.warn||(()=>{}),tw={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function tx(e,t=!1){if(tw.initialized&&tv(`linkifyjs: already initialized - will not register custom scheme "${e}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
105
- 1. Must only contain digits, lowercase ASCII letters or "-"
106
- 2. Cannot start or end with "-"
107
- 3. "-" cannot repeat`);tw.customSchemes.push([e,t])}function tk(e){return tw.initialized||function(){tw.scanner=function(e=[]){let t={};el.groups=t;let n=new el;null==tr&&(tr=ta("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==ti&&(ti=ta("ελ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")),eh(n,"'",e_),eh(n,"{",ex),eh(n,"}",ek),eh(n,"[",eS),eh(n,"]",eC),eh(n,"(",eE),eh(n,")",eM),eh(n,"<",eN),eh(n,">",eA),eh(n,"(",eT),eh(n,")",eR),eh(n,"「",eO),eh(n,"」",eD),eh(n,"『",ej),eh(n,"』",eI),eh(n,"<",eP),eh(n,">",eL),eh(n,"&",ez),eh(n,"*",e$),eh(n,"@","AT"),eh(n,"`",eB),eh(n,"^",eF),eh(n,":",eV),eh(n,",",eU),eh(n,"$",eW),eh(n,".","DOT"),eh(n,"=",eK),eh(n,"!",eq),eh(n,"-",eJ),eh(n,"%",eG),eh(n,"|",eX),eh(n,"+",eZ),eh(n,"#",eY),eh(n,"?",eQ),eh(n,'"',e0),eh(n,"/",e5),eh(n,";",e2),eh(n,"~",e3),eh(n,"_",e4),eh(n,"\\",eH),eh(n,"・",e1);let r=ed(n,tt,"NUM",{[Q]:!0});ed(r,tt,r);let i=ed(r,e7,em,{[en]:!0}),o=ed(r,e8,eg,{[er]:!0}),s=ed(n,e7,ep,{[ee]:!0});ed(s,tt,i),ed(s,e7,s),ed(i,tt,i),ed(i,e7,i);let a=ed(n,e8,ef,{[et]:!0});ed(a,e7),ed(a,tt,o),ed(a,e8,a),ed(o,tt,o),ed(o,e7),ed(o,e8,o);let l=eh(n,"\n","NL",{[es]:!0}),c=eh(n,"\r","WS",{[es]:!0}),d=ed(n,tn,"WS",{[es]:!0});eh(n,"",d),eh(c,"\n",l),eh(c,"",d),ed(c,tn,d),eh(d,"\r"),eh(d,"\n"),ed(d,tn,d),eh(d,"",d);let u=ed(n,te,e6,{[eo]:!0});eh(u,"#"),ed(u,te,u),eh(u,"️",u);let h=eh(u,"‍");eh(h,"#"),ed(h,te,u);let p=[[e7,s],[tt,i]],f=[[e7,null],[e8,a],[tt,o]];for(let e=0;e<tr.length;e++)ts(n,tr[e],"TLD",ep,p);for(let e=0;e<ti.length;e++)ts(n,ti[e],eb,ef,f);ea("TLD",{tld:!0,ascii:!0},t),ea(eb,{utld:!0,alpha:!0},t),ts(n,"file",ev,ep,p),ts(n,"mailto",ev,ep,p),ts(n,"http",ew,ep,p),ts(n,"https",ew,ep,p),ts(n,"ftp",ew,ep,p),ts(n,"ftps",ew,ep,p),ea(ev,{scheme:!0,ascii:!0},t),ea(ew,{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]?{scheme:!0}:{slashscheme:!0};r.indexOf("-")>=0?i[ei]=!0:e7.test(r)?tt.test(r)?i[en]=!0:i[ee]=!0:i[Q]=!0,eu(n,r,r,i)}return eu(n,"localhost",ey,{ascii:!0}),n.jd=new el("SYM"),{start:n,tokens:Object.assign({groups:t},e9)}}(tw.customSchemes);for(let e=0;e<tw.tokenQueue.length;e++)tw.tokenQueue[e][1]({scanner:tw.scanner});tw.parser=function({groups:e}){let t=e.domain.concat([ez,e$,"AT",eH,eB,eF,eW,eK,eJ,"NUM",eG,eX,eZ,eY,e5,"SYM",e3,e4]),n=[e_,eV,eU,"DOT",eq,eG,eQ,e0,e2,eN,eA,ex,ek,eC,eS,eE,eM,eT,eR,eO,eD,ej,eI,eP,eL],r=[ez,e_,e$,eH,eB,eF,eW,eK,eJ,ex,ek,eG,eX,eZ,eY,eQ,e5,"SYM",e3,e4],i=ty(),o=eh(i,e3);ec(o,r,o),ec(o,e.domain,o);let s=ty(),a=ty(),l=ty();ec(i,e.domain,s),ec(i,e.scheme,a),ec(i,e.slashscheme,l),ec(s,r,o),ec(s,e.domain,s);let c=eh(s,"AT");eh(o,"AT",c),eh(a,"AT",c),eh(l,"AT",c);let d=eh(o,"DOT");ec(d,r,o),ec(d,e.domain,o);let u=ty();ec(c,e.domain,u),ec(u,e.domain,u);let h=eh(u,"DOT");ec(h,e.domain,u);let p=ty(tp);ec(h,e.tld,p),ec(h,e.utld,p),eh(c,ey,p);let f=eh(u,eJ);eh(f,eJ,f),ec(f,e.domain,u),ec(p,e.domain,u),eh(p,"DOT",h),eh(p,eJ,f);let m=eh(s,eJ),g=eh(s,"DOT");eh(m,eJ,m),ec(m,e.domain,s),ec(g,r,o),ec(g,e.domain,s);let y=ty(tg);ec(g,e.tld,y),ec(g,e.utld,y),ec(y,e.domain,s),ec(y,r,o),eh(y,"DOT",g),eh(y,eJ,m),eh(y,"AT",c);let b=eh(y,eV),v=ty(tg);ec(b,e.numeric,v);let w=ty(tg),x=ty();ec(w,t,w),ec(w,n,x),ec(x,t,w),ec(x,n,x),eh(y,e5,w),eh(v,e5,w);let k=eh(a,eV),S=eh(l,eV),C=eh(S,e5),E=eh(C,e5);ec(a,e.domain,s),eh(a,"DOT",g),eh(a,eJ,m),ec(l,e.domain,s),eh(l,"DOT",g),eh(l,eJ,m),ec(k,e.domain,w),eh(k,e5,w),eh(k,eQ,w),ec(E,e.domain,w),ec(E,t,w),eh(E,e5,w);let M=[[ex,ek],[eS,eC],[eE,eM],[eN,eA],[eT,eR],[eO,eD],[ej,eI],[eP,eL]];for(let e=0;e<M.length;e++){let[r,i]=M[e],o=eh(w,r);eh(x,r,o);let s=ty(tg);ec(o,t,s);let a=ty();ec(o,n,a),eh(o,i,w),ec(s,t,s),ec(s,n,a),ec(a,t,s),ec(a,n,a),eh(s,i,w),eh(a,i,w)}return eh(i,ey,y),eh(i,"NL",tm),{start:i,tokens:e9}}(tw.scanner.tokens);for(let e=0;e<tw.pluginQueue.length;e++)tw.pluginQueue[e][1]({scanner:tw.scanner,parser:tw.parser});tw.initialized=!0}(),function(e,t,n){let r=n.length,i=0,o=[],s=[];for(;i<r;){let a=e,l=null,c=null,d=0,u=null,h=-1;for(;i<r&&!(l=a.go(n[i].t));)s.push(n[i++]);for(;i<r&&(c=l||a.go(n[i].t));)l=null,(a=c).accepts()?(h=0,u=a):h>=0&&h++,i++,d++;if(h<0)(i-=d)<r&&(s.push(n[i]),i++);else{s.length>0&&(o.push(tb(tf,t,s)),s=[]),i-=h,d-=h;let e=u.t,r=n.slice(i-d,i);o.push(tb(e,t,r))}}return s.length>0&&o.push(tb(tf,t,s)),o}(tw.parser.start,e,to(tw.scanner.start,e))}function tS(e,t=null,n=null){if(t&&"object"==typeof t){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new tc(n),i=tk(e),o=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&o.push(n.toFormattedObject(r))}return o}tk.scan=to;var tC="[\0-   ᠎ -\u2029  ]",tE=new RegExp(tC),tM=RegExp(`${tC}$`),tN=RegExp(tC,"g");function tA(e,t){let n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(e=>{let t="string"==typeof e?e:e.scheme;t&&n.push(t)}),!e||e.replace(tN,"").match(RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var tT=V.Mark.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=>{"string"==typeof e?tx(e):tx(e.scheme,e.optionalSlashes)})},onDestroy(){el.groups={},tw.scanner=null,tw.parser=null,tw.tokenQueue=[],tw.pluginQueue=[],tw.customSchemes=[],tw.initialized=!1},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!tA(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=>e.getAttribute("href")},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{let t=e.getAttribute("href");return!!t&&!!this.options.isAllowedUri(t,{defaultValidate:e=>!!tA(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!tA(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",(0,V.mergeAttributes)(this.options.HTMLAttributes,e),0]:["a",(0,V.mergeAttributes)(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)=>{var n,r,i,o;let s=null!=(r=null==(n=e.attrs)?void 0:n.href)?r:"",a=null!=(o=null==(i=e.attrs)?void 0:i.title)?o:"",l=t.renderChildren(e);return a?`[${l}](${s} "${a}")`:`[${l}](${s})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return!!this.options.isAllowedUri(n,{defaultValidate:e=>!!tA(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&t().setMark(this.name,e).setMeta("preventAutolink",!0).run()},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return(!n||!!this.options.isAllowedUri(n,{defaultValidate:e=>!!tA(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&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[(0,V.markPasteRule)({find:e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options,i=tS(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!tA(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=>{var t;return{href:null==(t=e.data)?void 0:t.href}}})]},addProseMirrorPlugins(){var e,t,n;let r=[],{protocols:i,defaultProtocol:o}=this.options;return this.options.autolink&&r.push((e={type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!tA(e,i),protocols:i,defaultProtocol:o}),shouldAutoLink:this.options.shouldAutoLink},new U.Plugin({key:new U.PluginKey("autolink"),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),o=t.some(e=>e.getMeta("preventAutolink"));if(!i||o)return;let{tr:s}=r,a=(0,V.combineTransactionSteps)(n.doc,[...t]);if((0,V.getChangedRanges)(a).forEach(({newRange:t})=>{let n,i,o=(0,V.findChildrenInRange)(r.doc,t,e=>e.isTextblock);if(o.length>1)n=o[0],i=r.doc.textBetween(n.pos,n.pos+n.node.nodeSize,void 0," ");else if(o.length){let e=r.doc.textBetween(t.from,t.to," "," ");if(!tM.test(e))return;n=o[0],i=r.doc.textBetween(n.pos,t.to,void 0," ")}if(n&&i){let t=i.split(tE).filter(Boolean);if(t.length<=0)return!1;let o=t[t.length-1],a=n.pos+i.lastIndexOf(o);if(!o)return!1;let l=tk(o).map(t=>t.toObject(e.defaultProtocol));if(!(1===l.length?l[0].isLink:3===l.length&&!!l[1].isLink&&["()","[]"].includes(l[0].value+l[2].value)))return!1;l.filter(e=>e.isLink).map(e=>({...e,from:a+e.start+1,to:a+e.end+1})).filter(e=>!r.schema.marks.code||!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code)).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{(0,V.getMarksBetween)(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||s.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),s.steps.length)return s}}))),r.push((t={type:this.type,editor:this.editor,openOnClick:"whenNotEditable"===this.options.openOnClick||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection},new U.Plugin({key:new U.PluginKey("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,o;if(0!==r.button||!e.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{let e=r.target;if(!e)return!1;let n=t.editor.view.dom;(s=e.closest("a"))&&!n.contains(s)&&(s=null)}if(!s)return!1;let a=!1;if(t.enableClickSelection&&(a=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){let n=(0,V.getAttributes)(e.state,t.type.name),r=null!=(i=s.href)?i:n.href,l=null!=(o=s.target)?o:n.target;r&&(window.open(r,l),a=!0)}return a}}}))),this.options.linkOnPaste&&r.push((n={editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink},new U.Plugin({key:new U.PluginKey("handlePasteLink"),props:{handlePaste:(e,t,r)=>{let{shouldAutoLink:i}=n,{state:o}=e,{selection:s}=o,{empty:a}=s;if(a)return!1;let l="";r.content.forEach(e=>{l+=e.textContent});let c=tS(l,{defaultProtocol:n.defaultProtocol}).find(e=>e.isLink&&e.value===l);return!!l&&!!c&&(void 0===i||!!i(c.value))&&n.editor.commands.setMark(n.type,{href:c.href})}}}))),r}}),tR=e.i(605842);class tO{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!=(n=t.width)?n:1,this.color=!1===t.color?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){null!=this.cursorPos&&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,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,t,n=this.editorView.state.doc.resolve(this.cursorPos),r=!n.parent.inlineContent,i,o=this.editorView.dom,s=o.getBoundingClientRect(),a=s.width/o.offsetWidth,l=s.height/o.offsetHeight;if(r){let e=n.nodeBefore,t=n.nodeAfter;if(e||t){let n=this.editorView.nodeDOM(this.cursorPos-(e?e.nodeSize:0));if(n){let r=n.getBoundingClientRect(),o=e?r.bottom:r.top;e&&t&&(o=(o+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*l;i={left:r.left,right:r.right,top:o-s,bottom:o+s}}}}if(!i){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;i={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let c=this.editorView.dom.offsetParent;if(!this.element&&(this.element=c.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",r),this.element.classList.toggle("prosemirror-dropcursor-inline",!r),c&&(c!=document.body||"static"!=getComputedStyle(c).position)){let n=c.getBoundingClientRect(),r=n.width/c.offsetWidth,i=n.height/c.offsetHeight;e=n.left-c.scrollLeft*r,t=n.top-c.scrollTop*i}else e=-pageXOffset,t=-pageYOffset;this.element.style.left=(i.left-e)/a+"px",this.element.style.top=(i.top-t)/l+"px",this.element.style.width=(i.right-i.left)/a+"px",this.element.style.height=(i.bottom-i.top)/l+"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="function"==typeof r?r(this.editorView,t,e):r;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=(0,tR.dropPoint)(this.editorView.state.doc,e,this.editorView.dragging.slice);null!=t&&(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)}}var tD=e.i(202008),tj=U,tI=e.i(644575);class tP extends tj.Selection{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return tP.valid(n)?new tP(n):tj.Selection.near(n)}content(){return tI.Slice.empty}eq(e){return e instanceof tP&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for GapCursor.fromJSON");return new tP(e.resolve(t.pos))}getBookmark(){return new tL(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(0==n){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||tz(e.type))return!0;if(e.inlineContent)return!1}}return!0}(e)||!function(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(0==e.childCount&&!e.inlineContent||tz(e.type))return!0;if(e.inlineContent)return!1}}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){r:for(;;){if(!n&&tP.valid(e))return e;let r=e.pos,i=null;for(let n=e.depth;;n--){let o=e.node(n);if(t>0?e.indexAfter(n)<o.childCount:e.index(n)>0){i=o.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;r+=t;let s=e.doc.resolve(r);if(tP.valid(s))return s}for(;;){let o=t>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!tj.NodeSelection.isSelectable(i)){e=e.doc.resolve(r+i.nodeSize*t),n=!1;continue r}break}i=o,r+=t;let s=e.doc.resolve(r);if(tP.valid(s))return s}return null}}}tP.prototype.visible=!1,tP.findFrom=tP.findGapCursorFrom,tj.Selection.jsonID("gapcursor",tP);class tL{constructor(e){this.pos=e}map(e){return new tL(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return tP.valid(t)?new tP(t):tj.Selection.near(t)}}function tz(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}let t_=(0,tD.keydownHandler)({ArrowLeft:t$("horiz",-1),ArrowRight:t$("horiz",1),ArrowUp:t$("vert",-1),ArrowDown:t$("vert",1)});function t$(e,t){let n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,i){let o=e.selection,s=t>0?o.$to:o.$from,a=o.empty;if(o instanceof tj.TextSelection){if(!i.endOfTextblock(n)||0==s.depth)return!1;a=!1,s=e.doc.resolve(t>0?s.after():s.before())}let l=tP.findGapCursorFrom(s,t,a);return!!l&&(r&&r(e.tr.setSelection(new tP(l))),!0)}}function tH(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!tP.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return!(i&&i.inside>-1&&tj.NodeSelection.isSelectable(e.state.doc.nodeAt(i.inside)))&&(e.dispatch(e.state.tr.setSelection(new tP(r))),!0)}function tB(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof tP))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=tI.Fragment.empty;for(let e=r.length-1;e>=0;e--)i=tI.Fragment.from(r[e].createAndFill(null,i));let o=e.state.tr.replace(n.pos,n.pos,new tI.Slice(i,0,0));return o.setSelection(tj.TextSelection.near(o.doc.resolve(n.pos+1))),e.dispatch(o),!1}function tF(e){if(!(e.selection instanceof tP))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",J.DecorationSet.create(e.doc,[J.Decoration.widget(e.selection.head,t,{key:"gapcursor"})])}var tV=function(){};tV.prototype.append=function(e){return e.length?(e=tV.from(e),!this.length&&e||e.length<200&&this.leafAppend(e)||this.length<200&&e.leafPrepend(this)||this.appendInner(e)):this},tV.prototype.prepend=function(e){return e.length?tV.from(e).append(this):this},tV.prototype.appendInner=function(e){return new tW(this,e)},tV.prototype.slice=function(e,t){return(void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t)?tV.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},tV.prototype.get=function(e){if(!(e<0)&&!(e>=this.length))return this.getInner(e)},tV.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},tV.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},tV.from=function(e){return e instanceof tV?e:e&&e.length?new tU(e):tV.empty};var tU=function(e){function t(t){e.call(this),this.values=t}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 0==e&&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(!1===e(this.values[i],r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(!1===e(this.values[i],r+i))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=200)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=200)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}(tV);tV.empty=new tU([]);var tW=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 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&&!1===this.left.forEachInner(e,t,Math.min(n,i),r)||n>i&&!1===this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&!1===this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)||n<i&&!1===this.left.forEachInvertedInner(e,Math.min(t,i),n,r))return!1},t.prototype.sliceInner=function(e,t){if(0==e&&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}(tV);class tK{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){let n,r,i,o;if(0==this.eventCount)return null;let s=this.items.length;for(;;s--)if(this.items.get(s-1).selection){--s;break}t&&(r=(n=this.remapping(s,this.items.length)).maps.length);let a=e.tr,l=[],c=[];return this.items.forEach((e,t)=>{if(!e.step){n||(r=(n=this.remapping(s,t+1)).maps.length),r--,c.push(e);return}if(n){c.push(new tq(e.map));let t=e.step.map(n.slice(r)),i;t&&a.maybeStep(t).doc&&(i=a.mapping.maps[a.mapping.maps.length-1],l.push(new tq(i,void 0,void 0,l.length+c.length))),r--,i&&n.appendMap(i,r)}else a.maybeStep(e.step);if(e.selection)return i=n?e.selection.map(n.slice(r)):e.selection,o=new tK(this.items.slice(0,s).append(c.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:o,transform:a,selection:i}}addTransform(e,t,n,r){var i,o;let s,a=[],l=this.eventCount,c=this.items,d=!r&&c.length?c.get(c.length-1):null;for(let n=0;n<e.steps.length;n++){let i=e.steps[n].invert(e.docs[n]),o=new tq(e.mapping.maps[n],i,t),s;(s=d&&d.merge(o))&&(o=s,n?a.pop():c=c.slice(0,c.length-1)),a.push(o),t&&(l++,t=void 0),r||(d=o)}let u=l-n.depth;return u>tG&&(i=c,o=u,i.forEach((e,t)=>{if(e.selection&&0==o--)return s=t,!1}),c=i.slice(s),l-=u),new tK(c.append(a),l)}remapping(e,t){let n=new tR.Mapping;return this.items.forEach((t,r)=>{let i=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(e){return 0==this.eventCount?this:new tK(this.items.append(e.map(e=>new tq(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),i=e.mapping,o=e.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},r);let a=t;this.items.forEach(t=>{let r=i.getMirror(--a);if(null==r)return;o=Math.min(o,r);let l=i.maps[r];if(t.step){let o=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(i.slice(a+1,r));c&&s++,n.push(new tq(l,o,c))}else n.push(new tq(l))},r);let l=[];for(let e=t;e<o;e++)l.push(new tq(i.maps[e]));let c=new tK(this.items.slice(0,r).append(l).append(n),s);return c.emptyItemCount()>500&&(c=c.compress(this.items.length-n.length)),c}emptyItemCount(){let e=0;return this.items.forEach(t=>{!t.step&&e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],i=0;return this.items.forEach((o,s)=>{if(s>=e)r.push(o),o.selection&&i++;else if(o.step){let e=o.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let a=o.selection&&o.selection.map(t.slice(n));a&&i++;let l=new tq(s.invert(),e,a),c,d=r.length-1;(c=r.length&&r[d].merge(l))?r[d]=c:r.push(l)}}else o.map&&n--},this.items.length,0),new tK(tV.from(r.reverse()),i)}}tK.empty=new tK(tV.empty,0);class tq{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new tq(t.getMap().invert(),t,this.selection)}}}class tJ{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}}let tG=20;function tX(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function tZ(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),o=t.map(e[r+1],-1);i<=o&&n.push(i,o)}return n}let tY=!1,tQ=null;function t0(e){let t=e.plugins;if(tQ!=t){tY=!1,tQ=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){tY=!0;break}}return tY}let t1=new U.PluginKey("history"),t2=new U.PluginKey("closeHistory");function t5(e,t){return(n,r)=>{let i=t1.getState(n);if(!i||0==(e?i.undone:i.done).eventCount)return!1;if(r){let o=function(e,t,n){let r=t0(t),i=t1.get(t).spec.config,o=(n?e.undone:e.done).popEvent(t,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),a=(n?e.done:e.undone).addTransform(o.transform,t.selection.getBookmark(),i,r),l=new tJ(n?a:o.remaining,n?o.remaining:a,null,0,-1);return o.transform.setSelection(s).setMeta(t1,{redo:n,historyState:l})}(i,n,e);o&&r(t?o.scrollIntoView():o)}return!0}}let t3=t5(!1,!0),t4=t5(!0,!0);t5(!1,!1),t5(!0,!1),V.Extension.create({name:"characterCount",addOptions:()=>({limit:null,autoTrim:!0,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(e=>""!==e).length}),addStorage:()=>({characters:()=>0,words:()=>0}),onBeforeCreate(){this.storage.characters=e=>{let t=(null==e?void 0:e.node)||this.editor.state.doc;if("textSize"===((null==e?void 0:e.mode)||this.options.mode)){let e=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=(null==e?void 0:e.node)||this.editor.state.doc,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new U.Plugin({key:new U.PluginKey("characterCount"),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,o=this.options.autoTrim;if(null==i||0===i||!1===o){e=!0;return}let s=this.storage.characters({node:r.doc});if(s>i){console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let t=r.tr.deleteRange(0,s-i);return e=!0,t}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||0===n||null==n)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 o=e.selection.$head.pos;return e.deleteRange(o-(i-n),o),!(this.storage.characters({node:e.doc})>n)}})]}});var t6=V.Extension.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[function(e={}){return new U.Plugin({view:t=>new tO(t,e)})}(this.options)]}});V.Extension.create({name:"focus",addOptions:()=>({className:"has-focus",mode:"all"}),addProseMirrorPlugins(){return[new U.Plugin({key:new U.PluginKey("focus"),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,o=[];if(!n||!r)return J.DecorationSet.create(e,[]);let s=0;"deepest"===this.options.mode&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;s+=1}});let a=0;return e.descendants((e,t)=>!e.isText&&!!(i>=t&&i<=t+e.nodeSize-1)&&((a+=1,"deepest"===this.options.mode&&s-a>0||"shallowest"===this.options.mode&&a>1)?"deepest"===this.options.mode:void o.push(J.Decoration.node(t,t+e.nodeSize,{class:this.options.className})))),J.DecorationSet.create(e,o)}}})]}});var t9=V.Extension.create({name:"gapCursor",addProseMirrorPlugins:()=>[new tj.Plugin({props:{decorations:tF,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&tP.valid(n)?new tP(n):null,handleClick:tH,handleKeyDown:t_,handleDOMEvents:{beforeinput:tB}}})],extendNodeSchema(e){var t;let n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:null!=(t=(0,V.callOrReturn)((0,V.getExtensionField)(e,"allowGapCursor",n)))?t:null}}}),t7="placeholder",t8=new U.PluginKey("tiptap__placeholder");function ne(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:o,isEmptyDoc:s,hasAnchor:a,classes:{emptyNode:l,emptyEditor:c}}=e,d=[l];return s&&d.push(c),J.Decoration.node(i,i+o.nodeSize,{class:d.join(" "),[r]:"function"==typeof n?n({editor:t,node:o,pos:i,hasAnchor:a}):n})}var nt={init:()=>({topPos:null,bottomPos:null}),apply(e,t){let n=e.getMeta(t8);return(null==n?void 0:n.positions)?{topPos:n.positions.top,bottomPos:n.positions.bottom}:e.docChanged?{topPos:null!==t.topPos?e.mapping.map(t.topPos):null,bottomPos:null!==t.bottomPos?e.mapping.map(t.bottomPos):null}:t}};function nn(e){let t=function(e){let t=e;for(;t;){if(function(e){let t=getComputedStyle(e),n=`${t.overflow} ${t.overflowY} ${t.overflowX}`;return/auto|scroll|overlay/.test(n)}(t))return t;let e=t.parentElement;if(!e){let e=t.getRootNode();if(e instanceof ShadowRoot){t=e.host;continue}break}t=e}return window}(e.dom),n=()=>{let n=function({doc:e,view:t,scrollContainer:n}){let r=t.dom.getBoundingClientRect(),i=n?n===window?{top:0,bottom:window.innerHeight}:n.getBoundingClientRect():{top:0,bottom:window.innerHeight},o=Math.max(r.top,i.top)-200,s=Math.min(r.bottom,i.bottom)+200;if(o>=s)return{top:0,bottom:e.content.size};let a="rtl"===getComputedStyle(t.dom).direction?Math.max(r.right-2,r.left+2):r.left+2,l=t.posAtCoords({left:a,top:o+2}),c=t.posAtCoords({left:a,top:s-2});return{top:l?l.pos:0,bottom:c?c.pos:e.content.size}}({view:e,doc:e.state.doc,scrollContainer:t}),r=t8.getState(e.state);if((null==r?void 0:r.topPos)===n.top&&(null==r?void 0:r.bottomPos)===n.bottom)return;let i=e.state.tr.setMeta(t8,{positions:n});e.dispatch(i)},r=null,i=0,o=()=>{null===r&&(r=requestAnimationFrame(()=>{r=null;let e=performance.now();e-i>=150?(i=e,n()):o()}))};return t.addEventListener("scroll",o,{passive:!0}),n(),{update(t,n){e.state.doc.content.size!==n.doc.content.size&&o()},destroy:()=>{null!==r&&cancelAnimationFrame(r),t.removeEventListener("scroll",o)}}}var nr=V.Extension.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:t7,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){return[function({editor:e,options:t}){let n=t.dataAttribute?`data-${t.dataAttribute.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}`:`data-${t7}`;return new U.Plugin({key:t8,state:nt,view:nn,props:{decorations:({doc:r,selection:i})=>(function({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){var o,s;if(!(e.isEditable||!t.showOnlyWhenEditable))return null;let{anchor:a}=i,l=[],c=e.isEmpty,d={emptyEditor:t.emptyEditorClass,emptyNode:t.emptyNodeClass};if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),o=i.depth>0?i.node(1):i.nodeAfter,s=i.depth>0?i.before(1):a;if(o&&o.type.isTextblock&&(0,V.isNodeEmpty)(o)){let r=a>=s&&a<=s+o.nodeSize;l.push(ne({editor:e,isEmptyDoc:c,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:d,node:o,pos:s}))}}else{let i=t8.getState(e.state),u=null!=(o=null==i?void 0:i.topPos)?o:0,h=null!=(s=null==i?void 0:i.bottomPos)?s:r.content.size;r.nodesBetween(u,h,(r,i)=>{let o=a>=i&&a<=i+r.nodeSize,s=!r.isLeaf&&(0,V.isNodeEmpty)(r);return r.type.isTextblock&&(o||!t.showOnlyCurrent)&&s&&l.push(ne({editor:e,isEmptyDoc:c,dataAttribute:n,hasAnchor:o,placeholder:t.placeholder,classes:d,node:r,pos:i})),t.includeChildren})}return J.DecorationSet.create(r,l)})({editor:e,options:t,dataAttribute:n,doc:r,selection:i})}})}({editor:this.editor,options:this.options})]}});function ni({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||(null==t?void 0:t.type)===e}V.Extension.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new U.Plugin({key:new U.PluginKey("selection"),props:{decorations:n=>n.selection.empty||e.isFocused||!e.isEditable||(0,V.isNodeSelection)(n.selection)||e.view.dragging?null:J.DecorationSet.create(n.doc,[J.Decoration.inline(n.selection.from,n.selection.to,{class:t.className})])}})]}});var no=V.Extension.create({name:"trailingNode",addOptions:()=>({node:void 0,notAfter:[]}),addProseMirrorPlugins(){var e;let t=new U.PluginKey(this.name),n=this.options.node||(null==(e=this.editor.schema.topNodeType.contentMatch.defaultType)?void 0:e.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(n).includes(e.name));return[new U.Plugin({key:t,appendTransaction:(e,r,i)=>{let{doc:o,tr:s,schema:a}=i,l=t.getState(i),c=o.content.size,d=a.nodes[n];if(!e.some(e=>e.getMeta("skipTrailingNode"))&&l)return s.insert(c,d.create())},state:{init:(e,t)=>!ni({node:t.tr.doc.lastChild,types:r}),apply:(e,t)=>!e.docChanged||e.getMeta("__uniqueIDTransaction")?t:!ni({node:e.doc.lastChild,types:r})}})]}}),ns=V.Extension.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:t})=>t3(e,t),redo:()=>({state:e,dispatch:t})=>t4(e,t)}),addProseMirrorPlugins(){return[function(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new U.Plugin({key:t1,state:{init:()=>new tJ(tK.empty,tK.empty,null,0,-1),apply:(t,n,r)=>(function(e,t,n,r){let i=n.getMeta(t1),o;if(i)return i.historyState;n.getMeta(t2)&&(e=new tJ(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(t1))if(s.getMeta(t1).redo)return new tJ(e.done.addTransform(n,void 0,r,t0(t)),e.undone,tX(n.mapping.maps),e.prevTime,e.prevComposition);else return new tJ(e.done,e.undone.addTransform(n,void 0,r,t0(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))if(o=n.getMeta("rebased"))return new tJ(e.done.rebased(n,o),e.undone.rebased(n,o),tZ(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new tJ(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),tZ(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let i=n.getMeta("composition"),o=0==e.prevTime||!s&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(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}(n,e.prevRanges)),a=s?tZ(e.prevRanges,n.mapping):tX(n.mapping.maps);return new tJ(e.done.addTransform(n,o?t.selection.getBookmark():void 0,r,t0(t)),tK.empty,a,n.time,null==i?e.prevComposition:i)}})(n,r,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?t3:"historyRedo"==n?t4:null;return!!r&&!!e.editable&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}(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()}}}),na=V.Mark.create({name:"subscript",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"sub"},{style:"vertical-align",getAttrs:e=>"sub"===e&&null}],renderHTML({HTMLAttributes:e}){return["sub",(0,V.mergeAttributes)(this.options.HTMLAttributes,e),0]},addCommands(){return{setSubscript:()=>({commands:e})=>e.setMark(this.name),toggleSubscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSubscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),nl=V.Mark.create({name:"superscript",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"sup"},{style:"vertical-align",getAttrs:e=>"super"===e&&null}],renderHTML({HTMLAttributes:e}){return["sup",(0,V.mergeAttributes)(this.options.HTMLAttributes,e),0]},addCommands(){return{setSuperscript:()=>({commands:e})=>e.setMark(this.name),toggleSuperscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSuperscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}});e.i(150663);var nc=e.i(608926);function nd(e){return"left"===e||"right"===e||"center"===e?e:null}function nu(){return{default:null,parseHTML:e=>{let t,n;return t=(e.style.textAlign||"").trim().toLowerCase(),n=(e.getAttribute("align")||"").trim().toLowerCase(),nd(t||n)},renderHTML:e=>e.align?{style:`text-align: ${e.align}`}:{}}}var nh=V.Node.create({name:"tableCell",addOptions:()=>({HTMLAttributes:{}}),content:"block+",addAttributes:()=>({colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{var t,n;let r=e.getAttribute("colwidth"),i=r?r.split(",").map(e=>parseInt(e,10)):null;if(!i){let r=null==(t=e.closest("table"))?void 0:t.querySelectorAll("colgroup > col"),i=Array.from((null==(n=e.parentElement)?void 0:n.children)||[]).indexOf(e);if(i&&i>-1&&r&&r[i]){let e=r[i].getAttribute("width");return e?[parseInt(e,10)]:null}}return i}},align:nu()}),tableRole:"cell",isolating:!0,parseHTML:()=>[{tag:"td"}],renderHTML({HTMLAttributes:e}){return["td",(0,V.mergeAttributes)(this.options.HTMLAttributes,e),0]}}),np=V.Node.create({name:"tableHeader",addOptions:()=>({HTMLAttributes:{}}),content:"block+",addAttributes:()=>({colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{let t=e.getAttribute("colwidth");return t?t.split(",").map(e=>parseInt(e,10)):null}},align:nu()}),tableRole:"header_cell",isolating:!0,parseHTML:()=>[{tag:"th"}],renderHTML({HTMLAttributes:e}){return["th",(0,V.mergeAttributes)(this.options.HTMLAttributes,e),0]}}),nf=V.Node.create({name:"tableRow",addOptions:()=>({HTMLAttributes:{}}),content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML:()=>[{tag:"tr"}],renderHTML({HTMLAttributes:e}){return["tr",(0,V.mergeAttributes)(this.options.HTMLAttributes,e),0]}});function nm(e,t){return t?["width",`${Math.max(t,e)}px`]:["min-width",`${e}px`]}function ng(e,t,n,r,i,o){var s;let a=0,l=!0,c=t.firstChild,d=e.firstChild;if(null!==d)for(let e=0,n=0;e<d.childCount;e+=1){let{colspan:s,colwidth:u}=d.child(e).attrs;for(let e=0;e<s;e+=1,n+=1){let s=i===n?o:u&&u[e],d=s?`${s}px`:"";if(a+=s||r,s||(l=!1),c){if(c.style.width!==d){let[e,t]=nm(r,s);c.style.setProperty(e,t)}c=c.nextSibling}else{let e=document.createElement("col"),[n,i]=nm(r,s);e.style.setProperty(n,i),t.appendChild(e)}}}for(;c;){let e=c.nextSibling;null==(s=c.parentNode)||s.removeChild(c),c=e}let u=e.attrs.style&&"string"==typeof e.attrs.style&&/\bwidth\s*:/i.test(e.attrs.style);l&&!u?(n.style.width=`${a}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${a}px`)}var ny=class{constructor(e,t){this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),e.attrs.style&&(this.table.style.cssText=e.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ng(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type===this.node.type&&(this.node=e,ng(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){let t=e.target,n=this.dom.contains(t),r=this.contentDOM.contains(t);return!!n&&!r&&("attributes"===e.type||"childList"===e.type||"characterData"===e.type)}};function nb(e,t){return t?e.createChecked(null,t):e.createAndFill()}var nv=({editor:e})=>{let{selection:t}=e.state;if(!(t instanceof nc.CellSelection))return!1;let n=0,r=(0,V.findParentNodeClosestToPos)(t.ranges[0].$from,e=>"table"===e.type.name);return null==r||r.node.descendants(e=>{if("table"===e.type.name)return!1;["tableCell","tableHeader"].includes(e.type.name)&&(n+=1)}),n===t.ranges.length&&(e.commands.deleteTable(),!0)},nw=function(e,t,n={}){var r;let i=null!=(r=n.cellLineSeparator)?r:"\x1f";if(!e||!e.content||0===e.content.length)return"";let o=[];e.content.forEach(e=>{let n=[];e.content&&e.content.forEach(e=>{var r;let o=((e.content&&Array.isArray(e.content)&&e.content.length>1?e.content.map(e=>t.renderChildren(e)).join(i):e.content?t.renderChildren(e.content):"")||"").replace(/\s+/g," ").trim(),s="tableHeader"===e.type,a=nd(null==(r=e.attrs)?void 0:r.align);n.push({text:o,isHeader:s,align:a})}),o.push(n)});let s=o.reduce((e,t)=>Math.max(e,t.length),0);if(0===s)return"";let a=Array.from({length:s}).fill(0);o.forEach(e=>{var t;for(let n=0;n<s;n+=1){let r=((null==(t=e[n])?void 0:t.text)||"").length;r>a[n]&&(a[n]=r),a[n]<3&&(a[n]=3)}});let l=(e,t)=>e+" ".repeat(Math.max(0,t-e.length)),c=o[0],d=c.some(e=>e.isHeader),u=Array.from({length:s}).fill(null);o.forEach(e=>{var t;for(let n=0;n<s;n+=1)!u[n]&&(null==(t=e[n])?void 0:t.align)&&(u[n]=e[n].align)});let h="\n",p=Array.from({length:s}).map((e,t)=>d&&c[t]&&c[t].text||"");return h+=`| ${p.map((e,t)=>l(e,a[t])).join(" | ")} |
108
- | ${a.map((e,t)=>{let n=Math.max(3,e),r=u[t];return"left"===r?`:${"-".repeat(n)}`:"right"===r?`${"-".repeat(n)}:`:"center"===r?`:${"-".repeat(n)}:`:"-".repeat(n)}).join(" | ")} |
109
- `,(d?o.slice(1):o).forEach(e=>{h+=`| ${Array.from({length:s}).fill(0).map((t,n)=>l(e[n]&&e[n].text||"",a[n])).join(" | ")} |
110
- `}),h},nx=V.Node.create({name:"table",addOptions:()=>({HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:ny,lastColumnResizable:!0,allowTableNodeSelection:!1}),content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML:()=>[{tag:"table"}],renderHTML({node:e,HTMLAttributes:t}){let{colgroup:n,tableWidth:r,tableMinWidth:i}=function(e,t){let n=0,r=!0,i=[],o=e.firstChild;if(!o)return{};for(let e=0,s=0;e<o.childCount;e+=1){let{colspan:a,colwidth:l}=o.child(e).attrs;for(let e=0;e<a;e+=1,s+=1){let o=void 0===s?void 0:l&&l[e];n+=o||t,o||(r=!1);let[a,c]=nm(t,o);i.push(["col",{style:`${a}: ${c}`}])}}return{colgroup:["colgroup",{},...i],tableWidth:r?`${n}px`:"",tableMinWidth:r?"":`${n}px`}}(e,this.options.cellMinWidth),o=t.style,s=["table",(0,V.mergeAttributes)(this.options.HTMLAttributes,t,{style:o||(r?`width: ${r}`:`min-width: ${i}`)}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},s]:s},parseMarkdown:(e,t)=>{let n=[],r=Array.isArray(e.align)?e.align:[];if(e.header){let i=[];e.header.forEach((e,n)=>{var o;let s=nd(null!=(o=r[n])?o:e.align);i.push(t.createNode("tableHeader",s?{align:s}:{},[{type:"paragraph",content:t.parseInline(e.tokens)}]))}),n.push(t.createNode("tableRow",{},i))}return e.rows&&e.rows.forEach(e=>{let i=[];e.forEach((e,n)=>{var o;let s=nd(null!=(o=r[n])?o:e.align);i.push(t.createNode("tableCell",s?{align:s}:{},[{type:"paragraph",content:t.parseInline(e.tokens)}]))}),n.push(t.createNode("tableRow",{},i))}),t.createNode("table",void 0,n)},renderMarkdown:(e,t)=>nw(e,t),addCommands:()=>({insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:o})=>{let s=function(e,t,n,r){let i=function(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;let t={};return Object.keys(e.nodes).forEach(n=>{let r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}(e),o=[],s=[];for(let e=0;e<n;e+=1){let e=nb(i.cell,void 0);if(e&&s.push(e),r){let e=nb(i.header_cell,void 0);e&&o.push(e)}}let a=[];for(let e=0;e<t;e+=1)a.push(i.row.createChecked(null,r&&0===e?o:s));return i.table.createChecked(null,a)}(o.schema,e,t,n);if(i){let e=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(U.TextSelection.near(r.doc.resolve(e)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>(0,nc.addColumnBefore)(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>(0,nc.addColumnAfter)(e,t),deleteColumn:()=>({state:e,dispatch:t})=>(0,nc.deleteColumn)(e,t),addRowBefore:()=>({state:e,dispatch:t})=>(0,nc.addRowBefore)(e,t),addRowAfter:()=>({state:e,dispatch:t})=>(0,nc.addRowAfter)(e,t),deleteRow:()=>({state:e,dispatch:t})=>(0,nc.deleteRow)(e,t),deleteTable:()=>({state:e,dispatch:t})=>(0,nc.deleteTable)(e,t),mergeCells:()=>({state:e,dispatch:t})=>(0,nc.mergeCells)(e,t),splitCell:()=>({state:e,dispatch:t})=>(0,nc.splitCell)(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>(0,nc.toggleHeader)("column")(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>(0,nc.toggleHeader)("row")(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>(0,nc.toggleHeaderCell)(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>!!(0,nc.mergeCells)(e,t)||(0,nc.splitCell)(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>(0,nc.setCellAttr)(e,t)(n,r),goToNextCell:()=>({state:e,dispatch:t})=>(0,nc.goToNextCell)(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>(0,nc.goToNextCell)(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&(0,nc.fixTables)(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){let n=nc.CellSelection.create(t.doc,e.anchorCell,e.headCell);t.setSelection(n)}return!0}}),addKeyboardShortcuts(){return{Tab:()=>!!this.editor.commands.goToNextCell()||!!this.editor.can().addRowAfter()&&this.editor.chain().addRowAfter().goToNextCell().run(),"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:nv,"Mod-Backspace":nv,Delete:nv,"Mod-Delete":nv}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[(0,nc.columnResizing)({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],(0,nc.tableEditing)({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){let e=this.options.resizable&&this.editor.isEditable,t=this.options.View;return e||!t?null:({node:e,view:n})=>new t(e,this.options.cellMinWidth,n)},extendNodeSchema(e){let t={name:e.name,options:e.options,storage:e.storage};return{tableRole:(0,V.callOrReturn)((0,V.getExtensionField)(e,"tableRole",t))}}});V.Extension.create({name:"tableKit",addExtensions(){let e=[];return!1!==this.options.table&&e.push(nx.configure(this.options.table)),!1!==this.options.tableCell&&e.push(nh.configure(this.options.tableCell)),!1!==this.options.tableHeader&&e.push(np.configure(this.options.tableHeader)),!1!==this.options.tableRow&&e.push(nf.configure(this.options.tableRow)),e}});var nk=Object.defineProperty,nS="textStyle",nC=/^\s*([-+*])\s$/,nE=V.Node.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:e}){return["ul",(0,V.mergeAttributes)(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>"list"!==e.type||e.ordered?[]:{type:"bulletList",content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(nS)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=(0,V.wrappingInputRule)({find:nC,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=(0,V.wrappingInputRule)({find:nC,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(nS),editor:this.editor})),[e]}}),nM=V.Node.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",(0,V.mergeAttributes)(this.options.HTMLAttributes,e),0]},markdownTokenName:"list_item",parseMarkdown:(e,t)=>{var n,r,i,o;if("list_item"!==e.type)return[];let s=null!=(n=t.parseBlockChildren)?n:t.parseChildren,a=[];if(e.tokens&&e.tokens.length>0){let n;if(n=null==(r=e.tokens)?void 0:r[0],e.text&&(null==(i=e.tokens)?void 0:i.length)===1&&(null==n?void 0:n.type)==="list"&&n.ordered&&n.raw===e.text)return{type:"listItem",content:[{type:"paragraph",content:(o=e.text||"",t.tokenizeInline?t.parseInline(t.tokenizeInline(o)):t.parseInline([{type:"text",raw:o,text:o}]))}]};if(e.tokens.some(e=>"paragraph"===e.type))a=s(e.tokens);else{let n=e.tokens[0];if(n&&"text"===n.type&&n.tokens&&n.tokens.length>0){if(a=[{type:"paragraph",content:t.parseInline(n.tokens)}],e.tokens.length>1){let t=s(e.tokens.slice(1));a.push(...t)}}else a=s(e.tokens)}}return 0===a.length&&(a=[{type:"paragraph",content:[]}]),{type:"listItem",content:a}},renderMarkdown:(e,t,n)=>(0,V.renderNestedMarkdownContent)(e,t,e=>{var t,n;if("bulletList"===e.parentType)return"- ";if("orderedList"===e.parentType){let r=(null==(n=null==(t=e.meta)?void 0:t.parentAttrs)?void 0:n.start)||1;return`${r+e.index}. `}return"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),nN={},nA={findListItemPos:()=>nR,getNextListDepth:()=>nO,handleBackspace:()=>nP,handleDelete:()=>n_,hasListBefore:()=>nD,hasListItemAfter:()=>n$,hasListItemBefore:()=>nj,listItemHasSubList:()=>nI,nextListIsDeeper:()=>nL,nextListIsHigher:()=>nz};for(var nT in nA)nk(nN,nT,{get:nA[nT],enumerable:!0});var nR=(e,t)=>{let{$from:n}=t.selection,r=(0,V.getNodeType)(e,t.schema),i=n.depth,o=n.pos,s=null;for(;i>0&&null===s;)n.node(i).type===r?s=i:(i-=1,o-=1);return null===s?null:{$pos:t.doc.resolve(o),depth:s}},nO=(e,t)=>{let n=nR(e,t);if(!n)return!1;let[,r]=(0,V.getNodeAtPosition)(t,e,n.$pos.pos+4);return r},nD=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),o=e.doc.resolve(i).node();return!!o&&!!n.includes(o.type.name)},nj=(e,t)=>{var n;let{$anchor:r}=t.selection,i=t.doc.resolve(r.pos-2);return 0!==i.index()&&(null==(n=i.nodeBefore)?void 0:n.type.name)===e},nI=(e,t,n)=>{if(!n)return!1;let r=(0,V.getNodeType)(e,t.schema),i=!1;return n.descendants(e=>{e.type===r&&(i=!0)}),i},nP=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!(0,V.isNodeActive)(e.state,t)&&nD(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 o=i.at(-1);if(!o)return!1;let s=e.state.doc.resolve(r.start()+o.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},s.end()).joinForward().run()}if(!(0,V.isNodeActive)(e.state,t)||!(0,V.isAtStartOfNode)(e.state))return!1;let r=nR(t,e.state);if(!r)return!1;let i=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=nI(t,e.state,i);return nj(t,e.state)&&!o?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},nL=(e,t)=>{let n=nO(e,t),r=nR(e,t);return!!r&&!!n&&n>r.depth},nz=(e,t)=>{let n=nO(e,t),r=nR(e,t);return!!r&&!!n&&n<r.depth},n_=(e,t)=>{if(!(0,V.isNodeActive)(e.state,t)||!(0,V.isAtEndOfNode)(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!(!n.empty&&r.sameParent(i))&&(nL(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():nz(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward())},n$=(e,t)=>{var n;let{$anchor:r}=t.selection,i=t.doc.resolve(r.pos-r.parentOffset-2);return i.index()!==i.parent.childCount-1&&(null==(n=i.nodeAfter)?void 0:n.type.name)===e},nH=V.Extension.create({name:"listKeymap",addOptions:()=>({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})=>{void 0!==e.state.schema.nodes[n]&&n_(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&n_(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&nP(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&nP(e,n,r)&&(t=!0)}),t}}}}),nB=/^(\s*)(\d+)\.\s+(.*)$/,nF=/^\s/,nV="textStyle",nU=/^(\d+)\.\s$/,nW=V.Node.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){let{start:t,...n}=e;return 1===t?["ol",(0,V.mergeAttributes)(this.options.HTMLAttributes,n),0]:["ol",(0,V.mergeAttributes)(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>{var n;if("list"!==e.type||!e.ordered)return[];let r=e.start||1,i=e.items?(n=e.items,n.map(e=>{if("list_item"!==e.type)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if("paragraph"===e.type||"list"===e.type||"blockquote"===e.type||"code"===e.type)n.push(...t.parseChildren([e]));else if("text"===e.type&&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}})):[];return 1!==r?{type:"orderedList",attrs:{start:r},content:i}:{type:"orderedList",content:i}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"orderedList",level:"block",start:e=>{let t=e.match(/^(\s*)(\d+)\.\s+/),n=null==t?void 0:t.index;return void 0!==n?n:-1},tokenize:(e,t,n)=>{var r;let i=e.split("\n"),[o,s]=function(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],o=i.match(nB);if(!o)break;let[,s,a,l]=o,c=s.length,d=[l],u=n+1,h=[i],p=!1;for(;u<e.length;){let t=e[u];if(t.match(nB))break;if(""===t.trim())h.push(t),d.push(""),p=!0,u+=1;else if(t.match(nF))h.push(t),d.push(t.slice(c+2)),u+=1;else{if(p)break;h.push(t),d.push(t),u+=1}}t.push({indent:c,number:parseInt(a,10),content:d.join("\n").trim(),contentLines:d,raw:h.join("\n")}),r=u,n=u}return[t,r]}(i);if(0===o.length)return;let a=function e(t,n,r){let i=[],o=0;for(;o<t.length;){let s=t[o];if(s.indent===n){let{paragraphLines:a,blockLines:l}=function(e){let t=[],n=[],r=!1;return e.forEach(e=>{let i;if(r)return void n.push(e);if(""===e.trim()||t.length>0&&(i=e.trimStart(),/^[-+*]\s+/.test(i)||/^\d+\.\s+/.test(i)||/^>\s?/.test(i)||/^```/.test(i)||/^~~~/.test(i))){r=!0,n.push(e);return}t.push(e)}),{paragraphLines:t,blockLines:n}}(s.contentLines),c=a.join("\n").trim(),d=[];c&&d.push({type:"paragraph",raw:c,tokens:r.inlineTokens(c)});let u=l.join("\n").trim();if(u){let e=r.blockTokens(u);d.push(...e)}let h=o+1,p=[];for(;h<t.length&&t[h].indent>n;)p.push(t[h]),h+=1;if(p.length>0){let t=Math.min(...p.map(e=>e.indent)),n=e(p,t,r);d.push({type:"list",ordered:!0,start:p[0].number,items:n,raw:p.map(e=>e.raw).join("\n")})}i.push({type:"list_item",raw:s.raw,tokens:d}),o=h}else o+=1}return i}(o,0,n);if(0!==a.length)return{type:"list",ordered:!0,start:(null==(r=o[0])?void 0:r.number)||1,items:a,raw:i.slice(0,s).join("\n")}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(nV)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=(0,V.wrappingInputRule)({find:nU,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=(0,V.wrappingInputRule)({find:nU,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(nV)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),nK=/^\s*(\[([( |x])?\])\s$/,nq=V.Node.create({name:"taskItem",addOptions:()=>({nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}),content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes:()=>({checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute("data-checked");return""===t||"true"===t},renderHTML:e=>({"data-checked":e.checked})}}),parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",(0,V.mergeAttributes)(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)=>{var n;let r=(null==(n=e.attrs)?void 0:n.checked)?"x":" ",i=`- [${r}] `;return(0,V.renderNestedMarkdownContent)(e,t,i)},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"),o=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=e=>{var t,n;a.ariaLabel=(null==(n=null==(t=this.options.a11y)?void 0:t.checkboxLabel)?void 0:n.call(t,e,a.checked))||`Task item checkbox for ${e.textContent||"empty task item"}`};c(e),o.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",e=>e.preventDefault()),a.addEventListener("change",t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}let{checked:i}=t.target;r.isEditable&&"function"==typeof n&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if("number"!=typeof t)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...null==r?void 0:r.attrs,checked:i}),!0}).run(),r.isEditable||!this.options.onReadOnlyChecked||this.options.onReadOnlyChecked(e,i)||(a.checked=!a.checked)}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,o.append(a,s),i.append(o,l),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let d=new Set(Object.keys(t));return{dom:i,contentDOM:l,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,c(e);let t=r.extensionManager.attributes,n=(0,V.getRenderedAttributes)(e,t),o=new Set(Object.keys(n)),s=this.options.HTMLAttributes;return d.forEach(e=>{o.has(e)||(e in s?i.setAttribute(e,s[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{null==t?e in s?i.setAttribute(e,s[e]):i.removeAttribute(e):i.setAttribute(e,t)}),d=o,!0}}}},addInputRules(){return[(0,V.wrappingInputRule)({find:nK,type:this.type,getAttributes:e=>({checked:"x"===e[e.length-1]})})]}}),nJ=V.Node.create({name:"taskList",addOptions:()=>({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",(0,V.mergeAttributes)(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,"\n"):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var t;let n=null==(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))?void 0:t.index;return void 0!==n?n:-1},tokenize(e,t,n){let r=e=>{let t=(0,V.parseIndentedBlocks)(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),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=(0,V.parseIndentedBlocks)(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),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()}}});V.Extension.create({name:"listKit",addExtensions(){let e=[];return!1!==this.options.bulletList&&e.push(nE.configure(this.options.bulletList)),!1!==this.options.listItem&&e.push(nM.configure(this.options.listItem)),!1!==this.options.listKeymap&&e.push(nH.configure(this.options.listKeymap)),!1!==this.options.orderedList&&e.push(nW.configure(this.options.orderedList)),!1!==this.options.taskItem&&e.push(nq.configure(this.options.taskItem)),!1!==this.options.taskList&&e.push(nJ.configure(this.options.taskList)),e}});var nG=V.Extension.create({name:"textAlign",addOptions:()=>({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),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))}},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")}}}),nX=(e,t)=>{if("slot"===e)return 0;if(e instanceof Function)return e(t);let{children:n,...r}=null!=t?t:{};if("svg"===e)throw Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,r,n]},nZ=/^\s*>\s$/,nY=V.Node.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return nX("blockquote",{...(0,V.mergeAttributes)(this.options.HTMLAttributes,e),children:nX("slot",{})})},parseMarkdown:(e,t)=>{var n;let r=null!=(n=t.parseBlockChildren)?n:t.parseChildren;return t.createNode("blockquote",void 0,r(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return"";let n=[];return e.content.forEach((e,r)=>{var i,o;let s=(null!=(o=null==(i=t.renderChild)?void 0:i.call(t,e,r))?o:t.renderChildren([e])).split("\n").map(e=>""===e.trim()?">":`> ${e}`);n.push(s.join("\n"))}),n.join(`
111
- >
112
- `)},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()}},addInputRules(){return[(0,V.wrappingInputRule)({find:nZ,type:this.type})]}}),nQ=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,n0=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,n1=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,n2=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,n5=V.Mark.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&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 nX("strong",{...(0,V.mergeAttributes)(this.options.HTMLAttributes,e),children:nX("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[(0,V.markInputRule)({find:nQ,type:this.type}),(0,V.markInputRule)({find:n1,type:this.type})]},addPasteRules(){return[(0,V.markPasteRule)({find:n0,type:this.type}),(0,V.markPasteRule)({find:n2,type:this.type})]}}),n3=/(^|[^`])`([^`]+)`(?!`)$/,n4=/(^|[^`])`([^`]+)`(?!`)/g,n6=V.Mark.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",(0,V.mergeAttributes)(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[(0,V.markInputRule)({find:n3,type:this.type})]},addPasteRules(){return[(0,V.markPasteRule)({find:n4,type:this.type})]}}),n9=V.Node.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n\n"):""}),n7=V.Node.create({name:"hardBreak",markdownTokenName:"br",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",(0,V.mergeAttributes)(this.options.HTMLAttributes,e)]},renderText:()=>"\n",renderMarkdown:()=>`
113
- `,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:o}=this.options,{splittableMarks:s}=r.extensionManager,a=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&a&&o){let t=a.filter(e=>s.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),n8=V.Node.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){let n=this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0];return[`h${n}`,(0,V.mergeAttributes)(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var n;let r=(null==(n=e.attrs)?void 0:n.level)?parseInt(e.attrs.level,10):1,i="#".repeat(r);return e.content?`${i} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.setNode(this.name,e),toggleHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.toggleNode(this.name,"paragraph",e)}},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=>(0,V.textblockTypeInputRule)({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),re=V.Node.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{},nextNodeType:"paragraph"}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",(0,V.mergeAttributes)(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!(0,V.canInsertNode)(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return(0,V.isNodeSelection)(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(U.TextSelection.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(U.NodeSelection.create(t.doc,n.pos)):t.setSelection(U.TextSelection.create(t.doc,n.pos));else{let i=e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType,o=null==i?void 0:i.create();o&&(t.insert(r,o),t.setSelection(U.TextSelection.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[(0,V.nodeInputRule)({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),rt=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,rn=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,rr=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,ri=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,ro=V.Mark.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",(0,V.mergeAttributes)(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[(0,V.markInputRule)({find:rt,type:this.type}),(0,V.markInputRule)({find:rr,type:this.type})]},addPasteRules(){return[(0,V.markPasteRule)({find:rn,type:this.type}),(0,V.markPasteRule)({find:ri,type:this.type})]}}),rs="&nbsp;",ra=V.Node.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",(0,V.mergeAttributes)(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(1===n.length&&"image"===n[0].type)return t.parseChildren([n[0]]);let r=t.parseInline(n);return 1===n.length&&"text"===n[0].type&&(n[0].raw===rs||n[0].text===rs||" "===n[0].raw||" "===n[0].text)&&1===r.length&&"text"===r[0].type&&(r[0].text===rs||" "===r[0].text)?t.createNode("paragraph",void 0,[]):t.createNode("paragraph",void 0,r)},renderMarkdown:(e,t,n)=>{var r,i;if(!e)return"";let o=Array.isArray(e.content)?e.content:[];if(0===o.length){let e=Array.isArray(null==(r=null==n?void 0:n.previousNode)?void 0:r.content)?n.previousNode.content:[];return(null==(i=null==n?void 0:n.previousNode)?void 0:i.type)==="paragraph"&&0===e.length?rs:""}return t.renderChildren(o)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),rl=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,rc=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,rd=V.Mark.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",(0,V.mergeAttributes)(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[(0,V.markInputRule)({find:rl,type:this.type})]},addPasteRules(){return[(0,V.markPasteRule)({find:rc,type:this.type})]}}),ru=V.Node.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),rh=V.Mark.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",(0,V.mergeAttributes)(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown:(e,t)=>`++${t.renderChildren(e)}++`,markdownTokenizer:{name:"underline",level:"inline",start:e=>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()}}}),rp=V.Extension.create({name:"starterKit",addExtensions(){var e,t,n,r;let i=[];return!1!==this.options.bold&&i.push(n5.configure(this.options.bold)),!1!==this.options.blockquote&&i.push(nY.configure(this.options.blockquote)),!1!==this.options.bulletList&&i.push(nE.configure(this.options.bulletList)),!1!==this.options.code&&i.push(n6.configure(this.options.code)),!1!==this.options.codeBlock&&i.push(q.configure(this.options.codeBlock)),!1!==this.options.document&&i.push(n9.configure(this.options.document)),!1!==this.options.dropcursor&&i.push(t6.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&i.push(t9.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&i.push(n7.configure(this.options.hardBreak)),!1!==this.options.heading&&i.push(n8.configure(this.options.heading)),!1!==this.options.undoRedo&&i.push(ns.configure(this.options.undoRedo)),!1!==this.options.horizontalRule&&i.push(re.configure(this.options.horizontalRule)),!1!==this.options.italic&&i.push(ro.configure(this.options.italic)),!1!==this.options.listItem&&i.push(nM.configure(this.options.listItem)),!1!==this.options.listKeymap&&i.push(nH.configure(null==(e=this.options)?void 0:e.listKeymap)),!1!==this.options.link&&i.push(tT.configure(null==(t=this.options)?void 0:t.link)),!1!==this.options.orderedList&&i.push(nW.configure(this.options.orderedList)),!1!==this.options.paragraph&&i.push(ra.configure(this.options.paragraph)),!1!==this.options.strike&&i.push(rd.configure(this.options.strike)),!1!==this.options.text&&i.push(ru.configure(this.options.text)),!1!==this.options.underline&&i.push(rh.configure(null==(n=this.options)?void 0:n.underline)),!1!==this.options.trailingNode&&i.push(no.configure(null==(r=this.options)?void 0:r.trailingNode)),i}});function rf(e){let t=e.regex,n={};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},{begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]}]});let r={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},i=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},s={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,r]};r.contains.push(s);let a={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},l=e.SHEBANG({binary:"(fish|bash|zsh|sh|csh|ksh|tcsh|dash|scsh)",relevance:10}),c={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0};return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],literal:["true","false"],built_in:["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset","alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias","set","shopt","autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp","chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"]},contains:[l,e.SHEBANG(),c,a,i,o,{match:/(\/[a-z._-]+)+/},s,{match:/\\"/},{className:"string",begin:/'/,end:/'/},{match:/\\'/},n]}}e.s(["default",0,rf],944404);let rm=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video","defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],rg=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),ry=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),rb=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),rv=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function rw(e){let t=e.regex,n={IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}},r=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,{begin:/-(webkit|moz|ms|o)-(?=[a-z])/},n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\.[a-zA-Z-][a-zA-Z0-9_-]*",relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+ry.join("|")+")"},{begin:":(:)?("+rb.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+rv.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...r,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...r,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:/@-?\w[\w]*(-\w+)*/},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:"and or not only",attribute:rg.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...r,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+rm.join("|")+")\\b"}]}}function rx(e){let t={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:t,illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"string",variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[e.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,illegal:/["']/}]}]}}e.s(["default",0,rw],334609),e.s(["default",0,rx],265590);let rk="[A-Za-z$_][0-9A-Za-z$_]*",rS=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],rC=["true","false","null","undefined","NaN","Infinity"],rE=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],rM=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],rN=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],rA=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],rT=[].concat(rN,rE,rM);function rR(e){var t;let n=e.regex,r=/<[A-Za-z0-9\\._:-]+/,i=/\/[A-Za-z0-9\\._:-]+>|\/>/,o={$pattern:rk,keyword:rS,literal:rC,built_in:rT,"variable.language":rA},s="[0-9](_?[0-9])*",a=`\\.(${s})`,l="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",c={className:"number",variants:[{begin:`(\\b(${l})((${a})|\\.)?|(${a}))[eE][+-]?(${s})\\b`},{begin:`\\b(${l})\\b((${a})\\b|\\.)?|(${a})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},d={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},u={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"xml"}},h={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"css"}},p={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"graphql"}},f={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,d]},m={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:rk+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},g=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,u,h,p,f,{match:/\$\d+/},c];d.contains=g.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(g)});let y=[].concat(m,d.contains),b=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(y)}]),v={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:b},w={variants:[{match:[/class/,/\s+/,rk,/\s+/,/extends/,/\s+/,n.concat(rk,"(",n.concat(/\./,rk),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,rk],scope:{1:"keyword",3:"title.class"}}]},x={relevance:0,match:n.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...rE,...rM]}},k={match:n.concat(/\b/,(t=[...rN,"super","import"].map(e=>`${e}\\s*\\(`),n.concat("(?!",t.join("|"),")")),rk,n.lookahead(/\s*\(/)),className:"title.function",relevance:0},S={begin:n.concat(/\./,n.lookahead(n.concat(rk,/(?![0-9A-Za-z$_(])/))),end:rk,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},C="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",E={match:[/const|var|let/,/\s+/,rk,/\s*/,/=\s*/,/(async\s*)?/,n.lookahead(C)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[v]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:b,CLASS_REFERENCE:x},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),{label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,u,h,p,f,m,{match:/\$\d+/},c,x,{scope:"attr",match:rk+n.lookahead(":"),relevance:0},E,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[m,e.REGEXP_MODE,{className:"function",begin:C,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:b}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:"<>",end:"</>"},{match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:r,"on:begin":(e,t)=>{let n,r=e[0].length+e.index,i=e.input[r];if("<"===i||","===i)return void t.ignoreMatch();">"!==i||((e,{after:t})=>{let n="</"+e[0].slice(1);return -1!==e.input.indexOf(n,t)})(e,{after:r})||t.ignoreMatch();let o=e.input.substring(r);if((n=o.match(/^\s*=/))||(n=o.match(/^\s+extends\s+/))&&0===n.index)return void t.ignoreMatch()},end:i}],subLanguage:"xml",contains:[{begin:r,end:i,skip:!0,contains:["self"]}]}]},{variants:[{match:[/function/,/\s+/,rk,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[v],illegal:/%/},{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[v,e.inherit(e.TITLE_MODE,{begin:rk,className:"title.function"})]},{match:/\.\.\./,relevance:0},S,{match:"\\$"+rk,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[v]},k,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},w,{match:[/get|set/,/\s+/,rk,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},v]},{match:/\$[(.]/}]}}function rO(e){let t=["true","false","null"],n={scope:"literal",beginKeywords:t.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:t},contains:[{className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},{match:/[{}[\],:]/,className:"punctuation",relevance:0},e.QUOTE_STRING_MODE,n,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function rD(e){let t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},i={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},o={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},s=e.inherit(i,{contains:[]}),a=e.inherit(o,{contains:[]});i.contains.push(a),o.contains.push(s);let l=[n,r];return[i,o,s,a].forEach(e=>{e.contains=e.contains.concat(l)}),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:l=l.concat(i,o)},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:l}]}]},n,{className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},i,o,{className:"quote",begin:"^>\\s+",contains:l,end:"$"},{className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},{begin:"^[-\\*]{3,}",end:"$"},r,{begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function rj(e){let t=e.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],i={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},o={className:"meta",begin:/^(>>>|\.\.\.) /},s={className:"subst",begin:/\{/,end:/\}/,keywords:i,illegal:/#/},a={begin:/\{\{/,relevance:0},l={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,o],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,o],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,o,a,s]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,o,a,s]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,a,s]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,a,s]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},c="[0-9](_?[0-9])*",d=`(\\b(${c}))?\\.(${c})|\\b(${c})\\.`,u=`\\b|${r.join("|")}`,h={className:"number",relevance:0,variants:[{begin:`(\\b(${c})|(${d}))[eE][+-]?(${c})[jJ]?(?=${u})`},{begin:`(${d})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${u})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${u})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${u})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${u})`},{begin:`\\b(${c})[jJ](?=${u})`}]},p={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:i,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},f={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i,contains:["self",o,h,l,e.HASH_COMMENT_MODE]}]};return s.contains=[l,h,o],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:i,illegal:/(<\/|\?)|=>/,contains:[o,h,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},l,p,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[f]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[h,f,l]}]}}function rI(e){let t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),o={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,t.lookahead(/\s*\(/))},s="([ui](8|16|32|64|128|size)|f(32|64))?",a=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],l=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:l,keyword:["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],literal:["true","false","Some","None","Ok","Err"],built_in:a},illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.COMMENT("/\\*","\\*/",{contains:["self"]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+s},{begin:"\\b0o([0-7_]+)"+s},{begin:"\\b0x([A-Fa-f0-9_]+)"+s},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+s}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:e.IDENT_RE+"::",keywords:{keyword:"Self",built_in:a,type:l}},{className:"punctuation",begin:"->"},o]}}function rP(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function rL(e){let t=e.regex,n=e.COMMENT("--","$"),r=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],i=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year","add","asc","collation","desc","final","first","last","view"].filter(e=>!r.includes(e)),o={match:t.concat(/\b/,t.either(...r),/\s*\(/),relevance:0,keywords:{built_in:r}};function s(e){return t.concat(/\b/,t.either(...e.map(e=>e.replace(/\s+/,"\\s+"))),/\b/)}let a={scope:"keyword",match:s(["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"]),relevance:0};return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:function(e,{exceptions:t,when:n}={}){return t=t||[],e.map(e=>e.match(/\|\d+$/)||t.includes(e)?e:n(e)?`${e}|0`:e)}(i,{when:e=>e.length<3}),literal:["true","false","unknown"],type:["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],built_in:["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"]},contains:[{scope:"type",match:s(["double precision","large object","with timezone","without timezone"])},a,o,{scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},{scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},{begin:/"/,end:/"/,contains:[{match:/""/}]},e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,{scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0}]}}e.s(["default",0,rR],441228),e.s(["default",0,rO],576500),e.s(["default",0,rD],194633),e.s(["default",0,rj],32033),e.s(["default",0,rI],623568),e.s(["default",0,rP],42420),e.s(["default",0,rL],278909);let rz="[A-Za-z$_][0-9A-Za-z$_]*",r_=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],r$=["true","false","null","undefined","NaN","Infinity"],rH=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],rB=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],rF=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],rV=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],rU=[].concat(rF,rH,rB);function rW(e){var t;let n,r,i,o,s,a,l,c,d,u,h,p,f,m,g,y,b,v,w,x,k,S,C,E,M,N=e.regex,A=(n=e.regex,r=/<[A-Za-z0-9\\._:-]+/,i=/\/[A-Za-z0-9\\._:-]+>|\/>/,o=(e,t)=>{let n,r=e[0].length+e.index,i=e.input[r];if("<"===i||","===i)return void t.ignoreMatch();">"!==i||((e,{after:t})=>{let n="</"+e[0].slice(1);return -1!==e.input.indexOf(n,t)})(e,{after:r})||t.ignoreMatch();let o=e.input.substring(r);if((n=o.match(/^\s*=/))||(n=o.match(/^\s+extends\s+/))&&0===n.index)return void t.ignoreMatch()},s={$pattern:rz,keyword:r_,literal:r$,built_in:rU,"variable.language":rV},a="[0-9](_?[0-9])*",l=`\\.(${a})`,c="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${c})((${l})|\\.)?|(${l}))[eE][+-]?(${a})\\b`},{begin:`\\b(${c})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},u={className:"subst",begin:"\\$\\{",end:"\\}",keywords:s,contains:[]},h={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"css"}},f={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,u],subLanguage:"graphql"}},m={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,u]},g={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:rz+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},u.contains=(y=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,p,f,m,{match:/\$\d+/},d]).concat({begin:/\{/,end:/\}/,keywords:s,contains:["self"].concat(y)}),v=(b=[].concat(g,u.contains)).concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:["self"].concat(b)}]),w={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:v},x={variants:[{match:[/class/,/\s+/,rz,/\s+/,/extends/,/\s+/,n.concat(rz,"(",n.concat(/\./,rz),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,rz],scope:{1:"keyword",3:"title.class"}}]},k={relevance:0,match:n.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...rH,...rB]}},S={match:n.concat(/\b/,(t=[...rF,"super","import"].map(e=>`${e}\\s*\\(`),n.concat("(?!",t.join("|"),")")),rz,n.lookahead(/\s*\(/)),className:"title.function",relevance:0},C={begin:n.concat(/\./,n.lookahead(n.concat(rz,/(?![0-9A-Za-z$_(])/))),end:rz,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},E="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",M={match:[/const|var|let/,/\s+/,rz,/\s*/,/=\s*/,/(async\s*)?/,n.lookahead(E)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[w]},{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:s,exports:{PARAMS_CONTAINS:v,CLASS_REFERENCE:k},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),{label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,p,f,m,g,{match:/\$\d+/},d,k,{scope:"attr",match:rz+n.lookahead(":"),relevance:0},M,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[g,e.REGEXP_MODE,{className:"function",begin:E,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:v}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:"<>",end:"</>"},{match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:r,"on:begin":o,end:i}],subLanguage:"xml",contains:[{begin:r,end:i,skip:!0,contains:["self"]}]}]},{variants:[{match:[/function/,/\s+/,rz,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[w],illegal:/%/},{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[w,e.inherit(e.TITLE_MODE,{begin:rz,className:"title.function"})]},{match:/\.\.\./,relevance:0},C,{match:"\\$"+rz,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[w]},S,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},x,{match:[/get|set/,/\s+/,rz,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},w]},{match:/\$[(.]/}]}),T=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],R={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},O={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:T},contains:[A.exports.CLASS_REFERENCE]},D={$pattern:rz,keyword:r_.concat(["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"]),literal:r$,built_in:rU.concat(T),"variable.language":rV},j={className:"meta",begin:"@"+rz},I=(e,t,n)=>{let r=e.contains.findIndex(e=>e.label===t);if(-1===r)throw Error("can not find mode to replace");e.contains.splice(r,1,n)};Object.assign(A.keywords,D),A.exports.PARAMS_CONTAINS.push(j);let P=A.contains.find(e=>"attr"===e.scope),L=Object.assign({},P,{match:N.concat(rz,N.lookahead(/\s*\?:/))});return A.exports.PARAMS_CONTAINS.push([A.exports.CLASS_REFERENCE,P,L]),A.contains=A.contains.concat([j,R,O,L]),I(A,"shebang",e.SHEBANG()),I(A,"use_strict",{className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/}),A.contains.find(e=>"func.def"===e.label).relevance=0,Object.assign(A,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),A}function rK(e){let t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(i,{begin:/\(/,end:/\)/}),s=e.inherit(e.APOS_STRING_MODE,{className:"string"}),a=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),l={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:/[\p{L}0-9._:-]+/u,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[r]},{begin:/'/,end:/'/,contains:[r]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[i,a,s,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[i,o,a,s]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},r,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[a]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[l],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[l],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:l}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function rq(e){let t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,{className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]}]},i=e.inherit(r,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),o={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},s=[{className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},{className:"number",begin:"\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b"},{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},{begin:/\{/,end:/\}/,contains:[o],illegal:"\\n",relevance:0},{begin:"\\[",end:"\\]",contains:[o],illegal:"\\n",relevance:0},{className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},r],a=[...s];return a.pop(),a.push(i),o.contains=a,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:s}}e.s(["default",0,rW],532270),e.s(["default",0,rK],503658),e.s(["default",0,rq],185503);var rJ=e.i(897802);let rG={};function rX(e){let t=G.newInstance();return e&&i(e),{highlight:n,highlightAuto:function(e,i){let o;(0,rJ.ok)("string"==typeof e,"expected `string` as `value`");let s=(i||rG).subset||r(),a=-1,l=0;for(;++a<s.length;){let r=s[a];if(!t.getLanguage(r))continue;let c=n(r,e,i);c.data&&void 0!==c.data.relevance&&c.data.relevance>l&&(l=c.data.relevance,o=c)}return o||{type:"root",children:[],data:{language:void 0,relevance:l}}},listLanguages:r,register:i,registerAlias:function(e,n){if("string"==typeof e)(0,rJ.ok)(void 0!==n),t.registerAliases("string"==typeof n?n:[...n],{languageName:e});else{let n;for(n in e)if(Object.hasOwn(e,n)){let r=e[n];t.registerAliases("string"==typeof r?r:[...r],{languageName:n})}}},registered:function(e){return!!t.getLanguage(e)}};function n(e,n,r){(0,rJ.ok)("string"==typeof e,"expected `string` as `name`"),(0,rJ.ok)("string"==typeof n,"expected `string` as `value`");let i=r||rG,o="string"==typeof i.prefix?i.prefix:"hljs-";if(!t.getLanguage(e))throw Error("Unknown language: `"+e+"` is not registered");t.configure({__emitter:rZ,classPrefix:o});let s=t.highlight(n,{ignoreIllegals:!0,language:e});if(s.errorRaised)throw Error("Could not highlight with `Highlight.js`",{cause:s.errorRaised});let a=s._emitter.root,l=a.data;return l.language=s.language,l.relevance=s.relevance,a}function r(){return t.listLanguages()}function i(e,n){if("string"==typeof e)(0,rJ.ok)(void 0!==n,"expected `grammar`"),t.registerLanguage(e,n);else{let n;for(n in e)Object.hasOwn(e,n)&&t.registerLanguage(n,e[n])}}}class rZ{constructor(e){this.options=e,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(""===e)return;let t=this.stack[this.stack.length-1],n=t.children[t.children.length-1];n&&"text"===n.type?n.value+=e:t.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,t){let n=this.stack[this.stack.length-1],r=e.root.children;t?n.children.push({type:"element",tagName:"span",properties:{className:[t]},children:r}):n.children.push(...r)}openNode(e){let t=this,n=e.split(".").map(function(e,n){return n?e+"_".repeat(n):t.options.classPrefix+e}),r=this.stack[this.stack.length-1],i={type:"element",tagName:"span",properties:{className:n},children:[]};r.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}e.s(["createLowlight",0,rX],993667);let rY=V.Node.create({name:"callout",group:"block",content:"block+",defining:!0,addAttributes:()=>({type:{default:"info",parseHTML:e=>e.getAttribute("data-callout-type")||"info",renderHTML:e=>({"data-callout-type":e.type})}}),parseHTML:()=>[{tag:'div[data-callout="true"]'}],renderHTML:({HTMLAttributes:e})=>["div",(0,V.mergeAttributes)(e,{"data-callout":"true",class:`callout callout-${e["data-callout-type"]||"info"}`}),0]});function rQ(e,t,n){let{selection:r,doc:i}=e,o=i.resolve(r.from);for(;o.depth>1;)o=i.resolve(o.before(o.depth));if(0===o.depth)return!1;let s=o.before(1),a=i.nodeAt(s);if(!a)return!1;let l=o.index(0),c="up"===n?l-1:l+1;if(c<0||c>=i.childCount)return!1;let d=i.child(c),u=e.tr,h=s+a.nodeSize,p="up"===n?s-d.nodeSize:h,f="up"===n?s:h+d.nodeSize;if("up"===n)u=(u=(u=u.delete(s,h)).insert(p,a)).setSelection(U.NodeSelection.create(u.doc,p));else{u=u.delete(s,h);let e=f-a.nodeSize;u=(u=u.insert(e,a)).setSelection(U.NodeSelection.create(u.doc,e))}return t&&t(u.scrollIntoView()),!0}let r0="cabinet-drag-handle",r1="cabinet-gutter-add",r2=V.Extension.create({name:"dragHandle",addKeyboardShortcuts:()=>({"Mod-Alt-ArrowUp":({editor:e})=>rQ(e.state,e.view.dispatch,"up"),"Mod-Alt-ArrowDown":({editor:e})=>rQ(e.state,e.view.dispatch,"down"),"Alt-Shift-ArrowUp":({editor:e})=>rQ(e.state,e.view.dispatch,"up"),"Alt-Shift-ArrowDown":({editor:e})=>rQ(e.state,e.view.dispatch,"down")}),addProseMirrorPlugins(){let e,t,n=null,r="u">typeof document?((e=document.getElementById(r0))||((e=document.createElement("div")).id=r0,e.setAttribute("data-drag-handle","true"),e.draggable=!0,e.innerHTML='<svg width="10" height="16" viewBox="0 0 10 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><circle cx="2.5" cy="3" r="1.2"/><circle cx="2.5" cy="8" r="1.2"/><circle cx="2.5" cy="13" r="1.2"/><circle cx="7.5" cy="3" r="1.2"/><circle cx="7.5" cy="8" r="1.2"/><circle cx="7.5" cy="13" r="1.2"/></svg>',Object.assign(e.style,{position:"absolute",display:"none",cursor:"grab",padding:"2px 4px",borderRadius:"4px",color:"var(--muted-foreground)",opacity:"0.55",zIndex:"40",userSelect:"none",transition:"opacity 120ms ease"}),e.addEventListener("mouseenter",()=>{e&&(e.style.opacity="1")}),e.addEventListener("mouseleave",()=>{e&&(e.style.opacity="0.55")}),document.body.appendChild(e)),e):null,i="u">typeof document?((t=document.getElementById(r1))||((t=document.createElement("button")).id=r1,t.type="button",t.setAttribute("aria-label","Add block"),t.title="Add block",t.innerHTML='<svg width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5 1V9M1 5H9" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>',Object.assign(t.style,{position:"absolute",display:"none",alignItems:"center",justifyContent:"center",width:"18px",height:"18px",cursor:"pointer",borderRadius:"4px",color:"var(--muted-foreground)",opacity:"0.55",zIndex:"40",transition:"opacity 120ms ease, background 120ms ease",background:"transparent",border:"none",padding:"0"}),t.addEventListener("mouseenter",()=>{t&&(t.style.opacity="1",t.style.background="var(--muted)")}),t.addEventListener("mouseleave",()=>{t&&(t.style.opacity="0.55",t.style.background="transparent")}),document.body.appendChild(t)),t):null,o=()=>{r&&(r.style.display="none"),i&&(i.style.display="none"),n=null};return[new U.Plugin({key:new U.PluginKey("cabinetDragHandle"),view:e=>{if(!r)return{destroy:()=>{}};let t=t=>{if(!e.editable)return;let s=e.dom.getBoundingClientRect();if(t.clientX<s.left-60||t.clientX>s.right+60||t.clientY<s.top||t.clientY>s.bottom)return void o();let a=function(e,t){let n=e.posAtCoords(t);if(!n)return null;let r=e.state.doc.resolve(n.inside>=0?n.inside:n.pos);for(;r.depth>0&&!r.parent.type.isBlock;)r=e.state.doc.resolve(r.before());let i=r.depth;for(;i>1&&"doc"!==e.state.doc.resolve(r.before(i)).parent.type.name;)i-=1;let o=0===i?0:r.before(Math.max(i,1)),s=e.state.doc.nodeAt(o);if(!s)return null;let a=e.nodeDOM(o);return{pos:o,node:s,dom:a}}(e,{left:Math.max(s.left+20,Math.min(s.right-20,t.clientX)),top:t.clientY});if(!a?.dom||!(a.dom instanceof HTMLElement))return void o();n=a;let l=a.dom.getBoundingClientRect();r.style.display="flex",r.style.top=`${window.scrollY+l.top+4}px`,r.style.left=`${window.scrollX+l.left-22}px`,i&&(i.style.display="flex",i.style.top=`${window.scrollY+l.top+4}px`,i.style.left=`${window.scrollX+l.left-44}px`)},s=()=>o(),a=()=>{if(!n)return;let t=n.pos+n.node.nodeSize,r=t<=e.state.doc.content.size,i=e.state.tr;if(r){let n=U.TextSelection.create(e.state.doc,Math.min(t-1,e.state.doc.content.size));e.dispatch(i.setSelection(n))}e.focus();let o=e.state.tr.split(e.state.selection.from);e.dispatch(o),e.dom.dispatchEvent(new KeyboardEvent("keydown",{key:"/",bubbles:!0,cancelable:!0}))},l=t=>{if(!n||!t.dataTransfer)return;let{pos:r,dom:i}=n,o=e.state.tr.setSelection(U.NodeSelection.create(e.state.doc,r));e.dispatch(o);let s=e.state.selection.content(),a=document.createElement("div");a.appendChild(e.someProp("clipboardSerializer")?.serializeFragment(s.content)??document.createElement("div")),t.dataTransfer.clearData(),t.dataTransfer.setData("text/html",a.innerHTML),t.dataTransfer.setData("text/plain",i.textContent??""),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage(i,0,0),e.dragging={slice:s,move:!0}};return window.addEventListener("mousemove",t),e.dom.addEventListener("mouseleave",s),r.addEventListener("dragstart",l),i&&i.addEventListener("click",a),{destroy(){window.removeEventListener("mousemove",t),e.dom.removeEventListener("mouseleave",s),r.removeEventListener("dragstart",l),i&&i.removeEventListener("click",a),o()}}}})]}}),r5=new U.PluginKey("headingAnchors");function r3(e){let t=[],n=new Map;return e.descendants((e,r)=>{if("heading"!==e.type.name)return;let i=e.textContent.toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-");if(!i)return;let o=n.get(i)??0;n.set(i,o+1);let s=0===o?i:`${i}-${o}`;t.push(J.Decoration.node(r,r+e.nodeSize,{id:s}))}),J.DecorationSet.create(e,t)}let r4=V.Extension.create({name:"headingAnchors",addProseMirrorPlugins:()=>[new U.Plugin({key:r5,state:{init:(e,{doc:t})=>r3(t),apply:(e,t)=>e.docChanged?r3(e.doc):t},props:{decorations:e=>r5.getState(e)}})]}),r6=V.Mark.create({name:"proofSpan",priority:900,inclusive:!1,keepOnSplit:!1,addAttributes:()=>({spanId:{default:null,parseHTML:e=>e.getAttribute("id"),renderHTML:e=>({id:e.spanId})},origin:{default:"ai",parseHTML:e=>e.getAttribute("origin"),renderHTML:e=>({origin:e.origin})},basis:{default:null,parseHTML:e=>e.getAttribute("basis"),renderHTML:e=>({basis:e.basis})},basisDetail:{default:null,parseHTML:e=>e.getAttribute("basis-detail"),renderHTML:e=>({"basis-detail":e.basisDetail})},by:{default:null,parseHTML:e=>e.getAttribute("by"),renderHTML:e=>({by:e.by})},at:{default:null,parseHTML:e=>e.getAttribute("at"),renderHTML:e=>({at:e.at})},inResponseTo:{default:null,parseHTML:e=>e.getAttribute("in-response-to"),renderHTML:e=>({"in-response-to":e.inResponseTo})}}),parseHTML:()=>[{tag:"proof-span"}],renderHTML:({HTMLAttributes:e})=>["proof-span",(0,V.mergeAttributes)(e,{class:"proof-span"}),0]});var r9=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,r7=V.Node.create({name:"image",addOptions:()=>({inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}),inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes:()=>({src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}),parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",(0,V.mergeAttributes)(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode("image",{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{var t,n,r,i,o,s;let a=null!=(n=null==(t=e.attrs)?void 0:t.src)?n:"",l=null!=(i=null==(r=e.attrs)?void 0:r.alt)?i:"",c=null!=(s=null==(o=e.attrs)?void 0:o.title)?s:"";return c?`![${l}](${a} "${c}")`:`![${l}](${a})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||"u"<typeof document)return null;let{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:i,getPos:o,HTMLAttributes:s,editor:a})=>{let l=document.createElement("img");Object.entries(s).forEach(([e,t])=>{if(null!=t)switch(e){case"width":case"height":break;default:l.setAttribute(e,t)}}),l.src=s.src;let c=new V.ResizableNodeView({element:l,editor:a,node:i,getPos:o,onResize:(e,t)=>{l.style.width=`${e}px`,l.style.height=`${t}px`},onCommit:(e,t)=>{let n=o();void 0!==n&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:(e,t,n)=>e.type===i.type,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:!0===r}}),d=c.dom;return d.style.visibility="hidden",d.style.pointerEvents="none",l.onload=()=>{d.style.visibility="",d.style.pointerEvents=""},c}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[(0,V.nodeInputRule)({find:r9,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}}),r8=e.i(885047);function ie(e){let{node:n,updateAttributes:r,selected:i,editor:o}=e,s=n.attrs,a=(0,O.useRef)(null),l=(0,O.useRef)(null),[c,d]=(0,O.useState)(null),u=s.align??"center",h=(0,O.useCallback)((e,t)=>{if(!o.isEditable)return;e.preventDefault(),e.stopPropagation();let n=a.current,i=l.current;if(!n||!i)return;let s=e.clientX,c=n.getBoundingClientRect().width,u=i.parentElement?.getBoundingClientRect().width??800,h=e=>{d(Math.max(80,Math.min(u,c+("right"===t?e.clientX-s:s-e.clientX))))},p=()=>{window.removeEventListener("pointermove",h),window.removeEventListener("pointerup",p),d(e=>(null!=e&&r({width:Math.round(e)}),null))};window.addEventListener("pointermove",h),window.addEventListener("pointerup",p)},[o.isEditable,r]),p=null!=c?`${Math.round(c)}px`:"number"==typeof s.width?`${s.width}px`:"string"==typeof s.width&&s.width?s.width:void 0,f="left"===u?"mr-auto":"right"===u?"ml-auto":"mx-auto";return(0,t.jsx)(r8.NodeViewWrapper,{as:"div",className:`resizable-image my-3 ${f}`,"data-align":u,style:{width:p??"fit-content",maxWidth:"100%"},children:(0,t.jsxs)("div",{ref:l,className:`relative group inline-block max-w-full ${i?"ring-2 ring-primary rounded-md":""}`,contentEditable:!1,children:[(0,t.jsx)("img",{ref:a,src:s.src,alt:s.alt??"",title:s.title??void 0,className:"block rounded-md max-w-full h-auto",style:{width:p},draggable:!1}),o.isEditable&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{"aria-label":"Resize from left",onPointerDown:e=>h(e,"left"),className:"hover-reveal resize-hit absolute left-0 top-0 bottom-0 w-2 cursor-ew-resize opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:(0,t.jsx)("div",{className:"w-1 h-8 bg-card border border-border rounded-full shadow"})}),(0,t.jsx)("div",{"aria-label":"Resize from right",onPointerDown:e=>h(e,"right"),className:"hover-reveal resize-hit absolute right-0 top-0 bottom-0 w-2 cursor-ew-resize opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:(0,t.jsx)("div",{className:"w-1 h-8 bg-card border border-border rounded-full shadow"})}),null!=c&&(0,t.jsxs)("div",{className:"absolute top-1 right-1 text-[10px] px-1.5 py-0.5 rounded bg-primary/80 text-primary-foreground font-mono",children:[Math.round(c),"px"]})]})]})})}let it=r7.extend({name:"image",draggable:!0,addAttributes(){return{...this.parent?.(),width:{default:null,parseHTML:e=>{let t=e.getAttribute("width")??e.style.width;if(!t)return null;let n=/^(\d+)(px)?$/.exec(t);return n?Number(n[1]):t},renderHTML:e=>{if(!e.width)return{};let t="number"==typeof e.width?`${e.width}px`:e.width;return{style:`width: ${t}`}}},align:{default:null,parseHTML:e=>e.getAttribute("data-align"),renderHTML:e=>e.align?{"data-align":e.align}:{}}}},addNodeView:()=>(0,r8.ReactNodeViewRenderer)(ie)});var ir=e.i(246542);let ii=new U.PluginKey("wikiLinkDecorator"),io="wikiLinkDecorator:refresh";function is(e){let{has:t}=ir.useWikiSlugsStore.getState(),n=e.schema.marks.wikiLink;if(!n)return J.DecorationSet.empty;let r=[];return e.doc.descendants((e,i)=>{if(!e.isText)return;let o=e.marks.find(e=>e.type===n);if(!o)return;let s=o.attrs.slug;!s||t(s)||r.push(J.Decoration.inline(i,i+e.nodeSize,{"data-broken":"true"}))}),J.DecorationSet.create(e.doc,r)}let ia=/\[\[([a-z0-9-]+)(?:\|([^\]#|]+)|#([a-z0-9-]+))?\]\]$/,il=V.Mark.create({name:"wikiLink",priority:1e3,keepOnSplit:!1,inclusive:!1,addAttributes:()=>({slug:{default:null,parseHTML:e=>e.getAttribute("data-slug"),renderHTML:e=>({"data-slug":e.slug})},alias:{default:null,parseHTML:e=>e.getAttribute("data-alias"),renderHTML:e=>null!=e.alias?{"data-alias":e.alias}:{}},anchor:{default:null,parseHTML:e=>e.getAttribute("data-anchor"),renderHTML:e=>null!=e.anchor?{"data-anchor":e.anchor}:{}}}),parseHTML:()=>[{tag:'a[data-wiki-link="true"]'}],renderHTML({HTMLAttributes:e}){let t=String(e["data-slug"]??""),n=null!=e["data-anchor"]?String(e["data-anchor"]):null,r=n?`#wiki:${t}#${n}`:`#wiki:${t}`;return["a",(0,V.mergeAttributes)(e,{"data-wiki-link":"true",href:r,class:"wiki-link"}),0]},addInputRules(){return[new V.InputRule({find:ia,handler:({state:e,range:t,match:n})=>{let r=n[1]??"",i=n[2]??null,o=n[3]??null,s=i??(o?`${r}#${o}`:r),{tr:a}=e;a.replaceWith(t.from,t.to,e.schema.text(s,[this.type.create({slug:r,alias:i,anchor:o})]))}})]},addProseMirrorPlugins:()=>[new U.Plugin({key:ii,state:{init:(e,t)=>is(t),apply:(e,t,n,r)=>e.getMeta(io)||e.docChanged?is(r):t.map(e.mapping,e.doc)},props:{decorations:e=>ii.getState(e)??J.DecorationSet.empty},view(e){let t=ir.useWikiSlugsStore.subscribe(()=>{let t=e.state.tr.setMeta(io,!0);e.dispatch(t)});return{destroy(){t()}}}})],addCommands(){return{setWikiLink:e=>({commands:t})=>t.setMark(this.name,{slug:e.slug,alias:e.alias??null,anchor:e.anchor??null}),unsetWikiLink:()=>({commands:e})=>e.unsetMark(this.name)}}}),ic=rX({bash:rf,css:rw,go:rx,javascript:rR,json:rO,markdown:rD,python:rj,rust:rI,shell:rP,sql:rL,typescript:rW,xml:rK,yaml:rq}),id=[rp.configure({heading:{levels:[1,2,3,4]},codeBlock:!1,link:!1,underline:!1}),Y.configure({lowlight:ic,HTMLAttributes:{class:"rounded-md bg-muted p-4 font-mono text-sm"}}),nr.configure({placeholder:"Start writing, or press '/' for commands..."}),it.configure({HTMLAttributes:{class:"rounded-lg max-w-full"},allowBase64:!1}),nx.configure({resizable:!0,lastColumnResizable:!1,HTMLAttributes:{class:"border-collapse w-full"}}),nf,nh,np,nJ.configure({HTMLAttributes:{class:"task-list"}}),nq.configure({nested:!0}),tT.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}}).extend({parseHTML:()=>[{tag:'a[href]:not([data-wiki-link="true"])'}],addKeyboardShortcuts(){return{"Mod-e":()=>{let{state:e}=this.editor,{from:t,to:n}=e.selection;if(t===n)return!1;let r=this.editor.getAttributes("link").href??"",i=window.prompt("Link URL",r);return null!==i&&(""===i?this.editor.chain().focus().extendMarkRange("link").unsetLink().run():this.editor.chain().focus().extendMarkRange("link").setLink({href:i}).run())}}}}),rY,r6,nG.configure({types:["heading","paragraph"]}),na,nl,r2,r4,il];e.s(["editorExtensions",0,id],314206);var iu=e.i(605993);let ih=(0,iu.default)("app-window",[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]]);e.s(["AppWindow",0,ih],388503);let ip=(0,iu.default)("file-audio",[["path",{d:"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"rslqgf"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",key:"9f7x3i"}]]);e.s(["FileAudio",0,ip],284766);let im=(0,iu.default)("file-code-2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);e.s(["FileCode2",0,im],965837);let ig=(0,iu.default)("file-image",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]);e.s(["FileImage",0,ig],582966);let iy=(0,iu.default)("file-spreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);e.s(["FileSpreadsheet",0,iy],25688);let ib=(0,iu.default)("file-video",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m10 11 5 3-5 3v-6Z",key:"7ntvm4"}]]);e.s(["FileVideo",0,ib],770271)},496668,665794,e=>{"use strict";var t=e.i(44501),n=e.i(388503),r=e.i(284766),i=e.i(965837),o=e.i(582966),s=e.i(25688),a=e.i(764143),l=e.i(770271),c=e.i(916767),d=e.i(845478),u=e.i(605993);let h=(0,u.default)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);var p=e.i(853840),f=e.i(101685),m=e.i(96701),g=e.i(990791),y=e.i(671485);let b="kb-folder-view-mode";function v(e){return"image"===e.type}function w(e){switch(e.type){case"directory":case"cabinet":return c.Folder;case"image":return o.FileImage;case"video":return l.FileVideo;case"audio":return r.FileAudio;case"code":return i.FileCode2;case"csv":case"xlsx":return s.FileSpreadsheet;case"website":return d.Globe;case"app":return n.AppWindow;default:return a.FileText}}function x(e){let{selectPage:t,expandPath:n}=g.useTreeStore.getState(),r=e.split("/");for(let e=1;e<r.length;e++)n(r.slice(0,e).join("/"));t(e),m.useEditorStore.getState().loadPage(e)}e.s(["FolderIndex",0,function({folderPath:e,entries:n}){let r=(0,f.useMemo)(()=>(function(e){if(0===e.length)return!1;let t=e.filter(v).length;return t>=4&&t/e.length>=.6})(n),[n]),[i,o]=(0,f.useState)(()=>{let t=function(e){try{let t=localStorage.getItem(b);if(!t)return null;return JSON.parse(t)[e]??null}catch{return null}}(e);return t||(r?"gallery":"list")}),s=t=>{o(t);try{let n=localStorage.getItem(b),r=n?JSON.parse(n):{};r[e]=t,localStorage.setItem(b,JSON.stringify(r))}catch{}},a=(0,f.useMemo)(()=>{let e=[...n];return e.sort((e,t)=>{let n="directory"===e.type||"cabinet"===e.type;return n!==("directory"===t.type||"cabinet"===t.type)?n?-1:1:e.name.localeCompare(t.name)}),e},[n]);return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("p",{className:"text-[11px] uppercase tracking-wider text-muted-foreground/70",children:[a.length," ",1===a.length?"item":"items"]}),(0,t.jsxs)("div",{className:"inline-flex items-center rounded-md border border-border p-0.5 text-[11px]",children:[(0,t.jsxs)("button",{onClick:()=>s("list"),className:`flex items-center gap-1 px-2 py-1 rounded transition-colors ${"list"===i?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"}`,"aria-pressed":"list"===i,title:"List view",children:[(0,t.jsx)(p.List,{className:"h-3 w-3"}),"List"]}),(0,t.jsxs)("button",{onClick:()=>s("gallery"),className:`flex items-center gap-1 px-2 py-1 rounded transition-colors ${"gallery"===i?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"}`,"aria-pressed":"gallery"===i,title:"Gallery view",children:[(0,t.jsx)(h,{className:"h-3 w-3"}),"Gallery"]})]})]}),"list"===i?(0,t.jsx)("ul",{className:"divide-y divide-border rounded-md border border-border overflow-hidden",children:a.map(e=>{let n=w(e),r=e.frontmatter?.title||e.name;return(0,t.jsx)("li",{children:(0,t.jsxs)("button",{onClick:()=>x(e.path),className:"w-full flex items-center gap-3 px-3 py-2 text-left text-sm hover:bg-accent/50 transition-colors",children:[(0,t.jsx)(n,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,t.jsx)("span",{className:"flex-1 truncate",children:r}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground/60 capitalize",children:e.type})]})},e.path)})}):(0,t.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-3",children:a.map(e=>{let n=e.frontmatter?.title||e.name;if(v(e))return(0,t.jsxs)("button",{onClick:()=>x(e.path),className:"group flex flex-col gap-1.5 text-left",title:n,children:[(0,t.jsx)("div",{className:"aspect-square w-full overflow-hidden rounded-md border border-border bg-muted",children:(0,t.jsx)("img",{src:(0,y.withWs)(`/api/assets/${e.path}`),alt:n,loading:"lazy",className:"h-full w-full object-cover transition-transform group-hover:scale-[1.02]"})}),(0,t.jsx)("span",{className:"truncate text-[12px] text-muted-foreground group-hover:text-foreground",children:n})]},e.path);let r=w(e);return(0,t.jsxs)("button",{onClick:()=>x(e.path),className:"group flex flex-col gap-1.5 text-left",title:n,children:[(0,t.jsx)("div",{className:"aspect-square w-full flex items-center justify-center rounded-md border border-border bg-muted/40 group-hover:bg-muted transition-colors",children:(0,t.jsx)(r,{className:"h-8 w-8 text-muted-foreground/60"})}),(0,t.jsx)("span",{className:"truncate text-[12px] text-muted-foreground group-hover:text-foreground",children:n})]},e.path)})})]})}],496668);let k=(0,u.default)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);var S=e.i(891734);e.s(["CommentPip",0,function({blockRef:e,comments:n,top:r,left:i,onClick:o}){let s;if(0===n.length)return null;let a=n.filter(e=>!e.resolved);if(0===a.length)s="check";else{let e=a[0].turns.at(-1);s=e?.by.startsWith("ai:")?"dot-ai":"ring-human"}return(0,t.jsxs)("button",{type:"button",onClick:o,style:{position:"absolute",top:r,left:i,transform:"translateY(2px)"},className:"z-10 p-2 sm:p-0.5 -m-1.5 sm:m-0 rounded transition-colors hover:bg-accent focus:outline-none focus-visible:ring-1 focus-visible:ring-ring","aria-label":`Comment thread for block ${e}`,children:["check"===s&&(0,t.jsx)(k,{className:"h-3.5 w-3.5 text-muted-foreground/30"}),"dot-ai"===s&&(0,t.jsx)(S.MessageCircle,{className:"h-3.5 w-3.5 fill-primary text-primary"}),"ring-human"===s&&(0,t.jsx)(S.MessageCircle,{className:"h-3.5 w-3.5 text-muted-foreground/70"})]})}],665794)},638154,461614,e=>{"use strict";var t=e.i(101685),n=e.i(278928),r=e.i(380560),i="u">typeof document?t.useLayoutEffect:function(){};function o(e,t){let n,r,i;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((n=e.length)!==t.length)return!1;for(r=n;0!=r--;)if(!o(e[r],t[r]))return!1;return!0}if((n=(i=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!({}).hasOwnProperty.call(t,i[r]))return!1;for(r=n;0!=r--;){let n=i[r];if(("_owner"!==n||!e.$$typeof)&&!o(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function s(e){return"u"<typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function a(e,t){let n=s(e);return Math.round(t*n)/n}function l(e){let n=t.useRef(e);return i(()=>{n.current=e}),n}var c=e.i(980939),d=e.i(44501),u=t.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...o}=e;return(0,d.jsx)(c.Primitive.svg,{...o,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:(0,d.jsx)("polygon",{points:"0,0 30,0 15,10"})})});u.displayName="Arrow";var h=e.i(967928),p=e.i(543250),f=e.i(136131),m=e.i(672687);function g(e){let[n,r]=t.useState(void 0);return(0,m.useLayoutEffect)(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{let n,i;if(!Array.isArray(t)||!t.length)return;let o=t[0];if("borderBoxSize"in o){let e=o.borderBoxSize,t=Array.isArray(e)?e[0]:e;n=t.inlineSize,i=t.blockSize}else n=e.offsetWidth,i=e.offsetHeight;r({width:n,height:i})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),n}e.s(["useSize",0,g],461614);var y="Popper",[b,v]=(0,p.createContextScope)(y),[w,x]=b(y),k=e=>{let{__scopePopper:n,children:r}=e,[i,o]=t.useState(null);return(0,d.jsx)(w,{scope:n,anchor:i,onAnchorChange:o,children:r})};k.displayName=y;var S="PopperAnchor",C=t.forwardRef((e,n)=>{let{__scopePopper:r,virtualRef:i,...o}=e,s=x(S,r),a=t.useRef(null),l=(0,h.useComposedRefs)(n,a),u=t.useRef(null);return t.useEffect(()=>{let e=u.current;u.current=i?.current||a.current,e!==u.current&&s.onAnchorChange(u.current)}),i?null:(0,d.jsx)(c.Primitive.div,{...o,ref:l})});C.displayName=S;var E="PopperContent",[M,N]=b(E),A=t.forwardRef((e,u)=>{var p,y,b,v,w,k,S,C,N,A,T,R,O,P,L;let z,_,$,H,B,F,{__scopePopper:V,side:U="bottom",sideOffset:W=0,align:K="center",alignOffset:q=0,arrowPadding:J=0,avoidCollisions:G=!0,collisionBoundary:X=[],collisionPadding:Z=0,sticky:Y="partial",hideWhenDetached:Q=!1,updatePositionStrategy:ee="optimized",onPlaced:et,...en}=e,er=x(E,V),[ei,eo]=t.useState(null),es=(0,h.useComposedRefs)(u,e=>eo(e)),[ea,el]=t.useState(null),ec=g(ea),ed=ec?.width??0,eu=ec?.height??0,eh="number"==typeof Z?Z:{top:0,right:0,bottom:0,left:0,...Z},ep=Array.isArray(X)?X:[X],ef=ep.length>0,em={padding:eh,boundary:ep.filter(D),altBoundary:ef},{refs:eg,floatingStyles:ey,placement:eb,isPositioned:ev,middlewareData:ew}=function(e){void 0===e&&(e={});let{placement:c="bottom",strategy:d="absolute",middleware:u=[],platform:h,elements:{reference:p,floating:f}={},transform:m=!0,whileElementsMounted:g,open:y}=e,[b,v]=t.useState({x:0,y:0,strategy:d,placement:c,middlewareData:{},isPositioned:!1}),[w,x]=t.useState(u);o(w,u)||x(u);let[k,S]=t.useState(null),[C,E]=t.useState(null),M=t.useCallback(e=>{e!==R.current&&(R.current=e,S(e))},[]),N=t.useCallback(e=>{e!==O.current&&(O.current=e,E(e))},[]),A=p||k,T=f||C,R=t.useRef(null),O=t.useRef(null),D=t.useRef(b),j=null!=g,I=l(g),P=l(h),L=l(y),z=t.useCallback(()=>{if(!R.current||!O.current)return;let e={placement:c,strategy:d,middleware:w};P.current&&(e.platform=P.current),(0,n.computePosition)(R.current,O.current,e).then(e=>{let t={...e,isPositioned:!1!==L.current};_.current&&!o(D.current,t)&&(D.current=t,r.flushSync(()=>{v(t)}))})},[w,c,d,P,L]);i(()=>{!1===y&&D.current.isPositioned&&(D.current.isPositioned=!1,v(e=>({...e,isPositioned:!1})))},[y]);let _=t.useRef(!1);i(()=>(_.current=!0,()=>{_.current=!1}),[]),i(()=>{if(A&&(R.current=A),T&&(O.current=T),A&&T){if(I.current)return I.current(A,T,z);z()}},[A,T,z,I,j]);let $=t.useMemo(()=>({reference:R,floating:O,setReference:M,setFloating:N}),[M,N]),H=t.useMemo(()=>({reference:A,floating:T}),[A,T]),B=t.useMemo(()=>{let e={position:d,left:0,top:0};if(!H.floating)return e;let t=a(H.floating,b.x),n=a(H.floating,b.y);return m?{...e,transform:"translate("+t+"px, "+n+"px)",...s(H.floating)>=1.5&&{willChange:"transform"}}:{position:d,left:t,top:n}},[d,m,H.floating,b.x,b.y]);return t.useMemo(()=>({...b,update:z,refs:$,elements:H,floatingStyles:B}),[b,z,$,H,B])}({strategy:"fixed",placement:U+("center"!==K?"-"+K:""),whileElementsMounted:(...e)=>(0,n.autoUpdate)(...e,{animationFrame:"always"===ee}),elements:{reference:er.anchor},middleware:[(p={mainAxis:W+eu,alignmentAxis:q},{name:(z=(0,n.offset)(p)).name,fn:z.fn,options:[p,y]}),G&&(w={mainAxis:!0,crossAxis:!1,limiter:"partial"===Y?{fn:(0,n.limitShift)(b).fn,options:[b,v]}:void 0,...em},{name:(_=(0,n.shift)(w)).name,fn:_.fn,options:[w,k]}),G&&(S={...em},{name:($=(0,n.flip)(S)).name,fn:$.fn,options:[S,C]}),(N={...em,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:o}=t.reference,s=e.floating.style;s.setProperty("--radix-popper-available-width",`${n}px`),s.setProperty("--radix-popper-available-height",`${r}px`),s.setProperty("--radix-popper-anchor-width",`${i}px`),s.setProperty("--radix-popper-anchor-height",`${o}px`)}},{name:(H=(0,n.size)(N)).name,fn:H.fn,options:[N,A]}),ea&&{name:(B={name:"arrow",options:O=T={element:ea,padding:J},fn(e){let{element:t,padding:r}="function"==typeof O?O(e):O;return t&&({}).hasOwnProperty.call(t,"current")?null!=t.current?(0,n.arrow)({element:t.current,padding:r}).fn(e):{}:t?(0,n.arrow)({element:t,padding:r}).fn(e):{}}}).name,fn:B.fn,options:[T,R]},j({arrowWidth:ed,arrowHeight:eu}),Q&&(P={strategy:"referenceHidden",...em},{name:(F=(0,n.hide)(P)).name,fn:F.fn,options:[P,L]})]}),[ex,ek]=I(eb),eS=(0,f.useCallbackRef)(et);(0,m.useLayoutEffect)(()=>{ev&&eS?.()},[ev,eS]);let eC=ew.arrow?.x,eE=ew.arrow?.y,eM=ew.arrow?.centerOffset!==0,[eN,eA]=t.useState();return(0,m.useLayoutEffect)(()=>{ei&&eA(window.getComputedStyle(ei).zIndex)},[ei]),(0,d.jsx)("div",{ref:eg.setFloating,"data-radix-popper-content-wrapper":"",style:{...ey,transform:ev?ey.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:eN,"--radix-popper-transform-origin":[ew.transformOrigin?.x,ew.transformOrigin?.y].join(" "),...ew.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,d.jsx)(M,{scope:V,placedSide:ex,onArrowChange:el,arrowX:eC,arrowY:eE,shouldHideArrow:eM,children:(0,d.jsx)(c.Primitive.div,{"data-side":ex,"data-align":ek,...en,ref:es,style:{...en.style,animation:ev?void 0:"none"}})})})});A.displayName=E;var T="PopperArrow",R={top:"bottom",right:"left",bottom:"top",left:"right"},O=t.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=N(T,n),o=R[i.placedSide];return(0,d.jsx)("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:(0,d.jsx)(u,{...r,ref:t,style:{...r.style,display:"block"}})})});function D(e){return null!==e}O.displayName=T;var j=e=>({name:"transformOrigin",options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,o=i.arrow?.centerOffset!==0,s=o?0:e.arrowWidth,a=o?0:e.arrowHeight,[l,c]=I(n),d={start:"0%",center:"50%",end:"100%"}[c],u=(i.arrow?.x??0)+s/2,h=(i.arrow?.y??0)+a/2,p="",f="";return"bottom"===l?(p=o?d:`${u}px`,f=`${-a}px`):"top"===l?(p=o?d:`${u}px`,f=`${r.floating.height+a}px`):"right"===l?(p=`${-a}px`,f=o?d:`${h}px`):"left"===l&&(p=`${r.floating.width+a}px`,f=o?d:`${h}px`),{data:{x:p,y:f}}}});function I(e){let[t,n="center"]=e.split("-");return[t,n]}e.s(["Anchor",0,C,"Arrow",0,O,"Content",0,A,"Root",0,k,"createPopperScope",0,v],638154)},926128,803043,589676,294250,955537,e=>{"use strict";var t=e.i(44501),n=e.i(101685),r=e.i(291967),i=e.i(967928),o=e.i(543250),s=e.i(348989),a=e.i(539340),l=e.i(445424),c=e.i(433616),d=e.i(638154),u=e.i(332374),h=e.i(190088),p=e.i(980939),f=e.i(652053),m=e.i(417256),g=e.i(73772),y=e.i(206500),b="Popover",[v,w]=(0,o.createContextScope)(b,[d.createPopperScope]),x=(0,d.createPopperScope)(),[k,S]=v(b),C=e=>{let{__scopePopover:r,children:i,open:o,defaultOpen:s,onOpenChange:a,modal:l=!1}=e,u=x(r),h=n.useRef(null),[p,f]=n.useState(!1),[g,y]=(0,m.useControllableState)({prop:o,defaultProp:s??!1,onChange:a,caller:b});return(0,t.jsx)(d.Root,{...u,children:(0,t.jsx)(k,{scope:r,contentId:(0,c.useId)(),triggerRef:h,open:g,onOpenChange:y,onOpenToggle:n.useCallback(()=>y(e=>!e),[y]),hasCustomAnchor:p,onCustomAnchorAdd:n.useCallback(()=>f(!0),[]),onCustomAnchorRemove:n.useCallback(()=>f(!1),[]),modal:l,children:i})})};C.displayName=b;var E="PopoverAnchor",M=n.forwardRef((e,r)=>{let{__scopePopover:i,...o}=e,s=S(E,i),a=x(i),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=s;return n.useEffect(()=>(l(),()=>c()),[l,c]),(0,t.jsx)(d.Anchor,{...a,...o,ref:r})});M.displayName=E;var N="PopoverTrigger";n.forwardRef((e,n)=>{let{__scopePopover:o,...s}=e,a=S(N,o),l=x(o),c=(0,i.useComposedRefs)(n,a.triggerRef),u=(0,t.jsx)(p.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":H(a.open),...s,ref:c,onClick:(0,r.composeEventHandlers)(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?u:(0,t.jsx)(d.Anchor,{asChild:!0,...l,children:u})}).displayName=N;var A="PopoverPortal",[T,R]=v(A,{forceMount:void 0}),O=e=>{let{__scopePopover:n,forceMount:r,children:i,container:o}=e,s=S(A,n);return(0,t.jsx)(T,{scope:n,forceMount:r,children:(0,t.jsx)(h.Presence,{present:r||s.open,children:(0,t.jsx)(u.Portal,{asChild:!0,container:o,children:i})})})};O.displayName=A;var D="PopoverContent",j=n.forwardRef((e,n)=>{let r=R(D,e.__scopePopover),{forceMount:i=r.forceMount,...o}=e,s=S(D,e.__scopePopover);return(0,t.jsx)(h.Presence,{present:i||s.open,children:s.modal?(0,t.jsx)(P,{...o,ref:n}):(0,t.jsx)(L,{...o,ref:n})})});j.displayName=D;var I=(0,f.createSlot)("PopoverContent.RemoveScroll"),P=n.forwardRef((e,o)=>{let s=S(D,e.__scopePopover),a=n.useRef(null),l=(0,i.useComposedRefs)(o,a),c=n.useRef(!1);return n.useEffect(()=>{let e=a.current;if(e)return(0,g.hideOthers)(e)},[]),(0,t.jsx)(y.RemoveScroll,{as:I,allowPinchZoom:!0,children:(0,t.jsx)(z,{...e,ref:l,trapFocus:s.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,r.composeEventHandlers)(e.onCloseAutoFocus,e=>{e.preventDefault(),c.current||s.triggerRef.current?.focus()}),onPointerDownOutside:(0,r.composeEventHandlers)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;c.current=2===t.button||n},{checkForDefaultPrevented:!1}),onFocusOutside:(0,r.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),L=n.forwardRef((e,r)=>{let i=S(D,e.__scopePopover),o=n.useRef(!1),s=n.useRef(!1);return(0,t.jsx)(z,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||i.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,s.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"===t.detail.originalEvent.type&&(s.current=!0));let n=t.target;i.triggerRef.current?.contains(n)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&s.current&&t.preventDefault()}})}),z=n.forwardRef((e,n)=>{let{__scopePopover:r,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:c,disableOutsidePointerEvents:u,onEscapeKeyDown:h,onPointerDownOutside:p,onFocusOutside:f,onInteractOutside:m,...g}=e,y=S(D,r),b=x(r);return(0,a.useFocusGuards)(),(0,t.jsx)(l.FocusScope,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:o,onUnmountAutoFocus:c,children:(0,t.jsx)(s.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:m,onEscapeKeyDown:h,onPointerDownOutside:p,onFocusOutside:f,onDismiss:()=>y.onOpenChange(!1),children:(0,t.jsx)(d.Content,{"data-state":H(y.open),role:"dialog",id:y.contentId,...b,...g,ref:n,style:{...g.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),_="PopoverClose";n.forwardRef((e,n)=>{let{__scopePopover:i,...o}=e,s=S(_,i);return(0,t.jsx)(p.Primitive.button,{type:"button",...o,ref:n,onClick:(0,r.composeEventHandlers)(e.onClick,()=>s.onOpenChange(!1))})}).displayName=_;var $=n.forwardRef((e,n)=>{let{__scopePopover:r,...i}=e,o=x(r);return(0,t.jsx)(d.Arrow,{...o,...i,ref:n})});function H(e){return e?"open":"closed"}$.displayName="PopoverArrow";var B=e.i(562199),F=e.i(592185),V=e.i(671485);let U=new Intl.RelativeTimeFormat("en",{numeric:"auto"});async function W(e,t,n,r){let i=encodeURIComponent(e).replace(/%2F/g,"/"),o=await (0,V.wsFetch)(`/api/agent/files/${i}`,{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":crypto.randomUUID(),...(0,B.authHeaders)()},body:JSON.stringify({baseRevision:t,by:n,ops:r})});if(409===o.status){let e=await o.json();return"STALE_REVISION"===e.code&&e.snapshot?.revision!==void 0?{ok:!1,stale:!0,newRevision:e.snapshot.revision}:{ok:!1,stale:!1}}return o.ok?{ok:!0,stale:!1}:{ok:!1,stale:!1}}async function K(e,t,n,r){let i=encodeURIComponent(e).replace(/%2F/g,"/"),o=await (0,V.wsFetch)(`/api/agent/files/${i}`,{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":crypto.randomUUID(),...(0,B.authHeaders)()},body:JSON.stringify({baseRevision:t,by:"human",ops:[{type:n,suggestionId:r}]})});return{ok:o.ok,status:o.status}}async function q(e,t,n){let r=encodeURIComponent(e).replace(/%2F/g,"/"),i=await (0,V.wsFetch)(`/api/agent/files/${r}`,{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":crypto.randomUUID(),...(0,B.authHeaders)()},body:JSON.stringify({baseRevision:t,by:"human",ops:n})});if(409===i.status){let e=await i.json();return"STALE_REVISION"===e.code&&e.snapshot?.revision!==void 0?{ok:!1,stale:!0,newRevision:e.snapshot.revision}:{ok:!1,stale:!1}}return i.ok?{ok:!0,stale:!1}:{ok:!1,stale:!1}}e.s(["CommentThread",0,function({path:e,blockRef:r,comments:i,anchorEl:o,onClose:s,readOnly:a}){let[l,c]=(0,n.useState)(null),[d,u]=(0,n.useState)(""),[h,p]=(0,n.useState)(!1),f=(0,n.useRef)(null),m=i.filter(e=>!e.resolved),g=m.length>0,y=m[0]??i[0]??null;if((0,n.useEffect)(()=>{if(!o)return void c(null);let e=o.getBoundingClientRect();c({top:e.bottom+4,left:e.left})},[o]),(0,n.useEffect)(()=>{if(!o)return;let e=e=>{"Escape"===e.key&&s()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[o,s]),(0,n.useEffect)(()=>{l&&setTimeout(()=>f.current?.focus(),50)},[l]),!o||!l)return null;function b(){let t=F.useProofStore.getState().byPath[e];return t?.snapshotRevision??0}async function v(){if(d.trim()&&!h){p(!0);try{let t=y?{type:"comment.reply",commentId:y.id,text:d.trim()}:{type:"comment.add",ref:r,text:d.trim()},n=b(),i=await W(e,n,"human",[t]);!i.ok&&i.stale&&void 0!==i.newRevision&&(await F.useProofStore.getState().loadSidecar(e),n=i.newRevision,i=await W(e,n,"human",[t])),i.ok&&(await F.useProofStore.getState().loadSidecar(e),u(""),s())}finally{p(!1)}}}async function w(){if(y&&!h){p(!0);try{let t=y.resolved?"comment.reopen":"comment.resolve",n=b(),r=await W(e,n,"human",[{type:t,commentId:y.id}]);!r.ok&&r.stale&&void 0!==r.newRevision&&(await F.useProofStore.getState().loadSidecar(e),n=r.newRevision,r=await W(e,n,"human",[{type:t,commentId:y.id}])),r.ok&&(await F.useProofStore.getState().loadSidecar(e),s())}finally{p(!1)}}}let x=i.flatMap(e=>e.turns.map(t=>({...t,resolved:e.resolved,commentId:e.id})));return(0,t.jsxs)(C,{open:!0,children:[(0,t.jsx)(M,{asChild:!0,children:(0,t.jsx)("span",{"aria-hidden":"true",style:{position:"fixed",top:l.top,left:l.left,width:0,height:0,pointerEvents:"none"}})}),(0,t.jsx)(O,{children:(0,t.jsxs)(j,{side:"bottom",align:"start",sideOffset:4,collisionPadding:8,onInteractOutside:s,className:"z-50 w-[min(18rem,calc(100vw-1rem))] bg-popover border border-border rounded-lg shadow-xl p-3 space-y-2 text-[12px] focus:outline-none",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-[11px] font-mono text-muted-foreground/60 truncate",children:r}),y&&!a&&(0,t.jsx)("button",{type:"button",disabled:h,onClick:()=>void w(),className:"ml-2 shrink-0 text-[10px] px-1.5 py-0.5 rounded border border-border hover:bg-accent disabled:opacity-50 transition-colors",children:y.resolved?"Reopen":"Resolve"})]}),x.length>0&&(0,t.jsx)("div",{className:"space-y-2 max-h-48 overflow-y-auto pr-1",children:x.map((e,n)=>(0,t.jsxs)("div",{className:"space-y-0.5",children:[(0,t.jsxs)("p",{className:"text-[10px] text-muted-foreground/60",children:[e.by," · ",function(e){let t=Math.round((Date.now()-new Date(e).getTime())/1e3);if(60>Math.abs(t))return U.format(-t,"second");let n=Math.round(t/60);if(60>Math.abs(n))return U.format(-n,"minute");let r=Math.round(n/60);return 24>Math.abs(r)?U.format(-r,"hour"):U.format(-Math.round(r/24),"day")}(e.at)]}),(0,t.jsx)("p",{className:"text-foreground leading-snug whitespace-pre-wrap",children:e.text})]},n))}),(!y?.resolved||0===i.length)&&(0,t.jsxs)("div",{className:"space-y-1.5 pt-1",children:[(0,t.jsx)("textarea",{ref:f,value:d,onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&v()},placeholder:g?"Reply…":"Add a comment…",rows:2,className:"w-full resize-none rounded-md border border-border bg-background px-2 py-1.5 text-[12px] focus:outline-none focus-visible:ring-1 focus-visible:ring-ring placeholder:text-muted-foreground/40"}),(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground/40",children:"⌘↵ send"}),(0,t.jsx)("button",{type:"button",disabled:h||!d.trim(),onClick:()=>void v(),className:"px-2.5 py-1 rounded-md bg-primary text-primary-foreground text-[11px] font-medium hover:bg-primary/90 disabled:opacity-50 transition-colors",children:"Send"})]})]}),(0,t.jsx)($,{className:"fill-border"})]})})]})}],926128),e.s(["ProofSpanPopover",0,function({targetEl:e,path:r,onClose:i,onComment:o}){let[s,a]=(0,n.useState)(null),[l,c]=(0,n.useState)(null),[d,u]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{if(!e){a(null),c(null);return}let t=e.getBoundingClientRect();a({top:t.bottom+window.scrollY+4,left:t.left+window.scrollX}),c({spanId:e.getAttribute("id")??"",origin:e.getAttribute("origin"),basis:e.getAttribute("basis"),basisDetail:e.getAttribute("basis-detail"),by:e.getAttribute("by"),at:e.getAttribute("at")})},[e]),(0,n.useEffect)(()=>{if(!e)return;let t=e=>{"Escape"===e.key&&i()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,i]),!e||!s||!l)return null;async function h(e){if(!d&&l){u(!0);try{await (0,V.wsFetch)("/api/agent/internal/span",{method:"POST",headers:{"Content-Type":"application/json",...(0,B.authHeaders)()},body:JSON.stringify({path:r,spanId:l.spanId,action:e,idempotencyKey:crypto.randomUUID()})})}finally{u(!1),i()}}}return(0,t.jsxs)(C,{open:!0,children:[(0,t.jsx)(M,{asChild:!0,children:(0,t.jsx)("span",{"aria-hidden":"true",style:{position:"fixed",top:s.top,left:s.left,width:0,height:0,pointerEvents:"none"}})}),(0,t.jsx)(O,{children:(0,t.jsxs)(j,{side:"bottom",align:"start",sideOffset:4,collisionPadding:8,onInteractOutside:i,className:"z-50 w-[min(16rem,calc(100vw-1rem))] bg-popover border border-border rounded-lg shadow-xl p-3 space-y-2 text-[12px] focus:outline-none",children:[(0,t.jsxs)("div",{className:"space-y-0.5",children:[(0,t.jsxs)("p",{className:"font-medium text-foreground truncate",children:[l.by??"unknown"," · ",l.basis??"—"," · ",function(e){if(!e)return"";let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<60)return`${t}s ago`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}(l.at)]}),l.basisDetail&&(0,t.jsxs)("p",{className:"text-muted-foreground italic truncate",children:["“",l.basisDetail,"”"]}),l.origin&&(0,t.jsxs)("p",{className:"text-muted-foreground/60",children:["origin: ",l.origin]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 pt-1",children:[(0,t.jsx)("button",{type:"button",disabled:d,onClick:()=>void h("accept"),className:"flex-1 py-1 rounded-md bg-primary text-primary-foreground text-[11px] font-medium hover:bg-primary/90 disabled:opacity-50 transition-colors",children:"Accept"}),(0,t.jsx)("button",{type:"button",disabled:d,onClick:()=>void h("revert"),className:"flex-1 py-1 rounded-md border border-border text-[11px] font-medium hover:bg-accent disabled:opacity-50 transition-colors",children:"Revert"}),(0,t.jsx)("button",{type:"button",disabled:d,onClick:()=>{o?.(),i()},className:"flex-1 py-1 rounded-md border border-border text-[11px] font-medium hover:bg-accent disabled:opacity-50 transition-colors",children:"Comment"})]}),(0,t.jsx)($,{className:"fill-border"})]})})]})}],803043),e.s(["SuggestionCard",0,function({suggestion:e,currentMarkdown:r,path:i,baseRevision:o,getLatestRevision:s,top:a,left:l,width:c,onSettled:d,readOnly:u}){let[h,p]=(0,n.useState)(!1);async function f(){if(!h){p(!0);try{let t=await K(i,o,"suggestion.accept",e.id);t.ok||409!==t.status||(t=await K(i,s(),"suggestion.accept",e.id))}finally{p(!1),d()}}}async function m(){if(!h){p(!0);try{await K(i,o,"suggestion.reject",e.id)}finally{p(!1),d()}}}let g="delete"===e.kind,y="insertAfter"===e.kind||"insertBefore"===e.kind;return(0,t.jsxs)("div",{style:{position:"absolute",top:a,left:l,width:c>0?c:void 0,zIndex:30},className:"my-1 rounded-lg border border-border bg-card shadow-md text-[12px] overflow-hidden",role:"region","aria-label":`Suggestion by ${e.by}`,children:[(0,t.jsx)("div",{className:"flex items-center justify-between px-3 py-2 bg-muted/50 border-b border-border",children:(0,t.jsxs)("span",{className:"font-medium text-foreground",children:[(0,t.jsx)("span",{className:"text-primary",children:e.by})," suggests ",(0,t.jsx)("span",{className:"text-muted-foreground",children:function(e){switch(e){case"replace":return"replacing this block";case"insertAfter":return"inserting content after this block";case"insertBefore":return"inserting content before this block";case"delete":return"deleting this block"}}(e.kind)})]})}),(0,t.jsxs)("div",{className:"p-3 space-y-2",children:["replace"===e.kind&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60 mb-1",children:"─ current ─"}),(0,t.jsx)("pre",{className:"whitespace-pre-wrap font-mono text-[11px] text-muted-foreground bg-destructive/5 rounded px-2 py-1",children:r||"(empty)"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60 mb-1",children:"─ proposed ─"}),(0,t.jsx)("pre",{className:"whitespace-pre-wrap font-mono text-[11px] text-foreground bg-primary/5 rounded px-2 py-1",children:e.markdown??"(empty)"})]})]}),y&&(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60 mb-1",children:"─ will be inserted ─"}),(0,t.jsx)("pre",{className:"whitespace-pre-wrap font-mono text-[11px] text-foreground bg-primary/5 rounded px-2 py-1",children:e.markdown??"(empty)"})]}),g&&(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60 mb-1",children:"─ will be deleted ─"}),(0,t.jsx)("pre",{className:"whitespace-pre-wrap font-mono text-[11px] text-muted-foreground line-through bg-destructive/5 rounded px-2 py-1",children:r||"(empty)"})]}),e.basisDetail&&(0,t.jsxs)("p",{className:"italic text-muted-foreground/70 text-[11px]",children:["Reason: ",e.basisDetail]})]}),!u&&(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border-t border-border bg-muted/30",children:[(0,t.jsx)("button",{type:"button",disabled:h,onClick:()=>void f(),className:"flex-1 py-1 rounded-md bg-primary text-primary-foreground text-[11px] font-medium hover:bg-primary/90 disabled:opacity-50 transition-colors",children:"Accept"}),(0,t.jsx)("button",{type:"button",disabled:h,onClick:()=>void m(),className:"flex-1 py-1 rounded-md border border-border text-[11px] font-medium hover:bg-accent disabled:opacity-50 transition-colors",children:"Reject"})]})]})}],589676);let J={replace:"Replace block",insertAfter:"Insert after",insertBefore:"Insert before",delete:"Delete block"};e.s(["SuggestEditPopover",0,function({path:e,blockRef:r,currentMarkdown:i,anchor:o,onClose:s}){let[a,l]=(0,n.useState)("replace"),[c,d]=(0,n.useState)(i),[u,h]=(0,n.useState)(""),[p,f]=(0,n.useState)(!1),m=(0,n.useRef)(null);(0,n.useEffect)(()=>{"replace"===a?d(i):d("")},[a,i]),(0,n.useEffect)(()=>{let e=e=>{"Escape"===e.key&&s()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[s]),(0,n.useEffect)(()=>{setTimeout(()=>m.current?.focus(),50)},[]);let g="delete"!==a,y=!p&&(!g||c.trim().length>0);async function b(){if(y){f(!0);try{let t={type:"suggestion.add",ref:r,kind:a,basis:"suggested"};g&&(t.markdown=c),u.trim()&&(t.basisDetail=u.trim());let n=F.useProofStore.getState().byPath[e]?.snapshotRevision??0,i=await q(e,n,[t]);!i.ok&&i.stale&&void 0!==i.newRevision&&(await F.useProofStore.getState().loadSidecar(e),n=i.newRevision,i=await q(e,n,[t])),i.ok&&(await F.useProofStore.getState().loadSidecar(e),await F.useProofStore.getState().loadSnapshot(e),s())}finally{f(!1)}}}return(0,t.jsxs)(C,{open:!0,children:[(0,t.jsx)(M,{asChild:!0,children:(0,t.jsx)("span",{"aria-hidden":"true",style:{position:"fixed",top:o.top,left:o.left,width:0,height:0,pointerEvents:"none"}})}),(0,t.jsx)(O,{children:(0,t.jsxs)(j,{side:"bottom",align:"start",sideOffset:4,collisionPadding:8,onInteractOutside:s,className:"z-50 w-[min(20rem,calc(100vw-1rem))] bg-popover border border-border rounded-lg shadow-xl p-3 space-y-2.5 text-[12px] focus:outline-none",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"font-medium text-foreground",children:"Suggest an edit"}),(0,t.jsx)("span",{className:"text-[11px] font-mono text-muted-foreground/60 truncate ml-2",children:r})]}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:Object.keys(J).map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>l(e),className:`px-2 py-0.5 rounded-md text-[10.5px] border transition-colors ${a===e?"bg-primary text-primary-foreground border-primary":"border-border text-muted-foreground hover:bg-accent"}`,children:J[e]},e))}),"delete"===a&&(0,t.jsx)("pre",{className:"whitespace-pre-wrap font-mono text-[11px] text-muted-foreground line-through bg-destructive/5 rounded px-2 py-1 max-h-32 overflow-y-auto",children:i||"(empty)"}),g&&(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60",children:"replace"===a?"proposed content":"content to insert"}),(0,t.jsx)("textarea",{ref:m,value:c,onChange:e=>d(e.target.value),rows:4,placeholder:"Markdown…",className:"w-full resize-y rounded-md border border-border bg-background px-2 py-1.5 font-mono text-[11px] focus:outline-none focus-visible:ring-1 focus-visible:ring-ring placeholder:text-muted-foreground/40"})]}),(0,t.jsx)("input",{type:"text",value:u,onChange:e=>h(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&b()},placeholder:"Reason (optional)",className:"w-full rounded-md border border-border bg-background px-2 py-1.5 text-[12px] focus:outline-none focus-visible:ring-1 focus-visible:ring-ring placeholder:text-muted-foreground/40"}),(0,t.jsxs)("div",{className:"flex items-center justify-between pt-0.5",children:[(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground/40",children:"⌘↵ submit"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("button",{type:"button",disabled:p,onClick:s,className:"px-2.5 py-1 rounded-md border border-border text-[11px] font-medium hover:bg-accent disabled:opacity-50 transition-colors",children:"Cancel"}),(0,t.jsx)("button",{type:"button",disabled:!y,onClick:()=>void b(),className:"px-2.5 py-1 rounded-md bg-primary text-primary-foreground text-[11px] font-medium hover:bg-primary/90 disabled:opacity-50 transition-colors",children:"Suggest"})]})]}),(0,t.jsx)($,{className:"fill-border"})]})})]})}],294250);let G=(0,e.i(605993).default)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);e.s(["AlertTriangle",0,G],955537)},203195,521470,623616,794469,877031,152555,e=>{"use strict";var t=e.i(44501),n=e.i(955537),r=e.i(987027),i=e.i(674155),o=e.i(73302),s=e.i(395330),a=e.i(398441),l=e.i(977112),c=e.i(799916),d=e.i(605993);let u=(0,d.default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);var h=e.i(853840),p=e.i(864255),f=e.i(991685),m=e.i(703550);let g=(0,d.default)("sigma",[["path",{d:"M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",key:"wuwx1p"}]]),y=(0,d.default)("table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]),b=(0,d.default)("type",[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]]);var v=e.i(978375),w=e.i(101685),x=e.i(975157),k=e.i(96701),S=e.i(512527);let C=[{label:"Text",icon:b,description:"Start writing plain text",category:"basic",action:{type:"direct",run:e=>e.chain().focus().setParagraph().run()}},{label:"Heading 1",icon:s.Heading1,description:"Large section heading",category:"basic",action:{type:"direct",run:e=>e.chain().focus().toggleHeading({level:1}).run()}},{label:"Heading 2",icon:a.Heading2,description:"Medium section heading",category:"basic",action:{type:"direct",run:e=>e.chain().focus().toggleHeading({level:2}).run()}},{label:"Heading 3",icon:l.Heading3,description:"Small section heading",category:"basic",action:{type:"direct",run:e=>e.chain().focus().toggleHeading({level:3}).run()}},{label:"Bullet List",icon:h.List,description:"Create a bullet list",category:"basic",action:{type:"direct",run:e=>e.chain().focus().toggleBulletList().run()}},{label:"Numbered List",icon:p.ListOrdered,description:"Create a numbered list",category:"basic",action:{type:"direct",run:e=>e.chain().focus().toggleOrderedList().run()}},{label:"Checklist",icon:r.CheckSquare,description:"Create a task checklist",category:"basic",action:{type:"direct",run:e=>e.chain().focus().toggleTaskList().run()}},{label:"Code Block",icon:i.Code,description:"Insert a code block",category:"basic",action:{type:"direct",run:e=>e.chain().focus().toggleCodeBlock().run()}},{label:"Blockquote",icon:m.Quote,description:"Insert a blockquote",category:"basic",action:{type:"direct",run:e=>e.chain().focus().toggleBlockquote().run()}},{label:"Divider",icon:f.Minus,description:"Insert a horizontal rule",category:"basic",action:{type:"direct",run:e=>e.chain().focus().setHorizontalRule().run()}},{label:"Table",icon:y,description:"Insert a 3x3 table",category:"basic",action:{type:"direct",run:e=>e.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()}},{label:"Image",icon:c.ImageIcon,description:"Upload, paste URL, or drop an image",category:"media",action:{type:"popover",kind:{type:"media",kind:"image"}}},{label:"Video",icon:v.Video,description:"Upload or paste a video URL",category:"media",action:{type:"popover",kind:{type:"media",kind:"video"}}},{label:"File",icon:o.File,description:"Attach any file to this page",category:"media",action:{type:"popover",kind:{type:"media",kind:"file"}}},{label:"Callout",icon:u,description:"Insert an info callout",category:"advanced",action:{type:"direct",run:e=>e.chain().focus().wrapIn("callout",{type:"info"}).run()}},{label:"Warning",icon:n.AlertTriangle,description:"Insert a warning callout",category:"advanced",action:{type:"direct",run:e=>e.chain().focus().wrapIn("callout",{type:"warning"}).run()}},{label:"Math",icon:g,description:"Insert a LaTeX math expression",category:"advanced",action:{type:"direct",run:e=>e.chain().focus().insertContent("$x=y$").run()}}];function E({cmd:e}){switch(e.label){case"Heading 1":return(0,t.jsx)("p",{className:"font-bold text-[18px] leading-tight text-foreground/80 truncate",children:"Heading 1"});case"Heading 2":return(0,t.jsx)("p",{className:"font-semibold text-[14px] leading-tight text-foreground/80 truncate",children:"Heading 2"});case"Heading 3":return(0,t.jsx)("p",{className:"font-medium text-[12px] leading-tight text-foreground/80 truncate",children:"Heading 3"});case"Text":return(0,t.jsx)("p",{className:"text-[11px] text-foreground/60 leading-snug",children:"The quick brown fox jumps over the lazy dog."});case"Bullet List":return(0,t.jsxs)("ul",{className:"list-disc pl-4 text-[10px] text-foreground/60 space-y-0.5",children:[(0,t.jsx)("li",{children:"First item"}),(0,t.jsx)("li",{children:"Second item"}),(0,t.jsx)("li",{children:"Third item"})]});case"Numbered List":return(0,t.jsxs)("ol",{className:"list-decimal pl-4 text-[10px] text-foreground/60 space-y-0.5",children:[(0,t.jsx)("li",{children:"First item"}),(0,t.jsx)("li",{children:"Second item"}),(0,t.jsx)("li",{children:"Third item"})]});case"Checklist":return(0,t.jsxs)("div",{className:"space-y-0.5 text-[10px] text-foreground/60",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("span",{className:"w-3 h-3 border border-foreground/30 rounded-sm inline-block shrink-0"}),"Pending task"]}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("span",{className:"w-3 h-3 border border-foreground/30 rounded-sm bg-foreground/20 inline-block shrink-0"}),"Done task"]})]});case"Code Block":return(0,t.jsx)("pre",{className:"bg-muted rounded px-2 py-1 text-[10px] font-mono text-foreground/70 leading-snug",children:(0,t.jsx)("code",{children:"const x = 42;"})});case"Blockquote":return(0,t.jsx)("div",{className:"border-l-2 border-foreground/30 pl-2 text-[10px] text-foreground/60 italic",children:"A thought worth quoting."});case"Divider":return(0,t.jsx)("hr",{className:"border-foreground/20 w-full"});case"Table":return(0,t.jsxs)("table",{className:"text-[9px] border-collapse w-full",children:[(0,t.jsx)("thead",{children:(0,t.jsx)("tr",{children:["Col A","Col B","Col C"].map(e=>(0,t.jsx)("th",{className:"border border-foreground/20 px-1.5 py-0.5 text-left font-semibold bg-muted/50 text-foreground/70",children:e},e))})}),(0,t.jsx)("tbody",{children:[["1","2","3"],["4","5","6"]].map((e,n)=>(0,t.jsx)("tr",{children:e.map((e,n)=>(0,t.jsx)("td",{className:"border border-foreground/20 px-1.5 py-0.5 text-foreground/50",children:e},n))},n))})]});case"Image":return(0,t.jsxs)("div",{className:"flex items-center gap-2 text-foreground/50",children:[(0,t.jsx)(c.ImageIcon,{className:"h-8 w-8 text-foreground/20"}),(0,t.jsx)("span",{className:"text-[10px]",children:"image.png"})]});case"Video":return(0,t.jsxs)("div",{className:"flex items-center gap-2 text-foreground/50",children:[(0,t.jsx)(v.Video,{className:"h-8 w-8 text-foreground/20"}),(0,t.jsx)("span",{className:"text-[10px]",children:"video.mp4"})]});case"File":return(0,t.jsxs)("div",{className:"flex items-center gap-2 text-foreground/50",children:[(0,t.jsx)(o.File,{className:"h-8 w-8 text-foreground/20"}),(0,t.jsx)("span",{className:"text-[10px]",children:"attachment.pdf"})]});case"Callout":return(0,t.jsxs)("div",{className:"flex items-start gap-1.5 bg-blue-500/10 border border-blue-500/20 rounded px-2 py-1",children:[(0,t.jsx)(u,{className:"h-3 w-3 text-blue-500 shrink-0 mt-0.5"}),(0,t.jsx)("span",{className:"text-[10px] text-foreground/60",children:"Info callout"})]});case"Warning":return(0,t.jsxs)("div",{className:"flex items-start gap-1.5 bg-warning/10 border border-warning/20 rounded px-2 py-1",children:[(0,t.jsx)(n.AlertTriangle,{className:"h-3 w-3 text-warning shrink-0 mt-0.5"}),(0,t.jsx)("span",{className:"text-[10px] text-foreground/60",children:"Warning callout"})]});case"Math":return(0,t.jsx)("p",{className:"font-mono text-[13px] text-foreground/70",children:"E = mc²"});default:return(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground",children:e.description})}}function M(e){let t=[],n=new Map;return e.state.doc.forEach((e,r)=>{if("heading"===e.type.name){let i=e.textContent,o=e.attrs.level,s=i.toLowerCase().replace(/\s+/g,"-").replace(/[^\w-]/g,"")||"heading",a=(n.get(s)??0)+1;n.set(s,a);let l=1===a?s:`${s}-${a}`;t.push({level:o,text:i,pos:r,uid:l})}}),t}e.s(["SlashCommands",0,function({editor:e}){let[n,r]=(0,w.useState)(!1),[i,o]=(0,w.useState)(""),[s,a]=(0,w.useState)(0),[l,c]=(0,w.useState)({top:0,left:0}),[d,u]=(0,w.useState)(null),h=(0,w.useRef)(null),p=(0,k.useEditorStore)(e=>e.currentPath),f=C.filter(e=>e.label.toLowerCase().includes(i.toLowerCase())||e.description.toLowerCase().includes(i.toLowerCase())),m=(0,w.useCallback)(()=>{r(!1),o(""),a(0)},[]),g=(0,w.useCallback)(t=>{if(!e)return;let{from:n}=e.state.selection,s=n-i.length-1;e.chain().focus().deleteRange({from:s,to:n}).run(),"direct"===t.action.type?(t.action.run(e),m()):(u(t.action.kind),r(!1),o(""))},[e,i,m]);if((0,w.useEffect)(()=>{if(!e)return;let t=t=>{if(!n){if("/"===t.key){let{from:t}=e.state.selection,n=e.state.doc.textBetween(Math.max(0,t-1),t);if(1===t||""===n||"\n"===n||" "===n){let n=e.view.coordsAtPos(t),i=e.view.dom.getBoundingClientRect();c({top:n.bottom-i.top+4,left:n.left-i.left}),r(!0),o(""),a(0)}}return}"Escape"===t.key?(t.preventDefault(),m()):"ArrowDown"===t.key?(t.preventDefault(),a(e=>Math.min(e+1,f.length-1))):"ArrowUp"===t.key?(t.preventDefault(),a(e=>Math.max(e-1,0))):"Enter"===t.key?(t.preventDefault(),f[s]&&g(f[s])):"Backspace"===t.key?0===i.length?m():(o(e=>e.slice(0,-1)),a(0)):" "===t.key?m():1!==t.key.length||t.metaKey||t.ctrlKey||(o(e=>e+t.key),a(0))};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e,n,i,s,f,m,g]),(0,w.useEffect)(()=>{if(!n)return;let e=e=>{h.current&&!h.current.contains(e.target)&&m()};return window.addEventListener("mousedown",e),()=>window.removeEventListener("mousedown",e)},[n,m]),(!n||0===f.length)&&!d)return null;let y=new Map;for(let e of f){let t=y.get(e.category)??[];t.push(e),y.set(e.category,t)}let b=f[s]??null;return(0,t.jsxs)(t.Fragment,{children:[n&&f.length>0&&(0,t.jsxs)("div",{ref:h,className:"absolute z-50 w-[280px] bg-popover border border-border rounded-lg shadow-lg overflow-hidden",style:{top:l.top,left:l.left},children:[(0,t.jsx)("div",{className:"max-h-[300px] overflow-y-auto py-1",children:[{key:"basic",title:"Basic"},{key:"media",title:"Media"},{key:"advanced",title:"Advanced"}].map(e=>{let n=y.get(e.key);return n&&0!==n.length?(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-[9px] uppercase tracking-wider text-muted-foreground px-3 pt-2 pb-1",children:e.title}),n.map(e=>{let n=f.indexOf(e),r=e.icon,i=n===s;return(0,t.jsxs)("button",{onMouseDown:t=>{t.preventDefault(),g(e)},onMouseEnter:()=>a(n),className:(0,x.cn)("flex items-center gap-3 w-full px-3 py-1.5 text-left transition-colors",i?"bg-accent text-accent-foreground ring-1 ring-inset ring-accent-foreground/10":"hover:bg-accent/50"),children:[(0,t.jsx)(r,{className:(0,x.cn)("h-4 w-4 shrink-0 transition-colors",i?"text-accent-foreground":"text-muted-foreground")}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("p",{className:"text-[12px] font-medium truncate",children:e.label}),(0,t.jsx)("p",{className:(0,x.cn)("text-[10px] truncate transition-colors",i?"text-accent-foreground/70":"text-muted-foreground"),children:e.description})]})]},e.label)})]},e.key):null})}),b&&(0,t.jsx)("div",{className:"border-t border-border bg-muted/30 px-3 py-2 min-h-[52px] flex items-center",children:(0,t.jsx)(E,{cmd:b})})]}),d&&e?"media"===d.type?p?(0,t.jsx)(S.MediaPopover,{kind:d.kind,pagePath:p,anchor:l,onCancel:()=>u(null),onInsert:t=>((t,n)=>{if(!e)return;let{url:r,alt:i,mimeType:o}=n;"image"===t||(o??"").startsWith("image/")||/\.(png|jpe?g|gif|webp|svg|avif)(\?|$)/i.test(r)?e.chain().focus().setImage({src:r,alt:i??""}).run():e.chain().focus().insertContent(`<a href="${r}">${i??r}</a>`).run(),u(null)})(d.kind,t)}):null:null:null]})}],203195),e.s(["DocumentOutline",0,function({editor:e,scrollContainerRef:n}){let[r,i]=(0,w.useState)([]),[o,s]=(0,w.useState)(null),[a,l]=(0,w.useState)(!1),[c,d]=(0,w.useState)(0),u=(0,w.useRef)(null);(0,w.useEffect)(()=>{if(!e)return;let t=null,n=()=>{t&&clearTimeout(t),t=setTimeout(()=>i(M(e)),250)};return e.on("update",n),i(M(e)),()=>{t&&clearTimeout(t),e.off("update",n)}},[e]),(0,w.useEffect)(()=>{let e=n.current;if(!e)return;let t=0,r=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(()=>{let t=e.scrollHeight-e.clientHeight;d(t>0?Math.min(1,e.scrollTop/t):0)})};return e.addEventListener("scroll",r,{passive:!0}),()=>{e.removeEventListener("scroll",r),cancelAnimationFrame(t)}},[n]),(0,w.useEffect)(()=>{u.current?.disconnect();let t=n.current;if(!t||!e||0===r.length)return;let i=new IntersectionObserver(e=>{for(let t of e)if(t.isIntersecting){let e=t.target.dataset.outlineId;e&&s(e)}},{root:t,rootMargin:"-8% 0px -72% 0px",threshold:0});for(let t of r)try{let{node:n}=e.view.domAtPos(t.pos+1),r=n.nodeType===Node.ELEMENT_NODE?n.closest("h1,h2,h3,h4,h5,h6")??n:n.parentElement?.closest("h1,h2,h3,h4,h5,h6")??null;r&&(r.dataset.outlineId=t.uid,i.observe(r))}catch{}return u.current=i,()=>{i.disconnect()}},[r,e,n]);let p=(0,w.useCallback)(t=>{if(e)try{let{node:n}=e.view.domAtPos(t.pos+1),r=n.nodeType===Node.ELEMENT_NODE?n.closest("h1,h2,h3,h4,h5,h6")??n:n.parentElement?.closest("h1,h2,h3,h4,h5,h6")??null;r?.scrollIntoView({behavior:"smooth",block:"start"})}catch{}},[e]),f=r.length>=2,[m,g]=(0,w.useState)(!1),y=(0,t.jsx)(t.Fragment,{children:r.map((e,n)=>(0,t.jsx)("button",{onClick:()=>{p(e),g(!1)},title:e.text,className:(0,x.cn)("text-left text-[10.5px] leading-snug py-0.5 rounded truncate transition-colors shrink-0",o===e.uid?"text-primary bg-primary/10 font-medium":"text-muted-foreground/60 hover:text-foreground hover:bg-accent"),style:{paddingLeft:`${(e.level-1)*8+4}px`},children:e.text},`${e.uid}-${n}`))});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{"aria-hidden":!0,className:"absolute top-0 left-0 right-0 h-0.5 z-30 pointer-events-none",children:(0,t.jsx)("div",{className:"h-full bg-primary/35 transition-[width] duration-100 ease-out",style:{width:`${100*c}%`}})}),f&&(0,t.jsxs)("div",{className:"absolute right-1 top-4 z-20 hidden xl:block w-40",children:[(0,t.jsxs)("button",{onClick:()=>l(e=>!e),className:"flex items-center gap-1 mb-1.5 px-1 py-0.5 rounded text-muted-foreground/40 hover:text-muted-foreground hover:bg-accent transition-colors text-[10px]","aria-label":a?"Expand outline":"Collapse outline",children:[(0,t.jsx)(h.List,{className:"h-3 w-3"}),!a&&(0,t.jsx)("span",{children:"Outline"})]}),!a&&(0,t.jsx)("nav",{"aria-label":"Document outline",className:"flex flex-col gap-px max-h-[50vh] overflow-y-auto pr-1",children:y})]}),f&&(0,t.jsxs)("div",{className:"absolute right-2 top-2 z-30 xl:hidden",children:[(0,t.jsx)("button",{onClick:()=>g(e=>!e),className:"flex items-center gap-1 px-1.5 py-1 rounded bg-background/80 backdrop-blur border border-border/60 text-muted-foreground/60 hover:text-foreground hover:bg-accent transition-colors text-[10px] shadow-sm","aria-label":"Document outline","aria-expanded":m,children:(0,t.jsx)(h.List,{className:"h-3.5 w-3.5"})}),m&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{"aria-hidden":!0,tabIndex:-1,className:"fixed inset-0 z-0 cursor-default",onClick:()=>g(!1)}),(0,t.jsx)("nav",{"aria-label":"Document outline",className:"absolute right-0 top-9 z-10 w-52 max-h-[60vh] overflow-y-auto flex flex-col gap-px rounded-lg border border-border bg-popover p-2 shadow-lg",children:y})]})]})]})}],521470);var N=e.i(367092),A=e.i(10137);let T=(0,d.default)("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]),R=(0,d.default)("unlink",[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]);var O=e.i(671485),D=e.i(246542);e.s(["BacklinksPanel",0,function({currentPath:e}){let[n,r]=(0,w.useState)([]),[i,o]=(0,w.useState)(!1),[s,a]=(0,w.useState)(!1),l=(0,D.useWikiSlugsStore)(e=>e.has);return((0,w.useEffect)(()=>{if(!e)return;let t=!1;o(!0),r([]);let n=setTimeout(()=>{(async()=>{try{let n=await (0,O.wsFetch)(`/api/wiki/backlinks?path=${encodeURIComponent(e)}`),i=n.ok?await n.json():{backlinks:[]};if(t)return;r(i.backlinks??[])}catch{t||r([])}finally{t||o(!1)}})()},200);return()=>{t=!0,clearTimeout(n)}},[e]),i||0!==n.length)?(0,t.jsx)("div",{className:"max-w-[var(--editor-max-w,48rem)] mx-auto px-4 sm:px-8 pb-8 pt-1",children:(0,t.jsxs)("div",{className:"border-t border-border/60 pt-4",children:[(0,t.jsxs)("button",{onClick:()=>a(e=>!e),className:"flex items-center gap-1.5 text-[11px] text-muted-foreground/60 hover:text-muted-foreground transition-colors mb-2","aria-expanded":!s,children:[s?(0,t.jsx)(A.ChevronRight,{className:"h-3 w-3 shrink-0"}):(0,t.jsx)(N.ChevronDown,{className:"h-3 w-3 shrink-0"}),(0,t.jsx)(T,{className:"h-3 w-3 shrink-0"}),(0,t.jsx)("span",{className:"font-medium",children:"Linked from"}),n.length>0&&(0,t.jsxs)("span",{className:"opacity-50 tabular-nums",children:["(",n.length,")"]}),i&&(0,t.jsx)("span",{className:"opacity-40 ml-1",children:"…"})]}),!s&&n.length>0&&(0,t.jsx)("ul",{className:"flex flex-col gap-1.5",children:n.map(e=>{var n,r;let i,o=l(((n=e.path).split("/").pop()??n).replace(/\.md$/i,""));return(0,t.jsxs)("li",{className:"flex flex-col",children:[(0,t.jsxs)("button",{onClick:()=>o&&k.useEditorStore.getState().loadPage(e.path),className:o?"text-left text-[12px] text-primary/70 hover:text-primary hover:underline underline-offset-2 truncate transition-colors flex items-center gap-1":"text-left text-[12px] text-muted-foreground/40 truncate cursor-default flex items-center gap-1",title:o?e.path:`${e.path} (file not found)`,children:[!o&&(0,t.jsx)(R,{className:"h-2.5 w-2.5 shrink-0 text-muted-foreground/30"}),(i=(r=e.path).replace(/\.md$/i,"").split("/")).length>1?i.slice(-2).join(" / "):i[0]??r]}),e.snippet&&(0,t.jsx)("p",{className:o?"text-[10.5px] text-muted-foreground/50 line-clamp-1 mt-0.5":"text-[10.5px] text-muted-foreground/25 line-clamp-1 mt-0.5",children:e.snippet})]},e.path)})})]})}):null}],623616),e.i(150663);var j=e.i(608926),I=e.i(153840);let P=(0,d.default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),L=(0,d.default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",0,L],794469);let z=(0,d.default)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),_=(0,d.default)("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),$=(0,d.default)("columns-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]),H=(0,d.default)("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);e.s(["PanelLeft",0,H],877031);let B=(0,d.default)("panel-top",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]]),F=(0,d.default)("rows-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]);var V=e.i(920978);function U({label:e,icon:n,disabled:r,active:i,danger:o,onAction:s}){return(0,t.jsx)("button",{type:"button","aria-label":e,title:e,disabled:r,onMouseDown:e=>e.preventDefault(),onClick:e=>{e.preventDefault(),s()},className:(0,x.cn)("h-7 w-7 inline-flex items-center justify-center rounded text-foreground/80 hover:bg-accent transition-colors disabled:pointer-events-none disabled:opacity-35",i&&"bg-accent text-foreground",o&&"text-destructive hover:bg-destructive/10"),children:(0,t.jsx)(n,{className:"h-3.5 w-3.5"})})}function W(){return(0,t.jsx)("div",{className:"mx-1 h-5 w-px bg-border"})}e.s(["TableMenu",0,function({editor:e}){if(!e)return null;let n=()=>{if(!(0,j.isInTable)(e.state))return null;try{return(0,j.selectedRect)(e.state)}catch{return null}},r=t=>{t()&&(e.commands.focus(),e.commands.fixTables())},i=t=>{let r=n();if(!r)return;let i=r.top,o=i+t;o<0||o>=r.map.height||((0,j.moveTableRow)({from:i,to:o})(e.state,e.view.dispatch),e.commands.focus())},o=t=>{let r=n();if(!r)return;let i=r.left,o=i+t;o<0||o>=r.map.width||((0,j.moveTableColumn)({from:i,to:o})(e.state,e.view.dispatch),e.commands.focus())},s=n(),a=!!s&&s.top>0,l=!!s&&s.top<s.map.height-1,c=!!s&&s.left>0,d=!!s&&s.left<s.map.width-1;return(0,t.jsxs)(I.BubbleMenu,{editor:e,pluginKey:"tableMenu",options:{placement:"top",offset:10},shouldShow:({editor:e})=>e.isActive("table"),className:"flex items-center gap-0.5 rounded-md border border-border bg-popover px-1 py-1 shadow-lg",children:[(0,t.jsx)(U,{label:"Select cell text",icon:y,onAction:()=>{let t=(0,j.cellAround)(e.state.selection.$from),n=t?.nodeAfter;t&&n&&e.chain().focus().setTextSelection({from:t.pos+1,to:t.pos+n.nodeSize-1}).run()}}),(0,t.jsx)(W,{}),(0,t.jsx)(U,{label:"Add row above",icon:F,onAction:()=>r(()=>e.chain().focus().addRowBefore().run())}),(0,t.jsx)(U,{label:"Add row below",icon:P,onAction:()=>r(()=>e.chain().focus().addRowAfter().run())}),(0,t.jsx)(U,{label:"Move row up",icon:_,disabled:!a,onAction:()=>i(-1)}),(0,t.jsx)(U,{label:"Move row down",icon:P,disabled:!l,onAction:()=>i(1)}),(0,t.jsx)(U,{label:"Delete row",icon:V.Trash2,danger:!0,onAction:()=>r(()=>e.chain().focus().deleteRow().run())}),(0,t.jsx)(W,{}),(0,t.jsx)(U,{label:"Add column before",icon:$,onAction:()=>r(()=>e.chain().focus().addColumnBefore().run())}),(0,t.jsx)(U,{label:"Add column after",icon:z,onAction:()=>r(()=>e.chain().focus().addColumnAfter().run())}),(0,t.jsx)(U,{label:"Move column left",icon:L,disabled:!c,onAction:()=>o(-1)}),(0,t.jsx)(U,{label:"Move column right",icon:z,disabled:!d,onAction:()=>o(1)}),(0,t.jsx)(U,{label:"Delete column",icon:V.Trash2,danger:!0,onAction:()=>r(()=>e.chain().focus().deleteColumn().run())}),(0,t.jsx)(W,{}),(0,t.jsx)(U,{label:"Toggle header row",icon:B,onAction:()=>r(()=>e.chain().focus().toggleHeaderRow().run())}),(0,t.jsx)(U,{label:"Toggle header column",icon:H,onAction:()=>r(()=>e.chain().focus().toggleHeaderColumn().run())}),(0,t.jsx)(W,{}),(0,t.jsx)(U,{label:"Delete table",icon:V.Trash2,danger:!0,onAction:()=>e.chain().focus().deleteTable().run()})]})}],152555)},793479,e=>{"use strict";var t=e.i(44501),n=e.i(101685),r=e.i(975157);let i=n.forwardRef(({className:e,type:n,...i},o)=>(0,t.jsx)("input",{type:n,className:(0,r.cn)("flex h-9 w-full rounded-sm border border-input bg-secondary px-3 py-1 text-sm shadow-e-1 transition-colors file:border-0 file:bg-transparent file:text-sm file:font-normal placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:o,...i}));i.displayName="Input",e.s(["Input",0,i])},912235,110204,e=>{"use strict";var t=e.i(44501);e.i(150663);var n=e.i(608926),r=e.i(885047),i=e.i(425732),o=e.i(43240),s=e.i(313393),a=e.i(530229),l=e.i(691520),c=e.i(231597),d=e.i(101685),u=e.i(417068),h=e.i(797715),p=e.i(660885),f=e.i(490275),m=e.i(24800),g=e.i(96701),y=e.i(990791),b=e.i(395624),v=e.i(246542),w=e.i(592185),x=e.i(926732),k=e.i(671485),S=e.i(417385),C=e.i(582612),E=e.i(240409),M=e.i(314206),N=e.i(496668),A=e.i(665794),T=e.i(926128),R=e.i(803043),O=e.i(589676),D=e.i(294250),j=e.i(203195),I=e.i(521470),P=e.i(623616),L=e.i(152555),z=e.i(519455),_=e.i(776639),$=e.i(793479),H=e.i(750110),B=d.forwardRef((e,n)=>(0,t.jsx)(H.Primitive.label,{...e,ref:n,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));B.displayName="Label";var F=e.i(294237),V=e.i(975157);let U=(0,F.cva)("text-sm font-normal leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50"),W=d.forwardRef(({className:e,...n},r)=>(0,t.jsx)(B,{ref:r,className:(0,V.cn)(U(),e),...n}));W.displayName=B.displayName,e.s(["Label",0,W],110204);let K=["entities","concepts","comparisons"],q=/^[a-z0-9-]+$/;function J({editor:e,onCreateRequest:n}){let[r,i]=(0,d.useState)(!1),[o,s]=(0,d.useState)(""),[a,l]=(0,d.useState)(0),[c,u]=(0,d.useState)({top:0,left:0}),h=(0,d.useRef)(null),p=(0,d.useRef)(0),f=(0,v.useWikiSlugsStore)(e=>e.slugs),m=(0,v.useWikiSlugsStore)(e=>e.slugDir),g=(0,v.useWikiSlugsStore)(e=>e.has),y=Array.from(f).sort().filter(e=>!o||e.includes(o.toLowerCase())).slice(0,20),b=o.length>0&&q.test(o)&&!g(o),w=y.length+ +!!b,x=(0,d.useCallback)(()=>{i(!1),s(""),l(0)},[]),k=(0,d.useCallback)(t=>{if(!e)return;let{from:n}=e.state.selection,r=p.current-2,i=e.state.schema.marks.wikiLink;if(!i)return;let o=i.create({slug:t,alias:null,anchor:null}),s=e.state.schema.text(t,[o]),a=e.state.tr.replaceWith(r,n,s);e.view.dispatch(a),e.commands.focus(),x()},[e,x]),S=(0,d.useCallback)(async t=>{if(e){if(t<y.length)k(y[t]??"");else if(b){let e=await n(o);e.ok?k(e.slug):x()}}},[e,y,b,o,k,n,x]);return((0,d.useEffect)(()=>{if(!e)return;let t=t=>{if(!r){if("["===t.key){let{from:t}=e.state.selection;if("["!==e.state.doc.textBetween(Math.max(0,t-1),t)||e.state.doc.resolve(t).marks().some(e=>"wikiLink"===e.type.name))return;let n=e.view.coordsAtPos(t),r=e.view.dom.getBoundingClientRect();u({top:n.bottom-r.top+4,left:n.left-r.left}),p.current=t+1,i(!0),s(""),l(0)}return}"ArrowDown"===t.key?(t.preventDefault(),l(e=>w>0?(e+1)%w:0)):"ArrowUp"===t.key?(t.preventDefault(),l(e=>w>0?(e-1+w)%w:0)):"Enter"===t.key?(t.preventDefault(),t.stopPropagation(),w>0&&S(a)):"Escape"===t.key||"]"===t.key?x():"Backspace"===t.key?0===o.length?x():(s(e=>e.slice(0,-1)),l(0)):1!==t.key.length||t.metaKey||t.ctrlKey||(s(e=>e+t.key),l(0))};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e,r,o,a,w,x,S]),(0,d.useEffect)(()=>{if(!r)return;let e=e=>{h.current&&!h.current.contains(e.target)&&x()};return window.addEventListener("mousedown",e),()=>window.removeEventListener("mousedown",e)},[r,x]),r&&0!==w)?(0,t.jsxs)("div",{ref:h,className:"absolute z-50 w-[280px] bg-popover border border-border rounded-lg shadow-lg py-1 overflow-hidden max-h-[300px] overflow-y-auto",style:{top:c.top,left:c.left},children:[y.map((e,n)=>{let r=m.get(e);return(0,t.jsxs)("button",{type:"button",onMouseDown:e=>{e.preventDefault(),S(n)},onMouseEnter:()=>l(n),className:(0,V.cn)("flex items-center justify-between w-full px-3 py-1.5 text-left text-sm transition-colors",n===a?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[(0,t.jsx)("span",{className:"truncate",children:e}),r&&(0,t.jsx)("span",{className:"ml-2 shrink-0 text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded",children:r})]},e)}),b&&(0,t.jsx)("button",{type:"button",onMouseDown:e=>{e.preventDefault(),S(y.length)},onMouseEnter:()=>l(y.length),className:(0,V.cn)("flex items-center w-full px-3 py-1.5 text-left text-sm transition-colors",y.length===a?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:(0,t.jsxs)("span",{className:"text-muted-foreground",children:["+ Create new “",o,"”"]})})]}):null}var G=e.i(367092),X=e.i(10137);let Z=(0,F.cva)("inline-flex items-center rounded-sm border px-2.5 py-0.5 text-xs font-normal transition-colors focus:outline-none focus:ring-2 focus:ring-ring",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow-e-1",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-destructive-foreground shadow-e-1",outline:"text-foreground",accent:"border-transparent bg-accent text-accent-foreground"}},defaultVariants:{variant:"default"}});function Y({className:e,variant:n,...r}){return(0,t.jsx)("div",{className:(0,V.cn)(Z({variant:n}),e),...r})}let Q=new Set(["title","type","status","created","updated","date","tags","sources","private","supersedes","superseded_by"]);function ee({data:e}){let[n,r]=(0,d.useState)(!1),i=Object.keys(e);if(0===i.length)return null;let o="string"==typeof e.title?e.title:null,s="string"==typeof e.type?e.type:null,a="string"==typeof e.status?e.status:null,l="string"==typeof e.created?e.created:null,c="string"==typeof e.updated?e.updated:null,u=!0===e.private,h=Array.isArray(e.tags)?e.tags:[],p=Array.isArray(e.sources)?e.sources:[],f="string"==typeof e.superseded_by?e.superseded_by:null,m=i.filter(e=>!Q.has(e));return(0,t.jsxs)("div",{className:"mb-6 rounded-sm border bg-card/40 px-4 py-3 text-xs",children:[o&&(0,t.jsx)("div",{className:"mb-2 text-base font-normal text-foreground",children:o}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1.5 text-muted-foreground",children:[s&&(0,t.jsx)(Y,{variant:"outline",className:"font-normal",children:s}),a&&(0,t.jsx)(Y,{variant:"outline",className:"font-normal",children:a}),u&&(0,t.jsx)(Y,{variant:"outline",className:"border-warning-ink/40 font-normal text-warning-ink",children:"private"}),f&&(0,t.jsxs)(Y,{variant:"outline",className:"border-destructive/40 font-normal text-destructive",children:["superseded → ",f]}),l&&(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"opacity-60",children:"created"})," ",(0,t.jsx)("span",{className:"text-foreground/80",children:l})]}),c&&c!==l&&(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"opacity-60",children:"updated"})," ",(0,t.jsx)("span",{className:"text-foreground/80",children:c})]})]}),h.length>0&&(0,t.jsx)("div",{className:"mt-2 flex flex-wrap gap-1",children:h.map(e=>(0,t.jsxs)(Y,{variant:"secondary",className:"font-normal text-[11px]",children:["#",e]},e))}),p.length>0&&(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsx)("span",{className:"opacity-60",children:"sources:"})," ",(0,t.jsx)("span",{className:"text-foreground/80",children:p.join(", ")})]}),m.length>0&&(0,t.jsxs)("div",{className:"mt-2 border-t pt-2",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>r(e=>!e),className:"flex items-center gap-1 text-muted-foreground hover:text-foreground",children:[n?(0,t.jsx)(G.ChevronDown,{className:"h-3 w-3"}):(0,t.jsx)(X.ChevronRight,{className:"h-3 w-3"}),(0,t.jsxs)("span",{children:[m.length," more field",1===m.length?"":"s"]})]}),n&&(0,t.jsx)("dl",{className:"mt-1.5 grid grid-cols-[max-content_1fr] gap-x-3 gap-y-0.5",children:m.map(n=>(0,t.jsxs)(d.Fragment,{children:[(0,t.jsx)("dt",{className:"opacity-60",children:n}),(0,t.jsx)("dd",{className:"text-foreground/80 break-words",children:function e(t){if(null==t)return"";if("string"==typeof t)return t;if("number"==typeof t||"boolean"==typeof t)return String(t);if(Array.isArray(t))return t.map(e).join(", ");try{return JSON.stringify(t)}catch{return String(t)}}(e[n])})]},n))})]})]})}var et=e.i(891734);function en({containerRef:e,onComment:n}){let[r,i]=(0,d.useState)(null);return((0,d.useEffect)(()=>{function t(){let t=window.getSelection();if(!t||t.isCollapsed||0===t.rangeCount)return void i(null);let n=t.getRangeAt(0),r=e.current;if(!r||!r.contains(n.commonAncestorContainer))return void i(null);let o=n.getBoundingClientRect();0===o.width&&0===o.height?i(null):i({top:o.top-38,left:o.left+o.width/2})}return document.addEventListener("selectionchange",t),()=>document.removeEventListener("selectionchange",t)},[e]),r)?(0,t.jsxs)("button",{type:"button",style:{position:"fixed",top:r.top,left:r.left,transform:"translateX(-50%)",zIndex:50},className:"flex items-center gap-1 px-2 py-1 bg-popover border border-border rounded-sm shadow-lg text-[12px] text-foreground/80 hover:text-foreground hover:bg-accent transition-colors",onMouseDown:e=>e.preventDefault(),onClick:()=>{n(),i(null)},"aria-label":"Add comment",title:"Add comment",children:[(0,t.jsx)(et.MessageCircle,{className:"w-3.5 h-3.5"}),(0,t.jsx)("span",{children:"Comment"})]}):null}async function er(e,t){let n=new FormData;n.append("file",t);try{let r=await (0,k.wsFetch)(`/api/upload/${e}`,{method:"POST",body:n});if(!r.ok)return(0,S.showError)(`Upload failed: ${t.name}`),null;return(await r.json()).url}catch{return(0,S.showError)(`Upload failed: ${t.name}`),null}}function ei(e){let t=[];for(let n of e)t.push({path:n.path,name:n.name}),n.children&&t.push(...ei(n.children));return t}function eo(e,t,n){let r=ei(n).filter(t=>t.name===e||t.path.endsWith(`/${e}`));if(0===r.length)return null;if(1===r.length)return r[0].path;if(t){let n=t.includes("/")?t.substring(0,t.lastIndexOf("/")):"",i=r.find(t=>t.path===(n?`${n}/${e}`:e));if(i)return i.path}return r[0].path}function es(e,t,n){let r=e.split("/");for(let e=1;e<r.length;e++)n(r.slice(0,e).join("/"));t(e),g.useEditorStore.getState().loadPage(e),setTimeout(()=>{document.querySelector("[data-editor-scroll]")?.scrollTo(0,0)},0)}e.s(["KBEditor",0,function({mode:e}={}){let{currentPath:H,content:B,saveStatus:F,frontmatter:V,isLoading:U,loadStatus:q,createMissingPage:G,editMode:X,setEditMode:Z}=(0,g.useEditorStore)(),Y=e??X,Q="viewing"===Y,et="suggesting"===Y,ea=(0,d.useMemo)(()=>Q?(0,f.parseFrontmatter)(B):{data:{},body:B},[B,Q]),el=(0,y.useTreeStore)(e=>e.nodes),ec=(0,b.useViewWidthStore)(e=>b.VIEW_WIDTH_CSS[e.width]),ed=(0,b.useViewWidthStore)(e=>b.VIEW_ALIGN_ML[e.align]),eu=Q?"rtl"===ea.data.dir:V?.dir==="rtl",{open:eh,clearMessages:ep}=(0,m.useAIPanelStore)(),{open:ef,Dialog:em}=function(){let[e,n]=(0,d.useState)(!1),[r,i]=(0,d.useState)({slug:"",dir:"entities",title:""}),[o,s]=(0,d.useState)(!1),a=(0,d.useRef)(null),l=(0,d.useCallback)(e=>(i({slug:e,dir:"entities",title:e.split("-").filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}),n(!0),new Promise(e=>{a.current=e})),[]),c=(0,d.useCallback)(()=>{n(!1),a.current?.({ok:!1,slug:r.slug}),a.current=null},[r.slug]),u=(0,d.useCallback)(async()=>{let{slug:e,dir:t,title:i}=r;s(!0);try{let r=await (0,k.wsFetch)("/api/wiki/page",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:e,dir:t,title:i.trim()||void 0})});if(r.ok||409===r.status){let r=v.useWikiSlugsStore.getState();r.invalidate(),r.load(),n(!1),a.current?.({ok:!0,slug:e,dir:t}),a.current=null}else{let e=await r.json().catch(()=>({})),t=null!==e&&"object"==typeof e&&"error"in e&&"string"==typeof e.error?e.error:"Failed to create page";(0,S.showError)(t)}}catch{(0,S.showError)("Failed to create page")}finally{s(!1)}},[r]);return{open:l,Dialog:(0,t.jsx)(_.Dialog,{open:e,onOpenChange:e=>{e||c()},children:(0,t.jsxs)(_.DialogContent,{children:[(0,t.jsx)(_.DialogHeader,{children:(0,t.jsx)(_.DialogTitle,{children:"Create wiki page"})}),(0,t.jsxs)("div",{className:"space-y-4 py-2",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)(W,{htmlFor:"wiki-create-slug",children:"Slug"}),(0,t.jsx)($.Input,{id:"wiki-create-slug",value:r.slug,readOnly:!0,className:"bg-muted cursor-default select-all"})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)(W,{children:"Directory"}),(0,t.jsx)("div",{className:"flex gap-4",children:K.map(e=>(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-sm cursor-pointer",children:[(0,t.jsx)("input",{type:"radio",name:"wiki-create-dir",value:e,checked:r.dir===e,onChange:()=>i(t=>({...t,dir:e})),className:"accent-primary"}),e]},e))})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)(W,{htmlFor:"wiki-create-title",children:"Title (optional)"}),(0,t.jsx)($.Input,{id:"wiki-create-title",value:r.title,onChange:e=>i(t=>({...t,title:e.target.value})),placeholder:"Humanized title..."})]})]}),(0,t.jsxs)(_.DialogFooter,{children:[(0,t.jsx)(z.Button,{variant:"outline",onClick:c,disabled:o,children:"Cancel"}),(0,t.jsx)(z.Button,{onClick:()=>void u(),disabled:o,children:o?"Creating...":"Create"})]})]})})}}(),eg=(0,d.useRef)(ef);eg.current=ef;let ey=(0,d.useRef)(!1),eb=(0,d.useRef)(Q);eb.current=Q;let[ev,ew]=(0,d.useState)(!1),[ex,ek]=(0,d.useState)(""),[eS,eC]=(0,d.useState)("page");(0,d.useEffect)(()=>{eC("page")},[]),(0,d.useEffect)(()=>{v.useWikiSlugsStore.getState().load()},[]),(0,d.useEffect)(()=>{if(!H)return;let e=setTimeout(()=>{w.useProofStore.getState().loadSidecar(H)},200);return()=>clearTimeout(e)},[H]),(0,d.useEffect)(()=>{if(!H||Q||!/\.(md|markdown)$/i.test(H))return;let e=e=>{(0,k.wsFetch)("/api/wiki/presence",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:H,action:e}),keepalive:"close"===e}).catch(()=>{})},t=!1,n=null,r=()=>{t&&"hidden"===document.visibilityState&&e("heartbeat")},i=setTimeout(()=>{t=!0,e("open"),n=setInterval(()=>e("heartbeat"),3e4),document.addEventListener("visibilitychange",r)},200);return()=>{clearTimeout(i),n&&clearInterval(n),document.removeEventListener("visibilitychange",r),t&&e("close")}},[H,Q]),(0,d.useEffect)(()=>{let e=new EventSource((0,k.withWs)("/api/wiki/watch"));return e.onmessage=e=>{try{let t=JSON.parse(e.data),n=g.useEditorStore.getState().currentPath;("change"===t.type||"add"===t.type)&&n&&t.path===n&&(w.useProofStore.getState().loadSnapshot(n).then(()=>w.useProofStore.getState().loadSidecar(n)),eb.current&&g.useEditorStore.getState().loadPage(n))}catch{}},()=>{e.close()}},[]);let[eE,eM]=(0,d.useState)(null),eN=(0,d.useRef)(null),[eA,eT]=(0,d.useState)(new Map),eR=(0,w.useProofStore)(e=>H?e.byPath[H]?.snapshotBlocks:void 0),eO=(0,w.useProofStore)(e=>H?e.byPath[H]?.sidecar?.suggestions:void 0),eD=(0,w.useProofStore)(e=>H?e.byPath[H]?.snapshotRevision??0:0),ej=(0,w.useProofStore)(e=>H?e.byPath[H]?.sidecar?.comments:void 0),eI=(0,d.useMemo)(()=>eR??[],[eR]),eP=(0,d.useMemo)(()=>ej??[],[ej]),eL=(0,d.useMemo)(()=>eO?.filter(e=>"pending"===e.status)??[],[eO]),ez=(0,d.useMemo)(()=>{let e={};for(let t of eP)(e[t.ref]??=[]).push(t);return e},[eP]),[e_,e$]=(0,d.useState)(null),[eH,eB]=(0,d.useState)(null),eF=(0,d.useCallback)(()=>{if(!eY.current)return null;let e=eY.current.view,{from:t}=e.state.selection,n=g.useEditorStore.getState().currentPath??"",r=w.useProofStore.getState().byPath[n]?.snapshotBlocks??[],i=e.state.doc.resolve(t),o=i.depth>0?i.index(0):0,s=eN.current?.querySelector(".ProseMirror"),a=(s?Array.from(s.children):[])[o]??null,l=r[o],c=l?.ref??a?.getAttribute("data-block-ref")??null,d=l?.markdown??"";if(!c&&a){let n=e.domAtPos(t),r=n.node.nodeType===Node.ELEMENT_NODE?n.node:n.node.parentElement,i=r?.closest("[data-block-ref]")??null;c=i?.getAttribute("data-block-ref")??null}return c&&a?{blockRef:c,blockEl:a,markdown:d}:null},[]),eV=(0,d.useCallback)(()=>{let e=eF();if(!e)return;let t=e.blockEl.getBoundingClientRect();eB({blockRef:e.blockRef,markdown:e.markdown,anchor:{top:t.bottom+4,left:t.left}})},[eF]),eU=(0,d.useCallback)(()=>{let e=eF();e&&e$({blockRef:e.blockRef,el:e.blockEl})},[eF]),eW=(0,d.useRef)(!1),eK=(0,d.useRef)(!1),eq=(0,d.useRef)(null),eJ=e=>e.replace(/\s+$/g,"").trimStart(),eG=(0,d.useCallback)(async()=>{if(eK.current||eb.current||"suggesting"!==g.useEditorStore.getState().editMode||!eW.current)return;let e=eY.current,t=g.useEditorStore.getState().currentPath;if(!e||!t)return;let n=eN.current?.querySelector(".ProseMirror");if(!n)return;let r=Array.from(n.children),i=w.useProofStore.getState().byPath[t]?.snapshotBlocks??[];if(0!==i.length){eK.current=!0,eW.current=!1;try{let n=()=>w.useProofStore.getState().byPath[t]?.snapshotRevision??0,o=async()=>{await w.useProofStore.getState().loadSnapshot(t),await w.useProofStore.getState().loadSidecar(t)},s=Math.max(r.length,i.length),a=!1;for(let e=0;e<s;e++){let s=r[e],l=i[e],c=s?(0,p.htmlToMarkdown)(s.outerHTML).trim():null;if(l&&null!==c){if(eJ(c)!==eJ(l.markdown)){let e=await (0,x.captureSuggestion)({path:t,ref:l.ref,kind:"replace",markdown:c,getRevision:n,refresh:o});a=a||e}}else if(l&&null===c){let e=await (0,x.captureSuggestion)({path:t,ref:l.ref,kind:"delete",getRevision:n,refresh:o});a=a||e}else if(!l&&null!==c&&c.length>0){let e=i[i.length-1]?.ref;if(e){let r=await (0,x.captureSuggestion)({path:t,ref:e,kind:"insertAfter",markdown:c,getRevision:n,refresh:o});a=a||r}}}if(a){await o();let n=(w.useProofStore.getState().byPath[t]?.snapshotBlocks??i).map(e=>e.markdown).join("\n\n");ey.current=!0;let r=await (0,h.markdownToHtml)(n,t);e.commands.setContent(r),setTimeout(()=>{ey.current=!1},50)}}finally{eK.current=!1}}},[]);(0,d.useEffect)(()=>{if(!H)return;let e=setTimeout(()=>{w.useProofStore.getState().loadSnapshot(H)},200);return()=>clearTimeout(e)},[H]),(0,d.useEffect)(()=>{if(!H||0===eI.length||!eN.current)return;let e=eN.current,t=e.querySelector(".ProseMirror");if(!t)return;let n=Array.from(t.children),r=e.getBoundingClientRect(),i=new Map;for(let t=0;t<Math.min(n.length,eI.length);t++){let o=n[t],s=eI[t];o.setAttribute("data-block-ref",s.ref);let a=o.getBoundingClientRect();i.set(s.ref,{top:a.top-r.top+e.scrollTop,left:a.left-r.left,width:a.width,bottom:a.bottom-r.top+e.scrollTop})}eT(i)},[H,eI]);let eX=(0,d.useCallback)(({editor:e})=>{if(ey.current||eb.current||!e)return;"suggesting"===g.useEditorStore.getState().editMode&&(eW.current=!0);let t=e.getHTML(),n=(0,p.htmlToMarkdown)(t);g.useEditorStore.getState().updateContent(n)},[]),eZ=(0,r.useEditor)({extensions:M.editorExtensions,content:"",editable:!Q,onUpdate:eX,onBlur:()=>{eG()},onSelectionUpdate:({editor:e})=>{if("suggesting"!==g.useEditorStore.getState().editMode)return;let{from:t}=e.state.selection,n=e.state.doc.resolve(t),r=n.depth>0?n.index(0):0,i=eq.current;eq.current=r,null!==i&&i!==r&&eW.current&&eG()},editorProps:{attributes:{class:"focus:outline-none min-h-[calc(100vh-12rem)] px-4 sm:px-8 py-6 max-w-[var(--editor-max-w,48rem)] ml-[var(--editor-ml,auto)] mr-auto"},handleKeyDown:(e,t)=>{if((t.metaKey||t.ctrlKey)&&"a"===t.key.toLowerCase()&&(0,n.isInTable)(e.state)){let r=(0,n.cellAround)(e.state.selection.$from),i=r?.nodeAfter;if(!r||!i)return!1;let o=r.pos+1,s=r.pos+i.nodeSize-1;return(e.state.selection.from!==o||e.state.selection.to!==s)&&(t.preventDefault(),eZ?.chain().focus().setTextSelection({from:o,to:s}).run(),!0)}return!1},handleClick:(e,t,n)=>{let r=n.target.closest("a");if(!r)return!1;let i=r.getAttribute("href");if(!i)return!1;if("true"===r.dataset.wikiLink){n.preventDefault(),n.stopPropagation();let e=r.dataset.slug??"",t=r.dataset.anchor??null;if(!e)return!0;let i=v.useWikiSlugsStore.getState();if(i.has(e)){let n=i.getDir(e),r=null===n||"root"===n?`${e}.md`:`${n}/${e}.md`;g.useEditorStore.getState().loadPage(r),t&&setTimeout(()=>{document.querySelector(`[id="${t}"]`)?.scrollIntoView({behavior:"smooth"})},200)}else{if(eb.current)return!0;eg.current(e).then(e=>{if(e.ok){let t=e.dir??"entities",n=`${t}/${e.slug}.md`;g.useEditorStore.getState().loadPage(n)}})}return!0}if(i.startsWith("#page:")){n.preventDefault(),n.stopPropagation();let e=i.replace("#page:",""),{nodes:t,selectPage:r,expandPath:o}=y.useTreeStore.getState(),s=eo(e,g.useEditorStore.getState().currentPath,t);return s&&es(s,r,o),!0}if(/^https?:\/\//.test(i)||i.startsWith("/api/")||i.startsWith("mailto:")||i.startsWith("tel:"))return!1;n.preventDefault(),n.stopPropagation();let{nodes:o,selectPage:s,expandPath:a}=y.useTreeStore.getState(),l=function(e,t,n){let r=ei(n),i=e.replace(/\.md$/,"").replace(/^\.\//,"").replace(/^\//,""),o=r.find(e=>e.path===i);if(o)return o.path;if(t){let e=t.includes("/")?t.substring(0,t.lastIndexOf("/")):"",n=e?`${e}/${i}`:i,o=r.find(e=>e.path===n);if(o)return o.path}return eo(i.includes("/")?i.split("/").pop():i,t,n)}(i,g.useEditorStore.getState().currentPath,o);return l&&es(l,s,a),!0},handlePaste:(e,t)=>{if(eb.current)return!1;let n=t.clipboardData?.files,r=g.useEditorStore.getState().currentPath;if(n&&n.length>0&&r){for(let e of Array.from(n))er(r,e).then(t=>{t&&eZ&&(e.type.startsWith("image/")?eZ.chain().focus().setImage({src:t,alt:e.name}).run():eZ.chain().focus().insertContent(`<a href="${t}">${e.name}</a>`).run())});return!0}return!1},handleDrop:(e,t)=>{if(eb.current)return!1;let n=t.dataTransfer?.files;if(!n||0===n.length)return!1;let r=g.useEditorStore.getState().currentPath;if(!r)return!1;for(let e of(t.preventDefault(),Array.from(n)))er(r,e).then(t=>{t&&eZ&&(e.type.startsWith("image/")?eZ.chain().focus().setImage({src:t,alt:e.name}).run():eZ.chain().focus().insertContent(`<a href="${t}">${e.name}</a>`).run())});return!0}},immediatelyRender:!1}),eY=(0,d.useRef)(eZ);eY.current=eZ,(0,d.useEffect)(()=>{eZ?.setEditable(!Q),Q&&ew(!1)},[eZ,Q]);let eQ=(0,d.useRef)(null),e0=(0,d.useRef)(null),[e1,e2]=(0,d.useState)(null);(0,d.useEffect)(()=>{if(!eZ||null===H||g.useEditorStore.getState().isDirty&&H===eQ.current||U&&""===B)return;let e=ea.body,t=`${H} ${e}`;if(e0.current===t){e1!==H&&e2(H);return}eQ.current=H;let n=!1;return(async()=>{ey.current=!0;let r=await (0,h.markdownToHtml)(e,Q?{pagePath:H,sanitize:!0}:H);if(n||g.useEditorStore.getState().currentPath!==H){ey.current=!1;return}eZ.commands.setContent(r),e0.current=t,e2(H),setTimeout(()=>{ey.current=!1},50)})(),()=>{n=!0}},[eZ,B,H,U,e1,ea.body,Q]),(0,d.useEffect)(()=>{if(!Q||!e1)return;let e=eN.current;e&&e.querySelectorAll('input[type="checkbox"]').forEach(e=>{e.disabled=!0})},[Q,e1,ea.body]);let e5=null!==H&&(U||e1!==H),[e3,e4]=(0,d.useState)(!1);if((0,d.useEffect)(()=>{if(!e5)return void e4(!1);let e=setTimeout(()=>e4(!0),150);return()=>clearTimeout(e)},[e5]),null===H)return(0,t.jsx)("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:(0,t.jsxs)("div",{className:"text-center space-y-3",children:[(0,t.jsx)("p",{className:"text-lg font-medium tracking-[-0.02em]",children:"No page selected"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground/70",children:"Select a page from the sidebar or create a new one"})]})});if("missing"===q){let e=(H.split("/").pop()||H).replace(/[-_]+/g," ").replace(/\b\w/g,e=>e.toUpperCase()),n=(0,u.findNodeByPath)(el,H),r=n?.children??[],i=r.length>0;return(0,t.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,t.jsxs)("div",{className:"max-w-3xl mx-auto px-6 py-10 space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("p",{className:"text-lg font-medium tracking-[-0.02em] text-foreground",children:e}),(0,t.jsxs)("p",{className:"text-sm text-muted-foreground/80",children:["This folder doesn't have an"," ",(0,t.jsx)("code",{className:"px-1 py-0.5 rounded bg-muted text-[12px]",children:"index.md"}),i?" yet — its contents are listed below.":" yet."]}),(0,t.jsxs)("button",{onClick:()=>void G(e),className:"inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-[13px] font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:[(0,t.jsx)(a.FilePlus,{className:"h-3.5 w-3.5"}),"Create page"]})]}),i&&(0,t.jsx)(N.FolderIndex,{folderPath:H,entries:r},H)]})})}let e6=async()=>{if(ev){if(g.useEditorStore.getState().updateContent(ex),eZ){ey.current=!0;let e=await (0,h.markdownToHtml)(ex,H??void 0);eZ.commands.setContent(e),setTimeout(()=>{ey.current=!1},50)}ew(!1)}else ek(g.useEditorStore.getState().content),ew(!0)},e9=(0,u.findNodeByPath)(el,H),e7=e9?.type==="directory"||e9?.type==="cabinet"?e9.children??[]:[],e8=e7.length>0,te=e8&&"files"===eS;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e8&&(0,t.jsxs)("div",{className:"flex items-center gap-1 px-3 pt-2 border-b border-border",children:[(0,t.jsx)("button",{onClick:()=>eC("page"),className:`px-3 py-1.5 text-[12px] rounded-t-md border-b-2 -mb-px transition-colors ${"page"===eS?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,"aria-pressed":"page"===eS,children:"Page"}),(0,t.jsxs)("button",{onClick:()=>eC("files"),className:`px-3 py-1.5 text-[12px] rounded-t-md border-b-2 -mb-px transition-colors ${"files"===eS?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,"aria-pressed":"files"===eS,children:["Files",(0,t.jsx)("span",{className:"ml-1.5 text-muted-foreground/60",children:e7.length})]})]}),te?(0,t.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,t.jsx)("div",{className:"max-w-3xl mx-auto px-6 py-6",children:(0,t.jsx)(N.FolderIndex,{folderPath:H,entries:e7},H)})}):(0,t.jsxs)(t.Fragment,{children:[!Q&&(0,t.jsxs)("div",{className:"flex items-center min-w-0",children:[(0,t.jsx)("div",{className:"flex-1 min-w-0",children:!ev&&(0,t.jsx)(E.EditorToolbar,{editor:eZ})}),(0,t.jsxs)("button",{onClick:e6,className:`flex items-center gap-1.5 px-3 py-1 mr-2 text-[11px] rounded-md transition-colors border border-border ${ev?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"}`,children:[(0,t.jsx)(s.Code2,{className:"h-3 w-3"}),ev?"Preview":"Markdown"]})]}),ev?(0,t.jsx)("div",{className:"flex-1 overflow-y-auto p-4",dir:eu?"rtl":void 0,children:(0,t.jsx)("textarea",{value:ex,onChange:e=>ek(e.target.value),className:"w-full h-full min-h-[calc(100vh-12rem)] bg-transparent font-mono text-[13px] leading-relaxed resize-none focus:outline-none",spellCheck:!1})}):(0,t.jsxs)("div",{className:"flex-1 relative",dir:eu?"rtl":void 0,children:[et&&(0,t.jsx)("div",{className:"absolute top-0 inset-x-0 z-20 flex items-center justify-center gap-2 px-3 py-1 bg-primary/10 border-b border-primary/20 text-[11px] text-primary pointer-events-none",children:"Suggesting mode · your edits become suggestions for review"}),(0,t.jsx)(I.DocumentOutline,{editor:eZ,scrollContainerRef:eN}),(0,t.jsxs)("div",{ref:eN,className:`absolute inset-0 overflow-y-auto ${et?"pt-7":""}`,style:{"--editor-max-w":ec,"--editor-ml":ed},"data-editor-scroll":!0,children:[(0,t.jsxs)("div",{"aria-hidden":"true",className:"relative pointer-events-none",style:{height:0},children:[Object.entries(ez).map(([e,n])=>{let r=eA.get(e);return r?(0,t.jsx)("div",{style:{pointerEvents:"auto"},children:(0,t.jsx)(A.CommentPip,{blockRef:e,comments:n,top:r.top+4,left:Math.max(0,r.left-20),onClick:()=>{let t=eN.current?.querySelector(`[data-block-ref="${e}"]`);t&&e$({blockRef:e,el:t})}})},`pip-${e}`):null}),H&&eL.map(e=>{let n=eA.get(e.ref),r=eI.find(t=>t.ref===e.ref);if(!n||!r)return null;let i="insertAfter"===e.kind?n.bottom+4:"insertBefore"===e.kind?Math.max(0,n.top-80):n.top;return(0,t.jsx)("div",{style:{pointerEvents:"auto"},children:(0,t.jsx)(O.SuggestionCard,{path:H,suggestion:e,currentMarkdown:r.markdown,baseRevision:eD,getLatestRevision:()=>w.useProofStore.getState().byPath[H]?.snapshotRevision??0,top:i,left:n.left,width:n.width,onSettled:()=>{w.useProofStore.getState().loadSidecar(H),w.useProofStore.getState().loadSnapshot(H)},readOnly:Q})},`sug-${e.id}`)})]}),e_&&H&&(0,t.jsx)(T.CommentThread,{path:H,blockRef:e_.blockRef,comments:ez[e_.blockRef]??[],anchorEl:e_.el,onClose:()=>e$(null),readOnly:Q}),eH&&H&&(0,t.jsx)(D.SuggestEditPopover,{path:H,blockRef:eH.blockRef,currentMarkdown:eH.markdown,anchor:eH.anchor,onClose:()=>eB(null)}),Q&&Object.keys(ea.data).length>0&&(0,t.jsx)("div",{className:"max-w-[var(--editor-max-w,48rem)] ml-[var(--editor-ml,auto)] mr-auto px-4 sm:px-8 pt-6",children:(0,t.jsx)(ee,{data:ea.data})}),(0,t.jsx)(r.EditorContent,{editor:eZ}),H&&/\.(md|markdown)$/i.test(H)&&(0,t.jsx)(P.BacklinksPanel,{currentPath:H}),(0,t.jsx)("div",{"aria-hidden":"true",className:"contents",onMouseOver:e=>{let t=e.target.closest(".proof-span");t&&t!==eE&&eM(t)},onMouseOut:e=>{let t=e.relatedTarget;t?.closest(".proof-span")||eM(null)}}),H&&(0,t.jsx)(R.ProofSpanPopover,{targetEl:eE,path:H,onClose:()=>eM(null),onComment:()=>{if(!eE)return;let e=eE.closest("[data-block-ref]");if(!e)return;let t=e.getAttribute("data-block-ref");t&&e$({blockRef:t,el:e})}}),!Q&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(C.EditorBubbleMenu,{editor:eZ,onSuggestEdit:eV,onComment:eU}),(0,t.jsx)(L.TableMenu,{editor:eZ}),(0,t.jsx)(j.SlashCommands,{editor:eZ}),(0,t.jsx)(J,{editor:eZ,onCreateRequest:eg.current})]}),Q&&(0,t.jsx)(en,{containerRef:eN,onComment:eU}),(0,t.jsxs)("div",{className:"max-w-[var(--editor-max-w,48rem)] ml-[var(--editor-ml,auto)] mr-auto px-8 pb-8 flex items-center gap-4",children:[(0,t.jsxs)("button",{onClick:()=>{ep(),eh()},className:"group flex items-center gap-2 text-[13px] text-muted-foreground/50 hover:text-muted-foreground transition-colors cursor-pointer",children:[(0,t.jsx)(c.Sparkles,{className:"h-3.5 w-3.5 group-hover:text-primary transition-colors"}),(0,t.jsx)("span",{children:"Edit with AI"})]}),!Q&&(0,t.jsxs)("span",{className:"text-[11px] text-muted-foreground/30 select-none",children:[(0,t.jsx)("kbd",{className:"rounded px-1 py-0.5 font-mono text-[10px] ring-1 ring-foreground/10",children:"/"})," ","for commands"]})]})]}),e3&&(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-background/80 backdrop-blur-md z-20 pointer-events-none","aria-hidden":"true",children:(0,t.jsx)(l.Loader2,{className:"h-5 w-5 animate-spin text-muted-foreground/70"})})]}),!Q&&(0,t.jsxs)("div",{className:"flex items-center justify-between px-4 py-1 border-t border-border text-xs text-muted-foreground/60",children:[(0,t.jsxs)("span",{className:"text-[10.5px] text-muted-foreground/30 select-none hidden sm:block",children:[(0,t.jsx)("kbd",{className:"rounded px-1 font-mono text-[9.5px] ring-1 ring-foreground/10",children:"⌘S"})," ","save",(0,t.jsx)("span",{className:"mx-1.5 opacity-40",children:"·"}),(0,t.jsx)("kbd",{className:"rounded px-1 font-mono text-[9.5px] ring-1 ring-foreground/10",children:"/"})," ","commands"]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsxs)("div",{className:"flex items-center rounded-md border border-border overflow-hidden text-[10.5px]",role:"radiogroup","aria-label":"Edit mode",children:[(0,t.jsx)("button",{type:"button",role:"radio","aria-checked":"editing"===X,onClick:()=>Z("editing"),className:`px-2 py-0.5 transition-colors ${"editing"===X?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"}`,children:"Editing"}),(0,t.jsx)("button",{type:"button",role:"radio","aria-checked":"suggesting"===X,onClick:()=>Z("suggesting"),className:`px-2 py-0.5 transition-colors ${"suggesting"===X?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"}`,children:"Suggesting"})]}),(0,t.jsxs)("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10.5px] transition-all duration-300 ${"idle"===F?"opacity-0 pointer-events-none":"opacity-100"} ${"saving"===F?"bg-muted text-muted-foreground":"saved"===F?"bg-success/10 text-success":"error"===F?"bg-destructive/10 text-destructive":""}`,children:["saving"===F&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(l.Loader2,{className:"h-2.5 w-2.5 animate-spin"}),"Saving…"]}),"saved"===F&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.Check,{className:"h-2.5 w-2.5"}),"Saved"]}),"error"===F&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.AlertCircle,{className:"h-2.5 w-2.5"}),"Save failed"]})]})]})]})]})]}),em]})}],912235)},41986,25486,e=>{"use strict";var t=e.i(101685),n=e.i(543250),r=e.i(967928),i=e.i(652053),o=e.i(44501),s=new WeakMap;function a(e,t){var n,r;let i,o,s;if("at"in Array.prototype)return Array.prototype.at.call(e,t);let a=(n=e,r=t,i=n.length,(s=(o=l(r))>=0?o:i+o)<0||s>=i?-1:s);return -1===a?void 0:e[a]}function l(e){return e!=e||0===e?0:Math.trunc(e)}(class e extends Map{#e;constructor(e){super(e),this.#e=[...super.keys()],s.set(this,!0)}set(e,t){return s.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r,i=this.has(t),o=this.#e.length,s=l(e),a=s>=0?s:o+s,c=a<0||a>=o?-1:a;if(c===this.size||i&&c===this.size-1||-1===c)return this.set(t,n),this;let d=this.size+ +!i;s<0&&a++;let u=[...this.#e],h=!1;for(let e=a;e<d;e++)if(a===e){let o=u[e];u[e]===t&&(o=u[e+1]),i&&this.delete(t),r=this.get(o),this.set(t,n)}else{h||u[e-1]!==t||(h=!0);let n=u[h?e:e-1],i=r;r=this.get(n),this.delete(n),this.set(n,i)}return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return -1===r?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(-1!==(t=-1===t||t===this.size-1?-1:t+1))return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return -1===r?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=a(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=a(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return a(this.#e,e)}from(e,t){let n=this.indexOf(e);if(-1===n)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(-1===n)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return -1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=0,i=n??this.at(0);for(let n of this)i=0===r&&1===e.length?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&1===e.length?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){return new e([...this.entries()].sort(t))}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,i=this.size-1;if(void 0===t)return r;t<0&&(t+=this.size),void 0!==n&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}}),e.s(["createCollection",0,function(e){let s=e+"CollectionProvider",[a,l]=(0,n.createContextScope)(s),[c,d]=a(s,{collectionRef:{current:null},itemMap:new Map}),u=e=>{let{scope:n,children:r}=e,i=t.default.useRef(null),s=t.default.useRef(new Map).current;return(0,o.jsx)(c,{scope:n,itemMap:s,collectionRef:i,children:r})};u.displayName=s;let h=e+"CollectionSlot",p=(0,i.createSlot)(h),f=t.default.forwardRef((e,t)=>{let{scope:n,children:i}=e,s=d(h,n),a=(0,r.useComposedRefs)(t,s.collectionRef);return(0,o.jsx)(p,{ref:a,children:i})});f.displayName=h;let m=e+"CollectionItemSlot",g="data-radix-collection-item",y=(0,i.createSlot)(m),b=t.default.forwardRef((e,n)=>{let{scope:i,children:s,...a}=e,l=t.default.useRef(null),c=(0,r.useComposedRefs)(n,l),u=d(m,i);return t.default.useEffect(()=>(u.itemMap.set(l,{ref:l,...a}),()=>void u.itemMap.delete(l))),(0,o.jsx)(y,{...{[g]:""},ref:c,children:s})});return b.displayName=m,[{Provider:u,Slot:f,ItemSlot:b},function(n){let r=d(e+"CollectionConsumer",n);return t.default.useCallback(()=>{let e=r.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${g}]`));return Array.from(r.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[r.collectionRef,r.itemMap])},l]}],41986);var c=t.createContext(void 0);e.s(["useDirection",0,function(e){let n=t.useContext(c);return e||n||"ltr"}],25486)},677275,e=>{"use strict";var t=e.i(101685),n=e.i(291967),r=e.i(41986),i=e.i(967928),o=e.i(543250),s=e.i(433616),a=e.i(980939),l=e.i(136131),c=e.i(417256),d=e.i(25486),u=e.i(44501),h="rovingFocusGroup.onEntryFocus",p={bubbles:!1,cancelable:!0},f="RovingFocusGroup",[m,g,y]=(0,r.createCollection)(f),[b,v]=(0,o.createContextScope)(f,[y]),[w,x]=b(f),k=t.forwardRef((e,t)=>(0,u.jsx)(m.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,u.jsx)(m.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,u.jsx)(S,{...e,ref:t})})}));k.displayName=f;var S=t.forwardRef((e,r)=>{let{__scopeRovingFocusGroup:o,orientation:s,loop:m=!1,dir:y,currentTabStopId:b,defaultCurrentTabStopId:v,onCurrentTabStopIdChange:x,onEntryFocus:k,preventScrollOnEntryFocus:S=!1,...C}=e,E=t.useRef(null),M=(0,i.useComposedRefs)(r,E),A=(0,d.useDirection)(y),[T,R]=(0,c.useControllableState)({prop:b,defaultProp:v??null,onChange:x,caller:f}),[O,D]=t.useState(!1),j=(0,l.useCallbackRef)(k),I=g(o),P=t.useRef(!1),[L,z]=t.useState(0);return t.useEffect(()=>{let e=E.current;if(e)return e.addEventListener(h,j),()=>e.removeEventListener(h,j)},[j]),(0,u.jsx)(w,{scope:o,orientation:s,dir:A,loop:m,currentTabStopId:T,onItemFocus:t.useCallback(e=>R(e),[R]),onItemShiftTab:t.useCallback(()=>D(!0),[]),onFocusableItemAdd:t.useCallback(()=>z(e=>e+1),[]),onFocusableItemRemove:t.useCallback(()=>z(e=>e-1),[]),children:(0,u.jsx)(a.Primitive.div,{tabIndex:O||0===L?-1:0,"data-orientation":s,...C,ref:M,style:{outline:"none",...e.style},onMouseDown:(0,n.composeEventHandlers)(e.onMouseDown,()=>{P.current=!0}),onFocus:(0,n.composeEventHandlers)(e.onFocus,e=>{let t=!P.current;if(e.target===e.currentTarget&&t&&!O){let t=new CustomEvent(h,p);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=I().filter(e=>e.focusable);N([e.find(e=>e.active),e.find(e=>e.id===T),...e].filter(Boolean).map(e=>e.ref.current),S)}}P.current=!1}),onBlur:(0,n.composeEventHandlers)(e.onBlur,()=>D(!1))})})}),C="RovingFocusGroupItem",E=t.forwardRef((e,r)=>{let{__scopeRovingFocusGroup:i,focusable:o=!0,active:l=!1,tabStopId:c,children:d,...h}=e,p=(0,s.useId)(),f=c||p,y=x(C,i),b=y.currentTabStopId===f,v=g(i),{onFocusableItemAdd:w,onFocusableItemRemove:k,currentTabStopId:S}=y;return t.useEffect(()=>{if(o)return w(),()=>k()},[o,w,k]),(0,u.jsx)(m.ItemSlot,{scope:i,id:f,focusable:o,active:l,children:(0,u.jsx)(a.Primitive.span,{tabIndex:b?0:-1,"data-orientation":y.orientation,...h,ref:r,onMouseDown:(0,n.composeEventHandlers)(e.onMouseDown,e=>{o?y.onItemFocus(f):e.preventDefault()}),onFocus:(0,n.composeEventHandlers)(e.onFocus,()=>y.onItemFocus(f)),onKeyDown:(0,n.composeEventHandlers)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void y.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=function(e,t,n){var r;let i=(r=e.key,"rtl"!==n?r:"ArrowLeft"===r?"ArrowRight":"ArrowRight"===r?"ArrowLeft":r);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(i))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(i)))return M[i]}(e,y.orientation,y.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let i=v().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)i.reverse();else if("prev"===t||"next"===t){var n,r;"prev"===t&&i.reverse();let o=i.indexOf(e.currentTarget);i=y.loop?(n=i,r=o+1,n.map((e,t)=>n[(r+t)%n.length])):i.slice(o+1)}setTimeout(()=>N(i))}}),children:"function"==typeof d?d({isCurrentTabStop:b,hasTabStop:null!=S}):d})})});E.displayName=C;var M={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function N(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}e.s(["Item",0,E,"Root",0,k,"createRovingFocusGroupScope",0,v])},996702,918552,e=>{"use strict";var t=e.i(101685),n=e.i(291967),r=e.i(967928),i=e.i(543250),o=e.i(417256),s=e.i(980939),a=e.i(41986),l=e.i(25486),c=e.i(348989),d=e.i(539340),u=e.i(445424),h=e.i(433616),p=e.i(638154),f=e.i(332374),m=e.i(190088),g=e.i(677275),y=e.i(652053),b=e.i(136131),v=e.i(73772),w=e.i(206500),x=e.i(44501),k=["Enter"," "],S=["ArrowUp","PageDown","End"],C=["ArrowDown","PageUp","Home",...S],E={ltr:[...k,"ArrowRight"],rtl:[...k,"ArrowLeft"]},M={ltr:["ArrowLeft"],rtl:["ArrowRight"]},N="Menu",[A,T,R]=(0,a.createCollection)(N),[O,D]=(0,i.createContextScope)(N,[R,p.createPopperScope,g.createRovingFocusGroupScope]),j=(0,p.createPopperScope)(),I=(0,g.createRovingFocusGroupScope)(),[P,L]=O(N),[z,_]=O(N),$=e=>{let{__scopeMenu:n,open:r=!1,children:i,dir:o,onOpenChange:s,modal:a=!0}=e,c=j(n),[d,u]=t.useState(null),h=t.useRef(!1),f=(0,b.useCallbackRef)(s),m=(0,l.useDirection)(o);return t.useEffect(()=>{let e=()=>{h.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>h.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),(0,x.jsx)(p.Root,{...c,children:(0,x.jsx)(P,{scope:n,open:r,onOpenChange:f,content:d,onContentChange:u,children:(0,x.jsx)(z,{scope:n,onClose:t.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:h,dir:m,modal:a,children:i})})})};$.displayName=N;var H=t.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=j(n);return(0,x.jsx)(p.Anchor,{...i,...r,ref:t})});H.displayName="MenuAnchor";var B="MenuPortal",[F,V]=O(B,{forceMount:void 0}),U=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,o=L(B,t);return(0,x.jsx)(F,{scope:t,forceMount:n,children:(0,x.jsx)(m.Presence,{present:n||o.open,children:(0,x.jsx)(f.Portal,{asChild:!0,container:i,children:r})})})};U.displayName=B;var W="MenuContent",[K,q]=O(W),J=t.forwardRef((e,t)=>{let n=V(W,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=L(W,e.__scopeMenu),s=_(W,e.__scopeMenu);return(0,x.jsx)(A.Provider,{scope:e.__scopeMenu,children:(0,x.jsx)(m.Presence,{present:r||o.open,children:(0,x.jsx)(A.Slot,{scope:e.__scopeMenu,children:s.modal?(0,x.jsx)(G,{...i,ref:t}):(0,x.jsx)(X,{...i,ref:t})})})})}),G=t.forwardRef((e,i)=>{let o=L(W,e.__scopeMenu),s=t.useRef(null),a=(0,r.useComposedRefs)(i,s);return t.useEffect(()=>{let e=s.current;if(e)return(0,v.hideOthers)(e)},[]),(0,x.jsx)(Y,{...e,ref:a,trapFocus:o.open,disableOutsidePointerEvents:o.open,disableOutsideScroll:!0,onFocusOutside:(0,n.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>o.onOpenChange(!1)})}),X=t.forwardRef((e,t)=>{let n=L(W,e.__scopeMenu);return(0,x.jsx)(Y,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Z=(0,y.createSlot)("MenuContent.ScrollLock"),Y=t.forwardRef((e,i)=>{let{__scopeMenu:o,loop:s=!1,trapFocus:a,onOpenAutoFocus:l,onCloseAutoFocus:h,disableOutsidePointerEvents:f,onEntryFocus:m,onEscapeKeyDown:y,onPointerDownOutside:b,onFocusOutside:v,onInteractOutside:k,onDismiss:E,disableOutsideScroll:M,...N}=e,A=L(W,o),R=_(W,o),O=j(o),D=I(o),P=T(o),[z,$]=t.useState(null),H=t.useRef(null),B=(0,r.useComposedRefs)(i,H,A.onContentChange),F=t.useRef(0),V=t.useRef(""),U=t.useRef(0),q=t.useRef(null),J=t.useRef("right"),G=t.useRef(0),X=M?w.RemoveScroll:t.Fragment;t.useEffect(()=>()=>window.clearTimeout(F.current),[]),(0,d.useFocusGuards)();let Y=t.useCallback(e=>{var t,n;return J.current===q.current?.side&&(t=e,!!(n=q.current?.area)&&function(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,o=t.length-1;e<t.length;o=e++){let s=t[e],a=t[o],l=s.x,c=s.y,d=a.x,u=a.y;c>r!=u>r&&n<(d-l)*(r-c)/(u-c)+l&&(i=!i)}return i}({x:t.clientX,y:t.clientY},n))},[]);return(0,x.jsx)(K,{scope:o,searchRef:V,onItemEnter:t.useCallback(e=>{Y(e)&&e.preventDefault()},[Y]),onItemLeave:t.useCallback(e=>{Y(e)||(H.current?.focus(),$(null))},[Y]),onTriggerLeave:t.useCallback(e=>{Y(e)&&e.preventDefault()},[Y]),pointerGraceTimerRef:U,onPointerGraceIntentChange:t.useCallback(e=>{q.current=e},[]),children:(0,x.jsx)(X,{...M?{as:Z,allowPinchZoom:!0}:void 0,children:(0,x.jsx)(u.FocusScope,{asChild:!0,trapped:a,onMountAutoFocus:(0,n.composeEventHandlers)(l,e=>{e.preventDefault(),H.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:h,children:(0,x.jsx)(c.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:f,onEscapeKeyDown:y,onPointerDownOutside:b,onFocusOutside:v,onInteractOutside:k,onDismiss:E,children:(0,x.jsx)(g.Root,{asChild:!0,...D,dir:R.dir,orientation:"vertical",loop:s,currentTabStopId:z,onCurrentTabStopIdChange:$,onEntryFocus:(0,n.composeEventHandlers)(m,e=>{R.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,x.jsx)(p.Content,{role:"menu","aria-orientation":"vertical","data-state":eM(A.open),"data-radix-menu-content":"",dir:R.dir,...O,...N,ref:B,style:{outline:"none",...N.style},onKeyDown:(0,n.composeEventHandlers)(N.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=1===e.key.length;if(t){var i;let t,o,s,a,l,c;"Tab"===e.key&&e.preventDefault(),!n&&r&&(i=e.key,t=V.current+i,o=P().filter(e=>!e.disabled),s=document.activeElement,a=o.find(e=>e.ref.current===s)?.textValue,l=function(e,t,n){var r;let i=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,o=n?e.indexOf(n):-1,s=(r=Math.max(o,0),e.map((t,n)=>e[(r+n)%e.length]));1===i.length&&(s=s.filter(e=>e!==n));let a=s.find(e=>e.toLowerCase().startsWith(i.toLowerCase()));return a!==n?a:void 0}(o.map(e=>e.textValue),t,a),c=o.find(e=>e.textValue===l)?.ref.current,function e(t){V.current=t,window.clearTimeout(F.current),""!==t&&(F.current=window.setTimeout(()=>e(""),1e3))}(t),c&&setTimeout(()=>c.focus()))}let o=H.current;if(e.target!==o||!C.includes(e.key))return;e.preventDefault();let s=P().filter(e=>!e.disabled).map(e=>e.ref.current);S.includes(e.key)&&s.reverse(),function(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}(s)}),onBlur:(0,n.composeEventHandlers)(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(F.current),V.current="")}),onPointerMove:(0,n.composeEventHandlers)(e.onPointerMove,eT(e=>{let t=e.target,n=G.current!==e.clientX;e.currentTarget.contains(t)&&n&&(J.current=e.clientX>G.current?"right":"left",G.current=e.clientX)}))})})})})})})});J.displayName=W;var Q=t.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,x.jsx)(s.Primitive.div,{role:"group",...r,ref:t})});Q.displayName="MenuGroup";var ee=t.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,x.jsx)(s.Primitive.div,{...r,ref:t})});ee.displayName="MenuLabel";var et="MenuItem",en="menu.itemSelect",er=t.forwardRef((e,i)=>{let{disabled:o=!1,onSelect:a,...l}=e,c=t.useRef(null),d=_(et,e.__scopeMenu),u=q(et,e.__scopeMenu),h=(0,r.useComposedRefs)(i,c),p=t.useRef(!1);return(0,x.jsx)(ei,{...l,ref:h,disabled:o,onClick:(0,n.composeEventHandlers)(e.onClick,()=>{let e=c.current;if(!o&&e){let t=new CustomEvent(en,{bubbles:!0,cancelable:!0});e.addEventListener(en,e=>a?.(e),{once:!0}),(0,s.dispatchDiscreteCustomEvent)(e,t),t.defaultPrevented?p.current=!1:d.onClose()}}),onPointerDown:t=>{e.onPointerDown?.(t),p.current=!0},onPointerUp:(0,n.composeEventHandlers)(e.onPointerUp,e=>{p.current||e.currentTarget?.click()}),onKeyDown:(0,n.composeEventHandlers)(e.onKeyDown,e=>{let t=""!==u.searchRef.current;o||t&&" "===e.key||k.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});er.displayName=et;var ei=t.forwardRef((e,i)=>{let{__scopeMenu:o,disabled:a=!1,textValue:l,...c}=e,d=q(et,o),u=I(o),h=t.useRef(null),p=(0,r.useComposedRefs)(i,h),[f,m]=t.useState(!1),[y,b]=t.useState("");return t.useEffect(()=>{let e=h.current;e&&b((e.textContent??"").trim())},[c.children]),(0,x.jsx)(A.ItemSlot,{scope:o,disabled:a,textValue:l??y,children:(0,x.jsx)(g.Item,{asChild:!0,...u,focusable:!a,children:(0,x.jsx)(s.Primitive.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...c,ref:p,onPointerMove:(0,n.composeEventHandlers)(e.onPointerMove,eT(e=>{a?d.onItemLeave(e):(d.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:(0,n.composeEventHandlers)(e.onPointerLeave,eT(e=>d.onItemLeave(e))),onFocus:(0,n.composeEventHandlers)(e.onFocus,()=>m(!0)),onBlur:(0,n.composeEventHandlers)(e.onBlur,()=>m(!1))})})})}),eo=t.forwardRef((e,t)=>{let{checked:r=!1,onCheckedChange:i,...o}=e;return(0,x.jsx)(ep,{scope:e.__scopeMenu,checked:r,children:(0,x.jsx)(er,{role:"menuitemcheckbox","aria-checked":eN(r)?"mixed":r,...o,ref:t,"data-state":eA(r),onSelect:(0,n.composeEventHandlers)(o.onSelect,()=>i?.(!!eN(r)||!r),{checkForDefaultPrevented:!1})})})});eo.displayName="MenuCheckboxItem";var es="MenuRadioGroup",[ea,el]=O(es,{value:void 0,onValueChange:()=>{}}),ec=t.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,o=(0,b.useCallbackRef)(r);return(0,x.jsx)(ea,{scope:e.__scopeMenu,value:n,onValueChange:o,children:(0,x.jsx)(Q,{...i,ref:t})})});ec.displayName=es;var ed="MenuRadioItem",eu=t.forwardRef((e,t)=>{let{value:r,...i}=e,o=el(ed,e.__scopeMenu),s=r===o.value;return(0,x.jsx)(ep,{scope:e.__scopeMenu,checked:s,children:(0,x.jsx)(er,{role:"menuitemradio","aria-checked":s,...i,ref:t,"data-state":eA(s),onSelect:(0,n.composeEventHandlers)(i.onSelect,()=>o.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});eu.displayName=ed;var eh="MenuItemIndicator",[ep,ef]=O(eh,{checked:!1}),em=t.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,o=ef(eh,n);return(0,x.jsx)(m.Presence,{present:r||eN(o.checked)||!0===o.checked,children:(0,x.jsx)(s.Primitive.span,{...i,ref:t,"data-state":eA(o.checked)})})});em.displayName=eh;var eg=t.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,x.jsx)(s.Primitive.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});eg.displayName="MenuSeparator";var ey=t.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=j(n);return(0,x.jsx)(p.Arrow,{...i,...r,ref:t})});ey.displayName="MenuArrow";var eb="MenuSub",[ev,ew]=O(eb),ex=e=>{let{__scopeMenu:n,children:r,open:i=!1,onOpenChange:o}=e,s=L(eb,n),a=j(n),[l,c]=t.useState(null),[d,u]=t.useState(null),f=(0,b.useCallbackRef)(o);return t.useEffect(()=>(!1===s.open&&f(!1),()=>f(!1)),[s.open,f]),(0,x.jsx)(p.Root,{...a,children:(0,x.jsx)(P,{scope:n,open:i,onOpenChange:f,content:d,onContentChange:u,children:(0,x.jsx)(ev,{scope:n,contentId:(0,h.useId)(),triggerId:(0,h.useId)(),trigger:l,onTriggerChange:c,children:r})})})};ex.displayName=eb;var ek="MenuSubTrigger",eS=t.forwardRef((e,i)=>{let o=L(ek,e.__scopeMenu),s=_(ek,e.__scopeMenu),a=ew(ek,e.__scopeMenu),l=q(ek,e.__scopeMenu),c=t.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:u}=l,h={__scopeMenu:e.__scopeMenu},p=t.useCallback(()=>{c.current&&window.clearTimeout(c.current),c.current=null},[]);return t.useEffect(()=>p,[p]),t.useEffect(()=>{let e=d.current;return()=>{window.clearTimeout(e),u(null)}},[d,u]),(0,x.jsx)(H,{asChild:!0,...h,children:(0,x.jsx)(ei,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":a.contentId,"data-state":eM(o.open),...e,ref:(0,r.composeRefs)(i,a.onTriggerChange),onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),o.open||o.onOpenChange(!0))},onPointerMove:(0,n.composeEventHandlers)(e.onPointerMove,eT(t=>{l.onItemEnter(t),!t.defaultPrevented&&(e.disabled||o.open||c.current||(l.onPointerGraceIntentChange(null),c.current=window.setTimeout(()=>{o.onOpenChange(!0),p()},100)))})),onPointerLeave:(0,n.composeEventHandlers)(e.onPointerLeave,eT(e=>{p();let t=o.content?.getBoundingClientRect();if(t){let n=o.content?.dataset.side,r="right"===n,i=t[r?"left":"right"],s=t[r?"right":"left"];l.onPointerGraceIntentChange({area:[{x:e.clientX+(r?-5:5),y:e.clientY},{x:i,y:t.top},{x:s,y:t.top},{x:s,y:t.bottom},{x:i,y:t.bottom}],side:n}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(e),e.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:(0,n.composeEventHandlers)(e.onKeyDown,t=>{let n=""!==l.searchRef.current;e.disabled||n&&" "===t.key||E[s.dir].includes(t.key)&&(o.onOpenChange(!0),o.content?.focus(),t.preventDefault())})})})});eS.displayName=ek;var eC="MenuSubContent",eE=t.forwardRef((e,i)=>{let o=V(W,e.__scopeMenu),{forceMount:s=o.forceMount,...a}=e,l=L(W,e.__scopeMenu),c=_(W,e.__scopeMenu),d=ew(eC,e.__scopeMenu),u=t.useRef(null),h=(0,r.useComposedRefs)(i,u);return(0,x.jsx)(A.Provider,{scope:e.__scopeMenu,children:(0,x.jsx)(m.Presence,{present:s||l.open,children:(0,x.jsx)(A.Slot,{scope:e.__scopeMenu,children:(0,x.jsx)(Y,{id:d.contentId,"aria-labelledby":d.triggerId,...a,ref:h,align:"start",side:"rtl"===c.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{c.isUsingKeyboardRef.current&&u.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:(0,n.composeEventHandlers)(e.onFocusOutside,e=>{e.target!==d.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:(0,n.composeEventHandlers)(e.onEscapeKeyDown,e=>{c.onClose(),e.preventDefault()}),onKeyDown:(0,n.composeEventHandlers)(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=M[c.dir].includes(e.key);t&&n&&(l.onOpenChange(!1),d.trigger?.focus(),e.preventDefault())})})})})})});function eM(e){return e?"open":"closed"}function eN(e){return"indeterminate"===e}function eA(e){return eN(e)?"indeterminate":e?"checked":"unchecked"}function eT(e){return t=>"mouse"===t.pointerType?e(t):void 0}eE.displayName=eC,e.s(["Anchor",0,H,"Arrow",0,ey,"CheckboxItem",0,eo,"Content",0,J,"Group",0,Q,"Item",0,er,"ItemIndicator",0,em,"Label",0,ee,"Portal",0,U,"RadioGroup",0,ec,"RadioItem",0,eu,"Root",0,$,"Separator",0,eg,"Sub",0,ex,"SubContent",0,eE,"SubTrigger",0,eS,"createMenuScope",0,D],918552);var eR="DropdownMenu",[eO,eD]=(0,i.createContextScope)(eR,[D]),ej=D(),[eI,eP]=eO(eR),eL=e=>{let{__scopeDropdownMenu:n,children:r,dir:i,open:s,defaultOpen:a,onOpenChange:l,modal:c=!0}=e,d=ej(n),u=t.useRef(null),[p,f]=(0,o.useControllableState)({prop:s,defaultProp:a??!1,onChange:l,caller:eR});return(0,x.jsx)(eI,{scope:n,triggerId:(0,h.useId)(),triggerRef:u,contentId:(0,h.useId)(),open:p,onOpenChange:f,onOpenToggle:t.useCallback(()=>f(e=>!e),[f]),modal:c,children:(0,x.jsx)($,{...d,open:p,onOpenChange:f,dir:i,modal:c,children:r})})};eL.displayName=eR;var ez="DropdownMenuTrigger",e_=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:i,disabled:o=!1,...a}=e,l=eP(ez,i),c=ej(i);return(0,x.jsx)(H,{asChild:!0,...c,children:(0,x.jsx)(s.Primitive.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...a,ref:(0,r.composeRefs)(t,l.triggerRef),onPointerDown:(0,n.composeEventHandlers)(e.onPointerDown,e=>{!o&&0===e.button&&!1===e.ctrlKey&&(l.onOpenToggle(),l.open||e.preventDefault())}),onKeyDown:(0,n.composeEventHandlers)(e.onKeyDown,e=>{!o&&(["Enter"," "].includes(e.key)&&l.onOpenToggle(),"ArrowDown"===e.key&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});e_.displayName=ez;var e$=e=>{let{__scopeDropdownMenu:t,...n}=e,r=ej(t);return(0,x.jsx)(U,{...r,...n})};e$.displayName="DropdownMenuPortal";var eH="DropdownMenuContent",eB=t.forwardRef((e,r)=>{let{__scopeDropdownMenu:i,...o}=e,s=eP(eH,i),a=ej(i),l=t.useRef(!1);return(0,x.jsx)(J,{id:s.contentId,"aria-labelledby":s.triggerId,...a,...o,ref:r,onCloseAutoFocus:(0,n.composeEventHandlers)(e.onCloseAutoFocus,e=>{l.current||s.triggerRef.current?.focus(),l.current=!1,e.preventDefault()}),onInteractOutside:(0,n.composeEventHandlers)(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey,r=2===t.button||n;(!s.modal||r)&&(l.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});eB.displayName=eH;var eF=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(Q,{...i,...r,ref:t})});eF.displayName="DropdownMenuGroup";var eV=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(ee,{...i,...r,ref:t})});eV.displayName="DropdownMenuLabel";var eU=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(er,{...i,...r,ref:t})});eU.displayName="DropdownMenuItem";var eW=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(eo,{...i,...r,ref:t})});eW.displayName="DropdownMenuCheckboxItem";var eK=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(ec,{...i,...r,ref:t})});eK.displayName="DropdownMenuRadioGroup";var eq=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(eu,{...i,...r,ref:t})});eq.displayName="DropdownMenuRadioItem";var eJ=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(em,{...i,...r,ref:t})});eJ.displayName="DropdownMenuItemIndicator";var eG=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(eg,{...i,...r,ref:t})});eG.displayName="DropdownMenuSeparator",t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(ey,{...i,...r,ref:t})}).displayName="DropdownMenuArrow";var eX=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(eS,{...i,...r,ref:t})});eX.displayName="DropdownMenuSubTrigger";var eZ=t.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=ej(n);return(0,x.jsx)(eE,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});eZ.displayName="DropdownMenuSubContent",e.s(["CheckboxItem",0,eW,"Content",0,eB,"Group",0,eF,"Item",0,eU,"ItemIndicator",0,eJ,"Label",0,eV,"Portal",0,e$,"RadioGroup",0,eK,"RadioItem",0,eq,"Root",0,eL,"Separator",0,eG,"Sub",0,e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:s}=e,a=ej(t),[l,c]=(0,o.useControllableState)({prop:r,defaultProp:s??!1,onChange:i,caller:"DropdownMenuSub"});return(0,x.jsx)(ex,{...a,open:l,onOpenChange:c,children:n})},"SubContent",0,eZ,"SubTrigger",0,eX,"Trigger",0,e_],996702)},755146,149427,e=>{"use strict";var t=e.i(44501),n=e.i(996702),r=e.i(43240),i=e.i(10137);let o=(0,e.i(605993).default)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);e.s(["Circle",0,o],149427);var s=e.i(101685),a=e.i(975157);let l=n.Root,c=n.Trigger;n.Group,n.Portal,n.Sub,n.RadioGroup,s.forwardRef(({className:e,inset:r,children:o,...s},l)=>(0,t.jsxs)(n.SubTrigger,{ref:l,className:(0,a.cn)("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",r&&"pl-8",e),...s,children:[o,(0,t.jsx)(i.ChevronRight,{className:"ml-auto h-4 w-4"})]})).displayName=n.SubTrigger.displayName,s.forwardRef(({className:e,...r},i)=>(0,t.jsx)(n.SubContent,{ref:i,className:(0,a.cn)("z-50 min-w-[8rem] overflow-hidden rounded-sm border bg-popover p-1 text-popover-foreground shadow-golden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})).displayName=n.SubContent.displayName;let d=s.forwardRef(({className:e,sideOffset:r=4,...i},o)=>(0,t.jsx)(n.Portal,{children:(0,t.jsx)(n.Content,{ref:o,sideOffset:r,className:(0,a.cn)("z-50 min-w-[8rem] overflow-hidden rounded-sm border bg-popover p-1 text-popover-foreground shadow-golden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...i})}));d.displayName=n.Content.displayName;let u=s.forwardRef(({className:e,inset:r,...i},o)=>(0,t.jsx)(n.Item,{ref:o,className:(0,a.cn)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r&&"pl-8",e),...i}));u.displayName=n.Item.displayName,s.forwardRef(({className:e,children:i,checked:o,...s},l)=>(0,t.jsxs)(n.CheckboxItem,{ref:l,className:(0,a.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:o,...s,children:[(0,t.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,t.jsx)(n.ItemIndicator,{children:(0,t.jsx)(r.Check,{className:"h-4 w-4"})})}),i]})).displayName=n.CheckboxItem.displayName,s.forwardRef(({className:e,children:r,...i},s)=>(0,t.jsxs)(n.RadioItem,{ref:s,className:(0,a.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...i,children:[(0,t.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,t.jsx)(n.ItemIndicator,{children:(0,t.jsx)(o,{className:"h-2 w-2 fill-current"})})}),r]})).displayName=n.RadioItem.displayName;let h=s.forwardRef(({className:e,inset:r,...i},o)=>(0,t.jsx)(n.Label,{ref:o,className:(0,a.cn)("px-2 py-1.5 text-sm font-normal",r&&"pl-8",e),...i}));h.displayName=n.Label.displayName;let p=s.forwardRef(({className:e,...r},i)=>(0,t.jsx)(n.Separator,{ref:i,className:(0,a.cn)("-mx-1 my-1 h-px bg-muted",e),...r}));p.displayName=n.Separator.displayName,e.s(["DropdownMenu",0,l,"DropdownMenuContent",0,d,"DropdownMenuItem",0,u,"DropdownMenuLabel",0,h,"DropdownMenuSeparator",0,p,"DropdownMenuTrigger",0,c],755146)},894013,409082,847463,e=>{"use strict";var t=e.i(44501),n=e.i(605993);let r=(0,n.default)("moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);e.s(["Moon",0,r],409082);let i=(0,n.default)("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);e.s(["Sun",0,i],847463);var o=e.i(917356),s=e.i(519455);e.s(["ThemeToggle",0,function({className:e}){let{resolvedTheme:n,setTheme:a}=(0,o.useTheme)();return(0,t.jsx)(s.Button,{size:"sm",variant:"ghost",className:`h-7 w-7 p-0 ${e??""}`,title:"dark"===n?"Switch to light":"Switch to dark",onClick:()=>a("dark"===n?"light":"dark"),children:"dark"===n?(0,t.jsx)(i,{className:"h-3.5 w-3.5"}):(0,t.jsx)(r,{className:"h-3.5 w-3.5"})})}],894013)},567776,e=>{"use strict";let t=(0,e.i(605993).default)("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);e.s(["Lock",0,t],567776)},515288,e=>{"use strict";var t=e.i(44501),n=e.i(101685),r=e.i(975157);let i=n.forwardRef(({className:e,...n},i)=>(0,t.jsx)("div",{ref:i,className:(0,r.cn)("rounded-md border border-border bg-card text-card-foreground shadow-e-2",e),...n}));i.displayName="Card",n.forwardRef(({className:e,...n},i)=>(0,t.jsx)("div",{ref:i,className:(0,r.cn)("flex flex-col space-y-1.5 p-6",e),...n})).displayName="CardHeader",n.forwardRef(({className:e,...n},i)=>(0,t.jsx)("div",{ref:i,className:(0,r.cn)("text-lg font-normal leading-none tracking-tight",e),...n})).displayName="CardTitle",n.forwardRef(({className:e,...n},i)=>(0,t.jsx)("div",{ref:i,className:(0,r.cn)("text-sm text-muted-foreground",e),...n})).displayName="CardDescription",n.forwardRef(({className:e,...n},i)=>(0,t.jsx)("div",{ref:i,className:(0,r.cn)("p-6 pt-0",e),...n})).displayName="CardContent",e.s(["Card",0,i])},780569,e=>{"use strict";var t=e.i(44501),n=e.i(43240),r=e.i(792934),i=e.i(519455),o=e.i(755146),s=e.i(395624);e.s(["ViewWidthToggle",0,function({className:e}){let a=(0,s.useViewWidthStore)(e=>e.width),l=(0,s.useViewWidthStore)(e=>e.setWidth),c=(0,s.useViewWidthStore)(e=>e.align),d=(0,s.useViewWidthStore)(e=>e.setAlign);return(0,t.jsxs)(o.DropdownMenu,{children:[(0,t.jsx)(o.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsx)(i.Button,{size:"sm",variant:"ghost",className:`h-7 w-7 p-0 ${e??""}`,title:`Content width: ${s.VIEW_WIDTH_LABEL[a]}`,children:(0,t.jsx)(r.AlignJustify,{className:"h-3.5 w-3.5"})})}),(0,t.jsxs)(o.DropdownMenuContent,{align:"end",className:"w-36",children:[(0,t.jsx)(o.DropdownMenuLabel,{className:"text-[11px] text-muted-foreground",children:"Width"}),s.VIEW_WIDTH_ORDER.map(e=>(0,t.jsxs)(o.DropdownMenuItem,{onClick:()=>l(e),className:"flex items-center justify-between text-xs",children:[s.VIEW_WIDTH_LABEL[e],e===a&&(0,t.jsx)(n.Check,{className:"h-3.5 w-3.5"})]},e)),(0,t.jsx)(o.DropdownMenuSeparator,{}),(0,t.jsx)(o.DropdownMenuLabel,{className:"text-[11px] text-muted-foreground",children:"Alignment"}),s.VIEW_ALIGN_ORDER.map(e=>(0,t.jsxs)(o.DropdownMenuItem,{onClick:()=>d(e),className:"flex items-center justify-between text-xs",children:[s.VIEW_ALIGN_LABEL[e],e===c&&(0,t.jsx)(n.Check,{className:"h-3.5 w-3.5"})]},e))]})]})}])}]);