ocean-brain 0.7.5 → 0.8.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.
- package/dist/index.js +3 -3
- package/dist/mcp.js +180 -736
- package/package.json +6 -2
- package/server/client/dist/assets/ArrowRight.es-CbA8ey6a.js +1 -0
- package/server/client/dist/assets/{Calendar-Bc2zJueR.js → Calendar-CgWgr1BV.js} +2 -2
- package/server/client/dist/assets/Callout-DKruIT0f.js +1 -0
- package/server/client/dist/assets/Copy.es-DFbgpaNJ.js +1 -0
- package/server/client/dist/assets/Graph-kCltGRlY.js +1 -0
- package/server/client/dist/assets/{Image-DxWhlIDG.js → Image-7W0DZwMo.js} +1 -1
- package/server/client/dist/assets/Image.es-5pXLx9TU.js +1 -0
- package/server/client/dist/assets/Note-BW6Np_5g.js +20 -0
- package/server/client/dist/assets/Plus.es-B0sg64VJ.js +1 -0
- package/server/client/dist/assets/Reminders-C10fHQcl.js +1 -0
- package/server/client/dist/assets/Search-tf2nV4v0.js +1 -0
- package/server/client/dist/assets/{SurfaceCard-CkAVMLPs.js → SurfaceCard-pydtvHfu.js} +1 -1
- package/server/client/dist/assets/Tag-uCoYbISy.js +1 -0
- package/server/client/dist/assets/TagNotes-CqOcQiRw.js +1 -0
- package/server/client/dist/assets/Trash.es-w32Goxfa.js +1 -0
- package/server/client/dist/assets/ViewNotes-slPXXoOY.js +1 -0
- package/server/client/dist/assets/ViewSectionDialog-brTrsF6G.js +102 -0
- package/server/client/dist/assets/Views-B_wsb-XJ.js +1 -0
- package/server/client/dist/assets/{graph-vendor-CUxe67Lr.js → graph-vendor-BAF95C0g.js} +2 -2
- package/server/client/dist/assets/image.api-CYsjXiMr.js +17 -0
- package/server/client/dist/assets/index-BR05aSXr.js +342 -0
- package/server/client/dist/assets/{index-D3BfroIT.js → index-D83QbOcw.js} +1 -1
- package/server/client/dist/assets/{index-C5BGzDgt.css → index-DPI6YoDt.css} +1 -1
- package/server/client/dist/assets/manage-image-BYIhWu56.js +1 -0
- package/server/client/dist/assets/{manage-image-detail-C8Q7K7I3.js → manage-image-detail-6KgmQvbN.js} +1 -1
- package/server/client/dist/assets/mcp-Dd98N9Hq.js +4 -0
- package/server/client/dist/assets/mcp-admin-adapter-DOgBsYpl.js +1 -0
- package/server/client/dist/assets/note-core-CMGUaW1v.js +176 -0
- package/server/client/dist/assets/note-vendor-Hoz9Q4-4.js +54 -0
- package/server/client/dist/assets/{placeholder-Cr_nI8UI.js → placeholder-siHGg9aK.js} +4 -4
- package/server/client/dist/assets/{properties-CvYWJWUM.js → properties-CyVRKgcT.js} +1 -1
- package/server/client/dist/assets/tag.api-CwmC8crB.js +21 -0
- package/server/client/dist/assets/trash-wojQBK9Z.js +1 -0
- package/server/client/dist/assets/{useReminderMutate-CDmIEwsw.js → useReminderMutate-DuVKxpBh.js} +1 -1
- package/server/client/dist/index.html +5 -5
- package/server/dist/app.js +0 -1
- package/server/dist/features/auth/http/api.js +0 -1
- package/server/dist/features/auth/http/login-page.js +272 -5
- package/server/dist/features/auth/http/pages.js +20 -3
- package/server/dist/features/auth/service.js +3 -2
- package/server/dist/features/cache/graphql/cache.field.resolver.js +0 -1
- package/server/dist/features/cache/graphql/cache.mutation.resolver.js +0 -1
- package/server/dist/features/cache/graphql/cache.query.resolver.js +0 -1
- package/server/dist/features/cache/graphql/cache.resolver.js +0 -1
- package/server/dist/features/cache/graphql/cache.type-defs.js +0 -1
- package/server/dist/features/cache/graphql/index.js +0 -1
- package/server/dist/features/image/graphql/image.field.resolver.js +0 -1
- package/server/dist/features/image/graphql/image.mutation.resolver.js +0 -1
- package/server/dist/features/image/graphql/image.query.resolver.js +0 -1
- package/server/dist/features/image/graphql/image.resolver.js +0 -1
- package/server/dist/features/image/graphql/image.type-defs.js +0 -1
- package/server/dist/features/image/graphql/index.js +0 -1
- package/server/dist/features/image/http/upload.js +34 -24
- package/server/dist/features/image/services/delete.js +0 -1
- package/server/dist/features/image/services/upload.js +0 -1
- package/server/dist/features/image/services/validation.js +110 -0
- package/server/dist/features/mcp-admin/http/handlers.js +11 -4
- package/server/dist/features/mcp-admin/service.js +0 -1
- package/server/dist/features/note/graphql/index.js +0 -1
- package/server/dist/features/note/graphql/note.field.resolver.js +0 -1
- package/server/dist/features/note/graphql/note.mutation.resolver.js +0 -1
- package/server/dist/features/note/graphql/note.query.resolver.js +0 -1
- package/server/dist/features/note/graphql/note.resolver.js +0 -1
- package/server/dist/features/note/graphql/note.type-defs.js +0 -1
- package/server/dist/features/note/http/mcp.js +8 -44
- package/server/dist/features/note/services/authoring.js +0 -1
- package/server/dist/features/note/services/cleanup.js +2 -3
- package/server/dist/features/note/services/content-blocks.js +0 -1
- package/server/dist/features/note/services/markdown-intent-write.js +11 -44
- package/server/dist/features/note/services/markdown-patch.js +4 -124
- package/server/dist/features/note/services/properties.js +0 -1
- package/server/dist/features/note/services/search-backfill.js +0 -1
- package/server/dist/features/note/services/search.js +0 -1
- package/server/dist/features/note/services/snapshot.js +0 -1
- package/server/dist/features/note/services/tag-filter.js +0 -1
- package/server/dist/features/note/services/trash.js +0 -1
- package/server/dist/features/note/services/write-conflict.js +0 -1
- package/server/dist/features/note/services/write.js +13 -14
- package/server/dist/features/placeholder/graphql/index.js +0 -1
- package/server/dist/features/placeholder/graphql/placeholder.field.resolver.js +0 -1
- package/server/dist/features/placeholder/graphql/placeholder.mutation.resolver.js +0 -1
- package/server/dist/features/placeholder/graphql/placeholder.query.resolver.js +0 -1
- package/server/dist/features/placeholder/graphql/placeholder.resolver.js +0 -1
- package/server/dist/features/placeholder/graphql/placeholder.type-defs.js +0 -1
- package/server/dist/features/reminder/graphql/index.js +0 -1
- package/server/dist/features/reminder/graphql/reminder.field.resolver.js +0 -1
- package/server/dist/features/reminder/graphql/reminder.mutation.resolver.js +0 -1
- package/server/dist/features/reminder/graphql/reminder.query.resolver.js +0 -1
- package/server/dist/features/reminder/graphql/reminder.resolver.js +0 -1
- package/server/dist/features/reminder/graphql/reminder.type-defs.js +0 -1
- package/server/dist/features/tag/graphql/index.js +0 -1
- package/server/dist/features/tag/graphql/tag.field.resolver.js +0 -1
- package/server/dist/features/tag/graphql/tag.mutation.resolver.js +0 -1
- package/server/dist/features/tag/graphql/tag.query.resolver.js +16 -2
- package/server/dist/features/tag/graphql/tag.resolver.js +0 -1
- package/server/dist/features/tag/graphql/tag.type-defs.js +2 -1
- package/server/dist/features/tag/http/mcp.js +0 -1
- package/server/dist/features/tag/services/organization.js +0 -1
- package/server/dist/features/view/graphql/index.js +0 -1
- package/server/dist/features/view/graphql/view.mutation.resolver.js +0 -1
- package/server/dist/features/view/graphql/view.query.resolver.js +0 -1
- package/server/dist/features/view/graphql/view.resolver.js +0 -1
- package/server/dist/features/view/graphql/view.type-defs.js +0 -1
- package/server/dist/features/view/services/workspace.js +0 -1
- package/server/dist/main.js +0 -1
- package/server/dist/models.js +0 -1
- package/server/dist/modules/app-version.js +104 -0
- package/server/dist/modules/auth-guard.js +0 -1
- package/server/dist/modules/auth-mode.js +0 -1
- package/server/dist/modules/auth-redirect.js +0 -1
- package/server/dist/modules/blocknote-markdown-editor.js +53 -0
- package/server/dist/modules/blocknote-tree.js +0 -1
- package/server/dist/modules/blocknote.js +10 -4
- package/server/dist/modules/data-maintenance.js +0 -1
- package/server/dist/modules/error-handler.js +0 -1
- package/server/dist/modules/graphql.js +0 -1
- package/server/dist/modules/logger.js +0 -1
- package/server/dist/modules/mcp-auth.js +62 -2
- package/server/dist/modules/mcp-token.js +0 -1
- package/server/dist/modules/prisma-runtime.js +0 -1
- package/server/dist/modules/rate-limit.js +0 -1
- package/server/dist/modules/recovery-retention.js +0 -1
- package/server/dist/modules/server-events-handler.js +0 -1
- package/server/dist/modules/server-events.js +0 -1
- package/server/dist/modules/session-store.js +0 -1
- package/server/dist/modules/use-async.js +0 -1
- package/server/dist/paths.js +1 -1
- package/server/dist/routes/api.js +2 -9
- package/server/dist/routes/auth-pages.js +0 -1
- package/server/dist/routes/client.js +51 -2
- package/server/dist/routes/graphql.js +0 -1
- package/server/dist/routes/index.js +0 -1
- package/server/dist/routes/mcp.js +0 -1
- package/server/dist/schema/index.js +0 -1
- package/server/dist/start.js +0 -1
- package/server/dist/types/index.js +0 -1
- package/server/dist/types/input.js +0 -1
- package/server/client/dist/assets/Callout-B4kA_Cvr.js +0 -1
- package/server/client/dist/assets/Graph-uq5jfJgt.js +0 -1
- package/server/client/dist/assets/Image.es-BpAOJjJT.js +0 -1
- package/server/client/dist/assets/Note-Bo8ZYRP-.js +0 -22
- package/server/client/dist/assets/Plus.es-Dc_js8AC.js +0 -1
- package/server/client/dist/assets/Reminders-lj7Equld.js +0 -1
- package/server/client/dist/assets/Search-1wcRO5--.js +0 -1
- package/server/client/dist/assets/Tag-CeygwFfv.js +0 -1
- package/server/client/dist/assets/TagNotes-B8DqItxw.js +0 -1
- package/server/client/dist/assets/Trash.es-OuQVb_SX.js +0 -1
- package/server/client/dist/assets/ViewNotes-BH7PbdOD.js +0 -1
- package/server/client/dist/assets/ViewSectionTableRenderer-BJwhd5be.js +0 -102
- package/server/client/dist/assets/Views-eYFtsdFj.js +0 -1
- package/server/client/dist/assets/image.api-C0eYGCeH.js +0 -17
- package/server/client/dist/assets/index-jIfkRdY_.js +0 -361
- package/server/client/dist/assets/manage-image-C0YwkLIP.js +0 -1
- package/server/client/dist/assets/mcp-DHHhTLC8.js +0 -1
- package/server/client/dist/assets/note-core-Z6kqulGB.js +0 -180
- package/server/client/dist/assets/note-vendor-i1M2FSI2.js +0 -54
- package/server/client/dist/assets/trash-DA27aW7L.js +0 -1
- package/server/client/dist/fonts/Pretendard-Bold.woff +0 -0
- package/server/client/dist/fonts/Pretendard-Regular.woff +0 -0
- package/server/dist/app.js.map +0 -1
- package/server/dist/features/auth/http/api.js.map +0 -1
- package/server/dist/features/auth/http/login-page.js.map +0 -1
- package/server/dist/features/auth/http/pages.js.map +0 -1
- package/server/dist/features/auth/service.js.map +0 -1
- package/server/dist/features/cache/graphql/cache.field.resolver.js.map +0 -1
- package/server/dist/features/cache/graphql/cache.mutation.resolver.js.map +0 -1
- package/server/dist/features/cache/graphql/cache.query.resolver.js.map +0 -1
- package/server/dist/features/cache/graphql/cache.resolver.js.map +0 -1
- package/server/dist/features/cache/graphql/cache.type-defs.js.map +0 -1
- package/server/dist/features/cache/graphql/index.js.map +0 -1
- package/server/dist/features/image/graphql/image.field.resolver.js.map +0 -1
- package/server/dist/features/image/graphql/image.mutation.resolver.js.map +0 -1
- package/server/dist/features/image/graphql/image.query.resolver.js.map +0 -1
- package/server/dist/features/image/graphql/image.resolver.js.map +0 -1
- package/server/dist/features/image/graphql/image.type-defs.js.map +0 -1
- package/server/dist/features/image/graphql/index.js.map +0 -1
- package/server/dist/features/image/http/upload.js.map +0 -1
- package/server/dist/features/image/services/delete.js.map +0 -1
- package/server/dist/features/image/services/remote-fetch.js +0 -176
- package/server/dist/features/image/services/remote-fetch.js.map +0 -1
- package/server/dist/features/image/services/upload.js.map +0 -1
- package/server/dist/features/mcp-admin/http/handlers.js.map +0 -1
- package/server/dist/features/mcp-admin/service.js.map +0 -1
- package/server/dist/features/note/graphql/index.js.map +0 -1
- package/server/dist/features/note/graphql/note.field.resolver.js.map +0 -1
- package/server/dist/features/note/graphql/note.mutation.resolver.js.map +0 -1
- package/server/dist/features/note/graphql/note.query.resolver.js.map +0 -1
- package/server/dist/features/note/graphql/note.resolver.js.map +0 -1
- package/server/dist/features/note/graphql/note.type-defs.js.map +0 -1
- package/server/dist/features/note/http/mcp.js.map +0 -1
- package/server/dist/features/note/services/authoring.js.map +0 -1
- package/server/dist/features/note/services/cleanup.js.map +0 -1
- package/server/dist/features/note/services/content-blocks.js.map +0 -1
- package/server/dist/features/note/services/markdown-intent-write.js.map +0 -1
- package/server/dist/features/note/services/markdown-patch.js.map +0 -1
- package/server/dist/features/note/services/properties.js.map +0 -1
- package/server/dist/features/note/services/search-backfill.js.map +0 -1
- package/server/dist/features/note/services/search.js.map +0 -1
- package/server/dist/features/note/services/snapshot.js.map +0 -1
- package/server/dist/features/note/services/tag-filter.js.map +0 -1
- package/server/dist/features/note/services/trash.js.map +0 -1
- package/server/dist/features/note/services/write-conflict.js.map +0 -1
- package/server/dist/features/note/services/write.js.map +0 -1
- package/server/dist/features/placeholder/graphql/index.js.map +0 -1
- package/server/dist/features/placeholder/graphql/placeholder.field.resolver.js.map +0 -1
- package/server/dist/features/placeholder/graphql/placeholder.mutation.resolver.js.map +0 -1
- package/server/dist/features/placeholder/graphql/placeholder.query.resolver.js.map +0 -1
- package/server/dist/features/placeholder/graphql/placeholder.resolver.js.map +0 -1
- package/server/dist/features/placeholder/graphql/placeholder.type-defs.js.map +0 -1
- package/server/dist/features/reminder/graphql/index.js.map +0 -1
- package/server/dist/features/reminder/graphql/reminder.field.resolver.js.map +0 -1
- package/server/dist/features/reminder/graphql/reminder.mutation.resolver.js.map +0 -1
- package/server/dist/features/reminder/graphql/reminder.query.resolver.js.map +0 -1
- package/server/dist/features/reminder/graphql/reminder.resolver.js.map +0 -1
- package/server/dist/features/reminder/graphql/reminder.type-defs.js.map +0 -1
- package/server/dist/features/tag/graphql/index.js.map +0 -1
- package/server/dist/features/tag/graphql/tag.field.resolver.js.map +0 -1
- package/server/dist/features/tag/graphql/tag.mutation.resolver.js.map +0 -1
- package/server/dist/features/tag/graphql/tag.query.resolver.js.map +0 -1
- package/server/dist/features/tag/graphql/tag.resolver.js.map +0 -1
- package/server/dist/features/tag/graphql/tag.type-defs.js.map +0 -1
- package/server/dist/features/tag/http/mcp.js.map +0 -1
- package/server/dist/features/tag/services/organization.js.map +0 -1
- package/server/dist/features/view/graphql/index.js.map +0 -1
- package/server/dist/features/view/graphql/view.mutation.resolver.js.map +0 -1
- package/server/dist/features/view/graphql/view.query.resolver.js.map +0 -1
- package/server/dist/features/view/graphql/view.resolver.js.map +0 -1
- package/server/dist/features/view/graphql/view.type-defs.js.map +0 -1
- package/server/dist/features/view/services/workspace.js.map +0 -1
- package/server/dist/main.js.map +0 -1
- package/server/dist/models.js.map +0 -1
- package/server/dist/modules/auth-guard.js.map +0 -1
- package/server/dist/modules/auth-mode.js.map +0 -1
- package/server/dist/modules/auth-redirect.js.map +0 -1
- package/server/dist/modules/blocknote-tree.js.map +0 -1
- package/server/dist/modules/blocknote.js.map +0 -1
- package/server/dist/modules/data-maintenance.js.map +0 -1
- package/server/dist/modules/error-handler.js.map +0 -1
- package/server/dist/modules/graphql.js.map +0 -1
- package/server/dist/modules/logger.js.map +0 -1
- package/server/dist/modules/mcp-auth.js.map +0 -1
- package/server/dist/modules/mcp-token.js.map +0 -1
- package/server/dist/modules/prisma-runtime.js.map +0 -1
- package/server/dist/modules/rate-limit.js.map +0 -1
- package/server/dist/modules/recovery-retention.js.map +0 -1
- package/server/dist/modules/server-events-handler.js.map +0 -1
- package/server/dist/modules/server-events.js.map +0 -1
- package/server/dist/modules/session-store.js.map +0 -1
- package/server/dist/modules/use-async.js.map +0 -1
- package/server/dist/paths.js.map +0 -1
- package/server/dist/routes/api.js.map +0 -1
- package/server/dist/routes/auth-pages.js.map +0 -1
- package/server/dist/routes/client.js.map +0 -1
- package/server/dist/routes/graphql.js.map +0 -1
- package/server/dist/routes/index.js.map +0 -1
- package/server/dist/routes/mcp.js.map +0 -1
- package/server/dist/schema/index.js.map +0 -1
- package/server/dist/start.js.map +0 -1
- package/server/dist/types/index.js.map +0 -1
- package/server/dist/types/input.js.map +0 -1
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import{g as v1}from"./graph-vendor-CUxe67Lr.js";function rt(t){this.content=t}rt.prototype={constructor:rt,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new rt(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new rt(n)},addToStart:function(t,e){return new rt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new rt(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new rt(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=rt.from(t),t.size?new rt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=rt.from(t),t.size?new rt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=rt.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};rt.from=function(t){if(t instanceof rt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new rt(e)};function D1(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)n++;return n}if(i.content.size||s.content.size){let o=D1(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function L1(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){n-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let c=0,u=Math.min(o.text.length,a.text.length);for(;c<u&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(o.content.size||a.content.size){let c=L1(o.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class v{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let o=0,a=0;a<n;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,i+a,s||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new v(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,o=0;o<n;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),i+=a.nodeSize),o=l}return new v(r,i)}cutByIndex(e,n){return e==n?v.empty:e==0&&n==this.content.length?this:new v(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new v(i,s)}addToStart(e){return new v([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new v(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))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 n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return D1(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return L1(this,e,n,r)}findIndex(e){if(e==0)return wa(0,e);if(e==this.size)return wa(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),s=r+i.nodeSize;if(s>=e)return s==e?wa(n+1,s):wa(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return v.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return v.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return v.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new v(n||e,r)}static from(e){if(!e)return v.empty;if(e instanceof v)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new v([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}v.empty=new v([],0);const Ou={index:0,offset:0};function wa(t,e){return Ou.index=t,Ou.offset=e,Ou}function Sl(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Sl(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Sl(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Se=class zd{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Sl(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return zd.none;if(e instanceof zd)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};Se.none=[];class wl extends Error{}class F{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=P1(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new F(r,this.openStart,this.openEnd)}removeBetween(e,n){return new F(R1(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return F.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new F(v.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new F(e,r,i)}}F.empty=new F(v.empty,0,0);function R1(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(i==e||s.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(R1(s.content,e-i-1,n-i-1)))}function P1(t,e,n,r,i,s){let{index:o,offset:a}=t.findIndex(e),l=t.maybeChild(o);if(a==e||l.isText)return s&&r<=0&&i<=0&&!s.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=P1(l.content,e-a-1,n,o==0?r-1:0,o==t.childCount-1?i-1:0,l);return c&&t.replaceChild(o,l.copy(c))}function Xw(t,e,n){if(n.openStart>t.depth)throw new wl("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new wl("Inconsistent open depths");return B1(t,e,n,0)}function B1(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let o=B1(t,e,n,r+1);return s.copy(s.content.replaceChild(i,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,a=o.content;return si(o,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=Zw(n,t);return si(s,H1(t,o,a,e,r))}else return si(s,xl(t,e,r))}function F1(t,e){if(!e.type.compatibleContent(t.type))throw new wl("Cannot join "+e.type.name+" onto "+t.type.name)}function Vd(t,e,n){let r=t.node(n);return F1(r,e.node(n)),r}function ii(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function so(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(ii(t.nodeAfter,r),s++));for(let a=s;a<o;a++)ii(i.child(a),r);e&&e.depth==n&&e.textOffset&&ii(e.nodeBefore,r)}function si(t,e){return t.type.checkContent(e),t.copy(e)}function H1(t,e,n,r,i){let s=t.depth>i&&Vd(t,e,i+1),o=r.depth>i&&Vd(n,r,i+1),a=[];return so(null,t,i,a),s&&o&&e.index(i)==n.index(i)?(F1(s,o),ii(si(s,H1(t,e,n,r,i+1)),a)):(s&&ii(si(s,xl(t,e,i+1)),a),so(e,n,i,a),o&&ii(si(o,xl(n,r,i+1)),a)),so(r,null,i,a),new v(a)}function xl(t,e,n){let r=[];if(so(null,t,n,r),t.depth>n){let i=Vd(t,e,n+1);ii(si(i,xl(t,e,n+1)),r)}return so(e,null,n,r),new v(r)}function Zw(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(v.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class No{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Se.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let a=r;r=i,i=a}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Al(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),c=s-l;if(r.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;s=c-1,i+=l+1}return new No(n,r,s)}static resolveCached(e,n){let r=xm.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==n)return o}else xm.set(e,r=new ex);let i=r.elts[r.i]=No.resolve(e,n);return r.i=(r.i+1)%tx,i}}class ex{constructor(){this.elts=[],this.i=0}}const tx=12,xm=new WeakMap;class Al{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const nx=Object.create(null);class Zt{constructor(e,n,r,i=Se.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||v.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,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Sl(this.attrs,n||e.defaultAttrs||nx)&&Se.sameSet(this.marks,r||Se.none)}copy(e=null){return e==this.content?this:new Zt(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Zt(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return F.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),a=i.start(o),c=i.node(o).content.cut(i.pos-a,s.pos-a);return new F(c,i.depth-o,s.depth-o)}replace(e,n,r){return Xw(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return No.resolveCached(this,e)}resolveNoCache(e){return No.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),U1(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=v.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Se.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Se.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n 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(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=v.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}}Zt.prototype.text=void 0;class _l extends Zt{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):U1(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new _l(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new _l(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function U1(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class fi{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new rx(e,n);if(r.next==null)return fi.empty;let i=$1(r);r.next&&r.err("Unexpected trailing text");let s=ux(cx(i));return dx(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(o,a){let l=o.matchFragment(e,r);if(l&&(!n||l.validEnd))return v.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let h=s(d,a.concat(u));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
|
|
2
|
-
`)}}fi.empty=new fi(!0);class rx{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function $1(t){let e=[];do e.push(ix(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function ix(t){let e=[];do e.push(sx(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function sx(t){let e=lx(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=ox(t,e);else break;return e}function Am(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function ox(t,e){let n=Am(t),r=n;return t.eat(",")&&(t.next!="}"?r=Am(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function ax(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let o=n[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function lx(t){if(t.eat("(")){let e=$1(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=ax(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function cx(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(s(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=s(o.exprs[l],a);if(l==o.exprs.length-1)return c;i(c,a=n())}else if(o.type=="star"){let l=n();return r(a,l),i(s(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=n();return i(s(o.expr,a),l),i(s(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let u=n();i(s(o.expr,l),u),l=u}if(o.max==-1)i(s(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let u=n();r(l,u),i(s(o.expr,l),u),l=u}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function z1(t,e){return e-t}function _m(t,e){let n=[];return r(e),n.sort(z1);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&n.indexOf(l)==-1&&r(l)}}}function ux(t){let e=Object.create(null);return n(_m(t,0));function n(r){let i=[];r.forEach(o=>{t[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<i.length;u++)i[u][0]==a&&(c=i[u][1]);_m(t,l).forEach(u=>{c||i.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new fi(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(z1);s.next.push({type:i[o][0],next:e[a.join(",")]||n(a)})}return s}}function dx(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function V1(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function j1(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function q1(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let s=t[i];s.validate&&s.validate(e[i])}}function W1(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new fx(t,r,e[r]);return n}let Nm=class Y1{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=W1(e,r.attrs),this.defaultAttrs=V1(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==fi.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:j1(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Zt(this,this.computeAttrs(e),v.from(n),Se.setFrom(r))}createChecked(e=null,n,r){return n=v.from(n),this.checkContent(n),new Zt(this,this.computeAttrs(e),n,Se.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=v.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(v.empty,!0);return s?new Zt(this,e,n.append(s),Se.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){q1(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Se.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new Y1(s,n,o));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function hx(t,e,n){let r=n.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class fx{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?hx(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Rc{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=W1(e,i.attrs),this.excluded=null;let s=V1(this.attrs);this.instance=s?new Se(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Se(this,j1(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new Rc(s,i++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){q1(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let K1=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=rt.from(e.nodes),n.marks=rt.from(e.marks||{}),this.nodes=Nm.compile(this.spec.nodes,this),this.marks=Rc.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=fi.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?Im(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:Im(this,o.split(" "))}this.nodeFromJSON=i=>Zt.fromJSON(this,i),this.markFromJSON=i=>Se.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Nm){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new _l(r,r.defaultAttrs,e,Se.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function Im(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let a in t.marks){let l=t.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function px(t){return t.tag!=null}function mx(t){return t.style!=null}let mn=class jd{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(px(i))this.tags.push(i);else if(mx(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new Mm(this,n,!1);return r.addAll(e,Se.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Mm(this,n,!0);return r.addAll(e,Se.none,n.from,n.to),F.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(yx(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(o.getAttrs){let l=o.getAttrs(n);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<n.length;o++){let a=n[o];if((a.priority==null?50:a.priority)<s)break}n.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=vm(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=vm(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new jd(e,jd.schemaRules(e)))}};const G1={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},gx={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Q1={ol:!0,ul:!0},Io=1,qd=2,oo=4;function Om(t,e,n){return e!=null?(e?Io:0)|(e==="full"?qd:0):t&&t.whitespace=="pre"?Io|qd:n&~oo}class xa{constructor(e,n,r,i,s,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=Se.none,this.match=s||(o&oo?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(v.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Io)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let n=v.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(v.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!G1.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Mm{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,o=Om(null,n.preserveWhitespace,0)|(r?oo:0);i?s=new xa(i.type,i.attrs,Se.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new xa(null,null,Se.none,!0,null,o):s=new xa(e.schema.topNodeType,null,Se.none,!0,null,o),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,s=i.options&qd?"full":this.localPreserveWS||(i.options&Io)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
|
|
3
|
-
`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(o.text(a[l]),n,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;Q1.hasOwnProperty(o)&&this.parser.normalizeLists&&bx(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:gx.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(G1.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(s),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
|
-
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(s,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,i){let s,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(o,n.attrs||null,r,n.preserveWhitespace);l&&(s=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}s&&this.sync(a)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,s=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)n=this.enterInner(i[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=Se.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):Dm(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,n,r,i){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,i)),s}enterInner(e,n,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=Om(e,s,o.options);o.options&oo&&o.content.length==0&&(a|=oo);let l=Se.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Dm(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new xa(e,n,l,i,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].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 n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Io)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let u=l>0||l==0&&i?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function bx(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Q1.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function yx(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function vm(t){let e={};for(let n in t)e[n]=t[n];return e}function Dm(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||s.indexOf(u)<0&&o(u))return!0}};if(o(i.contentMatch))return!0}}class zt{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Aa(n).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(s[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],u=this.serializeMark(c,o.isInline,n);u&&(s.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){if(e.isText)return Aa(n).createTextNode(e.text);let{dom:r,contentDOM:i}=rl(Aa(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&rl(Aa(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return typeof n=="string"?{dom:e.createTextNode(n)}:rl(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new zt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Lm(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Lm(e.marks)}}function Lm(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Aa(t){return t.document||window.document}const Rm=new WeakMap;function Ex(t){let e=Rm.get(t);return e===void 0&&Rm.set(t,e=kx(t)),e}function kx(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function rl(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=Ex(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(n=i.slice(0,o),i=i.slice(o+1));let a,l=n?t.createElementNS(n,i):t.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let h=d.indexOf(" ");h>0?l.setAttributeNS(d.slice(0,h),d.slice(h+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let h=e[d];if(h===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else if(typeof h=="string")l.appendChild(t.createTextNode(h));else{let{dom:f,contentDOM:p}=rl(t,h,n,r);if(l.appendChild(f),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const J1=65535,X1=Math.pow(2,16);function Tx(t,e){return t+e*X1}function Pm(t){return t&J1}function Cx(t){return(t-(t&J1))/X1}const Z1=1,ey=2,il=4,ty=8;class Wd{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&ty)>0}get deletedBefore(){return(this.delInfo&(Z1|il))>0}get deletedAfter(){return(this.delInfo&(ey|il))>0}get deletedAcross(){return(this.delInfo&il)>0}}class Ft{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Ft.empty)return Ft.empty}recover(e){let n=0,r=Pm(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+Cx(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+s],u=this.ranges[a+o],d=l+c;if(e<=d){let h=c?e==l?-1:e==d?1:n:n,f=l+i+(h<0?0:u);if(r)return f;let p=e==(n<0?l:d)?null:Tx(a/3,e-l),g=e==l?ey:e==d?Z1:il;return(n<0?e!=l:e!=d)&&(g|=ty),new Wd(f,g,p)}i+=u-c}return r?e+i:new Wd(e+i,0,null)}touches(e,n){let r=0,i=Pm(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+s],u=l+c;if(e<=u&&a==i*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),c=this.ranges[i+n],u=this.ranges[i+r];e(a,a+c,l,l+u),s+=u-c}}invert(){return new Ft(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ft.empty:new Ft(e<0?[0,-e,0]:[0,0,e])}}Ft.empty=new Ft([]);class ds{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new ds(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new ds;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new Wd(e,i,null)}}const Mu=Object.create(null);class pt{getMap(){return Ft.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Mu[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Mu)throw new RangeError("Duplicate use of step JSON ID "+e);return Mu[e]=n,n.prototype.jsonID=e,n}}class ze{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new ze(e,null)}static fail(e){return new ze(null,e)}static fromReplace(e,n,r,i){try{return ze.ok(e.replace(n,r,i))}catch(s){if(s instanceof wl)return ze.fail(s.message);throw s}}}function bf(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(bf(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return v.fromArray(r)}class Sr extends pt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new F(bf(n.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return ze.fromReplace(e,this.from,this.to,s)}invert(){return new fn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Sr(n.pos,r.pos,this.mark)}merge(e){return e instanceof Sr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Sr(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Sr(n.from,n.to,e.markFromJSON(n.mark))}}pt.jsonID("addMark",Sr);class fn extends pt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new F(bf(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return ze.fromReplace(e,this.from,this.to,r)}invert(){return new Sr(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new fn(n.pos,r.pos,this.mark)}merge(e){return e instanceof fn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new fn(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new fn(n.from,n.to,e.markFromJSON(n.mark))}}pt.jsonID("removeMark",fn);class wr extends pt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ze.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return ze.fromReplace(e,this.pos,this.pos+1,new F(v.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new wr(this.pos,n.marks[i]);return new wr(this.pos,this.mark)}}return new pi(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new wr(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new wr(n.pos,e.markFromJSON(n.mark))}}pt.jsonID("addNodeMark",wr);class pi extends pt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ze.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return ze.fromReplace(e,this.pos,this.pos+1,new F(v.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new wr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new pi(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new pi(n.pos,e.markFromJSON(n.mark))}}pt.jsonID("removeNodeMark",pi);class Re extends pt{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Yd(e,this.from,this.to)?ze.fail("Structure replace would overwrite content"):ze.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ft([this.from,this.to-this.from,this.slice.size])}invert(e){return new Re(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&Re.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new Re(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Re)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?F.empty:new F(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Re(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?F.empty:new F(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Re(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Re(n.from,n.to,F.fromJSON(e,n.slice),!!n.structure)}}Re.MAP_BIAS=1;pt.jsonID("replace",Re);class Fe extends pt{constructor(e,n,r,i,s,o,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(Yd(e,this.from,this.gapFrom)||Yd(e,this.gapTo,this.to)))return ze.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return ze.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?ze.fromReplace(e,this.from,this.to,r):ze.fail("Content does not fit in gap")}getMap(){return new Ft([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Fe(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new Fe(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Fe(n.from,n.to,n.gapFrom,n.gapTo,F.fromJSON(e,n.slice),n.insert,!!n.structure)}}pt.jsonID("replaceAround",Fe);function Yd(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function Sx(t,e,n,r){let i=[],s=[],o,a;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let h=Math.max(c,e),f=Math.min(c+l.nodeSize,n),p=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(p)||(o&&o.to==h&&o.mark.eq(d[g])?o.to=f:i.push(o=new fn(h,f,d[g])));a&&a.to==h?a.to=f:s.push(a=new Sr(h,f,r))}}),i.forEach(l=>t.step(l)),s.forEach(l=>t.step(l))}function wx(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(r instanceof Rc){let c=o.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],h;for(let f=0;f<i.length;f++){let p=i[f];p.step==s-1&&d.eq(i[f].style)&&(h=p)}h?(h.to=c,h.step=s):i.push({style:d,from:Math.max(a,e),to:c,step:s})}}}),i.forEach(o=>t.step(new fn(o.from,o.to,o.style)))}function yf(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let c=s.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new Re(a,u,F.empty));else{r=d;for(let h=0;h<c.marks.length;h++)n.allowsMarkType(c.marks[h].type)||t.step(new fn(a,u,c.marks[h]));if(i&&c.isText&&n.whitespace!="pre"){let h,f=/\r?\n|\r/g,p;for(;h=f.exec(c.text);)p||(p=new F(v.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),o.push(new Re(a+h.index,a+h.index+h[0].length,p))}}a=u}if(!r.validEnd){let l=r.fillBefore(v.empty,!0);t.replace(a,a,new F(l,0,0))}for(let l=o.length-1;l>=0;l--)t.step(o[l])}function xx(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Ns(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let o=t.$from.node(r),a=t.$from.index(r)+i,l=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(a,l,n))return r;if(r==0||o.type.spec.isolating||!xx(o,a,l))break;a&&(i=1),l<o.childCount&&(s=1)}return null}function Ax(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),a=i.after(s+1),l=o,c=a,u=v.empty,d=0;for(let p=s,g=!1;p>n;p--)g||r.index(p)>0?(g=!0,u=v.from(r.node(p).copy(u)),d++):l--;let h=v.empty,f=0;for(let p=s,g=!1;p>n;p--)g||i.after(p+1)<i.end(p)?(g=!0,h=v.from(i.node(p).copy(h)),f++):c++;t.step(new Fe(l,c,o,a,new F(u.append(h),d,f),u.size-d,!0))}function ny(t,e,n=null,r=t){let i=_x(t,e),s=i&&Nx(r,e);return s?i.map(Bm).concat({type:e,attrs:n}).concat(s.map(Bm)):null}function Bm(t){return{type:t,attrs:null}}function _x(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function Nx(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;l&&c<i;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:o}function Ix(t,e,n){let r=v.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let a=n[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=v.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new Fe(i,s,i,s,new F(r,0,0),n.length,!0))}function Ox(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,l)&&Mx(t.doc,t.mapping.slice(s).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!p?c=!1:!f&&p&&(c=!0)}c===!1&&iy(t,o,a,s),yf(t,t.mapping.slice(s).map(a,1),r,void 0,c===null);let u=t.mapping.slice(s),d=u.map(a,1),h=u.map(a+o.nodeSize,1);return t.step(new Fe(d,h,d+1,h-1,new F(v.from(r.create(l,null,o.marks)),0,0),1,!0)),c===!0&&ry(t,o,a,s),!1}})}function ry(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function iy(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
|
|
5
|
-
`))}})}function Mx(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function vx(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Fe(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new F(v.from(o),0,0),1,!0))}function rr(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=n-2;c>s;c--,u--){let d=i.node(c),h=i.index(c);if(d.type.spec.isolating)return!1;let f=d.content.cutByIndex(h,d.childCount),p=r&&r[u+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let g=r&&r[u]||d;if(!d.canReplace(h+1,d.childCount)||!g.type.validContent(f))return!1}let a=i.indexAfter(s),l=r&&r[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function Dx(t,e,n=1,r){let i=t.doc.resolve(e),s=v.empty,o=v.empty;for(let a=i.depth,l=i.depth-n,c=n-1;a>l;a--,c--){s=v.from(i.node(a).copy(s));let u=r&&r[c];o=v.from(u?u.type.create(u.attrs,o):i.node(a).copy(o))}t.step(new Re(e,e,new F(s.append(o),n,n),!0))}function Ni(t,e){let n=t.resolve(e),r=n.index();return sy(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Lx(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function sy(t,e){return!!(t&&e&&!t.isLeaf&&Lx(t,e))}function Pc(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,o,a=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):n>0?(s=r.node(i+1),a++,o=r.node(i).maybeChild(a)):(s=r.node(i).maybeChild(a-1),o=r.node(i+1)),s&&!s.isTextblock&&sy(s,o)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function Rx(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(i&&o.inlineContent){let u=o.whitespace=="pre",d=!!o.contentMatch.matchType(i);u&&!d?r=!1:!u&&d&&(r=!0)}let a=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);iy(t,u.node(),u.before(),a)}o.inlineContent&&yf(t,e+n-1,o,s.node().contentMatchAt(s.index()),r==null);let l=t.mapping.slice(a),c=l.map(e-n);if(t.step(new Re(c,l.map(e+n,-1),F.empty,!0)),r===!0){let u=t.doc.resolve(c);ry(t,u.node(),u.before(),t.steps.length)}return t}function Px(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function oy(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),c=r.node(o),u=!1;if(s==1)u=c.canReplace(l,l,i);else{let d=c.contentMatchAt(l).findWrapping(i.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function Bc(t,e,n=e,r=F.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return ay(i,s,r)?new Re(e,n,r):new Bx(i,s,r).fit()}function ay(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Bx{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=v.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=v.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new F(s,o,a);return e>-1?new Fe(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Re(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=vu(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(n==1&&(o?c.matchType(o.type)||(d=c.fillBefore(v.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:d};if(n==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=vu(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new F(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=vu(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new F(Xs(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new F(Xs(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let g=0;g<s.length;g++)this.openFrontierNode(s[g]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,c=0,u=[],{match:d,type:h}=this.frontier[n];if(i){for(let g=0;g<i.childCount;g++)u.push(i.child(g));d=d.matchFragment(i)}let f=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let g=a.child(c),b=d.matchType(g.type);if(!b)break;c++,(c>1||l==0||g.content.size)&&(d=b,u.push(ly(g.mark(h.allowedMarks(g.marks)),c==1?l:0,c==a.childCount?f:-1)))}let p=c==a.childCount;p||(f=-1),this.placed=Zs(this.placed,n,v.from(u)),this.frontier[n].match=d,p&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,b=a;g<f;g++){let y=b.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),b=y.content}this.unplaced=p?e==0?F.empty:new F(Xs(o.content,e-1,1),e-1,f<0?o.openEnd:e-1):new F(Xs(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Du(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=Du(e,n,i,r,s);if(o){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=Du(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Zs(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Zs(this.placed,this.depth,v.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(v.empty,!0);n.childCount&&(this.placed=Zs(this.placed,this.frontier.length,n))}}function Xs(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Xs(t.firstChild.content,e-1,n)))}function Zs(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Zs(t.lastChild.content,e-1,n)))}function vu(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function ly(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,ly(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(v.empty,!0)))),t.copy(r)}function Du(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!Fx(n,s.content,o)?a:null}function Fx(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function Hx(t){return t.spec.defining||t.spec.definingForContent}function Ux(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(ay(i,s,r))return t.step(new Re(e,n,r));let o=uy(i,s);o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let h=i.depth,f=i.pos-1;h>0;h--,f--){let p=i.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(h)>-1?a=h:i.before(h)==f&&o.splice(1,0,-h)}let l=o.indexOf(a),c=[],u=r.openStart;for(let h=r.content,f=0;;f++){let p=h.firstChild;if(c.push(p),f==r.openStart)break;h=p.content}for(let h=u-1;h>=0;h--){let f=c[h],p=Hx(f.type);if(p&&!f.sameMarkup(i.node(Math.abs(a)-1)))u=h;else if(p||!f.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let f=(h+u+1)%(r.openStart+1),p=c[f];if(p)for(let g=0;g<o.length;g++){let b=o[(g+l)%o.length],y=!0;b<0&&(y=!1,b=-b);let C=i.node(b-1),S=i.index(b-1);if(C.canReplaceWith(S,S,p.type,p.marks))return t.replace(i.before(b),y?s.after(b):n,new F(cy(r.content,0,r.openStart,f),f,r.openEnd))}}let d=t.steps.length;for(let h=o.length-1;h>=0&&(t.replace(e,n,r),!(t.steps.length>d));h--){let f=o[h];f<0||(e=i.before(f),n=s.after(f))}}function cy(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(cy(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(v.empty,!0))}return t}function $x(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=Px(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new F(v.from(r),0,0))}function zx(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let o=r.sharedDepth(n),a=!1;for(let l=r.depth;l>o;l--)r.node(l).type.spec.isolating&&(a=!0);for(let l=i.depth;l>o;l--)i.node(l).type.spec.isolating&&(a=!0);if(!a){for(let l=r.depth;l>0&&e==r.start(l);l--)e=r.before(l);for(let l=i.depth;l>0&&n==i.start(l);l--)n=i.before(l);r=t.doc.resolve(e),i=t.doc.resolve(n)}}let s=uy(r,i);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.delete(r.before(a),i.after(a))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-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 t.delete(r.before(o),n);t.delete(e,n)}function uy(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}class Xi extends pt{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return ze.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return ze.fromReplace(e,this.pos,this.pos+1,new F(v.from(i),0,n.isLeaf?0:1))}getMap(){return Ft.empty}invert(e){return new Xi(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Xi(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Xi(n.pos,n.attr,n.value)}}pt.jsonID("attr",Xi);class Oo extends pt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return ze.ok(r)}getMap(){return Ft.empty}invert(e){return new Oo(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Oo(n.attr,n.value)}}pt.jsonID("docAttr",Oo);let hs=class extends Error{};hs=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};hs.prototype=Object.create(Error.prototype);hs.prototype.constructor=hs;hs.prototype.name="TransformError";class Ef{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ds}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new hs(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.forEach((s,o,a,l)=>{e=Math.min(e,a),n=Math.max(n,l)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=F.empty){let i=Bc(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new F(v.from(r),0,0))}delete(e,n){return this.replace(e,n,F.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return Ux(this,e,n,r),this}replaceRangeWith(e,n,r){return $x(this,e,n,r),this}deleteRange(e,n){return zx(this,e,n),this}lift(e,n){return Ax(this,e,n),this}join(e,n=1){return Rx(this,e,n),this}wrap(e,n){return Ix(this,e,n),this}setBlockType(e,n=e,r,i=null){return Ox(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return vx(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new Xi(e,n,r)),this}setDocAttribute(e,n){return this.step(new Oo(e,n)),this}addNodeMark(e,n){return this.step(new wr(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof Se)n.isInSet(r.marks)&&this.step(new pi(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new pi(e,s)),i=s.removeFromSet(i);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,n=1,r){return Dx(this,e,n,r),this}addMark(e,n,r){return Sx(this,e,n,r),this}removeMark(e,n,r){return wx(this,e,n,r),this}clearIncompatible(e,n,r){return yf(this,e,n,r),this}}const Lu=Object.create(null);class Q{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new dy(e.min(n),e.max(n))]}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 n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=F.empty){let r=n.content.lastChild,i=null;for(let a=0;a<n.openEnd;a++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],u=e.mapping.slice(s);e.replaceRange(u.map(l.pos),u.map(c.pos),a?F.empty:n),a==0&&Um(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],l=e.mapping.slice(r),c=l.map(o.pos),u=l.map(a.pos);s?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),Um(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new j(e):ji(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=n<0?ji(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):ji(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Ot(e.node(0))}static atStart(e){return ji(e,e,0,0,1)||new Ot(e)}static atEnd(e){return ji(e,e,e.content.size,e.childCount,-1)||new Ot(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Lu[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Lu)throw new RangeError("Duplicate use of selection JSON ID "+e);return Lu[e]=n,n.prototype.jsonID=e,n}getBookmark(){return j.between(this.$anchor,this.$head).getBookmark()}}Q.prototype.visible=!0;class dy{constructor(e,n){this.$from=e,this.$to=n}}let Fm=!1;function Hm(t){!Fm&&!t.parent.inlineContent&&(Fm=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class j extends Q{constructor(e,n=e){Hm(e),Hm(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Q.near(r);let i=e.resolve(n.map(this.anchor));return new j(i.parent.inlineContent?i:r,r)}replace(e,n=F.empty){if(super.replace(e,n),n==F.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof j&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Fc(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new j(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=Q.findFrom(n,r,!0)||Q.findFrom(n,-r,!0);if(s)n=s.$head;else return Q.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(Q.findFrom(e,-r,!0)||Q.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new j(e,n)}}Q.jsonID("text",j);class Fc{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Fc(e.map(this.anchor),e.map(this.head))}resolve(e){return j.between(e.resolve(this.anchor),e.resolve(this.head))}}class W extends Q{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?Q.near(s):new W(s)}content(){return new F(v.from(this.node),0,0)}eq(e){return e instanceof W&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new kf(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new W(e.resolve(n.anchor))}static create(e,n){return new W(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}W.prototype.visible=!1;Q.jsonID("node",W);class kf{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Fc(r,r):new kf(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&W.isSelectable(r)?new W(n):Q.near(n)}}class Ot extends Q{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=F.empty){if(n==F.empty){e.delete(0,e.doc.content.size);let r=Q.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ot(e)}map(e){return new Ot(e)}eq(e){return e instanceof Ot}getBookmark(){return Vx}}Q.jsonID("all",Ot);const Vx={map(){return this},resolve(t){return new Ot(t)}};function ji(t,e,n,r,i,s=!1){if(e.inlineContent)return j.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&W.isSelectable(a))return W.create(t,n-(i<0?a.nodeSize:0))}else{let l=ji(t,a,n+i,i<0?a.childCount:0,i,s);if(l)return l}n+=a.nodeSize*i}return null}function Um(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof Re||i instanceof Fe))return;let s=t.mapping.maps[r],o;s.forEach((a,l,c,u)=>{o==null&&(o=u)}),t.setSelection(Q.near(t.doc.resolve(o),n))}const $m=1,_a=2,zm=4;let jx=class extends Ef{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|$m)&~_a,this.storedMarks=null,this}get selectionSet(){return(this.updated&$m)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=_a,this}ensureMarks(e){return Se.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&_a)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~_a,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Se.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Q.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=zm,this}get scrolledIntoView(){return(this.updated&zm)>0}};function Vm(t,e){return!e||!t?t:t.bind(e)}class eo{constructor(e,n,r){this.name=e,this.init=Vm(n.init,r),this.apply=Vm(n.apply,r)}}const qx=[new eo("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new eo("selection",{init(t,e){return t.selection||Q.atStart(e.doc)},apply(t){return t.selection}}),new eo("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new eo("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Ru{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=qx.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new eo(r.key,r.spec.state,r))})}}class Gi{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,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=i?i[o].n:0,c=i?i[o].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<o?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),s=!0}i&&(i[o]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Gi(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new jx(this)}static create(e){let n=new Ru(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Gi(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new Ru(this.schema,e.plugins),r=n.fields,i=new Gi(n);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Ru(e.schema,e.plugins),s=new Gi(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Zt.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=Q.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){s[o.name]=c.fromJSON.call(l,e,n[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function hy(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=hy(i,e,{})),n[r]=i}return n}class re{constructor(e){this.spec=e,this.props={},e.props&&hy(e.props,this,this.props),this.key=e.key?e.key.key:fy("plugin")}getState(e){return e[this.key]}}const Pu=Object.create(null);function fy(t){return t in Pu?t+"$"+ ++Pu[t]:(Pu[t]=0,t+"$")}class me{constructor(e="key"){this.key=fy(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Tf=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function py(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const my=(t,e,n)=>{let r=py(t,n);if(!r)return!1;let i=Cf(r);if(!i){let o=r.blockRange(),a=o&&Ns(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(wy(t,i,e,-1))return!0;if(r.parent.content.size==0&&(fs(s,"end")||W.isSelectable(s)))for(let o=r.depth;;o--){let a=Bc(t.doc,r.before(o),r.after(o),F.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(fs(s,"end")?Q.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):W.create(l.doc,i.pos-s.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},Wx=(t,e,n)=>{let r=py(t,n);if(!r)return!1;let i=Cf(r);return i?gy(t,i,e):!1},Yx=(t,e,n)=>{let r=yy(t,n);if(!r)return!1;let i=Sf(r);return i?gy(t,i,e):!1};function gy(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=Bc(t.doc,s,l,F.empty);if(!c||c.from!=s||c instanceof Re&&c.slice.size>=l-s)return!1;if(n){let u=t.tr.step(c);u.setSelection(j.create(u.doc,s)),n(u.scrollIntoView())}return!0}function fs(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const by=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=Cf(r)}let o=s&&s.nodeBefore;return!o||!W.isSelectable(o)?!1:(e&&e(t.tr.setSelection(W.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Cf(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function yy(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Ey=(t,e,n)=>{let r=yy(t,n);if(!r)return!1;let i=Sf(r);if(!i)return!1;let s=i.nodeAfter;if(wy(t,i,e,1))return!0;if(r.parent.content.size==0&&(fs(s,"start")||W.isSelectable(s))){let o=Bc(t.doc,r.before(),r.after(),F.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(fs(s,"start")?Q.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):W.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},ky=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=Sf(r)}let o=s&&s.nodeAfter;return!o||!W.isSelectable(o)?!1:(e&&e(t.tr.setSelection(W.create(t.doc,s.pos)).scrollIntoView()),!0)};function Sf(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const Kx=(t,e)=>{let n=t.selection,r=n instanceof W,i;if(r){if(n.node.isTextblock||!Ni(t.doc,n.from))return!1;i=n.from}else if(i=Pc(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(W.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},Gx=(t,e)=>{let n=t.selection,r;if(n instanceof W){if(n.node.isTextblock||!Ni(t.doc,n.to))return!1;r=n.to}else if(r=Pc(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},Qx=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&Ns(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},Ty=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
6
|
-
`).scrollIntoView()),!0)};function wf(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Jx=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=wf(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,o.createAndFill());l.setSelection(Q.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Cy=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Ot||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=wf(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=t.tr.insert(o,s.createAndFill());a.setSelection(j.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},Sy=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(rr(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Ns(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function Xx(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof W&&e.selection.node.isBlock)return!r.parentOffset||!rr(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,a,l=!1,c=!1;for(let f=r.depth;;f--)if(r.node(f).isBlock){l=r.end(f)==r.pos+(r.depth-f),c=r.start(f)==r.pos-(r.depth-f),a=wf(r.node(f-1).contentMatchAt(r.indexAfter(f-1))),s.unshift(l&&a?{type:a}:null),o=f;break}else{if(f==1)return!1;s.unshift(null)}let u=e.tr;(e.selection instanceof j||e.selection instanceof Ot)&&u.deleteSelection();let d=u.mapping.map(r.pos),h=rr(u.doc,d,s.length,s);if(h||(s[0]=a?{type:a}:null,h=rr(u.doc,d,s.length,s)),!h)return!1;if(u.split(d,s.length,s),!l&&c&&r.node(o).type!=a){let f=u.mapping.map(r.before(o)),p=u.doc.resolve(f);a&&r.node(o-1).canReplaceWith(p.index(),p.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(o)),a)}return n&&n(u.scrollIntoView()),!0}}const Zx=Xx(),eA=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(W.create(t.doc,i))),!0)};function tA(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Ni(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function wy(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,o,a,l=i.type.spec.isolating||s.type.spec.isolating;if(!l&&tA(t,e,n))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(n){let f=e.pos+s.nodeSize,p=v.empty;for(let y=o.length-1;y>=0;y--)p=v.from(o[y].create(null,p));p=v.from(i.copy(p));let g=t.tr.step(new Fe(e.pos-1,f,e.pos,f,new F(p,1,0),o.length,!0)),b=g.doc.resolve(f+2*o.length);b.nodeAfter&&b.nodeAfter.type==i.type&&Ni(g.doc,b.pos)&&g.join(b.pos),n(g.scrollIntoView())}return!0}let u=s.type.spec.isolating||r>0&&l?null:Q.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),h=d&&Ns(d);if(h!=null&&h>=e.depth)return n&&n(t.tr.lift(d,h).scrollIntoView()),!0;if(c&&fs(s,"start",!0)&&fs(i,"end")){let f=i,p=[];for(;p.push(f),!f.isTextblock;)f=f.lastChild;let g=s,b=1;for(;!g.isTextblock;g=g.firstChild)b++;if(f.canReplace(f.childCount,f.childCount,g.content)){if(n){let y=v.empty;for(let S=p.length-1;S>=0;S--)y=v.from(p[S].copy(y));let C=t.tr.step(new Fe(e.pos-p.length,e.pos+s.nodeSize,e.pos+b,e.pos+s.nodeSize-b,new F(y,p.length,0),0,!0));n(C.scrollIntoView())}return!0}}return!1}function xy(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(j.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const nA=xy(-1),rA=xy(1);function iA(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),a=o&&ny(o,t,e);return a?(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0):!1}}function jm(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=n.selection.ranges[s];n.doc.nodesBetween(o,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)i=!0;else{let u=n.doc.resolve(c),d=u.index();i=u.parent.canReplaceWith(d,d+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[o];s.setBlockType(a,l,t,e)}r(s.scrollIntoView())}return!0}}function xf(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}xf(Tf,my,by);xf(Tf,Ey,ky);xf(Ty,Cy,Sy,Zx);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function sA(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s);if(!o)return!1;let a=r?n.tr:null;return oA(a,o,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function oA(t,e,n,r=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);s=new Al(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new Al(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=ny(s,n,r,e);return a?(t&&aA(t,e,a,i,n),!0):!1}function aA(t,e,n,r,i){let s=v.empty;for(let u=n.length-1;u>=0;u--)s=v.from(n[u].type.create(n[u].attrs,s));t.step(new Fe(e.start-(r?2:0),e.end,e.start,e.end,new F(s,0,0),n.length,!0));let o=0;for(let u=0;u<n.length;u++)n[u].type==i&&(o=u+1);let a=n.length-o,l=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,h=!0;u<d;u++,h=!1)!h&&rr(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function lA(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?cA(e,n,t,s):uA(e,n,s):!0:!1}}function cA(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new Fe(s-1,o,s,o,new F(v.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Al(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const a=Ns(r);if(a==null)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(s,-1)-1);return Ni(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function uA(t,e,n){let r=t.tr,i=n.parent;for(let f=n.end,p=n.endIndex-1,g=n.startIndex;p>g;p--)f-=i.child(p).nodeSize,r.delete(f-1,f+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==i.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(a?0:1),u+1,o.content.append(l?v.empty:v.from(i))))return!1;let d=s.pos,h=d+o.nodeSize;return r.step(new Fe(d-(a?1:0),h+(l?1:0),d+1,h-1,new F((a?v.empty:v.from(i.copy(v.empty))).append(l?v.empty:v.from(i.copy(v.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function dA(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=t)return!1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,u=v.from(c?t.create():null),d=new F(v.from(t.create(null,v.from(a.type.create(null,u)))),c?3:1,0),h=s.start,f=s.end;n(e.tr.step(new Fe(h-(c?3:1),f,h,f,d,1,!0)).scrollIntoView())}return!0}}const it=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},ps=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Kd=null;const Zn=function(t,e,n){let r=Kd||(Kd=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},hA=function(){Kd=null},mi=function(t,e,n,r){return n&&(qm(t,e,n,r,-1)||qm(t,e,n,r,1))},fA=/^(img|br|input|textarea|hr)$/i;function qm(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Qt(t))){let o=t.parentNode;if(!o||o.nodeType!=1||ia(t)||fA.test(t.nodeName)||t.contentEditable=="false")return!1;e=it(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?Qt(t):0}else return!1}}function Qt(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function pA(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Qt(t)}else if(t.parentNode&&!ia(t))e=it(t),t=t.parentNode;else return null}}function mA(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!ia(t))e=it(t)+1,t=t.parentNode;else return null}}function gA(t,e,n){for(let r=e==0,i=e==Qt(t);r||i;){if(t==n)return!0;let s=it(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Qt(t)}}function ia(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Hc=function(t){return t.focusNode&&mi(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Jr(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function bA(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function yA(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Qt(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Qt(r.startContainer),r.startOffset)}}}const Ln=typeof navigator<"u"?navigator:null,Wm=typeof document<"u"?document:null,$r=Ln&&Ln.userAgent||"",Gd=/Edge\/(\d+)/.exec($r),Ay=/MSIE \d/.exec($r),Qd=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec($r),Mt=!!(Ay||Qd||Gd),Or=Ay?document.documentMode:Qd?+Qd[1]:Gd?+Gd[1]:0,en=!Mt&&/gecko\/(\d+)/i.test($r);en&&+(/Firefox\/(\d+)/.exec($r)||[0,0])[1];const Jd=!Mt&&/Chrome\/(\d+)/.exec($r),ot=!!Jd,_y=Jd?+Jd[1]:0,ht=!Mt&&!!Ln&&/Apple Computer/.test(Ln.vendor),ms=ht&&(/Mobile\/\w+/.test($r)||!!Ln&&Ln.maxTouchPoints>2),Yt=ms||(Ln?/Mac/.test(Ln.platform):!1),Ny=Ln?/Win/.test(Ln.platform):!1,tr=/Android \d/.test($r),sa=!!Wm&&"webkitFontSmoothing"in Wm.documentElement.style,EA=sa?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function kA(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Wn(t,e){return typeof t=="number"?t:t[e]}function TA(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Ym(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=ps(o);continue}let a=o,l=a==s.body,c=l?kA(s):TA(a),u=0,d=0;if(e.top<c.top+Wn(r,"top")?d=-(c.top-e.top+Wn(i,"top")):e.bottom>c.bottom-Wn(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+Wn(i,"top")-c.top:e.bottom-c.bottom+Wn(i,"bottom")),e.left<c.left+Wn(r,"left")?u=-(c.left-e.left+Wn(i,"left")):e.right>c.right-Wn(r,"right")&&(u=e.right-c.right+Wn(i,"right")),u||d)if(l)s.defaultView.scrollBy(u,d);else{let f=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let g=a.scrollLeft-f,b=a.scrollTop-p;e={left:e.left-g,top:e.top-b,right:e.right-g,bottom:e.bottom-b}}let h=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(h))break;o=h=="absolute"?o.offsetParent:ps(o)}}function CA(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=t.root.elementFromPoint(s,o);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:Iy(t.dom)}}function Iy(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=ps(r));return e}function SA({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Oy(n,r==0?0:r-e)}function Oy(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Hi=null;function wA(t){if(t.setActive)return t.setActive();if(Hi)return t.focus(Hi);let e=Iy(t);t.focus(Hi==null?{get preventScroll(){return Hi={preventScroll:!0},!0}}:void 0),Hi||(Hi=!1,Oy(e,0))}function My(t,e){let n,r=2e8,i,s=0,o=e.top,a=e.top,l,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let h;if(u.nodeType==1)h=u.getClientRects();else if(u.nodeType==3)h=Zn(u).getClientRects();else continue;for(let f=0;f<h.length;f++){let p=h[f];if(p.top<=o&&p.bottom>=a){o=Math.max(p.bottom,o),a=Math.min(p.top,a);let g=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(g<r){n=u,r=g,i=g&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&g&&(s=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!l&&p.left<=e.left&&p.right>=e.left&&(l=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=d+1)}}return!n&&l&&(n=l,i=c,r=0),n&&n.nodeType==3?xA(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:My(n,i)}function xA(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let o=pr(r,1);if(o.top!=o.bottom&&Af(e,o)){i={node:t,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function Af(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function AA(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function _A(t,e,n){let{node:r,offset:i}=My(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function NA(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let a=t.docView.nearestDesc(s,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&l.left>r.left||l.top>r.top?i=a.posBefore:(!o&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function vy(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let o=t.childNodes[s];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(Af(e,c))return vy(o,e,c)}}if((s=(s+1)%r)==i)break}return t}function IA(t,e){let n=t.dom.ownerDocument,r,i=0,s=yA(n,e.left,e.top);s&&({node:r,offset:i}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=t.dom.getBoundingClientRect();if(!Af(e,c)||(o=vy(t.dom,e,c),!o))return null}if(ht)for(let c=o;r&&c;c=ps(c))c.draggable&&(r=void 0);if(o=AA(o,e),r){if(en&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let c;sa&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=NA(t,r,i,e))}a==null&&(a=_A(t,o,e));let l=t.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Km(t){return t.top<t.bottom||t.left<t.right}function pr(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Km(r))return r}return Array.prototype.find.call(n,Km)||t.getBoundingClientRect()}const OA=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Dy(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=sa||en;if(r.nodeType==3)if(o&&(OA.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let l=pr(Zn(r,i,i),n);if(en&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=pr(Zn(r,i-1,i-1),-1);if(c.top==l.top){let u=pr(Zn(r,i,i+1),-1);if(u.top!=l.top)return Vs(u,u.left<c.left)}}return l}else{let l=i,c=i,u=n<0?1:-1;return n<0&&!i?(c++,u=-1):n>=0&&i==r.nodeValue.length?(l--,u=1):n<0?l--:c++,Vs(pr(Zn(r,l,c),u),u<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==Qt(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return Bu(l.getBoundingClientRect(),!1)}if(s==null&&i<Qt(r)){let l=r.childNodes[i];if(l.nodeType==1)return Bu(l.getBoundingClientRect(),!0)}return Bu(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==Qt(r))){let l=r.childNodes[i-1],c=l.nodeType==3?Zn(l,Qt(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return Vs(pr(c,1),!1)}if(s==null&&i<Qt(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?Zn(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return Vs(pr(c,-1),!0)}return Vs(pr(r.nodeType==3?Zn(r):r,-n),n>=0)}function Vs(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Bu(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Ly(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function MA(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return Ly(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=Dy(t,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Zn(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(n=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const vA=/[\u0590-\u08ac]/;function DA(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=t.domSelection();return a?!vA.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?s:o:Ly(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",n,"character");let f=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:g}=t.domSelectionRange(),b=p&&!f.contains(p.nodeType==1?p:p.parentNode)||l==p&&c==g;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return h!=null&&(a.caretBidiLevel=h),b}):r.pos==r.start()||r.pos==r.end()}let Gm=null,Qm=null,Jm=!1;function LA(t,e,n){return Gm==e&&Qm==n?Jm:(Gm=e,Qm=n,Jm=n=="up"||n=="down"?MA(t,e,n):DA(t,e,n))}const tn=0,Xm=1,Zr=2,Rn=3;class oa{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=tn,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>it(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!n||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let a=i.children[o];if(a.size){i=a;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],a=s+o.size;if(a>e||o instanceof Py){i=e-s;break}s=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof Ry&&s.side>=0;r--);if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?it(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?it(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,a=0;;a++){let l=this.children[a],c=o+l.size;if(i==-1&&e<=c){let u=o+l.border;if(e>=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,u);e=o;for(let d=a;d>0;d--){let h=this.children[d-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=it(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(c>n||a==this.children.length-1)){n=c;for(let u=a+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){s=it(d.dom);break}n+=d.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),o=Math.max(e,n);for(let f=0,p=0;f<this.children.length;f++){let g=this.children[f],b=p+g.size;if(s>p&&o<b)return g.setSelection(e-p-g.border,n-p-g.border,r,i);p=b}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((en||ht)&&e==n){let{node:f,offset:p}=a;if(f.nodeType==3){if(d=!!(p&&f.nodeValue[p-1]==`
|
|
7
|
-
`),d&&p==f.nodeValue.length)for(let g=f,b;g;g=g.parentNode){if(b=g.nextSibling){b.nodeName=="BR"&&(a=l={node:b.parentNode,offset:it(b)+1});break}let y=g.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let g=f.childNodes[p-1];d=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(en&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let f=u.focusNode.childNodes[u.focusOffset];f&&f.contentEditable=="false"&&(i=!0)}if(!(i||d&&ht)&&mi(a.node,a.offset,u.anchorNode,u.anchorOffset)&&mi(l.node,l.offset,u.focusNode,u.focusOffset))return;let h=!1;if((c.extend||e==n)&&!(d&&en)){c.collapse(a.node,a.offset);try{e!=n&&c.extend(l.node,l.offset),h=!0}catch{}}if(!h){if(e>n){let p=a;a=l,l=p}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let a=r+s.border,l=o-s.border;if(e>=a&&n<=l){this.dirty=e==r||n==o?Zr:Xm,e==a&&n==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Rn:s.markDirty(e-a,n-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Zr:Rn}r=o}this.dirty=Zr}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Zr:Xm;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Ry extends oa{constructor(e,n,r,i){let s,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==tn&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class RA extends oa{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class gi extends oa{constructor(e,n,r,i,s){super(e,[],r,i),this.mark=n,this.spec=s}static create(e,n,r,i){let s=i.nodeViews[n.type.name],o=s&&s(n,i,r);return(!o||!o.dom)&&(o=zt.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new gi(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Rn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Rn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=tn){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=tn}}slice(e,n,r){let i=gi.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=Zd(s,n,o,r)),e>0&&(s=Zd(s,0,e,r));for(let a=0;a<s.length;a++)s[a].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Mr extends oa{constructor(e,n,r,i,s,o,a,l,c){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,n,r,i,s,o){let a=s.nodeViews[n.type.name],l,c=a&&a(n,s,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,i),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=zt.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let h=u;return u=Hy(u,r,n),c?l=new PA(e,n,r,i,u,d||null,h,c,s,o+1):n.isText?new Uc(e,n,r,i,u,h,s):new Mr(e,n,r,i,u,d||null,h,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>v.empty)}return e}matchesNode(e,n,r){return this.dirty==tn&&e.eq(this.node)&&Nl(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new FA(this,o&&o.node,e);$A(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e,u):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?Se.none:this.node.child(u).marks,r,e,u),l.placeWidget(c,e,i)},(c,u,d,h)=>{l.syncToMarks(c.marks,r,e,h);let f;l.findNodeMatch(c,u,d,h)||a&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(f=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(c,u,d,f,e)||l.updateNextNode(c,u,d,e,h,i)||l.addNode(c,u,d,e,i),i+=c.nodeSize}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Zr)&&(o&&this.protectLocalComposition(e,o),By(this.contentDOM,this.children,e),ms&&zA(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof j)||r<n||i>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,a=VA(this.node.content,o,r-n,i-n);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new RA(this,s,n,i);e.input.compositionNodes.push(o),this.children=Zd(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==Rn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=tn}updateOuterDeco(e){if(Nl(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Fy(this.dom,this.nodeDOM,Xd(this.outerDeco,this.node,n),Xd(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Zm(t,e,n,r,i){Hy(r,e,t);let s=new Mr(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Uc extends Mr{constructor(e,n,r,i,s,o,a){super(e,n,r,i,s,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==Rn||this.dirty!=tn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=tn||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=tn,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new Uc(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Rn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Py extends oa{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==tn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class PA extends Mr{constructor(e,n,r,i,s,o,a,l,c,u){super(e,n,r,i,s,o,a,c,u),this.spec=l}update(e,n,r,i){if(this.dirty==Rn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function By(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],a=o.dom;if(a.parentNode==t){for(;a!=r;)r=eg(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(a,r);if(o instanceof gi){let l=r?r.previousSibling:t.lastChild;By(o.contentDOM,o.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=eg(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const ao=function(t){t&&(this.nodeName=t)};ao.prototype=Object.create(null);const ei=[new ao];function Xd(t,e,n){if(t.length==0)return ei;let r=n?ei[0]:new ao,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new ao(o.nodeName));for(let a in o){let l=o[a];l!=null&&(n&&i.length==1&&i.push(r=new ao(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function Fy(t,e,n,r){if(n==ei&&r==ei)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],a=n[s];if(s){let l;a&&a.nodeName==o.nodeName&&i!=t&&(l=i.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=ei[0]),i=l}BA(i,a||ei[0],o)}return i}function BA(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&t.classList.add(i[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function Hy(t,e,n){return Fy(t,t,ei,Xd(e,n,t.nodeType!=1))}function Nl(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function eg(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class FA{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=HA(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,i){let s=0,o=this.stack.length>>1,a=Math.min(o,e.length);for(;s<a&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=tn,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let l=-1,c=this.top.children.length;i<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let d=this.top.children[u];if(d.matchesMark(e[o])&&!this.isLocked(d.dom)){l=u;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let u=gi.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let o=this.top.children[i];return o.dirty==Rn&&o.dom==o.contentDOM&&(o.dirty=Zr),o.update(e,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Mr){let c=this.preMatch.matched.get(l);if(c!=null&&c!=s)return!1;let u=l.dom,d,h=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Rn&&Nl(n,l.outerDeco));if(!h&&l.update(e,n,r,i))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!h&&(d=this.recreateWrapper(l,e,n,r,i,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=Zr,d.updateChildren(i,o+1),d.dirty=tn),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Nl(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=Mr.create(this.top,n,r,i,s,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,i,s){let o=Mr.create(this.top,e,n,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new Ry(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof gi;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Uc)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ht||ot)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new Py(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function HA(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof gi)n=c,r=c.children.length;else{a=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function UA(t,e){return t.type.side-e.type.side}function $A(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,i,e.forChild(s,u),c),s+=u.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let u,d;for(;o<i.length&&i[o].to==s;){let b=i[o++];b.widget&&(u?(d||(d=[u])).push(b):u=b)}if(u)if(d){d.sort(UA);for(let b=0;b<d.length;b++)n(d[b],c,!!l)}else n(u,c,!!l);let h,f;if(l)f=-1,h=l,l=null;else if(c<t.childCount)f=c,h=t.child(c++);else break;for(let b=0;b<a.length;b++)a[b].to<=s&&a.splice(b--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let p=s+h.nodeSize;if(h.isText){let b=p;o<i.length&&i[o].from<b&&(b=i[o].from);for(let y=0;y<a.length;y++)a[y].to<b&&(b=a[y].to);b<p&&(l=h.cut(b-s),h=h.cut(0,b-s),p=b,f=-1)}else for(;o<i.length&&i[o].to<p;)o++;let g=h.isInline&&!h.isLeaf?a.filter(b=>!b.inline):a.slice();r(h,g,e.forChild(s,h),f),s=p}}function zA(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function VA(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<t.childCount;){let c=t.child(i++);if(s+=c.nodeSize,!c.isText)break;l+=c.text}if(s>=n){if(s>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=n)return a+c;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function Zd(t,e,n,r,i){let s=[];for(let o=0,a=0;o<t.length;o++){let l=t[o],c=a,u=a+=l.size;c>=n||u<=e?s.push(l):(c<e&&s.push(l.slice(0,e-c,r)),i&&(s.push(i),i=void 0),u>n&&s.push(l.slice(n-c,l.size,r)))}return s}function _f(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,c;if(Hc(n)){for(l=o;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&W.isSelectable(d)&&i.parent&&!(d.isInline&&gA(n.focusNode,n.focusOffset,i.dom))){let h=i.posBefore;c=new W(o==h?a:r.resolve(h))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=o,h=o;for(let f=0;f<n.rangeCount;f++){let p=n.getRangeAt(f);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),h=Math.max(h,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[l,o]=h==t.state.selection.anchor?[h,d]:[d,h],a=r.resolve(o)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let d=e=="pointer"||t.state.selection.head<a.pos&&!s?1:-1;c=Nf(t,u,a,d)}return c}function Uy(t){return t.editable?t.hasFocus():zy(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function ir(t,e=!1){let n=t.state.selection;if($y(t,n),!!Uy(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&ot){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&mi(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)qA(t);else{let{anchor:r,head:i}=n,s,o;tg&&!(n instanceof j)&&(n.$from.parent.inlineContent||(s=ng(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=ng(t,n.to))),t.docView.setSelection(r,i,t,e),tg&&(s&&rg(s),o&&rg(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&jA(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const tg=ht||ot&&_y<63;function ng(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(ht&&i&&i.contentEditable=="false")return Fu(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Fu(i);if(s)return Fu(s)}}function Fu(t){return t.contentEditable="true",ht&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function rg(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function jA(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Uy(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function qA(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,it(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&Mt&&Or<=11&&(n.disabled=!0,n.disabled=!1)}function $y(t,e){if(e instanceof W){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(ig(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else ig(t)}function ig(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Nf(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||j.between(e,n,r)}function sg(t){return t.editable&&!t.hasFocus()?!1:zy(t)}function zy(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function WA(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return mi(e.node,e.offset,n.anchorNode,n.anchorOffset)}function eh(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Q.findFrom(s,e)}function br(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function og(t,e,n){let r=t.state.selection;if(r instanceof j)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return br(t,new j(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=eh(t.state,e);return i&&i instanceof W?br(t,i):!1}else if(!(Yt&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(a))&&!o.contentDOM?W.isSelectable(s)?br(t,new W(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):sa?br(t,new j(t.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof W&&r.node.isInline)return br(t,new j(e>0?r.$to:r.$from));{let i=eh(t.state,e);return i?br(t,i):!1}}}function Il(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function lo(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Ui(t,e){return e<0?YA(t):KA(t)}function YA(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(en&&n.nodeType==1&&r<Il(n)&&lo(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(lo(a,-1))i=n,s=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(Vy(n))break;{let a=n.previousSibling;for(;a&&lo(a,-1);)i=n.parentNode,s=it(a),a=a.previousSibling;if(a)n=a,r=Il(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?th(t,n,r):i&&th(t,i,s)}function KA(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Il(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let a=n.childNodes[r];if(lo(a,1))s=n,o=++r;else break}else{if(Vy(n))break;{let a=n.nextSibling;for(;a&&lo(a,1);)s=a.parentNode,o=it(a)+1,a=a.nextSibling;if(a)n=a,r=0,i=Il(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&th(t,s,o)}function Vy(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function GA(t,e){for(;t&&e==t.childNodes.length&&!ia(t);)e=it(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function QA(t,e){for(;t&&!e&&!ia(t);)e=it(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function th(t,e,n){if(e.nodeType!=3){let s,o;(o=GA(e,n))?(e=o,n=0):(s=QA(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Hc(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&ir(t)},50)}function ag(t,e){let n=t.state.doc.resolve(e);if(!(ot||Ny)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function lg(t,e,n){let r=t.state.selection;if(r instanceof j&&!r.empty||n.indexOf("s")>-1||Yt&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=eh(t.state,e);if(o&&o instanceof W)return br(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=r instanceof Ot?Q.near(o,e):Q.findFrom(o,e);return a?br(t,a):!1}return!1}function cg(t,e){if(!(t.state.selection instanceof j))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function ug(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function JA(t){if(!ht||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;ug(t,r,"true"),setTimeout(()=>ug(t,r,"false"),20)}return!1}function XA(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function ZA(t,e){let n=e.keyCode,r=XA(e);if(n==8||Yt&&n==72&&r=="c")return cg(t,-1)||Ui(t,-1);if(n==46&&!e.shiftKey||Yt&&n==68&&r=="c")return cg(t,1)||Ui(t,1);if(n==13||n==27)return!0;if(n==37||Yt&&n==66&&r=="c"){let i=n==37?ag(t,t.state.selection.from)=="ltr"?-1:1:-1;return og(t,i,r)||Ui(t,i)}else if(n==39||Yt&&n==70&&r=="c"){let i=n==39?ag(t,t.state.selection.from)=="ltr"?1:-1:1;return og(t,i,r)||Ui(t,i)}else{if(n==38||Yt&&n==80&&r=="c")return lg(t,-1,r)||Ui(t,-1);if(n==40||Yt&&n==78&&r=="c")return JA(t)||lg(t,1,r)||Ui(t,1);if(r==(Yt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function If(t,e){t.someProp("transformCopied",f=>{e=f(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let f=r.firstChild;n.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let o=t.someProp("clipboardSerializer")||zt.fromSchema(t.state.schema),a=Gy(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Ky[c.nodeName.toLowerCase()]);){for(let f=u.length-1;f>=0;f--){let p=a.createElement(u[f]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(n)}`);let h=t.someProp("clipboardTextSerializer",f=>f(e,t))||e.content.textBetween(0,e.content.size,`
|
|
8
|
-
|
|
9
|
-
`);return{dom:l,text:h,slice:e}}function jy(t,e,n,r,i){let s=i.parent.type.spec.code,o,a;if(!n&&!e)return null;let l=!!e&&(r||s||!n);if(l){if(t.someProp("transformPastedText",h=>{e=h(e,s||r,t)}),s)return a=new F(v.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
10
|
-
`))),0,0),t.someProp("transformPasted",h=>{a=h(a,t,!0)}),a;let d=t.someProp("clipboardTextParser",h=>h(e,i,r,t));if(d)a=d;else{let h=i.marks(),{schema:f}=t.state,p=zt.fromSchema(f);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let b=o.appendChild(document.createElement("p"));g&&b.appendChild(p.serializeNode(f.text(g,h)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),o=r2(n),sa&&i2(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||mn.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||u),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!e2.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)a=s2(dg(a,+u[1],+u[2]),u[4]);else if(a=F.maxOpen(t2(a.content,i),!0),a.openStart||a.openEnd){let d=0,h=0;for(let f=a.content.firstChild;d<a.openStart&&!f.type.spec.isolating;d++,f=f.firstChild);for(let f=a.content.lastChild;h<a.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);a=dg(a,d,h)}return t.someProp("transformPasted",d=>{a=d(a,t,l)}),a}const e2=/^(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 t2(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&s.length&&Wy(l,s,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Yy(o[o.length-1],s.length));let u=qy(a,l);o.push(u),i=i.matchType(u.type),s=l}}),o)return v.from(o)}return t}function qy(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,v.from(t));return t}function Wy(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=Wy(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(v.from(qy(n,t,i+1))))}}function Yy(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Yy(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(v.empty,!0);return t.copy(n.append(r))}function nh(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,a=o.content;return t.childCount>1&&(s=0),i<r-1&&(a=nh(a,e,n,r,i+1,s)),i>=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(v.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function dg(t,e,n){return e<t.openStart&&(t=new F(nh(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new F(nh(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Ky={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let hg=null;function Gy(){return hg||(hg=document.implementation.createHTMLDocument("title"))}let Hu=null;function n2(t){let e=window.trustedTypes;return e?(Hu||(Hu=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Hu.createHTML(t)):t}function r2(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Gy().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&Ky[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=n2(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function i2(t){let e=t.querySelectorAll(ot?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function s2(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=v.from(l.create(r[a+1],i)),s++,o++}return new F(i,s,o)}const yt={},Et={},o2={touchstart:!0,touchmove:!0};class a2{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 l2(t){for(let e in yt){let n=yt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{u2(t,r)&&!Of(t,r)&&(t.editable||!(r.type in Et))&&n(t,r)},o2[e]?{passive:!0}:void 0)}ht&&t.dom.addEventListener("input",()=>null),rh(t)}function xr(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function c2(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function rh(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Of(t,r))})}function Of(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function u2(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function d2(t,e){!Of(t,e)&&yt[e.type]&&(t.editable||!(e.type in Et))&&yt[e.type](t,e)}Et.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Jy(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(tr&&ot&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),ms&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,Jr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||ZA(t,n)?n.preventDefault():xr(t,"key")};Et.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Et.keypress=(t,e)=>{let n=e;if(Jy(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Yt&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof j)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function $c(t){return{left:t.clientX,top:t.clientY}}function h2(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Mf(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,a=>o>s.depth?a(t,n,s.nodeAfter,s.before(o),i,!0):a(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function Zi(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function f2(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&W.isSelectable(r)?(Zi(t,new W(n)),!0):!1}function p2(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof W&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(W.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(Zi(t,W.create(t.state.doc,i)),!0):!1}function m2(t,e,n,r,i){return Mf(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?p2(t,n):f2(t,n))}function g2(t,e,n,r){return Mf(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function b2(t,e,n,r){return Mf(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||y2(t,n,r)}function y2(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Zi(t,j.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)Zi(t,j.create(r,a+1,a+1+o.content.size));else if(W.isSelectable(o))Zi(t,W.create(r,a));else continue;return!0}}function vf(t){return Ol(t)}const Qy=Yt?"metaKey":"ctrlKey";yt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=vf(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&h2(n,t.input.lastClick)&&!n[Qy]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let o=t.posAtCoords($c(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new E2(t,o,n,!!r)):(s=="doubleClick"?g2:b2)(t,o.pos,o.inside,n)?n.preventDefault():xr(t,"pointer"))};class E2{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Qy],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let u=e.state.doc.resolve(n.pos);s=u.parent,o=u.depth?u.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof W&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&en&&!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)),xr(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(()=>ir(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords($c(e))),this.updateAllowDefault(e),this.allowDefault||!n?xr(this.view,"pointer"):m2(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ht&&this.mightDrag&&!this.mightDrag.node.isAtom||ot&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Zi(this.view,Q.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):xr(this.view,"pointer")}move(e){this.updateAllowDefault(e),xr(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}yt.touchstart=t=>{t.input.lastTouch=Date.now(),vf(t),xr(t,"pointer")};yt.touchmove=t=>{t.input.lastTouch=Date.now(),xr(t,"pointer")};yt.contextmenu=t=>vf(t);function Jy(t,e){return t.composing?!0:ht&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const k2=tr?5e3:-1;Et.compositionstart=Et.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof j&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||ot&&Ny&&T2(t)))t.markCursor=t.state.storedMarks||n.marks(),Ol(t,!0),t.markCursor=null;else if(Ol(t,!e.selection.empty),en&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let a=t.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}Xy(t,k2)};function T2(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Et.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Xy(t,20))};function Xy(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Ol(t),e))}function Zy(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=S2());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function C2(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=pA(e.focusNode,e.focusOffset),r=mA(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function S2(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Ol(t,e=!1){if(!(tr&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Zy(t),e||t.docView&&t.docView.dirty){let n=_f(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function w2(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Mo=Mt&&Or<15||ms&&EA<604;yt.copy=Et.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=Mo?null:n.clipboardData,o=r.content(),{dom:a,text:l}=If(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):w2(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function x2(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function A2(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.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=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?vo(t,r.value,null,i,e):vo(t,r.textContent,r.innerHTML,i,e)},50)}function vo(t,e,n,r,i){let s=jy(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,s||F.empty)))return!0;if(!s)return!1;let o=x2(s),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function eE(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Et.paste=(t,e)=>{let n=e;if(t.composing&&!tr)return;let r=Mo?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&vo(t,eE(r),r.getData("text/html"),i,n)?n.preventDefault():A2(t,n)};class tE{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const _2=Yt?"altKey":"ctrlKey";function nE(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[_2]}yt.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords($c(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof W?i.to-1:i.to))){if(r&&r.mightDrag)o=W.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(o=W.create(t.state.doc,d.posBefore))}}let a=(o||t.state.selection).content(),{dom:l,text:c,slice:u}=If(t,a);(!n.dataTransfer.files.length||!ot||_y>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Mo?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Mo||n.dataTransfer.setData("text/plain",c),t.dragging=new tE(u,nE(t,n),o)};yt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Et.dragover=Et.dragenter=(t,e)=>e.preventDefault();Et.drop=(t,e)=>{try{N2(t,e,t.dragging)}finally{t.dragging=null}};function N2(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords($c(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",f=>{s=f(s,t,!1)}):s=jy(t,eE(e.dataTransfer),Mo?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&nE(t,e));if(t.someProp("handleDrop",f=>f(t,e,s||F.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let a=s?oy(t.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let l=t.state.tr;if(o){let{node:f}=n;f?f.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=l.doc;if(u?l.replaceRangeWith(c,c,s.content.firstChild):l.replaceRange(c,c,s),l.doc.eq(d))return;let h=l.doc.resolve(c);if(u&&W.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))l.setSelection(new W(h));else{let f=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((p,g,b,y)=>f=y),l.setSelection(Nf(t,h,l.doc.resolve(f)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}yt.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&ir(t)},20))};yt.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};yt.beforeinput=(t,e)=>{if(ot&&tr&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,Jr(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Et)yt[t]=Et[t];function Do(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Ml{constructor(e,n){this.toDOM=e,this.spec=n||oi,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new Ee(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Ml&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Do(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class vr{constructor(e,n){this.attrs=e,this.spec=n||oi}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new Ee(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof vr&&Do(this.attrs,e.attrs)&&Do(this.spec,e.spec)}static is(e){return e.type instanceof vr}destroy(){}}class Df{constructor(e,n){this.attrs=e,this.spec=n||oi}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new Ee(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof Df&&Do(this.attrs,e.attrs)&&Do(this.spec,e.spec)}destroy(){}}class Ee{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Ee(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Ee(e,e,new Ml(n,r))}static inline(e,n,r,i){return new Ee(e,n,new vr(r,i))}static node(e,n,r,i){return new Ee(e,n,new Df(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof vr}get widget(){return this.type instanceof Ml}}const qi=[],oi={};class ue{constructor(e,n){this.local=e.length?e:qi,this.children=n.length?n:qi}static create(e,n){return n.length?vl(n,e,0,oi):ct}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=n&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,i+a,s)}}map(e,n,r){return this==ct||e.maps.length==0?this:this.mapInner(e,n,0,0,r||oi)}mapInner(e,n,r,i,s){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(n,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?I2(this.children,o||[],e,n,r,i,s):o?new ue(o.sort(ai),qi):ct}add(e,n){return n.length?this==ct?ue.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((a,l)=>{let c=l+r,u;if(u=iE(n,a,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<l;)s+=3;i[s]==l?i[s+2]=i[s+2].addInner(a,u,c+1):i.splice(s,0,l,l+a.nodeSize,vl(u,a,c+1,oi)),s+=3}});let o=rE(s?sE(n):n,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new ue(o.length?this.local.concat(o).sort(ai):this.local,i||this.children)}remove(e){return e.length==0||this==ct?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,a=r[s]+n,l=r[s+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>a&&d.to<l&&(e[u]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(o,a+1);c!=ct?r[s+2]=c:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new ue(i,r):ct}forChild(e,n){if(this==ct)return this;if(n.isLeaf)return ue.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,o=s+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>s&&l.type instanceof vr){let c=Math.max(s,l.from)-s,u=Math.min(o,l.to)-s;c<u&&(i||(i=[])).push(l.copy(c,u))}}if(i){let a=new ue(i.sort(ai),qi);return r?new kr([a,r]):a}return r||ct}eq(e){if(this==e)return!0;if(!(e instanceof ue)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Lf(this.localsInner(e))}localsInner(e){if(this==ct)return qi;if(e.inlineContent||!this.local.some(vr.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof vr||n.push(this.local[r]);return n}forEachSet(e){e(this)}}ue.empty=new ue([],[]);ue.removeOverlap=Lf;const ct=ue.empty;class kr{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,oi));return kr.from(r)}forChild(e,n){if(n.isLeaf)return ue.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=ct&&(s instanceof kr?r=r.concat(s.members):r.push(s))}return kr.from(r)}eq(e){if(!(e instanceof kr)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?Lf(r?n:n.sort(ai)):qi}static from(e){switch(e.length){case 0:return ct;case 1:return e[0];default:return new kr(e.every(n=>n instanceof ue)?e:e.reduce((n,r)=>n.concat(r instanceof ue?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function I2(t,e,n,r,i,s,o){let a=t.slice();for(let c=0,u=s;c<n.maps.length;c++){let d=0;n.maps[c].forEach((h,f,p,g)=>{let b=g-p-(f-h);for(let y=0;y<a.length;y+=3){let C=a[y+1];if(C<0||h>C+u-d)continue;let S=a[y]+u-d;f>=S?a[y+1]=h<=S?-2:-1:h>=u&&b&&(a[y]+=b,a[y+1]+=b)}d+=b}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=n.map(t[c]+s),d=u-i;if(d<0||d>=r.content.size){l=!0;continue}let h=n.map(t[c+1]+s,-1),f=h-i,{index:p,offset:g}=r.content.findIndex(d),b=r.maybeChild(p);if(b&&g==d&&g+b.nodeSize==f){let y=a[c+2].mapInner(n,b,u+1,t[c]+s+1,o);y!=ct?(a[c]=d,a[c+1]=f,a[c+2]=y):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=O2(a,t,e,n,i,s,o),u=vl(c,r,0,o);e=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,h=0;d<u.children.length;d+=3){let f=u.children[d];for(;h<a.length&&a[h]<f;)h+=3;a.splice(h,0,u.children[d],u.children[d+1],u.children[d+2])}}return new ue(e.sort(ai),a)}function rE(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new Ee(i.from+e,i.to+e,i.type))}return n}function O2(t,e,n,r,i,s,o){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,i,c);d?n.push(d):o.onRemove&&o.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+s+1);return n}function iE(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function sE(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function vl(t,e,n,r){let i=[],s=!1;e.forEach((a,l)=>{let c=iE(t,a,l+n);if(c){s=!0;let u=vl(c,a,n+l+1,r);u!=ct&&i.push(l,l+a.nodeSize,u)}});let o=rE(s?sE(t):t,-n).sort(ai);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new ue(o,i):ct}function ai(t,e){return t.from-e.from||t.to-e.to}function Lf(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),fg(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),fg(e,i,r.copy(s.from,r.to)));break}}}return e}function fg(t,e,n){for(;e<t.length&&ai(n,t[e])>0;)e++;t.splice(e,0,n)}function Uu(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=ct&&e.push(r)}),t.cursorWrapper&&e.push(ue.create(t.state.doc,[t.cursorWrapper.deco])),kr.from(e)}const M2={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},v2=Mt&&Or<=11;class D2{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 L2{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new D2,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);Mt&&Or<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():ht&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),v2&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.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,M2)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(sg(this.view)){if(this.suppressingSelectionUpdates)return ir(this.view);if(Mt&&Or<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&mi(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let s=e.focusNode;s;s=ps(s))n.add(s);for(let s=e.anchorNode;s;s=ps(s))if(n.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&sg(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],l);d&&(s=s<0?d.from:Math.min(d.from,s),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(a=!0))}if(l.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of l)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;for(;d&&d.nodeType==1;){if(d.contentEditable=="false"){u.parentNode.removeChild(u);break}d=d.firstChild}}}else if(en&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,h]=u;d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let h of u){let f=h.parentNode;f&&f.nodeName=="LI"&&(!d||B2(e,d)!=f)&&h.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Hc(r)&&(c=_f(e))&&c.eq(Q.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,ir(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),R2(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,F2(e,l)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||ir(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(Mt&&Or<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:h}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(s=h)}let o=i&&i.parentNode==e.target?it(i)+1:0,a=r.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?it(s):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let pg=new WeakMap,mg=!1;function R2(t){if(!pg.has(t)&&(pg.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=en,mg)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),mg=!0}}function gg(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return mi(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function P2(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return gg(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?gg(t,n):null}function B2(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function F2(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let a=o;for(;;){let l=a.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;a=l}a.insertBefore(s,a.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function H2(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:o,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),c,u=l.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],Hc(l)||c.push({node:l.focusNode,offset:l.focusOffset})),ot&&t.input.lastKeyCode===8)for(let b=s;b>i;b--){let y=r.childNodes[b-1],C=y.pmViewDesc;if(y.nodeName=="BR"&&!C){s=b;break}if(!C||C.size)break}let d=t.state.doc,h=t.someProp("domParser")||mn.fromSchema(t.state.schema),f=d.resolve(o),p=null,g=h.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:i,to:s,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:U2,context:f});if(c&&c[0].pos!=null){let b=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=b),p={anchor:b+o,head:y+o}}return{doc:g,sel:p,from:o,to:a}}function U2(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(ht&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||ht&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const $2=/^(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 z2(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let D=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,z=_f(t,D);if(z&&!t.state.selection.eq(z)){if(ot&&tr&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",_=>_(t,Jr(13,"Enter"))))return;let V=t.state.tr.setSelection(z);D=="pointer"?V.setMeta("pointer",!0):D=="key"&&V.scrollIntoView(),s&&V.setMeta("composition",s),t.dispatch(V)}return}let o=t.state.doc.resolve(e),a=o.sharedDepth(n);e=o.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,c=H2(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),h,f;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(h=t.state.selection.to,f="end"):(h=t.state.selection.from,f="start"),t.input.lastKeyCode=null;let p=q2(d.content,c.doc.content,c.from,h,f);if(p&&t.input.domChangeCount++,(ms&&t.input.lastIOSEnter>Date.now()-225||tr)&&i.some(D=>D.nodeType==1&&!$2.test(D.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",D=>D(t,Jr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof j&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let D=bg(t,t.state.doc,c.sel);if(D&&!D.eq(t.state.selection)){let z=t.state.tr.setSelection(D);s&&z.setMeta("composition",s),t.dispatch(z)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof j&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),Mt&&Or<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)==" "&&(p.start--,p.endA--,p.endB--);let g=c.doc.resolveNoCache(p.start-c.from),b=c.doc.resolveNoCache(p.endB-c.from),y=u.resolve(p.start),C=g.sameParent(b)&&g.parent.inlineContent&&y.end()>=p.endA;if((ms&&t.input.lastIOSEnter>Date.now()-225&&(!C||i.some(D=>D.nodeName=="DIV"||D.nodeName=="P"))||!C&&g.pos<c.doc.content.size&&(!g.sameParent(b)||!g.parent.inlineContent)&&g.pos<b.pos&&!/\S/.test(c.doc.textBetween(g.pos,b.pos,"","")))&&t.someProp("handleKeyDown",D=>D(t,Jr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&j2(u,p.start,p.endA,g,b)&&t.someProp("handleKeyDown",D=>D(t,Jr(8,"Backspace")))){tr&&ot&&t.domObserver.suppressSelectionUpdates();return}ot&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),tr&&!C&&g.start()!=b.start()&&b.parentOffset==0&&g.depth==b.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,b=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(D){return D(t,Jr(13,"Enter"))})},20));let S=p.start,I=p.endA,M=D=>{let z=D||t.state.tr.replace(S,I,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let V=bg(t,z.doc,c.sel);V&&!(ot&&t.composing&&V.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(V.head==S||V.head==z.mapping.map(I)-1)||Mt&&V.empty&&V.head==S)&&z.setSelection(V)}return s&&z.setMeta("composition",s),z.scrollIntoView()},A;if(C)if(g.pos==b.pos){Mt&&Or<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>ir(t),20));let D=M(t.state.tr.delete(S,I)),z=u.resolve(p.start).marksAcross(u.resolve(p.endA));z&&D.ensureMarks(z),t.dispatch(D)}else if(p.endA==p.endB&&(A=V2(g.parent.content.cut(g.parentOffset,b.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start())))){let D=M(t.state.tr);A.type=="add"?D.addMark(S,I,A.mark):D.removeMark(S,I,A.mark),t.dispatch(D)}else if(g.parent.child(g.index()).isText&&g.index()==b.index()-(b.textOffset?0:1)){let D=g.parent.textBetween(g.parentOffset,b.parentOffset),z=()=>M(t.state.tr.insertText(D,S,I));t.someProp("handleTextInput",V=>V(t,S,I,D,z))||t.dispatch(z())}else t.dispatch(M());else t.dispatch(M())}function bg(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Nf(t,e.resolve(n.anchor),e.resolve(n.head))}function V2(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,a,l;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<n.length;u++)s=n[u].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",l=u=>u.mark(a.addToSet(u.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(v.from(c).eq(t))return{mark:a,type:o}}function j2(t,e,n,r,i){if(n-e<=i.pos-r.pos||$u(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&n==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve($u(s,!0,!0));return!o.parent.isTextblock||o.pos>n||$u(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function $u(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function q2(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:o,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let l=Math.max(0,s-Math.min(o,a));r-=o+l-s}if(o<s&&t.size<e.size){let l=r<=s&&r>=o?s-r:0;s-=l,s&&s<e.size&&yg(e.textBetween(s-1,s+1))&&(s+=l?1:-1),a=s+(a-o),o=s}else if(a<s){let l=r<=s&&r>=a?s-r:0;s-=l,s&&s<t.size&&yg(t.textBetween(s-1,s+1))&&(s+=l?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}function yg(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class oE{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new a2,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Sg),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Tg(this),kg(this),this.nodeViews=Cg(this),this.docView=Zm(this.state.doc,Eg(this),Uu(this),this.dom,this),this.domObserver=new L2(this,(r,i,s,o)=>z2(this,r,i,s,o)),this.domObserver.start(),l2(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&rh(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Sg),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(Zy(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let f=Cg(this);Y2(f,this.nodeViews)&&(this.nodeViews=f,s=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&rh(this),this.editable=Tg(this),kg(this);let l=Uu(this),c=Eg(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,c,l);(d||!e.selection.eq(i.selection))&&(o=!0);let h=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&CA(this);if(o){this.domObserver.stop();let f=d&&(Mt||ot)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&W2(i.selection,e.selection);if(d){let p=ot?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=C2(this)),(s||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Zm(e.doc,c,l,this.dom,this)),p&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&WA(this))?ir(this,f):($y(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():h&&SA(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof W){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Ym(this,n.getBoundingClientRect(),e)}else Ym(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new tE(e.slice,e.move,i<0?void 0:W.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=n?n(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=n?n(a):a))return i}}hasFocus(){if(Mt){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&wA(this.dom),ir(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return IA(this,e)}coordsAtPos(e,n=1){return Dy(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return LA(this,n||this.state,e)}pasteHTML(e,n){return vo(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return vo(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return If(this,e)}destroy(){this.docView&&(c2(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Uu(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,hA())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return d2(this,e)}domSelectionRange(){let e=this.domSelection();return e?ht&&this.root.nodeType===11&&bA(this.dom.ownerDocument)==this.dom&&P2(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}oE.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Eg(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Ee.node(0,t.state.doc.content.size,e)]}function kg(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Ee.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Tg(t){return!t.someProp("editable",e=>e(t.state)===!1)}function W2(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Cg(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Y2(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function Sg(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Dr={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:"'"},Dl={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},K2=typeof navigator<"u"&&/Mac/.test(navigator.platform),G2=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var st=0;st<10;st++)Dr[48+st]=Dr[96+st]=String(st);for(var st=1;st<=24;st++)Dr[st+111]="F"+st;for(var st=65;st<=90;st++)Dr[st]=String.fromCharCode(st+32),Dl[st]=String.fromCharCode(st);for(var zu in Dr)Dl.hasOwnProperty(zu)||(Dl[zu]=Dr[zu]);function Q2(t){var e=K2&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||G2&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Dl:Dr)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const J2=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),X2=typeof navigator<"u"&&/Win/.test(navigator.platform);function Z2(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))J2?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function e_(t){let e=Object.create(null);for(let n in t)e[Z2(n)]=t[n];return e}function Vu(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function aE(t){return new re({props:{handleKeyDown:Rf(t)}})}function Rf(t){let e=e_(t);return function(n,r){let i=Q2(r),s,o=e[Vu(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[Vu(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(X2&&r.ctrlKey&&r.altKey)&&(s=Dr[r.keyCode])&&s!=i){let a=e[Vu(s,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var t_=Object.defineProperty,Pf=(t,e)=>{for(var n in e)t_(t,n,{get:e[n],enumerable:!0})};function zc(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,s=n.storedMarks,n}}}var Vc=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:i}=n,s=this.buildProps(i);return Object.fromEntries(Object.entries(t).map(([o,a])=>[o,(...c)=>{const u=a(...c)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,o=[],a=!!t,l=t||i.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(l),o.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(n).map(([d,h])=>[d,(...p)=>{const g=this.buildProps(l,e),b=h(...p)(g);return o.push(b),u}])),run:c};return u}createCan(t){const{rawCommands:e,state:n}=this,r=!1,i=t||n.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>l(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,o={tr:t,editor:r,view:s,state:zc({state:i,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([a,l])=>[a,(...c)=>l(...c)(o)]))}};return o}},lE={};Pf(lE,{blur:()=>n_,clearContent:()=>r_,clearNodes:()=>i_,command:()=>s_,createParagraphNear:()=>o_,cut:()=>a_,deleteCurrentNode:()=>l_,deleteNode:()=>c_,deleteRange:()=>u_,deleteSelection:()=>d_,enter:()=>h_,exitCode:()=>f_,extendMarkRange:()=>p_,first:()=>m_,focus:()=>b_,forEach:()=>y_,insertContent:()=>E_,insertContentAt:()=>T_,joinBackward:()=>w_,joinDown:()=>S_,joinForward:()=>x_,joinItemBackward:()=>A_,joinItemForward:()=>__,joinTextblockBackward:()=>N_,joinTextblockForward:()=>I_,joinUp:()=>C_,keyboardShortcut:()=>M_,lift:()=>v_,liftEmptyBlock:()=>D_,liftListItem:()=>L_,newlineInCode:()=>R_,resetAttributes:()=>P_,scrollIntoView:()=>B_,selectAll:()=>F_,selectNodeBackward:()=>H_,selectNodeForward:()=>U_,selectParentNode:()=>$_,selectTextblockEnd:()=>z_,selectTextblockStart:()=>V_,setContent:()=>j_,setMark:()=>lN,setMeta:()=>cN,setNode:()=>uN,setNodeSelection:()=>dN,setTextDirection:()=>hN,setTextSelection:()=>fN,sinkListItem:()=>pN,splitBlock:()=>mN,splitListItem:()=>gN,toggleList:()=>yN,toggleMark:()=>EN,toggleNode:()=>kN,toggleWrap:()=>TN,undoInputRule:()=>CN,unsetAllMarks:()=>SN,unsetMark:()=>wN,unsetTextDirection:()=>xN,updateAttributes:()=>AN,wrapIn:()=>_N,wrapInList:()=>NN});var n_=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),r_=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),i_=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:o})=>{t.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),h=c.resolve(u.map(l+a.nodeSize)),f=d.blockRange(h);if(!f)return;const p=Ns(f);if(a.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(f.start,g)}(p||p===0)&&e.lift(f,p)})}),!0},s_=t=>e=>t(e),o_=()=>({state:t,dispatch:e})=>Cy(t,e),a_=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new j(r.doc.resolve(Math.max(o-1,0)))),!0},l_=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const a=i.before(s),l=i.after(s);t.delete(a,l).scrollIntoView()}return!0}return!1};function Xe(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var c_=t=>({tr:e,state:n,dispatch:r})=>{const i=Xe(t,n.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const l=s.before(o),c=s.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1},u_=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},d_=()=>({state:t,dispatch:e})=>Tf(t,e),h_=()=>({commands:t})=>t.keyboardShortcut("Enter"),f_=()=>({state:t,dispatch:e})=>Jx(t,e);function Bf(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Ll(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:Bf(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function cE(t,e,n={}){return t.find(r=>r.type===e&&Ll(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function wg(t,e,n={}){return!!cE(t,e,n)}function jc(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(c=>c.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(c=>c.type===e))return;if(!n){const c=r.node.marks.find(u=>u.type===e);c&&(n=c.attrs)}if(!cE([...r.node.marks],e,n))return;let s=r.index,o=t.start()+r.offset,a=s+1,l=o+r.node.nodeSize;for(;s>0&&wg([...t.parent.child(s-1).marks],e,n);)s-=1,o-=t.parent.child(s).nodeSize;for(;a<t.parent.childCount&&wg([...t.parent.child(a).marks],e,n);)l+=t.parent.child(a).nodeSize,a+=1;return{from:o,to:l}}function ar(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var p_=(t,e)=>({tr:n,state:r,dispatch:i})=>{const s=ar(t,r.schema),{doc:o,selection:a}=n,{$from:l,from:c,to:u}=a;if(i){const d=jc(l,s,e);if(d&&d.from<=c&&d.to>=u){const h=j.create(o,d.from,d.to);n.setSelection(h)}}return!0},m_=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function Ff(t){return t instanceof j}function nr(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function uE(t,e=null){if(!e)return null;const n=Q.atStart(t),r=Q.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?j.create(t,nr(0,i,s),nr(t.content.size,i,s)):j.create(t,nr(e,i,s),nr(e,i,s))}function ih(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Lo(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function g_(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var b_=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(Lo()||ih())&&r.dom.focus(),g_()&&!Lo()&&!ih()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(s&&t===null&&!Ff(n.state.selection))return o(),!0;const a=uE(i.doc,t)||n.state.selection,l=n.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},y_=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),E_=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),dE=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&dE(r)}return t};function Na(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return dE(n)}function Ro(t,e,n){if(t instanceof Zt||t instanceof v)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return v.fromArray(t.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),Ro("",e,n)}if(i){if(n.errorOnInvalidContent){let o=!1,a="";const l=new K1({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?mn.fromSchema(l).parseSlice(Na(t),n.parseOptions):mn.fromSchema(l).parse(Na(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=mn.fromSchema(e);return n.slice?s.parseSlice(Na(t),n.parseOptions).content:s.parse(Na(t),n.parseOptions)}return Ro("",e,n)}function hE(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof Re||i instanceof Fe))return;const s=t.mapping.maps[r];let o=0;s.forEach((a,l,c,u)=>{o===0&&(o=u)}),t.setSelection(Q.near(t.doc.resolve(o),n))}var k_=t=>!("type"in t),T_=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const l=b=>{s.emit("contentError",{editor:s,error:b,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Ro(e,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(b){l(b)}try{a=Ro(e,s.schema,{parseOptions:c,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(b){return l(b),!1}let{from:u,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},h=!0,f=!0;if((k_(a)?a:[a]).forEach(b=>{b.check(),h=h?b.isText&&b.marks.length===0:!1,f=f?b.isBlock:!1}),u===d&&f){const{parent:b}=r.doc.resolve(u);b.isTextblock&&!b.type.spec.code&&!b.childCount&&(u-=1,d+=1)}let g;if(h){if(Array.isArray(e))g=e.map(b=>b.text||"").join("");else if(e instanceof v){let b="";e.forEach(y=>{y.text&&(b+=y.text)}),g=b}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,u,d)}else{g=a;const b=r.doc.resolve(u),y=b.node(),C=b.parentOffset===0,S=y.isText||y.isTextblock,I=y.content.size>0;C&&S&&I&&f&&(u=Math.max(0,u-1)),r.replaceWith(u,d,g)}n.updateSelection&&hE(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:g}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:g})}return!0},C_=()=>({state:t,dispatch:e})=>Kx(t,e),S_=()=>({state:t,dispatch:e})=>Gx(t,e),w_=()=>({state:t,dispatch:e})=>my(t,e),x_=()=>({state:t,dispatch:e})=>Ey(t,e),A_=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Pc(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},__=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Pc(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},N_=()=>({state:t,dispatch:e})=>Wx(t,e),I_=()=>({state:t,dispatch:e})=>Yx(t,e);function fE(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function O_(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))Lo()||fE()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}var M_=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=O_(t).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,a))});return l?.steps.forEach(c=>{const u=c.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function Po(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?Xe(e,t.schema):null,a=[];t.doc.nodesBetween(r,i,(d,h)=>{if(d.isText)return;const f=Math.max(r,h),p=Math.min(i,h+d.nodeSize);a.push({node:d,from:f,to:p})});const l=i-r,c=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>Ll(d.node.attrs,n,{strict:!1}));return s?!!c.length:c.reduce((d,h)=>d+h.to-h.from,0)>=l}var v_=(t,e={})=>({state:n,dispatch:r})=>{const i=Xe(t,n.schema);return Po(n,i,e)?Qx(n,r):!1},D_=()=>({state:t,dispatch:e})=>Sy(t,e),L_=t=>({state:e,dispatch:n})=>{const r=Xe(t,e.schema);return lA(r)(e,n)},R_=()=>({state:t,dispatch:e})=>Ty(t,e);function qc(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function xg(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}var P_=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=qc(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(s=Xe(t,r.schema)),a==="mark"&&(o=ar(t,r.schema));let l=!1;return n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,d)=>{s&&s===u.type&&(l=!0,i&&n.setNodeMarkup(d,void 0,xg(u.attrs,e))),o&&u.marks.length&&u.marks.forEach(h=>{o===h.type&&(l=!0,i&&n.addMark(d,d+u.nodeSize,o.create(xg(h.attrs,e))))})})}),l},B_=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),F_=()=>({tr:t,dispatch:e})=>{if(e){const n=new Ot(t.doc);t.setSelection(n)}return!0},H_=()=>({state:t,dispatch:e})=>by(t,e),U_=()=>({state:t,dispatch:e})=>ky(t,e),$_=()=>({state:t,dispatch:e})=>eA(t,e),z_=()=>({state:t,dispatch:e})=>rA(t,e),V_=()=>({state:t,dispatch:e})=>nA(t,e);function Rl(t,e,n={},r={}){return Ro(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var j_=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{const{doc:l}=s;if(r.preserveWhitespace!=="full"){const c=Rl(t,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return o&&s.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!n),!0}return o&&s.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},t,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function pE(t,e){const n=ar(e,t.schema),{from:r,to:i,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function Wc(t,e){const n=new Ef(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function q_(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Ag(t,e){const n=[];return t.descendants((r,i)=>{e(r)&&n.push({node:r,pos:i})}),n}function mE(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function W_(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Yc(t){return e=>W_(e.$from,t)}function Y(t,e,n){return t.config[e]===void 0&&t.parent?Y(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?Y(t.parent,e,n):null}):t.config[e]}function Hf(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=Y(e,"addExtensions",n);return r?[e,...Hf(r())]:e}).flat(10)}function Uf(t,e){const n=zt.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function gE(t){return typeof t=="function"}function Te(t,e=void 0,...n){return gE(t)?e?t.bind(e)(...n):t(...n):t}function Y_(t={}){return Object.keys(t).length===0&&t.constructor===Object}function gs(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function bE(t){const e=[],{nodeExtensions:n,markExtensions:r}=gs(t),i=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(c=>c.name!=="text").map(c=>c.name),a=r.map(c=>c.name),l=[...o,...a];return t.forEach(c=>{const u={name:c.name,options:c.options,storage:c.storage,extensions:i},d=Y(c,"addGlobalAttributes",u);if(!d)return;d().forEach(f=>{let p;Array.isArray(f.types)?p=f.types:f.types==="*"?p=l:f.types==="nodes"?p=o:f.types==="marks"?p=a:p=[],p.forEach(g=>{Object.entries(f.attributes).forEach(([b,y])=>{e.push({type:g,name:b,attribute:{...s,...y}})})})})}),i.forEach(c=>{const u={name:c.name,options:c.options,storage:c.storage},d=Y(c,"addAttributes",u);if(!d)return;const h=d();Object.entries(h).forEach(([f,p])=>{const g={...s,...p};typeof g?.default=="function"&&(g.default=g.default()),g?.isRequired&&g?.default===void 0&&delete g.default,e.push({type:c.name,name:f,attribute:g})})}),e}function K_(t){const e=[];let n="",r=!1,i=!1,s=0;const o=t.length;for(let a=0;a<o;a+=1){const l=t[a];if(l==="'"&&!i){r=!r,n+=l;continue}if(l==='"'&&!r){i=!i,n+=l;continue}if(!r&&!i){if(l==="("){s+=1,n+=l;continue}if(l===")"&&s>0){s-=1,n+=l;continue}if(l===";"&&s===0){e.push(n),n="";continue}}n+=l}return n&&e.push(n),e}function _g(t){const e=[],n=K_(t||""),r=n.length;for(let i=0;i<r;i+=1){const s=n[i],o=s.indexOf(":");if(o===-1)continue;const a=s.slice(0,o).trim(),l=s.slice(o+1).trim();a&&l&&e.push([a,l])}return e}function sn(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const a=s?String(s).split(" "):[],l=r[i]?r[i].split(" "):[],c=a.filter(u=>!l.includes(u));r[i]=[...l,...c].join(" ")}else if(i==="style"){const a=new Map([..._g(r[i]),..._g(s)]);r[i]=Array.from(a.entries()).map(([l,c])=>`${l}: ${c}`).join("; ")}else r[i]=s}),r},{})}function Pl(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>sn(n,r),{})}function G_(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Ng(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(n):G_(n.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...r,...i}}}}function Ig(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&Y_(n)?!1:n!=null))}function Og(t){var e,n;const r={};return!((e=t?.attribute)!=null&&e.isRequired)&&"default"in(t?.attribute||{})&&(r.default=t.attribute.default),((n=t?.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function yE(t,e){var n;const r=bE(t),{nodeExtensions:i,markExtensions:s}=gs(t),o=(n=i.find(c=>Y(c,"topNode")))==null?void 0:n.name,a=Object.fromEntries(i.map(c=>{const u=r.filter(y=>y.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((y,C)=>{const S=Y(C,"extendNodeSchema",d);return{...y,...S?S(c):{}}},{}),f=Ig({...h,content:Te(Y(c,"content",d)),marks:Te(Y(c,"marks",d)),group:Te(Y(c,"group",d)),inline:Te(Y(c,"inline",d)),atom:Te(Y(c,"atom",d)),selectable:Te(Y(c,"selectable",d)),draggable:Te(Y(c,"draggable",d)),code:Te(Y(c,"code",d)),whitespace:Te(Y(c,"whitespace",d)),linebreakReplacement:Te(Y(c,"linebreakReplacement",d)),defining:Te(Y(c,"defining",d)),isolating:Te(Y(c,"isolating",d)),attrs:Object.fromEntries(u.map(Og))}),p=Te(Y(c,"parseHTML",d));p&&(f.parseDOM=p.map(y=>Ng(y,u)));const g=Y(c,"renderHTML",d);g&&(f.toDOM=y=>g({node:y,HTMLAttributes:Pl(y,u)}));const b=Y(c,"renderText",d);return b&&(f.toText=b),[c.name,f]})),l=Object.fromEntries(s.map(c=>{const u=r.filter(b=>b.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((b,y)=>{const C=Y(y,"extendMarkSchema",d);return{...b,...C?C(c):{}}},{}),f=Ig({...h,inclusive:Te(Y(c,"inclusive",d)),excludes:Te(Y(c,"excludes",d)),group:Te(Y(c,"group",d)),spanning:Te(Y(c,"spanning",d)),code:Te(Y(c,"code",d)),attrs:Object.fromEntries(u.map(Og))}),p=Te(Y(c,"parseHTML",d));p&&(f.parseDOM=p.map(b=>Ng(b,u)));const g=Y(c,"renderHTML",d);return g&&(f.toDOM=b=>g({mark:b,HTMLAttributes:Pl(b,u)})),[c.name,f]}));return new K1({topNode:o,nodes:a,marks:l})}function Q_(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function co(t){return t.sort((n,r)=>{const i=Y(n,"priority")||100,s=Y(r,"priority")||100;return i>s?-1:i<s?1:0})}function $f(t){const e=co(Hf(t)),n=Q_(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function J_(t,e){const n=$f(t);return yE(n,e)}function EE(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
|
|
11
|
-
|
|
12
|
-
`,textSerializers:o={}}=n||{};let a="";return t.nodesBetween(r,i,(l,c,u,d)=>{var h;l.isBlock&&c>r&&(a+=s);const f=o?.[l.type.name];if(f)return u&&(a+=f({node:l,pos:c,parent:u,index:d,range:e})),!1;l.isText&&(a+=(h=l?.text)==null?void 0:h.slice(Math.max(r,c)-c,i-c))}),a}function X_(t,e){const n={from:0,to:t.content.size};return EE(t,n,e)}function kE(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function Z_(t,e){const n=Xe(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===n.name);return o?{...o.attrs}:{}}function TE(t,e){const n=qc(typeof e=="string"?e:e.name,t.schema);return n==="node"?Z_(t,e):n==="mark"?pE(t,e):{}}function eN(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function tN(t){const e=eN(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,o)=>o!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function zf(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=n[s];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const c=e.slice(s).map(a,-1),u=e.slice(s).map(l),d=e.invert().map(c,-1),h=e.invert().map(u);r.push({oldRange:{from:d,to:h},newRange:{from:c,to:u}})})}),tN(r)}function Vf(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),o=jc(s,i.type);o&&r.push({mark:i,...o})}):n.nodesBetween(t,e,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}function js(t,e){return e.nodes[t]||e.marks[t]||null}function sl(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}var nN=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,a)=>{var l,c;const u=((c=(l=i.type.spec).toText)==null?void 0:c.call(l,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,r-s))}),n};function sh(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?ar(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>Ll(d.attrs,n,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:d,$to:h})=>{const f=d.pos,p=h.pos;t.doc.nodesBetween(f,p,(g,b)=>{if(s&&g.inlineContent&&!g.type.allowsMarkType(s))return!1;if(!g.isText&&!g.marks.length)return;const y=Math.max(f,b),C=Math.min(p,b+g.nodeSize),S=C-y;o+=S,a.push(...g.marks.map(I=>({mark:I,from:y,to:C})))})}),o===0)return!1;const l=a.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>Ll(d.mark.attrs,n,{strict:!1})).reduce((d,h)=>d+h.to-h.from,0),c=a.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,h)=>d+h.to-h.from,0);return(l>0?l+c:l)>=o}function rN(t,e,n={}){if(!e)return Po(t,null,n)||sh(t,null,n);const r=qc(e,t.schema);return r==="node"?Po(t,e,n):r==="mark"?sh(t,e,n):!1}function Mg(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function ju(t,e){const{nodeExtensions:n}=gs(e),r=n.find(o=>o.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=Te(Y(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function jf(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return!/\S/.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(s=>{i!==!1&&(jf(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function iN(t){return t instanceof W}function Nj({selection:t,pos:e,nodeSize:n,selectedOnTextSelection:r=!1}){const{from:i,to:s}=t;return!!(i<=e&&s>=e+n||r&&Ff(t)&&i>e&&s<e+n)}var CE=class SE{constructor(e){this.position=e}static fromJSON(e){return new SE(e.position)}toJSON(){return{position:this.position}}};function sN(t,e){const n=e.mapping.mapResult(t.position);return{position:new CE(n.pos),mapResult:n}}function oN(t){return new CE(t)}function wE(t,e,n){const i=t.state.doc.content.size,s=nr(e,0,i),o=nr(n,0,i),a=t.coordsAtPos(s),l=t.coordsAtPos(o,-1),c=Math.min(a.top,l.top),u=Math.max(a.bottom,l.bottom),d=Math.min(a.left,l.left),h=Math.max(a.right,l.right),f=h-d,p=u-c,y={top:c,bottom:u,left:d,right:h,width:f,height:p,x:d,y:c};return{...y,toJSON:()=>y}}function aN(t,e,n){var r;const{selection:i}=e;let s=null;if(Ff(i)&&(s=i.$cursor),s){const a=(r=t.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(n)&&(!!n.isInSet(a)||!a.some(c=>c.type.excludes(n)))}const{ranges:o}=i;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(u,d,h)=>{if(c)return!1;if(u.isInline){const f=!h||h.type.allowsMarkType(n),p=!!n.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(n));c=f&&p}return!c}),c})}var lN=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:a}=s,l=ar(t,r.schema);if(i)if(o){const c=pE(r,l);n.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(h,f)=>{const p=Math.max(f,u),g=Math.min(f+h.nodeSize,d);h.marks.find(y=>y.type===l)?h.marks.forEach(y=>{l===y.type&&n.addMark(p,g,l.create({...y.attrs,...e}))}):n.addMark(p,g,l.create(e))})});return aN(r,n,l)},cN=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),uN=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=Xe(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:a})=>jm(s,{...o,...e})(n)?!0:a.clearNodes()).command(({state:a})=>jm(s,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},dN=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=nr(t,0,r.content.size),s=W.create(r,i);e.setSelection(s)}return!0},hN=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=r;let o,a;return typeof e=="number"?(o=e,a=e):e&&"from"in e&&"to"in e?(o=e.from,a=e.to):(o=s.from,a=s.to),i&&n.doc.nodesBetween(o,a,(l,c)=>{l.isText||n.setNodeMarkup(c,void 0,{...l.attrs,dir:t})}),!0},fN=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,o=j.atStart(r).from,a=j.atEnd(r).to,l=nr(i,o,a),c=nr(s,o,a),u=j.create(r,l,c);e.setSelection(u)}return!0},pN=t=>({state:e,dispatch:n})=>{const r=Xe(t,e.schema);return dA(r)(e,n)};function vg(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}var mN=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,c=i.extensionManager.attributes,u=sl(c,a.node().type.name,a.node().attrs);if(s instanceof W&&s.node.isBlock)return!a.parentOffset||!rr(o,a.pos)?!1:(r&&(t&&vg(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,h=a.depth===0?void 0:q_(a.node(-1).contentMatchAt(a.indexAfter(-1)));let f=d&&h?[{type:h,attrs:u}]:void 0,p=rr(e.doc,e.mapping.map(a.pos),1,f);if(!f&&!p&&rr(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(p=!0,f=h?[{type:h,attrs:u}]:void 0),r){if(p&&(s instanceof j&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,f),h&&!d&&!a.parentOffset&&a.parent.type!==h)){const g=e.mapping.map(a.before()),b=e.doc.resolve(g);a.node(-1).canReplaceWith(b.index(),b.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}t&&vg(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},gN=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var o;const a=Xe(t,r.schema),{$from:l,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const d=l.node(-1);if(d.type!==a)return!1;const h=s.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let y=v.empty;const C=l.index(-1)?1:l.index(-2)?2:3;for(let z=l.depth-C;z>=l.depth-3;z-=1)y=v.from(l.node(z).copy(y));const S=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,I={...sl(h,l.node().type.name,l.node().attrs),...e},M=((o=a.contentMatch.defaultType)==null?void 0:o.createAndFill(I))||void 0;y=y.append(v.from(a.createAndFill(null,M)||void 0));const A=l.before(l.depth-(C-1));n.replace(A,l.after(-S),new F(y,4-C,0));let D=-1;n.doc.nodesBetween(A,n.doc.content.size,(z,V)=>{if(D>-1)return!1;z.isTextblock&&z.content.size===0&&(D=V+1)}),D>-1&&n.setSelection(j.near(n.doc.resolve(D))),n.scrollIntoView()}return!0}const f=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,p={...sl(h,d.type.name,d.attrs),...e},g={...sl(h,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,c.pos);const b=f?[{type:a,attrs:p},{type:f,attrs:g}]:[{type:a,attrs:p}];if(!rr(n.doc,l.pos,2))return!1;if(i){const{selection:y,storedMarks:C}=r,{splittableMarks:S}=s.extensionManager,I=C||y.$to.parentOffset&&y.$from.marks();if(n.split(l.pos,2,b).scrollIntoView(),!I||!i)return!0;const M=I.filter(A=>S.includes(A.type.name));n.ensureMarks(M)}return!0},qu=(t,e)=>{const n=Yc(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&Ni(t.doc,n.pos)&&t.join(n.pos),!0},Wu=(t,e)=>{const n=Yc(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&Ni(t.doc,r)&&t.join(r),!0};function bN(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),i=e.resolve(n.nodeSize-1);return j.between(r,i)}var yN=(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:h}=i.extensionManager,f=Xe(t,o.schema),p=Xe(e,o.schema),{selection:g,storedMarks:b}=o,{$from:y,$to:C}=g,S=y.blockRange(C),I=b||g.$to.parentOffset&&g.$from.marks();if(!S)return!1;const M=Yc(J=>ju(J.type.name,d))(g),A=g.from===0&&g.to===o.doc.content.size,D=o.doc.content.content,z=D.length===1?D[0]:null,V=A&&z&&ju(z.type.name,d)?{node:z,pos:0}:null,_=M??V,U=!!M&&S.depth>=1&&S.depth-M.depth<=1,q=!!V;if((U||q)&&_){if(_.node.type===f)return A&&q?l().command(({tr:J,dispatch:ee})=>{const K=bN(J);return K?(J.setSelection(K),ee&&ee(J),!0):!1}).liftListItem(p).run():c.liftListItem(p);if(ju(_.node.type.name,d)&&f.validContent(_.node.content))return l().command(()=>(s.setNodeMarkup(_.pos,f),!0)).command(()=>qu(s,f)).command(()=>Wu(s,f)).run()}return!n||!I||!a?l().command(()=>u().wrapInList(f,r)?!0:c.clearNodes()).wrapInList(f,r).command(()=>qu(s,f)).command(()=>Wu(s,f)).run():l().command(()=>{const J=u().wrapInList(f,r),ee=I.filter(K=>h.includes(K.type.name));return s.ensureMarks(ee),J?!0:c.clearNodes()}).wrapInList(f,r).command(()=>qu(s,f)).command(()=>Wu(s,f)).run()},EN=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=ar(t,r.schema);return sh(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},kN=(t,e,n={})=>({state:r,commands:i})=>{const s=Xe(t,r.schema),o=Xe(e,r.schema),a=Po(r,s,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?i.setNode(o,l):i.setNode(s,{...l,...n})},TN=(t,e={})=>({state:n,commands:r})=>{const i=Xe(t,n.schema);return Po(n,i,e)?r.lift(i):r.wrapIn(i,e)},CN=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const o=t.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},SN=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},wN=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=n,l=ar(t,r.schema),{$from:c,empty:u,ranges:d}=a;if(!i)return!0;if(u&&o){let{from:h,to:f}=a;const p=(s=c.marks().find(b=>b.type===l))==null?void 0:s.attrs,g=jc(c,l,p);g&&(h=g.from,f=g.to),n.removeMark(h,f,l)}else d.forEach(h=>{n.removeMark(h.$from.pos,h.$to.pos,l)});return n.removeStoredMark(l),!0},xN=t=>({tr:e,state:n,dispatch:r})=>{const{selection:i}=n;let s,o;return typeof t=="number"?(s=t,o=t):t&&"from"in t&&"to"in t?(s=t.from,o=t.to):(s=i.from,o=i.to),r&&e.doc.nodesBetween(s,o,(a,l)=>{if(a.isText)return;const c={...a.attrs};delete c.dir,e.setNodeMarkup(l,void 0,c)}),!0},AN=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=qc(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(s=Xe(t,r.schema)),a==="mark"&&(o=ar(t,r.schema));let l=!1;return n.selection.ranges.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;let h,f,p,g;n.selection.empty?r.doc.nodesBetween(u,d,(b,y)=>{s&&s===b.type&&(l=!0,p=Math.max(y,u),g=Math.min(y+b.nodeSize,d),h=y,f=b)}):r.doc.nodesBetween(u,d,(b,y)=>{y<u&&s&&s===b.type&&(l=!0,p=Math.max(y,u),g=Math.min(y+b.nodeSize,d),h=y,f=b),y>=u&&y<=d&&(s&&s===b.type&&(l=!0,i&&n.setNodeMarkup(y,void 0,{...b.attrs,...e})),o&&b.marks.length&&b.marks.forEach(C=>{if(o===C.type&&(l=!0,i)){const S=Math.max(y,u),I=Math.min(y+b.nodeSize,d);n.addMark(S,I,o.create({...C.attrs,...e}))}}))}),f&&(h!==void 0&&i&&n.setNodeMarkup(h,void 0,{...f.attrs,...e}),o&&f.marks.length&&f.marks.forEach(b=>{o===b.type&&i&&n.addMark(p,g,o.create({...b.attrs,...e}))}))}),l},_N=(t,e={})=>({state:n,dispatch:r})=>{const i=Xe(t,n.schema);return iA(i,e)(n,r)},NN=(t,e={})=>({state:n,dispatch:r})=>{const i=Xe(t,n.schema);return sA(i,e)(n,r)},IN=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},ON=class{constructor(e){var n;this.find=e.find,this.handler=e.handler,this.undoable=(n=e.undoable)!=null?n:!0}},MN=(t,e)=>{if(Bf(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function Ia(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let u=!1;const d=nN(c)+s;return o.forEach(h=>{if(u)return;const f=MN(d,h.find);if(!f)return;const p=l.state.tr,g=zc({state:l.state,transaction:p}),b={from:r-(f[0].length-s.length),to:i},{commands:y,chain:C,can:S}=new Vc({editor:n,state:g});h.handler({state:g,range:b,match:f,commands:y,chain:C,can:S})===null||!p.steps.length||(h.undoable&&p.setMeta(a,{transform:p,from:r,to:i,text:s}),l.dispatch(p),u=!0)}),u}function vN(t){const{editor:e,rules:n}=t,r=new re({state:{init(){return null},apply(i,s,o){const a=i.getMeta(r);if(a)return a;const l=i.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=Uf(v.from(u),o.schema);const{from:d}=l,h=d+u.length;Ia({editor:e,from:d,to:h,text:u,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return Ia({editor:e,from:s,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Ia({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?Ia({editor:e,from:o.pos,to:o.pos,text:`
|
|
13
|
-
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function DN(t){return Object.prototype.toString.call(t).slice(8,-1)}function Oa(t){return DN(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function xE(t,e){const n={...t};return Oa(t)&&Oa(e)&&Object.keys(e).forEach(r=>{Oa(e[r])&&Oa(t[r])?n[r]=xE(t[r],e[r]):n[r]=e[r]}),n}var qf=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...Te(Y(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Te(Y(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>xE(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Tn=class AE extends qf{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new AE(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(c=>c?.type.name===n.name))return!1;const l=o.find(c=>c?.type.name===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function LN(t){return typeof t=="number"}var RN=class{constructor(t){this.find=t.find,this.handler=t.handler}},PN=(t,e,n)=>{if(Bf(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=t,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function BN(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:a}=t,{commands:l,chain:c,can:u}=new Vc({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,i,(f,p)=>{var g,b,y,C,S;if((b=(g=f.type)==null?void 0:g.spec)!=null&&b.code||!(f.isText||f.isTextblock||f.isInline))return;const I=(S=(C=(y=f.content)==null?void 0:y.size)!=null?C:f.nodeSize)!=null?S:0,M=Math.max(r,p),A=Math.min(i,p+I);if(M>=A)return;const D=f.isText?f.text||"":f.textBetween(M-p,A-p,void 0,"");PN(D,s.find,o).forEach(V=>{if(V.index===void 0)return;const _=M+V.index+1,U=_+V[0].length,q={from:n.tr.mapping.map(_),to:n.tr.mapping.map(U)},J=s.handler({state:n,range:q,match:V,commands:l,chain:c,can:u,pasteEvent:o,dropEvent:a});d.push(J)})}),d.every(f=>f!==null)}var Ma=null,FN=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function HN(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:d,to:h,rule:f,pasteEvt:p})=>{const g=u.tr,b=zc({state:u,transaction:g});if(!(!BN({editor:e,state:b,from:Math.max(d-1,0),to:h.b-1,rule:f,pasteEvent:p,dropEvent:a})||!g.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return n.map(u=>new re({view(d){const h=p=>{var g;r=(g=d.dom.parentElement)!=null&&g.contains(p.target)?d.dom.parentElement:null,r&&(Ma=e)},f=()=>{Ma&&(Ma=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(d,h)=>{if(s=r===d.dom.parentElement,a=h,!s){const f=Ma;f?.isEditable&&setTimeout(()=>{const p=f.state.selection;p&&f.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,h)=>{var f;const p=(f=h.clipboardData)==null?void 0:f.getData("text/html");return o=h,i=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(d,h,f)=>{const p=d[0],g=p.getMeta("uiEvent")==="paste"&&!i,b=p.getMeta("uiEvent")==="drop"&&!s,y=p.getMeta("applyPasteRules"),C=!!y;if(!g&&!b&&!C)return;if(C){let{text:M}=y;typeof M=="string"?M=M:M=Uf(v.from(M),f.schema);const{from:A}=y,D=A+M.length,z=FN(M);return l({rule:u,state:f,from:A,to:{b:D},pasteEvt:z})}const S=h.doc.content.findDiffStart(f.doc.content),I=h.doc.content.findDiffEnd(f.doc.content);if(!(!LN(S)||!I||S===I.b))return l({rule:u,state:f,from:S,to:I,pasteEvt:o})}}))}var Kc=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=$f(t),this.schema=yE(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:js(e.name,this.schema)},r=Y(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return co([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:js(r.name,this.schema)},s=[],o=Y(r,"addKeyboardShortcuts",i);let a={};if(r.type==="mark"&&Y(r,"exitable",i)&&(a.ArrowRight=()=>Tn.handleExit({editor:t,mark:r})),o){const h=Object.fromEntries(Object.entries(o()).map(([f,p])=>[f,()=>p({editor:t})]));a={...a,...h}}const l=aE(a);s.push(l);const c=Y(r,"addInputRules",i);if(Mg(r,t.options.enableInputRules)&&c){const h=c();if(h&&h.length){const f=vN({editor:t,rules:h}),p=Array.isArray(f)?f:[f];s.push(...p)}}const u=Y(r,"addPasteRules",i);if(Mg(r,t.options.enablePasteRules)&&u){const h=u();if(h&&h.length){const f=HN({editor:t,rules:h});s.push(...f)}}const d=Y(r,"addProseMirrorPlugins",i);if(d){const h=d();s.push(...h)}return s})}get attributes(){return bE(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=gs(this.extensions);return Object.fromEntries(e.filter(n=>!!Y(n,"addNodeView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Xe(n.name,this.schema)},s=Y(n,"addNodeView",i);if(!s)return[];const o=s();if(!o)return[];const a=(l,c,u,d,h)=>{const f=Pl(l,r);return o({node:l,view:c,getPos:u,decorations:d,innerDecorations:h,editor:t,extension:n,HTMLAttributes:f})};return[n.name,a]}))}dispatchTransaction(t){const{editor:e}=this;return co([...this.extensions].reverse()).reduceRight((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:js(i.name,this.schema)},o=Y(i,"dispatchTransaction",s);return o?a=>{o.call(s,{transaction:a,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return co([...this.extensions]).reduce((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:js(i.name,this.schema)},o=Y(i,"transformPastedHTML",s);return o?(a,l)=>{const c=r(a,l);return o.call(s,c)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=gs(this.extensions);return Object.fromEntries(e.filter(n=>!!Y(n,"addMarkView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ar(n.name,this.schema)},s=Y(n,"addMarkView",i);if(!s)return[];const o=(a,l,c)=>{const u=Pl(a,r);return s()({mark:a,view:l,inline:c,editor:t,extension:n,HTMLAttributes:u,updateAttributes:d=>{XN(a,t,d)}})};return[n.name,o]}))}destroy(){this.extensions.forEach(t=>{let e=t;for(;e.parent;){const n=e.parent;n.child===e&&(n.child=null),e=n}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:js(e.name,this.schema)};e.type==="mark"&&((n=Te(Y(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const i=Y(e,"onBeforeCreate",r),s=Y(e,"onCreate",r),o=Y(e,"onUpdate",r),a=Y(e,"onSelectionUpdate",r),l=Y(e,"onTransaction",r),c=Y(e,"onFocus",r),u=Y(e,"onBlur",r),d=Y(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}};Kc.resolve=$f;Kc.sort=co;Kc.flatten=Hf;var Wi={};Pf(Wi,{ClipboardTextSerializer:()=>NE,Commands:()=>IE,Delete:()=>OE,Drop:()=>ME,Editable:()=>vE,FocusEvents:()=>LE,Keymap:()=>RE,Paste:()=>PE,Tabindex:()=>BE,TextDirection:()=>FE,focusEventsPluginKey:()=>DE});var De=class _E extends qf{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new _E(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},NE=De.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new re({key:new me("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(u=>u.$from.pos)),a=Math.max(...s.map(u=>u.$to.pos)),l=kE(n);return EE(r,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),IE=De.create({name:"commands",addCommands(){return{...lE}}}),OE=De.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,i;const s=()=>{var o,a,l,c;if((c=(l=(a=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,t))!=null?c:t.getMeta("y-sync$"))return;const u=Wc(t.before,[t,...e]);zf(u).forEach(f=>{u.mapping.mapResult(f.oldRange.from).deletedAfter&&u.mapping.mapResult(f.oldRange.to).deletedBefore&&u.before.nodesBetween(f.oldRange.from,f.oldRange.to,(p,g)=>{const b=g+p.nodeSize-2,y=f.oldRange.from<=g&&b<=f.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:g,to:b,newFrom:u.mapping.map(g),newTo:u.mapping.map(b),deletedRange:f.oldRange,newRange:f.newRange,partial:!y,editor:this.editor,transaction:t,combinedTransform:u})})});const h=u.mapping;u.steps.forEach((f,p)=>{var g,b;if(f instanceof fn){const y=h.slice(p).map(f.from,-1),C=h.slice(p).map(f.to),S=h.invert().map(y,-1),I=h.invert().map(C),M=y>0?(g=u.doc.nodeAt(y-1))==null?void 0:g.marks.some(D=>D.eq(f.mark)):!1,A=(b=u.doc.nodeAt(C))==null?void 0:b.marks.some(D=>D.eq(f.mark));this.editor.emit("delete",{type:"mark",mark:f.mark,from:f.from,to:f.to,deletedRange:{from:S,to:I},newRange:{from:y,to:C},partial:!!(A||M),editor:this.editor,transaction:t,combinedTransform:u})}})};(i=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||i?setTimeout(s,0):s()}}),ME=De.create({name:"drop",addProseMirrorPlugins(){return[new re({key:new me("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),vE=De.create({name:"editable",addProseMirrorPlugins(){return[new re({key:new me("editable"),props:{editable:()=>this.editor.options.editable}})]}}),DE=new me("focusEvents"),LE=De.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new re({key:DE,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),RE=De.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:d}=l,{pos:h,parent:f}=d,p=d.parent.isTextblock&&h>0?a.doc.resolve(h-1):d,g=p.parent.type.spec.isolating,b=d.pos-d.parentOffset,y=g&&p.parent.childCount===1?b===d.pos:Q.atStart(c).from===h;return!u||!f.type.isTextblock||f.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Lo()||fE()?s:i},addProseMirrorPlugins(){return[new re({key:new me("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(g=>g.getMeta("composition")))return;const r=t.some(g=>g.docChanged)&&!e.doc.eq(n.doc),i=t.some(g=>g.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:a}=e.selection,l=Q.atStart(e.doc).from,c=Q.atEnd(e.doc).to;if(s||!(o===l&&a===c)||!jf(n.doc))return;const h=n.tr,f=zc({state:n,transaction:h}),{commands:p}=new Vc({editor:this.editor,state:f});if(p.clearNodes(),!!h.steps.length)return h}})]}}),PE=De.create({name:"paste",addProseMirrorPlugins(){return[new re({key:new me("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),BE=De.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new re({key:new me("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!=null?t:"0"}}}})]}}),FE=De.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=gs(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new re({key:new me("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),UN=class to{constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}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(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},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?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new to(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new to(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new to(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,o=n.isInline,a=this.pos+r+(s?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!i&&!o&&l.depth<=this.depth)return;const c=new to(l,this.editor,i,i||o?n:null);i&&(c.actualDepth=this.depth+1),e.push(c)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,o=Object.keys(n);for(let a=0;a<o.length;a+=1){const l=o[a];if(s[l]!==n[l])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(l=>n[l]===o.node.attrs[l])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},$N=`.ProseMirror {
|
|
14
|
-
position: relative;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.ProseMirror {
|
|
18
|
-
word-wrap: break-word;
|
|
19
|
-
white-space: pre-wrap;
|
|
20
|
-
white-space: break-spaces;
|
|
21
|
-
-webkit-font-variant-ligatures: none;
|
|
22
|
-
font-variant-ligatures: none;
|
|
23
|
-
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.ProseMirror [contenteditable="false"] {
|
|
27
|
-
white-space: normal;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
31
|
-
white-space: pre-wrap;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.ProseMirror pre {
|
|
35
|
-
white-space: pre-wrap;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
img.ProseMirror-separator {
|
|
39
|
-
display: inline !important;
|
|
40
|
-
border: none !important;
|
|
41
|
-
margin: 0 !important;
|
|
42
|
-
width: 0 !important;
|
|
43
|
-
height: 0 !important;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.ProseMirror-gapcursor {
|
|
47
|
-
display: none;
|
|
48
|
-
pointer-events: none;
|
|
49
|
-
position: absolute;
|
|
50
|
-
margin: 0;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.ProseMirror-gapcursor:after {
|
|
54
|
-
content: "";
|
|
55
|
-
display: block;
|
|
56
|
-
position: absolute;
|
|
57
|
-
top: -2px;
|
|
58
|
-
width: 20px;
|
|
59
|
-
border-top: 1px solid black;
|
|
60
|
-
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
@keyframes ProseMirror-cursor-blink {
|
|
64
|
-
to {
|
|
65
|
-
visibility: hidden;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.ProseMirror-hideselection *::selection {
|
|
70
|
-
background: transparent;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.ProseMirror-hideselection *::-moz-selection {
|
|
74
|
-
background: transparent;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.ProseMirror-hideselection * {
|
|
78
|
-
caret-color: transparent;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
82
|
-
display: block;
|
|
83
|
-
}`;function zN(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}var VN=class extends IN{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:sN,createMappablePosition:oN},this.setOptions(t),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:r,slice:i,moved:s})=>this.options.onDrop(r,i,s)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=uE(e,this.options.autofocus);this.editorState=Gi.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t?.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=zN($N,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&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:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=gE(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;n=n.filter(o=>!o.key.startsWith(s))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e,n,r;const s=[...this.options.enableCoreExtensions?[vE,NE.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),IE,LE,RE,BE.configure({value:(r=(n=this.options.coreExtensionOptions)==null?void 0:n.tabindex)==null?void 0:r.value}),ME,PE,OE,FE.configure({direction:this.options.textDirection})].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o?.type));this.extensionManager=new Kc(s,this)}createCommandManager(){this.commandManager=new Vc({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Rl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=Rl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,s=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(s);this.editorView=new oE(t,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS();const l=this.view.dom;l.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(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(c=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(c)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),i=n.includes(t),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=o?.getMeta("focus"),l=o?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return TE(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return rN(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Uf(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
|
|
84
|
-
|
|
85
|
-
`,textSerializers:n={}}=t||{};return X_(this.state.doc,{blockSeparator:e,textSerializers:{...kE(this.schema),...n}})}get isEmpty(){return jf(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 t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t),n=t>0&&e.nodeAfter&&!e.nodeAfter.isText?e.nodeAfter:null;return new UN(e,this,!1,n)}get $doc(){return this.$pos(0)}};function bs(t){return new ON({find:t.find,handler:({state:e,range:n,match:r})=>{const i=Te(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),c=n.from+a.indexOf(o),u=c+o.length;if(Vf(n.from,n.to,e.doc).filter(f=>f.mark.type.excluded.find(g=>g===t.type&&g!==f.mark.type)).filter(f=>f.to>c).length)return null;u<n.to&&s.delete(u,n.to),c>n.from&&s.delete(n.from+l,c);const h=n.from+l+o.length;s.addMark(n.from+l,h,t.type.create(i||{})),s.removeStoredMark(t.type)}},undoable:t.undoable})}var jN={};Pf(jN,{createAtomBlockMarkdownSpec:()=>qN,createBlockMarkdownSpec:()=>WN,createInlineMarkdownSpec:()=>GN,parseAttributes:()=>Wf,parseIndentedBlocks:()=>QN,renderNestedMarkdownContent:()=>JN,serializeAttributes:()=>Yf});function Wf(t){if(!t?.trim())return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,c=>(n.push(c),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const c=i.map(u=>u.trim().slice(1));e.class=c.join(" ")}const s=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,c,u])=>{var d;const h=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),f=n[h];f&&(e[c]=f.slice(1,-1))});const l=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 l&&l.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function Yf(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function qN(t){const{nodeName:e,name:n,parseAttributes:r=Wf,serializeAttributes:i=Yf,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:a}=t,l=n||e,c=u=>{if(!a)return u;const d={};return a.forEach(h=>{h in u&&(d[h]=u[h])}),d};return{parseMarkdown:(u,d)=>{const h={...s,...u.attributes};return d.createNode(e,h,[])},markdownTokenizer:{name:e,level:"block",start(u){var d;const h=new RegExp(`^:::${l}(?:\\s|$)`,"m"),f=(d=u.match(h))==null?void 0:d.index;return f!==void 0?f:-1},tokenize(u,d,h){const f=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=u.match(f);if(!p)return;const g=p[1]||"",b=r(g);if(!o.find(C=>!(C in b)))return{type:e,raw:p[0],attributes:b}}},renderMarkdown:u=>{const d=c(u.attrs||{}),h=i(d),f=h?` {${h}}`:"";return`:::${l}${f} :::`}}}function WN(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=Wf,serializeAttributes:s=Yf,defaultAttributes:o={},content:a="block",allowedAttributes:l}=t,c=n||e,u=d=>{if(!l)return d;const h={};return l.forEach(f=>{f in d&&(h[f]=d[f])}),h};return{parseMarkdown:(d,h)=>{let f;if(r){const g=r(d);f=typeof g=="string"?[{type:"text",text:g}]:g}else a==="block"?f=h.parseChildren(d.tokens||[]):f=h.parseInline(d.tokens||[]);const p={...o,...d.attributes};return h.createNode(e,p,f)},markdownTokenizer:{name:e,level:"block",start(d){var h;const f=new RegExp(`^:::${c}`,"m"),p=(h=d.match(f))==null?void 0:h.index;return p!==void 0?p:-1},tokenize(d,h,f){var p;const g=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),b=d.match(g);if(!b)return;const[y,C=""]=b,S=i(C);let I=1;const M=y.length;let A="";const D=/^:::([\w-]*)(\s.*)?/gm,z=d.slice(M);for(D.lastIndex=0;;){const V=D.exec(z);if(V===null)break;const _=V.index,U=V[1];if(!((p=V[2])!=null&&p.endsWith(":::"))){if(U)I+=1;else if(I-=1,I===0){const q=z.slice(0,_);A=q.trim();const J=d.slice(0,M+_+V[0].length);let ee=[];if(A)if(a==="block")for(ee=f.blockTokens(q),ee.forEach(K=>{K.text&&(!K.tokens||K.tokens.length===0)&&(K.tokens=f.inlineTokens(K.text))});ee.length>0;){const K=ee[ee.length-1];if(K.type==="paragraph"&&(!K.text||K.text.trim()===""))ee.pop();else break}else ee=f.inlineTokens(A);return{type:e,raw:J,attributes:S,content:A,tokens:ee}}}}}},renderMarkdown:(d,h)=>{const f=u(d.attrs||{}),p=s(f),g=p?` {${p}}`:"",b=h.renderChildren(d.content||[],`
|
|
86
|
-
|
|
87
|
-
`);return`:::${c}${g}
|
|
88
|
-
|
|
89
|
-
${b}
|
|
90
|
-
|
|
91
|
-
:::`}}}function YN(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,i,s,o]=r;e[i]=s||o,r=n.exec(t)}return e}function KN(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function GN(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=YN,serializeAttributes:s=KN,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:l}=t,c=n||e,u=h=>{if(!l)return h;const f={};return l.forEach(p=>{const g=typeof p=="string"?p:p.name,b=typeof p=="string"?void 0:p.skipIfDefault;if(g in h){const y=h[g];if(b!==void 0&&y===b)return;f[g]=y}}),f},d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,f)=>{const p={...o,...h.attributes};if(a)return f.createNode(e,p);const g=r?r(h):h.content||"";return g?f.createNode(e,p,[f.createTextNode(g)]):f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"inline",start(h){const f=a?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),p=h.match(f),g=p?.index;return g!==void 0?g:-1},tokenize(h,f,p){const g=a?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),b=h.match(g);if(!b)return;let y="",C="";if(a){const[,I]=b;C=I}else{const[,I,M]=b;C=I,y=M||""}const S=i(C.trim());return{type:e,raw:b[0],content:y.trim(),attributes:S}}},renderMarkdown:h=>{let f="";r?f=r(h):h.content&&h.content.length>0&&(f=h.content.filter(y=>y.type==="text").map(y=>y.text).join(""));const p=u(h.attrs||{}),g=s(p),b=g?` ${g}`:"";return a?`[${c}${b}]`:`[${c}${b}]${f}[/${c}]`}}}function QN(t,e,n){var r,i,s,o;const a=t.split(`
|
|
92
|
-
`),l=[];let c="",u=0;const d=e.baseIndentSize||2;for(;u<a.length;){const h=a[u],f=h.match(e.itemPattern);if(!f){if(l.length>0)break;if(h.trim()===""){u+=1,c=`${c}${h}
|
|
93
|
-
`;continue}else return}const p=e.extractItemData(f),{indentLevel:g,mainContent:b}=p;c=`${c}${h}
|
|
94
|
-
`;const y=[b];for(u+=1;u<a.length;){const M=a[u];if(M.trim()===""){const D=a.slice(u+1).findIndex(_=>_.trim()!=="");if(D===-1)break;if((((i=(r=a[u+1+D].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>g){y.push(M),c=`${c}${M}
|
|
95
|
-
`,u+=1;continue}else break}if((((o=(s=M.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:o.length)||0)>g)y.push(M),c=`${c}${M}
|
|
96
|
-
`,u+=1;else break}let C;const S=y.slice(1);if(S.length>0){const M=S.map(A=>A.slice(g+d)).join(`
|
|
97
|
-
`);M.trim()&&(e.customNestedParser?C=e.customNestedParser(M):C=n.blockTokens(M))}const I=e.createToken(p,C);l.push(I)}if(l.length!==0)return{items:l,raw:c}}function JN(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const i=typeof n=="function"?n(r):n,[s,...o]=t.content,a=e.renderChildren([s]);let l=`${i}${a}`;return o&&o.length>0&&o.forEach((c,u)=>{var d,h;const f=(h=(d=e.renderChild)==null?void 0:d.call(e,c,u+1))!=null?h:e.renderChildren([c]);if(f!=null){const p=f.split(`
|
|
98
|
-
`).map(g=>g?e.indent(g):e.indent("")).join(`
|
|
99
|
-
`);l+=c.type==="paragraph"?`
|
|
100
|
-
|
|
101
|
-
${p}`:`
|
|
102
|
-
${p}`}}),l}function XN(t,e,n={}){const{state:r}=e,{doc:i,tr:s}=r,o=t;i.descendants((a,l)=>{const c=s.mapping.map(l),u=s.mapping.map(l)+a.nodeSize;let d=null;if(a.marks.forEach(f=>{if(f!==o)return!1;d=f}),!d)return;let h=!1;if(Object.keys(n).forEach(f=>{n[f]!==d.attrs[f]&&(h=!0)}),h){const f=t.type.create({...t.attrs,...n});s.removeMark(c,u,t.type),s.addMark(c,u,f)}}),s.docChanged&&e.view.dispatch(s)}var Cn=class HE extends qf{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new HE(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},Oj=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var e,n,r,i,s,o,a;const{view:l}=this.editor,c=t.target,u=c.nodeType===3?(e=c.parentElement)==null?void 0:e.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(n=this.contentDOM)!=null&&n.contains(c)||!u)return;let d=0,h=0;if(this.dom!==u){const C=this.dom.getBoundingClientRect(),S=u.getBoundingClientRect(),I=(i=t.offsetX)!=null?i:(r=t.nativeEvent)==null?void 0:r.offsetX,M=(o=t.offsetY)!=null?o:(s=t.nativeEvent)==null?void 0:s.offsetY;d=S.x-C.x+I,h=S.y-C.y+M}const f=this.dom.cloneNode(!0);try{const C=this.dom.getBoundingClientRect();f.style.width=`${Math.round(C.width)}px`,f.style.height=`${Math.round(C.height)}px`,f.style.boxSizing="border-box",f.style.pointerEvents="none"}catch{}let p=null;try{p=document.createElement("div"),p.style.position="absolute",p.style.top="-9999px",p.style.left="-9999px",p.style.pointerEvents="none",p.appendChild(f),document.body.appendChild(p),(a=t.dataTransfer)==null||a.setDragImage(f,d,h)}finally{p&&setTimeout(()=>{try{p?.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const b=W.create(l.state.doc,g),y=l.state.tr.setSelection(b);l.dispatch(y)}stopEvent(t){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const n=t.target;if(!(this.dom.contains(n)&&!((e=this.contentDOM)!=null&&e.contains(n))))return!1;const i=t.type.startsWith("drag"),s=t.type==="dragover"||t.type==="dragenter",o=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!o&&!i)return!0;const{isEditable:l}=this.editor,{isDragging:c}=this,u=!!this.node.type.spec.draggable,d=W.isSelectable(this.node),h=t.type==="copy",f=t.type==="paste",p=t.type==="cut",g=t.type==="mousedown";if(!u&&d&&i&&t.target===this.dom&&t.preventDefault(),u&&i&&!c&&t.target===this.dom)return t.preventDefault(),!1;if(u&&l&&!c&&g){const b=n.closest("[data-drag-handle]");b&&(this.dom===b||this.dom.contains(b))&&(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!(c||s||o||h||f||p||g&&d)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&(Lo()||ih())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(n=>n.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return typeof n!="number"?!1:(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}};function bi(t){return new RN({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=Te(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let c=n.to;if(a){const u=l.search(/\S/),d=n.from+l.indexOf(a),h=d+a.length;if(Vf(n.from,n.to,e.doc).filter(g=>g.mark.type.excluded.find(y=>y===t.type&&y!==g.mark.type)).filter(g=>g.to>d).length)return null;h<n.to&&o.delete(h,n.to),d>n.from&&o.delete(n.from+u,d),c=n.from+u+a.length,o.addMark(n.from+u,c,t.type.create(s||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(t.type)}}})}var va,ZN=new Uint8Array(16);function eI(){if(!va&&(va=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!va))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return va(ZN)}const tI=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function nI(t){return typeof t=="string"&&tI.test(t)}var nt=[];for(var Yu=0;Yu<256;++Yu)nt.push((Yu+256).toString(16).substr(1));function rI(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(nt[t[e+0]]+nt[t[e+1]]+nt[t[e+2]]+nt[t[e+3]]+"-"+nt[t[e+4]]+nt[t[e+5]]+"-"+nt[t[e+6]]+nt[t[e+7]]+"-"+nt[t[e+8]]+nt[t[e+9]]+"-"+nt[t[e+10]]+nt[t[e+11]]+nt[t[e+12]]+nt[t[e+13]]+nt[t[e+14]]+nt[t[e+15]]).toLowerCase();if(!nI(n))throw TypeError("Stringified UUID is invalid");return n}function UE(t,e,n){t=t||{};var r=t.random||(t.rng||eI)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,rI(r)}function iI(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function sI(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return iI(e)}const Gc=De.create({name:"uniqueID",priority:1e4,addOptions(){return{attributeName:"id",types:[],setIdAttribute:!1,generateID:()=>{if(typeof window<"u"&&window.__TEST_OPTIONS){const t=window.__TEST_OPTIONS;return t.mockID===void 0?t.mockID=0:t.mockID++,t.mockID.toString()}return UE()},filterTransaction:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{[this.options.attributeName]:{default:null,parseHTML:t=>t.getAttribute(`data-${this.options.attributeName}`),renderHTML:t=>{const e={[`data-${this.options.attributeName}`]:t[this.options.attributeName]};return this.options.setIdAttribute?{...e,id:t[this.options.attributeName]}:e}}}}]},addProseMirrorPlugins(){let t=null,e=!1;return[new re({key:new me("uniqueID"),appendTransaction:(n,r,i)=>{const s=n.some(f=>f.docChanged)&&!r.doc.eq(i.doc),o=this.options.filterTransaction&&n.some(f=>{var p,g;return!((g=(p=this.options).filterTransaction)!=null&&g.call(p,f))});if(!s||o)return;const{tr:a}=i,{types:l,attributeName:c,generateID:u}=this.options,d=Wc(r.doc,n),{mapping:h}=d;if(zf(d).forEach(({newRange:f})=>{const p=mE(i.doc,f,y=>l.includes(y.type.name)),g=p.map(({node:y})=>y.attrs[c]).filter(y=>y!==null),b=sI(g);p.forEach(({node:y,pos:C})=>{var S;const I=(S=a.doc.nodeAt(C))==null?void 0:S.attrs[c];if(I===null){const A=r.doc.type.createAndFill().content;if(r.doc.content.findDiffStart(A)===null){const D=JSON.parse(JSON.stringify(i.doc.toJSON()));if(D.content[0].content[0].attrs.id="initialBlockId",JSON.stringify(D.content)===JSON.stringify(A.toJSON())){a.setNodeMarkup(C,void 0,{...y.attrs,[c]:"initialBlockId"});return}}a.setNodeMarkup(C,void 0,{...y.attrs,[c]:u()});return}const{deleted:M}=h.invert().mapResult(C);M&&b.includes(I)&&a.setNodeMarkup(C,void 0,{...y.attrs,[c]:u()})})}),!!a.steps.length)return a.setMeta("uniqueID",!0),a},view(n){const r=i=>{let s;t=!((s=n.dom.parentElement)===null||s===void 0)&&s.contains(i.target)?n.dom.parentElement:null};return window.addEventListener("dragstart",r),{destroy(){window.removeEventListener("dragstart",r)}}},props:{handleDOMEvents:{drop:(n,r)=>{let i;return t!==n.dom.parentElement||((i=r.dataTransfer)===null||i===void 0?void 0:i.effectAllowed)==="copy"?e=!0:e=!1,t=null,!1},paste:()=>(e=!0,!1)},transformPasted:n=>{if(!e)return n;const{types:r,attributeName:i}=this.options,s=o=>{const a=[];return o.forEach(l=>{if(l.isText){a.push(l);return}if(!r.includes(l.type.name)){a.push(l.copy(s(l.content)));return}const c=l.type.create({...l.attrs,[i]:null},s(l.content),l.marks);a.push(c)}),v.from(a)};return e=!1,new F(s(n.content),n.openStart,n.openEnd)}}})]}});function Dg(t){return t.type==="link"}function $E(t){return typeof t!="string"&&t.type==="link"}function yi(t){return typeof t!="string"&&t.type==="text"}function oh(t){var e,n,r,i,s;return Kf(t)?{...t}:Bo(t)?{type:"tableCell",content:[].concat(t.content),props:{backgroundColor:((e=t.props)==null?void 0:e.backgroundColor)??"default",textColor:((n=t.props)==null?void 0:n.textColor)??"default",textAlignment:((r=t.props)==null?void 0:r.textAlignment)??"left",colspan:((i=t.props)==null?void 0:i.colspan)??1,rowspan:((s=t.props)==null?void 0:s.rowspan)??1}}:{type:"tableCell",content:[].concat(t),props:{backgroundColor:"default",textColor:"default",textAlignment:"left",colspan:1,rowspan:1}}}function Bo(t){return t!=null&&typeof t!="string"&&!Array.isArray(t)&&t.type==="tableCell"}function Kf(t){return Bo(t)&&t.props!==void 0&&t.content!==void 0}function Fo(t){return Kf(t)?t.props.colspan??1:1}function ah(t){return Kf(t)?t.props.rowspan??1:1}class Pn extends Error{constructor(e){super(`Unreachable case: ${e}`)}}function Mj(t,e=!0){const{"data-test":n,...r}=t;if(Object.keys(r).length>0&&e)throw new Error("Object must be empty "+JSON.stringify(t))}function Lr(t,e){const n=t.resolve(e);if(n.nodeAfter&&n.nodeAfter.type.isInGroup("bnBlock"))return{posBeforeNode:n.pos,node:n.nodeAfter};let r=n.depth,i=n.node(r);for(;r>0;){if(i.type.isInGroup("bnBlock"))return{posBeforeNode:n.before(r),node:i};r--,i=n.node(r)}const s=[];t.descendants((a,l)=>{a.type.isInGroup("bnBlock")&&s.push(l)}),console.warn(`Position ${e} is not within a blockContainer node.`);const o=t.resolve(s.find(a=>a>=e)||s[s.length-1]);return{posBeforeNode:o.pos,node:o.nodeAfter}}function Gf(t,e){if(!t.type.isInGroup("bnBlock"))throw new Error(`Attempted to get bnBlock node at position but found node of different type ${t.type.name}`);const n=t,r=e,i=r+n.nodeSize,s={node:n,beforePos:r,afterPos:i};if(n.type.name==="blockContainer"){let o,a;if(n.forEach((l,c)=>{if(l.type.spec.group==="blockContent"){const u=l,d=r+c+1,h=d+l.nodeSize;o={node:u,beforePos:d,afterPos:h}}else if(l.type.name==="blockGroup"){const u=l,d=r+c+1,h=d+l.nodeSize;a={node:u,beforePos:d,afterPos:h}}}),!o)throw new Error(`blockContainer node does not contain a blockContent node in its children: ${n}`);return{isBlockContainer:!0,bnBlock:s,blockContent:o,childContainer:a,blockNoteType:o.node.type.name}}else{if(!s.node.type.isInGroup("childContainer"))throw new Error(`bnBlock node is not in the childContainer group: ${s.node}`);return{isBlockContainer:!1,bnBlock:s,childContainer:s,blockNoteType:s.node.type.name}}}function Rr(t){return Gf(t.node,t.posBeforeNode)}function Qc(t){if(!t.nodeAfter)throw new Error(`Attempted to get blockContainer node at position ${t.pos} but a node at this position does not exist`);return Gf(t.nodeAfter,t.pos)}function xt(t){const e=Lr(t.doc,t.selection.anchor);return Rr(e)}function aa(t){const e=Lr(t.doc,t.selection.anchor);return Rr(e)}function He(t){return"doc"in t?t.doc.type.schema:t.type.schema}function zE(t){return t.cached.blockNoteEditor}function la(t){return zE(t).schema}function Qf(t){return la(t).blockSchema}function Jf(t){return la(t).inlineContentSchema}function Is(t){return la(t).styleSchema}function Xf(t){return zE(t).blockCache}function VE(t,e,n){var r,i;const s={type:"tableContent",columnWidths:[],headerRows:void 0,headerCols:void 0,rows:[]},o=[];t.content.forEach((a,l,c)=>{const u={cells:[]};c===0&&a.content.forEach(d=>{let h=d.attrs.colwidth;h==null&&(h=new Array(d.attrs.colspan??1).fill(void 0)),s.columnWidths.push(...h)}),u.cells=a.content.content.map((d,h)=>(o[c]||(o[c]=[]),o[c][h]=d.type.name==="tableHeader",{type:"tableCell",content:d.content.content.map(f=>Jc(f,e,n)).reduce((f,p)=>{if(!f.length)return p;const g=f[f.length-1],b=p[0];return b&&yi(g)&&yi(b)&&JSON.stringify(g.styles)===JSON.stringify(b.styles)?(g.text+=`
|
|
103
|
-
`+b.text,f.push(...p.slice(1)),f):(f.push(...p),f)},[]),props:{colspan:d.attrs.colspan,rowspan:d.attrs.rowspan,backgroundColor:d.attrs.backgroundColor,textColor:d.attrs.textColor,textAlignment:d.attrs.textAlignment}})),s.rows.push(u)});for(let a=0;a<o.length;a++)(r=o[a])!=null&&r.every(l=>l)&&(s.headerRows=(s.headerRows??0)+1);for(let a=0;a<((i=o[0])==null?void 0:i.length);a++)o!=null&&o.every(l=>l[a])&&(s.headerCols=(s.headerCols??0)+1);return s}function Jc(t,e,n){const r=[];let i;return t.content.forEach(s=>{if(s.type.name==="hardBreak"){if(i)if(yi(i))i.text+=`
|
|
104
|
-
`;else if(Dg(i))i.content[i.content.length-1].text+=`
|
|
105
|
-
`;else throw new Error("unexpected");else i={type:"text",text:`
|
|
106
|
-
`,styles:{}};return}if(s.type.name!=="link"&&s.type.name!=="text"){if(!e[s.type.name]){console.warn("unrecognized inline content type",s.type.name);return}i&&(r.push(i),i=void 0),r.push(Zf(s,e,n));return}const o={};let a;for(const l of s.marks)if(l.type.name==="link")a=l;else{const c=n[l.type.name];if(!c){if(l.type.spec.blocknoteIgnore)continue;throw new Error(`style ${l.type.name} not found in styleSchema`)}if(c.propSchema==="boolean")o[c.type]=!0;else if(c.propSchema==="string")o[c.type]=l.attrs.stringValue;else throw new Pn(c.propSchema)}i?yi(i)?a?(r.push(i),i={type:"link",href:a.attrs.href,content:[{type:"text",text:s.textContent,styles:o}]}):JSON.stringify(i.styles)===JSON.stringify(o)?i.text+=s.textContent:(r.push(i),i={type:"text",text:s.textContent,styles:o}):Dg(i)&&(a?i.href===a.attrs.href?JSON.stringify(i.content[i.content.length-1].styles)===JSON.stringify(o)?i.content[i.content.length-1].text+=s.textContent:i.content.push({type:"text",text:s.textContent,styles:o}):(r.push(i),i={type:"link",href:a.attrs.href,content:[{type:"text",text:s.textContent,styles:o}]}):(r.push(i),i={type:"text",text:s.textContent,styles:o})):a?i={type:"link",href:a.attrs.href,content:[{type:"text",text:s.textContent,styles:o}]}:i={type:"text",text:s.textContent,styles:o}}),i&&r.push(i),r}function Zf(t,e,n){if(t.type.name==="text"||t.type.name==="link")throw new Error("unexpected");const r={},i=e[t.type.name];for(const[o,a]of Object.entries(t.attrs)){if(!i)throw Error("ic node is of an unrecognized type: "+t.type.name);const l=i.propSchema;o in l&&(r[o]=a)}let s;return i.content==="styled"?s=Jc(t,e,n):s=void 0,{type:t.type.name,props:r,content:s}}function ve(t,e,n=Qf(e),r=Jf(e),i=Is(e),s=Xf(e)){var o;if(!t.type.isInGroup("bnBlock"))throw Error("Node should be a bnBlock, but is instead: "+t.type.name);const a=s?.get(t);if(a)return a;const l=Gf(t,0);let c=l.bnBlock.node.attrs.id;c===null&&(c=Gc.options.generateID());const u=n[l.blockNoteType];if(!u)throw Error("Block is of an unrecognized type: "+l.blockNoteType);const d={};for(const[b,y]of Object.entries({...t.attrs,...l.isBlockContainer?l.blockContent.node.attrs:{}})){const C=u.propSchema;b in C&&!(C[b].default===void 0&&y===void 0)&&(d[b]=y)}const h=n[l.blockNoteType],f=[];(o=l.childContainer)==null||o.node.forEach(b=>{f.push(ve(b,e,n,r,i,s))});let p;if(h.content==="inline"){if(!l.isBlockContainer)throw new Error("impossible");p=Jc(l.blockContent.node,r,i)}else if(h.content==="table"){if(!l.isBlockContainer)throw new Error("impossible");p=VE(l.blockContent.node,r,i)}else if(h.content==="none")p=void 0;else throw new Pn(h.content);const g={id:c,type:h.type,props:d,content:p,children:f};return s?.set(t,g),g}function oI(t,e=He(t),n=Qf(e),r=Jf(e),i=Is(e),s=Xf(e)){const o=[];return t.firstChild&&t.firstChild.descendants(a=>(o.push(ve(a,e,n,r,i,s)),!1)),o}function aI(t,e,n=Qf(e),r=Jf(e),i=Is(e),s=Xf(e)){function o(a,l,c){if(a.type.name!=="blockGroup")throw new Error("unexpected");const u=[];let d,h;return a.forEach((f,p,g)=>{if(f.type.name!=="blockContainer")throw new Error("unexpected");if(f.childCount===0)return;if(f.childCount===0||f.childCount>2)throw new Error("unexpected, blockContainer.childCount: "+f.childCount);const b=g===0,y=g===a.childCount-1;if(f.firstChild.type.name==="blockGroup"){if(!b)throw new Error("unexpected");const M=o(f.firstChild,Math.max(0,l-1),y?Math.max(0,c-1):0);d=M.blockCutAtStart,y&&(h=M.blockCutAtEnd),u.push(...M.blocks);return}const C=ve(f,e,n,r,i,s),S=f.childCount>1?f.child(1):void 0;let I=[];if(S){const M=o(S,0,y?Math.max(0,c-1):0);I=M.blocks,y&&(h=M.blockCutAtEnd)}y&&!S&&c>1&&(h=C.id),b&&l>1&&(d=C.id),u.push({...C,children:I})}),{blocks:u,blockCutAtStart:d,blockCutAtEnd:h}}if(t.content.childCount===0)return{blocks:[],blockCutAtStart:void 0,blockCutAtEnd:void 0};if(t.content.childCount!==1)throw new Error("slice must be a single block, did you forget includeParents=true?");return o(t.content.firstChild,Math.max(t.openStart-1,0),Math.max(t.openEnd-1,0))}function zr(t){const{height:e,width:n}=ep(t),r=new Array(e).fill(!1).map(()=>new Array(n).fill(null)),i=(s,o)=>{for(let a=s;a<e;a++)for(let l=o;l<n;l++)if(!r[a][l])return{row:a,col:l};throw new Error("Unable to create occupancy grid for table, no more available cells")};for(let s=0;s<t.content.rows.length;s++)for(let o=0;o<t.content.rows[s].cells.length;o++){const a=oh(t.content.rows[s].cells[o]),l=ah(a),c=Fo(a),{row:u,col:d}=i(s,o);for(let h=u;h<u+l;h++)for(let f=d;f<d+c;f++){if(r[h][f])throw new Error(`Unable to create occupancy grid for table, cell at ${h},${f} is already occupied`);r[h][f]={row:s,col:o,rowspan:l,colspan:c,cell:a}}}return r}function Ho(t){const e=new Set;return t.map(n=>({cells:n.map(r=>e.has(r.row+":"+r.col)?!1:(e.add(r.row+":"+r.col),r.cell)).filter(r=>r!==!1)}))}function Ei(t,e,n=zr(e)){for(let r=0;r<n.length;r++)for(let i=0;i<n[r].length;i++){const s=n[r][i];if(s&&s.row===t.row&&s.col===t.col)return{row:r,col:i,cell:s.cell}}throw new Error(`Unable to resolve relative table cell indices for table, cell at ${t.row},${t.col} is not occupied`)}function ep(t){const e=t.content.rows.length;let n=0;return t.content.rows.forEach(r=>{let i=0;r.cells.forEach(s=>{i+=Fo(s)}),n=Math.max(n,i)}),{height:e,width:n}}function jE(t,e,n=zr(e)){var r;const i=(r=n[t.row])==null?void 0:r[t.col];if(i)return{row:i.row,col:i.col,cell:i.cell}}function lh(t,e){var n;const r=zr(t);if(e<0||e>=r.length)return[];let i=0;for(let o=0;o<e;o++){const a=(n=r[i])==null?void 0:n[0];if(!a)return[];i+=a.rowspan}const s=new Array(r[0].length).fill(!1).map((o,a)=>jE({row:i,col:a},t,r)).filter(o=>o!==void 0);return s.filter((o,a)=>s.findIndex(l=>l.row===o.row&&l.col===o.col)===a)}function ch(t,e){var n;const r=zr(t);if(e<0||e>=r[0].length)return[];let i=0;for(let o=0;o<e;o++){const a=(n=r[0])==null?void 0:n[i];if(!a)return[];i+=a.colspan}const s=new Array(r.length).fill(!1).map((o,a)=>jE({row:a,col:i},t,r)).filter(o=>o!==void 0);return s.filter((o,a)=>s.findIndex(l=>l.row===o.row&&l.col===o.col)===a)}function lI(t,e,n,r=zr(t)){const{col:i}=Ei({row:0,col:e},t,r),{col:s}=Ei({row:0,col:n},t,r);return r.forEach(o=>{const[a]=o.splice(i,1);o.splice(s,0,a)}),Ho(r)}function cI(t,e,n,r=zr(t)){const{row:i}=Ei({row:e,col:0},t,r),{row:s}=Ei({row:n,col:0},t,r),[o]=r.splice(i,1);return r.splice(s,0,o),Ho(r)}function uh(t){return t?Bo(t)?uh(t.content):typeof t=="string"?t.length===0:Array.isArray(t)?t.every(e=>typeof e=="string"?e.length===0:yi(e)?e.text.length===0:$E(e)?typeof e.content=="string"?e.content.length===0:e.content.every(n=>n.text.length===0):!1):!1:!0}function uI(t,e,n=zr(t)){if(e==="columns"){let s=0;for(let o=n[0].length-1;o>=0&&n.every(a=>uh(a[o].cell)&&a[o].colspan===1);o--)s++;for(let o=n.length-1;o>=0;o--){const a=Math.max(n[o].length-s,1);n[o]=n[o].slice(0,a)}return Ho(n)}let r=0;for(let s=n.length-1;s>=0&&n[s].every(o=>uh(o.cell)&&o.rowspan===1);s--)r++;const i=Math.min(r,n.length-1);return n.splice(n.length-i,i),Ho(n)}function dI(t,e,n,r=zr(t)){const{width:i,height:s}=ep(t);if(e==="columns")r.forEach((o,a)=>{if(n>=0)for(let l=0;l<n;l++)o.push({row:a,col:Math.max(...o.map(c=>c.col))+1,rowspan:1,colspan:1,cell:oh("")});else o.splice(i+n,-1*n)});else if(n>0)for(let o=0;o<n;o++){const a=new Array(i).fill(null).map((l,c)=>({row:s+o,col:c,rowspan:1,colspan:1,cell:oh("")}));r.push(a)}else n<0&&r.splice(s+n,-1*n);return Ho(r)}function qE(t,e,n){const r=lh(t,n);if(!r.some(o=>ah(o.cell)>1))return!0;let i=n,s=n;return r.forEach(o=>{const a=ah(o.cell);i=Math.max(i,o.row+a-1),s=Math.min(s,o.row)}),e<n?n===i:n===s}function WE(t,e,n){const r=ch(t,n);if(!r.some(o=>Fo(o.cell)>1))return!0;let i=n,s=n;return r.forEach(o=>{const a=Fo(o.cell);i=Math.max(i,o.col+a-1),s=Math.min(s,o.col)}),e<n?n===i:n===s}function hI(t,e,n){const r=Ei(t,n),i=Ei(e,n);return r.col===i.col}function Lg(t,e,n,r){const i=[];for(const[s,o]of Object.entries(t.styles||{})){const a=n[s];if(!a)throw new Error(`style ${s} not found in styleSchema`);if(a.propSchema==="boolean")o&&i.push(e.mark(s));else if(a.propSchema==="string")o&&i.push(e.mark(s,{stringValue:o}));else throw new Pn(a.propSchema)}return!r||!e.nodes[r].spec.code?t.text.split(/(\n)/g).filter(s=>s.length>0).map(s=>s===`
|
|
107
|
-
`?e.nodes.hardBreak.createChecked():e.text(s,i)):t.text.length>0?[e.text(t.text,i)]:[]}function fI(t,e,n){const r=e.marks.link.create({href:t.href});return dh(t.content,e,n).map(i=>{if(i.type.name==="text")return i.mark([...i.marks,r]);if(i.type.name==="hardBreak")return i;throw new Error("unexpected node type")})}function dh(t,e,n,r){const i=[];if(typeof t=="string")return i.push(...Lg({text:t,styles:{}},e,n,r)),i;for(const s of t)i.push(...Lg(s,e,n,r));return i}function bn(t,e,n,r=Is(e)){const i=[];for(const s of t)typeof s=="string"?i.push(...dh(s,e,r,n)):$E(s)?i.push(...fI(s,e,r)):yi(s)?i.push(...dh([s],e,r,n)):i.push(YE(s,e,r));return i}function Xc(t,e,n=Is(e)){const r=[],i=new Array(t.headerRows??0).fill(!0),s=new Array(t.headerCols??0).fill(!0),o=t.columnWidths??[];for(let a=0;a<t.rows.length;a++){const l=t.rows[a],c=[],u=i[a];for(let h=0;h<l.cells.length;h++){const f=l.cells[h],p=s[h],g=void 0;let b=null;const y=Ei({row:a,col:h},{content:t});let C=o[y.col]?[o[y.col]]:null;if(f)if(typeof f=="string")b=e.text(f);else if(Bo(f)){f.content&&(b=bn(f.content,e,"tableParagraph",n));const I=Fo(f);I>1&&(C=new Array(I).fill(!1).map((M,A)=>o[y.col+A]??void 0))}else b=bn(f,e,"tableParagraph",n);const S=e.nodes[p||u?"tableHeader":"tableCell"].createChecked({...Bo(f)?f.props:{},colwidth:C},e.nodes.tableParagraph.createChecked(g,b));c.push(S)}const d=e.nodes.tableRow.createChecked({},c);r.push(d)}return r}function YE(t,e,n){let r,i=t.type;if(i===void 0&&(i="paragraph"),!e.nodes[i])throw new Error(`node type ${i} not found in schema`);if(!t.content)r=e.nodes[i].createChecked(t.props);else if(typeof t.content=="string"){const s=bn([t.content],e,i,n);r=e.nodes[i].createChecked(t.props,s)}else if(Array.isArray(t.content)){const s=bn(t.content,e,i,n);r=e.nodes[i].createChecked(t.props,s)}else if(t.content.type==="tableContent"){const s=Xc(t.content,e,n);r=e.nodes[i].createChecked(t.props,s)}else throw new Pn(t.content.type);return r}function Ii(t,e,n=Is(e)){let r=t.id;r===void 0&&(r=Gc.options.generateID());const i=[];if(t.children)for(const s of t.children)i.push(Ii(s,e,n));if(!t.type||e.nodes[t.type].isInGroup("blockContent")){const s=YE(t,e,n),o=i.length>0?e.nodes.blockGroup.createChecked({},i):void 0;return e.nodes.blockContainer.createChecked({id:r,...t.props},o?[s,o]:s)}else{if(e.nodes[t.type].isInGroup("bnBlock"))return e.nodes[t.type].createChecked({id:r,...t.props},i);throw new Error(`block type ${t.type} doesn't match blockContent or bnBlock group`)}}let hh,fh;if(typeof WeakMap<"u"){let t=new WeakMap;hh=e=>t.get(e),fh=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;hh=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},fh=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var Ae=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,i=e/this.width|0;let s=r+1,o=i+1;for(let a=1;s<this.width&&this.map[e+a]==n;a++)s++;for(let a=1;o<this.height&&this.map[e+this.width*a]==n;a++)o++;return{left:r,top:i,right:s,bottom:o}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:i,top:s,bottom:o}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[s*this.width+(n<0?r-1:i)]:(n<0?s==0:o==this.height)?null:this.map[r+this.width*(n<0?s-1:o)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:s}=this.findCell(t),{left:o,right:a,top:l,bottom:c}=this.findCell(e);return{left:Math.min(n,o),top:Math.min(i,l),right:Math.max(r,a),bottom:Math.max(s,c)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const s=r*this.width+i,o=this.map[s];n[o]||(n[o]=!0,!(i==t.left&&i&&this.map[s-1]==o||r==t.top&&r&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const s=i+n.child(r).nodeSize;if(r==t){let o=e+t*this.width;const a=(t+1)*this.width;for(;o<a&&this.map[o]<i;)o++;return o==a?s-1:this.map[o]}i=s}}static get(t){return hh(t)||fh(t,pI(t))}};function pI(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=mI(t),n=t.childCount,r=[];let i=0,s=null;const o=[];for(let c=0,u=e*n;c<u;c++)r[c]=0;for(let c=0,u=0;c<n;c++){const d=t.child(c);u++;for(let p=0;;p++){for(;i<r.length&&r[i]!=0;)i++;if(p==d.childCount)break;const g=d.child(p),{colspan:b,rowspan:y,colwidth:C}=g.attrs;for(let S=0;S<y;S++){if(S+c>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:y-S});break}const I=i+S*e;for(let M=0;M<b;M++){r[I+M]==0?r[I+M]=u:(s||(s=[])).push({type:"collision",row:c,pos:u,n:b-M});const A=C&&C[M];if(A){const D=(I+M)%e*2,z=o[D];z==null||z!=A&&o[D+1]==1?(o[D]=A,o[D+1]=1):z==A&&o[D+1]++}}}i+=b,u+=g.nodeSize}const h=(c+1)*e;let f=0;for(;i<h;)r[i++]==0&&f++;f&&(s||(s=[])).push({type:"missing",row:c,n:f}),u++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const a=new Ae(e,n,r,s);let l=!1;for(let c=0;!l&&c<o.length;c+=2)o[c]!=null&&o[c+1]<n&&(l=!0);return l&&gI(a,o,t),a}function mI(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let s=0;if(n)for(let o=0;o<r;o++){const a=t.child(o);for(let l=0;l<a.childCount;l++){const c=a.child(l);o+c.attrs.rowspan>r&&(s+=c.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const a=i.child(o);s+=a.attrs.colspan,a.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function gI(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const s=t.map[i];if(r[s])continue;r[s]=!0;const o=n.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let a=null;const l=o.attrs;for(let c=0;c<l.colspan;c++){const u=e[(i+c)%t.width*2];u!=null&&(!l.colwidth||l.colwidth[c]!=u)&&((a||(a=bI(l)))[c]=u)}a&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:a})}}function bI(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function ft(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}const Tr=new me("selectingCells");function ki(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function yI(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function Fn(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function tp(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=ki(e.$head)||EI(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function EI(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function ph(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function kI(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function np(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function KE(t,e,n){const r=t.node(-1),i=Ae.get(r),s=t.start(-1),o=i.nextCell(t.pos-s,e,n);return o==null?null:t.node(0).resolve(s+o)}function Ti(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function GE(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(e,0,0)}return r}function TI(t,e,n){const r=ft(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return!1;return!0}var be=class Jn extends Q{constructor(e,n=e){const r=e.node(-1),i=Ae.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,n.pos-s),a=e.node(0),l=i.cellsInRect(o).filter(u=>u!=n.pos-s);l.unshift(n.pos-s);const c=l.map(u=>{const d=r.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);const h=s+u+1;return new dy(a.resolve(h),a.resolve(h+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(ph(r)&&ph(i)&&np(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Jn.rowSelection(r,i):s&&this.isColSelection()?Jn.colSelection(r,i):new Jn(r,i)}return j.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=Ae.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},o=[];for(let l=i.top;l<i.bottom;l++){const c=[];for(let u=l*n.width+i.left,d=i.left;d<i.right;d++,u++){const h=n.map[u];if(s[h])continue;s[h]=!0;const f=n.findCell(h);let p=e.nodeAt(h);if(!p)throw new RangeError(`No cell with offset ${h} found`);const g=i.left-f.left,b=f.right-i.right;if(g>0||b>0){let y=p.attrs;if(g>0&&(y=Ti(y,0,g)),b>0&&(y=Ti(y,y.colspan-b,b)),f.left<i.left){if(p=p.type.createAndFill(y),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(y)}`)}else p=p.type.create(y,p.content)}if(f.top<i.top||f.bottom>i.bottom){const y={...p.attrs,rowspan:Math.min(f.bottom,i.bottom)-Math.max(f.top,i.top)};f.top<i.top?p=p.type.createAndFill(y):p=p.type.create(y,p.content)}c.push(p)}o.push(e.child(l).copy(v.from(c)))}const a=this.isColSelection()&&this.isRowSelection()?e:o;return new F(v.from(a),1,1)}replace(e,n=F.empty){const r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:a,$to:l}=i[o],c=e.mapping.slice(r);e.replace(c.map(a.pos),c.map(l.pos),o?F.empty:n)}const s=Q.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new F(v.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=Ae.get(n),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(n.nodeAt(s[o]),i+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=Ae.get(r),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(n.pos-s),l=e.node(0);return o.top<=a.top?(o.top>0&&(e=l.resolve(s+i.map[o.left])),a.bottom<i.height&&(n=l.resolve(s+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(s+i.map[a.left])),o.bottom<i.height&&(e=l.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new Jn(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=Ae.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,a=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,a)==n.width}eq(e){return e instanceof Jn&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=Ae.get(r),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(n.pos-s),l=e.node(0);return o.left<=a.left?(o.left>0&&(e=l.resolve(s+i.map[o.top*i.width])),a.right<i.width&&(n=l.resolve(s+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(s+i.map[a.top*i.width])),o.right<i.width&&(e=l.resolve(s+i.map[i.width*(o.top+1)-1]))),new Jn(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Jn(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Jn(e.resolve(n),e.resolve(r))}getBookmark(){return new CI(this.$anchorCell.pos,this.$headCell.pos)}};be.prototype.visible=!1;Q.jsonID("cell",be);var CI=class QE{constructor(e,n){this.anchor=e,this.head=n}map(e){return new QE(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&np(n,r)?new be(n,r):Q.near(r,1)}};function SI(t){if(!(t.selection instanceof be))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(Ee.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ue.create(t.doc,e)}function wI({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function xI({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&e.parentOffset===0}function AI(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,o;if(r instanceof W&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=be.create(i,r.from);else if(o=="row"){const a=i.resolve(r.from+1);s=be.rowSelection(a,a)}else if(!n){const a=Ae.get(r.node),l=r.from+1,c=l+a.map[a.width*a.height-1];s=be.create(i,l+1,c)}}else r instanceof j&&wI(r)?s=j.create(i,r.from):r instanceof j&&xI(r)&&(s=j.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const _I=new me("fix-tables");function JE(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let o=0,a=0;o<s;o++){const l=e.child(o);for(let c=a,u=Math.min(i,o+3);c<u;c++)if(t.child(c)==l){a=c+1,n+=l.nodeSize;continue e}r(l,n),a<i&&t.child(a).sameMarkup(l)?JE(t.child(a),l,n+1,r):l.nodesBetween(0,l.content.size,r,n+1),n+=l.nodeSize}}function NI(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=II(t,i,s,n))};return e?e.doc!=t.doc&&JE(e.doc,t.doc,0,r):t.doc.descendants(r),n}function II(t,e,n,r){const i=Ae.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let l=0;l<i.height;l++)s.push(0);for(let l=0;l<i.problems.length;l++){const c=i.problems[l];if(c.type=="collision"){const u=e.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let h=0;h<d.rowspan;h++)s[c.row+h]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,Ti(d,d.colspan-c.n,c.n))}else if(c.type=="missing")s[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=r.mapping.map(n);r.delete(u,u+e.nodeSize)}}let o,a;for(let l=0;l<s.length;l++)s[l]&&(o==null&&(o=l),a=l);for(let l=0,c=n+1;l<i.height;l++){const u=e.child(l),d=c+u.nodeSize,h=s[l];if(h>0){let f="cell";u.firstChild&&(f=u.firstChild.type.spec.tableRole);const p=[];for(let b=0;b<h;b++){const y=ft(t.schema)[f].createAndFill();y&&p.push(y)}const g=(l==0||o==l-1)&&a==l?c+1:d-1;r.insert(r.mapping.map(g),p)}c=d}return r.setMeta(_I,{fixTables:!0})}function Hn(t){const e=t.selection,n=tp(t),r=n.node(-1),i=n.start(-1),s=Ae.get(r);return{...e instanceof be?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function XE(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;TI(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let o=0;o<e.height;o++){const a=o*e.width+i;if(i>0&&i<e.width&&e.map[a-1]==e.map[a]){const l=e.map[a],c=r.nodeAt(l);t.setNodeMarkup(t.mapping.map(n+l),null,GE(c.attrs,i-e.colCount(l))),o+=c.attrs.rowspan-1}else{const l=s==null?ft(r.type.schema).cell:r.nodeAt(e.map[a+s]).type,c=e.positionAt(o,i,r);t.insert(t.mapping.map(n+c),l.createAndFill())}}return t}function OI(t,e){if(!Fn(t))return!1;if(e){const n=Hn(t);e(XE(t.tr,n,n.left))}return!0}function MI(t,e){if(!Fn(t))return!1;if(e){const n=Hn(t);e(XE(t.tr,n,n.right))}return!0}function vI(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let o=0;o<e.height;){const a=o*e.width+i,l=e.map[a],c=n.nodeAt(l),u=c.attrs;if(i>0&&e.map[a-1]==l||i<e.width-1&&e.map[a+1]==l)t.setNodeMarkup(t.mapping.slice(s).map(r+l),null,Ti(u,i-e.colCount(l)));else{const d=t.mapping.slice(s).map(r+l);t.delete(d,d+c.nodeSize)}o+=u.rowspan}}function DI(t,e){if(!Fn(t))return!1;if(e){const n=Hn(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;vI(r,n,i),i!=n.left;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=Ae.get(s)}e(r)}return!0}function LI(t,e,n){var r;const i=ft(e.type.schema).header_cell;for(let s=0;s<t.width;s++)if(((r=e.nodeAt(t.map[s+n*t.width]))===null||r===void 0?void 0:r.type)!=i)return!1;return!0}function ZE(t,{map:e,tableStart:n,table:r},i){let s=n;for(let c=0;c<i;c++)s+=r.child(c).nodeSize;const o=[];let a=i>0?-1:0;LI(e,r,i+a)&&(a=i==0||i==e.height?null:0);for(let c=0,u=e.width*i;c<e.width;c++,u++)if(i>0&&i<e.height&&e.map[u]==e.map[u-e.width]){const d=e.map[u],h=r.nodeAt(d).attrs;t.setNodeMarkup(n+d,null,{...h,rowspan:h.rowspan+1}),c+=h.colspan-1}else{var l;const d=a==null?ft(r.type.schema).cell:(l=r.nodeAt(e.map[u+a*e.width]))===null||l===void 0?void 0:l.type,h=d?.createAndFill();h&&o.push(h)}return t.insert(s,ft(r.type.schema).row.create(null,o)),t}function RI(t,e){if(!Fn(t))return!1;if(e){const n=Hn(t);e(ZE(t.tr,n,n.top))}return!0}function PI(t,e){if(!Fn(t))return!1;if(e){const n=Hn(t);e(ZE(t.tr,n,n.bottom))}return!0}function BI(t,{map:e,table:n,tableStart:r},i){let s=0;for(let c=0;c<i;c++)s+=n.child(c).nodeSize;const o=s+n.child(i).nodeSize,a=t.mapping.maps.length;t.delete(s+r,o+r);const l=new Set;for(let c=0,u=i*e.width;c<e.width;c++,u++){const d=e.map[u];if(!l.has(d)){if(l.add(d),i>0&&d==e.map[u-e.width]){const h=n.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(a).map(d+r),null,{...h,rowspan:h.rowspan-1}),c+=h.colspan-1}else if(i<e.height&&d==e.map[u+e.width]){const h=n.nodeAt(d),f=h.attrs,p=h.type.create({...f,rowspan:h.attrs.rowspan-1},h.content),g=e.positionAt(i+1,c,n);t.insert(t.mapping.slice(a).map(r+g),p),c+=f.colspan-1}}}}function FI(t,e){if(!Fn(t))return!1;if(e){const n=Hn(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;BI(r,n,i),i!=n.top;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=Ae.get(n.table)}e(r)}return!0}function Rg(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function HI({width:t,height:e,map:n},r){let i=r.top*t+r.left,s=i,o=(r.bottom-1)*t+r.left,a=i+(r.right-r.left-1);for(let l=r.top;l<r.bottom;l++){if(r.left>0&&n[s]==n[s-1]||r.right<t&&n[a]==n[a+1])return!0;s+=t,a+=t}for(let l=r.left;l<r.right;l++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[o]==n[o+t])return!0;i++,o++}return!1}function UI(t,e){const n=t.selection;if(!(n instanceof be)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Hn(t),{map:i}=r;if(HI(i,r))return!1;if(e){const s=t.tr,o={};let a=v.empty,l,c;for(let u=r.top;u<r.bottom;u++)for(let d=r.left;d<r.right;d++){const h=i.map[u*i.width+d],f=r.table.nodeAt(h);if(!(o[h]||!f))if(o[h]=!0,l==null)l=h,c=f;else{Rg(f)||(a=a.append(f.content));const p=s.mapping.map(h+r.tableStart);s.delete(p,p+f.nodeSize)}}if(l==null||c==null)return!0;if(s.setNodeMarkup(l+r.tableStart,null,{...GE(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),a.size>0){const u=l+1+c.content.size,d=Rg(c)?l+1:u;s.replaceWith(d+r.tableStart,u+r.tableStart,a)}s.setSelection(new be(s.doc.resolve(l+r.tableStart))),e(s)}return!0}function $I(t,e){const n=ft(t.schema);return zI(({node:r})=>n[r.type.spec.tableRole])(t,e)}function zI(t){return(e,n)=>{const r=e.selection;let i,s;if(r instanceof be){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{var o;if(i=yI(r.$from),!i)return!1;s=(o=ki(r.$from))===null||o===void 0?void 0:o.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let a=i.attrs;const l=[],c=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});const u=Hn(e),d=e.tr;for(let f=0;f<u.right-u.left;f++)l.push(c?{...a,colwidth:c&&c[f]?[c[f]]:null}:a);let h;for(let f=u.top;f<u.bottom;f++){let p=u.map.positionAt(f,u.left,u.table);f==u.top&&(p+=i.nodeSize);for(let g=u.left,b=0;g<u.right;g++,b++)g==u.left&&f==u.top||d.insert(h=d.mapping.map(p+u.tableStart,1),t({node:i,row:f,col:g}).createAndFill(l[b]))}d.setNodeMarkup(s,t({node:i,row:u.top,col:u.left}),l[0]),r instanceof be&&d.setSelection(new be(d.doc.resolve(r.$anchorCell.pos),h?d.doc.resolve(h):void 0)),n(d)}return!0}}function VI(t){return function(e,n){if(!Fn(e))return!1;if(n){const r=ft(e.schema),i=Hn(e),s=e.tr,o=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=o.map(l=>i.table.nodeAt(l));for(let l=0;l<o.length;l++)a[l].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[l],r.cell,a[l].attrs);if(s.steps.length===0)for(let l=0;l<o.length;l++)s.setNodeMarkup(i.tableStart+o[l],r.header_cell,a[l].attrs);n(s)}return!0}}function Pg(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function rp(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?VI(t):function(n,r){if(!Fn(n))return!1;if(r){const i=ft(n.schema),s=Hn(n),o=n.tr,a=Pg("row",s,i),l=Pg("column",s,i),c=(t==="column"?a:t==="row"&&l)?1:0,u=t=="column"?{left:0,top:c,right:1,bottom:s.map.height}:t=="row"?{left:c,top:0,right:s.map.width,bottom:1}:s,d=t=="column"?l?i.cell:i.header_cell:t=="row"?a?i.cell:i.header_cell:i.cell;s.map.cellsInRect(u).forEach(h=>{const f=h+s.tableStart,p=o.doc.nodeAt(f);p&&o.setNodeMarkup(f,d,p.attrs)}),r(o)}return!0}}rp("row",{useDeprecatedLogic:!0});rp("column",{useDeprecatedLogic:!0});rp("cell",{useDeprecatedLogic:!0});function jI(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const s=t.node(-1).child(r),o=s.lastChild;if(o)return i-1-o.nodeSize;i-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function Bg(t){return function(e,n){if(!Fn(e))return!1;const r=jI(tp(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(j.between(i,kI(i))).scrollIntoView())}return!0}}function Da(t,e){const n=t.selection;if(!(n instanceof be))return!1;if(e){const r=t.tr,i=ft(t.schema).cell.createAndFill().content;n.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new F(i,0,0))}),r.docChanged&&e(r)}return!0}function qI(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,o=i.type.schema,a=[];if(s=="row")for(let l=0;l<e.childCount;l++){let c=e.child(l).content;const u=l?0:Math.max(0,n-1),d=l<e.childCount-1?0:Math.max(0,r-1);(u||d)&&(c=mh(ft(o).row,new F(c,u,d)).content),a.push(c)}else if(s=="cell"||s=="header_cell")a.push(n||r?mh(ft(o).row,new F(e,n,r)).content:e);else return null;return WI(o,a)}function WI(t,e){const n=[];for(let i=0;i<e.length;i++){const s=e[i];for(let o=s.childCount-1;o>=0;o--){const{rowspan:a,colspan:l}=s.child(o).attrs;for(let c=i;c<i+a;c++)n[c]=(n[c]||0)+l}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(v.empty),n[i]<r){const s=ft(t).cell.createAndFill(),o=[];for(let a=n[i];a<r;a++)o.push(s);e[i]=e[i].append(v.from(o))}return{height:e.length,width:r,rows:e}}function mh(t,e){const n=t.createAndFill();return new Ef(n).replace(0,n.content.size,e).doc}function YI({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],o=[];for(let a=0;a<n.length;a++){const l=n[a],c=[];for(let u=s[a]||0,d=0;u<r;d++){let h=l.child(d%l.childCount);u+h.attrs.colspan>r&&(h=h.type.createChecked(Ti(h.attrs,h.attrs.colspan,u+h.attrs.colspan-r),h.content)),c.push(h),u+=h.attrs.colspan;for(let f=1;f<h.attrs.rowspan;f++)s[a+f]=(s[a+f]||0)+h.attrs.colspan}o.push(v.from(c))}n=o,t=r}if(e!=i){const s=[];for(let o=0,a=0;o<i;o++,a++){const l=[],c=n[a%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);o+d.attrs.rowspan>i&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),l.push(d)}s.push(v.from(l))}n=s,e=i}return{width:t,height:e,rows:n}}function KI(t,e,n,r,i,s,o){const a=t.doc.type.schema,l=ft(a);let c,u;if(i>e.width)for(let d=0,h=0;d<e.height;d++){const f=n.child(d);h+=f.nodeSize;const p=[];let g;f.lastChild==null||f.lastChild.type==l.cell?g=c||(c=l.cell.createAndFill()):g=u||(u=l.header_cell.createAndFill());for(let b=e.width;b<i;b++)p.push(g);t.insert(t.mapping.slice(o).map(h-1+r),p)}if(s>e.height){const d=[];for(let p=0,g=(e.height-1)*e.width;p<Math.max(e.width,i);p++){const b=p>=e.width?!1:n.nodeAt(e.map[g+p]).type==l.header_cell;d.push(b?u||(u=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}const h=l.row.create(null,v.from(d)),f=[];for(let p=e.height;p<s;p++)f.push(h);t.insert(t.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(c||u)}function Fg(t,e,n,r,i,s,o,a){if(o==0||o==e.height)return!1;let l=!1;for(let c=i;c<s;c++){const u=o*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){l=!0;const h=n.nodeAt(d),{top:f,left:p}=e.findCell(d);t.setNodeMarkup(t.mapping.slice(a).map(d+r),null,{...h.attrs,rowspan:o-f}),t.insert(t.mapping.slice(a).map(e.positionAt(o,p,n)),h.type.createAndFill({...h.attrs,rowspan:f+h.attrs.rowspan-o})),c+=h.attrs.colspan-1}}return l}function Hg(t,e,n,r,i,s,o,a){if(o==0||o==e.width)return!1;let l=!1;for(let c=i;c<s;c++){const u=c*e.width+o,d=e.map[u];if(e.map[u-1]==d){l=!0;const h=n.nodeAt(d),f=e.colCount(d),p=t.mapping.slice(a).map(d+r);t.setNodeMarkup(p,null,Ti(h.attrs,o-f,h.attrs.colspan-(o-f))),t.insert(p+h.nodeSize,h.type.createAndFill(Ti(h.attrs,0,o-f))),c+=h.attrs.rowspan-1}}return l}function Ug(t,e,n,r,i){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let o=Ae.get(s);const{top:a,left:l}=r,c=l+i.width,u=a+i.height,d=t.tr;let h=0;function f(){if(s=n?d.doc.nodeAt(n-1):d.doc,!s)throw new Error("No table found");o=Ae.get(s),h=d.mapping.maps.length}KI(d,o,s,n,c,u,h)&&f(),Fg(d,o,s,n,l,c,a,h)&&f(),Fg(d,o,s,n,l,c,u,h)&&f(),Hg(d,o,s,n,a,u,l,h)&&f(),Hg(d,o,s,n,a,u,c,h)&&f();for(let p=a;p<u;p++){const g=o.positionAt(p,l,s),b=o.positionAt(p,c,s);d.replace(d.mapping.slice(h).map(g+n),d.mapping.slice(h).map(b+n),new F(i.rows[p-a],0,0))}f(),d.setSelection(new be(d.doc.resolve(n+o.positionAt(a,l,s)),d.doc.resolve(n+o.positionAt(u-1,c-1,s)))),e(d)}const GI=Rf({ArrowLeft:La("horiz",-1),ArrowRight:La("horiz",1),ArrowUp:La("vert",-1),ArrowDown:La("vert",1),"Shift-ArrowLeft":Ra("horiz",-1),"Shift-ArrowRight":Ra("horiz",1),"Shift-ArrowUp":Ra("vert",-1),"Shift-ArrowDown":Ra("vert",1),Backspace:Da,"Mod-Backspace":Da,Delete:Da,"Mod-Delete":Da});function ol(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function La(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof be)return ol(n,r,Q.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const o=ek(i,t,e);if(o==null)return!1;if(t=="horiz")return ol(n,r,Q.near(n.doc.resolve(s.head+e),e));{const a=n.doc.resolve(o),l=KE(a,t,e);let c;return l?c=Q.near(l,1):e<0?c=Q.near(n.doc.resolve(a.before(-1)),-1):c=Q.near(n.doc.resolve(a.after(-1)),1),ol(n,r,c)}}}function Ra(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let o;if(s instanceof be)o=s;else{const l=ek(i,t,e);if(l==null)return!1;o=new be(n.doc.resolve(l))}const a=KE(o.$headCell,t,e);return a?ol(n,r,new be(o.$anchorCell,a)):!1}}function QI(t,e){const n=t.state.doc,r=ki(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new be(r))),!0):!1}function JI(t,e,n){if(!Fn(t.state))return!1;let r=qI(n);const i=t.state.selection;if(i instanceof be){r||(r={width:1,height:1,rows:[v.from(mh(ft(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),a=Ae.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=YI(r,a.right-a.left,a.bottom-a.top),Ug(t.state,t.dispatch,o,a,r),!0}else if(r){const s=tp(t.state),o=s.start(-1);return Ug(t.state,t.dispatch,o,Ae.get(s.node(-1)).findCell(s.pos-o),r),!0}else return!1}function XI(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=$g(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof be)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=ki(t.state.selection.$anchor))!=null&&((n=Ku(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(l,c){let u=Ku(t,c);const d=Tr.getState(t.state)==null;if(!u||!np(l,u))if(d)u=l;else return;const h=new be(l,u);if(d||!t.state.selection.eq(h)){const f=t.state.tr.setSelection(h);d&&f.setMeta(Tr,l.pos),t.dispatch(f)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",a),Tr.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Tr,-1))}function a(l){const c=l,u=Tr.getState(t.state);let d;if(u!=null)d=t.state.doc.resolve(u);else if($g(t,c.target)!=r&&(d=Ku(t,e),!d))return o();d&&s(d,c)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",a)}function ek(t,e,n){if(!(t.state.selection instanceof j))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const o=r.before(i),a=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(a)?o:null}}return null}function $g(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Ku(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&ki(t.state.doc.resolve(r))||ki(t.state.doc.resolve(i))}var tk=class{constructor(t,e){this.node=t,this.defaultCellMinWidth=e,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",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),gh(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,gh(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function gh(t,e,n,r,i,s){let o=0,a=!0,l=e.firstChild;const c=t.firstChild;if(c){for(let d=0,h=0;d<c.childCount;d++){const{colspan:f,colwidth:p}=c.child(d).attrs;for(let g=0;g<f;g++,h++){const b=i==h?s:p&&p[g],y=b?b+"px":"";if(o+=b||r,b||(a=!1),l)l.style.width!=y&&(l.style.width=y),l=l.nextSibling;else{const C=document.createElement("col");C.style.width=y,e.appendChild(C)}}}for(;l;){var u;const d=l.nextSibling;(u=l.parentNode)===null||u===void 0||u.removeChild(l),l=d}a?(n.style.width=o+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=o+"px")}}const Ht=new me("tableColumnResizing");function ZI({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=tk,lastColumnResizable:i=!0}={}){const s=new re({key:Ht,state:{init(o,a){var l;const c=(l=s.spec)===null||l===void 0||(l=l.props)===null||l===void 0?void 0:l.nodeViews,u=ft(a.schema).table.name;return r&&c&&(c[u]=(d,h)=>new r(d,n,h)),new eO(-1,!1)},apply(o,a){return a.apply(o)}},props:{attributes:o=>{const a=Ht.getState(o);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,a)=>{tO(o,a,t,i)},mouseleave:o=>{nO(o)},mousedown:(o,a)=>{rO(o,a,e,n)}},decorations:o=>{const a=Ht.getState(o);if(a&&a.activeHandle>-1)return lO(o,a.activeHandle)},nodeViews:{}}});return s}var eO=class al{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Ht);if(r&&r.setHandle!=null)return new al(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new al(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return ph(e.doc.resolve(i))||(i=-1),new al(i,n.dragging)}return n}};function tO(t,e,n,r){if(!t.editable)return;const i=Ht.getState(t.state);if(i&&!i.dragging){const s=sO(e.target);let o=-1;if(s){const{left:a,right:l}=s.getBoundingClientRect();e.clientX-a<=n?o=zg(t,e,"left",n):l-e.clientX<=n&&(o=zg(t,e,"right",n))}if(o!=i.activeHandle){if(!r&&o!==-1){const a=t.state.doc.resolve(o),l=a.node(-1),c=Ae.get(l),u=a.start(-1);if(c.colCount(a.pos-u)+a.nodeAfter.attrs.colspan-1==c.width-1)return}nk(t,o)}}}function nO(t){if(!t.editable)return;const e=Ht.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&nk(t,-1)}function rO(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,o=Ht.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const a=t.state.doc.nodeAt(o.activeHandle),l=iO(t,o.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta(Ht,{setDragging:{startX:e.clientX,startWidth:l}}));function c(d){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",u);const h=Ht.getState(t.state);h?.dragging&&(oO(t,h.activeHandle,Vg(h.dragging,d,n)),t.dispatch(t.state.tr.setMeta(Ht,{setDragging:null})))}function u(d){if(!d.which)return c(d);const h=Ht.getState(t.state);if(h&&h.dragging){const f=Vg(h.dragging,d,n);jg(t,h.activeHandle,f,r)}}return jg(t,o.activeHandle,l,r),s.addEventListener("mouseup",c),s.addEventListener("mousemove",u),e.preventDefault(),!0}function iO(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=t.domAtPos(e);let o=s.node.childNodes[s.offset].offsetWidth,a=n;if(r)for(let l=0;l<n;l++)r[l]&&(o-=r[l],a--);return o/a}function sO(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function zg(t,e,n,r){const i=n=="right"?-r:r,s=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!s)return-1;const{pos:o}=s,a=ki(t.state.doc.resolve(o));if(!a)return-1;if(n=="right")return a.pos;const l=Ae.get(a.node(-1)),c=a.start(-1),u=l.map.indexOf(a.pos-c);return u%l.width==0?-1:c+l.map[u-1]}function Vg(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function nk(t,e){t.dispatch(t.state.tr.setMeta(Ht,{setHandle:e}))}function oO(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=Ae.get(i),o=r.start(-1),a=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,l=t.state.tr;for(let c=0;c<s.height;c++){const u=c*s.width+a;if(c&&s.map[u]==s.map[u-s.width])continue;const d=s.map[u],h=i.nodeAt(d).attrs,f=h.colspan==1?0:a-s.colCount(d);if(h.colwidth&&h.colwidth[f]==n)continue;const p=h.colwidth?h.colwidth.slice():aO(h.colspan);p[f]=n,l.setNodeMarkup(o+d,null,{...h,colwidth:p})}l.docChanged&&t.dispatch(l)}function jg(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),o=i.start(-1),a=Ae.get(s).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1;let l=t.domAtPos(i.start(-1)).node;for(;l&&l.nodeName!="TABLE";)l=l.parentNode;l&&gh(s,l.firstChild,l,r,a,n)}function aO(t){return Array(t).fill(0)}function lO(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return ue.empty;const s=Ae.get(i),o=r.start(-1),a=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){const u=a+c*s.width;if((a==s.width-1||s.map[u]!=s.map[u+1])&&(c==0||s.map[u]!=s.map[u-s.width])){var l;const d=s.map[u],h=o+d+i.nodeAt(d).nodeSize-1,f=document.createElement("div");f.className="column-resize-handle",!((l=Ht.getState(t))===null||l===void 0)&&l.dragging&&n.push(Ee.node(o+d,o+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),n.push(Ee.widget(h,f))}}return ue.create(t.doc,n)}function cO({allowTableNodeSelection:t=!1}={}){return new re({key:Tr,state:{init(){return null},apply(e,n){const r=e.getMeta(Tr);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:i,pos:s}=e.mapping.mapResult(n);return i?null:s}},props:{decorations:SI,handleDOMEvents:{mousedown:XI},createSelectionBetween(e){return Tr.getState(e.state)!=null?e.state.selection:null},handleTripleClick:QI,handleKeyDown:GI,handlePaste:JI},appendTransaction(e,n,r){return AI(r,NI(r,n),t)}})}const nn=()=>new Map,bh=t=>{const e=nn();return t.forEach((n,r)=>{e.set(r,n)}),e},Un=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},uO=(t,e)=>{const n=[];for(const[r,i]of t)n.push(e(i,r));return n},dO=(t,e)=>{for(const[n,r]of t)if(e(r,n))return!0;return!1},Ci=()=>new Set,Gu=t=>t[t.length-1],hO=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},Pr=Array.from,ip=(t,e)=>{for(let n=0;n<t.length;n++)if(!e(t[n],n,t))return!1;return!0},sp=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},fO=(t,e)=>{const n=new Array(t);for(let r=0;r<t;r++)n[r]=e(r,n);return n},ys=Array.isArray;class rk{constructor(){this._observers=nn()}on(e,n){return Un(this._observers,e,Ci).add(n),n}once(e,n){const r=(...i)=>{this.off(e,r),n(...i)};this.on(e,r)}off(e,n){const r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return Pr((this._observers.get(e)||nn()).values()).forEach(r=>r(...n))}destroy(){this._observers=nn()}}const yn=Math.floor,ll=Math.abs,sr=(t,e)=>t<e?t:e,En=(t,e)=>t>e?t:e,ik=t=>t!==0?t<0:1/t<0,qg=1,Wg=2,Qu=4,Ju=8,Uo=32,or=64,bt=128,pO=1<<29,Zc=31,yh=63,li=127,mO=2147483647,Bl=Number.MAX_SAFE_INTEGER,Yg=Number.MIN_SAFE_INTEGER,gO=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&yn(t)===t),sk=String.fromCharCode,bO=t=>t.toLowerCase(),yO=/^\s*/g,EO=t=>t.replace(yO,""),kO=/([A-Z])/g,Kg=(t,e)=>EO(t.replace(kO,n=>`${e}${bO(n)}`)),TO=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=e.codePointAt(i);return r},$o=typeof TextEncoder<"u"?new TextEncoder:null,CO=t=>$o.encode(t),SO=$o?CO:TO;let uo=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});uo&&uo.decode(new Uint8Array).length===1&&(uo=null);const wO=(t,e)=>fO(e,()=>t).join("");class ca{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const ua=()=>new ca,xO=t=>{const e=ua();return t(e),pn(e)},AO=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},pn=t=>{const e=new Uint8Array(AO(t));let n=0;for(let r=0;r<t.bufs.length;r++){const i=t.bufs[r];e.set(i,n),n+=i.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},_O=(t,e)=>{const n=t.cbuf.length;n-t.cpos<e&&(t.bufs.push(new Uint8Array(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(En(n,e)*2),t.cpos=0)},Ke=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},Eh=Ke,le=(t,e)=>{for(;e>li;)Ke(t,bt|li&e),e=yn(e/128);Ke(t,li&e)},op=(t,e)=>{const n=ik(e);for(n&&(e=-e),Ke(t,(e>yh?bt:0)|(n?or:0)|yh&e),e=yn(e/64);e>0;)Ke(t,(e>li?bt:0)|li&e),e=yn(e/128)},kh=new Uint8Array(3e4),NO=kh.length/3,IO=(t,e)=>{if(e.length<NO){const n=$o.encodeInto(e,kh).written||0;le(t,n);for(let r=0;r<n;r++)Ke(t,kh[r])}else Pt(t,SO(e))},OO=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;le(t,r);for(let i=0;i<r;i++)Ke(t,n.codePointAt(i))},es=$o&&$o.encodeInto?IO:OO,eu=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=sr(n-r,e.length),s=e.length-i;t.cbuf.set(e.subarray(0,i),r),t.cpos+=i,s>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(En(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},Pt=(t,e)=>{le(t,e.byteLength),eu(t,e)},ap=(t,e)=>{_O(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},MO=(t,e)=>ap(t,4).setFloat32(0,e,!1),vO=(t,e)=>ap(t,8).setFloat64(0,e,!1),DO=(t,e)=>ap(t,8).setBigInt64(0,e,!1),Gg=new DataView(new ArrayBuffer(4)),LO=t=>(Gg.setFloat32(0,t),Gg.getFloat32(0)===t),Es=(t,e)=>{switch(typeof e){case"string":Ke(t,119),es(t,e);break;case"number":gO(e)&&ll(e)<=mO?(Ke(t,125),op(t,e)):LO(e)?(Ke(t,124),MO(t,e)):(Ke(t,123),vO(t,e));break;case"bigint":Ke(t,122),DO(t,e);break;case"object":if(e===null)Ke(t,126);else if(ys(e)){Ke(t,117),le(t,e.length);for(let n=0;n<e.length;n++)Es(t,e[n])}else if(e instanceof Uint8Array)Ke(t,116),Pt(t,e);else{Ke(t,118);const n=Object.keys(e);le(t,n.length);for(let r=0;r<n.length;r++){const i=n[r];es(t,i),Es(t,e[i])}}break;case"boolean":Ke(t,e?120:121);break;default:Ke(t,127)}};class Qg extends ca{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&le(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const Jg=t=>{t.count>0&&(op(t.encoder,t.count===1?t.s:-t.s),t.count>1&&le(t.encoder,t.count-2))};class cl{constructor(){this.encoder=new ca,this.s=0,this.count=0}write(e){this.s===e?this.count++:(Jg(this),this.count=1,this.s=e)}toUint8Array(){return Jg(this),pn(this.encoder)}}const Xg=t=>{if(t.count>0){const e=t.diff*2+(t.count===1?0:1);op(t.encoder,e),t.count>1&&le(t.encoder,t.count-2)}};class Xu{constructor(){this.encoder=new ca,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(Xg(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return Xg(this),pn(this.encoder)}}class RO{constructor(){this.sarr=[],this.s="",this.lensE=new cl}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new ca;return this.sarr.push(this.s),this.s="",es(e,this.sarr.join("")),eu(e,this.lensE.toUint8Array()),pn(e)}}const Bn=t=>new Error(t),rn=()=>{throw Bn("Method unimplemented")},kt=()=>{throw Bn("Unexpected case")},ok=Bn("Unexpected end of array"),ak=Bn("Integer out of Range");class tu{constructor(e){this.arr=e,this.pos=0}}const Os=t=>new tu(t),PO=t=>t.pos!==t.arr.length,BO=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},Bt=t=>BO(t,oe(t)),ks=t=>t.arr[t.pos++],oe=t=>{let e=0,n=1;const r=t.arr.length;for(;t.pos<r;){const i=t.arr[t.pos++];if(e=e+(i&li)*n,n*=128,i<bt)return e;if(e>Bl)throw ak}throw ok},lp=t=>{let e=t.arr[t.pos++],n=e&yh,r=64;const i=(e&or)>0?-1:1;if((e&bt)===0)return i*n;const s=t.arr.length;for(;t.pos<s;){if(e=t.arr[t.pos++],n=n+(e&li)*r,r*=128,e<bt)return i*n;if(n>Bl)throw ak}throw ok},FO=t=>{let e=oe(t);if(e===0)return"";{let n=String.fromCodePoint(ks(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(ks(t));else for(;e>0;){const r=e<1e4?e:1e4,i=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,i),e-=r}return decodeURIComponent(escape(n))}},HO=t=>uo.decode(Bt(t)),ts=uo?HO:FO,cp=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},UO=t=>cp(t,4).getFloat32(0,!1),$O=t=>cp(t,8).getFloat64(0,!1),zO=t=>cp(t,8).getBigInt64(0,!1),VO=[t=>{},t=>null,lp,UO,$O,zO,t=>!1,t=>!0,ts,t=>{const e=oe(t),n={};for(let r=0;r<e;r++){const i=ts(t);n[i]=zo(t)}return n},t=>{const e=oe(t),n=[];for(let r=0;r<e;r++)n.push(zo(t));return n},Bt],zo=t=>VO[127-ks(t)](t);class Zg extends tu{constructor(e,n){super(e),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),PO(this)?this.count=oe(this)+1:this.count=-1),this.count--,this.s}}class ul extends tu{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=lp(this);const e=ik(this.s);this.count=1,e&&(this.s=-this.s,this.count=oe(this)+2)}return this.count--,this.s}}class Zu extends tu{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=lp(this),n=e&1;this.diff=yn(e/2),this.count=1,n&&(this.count=oe(this)+2)}return this.s+=this.diff,this.count--,this.s}}class jO{constructor(e){this.decoder=new ul(e),this.str=ts(this.decoder),this.spos=0}read(){const e=this.spos+this.decoder.read(),n=this.str.slice(this.spos,e);return this.spos=e,n}}const qO=crypto.getRandomValues.bind(crypto),WO=Math.random,lk=()=>qO(new Uint32Array(1))[0],YO=t=>t[yn(WO()*t.length)],KO="10000000-1000-4000-8000"+-1e11,GO=()=>KO.replace(/[018]/g,t=>(t^lk()&15>>t/4).toString(16)),QO=Date.now,e0=t=>new Promise(t);Promise.all.bind(Promise);const t0=t=>t===void 0?null:t;class JO{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let ck=new JO,XO=!0;try{typeof localStorage<"u"&&localStorage&&(ck=localStorage,XO=!1)}catch{}const ZO=ck,Vo=Symbol("Equality"),uk=(t,e)=>t===e||!!t?.[Vo]?.(e)||!1,eM=t=>typeof t=="object",tM=Object.assign,dk=Object.keys,nM=(t,e)=>{for(const n in t)e(t[n],n)},Fl=t=>dk(t).length,rM=t=>{for(const e in t)return!1;return!0},Ms=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},up=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),iM=(t,e)=>t===e||Fl(t)===Fl(e)&&Ms(t,(n,r)=>(n!==void 0||up(e,r))&&uk(e[r],n)),sM=Object.freeze,hk=t=>{for(const e in t){const n=t[e];(typeof n=="object"||typeof n=="function")&&hk(t[e])}return sM(t)},dp=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&dp(t,e,n+1)}},oM=t=>t,dl=(t,e)=>{if(t===e)return!0;if(t==null||e==null||t.constructor!==e.constructor&&(t.constructor||Object)!==(e.constructor||Object))return!1;if(t[Vo]!=null)return t[Vo](e);switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:{if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;break}case Set:{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;break}case Map:{if(t.size!==e.size)return!1;for(const n of t.keys())if(!e.has(n)||!dl(t.get(n),e.get(n)))return!1;break}case void 0:case Object:if(Fl(t)!==Fl(e))return!1;for(const n in t)if(!up(t,n)||!dl(t[n],e[n]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!dl(t[n],e[n]))return!1;break;default:return!1}return!0},aM=(t,e)=>e.includes(t);var fk={};const Ts=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",pk=typeof window<"u"&&typeof document<"u"&&!Ts;let An;const lM=()=>{if(An===void 0)if(Ts){An=nn();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];r[0]==="-"?(e!==null&&An.set(e,""),e=r):e!==null&&(An.set(e,r),e=null)}e!==null&&An.set(e,"")}else typeof location=="object"?(An=nn(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");An.set(`--${Kg(e,"-")}`,n),An.set(`-${Kg(e,"-")}`,n)}})):An=nn();return An},Th=t=>lM().has(t),Hl=t=>t0(Ts?fk[t.toUpperCase().replaceAll("-","_")]:ZO.getItem(t)),mk=t=>Th("--"+t)||Hl(t)!==null,cM=mk("production"),uM=Ts&&aM(fk.FORCE_COLOR,["true","1","2"]),dM=uM||!Th("--no-colors")&&!mk("no-color")&&(!Ts||process.stdout.isTTY)&&(!Ts||Th("--color")||Hl("COLORTERM")!==null||(Hl("TERM")||"").includes("color")),hM=t=>new Uint8Array(t),fM=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=sk(t[n]);return btoa(e)},pM=t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),mM=pk?fM:pM,gM=t=>{const e=hM(t.byteLength);return e.set(t),e},bM=t=>xO(e=>Es(e,t));class yM{constructor(e,n){this.left=e,this.right=n}}const Yn=(t,e)=>new yM(t,e),n0=t=>t.next()>=.5,ed=(t,e,n)=>yn(t.next()*(n+1-e)+e),gk=(t,e,n)=>yn(t.next()*(n+1-e)+e),hp=(t,e,n)=>gk(t,e,n),EM=t=>sk(hp(t,97,122)),kM=(t,e=0,n=20)=>{const r=hp(t,e,n);let i="";for(let s=0;s<r;s++)i+=EM(t);return i},td=(t,e)=>e[hp(t,0,e.length-1)],TM=Symbol("0schema");class CM{constructor(){this._rerrs=[]}extend(e,n,r,i=null){this._rerrs.push({path:e,expected:n,has:r,message:i})}toString(){const e=[];for(let n=this._rerrs.length-1;n>0;n--){const r=this._rerrs[n];e.push(wO(" ",(this._rerrs.length-n)*2)+`${r.path!=null?`[${r.path}] `:""}${r.has} doesn't match ${r.expected}. ${r.message}`)}return e.join(`
|
|
108
|
-
`)}}const Ch=(t,e)=>t===e?!0:t==null||e==null||t.constructor!==e.constructor?!1:t[Vo]?uk(t,e):ys(t)?ip(t,n=>sp(e,r=>Ch(n,r))):eM(t)?Ms(t,(n,r)=>Ch(n,e[r])):!1;let Tt=class{static _dilutes=!1;extends(e){let[n,r]=[this.shape,e.shape];return this.constructor._dilutes&&([r,n]=[n,r]),Ch(n,r)}equals(e){return this.constructor===e.constructor&&dl(this.shape,e.shape)}[TM](){return!0}[Vo](e){return this.equals(e)}validate(e){return this.check(e)}check(e,n){rn()}get nullable(){return vs(this,ou)}get optional(){return new Ek(this)}cast(e){return r0(e,this),e}expect(e){return r0(e,this),e}};class fp extends Tt{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n=void 0){const r=e?.constructor===this.shape&&(this._c==null||this._c(e));return!r&&n?.extend(null,this.shape.name,e?.constructor.name,e?.constructor!==this.shape?"Constructor match failed":"Check failed"),r}}const je=(t,e=null)=>new fp(t,e);je(fp);class pp extends Tt{constructor(e){super(),this.shape=e}check(e,n){const r=this.shape(e);return!r&&n?.extend(null,"custom prop",e?.constructor.name,"failed to check custom prop"),r}}const Ze=t=>new pp(t);je(pp);class nu extends Tt{constructor(e){super(),this.shape=e}check(e,n){const r=this.shape.some(i=>i===e);return!r&&n?.extend(null,this.shape.join(" | "),e.toString()),r}}const ru=(...t)=>new nu(t),bk=je(nu),SM=RegExp.escape||(t=>t.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),yk=t=>{if(Cs.check(t))return[SM(t)];if(bk.check(t))return t.shape.map(e=>e+"");if(Nk.check(t))return["[+-]?\\d+.?\\d*"];if(Ik.check(t))return[".*"];if(Ul.check(t))return t.shape.map(yk).flat(1);kt()};class wM extends Tt{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(yk).map(n=>`(${n.join("|")})`).join("")+"$")}check(e,n){const r=this._r.exec(e)!=null;return!r&&n?.extend(null,this._r.toString(),e.toString(),"String doesn't match string template."),r}}je(wM);const xM=Symbol("optional");class Ek extends Tt{constructor(e){super(),this.shape=e}check(e,n){const r=e===void 0||this.shape.check(e);return!r&&n?.extend(null,"undefined (optional)","()"),r}get[xM](){return!0}}const AM=je(Ek);class _M extends Tt{check(e,n){return n?.extend(null,"never",typeof e),!1}}je(_M);class iu extends Tt{constructor(e,n=!1){super(),this.shape=e,this._isPartial=n}static _dilutes=!0;get partial(){return new iu(this.shape,!0)}check(e,n){return e==null?(n?.extend(null,"object","null"),!1):Ms(this.shape,(r,i)=>{const s=this._isPartial&&!up(e,i)||r.check(e[i],n);return!s&&n?.extend(i.toString(),r.toString(),typeof e[i],"Object property does not match"),s})}}const NM=t=>new iu(t),IM=je(iu),OM=Ze(t=>t!=null&&(t.constructor===Object||t.constructor==null));class kk extends Tt{constructor(e,n){super(),this.shape={keys:e,values:n}}check(e,n){return e!=null&&Ms(e,(r,i)=>{const s=this.shape.keys.check(i,n);return!s&&n?.extend(i+"","Record",typeof e,s?"Key doesn't match schema":"Value doesn't match value"),s&&this.shape.values.check(r,n)})}}const Tk=(t,e)=>new kk(t,e),MM=je(kk);class Ck extends Tt{constructor(e){super(),this.shape=e}check(e,n){return e!=null&&Ms(this.shape,(r,i)=>{const s=r.check(e[i],n);return!s&&n?.extend(i.toString(),"Tuple",typeof r),s})}}const vM=(...t)=>new Ck(t);je(Ck);class Sk extends Tt{constructor(e){super(),this.shape=e.length===1?e[0]:new mp(e)}check(e,n){const r=ys(e)&&ip(e,i=>this.shape.check(i));return!r&&n?.extend(null,"Array",""),r}}const wk=(...t)=>new Sk(t),DM=je(Sk),LM=Ze(t=>ys(t));class xk extends Tt{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n){const r=e instanceof this.shape&&(this._c==null||this._c(e));return!r&&n?.extend(null,this.shape.name,e?.constructor.name),r}}const RM=(t,e=null)=>new xk(t,e);je(xk);const PM=RM(Tt);class BM extends Tt{constructor(e){super(),this.len=e.length-1,this.args=vM(...e.slice(-1)),this.res=e[this.len]}check(e,n){const r=e.constructor===Function&&e.length<=this.len;return!r&&n?.extend(null,"function",typeof e),r}}const FM=je(BM),HM=Ze(t=>typeof t=="function");class UM extends Tt{constructor(e){super(),this.shape=e}check(e,n){const r=ip(this.shape,i=>i.check(e,n));return!r&&n?.extend(null,"Intersectinon",typeof e),r}}je(UM,t=>t.shape.length>0);class mp extends Tt{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,n){const r=sp(this.shape,i=>i.check(e,n));return n?.extend(null,"Union",typeof e),r}}const vs=(...t)=>t.findIndex(e=>Ul.check(e))>=0?vs(...t.map(e=>jo(e)).map(e=>Ul.check(e)?e.shape:[e]).flat(1)):t.length===1?t[0]:new mp(t),Ul=je(mp),Ak=()=>!0,$l=Ze(Ak),$M=je(pp,t=>t.shape===Ak),gp=Ze(t=>typeof t=="bigint"),zM=Ze(t=>t===gp),_k=Ze(t=>typeof t=="symbol");Ze(t=>t===_k);const ns=Ze(t=>typeof t=="number"),Nk=Ze(t=>t===ns),Cs=Ze(t=>typeof t=="string"),Ik=Ze(t=>t===Cs),su=Ze(t=>typeof t=="boolean"),VM=Ze(t=>t===su),Ok=ru(void 0);je(nu,t=>t.shape.length===1&&t.shape[0]===void 0);ru(void 0);const ou=ru(null),jM=je(nu,t=>t.shape.length===1&&t.shape[0]===null);je(Uint8Array);je(fp,t=>t.shape===Uint8Array);const qM=vs(ns,Cs,ou,Ok,gp,su,_k);(()=>{const t=wk($l),e=Tk(Cs,$l),n=vs(ns,Cs,ou,su,t,e);return t.shape=n,e.shape.values=n,n})();const jo=t=>{if(PM.check(t))return t;if(OM.check(t)){const e={};for(const n in t)e[n]=jo(t[n]);return NM(e)}else{if(LM.check(t))return vs(...t.map(jo));if(qM.check(t))return ru(t);if(HM.check(t))return je(t)}kt()},r0=cM?()=>{}:(t,e)=>{const n=new CM;if(!e.check(t,n))throw Bn(`Expected value to be of type ${e.constructor.name}.
|
|
109
|
-
${n.toString()}`)};class WM{constructor(e){this.patterns=[],this.$state=e}if(e,n){return this.patterns.push({if:jo(e),h:n}),this}else(e){return this.if($l,e)}done(){return(e,n)=>{for(let r=0;r<this.patterns.length;r++){const i=this.patterns[r];if(i.if.check(e))return i.h(e,n)}throw Bn("Unhandled pattern")}}}const YM=t=>new WM(t),Mk=YM($l).if(Nk,(t,e)=>ed(e,Yg,Bl)).if(Ik,(t,e)=>kM(e)).if(VM,(t,e)=>n0(e)).if(zM,(t,e)=>BigInt(ed(e,Yg,Bl))).if(Ul,(t,e)=>$i(e,td(e,t.shape))).if(IM,(t,e)=>{const n={};for(const r in t.shape){let i=t.shape[r];if(AM.check(i)){if(n0(e))continue;i=i.shape}n[r]=Mk(i,e)}return n}).if(DM,(t,e)=>{const n=[],r=gk(e,0,42);for(let i=0;i<r;i++)n.push($i(e,t.shape));return n}).if(bk,(t,e)=>td(e,t.shape)).if(jM,(t,e)=>null).if(FM,(t,e)=>{const n=$i(e,t.res);return()=>n}).if($M,(t,e)=>$i(e,td(e,[ns,Cs,ou,Ok,gp,su,wk(ns),Tk(vs("a","b","c"),ns)]))).if(MM,(t,e)=>{const n={},r=ed(e,0,3);for(let i=0;i<r;i++){const s=$i(e,t.shape.keys),o=$i(e,t.shape.values);n[s]=o}return n}).done(),$i=(t,e)=>Mk(jo(e),t),da=typeof document<"u"?document:{};Ze(t=>t.nodeType===XM);typeof DOMParser<"u"&&new DOMParser;Ze(t=>t.nodeType===GM);Ze(t=>t.nodeType===QM);const KM=t=>uO(t,(e,n)=>`${n}:${e};`).join(""),GM=da.ELEMENT_NODE,QM=da.TEXT_NODE,JM=da.DOCUMENT_NODE,XM=da.DOCUMENT_FRAGMENT_NODE;Ze(t=>t.nodeType===JM);const ZM=t=>class{constructor(n){this._=n}destroy(){t(this._)}},e3=ZM(clearTimeout),bp=(t,e)=>new e3(setTimeout(e,t)),lr=Symbol,vk=lr(),Dk=lr(),t3=lr(),n3=lr(),r3=lr(),Lk=lr(),i3=lr(),yp=lr(),s3=lr(),o3=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());const e=[],n=[];let r=0;for(;r<t.length;r++){const i=t[r];if(i===void 0)break;if(i.constructor===String||i.constructor===Number)e.push(i);else if(i.constructor===Object)break}for(r>0&&n.push(e.join(""));r<t.length;r++){const i=t[r];i instanceof Symbol||n.push(i)}return n},a3={[vk]:Yn("font-weight","bold"),[Dk]:Yn("font-weight","normal"),[t3]:Yn("color","blue"),[r3]:Yn("color","green"),[n3]:Yn("color","grey"),[Lk]:Yn("color","red"),[i3]:Yn("color","purple"),[yp]:Yn("color","orange"),[s3]:Yn("color","black")},l3=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());const e=[],n=[],r=nn();let i=[],s=0;for(;s<t.length;s++){const o=t[s],a=a3[o];if(a!==void 0)r.set(a.left,a.right);else{if(o===void 0)break;if(o.constructor===String||o.constructor===Number){const l=KM(r);s>0||l.length>0?(e.push("%c"+o),n.push(l)):e.push(o)}else break}}for(s>0&&(i=n,i.unshift(e.join("")));s<t.length;s++){const o=t[s];o instanceof Symbol||i.push(o)}return i},Rk=dM?l3:o3,c3=(...t)=>{console.log(...Rk(t)),Bk.forEach(e=>e.print(t))},Pk=(...t)=>{console.warn(...Rk(t)),t.unshift(yp),Bk.forEach(e=>e.print(t))},Bk=Ci(),Fk=t=>({[Symbol.iterator](){return this},next:t}),u3=(t,e)=>Fk(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),nd=(t,e)=>Fk(()=>{const{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}});class au{constructor(e,n){this.clock=e,this.len=n}}class Ds{constructor(){this.clients=new Map}}const Br=(t,e,n)=>e.clients.forEach((r,i)=>{const s=t.doc.store.clients.get(i);if(s!=null){const o=s[s.length-1],a=o.id.clock+o.length;for(let l=0,c=r[l];l<r.length&&c.clock<a;c=r[++l])Xk(t,s,c.clock,c.len,n)}}),d3=(t,e)=>{let n=0,r=t.length-1;for(;n<=r;){const i=yn((n+r)/2),s=t[i],o=s.clock;if(o<=e){if(e<o+s.len)return i;n=i+1}else r=i-1}return null},Ls=(t,e)=>{const n=t.clients.get(e.client);return n!==void 0&&d3(n,e.clock)!==null},Ep=t=>{t.clients.forEach(e=>{e.sort((i,s)=>i.clock-s.clock);let n,r;for(n=1,r=1;n<e.length;n++){const i=e[r-1],s=e[n];i.clock+i.len>=s.clock?e[r-1]=new au(i.clock,En(i.len,s.clock+s.len-i.clock)):(r<n&&(e[r]=s),r++)}e.length=r})},Sh=t=>{const e=new Ds;for(let n=0;n<t.length;n++)t[n].clients.forEach((r,i)=>{if(!e.clients.has(i)){const s=r.slice();for(let o=n+1;o<t.length;o++)hO(s,t[o].clients.get(i)||[]);e.clients.set(i,s)}});return Ep(e),e},qo=(t,e,n,r)=>{Un(t.clients,e,()=>[]).push(new au(n,r))},Hk=()=>new Ds,Uk=t=>{const e=Hk();return t.clients.forEach((n,r)=>{const i=[];for(let s=0;s<n.length;s++){const o=n[s];if(o.deleted){const a=o.id.clock;let l=o.length;if(s+1<n.length)for(let c=n[s+1];s+1<n.length&&c.deleted;c=n[++s+1])l+=c.length;i.push(new au(a,l))}}i.length>0&&e.clients.set(r,i)}),e},Rs=(t,e)=>{le(t.restEncoder,e.clients.size),Pr(e.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{t.resetDsCurVal(),le(t.restEncoder,n);const i=r.length;le(t.restEncoder,i);for(let s=0;s<i;s++){const o=r[s];t.writeDsClock(o.clock),t.writeDsLen(o.len)}})},kp=t=>{const e=new Ds,n=oe(t.restDecoder);for(let r=0;r<n;r++){t.resetDsCurVal();const i=oe(t.restDecoder),s=oe(t.restDecoder);if(s>0){const o=Un(e.clients,i,()=>[]);for(let a=0;a<s;a++)o.push(new au(t.readDsClock(),t.readDsLen()))}}return e},i0=(t,e,n)=>{const r=new Ds,i=oe(t.restDecoder);for(let s=0;s<i;s++){t.resetDsCurVal();const o=oe(t.restDecoder),a=oe(t.restDecoder),l=n.clients.get(o)||[],c=Be(n,o);for(let u=0;u<a;u++){const d=t.readDsClock(),h=d+t.readDsLen();if(d<c){c<h&&qo(r,o,c,h-c);let f=on(l,d),p=l[f];for(!p.deleted&&p.id.clock<d&&(l.splice(f+1,0,Kl(e,p,d-p.id.clock)),f++);f<l.length&&(p=l[f++],p.id.clock<h);)p.deleted||(h<p.id.clock+p.length&&l.splice(f,0,Kl(e,p,h-p.id.clock)),p.delete(e))}else qo(r,o,d,h-d)}}if(r.clients.size>0){const s=new Si;return le(s.restEncoder,0),Rs(s,r),s.toUint8Array()}return null},$k=lk;class Vr extends rk{constructor({guid:e=GO(),collectionid:n=null,gc:r=!0,gcFilter:i=()=>!0,meta:s=null,autoLoad:o=!1,shouldLoad:a=!0}={}){super(),this.gc=r,this.gcFilter=i,this.clientID=$k(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new Qk,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=a,this.autoLoad=o,this.meta=s,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=e0(c=>{this.on("load",()=>{this.isLoaded=!0,c(this)})});const l=()=>e0(c=>{const u=d=>{(d===void 0||d===!0)&&(this.off("sync",u),c())};this.on("sync",u)});this.on("sync",c=>{c===!1&&this.isSynced&&(this.whenSynced=l()),this.isSynced=c===void 0||c===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=l()}load(){const e=this._item;e!==null&&!this.shouldLoad&&Ce(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(Pr(this.subdocs).map(e=>e.guid))}transact(e,n=null){return Ce(this,e,n)}get(e,n=Qe){const r=Un(this.share,e,()=>{const s=new n;return s._integrate(this,null),s}),i=r.constructor;if(n!==Qe&&i!==n)if(i===Qe){const s=new n;s._map=r._map,r._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=s}),s._start=r._start;for(let o=s._start;o!==null;o=o.right)o.parent=s;return s._length=r._length,this.share.set(e,s),s._integrate(this,null),s}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=""){return this.get(e,ss)}getText(e=""){return this.get(e,Fr)}getMap(e=""){return this.get(e,ws)}getXmlElement(e=""){return this.get(e,at)}getXmlFragment(e=""){return this.get(e,wi)}toJSON(){const e={};return this.share.forEach((n,r)=>{e[r]=n.toJSON()}),e}destroy(){this.isDestroyed=!0,Pr(this.subdocs).forEach(n=>n.destroy());const e=this._item;if(e!==null){this._item=null;const n=e.content;n.doc=new Vr({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,Ce(e.parent.doc,r=>{const i=n.doc;e.deleted||r.subdocsAdded.add(i),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class zk{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return oe(this.restDecoder)}readDsLen(){return oe(this.restDecoder)}}class Vk extends zk{readLeftID(){return Z(oe(this.restDecoder),oe(this.restDecoder))}readRightID(){return Z(oe(this.restDecoder),oe(this.restDecoder))}readClient(){return oe(this.restDecoder)}readInfo(){return ks(this.restDecoder)}readString(){return ts(this.restDecoder)}readParentInfo(){return oe(this.restDecoder)===1}readTypeRef(){return oe(this.restDecoder)}readLen(){return oe(this.restDecoder)}readAny(){return zo(this.restDecoder)}readBuf(){return gM(Bt(this.restDecoder))}readJSON(){return JSON.parse(ts(this.restDecoder))}readKey(){return ts(this.restDecoder)}}class h3{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=oe(this.restDecoder),this.dsCurrVal}readDsLen(){const e=oe(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class Ss extends h3{constructor(e){super(e),this.keys=[],oe(e),this.keyClockDecoder=new Zu(Bt(e)),this.clientDecoder=new ul(Bt(e)),this.leftClockDecoder=new Zu(Bt(e)),this.rightClockDecoder=new Zu(Bt(e)),this.infoDecoder=new Zg(Bt(e),ks),this.stringDecoder=new jO(Bt(e)),this.parentInfoDecoder=new Zg(Bt(e),ks),this.typeRefDecoder=new ul(Bt(e)),this.lenDecoder=new ul(Bt(e))}readLeftID(){return new rs(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new rs(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return zo(this.restDecoder)}readBuf(){return Bt(this.restDecoder)}readJSON(){return zo(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{const n=this.stringDecoder.read();return this.keys.push(n),n}}}class jk{constructor(){this.restEncoder=ua()}toUint8Array(){return pn(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){le(this.restEncoder,e)}writeDsLen(e){le(this.restEncoder,e)}}class ha extends jk{writeLeftID(e){le(this.restEncoder,e.client),le(this.restEncoder,e.clock)}writeRightID(e){le(this.restEncoder,e.client),le(this.restEncoder,e.clock)}writeClient(e){le(this.restEncoder,e)}writeInfo(e){Eh(this.restEncoder,e)}writeString(e){es(this.restEncoder,e)}writeParentInfo(e){le(this.restEncoder,e?1:0)}writeTypeRef(e){le(this.restEncoder,e)}writeLen(e){le(this.restEncoder,e)}writeAny(e){Es(this.restEncoder,e)}writeBuf(e){Pt(this.restEncoder,e)}writeJSON(e){es(this.restEncoder,JSON.stringify(e))}writeKey(e){es(this.restEncoder,e)}}class qk{constructor(){this.restEncoder=ua(),this.dsCurrVal=0}toUint8Array(){return pn(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const n=e-this.dsCurrVal;this.dsCurrVal=e,le(this.restEncoder,n)}writeDsLen(e){e===0&&kt(),le(this.restEncoder,e-1),this.dsCurrVal+=e}}class Si extends qk{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Xu,this.clientEncoder=new cl,this.leftClockEncoder=new Xu,this.rightClockEncoder=new Xu,this.infoEncoder=new Qg(Eh),this.stringEncoder=new RO,this.parentInfoEncoder=new Qg(Eh),this.typeRefEncoder=new cl,this.lenEncoder=new cl}toUint8Array(){const e=ua();return le(e,0),Pt(e,this.keyClockEncoder.toUint8Array()),Pt(e,this.clientEncoder.toUint8Array()),Pt(e,this.leftClockEncoder.toUint8Array()),Pt(e,this.rightClockEncoder.toUint8Array()),Pt(e,pn(this.infoEncoder)),Pt(e,this.stringEncoder.toUint8Array()),Pt(e,pn(this.parentInfoEncoder)),Pt(e,this.typeRefEncoder.toUint8Array()),Pt(e,this.lenEncoder.toUint8Array()),eu(e,pn(this.restEncoder)),pn(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){Es(this.restEncoder,e)}writeBuf(e){Pt(this.restEncoder,e)}writeJSON(e){Es(this.restEncoder,e)}writeKey(e){const n=this.keyMap.get(e);n===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(n)}}const f3=(t,e,n,r)=>{r=En(r,e[0].id.clock);const i=on(e,r);le(t.restEncoder,e.length-i),t.writeClient(n),le(t.restEncoder,r);const s=e[i];s.write(t,r-s.id.clock);for(let o=i+1;o<e.length;o++)e[o].write(t,0)},Tp=(t,e,n)=>{const r=new Map;n.forEach((i,s)=>{Be(e,s)>i&&r.set(s,i)}),fa(e).forEach((i,s)=>{n.has(s)||r.set(s,0)}),le(t.restEncoder,r.size),Pr(r.entries()).sort((i,s)=>s[0]-i[0]).forEach(([i,s])=>{f3(t,e.clients.get(i),i,s)})},p3=(t,e)=>{const n=nn(),r=oe(t.restDecoder);for(let i=0;i<r;i++){const s=oe(t.restDecoder),o=new Array(s),a=t.readClient();let l=oe(t.restDecoder);n.set(a,{i:0,refs:o});for(let c=0;c<s;c++){const u=t.readInfo();switch(Zc&u){case 0:{const d=t.readLen();o[c]=new Jt(Z(a,l),d),l+=d;break}case 10:{const d=oe(t.restDecoder);o[c]=new Xt(Z(a,l),d),l+=d;break}default:{const d=(u&(or|bt))===0,h=new _e(Z(a,l),null,(u&bt)===bt?t.readLeftID():null,null,(u&or)===or?t.readRightID():null,d?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,d&&(u&Uo)===Uo?t.readString():null,kT(t,u));o[c]=h,l+=h.length}}}}return n},m3=(t,e,n)=>{const r=[];let i=Pr(n.keys()).sort((f,p)=>f-p);if(i.length===0)return null;const s=()=>{if(i.length===0)return null;let f=n.get(i[i.length-1]);for(;f.refs.length===f.i;)if(i.pop(),i.length>0)f=n.get(i[i.length-1]);else return null;return f};let o=s();if(o===null)return null;const a=new Qk,l=new Map,c=(f,p)=>{const g=l.get(f);(g==null||g>p)&&l.set(f,p)};let u=o.refs[o.i++];const d=new Map,h=()=>{for(const f of r){const p=f.id.client,g=n.get(p);g?(g.i--,a.clients.set(p,g.refs.slice(g.i)),n.delete(p),g.i=0,g.refs=[]):a.clients.set(p,[f]),i=i.filter(b=>b!==p)}r.length=0};for(;;){if(u.constructor!==Xt){const p=Un(d,u.id.client,()=>Be(e,u.id.client))-u.id.clock;if(p<0)r.push(u),c(u.id.client,u.id.clock-1),h();else{const g=u.getMissing(t,e);if(g!==null){r.push(u);const b=n.get(g)||{refs:[],i:0};if(b.refs.length===b.i)c(g,Be(e,g)),h();else{u=b.refs[b.i++];continue}}else(p===0||p<u.length)&&(u.integrate(t,p),d.set(u.id.client,u.id.clock+u.length))}}if(r.length>0)u=r.pop();else if(o!==null&&o.i<o.refs.length)u=o.refs[o.i++];else{if(o=s(),o===null)break;u=o.refs[o.i++]}}if(a.clients.size>0){const f=new Si;return Tp(f,a,new Map),le(f.restEncoder,0),{missing:l,update:f.toUint8Array()}}return null},g3=(t,e)=>Tp(t,e.doc.store,e.beforeState),b3=(t,e,n,r=new Ss(t))=>Ce(e,i=>{i.local=!1;let s=!1;const o=i.doc,a=o.store,l=p3(r,o),c=m3(i,a,l),u=a.pendingStructs;if(u){for(const[h,f]of u.missing)if(f<Be(a,h)){s=!0;break}if(c){for(const[h,f]of c.missing){const p=u.missing.get(h);(p==null||p>f)&&u.missing.set(h,f)}u.update=Vl([u.update,c.update])}}else a.pendingStructs=c;const d=i0(r,i,a);if(a.pendingDs){const h=new Ss(Os(a.pendingDs));oe(h.restDecoder);const f=i0(h,i,a);d&&f?a.pendingDs=Vl([d,f]):a.pendingDs=d||f}else a.pendingDs=d;if(s){const h=a.pendingStructs.update;a.pendingStructs=null,zl(i.doc,h)}},n,!1),zl=(t,e,n,r=Ss)=>{const i=Os(e);b3(i,t,n,new r(i))},s0=(t,e,n)=>zl(t,e,n,Vk),y3=(t,e,n=new Map)=>{Tp(t,e.store,n),Rs(t,Uk(e.store))},E3=(t,e=new Uint8Array([0]),n=new Si)=>{const r=Wk(e);y3(n,t,r);const i=[n.toUint8Array()];if(t.store.pendingDs&&i.push(t.store.pendingDs),t.store.pendingStructs&&i.push(F3(t.store.pendingStructs.update,e)),i.length>1){if(n.constructor===ha)return P3(i.map((s,o)=>o===0?s:U3(s)));if(n.constructor===Si)return Vl(i)}return i[0]},o0=(t,e)=>E3(t,e,new ha),k3=t=>{const e=new Map,n=oe(t.restDecoder);for(let r=0;r<n;r++){const i=oe(t.restDecoder),s=oe(t.restDecoder);e.set(i,s)}return e},Wk=t=>k3(new zk(Os(t))),Yk=(t,e)=>(le(t.restEncoder,e.size),Pr(e.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{le(t.restEncoder,n),le(t.restEncoder,r)}),t),T3=(t,e)=>Yk(t,fa(e.store)),C3=(t,e=new qk)=>(t instanceof Map?Yk(e,t):T3(e,t),e.toUint8Array()),S3=t=>C3(t,new jk);class w3{constructor(){this.l=[]}}const a0=()=>new w3,l0=(t,e)=>t.l.push(e),c0=(t,e)=>{const n=t.l,r=n.length;t.l=n.filter(i=>e!==i),r===t.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},Kk=(t,e,n)=>dp(t.l,[e,n]);class rs{constructor(e,n){this.client=e,this.clock=n}}const Qi=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,Z=(t,e)=>new rs(t,e),Wo=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw kt()},Yo=(t,e)=>{for(;e!==null;){if(e.parent===t)return!0;e=e.parent._item}return!1};class Ko{constructor(e,n,r,i=0){this.type=e,this.tname=n,this.item=r,this.assoc=i}}const ho=t=>new Ko(t.type==null?null:Z(t.type.client,t.type.clock),t.tname??null,t.item==null?null:Z(t.item.client,t.item.clock),t.assoc==null?0:t.assoc);class x3{constructor(e,n,r=0){this.type=e,this.index=n,this.assoc=r}}const A3=(t,e,n=0)=>new x3(t,e,n),Pa=(t,e,n)=>{let r=null,i=null;return t._item===null?i=Wo(t):r=Z(t._item.id.client,t._item.id.clock),new Ko(r,i,e,n)},rd=(t,e,n=0)=>{let r=t._start;if(n<0){if(e===0)return Pa(t,null,n);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return Pa(t,Z(r.id.client,r.id.clock+e),n);e-=r.length}if(r.right===null&&n<0)return Pa(t,r.lastId,n);r=r.right}return Pa(t,null,n)},_3=(t,e)=>{const n=is(t,e),r=e.clock-n.id.clock;return{item:n,diff:r}},N3=(t,e,n=!0)=>{const r=e.store,i=t.item,s=t.type,o=t.tname,a=t.assoc;let l=null,c=0;if(i!==null){if(Be(r,i.client)<=i.clock)return null;const u=n?_h(r,i):_3(r,i),d=u.item;if(!(d instanceof _e))return null;if(l=d.parent,l._item===null||!l._item.deleted){c=d.deleted||!d.countable?0:u.diff+(a>=0?0:1);let h=d.left;for(;h!==null;)!h.deleted&&h.countable&&(c+=h.length),h=h.left}}else{if(o!==null)l=e.get(o);else if(s!==null){if(Be(r,s.client)<=s.clock)return null;const{item:u}=n?_h(r,s):{item:is(r,s)};if(u instanceof _e&&u.content instanceof Sn)l=u.content.type;else return null}else throw kt();a>=0?c=l._length:c=0}return A3(l,c,t.assoc)},u0=(t,e)=>t===e||t!==null&&e!==null&&t.tname===e.tname&&Qi(t.item,e.item)&&Qi(t.type,e.type)&&t.assoc===e.assoc;class Cp{constructor(e,n){this.ds=e,this.sv=n}}const Gk=(t,e)=>new Cp(t,e),id=t=>Gk(Uk(t.store),fa(t.store)),Xr=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!Ls(e.ds,t.id),wh=(t,e)=>{const n=Un(t.meta,wh,Ci),r=t.doc.store;n.has(e)||(e.sv.forEach((i,s)=>{i<Be(r,s)&&Nt(t,Z(s,i))}),Br(t,e.ds,i=>{}),n.add(e))};class Qk{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const fa=t=>{const e=new Map;return t.clients.forEach((n,r)=>{const i=n[n.length-1];e.set(r,i.id.clock+i.length)}),e},Be=(t,e)=>{const n=t.clients.get(e);if(n===void 0)return 0;const r=n[n.length-1];return r.id.clock+r.length},Jk=(t,e)=>{let n=t.clients.get(e.id.client);if(n===void 0)n=[],t.clients.set(e.id.client,n);else{const r=n[n.length-1];if(r.id.clock+r.length!==e.id.clock)throw kt()}n.push(e)},on=(t,e)=>{let n=0,r=t.length-1,i=t[r],s=i.id.clock;if(s===e)return r;let o=yn(e/(s+i.length-1)*r);for(;n<=r;){if(i=t[o],s=i.id.clock,s<=e){if(e<s+i.length)return o;n=o+1}else r=o-1;o=yn((n+r)/2)}throw kt()},I3=(t,e)=>{const n=t.clients.get(e.client);return n[on(n,e.clock)]},is=I3,xh=(t,e,n)=>{const r=on(e,n),i=e[r];return i.id.clock<n&&i instanceof _e?(e.splice(r+1,0,Kl(t,i,n-i.id.clock)),r+1):r},Nt=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[xh(t,n,e.clock)]},d0=(t,e,n)=>{const r=e.clients.get(n.client),i=on(r,n.clock),s=r[i];return n.clock!==s.id.clock+s.length-1&&s.constructor!==Jt&&r.splice(i+1,0,Kl(t,s,n.clock-s.id.clock+1)),s},O3=(t,e,n)=>{const r=t.clients.get(e.id.client);r[on(r,e.id.clock)]=n},Xk=(t,e,n,r,i)=>{if(r===0)return;const s=n+r;let o=xh(t,e,n),a;do a=e[o++],s<a.id.clock+a.length&&xh(t,e,s),i(a);while(o<e.length&&e[o].id.clock<s)};class M3{constructor(e,n,r){this.doc=e,this.deleteSet=new Ds,this.beforeState=fa(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=n,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const h0=(t,e)=>e.deleteSet.clients.size===0&&!dO(e.afterState,(n,r)=>e.beforeState.get(r)!==n)?!1:(Ep(e.deleteSet),g3(t,e),Rs(t,e.deleteSet),!0),f0=(t,e,n)=>{const r=e._item;(r===null||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&Un(t.changed,e,Ci).add(n)},hl=(t,e)=>{let n=t[e],r=t[e-1],i=e;for(;i>0;n=r,r=t[--i-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof _e&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}const s=e-i;return s&&t.splice(e+1-s,s),s},v3=(t,e,n)=>{for(const[r,i]of t.clients.entries()){const s=e.clients.get(r);for(let o=i.length-1;o>=0;o--){const a=i[o],l=a.clock+a.len;for(let c=on(s,a.clock),u=s[c];c<s.length&&u.id.clock<l;u=s[++c]){const d=s[c];if(a.clock+a.len<=d.id.clock)break;d instanceof _e&&d.deleted&&!d.keep&&n(d)&&d.gc(e,!1)}}}},D3=(t,e)=>{t.clients.forEach((n,r)=>{const i=e.clients.get(r);for(let s=n.length-1;s>=0;s--){const o=n[s],a=sr(i.length-1,1+on(i,o.clock+o.len-1));for(let l=a,c=i[l];l>0&&c.id.clock>=o.clock;c=i[l])l-=1+hl(i,l)}})},Zk=(t,e)=>{if(e<t.length){const n=t[e],r=n.doc,i=r.store,s=n.deleteSet,o=n._mergeStructs;try{Ep(s),n.afterState=fa(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const a=[];n.changed.forEach((l,c)=>a.push(()=>{(c._item===null||!c._item.deleted)&&c._callObserver(n,l)})),a.push(()=>{n.changedParentTypes.forEach((l,c)=>{c._dEH.l.length>0&&(c._item===null||!c._item.deleted)&&(l=l.filter(u=>u.target._item===null||!u.target._item.deleted),l.forEach(u=>{u.currentTarget=c,u._path=null}),l.sort((u,d)=>u.path.length-d.path.length),a.push(()=>{Kk(c._dEH,l,n)}))}),a.push(()=>r.emit("afterTransaction",[n,r])),a.push(()=>{n._needFormattingCleanup&&ev(n)})}),dp(a,[])}finally{r.gc&&v3(s,i,r.gcFilter),D3(s,i),n.afterState.forEach((u,d)=>{const h=n.beforeState.get(d)||0;if(h!==u){const f=i.clients.get(d),p=En(on(f,h),1);for(let g=f.length-1;g>=p;)g-=1+hl(f,g)}});for(let u=o.length-1;u>=0;u--){const{client:d,clock:h}=o[u].id,f=i.clients.get(d),p=on(f,h);p+1<f.length&&hl(f,p+1)>1||p>0&&hl(f,p)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(c3(yp,vk,"[yjs] ",Dk,Lk,"Changed the client-id because another client seems to be using it."),r.clientID=$k()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const u=new ha;h0(u,n)&&r.emit("update",[u.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const u=new Si;h0(u,n)&&r.emit("updateV2",[u.toUint8Array(),n.origin,r,n])}const{subdocsAdded:a,subdocsLoaded:l,subdocsRemoved:c}=n;(a.size>0||c.size>0||l.size>0)&&(a.forEach(u=>{u.clientID=r.clientID,u.collectionid==null&&(u.collectionid=r.collectionid),r.subdocs.add(u)}),c.forEach(u=>r.subdocs.delete(u)),r.emit("subdocs",[{loaded:l,added:a,removed:c},r,n]),c.forEach(u=>u.destroy())),t.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t])):Zk(t,e+1)}}},Ce=(t,e,n=null,r=!0)=>{const i=t._transactionCleanups;let s=!1,o=null;t._transaction===null&&(s=!0,t._transaction=new M3(t,n,r),i.push(t._transaction),i.length===1&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{o=e(t._transaction)}finally{if(s){const a=t._transaction===i[0];t._transaction=null,a&&Zk(i,0)}}return o};class L3{constructor(e,n){this.insertions=n,this.deletions=e,this.meta=new Map}}const p0=(t,e,n)=>{Br(t,n.deletions,r=>{r instanceof _e&&e.scope.some(i=>i===t.doc||Yo(i,r))&&Op(r,!1)})},m0=(t,e,n)=>{let r=null;const i=t.doc,s=t.scope;Ce(i,a=>{for(;e.length>0&&t.currStackItem===null;){const l=i.store,c=e.pop(),u=new Set,d=[];let h=!1;Br(a,c.insertions,f=>{if(f instanceof _e){if(f.redone!==null){let{item:p,diff:g}=_h(l,f.id);g>0&&(p=Nt(a,Z(p.id.client,p.id.clock+g))),f=p}!f.deleted&&s.some(p=>p===a.doc||Yo(p,f))&&d.push(f)}}),Br(a,c.deletions,f=>{f instanceof _e&&s.some(p=>p===a.doc||Yo(p,f))&&!Ls(c.insertions,f.id)&&u.add(f)}),u.forEach(f=>{h=ET(a,f,u,c.insertions,t.ignoreRemoteMapChanges,t)!==null||h});for(let f=d.length-1;f>=0;f--){const p=d[f];t.deleteFilter(p)&&(p.delete(a),h=!0)}t.currStackItem=h?c:null}a.changed.forEach((l,c)=>{l.has(null)&&c._searchMarker&&(c._searchMarker.length=0)}),r=a},t);const o=t.currStackItem;if(o!=null){const a=r.changedParentTypes;t.emit("stack-item-popped",[{stackItem:o,type:n,changedParentTypes:a,origin:t},t]),t.currStackItem=null}return o};class eT extends rk{constructor(e,{captureTimeout:n=500,captureTransaction:r=l=>!0,deleteFilter:i=()=>!0,trackedOrigins:s=new Set([null]),ignoreRemoteMapChanges:o=!1,doc:a=ys(e)?e[0].doc:e instanceof Vr?e:e.doc}={}){super(),this.scope=[],this.doc=a,this.addToScope(e),this.deleteFilter=i,s.add(this),this.trackedOrigins=s,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=o,this.captureTimeout=n,this.afterTransactionHandler=l=>{if(!this.captureTransaction(l)||!this.scope.some(b=>l.changedParentTypes.has(b)||b===this.doc)||!this.trackedOrigins.has(l.origin)&&(!l.origin||!this.trackedOrigins.has(l.origin.constructor)))return;const c=this.undoing,u=this.redoing,d=c?this.redoStack:this.undoStack;c?this.stopCapturing():u||this.clear(!1,!0);const h=new Ds;l.afterState.forEach((b,y)=>{const C=l.beforeState.get(y)||0,S=b-C;S>0&&qo(h,y,C,S)});const f=QO();let p=!1;if(this.lastChange>0&&f-this.lastChange<this.captureTimeout&&d.length>0&&!c&&!u){const b=d[d.length-1];b.deletions=Sh([b.deletions,l.deleteSet]),b.insertions=Sh([b.insertions,h])}else d.push(new L3(l.deleteSet,h)),p=!0;!c&&!u&&(this.lastChange=f),Br(l,l.deleteSet,b=>{b instanceof _e&&this.scope.some(y=>y===l.doc||Yo(y,b))&&Op(b,!0)});const g=[{stackItem:d[d.length-1],origin:l.origin,type:c?"redo":"undo",changedParentTypes:l.changedParentTypes},this];p?this.emit("stack-item-added",g):this.emit("stack-item-updated",g)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(e){const n=new Set(this.scope);e=ys(e)?e:[e],e.forEach(r=>{n.has(r)||(n.add(r),(r instanceof Qe?r.doc!==this.doc:r!==this.doc)&&Pk("[yjs#509] Not same Y.Doc"),this.scope.push(r))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,n=!0){(e&&this.canUndo()||n&&this.canRedo())&&this.doc.transact(r=>{e&&(this.undoStack.forEach(i=>p0(r,this,i)),this.undoStack=[]),n&&(this.redoStack.forEach(i=>p0(r,this,i)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:e,redoStackCleared:n}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=m0(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=m0(this,this.redoStack,"redo")}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}function*R3(t){const e=oe(t.restDecoder);for(let n=0;n<e;n++){const r=oe(t.restDecoder),i=t.readClient();let s=oe(t.restDecoder);for(let o=0;o<r;o++){const a=t.readInfo();if(a===10){const l=oe(t.restDecoder);yield new Xt(Z(i,s),l),s+=l}else if((Zc&a)!==0){const l=(a&(or|bt))===0,c=new _e(Z(i,s),null,(a&bt)===bt?t.readLeftID():null,null,(a&or)===or?t.readRightID():null,l?t.readParentInfo()?t.readString():t.readLeftID():null,l&&(a&Uo)===Uo?t.readString():null,kT(t,a));yield c,s+=c.length}else{const l=t.readLen();yield new Jt(Z(i,s),l),s+=l}}}}class Sp{constructor(e,n){this.gen=R3(e),this.curr=null,this.done=!1,this.filterSkips=n,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===Xt);return this.curr}}class wp{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const P3=t=>Vl(t,Vk,ha),B3=(t,e)=>{if(t.constructor===Jt){const{client:n,clock:r}=t.id;return new Jt(Z(n,r+e),t.length-e)}else if(t.constructor===Xt){const{client:n,clock:r}=t.id;return new Xt(Z(n,r+e),t.length-e)}else{const n=t,{client:r,clock:i}=n.id;return new _e(Z(r,i+e),null,Z(r,i+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},Vl=(t,e=Ss,n=Si)=>{if(t.length===1)return t[0];const r=t.map(u=>new e(Os(u)));let i=r.map(u=>new Sp(u,!0)),s=null;const o=new n,a=new wp(o);for(;i=i.filter(h=>h.curr!==null),i.sort((h,f)=>{if(h.curr.id.client===f.curr.id.client){const p=h.curr.id.clock-f.curr.id.clock;return p===0?h.curr.constructor===f.curr.constructor?0:h.curr.constructor===Xt?1:-1:p}else return f.curr.id.client-h.curr.id.client}),i.length!==0;){const u=i[0],d=u.curr.id.client;if(s!==null){let h=u.curr,f=!1;for(;h!==null&&h.id.clock+h.length<=s.struct.id.clock+s.struct.length&&h.id.client>=s.struct.id.client;)h=u.next(),f=!0;if(h===null||h.id.client!==d||f&&h.id.clock>s.struct.id.clock+s.struct.length)continue;if(d!==s.struct.id.client)Cr(a,s.struct,s.offset),s={struct:h,offset:0},u.next();else if(s.struct.id.clock+s.struct.length<h.id.clock)if(s.struct.constructor===Xt)s.struct.length=h.id.clock+h.length-s.struct.id.clock;else{Cr(a,s.struct,s.offset);const p=h.id.clock-s.struct.id.clock-s.struct.length;s={struct:new Xt(Z(d,s.struct.id.clock+s.struct.length),p),offset:0}}else{const p=s.struct.id.clock+s.struct.length-h.id.clock;p>0&&(s.struct.constructor===Xt?s.struct.length-=p:h=B3(h,p)),s.struct.mergeWith(h)||(Cr(a,s.struct,s.offset),s={struct:h,offset:0},u.next())}}else s={struct:u.curr,offset:0},u.next();for(let h=u.curr;h!==null&&h.id.client===d&&h.id.clock===s.struct.id.clock+s.struct.length&&h.constructor!==Xt;h=u.next())Cr(a,s.struct,s.offset),s={struct:h,offset:0}}s!==null&&(Cr(a,s.struct,s.offset),s=null),xp(a);const l=r.map(u=>kp(u)),c=Sh(l);return Rs(o,c),o.toUint8Array()},F3=(t,e,n=Ss,r=Si)=>{const i=Wk(e),s=new r,o=new wp(s),a=new n(Os(t)),l=new Sp(a,!1);for(;l.curr;){const u=l.curr,d=u.id.client,h=i.get(d)||0;if(l.curr.constructor===Xt){l.next();continue}if(u.id.clock+u.length>h)for(Cr(o,u,En(h-u.id.clock,0)),l.next();l.curr&&l.curr.id.client===d;)Cr(o,l.curr,0),l.next();else for(;l.curr&&l.curr.id.client===d&&l.curr.id.clock+l.curr.length<=h;)l.next()}xp(o);const c=kp(a);return Rs(s,c),s.toUint8Array()},tT=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:pn(t.encoder.restEncoder)}),t.encoder.restEncoder=ua(),t.written=0)},Cr=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&tT(t),t.written===0&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),le(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},xp=t=>{tT(t);const e=t.encoder.restEncoder;le(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){const r=t.clientStructs[n];le(e,r.written),eu(e,r.restEncoder)}},H3=(t,e,n,r)=>{const i=new n(Os(t)),s=new Sp(i,!1),o=new r,a=new wp(o);for(let c=s.curr;c!==null;c=s.next())Cr(a,e(c),0);xp(a);const l=kp(i);return Rs(o,l),o.toUint8Array()},U3=t=>H3(t,oM,Ss,ha),g0="You must not compute changes after the event-handler fired.";class lu{constructor(e,n){this.target=e,this.currentTarget=e,this.transaction=n,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=$3(this.currentTarget,this.target))}deletes(e){return Ls(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Bn(g0);const e=new Map,n=this.target;this.transaction.changed.get(n).forEach(i=>{if(i!==null){const s=n._map.get(i);let o,a;if(this.adds(s)){let l=s.left;for(;l!==null&&this.adds(l);)l=l.left;if(this.deletes(s))if(l!==null&&this.deletes(l))o="delete",a=Gu(l.content.getContent());else return;else l!==null&&this.deletes(l)?(o="update",a=Gu(l.content.getContent())):(o="add",a=void 0)}else if(this.deletes(s))o="delete",a=Gu(s.content.getContent());else return;e.set(i,{action:o,oldValue:a})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw Bn(g0);const n=this.target,r=Ci(),i=Ci(),s=[];if(e={added:r,deleted:i,delta:s,keys:this.keys},this.transaction.changed.get(n).has(null)){let a=null;const l=()=>{a&&s.push(a)};for(let c=n._start;c!==null;c=c.right)c.deleted?this.deletes(c)&&!this.adds(c)&&((a===null||a.delete===void 0)&&(l(),a={delete:0}),a.delete+=c.length,i.add(c)):this.adds(c)?((a===null||a.insert===void 0)&&(l(),a={insert:[]}),a.insert=a.insert.concat(c.content.getContent()),r.add(c)):((a===null||a.retain===void 0)&&(l(),a={retain:0}),a.retain+=c.length);a!==null&&a.retain===void 0&&l()}this._changes=e}return e}}const $3=(t,e)=>{const n=[];for(;e._item!==null&&e!==t;){if(e._item.parentSub!==null)n.unshift(e._item.parentSub);else{let r=0,i=e._item.parent._start;for(;i!==e._item&&i!==null;)!i.deleted&&i.countable&&(r+=i.length),i=i.right;n.unshift(r)}e=e._item.parent}return n},dt=()=>{Pk("Invalid access: Add Yjs type to a document before reading data.")},nT=80;let Ap=0;class z3{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=Ap++}}const V3=t=>{t.timestamp=Ap++},rT=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=Ap++},j3=(t,e,n)=>{if(t.length>=nT){const r=t.reduce((i,s)=>i.timestamp<s.timestamp?i:s);return rT(r,e,n),r}else{const r=new z3(e,n);return t.push(r),r}},cu=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;const n=t._searchMarker.length===0?null:t._searchMarker.reduce((s,o)=>ll(e-s.index)<ll(e-o.index)?s:o);let r=t._start,i=0;for(n!==null&&(r=n.p,i=n.index,V3(n));r.right!==null&&i<e;){if(!r.deleted&&r.countable){if(e<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>e;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return n!==null&&ll(n.index-i)<r.parent.length/nT?(rT(n,r,i),n):j3(t._searchMarker,r,i)},Go=(t,e,n)=>{for(let r=t.length-1;r>=0;r--){const i=t[r];if(n>0){let s=i.p;for(s.marker=!1;s&&(s.deleted||!s.countable);)s=s.left,s&&!s.deleted&&s.countable&&(i.index-=s.length);if(s===null||s.marker===!0){t.splice(r,1);continue}i.p=s,s.marker=!0}(e<i.index||n>0&&e===i.index)&&(i.index=En(e,i.index+n))}},uu=(t,e,n)=>{const r=t,i=e.changedParentTypes;for(;Un(i,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;Kk(r._eH,n,e)};class Qe{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=a0(),this._dEH=a0(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw rn()}clone(){throw rn()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,n){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){l0(this._eH,e)}observeDeep(e){l0(this._dEH,e)}unobserve(e){c0(this._eH,e)}unobserveDeep(e){c0(this._dEH,e)}toJSON(){}}const iT=(t,e,n)=>{t.doc??dt(),e<0&&(e=t._length+e),n<0&&(n=t._length+n);let r=n-e;const i=[];let s=t._start;for(;s!==null&&r>0;){if(s.countable&&!s.deleted){const o=s.content.getContent();if(o.length<=e)e-=o.length;else{for(let a=e;a<o.length&&r>0;a++)i.push(o[a]),r--;e=0}}s=s.right}return i},sT=t=>{t.doc??dt();const e=[];let n=t._start;for(;n!==null;){if(n.countable&&!n.deleted){const r=n.content.getContent();for(let i=0;i<r.length;i++)e.push(r[i])}n=n.right}return e},oT=(t,e)=>{const n=[];let r=t._start;for(;r!==null;){if(r.countable&&Xr(r,e)){const i=r.content.getContent();for(let s=0;s<i.length;s++)n.push(i[s])}r=r.right}return n},Qo=(t,e)=>{let n=0,r=t._start;for(t.doc??dt();r!==null;){if(r.countable&&!r.deleted){const i=r.content.getContent();for(let s=0;s<i.length;s++)e(i[s],n++,t)}r=r.right}},aT=(t,e)=>{const n=[];return Qo(t,(r,i)=>{n.push(e(r,i,t))}),n},q3=t=>{let e=t._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};n=e.content.getContent(),r=0,e=e.right}const i=n[r++];return n.length<=r&&(n=null),{done:!1,value:i}}}},lT=(t,e)=>{t.doc??dt();const n=cu(t,e);let r=t._start;for(n!==null&&(r=n.p,e-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},jl=(t,e,n,r)=>{let i=n;const s=t.doc,o=s.clientID,a=s.store,l=n===null?e._start:n.right;let c=[];const u=()=>{c.length>0&&(i=new _e(Z(o,Be(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new xi(c)),i.integrate(t,0),c=[])};r.forEach(d=>{if(d===null)c.push(d);else switch(d.constructor){case Number:case Object:case Boolean:case Array:case String:c.push(d);break;default:switch(u(),d.constructor){case Uint8Array:case ArrayBuffer:i=new _e(Z(o,Be(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new pa(new Uint8Array(d))),i.integrate(t,0);break;case Vr:i=new _e(Z(o,Be(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new ma(d)),i.integrate(t,0);break;default:if(d instanceof Qe)i=new _e(Z(o,Be(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new Sn(d)),i.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),u()},cT=()=>Bn("Length exceeded!"),uT=(t,e,n,r)=>{if(n>e._length)throw cT();if(n===0)return e._searchMarker&&Go(e._searchMarker,n,r.length),jl(t,e,null,r);const i=n,s=cu(e,n);let o=e._start;for(s!==null&&(o=s.p,n-=s.index,n===0&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&Nt(t,Z(o.id.client,o.id.clock+n));break}n-=o.length}return e._searchMarker&&Go(e._searchMarker,i,r.length),jl(t,e,o,r)},W3=(t,e,n)=>{let i=(e._searchMarker||[]).reduce((s,o)=>o.index>s.index?o:s,{index:0,p:e._start}).p;if(i)for(;i.right;)i=i.right;return jl(t,e,i,n)},dT=(t,e,n,r)=>{if(r===0)return;const i=n,s=r,o=cu(e,n);let a=e._start;for(o!==null&&(a=o.p,n-=o.index);a!==null&&n>0;a=a.right)!a.deleted&&a.countable&&(n<a.length&&Nt(t,Z(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&Nt(t,Z(a.id.client,a.id.clock+r)),a.delete(t),r-=a.length),a=a.right;if(r>0)throw cT();e._searchMarker&&Go(e._searchMarker,i,-s+r)},ql=(t,e,n)=>{const r=e._map.get(n);r!==void 0&&r.delete(t)},_p=(t,e,n,r)=>{const i=e._map.get(n)||null,s=t.doc,o=s.clientID;let a;if(r==null)a=new xi([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:a=new xi([r]);break;case Uint8Array:a=new pa(r);break;case Vr:a=new ma(r);break;default:if(r instanceof Qe)a=new Sn(r);else throw new Error("Unexpected content type")}new _e(Z(o,Be(s.store,o)),i,i&&i.lastId,null,null,e,n,a).integrate(t,0)},Np=(t,e)=>{t.doc??dt();const n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},hT=t=>{const e={};return t.doc??dt(),t._map.forEach((n,r)=>{n.deleted||(e[r]=n.content.getContent()[n.length-1])}),e},fT=(t,e)=>{t.doc??dt();const n=t._map.get(e);return n!==void 0&&!n.deleted},Y3=(t,e)=>{const n={};return t._map.forEach((r,i)=>{let s=r;for(;s!==null&&(!e.sv.has(s.id.client)||s.id.clock>=(e.sv.get(s.id.client)||0));)s=s.left;s!==null&&Xr(s,e)&&(n[i]=s.content.getContent()[s.length-1])}),n},Ba=t=>(t.doc??dt(),u3(t._map.entries(),e=>!e[1].deleted));class K3 extends lu{}class ss extends Qe{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const n=new ss;return n.push(e),n}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new ss}clone(){const e=new ss;return e.insert(0,this.toArray().map(n=>n instanceof Qe?n.clone():n)),e}get length(){return this.doc??dt(),this._length}_callObserver(e,n){super._callObserver(e,n),uu(this,e,new K3(this,e))}insert(e,n){this.doc!==null?Ce(this.doc,r=>{uT(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?Ce(this.doc,n=>{W3(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?Ce(this.doc,r=>{dT(r,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return lT(this,e)}toArray(){return sT(this)}slice(e=0,n=this.length){return iT(this,e,n)}toJSON(){return this.map(e=>e instanceof Qe?e.toJSON():e)}map(e){return aT(this,e)}forEach(e){Qo(this,e)}[Symbol.iterator](){return q3(this)}_write(e){e.writeTypeRef(Ev)}}const G3=t=>new ss;class Q3 extends lu{constructor(e,n,r){super(e,n),this.keysChanged=r}}class ws extends Qe{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,n){super._integrate(e,n),this._prelimContent.forEach((r,i)=>{this.set(i,r)}),this._prelimContent=null}_copy(){return new ws}clone(){const e=new ws;return this.forEach((n,r)=>{e.set(r,n instanceof Qe?n.clone():n)}),e}_callObserver(e,n){uu(this,e,new Q3(this,e,n))}toJSON(){this.doc??dt();const e={};return this._map.forEach((n,r)=>{if(!n.deleted){const i=n.content.getContent()[n.length-1];e[r]=i instanceof Qe?i.toJSON():i}}),e}get size(){return[...Ba(this)].length}keys(){return nd(Ba(this),e=>e[0])}values(){return nd(Ba(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return nd(Ba(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??dt(),this._map.forEach((n,r)=>{n.deleted||e(n.content.getContent()[n.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?Ce(this.doc,n=>{ql(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?Ce(this.doc,r=>{_p(r,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return Np(this,e)}has(e){return fT(this,e)}clear(){this.doc!==null?Ce(this.doc,e=>{this.forEach(function(n,r,i){ql(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(kv)}}const J3=t=>new ws,Ar=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&iM(t,e);class Ah{constructor(e,n,r,i){this.left=e,this.right=n,this.index=r,this.currentAttributes=i}forward(){this.right===null&&kt(),this.right.content.constructor===Ve?this.right.deleted||Ps(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}}const b0=(t,e,n)=>{for(;e.right!==null&&n>0;)e.right.content.constructor===Ve?e.right.deleted||Ps(e.currentAttributes,e.right.content):e.right.deleted||(n<e.right.length&&Nt(t,Z(e.right.id.client,e.right.id.clock+n)),e.index+=e.right.length,n-=e.right.length),e.left=e.right,e.right=e.right.right;return e},Fa=(t,e,n,r)=>{const i=new Map,s=r?cu(e,n):null;if(s){const o=new Ah(s.p.left,s.p,s.index,i);return b0(t,o,n-s.index)}else{const o=new Ah(null,e._start,0,i);return b0(t,o,n)}},pT=(t,e,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===Ve&&Ar(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const i=t.doc,s=i.clientID;r.forEach((o,a)=>{const l=n.left,c=n.right,u=new _e(Z(s,Be(i.store,s)),l,l&&l.lastId,c,c&&c.id,e,null,new Ve(a,o));u.integrate(t,0),n.right=u,n.forward()})},Ps=(t,e)=>{const{key:n,value:r}=e;r===null?t.delete(n):t.set(n,r)},mT=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===Ve&&Ar(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},gT=(t,e,n,r)=>{const i=t.doc,s=i.clientID,o=new Map;for(const a in r){const l=r[a],c=n.currentAttributes.get(a)??null;if(!Ar(c,l)){o.set(a,c);const{left:u,right:d}=n;n.right=new _e(Z(s,Be(i.store,s)),u,u&&u.lastId,d,d&&d.id,e,null,new Ve(a,l)),n.right.integrate(t,0),n.forward()}}return o},sd=(t,e,n,r,i)=>{n.currentAttributes.forEach((h,f)=>{i[f]===void 0&&(i[f]=null)});const s=t.doc,o=s.clientID;mT(n,i);const a=gT(t,e,n,i),l=r.constructor===String?new kn(r):r instanceof Qe?new Sn(r):new Oi(r);let{left:c,right:u,index:d}=n;e._searchMarker&&Go(e._searchMarker,n.index,l.getLength()),u=new _e(Z(o,Be(s.store,o)),c,c&&c.lastId,u,u&&u.id,e,null,l),u.integrate(t,0),n.right=u,n.index=d,n.forward(),pT(t,e,n,a)},y0=(t,e,n,r,i)=>{const s=t.doc,o=s.clientID;mT(n,i);const a=gT(t,e,n,i);e:for(;n.right!==null&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===Ve));){if(!n.right.deleted)switch(n.right.content.constructor){case Ve:{const{key:l,value:c}=n.right.content,u=i[l];if(u!==void 0){if(Ar(u,c))a.delete(l);else{if(r===0)break e;a.set(l,c)}n.right.delete(t)}else n.currentAttributes.set(l,c);break}default:r<n.right.length&&Nt(t,Z(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let l="";for(;r>0;r--)l+=`
|
|
110
|
-
`;n.right=new _e(Z(o,Be(s.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new kn(l)),n.right.integrate(t,0),n.forward()}pT(t,e,n,a)},bT=(t,e,n,r,i)=>{let s=e;const o=nn();for(;s&&(!s.countable||s.deleted);){if(!s.deleted&&s.content.constructor===Ve){const c=s.content;o.set(c.key,c)}s=s.right}let a=0,l=!1;for(;e!==s;){if(n===e&&(l=!0),!e.deleted){const c=e.content;if(c.constructor===Ve){const{key:u,value:d}=c,h=r.get(u)??null;(o.get(u)!==c||h===d)&&(e.delete(t),a++,!l&&(i.get(u)??null)===d&&h!==d&&(h===null?i.delete(u):i.set(u,h))),!l&&!e.deleted&&Ps(i,c)}}e=e.right}return a},X3=(t,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const n=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===Ve){const r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}},Z3=t=>{let e=0;return Ce(t.doc,n=>{let r=t._start,i=t._start,s=nn();const o=bh(s);for(;i;)i.deleted===!1&&(i.content.constructor===Ve?Ps(o,i.content):(e+=bT(n,r,i,s,o),s=bh(o),r=i)),i=i.right}),e},ev=t=>{const e=new Set,n=t.doc;for(const[r,i]of t.afterState.entries()){const s=t.beforeState.get(r)||0;i!==s&&Xk(t,n.store.clients.get(r),s,i,o=>{!o.deleted&&o.content.constructor===Ve&&o.constructor!==Jt&&e.add(o.parent)})}Ce(n,r=>{Br(t,t.deleteSet,i=>{if(i instanceof Jt||!i.parent._hasFormatting||e.has(i.parent))return;const s=i.parent;i.content.constructor===Ve?e.add(s):X3(r,i)});for(const i of e)Z3(i)})},E0=(t,e,n)=>{const r=n,i=bh(e.currentAttributes),s=e.right;for(;n>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case Sn:case Oi:case kn:n<e.right.length&&Nt(t,Z(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t);break}e.forward()}s&&bT(t,s,e.right,i,e.currentAttributes);const o=(e.left||e.right).parent;return o._searchMarker&&Go(o._searchMarker,e.index,-r+n),e};class tv extends lu{constructor(e,n,r){super(e,n),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(i=>{i===null?this.childListChanged=!0:this.keysChanged.add(i)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,n=[];Ce(e,r=>{const i=new Map,s=new Map;let o=this.target._start,a=null;const l={};let c="",u=0,d=0;const h=()=>{if(a!==null){let f=null;switch(a){case"delete":d>0&&(f={delete:d}),d=0;break;case"insert":(typeof c=="object"||c.length>0)&&(f={insert:c},i.size>0&&(f.attributes={},i.forEach((p,g)=>{p!==null&&(f.attributes[g]=p)}))),c="";break;case"retain":u>0&&(f={retain:u},rM(l)||(f.attributes=tM({},l))),u=0;break}f&&n.push(f),a=null}};for(;o!==null;){switch(o.content.constructor){case Sn:case Oi:this.adds(o)?this.deletes(o)||(h(),a="insert",c=o.content.getContent()[0],h()):this.deletes(o)?(a!=="delete"&&(h(),a="delete"),d+=1):o.deleted||(a!=="retain"&&(h(),a="retain"),u+=1);break;case kn:this.adds(o)?this.deletes(o)||(a!=="insert"&&(h(),a="insert"),c+=o.content.str):this.deletes(o)?(a!=="delete"&&(h(),a="delete"),d+=o.length):o.deleted||(a!=="retain"&&(h(),a="retain"),u+=o.length);break;case Ve:{const{key:f,value:p}=o.content;if(this.adds(o)){if(!this.deletes(o)){const g=i.get(f)??null;Ar(g,p)?p!==null&&o.delete(r):(a==="retain"&&h(),Ar(p,s.get(f)??null)?delete l[f]:l[f]=p)}}else if(this.deletes(o)){s.set(f,p);const g=i.get(f)??null;Ar(g,p)||(a==="retain"&&h(),l[f]=g)}else if(!o.deleted){s.set(f,p);const g=l[f];g!==void 0&&(Ar(g,p)?g!==null&&o.delete(r):(a==="retain"&&h(),p===null?delete l[f]:l[f]=p))}o.deleted||(a==="insert"&&h(),Ps(i,o.content));break}}o=o.right}for(h();n.length>0;){const f=n[n.length-1];if(f.retain!==void 0&&f.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}}class Fr extends Qe{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??dt(),this._length}_integrate(e,n){super._integrate(e,n);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new Fr}clone(){const e=new Fr;return e.applyDelta(this.toDelta()),e}_callObserver(e,n){super._callObserver(e,n);const r=new tv(this,e,n);uu(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??dt();let e="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===kn&&(e+=n.content.str),n=n.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:n=!0}={}){this.doc!==null?Ce(this.doc,r=>{const i=new Ah(null,this._start,0,new Map);for(let s=0;s<e.length;s++){const o=e[s];if(o.insert!==void 0){const a=!n&&typeof o.insert=="string"&&s===e.length-1&&i.right===null&&o.insert.slice(-1)===`
|
|
111
|
-
`?o.insert.slice(0,-1):o.insert;(typeof a!="string"||a.length>0)&&sd(r,this,i,a,o.attributes||{})}else o.retain!==void 0?y0(r,this,i,o.retain,o.attributes||{}):o.delete!==void 0&&E0(r,i,o.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,r){this.doc??dt();const i=[],s=new Map,o=this.doc;let a="",l=this._start;function c(){if(a.length>0){const d={};let h=!1;s.forEach((p,g)=>{h=!0,d[g]=p});const f={insert:a};h&&(f.attributes=d),i.push(f),a=""}}const u=()=>{for(;l!==null;){if(Xr(l,e)||n!==void 0&&Xr(l,n))switch(l.content.constructor){case kn:{const d=s.get("ychange");e!==void 0&&!Xr(l,e)?(d===void 0||d.user!==l.id.client||d.type!=="removed")&&(c(),s.set("ychange",r?r("removed",l.id):{type:"removed"})):n!==void 0&&!Xr(l,n)?(d===void 0||d.user!==l.id.client||d.type!=="added")&&(c(),s.set("ychange",r?r("added",l.id):{type:"added"})):d!==void 0&&(c(),s.delete("ychange")),a+=l.content.str;break}case Sn:case Oi:{c();const d={insert:l.content.getContent()[0]};if(s.size>0){const h={};d.attributes=h,s.forEach((f,p)=>{h[p]=f})}i.push(d);break}case Ve:Xr(l,e)&&(c(),Ps(s,l.content));break}l=l.right}c()};return e||n?Ce(o,d=>{e&&wh(d,e),n&&wh(d,n),u()},"cleanup"):u(),i}insert(e,n,r){if(n.length<=0)return;const i=this.doc;i!==null?Ce(i,s=>{const o=Fa(s,this,e,!r);r||(r={},o.currentAttributes.forEach((a,l)=>{r[l]=a})),sd(s,this,o,n,r)}):this._pending.push(()=>this.insert(e,n,r))}insertEmbed(e,n,r){const i=this.doc;i!==null?Ce(i,s=>{const o=Fa(s,this,e,!r);sd(s,this,o,n,r||{})}):this._pending.push(()=>this.insertEmbed(e,n,r||{}))}delete(e,n){if(n===0)return;const r=this.doc;r!==null?Ce(r,i=>{E0(i,Fa(i,this,e,!0),n)}):this._pending.push(()=>this.delete(e,n))}format(e,n,r){if(n===0)return;const i=this.doc;i!==null?Ce(i,s=>{const o=Fa(s,this,e,!1);o.right!==null&&y0(s,this,o,n,r)}):this._pending.push(()=>this.format(e,n,r))}removeAttribute(e){this.doc!==null?Ce(this.doc,n=>{ql(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?Ce(this.doc,r=>{_p(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return Np(this,e)}getAttributes(){return hT(this)}_write(e){e.writeTypeRef(Tv)}}const nv=t=>new Fr;class od{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??dt()}[Symbol.iterator](){return this}next(){let e=this._currentNode,n=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(n)))do if(n=e.content.type,!e.deleted&&(n.constructor===at||n.constructor===wi)&&n._start!==null)e=n._start;else for(;e!==null;){const r=e.next;if(r!==null){e=r;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class wi extends Qe{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new wi}clone(){const e=new wi;return e.insert(0,this.toArray().map(n=>n instanceof Qe?n.clone():n)),e}get length(){return this.doc??dt(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new od(this,e)}querySelector(e){e=e.toUpperCase();const r=new od(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),Pr(new od(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){uu(this,e,new sv(this,n,e))}toString(){return aT(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,n={},r){const i=e.createDocumentFragment();return r!==void 0&&r._createAssociation(i,this),Qo(this,s=>{i.insertBefore(s.toDOM(e,n,r),null)}),i}insert(e,n){this.doc!==null?Ce(this.doc,r=>{uT(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)Ce(this.doc,r=>{const i=e&&e instanceof Qe?e._item:e;jl(r,this,i,n)});else{const r=this._prelimContent,i=e===null?0:r.findIndex(s=>s===e)+1;if(i===0&&e!==null)throw Bn("Reference item not found");r.splice(i,0,...n)}}delete(e,n=1){this.doc!==null?Ce(this.doc,r=>{dT(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return sT(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return lT(this,e)}slice(e=0,n=this.length){return iT(this,e,n)}forEach(e){Qo(this,e)}_write(e){e.writeTypeRef(Sv)}}const rv=t=>new wi;class at extends wi{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,n){super._integrate(e,n),this._prelimAttrs.forEach((r,i)=>{this.setAttribute(i,r)}),this._prelimAttrs=null}_copy(){return new at(this.nodeName)}clone(){const e=new at(this.nodeName),n=this.getAttributes();return nM(n,(r,i)=>{e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof Qe?r.clone():r)),e}toString(){const e=this.getAttributes(),n=[],r=[];for(const a in e)r.push(a);r.sort();const i=r.length;for(let a=0;a<i;a++){const l=r[a];n.push(l+'="'+e[l]+'"')}const s=this.nodeName.toLocaleLowerCase(),o=n.length>0?" "+n.join(" "):"";return`<${s}${o}>${super.toString()}</${s}>`}removeAttribute(e){this.doc!==null?Ce(this.doc,n=>{ql(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?Ce(this.doc,r=>{_p(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return Np(this,e)}hasAttribute(e){return fT(this,e)}getAttributes(e){return e?Y3(this,e):hT(this)}toDOM(e=document,n={},r){const i=e.createElement(this.nodeName),s=this.getAttributes();for(const o in s){const a=s[o];typeof a=="string"&&i.setAttribute(o,a)}return Qo(this,o=>{i.appendChild(o.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(Cv),e.writeKey(this.nodeName)}}const iv=t=>new at(t.readKey());class sv extends lu{constructor(e,n,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}}class Wl extends ws{constructor(e){super(),this.hookName=e}_copy(){return new Wl(this.hookName)}clone(){const e=new Wl(this.hookName);return this.forEach((n,r)=>{e.set(r,n)}),e}toDOM(e=document,n={},r){const i=n[this.hookName];let s;return i!==void 0?s=i.createDom(this):s=document.createElement(this.hookName),s.setAttribute("data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(s,this),s}_write(e){e.writeTypeRef(wv),e.writeKey(this.hookName)}}const ov=t=>new Wl(t.readKey());class Ut extends Fr{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new Ut}clone(){const e=new Ut;return e.applyDelta(this.toDelta()),e}toDOM(e=document,n,r){const i=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(i,this),i}toString(){return this.toDelta().map(e=>{const n=[];for(const i in e.attributes){const s=[];for(const o in e.attributes[i])s.push({key:o,value:e.attributes[i][o]});s.sort((o,a)=>o.key<a.key?-1:1),n.push({nodeName:i,attrs:s})}n.sort((i,s)=>i.nodeName<s.nodeName?-1:1);let r="";for(let i=0;i<n.length;i++){const s=n[i];r+=`<${s.nodeName}`;for(let o=0;o<s.attrs.length;o++){const a=s.attrs[o];r+=` ${a.key}="${a.value}"`}r+=">"}r+=e.insert;for(let i=n.length-1;i>=0;i--)r+=`</${n[i].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(xv)}}const av=t=>new Ut;class Ip{constructor(e,n){this.id=e,this.length=n}get deleted(){throw rn()}mergeWith(e){return!1}write(e,n,r){throw rn()}integrate(e,n){throw rn()}}const lv=0;class Jt extends Ip{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){n>0&&(this.id.clock+=n,this.length-=n),Jk(e.doc.store,this)}write(e,n){e.writeInfo(lv),e.writeLen(this.length-n)}getMissing(e,n){return null}}class pa{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new pa(this.content)}splice(e){throw rn()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}const cv=t=>new pa(t.readBuf());class Jo{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Jo(this.len)}splice(e){const n=new Jo(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){qo(e.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(e){}gc(e){}write(e,n){e.writeLen(this.len-n)}getRef(){return 1}}const uv=t=>new Jo(t.readLen()),yT=(t,e)=>new Vr({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class ma{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const n={};this.opts=n,e.gc||(n.gc=!1),e.autoLoad&&(n.autoLoad=!0),e.meta!==null&&(n.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new ma(yT(this.doc.guid,this.opts))}splice(e){throw rn()}mergeWith(e){return!1}integrate(e,n){this.doc._item=n,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,n){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}const dv=t=>new ma(yT(t.readString(),t.readAny()));class Oi{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new Oi(this.embed)}splice(e){throw rn()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}const hv=t=>new Oi(t.readJSON());class Ve{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new Ve(this.key,this.value)}splice(e){throw rn()}mergeWith(e){return!1}integrate(e,n){const r=n.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,n){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const fv=t=>new Ve(t.readKey(),t.readJSON());class Yl{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Yl(this.arr)}splice(e){const n=new Yl(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let i=n;i<r;i++){const s=this.arr[i];e.writeString(s===void 0?"undefined":JSON.stringify(s))}}getRef(){return 2}}const pv=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++){const i=t.readString();i==="undefined"?n.push(void 0):n.push(JSON.parse(i))}return new Yl(n)},mv=Hl("node_env")==="development";class xi{constructor(e){this.arr=e,mv&&hk(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new xi(this.arr)}splice(e){const n=new xi(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let i=n;i<r;i++){const s=this.arr[i];e.writeAny(s)}}getRef(){return 8}}const gv=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new xi(n)};class kn{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new kn(this.str)}splice(e){const n=new kn(this.str.slice(e));this.str=this.str.slice(0,e);const r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}}const bv=t=>new kn(t.readString()),yv=[G3,J3,nv,iv,rv,ov,av],Ev=0,kv=1,Tv=2,Cv=3,Sv=4,wv=5,xv=6;class Sn{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new Sn(this.type._copy())}splice(e){throw rn()}mergeWith(e){return!1}integrate(e,n){this.type._integrate(e.doc,n)}delete(e){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(e.beforeState.get(n.id.client)||0)&&e._mergeStructs.push(n):n.delete(e),n=n.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e)}),e.changed.delete(this.type)}gc(e){let n=this.type._start;for(;n!==null;)n.gc(e,!0),n=n.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,n){this.type._write(e)}getRef(){return 7}}const Av=t=>new Sn(yv[t.readTypeRef()](t)),_h=(t,e)=>{let n=e,r=0,i;do r>0&&(n=Z(n.client,n.clock+r)),i=is(t,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof _e);return{item:i,diff:r}},Op=(t,e)=>{for(;t!==null&&t.keep!==e;)t.keep=e,t=t.parent._item},Kl=(t,e,n)=>{const{client:r,clock:i}=e.id,s=new _e(Z(r,i+n),e,Z(r,i+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&s.markDeleted(),e.keep&&(s.keep=!0),e.redone!==null&&(s.redone=Z(e.redone.client,e.redone.clock+n)),e.right=s,s.right!==null&&(s.right.left=s),t._mergeStructs.push(s),s.parentSub!==null&&s.right===null&&s.parent._map.set(s.parentSub,s),e.length=n,s},k0=(t,e)=>sp(t,n=>Ls(n.deletions,e)),ET=(t,e,n,r,i,s)=>{const o=t.doc,a=o.store,l=o.clientID,c=e.redone;if(c!==null)return Nt(t,c);let u=e.parent._item,d=null,h;if(u!==null&&u.deleted===!0){if(u.redone===null&&(!n.has(u)||ET(t,u,n,r,i,s)===null))return null;for(;u.redone!==null;)u=Nt(t,u.redone)}const f=u===null?e.parent:u.content.type;if(e.parentSub===null){for(d=e.left,h=e;d!==null;){let y=d;for(;y!==null&&y.parent._item!==u;)y=y.redone===null?null:Nt(t,y.redone);if(y!==null&&y.parent._item===u){d=y;break}d=d.left}for(;h!==null;){let y=h;for(;y!==null&&y.parent._item!==u;)y=y.redone===null?null:Nt(t,y.redone);if(y!==null&&y.parent._item===u){h=y;break}h=h.right}}else if(h=null,e.right&&!i){for(d=e;d!==null&&d.right!==null&&(d.right.redone||Ls(r,d.right.id)||k0(s.undoStack,d.right.id)||k0(s.redoStack,d.right.id));)for(d=d.right;d.redone;)d=Nt(t,d.redone);if(d&&d.right!==null)return null}else d=f._map.get(e.parentSub)||null;const p=Be(a,l),g=Z(l,p),b=new _e(g,d,d&&d.lastId,h,h&&h.id,f,e.parentSub,e.content.copy());return e.redone=g,Op(b,!0),b.integrate(t,0),b};let _e=class Nh extends Ip{constructor(e,n,r,i,s,o,a,l){super(e,l.getLength()),this.origin=r,this.left=n,this.right=i,this.rightOrigin=s,this.parent=o,this.parentSub=a,this.redone=null,this.content=l,this.info=this.content.isCountable()?Wg:0}set marker(e){(this.info&Ju)>0!==e&&(this.info^=Ju)}get marker(){return(this.info&Ju)>0}get keep(){return(this.info&qg)>0}set keep(e){this.keep!==e&&(this.info^=qg)}get countable(){return(this.info&Wg)>0}get deleted(){return(this.info&Qu)>0}set deleted(e){this.deleted!==e&&(this.info^=Qu)}markDeleted(){this.info|=Qu}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Be(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Be(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===rs&&this.id.client!==this.parent.client&&this.parent.clock>=Be(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=d0(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Nt(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Jt||this.right&&this.right.constructor===Jt)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===Nh?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===Nh&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===rs){const r=is(n,this.parent);r.constructor===Jt?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=d0(e,e.doc.store,Z(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,i;if(r!==null)i=r.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const s=new Set,o=new Set;for(;i!==null&&i!==this.right;){if(o.add(i),s.add(i),Qi(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,s.clear();else if(Qi(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&o.has(is(e.doc.store,i.origin)))s.has(is(e.doc.store,i.origin))||(r=i,s.clear());else break;i=i.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),Jk(e.doc.store,this),this.content.integrate(e,this),f0(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new Jt(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:Z(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&Qi(e.origin,this.lastId)&&this.right===e&&Qi(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const n=this.parent._searchMarker;return n&&n.forEach(r=>{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),qo(e.deleteSet,this.id.client,this.id.clock,this.length),f0(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw kt();this.content.gc(e),n?O3(e,this,new Jt(this.id,this.length)):this.content=new Jo(this.length)}write(e,n){const r=n>0?Z(this.id.client,this.id.clock+n-1):this.origin,i=this.rightOrigin,s=this.parentSub,o=this.content.getRef()&Zc|(r===null?0:bt)|(i===null?0:or)|(s===null?0:Uo);if(e.writeInfo(o),r!==null&&e.writeLeftID(r),i!==null&&e.writeRightID(i),r===null&&i===null){const a=this.parent;if(a._item!==void 0){const l=a._item;if(l===null){const c=Wo(a);e.writeParentInfo(!0),e.writeString(c)}else e.writeParentInfo(!1),e.writeLeftID(l.id)}else a.constructor===String?(e.writeParentInfo(!0),e.writeString(a)):a.constructor===rs?(e.writeParentInfo(!1),e.writeLeftID(a)):kt();s!==null&&e.writeString(s)}this.content.write(e,n)}};const kT=(t,e)=>_v[e&Zc](t),_v=[()=>{kt()},uv,pv,cv,bv,hv,fv,Av,gv,dv,()=>{kt()}],Nv=10;class Xt extends Ip{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){kt()}write(e,n){e.writeInfo(Nv),le(e.restEncoder,this.length-n)}getMissing(e,n){return null}}const TT=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},CT="__ $YJS$ __";TT[CT]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");TT[CT]=!0;const Iv=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},Ov=/[\uD800-\uDBFF]/,Mv=/[\uDC00-\uDFFF]/,vv=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&Ov.test(t[n-1])&&n--;r+n<t.length&&r+n<e.length&&t[t.length-r-1]===e[e.length-r-1];)r++;return r>0&&Mv.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},Dv=vv,Ie=new me("y-sync"),vn=new me("y-undo"),Ha=new me("yjs-cursor"),Dn=(t,e)=>t>>>e|t<<32-e,Lv=t=>Dn(t,2)^Dn(t,13)^Dn(t,22),Rv=t=>Dn(t,6)^Dn(t,11)^Dn(t,25),Pv=t=>Dn(t,7)^Dn(t,18)^t>>>3,Bv=t=>Dn(t,17)^Dn(t,19)^t>>>10,Fv=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Hv=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class Uv{constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(Hv),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,n=this._W;for(let d=16;d<64;d++)n[d]=Bv(n[d-2])+n[d-7]+Pv(n[d-15])+n[d-16];let r=e[0],i=e[1],s=e[2],o=e[3],a=e[4],l=e[5],c=e[6],u=e[7];for(let d=0,h,f;d<64;d++)h=u+Rv(a)+(a&l^~a&c)+Fv[d]+n[d]>>>0,f=Lv(r)+(r&i^r&s^i&s)>>>0,u=c,c=l,l=a,a=o+h>>>0,o=s,s=i,i=r,r=h+f>>>0;e[0]+=r,e[1]+=i,e[2]+=s,e[3]+=o,e[4]+=a,e[5]+=l,e[6]+=c,e[7]+=u}digest(e){let n=0;for(;n+56<=e.length;){let o=0;for(;o<16&&n+3<e.length;o++)this._W[o]=e[n++]<<24|e[n++]<<16|e[n++]<<8|e[n++];if(n%64!==0){for(this._W.fill(0,o,16);n<e.length;)this._W[o]|=e[n]<<(3-n%4)*8,n++;this._W[o]|=bt<<(3-n%4)*8}this._updateHash()}const r=n%64!==0;this._W.fill(0,0,16);let i=0;for(;n<e.length;i++)for(let o=3;o>=0&&n<e.length;o--)this._W[i]|=e[n++]<<o*8;r||(this._W[i-(n%4===0?0:1)]|=bt<<(3-n%4)*8),this._W[14]=e.byteLength/pO,this._W[15]=e.byteLength*8,this._updateHash();const s=new Uint8Array(32);for(let o=0;o<this._H.length;o++)for(let a=0;a<4;a++)s[o*4+a]=this._H[o]>>>(3-a)*8;return s}}const $v=t=>new Uv().digest(t),zv=t=>{for(let n=6;n<t.length;n++)t[n%6]=t[n%6]^t[n];return t.slice(0,6)},Vv=t=>mM(zv($v(bM(t)))),Gl=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!Ls(e.ds,t.id),jv=[{light:"#ecd44433",dark:"#ecd444"}],qv=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){const r=Ci();t.forEach(i=>r.add(i)),e=e.filter(i=>!r.has(i))}t.set(n,YO(e))}return t.get(n)},Wv=(t,{colors:e=jv,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:s}={})=>{let o=!1;const a=new Kv(t,s),l=new re({props:{editable:c=>{const u=Ie.getState(c);return u.snapshot==null&&u.prevSnapshot==null}},key:Ie,state:{init:(c,u)=>({type:t,doc:t.doc,binding:a,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:n,permanentUserData:r}),apply:(c,u)=>{const d=c.getMeta(Ie);if(d!==void 0){u=Object.assign({},u);for(const h in d)u[h]=d[h]}return u.addToHistory=c.getMeta("addToHistory")!==!1,u.isChangeOrigin=d!==void 0&&!!d.isChangeOrigin,u.isUndoRedoOperation=d!==void 0&&!!d.isChangeOrigin&&!!d.isUndoRedoOperation,a.prosemirrorView!==null&&d!==void 0&&(d.snapshot!=null||d.prevSnapshot!=null)&&bp(0,()=>{a.prosemirrorView!=null&&(d.restore==null?a._renderSnapshot(d.snapshot,d.prevSnapshot,u):(a._renderSnapshot(d.snapshot,d.snapshot,u),delete u.restore,delete u.snapshot,delete u.prevSnapshot,a.mux(()=>{a._prosemirrorChanged(a.prosemirrorView.state.doc)})))}),u}},view:c=>(a.initView(c),s==null&&a._forceRerender(),i(),{update:()=>{const u=l.getState(c.state);if(u.snapshot==null&&u.prevSnapshot==null&&(o||c.state.doc.content.findDiffStart(c.state.doc.type.createAndFill().content)!==null)){if(o=!0,u.addToHistory===!1&&!u.isChangeOrigin){const d=vn.getState(c.state),h=d&&d.undoManager;h&&h.stopCapturing()}a.mux(()=>{u.doc.transact(d=>{d.meta.set("addToHistory",u.addToHistory),a._prosemirrorChanged(c.state.doc)},Ie)})}},destroy:()=>{a.destroy()}})});return l},Yv=(t,e,n)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")t.setSelection(new Ot(t.doc));else if(e.type==="node"){const r=ci(n.doc,n.type,e.anchor,n.mapping);t.setSelection(W.create(t.doc,r))}else{const r=ci(n.doc,n.type,e.anchor,n.mapping),i=ci(n.doc,n.type,e.head,n.mapping);if(r!==null&&i!==null){const s=j.between(t.doc.resolve(r),t.doc.resolve(i));t.setSelection(s)}}},Ih=(t,e)=>({type:e.selection.jsonID,anchor:Zo(e.selection.anchor,t.type,t.mapping),head:Zo(e.selection.head,t.type,t.mapping)});class Kv{constructor(e,n=new Map){this.type=e,this.prosemirrorView=null,this.mux=Iv(),this.mapping=n,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=Ih(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(pk&&this._domSelectionInView===null&&(bp(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){const e=this.prosemirrorView._root.getSelection();if(e==null||e.anchorNode==null)return!1;const n=this.prosemirrorView._root.createRange();n.setStart(e.anchorNode,e.anchorOffset),n.setEnd(e.focusNode,e.focusOffset),n.getClientRects().length===0&&n.startContainer&&n.collapsed&&n.selectNodeContents(n.startContainer);const i=n.getBoundingClientRect(),s=da.documentElement;return i.bottom>=0&&i.right>=0&&i.left<=(window.innerWidth||s.clientWidth||0)&&i.top<=(window.innerHeight||s.clientHeight||0)}renderSnapshot(e,n){n||(n=Gk(Hk(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(Ie,{snapshot:e,prevSnapshot:n}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const e=this.type.toArray().map(r=>fl(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new F(v.from(e),0,0));n.setMeta(Ie,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(n)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{const e=this.beforeTransactionSelection!==null?null:this.prosemirrorView.state.selection,n=this.type.toArray().map(i=>fl(i,this.prosemirrorView.state.schema,this)).filter(i=>i!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new F(v.from(n),0,0));if(e){const i=sr(En(e.anchor,0),r.doc.content.size),s=sr(En(e.head,0),r.doc.content.size);r.setSelection(j.create(r.doc,i,s))}this.prosemirrorView.dispatch(r.setMeta(Ie,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,n,r){let i=this.doc,s=this.type;if(e||(e=id(this.doc)),e instanceof Uint8Array||n instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(n instanceof Uint8Array))&&kt(),i=new Vr({gc:!1}),zl(i,n),n=id(i),zl(i,e),e=id(i),s._item===null){const o=Array.from(this.doc.share.keys()).find(a=>this.doc.share.get(a)===this.type);s=i.getXmlFragment(o)}else{const o=i.store.clients.get(s._item.id.client)??[],a=on(o,s._item.id.clock);s=o[a].content.type}this.mapping.clear(),this.mux(()=>{i.transact(o=>{const a=r.permanentUserData;a&&a.dss.forEach(d=>{Br(o,d,h=>{})});const l=(d,h)=>{const f=d==="added"?a.getUserByClientId(h.client):a.getUserByDeletedId(h);return{user:f,type:d,color:qv(r.colorMapping,r.colors,f)}},c=oT(s,new Cp(n.ds,e.sv)).map(d=>!d._item.deleted||Gl(d._item,e)||Gl(d._item,n)?fl(d,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,n,l):null).filter(d=>d!==null),u=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new F(v.from(c),0,0));this.prosemirrorView.dispatch(u.setMeta(Ie,{isChangeOrigin:!0}))},Ie)})}_typeChanged(e,n){if(this.prosemirrorView==null)return;const r=Ie.getState(this.prosemirrorView.state);if(e.length===0||r.snapshot!=null||r.prevSnapshot!=null){this.renderSnapshot(r.snapshot,r.prevSnapshot);return}this.mux(()=>{const i=(a,l)=>this.mapping.delete(l);Br(n,n.deleteSet,a=>{if(a.constructor===_e){const l=a.content.type;l&&this.mapping.delete(l)}}),n.changed.forEach(i),n.changedParentTypes.forEach(i);const s=this.type.toArray().map(a=>ST(a,this.prosemirrorView.state.schema,this)).filter(a=>a!==null);let o=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new F(v.from(s),0,0));Yv(o,this.beforeTransactionSelection,this),o=o.setMeta(Ie,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof eT}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&o.scrollIntoView(),this.prosemirrorView.dispatch(o)})}_prosemirrorChanged(e){this.doc.transact(()=>{Mh(this.doc,this.type,e,this),this.beforeTransactionSelection=Ih(this,this.prosemirrorView.state)},Ie)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions))}}const ST=(t,e,n,r,i,s)=>{const o=n.mapping.get(t);if(o===void 0){if(t instanceof at)return fl(t,e,n,r,i,s);throw rn()}return o},fl=(t,e,n,r,i,s)=>{const o=[],a=l=>{if(l instanceof at){const c=ST(l,e,n,r,i,s);c!==null&&o.push(c)}else{const c=l._item.right?.content?.type;c instanceof Fr&&!c._item.deleted&&c._item.id.client===c.doc.clientID&&(l.applyDelta([{retain:l.length},...c.toDelta()]),c.doc.transact(d=>{c._item.delete(d)}));const u=Gv(l,e,n,r,i,s);u!==null&&u.forEach(d=>{d!==null&&o.push(d)})}};r===void 0||i===void 0?t.toArray().forEach(a):oT(t,new Cp(i.ds,r.sv)).forEach(a);try{const l=t.getAttributes(r);r!==void 0&&(Gl(t._item,r)?Gl(t._item,i)||(l.ychange=s?s("added",t._item.id):{type:"added"}):l.ychange=s?s("removed",t._item.id):{type:"removed"});const c=e.node(t.nodeName,l,o);return n.mapping.set(t,c),c}catch{return t.doc.transact(c=>{t._item.delete(c)},Ie),n.mapping.delete(t),null}},Gv=(t,e,n,r,i,s)=>{const o=[],a=t.toDelta(r,i,s);try{for(let l=0;l<a.length;l++){const c=a[l];o.push(e.text(c.insert,tD(c.attributes,e)))}}catch{return t.doc.transact(c=>{t._item.delete(c)},Ie),null}return o},Qv=(t,e)=>{const n=new Ut,r=t.map(i=>({insert:i.text,attributes:AT(i.marks,e)}));return n.applyDelta(r),e.mapping.set(n,t),n},Jv=(t,e)=>{const n=new at(t.type.name);for(const r in t.attrs){const i=t.attrs[r];i!==null&&r!=="ychange"&&n.setAttribute(r,i)}return n.insert(0,du(t).map(r=>Oh(r,e))),e.mapping.set(n,t),n},Oh=(t,e)=>t instanceof Array?Qv(t,e):Jv(t,e),T0=t=>typeof t=="object"&&t!==null,Mp=(t,e)=>{const n=Object.keys(t).filter(i=>t[i]!==null);let r=n.length===(e==null?0:Object.keys(e).filter(i=>e[i]!==null).length);for(let i=0;i<n.length&&r;i++){const s=n[i],o=t[s],a=e[s];r=s==="ychange"||o===a||T0(o)&&T0(a)&&Mp(o,a)}return r},du=t=>{const e=t.content.content,n=[];for(let r=0;r<e.length;r++){const i=e[r];if(i.isText){const s=[];for(let o=e[r];r<e.length&&o.isText;o=e[++r])s.push(o);r--,n.push(s)}else n.push(i)}return n},wT=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((r,i)=>r.insert===e[i].text&&dk(r.attributes||{}).length===e[i].marks.length&&Ms(r.attributes,(s,o)=>{const a=xT(o),l=e[i].marks;return Mp(s,l.find(c=>c.type.name===a)?.attrs)}))},Xo=(t,e)=>{if(t instanceof at&&!(e instanceof Array)&&vh(t,e)){const n=du(e);return t._length===n.length&&Mp(t.getAttributes(),e.attrs)&&t.toArray().every((r,i)=>Xo(r,n[i]))}return t instanceof Ut&&e instanceof Array&&wT(t,e)},Ql=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),C0=(t,e,n)=>{const r=t.toArray(),i=du(e),s=i.length,o=r.length,a=sr(o,s);let l=0,c=0,u=!1;for(;l<a;l++){const d=r[l],h=i[l];if(Ql(n.mapping.get(d),h))u=!0;else if(!Xo(d,h))break}for(;l+c<a;c++){const d=r[o-c-1],h=i[s-c-1];if(Ql(n.mapping.get(d),h))u=!0;else if(!Xo(d,h))break}return{equalityFactor:l+c,foundMappedChild:u}},Xv=t=>{let e="",n=t._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof kn?e+=n.content.str:n.content instanceof Ve&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},Zv=(t,e,n)=>{n.mapping.set(t,e);const{nAttrs:r,str:i}=Xv(t),s=e.map(c=>({insert:c.text,attributes:Object.assign({},r,AT(c.marks,n))})),{insert:o,remove:a,index:l}=Dv(i,s.map(c=>c.insert).join(""));t.delete(l,a),t.insert(l,o),t.applyDelta(s.map(c=>({retain:c.insert.length,attributes:c.attributes})))},eD=/(.*)(--[a-zA-Z0-9+/=]{8})$/,xT=t=>eD.exec(t)?.[1]??t,tD=(t,e)=>{const n=[];for(const r in t)n.push(e.mark(xT(r),t[r]));return n},AT=(t,e)=>{const n={};return t.forEach(r=>{if(r.type.name!=="ychange"){const i=Un(e.isOMark,r.type,()=>!r.type.excludes(r.type));n[i?`${r.type.name}--${Vv(r.toJSON())}`:r.type.name]=r.attrs}}),n},Mh=(t,e,n,r)=>{if(e instanceof at&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(e,n),e instanceof at){const d=e.getAttributes(),h=n.attrs;for(const f in h)h[f]!==null?d[f]!==h[f]&&f!=="ychange"&&e.setAttribute(f,h[f]):e.removeAttribute(f);for(const f in d)h[f]===void 0&&e.removeAttribute(f)}const i=du(n),s=i.length,o=e.toArray(),a=o.length,l=sr(s,a);let c=0,u=0;for(;c<l;c++){const d=o[c],h=i[c];if(!Ql(r.mapping.get(d),h))if(Xo(d,h))r.mapping.set(d,h);else break}for(;u+c<l;u++){const d=o[a-u-1],h=i[s-u-1];if(!Ql(r.mapping.get(d),h))if(Xo(d,h))r.mapping.set(d,h);else break}t.transact(()=>{for(;a-c-u>0&&s-c-u>0;){const h=o[c],f=i[c],p=o[a-u-1],g=i[s-u-1];if(h instanceof Ut&&f instanceof Array)wT(h,f)||Zv(h,f,r),c+=1;else{let b=h instanceof at&&vh(h,f),y=p instanceof at&&vh(p,g);if(b&&y){const C=C0(h,f,r),S=C0(p,g,r);C.foundMappedChild&&!S.foundMappedChild?y=!1:!C.foundMappedChild&&S.foundMappedChild||C.equalityFactor<S.equalityFactor?b=!1:y=!1}b?(Mh(t,h,f,r),c+=1):y?(Mh(t,p,g,r),u+=1):(r.mapping.delete(e.get(c)),e.delete(c,1),e.insert(c,[Oh(f,r)]),c+=1)}}const d=a-c-u;if(a===1&&s===0&&o[0]instanceof Ut?(r.mapping.delete(o[0]),o[0].delete(0,o[0].length)):d>0&&(e.slice(c,c+d).forEach(h=>r.mapping.delete(h)),e.delete(c,d)),c+u<s){const h=[];for(let f=c;f<s-u;f++)h.push(Oh(i[f],r));e.insert(c,h)}},Ie)},vh=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name;let fo=null;const nD=()=>{const t=fo;fo=null,t.forEach((e,n)=>{const r=n.state.tr,i=Ie.getState(n.state);i&&i.binding&&!i.binding.isDestroyed&&(e.forEach((s,o)=>{r.setMeta(o,s)}),n.dispatch(r))})},rD=(t,e,n)=>{fo||(fo=new Map,bp(0,nD)),Un(fo,t,nn).set(e,n)},Zo=(t,e,n)=>{if(t===0)return rd(e,0,e.length===0?-1:0);let r=e._first===null?null:e._first.content.type;for(;r!==null&&e!==r;){if(r instanceof Ut){if(r._length>=t)return rd(r,t,e.length===0?-1:0);if(t-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,t--;while(r!==e&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==e&&(r=r._item===null?null:r._item.next.content.type)}}else{const i=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&t<i)r=r._first.content.type,t--;else{if(t===1&&r._length===0&&i>1)return new Ko(r._item===null?null:r._item.id,r._item===null?Wo(r):null,null);if(t-=i,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(t===0)return r=r._item===null?r:r._item.parent,new Ko(r._item===null?null:r._item.id,r._item===null?Wo(r):null,null);do r=r._item.parent,t--;while(r!==e&&r._item.next===null);r!==e&&(r=r._item.next.content.type)}}}if(r===null)throw kt();if(t===0&&r.constructor!==Ut&&r!==e)return iD(r._item.parent,r._item)}return rd(e,e._length,e.length===0?-1:0)},iD=(t,e)=>{let n=null,r=null;return t._item===null?r=Wo(t):n=Z(t._item.id.client,t._item.id.clock),new Ko(n,r,e.id)},ci=(t,e,n,r)=>{const i=N3(n,t);if(i===null||i.type!==e&&!Yo(e,i.type._item))return null;let s=i.type,o=0;if(s.constructor===Ut)o=i.index;else if(s._item===null||!s._item.deleted){let a=s._first,l=0;for(;l<s._length&&l<i.index&&a!==null;){if(!a.deleted){const c=a.content.type;l++,c instanceof Ut?o+=c._length:o+=r.get(c).nodeSize}a=a.right}o+=1}for(;s!==e&&s._item!==null;){const a=s._item.parent;if(a._item===null||!a._item.deleted){o+=1;let l=a._first;for(;l!==null;){const c=l.content.type;if(c===s)break;l.deleted||(c instanceof Ut?o+=c._length:o+=r.get(c).nodeSize),l=l.right}}s=a}return o-1},sD=(t,e,n)=>t!==e,oD=t=>{const e=document.createElement("span");e.classList.add("ProseMirror-yjs-cursor"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name),null);const r=document.createTextNode(""),i=document.createTextNode("");return e.insertBefore(r,null),e.insertBefore(n,null),e.insertBefore(i,null),e},_T=t=>({style:`background-color: ${t.color}70`,class:"ProseMirror-yjs-selection"}),aD=/^#[0-9a-fA-F]{6}$/,S0=(t,e,n,r,i)=>{const s=Ie.getState(t),o=s.doc,a=[];return s.snapshot!=null||s.prevSnapshot!=null||s.binding.mapping.size===0?ue.create(t.doc,[]):(e.getStates().forEach((l,c)=>{if(n(o.clientID,c,l)&&l.cursor!=null){const u=l.user||{};u.color==null?u.color="#ffa500":aD.test(u.color)||console.warn("A user uses an unsupported color format",u),u.name==null&&(u.name=`User: ${c}`);let d=ci(o,s.type,ho(l.cursor.anchor),s.binding.mapping),h=ci(o,s.type,ho(l.cursor.head),s.binding.mapping);if(d!==null&&h!==null){const f=En(t.doc.content.size-1,0);d=sr(d,f),h=sr(h,f),a.push(Ee.widget(h,()=>r(u,c),{key:c+"",side:10}));const p=sr(d,h),g=En(d,h);a.push(Ee.inline(p,g,i(u,c),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),ue.create(t.doc,a))},lD=(t,{awarenessStateFilter:e=sD,cursorBuilder:n=oD,selectionBuilder:r=_T,getSelection:i=o=>o.selection}={},s="cursor")=>new re({key:Ha,state:{init(o,a){return S0(a,t,e,n,r)},apply(o,a,l,c){const u=Ie.getState(c),d=o.getMeta(Ha);return u&&u.isChangeOrigin||d&&d.awarenessUpdated?S0(c,t,e,n,r):a.map(o.mapping,o.doc)}},props:{decorations:o=>Ha.getState(o)},view:o=>{const a=()=>{o.docView&&rD(o,Ha,{awarenessUpdated:!0})},l=()=>{const c=Ie.getState(o.state),u=t.getLocalState()||{};if(o.hasFocus()){const d=i(o.state),h=Zo(d.anchor,c.type,c.binding.mapping),f=Zo(d.head,c.type,c.binding.mapping);(u.cursor==null||!u0(ho(u.cursor.anchor),h)||!u0(ho(u.cursor.head),f))&&t.setLocalStateField(s,{anchor:h,head:f})}else u.cursor!=null&&ci(c.doc,c.type,ho(u.cursor.anchor),c.binding.mapping)!==null&&t.setLocalStateField(s,null)};return t.on("change",a),o.dom.addEventListener("focusin",l),o.dom.addEventListener("focusout",l),{update:l,destroy:()=>{o.dom.removeEventListener("focusin",l),o.dom.removeEventListener("focusout",l),t.off("change",a),t.setLocalStateField(s,null)}}}}),cD=t=>vn.getState(t)?.undoManager?.undo()!=null,uD=t=>vn.getState(t)?.undoManager?.redo()!=null,dD=(t,e)=>e==null?vn.getState(t)?.undoManager?.canUndo():cD(t),hD=(t,e)=>e==null?vn.getState(t)?.undoManager?.canRedo():uD(t),fD=new Set(["paragraph"]),pD=(t,e)=>!(t instanceof _e)||!(t.content instanceof Sn)||!(t.content.type instanceof Fr||t.content.type instanceof at&&e.has(t.content.type.nodeName))||t.content.type._length===0,mD=({protectedNodes:t=fD,trackedOrigins:e=[],undoManager:n=null}={})=>new re({key:vn,state:{init:(r,i)=>{const s=Ie.getState(i),o=n||new eT(s.type,{trackedOrigins:new Set([Ie].concat(e)),deleteFilter:a=>pD(a,t),captureTransaction:a=>a.meta.get("addToHistory")!==!1});return{undoManager:o,prevSel:null,hasUndoOps:o.undoStack.length>0,hasRedoOps:o.redoStack.length>0}},apply:(r,i,s,o)=>{const a=Ie.getState(o).binding,l=i.undoManager,c=l.undoStack.length>0,u=l.redoStack.length>0;return a?{undoManager:l,prevSel:Ih(a,s),hasUndoOps:c,hasRedoOps:u}:c!==i.hasUndoOps||u!==i.hasRedoOps?Object.assign({},i,{hasUndoOps:l.undoStack.length>0,hasRedoOps:l.redoStack.length>0}):i}},view:r=>{const i=Ie.getState(r.state),s=vn.getState(r.state).undoManager;return s.on("stack-item-added",({stackItem:o})=>{const a=i.binding;a&&o.meta.set(a,vn.getState(r.state).prevSel)}),s.on("stack-item-popped",({stackItem:o})=>{const a=i.binding;a&&(a.beforeTransactionSelection=o.meta.get(a)||a.beforeTransactionSelection)}),{destroy:()=>{s.destroy()}}}}),as=new WeakMap,pl=new WeakMap,Jl={current:[]};let ad=!1;const Ua=new Set,w0=new Map;function NT(t){const e=Array.from(t).sort((n,r)=>n instanceof ls&&n.options.deps.includes(r)?1:r instanceof ls&&r.options.deps.includes(n)?-1:0);for(const n of e){if(Jl.current.includes(n))continue;Jl.current.push(n),n.recompute();const r=pl.get(n);if(r)for(const i of r){const s=as.get(i);s&&NT(s)}}}function gD(t){const e={prevVal:t.prevState,currentVal:t.state};for(const n of t.listeners)n(e)}function bD(t){const e={prevVal:t.prevState,currentVal:t.state};for(const n of t.listeners)n(e)}function yD(t){if(Ua.add(t),!ad)try{for(ad=!0;Ua.size>0;){const e=Array.from(Ua);Ua.clear();for(const n of e){const r=w0.get(n)??n.prevState;n.prevState=r,gD(n)}for(const n of e){const r=as.get(n);r&&(Jl.current.push(n),NT(r))}for(const n of e){const r=as.get(n);if(r)for(const i of r)bD(i)}}}finally{ad=!1,Jl.current=[],w0.clear()}}function ED(t){return typeof t=="function"}class Dh{constructor(e,n){this.listeners=new Set,this.subscribe=r=>{var i,s;this.listeners.add(r);const o=(s=(i=this.options)==null?void 0:i.onSubscribe)==null?void 0:s.call(i,r,this);return()=>{this.listeners.delete(r),o?.()}},this.prevState=e,this.state=e,this.options=n}setState(e){var n,r,i;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(e):ED(e)?this.state=e(this.prevState):this.state=e,(i=(r=this.options)==null?void 0:r.onUpdate)==null||i.call(r),yD(this)}}class ls{constructor(e){this.listeners=new Set,this._subscriptions=[],this.lastSeenDepValues=[],this.getDepVals=()=>{const n=this.options.deps.length,r=new Array(n),i=new Array(n);for(let s=0;s<n;s++){const o=this.options.deps[s];r[s]=o.prevState,i[s]=o.state}return this.lastSeenDepValues=i,{prevDepVals:r,currDepVals:i,prevVal:this.prevState??void 0}},this.recompute=()=>{var n,r;this.prevState=this.state;const i=this.getDepVals();this.state=this.options.fn(i),(r=(n=this.options).onUpdate)==null||r.call(n)},this.checkIfRecalculationNeededDeeply=()=>{for(const s of this.options.deps)s instanceof ls&&s.checkIfRecalculationNeededDeeply();let n=!1;const r=this.lastSeenDepValues,{currDepVals:i}=this.getDepVals();for(let s=0;s<i.length;s++)if(i[s]!==r[s]){n=!0;break}n&&this.recompute()},this.mount=()=>(this.registerOnGraph(),this.checkIfRecalculationNeededDeeply(),()=>{this.unregisterFromGraph();for(const n of this._subscriptions)n()}),this.subscribe=n=>{var r,i;this.listeners.add(n);const s=(i=(r=this.options).onSubscribe)==null?void 0:i.call(r,n,this);return()=>{this.listeners.delete(n),s?.()}},this.options=e,this.state=e.fn({prevDepVals:void 0,prevVal:void 0,currDepVals:this.getDepVals().currDepVals})}registerOnGraph(e=this.options.deps){for(const n of e)if(n instanceof ls)n.registerOnGraph(),this.registerOnGraph(n.options.deps);else if(n instanceof Dh){let r=as.get(n);r||(r=new Set,as.set(n,r)),r.add(this);let i=pl.get(this);i||(i=new Set,pl.set(this,i)),i.add(n)}}unregisterFromGraph(e=this.options.deps){for(const n of e)if(n instanceof ls)this.unregisterFromGraph(n.options.deps);else if(n instanceof Dh){const r=as.get(n);r&&r.delete(this);const i=pl.get(this);i&&i.delete(n)}}}const Lh=Symbol("originalFactory");function pe(t){if(typeof t=="object"&&"key"in t)return function e(){return t[Lh]=e,t};if(typeof t!="function")throw new Error("factory must be a function");return function e(n){return r=>{const i=t({editor:r.editor,options:n});return i[Lh]=e,i}}}function Mi(t,e){return new Dh(t,e)}var x0=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},kD=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,TD=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,CD=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,SD=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,wD=Tn.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return x0("strong",{...sn(this.options.HTMLAttributes,t),children:x0("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[bs({find:kD,type:this.type}),bs({find:CD,type:this.type})]},addPasteRules(){return[bi({find:TD,type:this.type}),bi({find:SD,type:this.type})]}}),xD=wD,AD=/(^|[^`])`([^`]+)`(?!`)$/,_D=/(^|[^`])`([^`]+)`(?!`)/g,ND=Tn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",sn(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[bs({find:AD,type:this.type})]},addPasteRules(){return[bi({find:_D,type:this.type})]}}),ID=ND,OD=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,MD=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,vD=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,DD=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,LD=Tn.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",sn(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[bs({find:OD,type:this.type}),bs({find:vD,type:this.type})]},addPasteRules(){return[bi({find:MD,type:this.type}),bi({find:DD,type:this.type})]}}),RD=LD,PD=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,BD=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,FD=Tn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",sn(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[bs({find:PD,type:this.type})]},addPasteRules(){return[bi({find:BD,type:this.type})]}}),HD=FD,UD=Tn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",sn(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!i)return;const s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:n.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),$D=UD,zD=class IT{constructor(e){this.cache=new Map(e)}get(e){return this.cache.get(e)}set(e,n,r){e<0||this.cache.set(e,[n,r])}replace(e,n,r,i){this.remove(e),this.set(n,r,i)}remove(e){this.cache.delete(e)}invalidate(e){const n=new IT(this.cache),r=e.mapping;return this.cache.forEach(([i,s],o)=>{if(o<0)return;const a=r.mapResult(o),l=e.doc.nodeAt(a.pos);if(a.deleted||!l?.eq(i))n.remove(o);else if(o!==a.pos){const c=s.map(u=>u.map(r,0,0)).filter(u=>u!=null);n.replace(o,a.pos,l,c)}}),n}};function VD({parser:t,nodeTypes:e=["code_block","codeBlock"],languageExtractor:n=r=>r.attrs.language}){const r=new me("prosemirror-highlight");return new re({key:r,state:{init(i,s){const o=new zD,[a,l]=A0(s.doc,t,e,n,o);return{cache:o,decorations:a,promises:l}},apply:(i,s)=>{const o=s.cache.invalidate(i),a=!!i.getMeta("prosemirror-highlight-refresh");if(!i.docChanged&&!a)return{cache:o,decorations:s.decorations.map(i.mapping,i.doc),promises:s.promises};const[l,c]=A0(i.doc,t,e,n,o);return{cache:o,decorations:l,promises:c}}},view:i=>{const s=new Set,o=()=>{if(s.size>0)return;const l=i.state.tr.setMeta("prosemirror-highlight-refresh",!0);i.dispatch(l)},a=()=>{const l=r.getState(i.state);for(const c of l?.promises??[])s.add(c),c.then(()=>{s.delete(c),o()}).catch(()=>{s.delete(c)})};return a(),{update:()=>{a()}}},props:{decorations(i){return this.getState(i)?.decorations}}})}function A0(t,e,n,r,i){const s=[],o=[];return t.descendants((a,l)=>{if(!a.type.isTextblock)return!0;if(n.includes(a.type.name)){const c=r(a),u=i.get(l);if(u){const[d,h]=u;s.push(...h)}else{const d=e({content:a.textContent,language:c||void 0,pos:l,size:a.nodeSize});d&&Array.isArray(d)?(i.set(l,a,d),s.push(...d)):d instanceof Promise&&(i.remove(l),o.push(d))}}return!1}),[ue.create(t,s),o]}function jD(t,e){return function({content:r,language:i,pos:s,size:o}){const a=[],{tokens:l,fg:c,bg:u,rootStyle:d}=t.codeToTokens(r,{lang:i,theme:t.getLoadedThemes()[0]}),h=d||(c&&u?`--prosemirror-highlight:${c};--prosemirror-highlight-bg:${u}`:"");if(h){const p=Ee.node(s,s+o,{style:h});a.push(p)}let f=s+1;for(const p of l){for(const g of p){const b=f+g.content.length,y=Ee.inline(f,b,{style:qD(g.htmlStyle??`color: ${g.color}`),class:"shiki"});a.push(y),f=b}f+=1}return a}}function qD(t){return typeof t=="string"?t:Object.entries(t).map(([e,n])=>`${e}:${n}`).join(";")}var WD=Object.defineProperty,YD=(t,e,n)=>e in t?WD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Yr=(t,e,n)=>YD(t,typeof e!="symbol"?e+"":e,n);const KD=()=>typeof navigator<"u"&&(/Mac/.test(navigator.platform)||/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent));function dr(t,e="Ctrl"){return KD()?t.replace("Mod","⌘"):t.replace("Mod",e)}function Hr(...t){return[...new Set(t.filter(e=>e).join(" ").split(" "))].join(" ")}const Lj=()=>/^((?!chrome|android).)*safari/i.test(navigator.userAgent);function GD(t,e,n,r){const i=document.createElement("div");i.className=Hr("bn-block-content",n.class),i.setAttribute("data-content-type",t);for(const[o,a]of Object.entries(n))o!=="class"&&i.setAttribute(o,a);const s=document.createElement(e);s.className=Hr("bn-inline-content",r.class);for(const[o,a]of Object.entries(r))o!=="class"&&s.setAttribute(o,a);return i.appendChild(s),{dom:i,contentDOM:s}}const _0=(t,e)=>{let n=Ii(t,e.pmSchema);n.type.name==="blockContainer"&&(n=n.firstChild);const r=e.pmSchema.nodes[n.type.name].spec.toDOM;if(r===void 0)throw new Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");const i=r(n);if(typeof i!="object"||!("dom"in i))throw new Error("Cannot use this block's default HTML serialization as its corresponding TipTap node's `renderHTML` function does not return an object with the `dom` property.");return i};function QD(t,e="<br>"){const n=t.querySelectorAll("p");if(n.length>1){const r=n[0];for(let i=1;i<n.length;i++){const s=n[i];r.innerHTML+=e+s.innerHTML,s.remove()}}}function Xl(t){return"data-"+t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Rj(t){const e=t.split("/");return!e.length||e[e.length-1]===""?t:e[e.length-1]}function JD(t){var e;const n=["mp4","webm","ogg","mov","mkv","flv","avi","wmv","m4v"];try{const r=((e=new URL(t).pathname.split(".").pop())==null?void 0:e.toLowerCase())||"";return n.includes(r)}catch{return!1}}function XD(t){const e={};return Object.entries(t).forEach(([n,r])=>{e[n]={default:r.default,keepOnSplit:!0,parseHTML:i=>{const s=i.getAttribute(Xl(n));if(s===null)return null;if(r.default===void 0&&r.type==="boolean"||r.default!==void 0&&typeof r.default=="boolean")return s==="true"?!0:s==="false"?!1:null;if(r.default===void 0&&r.type==="number"||r.default!==void 0&&typeof r.default=="number"){const o=parseFloat(s);return!Number.isNaN(o)&&Number.isFinite(o)?o:null}return s},renderHTML:i=>i[n]!==r.default?{[Xl(n)]:i[n]}:{}}}),e}function ZD(t,e,n,r){const i=t();if(i===void 0)throw new Error("Cannot find node position");const s=n.state.doc.resolve(i).node().attrs.id;if(!s)throw new Error("Block doesn't have id");const o=e.getBlock(s);if(o.type!==r)throw new Error("Block type does not match");return o}function Rh(t,e,n,r,i=!1,s){const o=document.createElement("div");if(s!==void 0)for(const[a,l]of Object.entries(s))a!=="class"&&o.setAttribute(a,l);o.className=Hr("bn-block-content",s?.class||""),o.setAttribute("data-content-type",e);for(const[a,l]of Object.entries(n)){const c=r[a].default;l!==c&&o.setAttribute(Xl(a),l)}return i&&o.setAttribute("data-file-block",""),o.appendChild(t.dom),t.contentDOM&&(t.contentDOM.className=Hr("bn-inline-content",t.contentDOM.className)),{...t,dom:o}}function eL(t,e,n){return{config:{type:t.type,content:t.content,propSchema:e},implementation:{node:t.node,render:_0,toExternalHTML:_0},extensions:n}}function tL(t,e){t.stopEvent=n=>(n.type==="mousedown"&&setTimeout(()=>{e.view.dom.blur()},10),!0)}function nL(t,e){const n=[{tag:"[data-content-type="+t.type+"]",contentElement:".bn-inline-content"}];return e.parse&&n.push({tag:"*",getAttrs(r){var i;if(typeof r=="string")return!1;const s=(i=e.parse)==null?void 0:i.call(e,r);return s===void 0?!1:s},preserveWhitespace:!0,getContent:t.content==="inline"||t.content==="none"?(r,i)=>{var s;if(e.parseContent)return e.parseContent({el:r,schema:i});if(t.content==="inline"){const o=r.cloneNode(!0);return QD(o,(s=e.meta)!=null&&s.code?`
|
|
112
|
-
`:"<br>"),mn.fromSchema(i).parse(o,{topNode:i.nodes.paragraph.create(),preserveWhitespace:!0}).content}return v.empty}:void 0}),n}function rL(t,e,n,r){var i,s,o,a;const l=e.node||Cn.create({name:t.type,content:t.content==="inline"?"inline*":t.content==="none"?"":t.content,group:"blockContent",selectable:((i=e.meta)==null?void 0:i.selectable)??!0,isolating:((s=e.meta)==null?void 0:s.isolating)??!0,code:((o=e.meta)==null?void 0:o.code)??!1,defining:((a=e.meta)==null?void 0:a.defining)??!0,priority:r,addAttributes(){return XD(t.propSchema)},parseHTML(){return nL(t,e)},renderHTML({HTMLAttributes:c}){var u;const d=document.createElement("div");return Rh({dom:d,contentDOM:t.content==="inline"?d:void 0},t.type,{},t.propSchema,((u=e.meta)==null?void 0:u.fileBlockAccept)!==void 0,c)},addNodeView(){return c=>{var u,d;const h=this.options.editor,f=ZD(c.getPos,h,this.editor,t.type),p=((u=this.options.domAttributes)==null?void 0:u.blockContent)||{},g=e.render.call({blockContentDOMAttributes:p,props:c,renderType:"nodeView"},f,h);return((d=e.meta)==null?void 0:d.selectable)===!1&&tL(g,this.editor),g}}});if(l.name!==t.type)throw new Error("Node name does not match block type. This is a bug in BlockNote.");return{config:t,implementation:{...e,node:l,render(c,u){var d;const h=((d=l.options.domAttributes)==null?void 0:d.blockContent)||{};return e.render.call({blockContentDOMAttributes:h,props:void 0,renderType:"dom"},c,u)},toExternalHTML:(c,u,d)=>{var h,f;const p=((h=l.options.domAttributes)==null?void 0:h.blockContent)||{};return((f=e.toExternalHTML)==null?void 0:f.call({blockContentDOMAttributes:p},c,u,d))??e.render.call({blockContentDOMAttributes:p,renderType:"dom",props:void 0},c,u)}},extensions:n}}function jt(t,e,n){return(r={})=>{const i=typeof t=="function"?t(r):t,s=typeof e=="function"?e(r):e,o=n?typeof n=="function"?n(r):n:void 0;return{config:i,implementation:{...s,toExternalHTML(a,l,c){var u,d;const h=(u=s.toExternalHTML)==null?void 0:u.call({blockContentDOMAttributes:this.blockContentDOMAttributes},a,l,c);if(h!==void 0)return Rh(h,a.type,a.props,i.propSchema,((d=s.meta)==null?void 0:d.fileBlockAccept)!==void 0)},render(a,l){var c;const u=s.render.call({blockContentDOMAttributes:this.blockContentDOMAttributes,renderType:this.renderType,props:this.props},a,l);return Rh(u,a.type,a.props,i.propSchema,((c=s.meta)==null?void 0:c.fileBlockAccept)!==void 0,this.blockContentDOMAttributes)}},extensions:o}}}function Pj(t,e,n,r){return t.dom.setAttribute("data-inline-content-type",e),Object.entries(n).filter(([i,s])=>{const o=r[i];return s!==o.default}).map(([i,s])=>[Xl(i),s]).forEach(([i,s])=>t.dom.setAttribute(i,s)),t.contentDOM&&t.contentDOM.setAttribute("data-editable",""),t}function Bj(t){return{Backspace:({editor:e})=>{const n=e.state.selection.$from;return e.state.selection.empty&&n.node().type.name===t.type&&n.parentOffset===0}}}function Fj(t,e){return{config:t,implementation:e}}function OT(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>[e,n.config]))}function iL(t){return t==="boolean"?{}:{stringValue:{default:void 0,keepOnSplit:!0,parseHTML:e=>e.getAttribute("data-value"),renderHTML:e=>e.stringValue!==void 0?{"data-value":e.stringValue}:{}}}}function $a(t,e,n,r){return t.dom.setAttribute("data-style-type",e),r==="string"&&t.dom.setAttribute("data-value",n),t.contentDOM&&t.contentDOM.setAttribute("data-editable",""),t}function MT(t,e){return{config:t,implementation:e}}function qs(t,e){return MT({type:t.name,propSchema:e},{mark:t,render(n,r){const i=r.pmSchema.marks[t.name].spec.toDOM;if(i===void 0)throw new Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");const s=r.pmSchema.mark(t.name,{stringValue:n}),o=zt.renderSpec(document,i(s,!0));if(typeof o!="object"||!("dom"in o))throw new Error("Cannot use this block's default HTML serialization as its corresponding TipTap mark's `renderHTML` function does not return an object with the `dom` property.");return o},toExternalHTML(n,r){const i=r.pmSchema.marks[t.name].spec.toDOM;if(i===void 0)throw new Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");const s=r.pmSchema.mark(t.name,{stringValue:n}),o=zt.renderSpec(document,i(s,!0));if(typeof o!="object"||!("dom"in o))throw new Error("Cannot use this block's default HTML serialization as its corresponding TipTap mark's `renderHTML` function does not return an object with the `dom` property.");return o}})}function vT(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>[e,n.config]))}function sL(t,e){const n=[{tag:`[data-style-type="${t.type}"]`,contentElement:r=>{const i=r;return i.matches("[data-editable]")?i:i.querySelector("[data-editable]")||i}}];return e&&n.push({tag:"*",consuming:!1,getAttrs(r){if(typeof r=="string")return!1;const i=e?.(r);return i===void 0?!1:{stringValue:i}}}),n}function DT(t,e){const n=Tn.create({name:t.type,addAttributes(){return iL(t.propSchema)},parseHTML(){return sL(t,e.parse)},renderHTML({mark:r}){const i=(e.toExternalHTML||e.render)(r.attrs.stringValue);return $a(i,t.type,r.attrs.stringValue,t.propSchema)},addMarkView(){return({mark:r})=>{const i=e.render(r.attrs.stringValue);return $a(i,t.type,r.attrs.stringValue,t.propSchema)}}});return MT(t,{...e,mark:n,render:r=>{const i=e.render(r);return $a(i,t.type,r,t.propSchema)},toExternalHTML:r=>{const i=(e.toExternalHTML||e.render)(r);return $a(i,t.type,r,t.propSchema)}})}function Vt(t,e){let n,r;if(e.firstChild.descendants((i,s)=>n?!1:!vp(i)||i.attrs.id!==t?!0:(n=i,r=s+1,!1)),!(n===void 0||r===void 0))return{node:n,posBeforeNode:r}}function vp(t){return t.type.isInGroup("bnBlock")}const oL=(t,e)=>({tr:n,dispatch:r})=>(r&&hu(n,t,e),!0);function hu(t,e,n,r,i){const s=Qc(t.doc.resolve(e));let o=null;s.blockNoteType==="table"&&(o=cL(t));const a=He(t),l=a.nodes[s.blockNoteType],c=a.nodes[n.type||s.blockNoteType],u=c.isInGroup("bnBlock")?c:a.nodes.blockContainer;if(s.isBlockContainer&&c.isInGroup("blockContent"))N0(n,t,s),aL(n,t,l,c,s);else if(!s.isBlockContainer&&c.isInGroup("bnBlock"))N0(n,t,s);else{const d=ve(s.bnBlock.node,a);t.replaceWith(s.bnBlock.beforePos,s.bnBlock.afterPos,Ii({children:d.children,...n},a));return}t.setNodeMarkup(s.bnBlock.beforePos,u,{...s.bnBlock.node.attrs,...n.props}),o&&uL(t,s,o)}function aL(t,e,n,r,i,s,o){const a=He(e);let l="keep";if(t.content)if(typeof t.content=="string")l=bn([t.content],a,r.name);else if(Array.isArray(t.content))l=bn(t.content,a,r.name);else if(t.content.type==="tableContent")l=Xc(t.content,a);else throw new Pn(t.content.type);else n.spec.content===""||r.spec.content!==n.spec.content&&(l=[]);l==="keep"?e.setNodeMarkup(i.blockContent.beforePos,r,{...i.blockContent.node.attrs,...t.props}):e.replaceWith(i.blockContent.beforePos,i.blockContent.afterPos,r.createChecked({...i.blockContent.node.attrs,...t.props},l))}function N0(t,e,n){const r=He(e);if(t.children!==void 0&&t.children.length>0){const i=t.children.map(s=>Ii(s,r));if(n.childContainer)e.step(new Re(n.childContainer.beforePos+1,n.childContainer.afterPos-1,new F(v.from(i),0,0)));else{if(!n.isBlockContainer)throw new Error("impossible");e.insert(n.blockContent.afterPos,r.nodes.blockGroup.createChecked({},i))}}}function lL(t,e,n,r,i){const s=typeof e=="string"?e:e.id,o=Vt(s,t.doc);if(!o)throw new Error(`Block with ID ${s} not found`);hu(t,o.posBeforeNode,n);const a=t.doc.resolve(o.posBeforeNode+1).node(),l=He(t);return ve(a,l)}function cL(t){const e="selection"in t?t.selection:null;if(!(e instanceof j))return null;const n=t.doc.resolve(e.head);let r=-1,i=-1;for(let g=n.depth;g>=0;g--){const b=n.node(g).type.name;if(r<0&&(b==="tableCell"||b==="tableHeader")&&(r=g),b==="table"){i=g;break}}if(r<0||i<0)return null;const s=n.before(r),o=n.before(i),a=t.doc.nodeAt(o);if(!a||a.type.name!=="table")return null;const l=Ae.get(a),c=s-(o+1),u=l.map.indexOf(c);if(u<0)return null;const d=Math.floor(u/l.width),h=u%l.width,f=s+1+1,p=Math.max(0,e.head-f);return{row:d,col:h,offset:p}}function uL(t,e,n){var r;if(e.blockNoteType!=="table")return!1;let i=-1;if(e.isBlockContainer)i=t.mapping.map(e.blockContent.beforePos);else{const b=t.mapping.map(e.bnBlock.beforePos),y=b+(((r=t.doc.nodeAt(b))==null?void 0:r.nodeSize)||0);t.doc.nodesBetween(b,y,(C,S)=>C.type.name==="table"?(i=S,!1):!0)}const s=i>=0?t.doc.nodeAt(i):null;if(!s||s.type.name!=="table")return!1;const o=Ae.get(s),a=Math.max(0,Math.min(n.row,o.height-1)),l=Math.max(0,Math.min(n.col,o.width-1)),c=a*o.width+l,u=o.map[c];if(u==null)return!1;const d=i+1+u+1,h=t.doc.nodeAt(d),f=d+1,p=h?h.content.size:0,g=f+Math.max(0,Math.min(n.offset,p));return"selection"in t&&t.setSelection(j.create(t.doc,g)),!0}const _r={gray:{text:"#9b9a97",background:"#ebeced"},brown:{text:"#64473a",background:"#e9e5e3"},red:{text:"#e03e3e",background:"#fbe4e4"},orange:{text:"#d9730d",background:"#f6e9d9"},yellow:{text:"#dfab01",background:"#fbf3db"},green:{text:"#4d6461",background:"#ddedea"},blue:{text:"#0b6e99",background:"#ddebf1"},purple:{text:"#6940a5",background:"#eae4f2"},pink:{text:"#ad1a72",background:"#f4dfeb"}},ye={backgroundColor:{default:"default"},textColor:{default:"default"},textAlignment:{default:"left",values:["left","center","right","justify"]}},vt=t=>{const e={};return t.hasAttribute("data-background-color")?e.backgroundColor=t.getAttribute("data-background-color"):t.style.backgroundColor&&(e.backgroundColor=t.style.backgroundColor),t.hasAttribute("data-text-color")?e.textColor=t.getAttribute("data-text-color"):t.style.color&&(e.textColor=t.style.color),e.textAlignment=ye.textAlignment.values.includes(t.style.textAlign)?t.style.textAlign:void 0,e},vi=(t,e)=>{t.backgroundColor&&t.backgroundColor!==ye.backgroundColor.default&&(e.style.backgroundColor=t.backgroundColor in _r?_r[t.backgroundColor].background:t.backgroundColor),t.textColor&&t.textColor!==ye.textColor.default&&(e.style.color=t.textColor in _r?_r[t.textColor].text:t.textColor),t.textAlignment&&t.textAlignment!==ye.textAlignment.default&&(e.style.textAlign=t.textAlignment)},dL=(t="backgroundColor")=>({default:ye.backgroundColor.default,parseHTML:e=>e.hasAttribute("data-background-color")?e.getAttribute("data-background-color"):e.style.backgroundColor?e.style.backgroundColor:ye.backgroundColor.default,renderHTML:e=>e[t]===ye.backgroundColor.default?{}:{"data-background-color":e[t]}}),hL=(t="textColor")=>({default:ye.textColor.default,parseHTML:e=>e.hasAttribute("data-text-color")?e.getAttribute("data-text-color"):e.style.color?e.style.color:ye.textColor.default,renderHTML:e=>e[t]===ye.textColor.default?{}:{"data-text-color":e[t]}}),fu=(t,e)=>{const n=t.querySelector(e);if(!n)return;const r=t.querySelector("figcaption"),i=r?.textContent??void 0;return{targetElement:n,caption:i}},Nr=pe(({editor:t})=>{const e=Mi(void 0);function n(){e.setState(void 0)}return{key:"filePanel",store:e,mount({signal:r}){const i=t.onChange(n,!1),s=t.onSelectionChange(n,!1);r.addEventListener("abort",()=>{i(),s()})},closeMenu:n,showMenu(r){e.setState(r)}}}),fL=(t,e,n)=>{const r=document.createElement("div");r.className="bn-add-file-button";const i=document.createElement("div");i.className="bn-add-file-button-icon",n?i.appendChild(n):i.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"></path></svg>',r.appendChild(i);const s=document.createElement("p");s.className="bn-add-file-button-text",s.innerHTML=t.type in e.dictionary.file_blocks.add_button_text?e.dictionary.file_blocks.add_button_text[t.type]:e.dictionary.file_blocks.add_button_text.file,r.appendChild(s);const o=l=>{l.preventDefault(),l.stopPropagation()},a=()=>{var l;e.isEditable&&((l=e.getExtension(Nr))==null||l.showMenu(t.id))};return r.addEventListener("mousedown",o,!0),r.addEventListener("click",a,!0),{dom:r,destroy:()=>{r.removeEventListener("mousedown",o,!0),r.removeEventListener("click",a,!0)}}},pL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"></path></svg>',mL=t=>{const e=document.createElement("div");e.className="bn-file-name-with-icon";const n=document.createElement("div");n.className="bn-file-icon",n.innerHTML=pL,e.appendChild(n);const r=document.createElement("p");return r.className="bn-file-name",r.textContent=t.props.name,e.appendChild(r),{dom:e}},Dp=(t,e,n,r)=>{const i=document.createElement("div");if(i.className="bn-file-block-content-wrapper",t.props.url===""){const o=fL(t,e,r);i.appendChild(o.dom);const a=e.onUploadStart(l=>{if(l===t.id){i.removeChild(o.dom);const c=document.createElement("div");c.className="bn-file-loading-preview",c.textContent="Loading...",i.appendChild(c)}});return{dom:i,destroy:()=>{a(),o.destroy()}}}const s={dom:i};if(t.props.showPreview===!1||!n){const o=mL(t);i.appendChild(o.dom),s.destroy=()=>{var a;(a=o.destroy)==null||a.call(o)}}else i.appendChild(n.dom);if(t.props.caption){const o=document.createElement("p");o.className="bn-file-caption",o.textContent=t.props.caption,i.appendChild(o)}return s},Lp=(t,e)=>{const n=document.createElement("figure"),r=document.createElement("figcaption");return r.textContent=e,n.appendChild(t),n.appendChild(r),{dom:n}},pu=(t,e)=>{const n=document.createElement("div"),r=document.createElement("p");return r.textContent=e,n.appendChild(t),n.appendChild(r),{dom:n}},I0=t=>({url:t.src||void 0}),gL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"></path></svg>',bL=t=>({type:"audio",propSchema:{backgroundColor:ye.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0}},content:"none"}),yL=(t={})=>e=>{if(e.tagName==="AUDIO"){if(e.closest("figure"))return;const{backgroundColor:n}=vt(e);return{...I0(e),backgroundColor:n}}if(e.tagName==="FIGURE"){const n=fu(e,"audio");if(!n)return;const{targetElement:r,caption:i}=n,{backgroundColor:s}=vt(e);return{...I0(r),backgroundColor:s,caption:i}}},EL=(t={})=>(e,n)=>{const r=document.createElement("div");r.innerHTML=t.icon??gL;const i=document.createElement("audio");return i.className="bn-audio",n.resolveFileUrl?n.resolveFileUrl(e.props.url).then(s=>{i.src=s}):i.src=e.props.url,i.controls=!0,i.contentEditable="false",i.draggable=!1,Dp(e,n,{dom:i},r.firstElementChild)},kL=(t={})=>(e,n)=>{if(!e.props.url){const i=document.createElement("p");return i.textContent="Add audio",{dom:i}}let r;return e.props.showPreview?(r=document.createElement("audio"),r.src=e.props.url):(r=document.createElement("a"),r.href=e.props.url,r.textContent=e.props.name||e.props.url),e.props.caption?e.props.showPreview?Lp(r,e.props.caption):pu(r,e.props.caption):{dom:r}},TL=jt(bL,t=>({meta:{fileBlockAccept:["audio/*"]},parse:yL(t),render:EL(t),toExternalHTML:kL(t),runsBefore:["file"]})),O0=Symbol.for("blocknote.shikiParser"),ld=Symbol.for("blocknote.shikiHighlighterPromise");function CL(t){const e=globalThis;let n,r;return VD({parser:i=>{if(!t.createHighlighter)return[];if(!n)return e[ld]=e[ld]||t.createHighlighter(),e[ld].then(o=>{n=o});const s=LT(t,i.language);return!s||s==="text"||s==="none"||s==="plaintext"||s==="txt"?[]:n.getLoadedLanguages().includes(s)?(r||(r=e[O0]||jD(n),e[O0]=r),r(i)):n.loadLanguage(s)},languageExtractor:i=>i.attrs.language,nodeTypes:["codeBlock"]})}const SL=({defaultLanguage:t="text"})=>({type:"codeBlock",propSchema:{language:{default:t}},content:"inline"}),wL=jt(SL,t=>({meta:{code:!0,defining:!0,isolating:!1},parse:e=>{var n,r;if(e.tagName!=="PRE"||e.childElementCount!==1||((n=e.firstElementChild)==null?void 0:n.tagName)!=="CODE")return;const i=e.firstElementChild;return{language:i.getAttribute("data-language")||((r=i.className.split(" ").find(s=>s.includes("language-")))==null?void 0:r.replace("language-",""))}},parseContent:({el:e,schema:n})=>{const r=mn.fromSchema(n),i=e.firstElementChild;return r.parse(i,{preserveWhitespace:"full",topNode:n.nodes.codeBlock.create()}).content},render(e,n){const r=document.createDocumentFragment(),i=document.createElement("pre"),s=document.createElement("code");i.appendChild(s);let o;if(t.supportedLanguages){const a=document.createElement("select");if(Object.entries(t.supportedLanguages??{}).forEach(([c,{name:u}])=>{const d=document.createElement("option");d.value=c,d.text=u,a.appendChild(d)}),a.value=e.props.language||t.defaultLanguage||"text",n.isEditable){const c=u=>{const d=u.target.value;n.updateBlock(e.id,{props:{language:d}})};a.addEventListener("change",c),o=()=>a.removeEventListener("change",c)}else a.disabled=!0;const l=document.createElement("div");l.contentEditable="false",l.appendChild(a),r.appendChild(l)}return r.appendChild(i),{dom:r,contentDOM:s,destroy:()=>{o?.()}}},toExternalHTML(e){const n=document.createElement("pre"),r=document.createElement("code");return r.className=`language-${e.props.language}`,r.dataset.language=e.props.language,n.appendChild(r),{dom:n,contentDOM:r}}}),t=>[pe({key:"code-block-highlighter",prosemirrorPlugins:[CL(t)]}),pe({key:"code-block-keyboard-shortcuts",keyboardShortcuts:{Delete:({editor:e})=>e.transact(n=>{const{block:r}=e.getTextCursorPosition();if(r.type!=="codeBlock")return!1;const{$from:i}=n.selection;return i.parent.textContent?!1:(e.removeBlocks([r]),!0)}),Tab:({editor:e})=>t.indentLineWithTab===!1?!1:e.transact(n=>{const{block:r}=e.getTextCursorPosition();return r.type==="codeBlock"?(n.insertText(" "),!0):!1}),Enter:({editor:e})=>e.transact(n=>{const{block:r,nextBlock:i}=e.getTextCursorPosition();if(r.type!=="codeBlock")return!1;const{$from:s}=n.selection,o=s.parentOffset===s.parent.nodeSize-2,a=s.parent.textContent.endsWith(`
|
|
113
|
-
|
|
114
|
-
`);if(o&&a){if(n.delete(s.pos-2,s.pos),i)return e.setTextCursorPosition(i,"start"),!0;const[l]=e.insertBlocks([{type:"paragraph"}],r,"after");return e.setTextCursorPosition(l,"start"),!0}return n.insertText(`
|
|
115
|
-
`),!0}),"Shift-Enter":({editor:e})=>e.transact(()=>{const{block:n}=e.getTextCursorPosition();if(n.type!=="codeBlock")return!1;const[r]=e.insertBlocks([{type:"paragraph"}],n,"after");return e.setTextCursorPosition(r,"start"),!0})},inputRules:[{find:/^```(.*?)\s$/,replace:({match:e})=>{const n=e[1].trim();return{type:"codeBlock",props:{language:{language:LT(t,n)??n}.language},content:[]}}}]})]);function LT(t,e){var n;return(n=Object.entries(t.supportedLanguages??{}).find(([r,{aliases:i}])=>i?.includes(e)||r===e))==null?void 0:n[0]}const xL=()=>({type:"divider",propSchema:{},content:"none"}),AL=jt(xL,{meta:{isolating:!1},parse(t){if(t.tagName==="HR")return{}},render(){return{dom:document.createElement("hr")}}},[pe({key:"divider-block-shortcuts",inputRules:[{find:new RegExp("^---$"),replace(){return{type:"divider",props:{},content:[]}}}]})]),M0=t=>({url:t.src||void 0}),_L=()=>({type:"file",propSchema:{backgroundColor:ye.backgroundColor,name:{default:""},url:{default:""},caption:{default:""}},content:"none"}),NL=()=>t=>{if(t.tagName==="EMBED"){if(t.closest("figure"))return;const{backgroundColor:e}=vt(t);return{...M0(t),backgroundColor:e}}if(t.tagName==="FIGURE"){const e=fu(t,"embed");if(!e)return;const{targetElement:n,caption:r}=e,{backgroundColor:i}=vt(t);return{...M0(n),backgroundColor:i,caption:r}}},IL=jt(_L,{meta:{fileBlockAccept:["*/*"]},parse:NL(),render(t,e){return Dp(t,e)},toExternalHTML(t){if(!t.props.url){const n=document.createElement("p");return n.textContent="Add file",{dom:n}}const e=document.createElement("a");return e.href=t.props.url,e.textContent=t.props.name||t.props.url,t.props.caption?pu(e,t.props.caption):{dom:e}}}),OL={set:(t,e)=>window.localStorage.setItem(`toggle-${t.id}`,e?"true":"false"),get:t=>window.localStorage.getItem(`toggle-${t.id}`)==="true"},RT=(t,e,n,r=OL)=>{if("isToggleable"in t.props&&!t.props.isToggleable)return{dom:n};const i=document.createElement("div"),s=document.createElement("div");s.className="bn-toggle-wrapper";const o=document.createElement("button");o.className="bn-toggle-button",o.type="button",o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="CURRENTCOLOR"><path d="M320-200v-560l440 280-440 280Z"/></svg>';const a=p=>p.preventDefault();o.addEventListener("mousedown",a);const l=()=>{var p;s.getAttribute("data-show-children")==="true"?(s.setAttribute("data-show-children","false"),r.set(e.getBlock(t),!1),i.contains(c)&&i.removeChild(c)):(s.setAttribute("data-show-children","true"),r.set(e.getBlock(t),!0),e.isEditable&&((p=e.getBlock(t))==null?void 0:p.children.length)===0&&!i.contains(c)&&i.appendChild(c))};o.addEventListener("click",l),s.appendChild(o),s.appendChild(n);const c=document.createElement("button");c.className="bn-toggle-add-block-button",c.type="button",c.textContent=e.dictionary.toggle_blocks.add_block_button;const u=p=>p.preventDefault();c.addEventListener("mousedown",u);const d=()=>{e.transact(()=>{const p=e.updateBlock(t,{children:[{}]});e.setTextCursorPosition(p.children[0].id,"end"),e.focus()})};c.addEventListener("click",d),i.appendChild(s);let h=t.children.length;const f=e.onChange(()=>{var p;const g=((p=e.getBlock(t))==null?void 0:p.children.length)??0;g>h?(s.getAttribute("data-show-children")==="false"&&(s.setAttribute("data-show-children","true"),r.set(e.getBlock(t),!0)),i.contains(c)&&i.removeChild(c)):g===0&&g<h&&(s.getAttribute("data-show-children")==="true"&&(s.setAttribute("data-show-children","false"),r.set(e.getBlock(t),!1)),i.contains(c)&&i.removeChild(c)),h=g});return r.get(t)?(s.setAttribute("data-show-children","true"),e.isEditable&&t.children.length===0&&i.appendChild(c)):s.setAttribute("data-show-children","false"),{dom:i,ignoreMutation:p=>p instanceof MutationRecord&&(p.type==="attributes"&&p.target===s&&p.attributeName==="data-show-children"||p.type==="childList"&&(p.addedNodes[0]===c||p.removedNodes[0]===c)),destroy:()=>{o.removeEventListener("mousedown",a),o.removeEventListener("click",l),c.removeEventListener("mousedown",u),c.removeEventListener("click",d),f?.()}}},PT=[1,2,3,4,5,6],ML=t=>({editor:e})=>{const n=e.getTextCursorPosition();return e.schema.blockSchema[n.block.type].content!=="inline"?!1:(e.updateBlock(n.block,{type:"heading",props:{level:t}}),!0)},vL=({defaultLevel:t=1,levels:e=PT,allowToggleHeadings:n=!0}={})=>({type:"heading",propSchema:{...ye,level:{default:t,values:e},...n?{isToggleable:{default:!1,optional:!0}}:{}},content:"inline"}),DL=jt(vL,({allowToggleHeadings:t=!0}={})=>({meta:{isolating:!1},parse(e){let n;switch(e.tagName){case"H1":n=1;break;case"H2":n=2;break;case"H3":n=3;break;case"H4":n=4;break;case"H5":n=5;break;case"H6":n=6;break;default:return}return{...vt(e),level:n}},render(e,n){const r=document.createElement(`h${e.props.level}`);return t?{...RT(e,n,r),contentDOM:r}:{dom:r,contentDOM:r}},toExternalHTML(e){const n=document.createElement(`h${e.props.level}`);return vi(e.props,n),{dom:n,contentDOM:n}}}),({levels:t=PT}={})=>[pe({key:"heading-shortcuts",keyboardShortcuts:Object.fromEntries(t.map(e=>[`Mod-Alt-${e}`,ML(e)])??[]),inputRules:t.map(e=>({find:new RegExp(`^(#{${e}})\\s$`),replace({match:n}){return{type:"heading",props:{level:n[1].length}}}}))})]),BT=(t,e,n,r,i)=>{const{dom:s,destroy:o}=Dp(t,e,n,i),a=s;a.style.position="relative",t.props.url&&t.props.showPreview&&(t.props.previewWidth?a.style.width=`${t.props.previewWidth}px`:a.style.width="fit-content");const l=document.createElement("div");l.className="bn-resize-handle",l.style.left="4px";const c=document.createElement("div");c.className="bn-resize-handle",c.style.right="4px";const u=document.createElement("div");u.style.position="absolute",u.style.height="100%",u.style.width="100%";let d,h=t.props.previewWidth;const f=S=>{var I,M;if(!d){!e.isEditable&&r.contains(l)&&r.contains(c)&&(r.removeChild(l),r.removeChild(c));return}let A;const D="touches"in S?S.touches[0].clientX:S.clientX;t.props.textAlignment==="center"?d.handleUsed==="left"?A=d.initialWidth+(d.initialClientX-D)*2:A=d.initialWidth+(D-d.initialClientX)*2:d.handleUsed==="left"?A=d.initialWidth+d.initialClientX-D:A=d.initialWidth+D-d.initialClientX,h=Math.min(Math.max(A,64),((M=(I=e.domElement)==null?void 0:I.firstElementChild)==null?void 0:M.clientWidth)||Number.MAX_VALUE),a.style.width=`${h}px`},p=S=>{(!S.target||!a.contains(S.target)||!e.isEditable)&&r.contains(l)&&r.contains(c)&&(r.removeChild(l),r.removeChild(c)),d&&(d=void 0,a.contains(u)&&a.removeChild(u),e.updateBlock(t,{props:{previewWidth:h}}))},g=()=>{e.isEditable&&(r.appendChild(l),r.appendChild(c))},b=S=>{S.relatedTarget===l||S.relatedTarget===c||d||e.isEditable&&r.contains(l)&&r.contains(c)&&(r.removeChild(l),r.removeChild(c))},y=S=>{S.preventDefault(),a.contains(u)||a.appendChild(u);const I="touches"in S?S.touches[0].clientX:S.clientX;d={handleUsed:"left",initialWidth:a.clientWidth,initialClientX:I}},C=S=>{S.preventDefault(),a.contains(u)||a.appendChild(u);const I="touches"in S?S.touches[0].clientX:S.clientX;d={handleUsed:"right",initialWidth:a.clientWidth,initialClientX:I}};return window.addEventListener("mousemove",f),window.addEventListener("touchmove",f),window.addEventListener("mouseup",p),window.addEventListener("touchend",p),a.addEventListener("mouseenter",g),a.addEventListener("mouseleave",b),l.addEventListener("mousedown",y),l.addEventListener("touchstart",y),c.addEventListener("mousedown",C),c.addEventListener("touchstart",C),{dom:a,destroy:()=>{o?.(),window.removeEventListener("mousemove",f),window.removeEventListener("touchmove",f),window.removeEventListener("mouseup",p),window.removeEventListener("touchend",p),a.removeEventListener("mouseenter",g),a.removeEventListener("mouseleave",b),l.removeEventListener("mousedown",y),l.removeEventListener("touchstart",y),c.removeEventListener("mousedown",C),c.removeEventListener("touchstart",C)}}},v0=t=>{const e=t.src||void 0,n=t.width||void 0,r=t.alt||void 0;return{url:e,previewWidth:n,name:r}},LL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z"></path></svg>',RL=(t={})=>({type:"image",propSchema:{textAlignment:ye.textAlignment,backgroundColor:ye.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0},previewWidth:{default:void 0,type:"number"}},content:"none"}),PL=(t={})=>e=>{if(e.tagName==="IMG"){if(e.closest("figure"))return;const{backgroundColor:n}=vt(e);return{...v0(e),backgroundColor:n}}if(e.tagName==="FIGURE"){const n=fu(e,"img");if(!n)return;const{targetElement:r,caption:i}=n,{backgroundColor:s}=vt(e);return{...v0(r),backgroundColor:s,caption:i}}},BL=(t={})=>(e,n)=>{const r=document.createElement("div");r.innerHTML=t.icon??LL;const i=document.createElement("div");i.className="bn-visual-media-wrapper";const s=document.createElement("img");return s.className="bn-visual-media",n.resolveFileUrl?n.resolveFileUrl(e.props.url).then(o=>{s.src=o}):s.src=e.props.url,s.alt=e.props.name||e.props.caption||"BlockNote image",s.contentEditable="false",s.draggable=!1,i.appendChild(s),BT(e,n,{dom:i},i,r.firstElementChild)},FL=(t={})=>(e,n)=>{if(!e.props.url){const i=document.createElement("p");return i.textContent="Add image",{dom:i}}let r;return e.props.showPreview?(r=document.createElement("img"),r.src=e.props.url,r.alt=e.props.name||e.props.caption||"BlockNote image",e.props.previewWidth&&(r.width=e.props.previewWidth)):(r=document.createElement("a"),r.href=e.props.url,r.textContent=e.props.name||e.props.url),e.props.caption?e.props.showPreview?Lp(r,e.props.caption):pu(r,e.props.caption):{dom:r}},HL=jt(RL,t=>({meta:{fileBlockAccept:["image/*"]},parse:PL(t),render:BL(t),toExternalHTML:FL(t),runsBefore:["file"]})),UL=(t,e,n)=>({state:r,dispatch:i})=>i?FT(r.tr,t,e,n):!0,FT=(t,e,n,r)=>{const i=Lr(t.doc,e),s=Rr(i);if(!s.isBlockContainer)return!1;const o=He(t),a=[{type:s.bnBlock.node.type,attrs:r?{...s.bnBlock.node.attrs,id:void 0}:{}},{type:n?s.blockContent.node.type:o.nodes.paragraph,attrs:r?{...s.blockContent.node.attrs}:{}}];return t.split(e,2,a),!0},mu=(t,e)=>{const{blockInfo:n,selectionEmpty:r}=t.transact(o=>({blockInfo:aa(o),selectionEmpty:o.selection.anchor===o.selection.head}));if(!n.isBlockContainer)return!1;const{bnBlock:i,blockContent:s}=n;return s.node.type.name!==e||!r?!1:s.node.childCount===0?(t.transact(o=>{hu(o,i.beforePos,{type:"paragraph",props:{}})}),!0):s.node.childCount>0?t.transact(o=>(o.deleteSelection(),FT(o,o.selection.from,!0))):!1};function Rp(t,e,n){var r,i,s;const o=mn.fromSchema(e),a=t,l=document.createElement("div");l.setAttribute("data-node-type","blockGroup");for(const f of Array.from(a.childNodes))l.appendChild(f.cloneNode(!0));let c=o.parse(l,{topNode:e.nodes.blockGroup.create()});((i=(r=c.firstChild)==null?void 0:r.firstChild)==null?void 0:i.type.name)==="checkListItem"&&(c=c.copy(c.content.cut(c.firstChild.firstChild.nodeSize+2)));const u=(s=c.firstChild)==null?void 0:s.firstChild;if(!(u!=null&&u.isTextblock))return v.from(c);const d=e.nodes[n].create({},u.content),h=c.content.cut(u.nodeSize+2);if(h.size>0){const f=c.copy(h);return d.content.addToEnd(f)}return d.content}const $L=()=>({type:"bulletListItem",propSchema:{...ye},content:"inline"}),zL=jt($L,{meta:{isolating:!1},parse(t){var e;if(t.tagName!=="LI")return;const n=t.parentElement;if(n!==null&&(n.tagName==="UL"||n.tagName==="DIV"&&((e=n.parentElement)==null?void 0:e.tagName)==="UL"))return vt(t)},parseContent:({el:t,schema:e})=>Rp(t,e,"bulletListItem"),render(){const t=document.createElement("p");return{dom:t,contentDOM:t}},toExternalHTML(t){const e=document.createElement("li"),n=document.createElement("p");return vi(t.props,e),e.appendChild(n),{dom:e,contentDOM:n}}},[pe({key:"bullet-list-item-shortcuts",keyboardShortcuts:{Enter:({editor:t})=>mu(t,"bulletListItem"),"Mod-Shift-8":({editor:t})=>{const e=t.getTextCursorPosition();return t.schema.blockSchema[e.block.type].content!=="inline"?!1:(t.updateBlock(e.block,{type:"bulletListItem",props:{}}),!0)}},inputRules:[{find:/^\s?[-+*]\s$/,replace({editor:t}){if(xt(t.prosemirrorState).blockNoteType!=="heading")return{type:"bulletListItem",props:{}}}}]})]),VL=()=>({type:"checkListItem",propSchema:{...ye,checked:{default:!1,type:"boolean"}},content:"inline"}),jL=jt(VL,{meta:{isolating:!1},parse(t){var e;if(t.tagName==="input")return t.closest("[data-content-type]")||t.closest("li")?void 0:t.type==="checkbox"?{checked:t.checked}:void 0;if(t.tagName!=="LI")return;const n=t.parentElement;if(n!==null&&(n.tagName==="UL"||n.tagName==="DIV"&&((e=n.parentElement)==null?void 0:e.tagName)==="UL")){const r=t.querySelector("input[type=checkbox]")||null;return r===null?void 0:{...vt(t),checked:r.checked}}},parseContent:({el:t,schema:e})=>Rp(t,e,"checkListItem"),render(t,e){const n=document.createDocumentFragment(),r=document.createElement("input");r.type="checkbox",r.checked=t.props.checked,t.props.checked&&r.setAttribute("checked",""),r.addEventListener("change",()=>{e.updateBlock(t,{props:{checked:!t.props.checked}})});const i=document.createElement("p"),s=document.createElement("div");return s.contentEditable="false",s.appendChild(r),n.appendChild(s),n.appendChild(i),{dom:n,contentDOM:i}},toExternalHTML(t){const e=document.createElement("li"),n=document.createElement("input");n.type="checkbox",n.checked=t.props.checked,t.props.checked&&n.setAttribute("checked","");const r=document.createElement("p");return vi(t.props,e),e.appendChild(n),e.appendChild(r),{dom:e,contentDOM:r}},runsBefore:["bulletListItem"]},[pe({key:"check-list-item-shortcuts",keyboardShortcuts:{Enter:({editor:t})=>mu(t,"checkListItem"),"Mod-Shift-9":({editor:t})=>{const e=t.getTextCursorPosition();return t.schema.blockSchema[e.block.type].content!=="inline"?!1:(t.updateBlock(e.block,{type:"checkListItem",props:{}}),!0)}},inputRules:[{find:/^\s?\[\s*\]\s$/,replace(){return{type:"checkListItem",props:{checked:!1}}}},{find:/^\s?\[[Xx]\]\s$/,replace(){return{type:"checkListItem",props:{checked:!0}}}}]})]);function HT(t,e,n,r){let i=t.firstChild.attrs.start||1,s=!0;const o=!!t.firstChild.attrs.start,a=Rr({posBeforeNode:e,node:t});if(!a.isBlockContainer)throw new Error("impossible");const l=n.doc.resolve(a.bnBlock.beforePos).nodeBefore,c=l?r.get(l):void 0;return c!==void 0?(i=c+1,s=!1):l&&Rr({posBeforeNode:a.bnBlock.beforePos-l.nodeSize,node:l}).blockNoteType==="numberedListItem"&&(i=HT(l,a.bnBlock.beforePos-l.nodeSize,n,r).index+1,s=!1),r.set(t,i),{index:i,isFirst:s,hasStart:o}}function D0(t,e){const n=new Map,r=e.decorations.map(t.mapping,t.doc),i=[];t.doc.nodesBetween(0,t.doc.nodeSize-2,(o,a)=>{if(o.type.name==="blockContainer"&&o.firstChild.type.name==="numberedListItem"){const{index:l,isFirst:c,hasStart:u}=HT(o,a,t,n);if(r.find(a,a+o.nodeSize,d=>d.index===l&&d.isFirst===c&&d.hasStart===u).length===0){const d=t.doc.nodeAt(a+1);i.push(Ee.node(a+1,a+1+d.nodeSize,{"data-index":l.toString()}))}}});const s=i.flatMap(o=>r.find(o.from,o.to));return{decorations:r.remove(s).add(t.doc,i)}}const qL=()=>new re({key:new me("numbered-list-indexing-decorations"),state:{init(t,e){return D0(e.tr,{decorations:ue.empty})},apply(t,e){return!t.docChanged&&!t.selectionSet&&e.decorations?e:D0(t,e)}},props:{decorations(t){var e;return((e=this.getState(t))==null?void 0:e.decorations)??ue.empty}}}),WL=()=>({type:"numberedListItem",propSchema:{...ye,start:{default:void 0,type:"number"}},content:"inline"}),YL=jt(WL,{meta:{isolating:!1},parse(t){var e;if(t.tagName!=="LI")return;const n=t.parentElement;if(n!==null&&(n.tagName==="OL"||n.tagName==="DIV"&&((e=n.parentElement)==null?void 0:e.tagName)==="OL")){const r=parseInt(n.getAttribute("start")||"1"),i=vt(t);return t.previousElementSibling||r===1?i:{...i,start:r}}},parseContent:({el:t,schema:e})=>Rp(t,e,"numberedListItem"),render(){const t=document.createElement("p");return{dom:t,contentDOM:t}},toExternalHTML(t){const e=document.createElement("li"),n=document.createElement("p");return vi(t.props,e),e.appendChild(n),{dom:e,contentDOM:n}}},[pe({key:"numbered-list-item-shortcuts",inputRules:[{find:/^\s?(\d+)\.\s$/,replace({match:t,editor:e}){if(xt(e.prosemirrorState).blockNoteType==="heading")return;const n=parseInt(t[1]);return{type:"numberedListItem",props:{start:n!==1?n:void 0}}}}],keyboardShortcuts:{Enter:({editor:t})=>mu(t,"numberedListItem"),"Mod-Shift-7":({editor:t})=>{const e=t.getTextCursorPosition();return t.schema.blockSchema[e.block.type].content!=="inline"?!1:(t.updateBlock(e.block,{type:"numberedListItem",props:{}}),!0)}},prosemirrorPlugins:[qL()]})]),KL=()=>({type:"toggleListItem",propSchema:{...ye},content:"inline"}),GL=jt(KL,{meta:{isolating:!1},render(t,e){const n=document.createElement("p");return{...RT(t,e,n),contentDOM:n}},toExternalHTML(t){const e=document.createElement("li"),n=document.createElement("p");return vi(t.props,e),e.appendChild(n),{dom:e,contentDOM:n}}},[pe({key:"toggle-list-item-shortcuts",keyboardShortcuts:{Enter:({editor:t})=>mu(t,"toggleListItem"),"Mod-Shift-6":({editor:t})=>{const e=t.getTextCursorPosition();return t.schema.blockSchema[e.block.type].content!=="inline"?!1:(t.updateBlock(e.block,{type:"toggleListItem",props:{}}),!0)}}})]),QL=()=>({type:"paragraph",propSchema:ye,content:"inline"}),JL=jt(QL,{meta:{isolating:!1},parse:t=>{var e;if(t.tagName==="P"&&(e=t.textContent)!=null&&e.trim())return vt(t)},render:()=>{const t=document.createElement("p");return{dom:t,contentDOM:t}},toExternalHTML:t=>{const e=document.createElement("p");return vi(t.props,e),{dom:e,contentDOM:e}},runsBefore:["default"]},[pe({key:"paragraph-shortcuts",keyboardShortcuts:{"Mod-Alt-0":({editor:t})=>{const e=t.getTextCursorPosition();return t.schema.blockSchema[e.block.type].content!=="inline"?!1:(t.updateBlock(e.block,{type:"paragraph",props:{}}),!0)}}})]),XL=()=>({type:"quote",propSchema:{backgroundColor:ye.backgroundColor,textColor:ye.textColor},content:"inline"}),ZL=jt(XL,{meta:{isolating:!1},parse(t){if(t.tagName==="BLOCKQUOTE"){const{backgroundColor:e,textColor:n}=vt(t);return{backgroundColor:e,textColor:n}}},render(){const t=document.createElement("blockquote");return{dom:t,contentDOM:t}},toExternalHTML(t){const e=document.createElement("blockquote");return vi(t.props,e),{dom:e,contentDOM:e}}},[pe({key:"quote-block-shortcuts",keyboardShortcuts:{"Mod-Alt-q":({editor:t})=>{const e=t.getTextCursorPosition();return t.schema.blockSchema[e.block.type].content!=="inline"?!1:(t.updateBlock(e.block,{type:"quote",props:{}}),!0)}},inputRules:[{find:new RegExp("^>\\s$"),replace(){return{type:"quote",props:{}}}}]})]),eR=35,Pp=120,Hj=31,tR=De.create({name:"BlockNoteTableExtension",addProseMirrorPlugins:()=>[ZI({cellMinWidth:eR,defaultCellMinWidth:Pp,View:null}),cO()],addKeyboardShortcuts(){return{Enter:()=>this.editor.state.selection.empty&&this.editor.state.selection.$head.parent.type.name==="tableParagraph"?(this.editor.commands.insertContent({type:"hardBreak"}),!0):!1,Backspace:()=>{const t=this.editor.state.selection,e=t.empty,n=t.$head.parentOffset===0,r=t.$head.node().type.name==="tableParagraph";return e&&n&&r},Tab:()=>this.editor.commands.command(({state:t,dispatch:e,view:n})=>Bg(1)(t,e,n)),"Shift-Tab":()=>this.editor.commands.command(({state:t,dispatch:e,view:n})=>Bg(-1)(t,e,n))}},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:Te(Y(t,"tableRole",e))}}}),nR={textColor:ye.textColor},rR=Cn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"tableContent+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(n=>parseInt(n,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th",getContent:(t,e)=>UT(t,e)}]},renderHTML({HTMLAttributes:t}){return["th",sn(this.options.HTMLAttributes,t),0]}}),iR=Cn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"tableContent+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(n=>parseInt(n,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td",getContent:(t,e)=>UT(t,e)}]},renderHTML({HTMLAttributes:t}){return["td",sn(this.options.HTMLAttributes,t),0]}}),sR=Cn.create({name:"table",content:"tableRow+",group:"blockContent",tableRole:"table",marks:"deletion insertion modification",isolating:!0,parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){var n,r,i;const s=GD(this.name,"table",{...((n=this.options.domAttributes)==null?void 0:n.blockContent)||{},...e},((r=this.options.domAttributes)==null?void 0:r.inlineContent)||{}),o=document.createElement("colgroup");for(const a of t.children[0].children)if(a.attrs.colwidth)for(const l of a.attrs.colwidth){const c=document.createElement("col");l&&(c.style=`width: ${l}px`),o.appendChild(c)}else o.appendChild(document.createElement("col"));return(i=s.dom.firstChild)==null||i.appendChild(o),s},addNodeView(){return({node:t,HTMLAttributes:e})=>{var n;class r extends tk{constructor(s,o,a){super(s,o),this.node=s,this.cellMinWidth=o,this.blockContentHTMLAttributes=a;const l=document.createElement("div");l.className=Hr("bn-block-content",a.class),l.setAttribute("data-content-type","table");for(const[h,f]of Object.entries(a))h!=="class"&&l.setAttribute(h,f);const c=this.dom,u=document.createElement("div");u.className="tableWrapper-inner",u.appendChild(c.firstChild),c.appendChild(u),l.appendChild(c);const d=document.createElement("div");d.className="table-widgets-container",d.style.position="relative",c.appendChild(d),this.dom=l}ignoreMutation(s){return!s.target.closest(".tableWrapper-inner")||super.ignoreMutation(s)}}return new r(t,Pp,{...((n=this.options.domAttributes)==null?void 0:n.blockContent)||{},...e})}}}),oR=Cn.create({name:"tableParagraph",group:"tableContent",content:"inline*",parseHTML(){return[{tag:"p",getAttrs:t=>{if(typeof t=="string"||!t.textContent||!t.closest("[data-content-type]"))return!1;const e=t.parentElement;return e===null?!1:e.tagName==="TD"||e.tagName==="TH"?{}:!1},node:"tableParagraph"}]},renderHTML({HTMLAttributes:t}){return["p",t,0]}}),aR=Cn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)+",tableRole:"row",marks:"deletion insertion modification",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",sn(this.options.HTMLAttributes,t),0]}});function UT(t,e){const n=mn.fromSchema(e).parse(t,{topNode:e.nodes.blockGroup.create()}),r=[];return n.content.descendants(i=>{if(i.isInline)return r.push(i),!1}),v.fromArray(r)}const lR=()=>eL({node:sR,type:"table",content:"table"},nR,[pe({key:"table-extensions",tiptapExtensions:[tR,oR,rR,iR,aR]}),pe({key:"table-keyboard-delete",keyboardShortcuts:{Backspace:({editor:t})=>{if(!(t.prosemirrorState.selection instanceof be))return!1;const e=t.getTextCursorPosition().block,n=e.content;let r=0;for(const s of n.rows)for(const o of s.cells){if("type"in o&&o.content.length>0||!("type"in o)&&o.length>0)return!1;r++}let i=0;return t.prosemirrorState.selection.forEachCell(()=>{i++}),i<r?!1:(t.transact(()=>{(t.getPrevBlock(e)||t.getNextBlock(e))&&t.setTextCursorPosition(e),t.removeBlocks([e])}),!0)}}})]),L0=t=>{const e=t.src||void 0,n=t.width||void 0;return{url:e,previewWidth:n}},cR='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z"></path></svg>',uR=t=>({type:"video",propSchema:{textAlignment:ye.textAlignment,backgroundColor:ye.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0},previewWidth:{default:void 0,type:"number"}},content:"none"}),dR=t=>e=>{if(e.tagName==="VIDEO"){if(e.closest("figure"))return;const{backgroundColor:n}=vt(e);return{...L0(e),backgroundColor:n}}if(e.tagName==="FIGURE"){const n=fu(e,"video");if(!n)return;const{targetElement:r,caption:i}=n,{backgroundColor:s}=vt(e);return{...L0(r),backgroundColor:s,caption:i}}},hR=jt(uR,t=>({meta:{fileBlockAccept:["video/*"]},parse:dR(),render(e,n){const r=document.createElement("div");r.innerHTML=t.icon??cR;const i=document.createElement("div");i.className="bn-visual-media-wrapper";const s=document.createElement("video");return s.className="bn-visual-media",n.resolveFileUrl?n.resolveFileUrl(e.props.url).then(o=>{s.src=o}):s.src=e.props.url,s.controls=!0,s.contentEditable="false",s.draggable=!1,s.width=e.props.previewWidth,i.appendChild(s),BT(e,n,{dom:i},i,r.firstElementChild)},toExternalHTML(e){if(!e.props.url){const r=document.createElement("p");return r.textContent="Add video",{dom:r}}let n;return e.props.showPreview?(n=document.createElement("video"),n.src=e.props.url,e.props.previewWidth&&(n.width=e.props.previewWidth)):(n=document.createElement("a"),n.href=e.props.url,n.textContent=e.props.name||e.props.url),e.props.caption?e.props.showPreview?Lp(n,e.props.caption):pu(n,e.props.caption):{dom:n}},runsBefore:["file"]}));function We(t,e,n){if(!(e in t.schema.blockSpecs))return!1;if(!n)return!0;for(const[r,i]of Object.entries(n)){if(!(r in t.schema.blockSpecs[e].config.propSchema))return!1;if(typeof i=="string"){if(t.schema.blockSpecs[e].config.propSchema[r].default!==void 0&&typeof t.schema.blockSpecs[e].config.propSchema[r].default!==i||t.schema.blockSpecs[e].config.propSchema[r].type!==void 0&&t.schema.blockSpecs[e].config.propSchema[r].type!==i)return!1}else{if(t.schema.blockSpecs[e].config.propSchema[r].default!==i.default||t.schema.blockSpecs[e].config.propSchema[r].default===void 0&&i.default===void 0&&t.schema.blockSpecs[e].config.propSchema[r].type!==i.type||typeof t.schema.blockSpecs[e].config.propSchema[r].values!=typeof i.values)return!1;if(typeof t.schema.blockSpecs[e].config.propSchema[r].values=="object"&&typeof i.values=="object"){for(const s of i.values)if(!t.schema.blockSpecs[e].config.propSchema[r].values.includes(s))return!1}}}return!0}function Uj(t,e,n,r){return We(e,n,r)&&t.type===n}function R0(t){return t instanceof be}const za=new Map;function fR(t){if(za.has(t))return za.get(t);const e=new ds;return t._tiptapEditor.on("transaction",({transaction:n})=>{e.appendMapping(n.mapping)}),t._tiptapEditor.on("destroy",()=>{za.delete(t)}),za.set(t,e),e}function pR(t,e,n="left"){const r=Ie.getState(t.prosemirrorState);if(!r){const s=fR(t),o=s.maps.length;return()=>s.slice(o).map(e,n==="left"?-1:1)}const i=Zo(e+(n==="right"?1:-1),r.binding.type,r.binding.mapping);return()=>{const s=Ie.getState(t.prosemirrorState),o=ci(s.doc,s.binding.type,i,s.binding.mapping);if(o===null)throw new Error("Position not found, cannot track positions");return o+(n==="right"?-1:1)}}const mR=Yc(t=>t.type.name==="blockContainer");class gR{constructor(e,n,r){Yr(this,"state"),Yr(this,"emitUpdate"),Yr(this,"rootEl"),Yr(this,"pluginState"),Yr(this,"handleScroll",()=>{var s,o;if((s=this.state)!=null&&s.show){const a=(o=this.rootEl)==null?void 0:o.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);if(!a)return;this.state.referencePos=a.getBoundingClientRect().toJSON(),this.emitUpdate(this.pluginState.triggerCharacter)}}),Yr(this,"closeMenu",()=>{this.editor.transact(s=>s.setMeta(ti,null))}),Yr(this,"clearQuery",()=>{this.pluginState!==void 0&&this.editor._tiptapEditor.chain().focus().deleteRange({from:this.pluginState.queryStartPos()-(this.pluginState.deleteTriggerCharacter?this.pluginState.triggerCharacter.length:0),to:this.editor.transact(s=>s.selection.from)}).run()});var i;this.editor=e,this.pluginState=void 0,this.emitUpdate=s=>{var o;if(!this.state)throw new Error("Attempting to update uninitialized suggestions menu");n(s,{...this.state,ignoreQueryLength:(o=this.pluginState)==null?void 0:o.ignoreQueryLength})},this.rootEl=r.root,(i=this.rootEl)==null||i.addEventListener("scroll",this.handleScroll,!0)}update(e,n){var r;const i=ti.getState(n),s=ti.getState(e.state),o=i===void 0&&s!==void 0,a=i!==void 0&&s===void 0;if(!o&&!(i!==void 0&&s!==void 0)&&!a)return;if(this.pluginState=a?i:s,a||!this.editor.isEditable){this.state&&(this.state.show=!1),this.emitUpdate(this.pluginState.triggerCharacter);return}const l=(r=this.rootEl)==null?void 0:r.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);this.editor.isEditable&&l&&(this.state={show:!0,referencePos:l.getBoundingClientRect().toJSON(),query:this.pluginState.query},this.emitUpdate(this.pluginState.triggerCharacter))}destroy(){var e;(e=this.rootEl)==null||e.removeEventListener("scroll",this.handleScroll,!0)}}const ti=new me("SuggestionMenuPlugin"),Bp=pe(({editor:t})=>{const e=[];let n;const r=Mi(void 0);return{key:"suggestionMenu",store:r,addTriggerCharacter:i=>{e.push(i)},removeTriggerCharacter:i=>{e.splice(e.indexOf(i),1)},closeMenu:()=>{n?.closeMenu()},clearQuery:()=>{n?.clearQuery()},shown:()=>{var i;return((i=n?.state)==null?void 0:i.show)||!1},openSuggestionMenu:(i,s)=>{t.headless||(t.focus(),t.transact(o=>{s!=null&&s.deleteTriggerCharacter&&o.insertText(i),o.scrollIntoView().setMeta(ti,{triggerCharacter:i,deleteTriggerCharacter:s?.deleteTriggerCharacter||!1,ignoreQueryLength:s?.ignoreQueryLength||!1})}))},prosemirrorPlugins:[new re({key:ti,view:i=>(n=new gR(t,(s,o)=>{r.setState({...o,triggerCharacter:s})},i),n),state:{init(){},apply:(i,s,o,a)=>{if(i.selection.$from.parent.type.spec.code)return s;const l=i.getMeta(ti);if(typeof l=="object"&&l!==null){s&&n?.closeMenu();const u=pR(t,a.selection.from-l.triggerCharacter.length);return{triggerCharacter:l.triggerCharacter,deleteTriggerCharacter:l.deleteTriggerCharacter!==!1,queryStartPos:()=>u()+l.triggerCharacter.length,query:"",decorationId:`id_${Math.floor(Math.random()*4294967295)}`,ignoreQueryLength:l?.ignoreQueryLength}}if(s===void 0)return s;if(a.selection.from!==a.selection.to||l===null||i.getMeta("focus")||i.getMeta("blur")||i.getMeta("pointer")||s.triggerCharacter!==void 0&&a.selection.from<s.queryStartPos()||!a.selection.$from.sameParent(a.doc.resolve(s.queryStartPos())))return;const c={...s};return c.query=a.doc.textBetween(s.queryStartPos(),a.selection.from),c}},props:{handleTextInput(i,s,o,a){if(s===o){const l=i.state.doc;for(const c of e){const u=c.length>1?l.textBetween(s-c.length,s)+a:a;if(c===u)return i.dispatch(i.state.tr.insertText(a)),i.dispatch(i.state.tr.setMeta(ti,{triggerCharacter:u}).scrollIntoView()),!0}}return!1},decorations(i){const s=this.getState(i);if(s===void 0)return null;if(!s.deleteTriggerCharacter){const o=mR(i.selection);if(o)return ue.create(i.doc,[Ee.node(o.pos,o.pos+o.node.nodeSize,{nodeName:"span",class:"bn-suggestion-decorator","data-decoration-id":s.decorationId})])}return ue.create(i.doc,[Ee.inline(s.queryStartPos()-s.triggerCharacter.length,s.queryStartPos(),{nodeName:"span",class:"bn-suggestion-decorator","data-decoration-id":s.decorationId})])}}})]}});function bR(t){let e=t.getTextCursorPosition().block,n=t.schema.blockSchema[e.type].content;for(;n==="none";){if(e=t.getTextCursorPosition().nextBlock,e===void 0)return;n=t.schema.blockSchema[e.type].content,t.setTextCursorPosition(e,"end")}}function lt(t,e){const n=t.getTextCursorPosition().block;if(n.content===void 0)throw new Error("Slash Menu open in a block that doesn't contain content.");let r;return Array.isArray(n.content)&&(n.content.length===1&&yi(n.content[0])&&n.content[0].type==="text"&&n.content[0].text==="/"||n.content.length===0)?(r=t.updateBlock(n,e),t.setTextCursorPosition(r)):(r=t.insertBlocks([e],n,"after")[0],t.setTextCursorPosition(t.getTextCursorPosition().nextBlock)),bR(t),r}function $j(t){const e=[];return We(t,"heading",{level:"number"})&&(t.schema.blockSchema.heading.propSchema.level.values||[]).filter(n=>n<=3).forEach(n=>{e.push({onItemClick:()=>{lt(t,{type:"heading",props:{level:n}})},badge:dr(`Mod-Alt-${n}`),key:n===1?"heading":`heading_${n}`,...t.dictionary.slash_menu[n===1?"heading":`heading_${n}`]})}),We(t,"quote")&&e.push({onItemClick:()=>{lt(t,{type:"quote"})},key:"quote",...t.dictionary.slash_menu.quote}),We(t,"toggleListItem")&&e.push({onItemClick:()=>{lt(t,{type:"toggleListItem"})},badge:dr("Mod-Shift-6"),key:"toggle_list",...t.dictionary.slash_menu.toggle_list}),We(t,"numberedListItem")&&e.push({onItemClick:()=>{lt(t,{type:"numberedListItem"})},badge:dr("Mod-Shift-7"),key:"numbered_list",...t.dictionary.slash_menu.numbered_list}),We(t,"bulletListItem")&&e.push({onItemClick:()=>{lt(t,{type:"bulletListItem"})},badge:dr("Mod-Shift-8"),key:"bullet_list",...t.dictionary.slash_menu.bullet_list}),We(t,"checkListItem")&&e.push({onItemClick:()=>{lt(t,{type:"checkListItem"})},badge:dr("Mod-Shift-9"),key:"check_list",...t.dictionary.slash_menu.check_list}),We(t,"paragraph")&&e.push({onItemClick:()=>{lt(t,{type:"paragraph"})},badge:dr("Mod-Alt-0"),key:"paragraph",...t.dictionary.slash_menu.paragraph}),We(t,"codeBlock")&&e.push({onItemClick:()=>{lt(t,{type:"codeBlock"})},badge:dr("Mod-Alt-c"),key:"code_block",...t.dictionary.slash_menu.code_block}),We(t,"divider")&&e.push({onItemClick:()=>{lt(t,{type:"divider"})},key:"divider",...t.dictionary.slash_menu.divider}),We(t,"table")&&e.push({onItemClick:()=>{lt(t,{type:"table",content:{type:"tableContent",rows:[{cells:["","",""]},{cells:["","",""]}]}})},badge:void 0,key:"table",...t.dictionary.slash_menu.table}),We(t,"image",{url:"string"})&&e.push({onItemClick:()=>{var n;const r=lt(t,{type:"image"});(n=t.getExtension(Nr))==null||n.showMenu(r.id)},key:"image",...t.dictionary.slash_menu.image}),We(t,"video",{url:"string"})&&e.push({onItemClick:()=>{var n;const r=lt(t,{type:"video"});(n=t.getExtension(Nr))==null||n.showMenu(r.id)},key:"video",...t.dictionary.slash_menu.video}),We(t,"audio",{url:"string"})&&e.push({onItemClick:()=>{var n;const r=lt(t,{type:"audio"});(n=t.getExtension(Nr))==null||n.showMenu(r.id)},key:"audio",...t.dictionary.slash_menu.audio}),We(t,"file",{url:"string"})&&e.push({onItemClick:()=>{var n;const r=lt(t,{type:"file"});(n=t.getExtension(Nr))==null||n.showMenu(r.id)},key:"file",...t.dictionary.slash_menu.file}),We(t,"heading",{level:"number",isToggleable:"boolean"})&&(t.schema.blockSchema.heading.propSchema.level.values||[]).filter(n=>n<=3).forEach(n=>{e.push({onItemClick:()=>{lt(t,{type:"heading",props:{level:n,isToggleable:!0}})},key:n===1?"toggle_heading":`toggle_heading_${n}`,...t.dictionary.slash_menu[n===1?"toggle_heading":`toggle_heading_${n}`]})}),We(t,"heading",{level:"number"})&&(t.schema.blockSchema.heading.propSchema.level.values||[]).filter(n=>n>3).forEach(n=>{e.push({onItemClick:()=>{lt(t,{type:"heading",props:{level:n}})},badge:dr(`Mod-Alt-${n}`),key:`heading_${n}`,...t.dictionary.slash_menu[`heading_${n}`]})}),e.push({onItemClick:()=>{var n;(n=t.getExtension(Bp))==null||n.openSuggestionMenu(":",{deleteTriggerCharacter:!0,ignoreQueryLength:!0})},key:"emoji",...t.dictionary.slash_menu.emoji}),e}function zj(t,e){return t.filter(({title:n,aliases:r})=>n.toLowerCase().includes(e.toLowerCase())||r&&r.filter(i=>i.toLowerCase().includes(e.toLowerCase())).length!==0)}const yR={audio:TL(),bulletListItem:zL(),checkListItem:jL(),codeBlock:wL(),divider:AL(),file:IL(),heading:DL(),image:HL(),numberedListItem:YL(),paragraph:JL(),quote:ZL(),table:lR(),toggleListItem:GL(),video:hR()},ER=DT({type:"textColor",propSchema:"string"},{render:()=>{const t=document.createElement("span");return{dom:t,contentDOM:t}},toExternalHTML:t=>{const e=document.createElement("span");return t!==ye.textColor.default&&(e.style.color=t in _r?_r[t].text:t),{dom:e,contentDOM:e}},parse:t=>{if(t.tagName==="SPAN"&&t.style.color)return t.style.color}}),kR=DT({type:"backgroundColor",propSchema:"string"},{render:()=>{const t=document.createElement("span");return{dom:t,contentDOM:t}},toExternalHTML:t=>{const e=document.createElement("span");return t!==ye.backgroundColor.default&&(e.style.backgroundColor=t in _r?_r[t].background:t),{dom:e,contentDOM:e}},parse:t=>{if(t.tagName==="SPAN"&&t.style.backgroundColor)return t.style.backgroundColor}}),$T={bold:qs(xD,"boolean"),italic:qs(RD,"boolean"),underline:qs($D,"boolean"),strike:qs(HD,"boolean"),code:qs(ID,"boolean"),textColor:ER,backgroundColor:kR};vT($T);const zT={text:{config:"text",implementation:{}},link:{config:"link",implementation:{}}},Vj=OT(zT);var cd,P0;function TR(){return P0||(P0=1,cd=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,i,s;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!t(e[i],n[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(s=Object.keys(e),r=s.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[i]))return!1;for(i=r;i--!==0;){var o=s[i];if(!t(e[o],n[o]))return!1}return!0}return e!==e&&n!==n}),cd}var CR=TR();const SR=v1(CR);function wR(t={}){return new re({view(e){return new xR(e,t)}})}class xR{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,a=s.height/i.offsetHeight;if(n){let d=e.nodeBefore,h=e.nodeAfter;if(d||h){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let p=f.getBoundingClientRect(),g=d?p.bottom:p.top;d&&h&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let b=this.width/2*a;r={left:p.left,right:p.right,top:g-b,bottom:g+b}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;r={left:d.left-h,right:d.left+h,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.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",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),h=d.width/l.offsetWidth,f=d.height/l.offsetHeight;c=d.left-l.scrollLeft*h,u=d.top-l.scrollTop*f}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!s){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=oy(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}var Zl=200,Je=function(){};Je.prototype.append=function(e){return e.length?(e=Je.from(e),!this.length&&e||e.length<Zl&&this.leafAppend(e)||this.length<Zl&&e.leafPrepend(this)||this.appendInner(e)):this};Je.prototype.prepend=function(e){return e.length?Je.from(e).append(this):this};Je.prototype.appendInner=function(e){return new AR(this,e)};Je.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Je.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Je.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Je.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Je.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},n,r),i};Je.from=function(e){return e instanceof Je?e:e&&e.length?new VT(e):Je.empty};var VT=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l<o;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var l=s-1;l>=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Zl)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Zl)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Je);Je.empty=new VT([]);var AR=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Je);const _R=500;class hn{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,a,l,c=[],u=[];return this.items.forEach((d,h)=>{if(!d.step){i||(i=this.remapping(r,h+1),s=i.maps.length),s--,u.push(d);return}if(i){u.push(new _n(d.map));let f=d.step.map(i.slice(s)),p;f&&o.maybeStep(f).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new _n(p,void 0,void 0,c.length+u.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(s)):d.selection,l=new hn(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,n,r,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),h=new _n(e.mapping.maps[u],d,n),f;(f=l&&l.merge(h))&&(h=f,u?s.pop():a=a.slice(0,a.length-1)),s.push(h),n&&(o++,n=void 0),i||(l=h)}let c=o-r.depth;return c>IR&&(a=NR(a,c),o-=c),new hn(a.append(s),o)}remapping(e,n){let r=new ds;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new hn(this.items.append(e.map(n=>new _n(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let l=n;this.items.forEach(h=>{let f=s.getMirror(--l);if(f==null)return;o=Math.min(o,f);let p=s.maps[f];if(h.step){let g=e.steps[f].invert(e.docs[f]),b=h.selection&&h.selection.map(s.slice(l+1,f));b&&a++,r.push(new _n(p,g,b))}else r.push(new _n(p))},i);let c=[];for(let h=n;h<o;h++)c.push(new _n(s.maps[h]));let u=this.items.slice(0,i).append(c).append(r),d=new hn(u,a);return d.emptyItemCount()>_R&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=o.selection&&o.selection.map(n.slice(r));u&&s++;let d=new _n(c.invert(),l,u),h,f=i.length-1;(h=i.length&&i[f].merge(d))?i[f]=h:i.push(d)}}else o.map&&r--},this.items.length,0),new hn(Je.from(i.reverse()),s)}}hn.empty=new hn(Je.empty,0);function NR(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class _n{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new _n(n.getMap().invert(),n,this.selection)}}}class yr{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const IR=20;function OR(t,e,n,r){let i=n.getMeta(ui),s;if(i)return i.historyState;n.getMeta(jT)&&(t=new yr(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(ui))return o.getMeta(ui).redo?new yr(t.done.addTransform(n,void 0,r,ml(e)),t.undone,B0(n.mapping.maps),t.prevTime,t.prevComposition):new yr(t.done,t.undone.addTransform(n,void 0,r,ml(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!o&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!MR(n,t.prevRanges)),c=o?ud(t.prevRanges,n.mapping):B0(n.mapping.maps);return new yr(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,ml(e)),hn.empty,c,n.time,a??t.prevComposition)}else return(s=n.getMeta("rebased"))?new yr(t.done.rebased(n,s),t.undone.rebased(n,s),ud(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new yr(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),ud(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function MR(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function B0(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,o)=>e.push(s,o));return e}function ud(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function vR(t,e,n){let r=ml(e),i=ui.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),l=new yr(n?a:s.remaining,n?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(ui,{redo:n,historyState:l})}let dd=!1,F0=null;function ml(t){let e=t.plugins;if(F0!=e){dd=!1,F0=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){dd=!0;break}}return dd}function DR(t){return t.setMeta(jT,!0)}const ui=new me("history"),jT=new me("closeHistory");function LR(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new re({key:ui,state:{init(){return new yr(hn.empty,hn.empty,null,0,-1)},apply(e,n,r){return OR(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?WT:r=="historyRedo"?YT:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function qT(t,e){return(n,r)=>{let i=ui.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=vR(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const WT=qT(!1,!0),YT=qT(!0,!0);class ga{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}ga.prototype.normal={};ga.prototype.property={};ga.prototype.space=void 0;function KT(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new ga(n,r,e)}function ea(t){return t.toLowerCase()}class Dt{constructor(e,n){this.attribute=n,this.property=e}}Dt.prototype.attribute="";Dt.prototype.booleanish=!1;Dt.prototype.boolean=!1;Dt.prototype.commaOrSpaceSeparated=!1;Dt.prototype.commaSeparated=!1;Dt.prototype.defined=!1;Dt.prototype.mustUseProperty=!1;Dt.prototype.number=!1;Dt.prototype.overloadedBoolean=!1;Dt.prototype.property="";Dt.prototype.spaceSeparated=!1;Dt.prototype.space=void 0;let RR=0;const te=Di(),$e=Di(),Ph=Di(),H=Di(),xe=Di(),cs=Di(),Rt=Di();function Di(){return 2**++RR}const Bh=Object.freeze(Object.defineProperty({__proto__:null,boolean:te,booleanish:$e,commaOrSpaceSeparated:Rt,commaSeparated:cs,number:H,overloadedBoolean:Ph,spaceSeparated:xe},Symbol.toStringTag,{value:"Module"})),hd=Object.keys(Bh);class Fp extends Dt{constructor(e,n,r,i){let s=-1;if(super(e,n),H0(this,"space",i),typeof r=="number")for(;++s<hd.length;){const o=hd[s];H0(this,hd[s],(r&Bh[o])===Bh[o])}}}Fp.prototype.defined=!0;function H0(t,e,n){n&&(t[e]=n)}function Bs(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const s=new Fp(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[ea(r)]=r,n[ea(s.attribute)]=r}return new ga(e,n,t.space)}const GT=Bs({properties:{ariaActiveDescendant:null,ariaAtomic:$e,ariaAutoComplete:null,ariaBusy:$e,ariaChecked:$e,ariaColCount:H,ariaColIndex:H,ariaColSpan:H,ariaControls:xe,ariaCurrent:null,ariaDescribedBy:xe,ariaDetails:null,ariaDisabled:$e,ariaDropEffect:xe,ariaErrorMessage:null,ariaExpanded:$e,ariaFlowTo:xe,ariaGrabbed:$e,ariaHasPopup:null,ariaHidden:$e,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:xe,ariaLevel:H,ariaLive:null,ariaModal:$e,ariaMultiLine:$e,ariaMultiSelectable:$e,ariaOrientation:null,ariaOwns:xe,ariaPlaceholder:null,ariaPosInSet:H,ariaPressed:$e,ariaReadOnly:$e,ariaRelevant:null,ariaRequired:$e,ariaRoleDescription:xe,ariaRowCount:H,ariaRowIndex:H,ariaRowSpan:H,ariaSelected:$e,ariaSetSize:H,ariaSort:null,ariaValueMax:H,ariaValueMin:H,ariaValueNow:H,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function QT(t,e){return e in t?t[e]:e}function JT(t,e){return QT(t,e.toLowerCase())}const PR=Bs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:cs,acceptCharset:xe,accessKey:xe,action:null,allow:null,allowFullScreen:te,allowPaymentRequest:te,allowUserMedia:te,alt:null,as:null,async:te,autoCapitalize:null,autoComplete:xe,autoFocus:te,autoPlay:te,blocking:xe,capture:null,charSet:null,checked:te,cite:null,className:xe,cols:H,colSpan:null,content:null,contentEditable:$e,controls:te,controlsList:xe,coords:H|cs,crossOrigin:null,data:null,dateTime:null,decoding:null,default:te,defer:te,dir:null,dirName:null,disabled:te,download:Ph,draggable:$e,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:te,formTarget:null,headers:xe,height:H,hidden:Ph,high:H,href:null,hrefLang:null,htmlFor:xe,httpEquiv:xe,id:null,imageSizes:null,imageSrcSet:null,inert:te,inputMode:null,integrity:null,is:null,isMap:te,itemId:null,itemProp:xe,itemRef:xe,itemScope:te,itemType:xe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:te,low:H,manifest:null,max:null,maxLength:H,media:null,method:null,min:null,minLength:H,multiple:te,muted:te,name:null,nonce:null,noModule:te,noValidate:te,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:te,optimum:H,pattern:null,ping:xe,placeholder:null,playsInline:te,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:te,referrerPolicy:null,rel:xe,required:te,reversed:te,rows:H,rowSpan:H,sandbox:xe,scope:null,scoped:te,seamless:te,selected:te,shadowRootClonable:te,shadowRootDelegatesFocus:te,shadowRootMode:null,shape:null,size:H,sizes:null,slot:null,span:H,spellCheck:$e,src:null,srcDoc:null,srcLang:null,srcSet:null,start:H,step:null,style:null,tabIndex:H,target:null,title:null,translate:null,type:null,typeMustMatch:te,useMap:null,value:$e,width:H,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:xe,axis:null,background:null,bgColor:null,border:H,borderColor:null,bottomMargin:H,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:te,declare:te,event:null,face:null,frame:null,frameBorder:null,hSpace:H,leftMargin:H,link:null,longDesc:null,lowSrc:null,marginHeight:H,marginWidth:H,noResize:te,noHref:te,noShade:te,noWrap:te,object:null,profile:null,prompt:null,rev:null,rightMargin:H,rules:null,scheme:null,scrolling:$e,standby:null,summary:null,text:null,topMargin:H,valueType:null,version:null,vAlign:null,vLink:null,vSpace:H,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:te,disableRemotePlayback:te,prefix:null,property:null,results:H,security:null,unselectable:null},space:"html",transform:JT}),BR=Bs({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Rt,accentHeight:H,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:H,amplitude:H,arabicForm:null,ascent:H,attributeName:null,attributeType:null,azimuth:H,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:H,by:null,calcMode:null,capHeight:H,className:xe,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:H,diffuseConstant:H,direction:null,display:null,dur:null,divisor:H,dominantBaseline:null,download:te,dx:null,dy:null,edgeMode:null,editable:null,elevation:H,enableBackground:null,end:null,event:null,exponent:H,externalResourcesRequired:null,fill:null,fillOpacity:H,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:cs,g2:cs,glyphName:cs,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:H,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:H,horizOriginX:H,horizOriginY:H,id:null,ideographic:H,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:H,k:H,k1:H,k2:H,k3:H,k4:H,kernelMatrix:Rt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:H,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:H,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:H,overlineThickness:H,paintOrder:null,panose1:null,path:null,pathLength:H,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:xe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:H,pointsAtY:H,pointsAtZ:H,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Rt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Rt,rev:Rt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Rt,requiredFeatures:Rt,requiredFonts:Rt,requiredFormats:Rt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:H,specularExponent:H,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:H,strikethroughThickness:H,string:null,stroke:null,strokeDashArray:Rt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:H,strokeOpacity:H,strokeWidth:null,style:null,surfaceScale:H,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Rt,tabIndex:H,tableValues:null,target:null,targetX:H,targetY:H,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Rt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:H,underlineThickness:H,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:H,values:null,vAlphabetic:H,vMathematical:H,vectorEffect:null,vHanging:H,vIdeographic:H,version:null,vertAdvY:H,vertOriginX:H,vertOriginY:H,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:H,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:QT}),XT=Bs({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),ZT=Bs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:JT}),eC=Bs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),FR=/[A-Z]/g,U0=/-[a-z]/g,HR=/^data[-\w.:]+$/i;function Hp(t,e){const n=ea(e);let r=e,i=Dt;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&HR.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(U0,$R);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!U0.test(s)){let o=s.replace(FR,UR);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=Fp}return new i(r,e)}function UR(t){return"-"+t.toLowerCase()}function $R(t){return t.charAt(1).toUpperCase()}const gu=KT([GT,PR,XT,ZT,eC],"html"),ba=KT([GT,BR,XT,ZT,eC],"svg");function $0(t){const e=[],n=String(t||"");let r=n.indexOf(","),i=0,s=!1;for(;!s;){r===-1&&(r=n.length,s=!0);const o=n.slice(i,r).trim();(o||!s)&&e.push(o),i=r+1,r=n.indexOf(",",i)}return e}function zR(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const z0=/[#.]/g;function VR(t,e){const n=t||"",r={};let i=0,s,o;for(;i<n.length;){z0.lastIndex=i;const a=z0.exec(n),l=n.slice(i,a?a.index:n.length);l&&(s?s==="#"?r.id=l:Array.isArray(r.className)?r.className.push(l):r.className=[l]:o=l,i+=l.length),a&&(s=a[0],i++)}return{type:"element",tagName:o||e||"div",properties:r,children:[]}}function V0(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function jR(t){return t.join(" ").trim()}function tC(t,e,n){const r=n?KR(n):void 0;function i(s,o,...a){let l;if(s==null){l={type:"root",children:[]};const c=o;a.unshift(c)}else{l=VR(s,e);const c=l.tagName.toLowerCase(),u=r?r.get(c):void 0;if(l.tagName=u||c,qR(o))a.unshift(o);else for(const[d,h]of Object.entries(o))WR(t,l.properties,d,h)}for(const c of a)Fh(l.children,c);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return i}function qR(t){if(t===null||typeof t!="object"||Array.isArray(t))return!0;if(typeof t.type!="string")return!1;const e=t,n=Object.keys(t);for(const r of n){const i=e[r];if(i&&typeof i=="object"){if(!Array.isArray(i))return!0;const s=i;for(const o of s)if(typeof o!="number"&&typeof o!="string")return!0}}return!!("children"in t&&Array.isArray(t.children))}function WR(t,e,n,r){const i=Hp(t,n);let s;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;s=r}else typeof r=="boolean"?s=r:typeof r=="string"?i.spaceSeparated?s=V0(r):i.commaSeparated?s=$0(r):i.commaOrSpaceSeparated?s=V0($0(r).join(" ")):s=j0(i,i.property,r):Array.isArray(r)?s=[...r]:s=i.property==="style"?YR(r):String(r);if(Array.isArray(s)){const o=[];for(const a of s)o.push(j0(i,i.property,a));s=o}i.property==="className"&&Array.isArray(e.className)&&(s=e.className.concat(s)),e[i.property]=s}}function Fh(t,e){if(e!=null)if(typeof e=="number"||typeof e=="string")t.push({type:"text",value:String(e)});else if(Array.isArray(e))for(const n of e)Fh(t,n);else if(typeof e=="object"&&"type"in e)e.type==="root"?Fh(t,e.children):t.push(e);else throw new Error("Expected node, nodes, or string, got `"+e+"`")}function j0(t,e,n){if(typeof n=="string"){if(t.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((t.boolean||t.overloadedBoolean)&&(n===""||ea(n)===ea(e)))return!0}return n}function YR(t){const e=[];for(const[n,r]of Object.entries(t))e.push([n,r].join(": "));return e.join("; ")}function KR(t){const e=new Map;for(const n of t)e.set(n.toLowerCase(),n);return e}const GR=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],nC=tC(gu,"div"),rC=tC(ba,"g",GR);function QR(t){const e=String(t),n=[];return{toOffset:i,toPoint:r};function r(s){if(typeof s=="number"&&s>-1&&s<=e.length){let o=0;for(;;){let a=n[o];if(a===void 0){const l=q0(e,n[o-1]);a=l===-1?e.length+1:l+1,n[o]=a}if(a>s)return{line:o+1,column:s-(o>0?n[o-1]:0)+1,offset:s};o++}}}function i(s){if(s&&typeof s.line=="number"&&typeof s.column=="number"&&!Number.isNaN(s.line)&&!Number.isNaN(s.column)){for(;n.length<s.line;){const a=n[n.length-1],l=q0(e,a),c=l===-1?e.length+1:l+1;if(a===c)break;n.push(c)}const o=(s.line>1?n[s.line-2]:0)+s.column-1;if(o<n[s.line-1])return o}}}function q0(t,e){const n=t.indexOf("\r",e),r=t.indexOf(`
|
|
116
|
-
`,e);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}const gl={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"},iC={}.hasOwnProperty,JR=Object.prototype;function XR(t,e){const n=e||{};return Up({file:n.file||void 0,location:!1,schema:n.space==="svg"?ba:gu,verbose:n.verbose||!1},t)}function Up(t,e){let n;switch(e.nodeName){case"#comment":{const r=e;return n={type:"comment",value:r.data},bl(t,r,n),n}case"#document":case"#document-fragment":{const r=e,i="mode"in r?r.mode==="quirks"||r.mode==="limited-quirks":!1;if(n={type:"root",children:sC(t,e.childNodes),data:{quirksMode:i}},t.file&&t.location){const s=String(t.file),o=QR(s),a=o.toPoint(0),l=o.toPoint(s.length);n.position={start:a,end:l}}return n}case"#documentType":{const r=e;return n={type:"doctype"},bl(t,r,n),n}case"#text":{const r=e;return n={type:"text",value:r.value},bl(t,r,n),n}default:return n=ZR(t,e),n}}function sC(t,e){let n=-1;const r=[];for(;++n<e.length;){const i=Up(t,e[n]);r.push(i)}return r}function ZR(t,e){const n=t.schema;t.schema=e.namespaceURI===gl.svg?ba:gu;let r=-1;const i={};for(;++r<e.attrs.length;){const a=e.attrs[r],l=(a.prefix?a.prefix+":":"")+a.name;iC.call(JR,l)||(i[l]=a.value)}const o=(t.schema.space==="svg"?rC:nC)(e.tagName,i,sC(t,e.childNodes));if(bl(t,e,o),o.tagName==="template"){const a=e,l=a.sourceCodeLocation,c=l&&l.startTag&&Ji(l.startTag),u=l&&l.endTag&&Ji(l.endTag),d=Up(t,a.content);c&&u&&t.file&&(d.position={start:c.end,end:u.start}),o.content=d}return t.schema=n,o}function bl(t,e,n){if("sourceCodeLocation"in e&&e.sourceCodeLocation&&t.file){const r=e6(t,n,e.sourceCodeLocation);r&&(t.location=!0,n.position=r)}}function e6(t,e,n){const r=Ji(n);if(e.type==="element"){const i=e.children[e.children.length-1];if(r&&!n.endTag&&i&&i.position&&i.position.end&&(r.end=Object.assign({},i.position.end)),t.verbose){const s={};let o;if(n.attrs)for(o in n.attrs)iC.call(n.attrs,o)&&(s[Hp(t.schema,o).property]=Ji(n.attrs[o]));n.startTag;const a=Ji(n.startTag),l=n.endTag?Ji(n.endTag):void 0,c={opening:a};l&&(c.closing=l),c.properties=s,e.data={position:c}}}return r}function Ji(t){const e=W0({line:t.startLine,column:t.startCol,offset:t.startOffset}),n=W0({line:t.endLine,column:t.endCol,offset:t.endOffset});return e||n?{start:e,end:n}:void 0}function W0(t){return t.line&&t.column?t:void 0}const t6=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),Oe="�";var E;(function(t){t[t.EOF=-1]="EOF",t[t.NULL=0]="NULL",t[t.TABULATION=9]="TABULATION",t[t.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",t[t.LINE_FEED=10]="LINE_FEED",t[t.FORM_FEED=12]="FORM_FEED",t[t.SPACE=32]="SPACE",t[t.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",t[t.QUOTATION_MARK=34]="QUOTATION_MARK",t[t.AMPERSAND=38]="AMPERSAND",t[t.APOSTROPHE=39]="APOSTROPHE",t[t.HYPHEN_MINUS=45]="HYPHEN_MINUS",t[t.SOLIDUS=47]="SOLIDUS",t[t.DIGIT_0=48]="DIGIT_0",t[t.DIGIT_9=57]="DIGIT_9",t[t.SEMICOLON=59]="SEMICOLON",t[t.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",t[t.EQUALS_SIGN=61]="EQUALS_SIGN",t[t.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",t[t.QUESTION_MARK=63]="QUESTION_MARK",t[t.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",t[t.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",t[t.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",t[t.GRAVE_ACCENT=96]="GRAVE_ACCENT",t[t.LATIN_SMALL_A=97]="LATIN_SMALL_A",t[t.LATIN_SMALL_Z=122]="LATIN_SMALL_Z"})(E||(E={}));const St={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"};function oC(t){return t>=55296&&t<=57343}function n6(t){return t>=56320&&t<=57343}function r6(t,e){return(t-55296)*1024+9216+e}function aC(t){return t!==32&&t!==10&&t!==13&&t!==9&&t!==12&&t>=1&&t<=31||t>=127&&t<=159}function lC(t){return t>=64976&&t<=65007||t6.has(t)}var O;(function(t){t.controlCharacterInInputStream="control-character-in-input-stream",t.noncharacterInInputStream="noncharacter-in-input-stream",t.surrogateInInputStream="surrogate-in-input-stream",t.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",t.endTagWithAttributes="end-tag-with-attributes",t.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",t.unexpectedSolidusInTag="unexpected-solidus-in-tag",t.unexpectedNullCharacter="unexpected-null-character",t.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",t.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",t.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",t.missingEndTagName="missing-end-tag-name",t.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",t.unknownNamedCharacterReference="unknown-named-character-reference",t.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",t.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",t.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",t.eofBeforeTagName="eof-before-tag-name",t.eofInTag="eof-in-tag",t.missingAttributeValue="missing-attribute-value",t.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",t.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",t.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",t.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",t.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",t.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",t.missingDoctypePublicIdentifier="missing-doctype-public-identifier",t.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",t.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",t.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",t.cdataInHtmlContent="cdata-in-html-content",t.incorrectlyOpenedComment="incorrectly-opened-comment",t.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",t.eofInDoctype="eof-in-doctype",t.nestedComment="nested-comment",t.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",t.eofInComment="eof-in-comment",t.incorrectlyClosedComment="incorrectly-closed-comment",t.eofInCdata="eof-in-cdata",t.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",t.nullCharacterReference="null-character-reference",t.surrogateCharacterReference="surrogate-character-reference",t.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",t.controlCharacterReference="control-character-reference",t.noncharacterCharacterReference="noncharacter-character-reference",t.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",t.missingDoctypeName="missing-doctype-name",t.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",t.duplicateAttribute="duplicate-attribute",t.nonConformingDoctype="non-conforming-doctype",t.missingDoctype="missing-doctype",t.misplacedDoctype="misplaced-doctype",t.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",t.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",t.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",t.openElementsLeftAfterEof="open-elements-left-after-eof",t.abandonedHeadElementChild="abandoned-head-element-child",t.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",t.nestedNoscriptInHead="nested-noscript-in-head",t.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(O||(O={}));const i6=65536;class s6{constructor(e){this.handler=e,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=i6,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(e,n){const{line:r,col:i,offset:s}=this,o=i+n,a=s+n;return{code:e,startLine:r,endLine:r,startCol:o,endCol:o,startOffset:a,endOffset:a}}_err(e){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(e,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.html.length-1){const n=this.html.charCodeAt(this.pos+1);if(n6(n))return this.pos++,this._addGap(),r6(e,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,E.EOF;return this._err(O.surrogateInInputStream),e}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(e,n){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,n){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(e,this.pos);for(let r=0;r<e.length;r++)if((this.html.charCodeAt(this.pos+r)|32)!==e.charCodeAt(r))return!1;return!0}peek(e){const n=this.pos+e;if(n>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,E.EOF;const r=this.html.charCodeAt(n);return r===E.CARRIAGE_RETURN?E.LINE_FEED:r}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,E.EOF;let e=this.html.charCodeAt(this.pos);return e===E.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,E.LINE_FEED):e===E.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,oC(e)&&(e=this._processSurrogate(e)),this.handler.onParseError===null||e>31&&e<127||e===E.LINE_FEED||e===E.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){aC(e)?this._err(O.controlCharacterInInputStream):lC(e)&&this._err(O.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}var fe;(function(t){t[t.CHARACTER=0]="CHARACTER",t[t.NULL_CHARACTER=1]="NULL_CHARACTER",t[t.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",t[t.START_TAG=3]="START_TAG",t[t.END_TAG=4]="END_TAG",t[t.COMMENT=5]="COMMENT",t[t.DOCTYPE=6]="DOCTYPE",t[t.EOF=7]="EOF",t[t.HIBERNATION=8]="HIBERNATION"})(fe||(fe={}));function cC(t,e){for(let n=t.attrs.length-1;n>=0;n--)if(t.attrs[n].name===e)return t.attrs[n].value;return null}const o6=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(t=>t.charCodeAt(0))),a6=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function l6(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=a6.get(t))!==null&&e!==void 0?e:t}var Ge;(function(t){t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.EQUALS=61]="EQUALS",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.LOWER_Z=122]="LOWER_Z",t[t.UPPER_A=65]="UPPER_A",t[t.UPPER_F=70]="UPPER_F",t[t.UPPER_Z=90]="UPPER_Z"})(Ge||(Ge={}));const c6=32;var Ir;(function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"})(Ir||(Ir={}));function Hh(t){return t>=Ge.ZERO&&t<=Ge.NINE}function u6(t){return t>=Ge.UPPER_A&&t<=Ge.UPPER_F||t>=Ge.LOWER_A&&t<=Ge.LOWER_F}function d6(t){return t>=Ge.UPPER_A&&t<=Ge.UPPER_Z||t>=Ge.LOWER_A&&t<=Ge.LOWER_Z||Hh(t)}function h6(t){return t===Ge.EQUALS||d6(t)}var Ye;(function(t){t[t.EntityStart=0]="EntityStart",t[t.NumericStart=1]="NumericStart",t[t.NumericDecimal=2]="NumericDecimal",t[t.NumericHex=3]="NumericHex",t[t.NamedEntity=4]="NamedEntity"})(Ye||(Ye={}));var er;(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict",t[t.Attribute=2]="Attribute"})(er||(er={}));class f6{constructor(e,n,r){this.decodeTree=e,this.emitCodePoint=n,this.errors=r,this.state=Ye.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=er.Strict}startEntity(e){this.decodeMode=e,this.state=Ye.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,n){switch(this.state){case Ye.EntityStart:return e.charCodeAt(n)===Ge.NUM?(this.state=Ye.NumericStart,this.consumed+=1,this.stateNumericStart(e,n+1)):(this.state=Ye.NamedEntity,this.stateNamedEntity(e,n));case Ye.NumericStart:return this.stateNumericStart(e,n);case Ye.NumericDecimal:return this.stateNumericDecimal(e,n);case Ye.NumericHex:return this.stateNumericHex(e,n);case Ye.NamedEntity:return this.stateNamedEntity(e,n)}}stateNumericStart(e,n){return n>=e.length?-1:(e.charCodeAt(n)|c6)===Ge.LOWER_X?(this.state=Ye.NumericHex,this.consumed+=1,this.stateNumericHex(e,n+1)):(this.state=Ye.NumericDecimal,this.stateNumericDecimal(e,n))}addToNumericResult(e,n,r,i){if(n!==r){const s=r-n;this.result=this.result*Math.pow(i,s)+Number.parseInt(e.substr(n,s),i),this.consumed+=s}}stateNumericHex(e,n){const r=n;for(;n<e.length;){const i=e.charCodeAt(n);if(Hh(i)||u6(i))n+=1;else return this.addToNumericResult(e,r,n,16),this.emitNumericEntity(i,3)}return this.addToNumericResult(e,r,n,16),-1}stateNumericDecimal(e,n){const r=n;for(;n<e.length;){const i=e.charCodeAt(n);if(Hh(i))n+=1;else return this.addToNumericResult(e,r,n,10),this.emitNumericEntity(i,2)}return this.addToNumericResult(e,r,n,10),-1}emitNumericEntity(e,n){var r;if(this.consumed<=n)return(r=this.errors)===null||r===void 0||r.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===Ge.SEMI)this.consumed+=1;else if(this.decodeMode===er.Strict)return 0;return this.emitCodePoint(l6(this.result),this.consumed),this.errors&&(e!==Ge.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,n){const{decodeTree:r}=this;let i=r[this.treeIndex],s=(i&Ir.VALUE_LENGTH)>>14;for(;n<e.length;n++,this.excess++){const o=e.charCodeAt(n);if(this.treeIndex=p6(r,i,this.treeIndex+Math.max(1,s),o),this.treeIndex<0)return this.result===0||this.decodeMode===er.Attribute&&(s===0||h6(o))?0:this.emitNotTerminatedNamedEntity();if(i=r[this.treeIndex],s=(i&Ir.VALUE_LENGTH)>>14,s!==0){if(o===Ge.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==er.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;const{result:n,decodeTree:r}=this,i=(r[n]&Ir.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,i,this.consumed),(e=this.errors)===null||e===void 0||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,n,r){const{decodeTree:i}=this;return this.emitCodePoint(n===1?i[e]&~Ir.VALUE_LENGTH:i[e+1],r),n===3&&this.emitCodePoint(i[e+2],r),r}end(){var e;switch(this.state){case Ye.NamedEntity:return this.result!==0&&(this.decodeMode!==er.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Ye.NumericDecimal:return this.emitNumericEntity(0,2);case Ye.NumericHex:return this.emitNumericEntity(0,3);case Ye.NumericStart:return(e=this.errors)===null||e===void 0||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Ye.EntityStart:return 0}}}function p6(t,e,n,r){const i=(e&Ir.BRANCH_LENGTH)>>7,s=e&Ir.JUMP_TABLE;if(i===0)return s!==0&&r===s?n:-1;if(s){const l=r-s;return l<0||l>=i?-1:t[n+l]-1}let o=n,a=o+i-1;for(;o<=a;){const l=o+a>>>1,c=t[l];if(c<r)o=l+1;else if(c>r)a=l-1;else return t[l+i]}return-1}var R;(function(t){t.HTML="http://www.w3.org/1999/xhtml",t.MATHML="http://www.w3.org/1998/Math/MathML",t.SVG="http://www.w3.org/2000/svg",t.XLINK="http://www.w3.org/1999/xlink",t.XML="http://www.w3.org/XML/1998/namespace",t.XMLNS="http://www.w3.org/2000/xmlns/"})(R||(R={}));var di;(function(t){t.TYPE="type",t.ACTION="action",t.ENCODING="encoding",t.PROMPT="prompt",t.NAME="name",t.COLOR="color",t.FACE="face",t.SIZE="size"})(di||(di={}));var Kt;(function(t){t.NO_QUIRKS="no-quirks",t.QUIRKS="quirks",t.LIMITED_QUIRKS="limited-quirks"})(Kt||(Kt={}));var N;(function(t){t.A="a",t.ADDRESS="address",t.ANNOTATION_XML="annotation-xml",t.APPLET="applet",t.AREA="area",t.ARTICLE="article",t.ASIDE="aside",t.B="b",t.BASE="base",t.BASEFONT="basefont",t.BGSOUND="bgsound",t.BIG="big",t.BLOCKQUOTE="blockquote",t.BODY="body",t.BR="br",t.BUTTON="button",t.CAPTION="caption",t.CENTER="center",t.CODE="code",t.COL="col",t.COLGROUP="colgroup",t.DD="dd",t.DESC="desc",t.DETAILS="details",t.DIALOG="dialog",t.DIR="dir",t.DIV="div",t.DL="dl",t.DT="dt",t.EM="em",t.EMBED="embed",t.FIELDSET="fieldset",t.FIGCAPTION="figcaption",t.FIGURE="figure",t.FONT="font",t.FOOTER="footer",t.FOREIGN_OBJECT="foreignObject",t.FORM="form",t.FRAME="frame",t.FRAMESET="frameset",t.H1="h1",t.H2="h2",t.H3="h3",t.H4="h4",t.H5="h5",t.H6="h6",t.HEAD="head",t.HEADER="header",t.HGROUP="hgroup",t.HR="hr",t.HTML="html",t.I="i",t.IMG="img",t.IMAGE="image",t.INPUT="input",t.IFRAME="iframe",t.KEYGEN="keygen",t.LABEL="label",t.LI="li",t.LINK="link",t.LISTING="listing",t.MAIN="main",t.MALIGNMARK="malignmark",t.MARQUEE="marquee",t.MATH="math",t.MENU="menu",t.META="meta",t.MGLYPH="mglyph",t.MI="mi",t.MO="mo",t.MN="mn",t.MS="ms",t.MTEXT="mtext",t.NAV="nav",t.NOBR="nobr",t.NOFRAMES="noframes",t.NOEMBED="noembed",t.NOSCRIPT="noscript",t.OBJECT="object",t.OL="ol",t.OPTGROUP="optgroup",t.OPTION="option",t.P="p",t.PARAM="param",t.PLAINTEXT="plaintext",t.PRE="pre",t.RB="rb",t.RP="rp",t.RT="rt",t.RTC="rtc",t.RUBY="ruby",t.S="s",t.SCRIPT="script",t.SEARCH="search",t.SECTION="section",t.SELECT="select",t.SOURCE="source",t.SMALL="small",t.SPAN="span",t.STRIKE="strike",t.STRONG="strong",t.STYLE="style",t.SUB="sub",t.SUMMARY="summary",t.SUP="sup",t.TABLE="table",t.TBODY="tbody",t.TEMPLATE="template",t.TEXTAREA="textarea",t.TFOOT="tfoot",t.TD="td",t.TH="th",t.THEAD="thead",t.TITLE="title",t.TR="tr",t.TRACK="track",t.TT="tt",t.U="u",t.UL="ul",t.SVG="svg",t.VAR="var",t.WBR="wbr",t.XMP="xmp"})(N||(N={}));var m;(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.A=1]="A",t[t.ADDRESS=2]="ADDRESS",t[t.ANNOTATION_XML=3]="ANNOTATION_XML",t[t.APPLET=4]="APPLET",t[t.AREA=5]="AREA",t[t.ARTICLE=6]="ARTICLE",t[t.ASIDE=7]="ASIDE",t[t.B=8]="B",t[t.BASE=9]="BASE",t[t.BASEFONT=10]="BASEFONT",t[t.BGSOUND=11]="BGSOUND",t[t.BIG=12]="BIG",t[t.BLOCKQUOTE=13]="BLOCKQUOTE",t[t.BODY=14]="BODY",t[t.BR=15]="BR",t[t.BUTTON=16]="BUTTON",t[t.CAPTION=17]="CAPTION",t[t.CENTER=18]="CENTER",t[t.CODE=19]="CODE",t[t.COL=20]="COL",t[t.COLGROUP=21]="COLGROUP",t[t.DD=22]="DD",t[t.DESC=23]="DESC",t[t.DETAILS=24]="DETAILS",t[t.DIALOG=25]="DIALOG",t[t.DIR=26]="DIR",t[t.DIV=27]="DIV",t[t.DL=28]="DL",t[t.DT=29]="DT",t[t.EM=30]="EM",t[t.EMBED=31]="EMBED",t[t.FIELDSET=32]="FIELDSET",t[t.FIGCAPTION=33]="FIGCAPTION",t[t.FIGURE=34]="FIGURE",t[t.FONT=35]="FONT",t[t.FOOTER=36]="FOOTER",t[t.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",t[t.FORM=38]="FORM",t[t.FRAME=39]="FRAME",t[t.FRAMESET=40]="FRAMESET",t[t.H1=41]="H1",t[t.H2=42]="H2",t[t.H3=43]="H3",t[t.H4=44]="H4",t[t.H5=45]="H5",t[t.H6=46]="H6",t[t.HEAD=47]="HEAD",t[t.HEADER=48]="HEADER",t[t.HGROUP=49]="HGROUP",t[t.HR=50]="HR",t[t.HTML=51]="HTML",t[t.I=52]="I",t[t.IMG=53]="IMG",t[t.IMAGE=54]="IMAGE",t[t.INPUT=55]="INPUT",t[t.IFRAME=56]="IFRAME",t[t.KEYGEN=57]="KEYGEN",t[t.LABEL=58]="LABEL",t[t.LI=59]="LI",t[t.LINK=60]="LINK",t[t.LISTING=61]="LISTING",t[t.MAIN=62]="MAIN",t[t.MALIGNMARK=63]="MALIGNMARK",t[t.MARQUEE=64]="MARQUEE",t[t.MATH=65]="MATH",t[t.MENU=66]="MENU",t[t.META=67]="META",t[t.MGLYPH=68]="MGLYPH",t[t.MI=69]="MI",t[t.MO=70]="MO",t[t.MN=71]="MN",t[t.MS=72]="MS",t[t.MTEXT=73]="MTEXT",t[t.NAV=74]="NAV",t[t.NOBR=75]="NOBR",t[t.NOFRAMES=76]="NOFRAMES",t[t.NOEMBED=77]="NOEMBED",t[t.NOSCRIPT=78]="NOSCRIPT",t[t.OBJECT=79]="OBJECT",t[t.OL=80]="OL",t[t.OPTGROUP=81]="OPTGROUP",t[t.OPTION=82]="OPTION",t[t.P=83]="P",t[t.PARAM=84]="PARAM",t[t.PLAINTEXT=85]="PLAINTEXT",t[t.PRE=86]="PRE",t[t.RB=87]="RB",t[t.RP=88]="RP",t[t.RT=89]="RT",t[t.RTC=90]="RTC",t[t.RUBY=91]="RUBY",t[t.S=92]="S",t[t.SCRIPT=93]="SCRIPT",t[t.SEARCH=94]="SEARCH",t[t.SECTION=95]="SECTION",t[t.SELECT=96]="SELECT",t[t.SOURCE=97]="SOURCE",t[t.SMALL=98]="SMALL",t[t.SPAN=99]="SPAN",t[t.STRIKE=100]="STRIKE",t[t.STRONG=101]="STRONG",t[t.STYLE=102]="STYLE",t[t.SUB=103]="SUB",t[t.SUMMARY=104]="SUMMARY",t[t.SUP=105]="SUP",t[t.TABLE=106]="TABLE",t[t.TBODY=107]="TBODY",t[t.TEMPLATE=108]="TEMPLATE",t[t.TEXTAREA=109]="TEXTAREA",t[t.TFOOT=110]="TFOOT",t[t.TD=111]="TD",t[t.TH=112]="TH",t[t.THEAD=113]="THEAD",t[t.TITLE=114]="TITLE",t[t.TR=115]="TR",t[t.TRACK=116]="TRACK",t[t.TT=117]="TT",t[t.U=118]="U",t[t.UL=119]="UL",t[t.SVG=120]="SVG",t[t.VAR=121]="VAR",t[t.WBR=122]="WBR",t[t.XMP=123]="XMP"})(m||(m={}));const m6=new Map([[N.A,m.A],[N.ADDRESS,m.ADDRESS],[N.ANNOTATION_XML,m.ANNOTATION_XML],[N.APPLET,m.APPLET],[N.AREA,m.AREA],[N.ARTICLE,m.ARTICLE],[N.ASIDE,m.ASIDE],[N.B,m.B],[N.BASE,m.BASE],[N.BASEFONT,m.BASEFONT],[N.BGSOUND,m.BGSOUND],[N.BIG,m.BIG],[N.BLOCKQUOTE,m.BLOCKQUOTE],[N.BODY,m.BODY],[N.BR,m.BR],[N.BUTTON,m.BUTTON],[N.CAPTION,m.CAPTION],[N.CENTER,m.CENTER],[N.CODE,m.CODE],[N.COL,m.COL],[N.COLGROUP,m.COLGROUP],[N.DD,m.DD],[N.DESC,m.DESC],[N.DETAILS,m.DETAILS],[N.DIALOG,m.DIALOG],[N.DIR,m.DIR],[N.DIV,m.DIV],[N.DL,m.DL],[N.DT,m.DT],[N.EM,m.EM],[N.EMBED,m.EMBED],[N.FIELDSET,m.FIELDSET],[N.FIGCAPTION,m.FIGCAPTION],[N.FIGURE,m.FIGURE],[N.FONT,m.FONT],[N.FOOTER,m.FOOTER],[N.FOREIGN_OBJECT,m.FOREIGN_OBJECT],[N.FORM,m.FORM],[N.FRAME,m.FRAME],[N.FRAMESET,m.FRAMESET],[N.H1,m.H1],[N.H2,m.H2],[N.H3,m.H3],[N.H4,m.H4],[N.H5,m.H5],[N.H6,m.H6],[N.HEAD,m.HEAD],[N.HEADER,m.HEADER],[N.HGROUP,m.HGROUP],[N.HR,m.HR],[N.HTML,m.HTML],[N.I,m.I],[N.IMG,m.IMG],[N.IMAGE,m.IMAGE],[N.INPUT,m.INPUT],[N.IFRAME,m.IFRAME],[N.KEYGEN,m.KEYGEN],[N.LABEL,m.LABEL],[N.LI,m.LI],[N.LINK,m.LINK],[N.LISTING,m.LISTING],[N.MAIN,m.MAIN],[N.MALIGNMARK,m.MALIGNMARK],[N.MARQUEE,m.MARQUEE],[N.MATH,m.MATH],[N.MENU,m.MENU],[N.META,m.META],[N.MGLYPH,m.MGLYPH],[N.MI,m.MI],[N.MO,m.MO],[N.MN,m.MN],[N.MS,m.MS],[N.MTEXT,m.MTEXT],[N.NAV,m.NAV],[N.NOBR,m.NOBR],[N.NOFRAMES,m.NOFRAMES],[N.NOEMBED,m.NOEMBED],[N.NOSCRIPT,m.NOSCRIPT],[N.OBJECT,m.OBJECT],[N.OL,m.OL],[N.OPTGROUP,m.OPTGROUP],[N.OPTION,m.OPTION],[N.P,m.P],[N.PARAM,m.PARAM],[N.PLAINTEXT,m.PLAINTEXT],[N.PRE,m.PRE],[N.RB,m.RB],[N.RP,m.RP],[N.RT,m.RT],[N.RTC,m.RTC],[N.RUBY,m.RUBY],[N.S,m.S],[N.SCRIPT,m.SCRIPT],[N.SEARCH,m.SEARCH],[N.SECTION,m.SECTION],[N.SELECT,m.SELECT],[N.SOURCE,m.SOURCE],[N.SMALL,m.SMALL],[N.SPAN,m.SPAN],[N.STRIKE,m.STRIKE],[N.STRONG,m.STRONG],[N.STYLE,m.STYLE],[N.SUB,m.SUB],[N.SUMMARY,m.SUMMARY],[N.SUP,m.SUP],[N.TABLE,m.TABLE],[N.TBODY,m.TBODY],[N.TEMPLATE,m.TEMPLATE],[N.TEXTAREA,m.TEXTAREA],[N.TFOOT,m.TFOOT],[N.TD,m.TD],[N.TH,m.TH],[N.THEAD,m.THEAD],[N.TITLE,m.TITLE],[N.TR,m.TR],[N.TRACK,m.TRACK],[N.TT,m.TT],[N.U,m.U],[N.UL,m.UL],[N.SVG,m.SVG],[N.VAR,m.VAR],[N.WBR,m.WBR],[N.XMP,m.XMP]]);function bu(t){var e;return(e=m6.get(t))!==null&&e!==void 0?e:m.UNKNOWN}const P=m,g6={[R.HTML]:new Set([P.ADDRESS,P.APPLET,P.AREA,P.ARTICLE,P.ASIDE,P.BASE,P.BASEFONT,P.BGSOUND,P.BLOCKQUOTE,P.BODY,P.BR,P.BUTTON,P.CAPTION,P.CENTER,P.COL,P.COLGROUP,P.DD,P.DETAILS,P.DIR,P.DIV,P.DL,P.DT,P.EMBED,P.FIELDSET,P.FIGCAPTION,P.FIGURE,P.FOOTER,P.FORM,P.FRAME,P.FRAMESET,P.H1,P.H2,P.H3,P.H4,P.H5,P.H6,P.HEAD,P.HEADER,P.HGROUP,P.HR,P.HTML,P.IFRAME,P.IMG,P.INPUT,P.LI,P.LINK,P.LISTING,P.MAIN,P.MARQUEE,P.MENU,P.META,P.NAV,P.NOEMBED,P.NOFRAMES,P.NOSCRIPT,P.OBJECT,P.OL,P.P,P.PARAM,P.PLAINTEXT,P.PRE,P.SCRIPT,P.SECTION,P.SELECT,P.SOURCE,P.STYLE,P.SUMMARY,P.TABLE,P.TBODY,P.TD,P.TEMPLATE,P.TEXTAREA,P.TFOOT,P.TH,P.THEAD,P.TITLE,P.TR,P.TRACK,P.UL,P.WBR,P.XMP]),[R.MATHML]:new Set([P.MI,P.MO,P.MN,P.MS,P.MTEXT,P.ANNOTATION_XML]),[R.SVG]:new Set([P.TITLE,P.FOREIGN_OBJECT,P.DESC]),[R.XLINK]:new Set,[R.XML]:new Set,[R.XMLNS]:new Set},Uh=new Set([P.H1,P.H2,P.H3,P.H4,P.H5,P.H6]);N.STYLE,N.SCRIPT,N.XMP,N.IFRAME,N.NOEMBED,N.NOFRAMES,N.PLAINTEXT;var k;(function(t){t[t.DATA=0]="DATA",t[t.RCDATA=1]="RCDATA",t[t.RAWTEXT=2]="RAWTEXT",t[t.SCRIPT_DATA=3]="SCRIPT_DATA",t[t.PLAINTEXT=4]="PLAINTEXT",t[t.TAG_OPEN=5]="TAG_OPEN",t[t.END_TAG_OPEN=6]="END_TAG_OPEN",t[t.TAG_NAME=7]="TAG_NAME",t[t.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",t[t.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",t[t.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",t[t.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",t[t.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",t[t.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",t[t.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",t[t.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",t[t.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",t[t.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",t[t.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",t[t.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",t[t.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",t[t.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",t[t.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",t[t.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",t[t.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",t[t.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",t[t.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",t[t.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",t[t.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",t[t.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",t[t.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",t[t.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",t[t.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",t[t.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",t[t.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",t[t.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",t[t.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",t[t.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",t[t.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",t[t.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",t[t.BOGUS_COMMENT=40]="BOGUS_COMMENT",t[t.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",t[t.COMMENT_START=42]="COMMENT_START",t[t.COMMENT_START_DASH=43]="COMMENT_START_DASH",t[t.COMMENT=44]="COMMENT",t[t.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",t[t.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",t[t.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",t[t.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",t[t.COMMENT_END_DASH=49]="COMMENT_END_DASH",t[t.COMMENT_END=50]="COMMENT_END",t[t.COMMENT_END_BANG=51]="COMMENT_END_BANG",t[t.DOCTYPE=52]="DOCTYPE",t[t.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",t[t.DOCTYPE_NAME=54]="DOCTYPE_NAME",t[t.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",t[t.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",t[t.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",t[t.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",t[t.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",t[t.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",t[t.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",t[t.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",t[t.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",t[t.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",t[t.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",t[t.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",t[t.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",t[t.CDATA_SECTION=68]="CDATA_SECTION",t[t.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",t[t.CDATA_SECTION_END=70]="CDATA_SECTION_END",t[t.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",t[t.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(k||(k={}));const It={DATA:k.DATA,RCDATA:k.RCDATA,RAWTEXT:k.RAWTEXT,SCRIPT_DATA:k.SCRIPT_DATA,PLAINTEXT:k.PLAINTEXT,CDATA_SECTION:k.CDATA_SECTION};function b6(t){return t>=E.DIGIT_0&&t<=E.DIGIT_9}function no(t){return t>=E.LATIN_CAPITAL_A&&t<=E.LATIN_CAPITAL_Z}function y6(t){return t>=E.LATIN_SMALL_A&&t<=E.LATIN_SMALL_Z}function mr(t){return y6(t)||no(t)}function Y0(t){return mr(t)||b6(t)}function Va(t){return t+32}function uC(t){return t===E.SPACE||t===E.LINE_FEED||t===E.TABULATION||t===E.FORM_FEED}function K0(t){return uC(t)||t===E.SOLIDUS||t===E.GREATER_THAN_SIGN}function E6(t){return t===E.NULL?O.nullCharacterReference:t>1114111?O.characterReferenceOutsideUnicodeRange:oC(t)?O.surrogateCharacterReference:lC(t)?O.noncharacterCharacterReference:aC(t)||t===E.CARRIAGE_RETURN?O.controlCharacterReference:null}class k6{constructor(e,n){this.options=e,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=k.DATA,this.returnState=k.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new s6(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new f6(o6,(r,i)=>{this.preprocessor.pos=this.entityStartPos+i-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(O.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(O.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const i=E6(r);i&&this._err(i,1)}}:void 0)}_err(e,n=0){var r,i;(i=(r=this.handler).onParseError)===null||i===void 0||i.call(r,this.preprocessor.getError(e,n))}getCurrentLocation(e){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-e,startOffset:this.preprocessor.offset-e,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||e?.())}write(e,n,r){this.active=!0,this.preprocessor.write(e,n),this._runParsingLoop(),this.paused||r?.()}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(e){this.consumedAfterSnapshot+=e;for(let n=0;n<e;n++)this.preprocessor.advance()}_consumeSequenceIfMatch(e,n){return this.preprocessor.startsWith(e,n)?(this._advanceBy(e.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:fe.START_TAG,tagName:"",tagID:m.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:fe.END_TAG,tagName:"",tagID:m.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:fe.COMMENT,data:"",location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:fe.DOCTYPE,name:e,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(e,n){this.currentCharacterToken={type:e,chars:n,location:this.currentLocation}}_createAttr(e){this.currentAttr={name:e,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var e,n;const r=this.currentToken;if(cC(r,this.currentAttr.name)===null){if(r.attrs.push(this.currentAttr),r.location&&this.currentLocation){const i=(e=(n=r.location).attrs)!==null&&e!==void 0?e:n.attrs=Object.create(null);i[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(O.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(e){this._emitCurrentCharacterToken(e.location),this.currentToken=null,e.location&&(e.location.endLine=this.preprocessor.line,e.location.endCol=this.preprocessor.col+1,e.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){const e=this.currentToken;this.prepareToken(e),e.tagID=bu(e.tagName),e.type===fe.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(O.endTagWithAttributes),e.selfClosing&&this._err(O.endTagWithTrailingSolidus),this.handler.onEndTag(e)),this.preprocessor.dropParsedChunk()}emitCurrentComment(e){this.prepareToken(e),this.handler.onComment(e),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(e){this.prepareToken(e),this.handler.onDoctype(e),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(e){if(this.currentCharacterToken){switch(e&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=e.startLine,this.currentCharacterToken.location.endCol=e.startCol,this.currentCharacterToken.location.endOffset=e.startOffset),this.currentCharacterToken.type){case fe.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case fe.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case fe.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:fe.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===e){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(e,n)}_emitCodePoint(e){const n=uC(e)?fe.WHITESPACE_CHARACTER:e===E.NULL?fe.NULL_CHARACTER:fe.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(fe.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=k.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?er.Attribute:er.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===k.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===k.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===k.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case k.DATA:{this._stateData(e);break}case k.RCDATA:{this._stateRcdata(e);break}case k.RAWTEXT:{this._stateRawtext(e);break}case k.SCRIPT_DATA:{this._stateScriptData(e);break}case k.PLAINTEXT:{this._statePlaintext(e);break}case k.TAG_OPEN:{this._stateTagOpen(e);break}case k.END_TAG_OPEN:{this._stateEndTagOpen(e);break}case k.TAG_NAME:{this._stateTagName(e);break}case k.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(e);break}case k.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(e);break}case k.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(e);break}case k.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(e);break}case k.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(e);break}case k.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(e);break}case k.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(e);break}case k.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(e);break}case k.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(e);break}case k.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(e);break}case k.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(e);break}case k.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(e);break}case k.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(e);break}case k.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(e);break}case k.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(e);break}case k.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(e);break}case k.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(e);break}case k.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(e);break}case k.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(e);break}case k.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(e);break}case k.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(e);break}case k.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(e);break}case k.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(e);break}case k.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(e);break}case k.ATTRIBUTE_NAME:{this._stateAttributeName(e);break}case k.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(e);break}case k.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(e);break}case k.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(e);break}case k.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(e);break}case k.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(e);break}case k.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(e);break}case k.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(e);break}case k.BOGUS_COMMENT:{this._stateBogusComment(e);break}case k.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(e);break}case k.COMMENT_START:{this._stateCommentStart(e);break}case k.COMMENT_START_DASH:{this._stateCommentStartDash(e);break}case k.COMMENT:{this._stateComment(e);break}case k.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(e);break}case k.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(e);break}case k.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(e);break}case k.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(e);break}case k.COMMENT_END_DASH:{this._stateCommentEndDash(e);break}case k.COMMENT_END:{this._stateCommentEnd(e);break}case k.COMMENT_END_BANG:{this._stateCommentEndBang(e);break}case k.DOCTYPE:{this._stateDoctype(e);break}case k.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(e);break}case k.DOCTYPE_NAME:{this._stateDoctypeName(e);break}case k.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(e);break}case k.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(e);break}case k.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(e);break}case k.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(e);break}case k.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(e);break}case k.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(e);break}case k.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break}case k.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(e);break}case k.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(e);break}case k.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(e);break}case k.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(e);break}case k.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(e);break}case k.BOGUS_DOCTYPE:{this._stateBogusDoctype(e);break}case k.CDATA_SECTION:{this._stateCdataSection(e);break}case k.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(e);break}case k.CDATA_SECTION_END:{this._stateCdataSectionEnd(e);break}case k.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case k.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(e);break}default:throw new Error("Unknown state")}}_stateData(e){switch(e){case E.LESS_THAN_SIGN:{this.state=k.TAG_OPEN;break}case E.AMPERSAND:{this._startCharacterReference();break}case E.NULL:{this._err(O.unexpectedNullCharacter),this._emitCodePoint(e);break}case E.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case E.AMPERSAND:{this._startCharacterReference();break}case E.LESS_THAN_SIGN:{this.state=k.RCDATA_LESS_THAN_SIGN;break}case E.NULL:{this._err(O.unexpectedNullCharacter),this._emitChars(Oe);break}case E.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case E.LESS_THAN_SIGN:{this.state=k.RAWTEXT_LESS_THAN_SIGN;break}case E.NULL:{this._err(O.unexpectedNullCharacter),this._emitChars(Oe);break}case E.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case E.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_LESS_THAN_SIGN;break}case E.NULL:{this._err(O.unexpectedNullCharacter),this._emitChars(Oe);break}case E.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case E.NULL:{this._err(O.unexpectedNullCharacter),this._emitChars(Oe);break}case E.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateTagOpen(e){if(mr(e))this._createStartTagToken(),this.state=k.TAG_NAME,this._stateTagName(e);else switch(e){case E.EXCLAMATION_MARK:{this.state=k.MARKUP_DECLARATION_OPEN;break}case E.SOLIDUS:{this.state=k.END_TAG_OPEN;break}case E.QUESTION_MARK:{this._err(O.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=k.BOGUS_COMMENT,this._stateBogusComment(e);break}case E.EOF:{this._err(O.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(O.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=k.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(mr(e))this._createEndTagToken(),this.state=k.TAG_NAME,this._stateTagName(e);else switch(e){case E.GREATER_THAN_SIGN:{this._err(O.missingEndTagName),this.state=k.DATA;break}case E.EOF:{this._err(O.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break}default:this._err(O.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=k.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:{this.state=k.BEFORE_ATTRIBUTE_NAME;break}case E.SOLIDUS:{this.state=k.SELF_CLOSING_START_TAG;break}case E.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentTagToken();break}case E.NULL:{this._err(O.unexpectedNullCharacter),n.tagName+=Oe;break}case E.EOF:{this._err(O.eofInTag),this._emitEOFToken();break}default:n.tagName+=String.fromCodePoint(no(e)?Va(e):e)}}_stateRcdataLessThanSign(e){e===E.SOLIDUS?this.state=k.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=k.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){mr(e)?(this.state=k.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars("</"),this.state=k.RCDATA,this._stateRcdata(e))}handleSpecialEndTag(e){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();const n=this.currentToken;switch(n.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=k.BEFORE_ATTRIBUTE_NAME,!1;case E.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=k.SELF_CLOSING_START_TAG,!1;case E.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=k.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=k.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===E.SOLIDUS?this.state=k.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=k.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){mr(e)?(this.state=k.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars("</"),this.state=k.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=k.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case E.SOLIDUS:{this.state=k.SCRIPT_DATA_END_TAG_OPEN;break}case E.EXCLAMATION_MARK:{this.state=k.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break}default:this._emitChars("<"),this.state=k.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){mr(e)?(this.state=k.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars("</"),this.state=k.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=k.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===E.HYPHEN_MINUS?(this.state=k.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=k.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===E.HYPHEN_MINUS?(this.state=k.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=k.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case E.HYPHEN_MINUS:{this.state=k.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break}case E.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case E.NULL:{this._err(O.unexpectedNullCharacter),this._emitChars(Oe);break}case E.EOF:{this._err(O.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case E.HYPHEN_MINUS:{this.state=k.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break}case E.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case E.NULL:{this._err(O.unexpectedNullCharacter),this.state=k.SCRIPT_DATA_ESCAPED,this._emitChars(Oe);break}case E.EOF:{this._err(O.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=k.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case E.HYPHEN_MINUS:{this._emitChars("-");break}case E.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case E.GREATER_THAN_SIGN:{this.state=k.SCRIPT_DATA,this._emitChars(">");break}case E.NULL:{this._err(O.unexpectedNullCharacter),this.state=k.SCRIPT_DATA_ESCAPED,this._emitChars(Oe);break}case E.EOF:{this._err(O.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=k.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===E.SOLIDUS?this.state=k.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:mr(e)?(this._emitChars("<"),this.state=k.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars("<"),this.state=k.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){mr(e)?(this.state=k.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars("</"),this.state=k.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=k.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith(St.SCRIPT,!1)&&K0(this.preprocessor.peek(St.SCRIPT.length))){this._emitCodePoint(e);for(let n=0;n<St.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=k.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case E.HYPHEN_MINUS:{this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break}case E.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case E.NULL:{this._err(O.unexpectedNullCharacter),this._emitChars(Oe);break}case E.EOF:{this._err(O.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case E.HYPHEN_MINUS:{this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break}case E.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case E.NULL:{this._err(O.unexpectedNullCharacter),this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Oe);break}case E.EOF:{this._err(O.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDashDash(e){switch(e){case E.HYPHEN_MINUS:{this._emitChars("-");break}case E.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case E.GREATER_THAN_SIGN:{this.state=k.SCRIPT_DATA,this._emitChars(">");break}case E.NULL:{this._err(O.unexpectedNullCharacter),this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Oe);break}case E.EOF:{this._err(O.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===E.SOLIDUS?(this.state=k.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(St.SCRIPT,!1)&&K0(this.preprocessor.peek(St.SCRIPT.length))){this._emitCodePoint(e);for(let n=0;n<St.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=k.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.SOLIDUS:case E.GREATER_THAN_SIGN:case E.EOF:{this.state=k.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break}case E.EQUALS_SIGN:{this._err(O.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=k.ATTRIBUTE_NAME;break}default:this._createAttr(""),this.state=k.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:case E.SOLIDUS:case E.GREATER_THAN_SIGN:case E.EOF:{this._leaveAttrName(),this.state=k.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break}case E.EQUALS_SIGN:{this._leaveAttrName(),this.state=k.BEFORE_ATTRIBUTE_VALUE;break}case E.QUOTATION_MARK:case E.APOSTROPHE:case E.LESS_THAN_SIGN:{this._err(O.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break}case E.NULL:{this._err(O.unexpectedNullCharacter),this.currentAttr.name+=Oe;break}default:this.currentAttr.name+=String.fromCodePoint(no(e)?Va(e):e)}}_stateAfterAttributeName(e){switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.SOLIDUS:{this.state=k.SELF_CLOSING_START_TAG;break}case E.EQUALS_SIGN:{this.state=k.BEFORE_ATTRIBUTE_VALUE;break}case E.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentTagToken();break}case E.EOF:{this._err(O.eofInTag),this._emitEOFToken();break}default:this._createAttr(""),this.state=k.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.QUOTATION_MARK:{this.state=k.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break}case E.APOSTROPHE:{this.state=k.ATTRIBUTE_VALUE_SINGLE_QUOTED;break}case E.GREATER_THAN_SIGN:{this._err(O.missingAttributeValue),this.state=k.DATA,this.emitCurrentTagToken();break}default:this.state=k.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case E.QUOTATION_MARK:{this.state=k.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case E.AMPERSAND:{this._startCharacterReference();break}case E.NULL:{this._err(O.unexpectedNullCharacter),this.currentAttr.value+=Oe;break}case E.EOF:{this._err(O.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case E.APOSTROPHE:{this.state=k.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case E.AMPERSAND:{this._startCharacterReference();break}case E.NULL:{this._err(O.unexpectedNullCharacter),this.currentAttr.value+=Oe;break}case E.EOF:{this._err(O.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:{this._leaveAttrValue(),this.state=k.BEFORE_ATTRIBUTE_NAME;break}case E.AMPERSAND:{this._startCharacterReference();break}case E.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=k.DATA,this.emitCurrentTagToken();break}case E.NULL:{this._err(O.unexpectedNullCharacter),this.currentAttr.value+=Oe;break}case E.QUOTATION_MARK:case E.APOSTROPHE:case E.LESS_THAN_SIGN:case E.EQUALS_SIGN:case E.GRAVE_ACCENT:{this._err(O.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break}case E.EOF:{this._err(O.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:{this._leaveAttrValue(),this.state=k.BEFORE_ATTRIBUTE_NAME;break}case E.SOLIDUS:{this._leaveAttrValue(),this.state=k.SELF_CLOSING_START_TAG;break}case E.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=k.DATA,this.emitCurrentTagToken();break}case E.EOF:{this._err(O.eofInTag),this._emitEOFToken();break}default:this._err(O.missingWhitespaceBetweenAttributes),this.state=k.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case E.GREATER_THAN_SIGN:{const n=this.currentToken;n.selfClosing=!0,this.state=k.DATA,this.emitCurrentTagToken();break}case E.EOF:{this._err(O.eofInTag),this._emitEOFToken();break}default:this._err(O.unexpectedSolidusInTag),this.state=k.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){const n=this.currentToken;switch(e){case E.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentComment(n);break}case E.EOF:{this.emitCurrentComment(n),this._emitEOFToken();break}case E.NULL:{this._err(O.unexpectedNullCharacter),n.data+=Oe;break}default:n.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch(St.DASH_DASH,!0)?(this._createCommentToken(St.DASH_DASH.length+1),this.state=k.COMMENT_START):this._consumeSequenceIfMatch(St.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(St.DOCTYPE.length+1),this.state=k.DOCTYPE):this._consumeSequenceIfMatch(St.CDATA_START,!0)?this.inForeignNode?this.state=k.CDATA_SECTION:(this._err(O.cdataInHtmlContent),this._createCommentToken(St.CDATA_START.length+1),this.currentToken.data="[CDATA[",this.state=k.BOGUS_COMMENT):this._ensureHibernation()||(this._err(O.incorrectlyOpenedComment),this._createCommentToken(2),this.state=k.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case E.HYPHEN_MINUS:{this.state=k.COMMENT_START_DASH;break}case E.GREATER_THAN_SIGN:{this._err(O.abruptClosingOfEmptyComment),this.state=k.DATA;const n=this.currentToken;this.emitCurrentComment(n);break}default:this.state=k.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){const n=this.currentToken;switch(e){case E.HYPHEN_MINUS:{this.state=k.COMMENT_END;break}case E.GREATER_THAN_SIGN:{this._err(O.abruptClosingOfEmptyComment),this.state=k.DATA,this.emitCurrentComment(n);break}case E.EOF:{this._err(O.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=k.COMMENT,this._stateComment(e)}}_stateComment(e){const n=this.currentToken;switch(e){case E.HYPHEN_MINUS:{this.state=k.COMMENT_END_DASH;break}case E.LESS_THAN_SIGN:{n.data+="<",this.state=k.COMMENT_LESS_THAN_SIGN;break}case E.NULL:{this._err(O.unexpectedNullCharacter),n.data+=Oe;break}case E.EOF:{this._err(O.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){const n=this.currentToken;switch(e){case E.EXCLAMATION_MARK:{n.data+="!",this.state=k.COMMENT_LESS_THAN_SIGN_BANG;break}case E.LESS_THAN_SIGN:{n.data+="<";break}default:this.state=k.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===E.HYPHEN_MINUS?this.state=k.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=k.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===E.HYPHEN_MINUS?this.state=k.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=k.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==E.GREATER_THAN_SIGN&&e!==E.EOF&&this._err(O.nestedComment),this.state=k.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){const n=this.currentToken;switch(e){case E.HYPHEN_MINUS:{this.state=k.COMMENT_END;break}case E.EOF:{this._err(O.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=k.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){const n=this.currentToken;switch(e){case E.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentComment(n);break}case E.EXCLAMATION_MARK:{this.state=k.COMMENT_END_BANG;break}case E.HYPHEN_MINUS:{n.data+="-";break}case E.EOF:{this._err(O.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--",this.state=k.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){const n=this.currentToken;switch(e){case E.HYPHEN_MINUS:{n.data+="--!",this.state=k.COMMENT_END_DASH;break}case E.GREATER_THAN_SIGN:{this._err(O.incorrectlyClosedComment),this.state=k.DATA,this.emitCurrentComment(n);break}case E.EOF:{this._err(O.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--!",this.state=k.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:{this.state=k.BEFORE_DOCTYPE_NAME;break}case E.GREATER_THAN_SIGN:{this.state=k.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break}case E.EOF:{this._err(O.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(O.missingWhitespaceBeforeDoctypeName),this.state=k.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(no(e))this._createDoctypeToken(String.fromCharCode(Va(e))),this.state=k.DOCTYPE_NAME;else switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.NULL:{this._err(O.unexpectedNullCharacter),this._createDoctypeToken(Oe),this.state=k.DOCTYPE_NAME;break}case E.GREATER_THAN_SIGN:{this._err(O.missingDoctypeName),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=k.DATA;break}case E.EOF:{this._err(O.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=k.DOCTYPE_NAME}}_stateDoctypeName(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:{this.state=k.AFTER_DOCTYPE_NAME;break}case E.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentDoctype(n);break}case E.NULL:{this._err(O.unexpectedNullCharacter),n.name+=Oe;break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.name+=String.fromCodePoint(no(e)?Va(e):e)}}_stateAfterDoctypeName(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentDoctype(n);break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._consumeSequenceIfMatch(St.PUBLIC,!1)?this.state=k.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(St.SYSTEM,!1)?this.state=k.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(O.invalidCharacterSequenceAfterDoctypeName),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:{this.state=k.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break}case E.QUOTATION_MARK:{this._err(O.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=k.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case E.APOSTROPHE:{this._err(O.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=k.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case E.GREATER_THAN_SIGN:{this._err(O.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=k.DATA,this.emitCurrentDoctype(n);break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(O.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.QUOTATION_MARK:{n.publicId="",this.state=k.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case E.APOSTROPHE:{n.publicId="",this.state=k.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case E.GREATER_THAN_SIGN:{this._err(O.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=k.DATA,this.emitCurrentDoctype(n);break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(O.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){const n=this.currentToken;switch(e){case E.QUOTATION_MARK:{this.state=k.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case E.NULL:{this._err(O.unexpectedNullCharacter),n.publicId+=Oe;break}case E.GREATER_THAN_SIGN:{this._err(O.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=k.DATA;break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){const n=this.currentToken;switch(e){case E.APOSTROPHE:{this.state=k.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case E.NULL:{this._err(O.unexpectedNullCharacter),n.publicId+=Oe;break}case E.GREATER_THAN_SIGN:{this._err(O.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=k.DATA;break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:{this.state=k.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break}case E.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentDoctype(n);break}case E.QUOTATION_MARK:{this._err(O.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case E.APOSTROPHE:{this._err(O.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(O.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=k.DATA;break}case E.QUOTATION_MARK:{n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case E.APOSTROPHE:{n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(O.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:{this.state=k.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break}case E.QUOTATION_MARK:{this._err(O.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case E.APOSTROPHE:{this._err(O.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case E.GREATER_THAN_SIGN:{this._err(O.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=k.DATA,this.emitCurrentDoctype(n);break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(O.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.QUOTATION_MARK:{n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case E.APOSTROPHE:{n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case E.GREATER_THAN_SIGN:{this._err(O.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=k.DATA,this.emitCurrentDoctype(n);break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(O.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){const n=this.currentToken;switch(e){case E.QUOTATION_MARK:{this.state=k.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case E.NULL:{this._err(O.unexpectedNullCharacter),n.systemId+=Oe;break}case E.GREATER_THAN_SIGN:{this._err(O.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=k.DATA;break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){const n=this.currentToken;switch(e){case E.APOSTROPHE:{this.state=k.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case E.NULL:{this._err(O.unexpectedNullCharacter),n.systemId+=Oe;break}case E.GREATER_THAN_SIGN:{this._err(O.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=k.DATA;break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){const n=this.currentToken;switch(e){case E.SPACE:case E.LINE_FEED:case E.TABULATION:case E.FORM_FEED:break;case E.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=k.DATA;break}case E.EOF:{this._err(O.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(O.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){const n=this.currentToken;switch(e){case E.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=k.DATA;break}case E.NULL:{this._err(O.unexpectedNullCharacter);break}case E.EOF:{this.emitCurrentDoctype(n),this._emitEOFToken();break}}}_stateCdataSection(e){switch(e){case E.RIGHT_SQUARE_BRACKET:{this.state=k.CDATA_SECTION_BRACKET;break}case E.EOF:{this._err(O.eofInCdata),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===E.RIGHT_SQUARE_BRACKET?this.state=k.CDATA_SECTION_END:(this._emitChars("]"),this.state=k.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case E.GREATER_THAN_SIGN:{this.state=k.DATA;break}case E.RIGHT_SQUARE_BRACKET:{this._emitChars("]");break}default:this._emitChars("]]"),this.state=k.CDATA_SECTION,this._stateCdataSection(e)}}_stateCharacterReference(){let e=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(e<0)if(this.preprocessor.lastChunkWritten)e=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}e===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(E.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&Y0(this.preprocessor.peek(1))?k.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){Y0(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===E.SEMICOLON&&this._err(O.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}}const dC=new Set([m.DD,m.DT,m.LI,m.OPTGROUP,m.OPTION,m.P,m.RB,m.RP,m.RT,m.RTC]),G0=new Set([...dC,m.CAPTION,m.COLGROUP,m.TBODY,m.TD,m.TFOOT,m.TH,m.THEAD,m.TR]),ec=new Set([m.APPLET,m.CAPTION,m.HTML,m.MARQUEE,m.OBJECT,m.TABLE,m.TD,m.TEMPLATE,m.TH]),T6=new Set([...ec,m.OL,m.UL]),C6=new Set([...ec,m.BUTTON]),Q0=new Set([m.ANNOTATION_XML,m.MI,m.MN,m.MO,m.MS,m.MTEXT]),J0=new Set([m.DESC,m.FOREIGN_OBJECT,m.TITLE]),S6=new Set([m.TR,m.TEMPLATE,m.HTML]),w6=new Set([m.TBODY,m.TFOOT,m.THEAD,m.TEMPLATE,m.HTML]),x6=new Set([m.TABLE,m.TEMPLATE,m.HTML]),A6=new Set([m.TD,m.TH]);class _6{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,n,r){this.treeAdapter=n,this.handler=r,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=m.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===m.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===R.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(e,n){this.stackTop++,this.items[this.stackTop]=e,this.current=e,this.tagIDs[this.stackTop]=n,this.currentTagId=n,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(e,n,!0)}pop(){const e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,n){const r=this._indexOf(e);this.items[r]=n,r===this.stackTop&&(this.current=n)}insertAfter(e,n,r){const i=this._indexOf(e)+1;this.items.splice(i,0,n),this.tagIDs.splice(i,0,r),this.stackTop++,i===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,i===this.stackTop)}popUntilTagNamePopped(e){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(e,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==R.HTML);this.shortenToLength(Math.max(n,0))}shortenToLength(e){for(;this.stackTop>=e;){const n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop<e)}}popUntilElementPopped(e){const n=this._indexOf(e);this.shortenToLength(Math.max(n,0))}popUntilPopped(e,n){const r=this._indexOfTagNames(e,n);this.shortenToLength(Math.max(r,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(Uh,R.HTML)}popUntilTableCellPopped(){this.popUntilPopped(A6,R.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(e,n){for(let r=this.stackTop;r>=0;r--)if(e.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===n)return r;return-1}clearBackTo(e,n){const r=this._indexOfTagNames(e,n);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(x6,R.HTML)}clearBackToTableBodyContext(){this.clearBackTo(w6,R.HTML)}clearBackToTableRowContext(){this.clearBackTo(S6,R.HTML)}remove(e){const n=this._indexOf(e);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===m.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){const n=this._indexOf(e)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===m.HTML}hasInDynamicScope(e,n){for(let r=this.stackTop;r>=0;r--){const i=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case R.HTML:{if(i===e)return!0;if(n.has(i))return!1;break}case R.SVG:{if(J0.has(i))return!1;break}case R.MATHML:{if(Q0.has(i))return!1;break}}}return!0}hasInScope(e){return this.hasInDynamicScope(e,ec)}hasInListItemScope(e){return this.hasInDynamicScope(e,T6)}hasInButtonScope(e){return this.hasInDynamicScope(e,C6)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){const n=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case R.HTML:{if(Uh.has(n))return!0;if(ec.has(n))return!1;break}case R.SVG:{if(J0.has(n))return!1;break}case R.MATHML:{if(Q0.has(n))return!1;break}}}return!0}hasInTableScope(e){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===R.HTML)switch(this.tagIDs[n]){case e:return!0;case m.TABLE:case m.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===R.HTML)switch(this.tagIDs[e]){case m.TBODY:case m.THEAD:case m.TFOOT:return!0;case m.TABLE:case m.HTML:return!1}return!0}hasInSelectScope(e){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===R.HTML)switch(this.tagIDs[n]){case e:return!0;case m.OPTION:case m.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&dC.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&G0.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==void 0&&this.currentTagId!==e&&G0.has(this.currentTagId);)this.pop()}}const fd=3;var Mn;(function(t){t[t.Marker=0]="Marker",t[t.Element=1]="Element"})(Mn||(Mn={}));const X0={type:Mn.Marker};class N6{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,n){const r=[],i=n.length,s=this.treeAdapter.getTagName(e),o=this.treeAdapter.getNamespaceURI(e);for(let a=0;a<this.entries.length;a++){const l=this.entries[a];if(l.type===Mn.Marker)break;const{element:c}=l;if(this.treeAdapter.getTagName(c)===s&&this.treeAdapter.getNamespaceURI(c)===o){const u=this.treeAdapter.getAttrList(c);u.length===i&&r.push({idx:a,attrs:u})}}return r}_ensureNoahArkCondition(e){if(this.entries.length<fd)return;const n=this.treeAdapter.getAttrList(e),r=this._getNoahArkConditionCandidates(e,n);if(r.length<fd)return;const i=new Map(n.map(o=>[o.name,o.value]));let s=0;for(let o=0;o<r.length;o++){const a=r[o];a.attrs.every(l=>i.get(l.name)===l.value)&&(s+=1,s>=fd&&this.entries.splice(a.idx,1))}}insertMarker(){this.entries.unshift(X0)}pushElement(e,n){this._ensureNoahArkCondition(e),this.entries.unshift({type:Mn.Element,element:e,token:n})}insertElementAfterBookmark(e,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:Mn.Element,element:e,token:n})}removeEntry(e){const n=this.entries.indexOf(e);n!==-1&&this.entries.splice(n,1)}clearToLastMarker(){const e=this.entries.indexOf(X0);e===-1?this.entries.length=0:this.entries.splice(0,e+1)}getElementEntryInScopeWithTagName(e){const n=this.entries.find(r=>r.type===Mn.Marker||this.treeAdapter.getTagName(r.element)===e);return n&&n.type===Mn.Element?n:null}getElementEntry(e){return this.entries.find(n=>n.type===Mn.Element&&n.element===e)}}const gr={createDocument(){return{nodeName:"#document",mode:Kt.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(t,e,n){return{nodeName:t,tagName:t,attrs:n,namespaceURI:e,childNodes:[],parentNode:null}},createCommentNode(t){return{nodeName:"#comment",data:t,parentNode:null}},createTextNode(t){return{nodeName:"#text",value:t,parentNode:null}},appendChild(t,e){t.childNodes.push(e),e.parentNode=t},insertBefore(t,e,n){const r=t.childNodes.indexOf(n);t.childNodes.splice(r,0,e),e.parentNode=t},setTemplateContent(t,e){t.content=e},getTemplateContent(t){return t.content},setDocumentType(t,e,n,r){const i=t.childNodes.find(s=>s.nodeName==="#documentType");if(i)i.name=e,i.publicId=n,i.systemId=r;else{const s={nodeName:"#documentType",name:e,publicId:n,systemId:r,parentNode:null};gr.appendChild(t,s)}},setDocumentMode(t,e){t.mode=e},getDocumentMode(t){return t.mode},detachNode(t){if(t.parentNode){const e=t.parentNode.childNodes.indexOf(t);t.parentNode.childNodes.splice(e,1),t.parentNode=null}},insertText(t,e){if(t.childNodes.length>0){const n=t.childNodes[t.childNodes.length-1];if(gr.isTextNode(n)){n.value+=e;return}}gr.appendChild(t,gr.createTextNode(e))},insertTextBefore(t,e,n){const r=t.childNodes[t.childNodes.indexOf(n)-1];r&&gr.isTextNode(r)?r.value+=e:gr.insertBefore(t,gr.createTextNode(e),n)},adoptAttributes(t,e){const n=new Set(t.attrs.map(r=>r.name));for(let r=0;r<e.length;r++)n.has(e[r].name)||t.attrs.push(e[r])},getFirstChild(t){return t.childNodes[0]},getChildNodes(t){return t.childNodes},getParentNode(t){return t.parentNode},getAttrList(t){return t.attrs},getTagName(t){return t.tagName},getNamespaceURI(t){return t.namespaceURI},getTextNodeContent(t){return t.value},getCommentNodeContent(t){return t.data},getDocumentTypeNodeName(t){return t.name},getDocumentTypeNodePublicId(t){return t.publicId},getDocumentTypeNodeSystemId(t){return t.systemId},isTextNode(t){return t.nodeName==="#text"},isCommentNode(t){return t.nodeName==="#comment"},isDocumentTypeNode(t){return t.nodeName==="#documentType"},isElementNode(t){return Object.prototype.hasOwnProperty.call(t,"tagName")},setNodeSourceCodeLocation(t,e){t.sourceCodeLocation=e},getNodeSourceCodeLocation(t){return t.sourceCodeLocation},updateNodeSourceCodeLocation(t,e){t.sourceCodeLocation={...t.sourceCodeLocation,...e}}},hC="html",I6="about:legacy-compat",O6="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",fC=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],M6=[...fC,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],v6=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),pC=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],D6=[...pC,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function Z0(t,e){return e.some(n=>t.startsWith(n))}function L6(t){return t.name===hC&&t.publicId===null&&(t.systemId===null||t.systemId===I6)}function R6(t){if(t.name!==hC)return Kt.QUIRKS;const{systemId:e}=t;if(e&&e.toLowerCase()===O6)return Kt.QUIRKS;let{publicId:n}=t;if(n!==null){if(n=n.toLowerCase(),v6.has(n))return Kt.QUIRKS;let r=e===null?M6:fC;if(Z0(n,r))return Kt.QUIRKS;if(r=e===null?pC:D6,Z0(n,r))return Kt.LIMITED_QUIRKS}return Kt.NO_QUIRKS}const eb={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},P6="definitionurl",B6="definitionURL",F6=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(t=>[t.toLowerCase(),t])),H6=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:R.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:R.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:R.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:R.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:R.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:R.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:R.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:R.XML}],["xml:space",{prefix:"xml",name:"space",namespace:R.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:R.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:R.XMLNS}]]),U6=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(t=>[t.toLowerCase(),t])),$6=new Set([m.B,m.BIG,m.BLOCKQUOTE,m.BODY,m.BR,m.CENTER,m.CODE,m.DD,m.DIV,m.DL,m.DT,m.EM,m.EMBED,m.H1,m.H2,m.H3,m.H4,m.H5,m.H6,m.HEAD,m.HR,m.I,m.IMG,m.LI,m.LISTING,m.MENU,m.META,m.NOBR,m.OL,m.P,m.PRE,m.RUBY,m.S,m.SMALL,m.SPAN,m.STRONG,m.STRIKE,m.SUB,m.SUP,m.TABLE,m.TT,m.U,m.UL,m.VAR]);function z6(t){const e=t.tagID;return e===m.FONT&&t.attrs.some(({name:r})=>r===di.COLOR||r===di.SIZE||r===di.FACE)||$6.has(e)}function mC(t){for(let e=0;e<t.attrs.length;e++)if(t.attrs[e].name===P6){t.attrs[e].name=B6;break}}function gC(t){for(let e=0;e<t.attrs.length;e++){const n=F6.get(t.attrs[e].name);n!=null&&(t.attrs[e].name=n)}}function $p(t){for(let e=0;e<t.attrs.length;e++){const n=H6.get(t.attrs[e].name);n&&(t.attrs[e].prefix=n.prefix,t.attrs[e].name=n.name,t.attrs[e].namespace=n.namespace)}}function V6(t){const e=U6.get(t.tagName);e!=null&&(t.tagName=e,t.tagID=bu(t.tagName))}function j6(t,e){return e===R.MATHML&&(t===m.MI||t===m.MO||t===m.MN||t===m.MS||t===m.MTEXT)}function q6(t,e,n){if(e===R.MATHML&&t===m.ANNOTATION_XML){for(let r=0;r<n.length;r++)if(n[r].name===di.ENCODING){const i=n[r].value.toLowerCase();return i===eb.TEXT_HTML||i===eb.APPLICATION_XML}}return e===R.SVG&&(t===m.FOREIGN_OBJECT||t===m.DESC||t===m.TITLE)}function W6(t,e,n,r){return(!r||r===R.HTML)&&q6(t,e,n)||(!r||r===R.MATHML)&&j6(t,e)}const Y6="hidden",K6=8,G6=3;var T;(function(t){t[t.INITIAL=0]="INITIAL",t[t.BEFORE_HTML=1]="BEFORE_HTML",t[t.BEFORE_HEAD=2]="BEFORE_HEAD",t[t.IN_HEAD=3]="IN_HEAD",t[t.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",t[t.AFTER_HEAD=5]="AFTER_HEAD",t[t.IN_BODY=6]="IN_BODY",t[t.TEXT=7]="TEXT",t[t.IN_TABLE=8]="IN_TABLE",t[t.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",t[t.IN_CAPTION=10]="IN_CAPTION",t[t.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",t[t.IN_TABLE_BODY=12]="IN_TABLE_BODY",t[t.IN_ROW=13]="IN_ROW",t[t.IN_CELL=14]="IN_CELL",t[t.IN_SELECT=15]="IN_SELECT",t[t.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",t[t.IN_TEMPLATE=17]="IN_TEMPLATE",t[t.AFTER_BODY=18]="AFTER_BODY",t[t.IN_FRAMESET=19]="IN_FRAMESET",t[t.AFTER_FRAMESET=20]="AFTER_FRAMESET",t[t.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",t[t.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET"})(T||(T={}));const Q6={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},bC=new Set([m.TABLE,m.TBODY,m.TFOOT,m.THEAD,m.TR]),tb={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:gr,onParseError:null};class yC{constructor(e,n,r=null,i=null){this.fragmentContext=r,this.scriptHandler=i,this.currentToken=null,this.stopped=!1,this.insertionMode=T.INITIAL,this.originalInsertionMode=T.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...tb,...e},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=n??this.treeAdapter.createDocument(),this.tokenizer=new k6(this.options,this),this.activeFormattingElements=new N6(this.treeAdapter),this.fragmentContextID=r?bu(this.treeAdapter.getTagName(r)):m.UNKNOWN,this._setContextModes(r??this.document,this.fragmentContextID),this.openElements=new _6(this.document,this.treeAdapter,this)}static parse(e,n){const r=new this(n);return r.tokenizer.write(e,!0),r.document}static getFragmentParser(e,n){const r={...tb,...n};e??(e=r.treeAdapter.createElement(N.TEMPLATE,R.HTML,[]));const i=r.treeAdapter.createElement("documentmock",R.HTML,[]),s=new this(r,i,e);return s.fragmentContextID===m.TEMPLATE&&s.tmplInsertionModeStack.unshift(T.IN_TEMPLATE),s._initTokenizerForFragmentParsing(),s._insertFakeRootElement(),s._resetInsertionMode(),s._findFormInFragmentContext(),s}getFragment(){const e=this.treeAdapter.getFirstChild(this.document),n=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,n),n}_err(e,n,r){var i;if(!this.onParseError)return;const s=(i=e.location)!==null&&i!==void 0?i:Q6,o={code:n,startLine:s.startLine,startCol:s.startCol,startOffset:s.startOffset,endLine:r?s.startLine:s.endLine,endCol:r?s.startCol:s.endCol,endOffset:r?s.startOffset:s.endOffset};this.onParseError(o)}onItemPush(e,n,r){var i,s;(s=(i=this.treeAdapter).onItemPush)===null||s===void 0||s.call(i,e),r&&this.openElements.stackTop>0&&this._setContextModes(e,n)}onItemPop(e,n){var r,i;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),(i=(r=this.treeAdapter).onItemPop)===null||i===void 0||i.call(r,e,this.openElements.current),n){let s,o;this.openElements.stackTop===0&&this.fragmentContext?(s=this.fragmentContext,o=this.fragmentContextID):{current:s,currentTagId:o}=this.openElements,this._setContextModes(s,o)}}_setContextModes(e,n){const r=e===this.document||e&&this.treeAdapter.getNamespaceURI(e)===R.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&e!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,e)}_switchToTextParsing(e,n){this._insertElement(e,R.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=T.TEXT}switchToPlaintextParsing(){this.insertionMode=T.TEXT,this.originalInsertionMode=T.IN_BODY,this.tokenizer.state=It.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===N.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==R.HTML))switch(this.fragmentContextID){case m.TITLE:case m.TEXTAREA:{this.tokenizer.state=It.RCDATA;break}case m.STYLE:case m.XMP:case m.IFRAME:case m.NOEMBED:case m.NOFRAMES:case m.NOSCRIPT:{this.tokenizer.state=It.RAWTEXT;break}case m.SCRIPT:{this.tokenizer.state=It.SCRIPT_DATA;break}case m.PLAINTEXT:{this.tokenizer.state=It.PLAINTEXT;break}}}_setDocumentType(e){const n=e.name||"",r=e.publicId||"",i=e.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,i),e.location){const o=this.treeAdapter.getChildNodes(this.document).find(a=>this.treeAdapter.isDocumentTypeNode(a));o&&this.treeAdapter.setNodeSourceCodeLocation(o,e.location)}}_attachElementToTree(e,n){if(this.options.sourceCodeLocationInfo){const r=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(e,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{const r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r??this.document,e)}}_appendElement(e,n){const r=this.treeAdapter.createElement(e.tagName,n,e.attrs);this._attachElementToTree(r,e.location)}_insertElement(e,n){const r=this.treeAdapter.createElement(e.tagName,n,e.attrs);this._attachElementToTree(r,e.location),this.openElements.push(r,e.tagID)}_insertFakeElement(e,n){const r=this.treeAdapter.createElement(e,R.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(e){const n=this.treeAdapter.createElement(e.tagName,R.HTML,e.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,r),this._attachElementToTree(n,e.location),this.openElements.push(n,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){const e=this.treeAdapter.createElement(N.HTML,R.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,m.HTML)}_appendCommentNode(e,n){const r=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(n,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,e.location)}_insertCharacters(e){let n,r;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(n,e.chars,r):this.treeAdapter.insertText(n,e.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,e.chars)),!e.location)return;const i=this.treeAdapter.getChildNodes(n),s=r?i.lastIndexOf(r):i.length,o=i[s-1];if(this.treeAdapter.getNodeSourceCodeLocation(o)){const{endLine:l,endCol:c,endOffset:u}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(o,{endLine:l,endCol:c,endOffset:u})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(o,e.location)}_adoptNodes(e,n){for(let r=this.treeAdapter.getFirstChild(e);r;r=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(n,r)}_setEndLocation(e,n){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&n.location){const r=n.location,i=this.treeAdapter.getTagName(e),s=n.type===fe.END_TAG&&i===n.tagName?{endTag:{...r},endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,s)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let n,r;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,r=this.fragmentContextID):{current:n,currentTagId:r}=this.openElements,e.tagID===m.SVG&&this.treeAdapter.getTagName(n)===N.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===R.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===m.MGLYPH||e.tagID===m.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,R.HTML)}_processToken(e){switch(e.type){case fe.CHARACTER:{this.onCharacter(e);break}case fe.NULL_CHARACTER:{this.onNullCharacter(e);break}case fe.COMMENT:{this.onComment(e);break}case fe.DOCTYPE:{this.onDoctype(e);break}case fe.START_TAG:{this._processStartTag(e);break}case fe.END_TAG:{this.onEndTag(e);break}case fe.EOF:{this.onEof(e);break}case fe.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(e);break}}}_isIntegrationPoint(e,n,r){const i=this.treeAdapter.getNamespaceURI(n),s=this.treeAdapter.getAttrList(n);return W6(e,i,s,r)}_reconstructActiveFormattingElements(){const e=this.activeFormattingElements.entries.length;if(e){const n=this.activeFormattingElements.entries.findIndex(i=>i.type===Mn.Marker||this.openElements.contains(i.element)),r=n===-1?e-1:n-1;for(let i=r;i>=0;i--){const s=this.activeFormattingElements.entries[i];this._insertElement(s.token,this.treeAdapter.getNamespaceURI(s.element)),s.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=T.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(m.P),this.openElements.popUntilTagNamePopped(m.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(e===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case m.TR:{this.insertionMode=T.IN_ROW;return}case m.TBODY:case m.THEAD:case m.TFOOT:{this.insertionMode=T.IN_TABLE_BODY;return}case m.CAPTION:{this.insertionMode=T.IN_CAPTION;return}case m.COLGROUP:{this.insertionMode=T.IN_COLUMN_GROUP;return}case m.TABLE:{this.insertionMode=T.IN_TABLE;return}case m.BODY:{this.insertionMode=T.IN_BODY;return}case m.FRAMESET:{this.insertionMode=T.IN_FRAMESET;return}case m.SELECT:{this._resetInsertionModeForSelect(e);return}case m.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case m.HTML:{this.insertionMode=this.headElement?T.AFTER_HEAD:T.BEFORE_HEAD;return}case m.TD:case m.TH:{if(e>0){this.insertionMode=T.IN_CELL;return}break}case m.HEAD:{if(e>0){this.insertionMode=T.IN_HEAD;return}break}}this.insertionMode=T.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let n=e-1;n>0;n--){const r=this.openElements.tagIDs[n];if(r===m.TEMPLATE)break;if(r===m.TABLE){this.insertionMode=T.IN_SELECT_IN_TABLE;return}}this.insertionMode=T.IN_SELECT}_isElementCausesFosterParenting(e){return bC.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){const n=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case m.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===R.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case m.TABLE:{const r=this.treeAdapter.getParentNode(n);return r?{parent:r,beforeElement:n}:{parent:this.openElements.items[e-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){const n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,e,n.beforeElement):this.treeAdapter.appendChild(n.parent,e)}_isSpecialElement(e,n){const r=this.treeAdapter.getNamespaceURI(e);return g6[r].has(n)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){A4(this,e);return}switch(this.insertionMode){case T.INITIAL:{Ws(this,e);break}case T.BEFORE_HTML:{po(this,e);break}case T.BEFORE_HEAD:{mo(this,e);break}case T.IN_HEAD:{go(this,e);break}case T.IN_HEAD_NO_SCRIPT:{bo(this,e);break}case T.AFTER_HEAD:{yo(this,e);break}case T.IN_BODY:case T.IN_CAPTION:case T.IN_CELL:case T.IN_TEMPLATE:{kC(this,e);break}case T.TEXT:case T.IN_SELECT:case T.IN_SELECT_IN_TABLE:{this._insertCharacters(e);break}case T.IN_TABLE:case T.IN_TABLE_BODY:case T.IN_ROW:{pd(this,e);break}case T.IN_TABLE_TEXT:{AC(this,e);break}case T.IN_COLUMN_GROUP:{tc(this,e);break}case T.AFTER_BODY:{nc(this,e);break}case T.AFTER_AFTER_BODY:{yl(this,e);break}}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){x4(this,e);return}switch(this.insertionMode){case T.INITIAL:{Ws(this,e);break}case T.BEFORE_HTML:{po(this,e);break}case T.BEFORE_HEAD:{mo(this,e);break}case T.IN_HEAD:{go(this,e);break}case T.IN_HEAD_NO_SCRIPT:{bo(this,e);break}case T.AFTER_HEAD:{yo(this,e);break}case T.TEXT:{this._insertCharacters(e);break}case T.IN_TABLE:case T.IN_TABLE_BODY:case T.IN_ROW:{pd(this,e);break}case T.IN_COLUMN_GROUP:{tc(this,e);break}case T.AFTER_BODY:{nc(this,e);break}case T.AFTER_AFTER_BODY:{yl(this,e);break}}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML){$h(this,e);return}switch(this.insertionMode){case T.INITIAL:case T.BEFORE_HTML:case T.BEFORE_HEAD:case T.IN_HEAD:case T.IN_HEAD_NO_SCRIPT:case T.AFTER_HEAD:case T.IN_BODY:case T.IN_TABLE:case T.IN_CAPTION:case T.IN_COLUMN_GROUP:case T.IN_TABLE_BODY:case T.IN_ROW:case T.IN_CELL:case T.IN_SELECT:case T.IN_SELECT_IN_TABLE:case T.IN_TEMPLATE:case T.IN_FRAMESET:case T.AFTER_FRAMESET:{$h(this,e);break}case T.IN_TABLE_TEXT:{Ys(this,e);break}case T.AFTER_BODY:{rP(this,e);break}case T.AFTER_AFTER_BODY:case T.AFTER_AFTER_FRAMESET:{iP(this,e);break}}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case T.INITIAL:{sP(this,e);break}case T.BEFORE_HEAD:case T.IN_HEAD:case T.IN_HEAD_NO_SCRIPT:case T.AFTER_HEAD:{this._err(e,O.misplacedDoctype);break}case T.IN_TABLE_TEXT:{Ys(this,e);break}}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,O.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?_4(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case T.INITIAL:{Ws(this,e);break}case T.BEFORE_HTML:{oP(this,e);break}case T.BEFORE_HEAD:{lP(this,e);break}case T.IN_HEAD:{wn(this,e);break}case T.IN_HEAD_NO_SCRIPT:{dP(this,e);break}case T.AFTER_HEAD:{fP(this,e);break}case T.IN_BODY:{mt(this,e);break}case T.IN_TABLE:{xs(this,e);break}case T.IN_TABLE_TEXT:{Ys(this,e);break}case T.IN_CAPTION:{c4(this,e);break}case T.IN_COLUMN_GROUP:{jp(this,e);break}case T.IN_TABLE_BODY:{ku(this,e);break}case T.IN_ROW:{Tu(this,e);break}case T.IN_CELL:{h4(this,e);break}case T.IN_SELECT:{IC(this,e);break}case T.IN_SELECT_IN_TABLE:{p4(this,e);break}case T.IN_TEMPLATE:{g4(this,e);break}case T.AFTER_BODY:{y4(this,e);break}case T.IN_FRAMESET:{E4(this,e);break}case T.AFTER_FRAMESET:{T4(this,e);break}case T.AFTER_AFTER_BODY:{S4(this,e);break}case T.AFTER_AFTER_FRAMESET:{w4(this,e);break}}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?N4(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case T.INITIAL:{Ws(this,e);break}case T.BEFORE_HTML:{aP(this,e);break}case T.BEFORE_HEAD:{cP(this,e);break}case T.IN_HEAD:{uP(this,e);break}case T.IN_HEAD_NO_SCRIPT:{hP(this,e);break}case T.AFTER_HEAD:{pP(this,e);break}case T.IN_BODY:{Eu(this,e);break}case T.TEXT:{ZP(this,e);break}case T.IN_TABLE:{ta(this,e);break}case T.IN_TABLE_TEXT:{Ys(this,e);break}case T.IN_CAPTION:{u4(this,e);break}case T.IN_COLUMN_GROUP:{d4(this,e);break}case T.IN_TABLE_BODY:{zh(this,e);break}case T.IN_ROW:{NC(this,e);break}case T.IN_CELL:{f4(this,e);break}case T.IN_SELECT:{OC(this,e);break}case T.IN_SELECT_IN_TABLE:{m4(this,e);break}case T.IN_TEMPLATE:{b4(this,e);break}case T.AFTER_BODY:{vC(this,e);break}case T.IN_FRAMESET:{k4(this,e);break}case T.AFTER_FRAMESET:{C4(this,e);break}case T.AFTER_AFTER_BODY:{yl(this,e);break}}}onEof(e){switch(this.insertionMode){case T.INITIAL:{Ws(this,e);break}case T.BEFORE_HTML:{po(this,e);break}case T.BEFORE_HEAD:{mo(this,e);break}case T.IN_HEAD:{go(this,e);break}case T.IN_HEAD_NO_SCRIPT:{bo(this,e);break}case T.AFTER_HEAD:{yo(this,e);break}case T.IN_BODY:case T.IN_TABLE:case T.IN_CAPTION:case T.IN_COLUMN_GROUP:case T.IN_TABLE_BODY:case T.IN_ROW:case T.IN_CELL:case T.IN_SELECT:case T.IN_SELECT_IN_TABLE:{wC(this,e);break}case T.TEXT:{e4(this,e);break}case T.IN_TABLE_TEXT:{Ys(this,e);break}case T.IN_TEMPLATE:{MC(this,e);break}case T.AFTER_BODY:case T.IN_FRAMESET:case T.AFTER_FRAMESET:case T.AFTER_AFTER_BODY:case T.AFTER_AFTER_FRAMESET:{Vp(this,e);break}}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===E.LINE_FEED)){if(e.chars.length===1)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(e);return}switch(this.insertionMode){case T.IN_HEAD:case T.IN_HEAD_NO_SCRIPT:case T.AFTER_HEAD:case T.TEXT:case T.IN_COLUMN_GROUP:case T.IN_SELECT:case T.IN_SELECT_IN_TABLE:case T.IN_FRAMESET:case T.AFTER_FRAMESET:{this._insertCharacters(e);break}case T.IN_BODY:case T.IN_CAPTION:case T.IN_CELL:case T.IN_TEMPLATE:case T.AFTER_BODY:case T.AFTER_AFTER_BODY:case T.AFTER_AFTER_FRAMESET:{EC(this,e);break}case T.IN_TABLE:case T.IN_TABLE_BODY:case T.IN_ROW:{pd(this,e);break}case T.IN_TABLE_TEXT:{xC(this,e);break}}}}function J6(t,e){let n=t.activeFormattingElements.getElementEntryInScopeWithTagName(e.tagName);return n?t.openElements.contains(n.element)?t.openElements.hasInScope(e.tagID)||(n=null):(t.activeFormattingElements.removeEntry(n),n=null):SC(t,e),n}function X6(t,e){let n=null,r=t.openElements.stackTop;for(;r>=0;r--){const i=t.openElements.items[r];if(i===e.element)break;t._isSpecialElement(i,t.openElements.tagIDs[r])&&(n=i)}return n||(t.openElements.shortenToLength(Math.max(r,0)),t.activeFormattingElements.removeEntry(e)),n}function Z6(t,e,n){let r=e,i=t.openElements.getCommonAncestor(e);for(let s=0,o=i;o!==n;s++,o=i){i=t.openElements.getCommonAncestor(o);const a=t.activeFormattingElements.getElementEntry(o),l=a&&s>=G6;!a||l?(l&&t.activeFormattingElements.removeEntry(a),t.openElements.remove(o)):(o=eP(t,a),r===e&&(t.activeFormattingElements.bookmark=a),t.treeAdapter.detachNode(r),t.treeAdapter.appendChild(o,r),r=o)}return r}function eP(t,e){const n=t.treeAdapter.getNamespaceURI(e.element),r=t.treeAdapter.createElement(e.token.tagName,n,e.token.attrs);return t.openElements.replace(e.element,r),e.element=r,r}function tP(t,e,n){const r=t.treeAdapter.getTagName(e),i=bu(r);if(t._isElementCausesFosterParenting(i))t._fosterParentElement(n);else{const s=t.treeAdapter.getNamespaceURI(e);i===m.TEMPLATE&&s===R.HTML&&(e=t.treeAdapter.getTemplateContent(e)),t.treeAdapter.appendChild(e,n)}}function nP(t,e,n){const r=t.treeAdapter.getNamespaceURI(n.element),{token:i}=n,s=t.treeAdapter.createElement(i.tagName,r,i.attrs);t._adoptNodes(e,s),t.treeAdapter.appendChild(e,s),t.activeFormattingElements.insertElementAfterBookmark(s,i),t.activeFormattingElements.removeEntry(n),t.openElements.remove(n.element),t.openElements.insertAfter(e,s,i.tagID)}function zp(t,e){for(let n=0;n<K6;n++){const r=J6(t,e);if(!r)break;const i=X6(t,r);if(!i)break;t.activeFormattingElements.bookmark=r;const s=Z6(t,i,r.element),o=t.openElements.getCommonAncestor(r.element);t.treeAdapter.detachNode(s),o&&tP(t,o,s),nP(t,i,r)}}function $h(t,e){t._appendCommentNode(e,t.openElements.currentTmplContentOrNode)}function rP(t,e){t._appendCommentNode(e,t.openElements.items[0])}function iP(t,e){t._appendCommentNode(e,t.document)}function Vp(t,e){if(t.stopped=!0,e.location){const n=t.fragmentContext?0:2;for(let r=t.openElements.stackTop;r>=n;r--)t._setEndLocation(t.openElements.items[r],e);if(!t.fragmentContext&&t.openElements.stackTop>=0){const r=t.openElements.items[0],i=t.treeAdapter.getNodeSourceCodeLocation(r);if(i&&!i.endTag&&(t._setEndLocation(r,e),t.openElements.stackTop>=1)){const s=t.openElements.items[1],o=t.treeAdapter.getNodeSourceCodeLocation(s);o&&!o.endTag&&t._setEndLocation(s,e)}}}}function sP(t,e){t._setDocumentType(e);const n=e.forceQuirks?Kt.QUIRKS:R6(e);L6(e)||t._err(e,O.nonConformingDoctype),t.treeAdapter.setDocumentMode(t.document,n),t.insertionMode=T.BEFORE_HTML}function Ws(t,e){t._err(e,O.missingDoctype,!0),t.treeAdapter.setDocumentMode(t.document,Kt.QUIRKS),t.insertionMode=T.BEFORE_HTML,t._processToken(e)}function oP(t,e){e.tagID===m.HTML?(t._insertElement(e,R.HTML),t.insertionMode=T.BEFORE_HEAD):po(t,e)}function aP(t,e){const n=e.tagID;(n===m.HTML||n===m.HEAD||n===m.BODY||n===m.BR)&&po(t,e)}function po(t,e){t._insertFakeRootElement(),t.insertionMode=T.BEFORE_HEAD,t._processToken(e)}function lP(t,e){switch(e.tagID){case m.HTML:{mt(t,e);break}case m.HEAD:{t._insertElement(e,R.HTML),t.headElement=t.openElements.current,t.insertionMode=T.IN_HEAD;break}default:mo(t,e)}}function cP(t,e){const n=e.tagID;n===m.HEAD||n===m.BODY||n===m.HTML||n===m.BR?mo(t,e):t._err(e,O.endTagWithoutMatchingOpenElement)}function mo(t,e){t._insertFakeElement(N.HEAD,m.HEAD),t.headElement=t.openElements.current,t.insertionMode=T.IN_HEAD,t._processToken(e)}function wn(t,e){switch(e.tagID){case m.HTML:{mt(t,e);break}case m.BASE:case m.BASEFONT:case m.BGSOUND:case m.LINK:case m.META:{t._appendElement(e,R.HTML),e.ackSelfClosing=!0;break}case m.TITLE:{t._switchToTextParsing(e,It.RCDATA);break}case m.NOSCRIPT:{t.options.scriptingEnabled?t._switchToTextParsing(e,It.RAWTEXT):(t._insertElement(e,R.HTML),t.insertionMode=T.IN_HEAD_NO_SCRIPT);break}case m.NOFRAMES:case m.STYLE:{t._switchToTextParsing(e,It.RAWTEXT);break}case m.SCRIPT:{t._switchToTextParsing(e,It.SCRIPT_DATA);break}case m.TEMPLATE:{t._insertTemplate(e),t.activeFormattingElements.insertMarker(),t.framesetOk=!1,t.insertionMode=T.IN_TEMPLATE,t.tmplInsertionModeStack.unshift(T.IN_TEMPLATE);break}case m.HEAD:{t._err(e,O.misplacedStartTagForHeadElement);break}default:go(t,e)}}function uP(t,e){switch(e.tagID){case m.HEAD:{t.openElements.pop(),t.insertionMode=T.AFTER_HEAD;break}case m.BODY:case m.BR:case m.HTML:{go(t,e);break}case m.TEMPLATE:{Li(t,e);break}default:t._err(e,O.endTagWithoutMatchingOpenElement)}}function Li(t,e){t.openElements.tmplCount>0?(t.openElements.generateImpliedEndTagsThoroughly(),t.openElements.currentTagId!==m.TEMPLATE&&t._err(e,O.closingOfElementWithOpenChildElements),t.openElements.popUntilTagNamePopped(m.TEMPLATE),t.activeFormattingElements.clearToLastMarker(),t.tmplInsertionModeStack.shift(),t._resetInsertionMode()):t._err(e,O.endTagWithoutMatchingOpenElement)}function go(t,e){t.openElements.pop(),t.insertionMode=T.AFTER_HEAD,t._processToken(e)}function dP(t,e){switch(e.tagID){case m.HTML:{mt(t,e);break}case m.BASEFONT:case m.BGSOUND:case m.HEAD:case m.LINK:case m.META:case m.NOFRAMES:case m.STYLE:{wn(t,e);break}case m.NOSCRIPT:{t._err(e,O.nestedNoscriptInHead);break}default:bo(t,e)}}function hP(t,e){switch(e.tagID){case m.NOSCRIPT:{t.openElements.pop(),t.insertionMode=T.IN_HEAD;break}case m.BR:{bo(t,e);break}default:t._err(e,O.endTagWithoutMatchingOpenElement)}}function bo(t,e){const n=e.type===fe.EOF?O.openElementsLeftAfterEof:O.disallowedContentInNoscriptInHead;t._err(e,n),t.openElements.pop(),t.insertionMode=T.IN_HEAD,t._processToken(e)}function fP(t,e){switch(e.tagID){case m.HTML:{mt(t,e);break}case m.BODY:{t._insertElement(e,R.HTML),t.framesetOk=!1,t.insertionMode=T.IN_BODY;break}case m.FRAMESET:{t._insertElement(e,R.HTML),t.insertionMode=T.IN_FRAMESET;break}case m.BASE:case m.BASEFONT:case m.BGSOUND:case m.LINK:case m.META:case m.NOFRAMES:case m.SCRIPT:case m.STYLE:case m.TEMPLATE:case m.TITLE:{t._err(e,O.abandonedHeadElementChild),t.openElements.push(t.headElement,m.HEAD),wn(t,e),t.openElements.remove(t.headElement);break}case m.HEAD:{t._err(e,O.misplacedStartTagForHeadElement);break}default:yo(t,e)}}function pP(t,e){switch(e.tagID){case m.BODY:case m.HTML:case m.BR:{yo(t,e);break}case m.TEMPLATE:{Li(t,e);break}default:t._err(e,O.endTagWithoutMatchingOpenElement)}}function yo(t,e){t._insertFakeElement(N.BODY,m.BODY),t.insertionMode=T.IN_BODY,yu(t,e)}function yu(t,e){switch(e.type){case fe.CHARACTER:{kC(t,e);break}case fe.WHITESPACE_CHARACTER:{EC(t,e);break}case fe.COMMENT:{$h(t,e);break}case fe.START_TAG:{mt(t,e);break}case fe.END_TAG:{Eu(t,e);break}case fe.EOF:{wC(t,e);break}}}function EC(t,e){t._reconstructActiveFormattingElements(),t._insertCharacters(e)}function kC(t,e){t._reconstructActiveFormattingElements(),t._insertCharacters(e),t.framesetOk=!1}function mP(t,e){t.openElements.tmplCount===0&&t.treeAdapter.adoptAttributes(t.openElements.items[0],e.attrs)}function gP(t,e){const n=t.openElements.tryPeekProperlyNestedBodyElement();n&&t.openElements.tmplCount===0&&(t.framesetOk=!1,t.treeAdapter.adoptAttributes(n,e.attrs))}function bP(t,e){const n=t.openElements.tryPeekProperlyNestedBodyElement();t.framesetOk&&n&&(t.treeAdapter.detachNode(n),t.openElements.popAllUpToHtmlElement(),t._insertElement(e,R.HTML),t.insertionMode=T.IN_FRAMESET)}function yP(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,R.HTML)}function EP(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t.openElements.currentTagId!==void 0&&Uh.has(t.openElements.currentTagId)&&t.openElements.pop(),t._insertElement(e,R.HTML)}function kP(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,R.HTML),t.skipNextNewLine=!0,t.framesetOk=!1}function TP(t,e){const n=t.openElements.tmplCount>0;(!t.formElement||n)&&(t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,R.HTML),n||(t.formElement=t.openElements.current))}function CP(t,e){t.framesetOk=!1;const n=e.tagID;for(let r=t.openElements.stackTop;r>=0;r--){const i=t.openElements.tagIDs[r];if(n===m.LI&&i===m.LI||(n===m.DD||n===m.DT)&&(i===m.DD||i===m.DT)){t.openElements.generateImpliedEndTagsWithExclusion(i),t.openElements.popUntilTagNamePopped(i);break}if(i!==m.ADDRESS&&i!==m.DIV&&i!==m.P&&t._isSpecialElement(t.openElements.items[r],i))break}t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,R.HTML)}function SP(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,R.HTML),t.tokenizer.state=It.PLAINTEXT}function wP(t,e){t.openElements.hasInScope(m.BUTTON)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(m.BUTTON)),t._reconstructActiveFormattingElements(),t._insertElement(e,R.HTML),t.framesetOk=!1}function xP(t,e){const n=t.activeFormattingElements.getElementEntryInScopeWithTagName(N.A);n&&(zp(t,e),t.openElements.remove(n.element),t.activeFormattingElements.removeEntry(n)),t._reconstructActiveFormattingElements(),t._insertElement(e,R.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}function AP(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,R.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}function _P(t,e){t._reconstructActiveFormattingElements(),t.openElements.hasInScope(m.NOBR)&&(zp(t,e),t._reconstructActiveFormattingElements()),t._insertElement(e,R.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}function NP(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,R.HTML),t.activeFormattingElements.insertMarker(),t.framesetOk=!1}function IP(t,e){t.treeAdapter.getDocumentMode(t.document)!==Kt.QUIRKS&&t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,R.HTML),t.framesetOk=!1,t.insertionMode=T.IN_TABLE}function TC(t,e){t._reconstructActiveFormattingElements(),t._appendElement(e,R.HTML),t.framesetOk=!1,e.ackSelfClosing=!0}function CC(t){const e=cC(t,di.TYPE);return e!=null&&e.toLowerCase()===Y6}function OP(t,e){t._reconstructActiveFormattingElements(),t._appendElement(e,R.HTML),CC(e)||(t.framesetOk=!1),e.ackSelfClosing=!0}function MP(t,e){t._appendElement(e,R.HTML),e.ackSelfClosing=!0}function vP(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._appendElement(e,R.HTML),t.framesetOk=!1,e.ackSelfClosing=!0}function DP(t,e){e.tagName=N.IMG,e.tagID=m.IMG,TC(t,e)}function LP(t,e){t._insertElement(e,R.HTML),t.skipNextNewLine=!0,t.tokenizer.state=It.RCDATA,t.originalInsertionMode=t.insertionMode,t.framesetOk=!1,t.insertionMode=T.TEXT}function RP(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._reconstructActiveFormattingElements(),t.framesetOk=!1,t._switchToTextParsing(e,It.RAWTEXT)}function PP(t,e){t.framesetOk=!1,t._switchToTextParsing(e,It.RAWTEXT)}function nb(t,e){t._switchToTextParsing(e,It.RAWTEXT)}function BP(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,R.HTML),t.framesetOk=!1,t.insertionMode=t.insertionMode===T.IN_TABLE||t.insertionMode===T.IN_CAPTION||t.insertionMode===T.IN_TABLE_BODY||t.insertionMode===T.IN_ROW||t.insertionMode===T.IN_CELL?T.IN_SELECT_IN_TABLE:T.IN_SELECT}function FP(t,e){t.openElements.currentTagId===m.OPTION&&t.openElements.pop(),t._reconstructActiveFormattingElements(),t._insertElement(e,R.HTML)}function HP(t,e){t.openElements.hasInScope(m.RUBY)&&t.openElements.generateImpliedEndTags(),t._insertElement(e,R.HTML)}function UP(t,e){t.openElements.hasInScope(m.RUBY)&&t.openElements.generateImpliedEndTagsWithExclusion(m.RTC),t._insertElement(e,R.HTML)}function $P(t,e){t._reconstructActiveFormattingElements(),mC(e),$p(e),e.selfClosing?t._appendElement(e,R.MATHML):t._insertElement(e,R.MATHML),e.ackSelfClosing=!0}function zP(t,e){t._reconstructActiveFormattingElements(),gC(e),$p(e),e.selfClosing?t._appendElement(e,R.SVG):t._insertElement(e,R.SVG),e.ackSelfClosing=!0}function rb(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,R.HTML)}function mt(t,e){switch(e.tagID){case m.I:case m.S:case m.B:case m.U:case m.EM:case m.TT:case m.BIG:case m.CODE:case m.FONT:case m.SMALL:case m.STRIKE:case m.STRONG:{AP(t,e);break}case m.A:{xP(t,e);break}case m.H1:case m.H2:case m.H3:case m.H4:case m.H5:case m.H6:{EP(t,e);break}case m.P:case m.DL:case m.OL:case m.UL:case m.DIV:case m.DIR:case m.NAV:case m.MAIN:case m.MENU:case m.ASIDE:case m.CENTER:case m.FIGURE:case m.FOOTER:case m.HEADER:case m.HGROUP:case m.DIALOG:case m.DETAILS:case m.ADDRESS:case m.ARTICLE:case m.SEARCH:case m.SECTION:case m.SUMMARY:case m.FIELDSET:case m.BLOCKQUOTE:case m.FIGCAPTION:{yP(t,e);break}case m.LI:case m.DD:case m.DT:{CP(t,e);break}case m.BR:case m.IMG:case m.WBR:case m.AREA:case m.EMBED:case m.KEYGEN:{TC(t,e);break}case m.HR:{vP(t,e);break}case m.RB:case m.RTC:{HP(t,e);break}case m.RT:case m.RP:{UP(t,e);break}case m.PRE:case m.LISTING:{kP(t,e);break}case m.XMP:{RP(t,e);break}case m.SVG:{zP(t,e);break}case m.HTML:{mP(t,e);break}case m.BASE:case m.LINK:case m.META:case m.STYLE:case m.TITLE:case m.SCRIPT:case m.BGSOUND:case m.BASEFONT:case m.TEMPLATE:{wn(t,e);break}case m.BODY:{gP(t,e);break}case m.FORM:{TP(t,e);break}case m.NOBR:{_P(t,e);break}case m.MATH:{$P(t,e);break}case m.TABLE:{IP(t,e);break}case m.INPUT:{OP(t,e);break}case m.PARAM:case m.TRACK:case m.SOURCE:{MP(t,e);break}case m.IMAGE:{DP(t,e);break}case m.BUTTON:{wP(t,e);break}case m.APPLET:case m.OBJECT:case m.MARQUEE:{NP(t,e);break}case m.IFRAME:{PP(t,e);break}case m.SELECT:{BP(t,e);break}case m.OPTION:case m.OPTGROUP:{FP(t,e);break}case m.NOEMBED:case m.NOFRAMES:{nb(t,e);break}case m.FRAMESET:{bP(t,e);break}case m.TEXTAREA:{LP(t,e);break}case m.NOSCRIPT:{t.options.scriptingEnabled?nb(t,e):rb(t,e);break}case m.PLAINTEXT:{SP(t,e);break}case m.COL:case m.TH:case m.TD:case m.TR:case m.HEAD:case m.FRAME:case m.TBODY:case m.TFOOT:case m.THEAD:case m.CAPTION:case m.COLGROUP:break;default:rb(t,e)}}function VP(t,e){if(t.openElements.hasInScope(m.BODY)&&(t.insertionMode=T.AFTER_BODY,t.options.sourceCodeLocationInfo)){const n=t.openElements.tryPeekProperlyNestedBodyElement();n&&t._setEndLocation(n,e)}}function jP(t,e){t.openElements.hasInScope(m.BODY)&&(t.insertionMode=T.AFTER_BODY,vC(t,e))}function qP(t,e){const n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(n))}function WP(t){const e=t.openElements.tmplCount>0,{formElement:n}=t;e||(t.formElement=null),(n||e)&&t.openElements.hasInScope(m.FORM)&&(t.openElements.generateImpliedEndTags(),e?t.openElements.popUntilTagNamePopped(m.FORM):n&&t.openElements.remove(n))}function YP(t){t.openElements.hasInButtonScope(m.P)||t._insertFakeElement(N.P,m.P),t._closePElement()}function KP(t){t.openElements.hasInListItemScope(m.LI)&&(t.openElements.generateImpliedEndTagsWithExclusion(m.LI),t.openElements.popUntilTagNamePopped(m.LI))}function GP(t,e){const n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTagsWithExclusion(n),t.openElements.popUntilTagNamePopped(n))}function QP(t){t.openElements.hasNumberedHeaderInScope()&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilNumberedHeaderPopped())}function JP(t,e){const n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(n),t.activeFormattingElements.clearToLastMarker())}function XP(t){t._reconstructActiveFormattingElements(),t._insertFakeElement(N.BR,m.BR),t.openElements.pop(),t.framesetOk=!1}function SC(t,e){const n=e.tagName,r=e.tagID;for(let i=t.openElements.stackTop;i>0;i--){const s=t.openElements.items[i],o=t.openElements.tagIDs[i];if(r===o&&(r!==m.UNKNOWN||t.treeAdapter.getTagName(s)===n)){t.openElements.generateImpliedEndTagsWithExclusion(r),t.openElements.stackTop>=i&&t.openElements.shortenToLength(i);break}if(t._isSpecialElement(s,o))break}}function Eu(t,e){switch(e.tagID){case m.A:case m.B:case m.I:case m.S:case m.U:case m.EM:case m.TT:case m.BIG:case m.CODE:case m.FONT:case m.NOBR:case m.SMALL:case m.STRIKE:case m.STRONG:{zp(t,e);break}case m.P:{YP(t);break}case m.DL:case m.UL:case m.OL:case m.DIR:case m.DIV:case m.NAV:case m.PRE:case m.MAIN:case m.MENU:case m.ASIDE:case m.BUTTON:case m.CENTER:case m.FIGURE:case m.FOOTER:case m.HEADER:case m.HGROUP:case m.DIALOG:case m.ADDRESS:case m.ARTICLE:case m.DETAILS:case m.SEARCH:case m.SECTION:case m.SUMMARY:case m.LISTING:case m.FIELDSET:case m.BLOCKQUOTE:case m.FIGCAPTION:{qP(t,e);break}case m.LI:{KP(t);break}case m.DD:case m.DT:{GP(t,e);break}case m.H1:case m.H2:case m.H3:case m.H4:case m.H5:case m.H6:{QP(t);break}case m.BR:{XP(t);break}case m.BODY:{VP(t,e);break}case m.HTML:{jP(t,e);break}case m.FORM:{WP(t);break}case m.APPLET:case m.OBJECT:case m.MARQUEE:{JP(t,e);break}case m.TEMPLATE:{Li(t,e);break}default:SC(t,e)}}function wC(t,e){t.tmplInsertionModeStack.length>0?MC(t,e):Vp(t,e)}function ZP(t,e){var n;e.tagID===m.SCRIPT&&((n=t.scriptHandler)===null||n===void 0||n.call(t,t.openElements.current)),t.openElements.pop(),t.insertionMode=t.originalInsertionMode}function e4(t,e){t._err(e,O.eofInElementThatCanContainOnlyText),t.openElements.pop(),t.insertionMode=t.originalInsertionMode,t.onEof(e)}function pd(t,e){if(t.openElements.currentTagId!==void 0&&bC.has(t.openElements.currentTagId))switch(t.pendingCharacterTokens.length=0,t.hasNonWhitespacePendingCharacterToken=!1,t.originalInsertionMode=t.insertionMode,t.insertionMode=T.IN_TABLE_TEXT,e.type){case fe.CHARACTER:{AC(t,e);break}case fe.WHITESPACE_CHARACTER:{xC(t,e);break}}else ya(t,e)}function t4(t,e){t.openElements.clearBackToTableContext(),t.activeFormattingElements.insertMarker(),t._insertElement(e,R.HTML),t.insertionMode=T.IN_CAPTION}function n4(t,e){t.openElements.clearBackToTableContext(),t._insertElement(e,R.HTML),t.insertionMode=T.IN_COLUMN_GROUP}function r4(t,e){t.openElements.clearBackToTableContext(),t._insertFakeElement(N.COLGROUP,m.COLGROUP),t.insertionMode=T.IN_COLUMN_GROUP,jp(t,e)}function i4(t,e){t.openElements.clearBackToTableContext(),t._insertElement(e,R.HTML),t.insertionMode=T.IN_TABLE_BODY}function s4(t,e){t.openElements.clearBackToTableContext(),t._insertFakeElement(N.TBODY,m.TBODY),t.insertionMode=T.IN_TABLE_BODY,ku(t,e)}function o4(t,e){t.openElements.hasInTableScope(m.TABLE)&&(t.openElements.popUntilTagNamePopped(m.TABLE),t._resetInsertionMode(),t._processStartTag(e))}function a4(t,e){CC(e)?t._appendElement(e,R.HTML):ya(t,e),e.ackSelfClosing=!0}function l4(t,e){!t.formElement&&t.openElements.tmplCount===0&&(t._insertElement(e,R.HTML),t.formElement=t.openElements.current,t.openElements.pop())}function xs(t,e){switch(e.tagID){case m.TD:case m.TH:case m.TR:{s4(t,e);break}case m.STYLE:case m.SCRIPT:case m.TEMPLATE:{wn(t,e);break}case m.COL:{r4(t,e);break}case m.FORM:{l4(t,e);break}case m.TABLE:{o4(t,e);break}case m.TBODY:case m.TFOOT:case m.THEAD:{i4(t,e);break}case m.INPUT:{a4(t,e);break}case m.CAPTION:{t4(t,e);break}case m.COLGROUP:{n4(t,e);break}default:ya(t,e)}}function ta(t,e){switch(e.tagID){case m.TABLE:{t.openElements.hasInTableScope(m.TABLE)&&(t.openElements.popUntilTagNamePopped(m.TABLE),t._resetInsertionMode());break}case m.TEMPLATE:{Li(t,e);break}case m.BODY:case m.CAPTION:case m.COL:case m.COLGROUP:case m.HTML:case m.TBODY:case m.TD:case m.TFOOT:case m.TH:case m.THEAD:case m.TR:break;default:ya(t,e)}}function ya(t,e){const n=t.fosterParentingEnabled;t.fosterParentingEnabled=!0,yu(t,e),t.fosterParentingEnabled=n}function xC(t,e){t.pendingCharacterTokens.push(e)}function AC(t,e){t.pendingCharacterTokens.push(e),t.hasNonWhitespacePendingCharacterToken=!0}function Ys(t,e){let n=0;if(t.hasNonWhitespacePendingCharacterToken)for(;n<t.pendingCharacterTokens.length;n++)ya(t,t.pendingCharacterTokens[n]);else for(;n<t.pendingCharacterTokens.length;n++)t._insertCharacters(t.pendingCharacterTokens[n]);t.insertionMode=t.originalInsertionMode,t._processToken(e)}const _C=new Set([m.CAPTION,m.COL,m.COLGROUP,m.TBODY,m.TD,m.TFOOT,m.TH,m.THEAD,m.TR]);function c4(t,e){const n=e.tagID;_C.has(n)?t.openElements.hasInTableScope(m.CAPTION)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(m.CAPTION),t.activeFormattingElements.clearToLastMarker(),t.insertionMode=T.IN_TABLE,xs(t,e)):mt(t,e)}function u4(t,e){const n=e.tagID;switch(n){case m.CAPTION:case m.TABLE:{t.openElements.hasInTableScope(m.CAPTION)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(m.CAPTION),t.activeFormattingElements.clearToLastMarker(),t.insertionMode=T.IN_TABLE,n===m.TABLE&&ta(t,e));break}case m.BODY:case m.COL:case m.COLGROUP:case m.HTML:case m.TBODY:case m.TD:case m.TFOOT:case m.TH:case m.THEAD:case m.TR:break;default:Eu(t,e)}}function jp(t,e){switch(e.tagID){case m.HTML:{mt(t,e);break}case m.COL:{t._appendElement(e,R.HTML),e.ackSelfClosing=!0;break}case m.TEMPLATE:{wn(t,e);break}default:tc(t,e)}}function d4(t,e){switch(e.tagID){case m.COLGROUP:{t.openElements.currentTagId===m.COLGROUP&&(t.openElements.pop(),t.insertionMode=T.IN_TABLE);break}case m.TEMPLATE:{Li(t,e);break}case m.COL:break;default:tc(t,e)}}function tc(t,e){t.openElements.currentTagId===m.COLGROUP&&(t.openElements.pop(),t.insertionMode=T.IN_TABLE,t._processToken(e))}function ku(t,e){switch(e.tagID){case m.TR:{t.openElements.clearBackToTableBodyContext(),t._insertElement(e,R.HTML),t.insertionMode=T.IN_ROW;break}case m.TH:case m.TD:{t.openElements.clearBackToTableBodyContext(),t._insertFakeElement(N.TR,m.TR),t.insertionMode=T.IN_ROW,Tu(t,e);break}case m.CAPTION:case m.COL:case m.COLGROUP:case m.TBODY:case m.TFOOT:case m.THEAD:{t.openElements.hasTableBodyContextInTableScope()&&(t.openElements.clearBackToTableBodyContext(),t.openElements.pop(),t.insertionMode=T.IN_TABLE,xs(t,e));break}default:xs(t,e)}}function zh(t,e){const n=e.tagID;switch(e.tagID){case m.TBODY:case m.TFOOT:case m.THEAD:{t.openElements.hasInTableScope(n)&&(t.openElements.clearBackToTableBodyContext(),t.openElements.pop(),t.insertionMode=T.IN_TABLE);break}case m.TABLE:{t.openElements.hasTableBodyContextInTableScope()&&(t.openElements.clearBackToTableBodyContext(),t.openElements.pop(),t.insertionMode=T.IN_TABLE,ta(t,e));break}case m.BODY:case m.CAPTION:case m.COL:case m.COLGROUP:case m.HTML:case m.TD:case m.TH:case m.TR:break;default:ta(t,e)}}function Tu(t,e){switch(e.tagID){case m.TH:case m.TD:{t.openElements.clearBackToTableRowContext(),t._insertElement(e,R.HTML),t.insertionMode=T.IN_CELL,t.activeFormattingElements.insertMarker();break}case m.CAPTION:case m.COL:case m.COLGROUP:case m.TBODY:case m.TFOOT:case m.THEAD:case m.TR:{t.openElements.hasInTableScope(m.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=T.IN_TABLE_BODY,ku(t,e));break}default:xs(t,e)}}function NC(t,e){switch(e.tagID){case m.TR:{t.openElements.hasInTableScope(m.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=T.IN_TABLE_BODY);break}case m.TABLE:{t.openElements.hasInTableScope(m.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=T.IN_TABLE_BODY,zh(t,e));break}case m.TBODY:case m.TFOOT:case m.THEAD:{(t.openElements.hasInTableScope(e.tagID)||t.openElements.hasInTableScope(m.TR))&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=T.IN_TABLE_BODY,zh(t,e));break}case m.BODY:case m.CAPTION:case m.COL:case m.COLGROUP:case m.HTML:case m.TD:case m.TH:break;default:ta(t,e)}}function h4(t,e){const n=e.tagID;_C.has(n)?(t.openElements.hasInTableScope(m.TD)||t.openElements.hasInTableScope(m.TH))&&(t._closeTableCell(),Tu(t,e)):mt(t,e)}function f4(t,e){const n=e.tagID;switch(n){case m.TD:case m.TH:{t.openElements.hasInTableScope(n)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(n),t.activeFormattingElements.clearToLastMarker(),t.insertionMode=T.IN_ROW);break}case m.TABLE:case m.TBODY:case m.TFOOT:case m.THEAD:case m.TR:{t.openElements.hasInTableScope(n)&&(t._closeTableCell(),NC(t,e));break}case m.BODY:case m.CAPTION:case m.COL:case m.COLGROUP:case m.HTML:break;default:Eu(t,e)}}function IC(t,e){switch(e.tagID){case m.HTML:{mt(t,e);break}case m.OPTION:{t.openElements.currentTagId===m.OPTION&&t.openElements.pop(),t._insertElement(e,R.HTML);break}case m.OPTGROUP:{t.openElements.currentTagId===m.OPTION&&t.openElements.pop(),t.openElements.currentTagId===m.OPTGROUP&&t.openElements.pop(),t._insertElement(e,R.HTML);break}case m.HR:{t.openElements.currentTagId===m.OPTION&&t.openElements.pop(),t.openElements.currentTagId===m.OPTGROUP&&t.openElements.pop(),t._appendElement(e,R.HTML),e.ackSelfClosing=!0;break}case m.INPUT:case m.KEYGEN:case m.TEXTAREA:case m.SELECT:{t.openElements.hasInSelectScope(m.SELECT)&&(t.openElements.popUntilTagNamePopped(m.SELECT),t._resetInsertionMode(),e.tagID!==m.SELECT&&t._processStartTag(e));break}case m.SCRIPT:case m.TEMPLATE:{wn(t,e);break}}}function OC(t,e){switch(e.tagID){case m.OPTGROUP:{t.openElements.stackTop>0&&t.openElements.currentTagId===m.OPTION&&t.openElements.tagIDs[t.openElements.stackTop-1]===m.OPTGROUP&&t.openElements.pop(),t.openElements.currentTagId===m.OPTGROUP&&t.openElements.pop();break}case m.OPTION:{t.openElements.currentTagId===m.OPTION&&t.openElements.pop();break}case m.SELECT:{t.openElements.hasInSelectScope(m.SELECT)&&(t.openElements.popUntilTagNamePopped(m.SELECT),t._resetInsertionMode());break}case m.TEMPLATE:{Li(t,e);break}}}function p4(t,e){const n=e.tagID;n===m.CAPTION||n===m.TABLE||n===m.TBODY||n===m.TFOOT||n===m.THEAD||n===m.TR||n===m.TD||n===m.TH?(t.openElements.popUntilTagNamePopped(m.SELECT),t._resetInsertionMode(),t._processStartTag(e)):IC(t,e)}function m4(t,e){const n=e.tagID;n===m.CAPTION||n===m.TABLE||n===m.TBODY||n===m.TFOOT||n===m.THEAD||n===m.TR||n===m.TD||n===m.TH?t.openElements.hasInTableScope(n)&&(t.openElements.popUntilTagNamePopped(m.SELECT),t._resetInsertionMode(),t.onEndTag(e)):OC(t,e)}function g4(t,e){switch(e.tagID){case m.BASE:case m.BASEFONT:case m.BGSOUND:case m.LINK:case m.META:case m.NOFRAMES:case m.SCRIPT:case m.STYLE:case m.TEMPLATE:case m.TITLE:{wn(t,e);break}case m.CAPTION:case m.COLGROUP:case m.TBODY:case m.TFOOT:case m.THEAD:{t.tmplInsertionModeStack[0]=T.IN_TABLE,t.insertionMode=T.IN_TABLE,xs(t,e);break}case m.COL:{t.tmplInsertionModeStack[0]=T.IN_COLUMN_GROUP,t.insertionMode=T.IN_COLUMN_GROUP,jp(t,e);break}case m.TR:{t.tmplInsertionModeStack[0]=T.IN_TABLE_BODY,t.insertionMode=T.IN_TABLE_BODY,ku(t,e);break}case m.TD:case m.TH:{t.tmplInsertionModeStack[0]=T.IN_ROW,t.insertionMode=T.IN_ROW,Tu(t,e);break}default:t.tmplInsertionModeStack[0]=T.IN_BODY,t.insertionMode=T.IN_BODY,mt(t,e)}}function b4(t,e){e.tagID===m.TEMPLATE&&Li(t,e)}function MC(t,e){t.openElements.tmplCount>0?(t.openElements.popUntilTagNamePopped(m.TEMPLATE),t.activeFormattingElements.clearToLastMarker(),t.tmplInsertionModeStack.shift(),t._resetInsertionMode(),t.onEof(e)):Vp(t,e)}function y4(t,e){e.tagID===m.HTML?mt(t,e):nc(t,e)}function vC(t,e){var n;if(e.tagID===m.HTML){if(t.fragmentContext||(t.insertionMode=T.AFTER_AFTER_BODY),t.options.sourceCodeLocationInfo&&t.openElements.tagIDs[0]===m.HTML){t._setEndLocation(t.openElements.items[0],e);const r=t.openElements.items[1];r&&!(!((n=t.treeAdapter.getNodeSourceCodeLocation(r))===null||n===void 0)&&n.endTag)&&t._setEndLocation(r,e)}}else nc(t,e)}function nc(t,e){t.insertionMode=T.IN_BODY,yu(t,e)}function E4(t,e){switch(e.tagID){case m.HTML:{mt(t,e);break}case m.FRAMESET:{t._insertElement(e,R.HTML);break}case m.FRAME:{t._appendElement(e,R.HTML),e.ackSelfClosing=!0;break}case m.NOFRAMES:{wn(t,e);break}}}function k4(t,e){e.tagID===m.FRAMESET&&!t.openElements.isRootHtmlElementCurrent()&&(t.openElements.pop(),!t.fragmentContext&&t.openElements.currentTagId!==m.FRAMESET&&(t.insertionMode=T.AFTER_FRAMESET))}function T4(t,e){switch(e.tagID){case m.HTML:{mt(t,e);break}case m.NOFRAMES:{wn(t,e);break}}}function C4(t,e){e.tagID===m.HTML&&(t.insertionMode=T.AFTER_AFTER_FRAMESET)}function S4(t,e){e.tagID===m.HTML?mt(t,e):yl(t,e)}function yl(t,e){t.insertionMode=T.IN_BODY,yu(t,e)}function w4(t,e){switch(e.tagID){case m.HTML:{mt(t,e);break}case m.NOFRAMES:{wn(t,e);break}}}function x4(t,e){e.chars=Oe,t._insertCharacters(e)}function A4(t,e){t._insertCharacters(e),t.framesetOk=!1}function DC(t){for(;t.treeAdapter.getNamespaceURI(t.openElements.current)!==R.HTML&&t.openElements.currentTagId!==void 0&&!t._isIntegrationPoint(t.openElements.currentTagId,t.openElements.current);)t.openElements.pop()}function _4(t,e){if(z6(e))DC(t),t._startTagOutsideForeignContent(e);else{const n=t._getAdjustedCurrentElement(),r=t.treeAdapter.getNamespaceURI(n);r===R.MATHML?mC(e):r===R.SVG&&(V6(e),gC(e)),$p(e),e.selfClosing?t._appendElement(e,r):t._insertElement(e,r),e.ackSelfClosing=!0}}function N4(t,e){if(e.tagID===m.P||e.tagID===m.BR){DC(t),t._endTagOutsideForeignContent(e);return}for(let n=t.openElements.stackTop;n>0;n--){const r=t.openElements.items[n];if(t.treeAdapter.getNamespaceURI(r)===R.HTML){t._endTagOutsideForeignContent(e);break}const i=t.treeAdapter.getTagName(r);if(i.toLowerCase()===e.tagName){e.tagName=i,t.openElements.shortenToLength(n);break}}}N.AREA,N.BASE,N.BASEFONT,N.BGSOUND,N.BR,N.COL,N.EMBED,N.FRAME,N.HR,N.IMG,N.INPUT,N.KEYGEN,N.LINK,N.META,N.PARAM,N.SOURCE,N.TRACK,N.WBR;function I4(t,e){return yC.parse(t,e)}function O4(t,e,n){typeof t=="string"&&(n=e,e=t,t=null);const r=yC.getFragmentParser(t,n);return r.tokenizer.write(e,!0),r.getFragment()}function Eo(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?ib(t.position):"start"in t||"end"in t?ib(t):"line"in t||"column"in t?Vh(t):""}function Vh(t){return sb(t&&t.line)+":"+sb(t&&t.column)}function ib(t){return Vh(t&&t.start)+"-"+Vh(t&&t.end)}function sb(t){return t&&typeof t=="number"?t:1}class Ct extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof e=="string"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=Eo(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ct.prototype.file="";Ct.prototype.name="";Ct.prototype.reason="";Ct.prototype.message="";Ct.prototype.stack="";Ct.prototype.column=void 0;Ct.prototype.line=void 0;Ct.prototype.ancestors=void 0;Ct.prototype.cause=void 0;Ct.prototype.fatal=void 0;Ct.prototype.place=void 0;Ct.prototype.ruleId=void 0;Ct.prototype.source=void 0;const Nn={basename:M4,dirname:v4,extname:D4,join:L4,sep:"/"};function M4(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Ea(t);let n=0,r=-1,i=t.length,s;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let o=-1,a=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),a>-1&&(t.codePointAt(i)===e.codePointAt(a--)?a<0&&(r=i):(a=-1,r=o));return n===r?r=o:r<0&&(r=t.length),t.slice(n,r)}function v4(t){if(Ea(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function D4(t){Ea(t);let e=t.length,n=-1,r=0,i=-1,s=0,o;for(;e--;){const a=t.codePointAt(e);if(a===47){if(o){r=e+1;break}continue}n<0&&(o=!0,n=e+1),a===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function L4(...t){let e=-1,n;for(;++e<t.length;)Ea(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":R4(n)}function R4(t){Ea(t);const e=t.codePointAt(0)===47;let n=P4(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function P4(t,e){let n="",r=0,i=-1,s=0,o=-1,a,l;for(;++o<=t.length;){if(o<t.length)a=t.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,o):n=t.slice(i+1,o),r=o-i-1;i=o,s=0}else a===46&&s>-1?s++:s=-1}return n}function Ea(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const B4={cwd:F4};function F4(){return"/"}function jh(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function H4(t){if(typeof t=="string")t=new URL(t);else if(!jh(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return U4(t)}function U4(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const r=e.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}const md=["history","path","basename","stem","extname","dirname"];class qh{constructor(e){let n;e?jh(e)?n={path:e}:typeof e=="string"||$4(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":B4.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<md.length;){const s=md[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)md.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Nn.basename(this.path):void 0}set basename(e){bd(e,"basename"),gd(e,"basename"),this.path=Nn.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Nn.dirname(this.path):void 0}set dirname(e){ob(this.basename,"dirname"),this.path=Nn.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Nn.extname(this.path):void 0}set extname(e){if(gd(e,"extname"),ob(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Nn.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){jh(e)&&(e=H4(e)),bd(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Nn.basename(this.path,this.extname):void 0}set stem(e){bd(e,"stem"),gd(e,"stem"),this.path=Nn.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){const i=this.message(e,n,r);throw i.fatal=!0,i}info(e,n,r){const i=this.message(e,n,r);return i.fatal=void 0,i}message(e,n,r){const i=new Ct(e,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function gd(t,e){if(t&&t.includes(Nn.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Nn.sep+"`")}function bd(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function ob(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function $4(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const z4={abandonedHeadElementChild:{reason:"Unexpected metadata element after head",description:"Unexpected element after head. Expected the element before `</head>`",url:!1},abruptClosingOfEmptyComment:{reason:"Unexpected abruptly closed empty comment",description:"Unexpected `>` or `->`. Expected `-->` to close comments"},abruptDoctypePublicIdentifier:{reason:"Unexpected abruptly closed public identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the public identifier"},abruptDoctypeSystemIdentifier:{reason:"Unexpected abruptly closed system identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the identifier identifier"},absenceOfDigitsInNumericCharacterReference:{reason:"Unexpected non-digit at start of numeric character reference",description:"Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references"},cdataInHtmlContent:{reason:"Unexpected CDATA section in HTML",description:"Unexpected `<![CDATA[` in HTML. Remove it, use a comment, or encode special characters instead"},characterReferenceOutsideUnicodeRange:{reason:"Unexpected too big numeric character reference",description:"Unexpectedly high character reference. Expected character references to be at most hexadecimal 10ffff (or decimal 1114111)"},closingOfElementWithOpenChildElements:{reason:"Unexpected closing tag with open child elements",description:"Unexpectedly closing tag. Expected other tags to be closed first",url:!1},controlCharacterInInputStream:{reason:"Unexpected control character",description:"Unexpected control character `%x`. Expected a non-control code point, 0x00, or ASCII whitespace"},controlCharacterReference:{reason:"Unexpected control character reference",description:"Unexpectedly control character in reference. Expected a non-control code point, 0x00, or ASCII whitespace"},disallowedContentInNoscriptInHead:{reason:"Disallowed content inside `<noscript>` in `<head>`",description:"Unexpected text character `%c`. Only use text in `<noscript>`s in `<body>`",url:!1},duplicateAttribute:{reason:"Unexpected duplicate attribute",description:"Unexpectedly double attribute. Expected attributes to occur only once"},endTagWithAttributes:{reason:"Unexpected attribute on closing tag",description:"Unexpected attribute. Expected `>` instead"},endTagWithTrailingSolidus:{reason:"Unexpected slash at end of closing tag",description:"Unexpected `%c-1`. Expected `>` instead"},endTagWithoutMatchingOpenElement:{reason:"Unexpected unopened end tag",description:"Unexpected end tag. Expected no end tag or another end tag",url:!1},eofBeforeTagName:{reason:"Unexpected end of file",description:"Unexpected end of file. Expected tag name instead"},eofInCdata:{reason:"Unexpected end of file in CDATA",description:"Unexpected end of file. Expected `]]>` to close the CDATA"},eofInComment:{reason:"Unexpected end of file in comment",description:"Unexpected end of file. Expected `-->` to close the comment"},eofInDoctype:{reason:"Unexpected end of file in doctype",description:"Unexpected end of file. Expected a valid doctype (such as `<!doctype html>`)"},eofInElementThatCanContainOnlyText:{reason:"Unexpected end of file in element that can only contain text",description:"Unexpected end of file. Expected text or a closing tag",url:!1},eofInScriptHtmlCommentLikeText:{reason:"Unexpected end of file in comment inside script",description:"Unexpected end of file. Expected `-->` to close the comment"},eofInTag:{reason:"Unexpected end of file in tag",description:"Unexpected end of file. Expected `>` to close the tag"},incorrectlyClosedComment:{reason:"Incorrectly closed comment",description:"Unexpected `%c-1`. Expected `-->` to close the comment"},incorrectlyOpenedComment:{reason:"Incorrectly opened comment",description:"Unexpected `%c`. Expected `<!--` to open the comment"},invalidCharacterSequenceAfterDoctypeName:{reason:"Invalid sequence after doctype name",description:"Unexpected sequence at `%c`. Expected `public` or `system`"},invalidFirstCharacterOfTagName:{reason:"Invalid first character in tag name",description:"Unexpected `%c`. Expected an ASCII letter instead"},misplacedDoctype:{reason:"Misplaced doctype",description:"Unexpected doctype. Expected doctype before head",url:!1},misplacedStartTagForHeadElement:{reason:"Misplaced `<head>` start tag",description:"Unexpected start tag `<head>`. Expected `<head>` directly after doctype",url:!1},missingAttributeValue:{reason:"Missing attribute value",description:"Unexpected `%c-1`. Expected an attribute value or no `%c-1` instead"},missingDoctype:{reason:"Missing doctype before other content",description:"Expected a `<!doctype html>` before anything else",url:!1},missingDoctypeName:{reason:"Missing doctype name",description:"Unexpected doctype end at `%c`. Expected `html` instead"},missingDoctypePublicIdentifier:{reason:"Missing public identifier in doctype",description:"Unexpected `%c`. Expected identifier for `public` instead"},missingDoctypeSystemIdentifier:{reason:"Missing system identifier in doctype",description:'Unexpected `%c`. Expected identifier for `system` instead (suggested: `"about:legacy-compat"`)'},missingEndTagName:{reason:"Missing name in end tag",description:"Unexpected `%c`. Expected an ASCII letter instead"},missingQuoteBeforeDoctypePublicIdentifier:{reason:"Missing quote before public identifier in doctype",description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingQuoteBeforeDoctypeSystemIdentifier:{reason:"Missing quote before system identifier in doctype",description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingSemicolonAfterCharacterReference:{reason:"Missing semicolon after character reference",description:"Unexpected `%c`. Expected `;` instead"},missingWhitespaceAfterDoctypePublicKeyword:{reason:"Missing whitespace after public identifier in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceAfterDoctypeSystemKeyword:{reason:"Missing whitespace after system identifier in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBeforeDoctypeName:{reason:"Missing whitespace before doctype name",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenAttributes:{reason:"Missing whitespace between attributes",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:{reason:"Missing whitespace between public and system identifiers in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},nestedComment:{reason:"Unexpected nested comment",description:"Unexpected `<!--`. Expected `-->`"},nestedNoscriptInHead:{reason:"Unexpected nested `<noscript>` in `<head>`",description:"Unexpected `<noscript>`. Expected a closing tag or a meta element",url:!1},nonConformingDoctype:{reason:"Unexpected non-conforming doctype declaration",description:'Expected `<!doctype html>` or `<!doctype html system "about:legacy-compat">`',url:!1},nonVoidHtmlElementStartTagWithTrailingSolidus:{reason:"Unexpected trailing slash on start tag of non-void element",description:"Unexpected `/`. Expected `>` instead"},noncharacterCharacterReference:{reason:"Unexpected noncharacter code point referenced by character reference",description:"Unexpected code point. Do not use noncharacters in HTML"},noncharacterInInputStream:{reason:"Unexpected noncharacter character",description:"Unexpected code point `%x`. Do not use noncharacters in HTML"},nullCharacterReference:{reason:"Unexpected NULL character referenced by character reference",description:"Unexpected code point. Do not use NULL characters in HTML"},openElementsLeftAfterEof:{reason:"Unexpected end of file",description:"Unexpected end of file. Expected closing tag instead",url:!1},surrogateCharacterReference:{reason:"Unexpected surrogate character referenced by character reference",description:"Unexpected code point. Do not use lone surrogate characters in HTML"},surrogateInInputStream:{reason:"Unexpected surrogate character",description:"Unexpected code point `%x`. Do not use lone surrogate characters in HTML"},unexpectedCharacterAfterDoctypeSystemIdentifier:{reason:"Invalid character after system identifier in doctype",description:"Unexpected character at `%c`. Expected `>`"},unexpectedCharacterInAttributeName:{reason:"Unexpected character in attribute name",description:"Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter"},unexpectedCharacterInUnquotedAttributeValue:{reason:"Unexpected character in unquoted attribute value",description:"Unexpected `%c`. Quote the attribute value to include it"},unexpectedEqualsSignBeforeAttributeName:{reason:"Unexpected equals sign before attribute name",description:"Unexpected `%c`. Add an attribute name before it"},unexpectedNullCharacter:{reason:"Unexpected NULL character",description:"Unexpected code point `%x`. Do not use NULL characters in HTML"},unexpectedQuestionMarkInsteadOfTagName:{reason:"Unexpected question mark instead of tag name",description:"Unexpected `%c`. Expected an ASCII letter instead"},unexpectedSolidusInTag:{reason:"Unexpected slash in tag",description:"Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value"},unknownNamedCharacterReference:{reason:"Unexpected unknown named character reference",description:"Unexpected character reference. Expected known named character references"}},V4="https://html.spec.whatwg.org/multipage/parsing.html#parse-error-",j4=/-[a-z]/g,q4=/%c(?:([-+])(\d+))?/g,W4=/%x/g,Y4={2:!0,1:!1,0:null},K4={};function G4(t,e){const n=e||K4,r=n.onerror,i=t instanceof qh?t:new qh(t),s=n.fragment?O4:I4,o=String(i),a=s(o,{sourceCodeLocationInfo:!0,onParseError:n.onerror?l:null,scriptingEnabled:!1});return XR(a,{file:i,space:n.space,verbose:n.verbose});function l(c){const u=c.code,d=Q4(u),h=n[d],f=h??!0,p=typeof f=="number"?f:f?1:0;if(p){const b=z4[d],y=new Ct(g(b.reason),{place:{start:{line:c.startLine,column:c.startCol,offset:c.startOffset},end:{line:c.endLine,column:c.endCol,offset:c.endOffset}},ruleId:u,source:"hast-util-from-html"});i.path&&(y.file=i.path,y.name=i.path+":"+y.name),y.fatal=Y4[p],y.note=g(b.description),y.url=b.url===!1?void 0:V4+u,r(y)}function g(b){return b.replace(q4,y).replace(W4,C);function y(S,I,M){const A=(M?Number.parseInt(M,10):0)*(I==="-"?-1:1),D=o.charAt(c.startOffset+A);return X4(D)}function C(){return Z4(o.charCodeAt(c.startOffset))}}}}function Q4(t){return t.replace(j4,J4)}function J4(t){return t.charAt(1).toUpperCase()}function X4(t){return t==="`"?"` ` `":t}function Z4(t){return"0x"+t.toString(16).toUpperCase()}function eB(t){const e=this,{emitParseErrors:n,...r}={...e.data("settings"),...t};e.parser=i;function i(s,o){return G4(s,{...r,onerror:n?function(a){o.path&&(a.name=o.path+":"+a.name,a.file=o.path),o.messages.push(a)}:void 0})}}const LC=-1,Cu=0,ko=1,rc=2,qp=3,Wp=4,Yp=5,Kp=6,RC=7,PC=8,tB=typeof self=="object"?self:globalThis,ab=(t,e)=>{switch(t){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+t)}return new tB[t](e)},nB=(t,e)=>{const n=(i,s)=>(t.set(s,i),i),r=i=>{if(t.has(i))return t.get(i);const[s,o]=e[i];switch(s){case Cu:case LC:return n(o,i);case ko:{const a=n([],i);for(const l of o)a.push(r(l));return a}case rc:{const a=n({},i);for(const[l,c]of o)a[r(l)]=r(c);return a}case qp:return n(new Date(o),i);case Wp:{const{source:a,flags:l}=o;return n(new RegExp(a,l),i)}case Yp:{const a=n(new Map,i);for(const[l,c]of o)a.set(r(l),r(c));return a}case Kp:{const a=n(new Set,i);for(const l of o)a.add(r(l));return a}case RC:{const{name:a,message:l}=o;return n(ab(a,l),i)}case PC:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(ab(s,o),i)};return r},lb=t=>nB(new Map,t)(0),zi="",{toString:rB}={},{keys:iB}=Object,Ks=t=>{const e=typeof t;if(e!=="object"||!t)return[Cu,e];const n=rB.call(t).slice(8,-1);switch(n){case"Array":return[ko,zi];case"Object":return[rc,zi];case"Date":return[qp,zi];case"RegExp":return[Wp,zi];case"Map":return[Yp,zi];case"Set":return[Kp,zi];case"DataView":return[ko,n]}return n.includes("Array")?[ko,n]:n.includes("Error")?[RC,n]:[rc,n]},ja=([t,e])=>t===Cu&&(e==="function"||e==="symbol"),sB=(t,e,n,r)=>{const i=(o,a)=>{const l=r.push(o)-1;return n.set(a,l),l},s=o=>{if(n.has(o))return n.get(o);let[a,l]=Ks(o);switch(a){case Cu:{let u=o;switch(l){case"bigint":a=PC,u=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return i([LC],o)}return i([a,u],o)}case ko:{if(l){let h=o;return l==="DataView"?h=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(h=new Uint8Array(o)),i([l,[...h]],o)}const u=[],d=i([a,u],o);for(const h of o)u.push(s(h));return d}case rc:{if(l)switch(l){case"BigInt":return i([l,o.toString()],o);case"Boolean":case"Number":case"String":return i([l,o.valueOf()],o)}if(e&&"toJSON"in o)return s(o.toJSON());const u=[],d=i([a,u],o);for(const h of iB(o))(t||!ja(Ks(o[h])))&&u.push([s(h),s(o[h])]);return d}case qp:return i([a,o.toISOString()],o);case Wp:{const{source:u,flags:d}=o;return i([a,{source:u,flags:d}],o)}case Yp:{const u=[],d=i([a,u],o);for(const[h,f]of o)(t||!(ja(Ks(h))||ja(Ks(f))))&&u.push([s(h),s(f)]);return d}case Kp:{const u=[],d=i([a,u],o);for(const h of o)(t||!ja(Ks(h)))&&u.push(s(h));return d}}const{message:c}=o;return i([a,{name:l,message:c}],o)};return s},cb=(t,{json:e,lossy:n}={})=>{const r=[];return sB(!(e||n),!!e,new Map,r)(t),r},As=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?lb(cb(t,e)):structuredClone(t):(t,e)=>lb(cb(t,e)),Gp=(function(t,e,n,r,i){const s=xn(e);return BC(t)?s.call(i,t,n,r):!1}),xn=(function(t){if(t==null)return lB;if(typeof t=="string")return aB(t);if(typeof t=="object")return oB(t);if(typeof t=="function")return Qp(t);throw new Error("Expected function, string, or array as `test`")});function oB(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=xn(t[n]);return Qp(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function aB(t){return Qp(e);function e(n){return n.tagName===t}}function Qp(t){return e;function e(n,r,i){return!!(BC(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function lB(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="element"&&"tagName"in t&&typeof t.tagName=="string")}function BC(t){return t!==null&&typeof t=="object"&&"type"in t&&"tagName"in t}const FC=xn(function(t){return t.tagName==="audio"||t.tagName==="canvas"||t.tagName==="embed"||t.tagName==="iframe"||t.tagName==="img"||t.tagName==="math"||t.tagName==="object"||t.tagName==="picture"||t.tagName==="svg"||t.tagName==="video"}),cB=/[ \t\n\f\r]/g;function ka(t){return typeof t=="object"?t.type==="text"?ub(t.value):!1:ub(t)}function ub(t){return t.replace(cB,"")===""}const Fs=(function(t){if(t==null)return fB;if(typeof t=="function")return Su(t);if(typeof t=="object")return Array.isArray(t)?uB(t):dB(t);if(typeof t=="string")return hB(t);throw new Error("Expected function, string, or object as test")});function uB(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=Fs(t[n]);return Su(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function dB(t){const e=t;return Su(n);function n(r){const i=r;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function hB(t){return Su(e);function e(n){return n&&n.type===t}}function Su(t){return e;function e(n,r,i){return!!(pB(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function fB(){return!0}function pB(t){return t!==null&&typeof t=="object"&&"type"in t}const mB=["address","article","aside","blockquote","body","br","caption","center","col","colgroup","dd","dialog","dir","div","dl","dt","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","li","listing","main","menu","nav","ol","optgroup","option","p","plaintext","pre","section","summary","table","tbody","td","td","tfoot","th","th","thead","tr","ul","wbr","xmp"],gB=["button","input","select","textarea"],bB=["area","base","basefont","dialog","datalist","head","link","meta","noembed","noframes","param","rp","script","source","style","template","track","title"],yB={},Jp=Fs(["comment","doctype"]);function EB(t,e){HC(t,{collapse:AB((e||yB).newlines?wB:xB),whitespace:"normal"})}function HC(t,e){if("children"in t){const n={...e};return(t.type==="root"||zC(t))&&(n.before=!0,n.after=!0),n.whitespace=_B(t,e),TB(t,n)}if(t.type==="text"){if(e.whitespace==="normal")return kB(t,e);e.whitespace==="nowrap"&&(t.value=e.collapse(t.value))}return{ignore:Jp(t),stripAtStart:!1,remove:!1}}function kB(t,e){const n=e.collapse(t.value),r={ignore:!1,stripAtStart:!1,remove:!1};let i=0,s=n.length;return e.before&&db(n.charAt(0))&&i++,i!==s&&db(n.charAt(s-1))&&(e.after?s--:r.stripAtStart=!0),i===s?r.remove=!0:t.value=n.slice(i,s),r}function TB(t,e){let n=e.before;const r=e.after,i=t.children;let s=i.length,o=-1;for(;++o<s;){const a=HC(i[o],{...e,after:UC(i,o,r),before:n});a.remove?(i.splice(o,1),o--,s--):a.ignore||(n=a.stripAtStart),$C(i[o])&&(n=!1)}return{ignore:!1,stripAtStart:!!(n||r),remove:!1}}function UC(t,e,n){for(;++e<t.length;){const r=t[e];let i=CB(r);if(i===void 0&&"children"in r&&!SB(r)&&(i=UC(r.children,-1)),typeof i=="boolean")return i}return n}function CB(t){if(t.type==="element"){if($C(t))return!1;if(zC(t))return!0}else if(t.type==="text"){if(!ka(t))return!1}else if(!Jp(t))return!1}function $C(t){return FC(t)||Gp(t,gB)}function zC(t){return Gp(t,mB)}function SB(t){return!!(t.type==="element"&&t.properties.hidden)||Jp(t)||Gp(t,bB)}function db(t){return t===" "||t===`
|
|
117
|
-
`}function wB(t){const e=/\r?\n|\r/.exec(t);return e?e[0]:" "}function xB(){return" "}function AB(t){return e;function e(n){return String(n).replace(/[\t\n\v\f\r ]+/g,t)}}function _B(t,e){if("tagName"in t&&t.properties)switch(t.tagName){case"listing":case"plaintext":case"script":case"style":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return t.properties.wrap?"pre-wrap":"pre";case"td":case"th":return t.properties.noWrap?"nowrap":e.whitespace;case"textarea":return"pre-wrap"}return e.whitespace}function NB(t){return function(e){EB(e,t)}}const VC=[],IB=!0,ic=!1,jC="skip";function qC(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;const s=Fs(i),o=r?-1:1;a(t,void 0,[])();function a(l,c,u){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const f=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(l.type+(f?"<"+f+">":""))+")"})}return h;function h(){let f=VC,p,g,b;if((!e||s(l,c,u[u.length-1]||void 0))&&(f=OB(n(l,u)),f[0]===ic))return f;if("children"in l&&l.children){const y=l;if(y.children&&f[0]!==jC)for(g=(r?y.children.length:-1)+o,b=u.concat(y);g>-1&&g<y.children.length;){const C=y.children[g];if(p=a(C,g,b)(),p[0]===ic)return p;g=typeof p[1]=="number"?p[1]:g+o}}return f}}}function OB(t){return Array.isArray(t)?t:typeof t=="number"?[IB,t]:t==null?VC:[t]}function Ai(t,e,n,r){let i,s,o;typeof e=="function"&&typeof n!="function"?(s=void 0,o=e,i=n):(s=e,o=n,i=r),qC(t,s,a,i);function a(l,c){const u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return o(l,d,u)}}const WC=KC("end"),YC=KC("start");function KC(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function GC(t){const e=YC(t),n=WC(t);if(e&&n)return{start:e,end:n}}function MB(t,e){const n=e.properties||{},r=t.all(e),i={type:"link",url:t.resolve(String(n.href||"")||null),title:n.title?String(n.title):null,children:r};return t.patch(e,i),i}function vB(t,e){t.baseFound||(t.frozenBaseUrl=String(e.properties&&e.properties.href||"")||void 0,t.baseFound=!0)}function DB(t,e){const n={type:"blockquote",children:t.toFlow(t.all(e))};return t.patch(e,n),n}function LB(t,e){const n={type:"break"};return t.patch(e,n),n}const hb=(function(t,e,n){const r=Fs(n);if(!t||!t.type||!t.children)throw new Error("Expected parent node");if(typeof e=="number"){if(e<0||e===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(e=t.children.indexOf(e),e<0)throw new Error("Expected child node or index");for(;++e<t.children.length;)if(r(t.children[e],e,t))return t.children[e]}),fb=/\n/g,pb=/[\t ]+/g,Wh=xn("br"),mb=xn($B),RB=xn("p"),gb=xn("tr"),PB=xn(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",UB,zB]),QC=xn(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function Ta(t,e){const n={},r="children"in t?t.children:[],i=QC(t),s=ZC(t,{whitespace:n.whitespace||"normal"}),o=[];(t.type==="text"||t.type==="comment")&&o.push(...XC(t,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<r.length;)o.push(...JC(r[a],t,{whitespace:s,breakBefore:a?void 0:i,breakAfter:a<r.length-1?Wh(r[a+1]):i}));const l=[];let c;for(a=-1;++a<o.length;){const u=o[a];typeof u=="number"?c!==void 0&&u>c&&(c=u):u&&(c!==void 0&&c>-1&&l.push(`
|
|
118
|
-
`.repeat(c)||" "),c=-1,l.push(u))}return l.join("")}function JC(t,e,n){return t.type==="element"?BB(t,e,n):t.type==="text"?n.whitespace==="normal"?XC(t,n):FB(t):[]}function BB(t,e,n){const r=ZC(t,n),i=t.children||[];let s=-1,o=[];if(PB(t))return o;let a,l;for(Wh(t)||gb(t)&&hb(e,t,gb)?l=`
|
|
119
|
-
`:RB(t)?(a=2,l=2):QC(t)&&(a=1,l=1);++s<i.length;)o=o.concat(JC(i[s],t,{whitespace:r,breakBefore:s?void 0:a,breakAfter:s<i.length-1?Wh(i[s+1]):l}));return mb(t)&&hb(e,t,mb)&&o.push(" "),a&&o.unshift(a),l&&o.push(l),o}function XC(t,e){const n=String(t.value),r=[],i=[];let s=0;for(;s<=n.length;){fb.lastIndex=s;const l=fb.exec(n),c=l&&"index"in l?l.index:n.length;r.push(HB(n.slice(s,c).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),s===0?e.breakBefore:!0,c===n.length?e.breakAfter:!0)),s=c+1}let o=-1,a;for(;++o<r.length;)r[o].charCodeAt(r[o].length-1)===8203||o<r.length-1&&r[o+1].charCodeAt(0)===8203?(i.push(r[o]),a=void 0):r[o]?(typeof a=="number"&&i.push(a),i.push(r[o]),a=0):(o===0||o===r.length-1)&&i.push(0);return i}function FB(t){return[String(t.value)]}function HB(t,e,n){const r=[];let i=0,s;for(;i<t.length;){pb.lastIndex=i;const o=pb.exec(t);s=o?o.index:t.length,!i&&!s&&o&&!e&&r.push(""),i!==s&&r.push(t.slice(i,s)),i=o?s+o[0].length:s}return i!==s&&!n&&r.push(""),r.join(" ")}function ZC(t,e){if(t.type==="element"){const n=t.properties||{};switch(t.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return n.wrap?"pre-wrap":"pre";case"td":case"th":return n.noWrap?"nowrap":e.whitespace;case"textarea":return"pre-wrap"}}return e.whitespace}function UB(t){return!!(t.properties||{}).hidden}function $B(t){return t.tagName==="td"||t.tagName==="th"}function zB(t){return t.tagName==="dialog"&&!(t.properties||{}).open}function VB(t){const e=String(t);let n=e.length;for(;n>0;){const r=e.codePointAt(n-1);if(r!==void 0&&(r===10||r===13))n--;else break}return e.slice(0,n)}const yd="language-";function qa(t,e){const n=e.children;let r=-1,i,s;if(e.tagName==="pre")for(;++r<n.length;){const a=n[r];if(a.type==="element"&&a.tagName==="code"&&a.properties&&a.properties.className&&Array.isArray(a.properties.className)){i=a.properties.className;break}}if(i){for(r=-1;++r<i.length;)if(String(i[r]).slice(0,yd.length)===yd){s=String(i[r]).slice(yd.length);break}}const o={type:"code",lang:s||null,meta:null,value:VB(Ta(e))};return t.patch(e,o),o}function jB(t,e){const n={type:"html",value:"<!--"+e.value+"-->"};return t.patch(e,n),n}function Ed(t,e){const r={type:"delete",children:t.all(e)};return t.patch(e,r),r}function Xp(t){let e=-1;if(t.length>1){for(;++e<t.length;)if(t[e].spread)return!0}return!1}function qB(t,e){const n=[],r=[];let i=-1;for(;++i<e.children.length;){const a=e.children[i];a.type==="element"&&a.tagName==="div"?n.push(...a.children):n.push(a)}let s={definitions:[],titles:[]};for(i=-1;++i<n.length;){const a=n[i];if(a.type==="element"&&a.tagName==="dt"){const l=n[i-1];l&&l.type==="element"&&l.tagName==="dd"&&(r.push(s),s={definitions:[],titles:[]}),s.titles.push(a)}else s.definitions.push(a)}r.push(s),i=-1;const o=[];for(;++i<r.length;){const a=[...bb(t,r[i].titles),...bb(t,r[i].definitions)];a.length>0&&o.push({type:"listItem",spread:a.length>1,checked:null,children:a})}if(o.length>0){const a={type:"list",ordered:!1,start:null,spread:Xp(o),children:o};return t.patch(e,a),a}}function bb(t,e){const n=t.all({type:"root",children:e}),r=t.toSpecificContent(n,WB);return r.length===0?[]:r.length===1?r[0].children:[{type:"list",ordered:!1,start:null,spread:Xp(r),children:r}]}function WB(){return{type:"listItem",spread:!1,checked:null,children:[]}}function Wa(t,e){const r={type:"emphasis",children:t.all(e)};return t.patch(e,r),r}function Zp(t){let e=0,n=t.length;for(;e<n&&t[e].type==="break";)e++;for(;n>e&&t[n-1].type==="break";)n--;return e===0&&n===t.length?t:t.slice(e,n)}function Vi(t,e){const n=Number(e.tagName.charAt(1))||1,r=Zp(t.all(e)),i={type:"heading",depth:n,children:r};return t.patch(e,i),i}function YB(t,e){const n={type:"thematicBreak"};return t.patch(e,n),n}function KB(t,e){const n=e.properties||{},r=String(n.src||""),i=String(n.title||"");if(r&&i){const s={type:"link",title:null,url:t.resolve(r),children:[{type:"text",value:i}]};return t.patch(e,s),s}}function yb(t,e){const n=e.properties||{},r={type:"image",url:t.resolve(String(n.src||"")||null),title:n.title?String(n.title):null,alt:n.alt?String(n.alt):""};return t.patch(e,r),r}function Gs(t,e){const n={type:"inlineCode",value:Ta(e)};return t.patch(e,n),n}function eS(t,e){const n=[],r=[],i=e||t.properties||{},s=tS(t),o=Math.min(Number.parseInt(String(i.size),10),0)||(i.multiple?4:1);let a=-1;for(;++a<s.length;){const u=s[a];u&&u.properties&&u.properties.selected&&n.push(u)}const l=n.length>0?n:s,c=Math.min(l.length,o);for(a=-1;++a<c;){const u=l[a],d=u.properties||{},h=Ta(u),f=h||String(d.label||""),p=String(d.value||"")||h;r.push([p,f===p?void 0:f])}return r}function tS(t){const e=[];let n=-1;for(;++n<t.children.length;){const r=t.children[n];"children"in r&&Array.isArray(r.children)&&e.push(...tS(r)),r.type==="element"&&r.tagName==="option"&&(!r.properties||!r.properties.disabled)&&e.push(r)}return e}const GB="[x]",QB="[ ]";function JB(t,e){const n=e.properties||{},r=String(n.value||n.placeholder||"");if(n.disabled||n.type==="hidden"||n.type==="file")return;if(n.type==="checkbox"||n.type==="radio"){const l={type:"text",value:n.checked?t.options.checked||GB:t.options.unchecked||QB};return t.patch(e,l),l}if(n.type==="image"){const l=n.alt||r;if(l){const c={type:"image",url:t.resolve(String(n.src||"")||null),title:String(n.title||"")||null,alt:String(l)};return t.patch(e,c),c}return}let i=[];if(r)i=[[r,void 0]];else if(n.type!=="button"&&n.type!=="file"&&n.type!=="password"&&n.type!=="reset"&&n.type!=="submit"&&n.list){const l=String(n.list),c=t.elementById.get(l);c&&c.tagName==="datalist"&&(i=eS(c,n))}if(i.length===0)return;if(n.type==="password"&&(i[0]=["•".repeat(i[0][0].length),void 0]),n.type==="email"||n.type==="url"){const l=[];let c=-1;for(;++c<i.length;){const u=t.resolve(i[c][0]),d={type:"link",title:null,url:n.type==="email"?"mailto:"+u:u,children:[{type:"text",value:i[c][1]||u}]};l.push(d),c!==i.length-1&&l.push({type:"text",value:", "})}return l}const s=[];let o=-1;for(;++o<i.length;)s.push(i[o][1]?i[o][1]+" ("+i[o][0]+")":i[o][0]);const a={type:"text",value:s.join(", ")};return t.patch(e,a),a}const XB={}.hasOwnProperty;function ZB(t,e){const n=t.type==="element"&&XB.call(t.properties,e)&&t.properties[e];return n!=null&&n!==!1}const e5=new Set(["pingback","prefetch","stylesheet"]);function t5(t){if(t.type!=="element"||t.tagName!=="link")return!1;if(t.properties.itemProp)return!0;const e=t.properties.rel;let n=-1;if(!Array.isArray(e)||e.length===0)return!1;for(;++n<e.length;)if(!e5.has(String(e[n])))return!1;return!0}const n5=xn(["a","abbr","area","b","bdi","bdo","br","button","cite","code","data","datalist","del","dfn","em","i","input","ins","kbd","keygen","label","map","mark","meter","noscript","output","progress","q","ruby","s","samp","script","select","small","span","strong","sub","sup","template","textarea","time","u","var","wbr"]),r5=xn("meta");function nS(t){return!!(t.type==="text"||n5(t)||FC(t)||t5(t)||r5(t)&&ZB(t,"itemProp"))}function kd(t,e){const{rest:n,checkbox:r}=iS(e),i=r?!!r.properties.checked:null,s=rS(n),o=t.toFlow(t.all(n)),a={type:"listItem",spread:s,checked:i,children:o};return t.patch(e,a),a}function rS(t){let e=-1,n=!1;for(;++e<t.children.length;){const r=t.children[e];if(r.type==="element"){if(nS(r))continue;if(r.tagName==="p"||n||rS(r))return!0;n=!0}}return!1}function iS(t){const e=t.children[0];if(e&&e.type==="element"&&e.tagName==="input"&&e.properties&&(e.properties.type==="checkbox"||e.properties.type==="radio")){const n={...t,children:t.children.slice(1)};return{checkbox:e,rest:n}}if(e&&e.type==="element"&&e.tagName==="p"){const{checkbox:n,rest:r}=iS(e);if(n){const i={...t,children:[r,...t.children.slice(1)]};return{checkbox:n,rest:i}}}return{checkbox:void 0,rest:t}}function Td(t,e){const n=e.tagName==="ol",r=t.toSpecificContent(t.all(e),i5);let i=null;n&&(i=e.properties&&e.properties.start?Number.parseInt(String(e.properties.start),10):1);const s={type:"list",ordered:n,start:i,spread:Xp(r),children:r};return t.patch(e,s),s}function i5(){return{type:"listItem",spread:!1,checked:null,children:[]}}const s5={};function wu(t,e){const n=s5,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return sS(t,r,i)}function sS(t,e,n){if(o5(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return Eb(t.children,e,n)}return Array.isArray(t)?Eb(t,e,n):""}function Eb(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=sS(t[i],e,n);return r.join("")}function o5(t){return!!(t&&typeof t=="object")}const oS=Fs(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function xu(t){let e=-1;for(;++e<t.length;){const n=t[e];if(!cS(n)||"children"in n&&xu(n.children))return!0}return!1}function aS(t){return lS(t,e,function(n){return n});function e(n){return n.every(function(r){return r.type==="text"?ka(r.value):!1})?[]:[{type:"paragraph",children:Zp(n)}]}}function a5(t){return lS(t.children,e,n);function e(r){const i=Cd(t);return i.children=r,[i]}function n(r){if("children"in r&&"children"in t){const i=Cd(t),s=Cd(r);return i.children=r.children,s.children.push(i),s}return{...r}}}function lS(t,e,n){const r=l5(t),i=[];let s=[],o=-1;for(;++o<r.length;){const a=r[o];cS(a)?s.push(a):(s.length>0&&(i.push(...e(s)),s=[]),i.push(n(a)))}return s.length>0&&(i.push(...e(s)),s=[]),i}function l5(t){const e=[];let n=-1;for(;++n<t.length;){const r=t[n];(r.type==="delete"||r.type==="link")&&xu(r.children)?e.push(...a5(r)):e.push(r)}return e}function cS(t){const e=t.data&&t.data.hName;return e?nS({type:"element",tagName:e,properties:{},children:[]}):oS(t)}function Cd(t){return As({...t,children:[]})}function kb(t,e){const n=e.properties||{},r=e.tagName==="video"?String(n.poster||""):"";let i=String(n.src||""),s=-1,o=!1,a=t.all(e);if(Ai({type:"root",children:a},function(d){if(d.type==="link")return o=!0,ic}),o||xu(a))return a;for(;!i&&++s<e.children.length;){const d=e.children[s];d.type==="element"&&d.tagName==="source"&&d.properties&&(i=String(d.properties.src||""))}if(r){const d={type:"image",title:null,url:t.resolve(r),alt:wu(a)};t.patch(e,d),a=[d]}const c=a,u={type:"link",title:n.title?String(n.title):null,url:t.resolve(i),children:c};return t.patch(e,u),u}function Tb(t,e){const n=Zp(t.all(e));if(n.length>0){const r={type:"paragraph",children:n};return t.patch(e,r),r}}const c5=['"'];function u5(t,e){const n=t.options.quotes||c5;t.qNesting++;const r=t.all(e);t.qNesting--;const i=n[t.qNesting%n.length],s=r[0],o=r[r.length-1],a=i.charAt(0),l=i.length>1?i.charAt(1):i;return s&&s.type==="text"?s.value=a+s.value:r.unshift({type:"text",value:a}),o&&o.type==="text"?o.value+=l:r.push({type:"text",value:l}),r}function d5(t,e){let n=t.all(e);(t.options.document||xu(n))&&(n=aS(n));const r={type:"root",children:n};return t.patch(e,r),r}function h5(t,e){const n=eS(e);let r=-1;const i=[];for(;++r<n.length;){const s=n[r];i.push(s[1]?s[1]+" ("+s[0]+")":s[0])}if(i.length>0){const s={type:"text",value:i.join(", ")};return t.patch(e,s),s}}function Cb(t,e){const r={type:"strong",children:t.all(e)};return t.patch(e,r),r}function Sb(t,e){const r={type:"tableCell",children:t.all(e)};if(t.patch(e,r),e.properties){const i=e.properties.rowSpan,s=e.properties.colSpan;if(i||s){const o=r.data||(r.data={});i&&(o.hastUtilToMdastTemporaryRowSpan=i),s&&(o.hastUtilToMdastTemporaryColSpan=s)}}return r}function f5(t,e){const r={type:"tableRow",children:t.toSpecificContent(t.all(e),p5)};return t.patch(e,r),r}function p5(){return{type:"tableCell",children:[]}}function m5(t,e){if(t.inTable){const c={type:"text",value:Ta(e)};return t.patch(e,c),c}t.inTable=!0;const{align:n,headless:r}=g5(e),i=t.toSpecificContent(t.all(e),wb);r&&i.unshift(wb());let s=-1;for(;++s<i.length;){const c=i[s],u=t.toSpecificContent(c.children,b5);c.children=u}let o=1;for(s=-1;++s<i.length;){const c=i[s].children;let u=-1;for(;++u<c.length;){const d=c[u];if(d.data){const h=d.data,f=Number.parseInt(String(h.hastUtilToMdastTemporaryColSpan),10)||1,p=Number.parseInt(String(h.hastUtilToMdastTemporaryRowSpan),10)||1;if(f>1||p>1){let g=s-1;for(;++g<s+p;){let b=u-1;for(;++b<u+f&&i[g];){const y=[];(g!==s||b!==u)&&y.push({type:"tableCell",children:[]}),i[g].children.splice(b,0,...y)}}}"hastUtilToMdastTemporaryColSpan"in d.data&&delete d.data.hastUtilToMdastTemporaryColSpan,"hastUtilToMdastTemporaryRowSpan"in d.data&&delete d.data.hastUtilToMdastTemporaryRowSpan,Object.keys(d.data).length===0&&delete d.data}}c.length>o&&(o=c.length)}for(s=-1;++s<i.length;){const c=i[s].children;let u=c.length-1;for(;++u<o;)c.push({type:"tableCell",children:[]})}let a=n.length-1;for(;++a<o;)n.push(null);t.inTable=!1;const l={type:"table",align:n,children:i};return t.patch(e,l),l}function g5(t){const e={align:[null],headless:!0};let n=0,r=0;return Ai(t,function(i){if(i.type==="element"){if(i.tagName==="table"&&t!==i)return jC;if((i.tagName==="th"||i.tagName==="td")&&i.properties){if(!e.align[r]){const s=String(i.properties.align||"")||null;(s==="center"||s==="left"||s==="right"||s===null)&&(e.align[r]=s)}e.headless&&n<2&&i.tagName==="th"&&(e.headless=!1),r++}else i.tagName==="thead"?e.headless=!1:i.tagName==="tr"&&(n++,r=0)}}),e}function b5(){return{type:"tableCell",children:[]}}function wb(){return{type:"tableRow",children:[]}}function y5(t,e){const n={type:"text",value:e.value};return t.patch(e,n),n}function E5(t,e){const n={type:"text",value:Ta(e)};return t.patch(e,n),n}function k5(t,e){const n={type:"text",value:""};return t.patch(e,n),n}const T5={comment:jB,doctype:se,root:d5,text:y5},C5={applet:se,area:se,basefont:se,bgsound:se,caption:se,col:se,colgroup:se,command:se,content:se,datalist:se,dialog:se,element:se,embed:se,frame:se,frameset:se,isindex:se,keygen:se,link:se,math:se,menu:se,menuitem:se,meta:se,nextid:se,noembed:se,noframes:se,optgroup:se,option:se,param:se,script:se,shadow:se,source:se,spacer:se,style:se,svg:se,template:se,title:se,track:se,abbr:ie,acronym:ie,bdi:ie,bdo:ie,big:ie,blink:ie,button:ie,canvas:ie,cite:ie,data:ie,details:ie,dfn:ie,font:ie,ins:ie,label:ie,map:ie,marquee:ie,meter:ie,nobr:ie,noscript:ie,object:ie,output:ie,progress:ie,rb:ie,rbc:ie,rp:ie,rt:ie,rtc:ie,ruby:ie,slot:ie,small:ie,span:ie,sup:ie,sub:ie,tbody:ie,tfoot:ie,thead:ie,time:ie,address:Ue,article:Ue,aside:Ue,body:Ue,center:Ue,div:Ue,fieldset:Ue,figcaption:Ue,figure:Ue,form:Ue,footer:Ue,header:Ue,hgroup:Ue,html:Ue,legend:Ue,main:Ue,multicol:Ue,nav:Ue,picture:Ue,section:Ue,a:MB,audio:kb,b:Cb,base:vB,blockquote:DB,br:LB,code:Gs,dir:Td,dl:qB,dt:kd,dd:kd,del:Ed,em:Wa,h1:Vi,h2:Vi,h3:Vi,h4:Vi,h5:Vi,h6:Vi,hr:YB,i:Wa,iframe:KB,img:yb,image:yb,input:JB,kbd:Gs,li:kd,listing:qa,mark:Wa,ol:Td,p:Tb,plaintext:qa,pre:qa,q:u5,s:Ed,samp:Gs,select:h5,strike:Ed,strong:Cb,summary:Tb,table:m5,td:Sb,textarea:E5,th:Sb,tr:f5,tt:Gs,u:Wa,ul:Td,var:Gs,video:kb,wbr:k5,xmp:qa};function ie(t,e){return t.all(e)}function Ue(t,e){return t.toFlow(t.all(e))}function se(){}const xb={}.hasOwnProperty;function S5(t){return{all:w5,baseFound:!1,elementById:new Map,frozenBaseUrl:void 0,handlers:{...C5,...t.handlers},inTable:!1,nodeHandlers:{...T5,...t.nodeHandlers},one:x5,options:t,patch:A5,qNesting:0,resolve:_5,toFlow:N5,toSpecificContent:I5}}function w5(t){const e=t.children||[],n=[];let r=-1;for(;++r<e.length;){const i=e[r],s=this.one(i,t);Array.isArray(s)?n.push(...s):s&&n.push(s)}return n}function x5(t,e){if(t.type==="element"){if(t.properties&&t.properties.dataMdast==="ignore")return;if(xb.call(this.handlers,t.tagName))return this.handlers[t.tagName](this,t,e)||void 0}else if(xb.call(this.nodeHandlers,t.type))return this.nodeHandlers[t.type](this,t,e)||void 0;if("value"in t&&typeof t.value=="string"){const n={type:"text",value:t.value};return this.patch(t,n),n}if("children"in t)return this.all(t)}function A5(t,e){t.position&&(e.position=GC(t))}function _5(t){const e=this.frozenBaseUrl;return t==null?"":e?String(new URL(t,e)):t}function N5(t){return aS(t)}function I5(t,e){const n=e(),r=[];let i=[],s=-1;for(;++s<t.length;){const a=t[s];if(o(a))i.length>0&&(a.children.unshift(...i),i=[]),r.push(a);else{const l=a;i.push(l)}}if(i.length>0){let a=r[r.length-1];a||(a=e(),r.push(a)),a.children.push(...i),i=[]}return r;function o(a){return a.type===n.type}}const O5={};function Ab(t,e){const n=As(t),r=e||O5,i=NB({newlines:r.newlines===!0}),s=S5(r);let o;i(n),Ai(n,function(l){if(l&&l.type==="element"&&l.properties){const c=String(l.properties.id||"")||void 0;c&&!s.elementById.has(c)&&s.elementById.set(c,l)}});const a=s.one(n,void 0);return a?Array.isArray(a)?o={type:"root",children:a}:o=a:o={type:"root",children:[]},Ai(o,function(l,c,u){if(l.type==="text"&&c!==void 0&&u){const d=u.children[c-1];if(d&&d.type===l.type)return d.value+=l.value,u.children.splice(c,1),d.position&&l.position&&(d.position.end=l.position.end),c-1;if(l.value=l.value.replace(/[\t ]*(\r?\n|\r)[\t ]*/,"$1"),u&&(u.type==="heading"||u.type==="paragraph"||u.type==="root")&&(c||(l.value=l.value.replace(/^[\t ]+/,"")),c===u.children.length-1&&(l.value=l.value.replace(/[\t ]+$/,""))),!l.value)return u.children.splice(c,1),c}}),o}const _b={document:!0};function M5(t,e){return t&&"run"in t?async function(n,r){const i=Ab(n,{..._b,...e});await t.run(i,r)}:function(n){return Ab(n,{..._b,...t})}}function sc(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(e);for(;i!==-1;)r++,i=n.indexOf(e,i+e.length);return r}const gt=jr(/[A-Za-z]/),ut=jr(/[\dA-Za-z]/),v5=jr(/[#-'*+\--9=?A-Z^-~]/);function oc(t){return t!==null&&(t<32||t===127)}const Yh=jr(/\d/),D5=jr(/[\dA-Fa-f]/),L5=jr(/[!-/:-@[-`{-~]/);function G(t){return t!==null&&t<-2}function we(t){return t!==null&&(t<0||t===32)}function ae(t){return t===-2||t===-1||t===32}const Au=jr(new RegExp("\\p{P}|\\p{S}","u")),_i=jr(/\s/);function jr(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function R5(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function P5(t,e,n){const i=Fs((n||{}).ignore||[]),s=B5(e);let o=-1;for(;++o<s.length;)qC(t,"text",a);function a(c,u){let d=-1,h;for(;++d<u.length;){const f=u[d],p=h?h.children:void 0;if(i(f,p?p.indexOf(f):void 0,h))return;h=f}if(h)return l(c,u)}function l(c,u){const d=u[u.length-1],h=s[o][0],f=s[o][1];let p=0;const b=d.children.indexOf(c);let y=!1,C=[];h.lastIndex=0;let S=h.exec(c.value);for(;S;){const I=S.index,M={index:S.index,input:S.input,stack:[...u,c]};let A=f(...S,M);if(typeof A=="string"&&(A=A.length>0?{type:"text",value:A}:void 0),A===!1?h.lastIndex=I+1:(p!==I&&C.push({type:"text",value:c.value.slice(p,I)}),Array.isArray(A)?C.push(...A):A&&C.push(A),p=I+S[0].length,y=!0),!h.global)break;S=h.exec(c.value)}return y?(p<c.value.length&&C.push({type:"text",value:c.value.slice(p)}),d.children.splice(b,1,...C)):C=[c],b+C.length}}function B5(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!t[0]||Array.isArray(t[0])?t:[t];let r=-1;for(;++r<n.length;){const i=n[r];e.push([F5(i[0]),H5(i[1])])}return e}function F5(t){return typeof t=="string"?new RegExp(R5(t),"g"):t}function H5(t){return typeof t=="function"?t:function(){return t}}const Sd="phrasing",wd=["autolink","link","image","label"];function U5(){return{transforms:[Y5],enter:{literalAutolink:z5,literalAutolinkEmail:xd,literalAutolinkHttp:xd,literalAutolinkWww:xd},exit:{literalAutolink:W5,literalAutolinkEmail:q5,literalAutolinkHttp:V5,literalAutolinkWww:j5}}}function $5(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Sd,notInConstruct:wd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Sd,notInConstruct:wd},{character:":",before:"[ps]",after:"\\/",inConstruct:Sd,notInConstruct:wd}]}}function z5(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function xd(t){this.config.enter.autolinkProtocol.call(this,t)}function V5(t){this.config.exit.autolinkProtocol.call(this,t)}function j5(t){this.config.exit.data.call(this,t);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function q5(t){this.config.exit.autolinkEmail.call(this,t)}function W5(t){this.exit(t)}function Y5(t){P5(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,K5],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),G5]],{ignore:["link","linkReference"]})}function K5(t,e,n,r,i){let s="";if(!uS(i)||(/^w/i.test(e)&&(n=e+n,e="",s="http://"),!Q5(n)))return!1;const o=J5(n+r);if(!o[0])return!1;const a={type:"link",title:null,url:s+e+o[0],children:[{type:"text",value:e+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function G5(t,e,n,r){return!uS(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function Q5(t){const e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function J5(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const i=sc(t,"(");let s=sc(t,")");for(;r!==-1&&i>s;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[t,n]}function uS(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||_i(n)||Au(n))&&(!e||n!==47)}function gn(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}dS.peek=o8;function X5(){this.buffer()}function Z5(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function e8(){this.buffer()}function t8(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function n8(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=gn(this.sliceSerialize(t)).toLowerCase(),n.label=e}function r8(t){this.exit(t)}function i8(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=gn(this.sliceSerialize(t)).toLowerCase(),n.label=e}function s8(t){this.exit(t)}function o8(){return"["}function dS(t,e,n,r){const i=n.createTracker(r);let s=i.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return s+=i.move(n.safe(n.associationId(t),{after:"]",before:s})),a(),o(),s+=i.move("]"),s}function a8(){return{enter:{gfmFootnoteCallString:X5,gfmFootnoteCall:Z5,gfmFootnoteDefinitionLabelString:e8,gfmFootnoteDefinition:t8},exit:{gfmFootnoteCallString:n8,gfmFootnoteCall:r8,gfmFootnoteDefinitionLabelString:i8,gfmFootnoteDefinition:s8}}}function l8(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:dS},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,o){const a=s.createTracker(o);let l=a.move("[^");const c=s.enter("footnoteDefinition"),u=s.enter("label");return l+=a.move(s.safe(s.associationId(r),{before:l,after:"]"})),u(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((e?`
|
|
120
|
-
`:" ")+s.indentLines(s.containerFlow(r,a.current()),e?hS:c8))),c(),l}}function c8(t,e,n){return e===0?t:hS(t,e,n)}function hS(t,e,n){return(n?"":" ")+t}const u8=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];fS.peek=m8;function d8(){return{canContainEols:["delete"],enter:{strikethrough:f8},exit:{strikethrough:p8}}}function h8(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:u8}],handlers:{delete:fS}}}function f8(t){this.enter({type:"delete",children:[]},t)}function p8(t){this.exit(t)}function fS(t,e,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let o=i.move("~~");return o+=n.containerPhrasing(t,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function m8(){return"~"}function g8(t){return t.length}function b8(t,e){const n=e||{},r=(n.align||[]).concat(),i=n.stringLength||g8,s=[],o=[],a=[],l=[];let c=0,u=-1;for(;++u<t.length;){const g=[],b=[];let y=-1;for(t[u].length>c&&(c=t[u].length);++y<t[u].length;){const C=y8(t[u][y]);if(n.alignDelimiters!==!1){const S=i(C);b[y]=S,(l[y]===void 0||S>l[y])&&(l[y]=S)}g.push(C)}o[u]=g,a[u]=b}let d=-1;if(typeof r=="object"&&"length"in r)for(;++d<c;)s[d]=Nb(r[d]);else{const g=Nb(r);for(;++d<c;)s[d]=g}d=-1;const h=[],f=[];for(;++d<c;){const g=s[d];let b="",y="";g===99?(b=":",y=":"):g===108?b=":":g===114&&(y=":");let C=n.alignDelimiters===!1?1:Math.max(1,l[d]-b.length-y.length);const S=b+"-".repeat(C)+y;n.alignDelimiters!==!1&&(C=b.length+C+y.length,C>l[d]&&(l[d]=C),f[d]=C),h[d]=S}o.splice(1,0,h),a.splice(1,0,f),u=-1;const p=[];for(;++u<o.length;){const g=o[u],b=a[u];d=-1;const y=[];for(;++d<c;){const C=g[d]||"";let S="",I="";if(n.alignDelimiters!==!1){const M=l[d]-(b[d]||0),A=s[d];A===114?S=" ".repeat(M):A===99?M%2?(S=" ".repeat(M/2+.5),I=" ".repeat(M/2-.5)):(S=" ".repeat(M/2),I=S):I=" ".repeat(M)}n.delimiterStart!==!1&&!d&&y.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&C==="")&&(n.delimiterStart!==!1||d)&&y.push(" "),n.alignDelimiters!==!1&&y.push(S),y.push(C),n.alignDelimiters!==!1&&y.push(I),n.padding!==!1&&y.push(" "),(n.delimiterEnd!==!1||d!==c-1)&&y.push("|")}p.push(n.delimiterEnd===!1?y.join("").replace(/ +$/,""):y.join(""))}return p.join(`
|
|
121
|
-
`)}function y8(t){return t==null?"":String(t)}function Nb(t){const e=typeof t=="string"?t.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}const Ib={}.hasOwnProperty;function pS(t,e){const n=e||{};function r(i,...s){let o=r.invalid;const a=r.handlers;if(i&&Ib.call(i,t)){const l=String(i[t]);o=Ib.call(a,l)?a[l]:r.unknown}if(o)return o.call(this,i,...s)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const E8={}.hasOwnProperty;function mS(t,e){let n=-1,r;if(e.extensions)for(;++n<e.extensions.length;)mS(t,e.extensions[n]);for(r in e)if(E8.call(e,r))switch(r){case"extensions":break;case"unsafe":{Ob(t[r],e[r]);break}case"join":{Ob(t[r],e[r]);break}case"handlers":{k8(t[r],e[r]);break}default:t.options[r]=e[r]}return t}function Ob(t,e){e&&t.push(...e)}function k8(t,e){e&&Object.assign(t,e)}function T8(t,e,n,r){const i=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const o=n.indentLines(n.containerFlow(t,s.current()),C8);return i(),o}function C8(t,e,n){return">"+(n?"":" ")+t}function gS(t,e){return Mb(t,e.inConstruct,!0)&&!Mb(t,e.notInConstruct,!1)}function Mb(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++r<e.length;)if(t.includes(e[r]))return!0;return!1}function vb(t,e,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
122
|
-
`&&gS(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
123
|
-
`}function S8(t,e){const n=String(t);let r=n.indexOf(e),i=r,s=0,o=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>o&&(o=s):s=1,i=r+e.length,r=n.indexOf(e,i);return o}function Kh(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function w8(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function x8(t,e,n,r){const i=w8(n),s=t.value||"",o=i==="`"?"GraveAccent":"Tilde";if(Kh(t,n)){const d=n.enter("codeIndented"),h=n.indentLines(s,A8);return d(),h}const a=n.createTracker(r),l=i.repeat(Math.max(S8(s,i)+1,3)),c=n.enter("codeFenced");let u=a.move(l);if(t.lang){const d=n.enter(`codeFencedLang${o}`);u+=a.move(n.safe(t.lang,{before:u,after:" ",encode:["`"],...a.current()})),d()}if(t.lang&&t.meta){const d=n.enter(`codeFencedMeta${o}`);u+=a.move(" "),u+=a.move(n.safe(t.meta,{before:u,after:`
|
|
124
|
-
`,encode:["`"],...a.current()})),d()}return u+=a.move(`
|
|
125
|
-
`),s&&(u+=a.move(s+`
|
|
126
|
-
`)),u+=a.move(l),c(),u}function A8(t,e,n){return(n?"":" ")+t}function em(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function _8(t,e,n,r){const i=em(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");return c+=l.move(n.safe(n.associationId(t),{before:c,after:"]",...l.current()})),c+=l.move("]: "),a(),!t.url||/[\0- \u007F]/.test(t.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(t.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(t.url,{before:c,after:t.title?" ":`
|
|
127
|
-
`,...l.current()}))),a(),t.title&&(a=n.enter(`title${s}`),c+=l.move(" "+i),c+=l.move(n.safe(t.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),o(),c}function N8(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function Ur(t){return"&#x"+t.toString(16).toUpperCase()+";"}function _s(t){if(t===null||we(t)||_i(t))return 1;if(Au(t))return 2}function ac(t,e,n){const r=_s(t),i=_s(e);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}bS.peek=I8;function bS(t,e,n,r){const i=N8(n),s=n.enter("emphasis"),o=n.createTracker(r),a=o.move(i);let l=o.move(n.containerPhrasing(t,{after:i,before:a,...o.current()}));const c=l.charCodeAt(0),u=ac(r.before.charCodeAt(r.before.length-1),c,i);u.inside&&(l=Ur(c)+l.slice(1));const d=l.charCodeAt(l.length-1),h=ac(r.after.charCodeAt(0),d,i);h.inside&&(l=l.slice(0,-1)+Ur(d));const f=o.move(i);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},a+l+f}function I8(t,e,n){return n.options.emphasis||"*"}function yS(t,e){let n=!1;return Ai(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,ic}),!!((!t.depth||t.depth<3)&&wu(t)&&(e.options.setext||n))}function O8(t,e,n,r){const i=Math.max(Math.min(6,t.depth||1),1),s=n.createTracker(r);if(yS(t,n)){const u=n.enter("headingSetext"),d=n.enter("phrasing"),h=n.containerPhrasing(t,{...s.current(),before:`
|
|
128
|
-
`,after:`
|
|
129
|
-
`});return d(),u(),h+`
|
|
130
|
-
`+(i===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(`
|
|
131
|
-
`))+1))}const o="#".repeat(i),a=n.enter("headingAtx"),l=n.enter("phrasing");s.move(o+" ");let c=n.containerPhrasing(t,{before:"# ",after:`
|
|
132
|
-
`,...s.current()});return/^[\t ]/.test(c)&&(c=Ur(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,n.options.closeAtx&&(c+=" "+o),l(),a(),c}ES.peek=M8;function ES(t){return t.value||""}function M8(){return"<"}kS.peek=v8;function kS(t,e,n,r){const i=em(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");return c+=l.move(n.safe(t.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),a(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(t.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(t.url,{before:c,after:t.title?" ":")",...l.current()}))),a(),t.title&&(a=n.enter(`title${s}`),c+=l.move(" "+i),c+=l.move(n.safe(t.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),c+=l.move(")"),o(),c}function v8(){return"!"}TS.peek=D8;function TS(t,e,n,r){const i=t.referenceType,s=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const c=n.safe(t.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(t),{before:l,after:"]",...a.current()});return o(),n.stack=u,s(),i==="full"||!c||c!==d?l+=a.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function D8(){return"!"}CS.peek=L8;function CS(t,e,n){let r=t.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const o=n.unsafe[s],a=n.compilePattern(o);let l;if(o.atBreak)for(;l=a.exec(r);){let c=l.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(l.index+1)}}return i+r+i}function L8(){return"`"}function SS(t,e){const n=wu(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}wS.peek=R8;function wS(t,e,n,r){const i=em(n),s=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let a,l;if(SS(t,n)){const u=n.stack;n.stack=[],a=n.enter("autolink");let d=o.move("<");return d+=o.move(n.containerPhrasing(t,{before:d,after:">",...o.current()})),d+=o.move(">"),a(),n.stack=u,d}a=n.enter("link"),l=n.enter("label");let c=o.move("[");return c+=o.move(n.containerPhrasing(t,{before:c,after:"](",...o.current()})),c+=o.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(n.safe(t.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(l=n.enter("destinationRaw"),c+=o.move(n.safe(t.url,{before:c,after:t.title?" ":")",...o.current()}))),l(),t.title&&(l=n.enter(`title${s}`),c+=o.move(" "+i),c+=o.move(n.safe(t.title,{before:c,after:i,...o.current()})),c+=o.move(i),l()),c+=o.move(")"),a(),c}function R8(t,e,n){return SS(t,n)?"<":"["}xS.peek=P8;function xS(t,e,n,r){const i=t.referenceType,s=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const c=n.containerPhrasing(t,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(t),{before:l,after:"]",...a.current()});return o(),n.stack=u,s(),i==="full"||!c||c!==d?l+=a.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function P8(){return"["}function tm(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function B8(t){const e=tm(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function F8(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function AS(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function H8(t,e,n,r){const i=n.enter("list"),s=n.bulletCurrent;let o=t.ordered?F8(n):tm(n);const a=t.ordered?o==="."?")":".":B8(n);let l=e&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!t.ordered){const u=t.children?t.children[0]:void 0;if((o==="*"||o==="-")&&u&&(!u.children||!u.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),AS(n)===o&&u){let d=-1;for(;++d<t.children.length;){const h=t.children[d];if(h&&h.type==="listItem"&&h.children&&h.children[0]&&h.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(o=a),n.bulletCurrent=o;const c=n.containerFlow(t,r);return n.bulletLastUsed=o,n.bulletCurrent=s,i(),c}function U8(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function $8(t,e,n,r){const i=U8(n);let s=n.bulletCurrent||tm(n);e&&e.type==="list"&&e.ordered&&(s=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(o=Math.ceil(o/4)*4);const a=n.createTracker(r);a.move(s+" ".repeat(o-s.length)),a.shift(o);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(t,a.current()),u);return l(),c;function u(d,h,f){return h?(f?"":" ".repeat(o))+d:(f?s:s+" ".repeat(o-s.length))+d}}function z8(t,e,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),o=n.containerPhrasing(t,r);return s(),i(),o}function V8(t,e,n,r){return(t.children.some(function(o){return oS(o)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function j8(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}_S.peek=q8;function _S(t,e,n,r){const i=j8(n),s=n.enter("strong"),o=n.createTracker(r),a=o.move(i+i);let l=o.move(n.containerPhrasing(t,{after:i,before:a,...o.current()}));const c=l.charCodeAt(0),u=ac(r.before.charCodeAt(r.before.length-1),c,i);u.inside&&(l=Ur(c)+l.slice(1));const d=l.charCodeAt(l.length-1),h=ac(r.after.charCodeAt(0),d,i);h.inside&&(l=l.slice(0,-1)+Ur(d));const f=o.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},a+l+f}function q8(t,e,n){return n.options.strong||"*"}function W8(t,e,n,r){return n.safe(t.value,r)}function Y8(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function K8(t,e,n){const r=(AS(n)+(n.options.ruleSpaces?" ":"")).repeat(Y8(n));return n.options.ruleSpaces?r.slice(0,-1):r}const nm={blockquote:T8,break:vb,code:x8,definition:_8,emphasis:bS,hardBreak:vb,heading:O8,html:ES,image:kS,imageReference:TS,inlineCode:CS,link:wS,linkReference:xS,list:H8,listItem:$8,paragraph:z8,root:V8,strong:_S,text:W8,thematicBreak:K8},G8=[Q8];function Q8(t,e,n,r){if(e.type==="code"&&Kh(e,r)&&(t.type==="list"||t.type===e.type&&Kh(t,r)))return!1;if("spread"in n&&typeof n.spread=="boolean")return t.type==="paragraph"&&(t.type===e.type||e.type==="definition"||e.type==="heading"&&yS(e,r))?void 0:n.spread?1:0}const Kr=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],J8=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:`
|
|
133
|
-
`,inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:Kr},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r
|
|
134
|
-
]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:Kr},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r
|
|
135
|
-
*])`},{character:"*",inConstruct:"phrasing",notInConstruct:Kr},{atBreak:!0,character:"+",after:`(?:[ \r
|
|
136
|
-
])`},{atBreak:!0,character:"-",after:`(?:[ \r
|
|
137
|
-
-])`},{atBreak:!0,before:"\\d+",character:".",after:`(?:[ \r
|
|
138
|
-
]|$)`},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:Kr},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:Kr},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:Kr},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:Kr},{atBreak:!0,character:"~"}],Db=document.createElement("i");function rm(t){const e="&"+t+";";Db.innerHTML=e;const n=Db.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function NS(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}const X8=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function IS(t){return t.replace(X8,Z8)}function Z8(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return NS(n.slice(s?2:1),s?16:10)}return rm(n)||t}function eF(t){return t.label||!t.identifier?t.label||"":IS(t.identifier)}function tF(t){if(!t._compiled){const e=(t.atBreak?"[\\r\\n][\\t ]*":"")+(t.before?"(?:"+t.before+")":"");t._compiled=new RegExp((e?"("+e+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(t.character)?"\\":"")+t.character+(t.after?"(?:"+t.after+")":""),"g")}return t._compiled}function nF(t,e,n){const r=e.indexStack,i=t.children||[],s=[];let o=-1,a=n.before,l;r.push(-1);let c=e.createTracker(n);for(;++o<i.length;){const u=i[o];let d;if(r[r.length-1]=o,o+1<i.length){let p=e.handle.handlers[i[o+1].type];p&&p.peek&&(p=p.peek),d=p?p(i[o+1],t,e,{before:"",after:"",...c.current()}).charAt(0):""}else d=n.after;s.length>0&&(a==="\r"||a===`
|
|
139
|
-
`)&&u.type==="html"&&(s[s.length-1]=s[s.length-1].replace(/(\r?\n|\r)$/," "),a=" ",c=e.createTracker(n),c.move(s.join("")));let h=e.handle(u,t,e,{...c.current(),after:d,before:a});l&&l===h.slice(0,1)&&(h=Ur(l.charCodeAt(0))+h.slice(1));const f=e.attentionEncodeSurroundingInfo;e.attentionEncodeSurroundingInfo=void 0,l=void 0,f&&(s.length>0&&f.before&&a===s[s.length-1].slice(-1)&&(s[s.length-1]=s[s.length-1].slice(0,-1)+Ur(a.charCodeAt(0))),f.after&&(l=d)),c.move(h),s.push(h),a=h.slice(-1)}return r.pop(),s.join("")}function rF(t,e,n){const r=e.indexStack,i=t.children||[],s=e.createTracker(n),o=[];let a=-1;for(r.push(-1);++a<i.length;){const l=i[a];r[r.length-1]=a,o.push(s.move(e.handle(l,t,e,{before:`
|
|
140
|
-
`,after:`
|
|
141
|
-
`,...s.current()}))),l.type!=="list"&&(e.bulletLastUsed=void 0),a<i.length-1&&o.push(s.move(iF(l,i[a+1],t,e)))}return r.pop(),o.join("")}function iF(t,e,n,r){let i=r.join.length;for(;i--;){const s=r.join[i](t,e,n,r);if(s===!0||s===1)break;if(typeof s=="number")return`
|
|
142
|
-
`.repeat(1+s);if(s===!1)return`
|
|
143
|
-
|
|
144
|
-
<!---->
|
|
145
|
-
|
|
146
|
-
`}return`
|
|
147
|
-
|
|
148
|
-
`}const sF=/\r?\n|\r/g;function oF(t,e){const n=[];let r=0,i=0,s;for(;s=sF.exec(t);)o(t.slice(r,s.index)),n.push(s[0]),r=s.index+s[0].length,i++;return o(t.slice(r)),n.join("");function o(a){n.push(e(a,i,!a))}}function aF(t,e,n){const r=(n.before||"")+(e||"")+(n.after||""),i=[],s=[],o={};let a=-1;for(;++a<t.unsafe.length;){const u=t.unsafe[a];if(!gS(t.stack,u))continue;const d=t.compilePattern(u);let h;for(;h=d.exec(r);){const f="before"in u||!!u.atBreak,p="after"in u,g=h.index+(f?h[1].length:0);i.includes(g)?(o[g].before&&!f&&(o[g].before=!1),o[g].after&&!p&&(o[g].after=!1)):(i.push(g),o[g]={before:f,after:p})}}i.sort(lF);let l=n.before?n.before.length:0;const c=r.length-(n.after?n.after.length:0);for(a=-1;++a<i.length;){const u=i[a];u<l||u>=c||u+1<c&&i[a+1]===u+1&&o[u].after&&!o[u+1].before&&!o[u+1].after||i[a-1]===u-1&&o[u].before&&!o[u-1].before&&!o[u-1].after||(l!==u&&s.push(Lb(r.slice(l,u),"\\")),l=u,/[!-/:-@[-`{-~]/.test(r.charAt(u))&&(!n.encode||!n.encode.includes(r.charAt(u)))?s.push("\\"):(s.push(Ur(r.charCodeAt(u))),l++))}return s.push(Lb(r.slice(l,c),n.after)),s.join("")}function lF(t,e){return t-e}function Lb(t,e){const n=/\\(?=[!-/:-@[-`{-~])/g,r=[],i=[],s=t+e;let o=-1,a=0,l;for(;l=n.exec(s);)r.push(l.index);for(;++o<r.length;)a!==r[o]&&i.push(t.slice(a,r[o])),i.push("\\"),a=r[o];return i.push(t.slice(a)),i.join("")}function cF(t){const e=t||{},n=e.now||{};let r=e.lineShift||0,i=n.line||1,s=n.column||1;return{move:l,current:o,shift:a};function o(){return{now:{line:i,column:s},lineShift:r}}function a(c){r+=c}function l(c){const u=c||"",d=u.split(/\r?\n|\r/g),h=d[d.length-1];return i+=d.length-1,s=d.length===1?s+h.length:1+h.length+r,u}}function uF(t,e){const n=e||{},r={associationId:eF,containerPhrasing:pF,containerFlow:mF,createTracker:cF,compilePattern:tF,enter:s,handlers:{...nm},handle:void 0,indentLines:oF,indexStack:[],join:[...G8],options:{},safe:gF,stack:[],unsafe:[...J8]};mS(r,n),r.options.tightDefinitions&&r.join.push(fF),r.handle=pS("type",{invalid:dF,unknown:hF,handlers:r.handlers});let i=r.handle(t,void 0,r,{before:`
|
|
149
|
-
`,after:`
|
|
150
|
-
`,now:{line:1,column:1},lineShift:0});return i&&i.charCodeAt(i.length-1)!==10&&i.charCodeAt(i.length-1)!==13&&(i+=`
|
|
151
|
-
`),i;function s(o){return r.stack.push(o),a;function a(){r.stack.pop()}}}function dF(t){throw new Error("Cannot handle value `"+t+"`, expected node")}function hF(t){const e=t;throw new Error("Cannot handle unknown node `"+e.type+"`")}function fF(t,e){if(t.type==="definition"&&t.type===e.type)return 0}function pF(t,e){return nF(t,this,e)}function mF(t,e){return rF(t,this,e)}function gF(t,e){return aF(this,t,e)}function bF(){return{enter:{table:yF,tableData:Rb,tableHeader:Rb,tableRow:kF},exit:{codeText:TF,table:EF,tableData:Ad,tableHeader:Ad,tableRow:Ad}}}function yF(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function EF(t){this.exit(t),this.data.inTable=void 0}function kF(t){this.enter({type:"tableRow",children:[]},t)}function Ad(t){this.exit(t)}function Rb(t){this.enter({type:"tableCell",children:[]},t)}function TF(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,CF));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function CF(t,e){return e==="|"?e:t}function SF(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,i=e.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
152
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:o,tableCell:l,tableRow:a}};function o(f,p,g,b){return c(u(f,g,b),f.align)}function a(f,p,g,b){const y=d(f,g,b),C=c([y]);return C.slice(0,C.indexOf(`
|
|
153
|
-
`))}function l(f,p,g,b){const y=g.enter("tableCell"),C=g.enter("phrasing"),S=g.containerPhrasing(f,{...b,before:s,after:s});return C(),y(),S}function c(f,p){return b8(f,{align:p,alignDelimiters:r,padding:n,stringLength:i})}function u(f,p,g){const b=f.children;let y=-1;const C=[],S=p.enter("table");for(;++y<b.length;)C[y]=d(b[y],p,g);return S(),C}function d(f,p,g){const b=f.children;let y=-1;const C=[],S=p.enter("tableRow");for(;++y<b.length;)C[y]=l(b[y],f,p,g);return S(),C}function h(f,p,g){let b=nm.inlineCode(f,p,g);return g.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function wF(){return{exit:{taskListCheckValueChecked:Pb,taskListCheckValueUnchecked:Pb,paragraph:AF}}}function xF(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:_F}}}function Pb(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function AF(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=e.children;let s=-1,o;for(;++s<i.length;){const a=i[s];if(a.type==="paragraph"){o=a;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function _F(t,e,n,r){const i=t.children[0],s=typeof t.checked=="boolean"&&i&&i.type==="paragraph",o="["+(t.checked?"x":" ")+"] ",a=n.createTracker(r);s&&a.move(o);let l=nm.listItem(t,e,n,{...r,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(u){return u+o}}function NF(){return[U5(),a8(),d8(),bF(),wF()]}function IF(t){return{extensions:[$5(),l8(t),h8(),SF(t),xF()]}}function $t(t,e,n,r){const i=t.length;let s=0,o;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(e,n),t.splice(...o);else for(n&&t.splice(e,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(e,0),t.splice(...o),s+=1e4,e+=1e4}function Gt(t,e){return t.length>0?($t(t,t.length,0,e),t):e}const Bb={}.hasOwnProperty;function OS(t){const e={};let n=-1;for(;++n<t.length;)OF(e,t[n]);return e}function OF(t,e){let n;for(n in e){const i=(Bb.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let o;if(s)for(o in s){Bb.call(i,o)||(i[o]=[]);const a=s[o];MF(i[o],Array.isArray(a)?a:a?[a]:[])}}}function MF(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);$t(t,0,0,r)}const vF={tokenize:FF,partial:!0},MS={tokenize:HF,partial:!0},vS={tokenize:UF,partial:!0},DS={tokenize:$F,partial:!0},DF={tokenize:zF,partial:!0},LS={name:"wwwAutolink",tokenize:PF,previous:PS},RS={name:"protocolAutolink",tokenize:BF,previous:BS},cr={name:"emailAutolink",tokenize:RF,previous:FS},$n={};function LF(){return{text:$n}}let Gr=48;for(;Gr<123;)$n[Gr]=cr,Gr++,Gr===58?Gr=65:Gr===91&&(Gr=97);$n[43]=cr;$n[45]=cr;$n[46]=cr;$n[95]=cr;$n[72]=[cr,RS];$n[104]=[cr,RS];$n[87]=[cr,LS];$n[119]=[cr,LS];function RF(t,e,n){const r=this;let i,s;return o;function o(d){return!Gh(d)||!FS.call(r,r.previous)||im(r.events)?n(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(d))}function a(d){return Gh(d)?(t.consume(d),a):d===64?(t.consume(d),l):n(d)}function l(d){return d===46?t.check(DF,u,c)(d):d===45||d===95||ut(d)?(s=!0,t.consume(d),l):u(d)}function c(d){return t.consume(d),i=!0,l}function u(d){return s&&i&>(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):n(d)}}function PF(t,e,n){const r=this;return i;function i(o){return o!==87&&o!==119||!PS.call(r,r.previous)||im(r.events)?n(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(vF,t.attempt(MS,t.attempt(vS,s),n),n)(o))}function s(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function BF(t,e,n){const r=this;let i="",s=!1;return o;function o(d){return(d===72||d===104)&&BS.call(r,r.previous)&&!im(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),t.consume(d),a):n(d)}function a(d){if(gt(d)&&i.length<5)return i+=String.fromCodePoint(d),t.consume(d),a;if(d===58){const h=i.toLowerCase();if(h==="http"||h==="https")return t.consume(d),l}return n(d)}function l(d){return d===47?(t.consume(d),s?c:(s=!0,l)):n(d)}function c(d){return d===null||oc(d)||we(d)||_i(d)||Au(d)?n(d):t.attempt(MS,t.attempt(vS,u),n)(d)}function u(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function FF(t,e,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,t.consume(o),i):o===46&&r===3?(t.consume(o),s):n(o)}function s(o){return o===null?n(o):e(o)}}function HF(t,e,n){let r,i,s;return o;function o(c){return c===46||c===95?t.check(DS,l,a)(c):c===null||we(c)||_i(c)||c!==45&&Au(c)?l(c):(s=!0,t.consume(c),o)}function a(c){return c===95?r=!0:(i=r,r=void 0),t.consume(c),o}function l(c){return i||r||!s?n(c):e(c)}}function UF(t,e){let n=0,r=0;return i;function i(o){return o===40?(n++,t.consume(o),i):o===41&&r<n?s(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?t.check(DS,e,s)(o):o===null||we(o)||_i(o)?e(o):(t.consume(o),i)}function s(o){return o===41&&r++,t.consume(o),i}}function $F(t,e,n){return r;function r(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(t.consume(a),r):a===38?(t.consume(a),s):a===93?(t.consume(a),i):a===60||a===null||we(a)||_i(a)?e(a):n(a)}function i(a){return a===null||a===40||a===91||we(a)||_i(a)?e(a):r(a)}function s(a){return gt(a)?o(a):n(a)}function o(a){return a===59?(t.consume(a),r):gt(a)?(t.consume(a),o):n(a)}}function zF(t,e,n){return r;function r(s){return t.consume(s),i}function i(s){return ut(s)?n(s):e(s)}}function PS(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||we(t)}function BS(t){return!gt(t)}function FS(t){return!(t===47||Gh(t))}function Gh(t){return t===43||t===45||t===46||t===95||ut(t)}function im(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function Hs(t){const e=[];let n=-1,r=0,i=0;for(;++n<t.length;){const s=t.charCodeAt(n);let o="";if(s===37&&ut(t.charCodeAt(n+1))&&ut(t.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const a=t.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(e.push(t.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function _u(t,e,n){const r=[];let i=-1;for(;++i<t.length;){const s=t[i].resolveAll;s&&!r.includes(s)&&(e=s(e,n),r.push(s))}return e}const Qh={name:"attention",resolveAll:VF,tokenize:jF};function VF(t,e){let n=-1,r,i,s,o,a,l,c,u;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;l=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const d={...t[r][1].end},h={...t[n][1].start};Fb(d,-l),Fb(h,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...t[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:h},s={type:l>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},t[r][1].end={...o.start},t[n][1].start={...a.end},c=[],t[r][1].end.offset-t[r][1].start.offset&&(c=Gt(c,[["enter",t[r][1],e],["exit",t[r][1],e]])),c=Gt(c,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),c=Gt(c,_u(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),c=Gt(c,[["exit",s,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(u=2,c=Gt(c,[["enter",t[n][1],e],["exit",t[n][1],e]])):u=0,$t(t,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function jF(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=_s(r);let s;return o;function o(l){return s=l,t.enter("attentionSequence"),a(l)}function a(l){if(l===s)return t.consume(l),a;const c=t.exit("attentionSequence"),u=_s(l),d=!u||u===2&&i||n.includes(l),h=!i||i===2&&u||n.includes(r);return c._open=!!(s===42?d:d&&(i||!h)),c._close=!!(s===42?h:h&&(u||!d)),e(l)}}function Fb(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const qF={name:"autolink",tokenize:WF};function WF(t,e,n){let r=0;return i;function i(f){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(f){return gt(f)?(t.consume(f),o):f===64?n(f):c(f)}function o(f){return f===43||f===45||f===46||ut(f)?(r=1,a(f)):c(f)}function a(f){return f===58?(t.consume(f),r=0,l):(f===43||f===45||f===46||ut(f))&&r++<32?(t.consume(f),a):(r=0,c(f))}function l(f){return f===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):f===null||f===32||f===60||oc(f)?n(f):(t.consume(f),l)}function c(f){return f===64?(t.consume(f),u):v5(f)?(t.consume(f),c):n(f)}function u(f){return ut(f)?d(f):n(f)}function d(f){return f===46?(t.consume(f),r=0,u):f===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):h(f)}function h(f){if((f===45||ut(f))&&r++<63){const p=f===45?h:d;return t.consume(f),p}return n(f)}}function de(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return ae(l)?(t.enter(n),a(l)):e(l)}function a(l){return ae(l)&&s++<i?(t.consume(l),a):(t.exit(n),e(l))}}const Ca={partial:!0,tokenize:YF};function YF(t,e,n){return r;function r(s){return ae(s)?de(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||G(s)?e(s):n(s)}}const HS={continuation:{tokenize:GF},exit:QF,name:"blockQuote",tokenize:KF};function KF(t,e,n){const r=this;return i;function i(o){if(o===62){const a=r.containerState;return a.open||(t.enter("blockQuote",{_container:!0}),a.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),s}return n(o)}function s(o){return ae(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function GF(t,e,n){const r=this;return i;function i(o){return ae(o)?de(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(HS,e,n)(o)}}function QF(t){t.exit("blockQuote")}const US={name:"characterEscape",tokenize:JF};function JF(t,e,n){return r;function r(s){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(s),t.exit("escapeMarker"),i}function i(s){return L5(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const $S={name:"characterReference",tokenize:XF};function XF(t,e,n){const r=this;let i=0,s,o;return a;function a(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),l}function l(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),c):(t.enter("characterReferenceValue"),s=31,o=ut,u(d))}function c(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,o=D5,u):(t.enter("characterReferenceValue"),s=7,o=Yh,u(d))}function u(d){if(d===59&&i){const h=t.exit("characterReferenceValue");return o===ut&&!rm(r.sliceSerialize(h))?n(d):(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(d)&&i++<s?(t.consume(d),u):n(d)}}const Hb={partial:!0,tokenize:e9},Ub={concrete:!0,name:"codeFenced",tokenize:ZF};function ZF(t,e,n){const r=this,i={partial:!0,tokenize:M};let s=0,o=0,a;return l;function l(A){return c(A)}function c(A){const D=r.events[r.events.length-1];return s=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,a=A,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),u(A)}function u(A){return A===a?(o++,t.consume(A),u):o<3?n(A):(t.exit("codeFencedFenceSequence"),ae(A)?de(t,d,"whitespace")(A):d(A))}function d(A){return A===null||G(A)?(t.exit("codeFencedFence"),r.interrupt?e(A):t.check(Hb,g,I)(A)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),h(A))}function h(A){return A===null||G(A)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(A)):ae(A)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),de(t,f,"whitespace")(A)):A===96&&A===a?n(A):(t.consume(A),h)}function f(A){return A===null||G(A)?d(A):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),p(A))}function p(A){return A===null||G(A)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(A)):A===96&&A===a?n(A):(t.consume(A),p)}function g(A){return t.attempt(i,I,b)(A)}function b(A){return t.enter("lineEnding"),t.consume(A),t.exit("lineEnding"),y}function y(A){return s>0&&ae(A)?de(t,C,"linePrefix",s+1)(A):C(A)}function C(A){return A===null||G(A)?t.check(Hb,g,I)(A):(t.enter("codeFlowValue"),S(A))}function S(A){return A===null||G(A)?(t.exit("codeFlowValue"),C(A)):(t.consume(A),S)}function I(A){return t.exit("codeFenced"),e(A)}function M(A,D,z){let V=0;return _;function _(K){return A.enter("lineEnding"),A.consume(K),A.exit("lineEnding"),U}function U(K){return A.enter("codeFencedFence"),ae(K)?de(A,q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(K):q(K)}function q(K){return K===a?(A.enter("codeFencedFenceSequence"),J(K)):z(K)}function J(K){return K===a?(V++,A.consume(K),J):V>=o?(A.exit("codeFencedFenceSequence"),ae(K)?de(A,ee,"whitespace")(K):ee(K)):z(K)}function ee(K){return K===null||G(K)?(A.exit("codeFencedFence"),D(K)):z(K)}}}function e9(t,e,n){const r=this;return i;function i(o){return o===null?n(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}const _d={name:"codeIndented",tokenize:n9},t9={partial:!0,tokenize:r9};function n9(t,e,n){const r=this;return i;function i(c){return t.enter("codeIndented"),de(t,s,"linePrefix",5)(c)}function s(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):G(c)?t.attempt(t9,o,l)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||G(c)?(t.exit("codeFlowValue"),o(c)):(t.consume(c),a)}function l(c){return t.exit("codeIndented"),e(c)}}function r9(t,e,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):G(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):de(t,s,"linePrefix",5)(o)}function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):G(o)?i(o):n(o)}}const i9={name:"codeText",previous:o9,resolve:s9,tokenize:a9};function s9(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)i===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(i=r):(r===e||t[r][1].type==="lineEnding")&&(t[i][1].type="codeTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return t}function o9(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function a9(t,e,n){let r=0,i,s;return o;function o(d){return t.enter("codeText"),t.enter("codeTextSequence"),a(d)}function a(d){return d===96?(t.consume(d),r++,a):(t.exit("codeTextSequence"),l(d))}function l(d){return d===null?n(d):d===32?(t.enter("space"),t.consume(d),t.exit("space"),l):d===96?(s=t.enter("codeTextSequence"),i=0,u(d)):G(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),l):(t.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||G(d)?(t.exit("codeTextData"),l(d)):(t.consume(d),c)}function u(d){return d===96?(t.consume(d),i++,u):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(d)):(s.type="codeTextData",c(d))}}class l9{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Qs(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Qs(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Qs(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);Qs(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Qs(this.left,n.reverse())}}}function Qs(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function zS(t){const e={};let n=-1,r,i,s,o,a,l,c;const u=new l9(t);for(;++n<u.length;){for(;n in e;)n=e[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,c9(u,n)),n=e[n],c=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=u.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...u.get(i)[1].start},a=u.slice(i,n),a.unshift(r),u.splice(i,n-i+1,a))}}return $t(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function c9(t,e){const n=t.get(e)[1],r=t.get(e)[2];let i=e-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],c={};let u,d,h=-1,f=n,p=0,g=0;const b=[g];for(;f;){for(;t.get(++i)[1]!==f;);s.push(i),f._tokenizer||(u=r.sliceStream(f),f.next||u.push(null),d&&o.defineSkip(f.start),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=f,f=f.next}for(f=n;++h<a.length;)a[h][0]==="exit"&&a[h-1][0]==="enter"&&a[h][1].type===a[h-1][1].type&&a[h][1].start.line!==a[h][1].end.line&&(g=h+1,b.push(g),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(o.events=[],f?(f._tokenizer=void 0,f.previous=void 0):b.pop(),h=b.length;h--;){const y=a.slice(b[h],b[h+1]),C=s.pop();l.push([C,C+y.length-1]),t.splice(C,2,y)}for(l.reverse(),h=-1;++h<l.length;)c[p+l[h][0]]=p+l[h][1],p+=l[h][1]-l[h][0]-1;return c}const u9={resolve:h9,tokenize:f9},d9={partial:!0,tokenize:p9};function h9(t){return zS(t),t}function f9(t,e){let n;return r;function r(a){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):G(a)?t.check(d9,o,s)(a):(t.consume(a),i)}function s(a){return t.exit("chunkContent"),t.exit("content"),e(a)}function o(a){return t.consume(a),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function p9(t,e,n){const r=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),de(t,s,"linePrefix")}function s(o){if(o===null||G(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):t.interrupt(r.parser.constructs.flow,n,e)(o)}}function VS(t,e,n,r,i,s,o,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(y){return y===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(y),t.exit(s),h):y===null||y===32||y===41||oc(y)?n(y):(t.enter(r),t.enter(o),t.enter(a),t.enter("chunkString",{contentType:"string"}),g(y))}function h(y){return y===62?(t.enter(s),t.consume(y),t.exit(s),t.exit(i),t.exit(r),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),f(y))}function f(y){return y===62?(t.exit("chunkString"),t.exit(a),h(y)):y===null||y===60||G(y)?n(y):(t.consume(y),y===92?p:f)}function p(y){return y===60||y===62||y===92?(t.consume(y),f):f(y)}function g(y){return!u&&(y===null||y===41||we(y))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(r),e(y)):u<c&&y===40?(t.consume(y),u++,g):y===41?(t.consume(y),u--,g):y===null||y===32||y===40||oc(y)?n(y):(t.consume(y),y===92?b:g)}function b(y){return y===40||y===41||y===92?(t.consume(y),g):g(y)}}function jS(t,e,n,r,i,s){const o=this;let a=0,l;return c;function c(f){return t.enter(r),t.enter(i),t.consume(f),t.exit(i),t.enter(s),u}function u(f){return a>999||f===null||f===91||f===93&&!l||f===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(f):f===93?(t.exit(s),t.enter(i),t.consume(f),t.exit(i),t.exit(r),e):G(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===null||f===91||f===93||G(f)||a++>999?(t.exit("chunkString"),u(f)):(t.consume(f),l||(l=!ae(f)),f===92?h:d)}function h(f){return f===91||f===92||f===93?(t.consume(f),a++,d):d(f)}}function qS(t,e,n,r,i,s){let o;return a;function a(h){return h===34||h===39||h===40?(t.enter(r),t.enter(i),t.consume(h),t.exit(i),o=h===40?41:h,l):n(h)}function l(h){return h===o?(t.enter(i),t.consume(h),t.exit(i),t.exit(r),e):(t.enter(s),c(h))}function c(h){return h===o?(t.exit(s),l(o)):h===null?n(h):G(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),de(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(h))}function u(h){return h===o||h===null||G(h)?(t.exit("chunkString"),c(h)):(t.consume(h),h===92?d:u)}function d(h){return h===o||h===92?(t.consume(h),u):u(h)}}function To(t,e){let n;return r;function r(i){return G(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):ae(i)?de(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const m9={name:"definition",tokenize:b9},g9={partial:!0,tokenize:y9};function b9(t,e,n){const r=this;let i;return s;function s(f){return t.enter("definition"),o(f)}function o(f){return jS.call(r,t,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return i=gn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(t.enter("definitionMarker"),t.consume(f),t.exit("definitionMarker"),l):n(f)}function l(f){return we(f)?To(t,c)(f):c(f)}function c(f){return VS(t,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function u(f){return t.attempt(g9,d,d)(f)}function d(f){return ae(f)?de(t,h,"whitespace")(f):h(f)}function h(f){return f===null||G(f)?(t.exit("definition"),r.parser.defined.push(i),e(f)):n(f)}}function y9(t,e,n){return r;function r(a){return we(a)?To(t,i)(a):n(a)}function i(a){return qS(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return ae(a)?de(t,o,"whitespace")(a):o(a)}function o(a){return a===null||G(a)?e(a):n(a)}}const E9={name:"hardBreakEscape",tokenize:k9};function k9(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return G(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const T9={name:"headingAtx",resolve:C9,tokenize:S9};function C9(t,e){let n=t.length-2,r=3,i,s;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},s={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},$t(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function S9(t,e,n){let r=0;return i;function i(u){return t.enter("atxHeading"),s(u)}function s(u){return t.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&r++<6?(t.consume(u),o):u===null||we(u)?(t.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(t.enter("atxHeadingSequence"),l(u)):u===null||G(u)?(t.exit("atxHeading"),e(u)):ae(u)?de(t,a,"whitespace")(u):(t.enter("atxHeadingText"),c(u))}function l(u){return u===35?(t.consume(u),l):(t.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||we(u)?(t.exit("atxHeadingText"),a(u)):(t.consume(u),c)}}const w9=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],$b=["pre","script","style","textarea"],x9={concrete:!0,name:"htmlFlow",resolveTo:N9,tokenize:I9},A9={partial:!0,tokenize:M9},_9={partial:!0,tokenize:O9};function N9(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function I9(t,e,n){const r=this;let i,s,o,a,l;return c;function c(x){return u(x)}function u(x){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(x),d}function d(x){return x===33?(t.consume(x),h):x===47?(t.consume(x),s=!0,g):x===63?(t.consume(x),i=3,r.interrupt?e:w):gt(x)?(t.consume(x),o=String.fromCharCode(x),b):n(x)}function h(x){return x===45?(t.consume(x),i=2,f):x===91?(t.consume(x),i=5,a=0,p):gt(x)?(t.consume(x),i=4,r.interrupt?e:w):n(x)}function f(x){return x===45?(t.consume(x),r.interrupt?e:w):n(x)}function p(x){const cn="CDATA[";return x===cn.charCodeAt(a++)?(t.consume(x),a===cn.length?r.interrupt?e:q:p):n(x)}function g(x){return gt(x)?(t.consume(x),o=String.fromCharCode(x),b):n(x)}function b(x){if(x===null||x===47||x===62||we(x)){const cn=x===47,qr=o.toLowerCase();return!cn&&!s&&$b.includes(qr)?(i=1,r.interrupt?e(x):q(x)):w9.includes(o.toLowerCase())?(i=6,cn?(t.consume(x),y):r.interrupt?e(x):q(x)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(x):s?C(x):S(x))}return x===45||ut(x)?(t.consume(x),o+=String.fromCharCode(x),b):n(x)}function y(x){return x===62?(t.consume(x),r.interrupt?e:q):n(x)}function C(x){return ae(x)?(t.consume(x),C):_(x)}function S(x){return x===47?(t.consume(x),_):x===58||x===95||gt(x)?(t.consume(x),I):ae(x)?(t.consume(x),S):_(x)}function I(x){return x===45||x===46||x===58||x===95||ut(x)?(t.consume(x),I):M(x)}function M(x){return x===61?(t.consume(x),A):ae(x)?(t.consume(x),M):S(x)}function A(x){return x===null||x===60||x===61||x===62||x===96?n(x):x===34||x===39?(t.consume(x),l=x,D):ae(x)?(t.consume(x),A):z(x)}function D(x){return x===l?(t.consume(x),l=null,V):x===null||G(x)?n(x):(t.consume(x),D)}function z(x){return x===null||x===34||x===39||x===47||x===60||x===61||x===62||x===96||we(x)?M(x):(t.consume(x),z)}function V(x){return x===47||x===62||ae(x)?S(x):n(x)}function _(x){return x===62?(t.consume(x),U):n(x)}function U(x){return x===null||G(x)?q(x):ae(x)?(t.consume(x),U):n(x)}function q(x){return x===45&&i===2?(t.consume(x),Me):x===60&&i===1?(t.consume(x),et):x===62&&i===4?(t.consume(x),ln):x===63&&i===3?(t.consume(x),w):x===93&&i===5?(t.consume(x),zn):G(x)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(A9,Vn,J)(x)):x===null||G(x)?(t.exit("htmlFlowData"),J(x)):(t.consume(x),q)}function J(x){return t.check(_9,ee,Vn)(x)}function ee(x){return t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),K}function K(x){return x===null||G(x)?J(x):(t.enter("htmlFlowData"),q(x))}function Me(x){return x===45?(t.consume(x),w):q(x)}function et(x){return x===47?(t.consume(x),o="",an):q(x)}function an(x){if(x===62){const cn=o.toLowerCase();return $b.includes(cn)?(t.consume(x),ln):q(x)}return gt(x)&&o.length<8?(t.consume(x),o+=String.fromCharCode(x),an):q(x)}function zn(x){return x===93?(t.consume(x),w):q(x)}function w(x){return x===62?(t.consume(x),ln):x===45&&i===2?(t.consume(x),w):q(x)}function ln(x){return x===null||G(x)?(t.exit("htmlFlowData"),Vn(x)):(t.consume(x),ln)}function Vn(x){return t.exit("htmlFlow"),e(x)}}function O9(t,e,n){const r=this;return i;function i(o){return G(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}function M9(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Ca,e,n)}}const v9={name:"htmlText",tokenize:D9};function D9(t,e,n){const r=this;let i,s,o;return a;function a(w){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(w),l}function l(w){return w===33?(t.consume(w),c):w===47?(t.consume(w),M):w===63?(t.consume(w),S):gt(w)?(t.consume(w),z):n(w)}function c(w){return w===45?(t.consume(w),u):w===91?(t.consume(w),s=0,p):gt(w)?(t.consume(w),C):n(w)}function u(w){return w===45?(t.consume(w),f):n(w)}function d(w){return w===null?n(w):w===45?(t.consume(w),h):G(w)?(o=d,et(w)):(t.consume(w),d)}function h(w){return w===45?(t.consume(w),f):d(w)}function f(w){return w===62?Me(w):w===45?h(w):d(w)}function p(w){const ln="CDATA[";return w===ln.charCodeAt(s++)?(t.consume(w),s===ln.length?g:p):n(w)}function g(w){return w===null?n(w):w===93?(t.consume(w),b):G(w)?(o=g,et(w)):(t.consume(w),g)}function b(w){return w===93?(t.consume(w),y):g(w)}function y(w){return w===62?Me(w):w===93?(t.consume(w),y):g(w)}function C(w){return w===null||w===62?Me(w):G(w)?(o=C,et(w)):(t.consume(w),C)}function S(w){return w===null?n(w):w===63?(t.consume(w),I):G(w)?(o=S,et(w)):(t.consume(w),S)}function I(w){return w===62?Me(w):S(w)}function M(w){return gt(w)?(t.consume(w),A):n(w)}function A(w){return w===45||ut(w)?(t.consume(w),A):D(w)}function D(w){return G(w)?(o=D,et(w)):ae(w)?(t.consume(w),D):Me(w)}function z(w){return w===45||ut(w)?(t.consume(w),z):w===47||w===62||we(w)?V(w):n(w)}function V(w){return w===47?(t.consume(w),Me):w===58||w===95||gt(w)?(t.consume(w),_):G(w)?(o=V,et(w)):ae(w)?(t.consume(w),V):Me(w)}function _(w){return w===45||w===46||w===58||w===95||ut(w)?(t.consume(w),_):U(w)}function U(w){return w===61?(t.consume(w),q):G(w)?(o=U,et(w)):ae(w)?(t.consume(w),U):V(w)}function q(w){return w===null||w===60||w===61||w===62||w===96?n(w):w===34||w===39?(t.consume(w),i=w,J):G(w)?(o=q,et(w)):ae(w)?(t.consume(w),q):(t.consume(w),ee)}function J(w){return w===i?(t.consume(w),i=void 0,K):w===null?n(w):G(w)?(o=J,et(w)):(t.consume(w),J)}function ee(w){return w===null||w===34||w===39||w===60||w===61||w===96?n(w):w===47||w===62||we(w)?V(w):(t.consume(w),ee)}function K(w){return w===47||w===62||we(w)?V(w):n(w)}function Me(w){return w===62?(t.consume(w),t.exit("htmlTextData"),t.exit("htmlText"),e):n(w)}function et(w){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(w),t.exit("lineEnding"),an}function an(w){return ae(w)?de(t,zn,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):zn(w)}function zn(w){return t.enter("htmlTextData"),o(w)}}const sm={name:"labelEnd",resolveAll:B9,resolveTo:F9,tokenize:H9},L9={tokenize:U9},R9={tokenize:$9},P9={tokenize:z9};function B9(t){let e=-1;const n=[];for(;++e<t.length;){const r=t[e][1];if(n.push(t[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",e+=i}}return t.length!==n.length&&$t(t,0,t.length,n),t}function F9(t,e){let n=t.length,r=0,i,s,o,a;for(;n--;)if(i=t[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(t[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const l={type:t[s][1].type==="labelLink"?"link":"image",start:{...t[s][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[s][1].start},end:{...t[o][1].end}},u={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[o-2][1].start}};return a=[["enter",l,e],["enter",c,e]],a=Gt(a,t.slice(s+1,s+r+3)),a=Gt(a,[["enter",u,e]]),a=Gt(a,_u(e.parser.constructs.insideSpan.null,t.slice(s+r+4,o-3),e)),a=Gt(a,[["exit",u,e],t[o-2],t[o-1],["exit",c,e]]),a=Gt(a,t.slice(o+1)),a=Gt(a,[["exit",l,e]]),$t(t,s,t.length,a),t}function H9(t,e,n){const r=this;let i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return a;function a(h){return s?s._inactive?d(h):(o=r.parser.defined.includes(gn(r.sliceSerialize({start:s.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(h),t.exit("labelMarker"),t.exit("labelEnd"),l):n(h)}function l(h){return h===40?t.attempt(L9,u,o?u:d)(h):h===91?t.attempt(R9,u,o?c:d)(h):o?u(h):d(h)}function c(h){return t.attempt(P9,u,d)(h)}function u(h){return e(h)}function d(h){return s._balanced=!0,n(h)}}function U9(t,e,n){return r;function r(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),i}function i(d){return we(d)?To(t,s)(d):s(d)}function s(d){return d===41?u(d):VS(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return we(d)?To(t,l)(d):u(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?qS(t,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return we(d)?To(t,u)(d):u(d)}function u(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):n(d)}}function $9(t,e,n){const r=this;return i;function i(a){return jS.call(r,t,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(gn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(a):n(a)}function o(a){return n(a)}}function z9(t,e,n){return r;function r(s){return t.enter("reference"),t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),i}function i(s){return s===93?(t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),t.exit("reference"),e):n(s)}}const V9={name:"labelStartImage",resolveAll:sm.resolveAll,tokenize:j9};function j9(t,e,n){const r=this;return i;function i(a){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(a),t.exit("labelImageMarker"),s}function s(a){return a===91?(t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):e(a)}}const q9={name:"labelStartLink",resolveAll:sm.resolveAll,tokenize:W9};function W9(t,e,n){const r=this;return i;function i(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):e(o)}}const Nd={name:"lineEnding",tokenize:Y9};function Y9(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),de(t,e,"linePrefix")}}const El={name:"thematicBreak",tokenize:K9};function K9(t,e,n){let r=0,i;return s;function s(c){return t.enter("thematicBreak"),o(c)}function o(c){return i=c,a(c)}function a(c){return c===i?(t.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||G(c))?(t.exit("thematicBreak"),e(c)):n(c)}function l(c){return c===i?(t.consume(c),r++,l):(t.exit("thematicBreakSequence"),ae(c)?de(t,a,"whitespace")(c):a(c))}}const wt={continuation:{tokenize:X9},exit:eH,name:"list",tokenize:J9},G9={partial:!0,tokenize:tH},Q9={partial:!0,tokenize:Z9};function J9(t,e,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(f){const p=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:Yh(f)){if(r.containerState.type||(r.containerState.type=p,t.enter(p,{_container:!0})),p==="listUnordered")return t.enter("listItemPrefix"),f===42||f===45?t.check(El,n,c)(f):c(f);if(!r.interrupt||f===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(f)}return n(f)}function l(f){return Yh(f)&&++o<10?(t.consume(f),l):(!r.interrupt||o<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(t.exit("listItemValue"),c(f)):n(f)}function c(f){return t.enter("listItemMarker"),t.consume(f),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,t.check(Ca,r.interrupt?n:u,t.attempt(G9,h,d))}function u(f){return r.containerState.initialBlankLine=!0,s++,h(f)}function d(f){return ae(f)?(t.enter("listItemPrefixWhitespace"),t.consume(f),t.exit("listItemPrefixWhitespace"),h):n(f)}function h(f){return r.containerState.size=s+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(f)}}function X9(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Ca,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,de(t,e,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!ae(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(Q9,e,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,de(t,t.attempt(wt,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function Z9(t,e,n){const r=this;return de(t,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?e(s):n(s)}}function eH(t){t.exit(this.containerState.type)}function tH(t,e,n){const r=this;return de(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!ae(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const zb={name:"setextUnderline",resolveTo:nH,tokenize:rH};function nH(t,e){let n=t.length,r,i,s;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!s&&t[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",o,e]),t.splice(s+1,0,["exit",t[r][1],e]),t[r][1].end={...t[s][1].end}):t[r][1]=o,t.push(["exit",o,e]),t}function rH(t,e,n){const r=this;let i;return s;function s(c){let u=r.events.length,d;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){d=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(t.enter("setextHeadingLine"),i=c,o(c)):n(c)}function o(c){return t.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(t.consume(c),a):(t.exit("setextHeadingLineSequence"),ae(c)?de(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||G(c)?(t.exit("setextHeadingLine"),e(c)):n(c)}}const iH={tokenize:hH,partial:!0};function sH(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:cH,continuation:{tokenize:uH},exit:dH}},text:{91:{name:"gfmFootnoteCall",tokenize:lH},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:oH,resolveTo:aH}}}}function oH(t,e,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const l=r.events[i][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return n(l);const c=gn(r.sliceSerialize({start:o.end,end:r.now()}));return c.codePointAt(0)!==94||!s.includes(c.slice(1))?n(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function aH(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",i,e],["exit",i,e],["enter",s,e],["enter",o,e],["exit",o,e],["exit",s,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...a),t}function lH(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,o;return a;function a(d){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?n(d):(t.enter("gfmFootnoteCallMarker"),t.consume(d),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",c)}function c(d){if(s>999||d===93&&!o||d===null||d===91||we(d))return n(d);if(d===93){t.exit("chunkString");const h=t.exit("gfmFootnoteCallString");return i.includes(gn(r.sliceSerialize(h)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(d)}return we(d)||(o=!0),s++,t.consume(d),d===92?u:c}function u(d){return d===91||d===92||d===93?(t.consume(d),s++,c):c(d)}}function cH(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,o=0,a;return l;function l(p){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(p),t.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(p){return p===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(p),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",u):n(p)}function u(p){if(o>999||p===93&&!a||p===null||p===91||we(p))return n(p);if(p===93){t.exit("chunkString");const g=t.exit("gfmFootnoteDefinitionLabelString");return s=gn(r.sliceSerialize(g)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(p),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),h}return we(p)||(a=!0),o++,t.consume(p),p===92?d:u}function d(p){return p===91||p===92||p===93?(t.consume(p),o++,u):u(p)}function h(p){return p===58?(t.enter("definitionMarker"),t.consume(p),t.exit("definitionMarker"),i.includes(s)||i.push(s),de(t,f,"gfmFootnoteDefinitionWhitespace")):n(p)}function f(p){return e(p)}}function uH(t,e,n){return t.check(Ca,e,t.attempt(iH,e,n))}function dH(t){t.exit("gfmFootnoteDefinition")}function hH(t,e,n){const r=this;return de(t,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?e(s):n(s)}}function fH(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,a){let l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let c=l;for(;c--;)if(o[c][0]==="exit"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[c][1].end.offset-o[c][1].start.offset){o[l][1].type="strikethroughSequence",o[c][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[l][1].end)},d={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[l][1].start)},h=[["enter",u,a],["enter",o[c][1],a],["exit",o[c][1],a],["enter",d,a]],f=a.parser.constructs.insideSpan.null;f&&$t(h,h.length,0,_u(f,o.slice(c+1,l),a)),$t(h,h.length,0,[["exit",d,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",u,a]]),$t(o,c-1,l-c+3,h),l=c+h.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function s(o,a,l){const c=this.previous,u=this.events;let d=0;return h;function h(p){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(p):(o.enter("strikethroughSequenceTemporary"),f(p))}function f(p){const g=_s(c);if(p===126)return d>1?l(p):(o.consume(p),d++,f);if(d<2&&!n)return l(p);const b=o.exit("strikethroughSequenceTemporary"),y=_s(p);return b._open=!y||y===2&&!!g,b._close=!g||g===2&&!!y,a(p)}}}class pH{constructor(){this.map=[]}add(e,n,r){mH(this,e,n,r)}consume(e){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let i=r.pop();for(;i;){for(const s of i)e.push(s);i=r.pop()}this.map.length=0}}function mH(t,e,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<t.map.length;){if(t.map[i][0]===e){t.map[i][1]+=n,t.map[i][2].push(...r);return}i+=1}t.map.push([e,n,r])}}function gH(t,e){let n=!1;const r=[];for(;e<t.length;){const i=t[e];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function bH(){return{flow:{null:{name:"table",tokenize:yH,resolveAll:EH}}}}function yH(t,e,n){const r=this;let i=0,s=0,o;return a;function a(_){let U=r.events.length-1;for(;U>-1;){const ee=r.events[U][1].type;if(ee==="lineEnding"||ee==="linePrefix")U--;else break}const q=U>-1?r.events[U][1].type:null,J=q==="tableHead"||q==="tableRow"?A:l;return J===A&&r.parser.lazy[r.now().line]?n(_):J(_)}function l(_){return t.enter("tableHead"),t.enter("tableRow"),c(_)}function c(_){return _===124||(o=!0,s+=1),u(_)}function u(_){return _===null?n(_):G(_)?s>1?(s=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),f):n(_):ae(_)?de(t,u,"whitespace")(_):(s+=1,o&&(o=!1,i+=1),_===124?(t.enter("tableCellDivider"),t.consume(_),t.exit("tableCellDivider"),o=!0,u):(t.enter("data"),d(_)))}function d(_){return _===null||_===124||we(_)?(t.exit("data"),u(_)):(t.consume(_),_===92?h:d)}function h(_){return _===92||_===124?(t.consume(_),d):d(_)}function f(_){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(_):(t.enter("tableDelimiterRow"),o=!1,ae(_)?de(t,p,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):p(_))}function p(_){return _===45||_===58?b(_):_===124?(o=!0,t.enter("tableCellDivider"),t.consume(_),t.exit("tableCellDivider"),g):M(_)}function g(_){return ae(_)?de(t,b,"whitespace")(_):b(_)}function b(_){return _===58?(s+=1,o=!0,t.enter("tableDelimiterMarker"),t.consume(_),t.exit("tableDelimiterMarker"),y):_===45?(s+=1,y(_)):_===null||G(_)?I(_):M(_)}function y(_){return _===45?(t.enter("tableDelimiterFiller"),C(_)):M(_)}function C(_){return _===45?(t.consume(_),C):_===58?(o=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(_),t.exit("tableDelimiterMarker"),S):(t.exit("tableDelimiterFiller"),S(_))}function S(_){return ae(_)?de(t,I,"whitespace")(_):I(_)}function I(_){return _===124?p(_):_===null||G(_)?!o||i!==s?M(_):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(_)):M(_)}function M(_){return n(_)}function A(_){return t.enter("tableRow"),D(_)}function D(_){return _===124?(t.enter("tableCellDivider"),t.consume(_),t.exit("tableCellDivider"),D):_===null||G(_)?(t.exit("tableRow"),e(_)):ae(_)?de(t,D,"whitespace")(_):(t.enter("data"),z(_))}function z(_){return _===null||_===124||we(_)?(t.exit("data"),D(_)):(t.consume(_),_===92?V:z)}function V(_){return _===92||_===124?(t.consume(_),z):z(_)}}function EH(t,e){let n=-1,r=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,c,u,d;const h=new pH;for(;++n<t.length;){const f=t[n],p=f[1];f[0]==="enter"?p.type==="tableHead"?(a=!1,l!==0&&(Vb(h,e,l,c,u),u=void 0,l=0),c={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},h.add(n,0,[["enter",c,e]])):p.type==="tableRow"||p.type==="tableDelimiterRow"?(r=!0,d=void 0,s=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,u={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},h.add(n,0,[["enter",u,e]])),i=p.type==="tableDelimiterRow"?2:u?3:1):i&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],d=Ya(h,e,s,i,void 0,d),s=[0,0,0,0]),o[2]=n)):p.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(o[0]=o[1],d=Ya(h,e,s,i,void 0,d)),s=o,o=[s[1],n,0,0])):p.type==="tableHead"?(a=!0,l=n):p.type==="tableRow"||p.type==="tableDelimiterRow"?(l=n,s[1]!==0?(o[0]=o[1],d=Ya(h,e,s,i,n,d)):o[1]!==0&&(d=Ya(h,e,o,i,n,d)),i=0):i&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&Vb(h,e,l,c,u),h.consume(e.events),n=-1;++n<e.events.length;){const f=e.events[n];f[0]==="enter"&&f[1].type==="table"&&(f[1]._align=gH(e.events,n))}return t}function Ya(t,e,n,r,i,s){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(s.end=Object.assign({},Yi(e.events,n[0])),t.add(n[0],0,[["exit",s,e]]));const l=Yi(e.events,n[1]);if(s={type:o,start:Object.assign({},l),end:Object.assign({},l)},t.add(n[1],0,[["enter",s,e]]),n[2]!==0){const c=Yi(e.events,n[2]),u=Yi(e.events,n[3]),d={type:a,start:Object.assign({},c),end:Object.assign({},u)};if(t.add(n[2],0,[["enter",d,e]]),r!==2){const h=e.events[n[2]],f=e.events[n[3]];if(h[1].end=Object.assign({},f[1].end),h[1].type="chunkText",h[1].contentType="text",n[3]>n[2]+1){const p=n[2]+1,g=n[3]-n[2]-1;t.add(p,g,[])}}t.add(n[3]+1,0,[["exit",d,e]])}return i!==void 0&&(s.end=Object.assign({},Yi(e.events,i)),t.add(i,0,[["exit",s,e]]),s=void 0),s}function Vb(t,e,n,r,i){const s=[],o=Yi(e.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,e])),r.end=Object.assign({},o),s.push(["exit",r,e]),t.add(n+1,0,s)}function Yi(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const kH={name:"tasklistCheck",tokenize:CH};function TH(){return{text:{91:kH}}}function CH(t,e,n){const r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),s)}function s(l){return we(l)?(t.enter("taskListCheckValueUnchecked"),t.consume(l),t.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(t.enter("taskListCheckValueChecked"),t.consume(l),t.exit("taskListCheckValueChecked"),o):n(l)}function o(l){return l===93?(t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),a):n(l)}function a(l){return G(l)?e(l):ae(l)?t.check({tokenize:SH},e,n)(l):n(l)}}function SH(t,e,n){return de(t,r,"whitespace");function r(i){return i===null?n(i):e(i)}}function wH(t){return OS([LF(),sH(),fH(t),bH(),TH()])}const xH={};function WS(t){const e=this,n=t||xH,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(wH(n)),s.push(NF()),o.push(IF(n))}function AH(t){const e=this;e.compiler=n;function n(r){return uF(r,{...e.data("settings"),...t,extensions:e.data("toMarkdownExtensions")||[]})}}function jb(t){if(t)throw t}var Id,qb;function _H(){if(qb)return Id;qb=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(c){return typeof Array.isArray=="function"?Array.isArray(c):e.call(c)==="[object Array]"},s=function(c){if(!c||e.call(c)!=="[object Object]")return!1;var u=t.call(c,"constructor"),d=c.constructor&&c.constructor.prototype&&t.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!u&&!d)return!1;var h;for(h in c);return typeof h>"u"||t.call(c,h)},o=function(c,u){n&&u.name==="__proto__"?n(c,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):c[u.name]=u.newValue},a=function(c,u){if(u==="__proto__")if(t.call(c,u)){if(r)return r(c,u).value}else return;return c[u]};return Id=function l(){var c,u,d,h,f,p,g=arguments[0],b=1,y=arguments.length,C=!1;for(typeof g=="boolean"&&(C=g,g=arguments[1]||{},b=2),(g==null||typeof g!="object"&&typeof g!="function")&&(g={});b<y;++b)if(c=arguments[b],c!=null)for(u in c)d=a(g,u),h=a(c,u),g!==h&&(C&&h&&(s(h)||(f=i(h)))?(f?(f=!1,p=d&&i(d)?d:[]):p=d&&s(d)?d:{},o(g,{name:u,newValue:l(C,p,h)})):typeof h<"u"&&o(g,{name:u,newValue:h}));return g},Id}var NH=_H();const Od=v1(NH);function Jh(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function IH(){const t=[],e={run:n,use:r};return e;function n(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...i);function a(l,...c){const u=t[++s];let d=-1;if(l){o(l);return}for(;++d<i.length;)(c[d]===null||c[d]===void 0)&&(c[d]=i[d]);i=c,u?OH(u,a)(...c):o(null,...c)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function OH(t,e){let n;return r;function r(...o){const a=t.length>o.length;let l;a&&o.push(i);try{l=t.apply(this,o)}catch(c){const u=c;if(a&&n)throw u;return i(u)}a||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(o,...a){n||(n=!0,e(o,...a))}function s(o){i(null,o)}}const MH=(function(t){const r=this.constructor.prototype,i=r[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),vH={}.hasOwnProperty;class om extends MH{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=IH()}copy(){const e=new om;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(Od(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(Dd("data",this.frozen),this.namespace[e]=n,this):vH.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Dd("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(e,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=Ka(e),r=this.parser||this.Parser;return Md("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),Md("process",this.parser||this.Parser),vd("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,o){const a=Ka(e),l=r.parse(a);r.run(l,a,function(u,d,h){if(u||!d||!h)return c(u);const f=d,p=r.stringify(f,h);LH(p)?h.value=p:h.result=p,c(u,h)});function c(u,d){u||!d?o(u):s?s(d):n(void 0,d)}}}processSync(e){let n=!1,r;return this.freeze(),Md("processSync",this.parser||this.Parser),vd("processSync",this.compiler||this.Compiler),this.process(e,i),Yb("processSync","process",n),r;function i(s,o){n=!0,jb(s),r=o}}run(e,n,r){Wb(e),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(o,a){const l=Ka(n);i.run(e,l,c);function c(u,d,h){const f=d||e;u?a(u):o?o(f):r(void 0,f,h)}}}runSync(e,n){let r=!1,i;return this.run(e,n,s),Yb("runSync","run",r),i;function s(o,a){jb(o),i=a,r=!0}}stringify(e,n){this.freeze();const r=Ka(n),i=this.compiler||this.Compiler;return vd("stringify",i),Wb(e),i(e,r)}use(e,...n){const r=this.attachers,i=this.namespace;if(Dd("use",this.frozen),e!=null)if(typeof e=="function")l(e,n);else if(typeof e=="object")Array.isArray(e)?a(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function s(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...d]=c;l(u,d)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(i.settings=Od(!0,i.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const d=c[u];s(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let d=-1,h=-1;for(;++d<r.length;)if(r[d][0]===c){h=d;break}if(h===-1)r.push([c,...u]);else if(u.length>0){let[f,...p]=u;const g=r[h][1];Jh(g)&&Jh(f)&&(f=Od(!0,g,f)),r[h]=[c,f,...p]}}}}const YS=new om().freeze();function Md(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function vd(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Dd(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Wb(t){if(!Jh(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Yb(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Ka(t){return DH(t)?t:new qh(t)}function DH(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function LH(t){return typeof t=="string"||RH(t)}function RH(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}function PH(t,e){return KS(t,{})||{type:"root",children:[]}}function KS(t,e){const n=BH(t,e);return n&&e.afterTransform&&e.afterTransform(t,n),n}function BH(t,e){switch(t.nodeType){case 1:return $H(t,e);case 3:return HH(t);case 8:return UH(t);case 9:return Kb(t,e);case 10:return FH();case 11:return Kb(t,e);default:return}}function Kb(t,e){return{type:"root",children:GS(t,e)}}function FH(){return{type:"doctype"}}function HH(t){return{type:"text",value:t.nodeValue||""}}function UH(t){return{type:"comment",value:t.nodeValue||""}}function $H(t,e){const n=t.namespaceURI,r=n===gl.svg?rC:nC,i=n===gl.html?t.tagName.toLowerCase():t.tagName,s=n===gl.html&&i==="template"?t.content:t,o=t.getAttributeNames(),a={};let l=-1;for(;++l<o.length;)a[o[l]]=t.getAttribute(o[l])||"";return r(i,a,GS(s,e))}function GS(t,e){const n=t.childNodes,r=[];let i=-1;for(;++i<n.length;){const s=KS(n[i],e);s!==void 0&&r.push(s)}return r}var zH=Object.defineProperty,VH=(t,e,n)=>e in t?zH(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ge=(t,e,n)=>VH(t,typeof e!="symbol"?e+"":e,n);function QS(t){const e=Array.from(t.classList).filter(n=>!n.startsWith("bn-"))||[];e.length>0?t.className=e.join(" "):t.removeAttribute("class")}function JS(t,e,n,r){var i;let s;if(e)if(typeof e=="string")s=bn([e],t.pmSchema);else if(Array.isArray(e))s=bn(e,t.pmSchema);else if(e.type==="tableContent")s=Xc(e,t.pmSchema);else throw new Pn(e.type);else throw new Error("blockContent is required");const o=(r?.document??document).createDocumentFragment();for(const a of s)if(a.type.name!=="text"&&t.schema.inlineContentSchema[a.type.name]){const l=t.schema.inlineContentSpecs[a.type.name].implementation;if(l){const c=Zf(a,t.schema.inlineContentSchema,t.schema.styleSchema),u=l.toExternalHTML?l.toExternalHTML(c,t):l.render.call({renderType:"dom",props:void 0},c,()=>{},t);if(u){if(o.appendChild(u.dom),u.contentDOM){const d=n.serializeFragment(a.content,r);u.contentDOM.dataset.editable="",u.contentDOM.appendChild(d)}continue}}}else if(a.type.name==="text"){let l=document.createTextNode(a.textContent);for(const c of a.marks.toReversed())if(c.type.name in t.schema.styleSpecs){const u=(t.schema.styleSpecs[c.type.name].implementation.toExternalHTML??t.schema.styleSpecs[c.type.name].implementation.render)(c.attrs.stringValue,t);u.contentDOM.appendChild(l),l=u.dom}else{const u=c.type.spec.toDOM(c,!0),d=zt.renderSpec(document,u);d.contentDOM.appendChild(l),l=d.dom}o.appendChild(l)}else{const l=n.serializeFragment(v.from([a]),r);o.appendChild(l)}return o.childNodes.length===1&&((i=o.firstChild)==null?void 0:i.nodeType)===1&&QS(o.firstChild),o}function jH(t,e,n,r,i,s,o,a){var l,c,u,d,h,f,p,g,b;const y=a?.document??document,C=e.pmSchema.nodes.blockContainer,S=n.props||{};for(const[_,U]of Object.entries(e.schema.blockSchema[n.type].propSchema))!(_ in S)&&U.default!==void 0&&(S[_]=U.default);const I=(c=(l=C.spec)==null?void 0:l.toDOM)==null?void 0:c.call(l,C.create({id:n.id,...S})),M=Array.from(I.dom.attributes),A=e.blockImplementations[n.type].implementation,D=((u=A.toExternalHTML)==null?void 0:u.call({},{...n,props:S},e,{nestingLevel:o}))||A.render.call({},{...n,props:S},e),z=y.createDocumentFragment();if(D.dom.classList.contains("bn-block-content")){const _=[...M,...Array.from(D.dom.attributes)].filter(U=>U.name.startsWith("data")&&U.name!=="data-content-type"&&U.name!=="data-file-block"&&U.name!=="data-node-view-wrapper"&&U.name!=="data-node-type"&&U.name!=="data-id"&&U.name!=="data-editable");for(const U of _)D.dom.firstChild.setAttribute(U.name,U.value);QS(D.dom.firstChild),o>0&&D.dom.firstChild.setAttribute("data-nesting-level",o.toString()),z.append(...Array.from(D.dom.childNodes))}else z.append(D.dom),o>0&&D.dom.setAttribute("data-nesting-level",o.toString());if(D.contentDOM&&n.content){const _=JS(e,n.content,r,a);D.contentDOM.appendChild(_)}let V;if(i.has(n.type)?V="OL":s.has(n.type)&&(V="UL"),V){if(((d=t.lastChild)==null?void 0:d.nodeName)!==V){const _=y.createElement(V);V==="OL"&&"start"in S&&S.start&&S?.start!==1&&_.setAttribute("start",S.start+""),t.append(_)}t.lastChild.appendChild(z)}else t.append(z);if(n.children&&n.children.length>0){const _=y.createDocumentFragment();if(XS(_,e,n.children,r,i,s,o+1,a),((h=t.lastChild)==null?void 0:h.nodeName)==="UL"||((f=t.lastChild)==null?void 0:f.nodeName)==="OL")for(;((p=_.firstChild)==null?void 0:p.nodeName)==="UL"||((g=_.firstChild)==null?void 0:g.nodeName)==="OL";)t.lastChild.lastChild.appendChild(_.firstChild);e.pmSchema.nodes[n.type].isInGroup("blockContent")?t.append(_):(b=D.contentDOM)==null||b.append(_)}}const XS=(t,e,n,r,i,s,o=0,a)=>{for(const l of n)jH(t,e,l,r,i,s,o,a)},qH=(t,e,n,r,i,s)=>{const o=(s?.document??document).createDocumentFragment();return XS(o,t,e,n,r,i,0,s),o},Nu=(t,e)=>{const n=zt.fromSchema(t);return{exportBlocks:(r,i)=>{const s=qH(e,r,n,new Set(["numberedListItem"]),new Set(["bulletListItem","checkListItem","toggleListItem"]),i),o=document.createElement("div");return o.append(s),o.innerHTML},exportInlineContent:(r,i)=>{const s=JS(e,r,n,i),o=document.createElement("div");return o.append(s.cloneNode(!0)),o.innerHTML}}};function WH(t,e){if(e===0)return;const n=t.resolve(e);for(let r=n.depth;r>0;r--){const i=n.node(r);if(vp(i))return i.attrs.id}}function YH(t){return t.getMeta("paste")?{type:"paste"}:t.getMeta("uiEvent")==="drop"?{type:"drop"}:t.getMeta("history$")?{type:t.getMeta("history$").redo?"redo":"undo"}:t.getMeta("y-sync$")?t.getMeta("y-sync$").isUndoRedoOperation?{type:"undo-redo"}:{type:"yjs-remote"}:{type:"local"}}function Gb(t){const e="__root__",n={},r={},i=He(t);return t.descendants((s,o)=>{if(!vp(s))return!0;const a=WH(t,o),l=a??e;r[l]||(r[l]=[]);const c=ve(s,i);return n[s.attrs.id]={block:c,parentId:a},r[l].push(s.attrs.id),!0}),{byId:n,childrenByParent:r}}function KH(t,e){const n=new Set;if(!t||!e)return n;const r=new Set(t),i=e.filter(g=>r.has(g)),s=t.filter(g=>i.includes(g));if(s.length<=1||i.length<=1)return n;const o={};for(let g=0;g<s.length;g++)o[s[g]]=g;const a=i.map(g=>o[g]),l=a.length,c=[],u=[],d=new Array(l).fill(-1),h=(g,b)=>{let y=0,C=g.length;for(;y<C;){const S=y+C>>>1;g[S]<b?y=S+1:C=S}return y};for(let g=0;g<l;g++){const b=a[g],y=h(c,b);y>0&&(d[g]=u[y-1]),y===c.length?(c.push(b),u.push(g)):(c[y]=b,u[y]=g)}const f=new Set;let p=u[u.length-1]??-1;for(;p!==-1;)f.add(p),p=d[p];for(let g=0;g<i.length;g++)f.has(g)||n.add(i[g]);return n}function ZS(t,e=[]){const n=YH(t),r=Wc(t.before,[t,...e]),i=Gb(r.before),s=Gb(r.doc),o=[],a=new Set;Object.keys(s.byId).filter(f=>!(f in i.byId)).forEach(f=>{o.push({type:"insert",block:s.byId[f].block,source:n,prevBlock:void 0}),a.add(f)}),Object.keys(i.byId).filter(f=>!(f in s.byId)).forEach(f=>{o.push({type:"delete",block:i.byId[f].block,source:n,prevBlock:void 0}),a.add(f)}),Object.keys(s.byId).filter(f=>f in i.byId).forEach(f=>{var p,g;const b=i.byId[f],y=s.byId[f];b.parentId!==y.parentId?(o.push({type:"move",block:y.block,prevBlock:b.block,source:n,prevParent:b.parentId?(p=i.byId[b.parentId])==null?void 0:p.block:void 0,currentParent:y.parentId?(g=s.byId[y.parentId])==null?void 0:g.block:void 0}),a.add(f)):SR({...b.block,children:void 0},{...y.block,children:void 0})||(o.push({type:"update",block:y.block,prevBlock:b.block,source:n}),a.add(f))});const l=i.childrenByParent,c=s.childrenByParent,u="__root__",d=new Set([...Object.keys(l),...Object.keys(c)]),h=new Set;return d.forEach(f=>{const p=KH(l[f],c[f]);p.size!==0&&p.forEach(g=>{var b,y;const C=i.byId[g],S=s.byId[g];!C||!S||C.parentId!==S.parentId||a.has(g)||(C.parentId??u)!==f||h.has(g)||(h.add(g),o.push({type:"move",block:S.block,prevBlock:C.block,source:n,prevParent:C.parentId?(b=i.byId[C.parentId])==null?void 0:b.block:void 0,currentParent:S.parentId?(y=s.byId[S.parentId])==null?void 0:y.block:void 0}),a.add(g))})}),o}const ew=pe(()=>{const t=[];return{key:"blockChange",prosemirrorPlugins:[new re({key:new me("blockChange"),filterTransaction:e=>{let n;return t.reduce((r,i)=>r===!1?r:i({getChanges(){return n||(n=ZS(e),n)},tr:e})!==!1,!0)}})],subscribe(e){return t.push(e),()=>{t.splice(t.indexOf(e),1)}}}});function Qb(t){const e=t.charAt(0)==="#"?t.substring(1,7):t,n=parseInt(e.substring(0,2),16),r=parseInt(e.substring(2,4),16),i=parseInt(e.substring(4,6),16),s=[n/255,r/255,i/255].map(o=>o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4));return .2126*s[0]+.7152*s[1]+.0722*s[2]<=.179}function GH(t){const e=document.createElement("span");e.classList.add("bn-collaboration-cursor__base");const n=document.createElement("span");n.setAttribute("contentedEditable","false"),n.classList.add("bn-collaboration-cursor__caret"),n.setAttribute("style",`background-color: ${t.color}; color: ${Qb(t.color)?"white":"black"}`);const r=document.createElement("span");return r.classList.add("bn-collaboration-cursor__label"),r.setAttribute("style",`background-color: ${t.color}; color: ${Qb(t.color)?"white":"black"}`),r.insertBefore(document.createTextNode(t.name),null),n.insertBefore(r,null),e.insertBefore(document.createTextNode(""),null),e.insertBefore(n,null),e.insertBefore(document.createTextNode(""),null),e}const Xh=pe(({options:t})=>{const e=new Map,n=t.provider&&"awareness"in t.provider&&typeof t.provider.awareness=="object"?t.provider.awareness:void 0;return n&&("setLocalStateField"in n&&typeof n.setLocalStateField=="function"&&n.setLocalStateField("user",t.user),"on"in n&&typeof n.on=="function"&&t.showCursorLabels!=="always"&&n.on("change",({updated:r})=>{for(const i of r){const s=e.get(i);s&&(s.element.setAttribute("data-active",""),s.hideTimeout&&clearTimeout(s.hideTimeout),e.set(i,{element:s.element,hideTimeout:setTimeout(()=>{s.element.removeAttribute("data-active")},2e3)}))}})),{key:"yCursor",prosemirrorPlugins:[n?lD(n,{selectionBuilder:_T,cursorBuilder(r,i){let s=e.get(i);if(!s){const o=(t.renderCursor??GH)(r);t.showCursorLabels!=="always"&&(o.addEventListener("mouseenter",()=>{const a=e.get(i);a.element.setAttribute("data-active",""),a.hideTimeout&&(clearTimeout(a.hideTimeout),e.set(i,{element:a.element,hideTimeout:void 0}))}),o.addEventListener("mouseleave",()=>{const a=e.get(i);e.set(i,{element:a.element,hideTimeout:setTimeout(()=>{a.element.removeAttribute("data-active")},2e3)})})),s={element:o,hideTimeout:void 0},e.set(i,s)}return s.element}}):void 0].filter(Boolean),dependsOn:["ySync"],updateUser(r){n?.setLocalStateField("user",r)}}}),kl=pe(({options:t})=>({key:"ySync",prosemirrorPlugins:[Wv(t.fragment)],runsBefore:["default"]})),Tl=pe(()=>({key:"yUndo",prosemirrorPlugins:[mD()],dependsOn:["yCursor","ySync"],undoCommand:dD,redoCommand:hD}));function QH(t,e){const n=t.doc;if(t._item===null){const r=Array.from(n.share.keys()).find(i=>n.share.get(i)===t);if(r==null)throw new Error("type does not exist in other ydoc");return e.get(r,t.constructor)}else{const r=t._item,i=e.store.clients.get(r.id.client)??[],s=on(i,r.id.clock);return i[s].content.type}}const JH=pe(({editor:t,options:e})=>{let n;const r=Mi({isForked:!1});return{key:"yForkDoc",store:r,fork(){if(n)return;const i=e.fragment;if(!i)throw new Error("No fragment to fork from");const s=new Vr;s0(s,o0(i.doc));const o=QH(i,s);n={undoStack:vn.getState(t.prosemirrorState).undoManager.undoStack,originalFragment:i,forkedFragment:o},t.unregisterExtension([Tl,Xh,kl]);const a={...e,fragment:o};t.registerExtension([kl(a),Tl()]),r.setState({isForked:!0})},merge({keepChanges:i}){if(!n)return;t.unregisterExtension(["ySync","yCursor","yUndo"]);const{originalFragment:s,forkedFragment:o,undoStack:a}=n;if(t.registerExtension([kl(e),Xh(e),Tl()]),vn.getState(t.prosemirrorState).undoManager.undoStack=a,i){const l=o0(o.doc,S3(s.doc));s0(s.doc,l,t)}n=void 0,r.setState({isForked:!1})}}}),tw=(t,e)=>{e(t),t.forEach(n=>{n instanceof at&&tw(n,e)})},XH=(t,e)=>{const n=new Map;return t.forEach(r=>{r instanceof at&&tw(r,i=>{if(i.nodeName==="blockContainer"&&i.hasAttribute("id")){const s=i.getAttribute("textColor"),o=i.getAttribute("backgroundColor"),a={textColor:s===ye.textColor.default?void 0:s,backgroundColor:o===ye.backgroundColor.default?void 0:o};(a.textColor||a.backgroundColor)&&n.set(i.getAttribute("id"),a)}})}),n.size===0?!1:(e.doc.descendants((r,i)=>{if(r.type.name==="blockContainer"&&n.has(r.attrs.id)){const s=e.doc.nodeAt(i+1);if(!s)throw new Error("No element found");e.setNodeMarkup(i+1,void 0,{...s.attrs,...n.get(r.attrs.id)})}}),!0)},ZH=[XH],eU=pe(({options:t})=>{let e=!1;const n=new me("schemaMigration");return{key:"schemaMigration",prosemirrorPlugins:[new re({key:n,appendTransaction:(r,i,s)=>{if(e||!r.some(a=>a.getMeta("y-sync$"))||r.every(a=>!a.docChanged)||!t.fragment.firstChild)return;const o=s.tr;for(const a of ZH)a(t.fragment,o);if(e=!0,!!o.docChanged)return o}})]}}),tU=pe(({editor:t,options:e})=>({key:"dropCursor",prosemirrorPlugins:[(e.dropCursor??wR)({width:5,color:"#ddeeff",editor:t})]})),Zh=pe(({editor:t})=>{const e=Mi(!1),n=()=>t.transact(r=>{var i;if(r.selection.empty||r.selection instanceof W&&(r.selection.node.type.spec.content==="inline*"||((i=r.selection.node.firstChild)==null?void 0:i.type.spec.content)==="inline*")||r.selection instanceof j&&r.doc.textBetween(r.selection.from,r.selection.to).length===0)return!1;let s=!1;return r.selection.content().content.descendants(o=>(o.type.spec.code&&(s=!0),!s)),!s});return{key:"formattingToolbar",store:e,mount({dom:r,signal:i}){let s=!1;const o=t.onChange(()=>{s||e.setState(n())}),a=t.onSelectionChange(()=>{s||e.setState(n())});r.addEventListener("pointerdown",()=>{s=!0,e.setState(!1)},{signal:i}),t.prosemirrorView.root.addEventListener("pointerup",()=>{s=!1,t.isFocused()&&e.setState(n())},{signal:i,capture:!0}),r.addEventListener("pointercancel",()=>{s=!1},{signal:i,capture:!0}),i.addEventListener("abort",()=>{o(),a()})}}}),nU=pe(()=>({key:"history",prosemirrorPlugins:[LR()],undoCommand:WT,redoCommand:YT})),rU=pe(({editor:t})=>{function e(i){let s=t.prosemirrorView.nodeDOM(i);for(;s&&s.parentElement;){if(s.nodeName==="A")return s;s=s.parentElement}return null}function n(i,s){return t.transact(o=>{const a=o.doc.resolve(i),l=a.marks().find(u=>u.type.name===s);if(!l)return;const c=jc(a,l.type);if(c)return{range:c,mark:l,get text(){return o.doc.textBetween(c.from,c.to)},get position(){return wE(t.prosemirrorView,c.from,c.to).toJSON()}}})}function r(){return t.transact(i=>{const s=i.selection;if(s.empty)return n(s.anchor,"link")})}return{key:"linkToolbar",getLinkAtSelection:r,getLinkElementAtPos:e,getMarkAtPos:n,getLinkAtElement(i){return t.transact(()=>{const s=t.prosemirrorView.posAtDOM(i,0)+1;return n(s,"link")})},editLink(i,s,o=t.transact(a=>a.selection.anchor)){t.transact(a=>{const l=He(a),{range:c}=n(o+1,"link")||{range:{from:a.selection.from,to:a.selection.to}};c&&(a.insertText(s,c.from,c.to),a.addMark(c.from,c.from+s.length,l.mark("link",{href:i})))}),t.prosemirrorView.focus()},deleteLink(i=t.transact(s=>s.selection.anchor)){t.transact(s=>{const o=He(s),{range:a}=n(i+1,"link")||{range:{from:s.selection.from,to:s.selection.to}};a&&s.removeMark(a.from,a.to,o.marks.link).setMeta("preventAutolink",!0)}),t.prosemirrorView.focus()}}}),iU=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"],sU="https",oU=new me("node-selection-keyboard"),aU=pe(()=>({key:"nodeSelectionKeyboard",prosemirrorPlugins:[new re({key:oU,props:{handleKeyDown:(t,e)=>{if("node"in t.state.selection){if(e.ctrlKey||e.metaKey)return!1;if(e.key.length===1)return e.preventDefault(),!0;if(e.key==="Enter"&&!e.isComposing&&!e.shiftKey&&!e.altKey&&!e.ctrlKey&&!e.metaKey){const n=t.state.tr;return t.dispatch(n.insert(t.state.tr.selection.$to.after(),t.state.schema.nodes.paragraph.createChecked()).setSelection(new j(n.doc.resolve(t.state.tr.selection.$to.after()+1)))),!0}}return!1}}})]})),lU=new me("blocknote-placeholder"),cU=pe(({editor:t,options:e})=>{const n=e.placeholders;return{key:"placeholder",prosemirrorPlugins:[new re({key:lU,view:r=>{const i=`placeholder-selector-${UE()}`;r.dom.classList.add(i);const s=document.createElement("style"),o=t._tiptapEditor.options.injectNonce;o&&s.setAttribute("nonce",o),r.root instanceof window.ShadowRoot?r.root.append(s):r.root.head.appendChild(s);const a=s.sheet,l=(c="")=>`.${i} .bn-block-content${c} .bn-inline-content:has(> .ProseMirror-trailingBreak:only-child):before`;try{const{default:c,emptyDocument:u,...d}=n||{};for(const[p,g]of Object.entries(d)){const b=`[data-content-type="${p}"]`;a.insertRule(`${l(b)} { content: ${JSON.stringify(g)}; }`)}a.insertRule(`${l("[data-is-only-empty-block]")} { content: ${JSON.stringify(u)}; }`),a.insertRule(`${l("[data-is-empty-and-focused]")} { content: ${JSON.stringify(c)}; }`)}catch(c){console.warn("Failed to insert placeholder CSS rule - this is likely due to the browser not supporting certain CSS pseudo-element selectors (:has, :only-child:, or :before)",c)}return{destroy:()=>{r.root instanceof window.ShadowRoot?r.root.removeChild(s):r.root.head.removeChild(s)}}},props:{decorations:r=>{const{doc:i,selection:s}=r;if(!t.isEditable||!s.empty||s.$from.parent.type.spec.code)return;const o=[];r.doc.content.size===6&&o.push(Ee.node(2,4,{"data-is-only-empty-block":"true"}));const a=s.$anchor,l=a.parent;if(l.content.size===0){const c=a.before();o.push(Ee.node(c,c+l.nodeSize,{"data-is-empty-and-focused":"true"}))}return ue.create(i,o)}}})]}}),Jb=new me("previous-blocks"),uU={index:"index",level:"level",type:"type",depth:"depth","depth-change":"depth-change"},dU=pe(()=>{let t;return{key:"previousBlockType",prosemirrorPlugins:[new re({key:Jb,view(e){return{update:async(n,r)=>{var i;((i=this.key)==null?void 0:i.getState(n.state).updatedBlocks.size)>0&&(t=setTimeout(()=>{n.dispatch(n.state.tr.setMeta(Jb,{clearUpdate:!0}))},0))},destroy:()=>{t&&clearTimeout(t)}}},state:{init(){return{prevTransactionOldBlockAttrs:{},currentTransactionOldBlockAttrs:{},updatedBlocks:new Set}},apply(e,n,r,i){if(n.currentTransactionOldBlockAttrs={},n.updatedBlocks.clear(),!e.docChanged||r.doc.eq(i.doc))return n;const s={},o=Ag(r.doc,c=>c.attrs.id),a=new Map(o.map(c=>[c.node.attrs.id,c])),l=Ag(i.doc,c=>c.attrs.id);for(const c of l){const u=a.get(c.node.attrs.id),d=u?.node.firstChild,h=c.node.firstChild;if(u&&d&&h){const f={index:h.attrs.index,level:h.attrs.level,type:h.type.name,depth:i.doc.resolve(c.pos).depth},p={index:d.attrs.index,level:d.attrs.level,type:d.type.name,depth:r.doc.resolve(u.pos).depth};s[c.node.attrs.id]=p,n.currentTransactionOldBlockAttrs[c.node.attrs.id]=p,JSON.stringify(p)!==JSON.stringify(f)&&(p["depth-change"]=p.depth-f.depth,n.updatedBlocks.add(c.node.attrs.id))}}return n.prevTransactionOldBlockAttrs=s,n}},props:{decorations(e){const n=this.getState(e);if(n.updatedBlocks.size===0)return;const r=[];return e.doc.descendants((i,s)=>{if(!i.attrs.id||!n.updatedBlocks.has(i.attrs.id))return;const o=n.currentTransactionOldBlockAttrs[i.attrs.id],a={};for(const[c,u]of Object.entries(o))a["data-prev-"+uU[c]]=u||"none";const l=Ee.node(s,s+i.nodeSize,{...a});r.push(l)}),ue.create(e.doc,r)}}})]}});function nw(t,e){for(var n,r;t&&t.parentElement&&t.parentElement!==e.dom&&((n=t.getAttribute)==null?void 0:n.call(t,"data-node-type"))!=="blockContainer";)t=t.parentElement;if(((r=t.getAttribute)==null?void 0:r.call(t,"data-node-type"))==="blockContainer")return{node:t,id:t.getAttribute("data-id")}}function hU(){const t=e=>{let n=e.children.length;for(let r=0;r<n;r++){const i=e.children[r];if(i.type==="element"&&(t(i),i.tagName==="u"))if(i.children.length>0){e.children.splice(r,1,...i.children);const s=i.children.length-1;n+=s,r+=s}else e.children.splice(r,1),n--,r--}};return t}function fU(){const t=e=>{var n;if(e.children&&"length"in e.children&&e.children.length)for(let r=e.children.length-1;r>=0;r--){const i=e.children[r],s=r+1<e.children.length?e.children[r+1]:void 0;i.type==="element"&&i.tagName==="input"&&((n=i.properties)==null?void 0:n.type)==="checkbox"&&s?.type==="element"&&s.tagName==="p"?(s.tagName="span",s.children.splice(0,0,PH(document.createTextNode(" ")))):t(i)}};return t}function pU(){return t=>{Ai(t,"element",(e,n,r)=>{var i,s,o,a;if(r&&e.tagName==="video"){const l=((i=e.properties)==null?void 0:i.src)||((s=e.properties)==null?void 0:s["data-url"])||"",c=((o=e.properties)==null?void 0:o.title)||((a=e.properties)==null?void 0:a["data-name"])||"";r.children[n]={type:"text",value:``}}})}}function am(t){return YS().use(eB,{fragment:!0}).use(pU).use(hU).use(fU).use(M5).use(WS).use(AH,{handlers:{text:e=>e.value}}).processSync(t).value}function mU(t,e,n,r){const i=Nu(e,n).exportBlocks(t,r);return am(i)}function rw(t){const e=[];return t.descendants(n=>{var r,i;const s=He(n);return n.type.name==="blockContainer"&&((r=n.firstChild)==null?void 0:r.type.name)==="blockGroup"?!0:n.type.name==="columnList"&&n.childCount===1?((i=n.firstChild)==null||i.forEach(o=>{e.push(ve(o,s))}),!1):n.type.isInGroup("bnBlock")?(e.push(ve(n,s)),!1):!0}),e}class hi extends Q{constructor(e,n){super(e,n),ge(this,"nodes");const r=e.node();this.nodes=[],e.doc.nodesBetween(e.pos,n.pos,(i,s,o)=>{if(o!==null&&o.eq(r))return this.nodes.push(i),!1})}static create(e,n,r=n){return new hi(e.resolve(n),e.resolve(r))}content(){return new F(v.from(this.nodes),0,0)}eq(e){if(!(e instanceof hi)||this.nodes.length!==e.nodes.length||this.from!==e.from||this.to!==e.to)return!1;for(let n=0;n<this.nodes.length;n++)if(!this.nodes[n].eq(e.nodes[n]))return!1;return!0}map(e,n){const r=n.mapResult(this.from),i=n.mapResult(this.to);return i.deleted?Q.near(e.resolve(r.pos)):r.deleted?Q.near(e.resolve(i.pos)):new hi(e.resolve(r.pos),e.resolve(i.pos))}toJSON(){return{type:"multiple-node",anchor:this.anchor,head:this.head}}}Q.jsonID("multiple-node",hi);let dn;function gU(t,e){let n,r;const i=e.resolve(t.from).node().type.spec.group==="blockContent",s=e.resolve(t.to).node().type.spec.group==="blockContent",o=Math.min(t.$anchor.depth,t.$head.depth);if(i&&s){const a=t.$from.start(o-1),l=t.$to.end(o-1);n=e.resolve(a-1).pos,r=e.resolve(l+1).pos}else n=t.from,r=t.to;return{from:n,to:r}}function Xb(t,e,n=e){e===n&&(n+=t.state.doc.resolve(e+1).node().nodeSize);const r=t.domAtPos(e).node.cloneNode(!0),i=t.domAtPos(e).node,s=(u,d)=>Array.prototype.indexOf.call(u.children,d),o=s(i,t.domAtPos(e+1).node.parentElement),a=s(i,t.domAtPos(n-1).node.parentElement);for(let u=i.childElementCount-1;u>=0;u--)(u>a||u<o)&&r.removeChild(r.children[u]);iw(t.root),dn=r;const l=dn.getElementsByTagName("iframe");for(let u=0;u<l.length;u++){const d=l[u],h=d.parentElement;h&&h.removeChild(d)}const c=t.dom.className.split(" ").filter(u=>u!=="ProseMirror"&&u!=="bn-root"&&u!=="bn-editor").join(" ");dn.className=dn.className+" bn-drag-preview "+c,t.root instanceof ShadowRoot?t.root.appendChild(dn):t.root.body.appendChild(dn)}function iw(t){dn!==void 0&&(t instanceof ShadowRoot?t.removeChild(dn):t.body.removeChild(dn),dn=void 0)}function bU(t,e,n){if(!t.dataTransfer||n.headless)return;const r=n.prosemirrorView,i=Vt(e.id,r.state.doc);if(!i)throw new Error(`Block with ID ${e.id} not found`);const s=i.posBeforeNode;if(s!=null){const o=r.state.selection,a=r.state.doc,{from:l,to:c}=gU(o,a),u=l<=s&&s<c,d=o.$anchor.node()!==o.$head.node()||o instanceof hi;u&&d?(r.dispatch(r.state.tr.setSelection(hi.create(a,l,c))),Xb(r,l,c)):(r.dispatch(r.state.tr.setSelection(W.create(r.state.doc,s))),Xb(r,s));const h=r.state.selection.content(),f=n.pmSchema,p=r.serializeForClipboard(h).dom.innerHTML,g=Nu(f,n),b=rw(h.content),y=g.exportBlocks(b,{}),C=am(y);t.dataTransfer.clearData(),t.dataTransfer.setData("blocknote/html",p),t.dataTransfer.setData("text/html",y),t.dataTransfer.setData("text/plain",C),t.dataTransfer.effectAllowed="move",t.dataTransfer.setDragImage(dn,0,0)}}const Zb=250;function ef(t,e,n=!0){const r=t.root.elementsFromPoint(e.left,e.top);for(const i of r)if(t.dom.contains(i))return n&&i.closest("[data-node-type=columnList]")?ef(t,{left:e.left+50,top:e.top},!1):nw(i,t)}function yU(t,e){if(!e.dom.firstChild)return;const n=e.dom.firstChild.getBoundingClientRect(),r={left:Math.min(Math.max(n.left+10,t.x),n.right-10),top:t.y},i=ef(e,r);if(!i)return;const s=i.node.getBoundingClientRect();return ef(e,{left:s.right-10,top:t.y},!1)}class EU{constructor(e,n,r){ge(this,"state"),ge(this,"emitUpdate"),ge(this,"mousePos"),ge(this,"hoveredBlock"),ge(this,"menuFrozen",!1),ge(this,"isDragOrigin",!1),ge(this,"updateState",i=>{this.state=i,this.emitUpdate(this.state)}),ge(this,"updateStateFromMousePos",()=>{var i,s,o,a,l;if(this.menuFrozen||!this.mousePos)return;const c=this.findClosestEditorElement({clientX:this.mousePos.x,clientY:this.mousePos.y});if(c?.element!==this.pmView.dom||c.distance>Zb){(i=this.state)!=null&&i.show&&(this.state.show=!1,this.updateState(this.state));return}const u=yU(this.mousePos,this.pmView);if(!u||!this.editor.isEditable){(s=this.state)!=null&&s.show&&(this.state.show=!1,this.updateState(this.state));return}if(!((o=this.state)!=null&&o.show&&(a=this.hoveredBlock)!=null&&a.hasAttribute("data-id")&&((l=this.hoveredBlock)==null?void 0:l.getAttribute("data-id"))===u.id)&&(this.hoveredBlock=u.node,this.editor.isEditable)){const d=u.node.getBoundingClientRect(),h=u.node.closest("[data-node-type=column]");this.state={show:!0,referencePos:new DOMRect(h?h.firstElementChild.getBoundingClientRect().x:this.pmView.dom.firstChild.getBoundingClientRect().x,d.y,d.width,d.height),block:this.editor.getBlock(this.hoveredBlock.getAttribute("data-id"))},this.updateState(this.state)}}),ge(this,"onDragStart",i=>{var s;const o=(s=i.dataTransfer)==null?void 0:s.getData("blocknote/html");if(!o||this.pmView.dragging)return;const a=document.createElement("div");a.innerHTML=o;const l=mn.fromSchema(this.pmView.state.schema).parse(a,{topNode:this.pmView.state.schema.nodes.blockGroup.create()});this.pmView.dragging={slice:new F(l.content,0,0),move:!0}}),ge(this,"findClosestEditorElement",i=>{const s=Array.from(this.pmView.root.querySelectorAll(".bn-editor"));if(s.length===0)return null;let o=s[0],a=Number.MAX_VALUE;return s.forEach(l=>{const c=l.querySelector(".bn-block-group").getBoundingClientRect(),u=i.clientX<c.left?c.left-i.clientX:i.clientX>c.right?i.clientX-c.right:0,d=i.clientY<c.top?c.top-i.clientY:i.clientY>c.bottom?i.clientY-c.bottom:0,h=Math.sqrt(Math.pow(u,2)+Math.pow(d,2));h<a&&(a=h,o=l)}),{element:o,distance:a}}),ge(this,"onDragOver",i=>{if(i.synthetic)return;const s=this.getDragEventContext(i);if(!s||!s.isDropPoint){this.closeDropCursor();return}s.isDropPoint&&!s.isDropWithinEditorBounds&&this.dispatchSyntheticEvent(i)}),ge(this,"closeDropCursor",()=>{const i=new Event("dragleave",{bubbles:!1});i.synthetic=!0,this.pmView.dom.dispatchEvent(i)}),ge(this,"getDragEventContext",i=>{var s;const o=!((s=i.dataTransfer)!=null&&s.types.includes("blocknote/html"))&&!!this.pmView.dragging,a=!!this.isDragOrigin,l=o||a,c=this.findClosestEditorElement(i);if(!c||c.distance>Zb)return;const u=c.element===this.pmView.dom,d=u&&c.distance===0;if(!(!u&&!l))return{isDropPoint:u,isDropWithinEditorBounds:d,isDragOrigin:l}}),ge(this,"onDrop",i=>{if(i.synthetic)return;const s=this.getDragEventContext(i);if(!s){this.closeDropCursor();return}const{isDropPoint:o,isDropWithinEditorBounds:a,isDragOrigin:l}=s;if(!a&&o&&this.dispatchSyntheticEvent(i),o){if(this.pmView.dragging)return;this.pmView.dispatch(this.pmView.state.tr.setSelection(j.create(this.pmView.state.tr.doc,this.pmView.state.tr.selection.anchor)));return}else if(l){setTimeout(()=>this.pmView.dispatch(this.pmView.state.tr.deleteSelection()),0);return}}),ge(this,"onDragEnd",i=>{i.synthetic||(this.pmView.dragging=null)}),ge(this,"onKeyDown",i=>{var s;(s=this.state)!=null&&s.show&&this.editor.isFocused()&&(this.state.show=!1,this.emitUpdate(this.state))}),ge(this,"onMouseMove",i=>{var s;if(this.menuFrozen)return;this.mousePos={x:i.clientX,y:i.clientY};const o=this.pmView.dom.getBoundingClientRect(),a=this.mousePos.x>o.left&&this.mousePos.x<o.right&&this.mousePos.y>o.top&&this.mousePos.y<o.bottom,l=this.pmView.dom.parentElement;if(a&&i&&i.target&&!(l===i.target||l.contains(i.target))){(s=this.state)!=null&&s.show&&(this.state.show=!1,this.emitUpdate(this.state));return}this.updateStateFromMousePos()}),this.editor=e,this.pmView=n,this.emitUpdate=()=>{if(!this.state)throw new Error("Attempting to update uninitialized side menu");r(this.state)},this.pmView.root.addEventListener("dragstart",this.onDragStart),this.pmView.root.addEventListener("dragover",this.onDragOver),this.pmView.root.addEventListener("drop",this.onDrop,!0),this.pmView.root.addEventListener("dragend",this.onDragEnd,!0),this.pmView.root.addEventListener("mousemove",this.onMouseMove,!0),this.pmView.root.addEventListener("keydown",this.onKeyDown,!0)}dispatchSyntheticEvent(e){const n=new Event(e.type,e),r=this.pmView.dom.firstChild.getBoundingClientRect();n.clientX=e.clientX,n.clientY=e.clientY,n.clientX=Math.min(Math.max(e.clientX,r.left),r.left+r.width),n.clientY=Math.min(Math.max(e.clientY,r.top),r.top+r.height),n.dataTransfer=e.dataTransfer,n.preventDefault=()=>e.preventDefault(),n.synthetic=!0,this.pmView.dom.dispatchEvent(n)}update(e,n){var r;!n.doc.eq(this.pmView.state.doc)&&(r=this.state)!=null&&r.show&&this.updateStateFromMousePos()}destroy(){var e;(e=this.state)!=null&&e.show&&(this.state.show=!1,this.emitUpdate(this.state)),this.pmView.root.removeEventListener("mousemove",this.onMouseMove,!0),this.pmView.root.removeEventListener("dragstart",this.onDragStart),this.pmView.root.removeEventListener("dragover",this.onDragOver),this.pmView.root.removeEventListener("drop",this.onDrop,!0),this.pmView.root.removeEventListener("dragend",this.onDragEnd,!0),this.pmView.root.removeEventListener("keydown",this.onKeyDown,!0)}}const kU=new me("SideMenuPlugin"),TU=pe(({editor:t})=>{let e;const n=Mi(void 0);return{key:"sideMenu",store:n,prosemirrorPlugins:[new re({key:kU,view:r=>(e=new EU(t,r,i=>{n.setState({...i})}),e)})],blockDragStart(r,i){e&&(e.isDragOrigin=!0),bU(r,i,t)},blockDragEnd(){iw(t.prosemirrorView.root),e&&(e.isDragOrigin=!1),t.blur()},freezeMenu(){e.menuFrozen=!0,e.state.show=!0,e.emitUpdate(e.state)},unfreezeMenu(){e.menuFrozen=!1,e.state.show=!1,e.emitUpdate(e.state)}}});let At;function e1(t){At||(At=document.createElement("div"),At.innerHTML="_",At.style.opacity="0",At.style.height="1px",At.style.width="1px",t instanceof Document?t.body.appendChild(At):t.appendChild(At))}function CU(t){At&&(t instanceof Document?t.body.removeChild(At):t.removeChild(At),At=void 0)}function Ga(t){return Array.prototype.indexOf.call(t.parentElement.childNodes,t)}function SU(t){let e=t;for(;e&&e.nodeName!=="TD"&&e.nodeName!=="TH"&&!e.classList.contains("tableWrapper");){if(e.classList.contains("ProseMirror"))return;const n=e.parentNode;if(!n||!(n instanceof Element))return;e=n}return e.nodeName==="TD"||e.nodeName==="TH"?{type:"cell",domNode:e,tbodyNode:e.closest("tbody")}:{type:"wrapper",domNode:e,tbodyNode:e.querySelector("tbody")}}function wU(t,e){const n=e.querySelectorAll(t);for(let r=0;r<n.length;r++)n[r].style.visibility="hidden"}let xU=class{constructor(e,n,r){ge(this,"state"),ge(this,"emitUpdate"),ge(this,"tableId"),ge(this,"tablePos"),ge(this,"tableElement"),ge(this,"menuFrozen",!1),ge(this,"mouseState","up"),ge(this,"prevWasEditable",null),ge(this,"viewMousedownHandler",()=>{this.mouseState="down"}),ge(this,"mouseUpHandler",i=>{this.mouseState="up",this.mouseMoveHandler(i)}),ge(this,"mouseMoveHandler",i=>{var s,o,a,l,c,u,d,h;if(this.menuFrozen||this.mouseState==="selecting"||!(i.target instanceof Element)||!this.pmView.dom.contains(i.target))return;const f=SU(i.target);if(f?.type==="cell"&&this.mouseState==="down"&&!((s=this.state)!=null&&s.draggingState)){this.mouseState="selecting",(o=this.state)!=null&&o.show&&(this.state.show=!1,this.state.showAddOrRemoveRowsButton=!1,this.state.showAddOrRemoveColumnsButton=!1,this.emitUpdate());return}if(!f||!this.editor.isEditable){(a=this.state)!=null&&a.show&&(this.state.show=!1,this.state.showAddOrRemoveRowsButton=!1,this.state.showAddOrRemoveColumnsButton=!1,this.emitUpdate());return}if(!f.tbodyNode)return;const p=f.tbodyNode.getBoundingClientRect(),g=nw(f.domNode,this.pmView);if(!g)return;this.tableElement=g.node;let b;const y=this.editor.transact(I=>Vt(g.id,I.doc));if(!y)throw new Error(`Block with ID ${g.id} not found`);const C=ve(y.node,this.editor.pmSchema,this.editor.schema.blockSchema,this.editor.schema.inlineContentSchema,this.editor.schema.styleSchema);if(We(this.editor,"table")&&(this.tablePos=y.posBeforeNode+1,b=C),!b)return;this.tableId=g.id;const S=(l=f.domNode.closest(".tableWrapper"))==null?void 0:l.querySelector(".table-widgets-container");if(f?.type==="wrapper"){const I=i.clientY>=p.bottom-1&&i.clientY<p.bottom+20,M=i.clientX>=p.right-1&&i.clientX<p.right+20,A=((c=this.state)==null?void 0:c.block.id)!==b.id||i.clientX>p.right||i.clientY>p.bottom;this.state={...this.state,show:!0,showAddOrRemoveRowsButton:I,showAddOrRemoveColumnsButton:M,referencePosTable:p,block:b,widgetContainer:S,colIndex:A||(u=this.state)==null?void 0:u.colIndex,rowIndex:A||(d=this.state)==null?void 0:d.rowIndex,referencePosCell:A||(h=this.state)==null?void 0:h.referencePosCell}}else{const I=Ga(f.domNode),M=Ga(f.domNode.parentElement),A=f.domNode.getBoundingClientRect();if(this.state!==void 0&&this.state.show&&this.tableId===g.id&&this.state.rowIndex===M&&this.state.colIndex===I)return;this.state={show:!0,showAddOrRemoveColumnsButton:I===b.content.rows[0].cells.length-1,showAddOrRemoveRowsButton:M===b.content.rows.length-1,referencePosTable:p,block:b,draggingState:void 0,referencePosCell:A,colIndex:I,rowIndex:M,widgetContainer:S}}return this.emitUpdate(),!1}),ge(this,"dragOverHandler",i=>{var s;if(((s=this.state)==null?void 0:s.draggingState)===void 0)return;i.preventDefault(),i.dataTransfer.dropEffect="move",wU(".prosemirror-dropcursor-block, .prosemirror-dropcursor-inline",this.pmView.root);const o={left:Math.min(Math.max(i.clientX,this.state.referencePosTable.left+1),this.state.referencePosTable.right-1),top:Math.min(Math.max(i.clientY,this.state.referencePosTable.top+1),this.state.referencePosTable.bottom-1)},a=this.pmView.root.elementsFromPoint(o.left,o.top).filter(g=>g.tagName==="TD"||g.tagName==="TH");if(a.length===0)return;const l=a[0];let c=!1;const u=Ga(l.parentElement),d=Ga(l),h=this.state.draggingState.draggedCellOrientation==="row"?this.state.rowIndex:this.state.colIndex,f=(this.state.draggingState.draggedCellOrientation==="row"?u:d)!==h;(this.state.rowIndex!==u||this.state.colIndex!==d)&&(this.state.rowIndex=u,this.state.colIndex=d,this.state.referencePosCell=l.getBoundingClientRect(),c=!0);const p=this.state.draggingState.draggedCellOrientation==="row"?o.top:o.left;this.state.draggingState.mousePos!==p&&(this.state.draggingState.mousePos=p,c=!0),c&&this.emitUpdate(),f&&this.editor.transact(g=>g.setMeta(ro,!0))}),ge(this,"dropHandler",i=>{if(this.mouseState="up",this.state===void 0||this.state.draggingState===void 0)return!1;if(this.state.rowIndex===void 0||this.state.colIndex===void 0)throw new Error("Attempted to drop table row or column, but no table block was hovered prior.");i.preventDefault();const{draggingState:s,colIndex:o,rowIndex:a}=this.state,l=this.state.block.content.columnWidths;if(s.draggedCellOrientation==="row"){if(!qE(this.state.block,s.originalIndex,a))return!1;const c=cI(this.state.block,s.originalIndex,a);this.editor.updateBlock(this.state.block,{type:"table",content:{...this.state.block.content,rows:c}})}else{if(!WE(this.state.block,s.originalIndex,o))return!1;const c=lI(this.state.block,s.originalIndex,o),[u]=l.splice(s.originalIndex,1);l.splice(o,0,u),this.editor.updateBlock(this.state.block,{type:"table",content:{...this.state.block.content,columnWidths:l,rows:c}})}return this.editor.setTextCursorPosition(this.state.block.id),!0}),this.editor=e,this.pmView=n,this.emitUpdate=()=>{if(!this.state)throw new Error("Attempting to update uninitialized image toolbar");r(this.state)},n.dom.addEventListener("mousemove",this.mouseMoveHandler),n.dom.addEventListener("mousedown",this.viewMousedownHandler),window.addEventListener("mouseup",this.mouseUpHandler),n.root.addEventListener("dragover",this.dragOverHandler),n.root.addEventListener("drop",this.dropHandler)}update(){var e;if(!this.state||!this.state.show)return;if(this.state.block=this.editor.getBlock(this.state.block.id),!this.state.block||this.state.block.type!=="table"||!((e=this.tableElement)!=null&&e.isConnected)){this.state.show=!1,this.state.showAddOrRemoveRowsButton=!1,this.state.showAddOrRemoveColumnsButton=!1,this.emitUpdate();return}const{height:n,width:r}=ep(this.state.block);this.state.rowIndex!==void 0&&this.state.colIndex!==void 0&&(this.state.rowIndex>=n&&(this.state.rowIndex=n-1),this.state.colIndex>=r&&(this.state.colIndex=r-1));const i=this.tableElement.querySelector("tbody");if(!i)throw new Error("Table block does not contain a 'tbody' HTML element. This should never happen.");if(this.state.rowIndex!==void 0&&this.state.colIndex!==void 0){const s=i.children[this.state.rowIndex].children[this.state.colIndex];s?this.state.referencePosCell=s.getBoundingClientRect():(this.state.rowIndex=void 0,this.state.colIndex=void 0)}this.state.referencePosTable=i.getBoundingClientRect(),this.emitUpdate()}destroy(){this.pmView.dom.removeEventListener("mousemove",this.mouseMoveHandler),window.removeEventListener("mouseup",this.mouseUpHandler),this.pmView.dom.removeEventListener("mousedown",this.viewMousedownHandler),this.pmView.root.removeEventListener("dragover",this.dragOverHandler),this.pmView.root.removeEventListener("drop",this.dropHandler)}};const ro=new me("TableHandlesPlugin"),AU=pe(({editor:t})=>{let e;const n=Mi(void 0);return{key:"tableHandles",store:n,prosemirrorPlugins:[new re({key:ro,view:r=>(e=new xU(t,r,i=>{n.setState(i.block?{...i,draggingState:i.draggingState?{...i.draggingState}:void 0}:void 0)}),e),props:{decorations:r=>{if(e===void 0||e.state===void 0||e.state.draggingState===void 0||e.tablePos===void 0)return;const i=e.state.draggingState.draggedCellOrientation==="row"?e.state.rowIndex:e.state.colIndex;if(i===void 0)return;const s=[],{block:o,draggingState:a}=e.state,{originalIndex:l,draggedCellOrientation:c}=a;if(i===l||!o||c==="row"&&!qE(o,l,i)||c==="col"&&!WE(o,l,i))return ue.create(r.doc,s);const u=r.doc.resolve(e.tablePos+1);return e.state.draggingState.draggedCellOrientation==="row"?lh(e.state.block,i).forEach(({row:d,col:h})=>{const f=r.doc.resolve(u.posAtIndex(d)+1),p=r.doc.resolve(f.posAtIndex(h)+1),g=p.node(),b=p.pos+(i>l?g.nodeSize-2:0);s.push(Ee.widget(b,()=>{const y=document.createElement("div");return y.className="bn-table-drop-cursor",y.style.left="0",y.style.right="0",i>l?y.style.bottom="-2px":y.style.top="-3px",y.style.height="4px",y}))}):ch(e.state.block,i).forEach(({row:d,col:h})=>{const f=r.doc.resolve(u.posAtIndex(d)+1),p=r.doc.resolve(f.posAtIndex(h)+1),g=p.node(),b=p.pos+(i>l?g.nodeSize-2:0);s.push(Ee.widget(b,()=>{const y=document.createElement("div");return y.className="bn-table-drop-cursor",y.style.top="0",y.style.bottom="0",i>l?y.style.right="-2px":y.style.left="-3px",y.style.width="4px",y}))}),ue.create(r.doc,s)}}})],colDragStart(r){if(e===void 0||e.state===void 0||e.state.colIndex===void 0)throw new Error("Attempted to drag table column, but no table block was hovered prior.");e.state.draggingState={draggedCellOrientation:"col",originalIndex:e.state.colIndex,mousePos:r.clientX},e.emitUpdate(),t.transact(i=>i.setMeta(ro,{draggedCellOrientation:e.state.draggingState.draggedCellOrientation,originalIndex:e.state.colIndex,newIndex:e.state.colIndex,tablePos:e.tablePos})),!t.headless&&(e1(t.prosemirrorView.root),r.dataTransfer.setDragImage(At,0,0),r.dataTransfer.effectAllowed="move")},rowDragStart(r){if(e.state===void 0||e.state.rowIndex===void 0)throw new Error("Attempted to drag table row, but no table block was hovered prior.");e.state.draggingState={draggedCellOrientation:"row",originalIndex:e.state.rowIndex,mousePos:r.clientY},e.emitUpdate(),t.transact(i=>i.setMeta(ro,{draggedCellOrientation:e.state.draggingState.draggedCellOrientation,originalIndex:e.state.rowIndex,newIndex:e.state.rowIndex,tablePos:e.tablePos})),!t.headless&&(e1(t.prosemirrorView.root),r.dataTransfer.setDragImage(At,0,0),r.dataTransfer.effectAllowed="copyMove")},dragEnd(){if(e.state===void 0)throw new Error("Attempted to drag table row, but no table block was hovered prior.");e.state.draggingState=void 0,e.emitUpdate(),t.transact(r=>r.setMeta(ro,null)),!t.headless&&CU(t.prosemirrorView.root)},freezeHandles(){e.menuFrozen=!0},unfreezeHandles(){e.menuFrozen=!1},getCellsAtRowHandle(r,i){return lh(r,i)},getCellsAtColumnHandle(r,i){return ch(r,i)},setCellSelection(r,i,s=i){if(!e)throw new Error("Table handles view not initialized");const o=r.doc.resolve(e.tablePos+1),a=r.doc.resolve(o.posAtIndex(i.row)+1),l=r.doc.resolve(a.posAtIndex(i.col)),c=r.doc.resolve(o.posAtIndex(s.row)+1),u=r.doc.resolve(c.posAtIndex(s.col)),d=r.tr;return d.setSelection(new be(l,u)),r.apply(d)},addRowOrColumn(r,i){t.exec((s,o)=>{const a=this.setCellSelection(s,i.orientation==="row"?{row:r,col:0}:{row:0,col:r});return i.orientation==="row"?i.side==="above"?RI(a,o):PI(a,o):i.side==="left"?OI(a,o):MI(a,o)})},removeRowOrColumn(r,i){return i==="row"?t.exec((s,o)=>{const a=this.setCellSelection(s,{row:r,col:0});return FI(a,o)}):t.exec((s,o)=>{const a=this.setCellSelection(s,{row:0,col:r});return DI(a,o)})},mergeCells(r){return t.exec((i,s)=>{const o=r?this.setCellSelection(i,r.relativeStartCell,r.relativeEndCell):i;return UI(o,s)})},splitCell(r){return t.exec((i,s)=>{const o=r?this.setCellSelection(i,r):i;return $I(o,s)})},getCellSelection(){return t.transact(r=>{const i=r.selection;let s=i.$from,o=i.$to;if(R0(i)){const{ranges:g}=i;g.forEach(b=>{s=b.$from.min(s??b.$from),o=b.$to.max(o??b.$to)})}else if(s=r.doc.resolve(i.$from.pos-i.$from.parentOffset-1),o=r.doc.resolve(i.$to.pos-i.$to.parentOffset-1),s.pos===0||o.pos===0)return;const a=r.doc.resolve(s.pos-s.parentOffset-1),l=r.doc.resolve(o.pos-o.parentOffset-1),c=r.doc.resolve(a.pos-a.parentOffset-1),u=s.index(a.depth),d=a.index(c.depth),h=o.index(l.depth),f=l.index(c.depth),p=[];for(let g=d;g<=f;g++)for(let b=u;b<=h;b++)p.push({row:g,col:b});return{from:{row:d,col:u},to:{row:f,col:h},cells:p}})},getMergeDirection(r){return t.transact(i=>{const s=R0(i.selection)?i.selection:void 0;if(!s||!r||s.ranges.length<=1)return;const o=this.getCellSelection();if(o)return hI(o.from,o.to,r)?"vertical":"horizontal"})},cropEmptyRowsOrColumns(r,i){return uI(r,i)},addRowsOrColumns(r,i,s){return dI(r,i,s)}}}),t1=new me("trailingNode"),_U=pe(()=>({key:"trailingNode",prosemirrorPlugins:[new re({key:t1,appendTransaction:(t,e,n)=>{const{doc:r,tr:i,schema:s}=n,o=t1.getState(n),a=r.content.size-2,l=s.nodes.blockContainer,c=s.nodes.paragraph;if(o)return i.insert(a,l.create(void 0,c.create()))},state:{init:(t,e)=>{},apply:(t,e)=>{if(!t.docChanged)return e;let n=t.doc.lastChild;if(!n||n.type.name!=="blockGroup")throw new Error("Expected blockGroup");if(n=n.lastChild,!n||n.type.name!=="blockContainer")return!0;const r=n.firstChild;if(!r)throw new Error("Expected blockContent");return n.nodeSize>4||r.type.spec.content!=="inline*"}}})]}));var NU=Object.defineProperty,IU=(t,e,n)=>e in t?NU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Kn=(t,e,n)=>IU(t,typeof e!="symbol"?e+"":e,n);function OU(t){const e=vU(t);let{roots:n,nonRoots:r}=n1(e);const i=[];for(;n.size;){i.push(n);const s=new Set;for(const o of n){const a=t.get(o);if(a)for(const l of a){const c=e.get(l);if(c===void 0)continue;const u=c-1;e.set(l,u),u===0&&s.add(l)}}n=s}if(r=n1(e).nonRoots,r.size)throw new Error(`Cycle(s) detected; toposort only works on acyclic graphs. Cyclic nodes: ${Array.from(r).join(", ")}`);return i}function MU(t){const e=DU(t);return OU(e)}function vU(t){const e=new Map;for(const[n,r]of t.entries()){e.has(n)||e.set(n,0);for(const i of r){const s=e.get(i)??0;e.set(i,s+1)}}return e}function n1(t){const e=new Set,n=new Set;for(const[r,i]of t.entries())i===0?e.add(r):n.add(r);return{roots:e,nonRoots:n}}function DU(t){const e=new Map;for(const[n,r]of t.entries()){e.has(n)||e.set(n,new Set);for(const i of r)e.has(i)||e.set(i,new Set),e.get(i).add(n)}return e}function LU(){return new Map}function r1(t,e,n){return t.has(e)||t.set(e,new Set),t.get(e).add(n),t}function sw(t){const e=LU();for(const i of t)Array.isArray(i.runsBefore)&&i.runsBefore.length>0?i.runsBefore.forEach(s=>{r1(e,i.key,s)}):r1(e,"default",i.key);const n=MU(e),r=n.findIndex(i=>i.has("default"));return i=>91+(n.findIndex(s=>s.has(i))+r)*10}function i1(t){return t&&Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0))}class RU{constructor(e){Kn(this,"BlockNoteEditor","only for types"),Kn(this,"Block","only for types"),Kn(this,"PartialBlock","only for types"),Kn(this,"inlineContentSpecs"),Kn(this,"styleSpecs"),Kn(this,"blockSpecs"),Kn(this,"blockSchema"),Kn(this,"inlineContentSchema"),Kn(this,"styleSchema"),this.opts=e;const{blockSpecs:n,inlineContentSpecs:r,styleSpecs:i,blockSchema:s,inlineContentSchema:o,styleSchema:a}=this.init();this.blockSpecs=n,this.styleSpecs=i,this.styleSchema=a,this.inlineContentSpecs=r,this.blockSchema=s,this.inlineContentSchema=o}init(){const e=sw(Object.entries({...this.opts.blockSpecs,...this.opts.inlineContentSpecs,...this.opts.styleSpecs}).map(([s,o])=>{var a;return{key:s,runsBefore:((a=o.implementation)==null?void 0:a.runsBefore)??[]}})),n=Object.fromEntries(Object.entries(this.opts.blockSpecs).map(([s,o])=>[s,rL(o.config,o.implementation,o.extensions,e(s))])),r=Object.fromEntries(Object.entries(this.opts.inlineContentSpecs).map(([s,o])=>{var a;return typeof o.config!="object"?[s,o]:[s,{...o,implementation:{...o.implementation,node:(a=o.implementation)==null?void 0:a.node.extend({priority:e(s)})}}]})),i=Object.fromEntries(Object.entries(this.opts.styleSpecs).map(([s,o])=>{var a;return[s,{...o,implementation:{...o.implementation,mark:(a=o.implementation)==null?void 0:a.mark.extend({priority:e(s)})}}]}));return{blockSpecs:n,blockSchema:Object.fromEntries(Object.entries(n).map(([s,o])=>[s,o.config])),inlineContentSpecs:i1(r),styleSpecs:i1(i),inlineContentSchema:OT(r),styleSchema:vT(i)}}extend(e){Object.assign(this.opts.blockSpecs,e.blockSpecs),Object.assign(this.opts.inlineContentSpecs,e.inlineContentSpecs),Object.assign(this.opts.styleSpecs,e.styleSpecs);const{blockSpecs:n,inlineContentSpecs:r,styleSpecs:i,blockSchema:s,inlineContentSchema:o,styleSchema:a}=this.init();return this.blockSpecs=n,this.styleSpecs=i,this.styleSchema=a,this.inlineContentSpecs=r,this.blockSchema=s,this.inlineContentSchema=o,this}}let PU=class ow extends RU{static create(e){return new ow({blockSpecs:e?.blockSpecs??yR,inlineContentSpecs:e?.inlineContentSpecs??zT,styleSpecs:e?.styleSpecs??$T})}};var BU=Object.defineProperty,FU=(t,e,n)=>e in t?BU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,HU=(t,e,n)=>FU(t,e+"",n);class aw{constructor(){HU(this,"callbacks",{})}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),()=>this.off(e,n)}emit(e,...n){const r=this.callbacks[e];r&&r.forEach(i=>i.apply(this,n))}off(e,n){const r=this.callbacks[e];r&&(n?this.callbacks[e]=r.filter(i=>i!==n):delete this.callbacks[e])}removeAllListeners(){this.callbacks={}}}const UU={slash_menu:{heading:{title:"Heading 1",subtext:"Top-level heading",aliases:["h","heading1","h1"],group:"Headings"},heading_2:{title:"Heading 2",subtext:"Key section heading",aliases:["h2","heading2","subheading"],group:"Headings"},heading_3:{title:"Heading 3",subtext:"Subsection and group heading",aliases:["h3","heading3","subheading"],group:"Headings"},heading_4:{title:"Heading 4",subtext:"Minor subsection heading",aliases:["h4","heading4","subheading4"],group:"Subheadings"},heading_5:{title:"Heading 5",subtext:"Small subsection heading",aliases:["h5","heading5","subheading5"],group:"Subheadings"},heading_6:{title:"Heading 6",subtext:"Lowest-level heading",aliases:["h6","heading6","subheading6"],group:"Subheadings"},toggle_heading:{title:"Toggle Heading 1",subtext:"Toggleable top-level heading",aliases:["h","heading1","h1","collapsable"],group:"Subheadings"},toggle_heading_2:{title:"Toggle Heading 2",subtext:"Toggleable key section heading",aliases:["h2","heading2","subheading","collapsable"],group:"Subheadings"},toggle_heading_3:{title:"Toggle Heading 3",subtext:"Toggleable subsection and group heading",aliases:["h3","heading3","subheading","collapsable"],group:"Subheadings"},quote:{title:"Quote",subtext:"Quote or excerpt",aliases:["quotation","blockquote","bq"],group:"Basic blocks"},toggle_list:{title:"Toggle List",subtext:"List with hideable sub-items",aliases:["li","list","toggleList","toggle list","collapsable list"],group:"Basic blocks"},numbered_list:{title:"Numbered List",subtext:"List with ordered items",aliases:["ol","li","list","numberedlist","numbered list"],group:"Basic blocks"},bullet_list:{title:"Bullet List",subtext:"List with unordered items",aliases:["ul","li","list","bulletlist","bullet list"],group:"Basic blocks"},check_list:{title:"Check List",subtext:"List with checkboxes",aliases:["ul","li","list","checklist","check list","checked list","checkbox"],group:"Basic blocks"},paragraph:{title:"Paragraph",subtext:"The body of your document",aliases:["p","paragraph"],group:"Basic blocks"},code_block:{title:"Code Block",subtext:"Code block with syntax highlighting",aliases:["code","pre"],group:"Basic blocks"},page_break:{title:"Page Break",subtext:"Page separator",aliases:["page","break","separator"],group:"Basic blocks"},table:{title:"Table",subtext:"Table with editable cells",aliases:["table"],group:"Advanced"},image:{title:"Image",subtext:"Resizable image with caption",aliases:["image","imageUpload","upload","img","picture","media","url"],group:"Media"},video:{title:"Video",subtext:"Resizable video with caption",aliases:["video","videoUpload","upload","mp4","film","media","url"],group:"Media"},audio:{title:"Audio",subtext:"Embedded audio with caption",aliases:["audio","audioUpload","upload","mp3","sound","media","url"],group:"Media"},file:{title:"File",subtext:"Embedded file",aliases:["file","upload","embed","media","url"],group:"Media"},emoji:{title:"Emoji",subtext:"Search for and insert an emoji",aliases:["emoji","emote","emotion","face"],group:"Others"},divider:{title:"Divider",subtext:"Visually divide blocks",aliases:["divider","hr","line","horizontal rule"],group:"Basic blocks"}},placeholders:{default:"Enter text or type '/' for commands",heading:"Heading",toggleListItem:"Toggle",bulletListItem:"List",numberedListItem:"List",checkListItem:"List",emptyDocument:void 0,new_comment:"Write a comment...",edit_comment:"Edit comment...",comment_reply:"Add comment..."},file_blocks:{add_button_text:{image:"Add image",video:"Add video",audio:"Add audio",file:"Add file"}},toggle_blocks:{add_block_button:"Empty toggle. Click to add a block."},side_menu:{add_block_label:"Add block",drag_handle_label:"Open block menu"},drag_handle:{delete_menuitem:"Delete",colors_menuitem:"Colors",header_row_menuitem:"Header row",header_column_menuitem:"Header column"},table_handle:{delete_column_menuitem:"Delete column",delete_row_menuitem:"Delete row",add_left_menuitem:"Add column left",add_right_menuitem:"Add column right",add_above_menuitem:"Add row above",add_below_menuitem:"Add row below",split_cell_menuitem:"Split cell",merge_cells_menuitem:"Merge cells",background_color_menuitem:"Background color"},suggestion_menu:{no_items_title:"No items found"},color_picker:{text_title:"Text",background_title:"Background",colors:{default:"Default",gray:"Gray",brown:"Brown",red:"Red",orange:"Orange",yellow:"Yellow",green:"Green",blue:"Blue",purple:"Purple",pink:"Pink"}},formatting_toolbar:{bold:{tooltip:"Bold",secondary_tooltip:"Mod+B"},italic:{tooltip:"Italic",secondary_tooltip:"Mod+I"},underline:{tooltip:"Underline",secondary_tooltip:"Mod+U"},strike:{tooltip:"Strike",secondary_tooltip:"Mod+Shift+S"},code:{tooltip:"Code",secondary_tooltip:""},colors:{tooltip:"Colors"},link:{tooltip:"Create link",secondary_tooltip:"Mod+K"},file_caption:{tooltip:"Edit caption",input_placeholder:"Edit caption"},file_replace:{tooltip:{image:"Replace image",video:"Replace video",audio:"Replace audio",file:"Replace file"}},file_rename:{tooltip:{image:"Rename image",video:"Rename video",audio:"Rename audio",file:"Rename file"},input_placeholder:{image:"Rename image",video:"Rename video",audio:"Rename audio",file:"Rename file"}},file_download:{tooltip:{image:"Download image",video:"Download video",audio:"Download audio",file:"Download file"}},file_delete:{tooltip:{image:"Delete image",video:"Delete video",audio:"Delete audio",file:"Delete file"}},file_preview_toggle:{tooltip:"Toggle preview"},nest:{tooltip:"Nest block",secondary_tooltip:"Tab"},unnest:{tooltip:"Unnest block",secondary_tooltip:"Shift+Tab"},align_left:{tooltip:"Align text left"},align_center:{tooltip:"Align text center"},align_right:{tooltip:"Align text right"},align_justify:{tooltip:"Justify text"},table_cell_merge:{tooltip:"Merge cells"},comment:{tooltip:"Add comment"}},file_panel:{upload:{title:"Upload",file_placeholder:{image:"Upload image",video:"Upload video",audio:"Upload audio",file:"Upload file"},upload_error:"Error: Upload failed"},embed:{title:"Embed",embed_button:{image:"Embed image",video:"Embed video",audio:"Embed audio",file:"Embed file"},url_placeholder:"Enter URL"}},link_toolbar:{delete:{tooltip:"Remove link"},edit:{text:"Edit link",tooltip:"Edit"},open:{tooltip:"Open in new tab"},form:{title_placeholder:"Edit title",url_placeholder:"Edit URL"}},comments:{edited:"edited",save_button_text:"Save",cancel_button_text:"Cancel",actions:{add_reaction:"Add reaction",resolve:"Resolve",edit_comment:"Edit comment",delete_comment:"Delete comment",more_actions:"More actions"},reactions:{reacted_by:"Reacted by"},sidebar:{marked_as_resolved:"Marked as resolved",more_replies:t=>`${t} more replies`}},generic:{ctrl_shortcut:"Ctrl"}};class Ri{match;handler;undoable;inCode;inCodeMark;constructor(e,n,r={}){this.match=e,this.match=e,this.handler=typeof n=="string"?$U(n):n,this.undoable=r.undoable!==!1,this.inCode=r.inCode||!1,this.inCodeMark=r.inCodeMark!==!1}}function $U(t){return function(e,n,r,i){let s=t;if(n[1]){let o=n[0].lastIndexOf(n[1]);s+=n[0].slice(o+n[1].length),r+=o;let a=r-i;a>0&&(s=n[0].slice(o-a,o)+s,r=i)}return e.tr.insertText(s,r,i)}}const zU=500;function VU({rules:t}){let e=new re({state:{init(){return null},apply(n,r){let i=n.getMeta(this);return i||(n.selectionSet||n.docChanged?null:r)}},props:{handleTextInput(n,r,i,s){return s1(n,r,i,s,t,e)},handleDOMEvents:{compositionend:n=>{setTimeout(()=>{let{$cursor:r}=n.state.selection;r&&s1(n,r.pos,r.pos,"",t,e)})}}},isInputRules:!0});return e}function s1(t,e,n,r,i,s){if(t.composing)return!1;const o=t.state.tr.insertText(r,e,n),a=o.mapping.map(e),l=o.mapping.map(n);let c=null,u=o.doc.resolve(a),d=u.parent.textBetween(Math.max(0,u.parentOffset-zU),u.parentOffset,null,"");for(let h=0;h<i.length;h++){let f=i[h];if(!f.inCodeMark&&u.marks().some(b=>b.type.spec.code))continue;if(u.parent.type.spec.code){if(!f.inCode)continue}else if(f.inCode==="only")continue;let p=f.match.exec(d);if(!p||p[0].length<r.length)continue;c??=t.state.apply(o);let g=f.handler(c,p,a-p[0].length,l);if(g)return t.dispatch(o),t.dispatch(DR(t.state.tr)),f.undoable&&g.setMeta(s,{transform:g,from:a,to:l,text:r}),t.dispatch(g),!0}return!1}new Ri(/--$/,"—",{inCodeMark:!1});new Ri(/\.\.\.$/,"…",{inCodeMark:!1});new Ri(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1});new Ri(/"$/,"”",{inCodeMark:!1});new Ri(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1});new Ri(/'$/,"’",{inCodeMark:!1});class Pe extends Q{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Pe.valid(r)?new Pe(r):Q.near(r)}content(){return F.empty}eq(e){return e instanceof Pe&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Pe(e.resolve(n.pos))}getBookmark(){return new lm(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!jU(e)||!qU(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Pe.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let a=e.node(o);if(n>0?e.indexAfter(o)<a.childCount:e.index(o)>0){s=a.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=n;let l=e.doc.resolve(i);if(Pe.valid(l))return l}for(;;){let o=n>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!W.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=o,i+=n;let a=e.doc.resolve(i);if(Pe.valid(a))return a}return null}}}Pe.prototype.visible=!1;Pe.findFrom=Pe.findGapCursorFrom;Q.jsonID("gapcursor",Pe);class lm{constructor(e){this.pos=e}map(e){return new lm(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Pe.valid(n)?new Pe(n):Q.near(n)}}function lw(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function jU(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||lw(i.type))return!0;if(i.inlineContent)return!1}}return!0}function qU(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||lw(i.type))return!0;if(i.inlineContent)return!1}}return!0}function WU(){return new re({props:{decorations:QU,createSelectionBetween(t,e,n){return e.pos==n.pos&&Pe.valid(n)?new Pe(n):null},handleClick:KU,handleKeyDown:YU,handleDOMEvents:{beforeinput:GU}}})}const YU=Rf({ArrowLeft:Qa("horiz",-1),ArrowRight:Qa("horiz",1),ArrowUp:Qa("vert",-1),ArrowDown:Qa("vert",1)});function Qa(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof j){if(!s.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=Pe.findGapCursorFrom(a,e,l);return c?(i&&i(r.tr.setSelection(new Pe(c))),!0):!1}}function KU(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Pe.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&W.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Pe(r))),!0)}function GU(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Pe))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=v.empty;for(let o=r.length-1;o>=0;o--)i=v.from(r[o].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new F(i,0,0));return s.setSelection(j.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function QU(t){if(!(t.selection instanceof Pe))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ue.create(t.doc,[Ee.widget(t.selection.head,e,{key:"gapcursor"})])}var JU=De.create({name:"gapCursor",addProseMirrorPlugins(){return[WU()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Te(Y(t,"allowGapCursor",n)))!=null?e:null}}});const XU="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",ZU="ελ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",tf="numeric",nf="ascii",rf="alpha",Co="asciinumeric",io="alphanumeric",sf="domain",cw="emoji",e7="scheme",t7="slashscheme",Ld="whitespace";function n7(t,e){return t in e||(e[t]=[]),e[t]}function ni(t,e,n){e[tf]&&(e[Co]=!0,e[io]=!0),e[nf]&&(e[Co]=!0,e[rf]=!0),e[Co]&&(e[io]=!0),e[rf]&&(e[io]=!0),e[io]&&(e[sf]=!0),e[cw]&&(e[sf]=!0);for(const r in e){const i=n7(r,n);i.indexOf(t)<0&&i.push(t)}}function r7(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function _t(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}_t.groups={};_t.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],s=e.jr[r][1];if(s&&i.test(t))return s}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){r=r||_t.groups;let i;return e&&e.j?i=e:(i=new _t(e),n&&r&&ni(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const s=t.length;if(!s)return i;for(let o=0;o<s-1;o++)i=i.tt(t[o]);return i.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||_t.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const s=e;let o,a=i.go(t);if(a?(o=new _t,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new _t,s){if(r)if(o.t&&typeof o.t=="string"){const l=Object.assign(r7(o.t,r),n);ni(s,l,r)}else n&&ni(s,n,r);o.t=s}return i.j[t]=o,o}};const ne=(t,e,n,r,i)=>t.ta(e,n,r,i),Le=(t,e,n,r,i)=>t.tr(e,n,r,i),o1=(t,e,n,r,i)=>t.ts(e,n,r,i),B=(t,e,n,r,i)=>t.tt(e,n,r,i),Xn="WORD",of="UWORD",uw="ASCIINUMERICAL",dw="ALPHANUMERICAL",na="LOCALHOST",af="TLD",lf="UTLD",Cl="SCHEME",Ki="SLASH_SCHEME",cm="NUM",cf="WS",um="NL",So="OPENBRACE",wo="CLOSEBRACE",lc="OPENBRACKET",cc="CLOSEBRACKET",uc="OPENPAREN",dc="CLOSEPAREN",hc="OPENANGLEBRACKET",fc="CLOSEANGLEBRACKET",pc="FULLWIDTHLEFTPAREN",mc="FULLWIDTHRIGHTPAREN",gc="LEFTCORNERBRACKET",bc="RIGHTCORNERBRACKET",yc="LEFTWHITECORNERBRACKET",Ec="RIGHTWHITECORNERBRACKET",kc="FULLWIDTHLESSTHAN",Tc="FULLWIDTHGREATERTHAN",Cc="AMPERSAND",Sc="APOSTROPHE",wc="ASTERISK",Er="AT",xc="BACKSLASH",Ac="BACKTICK",_c="CARET",ri="COLON",dm="COMMA",Nc="DOLLAR",In="DOT",Ic="EQUALS",hm="EXCLAMATION",Wt="HYPHEN",xo="PERCENT",Oc="PIPE",Mc="PLUS",vc="POUND",Ao="QUERY",fm="QUOTE",hw="FULLWIDTHMIDDLEDOT",pm="SEMI",On="SLASH",_o="TILDE",Dc="UNDERSCORE",fw="EMOJI",Lc="SYM";var pw=Object.freeze({__proto__:null,ALPHANUMERICAL:dw,AMPERSAND:Cc,APOSTROPHE:Sc,ASCIINUMERICAL:uw,ASTERISK:wc,AT:Er,BACKSLASH:xc,BACKTICK:Ac,CARET:_c,CLOSEANGLEBRACKET:fc,CLOSEBRACE:wo,CLOSEBRACKET:cc,CLOSEPAREN:dc,COLON:ri,COMMA:dm,DOLLAR:Nc,DOT:In,EMOJI:fw,EQUALS:Ic,EXCLAMATION:hm,FULLWIDTHGREATERTHAN:Tc,FULLWIDTHLEFTPAREN:pc,FULLWIDTHLESSTHAN:kc,FULLWIDTHMIDDLEDOT:hw,FULLWIDTHRIGHTPAREN:mc,HYPHEN:Wt,LEFTCORNERBRACKET:gc,LEFTWHITECORNERBRACKET:yc,LOCALHOST:na,NL:um,NUM:cm,OPENANGLEBRACKET:hc,OPENBRACE:So,OPENBRACKET:lc,OPENPAREN:uc,PERCENT:xo,PIPE:Oc,PLUS:Mc,POUND:vc,QUERY:Ao,QUOTE:fm,RIGHTCORNERBRACKET:bc,RIGHTWHITECORNERBRACKET:Ec,SCHEME:Cl,SEMI:pm,SLASH:On,SLASH_SCHEME:Ki,SYM:Lc,TILDE:_o,TLD:af,UNDERSCORE:Dc,UTLD:lf,UWORD:of,WORD:Xn,WS:cf});const Gn=/[a-z]/,Js=new RegExp("\\p{L}","u"),Rd=new RegExp("\\p{Emoji}","u"),Qn=/\d/,Pd=/\s/,a1="\r",Bd=`
|
|
154
|
-
`,i7="️",s7="",Fd="";let Ja=null,Xa=null;function o7(t=[]){const e={};_t.groups=e;const n=new _t;Ja==null&&(Ja=l1(XU)),Xa==null&&(Xa=l1(ZU)),B(n,"'",Sc),B(n,"{",So),B(n,"}",wo),B(n,"[",lc),B(n,"]",cc),B(n,"(",uc),B(n,")",dc),B(n,"<",hc),B(n,">",fc),B(n,"(",pc),B(n,")",mc),B(n,"「",gc),B(n,"」",bc),B(n,"『",yc),B(n,"』",Ec),B(n,"<",kc),B(n,">",Tc),B(n,"&",Cc),B(n,"*",wc),B(n,"@",Er),B(n,"`",Ac),B(n,"^",_c),B(n,":",ri),B(n,",",dm),B(n,"$",Nc),B(n,".",In),B(n,"=",Ic),B(n,"!",hm),B(n,"-",Wt),B(n,"%",xo),B(n,"|",Oc),B(n,"+",Mc),B(n,"#",vc),B(n,"?",Ao),B(n,'"',fm),B(n,"/",On),B(n,";",pm),B(n,"~",_o),B(n,"_",Dc),B(n,"\\",xc),B(n,"・",hw);const r=Le(n,Qn,cm,{[tf]:!0});Le(r,Qn,r);const i=Le(r,Gn,uw,{[Co]:!0}),s=Le(r,Js,dw,{[io]:!0}),o=Le(n,Gn,Xn,{[nf]:!0});Le(o,Qn,i),Le(o,Gn,o),Le(i,Qn,i),Le(i,Gn,i);const a=Le(n,Js,of,{[rf]:!0});Le(a,Gn),Le(a,Qn,s),Le(a,Js,a),Le(s,Qn,s),Le(s,Gn),Le(s,Js,s);const l=B(n,Bd,um,{[Ld]:!0}),c=B(n,a1,cf,{[Ld]:!0}),u=Le(n,Pd,cf,{[Ld]:!0});B(n,Fd,u),B(c,Bd,l),B(c,Fd,u),Le(c,Pd,u),B(u,a1),B(u,Bd),Le(u,Pd,u),B(u,Fd,u);const d=Le(n,Rd,fw,{[cw]:!0});B(d,"#"),Le(d,Rd,d),B(d,i7,d);const h=B(d,s7);B(h,"#"),Le(h,Rd,d);const f=[[Gn,o],[Qn,i]],p=[[Gn,null],[Js,a],[Qn,s]];for(let g=0;g<Ja.length;g++)hr(n,Ja[g],af,Xn,f);for(let g=0;g<Xa.length;g++)hr(n,Xa[g],lf,of,p);ni(af,{tld:!0,ascii:!0},e),ni(lf,{utld:!0,alpha:!0},e),hr(n,"file",Cl,Xn,f),hr(n,"mailto",Cl,Xn,f),hr(n,"http",Ki,Xn,f),hr(n,"https",Ki,Xn,f),hr(n,"ftp",Ki,Xn,f),hr(n,"ftps",Ki,Xn,f),ni(Cl,{scheme:!0,ascii:!0},e),ni(Ki,{slashscheme:!0,ascii:!0},e),t=t.sort((g,b)=>g[0]>b[0]?1:-1);for(let g=0;g<t.length;g++){const b=t[g][0],C=t[g][1]?{[e7]:!0}:{[t7]:!0};b.indexOf("-")>=0?C[sf]=!0:Gn.test(b)?Qn.test(b)?C[Co]=!0:C[nf]=!0:C[tf]=!0,o1(n,b,b,C)}return o1(n,"localhost",na,{ascii:!0}),n.jd=new _t(Lc),{start:n,tokens:Object.assign({groups:e},pw)}}function mw(t,e){const n=a7(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,i=[];let s=0,o=0;for(;o<r;){let a=t,l=null,c=0,u=null,d=-1,h=-1;for(;o<r&&(l=a.go(n[o]));)a=l,a.accepts()?(d=0,h=0,u=a):d>=0&&(d+=n[o].length,h++),c+=n[o].length,s+=n[o].length,o++;s-=d,o-=h,c-=d,i.push({t:u.t,v:e.slice(s-c,s),s:s-c,e:s})}return i}function a7(t){const e=[],n=t.length;let r=0;for(;r<n;){let i=t.charCodeAt(r),s,o=i<55296||i>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function hr(t,e,n,r,i){let s;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];t.j[l]?s=t.j[l]:(s=new _t(r),s.jr=i.slice(),t.j[l]=s),t=s}return s=new _t(n),s.jr=i.slice(),t.j[e[o-1]]=s,s}function l1(t){const e=[],n=[];let r=0,i="0123456789";for(;r<t.length;){let s=0;for(;i.indexOf(t[r+s])>=0;)s++;if(s>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+s),10);o>0;o--)n.pop();r+=s}else n.push(t[r]),r++}return e}const ra={defaultProtocol:"http",events:null,format:c1,formatHref:c1,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function mm(t,e=null){let n=Object.assign({},ra);t&&(n=Object.assign(n,t instanceof mm?t.o:t));const r=n.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i}mm.prototype={o:ra,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let i=this.o[t];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:ra[t],typeof i=="function"&&r&&(i=i(e,n))):typeof i=="function"&&r&&(i=i(e,n.t,n)),i)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function c1(t){return t}function gw(t,e){this.t="token",this.v=t,this.tk=e}gw.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=ra.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),s=this.toFormattedString(t),o={},a=t.get("className",n,e),l=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return o.href=r,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),u&&Object.assign(o,u),{tagName:i,attributes:o,content:s,eventListeners:d}}};function Iu(t,e){class n extends gw{constructor(i,s){super(i,s),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const l7=Iu("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),u1=Iu("text"),c7=Iu("nl"),Za=Iu("url",{isLink:!0,toHref(t=ra.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==na&&t[1].t===ri}}),qt=t=>new _t(t);function u7({groups:t}){const e=t.domain.concat([Cc,wc,Er,xc,Ac,_c,Nc,Ic,Wt,cm,xo,Oc,Mc,vc,On,Lc,_o,Dc]),n=[Sc,ri,dm,In,hm,xo,Ao,fm,pm,hc,fc,So,wo,cc,lc,uc,dc,pc,mc,gc,bc,yc,Ec,kc,Tc],r=[Cc,Sc,wc,xc,Ac,_c,Nc,Ic,Wt,So,wo,xo,Oc,Mc,vc,Ao,On,Lc,_o,Dc],i=qt(),s=B(i,_o);ne(s,r,s),ne(s,t.domain,s);const o=qt(),a=qt(),l=qt();ne(i,t.domain,o),ne(i,t.scheme,a),ne(i,t.slashscheme,l),ne(o,r,s),ne(o,t.domain,o);const c=B(o,Er);B(s,Er,c),B(a,Er,c),B(l,Er,c);const u=B(s,In);ne(u,r,s),ne(u,t.domain,s);const d=qt();ne(c,t.domain,d),ne(d,t.domain,d);const h=B(d,In);ne(h,t.domain,d);const f=qt(l7);ne(h,t.tld,f),ne(h,t.utld,f),B(c,na,f);const p=B(d,Wt);B(p,Wt,p),ne(p,t.domain,d),ne(f,t.domain,d),B(f,In,h),B(f,Wt,p);const g=B(o,Wt),b=B(o,In);B(g,Wt,g),ne(g,t.domain,o),ne(b,r,s),ne(b,t.domain,o);const y=qt(Za);ne(b,t.tld,y),ne(b,t.utld,y),ne(y,t.domain,o),ne(y,r,s),B(y,In,b),B(y,Wt,g),B(y,Er,c);const C=B(y,ri),S=qt(Za);ne(C,t.numeric,S);const I=qt(Za),M=qt();ne(I,e,I),ne(I,n,M),ne(M,e,I),ne(M,n,M),B(y,On,I),B(S,On,I);const A=B(a,ri),D=B(l,ri),z=B(D,On),V=B(z,On);ne(a,t.domain,o),B(a,In,b),B(a,Wt,g),ne(l,t.domain,o),B(l,In,b),B(l,Wt,g),ne(A,t.domain,I),B(A,On,I),B(A,Ao,I),ne(V,t.domain,I),ne(V,e,I),B(V,On,I);const _=[[So,wo],[lc,cc],[uc,dc],[hc,fc],[pc,mc],[gc,bc],[yc,Ec],[kc,Tc]];for(let U=0;U<_.length;U++){const[q,J]=_[U],ee=B(I,q);B(M,q,ee);const K=qt(Za);ne(ee,e,K);const Me=qt();ne(ee,n,Me),B(ee,J,I),ne(K,e,K),ne(K,n,Me),ne(Me,e,K),ne(Me,n,Me),B(K,J,I),B(Me,J,I)}return B(i,na,y),B(i,um,c7),{start:i,tokens:pw}}function d7(t,e,n){let r=n.length,i=0,s=[],o=[];for(;i<r;){let a=t,l=null,c=null,u=0,d=null,h=-1;for(;i<r&&!(l=a.go(n[i].t));)o.push(n[i++]);for(;i<r&&(c=l||a.go(n[i].t));)l=null,a=c,a.accepts()?(h=0,d=a):h>=0&&h++,i++,u++;if(h<0)i-=u,i<r&&(o.push(n[i]),i++);else{o.length>0&&(s.push(Hd(u1,e,o)),o=[]),i-=h,u-=h;const f=d.t,p=n.slice(i-u,i);s.push(Hd(f,e,p))}}return o.length>0&&s.push(Hd(u1,e,o)),s}function Hd(t,e,n){const r=n[0].s,i=n[n.length-1].e,s=e.slice(r,i);return new t(s,n)}const h7=typeof console<"u"&&console&&console.warn||(()=>{}),f7="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ne={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function p7(){return _t.groups={},Ne.scanner=null,Ne.parser=null,Ne.tokenQueue=[],Ne.pluginQueue=[],Ne.customSchemes=[],Ne.initialized=!1,Ne}function d1(t,e=!1){if(Ne.initialized&&h7(`linkifyjs: already initialized - will not register custom scheme "${t}" ${f7}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
155
|
-
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
156
|
-
2. Cannot start or end with "-"
|
|
157
|
-
3. "-" cannot repeat`);Ne.customSchemes.push([t,e])}function m7(){Ne.scanner=o7(Ne.customSchemes);for(let t=0;t<Ne.tokenQueue.length;t++)Ne.tokenQueue[t][1]({scanner:Ne.scanner});Ne.parser=u7(Ne.scanner.tokens);for(let t=0;t<Ne.pluginQueue.length;t++)Ne.pluginQueue[t][1]({scanner:Ne.scanner,parser:Ne.parser});return Ne.initialized=!0,Ne}function gm(t){return Ne.initialized||m7(),d7(Ne.parser.start,t,mw(Ne.scanner.start,t))}gm.scan=mw;function bw(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new mm(n),i=gm(t),s=[];for(let o=0;o<i.length;o++){const a=i[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&s.push(a.toFormattedObject(r))}return s}var bm="[\0- -\u2029 ]",g7=new RegExp(bm),b7=new RegExp(`${bm}$`),y7=new RegExp(bm,"g");function E7(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function k7(t){return new re({key:new me("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,a=Wc(n.doc,[...e]);if(zf(a).forEach(({newRange:c})=>{const u=mE(r.doc,c,f=>f.isTextblock);let d,h;if(u.length>1)d=u[0],h=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const f=r.doc.textBetween(c.from,c.to," "," ");if(!b7.test(f))return;d=u[0],h=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&h){const f=h.split(g7).filter(Boolean);if(f.length<=0)return!1;const p=f[f.length-1],g=d.pos+h.lastIndexOf(p);if(!p)return!1;const b=gm(p).map(y=>y.toObject(t.defaultProtocol));if(!E7(b))return!1;b.filter(y=>y.isLink).map(y=>({...y,from:g+y.start+1,to:g+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>t.validate(y.value)).filter(y=>t.shouldAutoLink(y.value)).forEach(y=>{Vf(y.from,y.to,r.doc).some(C=>C.mark.type===t.type)||o.addMark(y.from,y.to,t.type.create({href:y.href}))})}}),!!o.steps.length)return o}})}function T7(t){return new re({key:new me("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const l=r.target;if(!l)return!1;const c=t.editor.view.dom;o=l.closest("a"),o&&!c.contains(o)&&(o=null)}if(!o)return!1;let a=!1;if(t.enableClickSelection&&(a=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const l=TE(e.state,t.type.name),c=(i=o.href)!=null?i:l.href,u=(s=o.target)!=null?s:l.target;c&&(window.open(c,u),a=!0)}return a}}})}function C7(t){return new re({key:new me("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:i}=t,{state:s}=e,{selection:o}=s,{empty:a}=o;if(a)return!1;let l="";r.content.forEach(u=>{l+=u.textContent});const c=bw(l,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===l);return!l||!c||i!==void 0&&!i(c.value)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function Qr(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(y7,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var S7=Tn.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(t=>{if(typeof t=="string"){d1(t);return}d1(t.scheme,t.optionalSlashes)})},onDestroy(){p7()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Qr(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const i=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.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:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Qr(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Qr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",sn(this.options.HTMLAttributes,t),0]:["a",sn(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,i,s;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",a=(s=(i=t.attrs)==null?void 0:i.title)!=null?s:"",l=e.renderChildren(t);return a?`[${l}](${o} "${a}")`:`[${l}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Qr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!Qr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[bi({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=bw(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!Qr(o,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(s=>{this.options.shouldAutoLink(s.value)&&e.push({text:s.value,data:{href:s.href},index:s.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(k7({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Qr(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(T7({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(C7({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),w7=Cn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""});const h1=new me("blocknote-show-selection"),x7=pe(({editor:t})=>{const e=Mi({enabledSet:new Set},{onUpdate(){t.transact(n=>n.setMeta(h1,{}))}});return{key:"showSelection",store:e,prosemirrorPlugins:[new re({key:h1,props:{decorations:n=>{const{doc:r,selection:i}=n;if(e.state.enabledSet.size===0)return ue.empty;const s=Ee.inline(i.from,i.to,{"data-show-selection":"true"});return ue.create(r,[s])}}})],showSelection(n,r){e.setState({enabledSet:n?new Set([...e.state.enabledSet,r]):new Set([...e.state.enabledSet].filter(i=>i!==r))})}}}),A7={tokenize:_7};function _7(t){const e=t.attempt(this.parser.constructs.contentInitial,r,i);let n;return e;function r(a){if(a===null){t.consume(a);return}return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),de(t,e,"linePrefix")}function i(a){return t.enter("paragraph"),s(a)}function s(a){const l=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(a);return}return G(a)?(t.consume(a),t.exit("chunkText"),s):(t.consume(a),o)}}const N7={tokenize:I7},f1={tokenize:O7};function I7(t){const e=this,n=[];let r=0,i,s,o;return a;function a(S){if(r<n.length){const I=n[r];return e.containerState=I[1],t.attempt(I[0].continuation,l,c)(S)}return c(S)}function l(S){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&C();const I=e.events.length;let M=I,A;for(;M--;)if(e.events[M][0]==="exit"&&e.events[M][1].type==="chunkFlow"){A=e.events[M][1].end;break}y(r);let D=I;for(;D<e.events.length;)e.events[D][1].end={...A},D++;return $t(e.events,M+1,0,e.events.slice(I)),e.events.length=D,c(S)}return a(S)}function c(S){if(r===n.length){if(!i)return h(S);if(i.currentConstruct&&i.currentConstruct.concrete)return p(S);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(f1,u,d)(S)}function u(S){return i&&C(),y(r),h(S)}function d(S){return e.parser.lazy[e.now().line]=r!==n.length,o=e.now().offset,p(S)}function h(S){return e.containerState={},t.attempt(f1,f,p)(S)}function f(S){return r++,n.push([e.currentConstruct,e.containerState]),h(S)}function p(S){if(S===null){i&&C(),y(0),t.consume(S);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),g(S)}function g(S){if(S===null){b(t.exit("chunkFlow"),!0),y(0),t.consume(S);return}return G(S)?(t.consume(S),b(t.exit("chunkFlow")),r=0,e.interrupt=void 0,a):(t.consume(S),g)}function b(S,I){const M=e.sliceStream(S);if(I&&M.push(null),S.previous=s,s&&(s.next=S),s=S,i.defineSkip(S.start),i.write(M),e.parser.lazy[S.start.line]){let A=i.events.length;for(;A--;)if(i.events[A][1].start.offset<o&&(!i.events[A][1].end||i.events[A][1].end.offset>o))return;const D=e.events.length;let z=D,V,_;for(;z--;)if(e.events[z][0]==="exit"&&e.events[z][1].type==="chunkFlow"){if(V){_=e.events[z][1].end;break}V=!0}for(y(r),A=D;A<e.events.length;)e.events[A][1].end={..._},A++;$t(e.events,z+1,0,e.events.slice(D)),e.events.length=A}}function y(S){let I=n.length;for(;I-- >S;){const M=n[I];e.containerState=M[1],M[0].exit.call(e,t)}n.length=S}function C(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function O7(t,e,n){return de(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}const M7={tokenize:v7};function v7(t){const e=this,n=t.attempt(Ca,r,t.attempt(this.parser.constructs.flowInitial,i,de(t,t.attempt(this.parser.constructs.flow,i,t.attempt(u9,i)),"linePrefix")));return n;function r(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const D7={resolveAll:Ew()},L7=yw("string"),R7=yw("text");function yw(t){return{resolveAll:Ew(t==="text"?P7:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],s=n.attempt(i,o,a);return o;function o(u){return c(u)?s(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),s(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const d=i[u];let h=-1;if(d)for(;++h<d.length;){const f=d[h];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function Ew(t){return e;function e(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return t?t(n,r):n}}function P7(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const r=t[n-1][1],i=e.sliceStream(r);let s=i.length,o=-1,a=0,l;for(;s--;){const c=i[s];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)l=!0,a++;else if(c!==-1){s++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(a=0),a){const c={type:n===t.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(t.splice(n,0,["enter",c,e],["exit",c,e]),n+=2)}n++}return t}const B7={42:wt,43:wt,45:wt,48:wt,49:wt,50:wt,51:wt,52:wt,53:wt,54:wt,55:wt,56:wt,57:wt,62:HS},F7={91:m9},H7={[-2]:_d,[-1]:_d,32:_d},U7={35:T9,42:El,45:[zb,El],60:x9,61:zb,95:El,96:Ub,126:Ub},$7={38:$S,92:US},z7={[-5]:Nd,[-4]:Nd,[-3]:Nd,33:V9,38:$S,42:Qh,60:[qF,v9],91:q9,92:[E9,US],93:sm,95:Qh,96:i9},V7={null:[Qh,D7]},j7={null:[42,95]},q7={null:[]},W7=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:j7,contentInitial:F7,disable:q7,document:B7,flow:U7,flowInitial:H7,insideSpan:V7,string:$7,text:z7},Symbol.toStringTag,{value:"Module"}));function Y7(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let o=[],a=[];const l={attempt:D(M),check:D(A),consume:C,enter:S,exit:I,interrupt:D(A,{interrupt:!0})},c={code:null,containerState:{},defineSkip:g,events:[],now:p,parser:t,previous:null,sliceSerialize:h,sliceStream:f,write:d};let u=e.tokenize.call(c,l);return e.resolveAll&&s.push(e),c;function d(U){return o=Gt(o,U),b(),o[o.length-1]!==null?[]:(z(e,0),c.events=_u(s,c.events,c),c.events)}function h(U,q){return G7(f(U),q)}function f(U){return K7(o,U)}function p(){const{_bufferIndex:U,_index:q,line:J,column:ee,offset:K}=r;return{_bufferIndex:U,_index:q,line:J,column:ee,offset:K}}function g(U){i[U.line]=U.column,_()}function b(){let U;for(;r._index<o.length;){const q=o[r._index];if(typeof q=="string")for(U=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===U&&r._bufferIndex<q.length;)y(q.charCodeAt(r._bufferIndex));else y(q)}}function y(U){u=u(U)}function C(U){G(U)?(r.line++,r.column=1,r.offset+=U===-3?2:1,_()):U!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=U}function S(U,q){const J=q||{};return J.type=U,J.start=p(),c.events.push(["enter",J,c]),a.push(J),J}function I(U){const q=a.pop();return q.end=p(),c.events.push(["exit",q,c]),q}function M(U,q){z(U,q.from)}function A(U,q){q.restore()}function D(U,q){return J;function J(ee,K,Me){let et,an,zn,w;return Array.isArray(ee)?Vn(ee):"tokenize"in ee?Vn([ee]):ln(ee);function ln(tt){return Us;function Us(ur){const Pi=ur!==null&&tt[ur],Bi=ur!==null&&tt.null,Sa=[...Array.isArray(Pi)?Pi:Pi?[Pi]:[],...Array.isArray(Bi)?Bi:Bi?[Bi]:[]];return Vn(Sa)(ur)}}function Vn(tt){return et=tt,an=0,tt.length===0?Me:x(tt[an])}function x(tt){return Us;function Us(ur){return w=V(),zn=tt,tt.partial||(c.currentConstruct=tt),tt.name&&c.parser.constructs.disable.null.includes(tt.name)?qr():tt.tokenize.call(q?Object.assign(Object.create(c),q):c,l,cn,qr)(ur)}}function cn(tt){return U(zn,w),K}function qr(tt){return w.restore(),++an<et.length?x(et[an]):Me}}}function z(U,q){U.resolveAll&&!s.includes(U)&&s.push(U),U.resolve&&$t(c.events,q,c.events.length-q,U.resolve(c.events.slice(q),c)),U.resolveTo&&(c.events=U.resolveTo(c.events,c))}function V(){const U=p(),q=c.previous,J=c.currentConstruct,ee=c.events.length,K=Array.from(a);return{from:ee,restore:Me};function Me(){r=U,c.previous=q,c.currentConstruct=J,c.events.length=ee,a=K,_()}}function _(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function K7(t,e){const n=e.start._index,r=e.start._bufferIndex,i=e.end._index,s=e.end._bufferIndex;let o;if(n===i)o=[t[n].slice(r,s)];else{if(o=t.slice(n,i),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}s>0&&o.push(t[i].slice(0,s))}return o}function G7(t,e){let n=-1;const r=[];let i;for(;++n<t.length;){const s=t[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
|
|
158
|
-
`;break}case-3:{o=`\r
|
|
159
|
-
`;break}case-2:{o=e?" ":" ";break}case-1:{if(!e&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function Q7(t){const r={constructs:OS([W7,...(t||{}).extensions||[]]),content:i(A7),defined:[],document:i(N7),flow:i(M7),lazy:{},string:i(L7),text:i(R7)};return r;function i(s){return o;function o(a){return Y7(r,s,a)}}}function J7(t){for(;!zS(t););return t}const p1=/[\0\t\n\r]/g;function X7(){let t=1,e="",n=!0,r;return i;function i(s,o,a){const l=[];let c,u,d,h,f;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),d=0,e="",n&&(s.charCodeAt(0)===65279&&d++,n=void 0);d<s.length;){if(p1.lastIndex=d,c=p1.exec(s),h=c&&c.index!==void 0?c.index:s.length,f=s.charCodeAt(h),!c){e=s.slice(d);break}if(f===10&&d===h&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<h&&(l.push(s.slice(d,h)),t+=h-d),f){case 0:{l.push(65533),t++;break}case 9:{for(u=Math.ceil(t/4)*4,l.push(-2);t++<u;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:r=!0,t=1}d=h+1}return a&&(r&&l.push(-5),e&&l.push(e),l.push(null)),l}}const kw={}.hasOwnProperty;function Z7(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),e$(n)(J7(Q7(n).document().write(X7()(t,e,!0))))}function e$(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Sm),autolinkProtocol:V,autolinkEmail:V,atxHeading:s(km),blockQuote:s(Bi),characterEscape:V,characterReference:V,codeFenced:s(Sa),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Sa,o),codeText:s(Vw,o),codeTextData:V,data:V,codeFlowValue:V,definition:s(jw),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(qw),hardBreakEscape:s(Tm),hardBreakTrailing:s(Tm),htmlFlow:s(Cm,o),htmlFlowData:V,htmlText:s(Cm,o),htmlTextData:V,image:s(Ww),label:o,link:s(Sm),listItem:s(Yw),listItemValue:h,listOrdered:s(wm,d),listUnordered:s(wm),paragraph:s(Kw),reference:x,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(km),strong:s(Gw),thematicBreak:s(Jw)},exit:{atxHeading:l(),atxHeadingSequence:M,autolink:l(),autolinkEmail:Pi,autolinkProtocol:ur,blockQuote:l(),characterEscapeValue:_,characterReferenceMarkerHexadecimal:qr,characterReferenceMarkerNumeric:qr,characterReferenceValue:tt,characterReference:Us,codeFenced:l(b),codeFencedFence:g,codeFencedFenceInfo:f,codeFencedFenceMeta:p,codeFlowValue:_,codeIndented:l(y),codeText:l(K),codeTextData:_,data:_,definition:l(),definitionDestinationString:I,definitionLabelString:C,definitionTitleString:S,emphasis:l(),hardBreakEscape:l(q),hardBreakTrailing:l(q),htmlFlow:l(J),htmlFlowData:_,htmlText:l(ee),htmlTextData:_,image:l(et),label:zn,labelText:an,lineEnding:U,link:l(Me),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:cn,resourceDestinationString:w,resourceTitleString:ln,resource:Vn,setextHeading:l(z),setextHeadingLineSequence:D,setextHeadingText:A,strong:l(),thematicBreak:l()}};Tw(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(L){let $={type:"root",children:[]};const X={stack:[$],tokenStack:[],config:e,enter:a,exit:c,buffer:o,resume:u,data:n},ce=[];let ke=-1;for(;++ke<L.length;)if(L[ke][1].type==="listOrdered"||L[ke][1].type==="listUnordered")if(L[ke][0]==="enter")ce.push(ke);else{const un=ce.pop();ke=i(L,un,ke)}for(ke=-1;++ke<L.length;){const un=e[L[ke][0]];kw.call(un,L[ke][1].type)&&un[L[ke][1].type].call(Object.assign({sliceSerialize:L[ke][2].sliceSerialize},X),L[ke][1])}if(X.tokenStack.length>0){const un=X.tokenStack[X.tokenStack.length-1];(un[1]||m1).call(X,void 0,un[0])}for($.position={start:fr(L.length>0?L[0][1].start:{line:1,column:1,offset:0}),end:fr(L.length>0?L[L.length-2][1].end:{line:1,column:1,offset:0})},ke=-1;++ke<e.transforms.length;)$=e.transforms[ke]($)||$;return $}function i(L,$,X){let ce=$-1,ke=-1,un=!1,Wr,jn,$s,zs;for(;++ce<=X;){const Lt=L[ce];switch(Lt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Lt[0]==="enter"?ke++:ke--,zs=void 0;break}case"lineEndingBlank":{Lt[0]==="enter"&&(Wr&&!zs&&!ke&&!$s&&($s=ce),zs=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:zs=void 0}if(!ke&&Lt[0]==="enter"&&Lt[1].type==="listItemPrefix"||ke===-1&&Lt[0]==="exit"&&(Lt[1].type==="listUnordered"||Lt[1].type==="listOrdered")){if(Wr){let Fi=ce;for(jn=void 0;Fi--;){const qn=L[Fi];if(qn[1].type==="lineEnding"||qn[1].type==="lineEndingBlank"){if(qn[0]==="exit")continue;jn&&(L[jn][1].type="lineEndingBlank",un=!0),qn[1].type="lineEnding",jn=Fi}else if(!(qn[1].type==="linePrefix"||qn[1].type==="blockQuotePrefix"||qn[1].type==="blockQuotePrefixWhitespace"||qn[1].type==="blockQuoteMarker"||qn[1].type==="listItemIndent"))break}$s&&(!jn||$s<jn)&&(Wr._spread=!0),Wr.end=Object.assign({},jn?L[jn][1].start:Lt[1].end),L.splice(jn||ce,0,["exit",Wr,Lt[2]]),ce++,X++}if(Lt[1].type==="listItemPrefix"){const Fi={type:"listItem",_spread:!1,start:Object.assign({},Lt[1].start),end:void 0};Wr=Fi,L.splice(ce,0,["enter",Fi,Lt[2]]),ce++,X++,$s=void 0,zs=!0}}}return L[$][1]._spread=un,X}function s(L,$){return X;function X(ce){a.call(this,L(ce),ce),$&&$.call(this,ce)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(L,$,X){this.stack[this.stack.length-1].children.push(L),this.stack.push(L),this.tokenStack.push([$,X||void 0]),L.position={start:fr($.start),end:void 0}}function l(L){return $;function $(X){L&&L.call(this,X),c.call(this,X)}}function c(L,$){const X=this.stack.pop(),ce=this.tokenStack.pop();if(ce)ce[0].type!==L.type&&($?$.call(this,L,ce[0]):(ce[1]||m1).call(this,L,ce[0]));else throw new Error("Cannot close `"+L.type+"` ("+Eo({start:L.start,end:L.end})+"): it’s not open");X.position.end=fr(L.end)}function u(){return wu(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function h(L){if(this.data.expectingFirstListItemValue){const $=this.stack[this.stack.length-2];$.start=Number.parseInt(this.sliceSerialize(L),10),this.data.expectingFirstListItemValue=void 0}}function f(){const L=this.resume(),$=this.stack[this.stack.length-1];$.lang=L}function p(){const L=this.resume(),$=this.stack[this.stack.length-1];$.meta=L}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const L=this.resume(),$=this.stack[this.stack.length-1];$.value=L.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const L=this.resume(),$=this.stack[this.stack.length-1];$.value=L.replace(/(\r?\n|\r)$/g,"")}function C(L){const $=this.resume(),X=this.stack[this.stack.length-1];X.label=$,X.identifier=gn(this.sliceSerialize(L)).toLowerCase()}function S(){const L=this.resume(),$=this.stack[this.stack.length-1];$.title=L}function I(){const L=this.resume(),$=this.stack[this.stack.length-1];$.url=L}function M(L){const $=this.stack[this.stack.length-1];if(!$.depth){const X=this.sliceSerialize(L).length;$.depth=X}}function A(){this.data.setextHeadingSlurpLineEnding=!0}function D(L){const $=this.stack[this.stack.length-1];$.depth=this.sliceSerialize(L).codePointAt(0)===61?1:2}function z(){this.data.setextHeadingSlurpLineEnding=void 0}function V(L){const X=this.stack[this.stack.length-1].children;let ce=X[X.length-1];(!ce||ce.type!=="text")&&(ce=Qw(),ce.position={start:fr(L.start),end:void 0},X.push(ce)),this.stack.push(ce)}function _(L){const $=this.stack.pop();$.value+=this.sliceSerialize(L),$.position.end=fr(L.end)}function U(L){const $=this.stack[this.stack.length-1];if(this.data.atHardBreak){const X=$.children[$.children.length-1];X.position.end=fr(L.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes($.type)&&(V.call(this,L),_.call(this,L))}function q(){this.data.atHardBreak=!0}function J(){const L=this.resume(),$=this.stack[this.stack.length-1];$.value=L}function ee(){const L=this.resume(),$=this.stack[this.stack.length-1];$.value=L}function K(){const L=this.resume(),$=this.stack[this.stack.length-1];$.value=L}function Me(){const L=this.stack[this.stack.length-1];if(this.data.inReference){const $=this.data.referenceType||"shortcut";L.type+="Reference",L.referenceType=$,delete L.url,delete L.title}else delete L.identifier,delete L.label;this.data.referenceType=void 0}function et(){const L=this.stack[this.stack.length-1];if(this.data.inReference){const $=this.data.referenceType||"shortcut";L.type+="Reference",L.referenceType=$,delete L.url,delete L.title}else delete L.identifier,delete L.label;this.data.referenceType=void 0}function an(L){const $=this.sliceSerialize(L),X=this.stack[this.stack.length-2];X.label=IS($),X.identifier=gn($).toLowerCase()}function zn(){const L=this.stack[this.stack.length-1],$=this.resume(),X=this.stack[this.stack.length-1];if(this.data.inReference=!0,X.type==="link"){const ce=L.children;X.children=ce}else X.alt=$}function w(){const L=this.resume(),$=this.stack[this.stack.length-1];$.url=L}function ln(){const L=this.resume(),$=this.stack[this.stack.length-1];$.title=L}function Vn(){this.data.inReference=void 0}function x(){this.data.referenceType="collapsed"}function cn(L){const $=this.resume(),X=this.stack[this.stack.length-1];X.label=$,X.identifier=gn(this.sliceSerialize(L)).toLowerCase(),this.data.referenceType="full"}function qr(L){this.data.characterReferenceType=L.type}function tt(L){const $=this.sliceSerialize(L),X=this.data.characterReferenceType;let ce;X?(ce=NS($,X==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ce=rm($);const ke=this.stack[this.stack.length-1];ke.value+=ce}function Us(L){const $=this.stack.pop();$.position.end=fr(L.end)}function ur(L){_.call(this,L);const $=this.stack[this.stack.length-1];$.url=this.sliceSerialize(L)}function Pi(L){_.call(this,L);const $=this.stack[this.stack.length-1];$.url="mailto:"+this.sliceSerialize(L)}function Bi(){return{type:"blockquote",children:[]}}function Sa(){return{type:"code",lang:null,meta:null,value:""}}function Vw(){return{type:"inlineCode",value:""}}function jw(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function qw(){return{type:"emphasis",children:[]}}function km(){return{type:"heading",depth:0,children:[]}}function Tm(){return{type:"break"}}function Cm(){return{type:"html",value:""}}function Ww(){return{type:"image",title:null,url:"",alt:null}}function Sm(){return{type:"link",title:null,url:"",children:[]}}function wm(L){return{type:"list",ordered:L.type==="listOrdered",start:null,spread:L._spread,children:[]}}function Yw(L){return{type:"listItem",spread:L._spread,checked:null,children:[]}}function Kw(){return{type:"paragraph",children:[]}}function Gw(){return{type:"strong",children:[]}}function Qw(){return{type:"text",value:""}}function Jw(){return{type:"thematicBreak"}}}function fr(t){return{line:t.line,column:t.column,offset:t.offset}}function Tw(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?Tw(t,r):t$(t,r)}}function t$(t,e){let n;for(n in e)if(kw.call(e,n))switch(n){case"canContainEols":{const r=e[n];r&&t[n].push(...r);break}case"transforms":{const r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{const r=e[n];r&&Object.assign(t[n],r);break}}}function m1(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Eo({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Eo({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Eo({start:e.start,end:e.end})+") is still open")}function n$(t){const e=this;e.parser=n;function n(r){return Z7(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function r$(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)}function i$(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
|
|
160
|
-
`}]}function s$(t,e){const n=e.value?e.value+`
|
|
161
|
-
`:"",r={},i=e.lang?e.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(s.data={meta:e.meta}),t.patch(e,s),s=t.applyData(e,s),s={type:"element",tagName:"pre",properties:{},children:[s]},t.patch(e,s),s}function o$(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function a$(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function l$(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),i=Hs(r.toLowerCase()),s=t.footnoteOrder.indexOf(r);let o,a=t.footnoteCounts.get(r);a===void 0?(a=0,t.footnoteOrder.push(r),o=t.footnoteOrder.length):o=s+1,a+=1,t.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};t.patch(e,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,c),t.applyData(e,c)}function c$(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function u$(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function Cw(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const i=t.all(e),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function d$(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return Cw(t,e);const i={src:Hs(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,s),t.applyData(e,s)}function h$(t,e){const n={src:Hs(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function f$(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function p$(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return Cw(t,e);const i={href:Hs(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)}function m$(t,e){const n={href:Hs(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function g$(t,e,n){const r=t.all(e),i=n?b$(n):Sw(e),s={},o=[];if(typeof e.checked=="boolean"){const u=r[0];let d;u&&u.type==="element"&&u.tagName==="p"?d=u:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const u=r[a];(i||a!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
|
|
162
|
-
`}),u.type==="element"&&u.tagName==="p"&&!i?o.push(...u.children):o.push(u)}const l=r[r.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
|
|
163
|
-
`});const c={type:"element",tagName:"li",properties:s,children:o};return t.patch(e,c),t.applyData(e,c)}function b$(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const n=t.children;let r=-1;for(;!e&&++r<n.length;)e=Sw(n[r])}return e}function Sw(t){const e=t.spread;return e??t.children.length>1}function y$(t,e){const n={},r=t.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++i<r.length;){const o=r[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(r,!0)};return t.patch(e,s),t.applyData(e,s)}function E$(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function k$(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function T$(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function C$(t,e){const n=t.all(e),r=n.shift(),i=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],o),i.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},a=YC(e.children[1]),l=WC(e.children[e.children.length-1]);a&&l&&(o.position={start:a,end:l}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,s),t.applyData(e,s)}function S$(t,e,n){const r=n?n.children:void 0,s=(r?r.indexOf(e):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:e.children.length;let l=-1;const c=[];for(;++l<a;){const d=e.children[l],h={},f=o?o[l]:void 0;f&&(h.align=f);let p={type:"element",tagName:s,properties:h,children:[]};d&&(p.children=t.all(d),t.patch(d,p),p=t.applyData(d,p)),c.push(p)}const u={type:"element",tagName:"tr",properties:{},children:t.wrap(c,!0)};return t.patch(e,u),t.applyData(e,u)}function w$(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const g1=9,b1=32;function x$(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),i=0;const s=[];for(;r;)s.push(y1(e.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return s.push(y1(e.slice(i),i>0,!1)),s.join("")}function y1(t,e,n){let r=0,i=t.length;if(e){let s=t.codePointAt(r);for(;s===g1||s===b1;)r++,s=t.codePointAt(r)}if(n){let s=t.codePointAt(i-1);for(;s===g1||s===b1;)i--,s=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function A$(t,e){const n={type:"text",value:x$(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function _$(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const uf={blockquote:r$,break:i$,code:s$,delete:o$,emphasis:a$,footnoteReference:l$,heading:c$,html:u$,imageReference:d$,image:h$,inlineCode:f$,linkReference:p$,link:m$,listItem:g$,list:y$,paragraph:E$,root:k$,strong:T$,table:C$,tableCell:w$,tableRow:S$,text:A$,thematicBreak:_$,toml:el,yaml:el,definition:el,footnoteDefinition:el};function el(){}function N$(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function I$(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function O$(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||N$,r=t.options.footnoteBackLabel||I$,i=t.options.footnoteLabel||"Footnotes",s=t.options.footnoteLabelTagName||"h2",o=t.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<t.footnoteOrder.length;){const c=t.footnoteById.get(t.footnoteOrder[l]);if(!c)continue;const u=t.all(c),d=String(c.identifier).toUpperCase(),h=Hs(d.toLowerCase());let f=0;const p=[],g=t.footnoteCounts.get(d);for(;g!==void 0&&++f<=g;){p.length>0&&p.push({type:"text",value:" "});let C=typeof n=="string"?n:n(l,f);typeof C=="string"&&(C={type:"text",value:C}),p.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+h+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,f),className:["data-footnote-backref"]},children:Array.isArray(C)?C:[C]})}const b=u[u.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const C=b.children[b.children.length-1];C&&C.type==="text"?C.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...p)}else u.push(...p);const y={type:"element",tagName:"li",properties:{id:e+"fn-"+h},children:t.wrap(u,!0)};t.patch(c,y),a.push(y)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...As(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
164
|
-
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(a,!0)},{type:"text",value:`
|
|
165
|
-
`}]}}const df={}.hasOwnProperty,M$={};function v$(t,e){const n=e||M$,r=new Map,i=new Map,s=new Map,o={...uf,...n.handlers},a={all:c,applyData:L$,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:l,options:n,patch:D$,wrap:P$};return Ai(t,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const d=u.type==="definition"?r:i,h=String(u.identifier).toUpperCase();d.has(h)||d.set(h,u)}}),a;function l(u,d){const h=u.type,f=a.handlers[h];if(df.call(a.handlers,h)&&f)return f(a,u,d);if(a.options.passThrough&&a.options.passThrough.includes(h)){if("children"in u){const{children:g,...b}=u,y=As(b);return y.children=a.all(u),y}return As(u)}return(a.options.unknownHandler||R$)(a,u,d)}function c(u){const d=[];if("children"in u){const h=u.children;let f=-1;for(;++f<h.length;){const p=a.one(h[f],u);if(p){if(f&&h[f-1].type==="break"&&(!Array.isArray(p)&&p.type==="text"&&(p.value=E1(p.value)),!Array.isArray(p)&&p.type==="element")){const g=p.children[0];g&&g.type==="text"&&(g.value=E1(g.value))}Array.isArray(p)?d.push(...p):d.push(p)}}}return d}}function D$(t,e){t.position&&(e.position=GC(t))}function L$(t,e){let n=e;if(t&&t.data){const r=t.data.hName,i=t.data.hChildren,s=t.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&s&&Object.assign(n.properties,As(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function R$(t,e){const n=e.data||{},r="value"in e&&!(df.call(n,"hProperties")||df.call(n,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function P$(t,e){const n=[];let r=-1;for(e&&n.push({type:"text",value:`
|
|
166
|
-
`});++r<t.length;)r&&n.push({type:"text",value:`
|
|
167
|
-
`}),n.push(t[r]);return e&&t.length>0&&n.push({type:"text",value:`
|
|
168
|
-
`}),n}function E1(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function k1(t,e){const n=v$(t,e),r=n.one(t,void 0),i=O$(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
|
|
169
|
-
`},i),s}function B$(t,e){return t&&"run"in t?async function(n,r){const i=k1(n,{file:r,...e});await t.run(i,r)}:function(n,r){return k1(n,{file:r,...t||e})}}const F$=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],H$=/["&'<>`]/g,U$=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,$$=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,z$=/[|\\{}()[\]^$+*?.]/g,T1=new WeakMap;function V$(t,e){if(t=t.replace(e.subset?j$(e.subset):H$,r),e.subset||e.escapeOnly)return t;return t.replace(U$,n).replace($$,r);function n(i,s,o){return e.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,o.charCodeAt(s+2),e)}function r(i,s,o){return e.format(i.charCodeAt(0),o.charCodeAt(s+1),e)}}function j$(t){let e=T1.get(t);return e||(e=q$(t),T1.set(t,e)),e}function q$(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(z$,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const W$=/[\dA-Fa-f]/;function Y$(t,e,n){const r="&#x"+t.toString(16).toUpperCase();return n&&e&&!W$.test(String.fromCharCode(e))?r:r+";"}const K$=/\d/;function G$(t,e,n){const r="&#"+String(t);return n&&e&&!K$.test(String.fromCharCode(e))?r:r+";"}const Q$=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],Ud={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},J$=["cent","copy","divide","gt","lt","not","para","times"],ww={}.hasOwnProperty,hf={};let tl;for(tl in Ud)ww.call(Ud,tl)&&(hf[Ud[tl]]=tl);const X$=/[^\dA-Za-z]/;function Z$(t,e,n,r){const i=String.fromCharCode(t);if(ww.call(hf,i)){const s=hf[i],o="&"+s;return n&&Q$.includes(s)&&!J$.includes(s)&&(!r||e&&e!==61&&X$.test(String.fromCharCode(e)))?o:o+";"}return""}function ez(t,e,n){let r=Y$(t,e,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=Z$(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){const s=G$(t,e,n.omitOptionalSemicolons);s.length<r.length&&(r=s)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function us(t,e){return V$(t,Object.assign({format:ez},e))}const tz=/^>|^->|<!--|-->|--!>|<!-$/g,nz=[">"],rz=["<",">"];function iz(t,e,n,r){return r.settings.bogusComments?"<?"+us(t.value,Object.assign({},r.settings.characterReferences,{subset:nz}))+">":"<!--"+t.value.replace(tz,i)+"-->";function i(s){return us(s,Object.assign({},r.settings.characterReferences,{subset:rz}))}}function sz(t,e,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const qe=Aw(1),xw=Aw(-1),oz=[];function Aw(t){return e;function e(n,r,i){const s=n?n.children:oz;let o=(r||0)+t,a=s[o];if(!i)for(;a&&ka(a);)o+=t,a=s[o];return a}}const az={}.hasOwnProperty;function _w(t){return e;function e(n,r,i){return az.call(t,n.tagName)&&t[n.tagName](n,r,i)}}const ym=_w({body:cz,caption:$d,colgroup:$d,dd:fz,dt:hz,head:$d,html:lz,li:dz,optgroup:pz,option:mz,p:uz,rp:C1,rt:C1,tbody:bz,td:S1,tfoot:yz,th:S1,thead:gz,tr:Ez});function $d(t,e,n){const r=qe(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&ka(r.value.charAt(0)))}function lz(t,e,n){const r=qe(n,e);return!r||r.type!=="comment"}function cz(t,e,n){const r=qe(n,e);return!r||r.type!=="comment"}function uz(t,e,n){const r=qe(n,e);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function dz(t,e,n){const r=qe(n,e);return!r||r.type==="element"&&r.tagName==="li"}function hz(t,e,n){const r=qe(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function fz(t,e,n){const r=qe(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function C1(t,e,n){const r=qe(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function pz(t,e,n){const r=qe(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function mz(t,e,n){const r=qe(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function gz(t,e,n){const r=qe(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function bz(t,e,n){const r=qe(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function yz(t,e,n){return!qe(n,e)}function Ez(t,e,n){const r=qe(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function S1(t,e,n){const r=qe(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const kz=_w({body:Sz,colgroup:wz,head:Cz,html:Tz,tbody:xz});function Tz(t){const e=qe(t,-1);return!e||e.type!=="comment"}function Cz(t){const e=new Set;for(const r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}const n=t.children[0];return!n||n.type==="element"}function Sz(t){const e=qe(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&ka(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function wz(t,e,n){const r=xw(n,e),i=qe(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&ym(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function xz(t,e,n){const r=xw(n,e),i=qe(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&ym(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}const nl={name:[[`
|
|
170
|
-
\f\r &/=>`.split(""),`
|
|
171
|
-
\f\r "&'/=>\``.split("")],[`\0
|
|
172
|
-
\f\r "&'/<=>`.split(""),`\0
|
|
173
|
-
\f\r "&'/<=>\``.split("")]],unquoted:[[`
|
|
174
|
-
\f\r &>`.split(""),`\0
|
|
175
|
-
\f\r "&'<=>\``.split("")],[`\0
|
|
176
|
-
\f\r "&'<=>\``.split(""),`\0
|
|
177
|
-
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function Az(t,e,n,r){const i=r.schema,s=i.space==="svg"?!1:r.settings.omitOptionalTags;let o=i.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const a=[];let l;i.space==="html"&&t.tagName==="svg"&&(r.schema=ba);const c=_z(r,t.properties),u=r.all(i.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=i,u&&(o=!1),(c||!s||!kz(t,e,n))&&(a.push("<",t.tagName,c?" "+c:""),o&&(i.space==="svg"||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(u),!o&&(!s||!ym(t,e,n))&&a.push("</"+t.tagName+">"),a.join("")}function _z(t,e){const n=[];let r=-1,i;if(e){for(i in e)if(e[i]!==null&&e[i]!==void 0){const s=Nz(t,i,e[i]);s&&n.push(s)}}for(;++r<n.length;){const s=t.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&s!=='"'&&s!=="'"&&(n[r]+=" ")}return n.join("")}function Nz(t,e,n){const r=Hp(t.schema,e),i=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,s=t.settings.allowDangerousCharacters?0:1;let o=t.quote,a;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const l=us(r.attribute,Object.assign({},t.settings.characterReferences,{subset:nl.name[i][s]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?zR:jR)(n,{padLeft:!t.settings.tightCommaSeparatedLists}):String(n),t.settings.collapseEmptyAttributes&&!n)?l:(t.settings.preferUnquoted&&(a=us(n,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:nl.unquoted[i][s]}))),a!==n&&(t.settings.quoteSmart&&sc(n,o)>sc(n,t.alternative)&&(o=t.alternative),a=o+us(n,Object.assign({},t.settings.characterReferences,{subset:(o==="'"?nl.single:nl.double)[i][s],attribute:!0}))+o),l+(a&&"="+a))}const Iz=["<","&"];function Nw(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:us(t.value,Object.assign({},r.settings.characterReferences,{subset:Iz}))}function Oz(t,e,n,r){return r.settings.allowDangerousHtml?t.value:Nw(t,e,n,r)}function Mz(t,e,n,r){return r.all(t)}const vz=pS("type",{invalid:Dz,unknown:Lz,handlers:{comment:iz,doctype:sz,element:Az,raw:Oz,root:Mz,text:Nw}});function Dz(t){throw new Error("Expected node, not `"+t+"`")}function Lz(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const Rz={},Pz={},Bz=[];function Fz(t,e){const n=e||Rz,r=n.quote||'"',i=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Hz,all:Uz,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||F$,characterReferences:n.characterReferences||Pz,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?ba:gu,quote:r,alternative:i}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function Hz(t,e,n){return vz(t,e,n,this)}function Uz(t){const e=[],n=t&&t.children||Bz;let r=-1;for(;++r<n.length;)e[r]=this.one(n[r],r,t);return e.join("")}function $z(t){const e=this,n={...e.data("settings"),...t};e.compiler=r;function r(i){return Fz(i,n)}}var zz=Object.defineProperty,Vz=(t,e,n)=>e in t?zz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,he=(t,e,n)=>Vz(t,typeof e!="symbol"?e+"":e,n);function qj(t,e){const n=[{tag:`[data-inline-content-type="${t.type}"]`,contentElement:r=>{const i=r;return i.matches("[data-editable]")?i:i.querySelector("[data-editable]")||i}}];return e&&n.push({tag:"*",getAttrs(r){if(typeof r=="string")return!1;const i=e?.(r);return i===void 0?!1:i}}),n}function jz(t,e,n,r="before"){const i=typeof n=="string"?n:n.id,s=He(t),o=e.map(c=>Ii(c,s)),a=Vt(i,t.doc);if(!a)throw new Error(`Block with ID ${i} not found`);let l=a.posBeforeNode;return r==="after"&&(l+=a.node.nodeSize),t.step(new Re(l,l,new F(v.from(o),0,0))),o.map(c=>ve(c,s))}function ff(t){if(!t||t.type.name!=="column")throw new Error("Invalid columnPos: does not point to column node.");const e=t.firstChild;if(!e)throw new Error("Invalid column: does not have child node.");const n=e.firstChild;if(!n)throw new Error("Invalid blockContainer: does not have child node.");return t.childCount===1&&e.childCount===1&&n.type.name==="paragraph"&&n.content.content.length===0}function qz(t,e){const n=t.doc.resolve(e),r=n.nodeAfter;if(!r||r.type.name!=="columnList")throw new Error("Invalid columnListPos: does not point to columnList node.");for(let i=r.childCount-1;i>=0;i--){const s=t.doc.resolve(n.pos+1).posAtIndex(i),o=t.doc.resolve(s).nodeAfter;if(!o||o.type.name!=="column")throw new Error("Invalid columnPos: does not point to column node.");ff(o)&&t.delete(s,s+o.nodeSize)}}function pf(t,e){qz(t,e);const n=t.doc.resolve(e).nodeAfter;if(!n||n.type.name!=="columnList")throw new Error("Invalid columnListPos: does not point to columnList node.");if(n.childCount>2)return;if(n.childCount<2)throw new Error("Invalid columnList: contains fewer than two children.");const r=e+1,i=t.doc.resolve(r).nodeAfter,s=e+n.nodeSize-1,o=t.doc.resolve(s).nodeBefore;if(!i||!o)throw new Error("Invalid columnList: does not contain children.");const a=ff(i),l=ff(o);if(a&&l){t.delete(e,e+n.nodeSize);return}if(a){t.step(new Fe(e,e+n.nodeSize,s-o.nodeSize+1,s-1,F.empty,0,!1));return}if(l){t.step(new Fe(e,e+n.nodeSize,r+1,r+i.nodeSize-1,F.empty,0,!1));return}}function w1(t,e,n){const r=He(t),i=n.map(u=>Ii(u,r)),s=new Set(e.map(u=>typeof u=="string"?u:u.id)),o=[],a=new Set,l=typeof e[0]=="string"?e[0]:e[0].id;let c=0;if(t.doc.descendants((u,d)=>{if(s.size===0)return!1;if(!u.type.isInGroup("bnBlock")||!s.has(u.attrs.id))return!0;if(o.push(ve(u,r)),s.delete(u.attrs.id),n.length>0&&u.attrs.id===l){const g=t.doc.nodeSize;t.insert(d,i);const b=t.doc.nodeSize;c+=g-b}const h=t.doc.nodeSize,f=t.doc.resolve(d-c);f.node().type.name==="column"?a.add(f.before(-1)):f.node().type.name==="columnList"&&a.add(f.before()),f.node().type.name==="blockGroup"&&f.node(f.depth-1).type.name!=="doc"&&f.node().childCount===1?t.delete(f.before(),f.after()):t.delete(d-c,d-c+u.nodeSize);const p=t.doc.nodeSize;return c+=h-p,!1}),s.size>0){const u=[...s].join(`
|
|
178
|
-
`);throw Error("Blocks with the following IDs could not be found in the editor: "+u)}return a.forEach(u=>pf(t,u)),{insertedBlocks:i.map(u=>ve(u,r)),removedBlocks:o}}function Wz(t,e,n,r,i){let s;if(e)if(typeof e=="string")s=bn([e],t.pmSchema,r);else if(Array.isArray(e))s=bn(e,t.pmSchema,r);else if(e.type==="tableContent")s=Xc(e,t.pmSchema);else throw new Pn(e.type);else throw new Error("blockContent is required");const o=(i?.document??document).createDocumentFragment();for(const a of s)if(a.type.name!=="text"&&t.schema.inlineContentSchema[a.type.name]){const l=t.schema.inlineContentSpecs[a.type.name].implementation;if(l){const c=Zf(a,t.schema.inlineContentSchema,t.schema.styleSchema),u=l.render.call({renderType:"dom",props:void 0},c,()=>{},t);if(u){if(o.appendChild(u.dom),u.contentDOM){const d=n.serializeFragment(a.content,i);u.contentDOM.dataset.editable="",u.contentDOM.appendChild(d)}continue}}}else if(a.type.name==="text"){let l=document.createTextNode(a.textContent);for(const c of a.marks.toReversed())if(c.type.name in t.schema.styleSpecs){const u=t.schema.styleSpecs[c.type.name].implementation.render(c.attrs.stringValue,t);u.contentDOM.appendChild(l),l=u.dom}else{const u=c.type.spec.toDOM(c,!0),d=zt.renderSpec(document,u);d.contentDOM.appendChild(l),l=d.dom}o.appendChild(l)}else{const l=n.serializeFragment(v.from([a]),i);o.appendChild(l)}return o}function Yz(t,e,n,r){var i,s,o,a,l;const c=t.pmSchema.nodes.blockContainer,u=e.props||{};for(const[p,g]of Object.entries(t.schema.blockSchema[e.type].propSchema))!(p in u)&&g.default!==void 0&&(u[p]=g.default);const d=e.children||[],h=t.blockImplementations[e.type].implementation.render.call({renderType:"dom",props:void 0},{...e,props:u,children:d},t);if(h.contentDOM&&e.content){const p=Wz(t,e.content,n,e.type,r);h.contentDOM.appendChild(p)}if(t.pmSchema.nodes[e.type].isInGroup("bnBlock")){if(e.children&&e.children.length>0){const p=Iw(t,e.children,n,r);(i=h.contentDOM)==null||i.append(p)}return h.dom}const f=(o=(s=c.spec)==null?void 0:s.toDOM)==null?void 0:o.call(s,c.create({id:e.id,...u}));return(a=f.contentDOM)==null||a.appendChild(h.dom),e.children&&e.children.length>0&&((l=f.contentDOM)==null||l.appendChild(Ow(t,e.children,n,r))),f.dom}function Iw(t,e,n,r){const i=(r?.document??document).createDocumentFragment();for(const s of e){const o=Yz(t,s,n,r);i.appendChild(o)}return i}const Ow=(t,e,n,r)=>{var i;const s=t.pmSchema.nodes.blockGroup,o=s.spec.toDOM(s.create({})),a=Iw(t,e,n,r);return(i=o.contentDOM)==null||i.appendChild(a),o.dom},Kz=t=>(t.querySelectorAll('[data-content-type="numberedListItem"]').forEach(e=>{var n,r;const i=(r=(n=e.closest(".bn-block-outer"))==null?void 0:n.previousElementSibling)==null?void 0:r.querySelector('[data-content-type="numberedListItem"]');if(!i)e.setAttribute("data-index",e.getAttribute("data-start")||"1");else{const s=i.getAttribute("data-index");e.setAttribute("data-index",(parseInt(s||"0")+1).toString())}}),t),Gz=t=>(t.querySelectorAll('[data-content-type="checkListItem"] input').forEach(e=>{e.disabled=!0}),t),Qz=t=>(t.querySelectorAll('.bn-toggle-wrapper[data-show-children="false"]').forEach(e=>{e.setAttribute("data-show-children","true")}),t),Jz=t=>(t.querySelectorAll('[data-content-type="table"] table').forEach(e=>{e.setAttribute("style",`--default-cell-min-width: ${Pp}px;`),e.setAttribute("data-show-children","true")}),t),Xz=t=>(t.querySelectorAll('[data-content-type="table"] table').forEach(e=>{var n;const r=document.createElement("div");r.className="tableWrapper";const i=document.createElement("div");i.className="tableWrapper-inner",r.appendChild(i),(n=e.parentElement)==null||n.appendChild(r),r.appendChild(e)}),t),Zz=t=>(t.querySelectorAll(".bn-inline-content:empty").forEach(e=>{const n=document.createElement("span");n.className="ProseMirror-trailingBreak",n.setAttribute("style","display: inline-block;"),e.appendChild(n)}),t),eV=(t,e)=>{const n=zt.fromSchema(t),r=[Kz,Gz,Qz,Jz,Xz,Zz];return{serializeBlocks:(i,s)=>{let o=Ow(e,i,n,s);for(const a of r)o=a(o);return o.outerHTML}}};function tV(t){return t.transact(e=>{const n=Lr(e.doc,e.selection.anchor);if(e.selection instanceof be)return{type:"cell",anchorBlockId:n.node.attrs.id,anchorCellOffset:e.selection.$anchorCell.pos-n.posBeforeNode,headCellOffset:e.selection.$headCell.pos-n.posBeforeNode};if(e.selection instanceof W)return{type:"node",anchorBlockId:n.node.attrs.id};{const r=Lr(e.doc,e.selection.head);return{type:"text",anchorBlockId:n.node.attrs.id,headBlockId:r.node.attrs.id,anchorOffset:e.selection.anchor-n.posBeforeNode,headOffset:e.selection.head-r.posBeforeNode}}})}function nV(t,e){var n,r;const i=(n=Vt(e.anchorBlockId,t.doc))==null?void 0:n.posBeforeNode;if(i===void 0)throw new Error(`Could not find block with ID ${e.anchorBlockId} to update selection`);let s;if(e.type==="cell")s=be.create(t.doc,i+e.anchorCellOffset,i+e.headCellOffset);else if(e.type==="node")s=W.create(t.doc,i+1);else{const o=(r=Vt(e.headBlockId,t.doc))==null?void 0:r.posBeforeNode;if(o===void 0)throw new Error(`Could not find block with ID ${e.headBlockId} to update selection`);s=j.create(t.doc,i+e.anchorOffset,o+e.headOffset)}t.setSelection(s)}function mf(t){return t.map(e=>e.type==="columnList"?e.children.map(n=>mf(n.children)).flat():{...e,children:mf(e.children)}).flat()}function Mw(t,e,n){t.transact(r=>{var i;const s=((i=t.getSelection())==null?void 0:i.blocks)||[t.getTextCursorPosition().block],o=tV(t);t.removeBlocks(s),t.insertBlocks(mf(s),e,n),nV(r,o)})}function vw(t){return!t||t.type!=="columnList"}function Dw(t,e,n){let r,i;if(e?e.children.length>0?(r=e.children[e.children.length-1],i="after"):(r=e,i="before"):n&&(r=n,i="before"),!r||!i)return;const s=t.getParentBlock(r);return vw(s)?{referenceBlock:r,placement:i}:Dw(t,i==="after"?r:t.getPrevBlock(r),s)}function Lw(t,e,n){let r,i;if(e?e.children.length>0?(r=e.children[0],i="before"):(r=e,i="after"):n&&(r=n,i="after"),!r||!i)return;const s=t.getParentBlock(r);return vw(s)?{referenceBlock:r,placement:i}:Lw(t,i==="before"?r:t.getNextBlock(r),s)}function rV(t){t.transact(()=>{const e=t.getSelection(),n=e?.blocks[0]||t.getTextCursorPosition().block,r=Dw(t,t.getPrevBlock(n),t.getParentBlock(n));r&&Mw(t,r.referenceBlock,r.placement)})}function iV(t){t.transact(()=>{const e=t.getSelection(),n=e?.blocks[e?.blocks.length-1]||t.getTextCursorPosition().block,r=Lw(t,t.getNextBlock(n),t.getParentBlock(n));r&&Mw(t,r.referenceBlock,r.placement)})}function sV(t,e,n){const{$from:r,$to:i}=t.selection,s=r.blockRange(i,f=>f.childCount>0&&(f.type.name==="blockGroup"||f.type.name==="column"));if(!s)return!1;const o=s.startIndex;if(o===0)return!1;const a=s.parent.child(o-1);if(a.type!==e)return!1;const l=a.lastChild&&a.lastChild.type===n,c=v.from(l?e.create():null),u=new F(v.from(e.create(null,v.from(n.create(null,c)))),l?3:1,0),d=s.start,h=s.end;return t.step(new Fe(d-(l?3:1),h,d,h,u,1,!0)).scrollIntoView(),!0}function Rw(t){return t.transact(e=>sV(e,t.pmSchema.nodes.blockContainer,t.pmSchema.nodes.blockGroup))}function oV(t){t._tiptapEditor.commands.liftListItem("blockContainer")}function aV(t){return t.transact(e=>{const{bnBlock:n}=aa(e);return e.doc.resolve(n.beforePos).nodeBefore!==null})}function lV(t){return t.transact(e=>{const{bnBlock:n}=aa(e);return e.doc.resolve(n.beforePos).depth>1})}function cV(t,e){const n=typeof e=="string"?e:e.id,r=He(t),i=Vt(n,t);if(i)return ve(i.node,r)}function uV(t,e){const n=typeof e=="string"?e:e.id,r=Vt(n,t),i=He(t);if(!r)return;const s=t.resolve(r.posBeforeNode).nodeBefore;if(s)return ve(s,i)}function dV(t,e){const n=typeof e=="string"?e:e.id,r=Vt(n,t),i=He(t);if(!r)return;const s=t.resolve(r.posBeforeNode+r.node.nodeSize).nodeAfter;if(s)return ve(s,i)}function hV(t,e){const n=typeof e=="string"?e:e.id,r=He(t),i=Vt(n,t);if(!i)return;const s=t.resolve(i.posBeforeNode),o=s.node(),a=s.node(-1),l=a.type.name!=="doc"?o.type.name==="blockGroup"?a:o:void 0;if(l)return ve(l,r)}class fV{constructor(e){this.editor=e}get document(){return this.editor.transact(e=>oI(e.doc,this.editor.pmSchema))}getBlock(e){return this.editor.transact(n=>cV(n.doc,e))}getPrevBlock(e){return this.editor.transact(n=>uV(n.doc,e))}getNextBlock(e){return this.editor.transact(n=>dV(n.doc,e))}getParentBlock(e){return this.editor.transact(n=>hV(n.doc,e))}forEachBlock(e,n=!1){const r=this.document.slice();n&&r.reverse();function i(s){for(const o of s){if(e(o)===!1)return!1;const a=n?o.children.slice().reverse():o.children;if(!i(a))return!1}return!0}i(r)}insertBlocks(e,n,r="before"){return this.editor.transact(i=>jz(i,e,n,r))}updateBlock(e,n){return this.editor.transact(r=>lL(r,e,n))}removeBlocks(e){return this.editor.transact(n=>w1(n,e,[]).removedBlocks)}replaceBlocks(e,n){return this.editor.transact(r=>w1(r,e,n))}canNestBlock(){return aV(this.editor)}nestBlock(){Rw(this.editor)}canUnnestBlock(){return lV(this.editor)}unnestBlock(){oV(this.editor)}moveBlocksUp(){return rV(this.editor)}moveBlocksDown(){return iV(this.editor)}}class pV extends aw{constructor(e){super(),this.editor=e,e.on("create",()=>{e._tiptapEditor.on("update",({transaction:n,appendedTransactions:r})=>{this.emit("onChange",{editor:e,transaction:n,appendedTransactions:r})}),e._tiptapEditor.on("selectionUpdate",({transaction:n})=>{this.emit("onSelectionChange",{editor:e,transaction:n})}),e._tiptapEditor.on("mount",()=>{this.emit("onMount",{editor:e})}),e._tiptapEditor.on("unmount",()=>{this.emit("onUnmount",{editor:e})})})}onChange(e,n=!0){const r=({transaction:i,appendedTransactions:s})=>{!n&&x1(i)||e(this.editor,{getChanges(){return ZS(i,s)}})};return this.on("onChange",r),()=>{this.off("onChange",r)}}onSelectionChange(e,n=!1){const r=i=>{!n&&x1(i.transaction)||e(this.editor)};return this.on("onSelectionChange",r),()=>{this.off("onSelectionChange",r)}}onMount(e){return this.on("onMount",e),()=>{this.off("onMount",e)}}onUnmount(e){return this.on("onUnmount",e),()=>{this.off("onUnmount",e)}}}function x1(t){return!!t.getMeta("y-sync$")}function mV(t){return Array.prototype.indexOf.call(t.parentElement.childNodes,t)}function gV(t){return t.nodeType===3&&!/\S/.test(t.nodeValue||"")}function bV(t){t.querySelectorAll("li > ul, li > ol").forEach(e=>{const n=mV(e),r=e.parentElement,i=Array.from(r.childNodes).slice(n+1);e.remove(),i.forEach(s=>{s.remove()}),r.insertAdjacentElement("afterend",e),i.reverse().forEach(s=>{if(gV(s))return;const o=document.createElement("li");o.append(s),e.insertAdjacentElement("afterend",o)}),r.childNodes.length===0&&r.remove()})}function yV(t){t.querySelectorAll("li + ul, li + ol").forEach(e=>{var n,r;const i=e.previousElementSibling,s=document.createElement("div");i.insertAdjacentElement("afterend",s),s.append(i);const o=document.createElement("div");for(o.setAttribute("data-node-type","blockGroup"),s.append(o);((n=s.nextElementSibling)==null?void 0:n.nodeName)==="UL"||((r=s.nextElementSibling)==null?void 0:r.nodeName)==="OL";)o.append(s.nextElementSibling)})}let A1=null;function EV(){return A1||(A1=document.implementation.createHTMLDocument("title"))}function kV(t){if(typeof t=="string"){const e=EV().createElement("div");e.innerHTML=t,t=e}return bV(t),yV(t),t}function Pw(t,e){const n=kV(t),r=mn.fromSchema(e).parse(n,{topNode:e.nodes.blockGroup.create()}),i=[];for(let s=0;s<r.childCount;s++)i.push(ve(r.child(s),e));return i}function TV(t,e){const n=e.value?e.value:"",r={};e.lang&&(r["data-language"]=e.lang);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(i.data={meta:e.meta}),t.patch(e,i),i=t.applyData(e,i),i={type:"element",tagName:"pre",properties:{},children:[i]},t.patch(e,i),i}function CV(t,e){var n;const r=String(e?.url||""),i=e!=null&&e.title?String(e.title):void 0;let s={type:"element",tagName:"video",properties:{src:r,"data-name":i,"data-url":r,controls:!0},children:[]};return(n=t.patch)==null||n.call(t,e,s),s=t.applyData?t.applyData(e,s):s,s}function Bw(t){return YS().use(n$).use(WS).use(B$,{handlers:{...uf,image:(e,n)=>{const r=String(n?.url||"");return JD(r)?CV(e,n):uf.image(e,n)},code:TV,blockquote:(e,n)=>{const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!1)};return e.patch(n,r),e.applyData(n,r)}}}).use($z).processSync(t).value}function SV(t,e){const n=Bw(t);return Pw(n,e)}class wV{constructor(e){this.editor=e}blocksToHTMLLossy(e=this.editor.document){return Nu(this.editor.pmSchema,this.editor).exportBlocks(e,{})}blocksToFullHTML(e=this.editor.document){return eV(this.editor.pmSchema,this.editor).serializeBlocks(e,{})}tryParseHTMLToBlocks(e){return Pw(e,this.editor.pmSchema)}blocksToMarkdownLossy(e=this.editor.document){return mU(e,this.editor.pmSchema,this.editor,{})}tryParseMarkdownToBlocks(e){return SV(e,this.editor.pmSchema)}pasteHTML(e,n=!1){var r;let i=e;if(!n){const s=this.tryParseHTMLToBlocks(e);i=this.blocksToFullHTML(s)}i&&((r=this.editor.prosemirrorView)==null||r.pasteHTML(i))}pasteText(e){var n;return(n=this.editor.prosemirrorView)==null?void 0:n.pasteText(e)}pasteMarkdown(e){const n=Bw(e);return this.pasteHTML(n)}}const Em=["vscode-editor-data","blocknote/html","text/markdown","text/html","text/plain","Files"];function xV(t,e){if(!t.startsWith(".")||!e.startsWith("."))throw new Error("The strings provided are not valid file extensions.");return t===e}function AV(t,e){const n=t.split("/"),r=e.split("/");if(n.length!==2)throw new Error(`The string ${t} is not a valid MIME type.`);if(r.length!==2)throw new Error(`The string ${e} is not a valid MIME type.`);return n[1]==="*"||r[1]==="*"?n[0]===r[0]:(n[0]==="*"||r[0]==="*"||n[0]===r[0])&&n[1]===r[1]}function _1(t,e,n,r="after"){let i;return Array.isArray(e.content)&&e.content.length===0?i=t.updateBlock(e,n).id:i=t.insertBlocks([n],e,r)[0].id,i}async function Fw(t,e){var n;if(!e.uploadFile){console.warn("Attempted ot insert file, but uploadFile is not set in the BlockNote editor options");return}const r="dataTransfer"in t?t.dataTransfer:t.clipboardData;if(r===null)return;let i=null;for(const o of Em)if(r.types.includes(o)){i=o;break}if(i!=="Files")return;const s=r.items;if(s){t.preventDefault();for(let o=0;o<s.length;o++){let a="file";for(const c of Object.values(e.schema.blockSpecs))for(const u of((n=c.implementation.meta)==null?void 0:n.fileBlockAccept)||[]){const d=u.startsWith("."),h=s[o].getAsFile();if(h&&(!d&&h.type&&AV(s[o].type,u)||d&&xV("."+h.name.split(".").pop(),u))){a=c.config.type;break}}const l=s[o].getAsFile();if(l){const c={type:a,props:{name:l.name}};let u;if(t.type==="paste"){const f=e.getTextCursorPosition().block;u=_1(e,f,c)}else if(t.type==="drop"){const f={left:t.clientX,top:t.clientY},p=e.prosemirrorView.posAtCoords(f);if(!p)return;u=e.transact(g=>{var b;const y=Lr(g.doc,p.pos),C=(b=e.domElement)==null?void 0:b.querySelector(`[data-id="${y.node.attrs.id}"]`),S=C?.getBoundingClientRect();return _1(e,e.getBlock(y.node.attrs.id),c,S&&(S.top+S.bottom)/2>f.top?"before":"after")})}else return;const d=await e.uploadFile(l,u),h=typeof d=="string"?{props:{url:d}}:{...d};e.updateBlock(u,h)}}}}const _V=t=>De.create({name:"dropFile",addProseMirrorPlugins(){return[new re({props:{handleDOMEvents:{drop(e,n){if(!t.isEditable)return;let r=null;for(const i of Em)if(n.dataTransfer.types.includes(i)){r=i;break}return r===null?!0:r==="Files"?(Fw(n,t),!0):!1}}}})]}}),NV=/(^|\n) {0,3}#{1,6} {1,8}[^\n]{1,64}\r?\n\r?\n\s{0,32}\S/,IV=/(_|__|\*|\*\*|~~|==|\+\+)(?!\s)(?:[^\s](?:.{0,62}[^\s])?|\S)(?=\1)/,OV=/\[[^\]]{1,128}\]\(https?:\/\/\S{1,999}\)/,MV=/(?:\s|^)`(?!\s)(?:[^\s`](?:[^`]{0,46}[^\s`])?|[^\s`])`([^\w]|$)/,vV=/(?:^|\n)\s{0,5}-\s{1}[^\n]+\n\s{0,15}-\s/,DV=/(?:^|\n)\s{0,5}\d+\.\s{1}[^\n]+\n\s{0,15}\d+\.\s/,LV=/\n{2} {0,3}-{2,48}\n{2}/,RV=/(?:\n|^)(```|~~~|\$\$)(?!`|~)[^\s]{0,64} {0,64}[^\n]{0,64}\n[\s\S]{0,9999}?\s*\1 {0,64}(?:\n+|$)/,PV=/(?:\n|^)(?!\s)\w[^\n]{0,64}\r?\n(-|=)\1{0,64}\n\n\s{0,64}(\w|$)/,BV=/(?:^|(\r?\n\r?\n))( {0,3}>[^\n]{1,333}\n){1,999}($|(\r?\n))/,FV=/^\s*\|(.+\|)+\s*$/m,HV=/^\s*\|(\s*[-:]+[-:]\s*\|)+\s*$/m,UV=/^\s*\|(.+\|)+\s*$/m,$V=t=>NV.test(t)||IV.test(t)||OV.test(t)||MV.test(t)||vV.test(t)||DV.test(t)||LV.test(t)||RV.test(t)||PV.test(t)||BV.test(t)||FV.test(t)||HV.test(t)||UV.test(t);async function zV(t,e){const{schema:n}=e.state;if(!t.clipboardData)return!1;const r=t.clipboardData.getData("text/plain");if(!r)return!1;if(!n.nodes.codeBlock)return e.pasteText(r),!0;const i=t.clipboardData.getData("vscode-editor-data"),s=i?JSON.parse(i):void 0,o=s?.mode;return o?(e.pasteHTML(`<pre><code class="language-${o}">${r.replace(/\r\n?/g,`
|
|
179
|
-
`)}</code></pre>`),!0):!1}function VV({event:t,editor:e,prioritizeMarkdownOverHTML:n,plainTextAsMarkdown:r}){var i;if(e.transact(a=>a.selection.$from.parent.type.spec.code&&a.selection.$to.parent.type.spec.code)){const a=(i=t.clipboardData)==null?void 0:i.getData("text/plain");if(a)return e.pasteText(a),!0}let s;for(const a of Em)if(t.clipboardData.types.includes(a)){s=a;break}if(!s)return!0;if(s==="vscode-editor-data")return zV(t,e.prosemirrorView),!0;if(s==="Files")return Fw(t,e),!0;const o=t.clipboardData.getData(s);if(s==="blocknote/html")return e.pasteHTML(o,!0),!0;if(s==="text/markdown")return e.pasteMarkdown(o),!0;if(n){const a=t.clipboardData.getData("text/plain");if($V(a))return e.pasteMarkdown(a),!0}return s==="text/html"?(e.pasteHTML(o),!0):r?(e.pasteMarkdown(o),!0):(e.pasteText(o),!0)}const jV=(t,e)=>De.create({name:"pasteFromClipboard",addProseMirrorPlugins(){return[new re({props:{handleDOMEvents:{paste(n,r){if(r.preventDefault(),!!t.isEditable)return e({event:r,editor:t,defaultPasteHandler:({prioritizeMarkdownOverHTML:i=!0,plainTextAsMarkdown:s=!0}={})=>VV({event:r,editor:t,prioritizeMarkdownOverHTML:i,plainTextAsMarkdown:s})})}}}})]}});function qV(t,e,n){var r;let i=!1;const s=t.state.selection instanceof be;if(!s){const l=t.state.doc.slice(t.state.selection.from,t.state.selection.to,!1).content,c=[];for(let u=0;u<l.childCount;u++)c.push(l.child(u));i=c.find(u=>u.type.isInGroup("bnBlock")||u.type.name==="blockGroup"||u.type.spec.group==="blockContent")===void 0,i&&(e=l)}let o;const a=Nu(t.state.schema,n);if(s){((r=e.firstChild)==null?void 0:r.type.name)==="table"&&(e=e.firstChild.content);const l=VE(e,n.schema.inlineContentSchema,n.schema.styleSchema);o=`<table>${a.exportInlineContent(l,{})}</table>`}else if(i){const l=Jc(e,n.schema.inlineContentSchema,n.schema.styleSchema);o=a.exportInlineContent(l,{})}else{const l=rw(e);o=a.exportBlocks(l,{})}return o}function Hw(t,e){"node"in t.state.selection&&t.state.selection.node.type.spec.group==="blockContent"&&e.transact(o=>o.setSelection(new W(o.doc.resolve(t.state.selection.from-1))));const n=t.serializeForClipboard(t.state.selection.content()).dom.innerHTML,r=t.state.selection.content().content,i=qV(t,r,e),s=am(i);return{clipboardHTML:n,externalHTML:i,markdown:s}}const N1=()=>{const t=window.getSelection();if(!t||t.isCollapsed)return!0;let e=t.focusNode;for(;e;){if(e instanceof HTMLElement&&e.getAttribute("contenteditable")==="false")return!0;e=e.parentElement}return!1},I1=(t,e,n)=>{n.preventDefault(),n.clipboardData.clearData();const{clipboardHTML:r,externalHTML:i,markdown:s}=Hw(e,t);n.clipboardData.setData("blocknote/html",r),n.clipboardData.setData("text/html",i),n.clipboardData.setData("text/plain",s)},WV=t=>De.create({name:"copyToClipboard",addProseMirrorPlugins(){return[new re({props:{handleDOMEvents:{copy(e,n){return N1()||I1(t,e,n),!0},cut(e,n){return N1()||(I1(t,e,n),e.editable&&e.dispatch(e.state.tr.deleteSelection())),!0},dragstart(e,n){if(!("node"in e.state.selection)||e.state.selection.node.type.spec.group!=="blockContent")return;t.transact(o=>o.setSelection(new W(o.doc.resolve(e.state.selection.from-1)))),n.preventDefault(),n.dataTransfer.clearData();const{clipboardHTML:r,externalHTML:i,markdown:s}=Hw(e,t);return n.dataTransfer.setData("blocknote/html",r),n.dataTransfer.setData("text/html",i),n.dataTransfer.setData("text/plain",s),!0}}}})]}}),YV=De.create({name:"blockBackgroundColor",addGlobalAttributes(){return[{types:["tableCell","tableHeader"],attributes:{backgroundColor:dL()}}]}}),KV=Cn.create({name:"hardBreak",inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,priority:10,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",sn(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
180
|
-
`}}),gf=(t,e)=>{const n=t.resolve(e),r=n.index();if(r===0)return;const i=n.posAtIndex(r-1);return Qc(t.resolve(i))},Uw=(t,e)=>{for(;e.childContainer;){const n=e.childContainer.node,r=t.resolve(e.childContainer.beforePos+1).posAtIndex(n.childCount-1);e=Qc(t.resolve(r))}return e},GV=(t,e)=>t.isBlockContainer&&t.blockContent.node.type.spec.content==="inline*"&&t.blockContent.node.childCount>0&&e.isBlockContainer&&e.blockContent.node.type.spec.content==="inline*",QV=(t,e,n,r)=>{if(!r.isBlockContainer)throw new Error(`Attempted to merge block at position ${r.bnBlock.beforePos} into previous block at position ${n.bnBlock.beforePos}, but next block is not a block container`);if(r.childContainer){const i=t.doc.resolve(r.childContainer.beforePos+1),s=t.doc.resolve(r.childContainer.afterPos-1),o=i.blockRange(s);if(e){const a=t.doc.resolve(r.bnBlock.beforePos);t.tr.lift(o,a.depth)}}if(e){if(!n.isBlockContainer)throw new Error(`Attempted to merge block at position ${r.bnBlock.beforePos} into previous block at position ${n.bnBlock.beforePos}, but previous block is not a block container`);e(t.tr.delete(n.blockContent.afterPos-1,r.blockContent.beforePos+1))}return!0},O1=t=>({state:e,dispatch:n})=>{const r=e.doc.resolve(t),i=Qc(r),s=gf(e.doc,i.bnBlock.beforePos);if(!s)return!1;const o=Uw(e.doc,s);return GV(o,i)?QV(e,n,o,i):!1},JV=De.create({priority:50,addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({chain:r,commands:i})=>[()=>i.deleteSelection(),()=>i.undoInputRule(),()=>i.command(({state:s})=>{const o=xt(s);if(!o.isBlockContainer)return!1;const a=s.selection.from===o.blockContent.beforePos+1,l=o.blockContent.node.type.name==="paragraph";return a&&!l?i.command(oL(o.bnBlock.beforePos,{type:"paragraph",props:{}})):!1}),()=>i.command(({state:s})=>{const o=xt(s);if(!o.isBlockContainer)return!1;const{blockContent:a}=o;return s.selection.from===a.beforePos+1?i.liftListItem("blockContainer"):!1}),()=>i.command(({state:s})=>{const o=xt(s);if(!o.isBlockContainer)return!1;const{bnBlock:a,blockContent:l}=o,c=s.selection.from===l.beforePos+1,u=s.selection.empty,d=a.beforePos;return c&&u?r().command(O1(d)).scrollIntoView().run():!1}),()=>i.command(({state:s,tr:o,dispatch:a})=>{const l=xt(s);if(!l.isBlockContainer||o.selection.from!==l.blockContent.beforePos+1)return!1;const c=o.doc.resolve(l.bnBlock.beforePos);if(c.nodeBefore||c.node().type.name!=="column")return!1;const u=o.doc.resolve(l.bnBlock.beforePos),d=o.doc.resolve(u.before()),h=d.before();if(a){const f=o.doc.slice(l.bnBlock.beforePos,l.bnBlock.afterPos).content;o.delete(l.bnBlock.beforePos,l.bnBlock.afterPos),d.index()===0?(pf(o,h),o.insert(h,f),o.setSelection(j.near(o.doc.resolve(h)))):(o.insert(d.pos-1,f),o.setSelection(j.near(o.doc.resolve(d.pos-1))),pf(o,h))}return!0}),()=>i.command(({state:s})=>{const o=xt(s);if(!o.isBlockContainer)return!1;if(o.blockContent.node.childCount===0&&o.blockContent.node.type.spec.content==="inline*"){const a=gf(s.doc,o.bnBlock.beforePos);if(!a||!a.isBlockContainer)return!1;let l=r();if(a.blockContent.node.type.spec.content==="tableRow+"){const c=o.bnBlock.beforePos-1-1-1-1-1;l=l.setTextSelection(c)}else if(a.blockContent.node.type.spec.content===""){const c=a.blockContent.afterPos-a.blockContent.node.nodeSize;l=l.setNodeSelection(c)}else{const c=a.blockContent.afterPos-a.blockContent.node.nodeSize;l=l.setTextSelection(c)}return l.deleteRange({from:o.bnBlock.beforePos,to:o.bnBlock.afterPos}).scrollIntoView().run()}return!1}),()=>i.command(({state:s})=>{const o=xt(s);if(!o.isBlockContainer)throw new Error("todo");const a=s.selection.from===o.blockContent.beforePos+1,l=s.selection.empty,c=gf(s.doc,o.bnBlock.beforePos);if(c&&a&&l){const u=Uw(s.doc,c);if(!u.isBlockContainer)throw new Error("todo");if(u.blockContent.node.type.spec.content===""||u.blockContent.node.type.spec.content==="inline*"&&u.blockContent.node.childCount===0)return r().cut({from:o.bnBlock.beforePos,to:o.bnBlock.afterPos},u.bnBlock.afterPos).deleteRange({from:u.bnBlock.beforePos,to:u.bnBlock.afterPos}).run()}return!1})]),e=()=>this.editor.commands.first(({commands:r})=>[()=>r.deleteSelection(),()=>r.command(({state:i})=>{const s=xt(i);if(!s.isBlockContainer)return!1;const{bnBlock:o,blockContent:a,childContainer:l}=s,{depth:c}=i.doc.resolve(o.beforePos),u=o.afterPos===i.doc.nodeSize-3,d=i.selection.from===a.afterPos-1,h=i.selection.empty;if(!u&&d&&h&&l===void 0){let f=c,p=o.afterPos+1,g=i.doc.resolve(p).depth;for(;g<f;)f=g,p+=2,g=i.doc.resolve(p).depth;return r.command(O1(p-1))}return!1})]),n=(r=!1)=>this.editor.commands.first(({commands:i,tr:s})=>[()=>i.command(({state:o})=>{const a=xt(o);if(!a.isBlockContainer)return!1;const{bnBlock:l,blockContent:c}=a,{depth:u}=o.doc.resolve(l.beforePos),d=o.selection.$anchor.parentOffset===0,h=o.selection.anchor===o.selection.head,f=c.node.childCount===0,p=u>1;return d&&h&&f&&p?i.liftListItem("blockContainer"):!1}),()=>i.command(({state:o})=>{var a;const l=xt(o),c=((a=this.options.editor.schema.blockSchema[l.blockNoteType].meta)==null?void 0:a.hardBreakShortcut)??"shift+enter";if(c==="none")return!1;if(c==="shift+enter"&&r||c==="enter"){const u=s.storedMarks||s.selection.$head.marks().filter(d=>this.editor.extensionManager.splittableMarks.includes(d.type.name));return s.insert(s.selection.head,s.doc.type.schema.nodes.hardBreak.create()).ensureMarks(u),!0}return!1}),()=>i.command(({state:o,dispatch:a})=>{const l=xt(o);if(!l.isBlockContainer)return!1;const{bnBlock:c,blockContent:u}=l,d=o.selection.$anchor.parentOffset===0,h=o.selection.anchor===o.selection.head,f=u.node.childCount===0;if(d&&h&&f){const p=c.afterPos,g=p+2;if(a){const b=o.schema.nodes.blockContainer.createAndFill();o.tr.insert(p,b).scrollIntoView(),o.tr.setSelection(new j(o.doc.resolve(g)))}return!0}return!1}),()=>i.command(({state:o,chain:a})=>{const l=xt(o);if(!l.isBlockContainer)return!1;const{blockContent:c}=l,u=o.selection.$anchor.parentOffset===0;return c.node.childCount===0?!1:(a().deleteSelection().command(UL(o.selection.from,u,u)).run(),!0)})]);return{Backspace:t,Delete:e,Enter:()=>n(),"Shift-Enter":()=>n(!0),Tab:()=>{var r,i;return this.options.tabBehavior!=="prefer-indent"&&((r=this.options.editor.getExtension(Zh))!=null&&r.store.state||((i=this.options.editor.getExtension(Nr))==null?void 0:i.store.state)!==void 0)?!1:Rw(this.options.editor)},"Shift-Tab":()=>{var r,i;return this.options.tabBehavior!=="prefer-indent"&&((r=this.options.editor.getExtension(Zh))!=null&&r.store.state||((i=this.options.editor.getExtension(Nr))==null?void 0:i.store.state)!==void 0)?!1:this.editor.commands.liftListItem("blockContainer")},"Shift-Mod-ArrowUp":()=>(this.options.editor.moveBlocksUp(),!0),"Shift-Mod-ArrowDown":()=>(this.options.editor.moveBlocksDown(),!0),"Mod-z":()=>this.options.editor.undo(),"Mod-y":()=>this.options.editor.redo(),"Shift-Mod-z":()=>this.options.editor.redo()}}}),XV=Tn.create({name:"insertion",inclusive:!1,excludes:"deletion modification insertion",addAttributes(){return{id:{default:null,validate:"number"}}},extendMarkSchema(t){return t.name!=="insertion"?{}:{blocknoteIgnore:!0,inclusive:!1,toDOM(e,n){return["ins",{"data-id":String(e.attrs.id),"data-inline":String(n),...!n&&{style:"display: contents"}},0]},parseDOM:[{tag:"ins",getAttrs(e){return e.dataset.id?{id:parseInt(e.dataset.id,10)}:!1}}]}}}),ZV=Tn.create({name:"deletion",inclusive:!1,excludes:"insertion modification deletion",addAttributes(){return{id:{default:null,validate:"number"}}},extendMarkSchema(t){return t.name!=="deletion"?{}:{blocknoteIgnore:!0,inclusive:!1,toDOM(e,n){return["del",{"data-id":String(e.attrs.id),"data-inline":String(n),...!n&&{style:"display: contents"}},0]},parseDOM:[{tag:"del",getAttrs(e){return e.dataset.id?{id:parseInt(e.dataset.id,10)}:!1}}]}}}),ej=Tn.create({name:"modification",inclusive:!1,excludes:"deletion insertion",addAttributes(){return{id:{default:null,validate:"number"},type:{validate:"string"},attrName:{default:null,validate:"string|null"},previousValue:{default:null},newValue:{default:null}}},extendMarkSchema(t){return t.name!=="modification"?{}:{blocknoteIgnore:!0,inclusive:!1,toDOM(e,n){return[n?"span":"div",{"data-type":"modification","data-id":String(e.attrs.id),"data-mod-type":e.attrs.type,"data-mod-prev-val":JSON.stringify(e.attrs.previousValue),"data-mod-new-val":JSON.stringify(e.attrs.newValue)},0]},parseDOM:[{tag:"span[data-type='modification']",getAttrs(e){return e.dataset.id?{id:parseInt(e.dataset.id,10),type:e.dataset.modType,previousValue:e.dataset.modPrevVal,newValue:e.dataset.modNewVal}:!1}},{tag:"div[data-type='modification']",getAttrs(e){return e.dataset.id?{id:parseInt(e.dataset.id,10),type:e.dataset.modType,previousValue:e.dataset.modPrevVal}:!1}}]}}}),tj=De.create({name:"textAlignment",addGlobalAttributes(){return[{types:["tableCell","tableHeader"],attributes:{textAlignment:{default:"left",parseHTML:t=>t.getAttribute("data-text-alignment"),renderHTML:t=>t.textAlignment==="left"?{}:{"data-text-alignment":t.textAlignment}}}}]}}),nj=De.create({name:"blockTextColor",addGlobalAttributes(){return[{types:["table","tableCell","tableHeader"],attributes:{textColor:hL()}}]}}),rj={blockColor:"data-block-color",blockStyle:"data-block-style",id:"data-id",depth:"data-depth",depthChange:"data-depth-change"},ij=Cn.create({name:"blockContainer",group:"blockGroupChild bnBlock",content:"blockContent blockGroup?",priority:50,defining:!0,marks:"insertion modification deletion",parseHTML(){return[{tag:"div[data-node-type="+this.name+"]",getAttrs:t=>{if(typeof t=="string")return!1;const e={};for(const[n,r]of Object.entries(rj))t.getAttribute(r)&&(e[n]=t.getAttribute(r));return e}},{tag:'div[data-node-type="blockOuter"]',skip:!0}]},renderHTML({HTMLAttributes:t}){var e;const n=document.createElement("div");n.className="bn-block-outer",n.setAttribute("data-node-type","blockOuter");for(const[s,o]of Object.entries(t))s!=="class"&&n.setAttribute(s,o);const r={...((e=this.options.domAttributes)==null?void 0:e.block)||{},...t},i=document.createElement("div");i.className=Hr("bn-block",r.class),i.setAttribute("data-node-type",this.name);for(const[s,o]of Object.entries(r))s!=="class"&&i.setAttribute(s,o);return n.appendChild(i),{dom:n,contentDOM:i}}}),sj=Cn.create({name:"blockGroup",group:"childContainer",content:"blockGroupChild+",marks:"deletion insertion modification",parseHTML(){return[{tag:"div",getAttrs:t=>typeof t=="string"?!1:t.getAttribute("data-node-type")==="blockGroup"?null:!1}]},renderHTML({HTMLAttributes:t}){var e;const n={...((e=this.options.domAttributes)==null?void 0:e.blockGroup)||{},...t},r=document.createElement("div");r.className=Hr("bn-block-group",n.class),r.setAttribute("data-node-type","blockGroup");for(const[i,s]of Object.entries(n))i!=="class"&&r.setAttribute(i,s);return{dom:r,contentDOM:r}}}),oj=Cn.create({name:"doc",topNode:!0,content:"blockGroup",marks:"insertion modification deletion"}),aj=pe(({options:t})=>({key:"collaboration",blockNoteExtensions:[JH(t),Xh(t),kl(t),Tl(),eU(t)]}));let M1=!1;function lj(t,e){const n=[Wi.ClipboardTextSerializer,Wi.Commands,Wi.Editable,Wi.FocusEvents,Wi.Tabindex,JU,Gc.configure({types:["blockContainer","columnList","column"],setIdAttribute:e.setIdAttribute}),KV,w7,XV,ZV,ej,S7.extend({inclusive:!1}).configure({defaultProtocol:sU,protocols:M1?[]:iU}),...Object.values(t.schema.styleSpecs).map(r=>r.implementation.mark.configure({editor:t})),nj,YV,tj,De.create({name:"OverrideEscape",addKeyboardShortcuts:()=>({Escape:()=>{var r;return(r=t.getExtension(Bp))!=null&&r.shown()?!1:(t.blur(),!0)}})}),oj,ij.configure({editor:t,domAttributes:e.domAttributes}),JV.configure({editor:t,tabBehavior:e.tabBehavior}),sj.configure({domAttributes:e.domAttributes}),...Object.values(t.schema.inlineContentSpecs).filter(r=>r.config!=="link"&&r.config!=="text").map(r=>r.implementation.node.configure({editor:t})),...Object.values(t.schema.blockSpecs).flatMap(r=>[..."node"in r.implementation?[r.implementation.node.configure({editor:t,domAttributes:e.domAttributes})]:[]]),WV(t),jV(t,e.pasteHandler||(r=>r.defaultPasteHandler())),_V(t)];return M1=!0,n}function cj(t,e){const n=[ew(),tU(e),Nr(e),Zh(e),rU(e),aU(),cU(e),x7(e),TU(e),Bp(e),...e.trailingBlock!==!1?[_U()]:[]];return e.collaboration?n.push(aj(e.collaboration)):n.push(nU()),"table"in t.schema.blockSpecs&&n.push(AU(e)),e.animations!==!1&&n.push(dU()),n}class uj{constructor(e,n){he(this,"disabledExtensions",new Set),he(this,"extensions",[]),he(this,"abortMap",new Map),he(this,"extensionFactories",new Map),he(this,"extensionPlugins",new Map),this.editor=e,this.options=n,e.onMount(()=>{for(const r of this.extensions)if(r.mount){const i=new window.AbortController,s=r.mount({dom:e.prosemirrorView.dom,root:e.prosemirrorView.root,signal:i.signal});s&&i.signal.addEventListener("abort",()=>{s()}),this.abortMap.set(r,i)}}),e.onUnmount(()=>{for(const[r,i]of this.abortMap.entries())this.abortMap.delete(r),i.abort()}),this.disabledExtensions=new Set(n.disableExtensions||[]);for(const r of cj(this.editor,this.options))this.addExtension(r);for(const r of this.options.extensions??[])this.addExtension(r);for(const r of Object.values(this.editor.schema.blockSpecs))for(const i of r.extensions??[])this.addExtension(i)}registerExtension(e){var n;const r=[].concat(e).filter(Boolean);if(!r.length){console.warn("No extensions found to register",e);return}const i=r.map(o=>this.addExtension(o)).filter(Boolean),s=new Set;for(const o of i)o!=null&&o.tiptapExtensions&&console.warn(`Extension ${o.key} has tiptap extensions, but these cannot be changed after initializing the editor. Please separate the extension into multiple extensions if you want to add them, or re-initialize the editor.`,o),(n=o?.inputRules)!=null&&n.length&&console.warn(`Extension ${o.key} has input rules, but these cannot be changed after initializing the editor. Please separate the extension into multiple extensions if you want to add them, or re-initialize the editor.`,o),this.getProsemirrorPluginsFromExtension(o).plugins.forEach(a=>{s.add(a)});this.updatePlugins(o=>[...o,...s])}addExtension(e){let n;if(typeof e=="function"?n=e({editor:this.editor}):n=e,!(!n||this.disabledExtensions.has(n.key))){if(typeof e=="function"){const r=n[Lh];typeof r=="function"&&this.extensionFactories.set(r,n)}if(this.extensions.push(n),n.blockNoteExtensions)for(const r of n.blockNoteExtensions)this.addExtension(r);return n}}resolveExtensions(e){const n=[];if(typeof e=="function"){const r=this.extensionFactories.get(e);r&&n.push(r)}else if(Array.isArray(e))for(const r of e)n.push(...this.resolveExtensions(r));else if(typeof e=="object"&&"key"in e)n.push(e);else if(typeof e=="string"){const r=this.extensions.find(i=>i.key===e);r&&n.push(r)}return n}unregisterExtension(e){var n;const r=this.resolveExtensions(e);if(!r.length){console.warn("No extensions found to unregister",e);return}let i=!1;const s=new Set;for(const o of r){this.extensions=this.extensions.filter(l=>l!==o),this.extensionFactories.forEach((l,c)=>{l===o&&this.extensionFactories.delete(c)}),(n=this.abortMap.get(o))==null||n.abort(),this.abortMap.delete(o);const a=this.extensionPlugins.get(o);a?.forEach(l=>{s.add(l)}),this.extensionPlugins.delete(o),o.tiptapExtensions&&!i&&(i=!0,console.warn(`Extension ${o.key} has tiptap extensions, but they will not be removed. Please separate the extension into multiple extensions if you want to remove them, or re-initialize the editor.`,e))}this.updatePlugins(o=>o.filter(a=>!s.has(a)))}updatePlugins(e){const n=this.editor.prosemirrorState,r=n.reconfigure({plugins:e(n.plugins.slice())});this.editor.prosemirrorView.updateState(r)}getTiptapExtensions(){var e;const n=lj(this.editor,this.options).filter(s=>!this.disabledExtensions.has(s.name)),r=sw(this.extensions),i=new Map;for(const s of this.extensions){s.tiptapExtensions&&n.push(...s.tiptapExtensions);const o=r(s.key),{plugins:a,inputRules:l}=this.getProsemirrorPluginsFromExtension(s);a.length&&n.push(De.create({name:s.key,priority:o,addProseMirrorPlugins:()=>a})),l.length&&(i.has(o)||i.set(o,[]),i.get(o).push(...l))}n.push(De.create({name:"blocknote-input-rules",addProseMirrorPlugins(){const s=[];return Array.from(i.keys()).sort().reverse().forEach(o=>{s.push(...i.get(o))}),[VU({rules:s})]}}));for(const s of((e=this.options._tiptapOptions)==null?void 0:e.extensions)??[])n.push(s);return n}getProsemirrorPluginsFromExtension(e){var n,r,i;const s=[...e.prosemirrorPlugins??[]],o=[];return!((n=e.prosemirrorPlugins)!=null&&n.length)&&!Object.keys(e.keyboardShortcuts||{}).length&&!((r=e.inputRules)!=null&&r.length)?{plugins:s,inputRules:o}:(this.extensionPlugins.set(e,s),(i=e.inputRules)!=null&&i.length&&o.push(...e.inputRules.map(a=>new Ri(a.find,(l,c,u,d)=>{const h=a.replace({match:c,range:{from:u,to:d},editor:this.editor});if(h){const f=this.editor.getTextCursorPosition();if(this.editor.schema.blockSchema[f.block.type].content!=="inline")return null;const p=aa(l.tr),g=l.tr.deleteRange(u,d);return hu(g,p.bnBlock.beforePos,h),g}return null}))),Object.keys(e.keyboardShortcuts||{}).length&&s.push(aE(Object.fromEntries(Object.entries(e.keyboardShortcuts).map(([a,l])=>[a,()=>l({editor:this.editor})])))),{plugins:s,inputRules:o})}getExtensions(){return new Map(this.extensions.map(e=>[e.key,e]))}getExtension(e){if(typeof e=="string")return this.extensions.find(r=>r.key===e)||void 0;if(typeof e=="function")return this.extensionFactories.get(e)||void 0;throw new Error(`Invalid extension type: ${typeof e}`)}hasExtension(e){return typeof e=="string"?this.extensions.some(n=>n.key===e):typeof e=="object"&&"key"in e?this.extensions.some(n=>n.key===e.key):typeof e=="function"?this.extensionFactories.has(e):!1}}function dj(t,e){let{$from:n,$to:r}=e;if(n.pos>n.start()&&n.pos<t.content.size){const i=t.textBetween(n.pos,n.pos+1);if(/^[\w\p{P}]$/u.test(i)){const s=t.textBetween(n.start(),n.pos).match(/[\w\p{P}]+$/u);s&&(n=t.resolve(n.pos-s[0].length))}}if(r.pos<r.end()&&r.pos>0){const i=t.textBetween(r.pos-1,r.pos);if(/^[\w\p{P}]$/u.test(i)){const s=t.textBetween(r.pos,r.end()).match(/^[\w\p{P}]+/u);s&&(r=t.resolve(r.pos+s[0].length))}}return{$from:n,$to:r,from:n.pos,to:r.pos}}function hj(t){const e=He(t);if(t.selection.empty||"node"in t.selection)return;const n=t.doc.resolve(Lr(t.doc,t.selection.from).posBeforeNode),r=t.doc.resolve(Lr(t.doc,t.selection.to).posBeforeNode),i=(c,u)=>{const d=n.posAtIndex(c,u),h=t.doc.resolve(d).nodeAfter;if(!h)throw new Error(`Error getting selection - node not found at position ${d}`);return ve(h,e)},s=[],o=n.sharedDepth(r.pos),a=n.index(o),l=r.index(o);if(n.depth>o){s.push(ve(n.nodeAfter,e));for(let c=n.depth;c>o;c--)if(n.node(c).type.isInGroup("childContainer")){const u=n.index(c)+1,d=n.node(c).childCount;for(let h=u;h<d;h++)s.push(i(h,c))}}else s.push(i(a,o));for(let c=a+1;c<=l;c++)s.push(i(c,o));if(s.length===0)throw new Error(`Error getting selection - selection doesn't span any blocks (${t.selection})`);return{blocks:s}}function fj(t,e,n){const r=typeof e=="string"?e:e.id,i=typeof n=="string"?n:n.id,s=He(t),o=la(s);if(r===i)throw new Error(`Attempting to set selection with the same anchor and head blocks (id ${r})`);const a=Vt(r,t.doc);if(!a)throw new Error(`Block with ID ${r} not found`);const l=Vt(i,t.doc);if(!l)throw new Error(`Block with ID ${i} not found`);const c=Rr(a),u=Rr(l),d=o.blockSchema[c.blockNoteType],h=o.blockSchema[u.blockNoteType];if(!c.isBlockContainer||d.content==="none")throw new Error(`Attempting to set selection anchor in block without content (id ${r})`);if(!u.isBlockContainer||h.content==="none")throw new Error(`Attempting to set selection anchor in block without content (id ${i})`);let f,p;if(d.content==="table"){const g=Ae.get(c.blockContent.node);f=c.blockContent.beforePos+g.positionAt(0,0,c.blockContent.node)+1+2}else f=c.blockContent.beforePos+1;if(h.content==="table"){const g=Ae.get(u.blockContent.node),b=u.blockContent.beforePos+g.positionAt(g.height-1,g.width-1,u.blockContent.node)+1,y=t.doc.resolve(b).nodeAfter.nodeSize;p=b+y-2}else p=u.blockContent.afterPos-1;t.setSelection(j.create(t.doc,f,p))}function pj(t,e=!1){const n=He(t),r=e?dj(t.doc,t.selection):t.selection;let i=r.$from,s=r.$to;for(;s.parentOffset>=s.parent.nodeSize-2&&s.depth>0;)s=t.doc.resolve(s.pos+1);for(;s.parentOffset===0&&s.depth>0;)s=t.doc.resolve(s.pos-1);for(;i.parentOffset===0&&i.depth>0;)i=t.doc.resolve(i.pos-1);for(;i.parentOffset>=i.parent.nodeSize-2&&i.depth>0;)i=t.doc.resolve(i.pos+1);const o=aI(t.doc.slice(i.pos,s.pos,!0),n);return{_meta:{startPos:i.pos,endPos:s.pos},...o}}function mj(t){const{bnBlock:e}=aa(t),n=He(t.doc),r=t.doc.resolve(e.beforePos),i=r.nodeBefore,s=t.doc.resolve(e.afterPos).nodeAfter;let o;return r.depth>1&&(o=r.node(),o.type.isInGroup("bnBlock")||(o=r.node(r.depth-1))),{block:ve(e.node,n),prevBlock:i===null?void 0:ve(i,n),nextBlock:s===null?void 0:ve(s,n),parentBlock:o===void 0?void 0:ve(o,n)}}function $w(t,e,n="start"){const r=typeof e=="string"?e:e.id,i=He(t.doc),s=la(i),o=Vt(r,t.doc);if(!o)throw new Error(`Block with ID ${r} not found`);const a=Rr(o),l=s.blockSchema[a.blockNoteType].content;if(a.isBlockContainer){const c=a.blockContent;if(l==="none"){t.setSelection(W.create(t.doc,c.beforePos));return}if(l==="inline")n==="start"?t.setSelection(j.create(t.doc,c.beforePos+1)):t.setSelection(j.create(t.doc,c.afterPos-1));else if(l==="table")n==="start"?t.setSelection(j.create(t.doc,c.beforePos+4)):t.setSelection(j.create(t.doc,c.afterPos-4));else throw new Pn(l)}else{const c=n==="start"?a.childContainer.node.firstChild:a.childContainer.node.lastChild;$w(t,c.attrs.id,n)}}class gj{constructor(e){this.editor=e}getSelection(){return this.editor.transact(e=>hj(e))}getSelectionCutBlocks(e=!1){return this.editor.transact(n=>pj(n,e))}setSelection(e,n){return this.editor.transact(r=>fj(r,e,n))}getTextCursorPosition(){return this.editor.transact(e=>mj(e))}setTextCursorPosition(e,n="start"){return this.editor.transact(r=>$w(r,e,n))}getSelectionBoundingBox(){if(!this.editor.prosemirrorView)return;const{selection:e}=this.editor.prosemirrorState,{ranges:n}=e,r=Math.min(...n.map(s=>s.$from.pos)),i=Math.max(...n.map(s=>s.$to.pos));if(iN(e)){const s=this.editor.prosemirrorView.nodeDOM(r);if(s)return s.getBoundingClientRect()}return wE(this.editor.prosemirrorView,r,i).toJSON()}}class bj{constructor(e){he(this,"activeTransaction",null),he(this,"isInCan",!1),this.editor=e}can(e){try{return this.isInCan=!0,e()}finally{this.isInCan=!1}}exec(e){if(this.activeTransaction)throw new Error("`exec` should not be called within a `transact` call, move the `exec` call outside of the `transact` call");if(this.isInCan)return this.canExec(e);const n=this.prosemirrorState,r=this.prosemirrorView;return e(n,i=>this.prosemirrorView.dispatch(i),r)}canExec(e){if(this.activeTransaction)throw new Error("`canExec` should not be called within a `transact` call, move the `canExec` call outside of the `transact` call");const n=this.prosemirrorState,r=this.prosemirrorView;return e(n,void 0,r)}transact(e){if(this.activeTransaction)return e(this.activeTransaction);try{this.activeTransaction=this.editor._tiptapEditor.state.tr;const n=e(this.activeTransaction),r=this.activeTransaction;return this.activeTransaction=null,r&&(r.docChanged||r.selectionSet||r.scrolledIntoView||r.storedMarksSet||!r.isGeneric)&&this.prosemirrorView.dispatch(r),n}finally{this.activeTransaction=null}}get prosemirrorState(){if(this.activeTransaction)throw new Error("`prosemirrorState` should not be called within a `transact` call, move the `prosemirrorState` call outside of the `transact` call or use `editor.transact` to read the current editor state");return this.editor._tiptapEditor.state}get prosemirrorView(){return this.editor._tiptapEditor.view}isFocused(){var e;return((e=this.prosemirrorView)==null?void 0:e.hasFocus())||!1}focus(){var e;(e=this.prosemirrorView)==null||e.focus()}get isEditable(){if(!this.editor._tiptapEditor){if(!this.editor.headless)throw new Error("no editor, but also not headless?");return!1}return this.editor._tiptapEditor.isEditable===void 0?!0:this.editor._tiptapEditor.isEditable}set isEditable(e){if(!this.editor._tiptapEditor){if(!this.editor.headless)throw new Error("no editor, but also not headless?");return}this.editor._tiptapEditor.options.editable!==e&&this.editor._tiptapEditor.setEditable(e)}undo(){const e=this.editor.getExtension("yUndo");if(e)return this.exec(e.undoCommand);const n=this.editor.getExtension("history");if(n)return this.exec(n.undoCommand);throw new Error("No undo plugin found")}redo(){const e=this.editor.getExtension("yUndo");if(e)return this.exec(e.redoCommand);const n=this.editor.getExtension("history");if(n)return this.exec(n.redoCommand);throw new Error("No redo plugin found")}}function yj(t,e,n,r={updateSelection:!0}){let{from:i,to:s}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},o=!0,a=!0,l="";if(n.forEach(c=>{c.check(),o&&c.isText&&c.marks.length===0?l+=c.text:o=!1,a=a?c.isBlock:!1}),i===s&&a){const{parent:c}=t.doc.resolve(i);c.isTextblock&&!c.type.spec.code&&!c.childCount&&(i-=1,s+=1)}return o?t.insertText(l,i,s):t.replaceWith(i,s,n),r.updateSelection&&hE(t,t.steps.length-1,-1),!0}class Ej{constructor(e){this.editor=e}insertInlineContent(e,{updateSelection:n=!1}={}){const r=bn(e,this.editor.pmSchema);this.editor.transact(i=>{yj(i,{from:i.selection.from,to:i.selection.to},r,{updateSelection:n})})}getActiveStyles(){return this.editor.transact(e=>{const n={},r=e.selection.$to.marks();for(const i of r){const s=this.editor.schema.styleSchema[i.type.name];if(!s){i.type.name!=="link"&&!i.type.spec.blocknoteIgnore&&console.warn("mark not found in styleschema",i.type.name);continue}s.propSchema==="boolean"?n[s.type]=!0:n[s.type]=i.attrs.stringValue}return n})}addStyles(e){for(const[n,r]of Object.entries(e)){const i=this.editor.schema.styleSchema[n];if(!i)throw new Error(`style ${n} not found in styleSchema`);if(i.propSchema==="boolean")this.editor._tiptapEditor.commands.setMark(n);else if(i.propSchema==="string")this.editor._tiptapEditor.commands.setMark(n,{stringValue:r});else throw new Pn(i.propSchema)}}removeStyles(e){for(const n of Object.keys(e))this.editor._tiptapEditor.commands.unsetMark(n)}toggleStyles(e){for(const[n,r]of Object.entries(e)){const i=this.editor.schema.styleSchema[n];if(!i)throw new Error(`style ${n} not found in styleSchema`);if(i.propSchema==="boolean")this.editor._tiptapEditor.commands.toggleMark(n);else if(i.propSchema==="string")this.editor._tiptapEditor.commands.toggleMark(n,{stringValue:r});else throw new Pn(i.propSchema)}}getSelectedText(){return this.editor.transact(e=>e.doc.textBetween(e.selection.from,e.selection.to))}getSelectedLinkUrl(){return this.editor._tiptapEditor.getAttributes("link").href}createLink(e,n){if(e==="")return;const r=this.editor.pmSchema.mark("link",{href:e});this.editor.transact(i=>{const{from:s,to:o}=i.selection;n?i.insertText(n,s,o).addMark(s,s+n.length,r):i.setSelection(j.create(i.doc,o)).addMark(s,o,r)})}}function kj(t,e){const n=[];return t.forEach((r,i,s)=>{s!==e&&n.push(r)}),v.from(n)}function Tj(t,e){const n=[];for(let r=0;r<t.childCount;r++)if(t.child(r).type.name==="tableRow")if(n.length>0&&n[n.length-1].type.name==="table"){const i=n[n.length-1],s=i.copy(i.content.addToEnd(t.child(r)));n[n.length-1]=s}else{const i=e.nodes.table.createChecked(void 0,t.child(r));n.push(i)}else n.push(t.child(r));return t=v.from(n),t}function Cj(t,e){let n=v.from(t.content);if(n=Tj(n,e.state.schema),!Sj(n,e))return new F(n,t.openStart,t.openEnd);for(let r=0;r<n.childCount;r++)if(n.child(r).type.spec.group==="blockContent"){const i=[n.child(r)];if(r+1<n.childCount&&n.child(r+1).type.name==="blockGroup"){const o=n.child(r+1).child(0).child(0);(o.type.name==="bulletListItem"||o.type.name==="numberedListItem"||o.type.name==="checkListItem")&&(i.push(n.child(r+1)),n=kj(n,r+1))}const s=e.state.schema.nodes.blockContainer.createChecked(void 0,i);n=n.replaceChild(r,s)}return new F(n,t.openStart,t.openEnd)}function Sj(t,e){var n,r;const i=t.childCount===1,s=((n=t.firstChild)==null?void 0:n.type.spec.content)==="inline*",o=((r=t.firstChild)==null?void 0:r.type.spec.content)==="tableRow+";if(i){if(s)return!1;if(o){const a=xt(e.state);if(a.isBlockContainer)return a.blockContent.node.type.spec.content!=="tableRow+"}}return!0}const wj={enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!1};class zw extends aw{constructor(e){var n,r,i,s,o,a,l,c,u,d;super(),he(this,"pmSchema"),he(this,"_tiptapEditor"),he(this,"elementRenderer",null),he(this,"blockCache",new WeakMap),he(this,"dictionary"),he(this,"schema"),he(this,"blockImplementations"),he(this,"inlineContentImplementations"),he(this,"styleImplementations"),he(this,"uploadFile"),he(this,"onUploadStartCallbacks",[]),he(this,"onUploadEndCallbacks",[]),he(this,"resolveFileUrl"),he(this,"settings"),he(this,"_blockManager"),he(this,"_eventManager"),he(this,"_exportManager"),he(this,"_extensionManager"),he(this,"_selectionManager"),he(this,"_stateManager"),he(this,"_styleManager"),he(this,"unregisterExtension",(...C)=>this._extensionManager.unregisterExtension(...C)),he(this,"registerExtension",(...C)=>this._extensionManager.registerExtension(...C)),he(this,"getExtension",(...C)=>this._extensionManager.getExtension(...C)),he(this,"mount",C=>{this._tiptapEditor.mount({mount:C})}),he(this,"unmount",()=>{this._tiptapEditor.unmount()}),this.options=e,this.dictionary=e.dictionary||UU,this.settings={tables:{splitCells:((n=e?.tables)==null?void 0:n.splitCells)??!1,cellBackgroundColor:((r=e?.tables)==null?void 0:r.cellBackgroundColor)??!1,cellTextColor:((i=e?.tables)==null?void 0:i.cellTextColor)??!1,headers:((s=e?.tables)==null?void 0:s.headers)??!1}};const h={defaultStyles:!0,schema:e.schema||PU.create(),...e,placeholders:{...this.dictionary.placeholders,...e.placeholders}};if(this.schema=h.schema,this.blockImplementations=h.schema.blockSpecs,this.inlineContentImplementations=h.schema.inlineContentSpecs,this.styleImplementations=h.schema.styleSpecs,h.uploadFile){const C=h.uploadFile;this.uploadFile=async(S,I)=>{this.onUploadStartCallbacks.forEach(M=>M.apply(this,[I]));try{return await C(S,I)}finally{this.onUploadEndCallbacks.forEach(M=>M.apply(this,[I]))}}}this.resolveFileUrl=h.resolveFileUrl,this._eventManager=new pV(this),this._extensionManager=new uj(this,h);const f=this._extensionManager.getTiptapExtensions(),p=this._extensionManager.hasExtension("ySync")||this._extensionManager.hasExtension("liveblocksExtension");p&&h.initialContent&&console.warn("When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider");const g={...wj,...h._tiptapOptions,element:null,autofocus:h.autofocus??!1,extensions:f,editorProps:{...(o=h._tiptapOptions)==null?void 0:o.editorProps,attributes:{tabIndex:"0",...(l=(a=h._tiptapOptions)==null?void 0:a.editorProps)==null?void 0:l.attributes,...(c=h.domAttributes)==null?void 0:c.editor,class:Hr("bn-editor",h.defaultStyles?"bn-default-styles":"",((d=(u=h.domAttributes)==null?void 0:u.editor)==null?void 0:d.class)||"")},transformPasted:Cj}};try{const C=h.initialContent||(p?[{type:"paragraph",id:"initialBlockId"}]:[{type:"paragraph",id:Gc.options.generateID()}]);if(!Array.isArray(C)||C.length===0)throw new Error("initialContent must be a non-empty array of blocks, received: "+C);const S=J_(g.extensions),I=C.map(A=>Ii(A,S,this.schema.styleSchema).toJSON()),M=Rl({type:"doc",content:[{type:"blockGroup",content:I}]},S,g.parseOptions);this._tiptapEditor=new VN({...g,content:M.toJSON()}),this.pmSchema=this._tiptapEditor.schema}catch(C){throw new Error("Error creating document from blocks passed as `initialContent`",{cause:C})}let b;const y=this.pmSchema.nodes.doc.createAndFill;this.pmSchema.nodes.doc.createAndFill=(...C)=>{if(b)return b;const S=y.apply(this.pmSchema.nodes.doc,C),I=JSON.parse(JSON.stringify(S.toJSON()));return I.content[0].content[0].attrs.id="initialBlockId",b=Zt.fromJSON(this.pmSchema,I),b},this.pmSchema.cached.blockNoteEditor=this,this._blockManager=new fV(this),this._exportManager=new wV(this),this._selectionManager=new gj(this),this._stateManager=new bj(this),this._styleManager=new Ej(this),this.emit("create")}static create(e){return new zw(e??{})}get extensions(){return this._extensionManager.getExtensions()}exec(e){return this._stateManager.exec(e)}canExec(e){return this._stateManager.canExec(e)}transact(e){return this._stateManager.transact(e)}get prosemirrorState(){return this._stateManager.prosemirrorState}get prosemirrorView(){return this._stateManager.prosemirrorView}get domElement(){var e;if(!this.headless)return(e=this.prosemirrorView)==null?void 0:e.dom}isFocused(){var e;return this.headless?!1:((e=this.prosemirrorView)==null?void 0:e.hasFocus())||!1}get headless(){return!this._tiptapEditor.isInitialized}focus(){this.headless||this.prosemirrorView.focus()}blur(){var e;this.headless||(e=this.domElement)==null||e.blur()}onUploadStart(e){return this.onUploadStartCallbacks.push(e),()=>{const n=this.onUploadStartCallbacks.indexOf(e);n>-1&&this.onUploadStartCallbacks.splice(n,1)}}onUploadEnd(e){return this.onUploadEndCallbacks.push(e),()=>{const n=this.onUploadEndCallbacks.indexOf(e);n>-1&&this.onUploadEndCallbacks.splice(n,1)}}get topLevelBlocks(){return this.document}get document(){return this._blockManager.document}getBlock(e){return this._blockManager.getBlock(e)}getPrevBlock(e){return this._blockManager.getPrevBlock(e)}getNextBlock(e){return this._blockManager.getNextBlock(e)}getParentBlock(e){return this._blockManager.getParentBlock(e)}forEachBlock(e,n=!1){this._blockManager.forEachBlock(e,n)}onEditorContentChange(e){this._tiptapEditor.on("update",e)}onEditorSelectionChange(e){this._tiptapEditor.on("selectionUpdate",e)}onBeforeChange(e){return this._extensionManager.getExtension(ew).subscribe(e)}getTextCursorPosition(){return this._selectionManager.getTextCursorPosition()}setTextCursorPosition(e,n="start"){return this._selectionManager.setTextCursorPosition(e,n)}getSelection(){return this._selectionManager.getSelection()}getSelectionCutBlocks(e=!1){return this._selectionManager.getSelectionCutBlocks(e)}setSelection(e,n){return this._selectionManager.setSelection(e,n)}get isEditable(){return this._stateManager.isEditable}set isEditable(e){this._stateManager.isEditable=e}insertBlocks(e,n,r="before"){return this._blockManager.insertBlocks(e,n,r)}updateBlock(e,n){return this._blockManager.updateBlock(e,n)}removeBlocks(e){return this._blockManager.removeBlocks(e)}replaceBlocks(e,n){return this._blockManager.replaceBlocks(e,n)}undo(){return this._stateManager.undo()}redo(){return this._stateManager.redo()}insertInlineContent(e,{updateSelection:n=!1}={}){this._styleManager.insertInlineContent(e,{updateSelection:n})}getActiveStyles(){return this._styleManager.getActiveStyles()}addStyles(e){this._styleManager.addStyles(e)}removeStyles(e){this._styleManager.removeStyles(e)}toggleStyles(e){this._styleManager.toggleStyles(e)}getSelectedText(){return this._styleManager.getSelectedText()}getSelectedLinkUrl(){return this._styleManager.getSelectedLinkUrl()}createLink(e,n){this._styleManager.createLink(e,n)}canNestBlock(){return this._blockManager.canNestBlock()}nestBlock(){this._blockManager.nestBlock()}canUnnestBlock(){return this._blockManager.canUnnestBlock()}unnestBlock(){this._blockManager.unnestBlock()}moveBlocksUp(){return this._blockManager.moveBlocksUp()}moveBlocksDown(){return this._blockManager.moveBlocksDown()}blocksToHTMLLossy(e=this.document){return this._exportManager.blocksToHTMLLossy(e)}blocksToFullHTML(e=this.document){return this._exportManager.blocksToFullHTML(e)}tryParseHTMLToBlocks(e){return this._exportManager.tryParseHTMLToBlocks(e)}blocksToMarkdownLossy(e=this.document){return this._exportManager.blocksToMarkdownLossy(e)}tryParseMarkdownToBlocks(e){return this._exportManager.tryParseMarkdownToBlocks(e)}onChange(e,n){return this._eventManager.onChange(e,n)}onSelectionChange(e,n){return this._eventManager.onSelectionChange(e,n)}onMount(e){this._eventManager.onMount(e)}onUnmount(e){this._eventManager.onUnmount(e)}getSelectionBoundingBox(){return this._selectionManager.getSelectionBoundingBox()}get isEmpty(){const e=this.document;return e.length===0||e.length===1&&e[0].type==="paragraph"&&e[0].content.length===0}pasteHTML(e,n=!1){this._exportManager.pasteHTML(e,n)}pasteText(e){return this._exportManager.pasteText(e)}pasteMarkdown(e){return this._exportManager.pasteMarkdown(e)}}export{XD as $,zj as A,$j as B,iU as C,ue as D,Pp as E,Hj as F,PU as G,Vj as H,Nr as I,$T as J,JL as K,zw as L,Tn as M,Oj as N,ZD as O,me as P,Xl as Q,Kf as R,oh as S,R0 as T,Cn as U,bn as V,Zf as W,Pj as X,qj as Y,Bj as Z,Bp as _,pe as a,Fj as a0,Mj as a1,Lj as a2,yR as a3,zT as a4,re as b,x7 as c,Ee as d,aw as e,Mi as f,Ih as g,Pl as h,Nj as i,Hr as j,Uj as k,ye as l,sn as m,Zh as n,We as o,wE as p,AU as q,dr as r,rU as s,TU as t,Rj as u,sU as v,Vt as w,Fo as x,Ie as y,ah as z};
|