headroom-cms 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +282 -0
- package/admin/assets/AdminsPage-CnrQqwKA.js +1 -0
- package/admin/assets/AllContentPage-ByN1h3PP.js +1 -0
- package/admin/assets/ApiKeysPage-FgNHZPBS.js +1 -0
- package/admin/assets/AuditPage-DAPpo-sj.js +1 -0
- package/admin/assets/BlockEditor-CZTwex-o.js +179 -0
- package/admin/assets/BlockEditor-Cp_wZ2xN.css +1 -0
- package/admin/assets/BlockTypeEditPage-Buuwbx1P.js +1 -0
- package/admin/assets/BlockTypesPage-Dj0qmsqX.js +1 -0
- package/admin/assets/BulkActionBar-BMcUBJSH.js +1 -0
- package/admin/assets/CollectionEditPage-CLgQu2HS.js +1 -0
- package/admin/assets/CollectionsPage-BnCaxALz.js +1 -0
- package/admin/assets/ContentCreatePage-CJI326o-.js +1 -0
- package/admin/assets/ContentEditPage-A4i8P2Jd.js +3 -0
- package/admin/assets/ContentListPage-Bc4mBIkB.js +1 -0
- package/admin/assets/CustomBlockPreview-CCssn6vF.js +479 -0
- package/admin/assets/FieldBuilder-YJGSk0nY.js +3 -0
- package/admin/assets/LoginPage-Jrne8-Wr.js +1 -0
- package/admin/assets/MediaPage-DfPQBmNf.css +1 -0
- package/admin/assets/MediaPage-_qNXqsZg.js +1 -0
- package/admin/assets/SiteSettingsPage-CoZnavij.js +1 -0
- package/admin/assets/SitesPage-ETqFT3nO.js +1 -0
- package/admin/assets/TagsPage-BGpp0XZM.js +1 -0
- package/admin/assets/UsersPage-CKRJpAb6.js +1 -0
- package/admin/assets/WebhookEditPage-BOcLe5OJ.js +1 -0
- package/admin/assets/WebhooksPage-Czco583Y.js +1 -0
- package/admin/assets/badge-0Z1nL6DI.js +1 -0
- package/admin/assets/card-D1-S-QZ6.js +1 -0
- package/admin/assets/check-BGA0ADyt.js +1 -0
- package/admin/assets/checkbox-BPqrj_XS.js +1 -0
- package/admin/assets/command-ChD319uJ.js +1 -0
- package/admin/assets/contentStatus-DfWHjFVB.js +1 -0
- package/admin/assets/copy-BqH9rXYM.js +1 -0
- package/admin/assets/core.esm-Csvubn5Q.js +5 -0
- package/admin/assets/format-CZ9bpk32.js +1 -0
- package/admin/assets/index-DOqKbrpW.css +1 -0
- package/admin/assets/index-Ds50UTAc.js +18 -0
- package/admin/assets/lib-BrI1UB_t.js +38 -0
- package/admin/assets/media-url-DIg_vSyf.js +1 -0
- package/admin/assets/module-RjUF93sV.js +716 -0
- package/admin/assets/native-48B9X9Wg.js +1 -0
- package/admin/assets/plus-BgHSYWJN.js +1 -0
- package/admin/assets/radix-DQ3amgxj.js +51 -0
- package/admin/assets/react-vendor-DNVhVxD7.js +4 -0
- package/admin/assets/search-DIzcfCVh.js +1 -0
- package/admin/assets/select-CJXZv4wv.js +1 -0
- package/admin/assets/sortable.esm-Zh-9QRSf.js +1 -0
- package/admin/assets/table-B3EHrN_H.js +1 -0
- package/admin/assets/tanstack-BO6c-AOu.js +1 -0
- package/admin/assets/trash-2-Gny2Upn-.js +1 -0
- package/admin/assets/useAdminResolver-BsQc_N4z.js +1 -0
- package/admin/assets/useContent-CSobIico.js +1 -0
- package/admin/assets/useDebouncedValue-Bf8UizjU.js +1 -0
- package/admin/assets/useMedia-CQnmMz4N.js +1 -0
- package/admin/assets/useTags-CYqbj5cK.js +1 -0
- package/admin/assets/useWebhooks-DXgtQ3aU.js +1 -0
- package/admin/index.html +21 -0
- package/admin/vite.svg +1 -0
- package/dist/admin-site.d.ts +30 -0
- package/dist/admin-site.d.ts.map +1 -0
- package/dist/admin-site.js +80 -0
- package/dist/admin-site.js.map +1 -0
- package/dist/api.d.ts +26 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +91 -0
- package/dist/api.js.map +1 -0
- package/dist/auth.d.ts +27 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +86 -0
- package/dist/auth.js.map +1 -0
- package/dist/cdn.d.ts +27 -0
- package/dist/cdn.d.ts.map +1 -0
- package/dist/cdn.js +382 -0
- package/dist/cdn.js.map +1 -0
- package/dist/image.d.ts +21 -0
- package/dist/image.d.ts.map +1 -0
- package/dist/image.js +48 -0
- package/dist/image.js.map +1 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +124 -0
- package/dist/index.js.map +1 -0
- package/dist/storage.d.ts +21 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +125 -0
- package/dist/storage.js.map +1 -0
- package/dist/webhooks.d.ts +23 -0
- package/dist/webhooks.d.ts.map +1 -0
- package/dist/webhooks.js +91 -0
- package/dist/webhooks.js.map +1 -0
- package/lambda/api/bootstrap +0 -0
- package/lambda/api/resource.enc +0 -0
- package/lambda/functions/custom-message/index.mjs +112 -0
- package/lambda/functions/custom-message/resource.enc +1 -0
- package/lambda/image-lambda/index.mjs +188 -0
- package/lambda/image-lambda/node_modules/.package-lock.json +160 -0
- package/lambda/image-lambda/node_modules/@img/sharp-libvips-linux-arm64/README.md +46 -0
- package/lambda/image-lambda/node_modules/@img/sharp-libvips-linux-arm64/lib/glib-2.0/include/glibconfig.h +220 -0
- package/lambda/image-lambda/node_modules/@img/sharp-libvips-linux-arm64/lib/index.js +1 -0
- package/lambda/image-lambda/node_modules/@img/sharp-libvips-linux-arm64/lib/libvips-cpp.so.42 +0 -0
- package/lambda/image-lambda/node_modules/@img/sharp-libvips-linux-arm64/package.json +42 -0
- package/lambda/image-lambda/node_modules/@img/sharp-libvips-linux-arm64/versions.json +30 -0
- package/lambda/image-lambda/node_modules/@img/sharp-linux-arm64/LICENSE +191 -0
- package/lambda/image-lambda/node_modules/@img/sharp-linux-arm64/README.md +18 -0
- package/lambda/image-lambda/node_modules/@img/sharp-linux-arm64/lib/sharp-linux-arm64.node +0 -0
- package/lambda/image-lambda/node_modules/@img/sharp-linux-arm64/package.json +46 -0
- package/lambda/image-lambda/node_modules/color/LICENSE +21 -0
- package/lambda/image-lambda/node_modules/color/README.md +123 -0
- package/lambda/image-lambda/node_modules/color/index.js +496 -0
- package/lambda/image-lambda/node_modules/color/package.json +47 -0
- package/lambda/image-lambda/node_modules/color-convert/CHANGELOG.md +54 -0
- package/lambda/image-lambda/node_modules/color-convert/LICENSE +21 -0
- package/lambda/image-lambda/node_modules/color-convert/README.md +68 -0
- package/lambda/image-lambda/node_modules/color-convert/conversions.js +839 -0
- package/lambda/image-lambda/node_modules/color-convert/index.js +81 -0
- package/lambda/image-lambda/node_modules/color-convert/package.json +48 -0
- package/lambda/image-lambda/node_modules/color-convert/route.js +97 -0
- package/lambda/image-lambda/node_modules/color-name/LICENSE +8 -0
- package/lambda/image-lambda/node_modules/color-name/README.md +11 -0
- package/lambda/image-lambda/node_modules/color-name/index.js +152 -0
- package/lambda/image-lambda/node_modules/color-name/package.json +28 -0
- package/lambda/image-lambda/node_modules/color-string/LICENSE +21 -0
- package/lambda/image-lambda/node_modules/color-string/README.md +62 -0
- package/lambda/image-lambda/node_modules/color-string/index.js +242 -0
- package/lambda/image-lambda/node_modules/color-string/package.json +39 -0
- package/lambda/image-lambda/node_modules/detect-libc/LICENSE +201 -0
- package/lambda/image-lambda/node_modules/detect-libc/README.md +163 -0
- package/lambda/image-lambda/node_modules/detect-libc/index.d.ts +14 -0
- package/lambda/image-lambda/node_modules/detect-libc/lib/detect-libc.js +313 -0
- package/lambda/image-lambda/node_modules/detect-libc/lib/elf.js +39 -0
- package/lambda/image-lambda/node_modules/detect-libc/lib/filesystem.js +51 -0
- package/lambda/image-lambda/node_modules/detect-libc/lib/process.js +24 -0
- package/lambda/image-lambda/node_modules/detect-libc/package.json +44 -0
- package/lambda/image-lambda/node_modules/is-arrayish/LICENSE +21 -0
- package/lambda/image-lambda/node_modules/is-arrayish/README.md +16 -0
- package/lambda/image-lambda/node_modules/is-arrayish/index.js +9 -0
- package/lambda/image-lambda/node_modules/is-arrayish/package.json +45 -0
- package/lambda/image-lambda/node_modules/semver/LICENSE +15 -0
- package/lambda/image-lambda/node_modules/semver/README.md +665 -0
- package/lambda/image-lambda/node_modules/semver/bin/semver.js +191 -0
- package/lambda/image-lambda/node_modules/semver/classes/comparator.js +143 -0
- package/lambda/image-lambda/node_modules/semver/classes/index.js +7 -0
- package/lambda/image-lambda/node_modules/semver/classes/range.js +557 -0
- package/lambda/image-lambda/node_modules/semver/classes/semver.js +333 -0
- package/lambda/image-lambda/node_modules/semver/functions/clean.js +8 -0
- package/lambda/image-lambda/node_modules/semver/functions/cmp.js +54 -0
- package/lambda/image-lambda/node_modules/semver/functions/coerce.js +62 -0
- package/lambda/image-lambda/node_modules/semver/functions/compare-build.js +9 -0
- package/lambda/image-lambda/node_modules/semver/functions/compare-loose.js +5 -0
- package/lambda/image-lambda/node_modules/semver/functions/compare.js +7 -0
- package/lambda/image-lambda/node_modules/semver/functions/diff.js +60 -0
- package/lambda/image-lambda/node_modules/semver/functions/eq.js +5 -0
- package/lambda/image-lambda/node_modules/semver/functions/gt.js +5 -0
- package/lambda/image-lambda/node_modules/semver/functions/gte.js +5 -0
- package/lambda/image-lambda/node_modules/semver/functions/inc.js +21 -0
- package/lambda/image-lambda/node_modules/semver/functions/lt.js +5 -0
- package/lambda/image-lambda/node_modules/semver/functions/lte.js +5 -0
- package/lambda/image-lambda/node_modules/semver/functions/major.js +5 -0
- package/lambda/image-lambda/node_modules/semver/functions/minor.js +5 -0
- package/lambda/image-lambda/node_modules/semver/functions/neq.js +5 -0
- package/lambda/image-lambda/node_modules/semver/functions/parse.js +18 -0
- package/lambda/image-lambda/node_modules/semver/functions/patch.js +5 -0
- package/lambda/image-lambda/node_modules/semver/functions/prerelease.js +8 -0
- package/lambda/image-lambda/node_modules/semver/functions/rcompare.js +5 -0
- package/lambda/image-lambda/node_modules/semver/functions/rsort.js +5 -0
- package/lambda/image-lambda/node_modules/semver/functions/satisfies.js +12 -0
- package/lambda/image-lambda/node_modules/semver/functions/sort.js +5 -0
- package/lambda/image-lambda/node_modules/semver/functions/valid.js +8 -0
- package/lambda/image-lambda/node_modules/semver/index.js +91 -0
- package/lambda/image-lambda/node_modules/semver/internal/constants.js +37 -0
- package/lambda/image-lambda/node_modules/semver/internal/debug.js +11 -0
- package/lambda/image-lambda/node_modules/semver/internal/identifiers.js +29 -0
- package/lambda/image-lambda/node_modules/semver/internal/lrucache.js +42 -0
- package/lambda/image-lambda/node_modules/semver/internal/parse-options.js +17 -0
- package/lambda/image-lambda/node_modules/semver/internal/re.js +223 -0
- package/lambda/image-lambda/node_modules/semver/package.json +78 -0
- package/lambda/image-lambda/node_modules/semver/preload.js +4 -0
- package/lambda/image-lambda/node_modules/semver/range.bnf +16 -0
- package/lambda/image-lambda/node_modules/semver/ranges/gtr.js +6 -0
- package/lambda/image-lambda/node_modules/semver/ranges/intersects.js +9 -0
- package/lambda/image-lambda/node_modules/semver/ranges/ltr.js +6 -0
- package/lambda/image-lambda/node_modules/semver/ranges/max-satisfying.js +27 -0
- package/lambda/image-lambda/node_modules/semver/ranges/min-satisfying.js +26 -0
- package/lambda/image-lambda/node_modules/semver/ranges/min-version.js +63 -0
- package/lambda/image-lambda/node_modules/semver/ranges/outside.js +82 -0
- package/lambda/image-lambda/node_modules/semver/ranges/simplify.js +49 -0
- package/lambda/image-lambda/node_modules/semver/ranges/subset.js +249 -0
- package/lambda/image-lambda/node_modules/semver/ranges/to-comparators.js +10 -0
- package/lambda/image-lambda/node_modules/semver/ranges/valid.js +13 -0
- package/lambda/image-lambda/node_modules/sharp/LICENSE +191 -0
- package/lambda/image-lambda/node_modules/sharp/README.md +118 -0
- package/lambda/image-lambda/node_modules/sharp/install/check.js +41 -0
- package/lambda/image-lambda/node_modules/sharp/lib/channel.js +174 -0
- package/lambda/image-lambda/node_modules/sharp/lib/colour.js +180 -0
- package/lambda/image-lambda/node_modules/sharp/lib/composite.js +210 -0
- package/lambda/image-lambda/node_modules/sharp/lib/constructor.js +452 -0
- package/lambda/image-lambda/node_modules/sharp/lib/index.d.ts +1754 -0
- package/lambda/image-lambda/node_modules/sharp/lib/index.js +16 -0
- package/lambda/image-lambda/node_modules/sharp/lib/input.js +658 -0
- package/lambda/image-lambda/node_modules/sharp/lib/is.js +169 -0
- package/lambda/image-lambda/node_modules/sharp/lib/libvips.js +203 -0
- package/lambda/image-lambda/node_modules/sharp/lib/operation.js +958 -0
- package/lambda/image-lambda/node_modules/sharp/lib/output.js +1587 -0
- package/lambda/image-lambda/node_modules/sharp/lib/resize.js +587 -0
- package/lambda/image-lambda/node_modules/sharp/lib/sharp.js +114 -0
- package/lambda/image-lambda/node_modules/sharp/lib/utility.js +296 -0
- package/lambda/image-lambda/node_modules/sharp/package.json +222 -0
- package/lambda/image-lambda/node_modules/sharp/src/binding.gyp +280 -0
- package/lambda/image-lambda/node_modules/sharp/src/common.cc +1091 -0
- package/lambda/image-lambda/node_modules/sharp/src/common.h +393 -0
- package/lambda/image-lambda/node_modules/sharp/src/metadata.cc +320 -0
- package/lambda/image-lambda/node_modules/sharp/src/metadata.h +85 -0
- package/lambda/image-lambda/node_modules/sharp/src/operations.cc +475 -0
- package/lambda/image-lambda/node_modules/sharp/src/operations.h +125 -0
- package/lambda/image-lambda/node_modules/sharp/src/pipeline.cc +1758 -0
- package/lambda/image-lambda/node_modules/sharp/src/pipeline.h +393 -0
- package/lambda/image-lambda/node_modules/sharp/src/sharp.cc +40 -0
- package/lambda/image-lambda/node_modules/sharp/src/stats.cc +183 -0
- package/lambda/image-lambda/node_modules/sharp/src/stats.h +59 -0
- package/lambda/image-lambda/node_modules/sharp/src/utilities.cc +269 -0
- package/lambda/image-lambda/node_modules/sharp/src/utilities.h +19 -0
- package/lambda/image-lambda/node_modules/simple-swizzle/LICENSE +21 -0
- package/lambda/image-lambda/node_modules/simple-swizzle/README.md +43 -0
- package/lambda/image-lambda/node_modules/simple-swizzle/index.js +29 -0
- package/lambda/image-lambda/node_modules/simple-swizzle/package.json +36 -0
- package/lambda/webhook-worker/bootstrap +0 -0
- package/lambda/webhook-worker/resource.enc +0 -0
- package/package.json +50 -0
- package/src/admin-site.ts +108 -0
- package/src/api.ts +113 -0
- package/src/auth.ts +110 -0
- package/src/cdn.ts +449 -0
- package/src/image.ts +62 -0
- package/src/index.ts +216 -0
- package/src/sst-env.d.ts +143 -0
- package/src/storage.ts +138 -0
- package/src/webhooks.ts +114 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import{j as y}from"./tanstack-BO6c-AOu.js";import{g as gC,r as C,b as bC,a as o3,R as Ie,u as yC,e as i3}from"./react-vendor-DNVhVxD7.js";import{n as EC,_ as eu,ac as s3,ad as a3,ab as Vm,D as xC,i as CC,j as kC,k as TC,l as wC,C as SC,L as Sf,X as l3,I as vf,B as Sa,m as vC,F as c3}from"./index-Ds50UTAc.js";import{af as AC,ag as u3,ah as On,N as ki,ai as Af,aj as d3,ak as _f,al as f3,am as h3,an as p3,ao as m3,R as g3,ap as b3,aq as Dr,ar as Hi,as as Al,at as tu,au as y3,av as E3,aw as ip,ax as x3,u as C3,s as k3,w as T3,A as w3,t as S3,ay as v3,j as A3,L as _3,k as N3,i as I3,a3 as M3,a1 as O3,a2 as D3,a7 as L3,a8 as R3,a9 as P3,a5 as B3,a6 as F3,a0 as H3,X as U3,Z as V3,W as $3,T as j3,az as z3,aA as q3,aB as W3,b as G3,aC as Y3,I as K3,C as Q3,aD as X3,aE as Z3,a as J3,aa as eN,ab as tN}from"./radix-DQ3amgxj.js";import{h as kd,S as _C}from"./command-ChD319uJ.js";import{B as nN}from"./badge-0Z1nL6DI.js";import{M as rN,F as oN,C as iN}from"./ContentEditPage-A4i8P2Jd.js";import{m as sp}from"./media-url-DIg_vSyf.js";import{C as sN}from"./CustomBlockPreview-CCssn6vF.js";import"./search-DIzcfCVh.js";import"./useContent-CSobIico.js";import"./useAdminResolver-BsQc_N4z.js";import"./select-CJXZv4wv.js";import"./check-BGA0ADyt.js";import"./format-CZ9bpk32.js";import"./sortable.esm-Zh-9QRSf.js";import"./core.esm-Csvubn5Q.js";import"./card-D1-S-QZ6.js";import"./useMedia-CQnmMz4N.js";import"./useTags-CYqbj5cK.js";import"./useDebouncedValue-Bf8UizjU.js";import"./plus-BgHSYWJN.js";import"./checkbox-BPqrj_XS.js";import"./trash-2-Gny2Upn-.js";import"./contentStatus-DfWHjFVB.js";const aN=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],lN=EC("paperclip",aN);const cN=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],NC=EC("pencil",cN);function zt(t){this.content=t}zt.prototype={constructor:zt,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,o=r.find(t),i=r.content.slice();return o==-1?i.push(n||t,e):(i[o+1]=e,n&&(i[o]=n)),new zt(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new zt(n)},addToStart:function(t,e){return new zt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new zt(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),i=r.find(t);return o.splice(i==-1?o.length:i,0,e,n),new zt(o)},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=zt.from(t),t.size?new zt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=zt.from(t),t.size?new zt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=zt.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}};zt.from=function(t){if(t instanceof zt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new zt(e)};function IC(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){let s=IC(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function MC(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=t.child(--o),a=e.child(--i),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let c=0,u=Math.min(s.text.length,a.text.length);for(;c<u&&s.text[s.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let c=MC(s.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,o=0,i){for(let s=0,a=0;a<n;s++){let l=this.content[s],c=a+l.nodeSize;if(c>e&&r(l,o+a,i||null,s)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,o+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let i="",s=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new V(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let i=0,s=0;s<n;i++){let a=this.content[i],l=s+a.nodeSize;l>e&&((s<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),o+=a.nodeSize),s=l}return new V(r,o)}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 o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new V(o,i)}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 o=this.content[n];e(o,r,n),r+=o.nodeSize}}findDiffStart(e,n=0){return IC(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return MC(this,e,n,r)}findIndex(e){if(e==0)return Ql(0,e);if(e==this.size)return Ql(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 o=this.child(n),i=r+o.nodeSize;if(i>=e)return i==e?Ql(n+1,i):Ql(n,r);r=i}}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 new V(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return V.empty;let n,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(n||(n=e.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}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 Nf={index:0,offset:0};function Ql(t,e){return Nf.index=t,Nf.offset=e,Nf}function nu(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(!nu(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!nu(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Ze=class ap{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}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&&nu(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 o=r.create(n.attrs);return r.checkAttrs(o.attrs),o}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 ap.none;if(e instanceof ap)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};Ze.none=[];class ru extends Error{}class Q{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=DC(this.content,e+this.openStart,n);return r&&new Q(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Q(OC(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 Q.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Q(V.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new Q(e,r,o)}}Q.empty=new Q(V.empty,0,0);function OC(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(o==e||i.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(OC(i.content,e-o-1,n-o-1)))}function DC(t,e,n,r){let{index:o,offset:i}=t.findIndex(e),s=t.maybeChild(o);if(i==e||s.isText)return r&&!r.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=DC(s.content,e-i-1,n,s);return a&&t.replaceChild(o,s.copy(a))}function uN(t,e,n){if(n.openStart>t.depth)throw new ru("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new ru("Inconsistent open depths");return LC(t,e,n,0)}function LC(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let s=LC(t,e,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,a=s.content;return mi(s,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=dN(n,t);return mi(i,PC(t,s,a,e,r))}else return mi(i,ou(t,e,r))}function RC(t,e){if(!e.type.compatibleContent(t.type))throw new ru("Cannot join "+e.type.name+" onto "+t.type.name)}function lp(t,e,n){let r=t.node(n);return RC(r,e.node(n)),r}function pi(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 va(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(pi(t.nodeAfter,r),i++));for(let a=i;a<s;a++)pi(o.child(a),r);e&&e.depth==n&&e.textOffset&&pi(e.nodeBefore,r)}function mi(t,e){return t.type.checkContent(e),t.copy(e)}function PC(t,e,n,r,o){let i=t.depth>o&&lp(t,e,o+1),s=r.depth>o&&lp(n,r,o+1),a=[];return va(null,t,o,a),i&&s&&e.index(o)==n.index(o)?(RC(i,s),pi(mi(i,PC(t,e,n,r,o+1)),a)):(i&&pi(mi(i,ou(t,e,o+1)),a),va(e,n,o,a),s&&pi(mi(s,ou(n,r,o+1)),a)),va(r,null,o,a),new V(a)}function ou(t,e,n){let r=[];if(va(null,t,n,r),t.depth>n){let o=lp(t,e,n+1);pi(mi(o,ou(t,e,n+1)),r)}return va(e,null,n,r),new V(r)}function dN(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)o=e.node(i).copy(V.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}class Ka{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],o=e.child(n);return r?e.child(n).cut(r):o}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],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Ze.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),o=e.maybeChild(n);if(!r){let a=r;r=o,o=a}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].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 iu(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=[],o=0,i=n;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(i),c=i-l;if(r.push(s,a,o+l),!c||(s=s.child(a),s.isText))break;i=c-1,o+=l+1}return new Ka(n,r,i)}static resolveCached(e,n){let r=h1.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else h1.set(e,r=new fN);let o=r.elts[r.i]=Ka.resolve(e,n);return r.i=(r.i+1)%hN,o}}class fN{constructor(){this.elts=[],this.i=0}}const hN=12,h1=new WeakMap;class iu{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 pN=Object.create(null);let ao=class cp{constructor(e,n,r,o=Ze.none){this.type=e,this.attrs=n,this.marks=o,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,o=0){this.content.nodesBetween(e,n,r,o,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,o){return this.content.textBetween(e,n,r,o)}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&&nu(this.attrs,n||e.defaultAttrs||pN)&&Ze.sameSet(this.marks,r||Ze.none)}copy(e=null){return e==this.content?this:new cp(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new cp(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 Q.empty;let o=this.resolve(e),i=this.resolve(n),s=r?0:o.sharedDepth(n),a=o.start(s),c=o.node(s).content.cut(o.pos-a,i.pos-a);return new Q(c,o.depth-s,i.depth-s)}replace(e,n,r){return uN(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(o==e||n.isText)return n;e-=o+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 o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(e){return Ka.resolveCached(this,e)}resolveNoCache(e){return Ka.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}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()+")"),BC(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,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=o;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.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=Ze.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(!Ze.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 o=V.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,o,r);return i.type.checkAttrs(i.attrs),i}};ao.prototype.text=void 0;class su extends ao{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):BC(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 su(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new su(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 BC(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Ti{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new mN(e,n);if(r.next==null)return Ti.empty;let o=FC(r);r.next&&r.err("Unexpected trailing text");let i=kN(CN(o));return TN(i,r),i}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 o=this;for(let i=n;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}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 o=[this];function i(s,a){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return V.from(a.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=i(d,a.concat(u));if(f)return f}}return null}return i(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 o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let a=o;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:a,next:l}=i.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!o.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:o}),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 o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
|
|
2
|
+
`)}}Ti.empty=new Ti(!0);class mN{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 FC(t){let e=[];do e.push(gN(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function gN(t){let e=[];do e.push(bN(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function bN(t){let e=xN(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=yN(t,e);else break;return e}function p1(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function yN(t,e){let n=p1(t),r=n;return t.eat(",")&&(t.next!="}"?r=p1(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function EN(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.isInGroup(e)&&o.push(s)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function xN(t){if(t.eat("(")){let e=FC(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=EN(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 CN(t){let e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(s,a,l){let c={term:l,to:a};return e[s].push(c),c}function o(s,a){s.forEach(l=>l.to=a)}function i(s,a){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(i(c,a)),[]);if(s.type=="seq")for(let l=0;;l++){let c=i(s.exprs[l],a);if(l==s.exprs.length-1)return c;o(c,a=n())}else if(s.type=="star"){let l=n();return r(a,l),o(i(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return o(i(s.expr,a),l),o(i(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(i(s.expr,a));if(s.type=="range"){let l=a;for(let c=0;c<s.min;c++){let u=n();o(i(s.expr,l),u),l=u}if(s.max==-1)o(i(s.expr,l),l);else for(let c=s.min;c<s.max;c++){let u=n();r(l,u),o(i(s.expr,l),u),l=u}return[r(l)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function HC(t,e){return e-t}function m1(t,e){let n=[];return r(e),n.sort(HC);function r(o){let i=t[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let s=0;s<i.length;s++){let{term:a,to:l}=i[s];!a&&n.indexOf(l)==-1&&r(l)}}}function kN(t){let e=Object.create(null);return n(m1(t,0));function n(r){let o=[];r.forEach(s=>{t[s].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<o.length;u++)o[u][0]==a&&(c=o[u][1]);m1(t,l).forEach(u=>{c||o.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new Ti(r.indexOf(t.length-1)>-1);for(let s=0;s<o.length;s++){let a=o[s][1].sort(HC);i.next.push({type:o[s][0],next:e[a.join(",")]||n(a)})}return i}}function TN(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let a=0;a<o.next.length;a++){let{type:l,next:c}=o.next[a];s.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function UC(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 VC(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(o===void 0){let i=t[r];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function $C(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in t){let i=t[o];i.validate&&i.validate(e[o])}}function jC(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new SN(t,r,e[r]);return n}let g1=class zC{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=jC(e,r.attrs),this.defaultAttrs=UC(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==Ti.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:VC(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ao(this,this.computeAttrs(e),V.from(n),Ze.setFrom(r))}createChecked(e=null,n,r){return n=V.from(n),this.checkContent(n),new ao(this,this.computeAttrs(e),n,Ze.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=V.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let o=this.contentMatch.matchFragment(n),i=o&&o.fillBefore(V.empty,!0);return i?new ao(this,e,n.append(i),Ze.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){$C(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:Ze.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,s)=>r[i]=new zC(i,n,s));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function wN(t,e,n){let r=n.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class SN{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?wN(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Td{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=jC(e,o.attrs),this.excluded=null;let i=UC(this.attrs);this.instance=i?new Ze(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Ze(this,VC(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new Td(i,o++,n,s)),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){$C(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let qC=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in e)n[o]=e[o];n.nodes=zt.from(e.nodes),n.marks=zt.from(e.marks||{}),this.nodes=g1.compile(this.spec.nodes,this),this.marks=Td.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=Ti.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?b1(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:b1(this,s.split(" "))}this.nodeFromJSON=o=>ao.fromJSON(this,o),this.markFromJSON=o=>Ze.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof g1){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,o)}text(e,n){let r=this.nodes.text;return new su(r,r.defaultAttrs,e,Ze.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 b1(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(let a in t.marks){let l=t.marks[a];(o=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function vN(t){return t.tag!=null}function AN(t){return t.style!=null}let hr=class up{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(vN(o))this.tags.push(o);else if(AN(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new E1(this,n,!1);return r.addAll(e,Ze.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new E1(this,n,!0);return r.addAll(e,Ze.none,n.from,n.to),Q.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(IN(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],a=s.style;if(!(a.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<n.length;s++){let a=n[s];if((a.priority==null?50:a.priority)<i)break}n.splice(s,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=x1(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=x1(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new up(e,up.schemaRules(e)))}};const WC={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},_N={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},GC={ol:!0,ul:!0},Qa=1,dp=2,Aa=4;function y1(t,e,n){return e!=null?(e?Qa:0)|(e==="full"?dp:0):t&&t.whitespace=="pre"?Qa|dp:n&~Aa}class Xl{constructor(e,n,r,o,i,s){this.type=e,this.attrs=n,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=Ze.none,this.match=i||(s&Aa?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,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Qa)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[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&&!WC.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class E1{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,i,s=y1(null,n.preserveWhitespace,0)|(r?Aa:0);o?i=new Xl(o.type,o.attrs,Ze.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new Xl(null,null,Ze.none,!0,null,s):i=new Xl(e.schema.topNodeType,null,Ze.none,!0,null,s),this.nodes=[i],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,o=this.top,i=o.options&dp?"full":this.localPreserveWS||(o.options&Qa)>0,{schema:s}=this.parser;if(i==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
|
|
3
|
+
`);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(s.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(s.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=o.content[o.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(s.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let o=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),a;GC.hasOwnProperty(s)&&this.parser.normalizeLists&&NN(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:_N.hasOwnProperty(s))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(WC.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.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(i),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=o}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 o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(i,s,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,o){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);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)}i&&this.sync(a)&&this.open--}addAll(e,n,r,o){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,a=o==null?null:e.childNodes[o];s!=a;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n,r){let o,i;for(let s=this.open,a=0;s>=0;s--){let l=this.nodes[s],c=l.findWrapping(e);if(c&&(!o||o.length>c.length+a)&&(o=c,i=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!o)return null;this.sync(i);for(let s=0;s<o.length;s++)n=this.enterInner(o[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let o=this.findPlace(e,n,r);if(o){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=Ze.none;for(let a of o.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):C1(a.type,e.type))&&(s=a.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,n,r,o){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,o)),i}enterInner(e,n,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let a=y1(e,i,s.options);s.options&Aa&&s.content.length==0&&(a|=Aa);let l=Ze.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):C1(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Xl(e,n,l,o,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|=Qa)}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 o=r.length-1;o>=0;o--)e+=r[o].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 o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].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,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=i;l--)if(s(a-1,l))return!0;return!1}else{let u=l>0||l==0&&o?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return s(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 NN(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&GC.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function IN(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function x1(t){let e={};for(let n in t)e[n]=t[n];return e}function C1(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let i=[],s=a=>{i.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||i.indexOf(u)<0&&s(u))return!0}};if(s(o.contentMatch))return!0}}class Fn{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=If(n).createDocumentFragment());let o=r,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let a=0,l=0;for(;a<i.length&&l<s.marks.length;){let c=s.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(i[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<i.length;)o=i.pop()[1];for(;l<s.marks.length;){let c=s.marks[l++],u=this.serializeMark(c,s.isInline,n);u&&(i.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:o}=Oc(If(n),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,o)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&Oc(If(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return Oc(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Fn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=k1(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return k1(e.marks)}}function k1(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function If(t){return t.document||window.document}const T1=new WeakMap;function MN(t){let e=T1.get(t);return e===void 0&&T1.set(t,e=ON(t)),e}function ON(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 o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(t),e}function Oc(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let o=e[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=MN(r))&&i.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 s=o.indexOf(" ");s>0&&(n=o.slice(0,s),o=o.slice(s+1));let a,l=n?t.createElementNS(n,o):t.createElement(o),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 f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+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 f=e[d];if(f===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{let{dom:h,contentDOM:p}=Oc(t,f,n,r);if(l.appendChild(h),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const YC=65535,KC=Math.pow(2,16);function DN(t,e){return t+e*KC}function w1(t){return t&YC}function LN(t){return(t-(t&YC))/KC}const QC=1,XC=2,Dc=4,ZC=8;class fp{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&ZC)>0}get deletedBefore(){return(this.delInfo&(QC|Dc))>0}get deletedAfter(){return(this.delInfo&(XC|Dc))>0}get deletedAcross(){return(this.delInfo&Dc)>0}}class Dn{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Dn.empty)return Dn.empty}recover(e){let n=0,r=w1(e);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+LN(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 o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?o:0);if(l>e)break;let c=this.ranges[a+i],u=this.ranges[a+s],d=l+c;if(e<=d){let f=c?e==l?-1:e==d?1:n:n,h=l+o+(f<0?0:u);if(r)return h;let p=e==(n<0?l:d)?null:DN(a/3,e-l),g=e==l?XC:e==d?QC:Dc;return(n<0?e!=l:e!=d)&&(g|=ZC),new fp(h,g,p)}o+=u-c}return r?e+o:new fp(e+o,0,null)}touches(e,n){let r=0,o=w1(n),i=this.inverted?2:1,s=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+i],u=l+c;if(e<=u&&a==o*3)return!0;r+=this.ranges[a+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],a=s-(this.inverted?i:0),l=s+(this.inverted?0:i),c=this.ranges[o+n],u=this.ranges[o+r];e(a,a+c,l,l+u),i+=u-c}}invert(){return new Dn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Dn.empty:new Dn(e<0?[0,-e,0]:[0,0,e])}}Dn.empty=new Dn([]);class Ss{constructor(e,n,r=0,o=e?e.length:0){this.mirror=n,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Ss(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 o=e.getMirror(n);this.appendMap(e._maps[n],o!=null&&o<n?r+o: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 o=e.getMirror(n);this.appendMap(e._maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let e=new Ss;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 o=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],a=s.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,e=this._maps[l].recover(a.recover);continue}}o|=a.delInfo,e=a.pos}return r?e:new fp(e,o,null)}}const Mf=Object.create(null);class tn{getMap(){return Dn.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Mf[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 Mf)throw new RangeError("Duplicate use of step JSON ID "+e);return Mf[e]=n,n.prototype.jsonID=e,n}}class vt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new vt(e,null)}static fail(e){return new vt(null,e)}static fromReplace(e,n,r,o){try{return vt.ok(e.replace(n,r,o))}catch(i){if(i instanceof ru)return vt.fail(i.message);throw i}}}function $m(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let i=t.child(o);i.content.size&&(i=i.copy($m(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return V.fromArray(r)}class Mo extends tn{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),o=r.node(r.sharedDepth(this.to)),i=new Q($m(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return vt.fromReplace(e,this.from,this.to,i)}invert(){return new ur(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 Mo(n.pos,r.pos,this.mark)}merge(e){return e instanceof Mo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Mo(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 Mo(n.from,n.to,e.markFromJSON(n.mark))}}tn.jsonID("addMark",Mo);class ur extends tn{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 Q($m(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return vt.fromReplace(e,this.from,this.to,r)}invert(){return new Mo(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 ur(n.pos,r.pos,this.mark)}merge(e){return e instanceof ur&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ur(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 ur(n.from,n.to,e.markFromJSON(n.mark))}}tn.jsonID("removeMark",ur);class Oo extends tn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return vt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return vt.fromReplace(e,this.pos,this.pos+1,new Q(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 o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new Oo(this.pos,n.marks[o]);return new Oo(this.pos,this.mark)}}return new wi(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Oo(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 Oo(n.pos,e.markFromJSON(n.mark))}}tn.jsonID("addNodeMark",Oo);class wi extends tn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return vt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return vt.fromReplace(e,this.pos,this.pos+1,new Q(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 Oo(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new wi(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 wi(n.pos,e.markFromJSON(n.mark))}}tn.jsonID("removeNodeMark",wi);class St extends tn{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&hp(e,this.from,this.to)?vt.fail("Structure replace would overwrite content"):vt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Dn([this.from,this.to-this.from,this.slice.size])}invert(e){return new St(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new St(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof St)||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?Q.empty:new Q(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new St(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?Q.empty:new Q(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new St(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 St(n.from,n.to,Q.fromJSON(e,n.slice),!!n.structure)}}tn.jsonID("replace",St);class yt extends tn{constructor(e,n,r,o,i,s,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=a}apply(e){if(this.structure&&(hp(e,this.from,this.gapFrom)||hp(e,this.gapTo,this.to)))return vt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return vt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?vt.fromReplace(e,this.from,this.to,r):vt.fail("Content does not fit in gap")}getMap(){return new Dn([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 yt(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),o=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||i>r.pos?null:new yt(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,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 yt(n.from,n.to,n.gapFrom,n.gapTo,Q.fromJSON(e,n.slice),n.insert,!!n.structure)}}tn.jsonID("replaceAround",yt);function hp(t,e,n){let r=t.resolve(e),o=n-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function RN(t,e,n,r){let o=[],i=[],s,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 f=Math.max(c,e),h=Math.min(c+l.nodeSize,n),p=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(p)||(s&&s.to==f&&s.mark.eq(d[g])?s.to=h:o.push(s=new ur(f,h,d[g])));a&&a.to==f?a.to=h:i.push(a=new Mo(f,h,r))}}),o.forEach(l=>t.step(l)),i.forEach(l=>t.step(l))}function PN(t,e,n,r){let o=[],i=0;t.doc.nodesBetween(e,n,(s,a)=>{if(!s.isInline)return;i++;let l=null;if(r instanceof Td){let c=s.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let c=Math.min(a+s.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],f;for(let h=0;h<o.length;h++){let p=o[h];p.step==i-1&&d.eq(o[h].style)&&(f=p)}f?(f.to=c,f.step=i):o.push({style:d,from:Math.max(a,e),to:c,step:i})}}}),o.forEach(s=>t.step(new ur(s.from,s.to,s.style)))}function jm(t,e,n,r=n.contentMatch,o=!0){let i=t.doc.nodeAt(e),s=[],a=e+1;for(let l=0;l<i.childCount;l++){let c=i.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new St(a,u,Q.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new ur(a,u,c.marks[f]));if(o&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new Q(V.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new St(a+f.index,a+f.index+f[0].length,p))}}a=u}if(!r.validEnd){let l=r.fillBefore(V.empty,!0);t.replace(a,a,new Q(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function BN(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function $s(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,o=0,i=0;;--r){let s=t.$from.node(r),a=t.$from.index(r)+o,l=t.$to.indexAfter(r)-i;if(r<t.depth&&s.canReplace(a,l,n))return r;if(r==0||s.type.spec.isolating||!BN(s,a,l))break;a&&(o=1),l<s.childCount&&(i=1)}return null}function FN(t,e,n){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),a=o.after(i+1),l=s,c=a,u=V.empty,d=0;for(let p=i,g=!1;p>n;p--)g||r.index(p)>0?(g=!0,u=V.from(r.node(p).copy(u)),d++):l--;let f=V.empty,h=0;for(let p=i,g=!1;p>n;p--)g||o.after(p+1)<o.end(p)?(g=!0,f=V.from(o.node(p).copy(f)),h++):c++;t.step(new yt(l,c,s,a,new Q(u.append(f),d,h),u.size-d,!0))}function JC(t,e,n=null,r=t){let o=HN(t,e),i=o&&UN(r,e);return i?o.map(S1).concat({type:e,attrs:n}).concat(i.map(S1)):null}function S1(t){return{type:t,attrs:null}}function HN(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}function UN(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;l&&c<o;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:s}function VN(t,e,n){let r=V.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let a=n[s].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[s].type.create(n[s].attrs,r))}let o=e.start,i=e.end;t.step(new yt(o,i,o,i,new Q(r,0,0),n.length,!0))}function $N(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,a)=>{let l=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,l)&&jN(t.doc,t.mapping.slice(i).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&tk(t,s,a,i),jm(t,t.mapping.slice(i).map(a,1),r,void 0,c===null);let u=t.mapping.slice(i),d=u.map(a,1),f=u.map(a+s.nodeSize,1);return t.step(new yt(d,f,d+1,f-1,new Q(V.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&ek(t,s,a,i),!1}})}function ek(t,e,n,r){e.forEach((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let l=t.mapping.slice(r).map(n+1+i+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function tk(t,e,n,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
|
|
5
|
+
`))}})}function jN(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function zN(t,e,n,r,o){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new yt(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new Q(V.from(s),0,0),1,!0))}function lo(t,e,n=1,r){let o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>i;c--,u--){let d=o.node(c),f=o.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let g=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!g.type.validContent(h))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function qN(t,e,n=1,r){let o=t.doc.resolve(e),i=V.empty,s=V.empty;for(let a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){i=V.from(o.node(a).copy(i));let u=r&&r[c];s=V.from(u?u.type.create(u.attrs,s):o.node(a).copy(s))}t.step(new St(e,e,new Q(i.append(s),n,n),!0))}function Ui(t,e){let n=t.resolve(e),r=n.index();return nk(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function WN(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let o=0;o<e.childCount;o++){let i=e.child(o),s=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function nk(t,e){return!!(t&&e&&!t.isLeaf&&WN(t,e))}function wd(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let i,s,a=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),a++,s=r.node(o).maybeChild(a)):(i=r.node(o).maybeChild(a-1),s=r.node(o+1)),i&&!i.isTextblock&&nk(i,s)&&r.node(o).canReplace(a,a+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o)}}function GN(t,e,n){let r=null,{linebreakReplacement:o}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(o&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(o);u&&!d?r=!1:!u&&d&&(r=!0)}let a=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);tk(t,u.node(),u.before(),a)}s.inlineContent&&jm(t,e+n-1,s,i.node().contentMatchAt(i.index()),r==null);let l=t.mapping.slice(a),c=l.map(e-n);if(t.step(new St(c,l.map(e+n,-1),Q.empty,!0)),r===!0){let u=t.doc.resolve(c);ek(t,u.node(),u.before(),t.steps.length)}return t}function YN(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 o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,n))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function rk(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=r.depth;s>=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),c=r.node(s),u=!1;if(i==1)u=c.canReplace(l,l,o);else{let d=c.contentMatchAt(l).findWrapping(o.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function Sd(t,e,n=e,r=Q.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return ok(o,i,r)?new St(e,n,r):new KN(o,i,r).fit()}function ok(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class KN{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=V.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=V.from(e.node(o).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,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,a=o.depth;for(;s&&a&&i.childCount==1;)i=i.firstChild.content,s--,a--;let l=new Q(i,s,a);return e>-1?new yt(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new St(r.pos,o.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=Of(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(n==1&&(s?c.matchType(s.type)||(d=c.fillBefore(V.from(s),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:d};if(n==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=Of(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new Q(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=Of(e,n);if(o.childCount<=1&&n>0){let i=e.size-n<=n+o.size;this.unplaced=new Q(ya(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new Q(ya(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let s=this.unplaced,a=r?r.content:s.content,l=s.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[n];if(o){for(let g=0;g<o.childCount;g++)u.push(o.child(g));d=d.matchFragment(o)}let h=a.size+e-(s.content.size-s.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(ik(g.mark(f.allowedMarks(g.marks)),c==1?l:0,c==a.childCount?h:-1)))}let p=c==a.childCount;p||(h=-1),this.placed=Ea(this.placed,n,V.from(u)),this.frontier[n].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,b=a;g<h;g++){let E=b.lastChild;this.frontier.push({type:E.type,match:E.contentMatchAt(E.childCount)}),b=E.content}this.unplaced=p?e==0?Q.empty:new Q(ya(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new Q(ya(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Df(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,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=Df(e,n,o,r,i);if(s){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=Df(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:i?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=Ea(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=Ea(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=Ea(this.placed,this.frontier.length,n))}}function ya(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(ya(t.firstChild.content,e-1,n)))}function Ea(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Ea(t.lastChild.content,e-1,n)))}function Of(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function ik(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,ik(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 Df(t,e,n,r,o){let i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!QN(n,i.content,s)?a:null}function QN(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function XN(t){return t.spec.defining||t.spec.definingForContent}function ZN(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),i=t.doc.resolve(n);if(ok(o,i,r))return t.step(new St(e,n,r));let s=ak(o,i);s[s.length-1]==0&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let f=o.depth,h=o.pos-1;f>0;f--,h--){let p=o.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;s.indexOf(f)>-1?a=f:o.before(f)==h&&s.splice(1,0,-f)}let l=s.indexOf(a),c=[],u=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==r.openStart)break;f=p.content}for(let f=u-1;f>=0;f--){let h=c[f],p=XN(h.type);if(p&&!h.sameMarkup(o.node(Math.abs(a)-1)))u=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+u+1)%(r.openStart+1),p=c[h];if(p)for(let g=0;g<s.length;g++){let b=s[(g+l)%s.length],E=!0;b<0&&(E=!1,b=-b);let x=o.node(b-1),T=o.index(b-1);if(x.canReplaceWith(T,T,p.type,p.marks))return t.replace(o.before(b),E?i.after(b):n,new Q(sk(r.content,0,r.openStart,h),h,r.openEnd))}}let d=t.steps.length;for(let f=s.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let h=s[f];h<0||(e=o.before(h),n=i.after(h))}}function sk(t,e,n,r,o){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(sk(i.content,e+1,n,r,i)))}if(e>r){let i=o.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(V.empty,!0))}return t}function JN(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=YN(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new Q(V.from(r),0,0))}function eI(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),i=ak(r,o);for(let s=0;s<i.length;s++){let a=i[s],l=s==i.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),o.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),o.indexAfter(a-1))))return t.delete(r.before(a),o.after(a))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function ak(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let i=t.start(o);if(i<t.pos-(t.depth-o)||e.end(o)>e.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&n.push(o)}return n}class fs extends tn{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 vt.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return vt.fromReplace(e,this.pos,this.pos+1,new Q(V.from(o),0,n.isLeaf?0:1))}getMap(){return Dn.empty}invert(e){return new fs(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 fs(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 fs(n.pos,n.attr,n.value)}}tn.jsonID("attr",fs);class Xa extends tn{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return vt.ok(r)}getMap(){return Dn.empty}invert(e){return new Xa(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 Xa(n.attr,n.value)}}tn.jsonID("docAttr",Xa);let vs=class extends Error{};vs=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};vs.prototype=Object.create(Error.prototype);vs.prototype.constructor=vs;vs.prototype.name="TransformError";class zm{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ss}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new vs(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 o=this.mapping.maps[r];r&&(e=o.map(e,1),n=o.map(n,-1)),o.forEach((i,s,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=Q.empty){let o=Sd(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new Q(V.from(r),0,0))}delete(e,n){return this.replace(e,n,Q.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return ZN(this,e,n,r),this}replaceRangeWith(e,n,r){return JN(this,e,n,r),this}deleteRange(e,n){return eI(this,e,n),this}lift(e,n){return FN(this,e,n),this}join(e,n=1){return GN(this,e,n),this}wrap(e,n){return VN(this,e,n),this}setBlockType(e,n=e,r,o=null){return $N(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return zN(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new fs(e,n,r)),this}setDocAttribute(e,n){return this.step(new Xa(e,n)),this}addNodeMark(e,n){return this.step(new Oo(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 Ze)n.isInSet(r.marks)&&this.step(new wi(e,n));else{let o=r.marks,i,s=[];for(;i=n.isInSet(o);)s.push(new wi(e,i)),o=i.removeFromSet(o);for(let a=s.length-1;a>=0;a--)this.step(s[a])}return this}split(e,n=1,r){return qN(this,e,n,r),this}addMark(e,n,r){return RN(this,e,n,r),this}removeMark(e,n,r){return PN(this,e,n,r),this}clearIncompatible(e,n,r){return jm(this,e,n,r),this}}const Lf=Object.create(null);class me{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new lk(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=Q.empty){let r=n.content.lastChild,o=null;for(let a=0;a<n.openEnd;a++)o=r,r=r.lastChild;let i=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:c}=s[a],u=e.mapping.slice(i);e.replaceRange(u.map(l.pos),u.map(c.pos),a?Q.empty:n),a==0&&_1(e,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:s,$to:a}=o[i],l=e.mapping.slice(r),c=l.map(s.pos),u=l.map(a.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),_1(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new ae(e):ts(e.node(0),e.parent,e.pos,e.index(),n,r);if(o)return o;for(let i=e.depth-1;i>=0;i--){let s=n<0?ts(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):ts(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Tn(e.node(0))}static atStart(e){return ts(e,e,0,0,1)||new Tn(e)}static atEnd(e){return ts(e,e,e.content.size,e.childCount,-1)||new Tn(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Lf[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 Lf)throw new RangeError("Duplicate use of selection JSON ID "+e);return Lf[e]=n,n.prototype.jsonID=e,n}getBookmark(){return ae.between(this.$anchor,this.$head).getBookmark()}}me.prototype.visible=!0;class lk{constructor(e,n){this.$from=e,this.$to=n}}let v1=!1;function A1(t){!v1&&!t.parent.inlineContent&&(v1=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class ae extends me{constructor(e,n=e){A1(e),A1(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 me.near(r);let o=e.resolve(n.map(this.anchor));return new ae(o.parent.inlineContent?o:r,r)}replace(e,n=Q.empty){if(super.replace(e,n),n==Q.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ae&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new vd(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 ae(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let o=e.resolve(n);return new this(o,r==n?o:e.resolve(r))}static between(e,n,r){let o=e.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let i=me.findFrom(n,r,!0)||me.findFrom(n,-r,!0);if(i)n=i.$head;else return me.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(me.findFrom(e,-r,!0)||me.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new ae(e,n)}}me.jsonID("text",ae);class vd{constructor(e,n){this.anchor=e,this.head=n}map(e){return new vd(e.map(this.anchor),e.map(this.head))}resolve(e){return ae.between(e.resolve(this.anchor),e.resolve(this.head))}}class le extends me{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:o}=n.mapResult(this.anchor),i=e.resolve(o);return r?me.near(i):new le(i)}content(){return new Q(V.from(this.node),0,0)}eq(e){return e instanceof le&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new qm(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new le(e.resolve(n.anchor))}static create(e,n){return new le(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}le.prototype.visible=!1;me.jsonID("node",le);class qm{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new vd(r,r):new qm(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&le.isSelectable(r)?new le(n):me.near(n)}}class Tn extends me{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=Q.empty){if(n==Q.empty){e.delete(0,e.doc.content.size);let r=me.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Tn(e)}map(e){return new Tn(e)}eq(e){return e instanceof Tn}getBookmark(){return tI}}me.jsonID("all",Tn);const tI={map(){return this},resolve(t){return new Tn(t)}};function ts(t,e,n,r,o,i=!1){if(e.inlineContent)return ae.create(t,n);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let a=e.child(s);if(a.isAtom){if(!i&&le.isSelectable(a))return le.create(t,n-(o<0?a.nodeSize:0))}else{let l=ts(t,a,n+o,o<0?a.childCount:0,o,i);if(l)return l}n+=a.nodeSize*o}return null}function _1(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof St||o instanceof yt))return;let i=t.mapping.maps[r],s;i.forEach((a,l,c,u)=>{s==null&&(s=u)}),t.setSelection(me.near(t.doc.resolve(s),n))}const N1=1,Zl=2,I1=4;let nI=class extends zm{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|N1)&~Zl,this.storedMarks=null,this}get selectionSet(){return(this.updated&N1)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Zl,this}ensureMarks(e){return Ze.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&Zl)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Zl,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)||Ze.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let o=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(me.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|=I1,this}get scrolledIntoView(){return(this.updated&I1)>0}};function M1(t,e){return!e||!t?t:t.bind(e)}class xa{constructor(e,n,r){this.name=e,this.init=M1(n.init,r),this.apply=M1(n.apply,r)}}const rI=[new xa("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new xa("selection",{init(t,e){return t.selection||me.atStart(e.doc)},apply(t){return t.selection}}),new xa("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new xa("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Rf{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=rI.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 xa(r.key,r.spec.state,r))})}}class ls{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 o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let l=o?o[s].n:0,c=o?o[s].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<s?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),i=!0}o&&(o[s]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new ls(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new nI(this)}static create(e){let n=new Rf(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new ls(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(e,r);return r}reconfigure(e){let n=new Rf(this.schema,e.plugins),r=n.fields,o=new ls(n);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(e,o)}return o}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 o=e[r],i=o.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(o,this[o.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 o=new Rf(e.schema,e.plugins),i=new ls(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=ao.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=me.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.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==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[s.name]=c.fromJSON.call(l,e,n[a],i);return}}i[s.name]=s.init(e,i)}}),i}}function ck(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=ck(o,e,{})),n[r]=o}return n}class ye{constructor(e){this.spec=e,this.props={},e.props&&ck(e.props,this,this.props),this.key=e.key?e.key.key:uk("plugin")}getState(e){return e[this.key]}}const Pf=Object.create(null);function uk(t){return t in Pf?t+"$"+ ++Pf[t]:(Pf[t]=0,t+"$")}class Oe{constructor(e="key"){this.key=uk(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const qt=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},As=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let pp=null;const ro=function(t,e,n){let r=pp||(pp=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},oI=function(){pp=null},Si=function(t,e,n,r){return n&&(O1(t,e,n,r,-1)||O1(t,e,n,r,1))},iI=/^(img|br|input|textarea|hr)$/i;function O1(t,e,n,r,o){for(var i;;){if(t==n&&e==r)return!0;if(e==(o<0?0:Gn(t))){let s=t.parentNode;if(!s||s.nodeType!=1||_l(t)||iI.test(t.nodeName)||t.contentEditable=="false")return!1;e=qt(t)+(o<0?0:1),t=s}else if(t.nodeType==1){let s=t.childNodes[e+(o<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=o;else return!1;else t=s,e=o<0?Gn(t):0}else return!1}}function Gn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function sI(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=Gn(t)}else if(t.parentNode&&!_l(t))e=qt(t),t=t.parentNode;else return null}}function aI(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&&!_l(t))e=qt(t)+1,t=t.parentNode;else return null}}function lI(t,e,n){for(let r=e==0,o=e==Gn(t);r||o;){if(t==n)return!0;let i=qt(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,o=o&&i==Gn(t)}}function _l(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 Ad=function(t){return t.focusNode&&Si(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function ai(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function cI(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function uI(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Gn(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Gn(r.startContainer),r.startOffset)}}}const Pr=typeof navigator<"u"?navigator:null,D1=typeof document<"u"?document:null,Zo=Pr&&Pr.userAgent||"",mp=/Edge\/(\d+)/.exec(Zo),dk=/MSIE \d/.exec(Zo),gp=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Zo),wn=!!(dk||gp||mp),Fo=dk?document.documentMode:gp?+gp[1]:mp?+mp[1]:0,Qn=!wn&&/gecko\/(\d+)/i.test(Zo);Qn&&+(/Firefox\/(\d+)/.exec(Zo)||[0,0])[1];const bp=!wn&&/Chrome\/(\d+)/.exec(Zo),Gt=!!bp,fk=bp?+bp[1]:0,Jt=!wn&&!!Pr&&/Apple Computer/.test(Pr.vendor),_s=Jt&&(/Mobile\/\w+/.test(Zo)||!!Pr&&Pr.maxTouchPoints>2),zn=_s||(Pr?/Mac/.test(Pr.platform):!1),hk=Pr?/Win/.test(Pr.platform):!1,io=/Android \d/.test(Zo),Nl=!!D1&&"webkitFontSmoothing"in D1.documentElement.style,dI=Nl?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function fI(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 Yr(t,e){return typeof t=="number"?t:t[e]}function hI(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 L1(t,e,n){let r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=As(s);continue}let a=s,l=a==i.body,c=l?fI(i):hI(a),u=0,d=0;if(e.top<c.top+Yr(r,"top")?d=-(c.top-e.top+Yr(o,"top")):e.bottom>c.bottom-Yr(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+Yr(o,"top")-c.top:e.bottom-c.bottom+Yr(o,"bottom")),e.left<c.left+Yr(r,"left")?u=-(c.left-e.left+Yr(o,"left")):e.right>c.right-Yr(r,"right")&&(u=e.right-c.right+Yr(o,"right")),u||d)if(l)i.defaultView.scrollBy(u,d);else{let h=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let g=a.scrollLeft-h,b=a.scrollTop-p;e={left:e.left-g,top:e.top-b,right:e.right-g,bottom:e.bottom-b}}let f=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(f))break;s=f=="absolute"?s.offsetParent:As(s)}}function pI(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let a=t.root.elementFromPoint(i,s);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,o=l.top;break}}return{refDOM:r,refTop:o,stack:pk(t.dom)}}function pk(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=As(r));return e}function mI({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;mk(n,r==0?0:r-e)}function mk(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:o,left:i}=t[n];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Yi=null;function gI(t){if(t.setActive)return t.setActive();if(Yi)return t.focus(Yi);let e=pk(t);t.focus(Yi==null?{get preventScroll(){return Yi={preventScroll:!0},!0}}:void 0),Yi||(Yi=!1,mk(e,0))}function gk(t,e){let n,r=2e8,o,i=0,s=e.top,a=e.top,l,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=ro(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=s&&p.bottom>=a){s=Math.max(p.bottom,s),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,o=g&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&g&&(i=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)&&(i=d+1)}}return!n&&l&&(n=l,o=c,r=0),n&&n.nodeType==3?bI(n,o):!n||r&&n.nodeType==1?{node:t,offset:i}:gk(n,o)}function bI(t,e){let n=t.nodeValue.length,r=document.createRange(),o;for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let s=xo(r,1);if(s.top!=s.bottom&&Wm(e,s)){o={node:t,offset:i+(e.left>=(s.left+s.right)/2?1:0)};break}}return r.detach(),o||{node:t,offset:0}}function Wm(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function yI(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function EI(t,e,n){let{node:r,offset:o}=gk(e,n),i=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,o,i)}function xI(t,e,n,r){let o=-1;for(let i=e,s=!1;i!=t.dom;){let a=t.docView.nearestDesc(i,!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)&&(!s&&l.left>r.left||l.top>r.top?o=a.posBefore:(!s&&l.right<r.left||l.bottom<r.top)&&(o=a.posAfter),s=!0),!a.contentDOM&&o<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;i=a.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n,-1)}function bk(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let s=t.childNodes[i];if(s.nodeType==1){let a=s.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(Wm(e,c))return bk(s,e,c)}}if((i=(i+1)%r)==o)break}return t}function CI(t,e){let n=t.dom.ownerDocument,r,o=0,i=uI(n,e.left,e.top);i&&({node:r,offset:o}=i);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=t.dom.getBoundingClientRect();if(!Wm(e,c)||(s=bk(t.dom,e,c),!s))return null}if(Jt)for(let c=s;r&&c;c=As(c))c.draggable&&(r=void 0);if(s=yI(s,e),r){if(Qn&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&o++}let c;Nl&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==t.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(a=xI(t,r,o,e))}a==null&&(a=EI(t,s,e));let l=t.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function R1(t){return t.top<t.bottom||t.left<t.right}function xo(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(R1(r))return r}return Array.prototype.find.call(n,R1)||t.getBoundingClientRect()}const kI=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function yk(t,e,n){let{node:r,offset:o,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=Nl||Qn;if(r.nodeType==3)if(s&&(kI.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let l=xo(ro(r,o,o),n);if(Qn&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=xo(ro(r,o-1,o-1),-1);if(c.top==l.top){let u=xo(ro(r,o,o+1),-1);if(u.top!=l.top)return ia(u,u.left<c.left)}}return l}else{let l=o,c=o,u=n<0?1:-1;return n<0&&!o?(c++,u=-1):n>=0&&o==r.nodeValue.length?(l--,u=1):n<0?l--:c++,ia(xo(ro(r,l,c),u),u<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(n<0||o==Gn(r))){let l=r.childNodes[o-1];if(l.nodeType==1)return Bf(l.getBoundingClientRect(),!1)}if(i==null&&o<Gn(r)){let l=r.childNodes[o];if(l.nodeType==1)return Bf(l.getBoundingClientRect(),!0)}return Bf(r.getBoundingClientRect(),n>=0)}if(i==null&&o&&(n<0||o==Gn(r))){let l=r.childNodes[o-1],c=l.nodeType==3?ro(l,Gn(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return ia(xo(c,1),!1)}if(i==null&&o<Gn(r)){let l=r.childNodes[o];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?ro(l,0,s?0:1):l.nodeType==1?l:null:null;if(c)return ia(xo(c,-1),!0)}return ia(xo(r.nodeType==3?ro(r):r,-n),n>=0)}function ia(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 Bf(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 Ek(t,e,n){let r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}function TI(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return Ek(t,e,()=>{let{node:i}=t.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let s=yk(t,o.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=ro(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"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const wI=/[\u0590-\u08ac]/;function SI(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=t.domSelection();return a?!wI.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:s:Ek(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:g}=t.domSelectionRange(),b=p&&!h.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 f!=null&&(a.caretBidiLevel=f),b}):r.pos==r.start()||r.pos==r.end()}let P1=null,B1=null,F1=!1;function vI(t,e,n){return P1==e&&B1==n?F1:(P1=e,B1=n,F1=n=="up"||n=="down"?TI(t,e,n):SI(t,e,n))}const Xn=0,H1=1,ci=2,Br=3;class Il{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=Xn,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 o=this.children[n];if(o==e)return r;r+=o.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 i,s;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=n>qt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!n||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return i}}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 o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],i=r+o.size;if(r==e&&i!=r){for(;!o.border&&o.children.length;)for(let s=0;s<o.children.length;s++){let a=o.children[s];if(a.size){o=a;break}}return o}if(e<i)return o.descAt(e-r-o.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],a=i+s.size;if(a>e||s instanceof Ck){o=e-i;break}i=a}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof xk&&i.side>=0;r--);if(n<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?qt(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?qt(i.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 o=-1,i=-1;for(let s=r,a=0;;a++){let l=this.children[a],c=s+l.size;if(o==-1&&e<=c){let u=s+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=s;for(let d=a;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){o=qt(f.dom)+1;break}e-=f.size}o==-1&&(o=0)}if(o>-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)){i=qt(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:n,fromOffset:o,toOffset:i}}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,o=!1){let i=Math.min(e,n),s=Math.max(e,n);for(let h=0,p=0;h<this.children.length;h++){let g=this.children[h],b=p+g.size;if(i>p&&s<b)return g.setSelection(e-p-g.border,n-p-g.border,r,o);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((Qn||Jt)&&e==n){let{node:h,offset:p}=a;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
|
|
6
|
+
`),d&&p==h.nodeValue.length)for(let g=h,b;g;g=g.parentNode){if(b=g.nextSibling){b.nodeName=="BR"&&(a=l={node:b.parentNode,offset:qt(b)+1});break}let E=g.pmViewDesc;if(E&&E.node&&E.node.isBlock)break}}else{let g=h.childNodes[p-1];d=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(Qn&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(o=!0)}if(!(o||d&&Jt)&&Si(a.node,a.offset,u.anchorNode,u.anchorOffset)&&Si(l.node,l.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==n)&&!(d&&Qn)){c.collapse(a.node,a.offset);try{e!=n&&c.extend(l.node,l.offset),f=!0}catch{}}if(!f){if(e>n){let p=a;a=l,l=p}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(h)}}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,o=0;o<this.children.length;o++){let i=this.children[o],s=r+i.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let a=r+i.border,l=s-i.border;if(e>=a&&n<=l){this.dirty=e==r||n==s?ci:H1,e==a&&n==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Br:i.markDirty(e-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?ci:Br}r=s}this.dirty=ci}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?ci:H1;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class xk extends Il{constructor(e,n,r,o){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==Xn&&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 AI extends Il{constructor(e,n,r,o){super(e,[],n,null),this.textDOM=r,this.text=o}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 vi extends Il{constructor(e,n,r,o,i){super(e,[],r,o),this.mark=n,this.spec=i}static create(e,n,r,o){let i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return(!s||!s.dom)&&(s=Fn.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new vi(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Br||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Br&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Xn){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Xn}}slice(e,n,r){let o=vi.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=Ep(i,n,s,r)),e>0&&(i=Ep(i,0,e,r));for(let a=0;a<i.length;a++)i[a].parent=o;return o.children=i,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Ho extends Il{constructor(e,n,r,o,i,s,a,l,c){super(e,[],i,s),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=a}static create(e,n,r,o,i,s){let a=i.nodeViews[n.type.name],l,c=a&&a(n,i,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,o),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}=Fn.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 f=u;return u=wk(u,r,n),c?l=new _I(e,n,r,o,u,d||null,f,c,i,s+1):n.isText?new _d(e,n,r,o,u,f,i):new Ho(e,n,r,o,u,d||null,f,i,s+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==Xn&&e.eq(this.node)&&au(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,o=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new II(this,s&&s.node,e);DI(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?Ze.none:this.node.child(u).marks,r,e,u),l.placeWidget(c,e,o)},(c,u,d,f)=>{l.syncToMarks(c.marks,r,e,f);let h;l.findNodeMatch(c,u,d,f)||a&&e.state.selection.from>o&&e.state.selection.to<o+c.nodeSize&&(h=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(c,u,d,h,e)||l.updateNextNode(c,u,d,e,f,o)||l.addNode(c,u,d,e,o),o+=c.nodeSize}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==ci)&&(s&&this.protectLocalComposition(e,s),kk(this.contentDOM,this.children,e),_s&&LI(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof ae)||r<n||o>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,a=RI(this.node.content,s,r-n,o-n);return a<0?null:{node:i,pos:a,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new AI(this,i,n,o);e.input.compositionNodes.push(s),this.children=Ep(this.children,r,r+o.length,e,s)}update(e,n,r,o){return this.dirty==Br||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,o),!0)}updateInner(e,n,r,o){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=Xn}updateOuterDeco(e){if(au(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Tk(this.dom,this.nodeDOM,yp(this.outerDeco,this.node,n),yp(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 U1(t,e,n,r,o){wk(r,e,t);let i=new Ho(void 0,t,e,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class _d extends Ho{constructor(e,n,r,o,i,s,a){super(e,n,r,o,i,null,s,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,o){return this.dirty==Br||this.dirty!=Xn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Xn||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=Xn,!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 o=this.node.cut(e,n),i=document.createTextNode(o.text);return new _d(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Br)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Ck extends Il{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Xn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class _I extends Ho{constructor(e,n,r,o,i,s,a,l,c,u){super(e,n,r,o,i,s,a,c,u),this.spec=l}update(e,n,r,o){if(this.dirty==Br)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,o),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,o)}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 kk(t,e,n){let r=t.firstChild,o=!1;for(let i=0;i<e.length;i++){let s=e[i],a=s.dom;if(a.parentNode==t){for(;a!=r;)r=V1(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(a,r);if(s instanceof vi){let l=r?r.previousSibling:t.lastChild;kk(s.contentDOM,s.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=V1(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}const _a=function(t){t&&(this.nodeName=t)};_a.prototype=Object.create(null);const ui=[new _a];function yp(t,e,n){if(t.length==0)return ui;let r=n?ui[0]:new _a,o=[r];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&o.push(r=new _a(s.nodeName));for(let a in s){let l=s[a];l!=null&&(n&&o.length==1&&o.push(r=new _a(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 o}function Tk(t,e,n,r){if(n==ui&&r==ui)return e;let o=e;for(let i=0;i<r.length;i++){let s=r[i],a=n[i];if(i){let l;a&&a.nodeName==s.nodeName&&o!=t&&(l=o.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(o),a=ui[0]),o=l}NI(o,a||ui[0],s)}return o}function NI(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):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&t.classList.add(o[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)t.style.removeProperty(o[1])}n.style&&(t.style.cssText+=n.style)}}function wk(t,e,n){return Tk(t,t,ui,yp(e,n,t.nodeType!=1))}function au(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 V1(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class II{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=MI(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,o){let i=0,s=this.stack.length>>1,a=Math.min(s,e.length);for(;i<a&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=Xn,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let l=-1,c=this.top.children.length;o<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[s])&&!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=vi.create(this.top,e[s],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))i=this.top.children.indexOf(s,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)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,o,i){let s=this.top.children[o];return s.dirty==Br&&s.dom==s.contentDOM&&(s.dirty=ci),s.update(e,n,r,i)?(this.destroyBetween(this.index,o),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 o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}e=n}}updateNextNode(e,n,r,o,i,s){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Ho){let c=this.preMatch.matched.get(l);if(c!=null&&c!=i)return!1;let u=l.dom,d,f=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Br&&au(n,l.outerDeco));if(!f&&l.update(e,n,r,o))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(l,e,n,r,o,s)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=ci,d.updateChildren(o,s+1),d.dirty=Xn),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,o,i,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!au(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let a=Ho.create(this.top,n,r,o,i,s);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,o,i){let s=Ho.create(this.top,e,n,r,o,i);s.contentDOM&&s.updateChildren(o,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let i=new xk(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof vi;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof _d)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Jt||Gt)&&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 o=new Ck(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function MI(t,e){let n=e,r=n.children.length,o=t.childCount,i=new Map,s=[];e:for(;o>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof vi)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(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}function OI(t,e){return t.type.side-e.type.side}function DI(t,e,n,r){let o=e.locals(t),i=0;if(o.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,o,e.forChild(i,u),c),i+=u.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let u,d;for(;s<o.length&&o[s].to==i;){let b=o[s++];b.widget&&(u?(d||(d=[u])).push(b):u=b)}if(u)if(d){d.sort(OI);for(let b=0;b<d.length;b++)n(d[b],c,!!l)}else n(u,c,!!l);let f,h;if(l)h=-1,f=l,l=null;else if(c<t.childCount)h=c,f=t.child(c++);else break;for(let b=0;b<a.length;b++)a[b].to<=i&&a.splice(b--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);let p=i+f.nodeSize;if(f.isText){let b=p;s<o.length&&o[s].from<b&&(b=o[s].from);for(let E=0;E<a.length;E++)a[E].to<b&&(b=a[E].to);b<p&&(l=f.cut(b-i),f=f.cut(0,b-i),p=b,h=-1)}else for(;s<o.length&&o[s].to<p;)s++;let g=f.isInline&&!f.isLeaf?a.filter(b=>!b.inline):a.slice();r(f,g,e.forChild(i,f),h),i=p}}function LI(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 RI(t,e,n,r){for(let o=0,i=0;o<t.childCount&&i<=r;){let s=t.child(o++),a=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;o<t.childCount;){let c=t.child(o++);if(i+=c.nodeSize,!c.isText)break;l+=c.text}if(i>=n){if(i>=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 Ep(t,e,n,r,o){let i=[];for(let s=0,a=0;s<t.length;s++){let l=t[s],c=a,u=a+=l.size;c>=n||u<=e?i.push(l):(c<e&&i.push(l.slice(0,e-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function Gm(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),i=o&&o.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,c;if(Ad(n)){for(l=s;o&&!o.node;)o=o.parent;let d=o.node;if(o&&d.isAtom&&le.isSelectable(d)&&o.parent&&!(d.isInline&&lI(n.focusNode,n.focusOffset,o.dom))){let f=o.posBefore;c=new le(s==f?a:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,f=s;for(let h=0;h<n.rangeCount;h++){let p=n.getRangeAt(h);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[l,s]=f==t.state.selection.anchor?[f,d]:[d,f],a=r.resolve(s)}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&&!i?1:-1;c=Ym(t,u,a,d)}return c}function Sk(t){return t.editable?t.hasFocus():Ak(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function co(t,e=!1){let n=t.state.selection;if(vk(t,n),!!Sk(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Gt){let r=t.domSelectionRange(),o=t.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&Si(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)BI(t);else{let{anchor:r,head:o}=n,i,s;$1&&!(n instanceof ae)&&(n.$from.parent.inlineContent||(i=j1(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=j1(t,n.to))),t.docView.setSelection(r,o,t,e),$1&&(i&&z1(i),s&&z1(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&PI(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const $1=Jt||Gt&&fk<63;function j1(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(Jt&&o&&o.contentEditable=="false")return Ff(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return Ff(o);if(i)return Ff(i)}}function Ff(t){return t.contentEditable="true",Jt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function z1(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function PI(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Sk(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function BI(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,qt(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&wn&&Fo<=11&&(n.disabled=!0,n.disabled=!1)}function vk(t,e){if(e instanceof le){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(q1(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else q1(t)}function q1(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Ym(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||ae.between(e,n,r)}function W1(t){return t.editable&&!t.hasFocus()?!1:Ak(t)}function Ak(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 FI(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Si(e.node,e.offset,n.anchorNode,n.anchorOffset)}function xp(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return i&&me.findFrom(i,e)}function To(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function G1(t,e,n){let r=t.state.selection;if(r instanceof ae)if(n.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return To(t,new ae(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=xp(t.state,e);return o&&o instanceof le?To(t,o):!1}else if(!(zn&&n.indexOf("m")>-1)){let o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let a=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=t.docView.descAt(a))&&!s.contentDOM?le.isSelectable(i)?To(t,new le(e<0?t.state.doc.resolve(o.pos-i.nodeSize):o)):Nl?To(t,new ae(t.state.doc.resolve(e<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof le&&r.node.isInline)return To(t,new ae(e>0?r.$to:r.$from));{let o=xp(t.state,e);return o?To(t,o):!1}}}function lu(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Na(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Ki(t,e){return e<0?HI(t):UI(t)}function HI(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,i,s=!1;for(Qn&&n.nodeType==1&&r<lu(n)&&Na(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Na(a,-1))o=n,i=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(_k(n))break;{let a=n.previousSibling;for(;a&&Na(a,-1);)o=n.parentNode,i=qt(a),a=a.previousSibling;if(a)n=a,r=lu(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?Cp(t,n,r):o&&Cp(t,o,i)}function UI(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=lu(n),i,s;for(;;)if(r<o){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Na(a,1))i=n,s=++r;else break}else{if(_k(n))break;{let a=n.nextSibling;for(;a&&Na(a,1);)i=a.parentNode,s=qt(a)+1,a=a.nextSibling;if(a)n=a,r=0,o=lu(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}i&&Cp(t,i,s)}function _k(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function VI(t,e){for(;t&&e==t.childNodes.length&&!_l(t);)e=qt(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 $I(t,e){for(;t&&!e&&!_l(t);)e=qt(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 Cp(t,e,n){if(e.nodeType!=3){let i,s;(s=VI(e,n))?(e=s,n=0):(i=$I(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Ad(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:o}=t;setTimeout(()=>{t.state==o&&co(t)},50)}function Y1(t,e){let n=t.state.doc.resolve(e);if(!(Gt||hk)&&n.parent.inlineContent){let o=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left<o.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left>o.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function K1(t,e,n){let r=t.state.selection;if(r instanceof ae&&!r.empty||n.indexOf("s")>-1||zn&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=xp(t.state,e);if(s&&s instanceof le)return To(t,s)}if(!o.parent.inlineContent){let s=e<0?o:i,a=r instanceof Tn?me.near(s,e):me.findFrom(s,e);return a?To(t,a):!1}return!1}function Q1(t,e){if(!(t.state.selection instanceof ae))return!0;let{$head:n,$anchor:r,empty:o}=t.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return!1}function X1(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function jI(t){if(!Jt||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;X1(t,r,"true"),setTimeout(()=>X1(t,r,"false"),20)}return!1}function zI(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function qI(t,e){let n=e.keyCode,r=zI(e);if(n==8||zn&&n==72&&r=="c")return Q1(t,-1)||Ki(t,-1);if(n==46&&!e.shiftKey||zn&&n==68&&r=="c")return Q1(t,1)||Ki(t,1);if(n==13||n==27)return!0;if(n==37||zn&&n==66&&r=="c"){let o=n==37?Y1(t,t.state.selection.from)=="ltr"?-1:1:-1;return G1(t,o,r)||Ki(t,o)}else if(n==39||zn&&n==70&&r=="c"){let o=n==39?Y1(t,t.state.selection.from)=="ltr"?1:-1:1;return G1(t,o,r)||Ki(t,o)}else{if(n==38||zn&&n==80&&r=="c")return K1(t,-1,r)||Ki(t,-1);if(n==40||zn&&n==78&&r=="c")return jI(t)||K1(t,1,r)||Ki(t,1);if(r==(zn?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Km(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let s=t.someProp("clipboardSerializer")||Fn.fromSchema(t.state.schema),a=Lk(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Dk[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=a.createElement(u[h]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
|
|
7
|
+
|
|
8
|
+
`);return{dom:l,text:f,slice:e}}function Nk(t,e,n,r,o){let i=o.parent.type.spec.code,s,a;if(!n&&!e)return null;let l=!!e&&(r||i||!n);if(l){if(t.someProp("transformPastedText",f=>{e=f(e,i||r,t)}),i)return a=new Q(V.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
9
|
+
`))),0,0),t.someProp("transformPasted",f=>{a=f(a,t,!0)}),a;let d=t.someProp("clipboardTextParser",f=>f(e,o,r,t));if(d)a=d;else{let f=o.marks(),{schema:h}=t.state,p=Fn.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let b=s.appendChild(document.createElement("p"));g&&b.appendChild(p.serializeNode(h.text(g,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=KI(n),Nl&&QI(s);let c=s&&s.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 f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||hr.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||u),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!WI.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=XI(Z1(a,+u[1],+u[2]),u[4]);else if(a=Q.maxOpen(GI(a.content,o),!0),a.openStart||a.openEnd){let d=0,f=0;for(let h=a.content.firstChild;d<a.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=a.content.lastChild;f<a.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);a=Z1(a,d,f)}return t.someProp("transformPasted",d=>{a=d(a,t,l)}),a}const WI=/^(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 GI(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.index(n)),i,s=[];if(t.forEach(a=>{if(!s)return;let l=o.findWrapping(a.type),c;if(!l)return s=null;if(c=s.length&&i.length&&Mk(l,i,a,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=Ok(s[s.length-1],i.length));let u=Ik(a,l);s.push(u),o=o.matchType(u.type),i=l}}),s)return V.from(s)}return t}function Ik(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,V.from(t));return t}function Mk(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let i=Mk(t,e,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(V.from(Ik(n,t,o+1))))}}function Ok(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Ok(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(V.empty,!0);return t.copy(n.append(r))}function kp(t,e,n,r,o,i){let s=e<0?t.firstChild:t.lastChild,a=s.content;return t.childCount>1&&(i=0),o<r-1&&(a=kp(a,e,n,r,o+1,i)),o>=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(V.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function Z1(t,e,n){return e<t.openStart&&(t=new Q(kp(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new Q(kp(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Dk={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 J1=null;function Lk(){return J1||(J1=document.implementation.createHTMLDocument("title"))}let Hf=null;function YI(t){let e=window.trustedTypes;return e?(Hf||(Hf=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Hf.createHTML(t)):t}function KI(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Lk().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&Dk[r[1].toLowerCase()])&&(t=o.map(i=>"<"+i+">").join("")+t+o.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=YI(t),o)for(let i=0;i<o.length;i++)n=n.querySelector(o[i])||n;return n}function QI(t){let e=t.querySelectorAll(Gt?"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 XI(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:o,openStart:i,openEnd:s}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;o=V.from(l.create(r[a+1],o)),i++,s++}return new Q(o,i,s)}const ln={},cn={},ZI={touchstart:!0,touchmove:!0};class JI{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 eM(t){for(let e in ln){let n=ln[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{nM(t,r)&&!Qm(t,r)&&(t.editable||!(r.type in cn))&&n(t,r)},ZI[e]?{passive:!0}:void 0)}Jt&&t.dom.addEventListener("input",()=>null),Tp(t)}function Do(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function tM(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 Tp(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Qm(t,r))})}function Qm(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function nM(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 rM(t,e){!Qm(t,e)&&ln[e.type]&&(t.editable||!(e.type in cn))&&ln[e.type](t,e)}cn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Pk(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(io&&Gt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),_s&&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",o=>o(t,ai(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||qI(t,n)?n.preventDefault():Do(t,"key")};cn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};cn.keypress=(t,e)=>{let n=e;if(Pk(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||zn&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof ae)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,o,i))&&t.dispatch(i()),n.preventDefault()}};function Nd(t){return{left:t.clientX,top:t.clientY}}function oM(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Xm(t,e,n,r,o){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,a=>s>i.depth?a(t,n,i.nodeAfter,i.before(s),o,!0):a(t,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function hs(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 iM(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&le.isSelectable(r)?(hs(t,new le(n)),!0):!1}function sM(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof le&&(r=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s);if(le.isSelectable(a)){r&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?o=i.before(n.$from.depth):o=i.before(s);break}}return o!=null?(hs(t,le.create(t.state.doc,o)),!0):!1}function aM(t,e,n,r,o){return Xm(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(o?sM(t,n):iM(t,n))}function lM(t,e,n,r){return Xm(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function cM(t,e,n,r){return Xm(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||uM(t,n,r)}function uM(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(hs(t,ae.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),a=o.before(i);if(s.inlineContent)hs(t,ae.create(r,a+1,a+1+s.content.size));else if(le.isSelectable(s))hs(t,le.create(r,a));else continue;return!0}}function Zm(t){return cu(t)}const Rk=zn?"metaKey":"ctrlKey";ln.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Zm(t),o=Date.now(),i="singleClick";o-t.input.lastClick.time<500&&oM(n,t.input.lastClick)&&!n[Rk]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=t.posAtCoords(Nd(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new dM(t,s,n,!!r)):(i=="doubleClick"?lM:cM)(t,s.pos,s.inside,n)?n.preventDefault():Do(t,"pointer"))};class dM{constructor(e,n,r,o){this.view=e,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Rk],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);i=u.parent,s=u.depth?u.before():0}const a=o?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&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof le&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Qn&&!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)),Do(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(()=>co(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(Nd(e))),this.updateAllowDefault(e),this.allowDefault||!n?Do(this.view,"pointer"):aM(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Jt&&this.mightDrag&&!this.mightDrag.node.isAtom||Gt&&!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)?(hs(this.view,me.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Do(this.view,"pointer")}move(e){this.updateAllowDefault(e),Do(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)}}ln.touchstart=t=>{t.input.lastTouch=Date.now(),Zm(t),Do(t,"pointer")};ln.touchmove=t=>{t.input.lastTouch=Date.now(),Do(t,"pointer")};ln.contextmenu=t=>Zm(t);function Pk(t,e){return t.composing?!0:Jt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const fM=io?5e3:-1;cn.compositionstart=cn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof ae&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Gt&&hk&&hM(t)))t.markCursor=t.state.storedMarks||n.marks(),cu(t,!0),t.markCursor=null;else if(cu(t,!e.selection.empty),Qn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){let a=t.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else o=s,i=-1}}t.input.composing=!0}Bk(t,fM)};function hM(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"}cn.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++,Bk(t,20))};function Bk(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>cu(t),e))}function Fk(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=mM());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function pM(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=sI(e.focusNode,e.focusOffset),r=aI(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function mM(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function cu(t,e=!1){if(!(io&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Fk(t),e||t.docView&&t.docView.dirty){let n=Gm(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 gM(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(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Za=wn&&Fo<15||_s&&dI<604;ln.copy=cn.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let i=Za?null:n.clipboardData,s=r.content(),{dom:a,text:l}=Km(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):gM(t,a),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function bM(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function yM(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 o=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Ja(t,r.value,null,o,e):Ja(t,r.textContent,r.innerHTML,o,e)},50)}function Ja(t,e,n,r,o){let i=Nk(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,o,i||Q.empty)))return!0;if(!i)return!1;let s=bM(i),a=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(i);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Hk(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," "):""}cn.paste=(t,e)=>{let n=e;if(t.composing&&!io)return;let r=Za?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Ja(t,Hk(r),r.getData("text/html"),o,n)?n.preventDefault():yM(t,n)};class Uk{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const EM=zn?"altKey":"ctrlKey";function Vk(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[EM]}ln.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,i=o.empty?null:t.posAtCoords(Nd(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof le?o.to-1:o.to))){if(r&&r.mightDrag)s=le.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&&(s=le.create(t.state.doc,d.posBefore))}}let a=(s||t.state.selection).content(),{dom:l,text:c,slice:u}=Km(t,a);(!n.dataTransfer.files.length||!Gt||fk>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Za?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Za||n.dataTransfer.setData("text/plain",c),t.dragging=new Uk(u,Vk(t,n),s)};ln.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};cn.dragover=cn.dragenter=(t,e)=>e.preventDefault();cn.drop=(t,e)=>{try{xM(t,e,t.dragging)}finally{t.dragging=null}};function xM(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Nd(e));if(!r)return;let o=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",h=>{i=h(i,t,!1)}):i=Nk(t,Hk(e.dataTransfer),Za?null:e.dataTransfer.getData("text/html"),!1,o);let s=!!(n&&Vk(t,e));if(t.someProp("handleDrop",h=>h(t,e,i||Q.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let a=i?rk(t.state.doc,o.pos,i):o.pos;a==null&&(a=o.pos);let l=t.state.tr;if(s){let{node:h}=n;h?h.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,d=l.doc;if(u?l.replaceRangeWith(c,c,i.content.firstChild):l.replaceRange(c,c,i),l.doc.eq(d))return;let f=l.doc.resolve(c);if(u&&le.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new le(f));else{let h=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((p,g,b,E)=>h=E),l.setSelection(Ym(t,f,l.doc.resolve(h)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}ln.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())&&co(t)},20))};ln.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)};ln.beforeinput=(t,e)=>{if(Gt&&io&&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",i=>i(t,ai(8,"Backspace")))))return;let{$cursor:o}=t.state.selection;o&&o.pos>0&&t.dispatch(t.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let t in cn)ln[t]=cn[t];function el(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 uu{constructor(e,n){this.toDOM=e,this.spec=n||gi,this.side=this.spec.side||0}map(e,n,r,o){let{pos:i,deleted:s}=e.mapResult(n.from+o,this.side<0?-1:1);return s?null:new je(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof uu&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&el(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Uo{constructor(e,n){this.attrs=e,this.spec=n||gi}map(e,n,r,o){let i=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new je(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Uo&&el(this.attrs,e.attrs)&&el(this.spec,e.spec)}static is(e){return e.type instanceof Uo}destroy(){}}class Jm{constructor(e,n){this.attrs=e,this.spec=n||gi}map(e,n,r,o){let i=e.mapResult(n.from+o,1);if(i.deleted)return null;let s=e.mapResult(n.to+o,-1);return s.deleted||s.pos<=i.pos?null:new je(i.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:o}=e.content.findIndex(n.from),i;return o==n.from&&!(i=e.child(r)).isText&&o+i.nodeSize==n.to}eq(e){return this==e||e instanceof Jm&&el(this.attrs,e.attrs)&&el(this.spec,e.spec)}destroy(){}}class je{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new je(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 je(e,e,new uu(n,r))}static inline(e,n,r,o){return new je(e,n,new Uo(r,o))}static node(e,n,r,o){return new je(e,n,new Jm(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof Uo}get widget(){return this.type instanceof uu}}const ns=[],gi={};class ke{constructor(e,n){this.local=e.length?e:ns,this.children=n.length?n:ns}static create(e,n){return n.length?du(n,e,0,gi):Qt}find(e,n,r){let o=[];return this.findInner(e??0,n??1e9,o,0,r),o}findInner(e,n,r,o,i){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=n&&a.to>=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+o,a.to+o))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let a=this.children[s]+1;this.children[s+2].findInner(e-a,n-a,r,o+a,i)}}map(e,n,r){return this==Qt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||gi)}mapInner(e,n,r,o,i){let s;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,o);l&&l.type.valid(n,l)?(s||(s=[])).push(l):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?CM(this.children,s||[],e,n,r,o,i):s?new ke(s.sort(bi),ns):Qt}add(e,n){return n.length?this==Qt?ke.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let o,i=0;e.forEach((a,l)=>{let c=l+r,u;if(u=jk(n,a,c)){for(o||(o=this.children.slice());i<o.length&&o[i]<l;)i+=3;o[i]==l?o[i+2]=o[i+2].addInner(a,u,c+1):o.splice(i,0,l,l+a.nodeSize,du(u,a,c+1,gi)),i+=3}});let s=$k(i?zk(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new ke(s.length?this.local.concat(s).sort(bi):this.local,o||this.children)}remove(e){return e.length==0||this==Qt?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,a=r[i]+n,l=r[i+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>a&&d.to<l&&(e[u]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(s,a+1);c!=Qt?r[i+2]=c:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let a=0;a<o.length;a++)o[a].eq(s,n)&&(o==this.local&&(o=this.local.slice()),o.splice(a--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new ke(o,r):Qt}forChild(e,n){if(this==Qt)return this;if(n.isLeaf)return ke.empty;let r,o;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 i=e+1,s=i+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<s&&l.to>i&&l.type instanceof Uo){let c=Math.max(i,l.from)-i,u=Math.min(s,l.to)-i;c<u&&(o||(o=[])).push(l.copy(c,u))}}if(o){let a=new ke(o.sort(bi),ns);return r?new vo([a,r]):a}return r||Qt}eq(e){if(this==e)return!0;if(!(e instanceof ke)||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 eg(this.localsInner(e))}localsInner(e){if(this==Qt)return ns;if(e.inlineContent||!this.local.some(Uo.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Uo||n.push(this.local[r]);return n}forEachSet(e){e(this)}}ke.empty=new ke([],[]);ke.removeOverlap=eg;const Qt=ke.empty;class vo{constructor(e){this.members=e}map(e,n){const r=this.members.map(o=>o.map(e,n,gi));return vo.from(r)}forChild(e,n){if(n.isLeaf)return ke.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(e,n);i!=Qt&&(i instanceof vo?r=r.concat(i.members):r.push(i))}return vo.from(r)}eq(e){if(!(e instanceof vo)||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 o=0;o<this.members.length;o++){let i=this.members[o].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?eg(r?n:n.sort(bi)):ns}static from(e){switch(e.length){case 0:return Qt;case 1:return e[0];default:return new vo(e.every(n=>n instanceof ke)?e:e.reduce((n,r)=>n.concat(r instanceof ke?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function CM(t,e,n,r,o,i,s){let a=t.slice();for(let c=0,u=i;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,h,p,g)=>{let b=g-p-(h-f);for(let E=0;E<a.length;E+=3){let x=a[E+1];if(x<0||f>x+u-d)continue;let T=a[E]+u-d;h>=T?a[E+1]=f<=T?-2:-1:f>=u&&b&&(a[E]+=b,a[E+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]+i),d=u-o;if(d<0||d>=r.content.size){l=!0;continue}let f=n.map(t[c+1]+i,-1),h=f-o,{index:p,offset:g}=r.content.findIndex(d),b=r.maybeChild(p);if(b&&g==d&&g+b.nodeSize==h){let E=a[c+2].mapInner(n,b,u+1,t[c]+i+1,s);E!=Qt?(a[c]=d,a[c+1]=h,a[c+2]=E):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=kM(a,t,e,n,o,i,s),u=du(c,r,0,s);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,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<a.length&&a[f]<h;)f+=3;a.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new ke(e.sort(bi),a)}function $k(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new je(o.from+e,o.to+e,o.type))}return n}function kM(t,e,n,r,o,i,s){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,o,c);d?n.push(d):s.onRemove&&s.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]+i+1);return n}function jk(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),t[i]=null);return o}function zk(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function du(t,e,n,r){let o=[],i=!1;e.forEach((a,l)=>{let c=jk(t,a,l+n);if(c){i=!0;let u=du(c,a,n+l+1,r);u!=Qt&&o.push(l,l+a.nodeSize,u)}});let s=$k(i?zk(t):t,-n).sort(bi);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new ke(s,o):Qt}function bi(t,e){return t.from-e.from||t.to-e.to}function eg(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let i=e[o];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),eb(e,o+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),eb(e,o,r.copy(i.from,r.to)));break}}}return e}function eb(t,e,n){for(;e<t.length&&bi(n,t[e])>0;)e++;t.splice(e,0,n)}function Uf(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Qt&&e.push(r)}),t.cursorWrapper&&e.push(ke.create(t.state.doc,[t.cursorWrapper.deco])),vo.from(e)}const TM={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},wM=wn&&Fo<=11;class SM{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 vM{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new SM,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);wn&&Fo<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():Jt&&e.composing&&r.some(o=>o.type=="childList"&&o.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),wM&&(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,TM)),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(W1(this.view)){if(this.suppressingSelectionUpdates)return co(this.view);if(wn&&Fo<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Si(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 i=e.focusNode;i;i=As(i))n.add(i);for(let i=e.anchorNode;i;i=As(i))if(n.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.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(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&W1(e)&&!this.ignoreSelectionChange(r),i=-1,s=-1,a=!1,l=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],l);d&&(i=i<0?d.from:Math.min(d.from,i),s=s<0?d.to:Math.max(d.to,s),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;d&&d.nodeType==1&&d.contentEditable=="false"&&u.parentNode.removeChild(u)}}else if(Qn&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||NM(e,d)!=h)&&f.remove()}}}let c=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ad(r)&&(c=Gm(e))&&c.eq(me.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,co(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,s),AM(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,IM(e,l)),this.handleDOMChange(i,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||co(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 o=e.previousSibling,i=e.nextSibling;if(wn&&Fo<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(o=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let s=o&&o.parentNode==e.target?qt(o)+1:0,a=r.localPosFromDOM(e.target,s,-1),l=i&&i.parentNode==e.target?qt(i):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 tb=new WeakMap,nb=!1;function AM(t){if(!tb.has(t)&&(tb.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Qn,nb)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."),nb=!0}}function rb(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return Si(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function _M(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return rb(t,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?rb(t,n):null}function NM(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 IM(t,e){var n;let{focusNode:r,focusOffset:o}=t.domSelectionRange();for(let i of e)if(((n=i.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let s=i.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let a=s;for(;;){let l=a.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;a=l}a.insertBefore(i,a.firstChild),r==i&&t.domSelection().collapse(i,o)}else i.parentNode.removeChild(i)}}function MM(t,e,n){let{node:r,fromOffset:o,toOffset:i,from:s,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}],Ad(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Gt&&t.input.lastKeyCode===8)for(let b=i;b>o;b--){let E=r.childNodes[b-1],x=E.pmViewDesc;if(E.nodeName=="BR"&&!x){i=b;break}if(!x||x.size)break}let d=t.state.doc,f=t.someProp("domParser")||hr.fromSchema(t.state.schema),h=d.resolve(s),p=null,g=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:o,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:OM,context:h});if(c&&c[0].pos!=null){let b=c[0].pos,E=c[1]&&c[1].pos;E==null&&(E=b),p={anchor:b+s,head:E+s}}return{doc:g,sel:p,from:s,to:a}}function OM(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Jt&&/^(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||Jt&&/^(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 DM=/^(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 LM(t,e,n,r,o){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let R=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,j=Gm(t,R);if(j&&!t.state.selection.eq(j)){if(Gt&&io&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",I=>I(t,ai(13,"Enter"))))return;let z=t.state.tr.setSelection(j);R=="pointer"?z.setMeta("pointer",!0):R=="key"&&z.scrollIntoView(),i&&z.setMeta("composition",i),t.dispatch(z)}return}let s=t.state.doc.resolve(e),a=s.sharedDepth(n);e=s.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,c=MM(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),f,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,h="end"):(f=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let p=BM(d.content,c.doc.content,c.from,f,h);if(p&&t.input.domChangeCount++,(_s&&t.input.lastIOSEnter>Date.now()-225||io)&&o.some(R=>R.nodeType==1&&!DM.test(R.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",R=>R(t,ai(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof ae&&!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 R=ob(t,t.state.doc,c.sel);if(R&&!R.eq(t.state.selection)){let j=t.state.tr.setSelection(R);i&&j.setMeta("composition",i),t.dispatch(j)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof ae&&(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)),wn&&Fo<=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),E=u.resolve(p.start),x=g.sameParent(b)&&g.parent.inlineContent&&E.end()>=p.endA;if((_s&&t.input.lastIOSEnter>Date.now()-225&&(!x||o.some(R=>R.nodeName=="DIV"||R.nodeName=="P"))||!x&&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",R=>R(t,ai(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&PM(u,p.start,p.endA,g,b)&&t.someProp("handleKeyDown",R=>R(t,ai(8,"Backspace")))){io&&Gt&&t.domObserver.suppressSelectionUpdates();return}Gt&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),io&&!x&&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(R){return R(t,ai(13,"Enter"))})},20));let T=p.start,D=p.endA,O=R=>{let j=R||t.state.tr.replace(T,D,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let z=ob(t,j.doc,c.sel);z&&!(Gt&&t.composing&&z.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(z.head==T||z.head==j.mapping.map(D)-1)||wn&&z.empty&&z.head==T)&&j.setSelection(z)}return i&&j.setMeta("composition",i),j.scrollIntoView()},v;if(x)if(g.pos==b.pos){wn&&Fo<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>co(t),20));let R=O(t.state.tr.delete(T,D)),j=u.resolve(p.start).marksAcross(u.resolve(p.endA));j&&R.ensureMarks(j),t.dispatch(R)}else if(p.endA==p.endB&&(v=RM(g.parent.content.cut(g.parentOffset,b.parentOffset),E.parent.content.cut(E.parentOffset,p.endA-E.start())))){let R=O(t.state.tr);v.type=="add"?R.addMark(T,D,v.mark):R.removeMark(T,D,v.mark),t.dispatch(R)}else if(g.parent.child(g.index()).isText&&g.index()==b.index()-(b.textOffset?0:1)){let R=g.parent.textBetween(g.parentOffset,b.parentOffset),j=()=>O(t.state.tr.insertText(R,T,D));t.someProp("handleTextInput",z=>z(t,T,D,R,j))||t.dispatch(j())}else t.dispatch(O());else t.dispatch(O())}function ob(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Ym(t,e.resolve(n.anchor),e.resolve(n.head))}function RM(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,i=r,s,a,l;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(o.length==1&&i.length==0)a=o[0],s="add",l=u=>u.mark(a.addToSet(u.marks));else if(o.length==0&&i.length==1)a=i[0],s="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:s}}function PM(t,e,n,r,o){if(n-e<=o.pos-r.pos||Vf(r,!0,!1)<o.pos)return!1;let i=t.resolve(e);if(!r.parent.isTextblock){let a=i.nodeAfter;return a!=null&&n==e+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(Vf(i,!0,!0));return!s.parent.isTextblock||s.pos>n||Vf(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Vf(t,e,n){let r=t.depth,o=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function BM(t,e,n,r,o){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(o=="end"){let l=Math.max(0,i-Math.min(s,a));r-=s+l-i}if(s<i&&t.size<e.size){let l=r<=i&&r>=s?i-r:0;i-=l,i&&i<e.size&&ib(e.textBetween(i-1,i+1))&&(i+=l?1:-1),a=i+(a-s),s=i}else if(a<i){let l=r<=i&&r>=a?i-r:0;i-=l,i&&i<t.size&&ib(t.textBetween(i-1,i+1))&&(i+=l?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}function ib(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 qk{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 JI,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(ub),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=lb(this),ab(this),this.nodeViews=cb(this),this.docView=U1(this.state.doc,sb(this),Uf(this),this.dom,this),this.domObserver=new vM(this,(r,o,i,s)=>LM(this,r,o,i,s)),this.domObserver.start(),eM(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&&Tp(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ub),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 o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(Fk(this),s=!0),this.state=e;let a=o.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=cb(this);HM(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Tp(this),this.editable=lb(this),ab(this);let l=Uf(this),c=sb(this),u=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,c,l);(d||!e.selection.eq(o.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&pI(this);if(s){this.domObserver.stop();let h=d&&(wn||Gt)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&FM(o.selection,e.selection);if(d){let p=Gt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=pM(this)),(i||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=U1(e.doc,c,l,this.dom,this)),p&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&FI(this))?co(this,h):(vk(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&mI(f)}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 le){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&L1(this,n.getBoundingClientRect(),e)}else L1(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,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new Uk(e.slice,e.move,o<0?void 0:le.create(this.state.doc,o))}someProp(e,n){let r=this._props&&this._props[e],o;if(r!=null&&(o=n?n(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[e];if(a!=null&&(o=n?n(a):a))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let a=i[s].props[e];if(a!=null&&(o=n?n(a):a))return o}}hasFocus(){if(wn){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&&gI(this.dom),co(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 CI(this,e)}coordsAtPos(e,n=1){return yk(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 o=this.docView.posFromDOM(e,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,n){return vI(this,n||this.state,e)}pasteHTML(e,n){return Ja(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Ja(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Km(this,e)}destroy(){this.docView&&(tM(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Uf(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,oI())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return rM(this,e)}domSelectionRange(){let e=this.domSelection();return e?Jt&&this.root.nodeType===11&&cI(this.dom.ownerDocument)==this.dom&&_M(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}qk.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function sb(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"),[je.node(0,t.state.doc.content.size,e)]}function ab(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:je.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function lb(t){return!t.someProp("editable",e=>e(t.state)===!1)}function FM(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 cb(t){let e=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function HM(t,e){let n=0,r=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let o in e)r++;return n!=r}function ub(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")}const Zn=()=>new Map,wp=t=>{const e=Zn();return t.forEach((n,r)=>{e.set(r,n)}),e},Ur=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},UM=(t,e)=>{const n=[];for(const[r,o]of t)n.push(e(o,r));return n},VM=(t,e)=>{for(const[n,r]of t)if(e(r,n))return!0;return!1},Ai=()=>new Set,$f=t=>t[t.length-1],$M=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},Vo=Array.from,tg=(t,e)=>{for(let n=0;n<t.length;n++)if(!e(t[n],n,t))return!1;return!0},ng=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},jM=(t,e)=>{const n=new Array(t);for(let r=0;r<t;r++)n[r]=e(r,n);return n},Ns=Array.isArray;class Wk{constructor(){this._observers=Zn()}on(e,n){return Ur(this._observers,e,Ai).add(n),n}once(e,n){const r=(...o)=>{this.off(e,r),n(...o)};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 Vo((this._observers.get(e)||Zn()).values()).forEach(r=>r(...n))}destroy(){this._observers=Zn()}}const mr=Math.floor,Lc=Math.abs,uo=(t,e)=>t<e?t:e,gr=(t,e)=>t>e?t:e,Gk=t=>t!==0?t<0:1/t<0,db=1,fb=2,jf=4,zf=8,tl=32,fo=64,an=128,zM=1<<29,Id=31,Sp=63,yi=127,qM=2147483647,fu=Number.MAX_SAFE_INTEGER,hb=Number.MIN_SAFE_INTEGER,WM=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&mr(t)===t),Yk=String.fromCharCode,GM=t=>t.toLowerCase(),YM=/^\s*/g,KM=t=>t.replace(YM,""),QM=/([A-Z])/g,pb=(t,e)=>KM(t.replace(QM,n=>`${e}${GM(n)}`)),XM=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let o=0;o<n;o++)r[o]=e.codePointAt(o);return r},nl=typeof TextEncoder<"u"?new TextEncoder:null,ZM=t=>nl.encode(t),JM=nl?ZM:XM;let Ia=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Ia&&Ia.decode(new Uint8Array).length===1&&(Ia=null);const eO=(t,e)=>jM(e,()=>t).join("");class Ml{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const Ol=()=>new Ml,tO=t=>{const e=Ol();return t(e),dr(e)},nO=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},dr=t=>{const e=new Uint8Array(nO(t));let n=0;for(let r=0;r<t.bufs.length;r++){const o=t.bufs[r];e.set(o,n),n+=o.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},rO=(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(gr(n,e)*2),t.cpos=0)},Bt=(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},vp=Bt,Le=(t,e)=>{for(;e>yi;)Bt(t,an|yi&e),e=mr(e/128);Bt(t,yi&e)},rg=(t,e)=>{const n=Gk(e);for(n&&(e=-e),Bt(t,(e>Sp?an:0)|(n?fo:0)|Sp&e),e=mr(e/64);e>0;)Bt(t,(e>yi?an:0)|yi&e),e=mr(e/128)},Ap=new Uint8Array(3e4),oO=Ap.length/3,iO=(t,e)=>{if(e.length<oO){const n=nl.encodeInto(e,Ap).written||0;Le(t,n);for(let r=0;r<n;r++)Bt(t,Ap[r])}else Nn(t,JM(e))},sO=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;Le(t,r);for(let o=0;o<r;o++)Bt(t,n.codePointAt(o))},ps=nl&&nl.encodeInto?iO:sO,Md=(t,e)=>{const n=t.cbuf.length,r=t.cpos,o=uo(n-r,e.length),i=e.length-o;t.cbuf.set(e.subarray(0,o),r),t.cpos+=o,i>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(gr(n*2,i)),t.cbuf.set(e.subarray(o)),t.cpos=i)},Nn=(t,e)=>{Le(t,e.byteLength),Md(t,e)},og=(t,e)=>{rO(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},aO=(t,e)=>og(t,4).setFloat32(0,e,!1),lO=(t,e)=>og(t,8).setFloat64(0,e,!1),cO=(t,e)=>og(t,8).setBigInt64(0,e,!1),mb=new DataView(new ArrayBuffer(4)),uO=t=>(mb.setFloat32(0,t),mb.getFloat32(0)===t),Is=(t,e)=>{switch(typeof e){case"string":Bt(t,119),ps(t,e);break;case"number":WM(e)&&Lc(e)<=qM?(Bt(t,125),rg(t,e)):uO(e)?(Bt(t,124),aO(t,e)):(Bt(t,123),lO(t,e));break;case"bigint":Bt(t,122),cO(t,e);break;case"object":if(e===null)Bt(t,126);else if(Ns(e)){Bt(t,117),Le(t,e.length);for(let n=0;n<e.length;n++)Is(t,e[n])}else if(e instanceof Uint8Array)Bt(t,116),Nn(t,e);else{Bt(t,118);const n=Object.keys(e);Le(t,n.length);for(let r=0;r<n.length;r++){const o=n[r];ps(t,o),Is(t,e[o])}}break;case"boolean":Bt(t,e?120:121);break;default:Bt(t,127)}};class gb extends Ml{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 bb=t=>{t.count>0&&(rg(t.encoder,t.count===1?t.s:-t.s),t.count>1&&Le(t.encoder,t.count-2))};class Rc{constructor(){this.encoder=new Ml,this.s=0,this.count=0}write(e){this.s===e?this.count++:(bb(this),this.count=1,this.s=e)}toUint8Array(){return bb(this),dr(this.encoder)}}const yb=t=>{if(t.count>0){const e=t.diff*2+(t.count===1?0:1);rg(t.encoder,e),t.count>1&&Le(t.encoder,t.count-2)}};class qf{constructor(){this.encoder=new Ml,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(yb(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return yb(this),dr(this.encoder)}}class dO{constructor(){this.sarr=[],this.s="",this.lensE=new Rc}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 Ml;return this.sarr.push(this.s),this.s="",ps(e,this.sarr.join("")),Md(e,this.lensE.toUint8Array()),dr(e)}}const Fr=t=>new Error(t),Jn=()=>{throw Fr("Method unimplemented")},un=()=>{throw Fr("Unexpected case")},Kk=Fr("Unexpected end of array"),Qk=Fr("Integer out of Range");class Od{constructor(e){this.arr=e,this.pos=0}}const js=t=>new Od(t),fO=t=>t.pos!==t.arr.length,hO=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},In=t=>hO(t,Me(t)),Ms=t=>t.arr[t.pos++],Me=t=>{let e=0,n=1;const r=t.arr.length;for(;t.pos<r;){const o=t.arr[t.pos++];if(e=e+(o&yi)*n,n*=128,o<an)return e;if(e>fu)throw Qk}throw Kk},ig=t=>{let e=t.arr[t.pos++],n=e&Sp,r=64;const o=(e&fo)>0?-1:1;if((e&an)===0)return o*n;const i=t.arr.length;for(;t.pos<i;){if(e=t.arr[t.pos++],n=n+(e&yi)*r,r*=128,e<an)return o*n;if(n>fu)throw Qk}throw Kk},pO=t=>{let e=Me(t);if(e===0)return"";{let n=String.fromCodePoint(Ms(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(Ms(t));else for(;e>0;){const r=e<1e4?e:1e4,o=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,o),e-=r}return decodeURIComponent(escape(n))}},mO=t=>Ia.decode(In(t)),ms=Ia?mO:pO,sg=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},gO=t=>sg(t,4).getFloat32(0,!1),bO=t=>sg(t,8).getFloat64(0,!1),yO=t=>sg(t,8).getBigInt64(0,!1),EO=[t=>{},t=>null,ig,gO,bO,yO,t=>!1,t=>!0,ms,t=>{const e=Me(t),n={};for(let r=0;r<e;r++){const o=ms(t);n[o]=rl(t)}return n},t=>{const e=Me(t),n=[];for(let r=0;r<e;r++)n.push(rl(t));return n},In],rl=t=>EO[127-Ms(t)](t);class Eb extends Od{constructor(e,n){super(e),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),fO(this)?this.count=Me(this)+1:this.count=-1),this.count--,this.s}}class Pc extends Od{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=ig(this);const e=Gk(this.s);this.count=1,e&&(this.s=-this.s,this.count=Me(this)+2)}return this.count--,this.s}}class Wf extends Od{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=ig(this),n=e&1;this.diff=mr(e/2),this.count=1,n&&(this.count=Me(this)+2)}return this.s+=this.diff,this.count--,this.s}}class xO{constructor(e){this.decoder=new Pc(e),this.str=ms(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 CO=crypto.getRandomValues.bind(crypto),kO=Math.random,Xk=()=>CO(new Uint32Array(1))[0],TO=t=>t[mr(kO()*t.length)],wO="10000000-1000-4000-8000"+-1e11,SO=()=>wO.replace(/[018]/g,t=>(t^Xk()&15>>t/4).toString(16)),vO=Date.now,xb=t=>new Promise(t);Promise.all.bind(Promise);const Cb=t=>t===void 0?null:t;class AO{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let Zk=new AO,_O=!0;try{typeof localStorage<"u"&&localStorage&&(Zk=localStorage,_O=!1)}catch{}const NO=Zk,ol=Symbol("Equality"),Jk=(t,e)=>t===e||!!t?.[ol]?.(e)||!1,IO=t=>typeof t=="object",MO=Object.assign,eT=Object.keys,OO=(t,e)=>{for(const n in t)e(t[n],n)},hu=t=>eT(t).length,DO=t=>{for(const e in t)return!1;return!0},zs=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},ag=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),LO=(t,e)=>t===e||hu(t)===hu(e)&&zs(t,(n,r)=>(n!==void 0||ag(e,r))&&Jk(e[r],n)),RO=Object.freeze,tT=t=>{for(const e in t){const n=t[e];(typeof n=="object"||typeof n=="function")&&tT(t[e])}return RO(t)},lg=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&lg(t,e,n+1)}},PO=t=>t,Bc=(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[ol]!=null)return t[ol](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)||!Bc(t.get(n),e.get(n)))return!1;break}case void 0:case Object:if(hu(t)!==hu(e))return!1;for(const n in t)if(!ag(t,n)||!Bc(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(!Bc(t[n],e[n]))return!1;break;default:return!1}return!0},BO=(t,e)=>e.includes(t);var nT={};const Os=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",rT=typeof window<"u"&&typeof document<"u"&&!Os;let wr;const FO=()=>{if(wr===void 0)if(Os){wr=Zn();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];r[0]==="-"?(e!==null&&wr.set(e,""),e=r):e!==null&&(wr.set(e,r),e=null)}e!==null&&wr.set(e,"")}else typeof location=="object"?(wr=Zn(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");wr.set(`--${pb(e,"-")}`,n),wr.set(`-${pb(e,"-")}`,n)}})):wr=Zn();return wr},_p=t=>FO().has(t),pu=t=>Cb(Os?nT[t.toUpperCase().replaceAll("-","_")]:NO.getItem(t)),oT=t=>_p("--"+t)||pu(t)!==null,HO=oT("production"),UO=Os&&BO(nT.FORCE_COLOR,["true","1","2"]),VO=UO||!_p("--no-colors")&&!oT("no-color")&&(!Os||process.stdout.isTTY)&&(!Os||_p("--color")||pu("COLORTERM")!==null||(pu("TERM")||"").includes("color")),$O=t=>new Uint8Array(t),jO=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=Yk(t[n]);return btoa(e)},zO=t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),qO=rT?jO:zO,WO=t=>{const e=$O(t.byteLength);return e.set(t),e},GO=t=>tO(e=>Is(e,t));class YO{constructor(e,n){this.left=e,this.right=n}}const Kr=(t,e)=>new YO(t,e),kb=t=>t.next()>=.5,Gf=(t,e,n)=>mr(t.next()*(n+1-e)+e),iT=(t,e,n)=>mr(t.next()*(n+1-e)+e),cg=(t,e,n)=>iT(t,e,n),KO=t=>Yk(cg(t,97,122)),QO=(t,e=0,n=20)=>{const r=cg(t,e,n);let o="";for(let i=0;i<r;i++)o+=KO(t);return o},Yf=(t,e)=>e[cg(t,0,e.length-1)],XO=Symbol("0schema");class ZO{constructor(){this._rerrs=[]}extend(e,n,r,o=null){this._rerrs.push({path:e,expected:n,has:r,message:o})}toString(){const e=[];for(let n=this._rerrs.length-1;n>0;n--){const r=this._rerrs[n];e.push(eO(" ",(this._rerrs.length-n)*2)+`${r.path!=null?`[${r.path}] `:""}${r.has} doesn't match ${r.expected}. ${r.message}`)}return e.join(`
|
|
10
|
+
`)}}const Np=(t,e)=>t===e?!0:t==null||e==null||t.constructor!==e.constructor?!1:t[ol]?Jk(t,e):Ns(t)?tg(t,n=>ng(e,r=>Np(n,r))):IO(t)?zs(t,(n,r)=>Np(n,e[r])):!1;let fn=class{static _dilutes=!1;extends(e){let[n,r]=[this.shape,e.shape];return this.constructor._dilutes&&([r,n]=[n,r]),Np(n,r)}equals(e){return this.constructor===e.constructor&&Bc(this.shape,e.shape)}[XO](){return!0}[ol](e){return this.equals(e)}validate(e){return this.check(e)}check(e,n){Jn()}get nullable(){return qs(this,Bd)}get optional(){return new lT(this)}cast(e){return Tb(e,this),e}expect(e){return Tb(e,this),e}};class ug extends fn{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 Nt=(t,e=null)=>new ug(t,e);Nt(ug);class dg extends fn{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 $t=t=>new dg(t);Nt(dg);class Dd extends fn{constructor(e){super(),this.shape=e}check(e,n){const r=this.shape.some(o=>o===e);return!r&&n?.extend(null,this.shape.join(" | "),e.toString()),r}}const Ld=(...t)=>new Dd(t),sT=Nt(Dd),JO=RegExp.escape||(t=>t.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),aT=t=>{if(Ds.check(t))return[JO(t)];if(sT.check(t))return t.shape.map(e=>e+"");if(bT.check(t))return["[+-]?\\d+.?\\d*"];if(yT.check(t))return[".*"];if(mu.check(t))return t.shape.map(aT).flat(1);un()};class e4 extends fn{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(aT).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}}Nt(e4);const t4=Symbol("optional");class lT extends fn{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[t4](){return!0}}const n4=Nt(lT);class r4 extends fn{check(e,n){return n?.extend(null,"never",typeof e),!1}}Nt(r4);class Rd extends fn{constructor(e,n=!1){super(),this.shape=e,this._isPartial=n}static _dilutes=!0;get partial(){return new Rd(this.shape,!0)}check(e,n){return e==null?(n?.extend(null,"object","null"),!1):zs(this.shape,(r,o)=>{const i=this._isPartial&&!ag(e,o)||r.check(e[o],n);return!i&&n?.extend(o.toString(),r.toString(),typeof e[o],"Object property does not match"),i})}}const o4=t=>new Rd(t),i4=Nt(Rd),s4=$t(t=>t!=null&&(t.constructor===Object||t.constructor==null));class cT extends fn{constructor(e,n){super(),this.shape={keys:e,values:n}}check(e,n){return e!=null&&zs(e,(r,o)=>{const i=this.shape.keys.check(o,n);return!i&&n?.extend(o+"","Record",typeof e,i?"Key doesn't match schema":"Value doesn't match value"),i&&this.shape.values.check(r,n)})}}const uT=(t,e)=>new cT(t,e),a4=Nt(cT);class dT extends fn{constructor(e){super(),this.shape=e}check(e,n){return e!=null&&zs(this.shape,(r,o)=>{const i=r.check(e[o],n);return!i&&n?.extend(o.toString(),"Tuple",typeof r),i})}}const l4=(...t)=>new dT(t);Nt(dT);class fT extends fn{constructor(e){super(),this.shape=e.length===1?e[0]:new fg(e)}check(e,n){const r=Ns(e)&&tg(e,o=>this.shape.check(o));return!r&&n?.extend(null,"Array",""),r}}const hT=(...t)=>new fT(t),c4=Nt(fT),u4=$t(t=>Ns(t));class pT extends fn{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 d4=(t,e=null)=>new pT(t,e);Nt(pT);const f4=d4(fn);class h4 extends fn{constructor(e){super(),this.len=e.length-1,this.args=l4(...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 p4=Nt(h4),m4=$t(t=>typeof t=="function");class g4 extends fn{constructor(e){super(),this.shape=e}check(e,n){const r=tg(this.shape,o=>o.check(e,n));return!r&&n?.extend(null,"Intersectinon",typeof e),r}}Nt(g4,t=>t.shape.length>0);class fg extends fn{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,n){const r=ng(this.shape,o=>o.check(e,n));return n?.extend(null,"Union",typeof e),r}}const qs=(...t)=>t.findIndex(e=>mu.check(e))>=0?qs(...t.map(e=>il(e)).map(e=>mu.check(e)?e.shape:[e]).flat(1)):t.length===1?t[0]:new fg(t),mu=Nt(fg),mT=()=>!0,gu=$t(mT),b4=Nt(dg,t=>t.shape===mT),hg=$t(t=>typeof t=="bigint"),y4=$t(t=>t===hg),gT=$t(t=>typeof t=="symbol");$t(t=>t===gT);const gs=$t(t=>typeof t=="number"),bT=$t(t=>t===gs),Ds=$t(t=>typeof t=="string"),yT=$t(t=>t===Ds),Pd=$t(t=>typeof t=="boolean"),E4=$t(t=>t===Pd),ET=Ld(void 0);Nt(Dd,t=>t.shape.length===1&&t.shape[0]===void 0);Ld(void 0);const Bd=Ld(null),x4=Nt(Dd,t=>t.shape.length===1&&t.shape[0]===null);Nt(Uint8Array);Nt(ug,t=>t.shape===Uint8Array);const C4=qs(gs,Ds,Bd,ET,hg,Pd,gT);(()=>{const t=hT(gu),e=uT(Ds,gu),n=qs(gs,Ds,Bd,Pd,t,e);return t.shape=n,e.shape.values=n,n})();const il=t=>{if(f4.check(t))return t;if(s4.check(t)){const e={};for(const n in t)e[n]=il(t[n]);return o4(e)}else{if(u4.check(t))return qs(...t.map(il));if(C4.check(t))return Ld(t);if(m4.check(t))return Nt(t)}un()},Tb=HO?()=>{}:(t,e)=>{const n=new ZO;if(!e.check(t,n))throw Fr(`Expected value to be of type ${e.constructor.name}.
|
|
11
|
+
${n.toString()}`)};class k4{constructor(e){this.patterns=[],this.$state=e}if(e,n){return this.patterns.push({if:il(e),h:n}),this}else(e){return this.if(gu,e)}done(){return(e,n)=>{for(let r=0;r<this.patterns.length;r++){const o=this.patterns[r];if(o.if.check(e))return o.h(e,n)}throw Fr("Unhandled pattern")}}}const T4=t=>new k4(t),xT=T4(gu).if(bT,(t,e)=>Gf(e,hb,fu)).if(yT,(t,e)=>QO(e)).if(E4,(t,e)=>kb(e)).if(y4,(t,e)=>BigInt(Gf(e,hb,fu))).if(mu,(t,e)=>Qi(e,Yf(e,t.shape))).if(i4,(t,e)=>{const n={};for(const r in t.shape){let o=t.shape[r];if(n4.check(o)){if(kb(e))continue;o=o.shape}n[r]=xT(o,e)}return n}).if(c4,(t,e)=>{const n=[],r=iT(e,0,42);for(let o=0;o<r;o++)n.push(Qi(e,t.shape));return n}).if(sT,(t,e)=>Yf(e,t.shape)).if(x4,(t,e)=>null).if(p4,(t,e)=>{const n=Qi(e,t.res);return()=>n}).if(b4,(t,e)=>Qi(e,Yf(e,[gs,Ds,Bd,ET,hg,Pd,hT(gs),uT(qs("a","b","c"),gs)]))).if(a4,(t,e)=>{const n={},r=Gf(e,0,3);for(let o=0;o<r;o++){const i=Qi(e,t.shape.keys),s=Qi(e,t.shape.values);n[i]=s}return n}).done(),Qi=(t,e)=>xT(il(e),t),Dl=typeof document<"u"?document:{};$t(t=>t.nodeType===_4);typeof DOMParser<"u"&&new DOMParser;$t(t=>t.nodeType===S4);$t(t=>t.nodeType===v4);const w4=t=>UM(t,(e,n)=>`${n}:${e};`).join(""),S4=Dl.ELEMENT_NODE,v4=Dl.TEXT_NODE,A4=Dl.DOCUMENT_NODE,_4=Dl.DOCUMENT_FRAGMENT_NODE;$t(t=>t.nodeType===A4);const N4=t=>class{constructor(n){this._=n}destroy(){t(this._)}},I4=N4(clearTimeout),pg=(t,e)=>new I4(setTimeout(e,t)),ho=Symbol,CT=ho(),kT=ho(),M4=ho(),O4=ho(),D4=ho(),TT=ho(),L4=ho(),mg=ho(),R4=ho(),P4=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());const e=[],n=[];let r=0;for(;r<t.length;r++){const o=t[r];if(o===void 0)break;if(o.constructor===String||o.constructor===Number)e.push(o);else if(o.constructor===Object)break}for(r>0&&n.push(e.join(""));r<t.length;r++){const o=t[r];o instanceof Symbol||n.push(o)}return n},B4={[CT]:Kr("font-weight","bold"),[kT]:Kr("font-weight","normal"),[M4]:Kr("color","blue"),[D4]:Kr("color","green"),[O4]:Kr("color","grey"),[TT]:Kr("color","red"),[L4]:Kr("color","purple"),[mg]:Kr("color","orange"),[R4]:Kr("color","black")},F4=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());const e=[],n=[],r=Zn();let o=[],i=0;for(;i<t.length;i++){const s=t[i],a=B4[s];if(a!==void 0)r.set(a.left,a.right);else{if(s===void 0)break;if(s.constructor===String||s.constructor===Number){const l=w4(r);i>0||l.length>0?(e.push("%c"+s),n.push(l)):e.push(s)}else break}}for(i>0&&(o=n,o.unshift(e.join("")));i<t.length;i++){const s=t[i];s instanceof Symbol||o.push(s)}return o},wT=VO?F4:P4,H4=(...t)=>{console.log(...wT(t)),vT.forEach(e=>e.print(t))},ST=(...t)=>{console.warn(...wT(t)),t.unshift(mg),vT.forEach(e=>e.print(t))},vT=Ai(),AT=t=>({[Symbol.iterator](){return this},next:t}),U4=(t,e)=>AT(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),Kf=(t,e)=>AT(()=>{const{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}});class gg{constructor(e,n){this.clock=e,this.len=n}}class Ws{constructor(){this.clients=new Map}}const $o=(t,e,n)=>e.clients.forEach((r,o)=>{const i=t.doc.store.clients.get(o);if(i!=null){const s=i[i.length-1],a=s.id.clock+s.length;for(let l=0,c=r[l];l<r.length&&c.clock<a;c=r[++l])VT(t,i,c.clock,c.len,n)}}),V4=(t,e)=>{let n=0,r=t.length-1;for(;n<=r;){const o=mr((n+r)/2),i=t[o],s=i.clock;if(s<=e){if(e<s+i.len)return o;n=o+1}else r=o-1}return null},Gs=(t,e)=>{const n=t.clients.get(e.client);return n!==void 0&&V4(n,e.clock)!==null},bg=t=>{t.clients.forEach(e=>{e.sort((o,i)=>o.clock-i.clock);let n,r;for(n=1,r=1;n<e.length;n++){const o=e[r-1],i=e[n];o.clock+o.len>=i.clock?o.len=gr(o.len,i.clock+i.len-o.clock):(r<n&&(e[r]=i),r++)}e.length=r})},Ip=t=>{const e=new Ws;for(let n=0;n<t.length;n++)t[n].clients.forEach((r,o)=>{if(!e.clients.has(o)){const i=r.slice();for(let s=n+1;s<t.length;s++)$M(i,t[s].clients.get(o)||[]);e.clients.set(o,i)}});return bg(e),e},sl=(t,e,n,r)=>{Ur(t.clients,e,()=>[]).push(new gg(n,r))},_T=()=>new Ws,NT=t=>{const e=_T();return t.clients.forEach((n,r)=>{const o=[];for(let i=0;i<n.length;i++){const s=n[i];if(s.deleted){const a=s.id.clock;let l=s.length;if(i+1<n.length)for(let c=n[i+1];i+1<n.length&&c.deleted;c=n[++i+1])l+=c.length;o.push(new gg(a,l))}}o.length>0&&e.clients.set(r,o)}),e},Ys=(t,e)=>{Le(t.restEncoder,e.clients.size),Vo(e.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{t.resetDsCurVal(),Le(t.restEncoder,n);const o=r.length;Le(t.restEncoder,o);for(let i=0;i<o;i++){const s=r[i];t.writeDsClock(s.clock),t.writeDsLen(s.len)}})},yg=t=>{const e=new Ws,n=Me(t.restDecoder);for(let r=0;r<n;r++){t.resetDsCurVal();const o=Me(t.restDecoder),i=Me(t.restDecoder);if(i>0){const s=Ur(e.clients,o,()=>[]);for(let a=0;a<i;a++)s.push(new gg(t.readDsClock(),t.readDsLen()))}}return e},wb=(t,e,n)=>{const r=new Ws,o=Me(t.restDecoder);for(let i=0;i<o;i++){t.resetDsCurVal();const s=Me(t.restDecoder),a=Me(t.restDecoder),l=n.clients.get(s)||[],c=bt(n,s);for(let u=0;u<a;u++){const d=t.readDsClock(),f=d+t.readDsLen();if(d<c){c<f&&sl(r,s,c,f-c);let h=tr(l,d),p=l[h];for(!p.deleted&&p.id.clock<d&&(l.splice(h+1,0,Tu(e,p,d-p.id.clock)),h++);h<l.length&&(p=l[h++],p.id.clock<f);)p.deleted||(f<p.id.clock+p.length&&l.splice(h,0,Tu(e,p,f-p.id.clock)),p.delete(e))}else sl(r,s,d,f-d)}}if(r.clients.size>0){const i=new _i;return Le(i.restEncoder,0),Ys(i,r),i.toUint8Array()}return null},IT=Xk;class Jo extends Wk{constructor({guid:e=SO(),collectionid:n=null,gc:r=!0,gcFilter:o=()=>!0,meta:i=null,autoLoad:s=!1,shouldLoad:a=!0}={}){super(),this.gc=r,this.gcFilter=o,this.clientID=IT(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new HT,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=a,this.autoLoad=s,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=xb(c=>{this.on("load",()=>{this.isLoaded=!0,c(this)})});const l=()=>xb(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&&Xe(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(Vo(this.subdocs).map(e=>e.guid))}transact(e,n=null){return Xe(this,e,n)}get(e,n=Ht){const r=Ur(this.share,e,()=>{const i=new n;return i._integrate(this,null),i}),o=r.constructor;if(n!==Ht&&o!==n)if(o===Ht){const i=new n;i._map=r._map,r._map.forEach(s=>{for(;s!==null;s=s.left)s.parent=i}),i._start=r._start;for(let s=i._start;s!==null;s=s.right)s.parent=i;return i._length=r._length,this.share.set(e,i),i._integrate(this,null),i}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,Es)}getText(e=""){return this.get(e,jo)}getMap(e=""){return this.get(e,Rs)}getXmlElement(e=""){return this.get(e,Yt)}getXmlFragment(e=""){return this.get(e,Ni)}toJSON(){const e={};return this.share.forEach((n,r)=>{e[r]=n.toJSON()}),e}destroy(){this.isDestroyed=!0,Vo(this.subdocs).forEach(n=>n.destroy());const e=this._item;if(e!==null){this._item=null;const n=e.content;n.doc=new Jo({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,Xe(e.parent.doc,r=>{const o=n.doc;e.deleted||r.subdocsAdded.add(o),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class MT{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return Me(this.restDecoder)}readDsLen(){return Me(this.restDecoder)}}class OT extends MT{readLeftID(){return Ce(Me(this.restDecoder),Me(this.restDecoder))}readRightID(){return Ce(Me(this.restDecoder),Me(this.restDecoder))}readClient(){return Me(this.restDecoder)}readInfo(){return Ms(this.restDecoder)}readString(){return ms(this.restDecoder)}readParentInfo(){return Me(this.restDecoder)===1}readTypeRef(){return Me(this.restDecoder)}readLen(){return Me(this.restDecoder)}readAny(){return rl(this.restDecoder)}readBuf(){return WO(In(this.restDecoder))}readJSON(){return JSON.parse(ms(this.restDecoder))}readKey(){return ms(this.restDecoder)}}class $4{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=Me(this.restDecoder),this.dsCurrVal}readDsLen(){const e=Me(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class Ls extends $4{constructor(e){super(e),this.keys=[],Me(e),this.keyClockDecoder=new Wf(In(e)),this.clientDecoder=new Pc(In(e)),this.leftClockDecoder=new Wf(In(e)),this.rightClockDecoder=new Wf(In(e)),this.infoDecoder=new Eb(In(e),Ms),this.stringDecoder=new xO(In(e)),this.parentInfoDecoder=new Eb(In(e),Ms),this.typeRefDecoder=new Pc(In(e)),this.lenDecoder=new Pc(In(e))}readLeftID(){return new bs(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new bs(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 rl(this.restDecoder)}readBuf(){return In(this.restDecoder)}readJSON(){return rl(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 DT{constructor(){this.restEncoder=Ol()}toUint8Array(){return dr(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){Le(this.restEncoder,e)}writeDsLen(e){Le(this.restEncoder,e)}}class Ll extends DT{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){vp(this.restEncoder,e)}writeString(e){ps(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){Is(this.restEncoder,e)}writeBuf(e){Nn(this.restEncoder,e)}writeJSON(e){ps(this.restEncoder,JSON.stringify(e))}writeKey(e){ps(this.restEncoder,e)}}class LT{constructor(){this.restEncoder=Ol(),this.dsCurrVal=0}toUint8Array(){return dr(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const n=e-this.dsCurrVal;this.dsCurrVal=e,Le(this.restEncoder,n)}writeDsLen(e){e===0&&un(),Le(this.restEncoder,e-1),this.dsCurrVal+=e}}class _i extends LT{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new qf,this.clientEncoder=new Rc,this.leftClockEncoder=new qf,this.rightClockEncoder=new qf,this.infoEncoder=new gb(vp),this.stringEncoder=new dO,this.parentInfoEncoder=new gb(vp),this.typeRefEncoder=new Rc,this.lenEncoder=new Rc}toUint8Array(){const e=Ol();return Le(e,0),Nn(e,this.keyClockEncoder.toUint8Array()),Nn(e,this.clientEncoder.toUint8Array()),Nn(e,this.leftClockEncoder.toUint8Array()),Nn(e,this.rightClockEncoder.toUint8Array()),Nn(e,dr(this.infoEncoder)),Nn(e,this.stringEncoder.toUint8Array()),Nn(e,dr(this.parentInfoEncoder)),Nn(e,this.typeRefEncoder.toUint8Array()),Nn(e,this.lenEncoder.toUint8Array()),Md(e,dr(this.restEncoder)),dr(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){Is(this.restEncoder,e)}writeBuf(e){Nn(this.restEncoder,e)}writeJSON(e){Is(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 j4=(t,e,n,r)=>{r=gr(r,e[0].id.clock);const o=tr(e,r);Le(t.restEncoder,e.length-o),t.writeClient(n),Le(t.restEncoder,r);const i=e[o];i.write(t,r-i.id.clock);for(let s=o+1;s<e.length;s++)e[s].write(t,0)},Eg=(t,e,n)=>{const r=new Map;n.forEach((o,i)=>{bt(e,i)>o&&r.set(i,o)}),Rl(e).forEach((o,i)=>{n.has(i)||r.set(i,0)}),Le(t.restEncoder,r.size),Vo(r.entries()).sort((o,i)=>i[0]-o[0]).forEach(([o,i])=>{j4(t,e.clients.get(o),o,i)})},z4=(t,e)=>{const n=Zn(),r=Me(t.restDecoder);for(let o=0;o<r;o++){const i=Me(t.restDecoder),s=new Array(i),a=t.readClient();let l=Me(t.restDecoder);n.set(a,{i:0,refs:s});for(let c=0;c<i;c++){const u=t.readInfo();switch(Id&u){case 0:{const d=t.readLen();s[c]=new Yn(Ce(a,l),d),l+=d;break}case 10:{const d=Me(t.restDecoder);s[c]=new Kn(Ce(a,l),d),l+=d;break}default:{const d=(u&(fo|an))===0,f=new ot(Ce(a,l),null,(u&an)===an?t.readLeftID():null,null,(u&fo)===fo?t.readRightID():null,d?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,d&&(u&tl)===tl?t.readString():null,cw(t,u));s[c]=f,l+=f.length}}}}return n},q4=(t,e,n)=>{const r=[];let o=Vo(n.keys()).sort((h,p)=>h-p);if(o.length===0)return null;const i=()=>{if(o.length===0)return null;let h=n.get(o[o.length-1]);for(;h.refs.length===h.i;)if(o.pop(),o.length>0)h=n.get(o[o.length-1]);else return null;return h};let s=i();if(s===null)return null;const a=new HT,l=new Map,c=(h,p)=>{const g=l.get(h);(g==null||g>p)&&l.set(h,p)};let u=s.refs[s.i++];const d=new Map,f=()=>{for(const h of r){const p=h.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,[h]),o=o.filter(b=>b!==p)}r.length=0};for(;;){if(u.constructor!==Kn){const p=Ur(d,u.id.client,()=>bt(e,u.id.client))-u.id.clock;if(p<0)r.push(u),c(u.id.client,u.id.clock-1),f();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,bt(e,g)),f();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(s!==null&&s.i<s.refs.length)u=s.refs[s.i++];else{if(s=i(),s===null)break;u=s.refs[s.i++]}}if(a.clients.size>0){const h=new _i;return Eg(h,a,new Map),Le(h.restEncoder,0),{missing:l,update:h.toUint8Array()}}return null},W4=(t,e)=>Eg(t,e.doc.store,e.beforeState),G4=(t,e,n,r=new Ls(t))=>Xe(e,o=>{o.local=!1;let i=!1;const s=o.doc,a=s.store,l=z4(r,s),c=q4(o,a,l),u=a.pendingStructs;if(u){for(const[f,h]of u.missing)if(h<bt(a,f)){i=!0;break}if(c){for(const[f,h]of c.missing){const p=u.missing.get(f);(p==null||p>h)&&u.missing.set(f,h)}u.update=yu([u.update,c.update])}}else a.pendingStructs=c;const d=wb(r,o,a);if(a.pendingDs){const f=new Ls(js(a.pendingDs));Me(f.restDecoder);const h=wb(f,o,a);d&&h?a.pendingDs=yu([d,h]):a.pendingDs=d||h}else a.pendingDs=d;if(i){const f=a.pendingStructs.update;a.pendingStructs=null,bu(o.doc,f)}},n,!1),bu=(t,e,n,r=Ls)=>{const o=js(e);G4(o,t,n,new r(o))},Sb=(t,e,n)=>bu(t,e,n,OT),Y4=(t,e,n=new Map)=>{Eg(t,e.store,n),Ys(t,NT(e.store))},K4=(t,e=new Uint8Array([0]),n=new _i)=>{const r=RT(e);Y4(n,t,r);const o=[n.toUint8Array()];if(t.store.pendingDs&&o.push(t.store.pendingDs),t.store.pendingStructs&&o.push(pD(t.store.pendingStructs.update,e)),o.length>1){if(n.constructor===Ll)return fD(o.map((i,s)=>s===0?i:gD(i)));if(n.constructor===_i)return yu(o)}return o[0]},vb=(t,e)=>K4(t,e,new Ll),Q4=t=>{const e=new Map,n=Me(t.restDecoder);for(let r=0;r<n;r++){const o=Me(t.restDecoder),i=Me(t.restDecoder);e.set(o,i)}return e},RT=t=>Q4(new MT(js(t))),PT=(t,e)=>(Le(t.restEncoder,e.size),Vo(e.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{Le(t.restEncoder,n),Le(t.restEncoder,r)}),t),X4=(t,e)=>PT(t,Rl(e.store)),Z4=(t,e=new LT)=>(t instanceof Map?PT(e,t):X4(e,t),e.toUint8Array()),J4=t=>Z4(t,new DT);class eD{constructor(){this.l=[]}}const Ab=()=>new eD,_b=(t,e)=>t.l.push(e),Nb=(t,e)=>{const n=t.l,r=n.length;t.l=n.filter(o=>e!==o),r===t.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},BT=(t,e,n)=>lg(t.l,[e,n]);class bs{constructor(e,n){this.client=e,this.clock=n}}const cs=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,Ce=(t,e)=>new bs(t,e),al=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw un()},ll=(t,e)=>{for(;e!==null;){if(e.parent===t)return!0;e=e.parent._item}return!1};class cl{constructor(e,n,r,o=0){this.type=e,this.tname=n,this.item=r,this.assoc=o}}const Ma=t=>new cl(t.type==null?null:Ce(t.type.client,t.type.clock),t.tname??null,t.item==null?null:Ce(t.item.client,t.item.clock),t.assoc==null?0:t.assoc);class tD{constructor(e,n,r=0){this.type=e,this.index=n,this.assoc=r}}const nD=(t,e,n=0)=>new tD(t,e,n),Jl=(t,e,n)=>{let r=null,o=null;return t._item===null?o=al(t):r=Ce(t._item.id.client,t._item.id.clock),new cl(r,o,e,n)},Qf=(t,e,n=0)=>{let r=t._start;if(n<0){if(e===0)return Jl(t,null,n);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return Jl(t,Ce(r.id.client,r.id.clock+e),n);e-=r.length}if(r.right===null&&n<0)return Jl(t,r.lastId,n);r=r.right}return Jl(t,null,n)},rD=(t,e)=>{const n=ys(t,e),r=e.clock-n.id.clock;return{item:n,diff:r}},oD=(t,e,n=!0)=>{const r=e.store,o=t.item,i=t.type,s=t.tname,a=t.assoc;let l=null,c=0;if(o!==null){if(bt(r,o.client)<=o.clock)return null;const u=n?Lp(r,o):rD(r,o),d=u.item;if(!(d instanceof ot))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 f=d.left;for(;f!==null;)!f.deleted&&f.countable&&(c+=f.length),f=f.left}}else{if(s!==null)l=e.get(s);else if(i!==null){if(bt(r,i.client)<=i.clock)return null;const{item:u}=n?Lp(r,i):{item:ys(r,i)};if(u instanceof ot&&u.content instanceof xr)l=u.content.type;else return null}else throw un();a>=0?c=l._length:c=0}return nD(l,c,t.assoc)},Ib=(t,e)=>t===e||t!==null&&e!==null&&t.tname===e.tname&&cs(t.item,e.item)&&cs(t.type,e.type)&&t.assoc===e.assoc;class xg{constructor(e,n){this.ds=e,this.sv=n}}const FT=(t,e)=>new xg(t,e),Xf=t=>FT(NT(t.store),Rl(t.store)),li=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!Gs(e.ds,t.id),Mp=(t,e)=>{const n=Ur(t.meta,Mp,Ai),r=t.doc.store;n.has(e)||(e.sv.forEach((o,i)=>{o<bt(r,i)&&xn(t,Ce(i,o))}),$o(t,e.ds,o=>{}),n.add(e))};class HT{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const Rl=t=>{const e=new Map;return t.clients.forEach((n,r)=>{const o=n[n.length-1];e.set(r,o.id.clock+o.length)}),e},bt=(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},UT=(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 un()}n.push(e)},tr=(t,e)=>{let n=0,r=t.length-1,o=t[r],i=o.id.clock;if(i===e)return r;let s=mr(e/(i+o.length-1)*r);for(;n<=r;){if(o=t[s],i=o.id.clock,i<=e){if(e<i+o.length)return s;n=s+1}else r=s-1;s=mr((n+r)/2)}throw un()},iD=(t,e)=>{const n=t.clients.get(e.client);return n[tr(n,e.clock)]},ys=iD,Op=(t,e,n)=>{const r=tr(e,n),o=e[r];return o.id.clock<n&&o instanceof ot?(e.splice(r+1,0,Tu(t,o,n-o.id.clock)),r+1):r},xn=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[Op(t,n,e.clock)]},Mb=(t,e,n)=>{const r=e.clients.get(n.client),o=tr(r,n.clock),i=r[o];return n.clock!==i.id.clock+i.length-1&&i.constructor!==Yn&&r.splice(o+1,0,Tu(t,i,n.clock-i.id.clock+1)),i},sD=(t,e,n)=>{const r=t.clients.get(e.id.client);r[tr(r,e.id.clock)]=n},VT=(t,e,n,r,o)=>{if(r===0)return;const i=n+r;let s=Op(t,e,n),a;do a=e[s++],i<a.id.clock+a.length&&Op(t,e,i),o(a);while(s<e.length&&e[s].id.clock<i)};class aD{constructor(e,n,r){this.doc=e,this.deleteSet=new Ws,this.beforeState=Rl(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 Ob=(t,e)=>e.deleteSet.clients.size===0&&!VM(e.afterState,(n,r)=>e.beforeState.get(r)!==n)?!1:(bg(e.deleteSet),W4(t,e),Ys(t,e.deleteSet),!0),Db=(t,e,n)=>{const r=e._item;(r===null||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&Ur(t.changed,e,Ai).add(n)},Fc=(t,e)=>{let n=t[e],r=t[e-1],o=e;for(;o>0;n=r,r=t[--o-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof ot&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}const i=e-o;return i&&t.splice(e+1-i,i),i},lD=(t,e,n)=>{for(const[r,o]of t.clients.entries()){const i=e.clients.get(r);for(let s=o.length-1;s>=0;s--){const a=o[s],l=a.clock+a.len;for(let c=tr(i,a.clock),u=i[c];c<i.length&&u.id.clock<l;u=i[++c]){const d=i[c];if(a.clock+a.len<=d.id.clock)break;d instanceof ot&&d.deleted&&!d.keep&&n(d)&&d.gc(e,!1)}}}},cD=(t,e)=>{t.clients.forEach((n,r)=>{const o=e.clients.get(r);for(let i=n.length-1;i>=0;i--){const s=n[i],a=uo(o.length-1,1+tr(o,s.clock+s.len-1));for(let l=a,c=o[l];l>0&&c.id.clock>=s.clock;c=o[l])l-=1+Fc(o,l)}})},$T=(t,e)=>{if(e<t.length){const n=t[e],r=n.doc,o=r.store,i=n.deleteSet,s=n._mergeStructs;try{bg(i),n.afterState=Rl(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(()=>{BT(c._dEH,l,n)}))}),a.push(()=>r.emit("afterTransaction",[n,r])),a.push(()=>{n._needFormattingCleanup&&ID(n)})}),lg(a,[])}finally{r.gc&&lD(i,o,r.gcFilter),cD(i,o),n.afterState.forEach((u,d)=>{const f=n.beforeState.get(d)||0;if(f!==u){const h=o.clients.get(d),p=gr(tr(h,f),1);for(let g=h.length-1;g>=p;)g-=1+Fc(h,g)}});for(let u=s.length-1;u>=0;u--){const{client:d,clock:f}=s[u].id,h=o.clients.get(d),p=tr(h,f);p+1<h.length&&Fc(h,p+1)>1||p>0&&Fc(h,p)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(H4(mg,CT,"[yjs] ",kT,TT,"Changed the client-id because another client seems to be using it."),r.clientID=IT()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const u=new Ll;Ob(u,n)&&r.emit("update",[u.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const u=new _i;Ob(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])):$T(t,e+1)}}},Xe=(t,e,n=null,r=!0)=>{const o=t._transactionCleanups;let i=!1,s=null;t._transaction===null&&(i=!0,t._transaction=new aD(t,n,r),o.push(t._transaction),o.length===1&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{s=e(t._transaction)}finally{if(i){const a=t._transaction===o[0];t._transaction=null,a&&$T(o,0)}}return s};class uD{constructor(e,n){this.insertions=n,this.deletions=e,this.meta=new Map}}const Lb=(t,e,n)=>{$o(t,n.deletions,r=>{r instanceof ot&&e.scope.some(o=>o===t.doc||ll(o,r))&&_g(r,!1)})},Rb=(t,e,n)=>{let r=null;const o=t.doc,i=t.scope;Xe(o,a=>{for(;e.length>0&&t.currStackItem===null;){const l=o.store,c=e.pop(),u=new Set,d=[];let f=!1;$o(a,c.insertions,h=>{if(h instanceof ot){if(h.redone!==null){let{item:p,diff:g}=Lp(l,h.id);g>0&&(p=xn(a,Ce(p.id.client,p.id.clock+g))),h=p}!h.deleted&&i.some(p=>p===a.doc||ll(p,h))&&d.push(h)}}),$o(a,c.deletions,h=>{h instanceof ot&&i.some(p=>p===a.doc||ll(p,h))&&!Gs(c.insertions,h.id)&&u.add(h)}),u.forEach(h=>{f=lw(a,h,u,c.insertions,t.ignoreRemoteMapChanges,t)!==null||f});for(let h=d.length-1;h>=0;h--){const p=d[h];t.deleteFilter(p)&&(p.delete(a),f=!0)}t.currStackItem=f?c:null}a.changed.forEach((l,c)=>{l.has(null)&&c._searchMarker&&(c._searchMarker.length=0)}),r=a},t);const s=t.currStackItem;if(s!=null){const a=r.changedParentTypes;t.emit("stack-item-popped",[{stackItem:s,type:n,changedParentTypes:a,origin:t},t]),t.currStackItem=null}return s};class jT extends Wk{constructor(e,{captureTimeout:n=500,captureTransaction:r=l=>!0,deleteFilter:o=()=>!0,trackedOrigins:i=new Set([null]),ignoreRemoteMapChanges:s=!1,doc:a=Ns(e)?e[0].doc:e instanceof Jo?e:e.doc}={}){super(),this.scope=[],this.doc=a,this.addToScope(e),this.deleteFilter=o,i.add(this),this.trackedOrigins=i,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=s,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 f=new Ws;l.afterState.forEach((b,E)=>{const x=l.beforeState.get(E)||0,T=b-x;T>0&&sl(f,E,x,T)});const h=vO();let p=!1;if(this.lastChange>0&&h-this.lastChange<this.captureTimeout&&d.length>0&&!c&&!u){const b=d[d.length-1];b.deletions=Ip([b.deletions,l.deleteSet]),b.insertions=Ip([b.insertions,f])}else d.push(new uD(l.deleteSet,f)),p=!0;!c&&!u&&(this.lastChange=h),$o(l,l.deleteSet,b=>{b instanceof ot&&this.scope.some(E=>E===l.doc||ll(E,b))&&_g(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=Ns(e)?e:[e],e.forEach(r=>{n.has(r)||(n.add(r),(r instanceof Ht?r.doc!==this.doc:r!==this.doc)&&ST("[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(o=>Lb(r,this,o)),this.undoStack=[]),n&&(this.redoStack.forEach(o=>Lb(r,this,o)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:e,redoStackCleared:n}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=Rb(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=Rb(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*dD(t){const e=Me(t.restDecoder);for(let n=0;n<e;n++){const r=Me(t.restDecoder),o=t.readClient();let i=Me(t.restDecoder);for(let s=0;s<r;s++){const a=t.readInfo();if(a===10){const l=Me(t.restDecoder);yield new Kn(Ce(o,i),l),i+=l}else if((Id&a)!==0){const l=(a&(fo|an))===0,c=new ot(Ce(o,i),null,(a&an)===an?t.readLeftID():null,null,(a&fo)===fo?t.readRightID():null,l?t.readParentInfo()?t.readString():t.readLeftID():null,l&&(a&tl)===tl?t.readString():null,cw(t,a));yield c,i+=c.length}else{const l=t.readLen();yield new Yn(Ce(o,i),l),i+=l}}}}class Cg{constructor(e,n){this.gen=dD(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===Kn);return this.curr}}class kg{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const fD=t=>yu(t,OT,Ll),hD=(t,e)=>{if(t.constructor===Yn){const{client:n,clock:r}=t.id;return new Yn(Ce(n,r+e),t.length-e)}else if(t.constructor===Kn){const{client:n,clock:r}=t.id;return new Kn(Ce(n,r+e),t.length-e)}else{const n=t,{client:r,clock:o}=n.id;return new ot(Ce(r,o+e),null,Ce(r,o+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},yu=(t,e=Ls,n=_i)=>{if(t.length===1)return t[0];const r=t.map(u=>new e(js(u)));let o=r.map(u=>new Cg(u,!0)),i=null;const s=new n,a=new kg(s);for(;o=o.filter(f=>f.curr!==null),o.sort((f,h)=>{if(f.curr.id.client===h.curr.id.client){const p=f.curr.id.clock-h.curr.id.clock;return p===0?f.curr.constructor===h.curr.constructor?0:f.curr.constructor===Kn?1:-1:p}else return h.curr.id.client-f.curr.id.client}),o.length!==0;){const u=o[0],d=u.curr.id.client;if(i!==null){let f=u.curr,h=!1;for(;f!==null&&f.id.clock+f.length<=i.struct.id.clock+i.struct.length&&f.id.client>=i.struct.id.client;)f=u.next(),h=!0;if(f===null||f.id.client!==d||h&&f.id.clock>i.struct.id.clock+i.struct.length)continue;if(d!==i.struct.id.client)Ao(a,i.struct,i.offset),i={struct:f,offset:0},u.next();else if(i.struct.id.clock+i.struct.length<f.id.clock)if(i.struct.constructor===Kn)i.struct.length=f.id.clock+f.length-i.struct.id.clock;else{Ao(a,i.struct,i.offset);const p=f.id.clock-i.struct.id.clock-i.struct.length;i={struct:new Kn(Ce(d,i.struct.id.clock+i.struct.length),p),offset:0}}else{const p=i.struct.id.clock+i.struct.length-f.id.clock;p>0&&(i.struct.constructor===Kn?i.struct.length-=p:f=hD(f,p)),i.struct.mergeWith(f)||(Ao(a,i.struct,i.offset),i={struct:f,offset:0},u.next())}}else i={struct:u.curr,offset:0},u.next();for(let f=u.curr;f!==null&&f.id.client===d&&f.id.clock===i.struct.id.clock+i.struct.length&&f.constructor!==Kn;f=u.next())Ao(a,i.struct,i.offset),i={struct:f,offset:0}}i!==null&&(Ao(a,i.struct,i.offset),i=null),Tg(a);const l=r.map(u=>yg(u)),c=Ip(l);return Ys(s,c),s.toUint8Array()},pD=(t,e,n=Ls,r=_i)=>{const o=RT(e),i=new r,s=new kg(i),a=new n(js(t)),l=new Cg(a,!1);for(;l.curr;){const u=l.curr,d=u.id.client,f=o.get(d)||0;if(l.curr.constructor===Kn){l.next();continue}if(u.id.clock+u.length>f)for(Ao(s,u,gr(f-u.id.clock,0)),l.next();l.curr&&l.curr.id.client===d;)Ao(s,l.curr,0),l.next();else for(;l.curr&&l.curr.id.client===d&&l.curr.id.clock+l.curr.length<=f;)l.next()}Tg(s);const c=yg(a);return Ys(i,c),i.toUint8Array()},zT=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:dr(t.encoder.restEncoder)}),t.encoder.restEncoder=Ol(),t.written=0)},Ao=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&zT(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++},Tg=t=>{zT(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),Md(e,r.restEncoder)}},mD=(t,e,n,r)=>{const o=new n(js(t)),i=new Cg(o,!1),s=new r,a=new kg(s);for(let c=i.curr;c!==null;c=i.next())Ao(a,e(c),0);Tg(a);const l=yg(o);return Ys(s,l),s.toUint8Array()},gD=t=>mD(t,PO,Ls,Ll),Pb="You must not compute changes after the event-handler fired.";class Fd{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=bD(this.currentTarget,this.target))}deletes(e){return Gs(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Fr(Pb);const e=new Map,n=this.target;this.transaction.changed.get(n).forEach(o=>{if(o!==null){const i=n._map.get(o);let s,a;if(this.adds(i)){let l=i.left;for(;l!==null&&this.adds(l);)l=l.left;if(this.deletes(i))if(l!==null&&this.deletes(l))s="delete",a=$f(l.content.getContent());else return;else l!==null&&this.deletes(l)?(s="update",a=$f(l.content.getContent())):(s="add",a=void 0)}else if(this.deletes(i))s="delete",a=$f(i.content.getContent());else return;e.set(o,{action:s,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 Fr(Pb);const n=this.target,r=Ai(),o=Ai(),i=[];if(e={added:r,deleted:o,delta:i,keys:this.keys},this.transaction.changed.get(n).has(null)){let a=null;const l=()=>{a&&i.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,o.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 bD=(t,e)=>{const n=[];for(;e._item!==null&&e!==t;){if(e._item.parentSub!==null)n.unshift(e._item.parentSub);else{let r=0,o=e._item.parent._start;for(;o!==e._item&&o!==null;)!o.deleted&&o.countable&&(r+=o.length),o=o.right;n.unshift(r)}e=e._item.parent}return n},Zt=()=>{ST("Invalid access: Add Yjs type to a document before reading data.")},qT=80;let wg=0;class yD{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=wg++}}const ED=t=>{t.timestamp=wg++},WT=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=wg++},xD=(t,e,n)=>{if(t.length>=qT){const r=t.reduce((o,i)=>o.timestamp<i.timestamp?o:i);return WT(r,e,n),r}else{const r=new yD(e,n);return t.push(r),r}},Hd=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;const n=t._searchMarker.length===0?null:t._searchMarker.reduce((i,s)=>Lc(e-i.index)<Lc(e-s.index)?i:s);let r=t._start,o=0;for(n!==null&&(r=n.p,o=n.index,ED(n));r.right!==null&&o<e;){if(!r.deleted&&r.countable){if(e<o+r.length)break;o+=r.length}r=r.right}for(;r.left!==null&&o>e;)r=r.left,!r.deleted&&r.countable&&(o-=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&&(o-=r.length);return n!==null&&Lc(n.index-o)<r.parent.length/qT?(WT(n,r,o),n):xD(t._searchMarker,r,o)},ul=(t,e,n)=>{for(let r=t.length-1;r>=0;r--){const o=t[r];if(n>0){let i=o.p;for(i.marker=!1;i&&(i.deleted||!i.countable);)i=i.left,i&&!i.deleted&&i.countable&&(o.index-=i.length);if(i===null||i.marker===!0){t.splice(r,1);continue}o.p=i,i.marker=!0}(e<o.index||n>0&&e===o.index)&&(o.index=gr(e,o.index+n))}},Ud=(t,e,n)=>{const r=t,o=e.changedParentTypes;for(;Ur(o,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;BT(r._eH,n,e)};class Ht{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=Ab(),this._dEH=Ab(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw Jn()}clone(){throw Jn()}_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){_b(this._eH,e)}observeDeep(e){_b(this._dEH,e)}unobserve(e){Nb(this._eH,e)}unobserveDeep(e){Nb(this._dEH,e)}toJSON(){}}const GT=(t,e,n)=>{t.doc??Zt(),e<0&&(e=t._length+e),n<0&&(n=t._length+n);let r=n-e;const o=[];let i=t._start;for(;i!==null&&r>0;){if(i.countable&&!i.deleted){const s=i.content.getContent();if(s.length<=e)e-=s.length;else{for(let a=e;a<s.length&&r>0;a++)o.push(s[a]),r--;e=0}}i=i.right}return o},YT=t=>{t.doc??Zt();const e=[];let n=t._start;for(;n!==null;){if(n.countable&&!n.deleted){const r=n.content.getContent();for(let o=0;o<r.length;o++)e.push(r[o])}n=n.right}return e},KT=(t,e)=>{const n=[];let r=t._start;for(;r!==null;){if(r.countable&&li(r,e)){const o=r.content.getContent();for(let i=0;i<o.length;i++)n.push(o[i])}r=r.right}return n},dl=(t,e)=>{let n=0,r=t._start;for(t.doc??Zt();r!==null;){if(r.countable&&!r.deleted){const o=r.content.getContent();for(let i=0;i<o.length;i++)e(o[i],n++,t)}r=r.right}},QT=(t,e)=>{const n=[];return dl(t,(r,o)=>{n.push(e(r,o,t))}),n},CD=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 o=n[r++];return n.length<=r&&(n=null),{done:!1,value:o}}}},XT=(t,e)=>{t.doc??Zt();const n=Hd(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}},Eu=(t,e,n,r)=>{let o=n;const i=t.doc,s=i.clientID,a=i.store,l=n===null?e._start:n.right;let c=[];const u=()=>{c.length>0&&(o=new ot(Ce(s,bt(a,s)),o,o&&o.lastId,l,l&&l.id,e,null,new Ii(c)),o.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:o=new ot(Ce(s,bt(a,s)),o,o&&o.lastId,l,l&&l.id,e,null,new Pl(new Uint8Array(d))),o.integrate(t,0);break;case Jo:o=new ot(Ce(s,bt(a,s)),o,o&&o.lastId,l,l&&l.id,e,null,new Bl(d)),o.integrate(t,0);break;default:if(d instanceof Ht)o=new ot(Ce(s,bt(a,s)),o,o&&o.lastId,l,l&&l.id,e,null,new xr(d)),o.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),u()},ZT=()=>Fr("Length exceeded!"),JT=(t,e,n,r)=>{if(n>e._length)throw ZT();if(n===0)return e._searchMarker&&ul(e._searchMarker,n,r.length),Eu(t,e,null,r);const o=n,i=Hd(e,n);let s=e._start;for(i!==null&&(s=i.p,n-=i.index,n===0&&(s=s.prev,n+=s&&s.countable&&!s.deleted?s.length:0));s!==null;s=s.right)if(!s.deleted&&s.countable){if(n<=s.length){n<s.length&&xn(t,Ce(s.id.client,s.id.clock+n));break}n-=s.length}return e._searchMarker&&ul(e._searchMarker,o,r.length),Eu(t,e,s,r)},kD=(t,e,n)=>{let o=(e._searchMarker||[]).reduce((i,s)=>s.index>i.index?s:i,{index:0,p:e._start}).p;if(o)for(;o.right;)o=o.right;return Eu(t,e,o,n)},ew=(t,e,n,r)=>{if(r===0)return;const o=n,i=r,s=Hd(e,n);let a=e._start;for(s!==null&&(a=s.p,n-=s.index);a!==null&&n>0;a=a.right)!a.deleted&&a.countable&&(n<a.length&&xn(t,Ce(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&xn(t,Ce(a.id.client,a.id.clock+r)),a.delete(t),r-=a.length),a=a.right;if(r>0)throw ZT();e._searchMarker&&ul(e._searchMarker,o,-i+r)},xu=(t,e,n)=>{const r=e._map.get(n);r!==void 0&&r.delete(t)},Sg=(t,e,n,r)=>{const o=e._map.get(n)||null,i=t.doc,s=i.clientID;let a;if(r==null)a=new Ii([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:a=new Ii([r]);break;case Uint8Array:a=new Pl(r);break;case Jo:a=new Bl(r);break;default:if(r instanceof Ht)a=new xr(r);else throw new Error("Unexpected content type")}new ot(Ce(s,bt(i.store,s)),o,o&&o.lastId,null,null,e,n,a).integrate(t,0)},vg=(t,e)=>{t.doc??Zt();const n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},tw=t=>{const e={};return t.doc??Zt(),t._map.forEach((n,r)=>{n.deleted||(e[r]=n.content.getContent()[n.length-1])}),e},nw=(t,e)=>{t.doc??Zt();const n=t._map.get(e);return n!==void 0&&!n.deleted},TD=(t,e)=>{const n={};return t._map.forEach((r,o)=>{let i=r;for(;i!==null&&(!e.sv.has(i.id.client)||i.id.clock>=(e.sv.get(i.id.client)||0));)i=i.left;i!==null&&li(i,e)&&(n[o]=i.content.getContent()[i.length-1])}),n},ec=t=>(t.doc??Zt(),U4(t._map.entries(),e=>!e[1].deleted));class wD extends Fd{}class Es extends Ht{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const n=new Es;return n.push(e),n}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Es}clone(){const e=new Es;return e.insert(0,this.toArray().map(n=>n instanceof Ht?n.clone():n)),e}get length(){return this.doc??Zt(),this._length}_callObserver(e,n){super._callObserver(e,n),Ud(this,e,new wD(this,e))}insert(e,n){this.doc!==null?Xe(this.doc,r=>{JT(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?Xe(this.doc,n=>{kD(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?Xe(this.doc,r=>{ew(r,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return XT(this,e)}toArray(){return YT(this)}slice(e=0,n=this.length){return GT(this,e,n)}toJSON(){return this.map(e=>e instanceof Ht?e.toJSON():e)}map(e){return QT(this,e)}forEach(e){dl(this,e)}[Symbol.iterator](){return CD(this)}_write(e){e.writeTypeRef(KD)}}const SD=t=>new Es;class vD extends Fd{constructor(e,n,r){super(e,n),this.keysChanged=r}}class Rs extends Ht{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,o)=>{this.set(o,r)}),this._prelimContent=null}_copy(){return new Rs}clone(){const e=new Rs;return this.forEach((n,r)=>{e.set(r,n instanceof Ht?n.clone():n)}),e}_callObserver(e,n){Ud(this,e,new vD(this,e,n))}toJSON(){this.doc??Zt();const e={};return this._map.forEach((n,r)=>{if(!n.deleted){const o=n.content.getContent()[n.length-1];e[r]=o instanceof Ht?o.toJSON():o}}),e}get size(){return[...ec(this)].length}keys(){return Kf(ec(this),e=>e[0])}values(){return Kf(ec(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return Kf(ec(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??Zt(),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?Xe(this.doc,n=>{xu(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?Xe(this.doc,r=>{Sg(r,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return vg(this,e)}has(e){return nw(this,e)}clear(){this.doc!==null?Xe(this.doc,e=>{this.forEach(function(n,r,o){xu(e,o,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(QD)}}const AD=t=>new Rs,Lo=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&LO(t,e);class Dp{constructor(e,n,r,o){this.left=e,this.right=n,this.index=r,this.currentAttributes=o}forward(){switch(this.right===null&&un(),this.right.content.constructor){case _t:this.right.deleted||Ks(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const Bb=(t,e,n)=>{for(;e.right!==null&&n>0;){switch(e.right.content.constructor){case _t:e.right.deleted||Ks(e.currentAttributes,e.right.content);break;default:e.right.deleted||(n<e.right.length&&xn(t,Ce(e.right.id.client,e.right.id.clock+n)),e.index+=e.right.length,n-=e.right.length);break}e.left=e.right,e.right=e.right.right}return e},tc=(t,e,n,r)=>{const o=new Map,i=r?Hd(e,n):null;if(i){const s=new Dp(i.p.left,i.p,i.index,o);return Bb(t,s,n-i.index)}else{const s=new Dp(null,e._start,0,o);return Bb(t,s,n)}},rw=(t,e,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===_t&&Lo(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const o=t.doc,i=o.clientID;r.forEach((s,a)=>{const l=n.left,c=n.right,u=new ot(Ce(i,bt(o.store,i)),l,l&&l.lastId,c,c&&c.id,e,null,new _t(a,s));u.integrate(t,0),n.right=u,n.forward()})},Ks=(t,e)=>{const{key:n,value:r}=e;r===null?t.delete(n):t.set(n,r)},ow=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===_t&&Lo(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},iw=(t,e,n,r)=>{const o=t.doc,i=o.clientID,s=new Map;for(const a in r){const l=r[a],c=n.currentAttributes.get(a)??null;if(!Lo(c,l)){s.set(a,c);const{left:u,right:d}=n;n.right=new ot(Ce(i,bt(o.store,i)),u,u&&u.lastId,d,d&&d.id,e,null,new _t(a,l)),n.right.integrate(t,0),n.forward()}}return s},Zf=(t,e,n,r,o)=>{n.currentAttributes.forEach((f,h)=>{o[h]===void 0&&(o[h]=null)});const i=t.doc,s=i.clientID;ow(n,o);const a=iw(t,e,n,o),l=r.constructor===String?new br(r):r instanceof Ht?new xr(r):new Vi(r);let{left:c,right:u,index:d}=n;e._searchMarker&&ul(e._searchMarker,n.index,l.getLength()),u=new ot(Ce(s,bt(i.store,s)),c,c&&c.lastId,u,u&&u.id,e,null,l),u.integrate(t,0),n.right=u,n.index=d,n.forward(),rw(t,e,n,a)},Fb=(t,e,n,r,o)=>{const i=t.doc,s=i.clientID;ow(n,o);const a=iw(t,e,n,o);e:for(;n.right!==null&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===_t));){if(!n.right.deleted)switch(n.right.content.constructor){case _t:{const{key:l,value:c}=n.right.content,u=o[l];if(u!==void 0){if(Lo(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&&xn(t,Ce(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+=`
|
|
12
|
+
`;n.right=new ot(Ce(s,bt(i.store,s)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new br(l)),n.right.integrate(t,0),n.forward()}rw(t,e,n,a)},sw=(t,e,n,r,o)=>{let i=e;const s=Zn();for(;i&&(!i.countable||i.deleted);){if(!i.deleted&&i.content.constructor===_t){const c=i.content;s.set(c.key,c)}i=i.right}let a=0,l=!1;for(;e!==i;){if(n===e&&(l=!0),!e.deleted){const c=e.content;switch(c.constructor){case _t:{const{key:u,value:d}=c,f=r.get(u)??null;(s.get(u)!==c||f===d)&&(e.delete(t),a++,!l&&(o.get(u)??null)===d&&f!==d&&(f===null?o.delete(u):o.set(u,f))),!l&&!e.deleted&&Ks(o,c);break}}}e=e.right}return a},_D=(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===_t){const r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}},ND=t=>{let e=0;return Xe(t.doc,n=>{let r=t._start,o=t._start,i=Zn();const s=wp(i);for(;o;){if(o.deleted===!1)switch(o.content.constructor){case _t:Ks(s,o.content);break;default:e+=sw(n,r,o,i,s),i=wp(s),r=o;break}o=o.right}}),e},ID=t=>{const e=new Set,n=t.doc;for(const[r,o]of t.afterState.entries()){const i=t.beforeState.get(r)||0;o!==i&&VT(t,n.store.clients.get(r),i,o,s=>{!s.deleted&&s.content.constructor===_t&&s.constructor!==Yn&&e.add(s.parent)})}Xe(n,r=>{$o(t,t.deleteSet,o=>{if(o instanceof Yn||!o.parent._hasFormatting||e.has(o.parent))return;const i=o.parent;o.content.constructor===_t?e.add(i):_D(r,o)});for(const o of e)ND(o)})},Hb=(t,e,n)=>{const r=n,o=wp(e.currentAttributes),i=e.right;for(;n>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case xr:case Vi:case br:n<e.right.length&&xn(t,Ce(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t);break}e.forward()}i&&sw(t,i,e.right,o,e.currentAttributes);const s=(e.left||e.right).parent;return s._searchMarker&&ul(s._searchMarker,e.index,-r+n),e};class MD extends Fd{constructor(e,n,r){super(e,n),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(o=>{o===null?this.childListChanged=!0:this.keysChanged.add(o)})}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=[];Xe(e,r=>{const o=new Map,i=new Map;let s=this.target._start,a=null;const l={};let c="",u=0,d=0;const f=()=>{if(a!==null){let h=null;switch(a){case"delete":d>0&&(h={delete:d}),d=0;break;case"insert":(typeof c=="object"||c.length>0)&&(h={insert:c},o.size>0&&(h.attributes={},o.forEach((p,g)=>{p!==null&&(h.attributes[g]=p)}))),c="";break;case"retain":u>0&&(h={retain:u},DO(l)||(h.attributes=MO({},l))),u=0;break}h&&n.push(h),a=null}};for(;s!==null;){switch(s.content.constructor){case xr:case Vi:this.adds(s)?this.deletes(s)||(f(),a="insert",c=s.content.getContent()[0],f()):this.deletes(s)?(a!=="delete"&&(f(),a="delete"),d+=1):s.deleted||(a!=="retain"&&(f(),a="retain"),u+=1);break;case br:this.adds(s)?this.deletes(s)||(a!=="insert"&&(f(),a="insert"),c+=s.content.str):this.deletes(s)?(a!=="delete"&&(f(),a="delete"),d+=s.length):s.deleted||(a!=="retain"&&(f(),a="retain"),u+=s.length);break;case _t:{const{key:h,value:p}=s.content;if(this.adds(s)){if(!this.deletes(s)){const g=o.get(h)??null;Lo(g,p)?p!==null&&s.delete(r):(a==="retain"&&f(),Lo(p,i.get(h)??null)?delete l[h]:l[h]=p)}}else if(this.deletes(s)){i.set(h,p);const g=o.get(h)??null;Lo(g,p)||(a==="retain"&&f(),l[h]=g)}else if(!s.deleted){i.set(h,p);const g=l[h];g!==void 0&&(Lo(g,p)?g!==null&&s.delete(r):(a==="retain"&&f(),p===null?delete l[h]:l[h]=p))}s.deleted||(a==="insert"&&f(),Ks(o,s.content));break}}s=s.right}for(f();n.length>0;){const h=n[n.length-1];if(h.retain!==void 0&&h.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}}class jo extends Ht{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??Zt(),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 jo}clone(){const e=new jo;return e.applyDelta(this.toDelta()),e}_callObserver(e,n){super._callObserver(e,n);const r=new MD(this,e,n);Ud(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??Zt();let e="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===br&&(e+=n.content.str),n=n.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:n=!0}={}){this.doc!==null?Xe(this.doc,r=>{const o=new Dp(null,this._start,0,new Map);for(let i=0;i<e.length;i++){const s=e[i];if(s.insert!==void 0){const a=!n&&typeof s.insert=="string"&&i===e.length-1&&o.right===null&&s.insert.slice(-1)===`
|
|
13
|
+
`?s.insert.slice(0,-1):s.insert;(typeof a!="string"||a.length>0)&&Zf(r,this,o,a,s.attributes||{})}else s.retain!==void 0?Fb(r,this,o,s.retain,s.attributes||{}):s.delete!==void 0&&Hb(r,o,s.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,r){this.doc??Zt();const o=[],i=new Map,s=this.doc;let a="",l=this._start;function c(){if(a.length>0){const d={};let f=!1;i.forEach((p,g)=>{f=!0,d[g]=p});const h={insert:a};f&&(h.attributes=d),o.push(h),a=""}}const u=()=>{for(;l!==null;){if(li(l,e)||n!==void 0&&li(l,n))switch(l.content.constructor){case br:{const d=i.get("ychange");e!==void 0&&!li(l,e)?(d===void 0||d.user!==l.id.client||d.type!=="removed")&&(c(),i.set("ychange",r?r("removed",l.id):{type:"removed"})):n!==void 0&&!li(l,n)?(d===void 0||d.user!==l.id.client||d.type!=="added")&&(c(),i.set("ychange",r?r("added",l.id):{type:"added"})):d!==void 0&&(c(),i.delete("ychange")),a+=l.content.str;break}case xr:case Vi:{c();const d={insert:l.content.getContent()[0]};if(i.size>0){const f={};d.attributes=f,i.forEach((h,p)=>{f[p]=h})}o.push(d);break}case _t:li(l,e)&&(c(),Ks(i,l.content));break}l=l.right}c()};return e||n?Xe(s,d=>{e&&Mp(d,e),n&&Mp(d,n),u()},"cleanup"):u(),o}insert(e,n,r){if(n.length<=0)return;const o=this.doc;o!==null?Xe(o,i=>{const s=tc(i,this,e,!r);r||(r={},s.currentAttributes.forEach((a,l)=>{r[l]=a})),Zf(i,this,s,n,r)}):this._pending.push(()=>this.insert(e,n,r))}insertEmbed(e,n,r){const o=this.doc;o!==null?Xe(o,i=>{const s=tc(i,this,e,!r);Zf(i,this,s,n,r||{})}):this._pending.push(()=>this.insertEmbed(e,n,r||{}))}delete(e,n){if(n===0)return;const r=this.doc;r!==null?Xe(r,o=>{Hb(o,tc(o,this,e,!0),n)}):this._pending.push(()=>this.delete(e,n))}format(e,n,r){if(n===0)return;const o=this.doc;o!==null?Xe(o,i=>{const s=tc(i,this,e,!1);s.right!==null&&Fb(i,this,s,n,r)}):this._pending.push(()=>this.format(e,n,r))}removeAttribute(e){this.doc!==null?Xe(this.doc,n=>{xu(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?Xe(this.doc,r=>{Sg(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return vg(this,e)}getAttributes(){return tw(this)}_write(e){e.writeTypeRef(XD)}}const OD=t=>new jo;class Jf{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??Zt()}[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===Yt||n.constructor===Ni)&&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 Ni extends Ht{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 Ni}clone(){const e=new Ni;return e.insert(0,this.toArray().map(n=>n instanceof Ht?n.clone():n)),e}get length(){return this.doc??Zt(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new Jf(this,e)}querySelector(e){e=e.toUpperCase();const r=new Jf(this,o=>o.nodeName&&o.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),Vo(new Jf(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){Ud(this,e,new RD(this,n,e))}toString(){return QT(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,n={},r){const o=e.createDocumentFragment();return r!==void 0&&r._createAssociation(o,this),dl(this,i=>{o.insertBefore(i.toDOM(e,n,r),null)}),o}insert(e,n){this.doc!==null?Xe(this.doc,r=>{JT(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)Xe(this.doc,r=>{const o=e&&e instanceof Ht?e._item:e;Eu(r,this,o,n)});else{const r=this._prelimContent,o=e===null?0:r.findIndex(i=>i===e)+1;if(o===0&&e!==null)throw Fr("Reference item not found");r.splice(o,0,...n)}}delete(e,n=1){this.doc!==null?Xe(this.doc,r=>{ew(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return YT(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return XT(this,e)}slice(e=0,n=this.length){return GT(this,e,n)}forEach(e){dl(this,e)}_write(e){e.writeTypeRef(JD)}}const DD=t=>new Ni;class Yt extends Ni{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,o)=>{this.setAttribute(o,r)}),this._prelimAttrs=null}_copy(){return new Yt(this.nodeName)}clone(){const e=new Yt(this.nodeName),n=this.getAttributes();return OO(n,(r,o)=>{e.setAttribute(o,r)}),e.insert(0,this.toArray().map(r=>r instanceof Ht?r.clone():r)),e}toString(){const e=this.getAttributes(),n=[],r=[];for(const a in e)r.push(a);r.sort();const o=r.length;for(let a=0;a<o;a++){const l=r[a];n.push(l+'="'+e[l]+'"')}const i=this.nodeName.toLocaleLowerCase(),s=n.length>0?" "+n.join(" "):"";return`<${i}${s}>${super.toString()}</${i}>`}removeAttribute(e){this.doc!==null?Xe(this.doc,n=>{xu(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?Xe(this.doc,r=>{Sg(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return vg(this,e)}hasAttribute(e){return nw(this,e)}getAttributes(e){return e?TD(this,e):tw(this)}toDOM(e=document,n={},r){const o=e.createElement(this.nodeName),i=this.getAttributes();for(const s in i){const a=i[s];typeof a=="string"&&o.setAttribute(s,a)}return dl(this,s=>{o.appendChild(s.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(o,this),o}_write(e){e.writeTypeRef(ZD),e.writeKey(this.nodeName)}}const LD=t=>new Yt(t.readKey());class RD extends Fd{constructor(e,n,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(o=>{o===null?this.childListChanged=!0:this.attributesChanged.add(o)})}}class Cu extends Rs{constructor(e){super(),this.hookName=e}_copy(){return new Cu(this.hookName)}clone(){const e=new Cu(this.hookName);return this.forEach((n,r)=>{e.set(r,n)}),e}toDOM(e=document,n={},r){const o=n[this.hookName];let i;return o!==void 0?i=o.createDom(this):i=document.createElement(this.hookName),i.setAttribute("data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(eL),e.writeKey(this.hookName)}}const PD=t=>new Cu(t.readKey());class Pn extends jo{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 Pn}clone(){const e=new Pn;return e.applyDelta(this.toDelta()),e}toDOM(e=document,n,r){const o=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(o,this),o}toString(){return this.toDelta().map(e=>{const n=[];for(const o in e.attributes){const i=[];for(const s in e.attributes[o])i.push({key:s,value:e.attributes[o][s]});i.sort((s,a)=>s.key<a.key?-1:1),n.push({nodeName:o,attrs:i})}n.sort((o,i)=>o.nodeName<i.nodeName?-1:1);let r="";for(let o=0;o<n.length;o++){const i=n[o];r+=`<${i.nodeName}`;for(let s=0;s<i.attrs.length;s++){const a=i.attrs[s];r+=` ${a.key}="${a.value}"`}r+=">"}r+=e.insert;for(let o=n.length-1;o>=0;o--)r+=`</${n[o].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(tL)}}const BD=t=>new Pn;class Ag{constructor(e,n){this.id=e,this.length=n}get deleted(){throw Jn()}mergeWith(e){return!1}write(e,n,r){throw Jn()}integrate(e,n){throw Jn()}}const FD=0;class Yn extends Ag{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),UT(e.doc.store,this)}write(e,n){e.writeInfo(FD),e.writeLen(this.length-n)}getMissing(e,n){return null}}class Pl{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new Pl(this.content)}splice(e){throw Jn()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}const HD=t=>new Pl(t.readBuf());class fl{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new fl(this.len)}splice(e){const n=new fl(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){sl(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 UD=t=>new fl(t.readLen()),aw=(t,e)=>new Jo({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class Bl{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 Bl(aw(this.doc.guid,this.opts))}splice(e){throw Jn()}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 VD=t=>new Bl(aw(t.readString(),t.readAny()));class Vi{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new Vi(this.embed)}splice(e){throw Jn()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}const $D=t=>new Vi(t.readJSON());class _t{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new _t(this.key,this.value)}splice(e){throw Jn()}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 jD=t=>new _t(t.readKey(),t.readJSON());class ku{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new ku(this.arr)}splice(e){const n=new ku(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 o=n;o<r;o++){const i=this.arr[o];e.writeString(i===void 0?"undefined":JSON.stringify(i))}}getRef(){return 2}}const zD=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++){const o=t.readString();o==="undefined"?n.push(void 0):n.push(JSON.parse(o))}return new ku(n)},qD=pu("node_env")==="development";class Ii{constructor(e){this.arr=e,qD&&tT(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Ii(this.arr)}splice(e){const n=new Ii(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 o=n;o<r;o++){const i=this.arr[o];e.writeAny(i)}}getRef(){return 8}}const WD=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new Ii(n)};class br{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new br(this.str)}splice(e){const n=new br(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 GD=t=>new br(t.readString()),YD=[SD,AD,OD,LD,DD,PD,BD],KD=0,QD=1,XD=2,ZD=3,JD=4,eL=5,tL=6;class xr{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new xr(this.type._copy())}splice(e){throw Jn()}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 nL=t=>new xr(YD[t.readTypeRef()](t)),Lp=(t,e)=>{let n=e,r=0,o;do r>0&&(n=Ce(n.client,n.clock+r)),o=ys(t,n),r=n.clock-o.id.clock,n=o.redone;while(n!==null&&o instanceof ot);return{item:o,diff:r}},_g=(t,e)=>{for(;t!==null&&t.keep!==e;)t.keep=e,t=t.parent._item},Tu=(t,e,n)=>{const{client:r,clock:o}=e.id,i=new ot(Ce(r,o+n),e,Ce(r,o+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&i.markDeleted(),e.keep&&(i.keep=!0),e.redone!==null&&(i.redone=Ce(e.redone.client,e.redone.clock+n)),e.right=i,i.right!==null&&(i.right.left=i),t._mergeStructs.push(i),i.parentSub!==null&&i.right===null&&i.parent._map.set(i.parentSub,i),e.length=n,i},Ub=(t,e)=>ng(t,n=>Gs(n.deletions,e)),lw=(t,e,n,r,o,i)=>{const s=t.doc,a=s.store,l=s.clientID,c=e.redone;if(c!==null)return xn(t,c);let u=e.parent._item,d=null,f;if(u!==null&&u.deleted===!0){if(u.redone===null&&(!n.has(u)||lw(t,u,n,r,o,i)===null))return null;for(;u.redone!==null;)u=xn(t,u.redone)}const h=u===null?e.parent:u.content.type;if(e.parentSub===null){for(d=e.left,f=e;d!==null;){let E=d;for(;E!==null&&E.parent._item!==u;)E=E.redone===null?null:xn(t,E.redone);if(E!==null&&E.parent._item===u){d=E;break}d=d.left}for(;f!==null;){let E=f;for(;E!==null&&E.parent._item!==u;)E=E.redone===null?null:xn(t,E.redone);if(E!==null&&E.parent._item===u){f=E;break}f=f.right}}else if(f=null,e.right&&!o){for(d=e;d!==null&&d.right!==null&&(d.right.redone||Gs(r,d.right.id)||Ub(i.undoStack,d.right.id)||Ub(i.redoStack,d.right.id));)for(d=d.right;d.redone;)d=xn(t,d.redone);if(d&&d.right!==null)return null}else d=h._map.get(e.parentSub)||null;const p=bt(a,l),g=Ce(l,p),b=new ot(g,d,d&&d.lastId,f,f&&f.id,h,e.parentSub,e.content.copy());return e.redone=g,_g(b,!0),b.integrate(t,0),b};let ot=class Rp extends Ag{constructor(e,n,r,o,i,s,a,l){super(e,l.getLength()),this.origin=r,this.left=n,this.right=o,this.rightOrigin=i,this.parent=s,this.parentSub=a,this.redone=null,this.content=l,this.info=this.content.isCountable()?fb:0}set marker(e){(this.info&zf)>0!==e&&(this.info^=zf)}get marker(){return(this.info&zf)>0}get keep(){return(this.info&db)>0}set keep(e){this.keep!==e&&(this.info^=db)}get countable(){return(this.info&fb)>0}get deleted(){return(this.info&jf)>0}set deleted(e){this.deleted!==e&&(this.info^=jf)}markDeleted(){this.info|=jf}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=bt(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=bt(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===bs&&this.id.client!==this.parent.client&&this.parent.clock>=bt(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=Mb(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=xn(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Yn||this.right&&this.right.constructor===Yn)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===Rp?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===Rp&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===bs){const r=ys(n,this.parent);r.constructor===Yn?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=Mb(e,e.doc.store,Ce(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,o;if(r!==null)o=r.right;else if(this.parentSub!==null)for(o=this.parent._map.get(this.parentSub)||null;o!==null&&o.left!==null;)o=o.left;else o=this.parent._start;const i=new Set,s=new Set;for(;o!==null&&o!==this.right;){if(s.add(o),i.add(o),cs(this.origin,o.origin)){if(o.id.client<this.id.client)r=o,i.clear();else if(cs(this.rightOrigin,o.rightOrigin))break}else if(o.origin!==null&&s.has(ys(e.doc.store,o.origin)))i.has(ys(e.doc.store,o.origin))||(r=o,i.clear());else break;o=o.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),UT(e.doc.store,this),this.content.integrate(e,this),Db(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new Yn(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:Ce(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&cs(e.origin,this.lastId)&&this.right===e&&cs(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(),sl(e.deleteSet,this.id.client,this.id.clock,this.length),Db(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw un();this.content.gc(e),n?sD(e,this,new Yn(this.id,this.length)):this.content=new fl(this.length)}write(e,n){const r=n>0?Ce(this.id.client,this.id.clock+n-1):this.origin,o=this.rightOrigin,i=this.parentSub,s=this.content.getRef()&Id|(r===null?0:an)|(o===null?0:fo)|(i===null?0:tl);if(e.writeInfo(s),r!==null&&e.writeLeftID(r),o!==null&&e.writeRightID(o),r===null&&o===null){const a=this.parent;if(a._item!==void 0){const l=a._item;if(l===null){const c=al(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===bs?(e.writeParentInfo(!1),e.writeLeftID(a)):un();i!==null&&e.writeString(i)}this.content.write(e,n)}};const cw=(t,e)=>rL[e&Id](t),rL=[()=>{un()},UD,zD,HD,GD,$D,jD,nL,WD,VD,()=>{un()}],oL=10;class Kn extends Ag{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){un()}write(e,n){e.writeInfo(oL),Le(e.restEncoder,this.length-n)}getMissing(e,n){return null}}const uw=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},dw="__ $YJS$ __";uw[dw]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");uw[dw]=!0;const iL=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},sL=/[\uD800-\uDBFF]/,aL=/[\uDC00-\uDFFF]/,lL=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&sL.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&&aL.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},cL=lL,nt=new Oe("y-sync"),Lr=new Oe("y-undo"),nc=new Oe("yjs-cursor"),Rr=(t,e)=>t>>>e|t<<32-e,uL=t=>Rr(t,2)^Rr(t,13)^Rr(t,22),dL=t=>Rr(t,6)^Rr(t,11)^Rr(t,25),fL=t=>Rr(t,7)^Rr(t,18)^t>>>3,hL=t=>Rr(t,17)^Rr(t,19)^t>>>10,pL=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]),mL=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class gL{constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(mL),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,n=this._W;for(let d=16;d<64;d++)n[d]=hL(n[d-2])+n[d-7]+fL(n[d-15])+n[d-16];let r=e[0],o=e[1],i=e[2],s=e[3],a=e[4],l=e[5],c=e[6],u=e[7];for(let d=0,f,h;d<64;d++)f=u+dL(a)+(a&l^~a&c)+pL[d]+n[d]>>>0,h=uL(r)+(r&o^r&i^o&i)>>>0,u=c,c=l,l=a,a=s+f>>>0,s=i,i=o,o=r,r=f+h>>>0;e[0]+=r,e[1]+=o,e[2]+=i,e[3]+=s,e[4]+=a,e[5]+=l,e[6]+=c,e[7]+=u}digest(e){let n=0;for(;n+56<=e.length;){let s=0;for(;s<16&&n+3<e.length;s++)this._W[s]=e[n++]<<24|e[n++]<<16|e[n++]<<8|e[n++];if(n%64!==0){for(this._W.fill(0,s,16);n<e.length;)this._W[s]|=e[n]<<(3-n%4)*8,n++;this._W[s]|=an<<(3-n%4)*8}this._updateHash()}const r=n%64!==0;this._W.fill(0,0,16);let o=0;for(;n<e.length;o++)for(let s=3;s>=0&&n<e.length;s--)this._W[o]|=e[n++]<<s*8;r||(this._W[o-(n%4===0?0:1)]|=an<<(3-n%4)*8),this._W[14]=e.byteLength/zM,this._W[15]=e.byteLength*8,this._updateHash();const i=new Uint8Array(32);for(let s=0;s<this._H.length;s++)for(let a=0;a<4;a++)i[s*4+a]=this._H[s]>>>(3-a)*8;return i}}const bL=t=>new gL().digest(t),yL=t=>{for(let n=6;n<t.length;n++)t[n%6]=t[n%6]^t[n];return t.slice(0,6)},EL=t=>qO(yL(bL(GO(t)))),wu=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!Gs(e.ds,t.id),xL=[{light:"#ecd44433",dark:"#ecd444"}],CL=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){const r=Ai();t.forEach(o=>r.add(o)),e=e.filter(o=>!r.has(o))}t.set(n,TO(e))}return t.get(n)},kL=(t,{colors:e=xL,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:o=()=>{},mapping:i}={})=>{let s=!1;const a=new wL(t,i),l=new ye({props:{editable:c=>{const u=nt.getState(c);return u.snapshot==null&&u.prevSnapshot==null}},key:nt,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(nt);if(d!==void 0){u=Object.assign({},u);for(const f in d)u[f]=d[f]}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)&&pg(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),i==null&&a._forceRerender(),o(),{update:()=>{const u=l.getState(c.state);if(u.snapshot==null&&u.prevSnapshot==null&&(s||c.state.doc.content.findDiffStart(c.state.doc.type.createAndFill().content)!==null)){if(s=!0,u.addToHistory===!1&&!u.isChangeOrigin){const d=Lr.getState(c.state),f=d&&d.undoManager;f&&f.stopCapturing()}a.mux(()=>{u.doc.transact(d=>{d.meta.set("addToHistory",u.addToHistory),a._prosemirrorChanged(c.state.doc)},nt)})}},destroy:()=>{a.destroy()}})});return l},TL=(t,e,n)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")t.setSelection(new Tn(t.doc));else if(e.type==="node"){const r=Ei(n.doc,n.type,e.anchor,n.mapping);t.setSelection(le.create(t.doc,r))}else{const r=Ei(n.doc,n.type,e.anchor,n.mapping),o=Ei(n.doc,n.type,e.head,n.mapping);if(r!==null&&o!==null){const i=ae.between(t.doc.resolve(r),t.doc.resolve(o));t.setSelection(i)}}},Su=(t,e)=>({type:e.selection.jsonID,anchor:pl(e.selection.anchor,t.type,t.mapping),head:pl(e.selection.head,t.type,t.mapping)});class wL{constructor(e,n=new Map){this.type=e,this.prosemirrorView=null,this.mux=iL(),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=Su(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()?(rT&&this._domSelectionInView===null&&(pg(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 o=n.getBoundingClientRect(),i=Dl.documentElement;return o.bottom>=0&&o.right>=0&&o.left<=(window.innerWidth||i.clientWidth||0)&&o.top<=(window.innerHeight||i.clientHeight||0)}renderSnapshot(e,n){n||(n=FT(_T(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(nt,{snapshot:e,prevSnapshot:n}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const e=this.type.toArray().map(r=>Hc(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new Q(V.from(e),0,0));n.setMeta(nt,{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(o=>Hc(o,this.prosemirrorView.state.schema,this)).filter(o=>o!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new Q(V.from(n),0,0));if(e){const o=uo(gr(e.anchor,0),r.doc.content.size),i=uo(gr(e.head,0),r.doc.content.size);r.setSelection(ae.create(r.doc,o,i))}this.prosemirrorView.dispatch(r.setMeta(nt,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,n,r){let o=this.doc,i=this.type;if(e||(e=Xf(this.doc)),e instanceof Uint8Array||n instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(n instanceof Uint8Array))&&un(),o=new Jo({gc:!1}),bu(o,n),n=Xf(o),bu(o,e),e=Xf(o),i._item===null){const s=Array.from(this.doc.share.keys()).find(a=>this.doc.share.get(a)===this.type);i=o.getXmlFragment(s)}else{const s=o.store.clients.get(i._item.id.client)??[],a=tr(s,i._item.id.clock);i=s[a].content.type}this.mapping.clear(),this.mux(()=>{o.transact(s=>{const a=r.permanentUserData;a&&a.dss.forEach(d=>{$o(s,d,f=>{})});const l=(d,f)=>{const h=d==="added"?a.getUserByClientId(f.client):a.getUserByDeletedId(f);return{user:h,type:d,color:CL(r.colorMapping,r.colors,h)}},c=KT(i,new xg(n.ds,e.sv)).map(d=>!d._item.deleted||wu(d._item,e)||wu(d._item,n)?Hc(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 Q(V.from(c),0,0));this.prosemirrorView.dispatch(u.setMeta(nt,{isChangeOrigin:!0}))},nt)})}_typeChanged(e,n){if(this.prosemirrorView==null)return;const r=nt.getState(this.prosemirrorView.state);if(e.length===0||r.snapshot!=null||r.prevSnapshot!=null){this.renderSnapshot(r.snapshot,r.prevSnapshot);return}this.mux(()=>{const o=(a,l)=>this.mapping.delete(l);$o(n,n.deleteSet,a=>{if(a.constructor===ot){const l=a.content.type;l&&this.mapping.delete(l)}}),n.changed.forEach(o),n.changedParentTypes.forEach(o);const i=this.type.toArray().map(a=>fw(a,this.prosemirrorView.state.schema,this)).filter(a=>a!==null);let s=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new Q(V.from(i),0,0));TL(s,this.beforeTransactionSelection,this),s=s.setMeta(nt,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof jT}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&s.scrollIntoView(),this.prosemirrorView.dispatch(s)})}_prosemirrorChanged(e){this.doc.transact(()=>{Bp(this.doc,this.type,e,this),this.beforeTransactionSelection=Su(this,this.prosemirrorView.state)},nt)}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 fw=(t,e,n,r,o,i)=>{const s=n.mapping.get(t);if(s===void 0){if(t instanceof Yt)return Hc(t,e,n,r,o,i);throw Jn()}return s},Hc=(t,e,n,r,o,i)=>{const s=[],a=l=>{if(l instanceof Yt){const c=fw(l,e,n,r,o,i);c!==null&&s.push(c)}else{const c=l._item.right?.content?.type;c instanceof jo&&!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=SL(l,e,n,r,o,i);u!==null&&u.forEach(d=>{d!==null&&s.push(d)})}};r===void 0||o===void 0?t.toArray().forEach(a):KT(t,new xg(o.ds,r.sv)).forEach(a);try{const l=t.getAttributes(r);r!==void 0&&(wu(t._item,r)?wu(t._item,o)||(l.ychange=i?i("added",t._item.id):{type:"added"}):l.ychange=i?i("removed",t._item.id):{type:"removed"});const c=e.node(t.nodeName,l,s);return n.mapping.set(t,c),c}catch{return t.doc.transact(c=>{t._item.delete(c)},nt),n.mapping.delete(t),null}},SL=(t,e,n,r,o,i)=>{const s=[],a=t.toDelta(r,o,i);try{for(let l=0;l<a.length;l++){const c=a[l];s.push(e.text(c.insert,ML(c.attributes,e)))}}catch{return t.doc.transact(c=>{t._item.delete(c)},nt),null}return s},vL=(t,e)=>{const n=new Pn,r=t.map(o=>({insert:o.text,attributes:mw(o.marks,e)}));return n.applyDelta(r),e.mapping.set(n,t),n},AL=(t,e)=>{const n=new Yt(t.type.name);for(const r in t.attrs){const o=t.attrs[r];o!==null&&r!=="ychange"&&n.setAttribute(r,o)}return n.insert(0,Vd(t).map(r=>Pp(r,e))),e.mapping.set(n,t),n},Pp=(t,e)=>t instanceof Array?vL(t,e):AL(t,e),Vb=t=>typeof t=="object"&&t!==null,Ng=(t,e)=>{const n=Object.keys(t).filter(o=>t[o]!==null);let r=n.length===(e==null?0:Object.keys(e).filter(o=>e[o]!==null).length);for(let o=0;o<n.length&&r;o++){const i=n[o],s=t[i],a=e[i];r=i==="ychange"||s===a||Vb(s)&&Vb(a)&&Ng(s,a)}return r},Vd=t=>{const e=t.content.content,n=[];for(let r=0;r<e.length;r++){const o=e[r];if(o.isText){const i=[];for(let s=e[r];r<e.length&&s.isText;s=e[++r])i.push(s);r--,n.push(i)}else n.push(o)}return n},hw=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((r,o)=>r.insert===e[o].text&&eT(r.attributes||{}).length===e[o].marks.length&&zs(r.attributes,(i,s)=>{const a=pw(s),l=e[o].marks;return Ng(i,l.find(c=>c.type.name===a)?.attrs)}))},hl=(t,e)=>{if(t instanceof Yt&&!(e instanceof Array)&&Fp(t,e)){const n=Vd(e);return t._length===n.length&&Ng(t.getAttributes(),e.attrs)&&t.toArray().every((r,o)=>hl(r,n[o]))}return t instanceof Pn&&e instanceof Array&&hw(t,e)},vu=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),$b=(t,e,n)=>{const r=t.toArray(),o=Vd(e),i=o.length,s=r.length,a=uo(s,i);let l=0,c=0,u=!1;for(;l<a;l++){const d=r[l],f=o[l];if(vu(n.mapping.get(d),f))u=!0;else if(!hl(d,f))break}for(;l+c<a;c++){const d=r[s-c-1],f=o[i-c-1];if(vu(n.mapping.get(d),f))u=!0;else if(!hl(d,f))break}return{equalityFactor:l+c,foundMappedChild:u}},_L=t=>{let e="",n=t._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof br?e+=n.content.str:n.content instanceof _t&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},NL=(t,e,n)=>{n.mapping.set(t,e);const{nAttrs:r,str:o}=_L(t),i=e.map(c=>({insert:c.text,attributes:Object.assign({},r,mw(c.marks,n))})),{insert:s,remove:a,index:l}=cL(o,i.map(c=>c.insert).join(""));t.delete(l,a),t.insert(l,s),t.applyDelta(i.map(c=>({retain:c.insert.length,attributes:c.attributes})))},IL=/(.*)(--[a-zA-Z0-9+/=]{8})$/,pw=t=>IL.exec(t)?.[1]??t,ML=(t,e)=>{const n=[];for(const r in t)n.push(e.mark(pw(r),t[r]));return n},mw=(t,e)=>{const n={};return t.forEach(r=>{if(r.type.name!=="ychange"){const o=Ur(e.isOMark,r.type,()=>!r.type.excludes(r.type));n[o?`${r.type.name}--${EL(r.toJSON())}`:r.type.name]=r.attrs}}),n},Bp=(t,e,n,r)=>{if(e instanceof Yt&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(e,n),e instanceof Yt){const d=e.getAttributes(),f=n.attrs;for(const h in f)f[h]!==null?d[h]!==f[h]&&h!=="ychange"&&e.setAttribute(h,f[h]):e.removeAttribute(h);for(const h in d)f[h]===void 0&&e.removeAttribute(h)}const o=Vd(n),i=o.length,s=e.toArray(),a=s.length,l=uo(i,a);let c=0,u=0;for(;c<l;c++){const d=s[c],f=o[c];if(!vu(r.mapping.get(d),f))if(hl(d,f))r.mapping.set(d,f);else break}for(;u+c<l;u++){const d=s[a-u-1],f=o[i-u-1];if(!vu(r.mapping.get(d),f))if(hl(d,f))r.mapping.set(d,f);else break}t.transact(()=>{for(;a-c-u>0&&i-c-u>0;){const f=s[c],h=o[c],p=s[a-u-1],g=o[i-u-1];if(f instanceof Pn&&h instanceof Array)hw(f,h)||NL(f,h,r),c+=1;else{let b=f instanceof Yt&&Fp(f,h),E=p instanceof Yt&&Fp(p,g);if(b&&E){const x=$b(f,h,r),T=$b(p,g,r);x.foundMappedChild&&!T.foundMappedChild?E=!1:!x.foundMappedChild&&T.foundMappedChild||x.equalityFactor<T.equalityFactor?b=!1:E=!1}b?(Bp(t,f,h,r),c+=1):E?(Bp(t,p,g,r),u+=1):(r.mapping.delete(e.get(c)),e.delete(c,1),e.insert(c,[Pp(h,r)]),c+=1)}}const d=a-c-u;if(a===1&&i===0&&s[0]instanceof Pn?(r.mapping.delete(s[0]),s[0].delete(0,s[0].length)):d>0&&(e.slice(c,c+d).forEach(f=>r.mapping.delete(f)),e.delete(c,d)),c+u<i){const f=[];for(let h=c;h<i-u;h++)f.push(Pp(o[h],r));e.insert(c,f)}},nt)},Fp=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name;let Oa=null;const OL=()=>{const t=Oa;Oa=null,t.forEach((e,n)=>{const r=n.state.tr,o=nt.getState(n.state);o&&o.binding&&!o.binding.isDestroyed&&(e.forEach((i,s)=>{r.setMeta(s,i)}),n.dispatch(r))})},DL=(t,e,n)=>{Oa||(Oa=new Map,pg(0,OL)),Ur(Oa,t,Zn).set(e,n)},pl=(t,e,n)=>{if(t===0)return Qf(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 Pn){if(r._length>=t)return Qf(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 o=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&t<o)r=r._first.content.type,t--;else{if(t===1&&r._length===0&&o>1)return new cl(r._item===null?null:r._item.id,r._item===null?al(r):null,null);if(t-=o,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 cl(r._item===null?null:r._item.id,r._item===null?al(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 un();if(t===0&&r.constructor!==Pn&&r!==e)return LL(r._item.parent,r._item)}return Qf(e,e._length,e.length===0?-1:0)},LL=(t,e)=>{let n=null,r=null;return t._item===null?r=al(t):n=Ce(t._item.id.client,t._item.id.clock),new cl(n,r,e.id)},Ei=(t,e,n,r)=>{const o=oD(n,t);if(o===null||o.type!==e&&!ll(e,o.type._item))return null;let i=o.type,s=0;if(i.constructor===Pn)s=o.index;else if(i._item===null||!i._item.deleted){let a=i._first,l=0;for(;l<i._length&&l<o.index&&a!==null;){if(!a.deleted){const c=a.content.type;l++,c instanceof Pn?s+=c._length:s+=r.get(c).nodeSize}a=a.right}s+=1}for(;i!==e&&i._item!==null;){const a=i._item.parent;if(a._item===null||!a._item.deleted){s+=1;let l=a._first;for(;l!==null;){const c=l.content.type;if(c===i)break;l.deleted||(c instanceof Pn?s+=c._length:s+=r.get(c).nodeSize),l=l.right}}i=a}return s-1},RL=(t,e,n)=>t!==e,PL=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(""),o=document.createTextNode("");return e.insertBefore(r,null),e.insertBefore(n,null),e.insertBefore(o,null),e},gw=t=>({style:`background-color: ${t.color}70`,class:"ProseMirror-yjs-selection"}),BL=/^#[0-9a-fA-F]{6}$/,jb=(t,e,n,r,o)=>{const i=nt.getState(t),s=i.doc,a=[];return i.snapshot!=null||i.prevSnapshot!=null||i.binding.mapping.size===0?ke.create(t.doc,[]):(e.getStates().forEach((l,c)=>{if(n(s.clientID,c,l)&&l.cursor!=null){const u=l.user||{};u.color==null?u.color="#ffa500":BL.test(u.color)||console.warn("A user uses an unsupported color format",u),u.name==null&&(u.name=`User: ${c}`);let d=Ei(s,i.type,Ma(l.cursor.anchor),i.binding.mapping),f=Ei(s,i.type,Ma(l.cursor.head),i.binding.mapping);if(d!==null&&f!==null){const h=gr(t.doc.content.size-1,0);d=uo(d,h),f=uo(f,h),a.push(je.widget(f,()=>r(u,c),{key:c+"",side:10}));const p=uo(d,f),g=gr(d,f);a.push(je.inline(p,g,o(u,c),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),ke.create(t.doc,a))},FL=(t,{awarenessStateFilter:e=RL,cursorBuilder:n=PL,selectionBuilder:r=gw,getSelection:o=s=>s.selection}={},i="cursor")=>new ye({key:nc,state:{init(s,a){return jb(a,t,e,n,r)},apply(s,a,l,c){const u=nt.getState(c),d=s.getMeta(nc);return u&&u.isChangeOrigin||d&&d.awarenessUpdated?jb(c,t,e,n,r):a.map(s.mapping,s.doc)}},props:{decorations:s=>nc.getState(s)},view:s=>{const a=()=>{s.docView&&DL(s,nc,{awarenessUpdated:!0})},l=()=>{const c=nt.getState(s.state),u=t.getLocalState()||{};if(s.hasFocus()){const d=o(s.state),f=pl(d.anchor,c.type,c.binding.mapping),h=pl(d.head,c.type,c.binding.mapping);(u.cursor==null||!Ib(Ma(u.cursor.anchor),f)||!Ib(Ma(u.cursor.head),h))&&t.setLocalStateField(i,{anchor:f,head:h})}else u.cursor!=null&&Ei(c.doc,c.type,Ma(u.cursor.anchor),c.binding.mapping)!==null&&t.setLocalStateField(i,null)};return t.on("change",a),s.dom.addEventListener("focusin",l),s.dom.addEventListener("focusout",l),{update:l,destroy:()=>{s.dom.removeEventListener("focusin",l),s.dom.removeEventListener("focusout",l),t.off("change",a),t.setLocalStateField(i,null)}}}}),HL=t=>Lr.getState(t)?.undoManager?.undo()!=null,UL=t=>Lr.getState(t)?.undoManager?.redo()!=null,VL=(t,e)=>e==null?Lr.getState(t)?.undoManager?.canUndo():HL(t),$L=(t,e)=>e==null?Lr.getState(t)?.undoManager?.canRedo():UL(t),jL=new Set(["paragraph"]),zL=(t,e)=>!(t instanceof ot)||!(t.content instanceof xr)||!(t.content.type instanceof jo||t.content.type instanceof Yt&&e.has(t.content.type.nodeName))||t.content.type._length===0,qL=({protectedNodes:t=jL,trackedOrigins:e=[],undoManager:n=null}={})=>new ye({key:Lr,state:{init:(r,o)=>{const i=nt.getState(o),s=n||new jT(i.type,{trackedOrigins:new Set([nt].concat(e)),deleteFilter:a=>zL(a,t),captureTransaction:a=>a.meta.get("addToHistory")!==!1});return{undoManager:s,prevSel:null,hasUndoOps:s.undoStack.length>0,hasRedoOps:s.redoStack.length>0}},apply:(r,o,i,s)=>{const a=nt.getState(s).binding,l=o.undoManager,c=l.undoStack.length>0,u=l.redoStack.length>0;return a?{undoManager:l,prevSel:Su(a,i),hasUndoOps:c,hasRedoOps:u}:c!==o.hasUndoOps||u!==o.hasRedoOps?Object.assign({},o,{hasUndoOps:l.undoStack.length>0,hasRedoOps:l.redoStack.length>0}):o}},view:r=>{const o=nt.getState(r.state),i=Lr.getState(r.state).undoManager;return i.on("stack-item-added",({stackItem:s})=>{const a=o.binding;a&&s.meta.set(a,Lr.getState(r.state).prevSel)}),i.on("stack-item-popped",({stackItem:s})=>{const a=o.binding;a&&(a.beforeTransactionSelection=s.meta.get(a)||a.beforeTransactionSelection)}),{destroy:()=>{i.destroy()}}}}),xs=new WeakMap,Uc=new WeakMap,Au={current:[]};let eh=!1;const rc=new Set,zb=new Map;function bw(t){const e=Array.from(t).sort((n,r)=>n instanceof Cs&&n.options.deps.includes(r)?1:r instanceof Cs&&r.options.deps.includes(n)?-1:0);for(const n of e){if(Au.current.includes(n))continue;Au.current.push(n),n.recompute();const r=Uc.get(n);if(r)for(const o of r){const i=xs.get(o);i&&bw(i)}}}function WL(t){const e={prevVal:t.prevState,currentVal:t.state};for(const n of t.listeners)n(e)}function GL(t){const e={prevVal:t.prevState,currentVal:t.state};for(const n of t.listeners)n(e)}function YL(t){if(rc.add(t),!eh)try{for(eh=!0;rc.size>0;){const e=Array.from(rc);rc.clear();for(const n of e){const r=zb.get(n)??n.prevState;n.prevState=r,WL(n)}for(const n of e){const r=xs.get(n);r&&(Au.current.push(n),bw(r))}for(const n of e){const r=xs.get(n);if(r)for(const o of r)GL(o)}}}finally{eh=!1,Au.current=[],zb.clear()}}function KL(t){return typeof t=="function"}class Hp{constructor(e,n){this.listeners=new Set,this.subscribe=r=>{var o,i;this.listeners.add(r);const s=(i=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:i.call(o,r,this);return()=>{this.listeners.delete(r),s?.()}},this.prevState=e,this.state=e,this.options=n}setState(e){var n,r,o;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(e):KL(e)?this.state=e(this.prevState):this.state=e,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),YL(this)}}class Cs{constructor(e){this.listeners=new Set,this._subscriptions=[],this.lastSeenDepValues=[],this.getDepVals=()=>{const n=this.options.deps.length,r=new Array(n),o=new Array(n);for(let i=0;i<n;i++){const s=this.options.deps[i];r[i]=s.prevState,o[i]=s.state}return this.lastSeenDepValues=o,{prevDepVals:r,currDepVals:o,prevVal:this.prevState??void 0}},this.recompute=()=>{var n,r;this.prevState=this.state;const o=this.getDepVals();this.state=this.options.fn(o),(r=(n=this.options).onUpdate)==null||r.call(n)},this.checkIfRecalculationNeededDeeply=()=>{for(const i of this.options.deps)i instanceof Cs&&i.checkIfRecalculationNeededDeeply();let n=!1;const r=this.lastSeenDepValues,{currDepVals:o}=this.getDepVals();for(let i=0;i<o.length;i++)if(o[i]!==r[i]){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,o;this.listeners.add(n);const i=(o=(r=this.options).onSubscribe)==null?void 0:o.call(r,n,this);return()=>{this.listeners.delete(n),i?.()}},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 Cs)n.registerOnGraph(),this.registerOnGraph(n.options.deps);else if(n instanceof Hp){let r=xs.get(n);r||(r=new Set,xs.set(n,r)),r.add(this);let o=Uc.get(this);o||(o=new Set,Uc.set(this,o)),o.add(n)}}unregisterFromGraph(e=this.options.deps){for(const n of e)if(n instanceof Cs)this.unregisterFromGraph(n.options.deps);else if(n instanceof Hp){const r=xs.get(n);r&&r.delete(this);const o=Uc.get(this);o&&o.delete(n)}}}const Up=Symbol("originalFactory");function ze(t){if(typeof t=="object"&&"key"in t)return function e(){return t[Up]=e,t};if(typeof t!="function")throw new Error("factory must be a function");return function e(n){return r=>{const o=t({editor:r.editor,options:n});return o[Up]=e,o}}}function ei(t,e){return new Hp(t,e)}const qb=new Oe("blocknote-show-selection"),ml=ze(({editor:t})=>{const e=ei({enabled:!1},{onUpdate(){t.transact(n=>n.setMeta(qb,{}))}});return{key:"showSelection",store:e,prosemirrorPlugins:[new ye({key:qb,props:{decorations:n=>{const{doc:r,selection:o}=n;if(!e.state.enabled)return ke.empty;const i=je.inline(o.from,o.to,{"data-show-selection":"true"});return ke.create(r,[i])}}})],showSelection(n){e.setState({enabled:n})}}}),Ig=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function yw(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Ew=(t,e,n)=>{let r=yw(t,n);if(!r)return!1;let o=Mg(r);if(!o){let s=r.blockRange(),a=s&&$s(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let i=o.nodeBefore;if(_w(t,o,e,-1))return!0;if(r.parent.content.size==0&&(Ps(i,"end")||le.isSelectable(i)))for(let s=r.depth;;s--){let a=Sd(t.doc,r.before(s),r.after(s),Q.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(Ps(i,"end")?me.findFrom(l.doc.resolve(l.mapping.map(o.pos,-1)),-1):le.create(l.doc,o.pos-i.nodeSize)),e(l.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1},QL=(t,e,n)=>{let r=yw(t,n);if(!r)return!1;let o=Mg(r);return o?xw(t,o,e):!1},XL=(t,e,n)=>{let r=kw(t,n);if(!r)return!1;let o=Og(r);return o?xw(t,o,e):!1};function xw(t,e,n){let r=e.nodeBefore,o=r,i=e.pos-1;for(;!o.isTextblock;i--){if(o.type.spec.isolating)return!1;let u=o.lastChild;if(!u)return!1;o=u}let s=e.nodeAfter,a=s,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=Sd(t.doc,i,l,Q.empty);if(!c||c.from!=i||c instanceof St&&c.slice.size>=l-i)return!1;if(n){let u=t.tr.step(c);u.setSelection(ae.create(u.doc,i)),n(u.scrollIntoView())}return!0}function Ps(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 Cw=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=Mg(r)}let s=i&&i.nodeBefore;return!s||!le.isSelectable(s)?!1:(e&&e(t.tr.setSelection(le.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function Mg(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 kw(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Tw=(t,e,n)=>{let r=kw(t,n);if(!r)return!1;let o=Og(r);if(!o)return!1;let i=o.nodeAfter;if(_w(t,o,e,1))return!0;if(r.parent.content.size==0&&(Ps(i,"start")||le.isSelectable(i))){let s=Sd(t.doc,r.before(),r.after(),Q.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=t.tr.step(s);a.setSelection(Ps(i,"start")?me.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):le.create(a.doc,a.mapping.map(o.pos))),e(a.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},ww=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=Og(r)}let s=i&&i.nodeAfter;return!s||!le.isSelectable(s)?!1:(e&&e(t.tr.setSelection(le.create(t.doc,i.pos)).scrollIntoView()),!0)};function Og(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 ZL=(t,e)=>{let n=t.selection,r=n instanceof le,o;if(r){if(n.node.isTextblock||!Ui(t.doc,n.from))return!1;o=n.from}else if(o=wd(t.doc,n.from,-1),o==null)return!1;if(e){let i=t.tr.join(o);r&&i.setSelection(le.create(i.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},JL=(t,e)=>{let n=t.selection,r;if(n instanceof le){if(n.node.isTextblock||!Ui(t.doc,n.to))return!1;r=n.to}else if(r=wd(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},eR=(t,e)=>{let{$from:n,$to:r}=t.selection,o=n.blockRange(r),i=o&&$s(o);return i==null?!1:(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)},Sw=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
14
|
+
`).scrollIntoView()),!0)};function Dg(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 tR=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=Dg(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,s.createAndFill());l.setSelection(me.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},vw=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof Tn||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Dg(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=t.tr.insert(s,i.createAndFill());a.setSelection(ae.create(a.doc,s+1)),e(a.scrollIntoView())}return!0},Aw=(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 i=n.before();if(lo(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&$s(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function nR(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof le&&e.selection.node.isBlock)return!r.parentOffset||!lo(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],s,a,l=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){l=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),a=Dg(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),i.unshift(l&&a?{type:a}:null),s=h;break}else{if(h==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof ae||e.selection instanceof Tn)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=lo(u.doc,d,i.length,i);if(f||(i[0]=a?{type:a}:null,f=lo(u.doc,d,i.length,i)),!f)return!1;if(u.split(d,i.length,i),!l&&c&&r.node(s).type!=a){let h=u.mapping.map(r.before(s)),p=u.doc.resolve(h);a&&r.node(s-1).canReplaceWith(p.index(),p.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(s)),a)}return n&&n(u.scrollIntoView()),!0}}const rR=nR(),oR=(t,e)=>{let{$from:n,to:r}=t.selection,o,i=n.sharedDepth(r);return i==0?!1:(o=n.before(i),e&&e(t.tr.setSelection(le.create(t.doc,o))),!0)};function iR(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||Ui(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function _w(t,e,n,r){let o=e.nodeBefore,i=e.nodeAfter,s,a,l=o.type.spec.isolating||i.type.spec.isolating;if(!l&&iR(t,e,n))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(a=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&a.matchType(s[0]||i.type).validEnd){if(n){let h=e.pos+i.nodeSize,p=V.empty;for(let E=s.length-1;E>=0;E--)p=V.from(s[E].create(null,p));p=V.from(o.copy(p));let g=t.tr.step(new yt(e.pos-1,h,e.pos,h,new Q(p,1,0),s.length,!0)),b=g.doc.resolve(h+2*s.length);b.nodeAfter&&b.nodeAfter.type==o.type&&Ui(g.doc,b.pos)&&g.join(b.pos),n(g.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&l?null:me.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&$s(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&Ps(i,"start",!0)&&Ps(o,"end")){let h=o,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let g=i,b=1;for(;!g.isTextblock;g=g.firstChild)b++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(n){let E=V.empty;for(let T=p.length-1;T>=0;T--)E=V.from(p[T].copy(E));let x=t.tr.step(new yt(e.pos-p.length,e.pos+i.nodeSize,e.pos+b,e.pos+i.nodeSize-b,new Q(E,p.length,0),0,!0));n(x.scrollIntoView())}return!0}}return!1}function Nw(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(e.tr.setSelection(ae.create(e.doc,t<0?o.start(i):o.end(i)))),!0):!1}}const sR=Nw(-1),aR=Nw(1);function lR(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),a=s&&JC(s,t,e);return a?(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0):!1}}function Wb(t,e=null){return function(n,r){let o=!1;for(let i=0;i<n.selection.ranges.length&&!o;i++){let{$from:{pos:s},$to:{pos:a}}=n.selection.ranges[i];n.doc.nodesBetween(s,a,(l,c)=>{if(o)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)o=!0;else{let u=n.doc.resolve(c),d=u.index();o=u.parent.canReplaceWith(d,d+1,t)}})}if(!o)return!1;if(r){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[s];i.setBlockType(a,l,t,e)}r(i.scrollIntoView())}return!0}}function Lg(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}Lg(Ig,Ew,Cw);Lg(Ig,Tw,ww);Lg(Sw,vw,Aw,rR);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function cR(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let a=r?n.tr:null;return uR(a,s,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function uR(t,e,n,r=null){let o=!1,i=e,s=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=s.resolve(e.start-2);i=new iu(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new iu(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let a=JC(i,n,r,e);return a?(t&&dR(t,e,a,o,n),!0):!1}function dR(t,e,n,r,o){let i=V.empty;for(let u=n.length-1;u>=0;u--)i=V.from(n[u].type.create(n[u].attrs,i));t.step(new yt(e.start-(r?2:0),e.end,e.start,e.end,new Q(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==o&&(s=u+1);let a=n.length-s,l=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&lo(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function fR(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?hR(e,n,t,i):pR(e,n,i):!0:!1}}function hR(t,e,n,r){let o=t.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new yt(i-1,s,i,s,new Q(V.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new iu(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=$s(r);if(a==null)return!1;o.lift(r,a);let l=o.doc.resolve(o.mapping.map(i,-1)-1);return Ui(o.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&o.join(l.pos),e(o.scrollIntoView()),!0}function pR(t,e,n){let r=t.tr,o=n.parent;for(let h=n.end,p=n.endIndex-1,g=n.startIndex;p>g;p--)h-=o.child(p).nodeSize,r.delete(h-1,h+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(a?0:1),u+1,s.content.append(l?V.empty:V.from(o))))return!1;let d=i.pos,f=d+s.nodeSize;return r.step(new yt(d-(a?1:0),f+(l?1:0),d+1,f-1,new Q((a?V.empty:V.from(o.copy(V.empty))).append(l?V.empty:V.from(o.copy(V.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function mR(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let a=i.parent,l=a.child(s-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 Q(V.from(t.create(null,V.from(a.type.create(null,u)))),c?3:1,0),f=i.start,h=i.end;n(e.tr.step(new yt(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}var zo={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:"'"},_u={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},gR=typeof navigator<"u"&&/Mac/.test(navigator.platform),bR=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Wt=0;Wt<10;Wt++)zo[48+Wt]=zo[96+Wt]=String(Wt);for(var Wt=1;Wt<=24;Wt++)zo[Wt+111]="F"+Wt;for(var Wt=65;Wt<=90;Wt++)zo[Wt]=String.fromCharCode(Wt+32),_u[Wt]=String.fromCharCode(Wt);for(var th in zo)_u.hasOwnProperty(th)||(_u[th]=zo[th]);function yR(t){var e=gR&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||bR&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?_u:zo)[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 ER=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),xR=typeof navigator<"u"&&/Win/.test(navigator.platform);function CR(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,i,s;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))o=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))ER?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function kR(t){let e=Object.create(null);for(let n in t)e[CR(n)]=t[n];return e}function nh(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 Iw(t){return new ye({props:{handleKeyDown:Rg(t)}})}function Rg(t){let e=kR(t);return function(n,r){let o=yR(r),i,s=e[nh(o,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=e[nh(o,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(xR&&r.ctrlKey&&r.altKey)&&(i=zo[r.keyCode])&&i!=o){let a=e[nh(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var TR=Object.defineProperty,Pg=(t,e)=>{for(var n in e)TR(t,n,{get:e[n],enumerable:!0})};function $d(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:o}=n,{storedMarks:i}=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 i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var jd=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:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([s,a])=>[s,(...c)=>{const u=a(...c)(i);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(o),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s=[],a=!!t,l=t||o.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(l),s.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(n).map(([d,f])=>[d,(...p)=>{const g=this.buildProps(l,e),b=f(...p)(g);return s.push(b),u}])),run:c};return u}createCan(t){const{rawCommands:e,state:n}=this,r=!1,o=t||n.tr,i=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>l(...c)({...i,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s={tr:t,editor:r,view:i,state:$d({state:o,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)(s)]))}};return s}},Mw={};Pg(Mw,{blur:()=>wR,clearContent:()=>SR,clearNodes:()=>vR,command:()=>AR,createParagraphNear:()=>_R,cut:()=>NR,deleteCurrentNode:()=>IR,deleteNode:()=>MR,deleteRange:()=>OR,deleteSelection:()=>DR,enter:()=>LR,exitCode:()=>RR,extendMarkRange:()=>PR,first:()=>BR,focus:()=>HR,forEach:()=>UR,insertContent:()=>VR,insertContentAt:()=>jR,joinBackward:()=>WR,joinDown:()=>qR,joinForward:()=>GR,joinItemBackward:()=>YR,joinItemForward:()=>KR,joinTextblockBackward:()=>QR,joinTextblockForward:()=>XR,joinUp:()=>zR,keyboardShortcut:()=>JR,lift:()=>e6,liftEmptyBlock:()=>t6,liftListItem:()=>n6,newlineInCode:()=>r6,resetAttributes:()=>o6,scrollIntoView:()=>i6,selectAll:()=>s6,selectNodeBackward:()=>a6,selectNodeForward:()=>l6,selectParentNode:()=>c6,selectTextblockEnd:()=>u6,selectTextblockStart:()=>d6,setContent:()=>f6,setMark:()=>_6,setMeta:()=>N6,setNode:()=>I6,setNodeSelection:()=>M6,setTextDirection:()=>O6,setTextSelection:()=>D6,sinkListItem:()=>L6,splitBlock:()=>R6,splitListItem:()=>P6,toggleList:()=>B6,toggleMark:()=>F6,toggleNode:()=>H6,toggleWrap:()=>U6,undoInputRule:()=>V6,unsetAllMarks:()=>$6,unsetMark:()=>j6,unsetTextDirection:()=>z6,updateAttributes:()=>q6,wrapIn:()=>W6,wrapInList:()=>G6});var wR=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),SR=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),vR=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({$from:i,$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),f=c.resolve(u.map(l+a.nodeSize)),h=d.blockRange(f);if(!h)return;const p=$s(h);if(a.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,g)}(p||p===0)&&e.lift(h,p)})}),!0},AR=t=>e=>t(e),_R=()=>({state:t,dispatch:e})=>vw(t,e),NR=(t,e)=>({editor:n,tr:r})=>{const{state:o}=n,i=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const s=r.mapping.map(e);return r.insert(s,i.content),r.setSelection(new ae(r.doc.resolve(Math.max(s-1,0)))),!0},IR=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const o=t.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===r.type){if(e){const a=o.before(i),l=o.after(i);t.delete(a,l).scrollIntoView()}return!0}return!1};function Vt(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 MR=t=>({tr:e,state:n,dispatch:r})=>{const o=Vt(t,n.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===o){if(r){const l=i.before(s),c=i.after(s);e.delete(l,c).scrollIntoView()}return!0}return!1},OR=t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0},DR=()=>({state:t,dispatch:e})=>Ig(t,e),LR=()=>({commands:t})=>t.keyboardShortcut("Enter"),RR=()=>({state:t,dispatch:e})=>tR(t,e);function Bg(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Nu(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:Bg(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function Ow(t,e,n={}){return t.find(r=>r.type===e&&Nu(Object.fromEntries(Object.keys(n).map(o=>[o,r.attrs[o]])),n))}function Gb(t,e,n={}){return!!Ow(t,e,n)}function zd(t,e,n){var r;if(!t||!e)return;let o=t.parent.childAfter(t.parentOffset);if((!o.node||!o.node.marks.some(u=>u.type===e))&&(o=t.parent.childBefore(t.parentOffset)),!o.node||!o.node.marks.some(u=>u.type===e)||(n=n||((r=o.node.marks[0])==null?void 0:r.attrs),!Ow([...o.node.marks],e,n)))return;let s=o.index,a=t.start()+o.offset,l=s+1,c=a+o.node.nodeSize;for(;s>0&&Gb([...t.parent.child(s-1).marks],e,n);)s-=1,a-=t.parent.child(s).nodeSize;for(;l<t.parent.childCount&&Gb([...t.parent.child(l).marks],e,n);)c+=t.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function po(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 PR=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const i=po(t,r.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:u}=a;if(o){const d=zd(l,i,e);if(d&&d.from<=c&&d.to>=u){const f=ae.create(s,d.from,d.to);n.setSelection(f)}}return!0},BR=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 Dw(t){return t instanceof ae}function so(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Lw(t,e=null){if(!e)return null;const n=me.atStart(t),r=me.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const o=n.from,i=r.to;return e==="all"?ae.create(t,so(0,o,i),so(t.content.size,o,i)):ae.create(t,so(e,o,i),so(e,o,i))}function Vp(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function gl(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function FR(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var HR=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(gl()||Vp())&&r.dom.focus(),FR()&&!gl()&&!Vp()&&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(i&&t===null&&!Dw(n.state.selection))return s(),!0;const a=Lw(o.doc,t)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||o.setSelection(a),l&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},UR=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),VR=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Rw=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&&Rw(r)}return t};function oc(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 Rw(n)}function bl(t,e,n){if(t instanceof ao||t instanceof V)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,o=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return V.fromArray(t.map(a=>e.nodeFromJSON(a)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),bl("",e,n)}if(o){if(n.errorOnInvalidContent){let s=!1,a="";const l=new qC({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=>(s=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?hr.fromSchema(l).parseSlice(oc(t),n.parseOptions):hr.fromSchema(l).parse(oc(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=hr.fromSchema(e);return n.slice?i.parseSlice(oc(t),n.parseOptions).content:i.parse(oc(t),n.parseOptions)}return bl("",e,n)}function Pw(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof St||o instanceof yt))return;const i=t.mapping.maps[r];let s=0;i.forEach((a,l,c,u)=>{s===0&&(s=u)}),t.setSelection(me.near(t.doc.resolve(s),n))}var $R=t=>!("type"in t),jR=(t,e,n)=>({tr:r,dispatch:o,editor:i})=>{var s;if(o){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const l=b=>{i.emit("contentError",{editor:i,error:b,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{bl(e,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(b){l(b)}try{a=bl(e,i.schema,{parseOptions:c,errorOnInvalidContent:(s=n.errorOnInvalidContent)!=null?s:i.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},f=!0,h=!0;if(($R(a)?a:[a]).forEach(b=>{b.check(),f=f?b.isText&&b.marks.length===0:!1,h=h?b.isBlock:!1}),u===d&&h){const{parent:b}=r.doc.resolve(u);b.isTextblock&&!b.type.spec.code&&!b.childCount&&(u-=1,d+=1)}let g;if(f){if(Array.isArray(e))g=e.map(b=>b.text||"").join("");else if(e instanceof V){let b="";e.forEach(E=>{E.text&&(b+=E.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),E=b.node(),x=b.parentOffset===0,T=E.isText||E.isTextblock,D=E.content.size>0;x&&T&&D&&(u=Math.max(0,u-1)),r.replaceWith(u,d,g)}n.updateSelection&&Pw(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},zR=()=>({state:t,dispatch:e})=>ZL(t,e),qR=()=>({state:t,dispatch:e})=>JL(t,e),WR=()=>({state:t,dispatch:e})=>Ew(t,e),GR=()=>({state:t,dispatch:e})=>Tw(t,e),YR=()=>({state:t,dispatch:e,tr:n})=>{try{const r=wd(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},KR=()=>({state:t,dispatch:e,tr:n})=>{try{const r=wd(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},QR=()=>({state:t,dispatch:e})=>QL(t,e),XR=()=>({state:t,dispatch:e})=>XL(t,e);function Bw(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function ZR(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,o,i,s;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))o=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))gl()||Bw()?s=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),o&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var JR=t=>({editor:e,view:n,tr:r,dispatch:o})=>{const i=ZR(t).split(/-(?!$)/),s=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.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&&o&&r.maybeStep(u)}),!0};function yl(t,e,n={}){const{from:r,to:o,empty:i}=t.selection,s=e?Vt(e,t.schema):null,a=[];t.doc.nodesBetween(r,o,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),p=Math.min(o,f+d.nodeSize);a.push({node:d,from:h,to:p})});const l=o-r,c=a.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>Nu(d.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=l}var e6=(t,e={})=>({state:n,dispatch:r})=>{const o=Vt(t,n.schema);return yl(n,o,e)?eR(n,r):!1},t6=()=>({state:t,dispatch:e})=>Aw(t,e),n6=t=>({state:e,dispatch:n})=>{const r=Vt(t,e.schema);return fR(r)(e,n)},r6=()=>({state:t,dispatch:e})=>Sw(t,e);function qd(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Yb(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}var o6=(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=qd(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(i=Vt(t,r.schema)),a==="mark"&&(s=po(t,r.schema));let l=!1;return n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,d)=>{i&&i===u.type&&(l=!0,o&&n.setNodeMarkup(d,void 0,Yb(u.attrs,e))),s&&u.marks.length&&u.marks.forEach(f=>{s===f.type&&(l=!0,o&&n.addMark(d,d+u.nodeSize,s.create(Yb(f.attrs,e))))})})}),l},i6=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),s6=()=>({tr:t,dispatch:e})=>{if(e){const n=new Tn(t.doc);t.setSelection(n)}return!0},a6=()=>({state:t,dispatch:e})=>Cw(t,e),l6=()=>({state:t,dispatch:e})=>ww(t,e),c6=()=>({state:t,dispatch:e})=>oR(t,e),u6=()=>({state:t,dispatch:e})=>aR(t,e),d6=()=>({state:t,dispatch:e})=>sR(t,e);function Iu(t,e,n={},r={}){return bl(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var f6=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:s,commands:a})=>{const{doc:l}=i;if(r.preserveWhitespace!=="full"){const c=Iu(t,o.schema,r,{errorOnInvalidContent:e??o.options.enableContentCheck});return s&&i.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},t,{parseOptions:r,errorOnInvalidContent:e??o.options.enableContentCheck})};function Fw(t,e){const n=po(e,t.schema),{from:r,to:o,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,o,l=>{s.push(...l.marks)});const a=s.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function Wd(t,e){const n=new zm(t);return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function h6(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 Kb(t,e){const n=[];return t.descendants((r,o)=>{e(r)&&n.push({node:r,pos:o})}),n}function Hw(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(o,i)=>{n(o)&&r.push({node:o,pos:i})}),r}function p6(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 Gd(t){return e=>p6(e.$from,t)}function de(t,e,n){return t.config[e]===void 0&&t.parent?de(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?de(t.parent,e,n):null}):t.config[e]}function Fg(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=de(e,"addExtensions",n);return r?[e,...Fg(r())]:e}).flat(10)}function Hg(t,e){const n=Fn.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}function Uw(t){return typeof t=="function"}function Qe(t,e=void 0,...n){return Uw(t)?e?t.bind(e)(...n):t(...n):t}function m6(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Bs(t){const e=t.filter(o=>o.type==="extension"),n=t.filter(o=>o.type==="node"),r=t.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function Vw(t){const e=[],{nodeExtensions:n,markExtensions:r}=Bs(t),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage,extensions:o},l=de(s,"addGlobalAttributes",a);if(!l)return;l().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([f,h])=>{e.push({type:d,name:f,attribute:{...i,...h}})})})})}),o.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage},l=de(s,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([u,d])=>{const f={...i,...d};typeof f?.default=="function"&&(f.default=f.default()),f?.isRequired&&f?.default===void 0&&delete f.default,e.push({type:s.name,name:u,attribute:f})})}),e}function Hn(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([o,i])=>{if(!r[o]){r[o]=i;return}if(o==="class"){const a=i?String(i).split(" "):[],l=r[o]?r[o].split(" "):[],c=a.filter(u=>!l.includes(u));r[o]=[...l,...c].join(" ")}else if(o==="style"){const a=i?i.split(";").map(u=>u.trim()).filter(Boolean):[],l=r[o]?r[o].split(";").map(u=>u.trim()).filter(Boolean):[],c=new Map;l.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),a.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),r[o]=Array.from(c.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else r[o]=i}),r},{})}function El(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)=>Hn(n,r),{})}function g6(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Qb(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 o=e.reduce((i,s)=>{const a=s.attribute.parseHTML?s.attribute.parseHTML(n):g6(n.getAttribute(s.name));return a==null?i:{...i,[s.name]:a}},{});return{...r,...o}}}}function Xb(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&m6(n)?!1:n!=null))}function Zb(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 $w(t,e){var n;const r=Vw(t),{nodeExtensions:o,markExtensions:i}=Bs(t),s=(n=o.find(c=>de(c,"topNode")))==null?void 0:n.name,a=Object.fromEntries(o.map(c=>{const u=r.filter(E=>E.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((E,x)=>{const T=de(x,"extendNodeSchema",d);return{...E,...T?T(c):{}}},{}),h=Xb({...f,content:Qe(de(c,"content",d)),marks:Qe(de(c,"marks",d)),group:Qe(de(c,"group",d)),inline:Qe(de(c,"inline",d)),atom:Qe(de(c,"atom",d)),selectable:Qe(de(c,"selectable",d)),draggable:Qe(de(c,"draggable",d)),code:Qe(de(c,"code",d)),whitespace:Qe(de(c,"whitespace",d)),linebreakReplacement:Qe(de(c,"linebreakReplacement",d)),defining:Qe(de(c,"defining",d)),isolating:Qe(de(c,"isolating",d)),attrs:Object.fromEntries(u.map(Zb))}),p=Qe(de(c,"parseHTML",d));p&&(h.parseDOM=p.map(E=>Qb(E,u)));const g=de(c,"renderHTML",d);g&&(h.toDOM=E=>g({node:E,HTMLAttributes:El(E,u)}));const b=de(c,"renderText",d);return b&&(h.toText=b),[c.name,h]})),l=Object.fromEntries(i.map(c=>{const u=r.filter(b=>b.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((b,E)=>{const x=de(E,"extendMarkSchema",d);return{...b,...x?x(c):{}}},{}),h=Xb({...f,inclusive:Qe(de(c,"inclusive",d)),excludes:Qe(de(c,"excludes",d)),group:Qe(de(c,"group",d)),spanning:Qe(de(c,"spanning",d)),code:Qe(de(c,"code",d)),attrs:Object.fromEntries(u.map(Zb))}),p=Qe(de(c,"parseHTML",d));p&&(h.parseDOM=p.map(b=>Qb(b,u)));const g=de(c,"renderHTML",d);return g&&(h.toDOM=b=>g({mark:b,HTMLAttributes:El(b,u)})),[c.name,h]}));return new qC({topNode:s,nodes:a,marks:l})}function b6(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Mu(t){return t.sort((n,r)=>{const o=de(n,"priority")||100,i=de(r,"priority")||100;return o>i?-1:o<i?1:0})}function Ug(t){const e=Mu(Fg(t)),n=b6(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 y6(t,e){const n=Ug(t);return $w(n,e)}function jw(t,e,n){const{from:r,to:o}=e,{blockSeparator:i=`
|
|
15
|
+
|
|
16
|
+
`,textSerializers:s={}}=n||{};let a="";return t.nodesBetween(r,o,(l,c,u,d)=>{var f;l.isBlock&&c>r&&(a+=i);const h=s?.[l.type.name];if(h)return u&&(a+=h({node:l,pos:c,parent:u,index:d,range:e})),!1;l.isText&&(a+=(f=l?.text)==null?void 0:f.slice(Math.max(r,c)-c,o-c))}),a}function E6(t,e){const n={from:0,to:t.content.size};return jw(t,n,e)}function zw(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function x6(t,e){const n=Vt(e,t.schema),{from:r,to:o}=t.selection,i=[];t.doc.nodesBetween(r,o,a=>{i.push(a)});const s=i.reverse().find(a=>a.type.name===n.name);return s?{...s.attrs}:{}}function qw(t,e){const n=qd(typeof e=="string"?e:e.name,t.schema);return n==="node"?x6(t,e):n==="mark"?Fw(t,e):{}}function C6(t,e=JSON.stringify){const n={};return t.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function k6(t){const e=C6(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,s)=>s!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function Vg(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((o,i)=>{const s=[];if(o.ranges.length)o.forEach((a,l)=>{s.push({from:a,to:l})});else{const{from:a,to:l}=n[i];if(a===void 0||l===void 0)return;s.push({from:a,to:l})}s.forEach(({from:a,to:l})=>{const c=e.slice(i).map(a,-1),u=e.slice(i).map(l),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),k6(r)}function $g(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(o=>{const i=n.resolve(t),s=zd(i,o.type);s&&r.push({mark:o,...s})}):n.nodesBetween(t,e,(o,i)=>{!o||o?.nodeSize===void 0||r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})))}),r}function ic(t,e){return e.nodes[t]||e.marks[t]||null}function Vc(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const o=t.find(i=>i.type===e&&i.name===r);return o?o.attribute.keepOnSplit:!1}))}var T6=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(o,i,s,a)=>{var l,c;const u=((c=(l=o.type.spec).toText)==null?void 0:c.call(l,{node:o,pos:i,parent:s,index:a}))||o.textContent||"%leaf%";n+=o.isAtom&&!o.isText?u:u.slice(0,Math.max(0,r-i))}),n};function $p(t,e,n={}){const{empty:r,ranges:o}=t.selection,i=e?po(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>Nu(d.attrs,n,{strict:!1}));let s=0;const a=[];if(o.forEach(({$from:d,$to:f})=>{const h=d.pos,p=f.pos;t.doc.nodesBetween(h,p,(g,b)=>{if(!g.isText&&!g.marks.length)return;const E=Math.max(h,b),x=Math.min(p,b+g.nodeSize),T=x-E;s+=T,a.push(...g.marks.map(D=>({mark:D,from:E,to:x})))})}),s===0)return!1;const l=a.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>Nu(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=a.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,f)=>d+f.to-f.from,0);return(l>0?l+c:l)>=s}function w6(t,e,n={}){if(!e)return yl(t,null,n)||$p(t,null,n);const r=qd(e,t.schema);return r==="node"?yl(t,e,n):r==="mark"?$p(t,e,n):!1}function Jb(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function ey(t,e){const{nodeExtensions:n}=Bs(e),r=n.find(s=>s.name===t);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},i=Qe(de(r,"group",o));return typeof i!="string"?!1:i.split(" ").includes("list")}function Yd(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.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 o=!0;return t.content.forEach(i=>{o!==!1&&(Yd(i,{ignoreWhitespace:n,checkChildren:e})||(o=!1))}),o}return!1}function Ww(t){return t instanceof le}var Gw=class Yw{constructor(e){this.position=e}static fromJSON(e){return new Yw(e.position)}toJSON(){return{position:this.position}}};function S6(t,e){const n=e.mapping.mapResult(t.position);return{position:new Gw(n.pos),mapResult:n}}function v6(t){return new Gw(t)}function jg(t,e,n){const o=t.state.doc.content.size,i=so(e,0,o),s=so(n,0,o),a=t.coordsAtPos(i),l=t.coordsAtPos(s,-1),c=Math.min(a.top,l.top),u=Math.max(a.bottom,l.bottom),d=Math.min(a.left,l.left),f=Math.max(a.right,l.right),h=f-d,p=u-c,E={top:c,bottom:u,left:d,right:f,width:h,height:p,x:d,y:c};return{...E,toJSON:()=>E}}function A6(t,e,n){var r;const{selection:o}=e;let i=null;if(Dw(o)&&(i=o.$cursor),i){const a=(r=t.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(a)||!a.some(c=>c.type.excludes(n)))}const{ranges:s}=o;return s.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,f)=>{if(c)return!1;if(u.isInline){const h=!f||f.type.allowsMarkType(n),p=!!n.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(n));c=h&&p}return!c}),c})}var _6=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:a}=i,l=po(t,r.schema);if(o)if(s){const c=Fw(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,(f,h)=>{const p=Math.max(h,u),g=Math.min(h+f.nodeSize,d);f.marks.find(E=>E.type===l)?f.marks.forEach(E=>{l===E.type&&n.addMark(p,g,l.create({...E.attrs,...e}))}):n.addMark(p,g,l.create(e))})});return A6(r,n,l)},N6=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),I6=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const i=Vt(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?o().command(({commands:a})=>Wb(i,{...s,...e})(n)?!0:a.clearNodes()).command(({state:a})=>Wb(i,{...s,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},M6=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,o=so(t,0,r.content.size),i=le.create(r,o);e.setSelection(i)}return!0},O6=(t,e)=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=r;let s,a;return typeof e=="number"?(s=e,a=e):e&&"from"in e&&"to"in e?(s=e.from,a=e.to):(s=i.from,a=i.to),o&&n.doc.nodesBetween(s,a,(l,c)=>{l.isText||n.setNodeMarkup(c,void 0,{...l.attrs,dir:t})}),!0},D6=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:o,to:i}=typeof t=="number"?{from:t,to:t}:t,s=ae.atStart(r).from,a=ae.atEnd(r).to,l=so(o,s,a),c=so(i,s,a),u=ae.create(r,l,c);e.setSelection(u)}return!0},L6=t=>({state:e,dispatch:n})=>{const r=Vt(t,e.schema);return mR(r)(e,n)};function ty(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(o=>e?.includes(o.type.name));t.tr.ensureMarks(r)}}var R6=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=e,{$from:a,$to:l}=i,c=o.extensionManager.attributes,u=Vc(c,a.node().type.name,a.node().attrs);if(i instanceof le&&i.node.isBlock)return!a.parentOffset||!lo(s,a.pos)?!1:(r&&(t&&ty(n,o.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,f=a.depth===0?void 0:h6(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=lo(e.doc,e.mapping.map(a.pos),1,h);if(!h&&!p&&lo(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(p&&(i instanceof ae&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,h),f&&!d&&!a.parentOffset&&a.parent.type!==f)){const g=e.mapping.map(a.before()),b=e.doc.resolve(g);a.node(-1).canReplaceWith(b.index(),b.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}t&&ty(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return p},P6=(t,e={})=>({tr:n,state:r,dispatch:o,editor:i})=>{var s;const a=Vt(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 f=i.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(o){let E=V.empty;const x=l.index(-1)?1:l.index(-2)?2:3;for(let j=l.depth-x;j>=l.depth-3;j-=1)E=V.from(l.node(j).copy(E));const T=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,D={...Vc(f,l.node().type.name,l.node().attrs),...e},O=((s=a.contentMatch.defaultType)==null?void 0:s.createAndFill(D))||void 0;E=E.append(V.from(a.createAndFill(null,O)||void 0));const v=l.before(l.depth-(x-1));n.replace(v,l.after(-T),new Q(E,4-x,0));let R=-1;n.doc.nodesBetween(v,n.doc.content.size,(j,z)=>{if(R>-1)return!1;j.isTextblock&&j.content.size===0&&(R=z+1)}),R>-1&&n.setSelection(ae.near(n.doc.resolve(R))),n.scrollIntoView()}return!0}const h=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,p={...Vc(f,d.type.name,d.attrs),...e},g={...Vc(f,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,c.pos);const b=h?[{type:a,attrs:p},{type:h,attrs:g}]:[{type:a,attrs:p}];if(!lo(n.doc,l.pos,2))return!1;if(o){const{selection:E,storedMarks:x}=r,{splittableMarks:T}=i.extensionManager,D=x||E.$to.parentOffset&&E.$from.marks();if(n.split(l.pos,2,b).scrollIntoView(),!D||!o)return!0;const O=D.filter(v=>T.includes(v.type.name));n.ensureMarks(O)}return!0},rh=(t,e)=>{const n=Gd(s=>s.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 o=t.doc.nodeAt(r);return n.node.type===o?.type&&Ui(t.doc,n.pos)&&t.join(n.pos),!0},oh=(t,e)=>{const n=Gd(s=>s.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 o=t.doc.nodeAt(r);return n.node.type===o?.type&&Ui(t.doc,r)&&t.join(r),!0},B6=(t,e,n,r={})=>({editor:o,tr:i,state:s,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=o.extensionManager,h=Vt(t,s.schema),p=Vt(e,s.schema),{selection:g,storedMarks:b}=s,{$from:E,$to:x}=g,T=E.blockRange(x),D=b||g.$to.parentOffset&&g.$from.marks();if(!T)return!1;const O=Gd(v=>ey(v.type.name,d))(g);if(T.depth>=1&&O&&T.depth-O.depth<=1){if(O.node.type===h)return c.liftListItem(p);if(ey(O.node.type.name,d)&&h.validContent(O.node.content)&&a)return l().command(()=>(i.setNodeMarkup(O.pos,h),!0)).command(()=>rh(i,h)).command(()=>oh(i,h)).run()}return!n||!D||!a?l().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>rh(i,h)).command(()=>oh(i,h)).run():l().command(()=>{const v=u().wrapInList(h,r),R=D.filter(j=>f.includes(j.type.name));return i.ensureMarks(R),v?!0:c.clearNodes()}).wrapInList(h,r).command(()=>rh(i,h)).command(()=>oh(i,h)).run()},F6=(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=po(t,r.schema);return $p(r,s,e)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},H6=(t,e,n={})=>({state:r,commands:o})=>{const i=Vt(t,r.schema),s=Vt(e,r.schema),a=yl(r,i,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?o.setNode(s,l):o.setNode(i,{...l,...n})},U6=(t,e={})=>({state:n,commands:r})=>{const o=Vt(t,n.schema);return yl(n,o,e)?r.lift(o):r.wrapIn(o,e)},V6=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(t))){if(e){const s=t.tr,a=i.transform;for(let l=a.steps.length-1;l>=0;l-=1)s.step(a.steps[l].invert(a.docs[l]));if(i.text){const l=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,l))}else s.delete(i.from,i.to)}return!0}}return!1},$6=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:o}=n;return r||e&&o.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},j6=(t,e={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:a}=n,l=po(t,r.schema),{$from:c,empty:u,ranges:d}=a;if(!o)return!0;if(u&&s){let{from:f,to:h}=a;const p=(i=c.marks().find(b=>b.type===l))==null?void 0:i.attrs,g=zd(c,l,p);g&&(f=g.from,h=g.to),n.removeMark(f,h,l)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,l)});return n.removeStoredMark(l),!0},z6=t=>({tr:e,state:n,dispatch:r})=>{const{selection:o}=n;let i,s;return typeof t=="number"?(i=t,s=t):t&&"from"in t&&"to"in t?(i=t.from,s=t.to):(i=o.from,s=o.to),r&&e.doc.nodesBetween(i,s,(a,l)=>{if(a.isText)return;const c={...a.attrs};delete c.dir,e.setNodeMarkup(l,void 0,c)}),!0},q6=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=qd(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(i=Vt(t,r.schema)),a==="mark"&&(s=po(t,r.schema));let l=!1;return n.selection.ranges.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;let f,h,p,g;n.selection.empty?r.doc.nodesBetween(u,d,(b,E)=>{i&&i===b.type&&(l=!0,p=Math.max(E,u),g=Math.min(E+b.nodeSize,d),f=E,h=b)}):r.doc.nodesBetween(u,d,(b,E)=>{E<u&&i&&i===b.type&&(l=!0,p=Math.max(E,u),g=Math.min(E+b.nodeSize,d),f=E,h=b),E>=u&&E<=d&&(i&&i===b.type&&(l=!0,o&&n.setNodeMarkup(E,void 0,{...b.attrs,...e})),s&&b.marks.length&&b.marks.forEach(x=>{if(s===x.type&&(l=!0,o)){const T=Math.max(E,u),D=Math.min(E+b.nodeSize,d);n.addMark(T,D,s.create({...x.attrs,...e}))}}))}),h&&(f!==void 0&&o&&n.setNodeMarkup(f,void 0,{...h.attrs,...e}),s&&h.marks.length&&h.marks.forEach(b=>{s===b.type&&o&&n.addMark(p,g,s.create({...b.attrs,...e}))}))}),l},W6=(t,e={})=>({state:n,dispatch:r})=>{const o=Vt(t,n.schema);return lR(o,e)(n,r)},G6=(t,e={})=>({state:n,dispatch:r})=>{const o=Vt(t,n.schema);return cR(o,e)(n,r)},Y6=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={}}},K6=class{constructor(e){var n;this.find=e.find,this.handler=e.handler,this.undoable=(n=e.undoable)!=null?n:!0}},Q6=(t,e)=>{if(Bg(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 sc(t){var e;const{editor:n,from:r,to:o,text:i,rules:s,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(f=>f.type.spec.code))return!1;let u=!1;const d=T6(c)+i;return s.forEach(f=>{if(u)return;const h=Q6(d,f.find);if(!h)return;const p=l.state.tr,g=$d({state:l.state,transaction:p}),b={from:r-(h[0].length-i.length),to:o},{commands:E,chain:x,can:T}=new jd({editor:n,state:g});f.handler({state:g,range:b,match:h,commands:E,chain:x,can:T})===null||!p.steps.length||(f.undoable&&p.setMeta(a,{transform:p,from:r,to:o,text:i}),l.dispatch(p),u=!0)}),u}function X6(t){const{editor:e,rules:n}=t,r=new ye({state:{init(){return null},apply(o,i,s){const a=o.getMeta(r);if(a)return a;const l=o.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=Hg(V.from(u),s.schema);const{from:d}=l,f=d+u.length;sc({editor:e,from:d,to:f,text:u,rules:n,plugin:r})}),o.selectionSet||o.docChanged?null:i}},props:{handleTextInput(o,i,s,a){return sc({editor:e,from:i,to:s,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:i}=o.state.selection;i&&sc({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(o,i){if(i.key!=="Enter")return!1;const{$cursor:s}=o.state.selection;return s?sc({editor:e,from:s.pos,to:s.pos,text:`
|
|
17
|
+
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function Z6(t){return Object.prototype.toString.call(t).slice(8,-1)}function ac(t){return Z6(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Kw(t,e){const n={...t};return ac(t)&&ac(e)&&Object.keys(e).forEach(r=>{ac(e[r])&&ac(t[r])?n[r]=Kw(t[r],e[r]):n[r]=e[r]}),n}var zg=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{...Qe(de(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Qe(de(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>Kw(this.options,t)});return e.name=this.name,e.parent=this.parent,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}},rr=class Qw extends zg{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new Qw(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){const s=o.marks();if(!!!s.find(c=>c?.type.name===n.name))return!1;const l=s.find(c=>c?.type.name===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",o.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 J6(t){return typeof t=="number"}var e5=class{constructor(t){this.find=t.find,this.handler=t.handler}},t5=(t,e,n)=>{if(Bg(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(o=>{const i=[o.text];return i.index=o.index,i.input=t,i.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(o.replaceWith)),i}):[]};function n5(t){const{editor:e,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:a}=t,{commands:l,chain:c,can:u}=new jd({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,o,(h,p)=>{var g,b,E,x,T;if((b=(g=h.type)==null?void 0:g.spec)!=null&&b.code||!(h.isText||h.isTextblock||h.isInline))return;const D=(T=(x=(E=h.content)==null?void 0:E.size)!=null?x:h.nodeSize)!=null?T:0,O=Math.max(r,p),v=Math.min(o,p+D);if(O>=v)return;const R=h.isText?h.text||"":h.textBetween(O-p,v-p,void 0,"");t5(R,i.find,s).forEach(z=>{if(z.index===void 0)return;const I=O+z.index+1,X=I+z[0].length,F={from:n.tr.mapping.map(I),to:n.tr.mapping.map(X)},W=i.handler({state:n,range:F,match:z,commands:l,chain:c,can:u,pasteEvent:s,dropEvent:a});d.push(W)})}),d.every(h=>h!==null)}var lc=null,r5=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function o5(t){const{editor:e,rules:n}=t;let r=null,o=!1,i=!1,s=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:f,rule:h,pasteEvt:p})=>{const g=u.tr,b=$d({state:u,transaction:g});if(!(!n5({editor:e,state:b,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:a})||!g.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return n.map(u=>new ye({view(d){const f=p=>{var g;r=(g=d.dom.parentElement)!=null&&g.contains(p.target)?d.dom.parentElement:null,r&&(lc=e)},h=()=>{lc&&(lc=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(i=r===d.dom.parentElement,a=f,!i){const h=lc;h?.isEditable&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,f)=>{var h;const p=(h=f.clipboardData)==null?void 0:h.getData("text/html");return s=f,o=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],g=p.getMeta("uiEvent")==="paste"&&!o,b=p.getMeta("uiEvent")==="drop"&&!i,E=p.getMeta("applyPasteRules"),x=!!E;if(!g&&!b&&!x)return;if(x){let{text:O}=E;typeof O=="string"?O=O:O=Hg(V.from(O),h.schema);const{from:v}=E,R=v+O.length,j=r5(O);return l({rule:u,state:h,from:v,to:{b:R},pasteEvt:j})}const T=f.doc.content.findDiffStart(h.doc.content),D=f.doc.content.findDiffEnd(h.doc.content);if(!(!J6(T)||!D||T===D.b))return l({rule:u,state:h,from:T,to:D,pasteEvt:s})}}))}var Kd=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=Ug(t),this.schema=$w(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:ic(e.name,this.schema)},r=de(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return Mu([...this.extensions].reverse()).flatMap(r=>{const o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:ic(r.name,this.schema)},i=[],s=de(r,"addKeyboardShortcuts",o);let a={};if(r.type==="mark"&&de(r,"exitable",o)&&(a.ArrowRight=()=>rr.handleExit({editor:t,mark:r})),s){const f=Object.fromEntries(Object.entries(s()).map(([h,p])=>[h,()=>p({editor:t})]));a={...a,...f}}const l=Iw(a);i.push(l);const c=de(r,"addInputRules",o);if(Jb(r,t.options.enableInputRules)&&c){const f=c();if(f&&f.length){const h=X6({editor:t,rules:f}),p=Array.isArray(h)?h:[h];i.push(...p)}}const u=de(r,"addPasteRules",o);if(Jb(r,t.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const h=o5({editor:t,rules:f});i.push(...h)}}const d=de(r,"addProseMirrorPlugins",o);if(d){const f=d();i.push(...f)}return i})}get attributes(){return Vw(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Bs(this.extensions);return Object.fromEntries(e.filter(n=>!!de(n,"addNodeView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Vt(n.name,this.schema)},i=de(n,"addNodeView",o);if(!i)return[];const s=i();if(!s)return[];const a=(l,c,u,d,f)=>{const h=El(l,r);return s({node:l,view:c,getPos:u,decorations:d,innerDecorations:f,editor:t,extension:n,HTMLAttributes:h})};return[n.name,a]}))}dispatchTransaction(t){const{editor:e}=this;return Mu([...this.extensions].reverse()).reduceRight((r,o)=>{const i={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:e,type:ic(o.name,this.schema)},s=de(o,"dispatchTransaction",i);return s?a=>{s.call(i,{transaction:a,next:r})}:r},t)}get markViews(){const{editor:t}=this,{markExtensions:e}=Bs(this.extensions);return Object.fromEntries(e.filter(n=>!!de(n,"addMarkView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:po(n.name,this.schema)},i=de(n,"addMarkView",o);if(!i)return[];const s=(a,l,c)=>{const u=El(a,r);return i()({mark:a,view:l,inline:c,editor:t,extension:n,HTMLAttributes:u,updateAttributes:d=>{b5(a,t,d)}})};return[n.name,s]}))}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:ic(e.name,this.schema)};e.type==="mark"&&((n=Qe(de(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const o=de(e,"onBeforeCreate",r),i=de(e,"onCreate",r),s=de(e,"onUpdate",r),a=de(e,"onSelectionUpdate",r),l=de(e,"onTransaction",r),c=de(e,"onFocus",r),u=de(e,"onBlur",r),d=de(e,"onDestroy",r);o&&this.editor.on("beforeCreate",o),i&&this.editor.on("create",i),s&&this.editor.on("update",s),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)})}};Kd.resolve=Ug;Kd.sort=Mu;Kd.flatten=Fg;var rs={};Pg(rs,{ClipboardTextSerializer:()=>Zw,Commands:()=>Jw,Delete:()=>e2,Drop:()=>t2,Editable:()=>n2,FocusEvents:()=>o2,Keymap:()=>i2,Paste:()=>s2,Tabindex:()=>a2,TextDirection:()=>l2,focusEventsPluginKey:()=>r2});var We=class Xw extends zg{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new Xw(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},Zw=We.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ye({key:new Oe("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,{ranges:i}=o,s=Math.min(...i.map(u=>u.$from.pos)),a=Math.max(...i.map(u=>u.$to.pos)),l=zw(n);return jw(r,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),Jw=We.create({name:"commands",addCommands(){return{...Mw}}}),e2=We.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,o;const i=()=>{var s,a,l,c;if((c=(l=(a=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,t))!=null?c:t.getMeta("y-sync$"))return;const u=Wd(t.before,[t,...e]);Vg(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(p,g)=>{const b=g+p.nodeSize-2,E=h.oldRange.from<=g&&b<=h.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:h.oldRange,newRange:h.newRange,partial:!E,editor:this.editor,transaction:t,combinedTransform:u})})});const f=u.mapping;u.steps.forEach((h,p)=>{var g,b;if(h instanceof ur){const E=f.slice(p).map(h.from,-1),x=f.slice(p).map(h.to),T=f.invert().map(E,-1),D=f.invert().map(x),O=(g=u.doc.nodeAt(E-1))==null?void 0:g.marks.some(R=>R.eq(h.mark)),v=(b=u.doc.nodeAt(x))==null?void 0:b.marks.some(R=>R.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:T,to:D},newRange:{from:E,to:x},partial:!!(v||O),editor:this.editor,transaction:t,combinedTransform:u})}})};(o=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||o?setTimeout(i,0):i()}}),t2=We.create({name:"drop",addProseMirrorPlugins(){return[new ye({key:new Oe("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),n2=We.create({name:"editable",addProseMirrorPlugins(){return[new ye({key:new Oe("editable"),props:{editable:()=>this.editor.options.editable}})]}}),r2=new Oe("focusEvents"),o2=We.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new ye({key:r2,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}}}})]}}),i2=We.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:d}=l,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?a.doc.resolve(f-1):d,g=p.parent.type.spec.isolating,b=d.pos-d.parentOffset,E=g&&p.parent.childCount===1?b===d.pos:me.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!E||E&&d.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.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()},o={...r},i={...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 gl()||Bw()?i:o},addProseMirrorPlugins(){return[new ye({key:new Oe("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),o=t.some(g=>g.getMeta("preventClearDocument"));if(!r||o)return;const{empty:i,from:s,to:a}=e.selection,l=me.atStart(e.doc).from,c=me.atEnd(e.doc).to;if(i||!(s===l&&a===c)||!Yd(n.doc))return;const f=n.tr,h=$d({state:n,transaction:f}),{commands:p}=new jd({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),s2=We.create({name:"paste",addProseMirrorPlugins(){return[new ye({key:new Oe("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),a2=We.create({name:"tabindex",addProseMirrorPlugins(){return[new ye({key:new Oe("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),l2=We.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Bs(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 ye({key:new Oe("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),i5=class Ca{constructor(e,n,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=o}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 Ca(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 Ca(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 Ca(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=n.isInline,a=this.pos+r+(i?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!o&&!s&&l.depth<=this.depth)return;const c=new Ca(l,this.editor,o,o||s?n:null);o&&(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,o=this.parent;for(;o&&!r;){if(o.node.type.name===e)if(Object.keys(n).length>0){const i=o.node.attrs,s=Object.keys(n);for(let a=0;a<s.length;a+=1){const l=s[a];if(i[l]!==n[l])break}}else r=o;o=o.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let o=[];if(!this.children||this.children.length===0)return o;const i=Object.keys(n);return this.children.forEach(s=>{r&&o.length>0||(s.node.type.name===e&&i.every(l=>n[l]===s.node.attrs[l])&&o.push(s),!(r&&o.length>0)&&(o=o.concat(s.querySelectorAll(e,n,r))))}),o}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},s5=`.ProseMirror {
|
|
18
|
+
position: relative;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.ProseMirror {
|
|
22
|
+
word-wrap: break-word;
|
|
23
|
+
white-space: pre-wrap;
|
|
24
|
+
white-space: break-spaces;
|
|
25
|
+
-webkit-font-variant-ligatures: none;
|
|
26
|
+
font-variant-ligatures: none;
|
|
27
|
+
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.ProseMirror [contenteditable="false"] {
|
|
31
|
+
white-space: normal;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
35
|
+
white-space: pre-wrap;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.ProseMirror pre {
|
|
39
|
+
white-space: pre-wrap;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
img.ProseMirror-separator {
|
|
43
|
+
display: inline !important;
|
|
44
|
+
border: none !important;
|
|
45
|
+
margin: 0 !important;
|
|
46
|
+
width: 0 !important;
|
|
47
|
+
height: 0 !important;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.ProseMirror-gapcursor {
|
|
51
|
+
display: none;
|
|
52
|
+
pointer-events: none;
|
|
53
|
+
position: absolute;
|
|
54
|
+
margin: 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.ProseMirror-gapcursor:after {
|
|
58
|
+
content: "";
|
|
59
|
+
display: block;
|
|
60
|
+
position: absolute;
|
|
61
|
+
top: -2px;
|
|
62
|
+
width: 20px;
|
|
63
|
+
border-top: 1px solid black;
|
|
64
|
+
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@keyframes ProseMirror-cursor-blink {
|
|
68
|
+
to {
|
|
69
|
+
visibility: hidden;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.ProseMirror-hideselection *::selection {
|
|
74
|
+
background: transparent;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
78
|
+
background: transparent;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.ProseMirror-hideselection * {
|
|
82
|
+
caret-color: transparent;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
86
|
+
display: block;
|
|
87
|
+
}`;function a5(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const o=document.createElement("style");return e&&o.setAttribute("nonce",e),o.setAttribute("data-tiptap-style",""),o.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(o),o}var l5=class extends Y6{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!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:S6,createMappablePosition:v6},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:o,moved:i})=>this.options.onDrop(r,o,i)),this.on("paste",({event:r,slice:o})=>this.options.onPaste(r,o)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=Lw(e,this.options.autofocus);this.editorState=ls.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=a5(s5,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=Uw(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(o=>{const i=typeof o=="string"?`${o}$`:o.key;n=n.filter(s=>!s.key.startsWith(i))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[n2,Zw.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Jw,o2,i2,a2,t2,s2,e2,l2.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 Kd(r,this)}createCommandManager(){this.commandManager=new jd({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Iu(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=Iu(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),o=n?this.extensionManager.dispatchTransaction(r):r;this.editorView=new qk(t,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.prependClass(),this.injectCSS();const s=this.view.dom;s.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),o=n.includes(t),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!o)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 s=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=s?.getMeta("focus"),l=s?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:s}),l&&this.emit("blur",{editor:this,event:l.event,transaction:s}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return qw(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return w6(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Hg(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
|
|
88
|
+
|
|
89
|
+
`,textSerializers:n={}}=t||{};return E6(this.state.doc,{blockSeparator:e,textSerializers:{...zw(this.schema),...n}})}get isEmpty(){return Yd(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}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);return new i5(e,this)}get $doc(){return this.$pos(0)}};function Fs(t){return new K6({find:t.find,handler:({state:e,range:n,match:r})=>{const o=Qe(t.getAttributes,void 0,r);if(o===!1||o===null)return null;const{tr:i}=e,s=r[r.length-1],a=r[0];if(s){const l=a.search(/\S/),c=n.from+a.indexOf(s),u=c+s.length;if($g(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(g=>g===t.type&&g!==h.mark.type)).filter(h=>h.to>c).length)return null;u<n.to&&i.delete(u,n.to),c>n.from&&i.delete(n.from+l,c);const f=n.from+l+s.length;i.addMark(n.from+l,f,t.type.create(o||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}var c5={};Pg(c5,{createAtomBlockMarkdownSpec:()=>u5,createBlockMarkdownSpec:()=>d5,createInlineMarkdownSpec:()=>p5,parseAttributes:()=>qg,parseIndentedBlocks:()=>m5,renderNestedMarkdownContent:()=>g5,serializeAttributes:()=>Wg});function qg(t){if(!t?.trim())return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,c=>(n.push(c),`__QUOTED_${n.length-1}__`)),o=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){const c=o.map(u=>u.trim().slice(1));e.class=c.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(s)).forEach(([,c,u])=>{var d;const f=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),h=n[f];h&&(e[c]=h.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 Wg(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 u5(t){const{nodeName:e,name:n,parseAttributes:r=qg,serializeAttributes:o=Wg,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:a}=t,l=n||e,c=u=>{if(!a)return u;const d={};return a.forEach(f=>{f in u&&(d[f]=u[f])}),d};return{parseMarkdown:(u,d)=>{const f={...i,...u.attributes};return d.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(u){var d;const f=new RegExp(`^:::${l}(?:\\s|$)`,"m"),h=(d=u.match(f))==null?void 0:d.index;return h!==void 0?h:-1},tokenize(u,d,f){const h=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=u.match(h);if(!p)return;const g=p[1]||"",b=r(g);if(!s.find(x=>!(x in b)))return{type:e,raw:p[0],attributes:b}}},renderMarkdown:u=>{const d=c(u.attrs||{}),f=o(d),h=f?` {${f}}`:"";return`:::${l}${h} :::`}}}function d5(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=qg,serializeAttributes:i=Wg,defaultAttributes:s={},content:a="block",allowedAttributes:l}=t,c=n||e,u=d=>{if(!l)return d;const f={};return l.forEach(h=>{h in d&&(f[h]=d[h])}),f};return{parseMarkdown:(d,f)=>{let h;if(r){const g=r(d);h=typeof g=="string"?[{type:"text",text:g}]:g}else a==="block"?h=f.parseChildren(d.tokens||[]):h=f.parseInline(d.tokens||[]);const p={...s,...d.attributes};return f.createNode(e,p,h)},markdownTokenizer:{name:e,level:"block",start(d){var f;const h=new RegExp(`^:::${c}`,"m"),p=(f=d.match(h))==null?void 0:f.index;return p!==void 0?p:-1},tokenize(d,f,h){var p;const g=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),b=d.match(g);if(!b)return;const[E,x=""]=b,T=o(x);let D=1;const O=E.length;let v="";const R=/^:::([\w-]*)(\s.*)?/gm,j=d.slice(O);for(R.lastIndex=0;;){const z=R.exec(j);if(z===null)break;const I=z.index,X=z[1];if(!((p=z[2])!=null&&p.endsWith(":::"))){if(X)D+=1;else if(D-=1,D===0){const F=j.slice(0,I);v=F.trim();const W=d.slice(0,O+I+z[0].length);let B=[];if(v)if(a==="block")for(B=h.blockTokens(F),B.forEach(q=>{q.text&&(!q.tokens||q.tokens.length===0)&&(q.tokens=h.inlineTokens(q.text))});B.length>0;){const q=B[B.length-1];if(q.type==="paragraph"&&(!q.text||q.text.trim()===""))B.pop();else break}else B=h.inlineTokens(v);return{type:e,raw:W,attributes:T,content:v,tokens:B}}}}}},renderMarkdown:(d,f)=>{const h=u(d.attrs||{}),p=i(h),g=p?` {${p}}`:"",b=f.renderChildren(d.content||[],`
|
|
90
|
+
|
|
91
|
+
`);return`:::${c}${g}
|
|
92
|
+
|
|
93
|
+
${b}
|
|
94
|
+
|
|
95
|
+
:::`}}}function f5(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,o,i,s]=r;e[o]=i||s,r=n.exec(t)}return e}function h5(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function p5(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=f5,serializeAttributes:i=h5,defaultAttributes:s={},selfClosing:a=!1,allowedAttributes:l}=t,c=n||e,u=f=>{if(!l)return f;const h={};return l.forEach(p=>{const g=typeof p=="string"?p:p.name,b=typeof p=="string"?void 0:p.skipIfDefault;if(g in f){const E=f[g];if(b!==void 0&&E===b)return;h[g]=E}}),h},d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,h)=>{const p={...s,...f.attributes};if(a)return h.createNode(e,p);const g=r?r(f):f.content||"";return g?h.createNode(e,p,[h.createTextNode(g)]):h.createNode(e,p,[])},markdownTokenizer:{name:e,level:"inline",start(f){const h=a?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),p=f.match(h),g=p?.index;return g!==void 0?g:-1},tokenize(f,h,p){const g=a?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),b=f.match(g);if(!b)return;let E="",x="";if(a){const[,D]=b;x=D}else{const[,D,O]=b;x=D,E=O||""}const T=o(x.trim());return{type:e,raw:b[0],content:E.trim(),attributes:T}}},renderMarkdown:f=>{let h="";r?h=r(f):f.content&&f.content.length>0&&(h=f.content.filter(E=>E.type==="text").map(E=>E.text).join(""));const p=u(f.attrs||{}),g=i(p),b=g?` ${g}`:"";return a?`[${c}${b}]`:`[${c}${b}]${h}[/${c}]`}}}function m5(t,e,n){var r,o,i,s;const a=t.split(`
|
|
96
|
+
`),l=[];let c="",u=0;const d=e.baseIndentSize||2;for(;u<a.length;){const f=a[u],h=f.match(e.itemPattern);if(!h){if(l.length>0)break;if(f.trim()===""){u+=1,c=`${c}${f}
|
|
97
|
+
`;continue}else return}const p=e.extractItemData(h),{indentLevel:g,mainContent:b}=p;c=`${c}${f}
|
|
98
|
+
`;const E=[b];for(u+=1;u<a.length;){const O=a[u];if(O.trim()===""){const R=a.slice(u+1).findIndex(I=>I.trim()!=="");if(R===-1)break;if((((o=(r=a[u+1+R].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:o.length)||0)>g){E.push(O),c=`${c}${O}
|
|
99
|
+
`,u+=1;continue}else break}if((((s=(i=O.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:s.length)||0)>g)E.push(O),c=`${c}${O}
|
|
100
|
+
`,u+=1;else break}let x;const T=E.slice(1);if(T.length>0){const O=T.map(v=>v.slice(g+d)).join(`
|
|
101
|
+
`);O.trim()&&(e.customNestedParser?x=e.customNestedParser(O):x=n.blockTokens(O))}const D=e.createToken(p,x);l.push(D)}if(l.length!==0)return{items:l,raw:c}}function g5(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const o=typeof n=="function"?n(r):n,[i,...s]=t.content,a=e.renderChildren([i]),l=[`${o}${a}`];return s&&s.length>0&&s.forEach(c=>{const u=e.renderChildren([c]);if(u){const d=u.split(`
|
|
102
|
+
`).map(f=>f?e.indent(f):"").join(`
|
|
103
|
+
`);l.push(d)}}),l.join(`
|
|
104
|
+
`)}function b5(t,e,n={}){const{state:r}=e,{doc:o,tr:i}=r,s=t;o.descendants((a,l)=>{const c=i.mapping.map(l),u=i.mapping.map(l)+a.nodeSize;let d=null;if(a.marks.forEach(h=>{if(h!==s)return!1;d=h}),!d)return;let f=!1;if(Object.keys(n).forEach(h=>{n[h]!==d.attrs[h]&&(f=!0)}),f){const h=t.type.create({...t.attrs,...n});i.removeMark(c,u,t.type),i.addMark(c,u,h)}}),i.docChanged&&e.view.dispatch(i)}var Cr=class c2 extends zg{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new c2(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},y5=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,o,i,s,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,f=0;if(this.dom!==u){const x=this.dom.getBoundingClientRect(),T=u.getBoundingClientRect(),D=(o=t.offsetX)!=null?o:(r=t.nativeEvent)==null?void 0:r.offsetX,O=(s=t.offsetY)!=null?s:(i=t.nativeEvent)==null?void 0:i.offsetY;d=T.x-x.x+D,f=T.y-x.y+O}const h=this.dom.cloneNode(!0);try{const x=this.dom.getBoundingClientRect();h.style.width=`${Math.round(x.width)}px`,h.style.height=`${Math.round(x.height)}px`,h.style.boxSizing="border-box",h.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(h),document.body.appendChild(p),(a=t.dataTransfer)==null||a.setDragImage(h,d,f)}finally{p&&setTimeout(()=>{try{p?.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const b=le.create(l.state.doc,g),E=l.state.tr.setSelection(b);l.dispatch(E)}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 o=t.type.startsWith("drag"),i=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!i&&!o)return!0;const{isEditable:a}=this.editor,{isDragging:l}=this,c=!!this.node.type.spec.draggable,u=le.isSelectable(this.node),d=t.type==="copy",f=t.type==="paste",h=t.type==="cut",p=t.type==="mousedown";if(!c&&u&&o&&t.target===this.dom&&t.preventDefault(),c&&o&&!l&&t.target===this.dom)return t.preventDefault(),!1;if(c&&a&&!l&&p){const g=n.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(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!(l||i||d||f||h||p&&u)}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"&&(gl()||Vp())&&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 Mi(t){return new e5({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:o})=>{const i=Qe(t.getAttributes,void 0,r,o);if(i===!1||i===null)return null;const{tr:s}=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),f=d+a.length;if($g(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(b=>b===t.type&&b!==p.mark.type)).filter(p=>p.to>d).length)return null;f<n.to&&s.delete(f,n.to),d>n.from&&s.delete(n.from+u,d),c=n.from+u+a.length,s.addMark(n.from+u,c,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}var E5=Object.defineProperty,x5=(t,e,n)=>e in t?E5(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,C5=(t,e,n)=>x5(t,e+"",n);let Gg=class{constructor(){C5(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(o=>o.apply(this,n))}off(e,n){const r=this.callbacks[e];r&&(n?this.callbacks[e]=r.filter(o=>o!==n):delete this.callbacks[e])}removeAllListeners(){this.callbacks={}}};var cc,k5=new Uint8Array(16);function T5(){if(!cc&&(cc=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!cc))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return cc(k5)}const w5=/^(?:[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 S5(t){return typeof t=="string"&&w5.test(t)}var jt=[];for(var ih=0;ih<256;++ih)jt.push((ih+256).toString(16).substr(1));function v5(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(jt[t[e+0]]+jt[t[e+1]]+jt[t[e+2]]+jt[t[e+3]]+"-"+jt[t[e+4]]+jt[t[e+5]]+"-"+jt[t[e+6]]+jt[t[e+7]]+"-"+jt[t[e+8]]+jt[t[e+9]]+"-"+jt[t[e+10]]+jt[t[e+11]]+jt[t[e+12]]+jt[t[e+13]]+jt[t[e+14]]+jt[t[e+15]]).toLowerCase();if(!S5(n))throw TypeError("Stringified UUID is invalid");return n}function u2(t,e,n){t=t||{};var r=t.random||(t.rng||T5)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,v5(r)}var A5=Object.defineProperty,_5=(t,e,n)=>e in t?A5(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ny=(t,e,n)=>_5(t,typeof e!="symbol"?e+"":e,n);const ry=rr.create({name:"comment",excludes:"",inclusive:!1,keepOnSplit:!0,addAttributes(){return{orphan:{parseHTML:t=>!!t.getAttribute("data-orphan"),renderHTML:t=>t.orphan?{"data-orphan":"true"}:{},default:!1},threadId:{parseHTML:t=>t.getAttribute("data-bn-thread-id"),renderHTML:t=>({"data-bn-thread-id":t.threadId}),default:""}}},renderHTML({HTMLAttributes:t}){return["span",Hn(t,{class:"bn-thread-mark"})]},parseHTML(){return[{tag:"span.bn-thread-mark"}]},extendMarkSchema(t){return t.name==="comment"?{blocknoteIgnore:!0}:{}}});let N5=class extends Gg{constructor(e){super(),ny(this,"userCache",new Map),ny(this,"loadingUsers",new Set),this.resolveUsers=e}async loadUsers(e){const n=e.filter(r=>!this.userCache.has(r)&&!this.loadingUsers.has(r));if(n.length!==0){for(const r of n)this.loadingUsers.add(r);try{const r=await this.resolveUsers(n);for(const o of r)this.userCache.set(o.id,o);this.emit("update",this.userCache)}finally{for(const r of n)this.loadingUsers.delete(r)}}}getUser(e){return this.userCache.get(e)}subscribe(e){return this.on("update",e)}};const uc=new Oe("blocknote-comments");function I5(t,e){const n=new Map;return t.descendants((r,o)=>{r.marks.forEach(i=>{if(i.type.name===e){const s=i.attrs.threadId;if(!s)return;const a=o,l=a+r.nodeSize,c=n.get(s)??{from:1/0,to:0};n.set(s,{from:Math.min(a,c.from),to:Math.max(l,c.to)})}})}),n}const nr=ze(({editor:t,options:{schema:e,threadStore:n,resolveUsers:r}})=>{if(!r)throw new Error("resolveUsers is required to be defined when using comments");if(!n)throw new Error("threadStore is required to be defined when using comments");const o=ry.name,i=new N5(r),s=ei({pendingComment:!1,selectedThreadId:void 0,threadPositions:new Map},{onUpdate(){s.state.selectedThreadId!==s.prevState.selectedThreadId&&t.transact(l=>l.setMeta(uc,!0))}}),a=l=>{t.transact(c=>{c.doc.descendants((u,d)=>{u.marks.forEach(f=>{if(f.type.name===o){const h=f.type,p=f.attrs.threadId,g=l.get(p),b=!!(!g||g.resolved||g.deletedAt);if(b!==f.attrs.orphan){const E=Math.max(d,0),x=Math.min(d+u.nodeSize,c.doc.content.size-1,c.doc.content.size-1);c.removeMark(E,x,f),c.addMark(E,x,h.create({...f.attrs,orphan:b})),b&&s.state.selectedThreadId===p&&s.setState(T=>({...T,selectedThreadId:void 0}))}}})})})};return{key:"comments",store:s,prosemirrorPlugins:[new ye({key:uc,state:{init(){return{decorations:ke.empty}},apply(l,c){const u=l.getMeta(uc);if(!l.docChanged&&!u)return c;const d=l.docChanged?I5(l.doc,o):s.state.threadPositions;(d.size>0||s.state.threadPositions.size>0)&&s.setState(h=>({...h,threadPositions:d}));const f=[];if(s.state.selectedThreadId){const h=d.get(s.state.selectedThreadId);h&&f.push(je.inline(h.from,h.to,{class:"bn-thread-mark-selected"}))}return{decorations:ke.create(l.doc,f)}}},props:{decorations(l){var c;return((c=uc.getState(l))==null?void 0:c.decorations)??ke.empty},handleClick:(l,c,u)=>{if(u.button!==0)return;const d=l.state.doc.nodeAt(c);if(!d){s.setState(p=>({...p,selectedThreadId:void 0}));return}const f=d.marks.find(p=>p.type.name===o&&p.attrs.orphan!==!0),h=f?.attrs.threadId;h!==s.state.selectedThreadId&&s.setState(p=>({...p,selectedThreadId:h}))}}})],threadStore:n,mount(){const l=n.subscribe(a);a(n.getThreads());const c=t.onSelectionChange(()=>{s.state.pendingComment&&s.setState(u=>({...u,pendingComment:!1}))});return()=>{l(),c()}},selectThread(l,c=!0){var u,d;if(s.state.selectedThreadId!==l&&(s.setState(f=>({...f,pendingComment:!1,selectedThreadId:l})),l&&c)){const f=s.state.threadPositions.get(l);if(!f)return;(d=(u=t.prosemirrorView)==null?void 0:u.domAtPos(f.from).node)==null||d.scrollIntoView({behavior:"smooth",block:"center"})}},startPendingComment(){var l;s.setState(c=>({...c,selectedThreadId:void 0,pendingComment:!0})),(l=t.getExtension(ml))==null||l.showSelection(!0)},stopPendingComment(){var l;s.setState(c=>({...c,selectedThreadId:void 0,pendingComment:!1})),(l=t.getExtension(ml))==null||l.showSelection(!1)},async createThread(l){const c=await n.createThread(l);if(n.addThreadToDocument){const u=t.prosemirrorView,d=u.state.selection,f=nt.getState(u.state),h={prosemirror:{head:d.head,anchor:d.anchor},yjs:f?Su(f.binding,u.state):void 0};await n.addThreadToDocument({threadId:c.id,selection:h})}else t._tiptapEditor.commands.setMark(o,{orphan:!1,threadId:c.id})},userStore:i,commentEditorSchema:e,tiptapExtensions:[ry]}});var sh,oy;function M5(){return oy||(oy=1,sh=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,o,i;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!t(e[o],n[o]))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(i=Object.keys(e),r=i.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;o--!==0;){var s=i[o];if(!t(e[s],n[s]))return!1}return!0}return e!==e&&n!==n}),sh}var O5=M5();const D5=gC(O5);function L5(t,e=JSON.stringify){const n={};return t.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function R5(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return L5(e)}const Qd=We.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 u2()},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 ye({key:new Oe("uniqueID"),appendTransaction:(n,r,o)=>{const i=n.some(h=>h.docChanged)&&!r.doc.eq(o.doc),s=this.options.filterTransaction&&n.some(h=>{var p,g;return!((g=(p=this.options).filterTransaction)!=null&&g.call(p,h))});if(!i||s)return;const{tr:a}=o,{types:l,attributeName:c,generateID:u}=this.options,d=Wd(r.doc,n),{mapping:f}=d;if(Vg(d).forEach(({newRange:h})=>{const p=Hw(o.doc,h,E=>l.includes(E.type.name)),g=p.map(({node:E})=>E.attrs[c]).filter(E=>E!==null),b=R5(g);p.forEach(({node:E,pos:x})=>{var T;const D=(T=a.doc.nodeAt(x))==null?void 0:T.attrs[c];if(D===null){const v=r.doc.type.createAndFill().content;if(r.doc.content.findDiffStart(v)===null){const R=JSON.parse(JSON.stringify(o.doc.toJSON()));if(R.content[0].content[0].attrs.id="initialBlockId",JSON.stringify(R.content)===JSON.stringify(v.toJSON())){a.setNodeMarkup(x,void 0,{...E.attrs,[c]:"initialBlockId"});return}}a.setNodeMarkup(x,void 0,{...E.attrs,[c]:u()});return}const{deleted:O}=f.invert().mapResult(x);O&&b.includes(D)&&a.setNodeMarkup(x,void 0,{...E.attrs,[c]:u()})})}),!!a.steps.length)return a.setMeta("uniqueID",!0),a},view(n){const r=o=>{let i;t=!((i=n.dom.parentElement)===null||i===void 0)&&i.contains(o.target)?n.dom.parentElement:null};return window.addEventListener("dragstart",r),{destroy(){window.removeEventListener("dragstart",r)}}},props:{handleDOMEvents:{drop:(n,r)=>{let o;return t!==n.dom.parentElement||((o=r.dataTransfer)===null||o===void 0?void 0:o.effectAllowed)==="copy"?e=!0:e=!1,t=null,!1},paste:()=>(e=!0,!1)},transformPasted:n=>{if(!e)return n;const{types:r,attributeName:o}=this.options,i=s=>{const a=[];return s.forEach(l=>{if(l.isText){a.push(l);return}if(!r.includes(l.type.name)){a.push(l.copy(i(l.content)));return}const c=l.type.create({...l.attrs,[o]:null},i(l.content),l.marks);a.push(c)}),V.from(a)};return e=!1,new Q(i(n.content),n.openStart,n.openEnd)}}})]}});function iy(t){return t.type==="link"}function d2(t){return typeof t!="string"&&t.type==="link"}function Oi(t){return typeof t!="string"&&t.type==="text"}function qo(t){var e,n,r,o,i;return Wo(t)?{...t}:xl(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:((o=t.props)==null?void 0:o.colspan)??1,rowspan:((i=t.props)==null?void 0:i.rowspan)??1}}:{type:"tableCell",content:[].concat(t),props:{backgroundColor:"default",textColor:"default",textAlignment:"left",colspan:1,rowspan:1}}}function xl(t){return t!=null&&typeof t!="string"&&!Array.isArray(t)&&t.type==="tableCell"}function Wo(t){return xl(t)&&t.props!==void 0&&t.content!==void 0}function Di(t){return Wo(t)?t.props.colspan??1:1}function Cl(t){return Wo(t)?t.props.rowspan??1:1}class Hr extends Error{constructor(e){super(`Unreachable case: ${e}`)}}function Se(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 Go(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,o=n.node(r);for(;r>0;){if(o.type.isInGroup("bnBlock"))return{posBeforeNode:n.before(r),node:o};r--,o=n.node(r)}const i=[];t.descendants((a,l)=>{a.type.isInGroup("bnBlock")&&i.push(l)}),console.warn(`Position ${e} is not within a blockContainer node.`);const s=t.resolve(i.find(a=>a>=e)||i[i.length-1]);return{posBeforeNode:s.pos,node:s.nodeAfter}}function Yg(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,o=r+n.nodeSize,i={node:n,beforePos:r,afterPos:o};if(n.type.name==="blockContainer"){let s,a;if(n.forEach((l,c)=>{if(l.type.spec.group==="blockContent"){const u=l,d=r+c+1,f=d+l.nodeSize;s={node:u,beforePos:d,afterPos:f}}else if(l.type.name==="blockGroup"){const u=l,d=r+c+1,f=d+l.nodeSize;a={node:u,beforePos:d,afterPos:f}}}),!s)throw new Error(`blockContainer node does not contain a blockContent node in its children: ${n}`);return{isBlockContainer:!0,bnBlock:i,blockContent:s,childContainer:a,blockNoteType:s.node.type.name}}else{if(!i.node.type.isInGroup("childContainer"))throw new Error(`bnBlock node is not in the childContainer group: ${i.node}`);return{isBlockContainer:!1,bnBlock:i,childContainer:i,blockNoteType:i.node.type.name}}}function Yo(t){return Yg(t.node,t.posBeforeNode)}function Xd(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 Yg(t.nodeAfter,t.pos)}function gn(t){const e=Go(t.doc,t.selection.anchor);return Yo(e)}function Fl(t){const e=Go(t.doc,t.selection.anchor);return Yo(e)}function Et(t){return"doc"in t?t.doc.type.schema:t.type.schema}function f2(t){return t.cached.blockNoteEditor}function Hl(t){return f2(t).schema}function Kg(t){return Hl(t).blockSchema}function Qg(t){return Hl(t).inlineContentSchema}function Qs(t){return Hl(t).styleSchema}function Xg(t){return f2(t).blockCache}function h2(t,e,n){var r,o;const i={type:"tableContent",columnWidths:[],headerRows:void 0,headerCols:void 0,rows:[]},s=[];t.content.forEach((a,l,c)=>{const u={cells:[]};c===0&&a.content.forEach(d=>{let f=d.attrs.colwidth;f==null&&(f=new Array(d.attrs.colspan??1).fill(void 0)),i.columnWidths.push(...f)}),u.cells=a.content.content.map((d,f)=>(s[c]||(s[c]=[]),s[c][f]=d.type.name==="tableHeader",{type:"tableCell",content:d.content.content.map(h=>Zd(h,e,n)).reduce((h,p)=>{if(!h.length)return p;const g=h[h.length-1],b=p[0];return b&&Oi(g)&&Oi(b)&&JSON.stringify(g.styles)===JSON.stringify(b.styles)?(g.text+=`
|
|
105
|
+
`+b.text,h.push(...p.slice(1)),h):(h.push(...p),h)},[]),props:{colspan:d.attrs.colspan,rowspan:d.attrs.rowspan,backgroundColor:d.attrs.backgroundColor,textColor:d.attrs.textColor,textAlignment:d.attrs.textAlignment}})),i.rows.push(u)});for(let a=0;a<s.length;a++)(r=s[a])!=null&&r.every(l=>l)&&(i.headerRows=(i.headerRows??0)+1);for(let a=0;a<((o=s[0])==null?void 0:o.length);a++)s!=null&&s.every(l=>l[a])&&(i.headerCols=(i.headerCols??0)+1);return i}function Zd(t,e,n){const r=[];let o;return t.content.forEach(i=>{if(i.type.name==="hardBreak"){if(o)if(Oi(o))o.text+=`
|
|
106
|
+
`;else if(iy(o))o.content[o.content.length-1].text+=`
|
|
107
|
+
`;else throw new Error("unexpected");else o={type:"text",text:`
|
|
108
|
+
`,styles:{}};return}if(i.type.name!=="link"&&i.type.name!=="text"){if(!e[i.type.name]){console.warn("unrecognized inline content type",i.type.name);return}o&&(r.push(o),o=void 0),r.push(Zg(i,e,n));return}const s={};let a;for(const l of i.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")s[c.type]=!0;else if(c.propSchema==="string")s[c.type]=l.attrs.stringValue;else throw new Hr(c.propSchema)}o?Oi(o)?a?(r.push(o),o={type:"link",href:a.attrs.href,content:[{type:"text",text:i.textContent,styles:s}]}):JSON.stringify(o.styles)===JSON.stringify(s)?o.text+=i.textContent:(r.push(o),o={type:"text",text:i.textContent,styles:s}):iy(o)&&(a?o.href===a.attrs.href?JSON.stringify(o.content[o.content.length-1].styles)===JSON.stringify(s)?o.content[o.content.length-1].text+=i.textContent:o.content.push({type:"text",text:i.textContent,styles:s}):(r.push(o),o={type:"link",href:a.attrs.href,content:[{type:"text",text:i.textContent,styles:s}]}):(r.push(o),o={type:"text",text:i.textContent,styles:s})):a?o={type:"link",href:a.attrs.href,content:[{type:"text",text:i.textContent,styles:s}]}:o={type:"text",text:i.textContent,styles:s}}),o&&r.push(o),r}function Zg(t,e,n){if(t.type.name==="text"||t.type.name==="link")throw new Error("unexpected");const r={},o=e[t.type.name];for(const[s,a]of Object.entries(t.attrs)){if(!o)throw Error("ic node is of an unrecognized type: "+t.type.name);const l=o.propSchema;s in l&&(r[s]=a)}let i;return o.content==="styled"?i=Zd(t,e,n):i=void 0,{type:t.type.name,props:r,content:i}}function pt(t,e,n=Kg(e),r=Qg(e),o=Qs(e),i=Xg(e)){var s;if(!t.type.isInGroup("bnBlock"))throw Error("Node should be a bnBlock, but is instead: "+t.type.name);const a=i?.get(t);if(a)return a;const l=Yg(t,0);let c=l.bnBlock.node.attrs.id;c===null&&(c=Qd.options.generateID());const u=n[l.blockNoteType];if(!u)throw Error("Block is of an unrecognized type: "+l.blockNoteType);const d={};for(const[b,E]of Object.entries({...t.attrs,...l.isBlockContainer?l.blockContent.node.attrs:{}})){const x=u.propSchema;b in x&&!(x[b].default===void 0&&E===void 0)&&(d[b]=E)}const f=n[l.blockNoteType],h=[];(s=l.childContainer)==null||s.node.forEach(b=>{h.push(pt(b,e,n,r,o,i))});let p;if(f.content==="inline"){if(!l.isBlockContainer)throw new Error("impossible");p=Zd(l.blockContent.node,r,o)}else if(f.content==="table"){if(!l.isBlockContainer)throw new Error("impossible");p=h2(l.blockContent.node,r,o)}else if(f.content==="none")p=void 0;else throw new Hr(f.content);const g={id:c,type:f.type,props:d,content:p,children:h};return i?.set(t,g),g}function P5(t,e=Et(t),n=Kg(e),r=Qg(e),o=Qs(e),i=Xg(e)){const s=[];return t.firstChild&&t.firstChild.descendants(a=>(s.push(pt(a,e,n,r,o,i)),!1)),s}function B5(t,e,n=Kg(e),r=Qg(e),o=Qs(e),i=Xg(e)){function s(a,l,c){if(a.type.name!=="blockGroup")throw new Error("unexpected");const u=[];let d,f;return a.forEach((h,p,g)=>{if(h.type.name!=="blockContainer")throw new Error("unexpected");if(h.childCount===0)return;if(h.childCount===0||h.childCount>2)throw new Error("unexpected, blockContainer.childCount: "+h.childCount);const b=g===0,E=g===a.childCount-1;if(h.firstChild.type.name==="blockGroup"){if(!b)throw new Error("unexpected");const O=s(h.firstChild,Math.max(0,l-1),E?Math.max(0,c-1):0);d=O.blockCutAtStart,E&&(f=O.blockCutAtEnd),u.push(...O.blocks);return}const x=pt(h,e,n,r,o,i),T=h.childCount>1?h.child(1):void 0;let D=[];if(T){const O=s(T,0,E?Math.max(0,c-1):0);D=O.blocks,E&&(f=O.blockCutAtEnd)}E&&!T&&c>1&&(f=x.id),b&&l>1&&(d=x.id),u.push({...x,children:D})}),{blocks:u,blockCutAtStart:d,blockCutAtEnd:f}}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 s(t.content.firstChild,Math.max(t.openStart-1,0),Math.max(t.openEnd-1,0))}function ti(t){const{height:e,width:n}=Jg(t),r=new Array(e).fill(!1).map(()=>new Array(n).fill(null)),o=(i,s)=>{for(let a=i;a<e;a++)for(let l=s;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 i=0;i<t.content.rows.length;i++)for(let s=0;s<t.content.rows[i].cells.length;s++){const a=qo(t.content.rows[i].cells[s]),l=Cl(a),c=Di(a),{row:u,col:d}=o(i,s);for(let f=u;f<u+l;f++)for(let h=d;h<d+c;h++){if(r[f][h])throw new Error(`Unable to create occupancy grid for table, cell at ${f},${h} is already occupied`);r[f][h]={row:i,col:s,rowspan:l,colspan:c,cell:a}}}return r}function kl(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 Li(t,e,n=ti(e)){for(let r=0;r<n.length;r++)for(let o=0;o<n[r].length;o++){const i=n[r][o];if(i.row===t.row&&i.col===t.col)return{row:r,col:o,cell:i.cell}}throw new Error(`Unable to resolve relative table cell indices for table, cell at ${t.row},${t.col} is not occupied`)}function Jg(t){const e=t.content.rows.length;let n=0;return t.content.rows.forEach(r=>{let o=0;r.cells.forEach(i=>{o+=Di(i)}),n=Math.max(n,o)}),{height:e,width:n}}function p2(t,e,n=ti(e)){var r;const o=(r=n[t.row])==null?void 0:r[t.col];if(o)return{row:o.row,col:o.col,cell:o.cell}}function jp(t,e){var n;const r=ti(t);if(e<0||e>=r.length)return[];let o=0;for(let s=0;s<e;s++){const a=(n=r[o])==null?void 0:n[0];if(!a)return[];o+=a.rowspan}const i=new Array(r[0].length).fill(!1).map((s,a)=>p2({row:o,col:a},t,r)).filter(s=>s!==void 0);return i.filter((s,a)=>i.findIndex(l=>l.row===s.row&&l.col===s.col)===a)}function zp(t,e){var n;const r=ti(t);if(e<0||e>=r[0].length)return[];let o=0;for(let s=0;s<e;s++){const a=(n=r[0])==null?void 0:n[o];if(!a)return[];o+=a.colspan}const i=new Array(r.length).fill(!1).map((s,a)=>p2({row:a,col:o},t,r)).filter(s=>s!==void 0);return i.filter((s,a)=>i.findIndex(l=>l.row===s.row&&l.col===s.col)===a)}function F5(t,e,n,r=ti(t)){const{col:o}=Li({row:0,col:e},t,r),{col:i}=Li({row:0,col:n},t,r);return r.forEach(s=>{const[a]=s.splice(o,1);s.splice(i,0,a)}),kl(r)}function H5(t,e,n,r=ti(t)){const{row:o}=Li({row:e,col:0},t,r),{row:i}=Li({row:n,col:0},t,r),[s]=r.splice(o,1);return r.splice(i,0,s),kl(r)}function qp(t){return t?xl(t)?qp(t.content):typeof t=="string"?t.length===0:Array.isArray(t)?t.every(e=>typeof e=="string"?e.length===0:Oi(e)?e.text.length===0:d2(e)?typeof e.content=="string"?e.content.length===0:e.content.every(n=>n.text.length===0):!1):!1:!0}function U5(t,e,n=ti(t)){if(e==="columns"){let i=0;for(let s=n[0].length-1;s>=0&&n.every(a=>qp(a[s].cell)&&a[s].colspan===1);s--)i++;for(let s=n.length-1;s>=0;s--){const a=Math.max(n[s].length-i,1);n[s]=n[s].slice(0,a)}return kl(n)}let r=0;for(let i=n.length-1;i>=0&&n[i].every(s=>qp(s.cell)&&s.rowspan===1);i--)r++;const o=Math.min(r,n.length-1);return n.splice(n.length-o,o),kl(n)}function V5(t,e,n,r=ti(t)){const{width:o,height:i}=Jg(t);if(e==="columns")r.forEach((s,a)=>{if(n>=0)for(let l=0;l<n;l++)s.push({row:a,col:Math.max(...s.map(c=>c.col))+1,rowspan:1,colspan:1,cell:qo("")});else s.splice(o+n,-1*n)});else if(n>0)for(let s=0;s<n;s++){const a=new Array(o).fill(null).map((l,c)=>({row:i+s,col:c,rowspan:1,colspan:1,cell:qo("")}));r.push(a)}else n<0&&r.splice(i+n,-1*n);return kl(r)}function m2(t,e,n){const r=jp(t,n);if(!r.some(s=>Cl(s.cell)>1))return!0;let o=n,i=n;return r.forEach(s=>{const a=Cl(s.cell);o=Math.max(o,s.row+a-1),i=Math.min(i,s.row)}),e<n?n===o:n===i}function g2(t,e,n){const r=zp(t,n);if(!r.some(s=>Di(s.cell)>1))return!0;let o=n,i=n;return r.forEach(s=>{const a=Di(s.cell);o=Math.max(o,s.col+a-1),i=Math.min(i,s.col)}),e<n?n===o:n===i}function $5(t,e,n){const r=Li(t,n),o=Li(e,n);return r.col===o.col}function sy(t,e,n,r){const o=[];for(const[i,s]of Object.entries(t.styles||{})){const a=n[i];if(!a)throw new Error(`style ${i} not found in styleSchema`);if(a.propSchema==="boolean")s&&o.push(e.mark(i));else if(a.propSchema==="string")s&&o.push(e.mark(i,{stringValue:s}));else throw new Hr(a.propSchema)}return!r||!e.nodes[r].spec.code?t.text.split(/(\n)/g).filter(i=>i.length>0).map(i=>i===`
|
|
109
|
+
`?e.nodes.hardBreak.createChecked():e.text(i,o)):t.text.length>0?[e.text(t.text,o)]:[]}function j5(t,e,n){const r=e.marks.link.create({href:t.href});return Wp(t.content,e,n).map(o=>{if(o.type.name==="text")return o.mark([...o.marks,r]);if(o.type.name==="hardBreak")return o;throw new Error("unexpected node type")})}function Wp(t,e,n,r){const o=[];if(typeof t=="string")return o.push(...sy({text:t,styles:{}},e,n,r)),o;for(const i of t)o.push(...sy(i,e,n,r));return o}function yr(t,e,n,r=Qs(e)){const o=[];for(const i of t)typeof i=="string"?o.push(...Wp(i,e,r,n)):d2(i)?o.push(...j5(i,e,r)):Oi(i)?o.push(...Wp([i],e,r,n)):o.push(b2(i,e,r));return o}function Jd(t,e,n=Qs(e)){const r=[],o=new Array(t.headerRows??0).fill(!0),i=new Array(t.headerCols??0).fill(!0),s=t.columnWidths??[];for(let a=0;a<t.rows.length;a++){const l=t.rows[a],c=[],u=o[a];for(let f=0;f<l.cells.length;f++){const h=l.cells[f],p=i[f],g=void 0;let b=null;const E=Li({row:a,col:f},{content:t});let x=s[E.col]?[s[E.col]]:null;if(h)if(typeof h=="string")b=e.text(h);else if(xl(h)){h.content&&(b=yr(h.content,e,"tableParagraph",n));const D=Di(h);D>1&&(x=new Array(D).fill(!1).map((O,v)=>s[E.col+v]??void 0))}else b=yr(h,e,"tableParagraph",n);const T=e.nodes[p||u?"tableHeader":"tableCell"].createChecked({...xl(h)?h.props:{},colwidth:x},e.nodes.tableParagraph.createChecked(g,b));c.push(T)}const d=e.nodes.tableRow.createChecked({},c);r.push(d)}return r}function b2(t,e,n){let r,o=t.type;if(o===void 0&&(o="paragraph"),!e.nodes[o])throw new Error(`node type ${o} not found in schema`);if(!t.content)r=e.nodes[o].createChecked(t.props);else if(typeof t.content=="string"){const i=yr([t.content],e,o,n);r=e.nodes[o].createChecked(t.props,i)}else if(Array.isArray(t.content)){const i=yr(t.content,e,o,n);r=e.nodes[o].createChecked(t.props,i)}else if(t.content.type==="tableContent"){const i=Jd(t.content,e,n);r=e.nodes[o].createChecked(t.props,i)}else throw new Hr(t.content.type);return r}function $i(t,e,n=Qs(e)){let r=t.id;r===void 0&&(r=Qd.options.generateID());const o=[];if(t.children)for(const i of t.children)o.push($i(i,e,n));if(!t.type||e.nodes[t.type].isInGroup("blockContent")){const i=b2(t,e,n),s=o.length>0?e.nodes.blockGroup.createChecked({},o):void 0;return e.nodes.blockContainer.createChecked({id:r,...t.props},s?[i,s]:i)}else{if(e.nodes[t.type].isInGroup("bnBlock"))return e.nodes[t.type].createChecked({id:r,...t.props},o);throw new Error(`block type ${t.type} doesn't match blockContent or bnBlock group`)}}let Gp,Yp;if(typeof WeakMap<"u"){let t=new WeakMap;Gp=e=>t.get(e),Yp=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Gp=r=>{for(let o=0;o<t.length;o+=2)if(t[o]==r)return t[o+1]},Yp=(r,o)=>(n==10&&(n=0),t[n++]=r,t[n++]=o)}var rt=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,o=e/this.width|0;let i=r+1,s=o+1;for(let a=1;i<this.width&&this.map[e+a]==n;a++)i++;for(let a=1;s<this.height&&this.map[e+this.width*a]==n;a++)s++;return{left:r,top:o,right:i,bottom:s}}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:o,top:i,bottom:s}=this.findCell(t);return e=="horiz"?(n<0?r==0:o==this.width)?null:this.map[i*this.width+(n<0?r-1:o)]:(n<0?i==0:s==this.height)?null:this.map[r+this.width*(n<0?i-1:s)]}rectBetween(t,e){const{left:n,right:r,top:o,bottom:i}=this.findCell(t),{left:s,right:a,top:l,bottom:c}=this.findCell(e);return{left:Math.min(n,s),top:Math.min(o,l),right:Math.max(r,a),bottom:Math.max(i,c)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let o=t.left;o<t.right;o++){const i=r*this.width+o,s=this.map[i];n[s]||(n[s]=!0,!(o==t.left&&o&&this.map[i-1]==s||r==t.top&&r&&this.map[i-this.width]==s)&&e.push(s))}return e}positionAt(t,e,n){for(let r=0,o=0;;r++){const i=o+n.child(r).nodeSize;if(r==t){let s=e+t*this.width;const a=(t+1)*this.width;for(;s<a&&this.map[s]<o;)s++;return s==a?i-1:this.map[s]}o=i}}static get(t){return Gp(t)||Yp(t,z5(t))}};function z5(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=q5(t),n=t.childCount,r=[];let o=0,i=null;const s=[];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(;o<r.length&&r[o]!=0;)o++;if(p==d.childCount)break;const g=d.child(p),{colspan:b,rowspan:E,colwidth:x}=g.attrs;for(let T=0;T<E;T++){if(T+c>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:E-T});break}const D=o+T*e;for(let O=0;O<b;O++){r[D+O]==0?r[D+O]=u:(i||(i=[])).push({type:"collision",row:c,pos:u,n:b-O});const v=x&&x[O];if(v){const R=(D+O)%e*2,j=s[R];j==null||j!=v&&s[R+1]==1?(s[R]=v,s[R+1]=1):j==v&&s[R+1]++}}}o+=b,u+=g.nodeSize}const f=(c+1)*e;let h=0;for(;o<f;)r[o++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:c,n:h}),u++}(e===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});const a=new rt(e,n,r,i);let l=!1;for(let c=0;!l&&c<s.length;c+=2)s[c]!=null&&s[c+1]<n&&(l=!0);return l&&W5(a,s,t),a}function q5(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const o=t.child(r);let i=0;if(n)for(let s=0;s<r;s++){const a=t.child(s);for(let l=0;l<a.childCount;l++){const c=a.child(l);s+c.attrs.rowspan>r&&(i+=c.attrs.colspan)}}for(let s=0;s<o.childCount;s++){const a=o.child(s);i+=a.attrs.colspan,a.attrs.rowspan>1&&(n=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function W5(t,e,n){t.problems||(t.problems=[]);const r={};for(let o=0;o<t.map.length;o++){const i=t.map[o];if(r[i])continue;r[i]=!0;const s=n.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let a=null;const l=s.attrs;for(let c=0;c<l.colspan;c++){const u=e[(o+c)%t.width*2];u!=null&&(!l.colwidth||l.colwidth[c]!=u)&&((a||(a=G5(l)))[c]=u)}a&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:a})}}function G5(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function en(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],o=r.spec.tableRole;o&&(e[o]=r)}}return e}const _o=new Oe("selectingCells");function Ri(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 Y5(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 Vr(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 e0(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=Ri(e.$head)||K5(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function K5(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 Kp(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function Q5(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function t0(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function y2(t,e,n){const r=t.node(-1),o=rt.get(r),i=t.start(-1),s=o.nextCell(t.pos-i,e,n);return s==null?null:t.node(0).resolve(i+s)}function Pi(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(o=>o>0)||(r.colwidth=null)),r}function E2(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;o<n;o++)r.colwidth.splice(e,0,0)}return r}function X5(t,e,n){const r=en(e.type.schema).header_cell;for(let o=0;o<t.height;o++)if(e.nodeAt(t.map[n+o*t.width]).type!=r)return!1;return!0}var Ge=class to extends me{constructor(e,n=e){const r=e.node(-1),o=rt.get(r),i=e.start(-1),s=o.rectBetween(e.pos-i,n.pos-i),a=e.node(0),l=o.cellsInRect(s).filter(u=>u!=n.pos-i);l.unshift(n.pos-i);const c=l.map(u=>{const d=r.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);const f=i+u+1;return new lk(a.resolve(f),a.resolve(f+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)),o=e.resolve(n.map(this.$headCell.pos));if(Kp(r)&&Kp(o)&&t0(r,o)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?to.rowSelection(r,o):i&&this.isColSelection()?to.colSelection(r,o):new to(r,o)}return ae.between(r,o)}content(){const e=this.$anchorCell.node(-1),n=rt.get(e),r=this.$anchorCell.start(-1),o=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},s=[];for(let l=o.top;l<o.bottom;l++){const c=[];for(let u=l*n.width+o.left,d=o.left;d<o.right;d++,u++){const f=n.map[u];if(i[f])continue;i[f]=!0;const h=n.findCell(f);let p=e.nodeAt(f);if(!p)throw new RangeError(`No cell with offset ${f} found`);const g=o.left-h.left,b=h.right-o.right;if(g>0||b>0){let E=p.attrs;if(g>0&&(E=Pi(E,0,g)),b>0&&(E=Pi(E,E.colspan-b,b)),h.left<o.left){if(p=p.type.createAndFill(E),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(E)}`)}else p=p.type.create(E,p.content)}if(h.top<o.top||h.bottom>o.bottom){const E={...p.attrs,rowspan:Math.min(h.bottom,o.bottom)-Math.max(h.top,o.top)};h.top<o.top?p=p.type.createAndFill(E):p=p.type.create(E,p.content)}c.push(p)}s.push(e.child(l).copy(V.from(c)))}const a=this.isColSelection()&&this.isRowSelection()?e:s;return new Q(V.from(a),1,1)}replace(e,n=Q.empty){const r=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){const{$from:a,$to:l}=o[s],c=e.mapping.slice(r);e.replace(c.map(a.pos),c.map(l.pos),s?Q.empty:n)}const i=me.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,n){this.replace(e,new Q(V.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=rt.get(n),o=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let s=0;s<i.length;s++)e(n.nodeAt(i[s]),o+i[s])}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,o=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),o=rt.get(r),i=e.start(-1),s=o.findCell(e.pos-i),a=o.findCell(n.pos-i),l=e.node(0);return s.top<=a.top?(s.top>0&&(e=l.resolve(i+o.map[s.left])),a.bottom<o.height&&(n=l.resolve(i+o.map[o.width*(o.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(i+o.map[a.left])),s.bottom<o.height&&(e=l.resolve(i+o.map[o.width*(o.height-1)+s.right-1]))),new to(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=rt.get(e),r=this.$anchorCell.start(-1),o=n.colCount(this.$anchorCell.pos-r),i=n.colCount(this.$headCell.pos-r);if(Math.min(o,i)>0)return!1;const s=o+this.$anchorCell.nodeAfter.attrs.colspan,a=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,a)==n.width}eq(e){return e instanceof to&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),o=rt.get(r),i=e.start(-1),s=o.findCell(e.pos-i),a=o.findCell(n.pos-i),l=e.node(0);return s.left<=a.left?(s.left>0&&(e=l.resolve(i+o.map[s.top*o.width])),a.right<o.width&&(n=l.resolve(i+o.map[o.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(i+o.map[a.top*o.width])),s.right<o.width&&(e=l.resolve(i+o.map[o.width*(s.top+1)-1]))),new to(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new to(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new to(e.resolve(n),e.resolve(r))}getBookmark(){return new Z5(this.$anchorCell.pos,this.$headCell.pos)}};Ge.prototype.visible=!1;me.jsonID("cell",Ge);var Z5=class x2{constructor(e,n){this.anchor=e,this.head=n}map(e){return new x2(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&&t0(n,r)?new Ge(n,r):me.near(r,1)}};function J5(t){if(!(t.selection instanceof Ge))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(je.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ke.create(t.doc,e)}function eP({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,o=t.depth;for(;o>=0&&!(t.after(o+1)<t.end(o));o--,n++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,r--);return n==r&&/row|table/.test(t.node(o).type.spec.tableRole)}function tP({$from:t,$to:e}){let n,r;for(let o=t.depth;o>0;o--){const i=t.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let o=e.depth;o>0;o--){const i=e.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return n!==r&&e.parentOffset===0}function nP(t,e,n){const r=(e||t).selection,o=(e||t).doc;let i,s;if(r instanceof le&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=Ge.create(o,r.from);else if(s=="row"){const a=o.resolve(r.from+1);i=Ge.rowSelection(a,a)}else if(!n){const a=rt.get(r.node),l=r.from+1,c=l+a.map[a.width*a.height-1];i=Ge.create(o,l+1,c)}}else r instanceof ae&&eP(r)?i=ae.create(o,r.from):r instanceof ae&&tP(r)&&(i=ae.create(o,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}const rP=new Oe("fix-tables");function C2(t,e,n,r){const o=t.childCount,i=e.childCount;e:for(let s=0,a=0;s<i;s++){const l=e.child(s);for(let c=a,u=Math.min(o,s+3);c<u;c++)if(t.child(c)==l){a=c+1,n+=l.nodeSize;continue e}r(l,n),a<o&&t.child(a).sameMarkup(l)?C2(t.child(a),l,n+1,r):l.nodesBetween(0,l.content.size,r,n+1),n+=l.nodeSize}}function oP(t,e){let n;const r=(o,i)=>{o.type.spec.tableRole=="table"&&(n=iP(t,o,i,n))};return e?e.doc!=t.doc&&C2(e.doc,t.doc,0,r):t.doc.descendants(r),n}function iP(t,e,n,r){const o=rt.get(e);if(!o.problems)return r;r||(r=t.tr);const i=[];for(let l=0;l<o.height;l++)i.push(0);for(let l=0;l<o.problems.length;l++){const c=o.problems[l];if(c.type=="collision"){const u=e.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let f=0;f<d.rowspan;f++)i[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,Pi(d,d.colspan-c.n,c.n))}else if(c.type=="missing")i[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 s,a;for(let l=0;l<i.length;l++)i[l]&&(s==null&&(s=l),a=l);for(let l=0,c=n+1;l<o.height;l++){const u=e.child(l),d=c+u.nodeSize,f=i[l];if(f>0){let h="cell";u.firstChild&&(h=u.firstChild.type.spec.tableRole);const p=[];for(let b=0;b<f;b++){const E=en(t.schema)[h].createAndFill();E&&p.push(E)}const g=(l==0||s==l-1)&&a==l?c+1:d-1;r.insert(r.mapping.map(g),p)}c=d}return r.setMeta(rP,{fixTables:!0})}function $r(t){const e=t.selection,n=e0(t),r=n.node(-1),o=n.start(-1),i=rt.get(r);return{...e instanceof Ge?i.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):i.findCell(n.pos-o),tableStart:o,map:i,table:r}}function k2(t,{map:e,tableStart:n,table:r},o){let i=o>0?-1:0;X5(e,r,o+i)&&(i=o==0||o==e.width?null:0);for(let s=0;s<e.height;s++){const a=s*e.width+o;if(o>0&&o<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,E2(c.attrs,o-e.colCount(l))),s+=c.attrs.rowspan-1}else{const l=i==null?en(r.type.schema).cell:r.nodeAt(e.map[a+i]).type,c=e.positionAt(s,o,r);t.insert(t.mapping.map(n+c),l.createAndFill())}}return t}function sP(t,e){if(!Vr(t))return!1;if(e){const n=$r(t);e(k2(t.tr,n,n.left))}return!0}function aP(t,e){if(!Vr(t))return!1;if(e){const n=$r(t);e(k2(t.tr,n,n.right))}return!0}function lP(t,{map:e,table:n,tableStart:r},o){const i=t.mapping.maps.length;for(let s=0;s<e.height;){const a=s*e.width+o,l=e.map[a],c=n.nodeAt(l),u=c.attrs;if(o>0&&e.map[a-1]==l||o<e.width-1&&e.map[a+1]==l)t.setNodeMarkup(t.mapping.slice(i).map(r+l),null,Pi(u,o-e.colCount(l)));else{const d=t.mapping.slice(i).map(r+l);t.delete(d,d+c.nodeSize)}s+=u.rowspan}}function cP(t,e){if(!Vr(t))return!1;if(e){const n=$r(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let o=n.right-1;lP(r,n,o),o!=n.left;o--){const i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw new RangeError("No table found");n.table=i,n.map=rt.get(i)}e(r)}return!0}function uP(t,e,n){var r;const o=en(e.type.schema).header_cell;for(let i=0;i<t.width;i++)if(((r=e.nodeAt(t.map[i+n*t.width]))===null||r===void 0?void 0:r.type)!=o)return!1;return!0}function T2(t,{map:e,tableStart:n,table:r},o){let i=n;for(let c=0;c<o;c++)i+=r.child(c).nodeSize;const s=[];let a=o>0?-1:0;uP(e,r,o+a)&&(a=o==0||o==e.height?null:0);for(let c=0,u=e.width*o;c<e.width;c++,u++)if(o>0&&o<e.height&&e.map[u]==e.map[u-e.width]){const d=e.map[u],f=r.nodeAt(d).attrs;t.setNodeMarkup(n+d,null,{...f,rowspan:f.rowspan+1}),c+=f.colspan-1}else{var l;const d=a==null?en(r.type.schema).cell:(l=r.nodeAt(e.map[u+a*e.width]))===null||l===void 0?void 0:l.type,f=d?.createAndFill();f&&s.push(f)}return t.insert(i,en(r.type.schema).row.create(null,s)),t}function dP(t,e){if(!Vr(t))return!1;if(e){const n=$r(t);e(T2(t.tr,n,n.top))}return!0}function fP(t,e){if(!Vr(t))return!1;if(e){const n=$r(t);e(T2(t.tr,n,n.bottom))}return!0}function hP(t,{map:e,table:n,tableStart:r},o){let i=0;for(let c=0;c<o;c++)i+=n.child(c).nodeSize;const s=i+n.child(o).nodeSize,a=t.mapping.maps.length;t.delete(i+r,s+r);const l=new Set;for(let c=0,u=o*e.width;c<e.width;c++,u++){const d=e.map[u];if(!l.has(d)){if(l.add(d),o>0&&d==e.map[u-e.width]){const f=n.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(a).map(d+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(o<e.height&&d==e.map[u+e.width]){const f=n.nodeAt(d),h=f.attrs,p=f.type.create({...h,rowspan:f.attrs.rowspan-1},f.content),g=e.positionAt(o+1,c,n);t.insert(t.mapping.slice(a).map(r+g),p),c+=h.colspan-1}}}}function pP(t,e){if(!Vr(t))return!1;if(e){const n=$r(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let o=n.bottom-1;hP(r,n,o),o!=n.top;o--){const i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw new RangeError("No table found");n.table=i,n.map=rt.get(n.table)}e(r)}return!0}function ay(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function mP({width:t,height:e,map:n},r){let o=r.top*t+r.left,i=o,s=(r.bottom-1)*t+r.left,a=o+(r.right-r.left-1);for(let l=r.top;l<r.bottom;l++){if(r.left>0&&n[i]==n[i-1]||r.right<t&&n[a]==n[a+1])return!0;i+=t,a+=t}for(let l=r.left;l<r.right;l++){if(r.top>0&&n[o]==n[o-t]||r.bottom<e&&n[s]==n[s+t])return!0;o++,s++}return!1}function gP(t,e){const n=t.selection;if(!(n instanceof Ge)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=$r(t),{map:o}=r;if(mP(o,r))return!1;if(e){const i=t.tr,s={};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 f=o.map[u*o.width+d],h=r.table.nodeAt(f);if(!(s[f]||!h))if(s[f]=!0,l==null)l=f,c=h;else{ay(h)||(a=a.append(h.content));const p=i.mapping.map(f+r.tableStart);i.delete(p,p+h.nodeSize)}}if(l==null||c==null)return!0;if(i.setNodeMarkup(l+r.tableStart,null,{...E2(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=ay(c)?l+1:u;i.replaceWith(d+r.tableStart,u+r.tableStart,a)}i.setSelection(new Ge(i.doc.resolve(l+r.tableStart))),e(i)}return!0}function bP(t,e){const n=en(t.schema);return yP(({node:r})=>n[r.type.spec.tableRole])(t,e)}function yP(t){return(e,n)=>{const r=e.selection;let o,i;if(r instanceof Ge){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;o=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{var s;if(o=Y5(r.$from),!o)return!1;i=(s=Ri(r.$from))===null||s===void 0?void 0:s.pos}if(o==null||i==null||o.attrs.colspan==1&&o.attrs.rowspan==1)return!1;if(n){let a=o.attrs;const l=[],c=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});const u=$r(e),d=e.tr;for(let h=0;h<u.right-u.left;h++)l.push(c?{...a,colwidth:c&&c[h]?[c[h]]:null}:a);let f;for(let h=u.top;h<u.bottom;h++){let p=u.map.positionAt(h,u.left,u.table);h==u.top&&(p+=o.nodeSize);for(let g=u.left,b=0;g<u.right;g++,b++)g==u.left&&h==u.top||d.insert(f=d.mapping.map(p+u.tableStart,1),t({node:o,row:h,col:g}).createAndFill(l[b]))}d.setNodeMarkup(i,t({node:o,row:u.top,col:u.left}),l[0]),r instanceof Ge&&d.setSelection(new Ge(d.doc.resolve(r.$anchorCell.pos),f?d.doc.resolve(f):void 0)),n(d)}return!0}}function EP(t){return function(e,n){if(!Vr(e))return!1;if(n){const r=en(e.schema),o=$r(e),i=e.tr,s=o.map.cellsInRect(t=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:t=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),a=s.map(l=>o.table.nodeAt(l));for(let l=0;l<s.length;l++)a[l].type==r.header_cell&&i.setNodeMarkup(o.tableStart+s[l],r.cell,a[l].attrs);if(i.steps.length===0)for(let l=0;l<s.length;l++)i.setNodeMarkup(o.tableStart+s[l],r.header_cell,a[l].attrs);n(i)}return!0}}function ly(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 o=0;o<r.length;o++){const i=e.table.nodeAt(r[o]);if(i&&i.type!==n.header_cell)return!1}return!0}function n0(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?EP(t):function(n,r){if(!Vr(n))return!1;if(r){const o=en(n.schema),i=$r(n),s=n.tr,a=ly("row",i,o),l=ly("column",i,o),c=(t==="column"?a:t==="row"&&l)?1:0,u=t=="column"?{left:0,top:c,right:1,bottom:i.map.height}:t=="row"?{left:c,top:0,right:i.map.width,bottom:1}:i,d=t=="column"?l?o.cell:o.header_cell:t=="row"?a?o.cell:o.header_cell:o.cell;i.map.cellsInRect(u).forEach(f=>{const h=f+i.tableStart,p=s.doc.nodeAt(h);p&&s.setNodeMarkup(h,d,p.attrs)}),r(s)}return!0}}n0("row",{useDeprecatedLogic:!0});n0("column",{useDeprecatedLogic:!0});n0("cell",{useDeprecatedLogic:!0});function xP(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,o=t.before();r>=0;r--){const i=t.node(-1).child(r),s=i.lastChild;if(s)return o-1-s.nodeSize;o-=i.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),o=t.after();r<n.childCount;r++){const i=n.child(r);if(i.childCount)return o+1;o+=i.nodeSize}}return null}function cy(t){return function(e,n){if(!Vr(e))return!1;const r=xP(e0(e),t);if(r==null)return!1;if(n){const o=e.doc.resolve(r);n(e.tr.setSelection(ae.between(o,Q5(o))).scrollIntoView())}return!0}}function dc(t,e){const n=t.selection;if(!(n instanceof Ge))return!1;if(e){const r=t.tr,o=en(t.schema).cell.createAndFill().content;n.forEachCell((i,s)=>{i.content.eq(o)||r.replace(r.mapping.map(s+1),r.mapping.map(s+i.nodeSize-1),new Q(o,0,0))}),r.docChanged&&e(r)}return!0}function CP(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 o=e.child(0),i=o.type.spec.tableRole,s=o.type.schema,a=[];if(i=="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=Qp(en(s).row,new Q(c,u,d)).content),a.push(c)}else if(i=="cell"||i=="header_cell")a.push(n||r?Qp(en(s).row,new Q(e,n,r)).content:e);else return null;return kP(s,a)}function kP(t,e){const n=[];for(let o=0;o<e.length;o++){const i=e[o];for(let s=i.childCount-1;s>=0;s--){const{rowspan:a,colspan:l}=i.child(s).attrs;for(let c=o;c<o+a;c++)n[c]=(n[c]||0)+l}}let r=0;for(let o=0;o<n.length;o++)r=Math.max(r,n[o]);for(let o=0;o<n.length;o++)if(o>=e.length&&e.push(V.empty),n[o]<r){const i=en(t).cell.createAndFill(),s=[];for(let a=n[o];a<r;a++)s.push(i);e[o]=e[o].append(V.from(s))}return{height:e.length,width:r,rows:e}}function Qp(t,e){const n=t.createAndFill();return new zm(n).replace(0,n.content.size,e).doc}function TP({width:t,height:e,rows:n},r,o){if(t!=r){const i=[],s=[];for(let a=0;a<n.length;a++){const l=n[a],c=[];for(let u=i[a]||0,d=0;u<r;d++){let f=l.child(d%l.childCount);u+f.attrs.colspan>r&&(f=f.type.createChecked(Pi(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),f.content)),c.push(f),u+=f.attrs.colspan;for(let h=1;h<f.attrs.rowspan;h++)i[a+h]=(i[a+h]||0)+f.attrs.colspan}s.push(V.from(c))}n=s,t=r}if(e!=o){const i=[];for(let s=0,a=0;s<o;s++,a++){const l=[],c=n[a%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);s+d.attrs.rowspan>o&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,o-d.attrs.rowspan)},d.content)),l.push(d)}i.push(V.from(l))}n=i,e=o}return{width:t,height:e,rows:n}}function wP(t,e,n,r,o,i,s){const a=t.doc.type.schema,l=en(a);let c,u;if(o>e.width)for(let d=0,f=0;d<e.height;d++){const h=n.child(d);f+=h.nodeSize;const p=[];let g;h.lastChild==null||h.lastChild.type==l.cell?g=c||(c=l.cell.createAndFill()):g=u||(u=l.header_cell.createAndFill());for(let b=e.width;b<o;b++)p.push(g);t.insert(t.mapping.slice(s).map(f-1+r),p)}if(i>e.height){const d=[];for(let p=0,g=(e.height-1)*e.width;p<Math.max(e.width,o);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 f=l.row.create(null,V.from(d)),h=[];for(let p=e.height;p<i;p++)h.push(f);t.insert(t.mapping.slice(s).map(r+n.nodeSize-2),h)}return!!(c||u)}function uy(t,e,n,r,o,i,s,a){if(s==0||s==e.height)return!1;let l=!1;for(let c=o;c<i;c++){const u=s*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){l=!0;const f=n.nodeAt(d),{top:h,left:p}=e.findCell(d);t.setNodeMarkup(t.mapping.slice(a).map(d+r),null,{...f.attrs,rowspan:s-h}),t.insert(t.mapping.slice(a).map(e.positionAt(s,p,n)),f.type.createAndFill({...f.attrs,rowspan:h+f.attrs.rowspan-s})),c+=f.attrs.colspan-1}}return l}function dy(t,e,n,r,o,i,s,a){if(s==0||s==e.width)return!1;let l=!1;for(let c=o;c<i;c++){const u=c*e.width+s,d=e.map[u];if(e.map[u-1]==d){l=!0;const f=n.nodeAt(d),h=e.colCount(d),p=t.mapping.slice(a).map(d+r);t.setNodeMarkup(p,null,Pi(f.attrs,s-h,f.attrs.colspan-(s-h))),t.insert(p+f.nodeSize,f.type.createAndFill(Pi(f.attrs,0,s-h))),c+=f.attrs.rowspan-1}}return l}function fy(t,e,n,r,o){let i=n?t.doc.nodeAt(n-1):t.doc;if(!i)throw new Error("No table found");let s=rt.get(i);const{top:a,left:l}=r,c=l+o.width,u=a+o.height,d=t.tr;let f=0;function h(){if(i=n?d.doc.nodeAt(n-1):d.doc,!i)throw new Error("No table found");s=rt.get(i),f=d.mapping.maps.length}wP(d,s,i,n,c,u,f)&&h(),uy(d,s,i,n,l,c,a,f)&&h(),uy(d,s,i,n,l,c,u,f)&&h(),dy(d,s,i,n,a,u,l,f)&&h(),dy(d,s,i,n,a,u,c,f)&&h();for(let p=a;p<u;p++){const g=s.positionAt(p,l,i),b=s.positionAt(p,c,i);d.replace(d.mapping.slice(f).map(g+n),d.mapping.slice(f).map(b+n),new Q(o.rows[p-a],0,0))}h(),d.setSelection(new Ge(d.doc.resolve(n+s.positionAt(a,l,i)),d.doc.resolve(n+s.positionAt(u-1,c-1,i)))),e(d)}const SP=Rg({ArrowLeft:fc("horiz",-1),ArrowRight:fc("horiz",1),ArrowUp:fc("vert",-1),ArrowDown:fc("vert",1),"Shift-ArrowLeft":hc("horiz",-1),"Shift-ArrowRight":hc("horiz",1),"Shift-ArrowUp":hc("vert",-1),"Shift-ArrowDown":hc("vert",1),Backspace:dc,"Mod-Backspace":dc,Delete:dc,"Mod-Delete":dc});function $c(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function fc(t,e){return(n,r,o)=>{if(!o)return!1;const i=n.selection;if(i instanceof Ge)return $c(n,r,me.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const s=w2(o,t,e);if(s==null)return!1;if(t=="horiz")return $c(n,r,me.near(n.doc.resolve(i.head+e),e));{const a=n.doc.resolve(s),l=y2(a,t,e);let c;return l?c=me.near(l,1):e<0?c=me.near(n.doc.resolve(a.before(-1)),-1):c=me.near(n.doc.resolve(a.after(-1)),1),$c(n,r,c)}}}function hc(t,e){return(n,r,o)=>{if(!o)return!1;const i=n.selection;let s;if(i instanceof Ge)s=i;else{const l=w2(o,t,e);if(l==null)return!1;s=new Ge(n.doc.resolve(l))}const a=y2(s.$headCell,t,e);return a?$c(n,r,new Ge(s.$anchorCell,a)):!1}}function vP(t,e){const n=t.state.doc,r=Ri(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Ge(r))),!0):!1}function AP(t,e,n){if(!Vr(t.state))return!1;let r=CP(n);const o=t.state.selection;if(o instanceof Ge){r||(r={width:1,height:1,rows:[V.from(Qp(en(t.state.schema).cell,n))]});const i=o.$anchorCell.node(-1),s=o.$anchorCell.start(-1),a=rt.get(i).rectBetween(o.$anchorCell.pos-s,o.$headCell.pos-s);return r=TP(r,a.right-a.left,a.bottom-a.top),fy(t.state,t.dispatch,s,a,r),!0}else if(r){const i=e0(t.state),s=i.start(-1);return fy(t.state,t.dispatch,s,rt.get(i.node(-1)).findCell(i.pos-s),r),!0}else return!1}function _P(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=hy(t,e.target);let o;if(e.shiftKey&&t.state.selection instanceof Ge)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(o=Ri(t.state.selection.$anchor))!=null&&((n=ah(t,e))===null||n===void 0?void 0:n.pos)!=o.pos)i(o,e),e.preventDefault();else if(!r)return;function i(l,c){let u=ah(t,c);const d=_o.getState(t.state)==null;if(!u||!t0(l,u))if(d)u=l;else return;const f=new Ge(l,u);if(d||!t.state.selection.eq(f)){const h=t.state.tr.setSelection(f);d&&h.setMeta(_o,l.pos),t.dispatch(h)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",a),_o.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(_o,-1))}function a(l){const c=l,u=_o.getState(t.state);let d;if(u!=null)d=t.state.doc.resolve(u);else if(hy(t,c.target)!=r&&(d=ah(t,e),!d))return s();d&&i(d,c)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",a)}function w2(t,e,n){if(!(t.state.selection instanceof ae))return null;const{$head:r}=t.state.selection;for(let o=r.depth-1;o>=0;o--){const i=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const s=r.before(o),a=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(a)?s:null}}return null}function hy(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function ah(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:o}=n;return r>=0&&Ri(t.state.doc.resolve(r))||Ri(t.state.doc.resolve(o))}var S2=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")),Xp(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,Xp(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function Xp(t,e,n,r,o,i){let s=0,a=!0,l=e.firstChild;const c=t.firstChild;if(c){for(let d=0,f=0;d<c.childCount;d++){const{colspan:h,colwidth:p}=c.child(d).attrs;for(let g=0;g<h;g++,f++){const b=o==f?i:p&&p[g],E=b?b+"px":"";if(s+=b||r,b||(a=!1),l)l.style.width!=E&&(l.style.width=E),l=l.nextSibling;else{const x=document.createElement("col");x.style.width=E,e.appendChild(x)}}}for(;l;){var u;const d=l.nextSibling;(u=l.parentNode)===null||u===void 0||u.removeChild(l),l=d}a?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}const Ln=new Oe("tableColumnResizing");function NP({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=S2,lastColumnResizable:o=!0}={}){const i=new ye({key:Ln,state:{init(s,a){var l;const c=(l=i.spec)===null||l===void 0||(l=l.props)===null||l===void 0?void 0:l.nodeViews,u=en(a.schema).table.name;return r&&c&&(c[u]=(d,f)=>new r(d,n,f)),new IP(-1,!1)},apply(s,a){return a.apply(s)}},props:{attributes:s=>{const a=Ln.getState(s);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,a)=>{MP(s,a,t,o)},mouseleave:s=>{OP(s)},mousedown:(s,a)=>{DP(s,a,e,n)}},decorations:s=>{const a=Ln.getState(s);if(a&&a.activeHandle>-1)return FP(s,a.activeHandle)},nodeViews:{}}});return i}var IP=class jc{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Ln);if(r&&r.setHandle!=null)return new jc(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new jc(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let o=e.mapping.map(n.activeHandle,-1);return Kp(e.doc.resolve(o))||(o=-1),new jc(o,n.dragging)}return n}};function MP(t,e,n,r){if(!t.editable)return;const o=Ln.getState(t.state);if(o&&!o.dragging){const i=RP(e.target);let s=-1;if(i){const{left:a,right:l}=i.getBoundingClientRect();e.clientX-a<=n?s=py(t,e,"left",n):l-e.clientX<=n&&(s=py(t,e,"right",n))}if(s!=o.activeHandle){if(!r&&s!==-1){const a=t.state.doc.resolve(s),l=a.node(-1),c=rt.get(l),u=a.start(-1);if(c.colCount(a.pos-u)+a.nodeAfter.attrs.colspan-1==c.width-1)return}v2(t,s)}}}function OP(t){if(!t.editable)return;const e=Ln.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&v2(t,-1)}function DP(t,e,n,r){var o;if(!t.editable)return!1;const i=(o=t.dom.ownerDocument.defaultView)!==null&&o!==void 0?o:window,s=Ln.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const a=t.state.doc.nodeAt(s.activeHandle),l=LP(t,s.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta(Ln,{setDragging:{startX:e.clientX,startWidth:l}}));function c(d){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",u);const f=Ln.getState(t.state);f?.dragging&&(PP(t,f.activeHandle,my(f.dragging,d,n)),t.dispatch(t.state.tr.setMeta(Ln,{setDragging:null})))}function u(d){if(!d.which)return c(d);const f=Ln.getState(t.state);if(f&&f.dragging){const h=my(f.dragging,d,n);gy(t,f.activeHandle,h,r)}}return gy(t,s.activeHandle,l,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",u),e.preventDefault(),!0}function LP(t,e,{colspan:n,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const i=t.domAtPos(e);let s=i.node.childNodes[i.offset].offsetWidth,a=n;if(r)for(let l=0;l<n;l++)r[l]&&(s-=r[l],a--);return s/a}function RP(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function py(t,e,n,r){const o=n=="right"?-r:r,i=t.posAtCoords({left:e.clientX+o,top:e.clientY});if(!i)return-1;const{pos:s}=i,a=Ri(t.state.doc.resolve(s));if(!a)return-1;if(n=="right")return a.pos;const l=rt.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 my(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function v2(t,e){t.dispatch(t.state.tr.setMeta(Ln,{setHandle:e}))}function PP(t,e,n){const r=t.state.doc.resolve(e),o=r.node(-1),i=rt.get(o),s=r.start(-1),a=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,l=t.state.tr;for(let c=0;c<i.height;c++){const u=c*i.width+a;if(c&&i.map[u]==i.map[u-i.width])continue;const d=i.map[u],f=o.nodeAt(d).attrs,h=f.colspan==1?0:a-i.colCount(d);if(f.colwidth&&f.colwidth[h]==n)continue;const p=f.colwidth?f.colwidth.slice():BP(f.colspan);p[h]=n,l.setNodeMarkup(s+d,null,{...f,colwidth:p})}l.docChanged&&t.dispatch(l)}function gy(t,e,n,r){const o=t.state.doc.resolve(e),i=o.node(-1),s=o.start(-1),a=rt.get(i).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;let l=t.domAtPos(o.start(-1)).node;for(;l&&l.nodeName!="TABLE";)l=l.parentNode;l&&Xp(i,l.firstChild,l,r,a,n)}function BP(t){return Array(t).fill(0)}function FP(t,e){const n=[],r=t.doc.resolve(e),o=r.node(-1);if(!o)return ke.empty;const i=rt.get(o),s=r.start(-1),a=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;for(let c=0;c<i.height;c++){const u=a+c*i.width;if((a==i.width-1||i.map[u]!=i.map[u+1])&&(c==0||i.map[u]!=i.map[u-i.width])){var l;const d=i.map[u],f=s+d+o.nodeAt(d).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((l=Ln.getState(t))===null||l===void 0)&&l.dragging&&n.push(je.node(s+d,s+d+o.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),n.push(je.widget(f,h))}}return ke.create(t.doc,n)}function HP({allowTableNodeSelection:t=!1}={}){return new ye({key:_o,state:{init(){return null},apply(e,n){const r=e.getMeta(_o);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:o,pos:i}=e.mapping.mapResult(n);return o?null:i}},props:{decorations:J5,handleDOMEvents:{mousedown:_P},createSelectionBetween(e){return _o.getState(e.state)!=null?e.state.selection:null},handleTripleClick:vP,handleKeyDown:SP,handlePaste:AP},appendTransaction(e,n,r){return nP(r,oP(r,n),t)}})}var by=(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]},UP=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,VP=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,$P=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,jP=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,zP=rr.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 by("strong",{...Hn(this.options.HTMLAttributes,t),children:by("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),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[Fs({find:UP,type:this.type}),Fs({find:$P,type:this.type})]},addPasteRules(){return[Mi({find:VP,type:this.type}),Mi({find:jP,type:this.type})]}}),qP=zP,WP=/(^|[^`])`([^`]+)`(?!`)$/,GP=/(^|[^`])`([^`]+)`(?!`)/g,YP=rr.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Hn(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[Fs({find:WP,type:this.type})]},addPasteRules(){return[Mi({find:GP,type:this.type})]}}),KP=YP,QP=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,XP=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,ZP=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,JP=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,e8=rr.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",Hn(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||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Fs({find:QP,type:this.type}),Fs({find:ZP,type:this.type})]},addPasteRules(){return[Mi({find:XP,type:this.type}),Mi({find:JP,type:this.type})]}}),t8=e8,n8=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,r8=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,o8=rr.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",Hn(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[Fs({find:n8,type:this.type})]},addPasteRules(){return[Mi({find:r8,type:this.type})]}}),i8=o8,s8=rr.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",Hn(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 o=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!o)return;const i=o[2].trim();return{type:"underline",raw:o[0],text:i,tokens:n.inlineTokens(i)}}},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()}}}),a8=s8,l8=class A2{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,o){this.remove(e),this.set(n,r,o)}remove(e){this.cache.delete(e)}invalidate(e){const n=new A2(this.cache),r=e.mapping;return this.cache.forEach(([o,i],s)=>{if(s<0)return;const a=r.mapResult(s),l=e.doc.nodeAt(a.pos);if(a.deleted||!l?.eq(o))n.remove(s);else if(s!==a.pos){const c=i.map(u=>u.map(r,0,0)).filter(u=>u!=null);n.replace(s,a.pos,l,c)}}),n}};function c8({parser:t,nodeTypes:e=["code_block","codeBlock"],languageExtractor:n=r=>r.attrs.language}){const r=new Oe("prosemirror-highlight");return new ye({key:r,state:{init(o,i){const s=new l8,[a,l]=yy(i.doc,t,e,n,s);return{cache:s,decorations:a,promises:l}},apply:(o,i)=>{const s=i.cache.invalidate(o),a=!!o.getMeta("prosemirror-highlight-refresh");if(!o.docChanged&&!a)return{cache:s,decorations:i.decorations.map(o.mapping,o.doc),promises:i.promises};const[l,c]=yy(o.doc,t,e,n,s);return{cache:s,decorations:l,promises:c}}},view:o=>{const i=new Set,s=()=>{if(i.size>0)return;const l=o.state.tr.setMeta("prosemirror-highlight-refresh",!0);o.dispatch(l)},a=()=>{const l=r.getState(o.state);for(const c of l?.promises??[])i.add(c),c.then(()=>{i.delete(c),s()}).catch(()=>{i.delete(c)})};return a(),{update:()=>{a()}}},props:{decorations(o){return this.getState(o)?.decorations}}})}function yy(t,e,n,r,o){const i=[],s=[];return t.descendants((a,l)=>{if(!a.type.isTextblock)return!0;if(n.includes(a.type.name)){const c=r(a),u=o.get(l);if(u){const[d,f]=u;i.push(...f)}else{const d=e({content:a.textContent,language:c||void 0,pos:l,size:a.nodeSize});d&&Array.isArray(d)?(o.set(l,a,d),i.push(...d)):d instanceof Promise&&(o.remove(l),s.push(d))}}return!1}),[ke.create(t,i),s]}function u8(t,e){return function({content:r,language:o,pos:i,size:s}){const a=[],{tokens:l,fg:c,bg:u,rootStyle:d}=t.codeToTokens(r,{lang:o,theme:t.getLoadedThemes()[0]}),f=d||(c&&u?`--prosemirror-highlight:${c};--prosemirror-highlight-bg:${u}`:"");if(f){const p=je.node(i,i+s,{style:f});a.push(p)}let h=i+1;for(const p of l){for(const g of p){const b=h+g.content.length,E=je.inline(h,b,{style:d8(g.htmlStyle??`color: ${g.color}`),class:"shiki"});a.push(E),h=b}h+=1}return a}}function d8(t){return typeof t=="string"?t:Object.entries(t).map(([e,n])=>`${e}:${n}`).join(";")}var f8=Object.defineProperty,h8=(t,e,n)=>e in t?f8(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ri=(t,e,n)=>h8(t,typeof e!="symbol"?e+"":e,n);const p8=()=>typeof navigator<"u"&&(/Mac/.test(navigator.platform)||/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent));function Mn(t,e="Ctrl"){return p8()?t.replace("Mod","⌘"):t.replace("Mod",e)}function ut(...t){return[...new Set(t.filter(e=>e).join(" ").split(" "))].join(" ")}function m8(t,e,n,r){const o=document.createElement("div");o.className=ut("bn-block-content",n.class),o.setAttribute("data-content-type",t);for(const[s,a]of Object.entries(n))s!=="class"&&o.setAttribute(s,a);const i=document.createElement(e);i.className=ut("bn-inline-content",r.class);for(const[s,a]of Object.entries(r))s!=="class"&&i.setAttribute(s,a);return o.appendChild(i),{dom:o,contentDOM:i}}const Ey=(t,e)=>{let n=$i(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 o=r(n);if(typeof o!="object"||!("dom"in o))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 o};function g8(t,e="<br>"){const n=t.querySelectorAll("p");if(n.length>1){const r=n[0];for(let o=1;o<n.length;o++){const i=n[o];r.innerHTML+=e+i.innerHTML,i.remove()}}}function Ou(t){return"data-"+t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function xy(t){const e=t.split("/");return!e.length||e[e.length-1]===""?t:e[e.length-1]}function b8(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 y8(t){const e={};return Object.entries(t).forEach(([n,r])=>{e[n]={default:r.default,keepOnSplit:!0,parseHTML:o=>{const i=o.getAttribute(Ou(n));if(i===null)return null;if(r.default===void 0&&r.type==="boolean"||r.default!==void 0&&typeof r.default=="boolean")return i==="true"?!0:i==="false"?!1:null;if(r.default===void 0&&r.type==="number"||r.default!==void 0&&typeof r.default=="number"){const s=parseFloat(i);return!Number.isNaN(s)&&Number.isFinite(s)?s:null}return i},renderHTML:o=>o[n]!==r.default?{[Ou(n)]:o[n]}:{}}}),e}function _2(t,e,n,r){const o=t();if(o===void 0)throw new Error("Cannot find node position");const i=n.state.doc.resolve(o).node().attrs.id;if(!i)throw new Error("Block doesn't have id");const s=e.getBlock(i);if(s.type!==r)throw new Error("Block type does not match");return s}function Zp(t,e,n,r,o=!1,i){const s=document.createElement("div");if(i!==void 0)for(const[a,l]of Object.entries(i))a!=="class"&&s.setAttribute(a,l);s.className=ut("bn-block-content",i?.class||""),s.setAttribute("data-content-type",e);for(const[a,l]of Object.entries(n)){const c=r[a].default;l!==c&&s.setAttribute(Ou(a),l)}return o&&s.setAttribute("data-file-block",""),s.appendChild(t.dom),t.contentDOM&&(t.contentDOM.className=ut("bn-inline-content",t.contentDOM.className)),{...t,dom:s}}function E8(t,e,n){return{config:{type:t.type,content:t.content,propSchema:e},implementation:{node:t.node,render:Ey,toExternalHTML:Ey},extensions:n}}function x8(t,e){t.stopEvent=n=>(n.type==="mousedown"&&setTimeout(()=>{e.view.dom.blur()},10),!0)}function C8(t,e){const n=[{tag:"[data-content-type="+t.type+"]",contentElement:".bn-inline-content"}];return e.parse&&n.push({tag:"*",getAttrs(r){var o;if(typeof r=="string")return!1;const i=(o=e.parse)==null?void 0:o.call(e,r);return i===void 0?!1:i},getContent:t.content==="inline"||t.content==="none"?(r,o)=>{var i;if(e.parseContent)return e.parseContent({el:r,schema:o});if(t.content==="inline"){const s=r.cloneNode(!0);return g8(s,(i=e.meta)!=null&&i.code?`
|
|
110
|
+
`:"<br>"),hr.fromSchema(o).parse(s,{topNode:o.nodes.paragraph.create()}).content}return V.empty}:void 0}),n}function k8(t,e,n,r){var o,i,s,a;const l=e.node||Cr.create({name:t.type,content:t.content==="inline"?"inline*":t.content==="none"?"":t.content,group:"blockContent",selectable:((o=e.meta)==null?void 0:o.selectable)??!0,isolating:((i=e.meta)==null?void 0:i.isolating)??!0,code:((s=e.meta)==null?void 0:s.code)??!1,defining:((a=e.meta)==null?void 0:a.defining)??!0,priority:r,addAttributes(){return y8(t.propSchema)},parseHTML(){return C8(t,e)},renderHTML({HTMLAttributes:c}){var u;const d=document.createElement("div");return Zp({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 f=this.options.editor,h=_2(c.getPos,f,this.editor,t.type),p=((u=this.options.domAttributes)==null?void 0:u.blockContent)||{},g=e.render.call({blockContentDOMAttributes:p,props:c,renderType:"nodeView"},h,f);return((d=e.meta)==null?void 0:d.selectable)===!1&&x8(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 f=((d=l.options.domAttributes)==null?void 0:d.blockContent)||{};return e.render.call({blockContentDOMAttributes:f,props:void 0,renderType:"dom"},c,u)},toExternalHTML:(c,u)=>{var d,f;const h=((d=l.options.domAttributes)==null?void 0:d.blockContent)||{};return((f=e.toExternalHTML)==null?void 0:f.call({blockContentDOMAttributes:h},c,u))??e.render.call({blockContentDOMAttributes:h,renderType:"dom",props:void 0},c,u)}},extensions:n}}function Un(t,e,n){return(r={})=>{const o=typeof t=="function"?t(r):t,i=typeof e=="function"?e(r):e,s=n?typeof n=="function"?n(r):n:void 0;return{config:o,implementation:{...i,toExternalHTML(a,l){var c,u;const d=(c=i.toExternalHTML)==null?void 0:c.call({blockContentDOMAttributes:this.blockContentDOMAttributes},a,l);if(d!==void 0)return Zp(d,a.type,a.props,o.propSchema,((u=i.meta)==null?void 0:u.fileBlockAccept)!==void 0)},render(a,l){var c;const u=i.render.call({blockContentDOMAttributes:this.blockContentDOMAttributes,renderType:this.renderType,props:this.props},a,l);return Zp(u,a.type,a.props,o.propSchema,((c=i.meta)==null?void 0:c.fileBlockAccept)!==void 0,this.blockContentDOMAttributes)}},extensions:s}}}function N2(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>[e,n.config]))}function T8(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 pc(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 I2(t,e){return{config:t,implementation:e}}function sa(t,e){return I2({type:t.name,propSchema:e},{mark:t,render(n,r){const o=r.pmSchema.marks[t.name].spec.toDOM;if(o===void 0)throw new Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");const i=r.pmSchema.mark(t.name,{stringValue:n}),s=Fn.renderSpec(document,o(i,!0));if(typeof s!="object"||!("dom"in s))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 s},toExternalHTML(n,r){const o=r.pmSchema.marks[t.name].spec.toDOM;if(o===void 0)throw new Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");const i=r.pmSchema.mark(t.name,{stringValue:n}),s=Fn.renderSpec(document,o(i,!0));if(typeof s!="object"||!("dom"in s))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 s}})}function M2(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>[e,n.config]))}function w8(t,e){const n=[{tag:`[data-style-type="${t.type}"]`,contentElement:r=>{const o=r;return o.matches("[data-editable]")?o:o.querySelector("[data-editable]")||o}}];return e&&n.push({tag:"*",consuming:!1,getAttrs(r){if(typeof r=="string")return!1;const o=e?.(r);return o===void 0?!1:{stringValue:o}}}),n}function O2(t,e){const n=rr.create({name:t.type,addAttributes(){return T8(t.propSchema)},parseHTML(){return w8(t,e.parse)},renderHTML({mark:r}){const o=(e.toExternalHTML||e.render)(r.attrs.stringValue);return pc(o,t.type,r.attrs.stringValue,t.propSchema)},addMarkView(){return({mark:r})=>{const o=e.render(r.attrs.stringValue);return pc(o,t.type,r.attrs.stringValue,t.propSchema)}}});return I2(t,{...e,mark:n,render:r=>{const o=e.render(r);return pc(o,t.type,r,t.propSchema)},toExternalHTML:r=>{const o=(e.toExternalHTML||e.render)(r);return pc(o,t.type,r,t.propSchema)}})}function dn(t,e){let n,r;if(e.firstChild.descendants((o,i)=>n?!1:!r0(o)||o.attrs.id!==t?!0:(n=o,r=i+1,!1)),!(n===void 0||r===void 0))return{node:n,posBeforeNode:r}}function r0(t){return t.type.isInGroup("bnBlock")}const S8=(t,e)=>({tr:n,dispatch:r})=>(r&&ef(n,t,e),!0);function ef(t,e,n,r,o){const i=Xd(t.doc.resolve(e));let s=null;i.blockNoteType==="table"&&(s=_8(t));const a=Et(t),l=a.nodes[i.blockNoteType],c=a.nodes[n.type||i.blockNoteType],u=c.isInGroup("bnBlock")?c:a.nodes.blockContainer;if(i.isBlockContainer&&c.isInGroup("blockContent"))Cy(n,t,i),v8(n,t,l,c,i);else if(!i.isBlockContainer&&c.isInGroup("bnBlock"))Cy(n,t,i);else{const d=pt(i.bnBlock.node,a);t.replaceWith(i.bnBlock.beforePos,i.bnBlock.afterPos,$i({children:d.children,...n},a));return}t.setNodeMarkup(i.bnBlock.beforePos,u,{...i.bnBlock.node.attrs,...n.props}),s&&N8(t,i,s)}function v8(t,e,n,r,o,i,s){const a=Et(e);let l="keep";if(t.content)if(typeof t.content=="string")l=yr([t.content],a,r.name);else if(Array.isArray(t.content))l=yr(t.content,a,r.name);else if(t.content.type==="tableContent")l=Jd(t.content,a);else throw new Hr(t.content.type);else n.spec.content===""||r.spec.content!==n.spec.content&&(l=[]);l==="keep"?e.setNodeMarkup(o.blockContent.beforePos,r,{...o.blockContent.node.attrs,...t.props}):e.replaceWith(o.blockContent.beforePos,o.blockContent.afterPos,r.createChecked({...o.blockContent.node.attrs,...t.props},l))}function Cy(t,e,n){const r=Et(e);if(t.children!==void 0&&t.children.length>0){const o=t.children.map(i=>$i(i,r));if(n.childContainer)e.step(new St(n.childContainer.beforePos+1,n.childContainer.afterPos-1,new Q(V.from(o),0,0)));else{if(!n.isBlockContainer)throw new Error("impossible");e.insert(n.blockContent.afterPos,r.nodes.blockGroup.createChecked({},o))}}}function A8(t,e,n,r,o){const i=typeof e=="string"?e:e.id,s=dn(i,t.doc);if(!s)throw new Error(`Block with ID ${i} not found`);ef(t,s.posBeforeNode,n);const a=t.doc.resolve(s.posBeforeNode+1).node(),l=Et(t);return pt(a,l)}function _8(t){const e="selection"in t?t.selection:null;if(!(e instanceof ae))return null;const n=t.doc.resolve(e.head);let r=-1,o=-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"){o=g;break}}if(r<0||o<0)return null;const i=n.before(r),s=n.before(o),a=t.doc.nodeAt(s);if(!a||a.type.name!=="table")return null;const l=rt.get(a),c=i-(s+1),u=l.map.indexOf(c);if(u<0)return null;const d=Math.floor(u/l.width),f=u%l.width,h=i+1+1,p=Math.max(0,e.head-h);return{row:d,col:f,offset:p}}function N8(t,e,n){var r;if(e.blockNoteType!=="table")return!1;let o=-1;if(e.isBlockContainer)o=t.mapping.map(e.blockContent.beforePos);else{const b=t.mapping.map(e.bnBlock.beforePos),E=b+(((r=t.doc.nodeAt(b))==null?void 0:r.nodeSize)||0);t.doc.nodesBetween(b,E,(x,T)=>x.type.name==="table"?(o=T,!1):!0)}const i=o>=0?t.doc.nodeAt(o):null;if(!i||i.type.name!=="table")return!1;const s=rt.get(i),a=Math.max(0,Math.min(n.row,s.height-1)),l=Math.max(0,Math.min(n.col,s.width-1)),c=a*s.width+l,u=s.map[c];if(u==null)return!1;const d=o+1+u+1,f=t.doc.nodeAt(d),h=d+1,p=f?f.content.size:0,g=h+Math.max(0,Math.min(n.offset,p));return"selection"in t&&t.setSelection(ae.create(t.doc,g)),!0}const Ro={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"}},He={backgroundColor:{default:"default"},textColor:{default:"default"},textAlignment:{default:"left",values:["left","center","right","justify"]}},Sn=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=He.textAlignment.values.includes(t.style.textAlign)?t.style.textAlign:void 0,e},ji=(t,e)=>{t.backgroundColor&&t.backgroundColor!==He.backgroundColor.default&&(e.style.backgroundColor=t.backgroundColor in Ro?Ro[t.backgroundColor].background:t.backgroundColor),t.textColor&&t.textColor!==He.textColor.default&&(e.style.color=t.textColor in Ro?Ro[t.textColor].text:t.textColor),t.textAlignment&&t.textAlignment!==He.textAlignment.default&&(e.style.textAlign=t.textAlignment)},I8=(t="backgroundColor")=>({default:He.backgroundColor.default,parseHTML:e=>e.hasAttribute("data-background-color")?e.getAttribute("data-background-color"):e.style.backgroundColor?e.style.backgroundColor:He.backgroundColor.default,renderHTML:e=>e[t]===He.backgroundColor.default?{}:{"data-background-color":e[t]}}),M8=(t="textColor")=>({default:He.textColor.default,parseHTML:e=>e.hasAttribute("data-text-color")?e.getAttribute("data-text-color"):e.style.color?e.style.color:He.textColor.default,renderHTML:e=>e[t]===He.textColor.default?{}:{"data-text-color":e[t]}}),tf=(t,e)=>{const n=t.querySelector(e);if(!n)return;const r=t.querySelector("figcaption"),o=r?.textContent??void 0;return{targetElement:n,caption:o}},fr=ze(({editor:t})=>{const e=ei(void 0);function n(){e.setState(void 0)}return{key:"filePanel",store:e,mount({signal:r}){const o=t.onChange(n,!1),i=t.onSelectionChange(n,!1);r.addEventListener("abort",()=>{o(),i()})},closeMenu:n,showMenu(r){e.setState(r)}}}),O8=(t,e,n)=>{const r=document.createElement("div");r.className="bn-add-file-button";const o=document.createElement("div");o.className="bn-add-file-button-icon",n?o.appendChild(n):o.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(o);const i=document.createElement("p");i.className="bn-add-file-button-text",i.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(i);const s=l=>{l.preventDefault(),l.stopPropagation()},a=()=>{var l;e.isEditable&&((l=e.getExtension(fr))==null||l.showMenu(t.id))};return r.addEventListener("mousedown",s,!0),r.addEventListener("click",a,!0),{dom:r,destroy:()=>{r.removeEventListener("mousedown",s,!0),r.removeEventListener("click",a,!0)}}},D8='<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>',L8=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=D8,e.appendChild(n);const r=document.createElement("p");return r.className="bn-file-name",r.textContent=t.props.name,e.appendChild(r),{dom:e}},o0=(t,e,n,r)=>{const o=document.createElement("div");if(o.className="bn-file-block-content-wrapper",t.props.url===""){const s=O8(t,e,r);o.appendChild(s.dom);const a=e.onUploadStart(l=>{if(l===t.id){o.removeChild(s.dom);const c=document.createElement("div");c.className="bn-file-loading-preview",c.textContent="Loading...",o.appendChild(c)}});return{dom:o,destroy:()=>{a(),s.destroy()}}}const i={dom:o};if(t.props.showPreview===!1||!n){const s=L8(t);o.appendChild(s.dom),i.destroy=()=>{var a;(a=s.destroy)==null||a.call(s)}}else o.appendChild(n.dom);if(t.props.caption){const s=document.createElement("p");s.className="bn-file-caption",s.textContent=t.props.caption,o.appendChild(s)}return i},i0=(t,e)=>{const n=document.createElement("figure"),r=document.createElement("figcaption");return r.textContent=e,n.appendChild(t),n.appendChild(r),{dom:n}},nf=(t,e)=>{const n=document.createElement("div"),r=document.createElement("p");return r.textContent=e,n.appendChild(t),n.appendChild(r),{dom:n}},ky=t=>({url:t.src||void 0}),R8='<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>',P8=t=>({type:"audio",propSchema:{backgroundColor:He.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0}},content:"none"}),B8=(t={})=>e=>{if(e.tagName==="AUDIO"){if(e.closest("figure"))return;const{backgroundColor:n}=Sn(e);return{...ky(e),backgroundColor:n}}if(e.tagName==="FIGURE"){const n=tf(e,"audio");if(!n)return;const{targetElement:r,caption:o}=n,{backgroundColor:i}=Sn(e);return{...ky(r),backgroundColor:i,caption:o}}},F8=(t={})=>(e,n)=>{const r=document.createElement("div");r.innerHTML=t.icon??R8;const o=document.createElement("audio");return o.className="bn-audio",n.resolveFileUrl?n.resolveFileUrl(e.props.url).then(i=>{o.src=i}):o.src=e.props.url,o.controls=!0,o.contentEditable="false",o.draggable=!1,o0(e,n,{dom:o},r.firstElementChild)},H8=(t={})=>(e,n)=>{if(!e.props.url){const o=document.createElement("p");return o.textContent="Add audio",{dom:o}}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?i0(r,e.props.caption):nf(r,e.props.caption):{dom:r}},U8=Un(P8,t=>({meta:{fileBlockAccept:["audio/*"]},parse:B8(t),render:F8(t),toExternalHTML:H8(t),runsBefore:["file"]})),Ty=Symbol.for("blocknote.shikiParser"),lh=Symbol.for("blocknote.shikiHighlighterPromise");function V8(t){const e=globalThis;let n,r;return c8({parser:o=>{if(!t.createHighlighter)return[];if(!n)return e[lh]=e[lh]||t.createHighlighter(),e[lh].then(s=>{n=s});const i=D2(t,o.language);return!i||i==="text"||i==="none"||i==="plaintext"||i==="txt"?[]:n.getLoadedLanguages().includes(i)?(r||(r=e[Ty]||u8(n),e[Ty]=r),r(o)):n.loadLanguage(i)},languageExtractor:o=>o.attrs.language,nodeTypes:["codeBlock"]})}const $8=({defaultLanguage:t="text"})=>({type:"codeBlock",propSchema:{language:{default:t}},content:"inline"}),j8=Un($8,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 o=e.firstElementChild;return{language:o.getAttribute("data-language")||((r=o.className.split(" ").find(i=>i.includes("language-")))==null?void 0:r.replace("language-",""))}},parseContent:({el:e,schema:n})=>{const r=hr.fromSchema(n),o=e.firstElementChild;return r.parse(o,{preserveWhitespace:"full",topNode:n.nodes.codeBlock.create()}).content},render(e,n){const r=document.createDocumentFragment(),o=document.createElement("pre"),i=document.createElement("code");o.appendChild(i);let s;if(t.supportedLanguages){const a=document.createElement("select");Object.entries(t.supportedLanguages??{}).forEach(([u,{name:d}])=>{const f=document.createElement("option");f.value=u,f.text=d,a.appendChild(f)}),a.value=e.props.language||t.defaultLanguage||"text";const l=u=>{const d=u.target.value;n.updateBlock(e.id,{props:{language:d}})};a.addEventListener("change",l),s=()=>a.removeEventListener("change",l);const c=document.createElement("div");c.contentEditable="false",c.appendChild(a),r.appendChild(c)}return r.appendChild(o),{dom:r,contentDOM:i,destroy:()=>{s?.()}}},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=>[ze({key:"code-block-highlighter",prosemirrorPlugins:[V8(t)]}),ze({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:o}=n.selection;return o.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:o}=e.getTextCursorPosition();if(r.type!=="codeBlock")return!1;const{$from:i}=n.selection,s=i.parentOffset===i.parent.nodeSize-2,a=i.parent.textContent.endsWith(`
|
|
111
|
+
|
|
112
|
+
`);if(s&&a){if(n.delete(i.pos-2,i.pos),o)return e.setTextCursorPosition(o,"start"),!0;const[l]=e.insertBlocks([{type:"paragraph"}],r,"after");return e.setTextCursorPosition(l,"start"),!0}return n.insertText(`
|
|
113
|
+
`),!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:D2(t,n)??n}.language},content:[]}}}]})]);function D2(t,e){var n;return(n=Object.entries(t.supportedLanguages??{}).find(([r,{aliases:o}])=>o?.includes(e)||r===e))==null?void 0:n[0]}const z8=()=>({type:"divider",propSchema:{},content:"none"}),q8=Un(z8,{meta:{isolating:!1},parse(t){if(t.tagName==="HR")return{}},render(){return{dom:document.createElement("hr")}}},[ze({key:"divider-block-shortcuts",inputRules:[{find:new RegExp("^---$"),replace(){return{type:"divider",props:{},content:[]}}}]})]),wy=t=>({url:t.src||void 0}),W8=()=>({type:"file",propSchema:{backgroundColor:He.backgroundColor,name:{default:""},url:{default:""},caption:{default:""}},content:"none"}),G8=()=>t=>{if(t.tagName==="EMBED"){if(t.closest("figure"))return;const{backgroundColor:e}=Sn(t);return{...wy(t),backgroundColor:e}}if(t.tagName==="FIGURE"){const e=tf(t,"embed");if(!e)return;const{targetElement:n,caption:r}=e,{backgroundColor:o}=Sn(t);return{...wy(n),backgroundColor:o,caption:r}}},Y8=Un(W8,{meta:{fileBlockAccept:["*/*"]},parse:G8(),render(t,e){return o0(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?nf(e,t.props.caption):{dom:e}}}),K8={set:(t,e)=>window.localStorage.setItem(`toggle-${t.id}`,e?"true":"false"),get:t=>window.localStorage.getItem(`toggle-${t.id}`)==="true"},L2=(t,e,n,r=K8)=>{if("isToggleable"in t.props&&!t.props.isToggleable)return{dom:n};const o=document.createElement("div"),i=document.createElement("div");i.className="bn-toggle-wrapper";const s=document.createElement("button");s.className="bn-toggle-button",s.type="button",s.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();s.addEventListener("mousedown",a);const l=()=>{var p;i.getAttribute("data-show-children")==="true"?(i.setAttribute("data-show-children","false"),r.set(e.getBlock(t),!1),o.contains(c)&&o.removeChild(c)):(i.setAttribute("data-show-children","true"),r.set(e.getBlock(t),!0),e.isEditable&&((p=e.getBlock(t))==null?void 0:p.children.length)===0&&!o.contains(c)&&o.appendChild(c))};s.addEventListener("click",l),i.appendChild(s),i.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),o.appendChild(i);let f=t.children.length;const h=e.onChange(()=>{var p;const g=((p=e.getBlock(t))==null?void 0:p.children.length)??0;g>f?(i.getAttribute("data-show-children")==="false"&&(i.setAttribute("data-show-children","true"),r.set(e.getBlock(t),!0)),o.contains(c)&&o.removeChild(c)):g===0&&g<f&&(i.getAttribute("data-show-children")==="true"&&(i.setAttribute("data-show-children","false"),r.set(e.getBlock(t),!1)),o.contains(c)&&o.removeChild(c)),f=g});return r.get(t)?(i.setAttribute("data-show-children","true"),e.isEditable&&t.children.length===0&&o.appendChild(c)):i.setAttribute("data-show-children","false"),{dom:o,ignoreMutation:p=>p instanceof MutationRecord&&(p.type==="attributes"&&p.target===i&&p.attributeName==="data-show-children"||p.type==="childList"&&(p.addedNodes[0]===c||p.removedNodes[0]===c)),destroy:()=>{s.removeEventListener("mousedown",a),s.removeEventListener("click",l),c.removeEventListener("mousedown",u),c.removeEventListener("click",d),h?.()}}},R2=[1,2,3,4,5,6],Q8=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)},X8=({defaultLevel:t=1,levels:e=R2,allowToggleHeadings:n=!0}={})=>({type:"heading",propSchema:{...He,level:{default:t,values:e},...n?{isToggleable:{default:!1,optional:!0}}:{}},content:"inline"}),Z8=Un(X8,({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{...Sn(e),level:n}},render(e,n){const r=document.createElement(`h${e.props.level}`);return t?{...L2(e,n,r),contentDOM:r}:{dom:r,contentDOM:r}},toExternalHTML(e){const n=document.createElement(`h${e.props.level}`);return ji(e.props,n),{dom:n,contentDOM:n}}}),({levels:t=R2}={})=>[ze({key:"heading-shortcuts",keyboardShortcuts:Object.fromEntries(t.map(e=>[`Mod-Alt-${e}`,Q8(e)])??[]),inputRules:t.map(e=>({find:new RegExp(`^(#{${e}})\\s$`),replace({match:n}){return{type:"heading",props:{level:n[1].length}}}}))})]),P2=(t,e,n,r,o)=>{const{dom:i,destroy:s}=o0(t,e,n,o),a=i;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,f=t.props.previewWidth;const h=T=>{var D,O;if(!d){!e.isEditable&&r.contains(l)&&r.contains(c)&&(r.removeChild(l),r.removeChild(c));return}let v;const R="touches"in T?T.touches[0].clientX:T.clientX;t.props.textAlignment==="center"?d.handleUsed==="left"?v=d.initialWidth+(d.initialClientX-R)*2:v=d.initialWidth+(R-d.initialClientX)*2:d.handleUsed==="left"?v=d.initialWidth+d.initialClientX-R:v=d.initialWidth+R-d.initialClientX,f=Math.min(Math.max(v,64),((O=(D=e.domElement)==null?void 0:D.firstElementChild)==null?void 0:O.clientWidth)||Number.MAX_VALUE),a.style.width=`${f}px`},p=T=>{(!T.target||!a.contains(T.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:f}}))},g=()=>{e.isEditable&&(r.appendChild(l),r.appendChild(c))},b=T=>{T.relatedTarget===l||T.relatedTarget===c||d||e.isEditable&&r.contains(l)&&r.contains(c)&&(r.removeChild(l),r.removeChild(c))},E=T=>{T.preventDefault(),a.contains(u)||a.appendChild(u);const D="touches"in T?T.touches[0].clientX:T.clientX;d={handleUsed:"left",initialWidth:a.clientWidth,initialClientX:D}},x=T=>{T.preventDefault(),a.contains(u)||a.appendChild(u);const D="touches"in T?T.touches[0].clientX:T.clientX;d={handleUsed:"right",initialWidth:a.clientWidth,initialClientX:D}};return window.addEventListener("mousemove",h),window.addEventListener("touchmove",h),window.addEventListener("mouseup",p),window.addEventListener("touchend",p),a.addEventListener("mouseenter",g),a.addEventListener("mouseleave",b),l.addEventListener("mousedown",E),l.addEventListener("touchstart",E),c.addEventListener("mousedown",x),c.addEventListener("touchstart",x),{dom:a,destroy:()=>{s?.(),window.removeEventListener("mousemove",h),window.removeEventListener("touchmove",h),window.removeEventListener("mouseup",p),window.removeEventListener("touchend",p),a.removeEventListener("mouseenter",g),a.removeEventListener("mouseleave",b),l.removeEventListener("mousedown",E),l.removeEventListener("touchstart",E),c.removeEventListener("mousedown",x),c.removeEventListener("touchstart",x)}}},Sy=t=>{const e=t.src||void 0,n=t.width||void 0,r=t.alt||void 0;return{url:e,previewWidth:n,name:r}},J8='<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>',eB=(t={})=>({type:"image",propSchema:{textAlignment:He.textAlignment,backgroundColor:He.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0},previewWidth:{default:void 0,type:"number"}},content:"none"}),tB=(t={})=>e=>{if(e.tagName==="IMG"){if(e.closest("figure"))return;const{backgroundColor:n}=Sn(e);return{...Sy(e),backgroundColor:n}}if(e.tagName==="FIGURE"){const n=tf(e,"img");if(!n)return;const{targetElement:r,caption:o}=n,{backgroundColor:i}=Sn(e);return{...Sy(r),backgroundColor:i,caption:o}}},nB=(t={})=>(e,n)=>{const r=document.createElement("div");r.innerHTML=t.icon??J8;const o=document.createElement("div");o.className="bn-visual-media-wrapper";const i=document.createElement("img");return i.className="bn-visual-media",n.resolveFileUrl?n.resolveFileUrl(e.props.url).then(s=>{i.src=s}):i.src=e.props.url,i.alt=e.props.name||e.props.caption||"BlockNote image",i.contentEditable="false",i.draggable=!1,o.appendChild(i),P2(e,n,{dom:o},o,r.firstElementChild)},rB=(t={})=>(e,n)=>{if(!e.props.url){const o=document.createElement("p");return o.textContent="Add image",{dom:o}}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?i0(r,e.props.caption):nf(r,e.props.caption):{dom:r}},oB=Un(eB,t=>({meta:{fileBlockAccept:["image/*"]},parse:tB(t),render:nB(t),toExternalHTML:rB(t),runsBefore:["file"]})),iB=(t,e,n)=>({state:r,dispatch:o})=>o?B2(r.tr,t,e,n):!0,B2=(t,e,n,r)=>{const o=Go(t.doc,e),i=Yo(o);if(!i.isBlockContainer)return!1;const s=Et(t),a=[{type:i.bnBlock.node.type,attrs:r?{...i.bnBlock.node.attrs,id:void 0}:{}},{type:n?i.blockContent.node.type:s.nodes.paragraph,attrs:r?{...i.blockContent.node.attrs}:{}}];return t.split(e,2,a),!0},rf=(t,e)=>{const{blockInfo:n,selectionEmpty:r}=t.transact(s=>({blockInfo:Fl(s),selectionEmpty:s.selection.anchor===s.selection.head}));if(!n.isBlockContainer)return!1;const{bnBlock:o,blockContent:i}=n;return i.node.type.name!==e||!r?!1:i.node.childCount===0?(t.transact(s=>{ef(s,o.beforePos,{type:"paragraph",props:{}})}),!0):i.node.childCount>0?t.transact(s=>(s.deleteSelection(),B2(s,s.selection.from,!0))):!1};function s0(t,e,n){var r,o,i;const s=hr.fromSchema(e),a=t,l=document.createElement("div");l.setAttribute("data-node-type","blockGroup");for(const h of Array.from(a.childNodes))l.appendChild(h.cloneNode(!0));let c=s.parse(l,{topNode:e.nodes.blockGroup.create()});((o=(r=c.firstChild)==null?void 0:r.firstChild)==null?void 0:o.type.name)==="checkListItem"&&(c=c.copy(c.content.cut(c.firstChild.firstChild.nodeSize+2)));const u=(i=c.firstChild)==null?void 0:i.firstChild;if(!(u!=null&&u.isTextblock))return V.from(c);const d=e.nodes[n].create({},u.content),f=c.content.cut(u.nodeSize+2);if(f.size>0){const h=c.copy(f);return d.content.addToEnd(h)}return d.content}const sB=()=>({type:"bulletListItem",propSchema:{...He},content:"inline"}),aB=Un(sB,{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 Sn(t)},parseContent:({el:t,schema:e})=>s0(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 ji(t.props,e),e.appendChild(n),{dom:e,contentDOM:n}}},[ze({key:"bullet-list-item-shortcuts",keyboardShortcuts:{Enter:({editor:t})=>rf(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:new RegExp("^[-+*]\\s$"),replace({editor:t}){if(gn(t.prosemirrorState).blockNoteType!=="heading")return{type:"bulletListItem",props:{}}}}]})]),lB=()=>({type:"checkListItem",propSchema:{...He,checked:{default:!1,type:"boolean"}},content:"inline"}),cB=Un(lB,{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:{...Sn(t),checked:r.checked}}},parseContent:({el:t,schema:e})=>s0(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 o=document.createElement("p");return n.appendChild(r),n.appendChild(o),{dom:n,contentDOM:o}},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 ji(t.props,e),e.appendChild(n),e.appendChild(r),{dom:e,contentDOM:r}},runsBefore:["bulletListItem"]},[ze({key:"check-list-item-shortcuts",keyboardShortcuts:{Enter:({editor:t})=>rf(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:new RegExp("\\[\\s*\\]\\s$"),replace(){return{type:"checkListItem",props:{checked:!1},content:[]}}},{find:new RegExp("\\[[Xx]\\]\\s$"),replace(){return{type:"checkListItem",props:{checked:!0}}}}]})]);function F2(t,e,n,r){let o=t.firstChild.attrs.start||1,i=!0;const s=!!t.firstChild.attrs.start,a=Yo({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?(o=c+1,i=!1):l&&Yo({posBeforeNode:a.bnBlock.beforePos-l.nodeSize,node:l}).blockNoteType==="numberedListItem"&&(o=F2(l,a.bnBlock.beforePos-l.nodeSize,n,r).index+1,i=!1),r.set(t,o),{index:o,isFirst:i,hasStart:s}}function vy(t,e){const n=new Map,r=e.decorations.map(t.mapping,t.doc),o=[];t.doc.nodesBetween(0,t.doc.nodeSize-2,(s,a)=>{if(s.type.name==="blockContainer"&&s.firstChild.type.name==="numberedListItem"){const{index:l,isFirst:c,hasStart:u}=F2(s,a,t,n);if(r.find(a,a+s.nodeSize,d=>d.index===l&&d.isFirst===c&&d.hasStart===u).length===0){const d=t.doc.nodeAt(a+1);o.push(je.node(a+1,a+1+d.nodeSize,{"data-index":l.toString()}))}}});const i=o.flatMap(s=>r.find(s.from,s.to));return{decorations:r.remove(i).add(t.doc,o)}}const uB=()=>new ye({key:new Oe("numbered-list-indexing-decorations"),state:{init(t,e){return vy(e.tr,{decorations:ke.empty})},apply(t,e){return!t.docChanged&&!t.selectionSet&&e.decorations?e:vy(t,e)}},props:{decorations(t){var e;return((e=this.getState(t))==null?void 0:e.decorations)??ke.empty}}}),dB=()=>({type:"numberedListItem",propSchema:{...He,start:{default:void 0,type:"number"}},content:"inline"}),fB=Un(dB,{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"),o=Sn(t);return t.previousElementSibling||r===1?o:{...o,start:r}}},parseContent:({el:t,schema:e})=>s0(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 ji(t.props,e),e.appendChild(n),{dom:e,contentDOM:n}}},[ze({key:"numbered-list-item-shortcuts",inputRules:[{find:new RegExp("^(\\d+)\\.\\s$"),replace({match:t,editor:e}){if(gn(e.prosemirrorState).blockNoteType==="heading")return;const n=parseInt(t[1]);return{type:"numberedListItem",props:{start:n!==1?n:void 0}}}}],keyboardShortcuts:{Enter:({editor:t})=>rf(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:[uB()]})]),hB=()=>({type:"toggleListItem",propSchema:{...He},content:"inline"}),pB=Un(hB,{meta:{isolating:!1},render(t,e){const n=document.createElement("p");return{...L2(t,e,n),contentDOM:n}},toExternalHTML(t){const e=document.createElement("li"),n=document.createElement("p");return ji(t.props,e),e.appendChild(n),{dom:e,contentDOM:n}}},[ze({key:"toggle-list-item-shortcuts",keyboardShortcuts:{Enter:({editor:t})=>rf(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)}}})]),mB=()=>({type:"paragraph",propSchema:He,content:"inline"}),H2=Un(mB,{meta:{isolating:!1},parse:t=>{var e;if(t.tagName==="P"&&(e=t.textContent)!=null&&e.trim())return Sn(t)},render:()=>{const t=document.createElement("p");return{dom:t,contentDOM:t}},toExternalHTML:t=>{const e=document.createElement("p");return ji(t.props,e),{dom:e,contentDOM:e}},runsBefore:["default"]},[ze({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)}}})]),gB=()=>({type:"quote",propSchema:{backgroundColor:He.backgroundColor,textColor:He.textColor},content:"inline"}),bB=Un(gB,{meta:{isolating:!1},parse(t){if(t.tagName==="BLOCKQUOTE"){const{backgroundColor:e,textColor:n}=Sn(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 ji(t.props,e),{dom:e,contentDOM:e}}},[ze({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:{}}}}]})]),yB=35,a0=120,EB=31,xB=We.create({name:"BlockNoteTableExtension",addProseMirrorPlugins:()=>[NP({cellMinWidth:yB,defaultCellMinWidth:a0,View:null}),HP()],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})=>cy(1)(t,e,n)),"Shift-Tab":()=>this.editor.commands.command(({state:t,dispatch:e,view:n})=>cy(-1)(t,e,n))}},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:Qe(de(t,"tableRole",e))}}}),CB={textColor:He.textColor},kB=Cr.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)=>U2(t,e)}]},renderHTML({HTMLAttributes:t}){return["th",Hn(this.options.HTMLAttributes,t),0]}}),TB=Cr.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)=>U2(t,e)}]},renderHTML({HTMLAttributes:t}){return["td",Hn(this.options.HTMLAttributes,t),0]}}),wB=Cr.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,o;const i=m8(this.name,"table",{...((n=this.options.domAttributes)==null?void 0:n.blockContent)||{},...e},((r=this.options.domAttributes)==null?void 0:r.inlineContent)||{}),s=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`),s.appendChild(c)}else s.appendChild(document.createElement("col"));return(o=i.dom.firstChild)==null||o.appendChild(s),i},addNodeView(){return({node:t,HTMLAttributes:e})=>{var n;class r extends S2{constructor(i,s,a){super(i,s),this.node=i,this.cellMinWidth=s,this.blockContentHTMLAttributes=a;const l=document.createElement("div");l.className=ut("bn-block-content",a.class),l.setAttribute("data-content-type","table");for(const[f,h]of Object.entries(a))f!=="class"&&l.setAttribute(f,h);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(i){return!i.target.closest(".tableWrapper-inner")||super.ignoreMutation(i)}}return new r(t,a0,{...((n=this.options.domAttributes)==null?void 0:n.blockContent)||{},...e})}}}),SB=Cr.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]}}),vB=Cr.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)+",tableRole:"row",marks:"deletion insertion modification",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Hn(this.options.HTMLAttributes,t),0]}});function U2(t,e){const n=hr.fromSchema(e).parse(t,{topNode:e.nodes.blockGroup.create()}),r=[];return n.content.descendants(o=>{if(o.isInline)return r.push(o),!1}),V.fromArray(r)}const AB=()=>E8({node:wB,type:"table",content:"table"},CB,[ze({key:"table-extensions",tiptapExtensions:[xB,SB,kB,TB,vB]}),ze({key:"table-keyboard-delete",keyboardShortcuts:{Backspace:({editor:t})=>{if(!(t.prosemirrorState.selection instanceof Ge))return!1;const e=t.getTextCursorPosition().block,n=e.content;let r=0;for(const i of n.rows)for(const s of i.cells){if("type"in s&&s.content.length>0||!("type"in s)&&s.length>0)return!1;r++}let o=0;return t.prosemirrorState.selection.forEachCell(()=>{o++}),o<r?!1:(t.transact(()=>{(t.getPrevBlock(e)||t.getNextBlock(e))&&t.setTextCursorPosition(e),t.removeBlocks([e])}),!0)}}})]),Ay=t=>{const e=t.src||void 0,n=t.width||void 0;return{url:e,previewWidth:n}},_B='<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>',NB=t=>({type:"video",propSchema:{textAlignment:He.textAlignment,backgroundColor:He.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0},previewWidth:{default:void 0,type:"number"}},content:"none"}),IB=t=>e=>{if(e.tagName==="VIDEO"){if(e.closest("figure"))return;const{backgroundColor:n}=Sn(e);return{...Ay(e),backgroundColor:n}}if(e.tagName==="FIGURE"){const n=tf(e,"video");if(!n)return;const{targetElement:r,caption:o}=n,{backgroundColor:i}=Sn(e);return{...Ay(r),backgroundColor:i,caption:o}}},MB=Un(NB,t=>({meta:{fileBlockAccept:["video/*"]},parse:IB(),render(e,n){const r=document.createElement("div");r.innerHTML=t.icon??_B;const o=document.createElement("div");o.className="bn-visual-media-wrapper";const i=document.createElement("video");return i.className="bn-visual-media",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,i.width=e.props.previewWidth,o.appendChild(i),P2(e,n,{dom:o},o,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?i0(n,e.props.caption):nf(n,e.props.caption):{dom:n}},runsBefore:["file"]}));function st(t,e,n){if(!(e in t.schema.blockSpecs))return!1;if(!n)return!0;for(const[r,o]of Object.entries(n)){if(!(r in t.schema.blockSpecs[e].config.propSchema))return!1;if(typeof o=="string"){if(t.schema.blockSpecs[e].config.propSchema[r].default!==void 0&&typeof t.schema.blockSpecs[e].config.propSchema[r].default!==o||t.schema.blockSpecs[e].config.propSchema[r].type!==void 0&&t.schema.blockSpecs[e].config.propSchema[r].type!==o)return!1}else{if(t.schema.blockSpecs[e].config.propSchema[r].default!==o.default||t.schema.blockSpecs[e].config.propSchema[r].default===void 0&&o.default===void 0&&t.schema.blockSpecs[e].config.propSchema[r].type!==o.type||typeof t.schema.blockSpecs[e].config.propSchema[r].values!=typeof o.values)return!1;if(typeof t.schema.blockSpecs[e].config.propSchema[r].values=="object"&&typeof o.values=="object"){for(const i of o.values)if(!t.schema.blockSpecs[e].config.propSchema[r].values.includes(i))return!1}}}return!0}function kn(t,e,n,r){return st(e,n,r)&&t.type===n}function Jp(t){return t instanceof Ge}const mc=new Map;function OB(t){if(mc.has(t))return mc.get(t);const e=new Ss;return t._tiptapEditor.on("transaction",({transaction:n})=>{e.appendMapping(n.mapping)}),t._tiptapEditor.on("destroy",()=>{mc.delete(t)}),mc.set(t,e),e}function DB(t,e,n="left"){const r=nt.getState(t.prosemirrorState);if(!r){const i=OB(t),s=i.maps.length;return()=>i.slice(s).map(e,n==="left"?-1:1)}const o=pl(e+(n==="right"?1:-1),r.binding.type,r.binding.mapping);return()=>{const i=nt.getState(t.prosemirrorState),s=Ei(i.doc,i.binding.type,o,i.binding.mapping);if(s===null)throw new Error("Position not found, cannot track positions");return s+(n==="right"?-1:1)}}const LB=Gd(t=>t.type.name==="blockContainer");class RB{constructor(e,n,r){ri(this,"state"),ri(this,"emitUpdate"),ri(this,"rootEl"),ri(this,"pluginState"),ri(this,"handleScroll",()=>{var i,s;if((i=this.state)!=null&&i.show){const a=(s=this.rootEl)==null?void 0:s.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);if(!a)return;this.state.referencePos=a.getBoundingClientRect().toJSON(),this.emitUpdate(this.pluginState.triggerCharacter)}}),ri(this,"closeMenu",()=>{this.editor.transact(i=>i.setMeta(di,null))}),ri(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(i=>i.selection.from)}).run()});var o;this.editor=e,this.pluginState=void 0,this.emitUpdate=i=>{var s;if(!this.state)throw new Error("Attempting to update uninitialized suggestions menu");n(i,{...this.state,ignoreQueryLength:(s=this.pluginState)==null?void 0:s.ignoreQueryLength})},this.rootEl=r.root,(o=this.rootEl)==null||o.addEventListener("scroll",this.handleScroll,!0)}update(e,n){var r;const o=di.getState(n),i=di.getState(e.state),s=o===void 0&&i!==void 0,a=o!==void 0&&i===void 0;if(!s&&!(o!==void 0&&i!==void 0)&&!a)return;if(this.pluginState=a?o:i,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 di=new Oe("SuggestionMenuPlugin"),er=ze(({editor:t})=>{const e=[];let n;const r=ei(void 0);return{key:"suggestionMenu",store:r,addTriggerCharacter:o=>{e.push(o)},removeTriggerCharacter:o=>{e.splice(e.indexOf(o),1)},closeMenu:()=>{n?.closeMenu()},clearQuery:()=>{n?.clearQuery()},shown:()=>{var o;return((o=n?.state)==null?void 0:o.show)||!1},openSuggestionMenu:(o,i)=>{t.headless||(t.focus(),t.transact(s=>{i!=null&&i.deleteTriggerCharacter&&s.insertText(o),s.scrollIntoView().setMeta(di,{triggerCharacter:o,deleteTriggerCharacter:i?.deleteTriggerCharacter||!1,ignoreQueryLength:i?.ignoreQueryLength||!1})}))},prosemirrorPlugins:[new ye({key:di,view:o=>(n=new RB(t,(i,s)=>{r.setState({...s,triggerCharacter:i})},o),n),state:{init(){},apply:(o,i,s,a)=>{if(o.selection.$from.parent.type.spec.code)return i;const l=o.getMeta(di);if(typeof l=="object"&&l!==null){i&&n?.closeMenu();const u=DB(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(i===void 0)return i;if(a.selection.from!==a.selection.to||l===null||o.getMeta("focus")||o.getMeta("blur")||o.getMeta("pointer")||i.triggerCharacter!==void 0&&a.selection.from<i.queryStartPos()||!a.selection.$from.sameParent(a.doc.resolve(i.queryStartPos())))return;const c={...i};return c.query=a.doc.textBetween(i.queryStartPos(),a.selection.from),c}},props:{handleTextInput(o,i,s,a){if(i===s){const l=o.state.doc;for(const c of e){const u=c.length>1?l.textBetween(i-c.length,i)+a:a;if(c===u)return o.dispatch(o.state.tr.insertText(a)),o.dispatch(o.state.tr.setMeta(di,{triggerCharacter:u}).scrollIntoView()),!0}}return!1},decorations(o){const i=this.getState(o);if(i===void 0)return null;if(!i.deleteTriggerCharacter){const s=LB(o.selection);if(s)return ke.create(o.doc,[je.node(s.pos,s.pos+s.node.nodeSize,{nodeName:"span",class:"bn-suggestion-decorator","data-decoration-id":i.decorationId})])}return ke.create(o.doc,[je.inline(i.queryStartPos()-i.triggerCharacter.length,i.queryStartPos(),{nodeName:"span",class:"bn-suggestion-decorator","data-decoration-id":i.decorationId})])}}})]}});function PB(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 Ct(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&&Oi(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)),PB(t),r}function BB(t){const e=[];return st(t,"heading",{level:"number"})&&e.push({onItemClick:()=>{Ct(t,{type:"heading",props:{level:1}})},badge:Mn("Mod-Alt-1"),key:"heading",...t.dictionary.slash_menu.heading},{onItemClick:()=>{Ct(t,{type:"heading",props:{level:2}})},badge:Mn("Mod-Alt-2"),key:"heading_2",...t.dictionary.slash_menu.heading_2},{onItemClick:()=>{Ct(t,{type:"heading",props:{level:3}})},badge:Mn("Mod-Alt-3"),key:"heading_3",...t.dictionary.slash_menu.heading_3}),st(t,"quote")&&e.push({onItemClick:()=>{Ct(t,{type:"quote"})},key:"quote",...t.dictionary.slash_menu.quote}),st(t,"toggleListItem")&&e.push({onItemClick:()=>{Ct(t,{type:"toggleListItem"})},badge:Mn("Mod-Shift-6"),key:"toggle_list",...t.dictionary.slash_menu.toggle_list}),st(t,"numberedListItem")&&e.push({onItemClick:()=>{Ct(t,{type:"numberedListItem"})},badge:Mn("Mod-Shift-7"),key:"numbered_list",...t.dictionary.slash_menu.numbered_list}),st(t,"bulletListItem")&&e.push({onItemClick:()=>{Ct(t,{type:"bulletListItem"})},badge:Mn("Mod-Shift-8"),key:"bullet_list",...t.dictionary.slash_menu.bullet_list}),st(t,"checkListItem")&&e.push({onItemClick:()=>{Ct(t,{type:"checkListItem"})},badge:Mn("Mod-Shift-9"),key:"check_list",...t.dictionary.slash_menu.check_list}),st(t,"paragraph")&&e.push({onItemClick:()=>{Ct(t,{type:"paragraph"})},badge:Mn("Mod-Alt-0"),key:"paragraph",...t.dictionary.slash_menu.paragraph}),st(t,"codeBlock")&&e.push({onItemClick:()=>{Ct(t,{type:"codeBlock"})},badge:Mn("Mod-Alt-c"),key:"code_block",...t.dictionary.slash_menu.code_block}),st(t,"divider")&&e.push({onItemClick:()=>{Ct(t,{type:"divider"})},key:"divider",...t.dictionary.slash_menu.divider}),st(t,"table")&&e.push({onItemClick:()=>{Ct(t,{type:"table",content:{type:"tableContent",rows:[{cells:["","",""]},{cells:["","",""]}]}})},badge:void 0,key:"table",...t.dictionary.slash_menu.table}),st(t,"image",{url:"string"})&&e.push({onItemClick:()=>{var n;const r=Ct(t,{type:"image"});(n=t.getExtension(fr))==null||n.showMenu(r.id)},key:"image",...t.dictionary.slash_menu.image}),st(t,"video",{url:"string"})&&e.push({onItemClick:()=>{var n;const r=Ct(t,{type:"video"});(n=t.getExtension(fr))==null||n.showMenu(r.id)},key:"video",...t.dictionary.slash_menu.video}),st(t,"audio",{url:"string"})&&e.push({onItemClick:()=>{var n;const r=Ct(t,{type:"audio"});(n=t.getExtension(fr))==null||n.showMenu(r.id)},key:"audio",...t.dictionary.slash_menu.audio}),st(t,"file",{url:"string"})&&e.push({onItemClick:()=>{var n;const r=Ct(t,{type:"file"});(n=t.getExtension(fr))==null||n.showMenu(r.id)},key:"file",...t.dictionary.slash_menu.file}),st(t,"heading",{level:"number",isToggleable:"boolean"})&&e.push({onItemClick:()=>{Ct(t,{type:"heading",props:{level:1,isToggleable:!0}})},key:"toggle_heading",...t.dictionary.slash_menu.toggle_heading},{onItemClick:()=>{Ct(t,{type:"heading",props:{level:2,isToggleable:!0}})},key:"toggle_heading_2",...t.dictionary.slash_menu.toggle_heading_2},{onItemClick:()=>{Ct(t,{type:"heading",props:{level:3,isToggleable:!0}})},key:"toggle_heading_3",...t.dictionary.slash_menu.toggle_heading_3}),st(t,"heading",{level:"number"})&&(t.schema.blockSchema.heading.propSchema.level.values||[]).filter(n=>n>3).forEach(n=>{e.push({onItemClick:()=>{Ct(t,{type:"heading",props:{level:n}})},key:`heading_${n}`,...t.dictionary.slash_menu[`heading_${n}`]})}),e.push({onItemClick:()=>{var n;(n=t.getExtension(er))==null||n.openSuggestionMenu(":",{deleteTriggerCharacter:!0,ignoreQueryLength:!0})},key:"emoji",...t.dictionary.slash_menu.emoji}),e}function FB(t,e){return t.filter(({title:n,aliases:r})=>n.toLowerCase().includes(e.toLowerCase())||r&&r.filter(o=>o.toLowerCase().includes(e.toLowerCase())).length!==0)}const V2={audio:U8(),bulletListItem:aB(),checkListItem:cB(),codeBlock:j8(),divider:q8(),file:Y8(),heading:Z8(),image:oB(),numberedListItem:fB(),paragraph:H2(),quote:bB(),table:AB(),toggleListItem:pB(),video:MB()},HB=O2({type:"textColor",propSchema:"string"},{render:()=>{const t=document.createElement("span");return{dom:t,contentDOM:t}},toExternalHTML:t=>{const e=document.createElement("span");return t!==He.textColor.default&&(e.style.color=t in Ro?Ro[t].text:t),{dom:e,contentDOM:e}},parse:t=>{if(t.tagName==="SPAN"&&t.style.color)return t.style.color}}),UB=O2({type:"backgroundColor",propSchema:"string"},{render:()=>{const t=document.createElement("span");return{dom:t,contentDOM:t}},toExternalHTML:t=>{const e=document.createElement("span");return t!==He.backgroundColor.default&&(e.style.backgroundColor=t in Ro?Ro[t].background:t),{dom:e,contentDOM:e}},parse:t=>{if(t.tagName==="SPAN"&&t.style.backgroundColor)return t.style.backgroundColor}}),l0={bold:sa(qP,"boolean"),italic:sa(t8,"boolean"),underline:sa(a8,"boolean"),strike:sa(i8,"boolean"),code:sa(KP,"boolean"),textColor:HB,backgroundColor:UB};M2(l0);const $2={text:{config:"text",implementation:{}},link:{config:"link",implementation:{}}},VB=N2($2);function j2(t={}){return new ye({view(e){return new $B(e,t)}})}class $B{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(o=>{let i=s=>{this[o](s)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}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,o=this.editorView.dom,i=o.getBoundingClientRect(),s=i.width/o.offsetWidth,a=i.height/o.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),g=d?p.bottom:p.top;d&&f&&(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),f=this.width/2*s;r={left:d.left-f,right:d.left+f,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(),f=d.width/l.offsetWidth,h=d.height/l.offsetHeight;c=d.left-l.scrollLeft*f,u=d.top-l.scrollTop*h}this.element.style.left=(r.left-c)/s+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/s+"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),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,e):o;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=rk(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}var Du=200,Ut=function(){};Ut.prototype.append=function(e){return e.length?(e=Ut.from(e),!this.length&&e||e.length<Du&&this.leafAppend(e)||this.length<Du&&e.leafPrepend(this)||this.appendInner(e)):this};Ut.prototype.prepend=function(e){return e.length?Ut.from(e).append(this):this};Ut.prototype.appendInner=function(e){return new jB(this,e)};Ut.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Ut.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Ut.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Ut.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)};Ut.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},n,r),o};Ut.from=function(e){return e instanceof Ut?e:e&&e.length?new z2(e):Ut.empty};var z2=(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(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,a){for(var l=i;l<s;l++)if(o(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(o,i,s,a){for(var l=i-1;l>=s;l--)if(o(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=Du)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=Du)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Ut);Ut.empty=new z2([]);var jB=(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,o,i,s){var a=this.left.length;if(o<a&&this.left.forEachInner(r,o,Math.min(i,a),s)===!1||i>a&&this.right.forEachInner(r,Math.max(o-a,0),Math.min(this.length,i)-a,s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,s){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(r,o-a,Math.max(i,a)-a,s+a)===!1||i<a&&this.left.forEachInvertedInner(r,Math.min(o,a),i,s)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,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})(Ut);const zB=500;class ar{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 o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,a,l,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new Sr(d.map));let h=d.step.map(o.slice(i)),p;h&&s.maybeStep(h).doc&&(p=s.mapping.maps[s.mapping.maps.length-1],c.push(new Sr(p,void 0,void 0,c.length+u.length))),i--,p&&o.appendMap(p,i)}else s.maybeStep(d.step);if(d.selection)return a=o?d.selection.map(o.slice(i)):d.selection,l=new ar(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(e,n,r,o){let i=[],s=this.eventCount,a=this.items,l=!o&&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]),f=new Sr(e.mapping.maps[u],d,n),h;(h=l&&l.merge(f))&&(f=h,u?i.pop():a=a.slice(0,a.length-1)),i.push(f),n&&(s++,n=void 0),o||(l=f)}let c=s-r.depth;return c>WB&&(a=qB(a,c),s-=c),new ar(a.append(i),s)}remapping(e,n){let r=new Ss;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new ar(this.items.append(e.map(n=>new Sr(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},o);let l=n;this.items.forEach(f=>{let h=i.getMirror(--l);if(h==null)return;s=Math.min(s,h);let p=i.maps[h];if(f.step){let g=e.steps[h].invert(e.docs[h]),b=f.selection&&f.selection.map(i.slice(l+1,h));b&&a++,r.push(new Sr(p,g,b))}else r.push(new Sr(p))},o);let c=[];for(let f=n;f<s;f++)c.push(new Sr(i.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new ar(u,a);return d.emptyItemCount()>zB&&(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,o=[],i=0;return this.items.forEach((s,a)=>{if(a>=e)o.push(s),s.selection&&i++;else if(s.step){let l=s.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=s.selection&&s.selection.map(n.slice(r));u&&i++;let d=new Sr(c.invert(),l,u),f,h=o.length-1;(f=o.length&&o[h].merge(d))?o[h]=f:o.push(d)}}else s.map&&r--},this.items.length,0),new ar(Ut.from(o.reverse()),i)}}ar.empty=new ar(Ut.empty,0);function qB(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}class Sr{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Sr(n.getMap().invert(),n,this.selection)}}}class wo{constructor(e,n,r,o,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const WB=20;function GB(t,e,n,r){let o=n.getMeta(xi),i;if(o)return o.historyState;n.getMeta(q2)&&(t=new wo(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(xi))return s.getMeta(xi).redo?new wo(t.done.addTransform(n,void 0,r,zc(e)),t.undone,_y(n.mapping.maps),t.prevTime,t.prevComposition):new wo(t.done,t.undone.addTransform(n,void 0,r,zc(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!YB(n,t.prevRanges)),c=s?ch(t.prevRanges,n.mapping):_y(n.mapping.maps);return new wo(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,zc(e)),ar.empty,c,n.time,a??t.prevComposition)}else return(i=n.getMeta("rebased"))?new wo(t.done.rebased(n,i),t.undone.rebased(n,i),ch(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new wo(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),ch(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function YB(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&o>=e[i]&&(n=!0)}),n}function _y(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,o,i,s)=>e.push(i,s));return e}function ch(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function KB(t,e,n){let r=zc(e),o=xi.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),o,r),l=new wo(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(xi,{redo:n,historyState:l})}let uh=!1,Ny=null;function zc(t){let e=t.plugins;if(Ny!=e){uh=!1,Ny=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){uh=!0;break}}return uh}function QB(t){return t.setMeta(q2,!0)}const xi=new Oe("history"),q2=new Oe("closeHistory");function W2(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new ye({key:xi,state:{init(){return new wo(ar.empty,ar.empty,null,0,-1)},apply(e,n,r){return GB(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?c0:r=="historyRedo"?u0:null;return!o||!e.editable?!1:(n.preventDefault(),o(e.state,e.dispatch))}}}})}function G2(t,e){return(n,r)=>{let o=xi.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(r){let i=KB(o,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const c0=G2(!1,!0),u0=G2(!0,!0);class Ul{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}Ul.prototype.normal={};Ul.prototype.property={};Ul.prototype.space=void 0;function Y2(t,e){const n={},r={};for(const o of t)Object.assign(n,o.property),Object.assign(r,o.normal);return new Ul(n,r,e)}function Tl(t){return t.toLowerCase()}class vn{constructor(e,n){this.attribute=n,this.property=e}}vn.prototype.attribute="";vn.prototype.booleanish=!1;vn.prototype.boolean=!1;vn.prototype.commaOrSpaceSeparated=!1;vn.prototype.commaSeparated=!1;vn.prototype.defined=!1;vn.prototype.mustUseProperty=!1;vn.prototype.number=!1;vn.prototype.overloadedBoolean=!1;vn.prototype.property="";vn.prototype.spaceSeparated=!1;vn.prototype.space=void 0;let XB=0;const we=zi(),wt=zi(),em=zi(),J=zi(),tt=zi(),ks=zi(),An=zi();function zi(){return 2**++XB}const tm=Object.freeze(Object.defineProperty({__proto__:null,boolean:we,booleanish:wt,commaOrSpaceSeparated:An,commaSeparated:ks,number:J,overloadedBoolean:em,spaceSeparated:tt},Symbol.toStringTag,{value:"Module"})),dh=Object.keys(tm);class d0 extends vn{constructor(e,n,r,o){let i=-1;if(super(e,n),Iy(this,"space",o),typeof r=="number")for(;++i<dh.length;){const s=dh[i];Iy(this,dh[i],(r&tm[s])===tm[s])}}}d0.prototype.defined=!0;function Iy(t,e,n){n&&(t[e]=n)}function Xs(t){const e={},n={};for(const[r,o]of Object.entries(t.properties)){const i=new d0(r,t.transform(t.attributes||{},r),o,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),e[r]=i,n[Tl(r)]=r,n[Tl(i.attribute)]=r}return new Ul(e,n,t.space)}const K2=Xs({properties:{ariaActiveDescendant:null,ariaAtomic:wt,ariaAutoComplete:null,ariaBusy:wt,ariaChecked:wt,ariaColCount:J,ariaColIndex:J,ariaColSpan:J,ariaControls:tt,ariaCurrent:null,ariaDescribedBy:tt,ariaDetails:null,ariaDisabled:wt,ariaDropEffect:tt,ariaErrorMessage:null,ariaExpanded:wt,ariaFlowTo:tt,ariaGrabbed:wt,ariaHasPopup:null,ariaHidden:wt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:tt,ariaLevel:J,ariaLive:null,ariaModal:wt,ariaMultiLine:wt,ariaMultiSelectable:wt,ariaOrientation:null,ariaOwns:tt,ariaPlaceholder:null,ariaPosInSet:J,ariaPressed:wt,ariaReadOnly:wt,ariaRelevant:null,ariaRequired:wt,ariaRoleDescription:tt,ariaRowCount:J,ariaRowIndex:J,ariaRowSpan:J,ariaSelected:wt,ariaSetSize:J,ariaSort:null,ariaValueMax:J,ariaValueMin:J,ariaValueNow:J,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function Q2(t,e){return e in t?t[e]:e}function X2(t,e){return Q2(t,e.toLowerCase())}const ZB=Xs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ks,acceptCharset:tt,accessKey:tt,action:null,allow:null,allowFullScreen:we,allowPaymentRequest:we,allowUserMedia:we,alt:null,as:null,async:we,autoCapitalize:null,autoComplete:tt,autoFocus:we,autoPlay:we,blocking:tt,capture:null,charSet:null,checked:we,cite:null,className:tt,cols:J,colSpan:null,content:null,contentEditable:wt,controls:we,controlsList:tt,coords:J|ks,crossOrigin:null,data:null,dateTime:null,decoding:null,default:we,defer:we,dir:null,dirName:null,disabled:we,download:em,draggable:wt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:we,formTarget:null,headers:tt,height:J,hidden:em,high:J,href:null,hrefLang:null,htmlFor:tt,httpEquiv:tt,id:null,imageSizes:null,imageSrcSet:null,inert:we,inputMode:null,integrity:null,is:null,isMap:we,itemId:null,itemProp:tt,itemRef:tt,itemScope:we,itemType:tt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:we,low:J,manifest:null,max:null,maxLength:J,media:null,method:null,min:null,minLength:J,multiple:we,muted:we,name:null,nonce:null,noModule:we,noValidate:we,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:we,optimum:J,pattern:null,ping:tt,placeholder:null,playsInline:we,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:we,referrerPolicy:null,rel:tt,required:we,reversed:we,rows:J,rowSpan:J,sandbox:tt,scope:null,scoped:we,seamless:we,selected:we,shadowRootClonable:we,shadowRootDelegatesFocus:we,shadowRootMode:null,shape:null,size:J,sizes:null,slot:null,span:J,spellCheck:wt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:J,step:null,style:null,tabIndex:J,target:null,title:null,translate:null,type:null,typeMustMatch:we,useMap:null,value:wt,width:J,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:tt,axis:null,background:null,bgColor:null,border:J,borderColor:null,bottomMargin:J,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:we,declare:we,event:null,face:null,frame:null,frameBorder:null,hSpace:J,leftMargin:J,link:null,longDesc:null,lowSrc:null,marginHeight:J,marginWidth:J,noResize:we,noHref:we,noShade:we,noWrap:we,object:null,profile:null,prompt:null,rev:null,rightMargin:J,rules:null,scheme:null,scrolling:wt,standby:null,summary:null,text:null,topMargin:J,valueType:null,version:null,vAlign:null,vLink:null,vSpace:J,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:we,disableRemotePlayback:we,prefix:null,property:null,results:J,security:null,unselectable:null},space:"html",transform:X2}),JB=Xs({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:An,accentHeight:J,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:J,amplitude:J,arabicForm:null,ascent:J,attributeName:null,attributeType:null,azimuth:J,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:J,by:null,calcMode:null,capHeight:J,className:tt,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:J,diffuseConstant:J,direction:null,display:null,dur:null,divisor:J,dominantBaseline:null,download:we,dx:null,dy:null,edgeMode:null,editable:null,elevation:J,enableBackground:null,end:null,event:null,exponent:J,externalResourcesRequired:null,fill:null,fillOpacity:J,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:ks,g2:ks,glyphName:ks,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:J,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:J,horizOriginX:J,horizOriginY:J,id:null,ideographic:J,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:J,k:J,k1:J,k2:J,k3:J,k4:J,kernelMatrix:An,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:J,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:J,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:J,overlineThickness:J,paintOrder:null,panose1:null,path:null,pathLength:J,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:tt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:J,pointsAtY:J,pointsAtZ:J,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:An,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:An,rev:An,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:An,requiredFeatures:An,requiredFonts:An,requiredFormats:An,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:J,specularExponent:J,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:J,strikethroughThickness:J,string:null,stroke:null,strokeDashArray:An,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:J,strokeOpacity:J,strokeWidth:null,style:null,surfaceScale:J,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:An,tabIndex:J,tableValues:null,target:null,targetX:J,targetY:J,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:An,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:J,underlineThickness:J,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:J,values:null,vAlphabetic:J,vMathematical:J,vectorEffect:null,vHanging:J,vIdeographic:J,version:null,vertAdvY:J,vertOriginX:J,vertOriginY:J,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:J,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Q2}),Z2=Xs({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()}}),J2=Xs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:X2}),eS=Xs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),e9=/[A-Z]/g,My=/-[a-z]/g,t9=/^data[-\w.:]+$/i;function f0(t,e){const n=Tl(e);let r=e,o=vn;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&t9.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(My,r9);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!My.test(i)){let s=i.replace(e9,n9);s.charAt(0)!=="-"&&(s="-"+s),e="data"+s}}o=d0}return new o(r,e)}function n9(t){return"-"+t.toLowerCase()}function r9(t){return t.charAt(1).toUpperCase()}const of=Y2([K2,ZB,Z2,J2,eS],"html"),Vl=Y2([K2,JB,Z2,J2,eS],"svg");function Oy(t){const e=[],n=String(t||"");let r=n.indexOf(","),o=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const s=n.slice(o,r).trim();(s||!i)&&e.push(s),o=r+1,r=n.indexOf(",",o)}return e}function o9(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Dy=/[#.]/g;function i9(t,e){const n=t||"",r={};let o=0,i,s;for(;o<n.length;){Dy.lastIndex=o;const a=Dy.exec(n),l=n.slice(o,a?a.index:n.length);l&&(i?i==="#"?r.id=l:Array.isArray(r.className)?r.className.push(l):r.className=[l]:s=l,o+=l.length),a&&(i=a[0],o++)}return{type:"element",tagName:s||e||"div",properties:r,children:[]}}function Ly(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function s9(t){return t.join(" ").trim()}function tS(t,e,n){const r=n?u9(n):void 0;function o(i,s,...a){let l;if(i==null){l={type:"root",children:[]};const c=s;a.unshift(c)}else{l=i9(i,e);const c=l.tagName.toLowerCase(),u=r?r.get(c):void 0;if(l.tagName=u||c,a9(s))a.unshift(s);else for(const[d,f]of Object.entries(s))l9(t,l.properties,d,f)}for(const c of a)nm(l.children,c);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return o}function a9(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 o=e[r];if(o&&typeof o=="object"){if(!Array.isArray(o))return!0;const i=o;for(const s of i)if(typeof s!="number"&&typeof s!="string")return!0}}return!!("children"in t&&Array.isArray(t.children))}function l9(t,e,n,r){const o=f0(t,n);let i;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;i=r}else typeof r=="boolean"?i=r:typeof r=="string"?o.spaceSeparated?i=Ly(r):o.commaSeparated?i=Oy(r):o.commaOrSpaceSeparated?i=Ly(Oy(r).join(" ")):i=Ry(o,o.property,r):Array.isArray(r)?i=[...r]:i=o.property==="style"?c9(r):String(r);if(Array.isArray(i)){const s=[];for(const a of i)s.push(Ry(o,o.property,a));i=s}o.property==="className"&&Array.isArray(e.className)&&(i=e.className.concat(i)),e[o.property]=i}}function nm(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)nm(t,n);else if(typeof e=="object"&&"type"in e)e.type==="root"?nm(t,e.children):t.push(e);else throw new Error("Expected node, nodes, or string, got `"+e+"`")}function Ry(t,e,n){if(typeof n=="string"){if(t.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((t.boolean||t.overloadedBoolean)&&(n===""||Tl(n)===Tl(e)))return!0}return n}function c9(t){const e=[];for(const[n,r]of Object.entries(t))e.push([n,r].join(": "));return e.join("; ")}function u9(t){const e=new Map;for(const n of t)e.set(n.toLowerCase(),n);return e}const d9=["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"],nS=tS(of,"div"),rS=tS(Vl,"g",d9);function f9(t){const e=String(t),n=[];return{toOffset:o,toPoint:r};function r(i){if(typeof i=="number"&&i>-1&&i<=e.length){let s=0;for(;;){let a=n[s];if(a===void 0){const l=Py(e,n[s-1]);a=l===-1?e.length+1:l+1,n[s]=a}if(a>i)return{line:s+1,column:i-(s>0?n[s-1]:0)+1,offset:i};s++}}}function o(i){if(i&&typeof i.line=="number"&&typeof i.column=="number"&&!Number.isNaN(i.line)&&!Number.isNaN(i.column)){for(;n.length<i.line;){const a=n[n.length-1],l=Py(e,a),c=l===-1?e.length+1:l+1;if(a===c)break;n.push(c)}const s=(i.line>1?n[i.line-2]:0)+i.column-1;if(s<n[i.line-1])return s}}}function Py(t,e){const n=t.indexOf("\r",e),r=t.indexOf(`
|
|
114
|
+
`,e);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}const qc={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"},oS={}.hasOwnProperty,h9=Object.prototype;function p9(t,e){const n=e||{};return h0({file:n.file||void 0,location:!1,schema:n.space==="svg"?Vl:of,verbose:n.verbose||!1},t)}function h0(t,e){let n;switch(e.nodeName){case"#comment":{const r=e;return n={type:"comment",value:r.data},Wc(t,r,n),n}case"#document":case"#document-fragment":{const r=e,o="mode"in r?r.mode==="quirks"||r.mode==="limited-quirks":!1;if(n={type:"root",children:iS(t,e.childNodes),data:{quirksMode:o}},t.file&&t.location){const i=String(t.file),s=f9(i),a=s.toPoint(0),l=s.toPoint(i.length);n.position={start:a,end:l}}return n}case"#documentType":{const r=e;return n={type:"doctype"},Wc(t,r,n),n}case"#text":{const r=e;return n={type:"text",value:r.value},Wc(t,r,n),n}default:return n=m9(t,e),n}}function iS(t,e){let n=-1;const r=[];for(;++n<e.length;){const o=h0(t,e[n]);r.push(o)}return r}function m9(t,e){const n=t.schema;t.schema=e.namespaceURI===qc.svg?Vl:of;let r=-1;const o={};for(;++r<e.attrs.length;){const a=e.attrs[r],l=(a.prefix?a.prefix+":":"")+a.name;oS.call(h9,l)||(o[l]=a.value)}const s=(t.schema.space==="svg"?rS:nS)(e.tagName,o,iS(t,e.childNodes));if(Wc(t,e,s),s.tagName==="template"){const a=e,l=a.sourceCodeLocation,c=l&&l.startTag&&us(l.startTag),u=l&&l.endTag&&us(l.endTag),d=h0(t,a.content);c&&u&&t.file&&(d.position={start:c.end,end:u.start}),s.content=d}return t.schema=n,s}function Wc(t,e,n){if("sourceCodeLocation"in e&&e.sourceCodeLocation&&t.file){const r=g9(t,n,e.sourceCodeLocation);r&&(t.location=!0,n.position=r)}}function g9(t,e,n){const r=us(n);if(e.type==="element"){const o=e.children[e.children.length-1];if(r&&!n.endTag&&o&&o.position&&o.position.end&&(r.end=Object.assign({},o.position.end)),t.verbose){const i={};let s;if(n.attrs)for(s in n.attrs)oS.call(n.attrs,s)&&(i[f0(t.schema,s).property]=us(n.attrs[s]));n.startTag;const a=us(n.startTag),l=n.endTag?us(n.endTag):void 0,c={opening:a};l&&(c.closing=l),c.properties=i,e.data={position:c}}}return r}function us(t){const e=By({line:t.startLine,column:t.startCol,offset:t.startOffset}),n=By({line:t.endLine,column:t.endCol,offset:t.endOffset});return e||n?{start:e,end:n}:void 0}function By(t){return t.line&&t.column?t:void 0}const b9=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]),lt="�";var k;(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"})(k||(k={}));const pn={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"};function sS(t){return t>=55296&&t<=57343}function y9(t){return t>=56320&&t<=57343}function E9(t,e){return(t-55296)*1024+9216+e}function aS(t){return t!==32&&t!==10&&t!==13&&t!==9&&t!==12&&t>=1&&t<=31||t>=127&&t<=159}function lS(t){return t>=64976&&t<=65007||b9.has(t)}var U;(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"})(U||(U={}));const x9=65536;class C9{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=x9,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:o,offset:i}=this,s=o+n,a=i+n;return{code:e,startLine:r,endLine:r,startCol:s,endCol:s,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(y9(n))return this.pos++,this._addGap(),E9(e,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,k.EOF;return this._err(U.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,k.EOF;const r=this.html.charCodeAt(n);return r===k.CARRIAGE_RETURN?k.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,k.EOF;let e=this.html.charCodeAt(this.pos);return e===k.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,k.LINE_FEED):e===k.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,sS(e)&&(e=this._processSurrogate(e)),this.handler.onParseError===null||e>31&&e<127||e===k.LINE_FEED||e===k.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){aS(e)?this._err(U.controlCharacterInInputStream):lS(e)&&this._err(U.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 cS(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 k9=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))),T9=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 w9(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=T9.get(t))!==null&&e!==void 0?e:t}var Ft;(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"})(Ft||(Ft={}));const S9=32;var Po;(function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"})(Po||(Po={}));function rm(t){return t>=Ft.ZERO&&t<=Ft.NINE}function v9(t){return t>=Ft.UPPER_A&&t<=Ft.UPPER_F||t>=Ft.LOWER_A&&t<=Ft.LOWER_F}function A9(t){return t>=Ft.UPPER_A&&t<=Ft.UPPER_Z||t>=Ft.LOWER_A&&t<=Ft.LOWER_Z||rm(t)}function _9(t){return t===Ft.EQUALS||A9(t)}var Pt;(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"})(Pt||(Pt={}));var oo;(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict",t[t.Attribute=2]="Attribute"})(oo||(oo={}));class N9{constructor(e,n,r){this.decodeTree=e,this.emitCodePoint=n,this.errors=r,this.state=Pt.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=oo.Strict}startEntity(e){this.decodeMode=e,this.state=Pt.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,n){switch(this.state){case Pt.EntityStart:return e.charCodeAt(n)===Ft.NUM?(this.state=Pt.NumericStart,this.consumed+=1,this.stateNumericStart(e,n+1)):(this.state=Pt.NamedEntity,this.stateNamedEntity(e,n));case Pt.NumericStart:return this.stateNumericStart(e,n);case Pt.NumericDecimal:return this.stateNumericDecimal(e,n);case Pt.NumericHex:return this.stateNumericHex(e,n);case Pt.NamedEntity:return this.stateNamedEntity(e,n)}}stateNumericStart(e,n){return n>=e.length?-1:(e.charCodeAt(n)|S9)===Ft.LOWER_X?(this.state=Pt.NumericHex,this.consumed+=1,this.stateNumericHex(e,n+1)):(this.state=Pt.NumericDecimal,this.stateNumericDecimal(e,n))}addToNumericResult(e,n,r,o){if(n!==r){const i=r-n;this.result=this.result*Math.pow(o,i)+Number.parseInt(e.substr(n,i),o),this.consumed+=i}}stateNumericHex(e,n){const r=n;for(;n<e.length;){const o=e.charCodeAt(n);if(rm(o)||v9(o))n+=1;else return this.addToNumericResult(e,r,n,16),this.emitNumericEntity(o,3)}return this.addToNumericResult(e,r,n,16),-1}stateNumericDecimal(e,n){const r=n;for(;n<e.length;){const o=e.charCodeAt(n);if(rm(o))n+=1;else return this.addToNumericResult(e,r,n,10),this.emitNumericEntity(o,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===Ft.SEMI)this.consumed+=1;else if(this.decodeMode===oo.Strict)return 0;return this.emitCodePoint(w9(this.result),this.consumed),this.errors&&(e!==Ft.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,n){const{decodeTree:r}=this;let o=r[this.treeIndex],i=(o&Po.VALUE_LENGTH)>>14;for(;n<e.length;n++,this.excess++){const s=e.charCodeAt(n);if(this.treeIndex=I9(r,o,this.treeIndex+Math.max(1,i),s),this.treeIndex<0)return this.result===0||this.decodeMode===oo.Attribute&&(i===0||_9(s))?0:this.emitNotTerminatedNamedEntity();if(o=r[this.treeIndex],i=(o&Po.VALUE_LENGTH)>>14,i!==0){if(s===Ft.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==oo.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;const{result:n,decodeTree:r}=this,o=(r[n]&Po.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,o,this.consumed),(e=this.errors)===null||e===void 0||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,n,r){const{decodeTree:o}=this;return this.emitCodePoint(n===1?o[e]&~Po.VALUE_LENGTH:o[e+1],r),n===3&&this.emitCodePoint(o[e+2],r),r}end(){var e;switch(this.state){case Pt.NamedEntity:return this.result!==0&&(this.decodeMode!==oo.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Pt.NumericDecimal:return this.emitNumericEntity(0,2);case Pt.NumericHex:return this.emitNumericEntity(0,3);case Pt.NumericStart:return(e=this.errors)===null||e===void 0||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Pt.EntityStart:return 0}}}function I9(t,e,n,r){const o=(e&Po.BRANCH_LENGTH)>>7,i=e&Po.JUMP_TABLE;if(o===0)return i!==0&&r===i?n:-1;if(i){const l=r-i;return l<0||l>=o?-1:t[n+l]-1}let s=n,a=s+o-1;for(;s<=a;){const l=s+a>>>1,c=t[l];if(c<r)s=l+1;else if(c>r)a=l-1;else return t[l+o]}return-1}var G;(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/"})(G||(G={}));var Ci;(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"})(Ci||(Ci={}));var qn;(function(t){t.NO_QUIRKS="no-quirks",t.QUIRKS="quirks",t.LIMITED_QUIRKS="limited-quirks"})(qn||(qn={}));var L;(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"})(L||(L={}));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 M9=new Map([[L.A,m.A],[L.ADDRESS,m.ADDRESS],[L.ANNOTATION_XML,m.ANNOTATION_XML],[L.APPLET,m.APPLET],[L.AREA,m.AREA],[L.ARTICLE,m.ARTICLE],[L.ASIDE,m.ASIDE],[L.B,m.B],[L.BASE,m.BASE],[L.BASEFONT,m.BASEFONT],[L.BGSOUND,m.BGSOUND],[L.BIG,m.BIG],[L.BLOCKQUOTE,m.BLOCKQUOTE],[L.BODY,m.BODY],[L.BR,m.BR],[L.BUTTON,m.BUTTON],[L.CAPTION,m.CAPTION],[L.CENTER,m.CENTER],[L.CODE,m.CODE],[L.COL,m.COL],[L.COLGROUP,m.COLGROUP],[L.DD,m.DD],[L.DESC,m.DESC],[L.DETAILS,m.DETAILS],[L.DIALOG,m.DIALOG],[L.DIR,m.DIR],[L.DIV,m.DIV],[L.DL,m.DL],[L.DT,m.DT],[L.EM,m.EM],[L.EMBED,m.EMBED],[L.FIELDSET,m.FIELDSET],[L.FIGCAPTION,m.FIGCAPTION],[L.FIGURE,m.FIGURE],[L.FONT,m.FONT],[L.FOOTER,m.FOOTER],[L.FOREIGN_OBJECT,m.FOREIGN_OBJECT],[L.FORM,m.FORM],[L.FRAME,m.FRAME],[L.FRAMESET,m.FRAMESET],[L.H1,m.H1],[L.H2,m.H2],[L.H3,m.H3],[L.H4,m.H4],[L.H5,m.H5],[L.H6,m.H6],[L.HEAD,m.HEAD],[L.HEADER,m.HEADER],[L.HGROUP,m.HGROUP],[L.HR,m.HR],[L.HTML,m.HTML],[L.I,m.I],[L.IMG,m.IMG],[L.IMAGE,m.IMAGE],[L.INPUT,m.INPUT],[L.IFRAME,m.IFRAME],[L.KEYGEN,m.KEYGEN],[L.LABEL,m.LABEL],[L.LI,m.LI],[L.LINK,m.LINK],[L.LISTING,m.LISTING],[L.MAIN,m.MAIN],[L.MALIGNMARK,m.MALIGNMARK],[L.MARQUEE,m.MARQUEE],[L.MATH,m.MATH],[L.MENU,m.MENU],[L.META,m.META],[L.MGLYPH,m.MGLYPH],[L.MI,m.MI],[L.MO,m.MO],[L.MN,m.MN],[L.MS,m.MS],[L.MTEXT,m.MTEXT],[L.NAV,m.NAV],[L.NOBR,m.NOBR],[L.NOFRAMES,m.NOFRAMES],[L.NOEMBED,m.NOEMBED],[L.NOSCRIPT,m.NOSCRIPT],[L.OBJECT,m.OBJECT],[L.OL,m.OL],[L.OPTGROUP,m.OPTGROUP],[L.OPTION,m.OPTION],[L.P,m.P],[L.PARAM,m.PARAM],[L.PLAINTEXT,m.PLAINTEXT],[L.PRE,m.PRE],[L.RB,m.RB],[L.RP,m.RP],[L.RT,m.RT],[L.RTC,m.RTC],[L.RUBY,m.RUBY],[L.S,m.S],[L.SCRIPT,m.SCRIPT],[L.SEARCH,m.SEARCH],[L.SECTION,m.SECTION],[L.SELECT,m.SELECT],[L.SOURCE,m.SOURCE],[L.SMALL,m.SMALL],[L.SPAN,m.SPAN],[L.STRIKE,m.STRIKE],[L.STRONG,m.STRONG],[L.STYLE,m.STYLE],[L.SUB,m.SUB],[L.SUMMARY,m.SUMMARY],[L.SUP,m.SUP],[L.TABLE,m.TABLE],[L.TBODY,m.TBODY],[L.TEMPLATE,m.TEMPLATE],[L.TEXTAREA,m.TEXTAREA],[L.TFOOT,m.TFOOT],[L.TD,m.TD],[L.TH,m.TH],[L.THEAD,m.THEAD],[L.TITLE,m.TITLE],[L.TR,m.TR],[L.TRACK,m.TRACK],[L.TT,m.TT],[L.U,m.U],[L.UL,m.UL],[L.SVG,m.SVG],[L.VAR,m.VAR],[L.WBR,m.WBR],[L.XMP,m.XMP]]);function sf(t){var e;return(e=M9.get(t))!==null&&e!==void 0?e:m.UNKNOWN}const Y=m,O9={[G.HTML]:new Set([Y.ADDRESS,Y.APPLET,Y.AREA,Y.ARTICLE,Y.ASIDE,Y.BASE,Y.BASEFONT,Y.BGSOUND,Y.BLOCKQUOTE,Y.BODY,Y.BR,Y.BUTTON,Y.CAPTION,Y.CENTER,Y.COL,Y.COLGROUP,Y.DD,Y.DETAILS,Y.DIR,Y.DIV,Y.DL,Y.DT,Y.EMBED,Y.FIELDSET,Y.FIGCAPTION,Y.FIGURE,Y.FOOTER,Y.FORM,Y.FRAME,Y.FRAMESET,Y.H1,Y.H2,Y.H3,Y.H4,Y.H5,Y.H6,Y.HEAD,Y.HEADER,Y.HGROUP,Y.HR,Y.HTML,Y.IFRAME,Y.IMG,Y.INPUT,Y.LI,Y.LINK,Y.LISTING,Y.MAIN,Y.MARQUEE,Y.MENU,Y.META,Y.NAV,Y.NOEMBED,Y.NOFRAMES,Y.NOSCRIPT,Y.OBJECT,Y.OL,Y.P,Y.PARAM,Y.PLAINTEXT,Y.PRE,Y.SCRIPT,Y.SECTION,Y.SELECT,Y.SOURCE,Y.STYLE,Y.SUMMARY,Y.TABLE,Y.TBODY,Y.TD,Y.TEMPLATE,Y.TEXTAREA,Y.TFOOT,Y.TH,Y.THEAD,Y.TITLE,Y.TR,Y.TRACK,Y.UL,Y.WBR,Y.XMP]),[G.MATHML]:new Set([Y.MI,Y.MO,Y.MN,Y.MS,Y.MTEXT,Y.ANNOTATION_XML]),[G.SVG]:new Set([Y.TITLE,Y.FOREIGN_OBJECT,Y.DESC]),[G.XLINK]:new Set,[G.XML]:new Set,[G.XMLNS]:new Set},om=new Set([Y.H1,Y.H2,Y.H3,Y.H4,Y.H5,Y.H6]);L.STYLE,L.SCRIPT,L.XMP,L.IFRAME,L.NOEMBED,L.NOFRAMES,L.PLAINTEXT;var w;(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"})(w||(w={}));const Cn={DATA:w.DATA,RCDATA:w.RCDATA,RAWTEXT:w.RAWTEXT,SCRIPT_DATA:w.SCRIPT_DATA,PLAINTEXT:w.PLAINTEXT,CDATA_SECTION:w.CDATA_SECTION};function D9(t){return t>=k.DIGIT_0&&t<=k.DIGIT_9}function ka(t){return t>=k.LATIN_CAPITAL_A&&t<=k.LATIN_CAPITAL_Z}function L9(t){return t>=k.LATIN_SMALL_A&&t<=k.LATIN_SMALL_Z}function Co(t){return L9(t)||ka(t)}function Fy(t){return Co(t)||D9(t)}function gc(t){return t+32}function uS(t){return t===k.SPACE||t===k.LINE_FEED||t===k.TABULATION||t===k.FORM_FEED}function Hy(t){return uS(t)||t===k.SOLIDUS||t===k.GREATER_THAN_SIGN}function R9(t){return t===k.NULL?U.nullCharacterReference:t>1114111?U.characterReferenceOutsideUnicodeRange:sS(t)?U.surrogateCharacterReference:lS(t)?U.noncharacterCharacterReference:aS(t)||t===k.CARRIAGE_RETURN?U.controlCharacterReference:null}class P9{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=w.DATA,this.returnState=w.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new C9(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new N9(k9,(r,o)=>{this.preprocessor.pos=this.entityStartPos+o-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(U.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(U.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const o=R9(r);o&&this._err(o,1)}}:void 0)}_err(e,n=0){var r,o;(o=(r=this.handler).onParseError)===null||o===void 0||o.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(cS(r,this.currentAttr.name)===null){if(r.attrs.push(this.currentAttr),r.location&&this.currentLocation){const o=(e=(n=r.location).attrs)!==null&&e!==void 0?e:n.attrs=Object.create(null);o[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(U.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=sf(e.tagName),e.type===Fe.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(U.endTagWithAttributes),e.selfClosing&&this._err(U.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=uS(e)?Fe.WHITESPACE_CHARACTER:e===k.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=w.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?oo.Attribute:oo.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===w.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===w.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===w.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case w.DATA:{this._stateData(e);break}case w.RCDATA:{this._stateRcdata(e);break}case w.RAWTEXT:{this._stateRawtext(e);break}case w.SCRIPT_DATA:{this._stateScriptData(e);break}case w.PLAINTEXT:{this._statePlaintext(e);break}case w.TAG_OPEN:{this._stateTagOpen(e);break}case w.END_TAG_OPEN:{this._stateEndTagOpen(e);break}case w.TAG_NAME:{this._stateTagName(e);break}case w.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(e);break}case w.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(e);break}case w.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(e);break}case w.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(e);break}case w.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(e);break}case w.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(e);break}case w.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(e);break}case w.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(e);break}case w.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(e);break}case w.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(e);break}case w.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(e);break}case w.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(e);break}case w.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(e);break}case w.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(e);break}case w.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(e);break}case w.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(e);break}case w.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(e);break}case w.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(e);break}case w.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(e);break}case w.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(e);break}case w.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(e);break}case w.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(e);break}case w.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(e);break}case w.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(e);break}case w.ATTRIBUTE_NAME:{this._stateAttributeName(e);break}case w.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(e);break}case w.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(e);break}case w.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(e);break}case w.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(e);break}case w.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(e);break}case w.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(e);break}case w.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(e);break}case w.BOGUS_COMMENT:{this._stateBogusComment(e);break}case w.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(e);break}case w.COMMENT_START:{this._stateCommentStart(e);break}case w.COMMENT_START_DASH:{this._stateCommentStartDash(e);break}case w.COMMENT:{this._stateComment(e);break}case w.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(e);break}case w.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(e);break}case w.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(e);break}case w.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(e);break}case w.COMMENT_END_DASH:{this._stateCommentEndDash(e);break}case w.COMMENT_END:{this._stateCommentEnd(e);break}case w.COMMENT_END_BANG:{this._stateCommentEndBang(e);break}case w.DOCTYPE:{this._stateDoctype(e);break}case w.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(e);break}case w.DOCTYPE_NAME:{this._stateDoctypeName(e);break}case w.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(e);break}case w.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(e);break}case w.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(e);break}case w.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(e);break}case w.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(e);break}case w.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(e);break}case w.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break}case w.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(e);break}case w.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(e);break}case w.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(e);break}case w.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(e);break}case w.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(e);break}case w.BOGUS_DOCTYPE:{this._stateBogusDoctype(e);break}case w.CDATA_SECTION:{this._stateCdataSection(e);break}case w.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(e);break}case w.CDATA_SECTION_END:{this._stateCdataSectionEnd(e);break}case w.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case w.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(e);break}default:throw new Error("Unknown state")}}_stateData(e){switch(e){case k.LESS_THAN_SIGN:{this.state=w.TAG_OPEN;break}case k.AMPERSAND:{this._startCharacterReference();break}case k.NULL:{this._err(U.unexpectedNullCharacter),this._emitCodePoint(e);break}case k.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case k.AMPERSAND:{this._startCharacterReference();break}case k.LESS_THAN_SIGN:{this.state=w.RCDATA_LESS_THAN_SIGN;break}case k.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(lt);break}case k.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case k.LESS_THAN_SIGN:{this.state=w.RAWTEXT_LESS_THAN_SIGN;break}case k.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(lt);break}case k.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case k.LESS_THAN_SIGN:{this.state=w.SCRIPT_DATA_LESS_THAN_SIGN;break}case k.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(lt);break}case k.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case k.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(lt);break}case k.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateTagOpen(e){if(Co(e))this._createStartTagToken(),this.state=w.TAG_NAME,this._stateTagName(e);else switch(e){case k.EXCLAMATION_MARK:{this.state=w.MARKUP_DECLARATION_OPEN;break}case k.SOLIDUS:{this.state=w.END_TAG_OPEN;break}case k.QUESTION_MARK:{this._err(U.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=w.BOGUS_COMMENT,this._stateBogusComment(e);break}case k.EOF:{this._err(U.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(U.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=w.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(Co(e))this._createEndTagToken(),this.state=w.TAG_NAME,this._stateTagName(e);else switch(e){case k.GREATER_THAN_SIGN:{this._err(U.missingEndTagName),this.state=w.DATA;break}case k.EOF:{this._err(U.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break}default:this._err(U.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=w.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){const n=this.currentToken;switch(e){case k.SPACE:case k.LINE_FEED:case k.TABULATION:case k.FORM_FEED:{this.state=w.BEFORE_ATTRIBUTE_NAME;break}case k.SOLIDUS:{this.state=w.SELF_CLOSING_START_TAG;break}case k.GREATER_THAN_SIGN:{this.state=w.DATA,this.emitCurrentTagToken();break}case k.NULL:{this._err(U.unexpectedNullCharacter),n.tagName+=lt;break}case k.EOF:{this._err(U.eofInTag),this._emitEOFToken();break}default:n.tagName+=String.fromCodePoint(ka(e)?gc(e):e)}}_stateRcdataLessThanSign(e){e===k.SOLIDUS?this.state=w.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=w.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){Co(e)?(this.state=w.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars("</"),this.state=w.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 k.SPACE:case k.LINE_FEED:case k.TABULATION:case k.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=w.BEFORE_ATTRIBUTE_NAME,!1;case k.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=w.SELF_CLOSING_START_TAG,!1;case k.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=w.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=w.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===k.SOLIDUS?this.state=w.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=w.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){Co(e)?(this.state=w.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars("</"),this.state=w.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=w.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case k.SOLIDUS:{this.state=w.SCRIPT_DATA_END_TAG_OPEN;break}case k.EXCLAMATION_MARK:{this.state=w.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break}default:this._emitChars("<"),this.state=w.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){Co(e)?(this.state=w.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars("</"),this.state=w.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=w.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===k.HYPHEN_MINUS?(this.state=w.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=w.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===k.HYPHEN_MINUS?(this.state=w.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=w.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case k.HYPHEN_MINUS:{this.state=w.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break}case k.LESS_THAN_SIGN:{this.state=w.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case k.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(lt);break}case k.EOF:{this._err(U.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case k.HYPHEN_MINUS:{this.state=w.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break}case k.LESS_THAN_SIGN:{this.state=w.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case k.NULL:{this._err(U.unexpectedNullCharacter),this.state=w.SCRIPT_DATA_ESCAPED,this._emitChars(lt);break}case k.EOF:{this._err(U.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=w.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case k.HYPHEN_MINUS:{this._emitChars("-");break}case k.LESS_THAN_SIGN:{this.state=w.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case k.GREATER_THAN_SIGN:{this.state=w.SCRIPT_DATA,this._emitChars(">");break}case k.NULL:{this._err(U.unexpectedNullCharacter),this.state=w.SCRIPT_DATA_ESCAPED,this._emitChars(lt);break}case k.EOF:{this._err(U.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=w.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===k.SOLIDUS?this.state=w.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Co(e)?(this._emitChars("<"),this.state=w.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars("<"),this.state=w.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){Co(e)?(this.state=w.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars("</"),this.state=w.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=w.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith(pn.SCRIPT,!1)&&Hy(this.preprocessor.peek(pn.SCRIPT.length))){this._emitCodePoint(e);for(let n=0;n<pn.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=w.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=w.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case k.HYPHEN_MINUS:{this.state=w.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break}case k.LESS_THAN_SIGN:{this.state=w.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case k.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(lt);break}case k.EOF:{this._err(U.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case k.HYPHEN_MINUS:{this.state=w.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break}case k.LESS_THAN_SIGN:{this.state=w.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case k.NULL:{this._err(U.unexpectedNullCharacter),this.state=w.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(lt);break}case k.EOF:{this._err(U.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=w.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDashDash(e){switch(e){case k.HYPHEN_MINUS:{this._emitChars("-");break}case k.LESS_THAN_SIGN:{this.state=w.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case k.GREATER_THAN_SIGN:{this.state=w.SCRIPT_DATA,this._emitChars(">");break}case k.NULL:{this._err(U.unexpectedNullCharacter),this.state=w.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(lt);break}case k.EOF:{this._err(U.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=w.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===k.SOLIDUS?(this.state=w.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=w.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(pn.SCRIPT,!1)&&Hy(this.preprocessor.peek(pn.SCRIPT.length))){this._emitCodePoint(e);for(let n=0;n<pn.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=w.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=w.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case k.SPACE:case k.LINE_FEED:case k.TABULATION:case k.FORM_FEED:break;case k.SOLIDUS:case k.GREATER_THAN_SIGN:case k.EOF:{this.state=w.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break}case k.EQUALS_SIGN:{this._err(U.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=w.ATTRIBUTE_NAME;break}default:this._createAttr(""),this.state=w.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case k.SPACE:case k.LINE_FEED:case k.TABULATION:case k.FORM_FEED:case k.SOLIDUS:case k.GREATER_THAN_SIGN:case k.EOF:{this._leaveAttrName(),this.state=w.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break}case k.EQUALS_SIGN:{this._leaveAttrName(),this.state=w.BEFORE_ATTRIBUTE_VALUE;break}case k.QUOTATION_MARK:case k.APOSTROPHE:case k.LESS_THAN_SIGN:{this._err(U.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break}case k.NULL:{this._err(U.unexpectedNullCharacter),this.currentAttr.name+=lt;break}default:this.currentAttr.name+=String.fromCodePoint(ka(e)?gc(e):e)}}_stateAfterAttributeName(e){switch(e){case k.SPACE:case k.LINE_FEED:case k.TABULATION:case k.FORM_FEED:break;case k.SOLIDUS:{this.state=w.SELF_CLOSING_START_TAG;break}case k.EQUALS_SIGN:{this.state=w.BEFORE_ATTRIBUTE_VALUE;break}case k.GREATER_THAN_SIGN:{this.state=w.DATA,this.emitCurrentTagToken();break}case k.EOF:{this._err(U.eofInTag),this._emitEOFToken();break}default:this._createAttr(""),this.state=w.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case k.SPACE:case k.LINE_FEED:case k.TABULATION:case k.FORM_FEED:break;case k.QUOTATION_MARK:{this.state=w.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break}case k.APOSTROPHE:{this.state=w.ATTRIBUTE_VALUE_SINGLE_QUOTED;break}case k.GREATER_THAN_SIGN:{this._err(U.missingAttributeValue),this.state=w.DATA,this.emitCurrentTagToken();break}default:this.state=w.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case k.QUOTATION_MARK:{this.state=w.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case k.AMPERSAND:{this._startCharacterReference();break}case k.NULL:{this._err(U.unexpectedNullCharacter),this.currentAttr.value+=lt;break}case k.EOF:{this._err(U.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case k.APOSTROPHE:{this.state=w.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case k.AMPERSAND:{this._startCharacterReference();break}case k.NULL:{this._err(U.unexpectedNullCharacter),this.currentAttr.value+=lt;break}case k.EOF:{this._err(U.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case k.SPACE:case k.LINE_FEED:case k.TABULATION:case k.FORM_FEED:{this._leaveAttrValue(),this.state=w.BEFORE_ATTRIBUTE_NAME;break}case k.AMPERSAND:{this._startCharacterReference();break}case k.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=w.DATA,this.emitCurrentTagToken();break}case k.NULL:{this._err(U.unexpectedNullCharacter),this.currentAttr.value+=lt;break}case k.QUOTATION_MARK:case k.APOSTROPHE:case k.LESS_THAN_SIGN:case k.EQUALS_SIGN:case k.GRAVE_ACCENT:{this._err(U.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break}case k.EOF:{this._err(U.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case k.SPACE:case k.LINE_FEED:case k.TABULATION:case k.FORM_FEED:{this._leaveAttrValue(),this.state=w.BEFORE_ATTRIBUTE_NAME;break}case k.SOLIDUS:{this._leaveAttrValue(),this.state=w.SELF_CLOSING_START_TAG;break}case k.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=w.DATA,this.emitCurrentTagToken();break}case k.EOF:{this._err(U.eofInTag),this._emitEOFToken();break}default:this._err(U.missingWhitespaceBetweenAttributes),this.state=w.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case k.GREATER_THAN_SIGN:{const n=this.currentToken;n.selfClosing=!0,this.state=w.DATA,this.emitCurrentTagToken();break}case k.EOF:{this._err(U.eofInTag),this._emitEOFToken();break}default:this._err(U.unexpectedSolidusInTag),this.state=w.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){const n=this.currentToken;switch(e){case k.GREATER_THAN_SIGN:{this.state=w.DATA,this.emitCurrentComment(n);break}case k.EOF:{this.emitCurrentComment(n),this._emitEOFToken();break}case k.NULL:{this._err(U.unexpectedNullCharacter),n.data+=lt;break}default:n.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch(pn.DASH_DASH,!0)?(this._createCommentToken(pn.DASH_DASH.length+1),this.state=w.COMMENT_START):this._consumeSequenceIfMatch(pn.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(pn.DOCTYPE.length+1),this.state=w.DOCTYPE):this._consumeSequenceIfMatch(pn.CDATA_START,!0)?this.inForeignNode?this.state=w.CDATA_SECTION:(this._err(U.cdataInHtmlContent),this._createCommentToken(pn.CDATA_START.length+1),this.currentToken.data="[CDATA[",this.state=w.BOGUS_COMMENT):this._ensureHibernation()||(this._err(U.incorrectlyOpenedComment),this._createCommentToken(2),this.state=w.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case k.HYPHEN_MINUS:{this.state=w.COMMENT_START_DASH;break}case k.GREATER_THAN_SIGN:{this._err(U.abruptClosingOfEmptyComment),this.state=w.DATA;const n=this.currentToken;this.emitCurrentComment(n);break}default:this.state=w.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){const n=this.currentToken;switch(e){case k.HYPHEN_MINUS:{this.state=w.COMMENT_END;break}case k.GREATER_THAN_SIGN:{this._err(U.abruptClosingOfEmptyComment),this.state=w.DATA,this.emitCurrentComment(n);break}case k.EOF:{this._err(U.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=w.COMMENT,this._stateComment(e)}}_stateComment(e){const n=this.currentToken;switch(e){case k.HYPHEN_MINUS:{this.state=w.COMMENT_END_DASH;break}case k.LESS_THAN_SIGN:{n.data+="<",this.state=w.COMMENT_LESS_THAN_SIGN;break}case k.NULL:{this._err(U.unexpectedNullCharacter),n.data+=lt;break}case k.EOF:{this._err(U.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){const n=this.currentToken;switch(e){case k.EXCLAMATION_MARK:{n.data+="!",this.state=w.COMMENT_LESS_THAN_SIGN_BANG;break}case k.LESS_THAN_SIGN:{n.data+="<";break}default:this.state=w.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===k.HYPHEN_MINUS?this.state=w.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=w.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===k.HYPHEN_MINUS?this.state=w.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=w.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==k.GREATER_THAN_SIGN&&e!==k.EOF&&this._err(U.nestedComment),this.state=w.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){const n=this.currentToken;switch(e){case k.HYPHEN_MINUS:{this.state=w.COMMENT_END;break}case k.EOF:{this._err(U.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=w.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){const n=this.currentToken;switch(e){case k.GREATER_THAN_SIGN:{this.state=w.DATA,this.emitCurrentComment(n);break}case k.EXCLAMATION_MARK:{this.state=w.COMMENT_END_BANG;break}case k.HYPHEN_MINUS:{n.data+="-";break}case k.EOF:{this._err(U.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--",this.state=w.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){const n=this.currentToken;switch(e){case k.HYPHEN_MINUS:{n.data+="--!",this.state=w.COMMENT_END_DASH;break}case k.GREATER_THAN_SIGN:{this._err(U.incorrectlyClosedComment),this.state=w.DATA,this.emitCurrentComment(n);break}case k.EOF:{this._err(U.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--!",this.state=w.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case k.SPACE:case k.LINE_FEED:case k.TABULATION:case k.FORM_FEED:{this.state=w.BEFORE_DOCTYPE_NAME;break}case k.GREATER_THAN_SIGN:{this.state=w.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break}case k.EOF:{this._err(U.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(U.missingWhitespaceBeforeDoctypeName),this.state=w.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(ka(e))this._createDoctypeToken(String.fromCharCode(gc(e))),this.state=w.DOCTYPE_NAME;else switch(e){case k.SPACE:case k.LINE_FEED:case k.TABULATION:case k.FORM_FEED:break;case k.NULL:{this._err(U.unexpectedNullCharacter),this._createDoctypeToken(lt),this.state=w.DOCTYPE_NAME;break}case k.GREATER_THAN_SIGN:{this._err(U.missingDoctypeName),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=w.DATA;break}case k.EOF:{this._err(U.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=w.DOCTYPE_NAME}}_stateDoctypeName(e){const n=this.currentToken;switch(e){case k.SPACE:case k.LINE_FEED:case k.TABULATION:case k.FORM_FEED:{this.state=w.AFTER_DOCTYPE_NAME;break}case k.GREATER_THAN_SIGN:{this.state=w.DATA,this.emitCurrentDoctype(n);break}case k.NULL:{this._err(U.unexpectedNullCharacter),n.name+=lt;break}case k.EOF:{this._err(U.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.name+=String.fromCodePoint(ka(e)?gc(e):e)}}_stateAfterDoctypeName(e){const n=this.currentToken;switch(e){case k.SPACE:case k.LINE_FEED:case k.TABULATION:case k.FORM_FEED:break;case k.GREATER_THAN_SIGN:{this.state=w.DATA,this.emitCurrentDoctype(n);break}case k.EOF:{this._err(U.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._consumeSequenceIfMatch(pn.PUBLIC,!1)?this.state=w.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(pn.SYSTEM,!1)?this.state=w.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(U.invalidCharacterSequenceAfterDoctypeName),n.forceQuirks=!0,this.state=w.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){const n=this.currentToken;switch(e){case k.SPACE:case k.LINE_FEED:case k.TABULATION:case k.FORM_FEED:{this.state=w.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break}case k.QUOTATION_MARK:{this._err(U.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=w.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case k.APOSTROPHE:{this._err(U.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=w.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case k.GREATER_THAN_SIGN:{this._err(U.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=w.DATA,this.emitCurrentDoctype(n);break}case k.EOF:{this._err(U.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(U.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=w.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){const n=this.currentToken;switch(e){case k.SPACE:case k.LINE_FEED:case k.TABULATION:case k.FORM_FEED:break;case k.QUOTATION_MARK:{n.publicId="",this.state=w.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case k.APOSTROPHE:{n.publicId="",this.state=w.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case k.GREATER_THAN_SIGN:{this._err(U.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=w.DATA,this.emitCurrentDoctype(n);break}case k.EOF:{this._err(U.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(U.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=w.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){const n=this.currentToken;switch(e){case k.QUOTATION_MARK:{this.state=w.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case k.NULL:{this._err(U.unexpectedNullCharacter),n.publicId+=lt;break}case k.GREATER_THAN_SIGN:{this._err(U.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=w.DATA;break}case k.EOF:{this._err(U.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 k.APOSTROPHE:{this.state=w.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case k.NULL:{this._err(U.unexpectedNullCharacter),n.publicId+=lt;break}case k.GREATER_THAN_SIGN:{this._err(U.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=w.DATA;break}case k.EOF:{this._err(U.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 k.SPACE:case k.LINE_FEED:case k.TABULATION:case k.FORM_FEED:{this.state=w.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break}case k.GREATER_THAN_SIGN:{this.state=w.DATA,this.emitCurrentDoctype(n);break}case k.QUOTATION_MARK:{this._err(U.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=w.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case k.APOSTROPHE:{this._err(U.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=w.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case k.EOF:{this._err(U.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(U.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=w.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){const n=this.currentToken;switch(e){case k.SPACE:case k.LINE_FEED:case k.TABULATION:case k.FORM_FEED:break;case k.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=w.DATA;break}case k.QUOTATION_MARK:{n.systemId="",this.state=w.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case k.APOSTROPHE:{n.systemId="",this.state=w.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case k.EOF:{this._err(U.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(U.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=w.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){const n=this.currentToken;switch(e){case k.SPACE:case k.LINE_FEED:case k.TABULATION:case k.FORM_FEED:{this.state=w.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break}case k.QUOTATION_MARK:{this._err(U.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=w.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case k.APOSTROPHE:{this._err(U.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=w.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case k.GREATER_THAN_SIGN:{this._err(U.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=w.DATA,this.emitCurrentDoctype(n);break}case k.EOF:{this._err(U.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(U.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=w.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){const n=this.currentToken;switch(e){case k.SPACE:case k.LINE_FEED:case k.TABULATION:case k.FORM_FEED:break;case k.QUOTATION_MARK:{n.systemId="",this.state=w.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case k.APOSTROPHE:{n.systemId="",this.state=w.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case k.GREATER_THAN_SIGN:{this._err(U.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=w.DATA,this.emitCurrentDoctype(n);break}case k.EOF:{this._err(U.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(U.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=w.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){const n=this.currentToken;switch(e){case k.QUOTATION_MARK:{this.state=w.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case k.NULL:{this._err(U.unexpectedNullCharacter),n.systemId+=lt;break}case k.GREATER_THAN_SIGN:{this._err(U.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=w.DATA;break}case k.EOF:{this._err(U.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 k.APOSTROPHE:{this.state=w.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case k.NULL:{this._err(U.unexpectedNullCharacter),n.systemId+=lt;break}case k.GREATER_THAN_SIGN:{this._err(U.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=w.DATA;break}case k.EOF:{this._err(U.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 k.SPACE:case k.LINE_FEED:case k.TABULATION:case k.FORM_FEED:break;case k.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=w.DATA;break}case k.EOF:{this._err(U.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(U.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=w.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){const n=this.currentToken;switch(e){case k.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=w.DATA;break}case k.NULL:{this._err(U.unexpectedNullCharacter);break}case k.EOF:{this.emitCurrentDoctype(n),this._emitEOFToken();break}}}_stateCdataSection(e){switch(e){case k.RIGHT_SQUARE_BRACKET:{this.state=w.CDATA_SECTION_BRACKET;break}case k.EOF:{this._err(U.eofInCdata),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===k.RIGHT_SQUARE_BRACKET?this.state=w.CDATA_SECTION_END:(this._emitChars("]"),this.state=w.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case k.GREATER_THAN_SIGN:{this.state=w.DATA;break}case k.RIGHT_SQUARE_BRACKET:{this._emitChars("]");break}default:this._emitChars("]]"),this.state=w.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(k.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&Fy(this.preprocessor.peek(1))?w.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){Fy(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===k.SEMICOLON&&this._err(U.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}}const dS=new Set([m.DD,m.DT,m.LI,m.OPTGROUP,m.OPTION,m.P,m.RB,m.RP,m.RT,m.RTC]),Uy=new Set([...dS,m.CAPTION,m.COLGROUP,m.TBODY,m.TD,m.TFOOT,m.TH,m.THEAD,m.TR]),Lu=new Set([m.APPLET,m.CAPTION,m.HTML,m.MARQUEE,m.OBJECT,m.TABLE,m.TD,m.TEMPLATE,m.TH]),B9=new Set([...Lu,m.OL,m.UL]),F9=new Set([...Lu,m.BUTTON]),Vy=new Set([m.ANNOTATION_XML,m.MI,m.MN,m.MO,m.MS,m.MTEXT]),$y=new Set([m.DESC,m.FOREIGN_OBJECT,m.TITLE]),H9=new Set([m.TR,m.TEMPLATE,m.HTML]),U9=new Set([m.TBODY,m.TFOOT,m.THEAD,m.TEMPLATE,m.HTML]),V9=new Set([m.TABLE,m.TEMPLATE,m.HTML]),$9=new Set([m.TD,m.TH]);class j9{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)===G.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 o=this._indexOf(e)+1;this.items.splice(o,0,n),this.tagIDs.splice(o,0,r),this.stackTop++,o===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,o===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])!==G.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(om,G.HTML)}popUntilTableCellPopped(){this.popUntilPopped($9,G.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(V9,G.HTML)}clearBackToTableBodyContext(){this.clearBackTo(U9,G.HTML)}clearBackToTableRowContext(){this.clearBackTo(H9,G.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 o=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case G.HTML:{if(o===e)return!0;if(n.has(o))return!1;break}case G.SVG:{if($y.has(o))return!1;break}case G.MATHML:{if(Vy.has(o))return!1;break}}}return!0}hasInScope(e){return this.hasInDynamicScope(e,Lu)}hasInListItemScope(e){return this.hasInDynamicScope(e,B9)}hasInButtonScope(e){return this.hasInDynamicScope(e,F9)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){const n=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case G.HTML:{if(om.has(n))return!0;if(Lu.has(n))return!1;break}case G.SVG:{if($y.has(n))return!1;break}case G.MATHML:{if(Vy.has(n))return!1;break}}}return!0}hasInTableScope(e){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===G.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])===G.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])===G.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&&dS.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&Uy.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==void 0&&this.currentTagId!==e&&Uy.has(this.currentTagId);)this.pop()}}const fh=3;var Ir;(function(t){t[t.Marker=0]="Marker",t[t.Element=1]="Element"})(Ir||(Ir={}));const jy={type:Ir.Marker};class z9{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,n){const r=[],o=n.length,i=this.treeAdapter.getTagName(e),s=this.treeAdapter.getNamespaceURI(e);for(let a=0;a<this.entries.length;a++){const l=this.entries[a];if(l.type===Ir.Marker)break;const{element:c}=l;if(this.treeAdapter.getTagName(c)===i&&this.treeAdapter.getNamespaceURI(c)===s){const u=this.treeAdapter.getAttrList(c);u.length===o&&r.push({idx:a,attrs:u})}}return r}_ensureNoahArkCondition(e){if(this.entries.length<fh)return;const n=this.treeAdapter.getAttrList(e),r=this._getNoahArkConditionCandidates(e,n);if(r.length<fh)return;const o=new Map(n.map(s=>[s.name,s.value]));let i=0;for(let s=0;s<r.length;s++){const a=r[s];a.attrs.every(l=>o.get(l.name)===l.value)&&(i+=1,i>=fh&&this.entries.splice(a.idx,1))}}insertMarker(){this.entries.unshift(jy)}pushElement(e,n){this._ensureNoahArkCondition(e),this.entries.unshift({type:Ir.Element,element:e,token:n})}insertElementAfterBookmark(e,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:Ir.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(jy);e===-1?this.entries.length=0:this.entries.splice(0,e+1)}getElementEntryInScopeWithTagName(e){const n=this.entries.find(r=>r.type===Ir.Marker||this.treeAdapter.getTagName(r.element)===e);return n&&n.type===Ir.Element?n:null}getElementEntry(e){return this.entries.find(n=>n.type===Ir.Element&&n.element===e)}}const ko={createDocument(){return{nodeName:"#document",mode:qn.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 o=t.childNodes.find(i=>i.nodeName==="#documentType");if(o)o.name=e,o.publicId=n,o.systemId=r;else{const i={nodeName:"#documentType",name:e,publicId:n,systemId:r,parentNode:null};ko.appendChild(t,i)}},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(ko.isTextNode(n)){n.value+=e;return}}ko.appendChild(t,ko.createTextNode(e))},insertTextBefore(t,e,n){const r=t.childNodes[t.childNodes.indexOf(n)-1];r&&ko.isTextNode(r)?r.value+=e:ko.insertBefore(t,ko.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}}},fS="html",q9="about:legacy-compat",W9="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",hS=["+//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//"],G9=[...hS,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],Y9=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),pS=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],K9=[...pS,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function zy(t,e){return e.some(n=>t.startsWith(n))}function Q9(t){return t.name===fS&&t.publicId===null&&(t.systemId===null||t.systemId===q9)}function X9(t){if(t.name!==fS)return qn.QUIRKS;const{systemId:e}=t;if(e&&e.toLowerCase()===W9)return qn.QUIRKS;let{publicId:n}=t;if(n!==null){if(n=n.toLowerCase(),Y9.has(n))return qn.QUIRKS;let r=e===null?G9:hS;if(zy(n,r))return qn.QUIRKS;if(r=e===null?pS:K9,zy(n,r))return qn.LIMITED_QUIRKS}return qn.NO_QUIRKS}const qy={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},Z9="definitionurl",J9="definitionURL",e7=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])),t7=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:G.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:G.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:G.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:G.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:G.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:G.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:G.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:G.XML}],["xml:space",{prefix:"xml",name:"space",namespace:G.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:G.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:G.XMLNS}]]),n7=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])),r7=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 o7(t){const e=t.tagID;return e===m.FONT&&t.attrs.some(({name:r})=>r===Ci.COLOR||r===Ci.SIZE||r===Ci.FACE)||r7.has(e)}function mS(t){for(let e=0;e<t.attrs.length;e++)if(t.attrs[e].name===Z9){t.attrs[e].name=J9;break}}function gS(t){for(let e=0;e<t.attrs.length;e++){const n=e7.get(t.attrs[e].name);n!=null&&(t.attrs[e].name=n)}}function p0(t){for(let e=0;e<t.attrs.length;e++){const n=t7.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 i7(t){const e=n7.get(t.tagName);e!=null&&(t.tagName=e,t.tagID=sf(t.tagName))}function s7(t,e){return e===G.MATHML&&(t===m.MI||t===m.MO||t===m.MN||t===m.MS||t===m.MTEXT)}function a7(t,e,n){if(e===G.MATHML&&t===m.ANNOTATION_XML){for(let r=0;r<n.length;r++)if(n[r].name===Ci.ENCODING){const o=n[r].value.toLowerCase();return o===qy.TEXT_HTML||o===qy.APPLICATION_XML}}return e===G.SVG&&(t===m.FOREIGN_OBJECT||t===m.DESC||t===m.TITLE)}function l7(t,e,n,r){return(!r||r===G.HTML)&&a7(t,e,n)||(!r||r===G.MATHML)&&s7(t,e)}const c7="hidden",u7=8,d7=3;var A;(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"})(A||(A={}));const f7={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},bS=new Set([m.TABLE,m.TBODY,m.TFOOT,m.THEAD,m.TR]),Wy={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:ko,onParseError:null};class yS{constructor(e,n,r=null,o=null){this.fragmentContext=r,this.scriptHandler=o,this.currentToken=null,this.stopped=!1,this.insertionMode=A.INITIAL,this.originalInsertionMode=A.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={...Wy,...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 P9(this.options,this),this.activeFormattingElements=new z9(this.treeAdapter),this.fragmentContextID=r?sf(this.treeAdapter.getTagName(r)):m.UNKNOWN,this._setContextModes(r??this.document,this.fragmentContextID),this.openElements=new j9(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={...Wy,...n};e??(e=r.treeAdapter.createElement(L.TEMPLATE,G.HTML,[]));const o=r.treeAdapter.createElement("documentmock",G.HTML,[]),i=new this(r,o,e);return i.fragmentContextID===m.TEMPLATE&&i.tmplInsertionModeStack.unshift(A.IN_TEMPLATE),i._initTokenizerForFragmentParsing(),i._insertFakeRootElement(),i._resetInsertionMode(),i._findFormInFragmentContext(),i}getFragment(){const e=this.treeAdapter.getFirstChild(this.document),n=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,n),n}_err(e,n,r){var o;if(!this.onParseError)return;const i=(o=e.location)!==null&&o!==void 0?o:f7,s={code:n,startLine:i.startLine,startCol:i.startCol,startOffset:i.startOffset,endLine:r?i.startLine:i.endLine,endCol:r?i.startCol:i.endCol,endOffset:r?i.startOffset:i.endOffset};this.onParseError(s)}onItemPush(e,n,r){var o,i;(i=(o=this.treeAdapter).onItemPush)===null||i===void 0||i.call(o,e),r&&this.openElements.stackTop>0&&this._setContextModes(e,n)}onItemPop(e,n){var r,o;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),(o=(r=this.treeAdapter).onItemPop)===null||o===void 0||o.call(r,e,this.openElements.current),n){let i,s;this.openElements.stackTop===0&&this.fragmentContext?(i=this.fragmentContext,s=this.fragmentContextID):{current:i,currentTagId:s}=this.openElements,this._setContextModes(i,s)}}_setContextModes(e,n){const r=e===this.document||e&&this.treeAdapter.getNamespaceURI(e)===G.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&e!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,e)}_switchToTextParsing(e,n){this._insertElement(e,G.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=A.TEXT}switchToPlaintextParsing(){this.insertionMode=A.TEXT,this.originalInsertionMode=A.IN_BODY,this.tokenizer.state=Cn.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)===L.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==G.HTML))switch(this.fragmentContextID){case m.TITLE:case m.TEXTAREA:{this.tokenizer.state=Cn.RCDATA;break}case m.STYLE:case m.XMP:case m.IFRAME:case m.NOEMBED:case m.NOFRAMES:case m.NOSCRIPT:{this.tokenizer.state=Cn.RAWTEXT;break}case m.SCRIPT:{this.tokenizer.state=Cn.SCRIPT_DATA;break}case m.PLAINTEXT:{this.tokenizer.state=Cn.PLAINTEXT;break}}}_setDocumentType(e){const n=e.name||"",r=e.publicId||"",o=e.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,o),e.location){const s=this.treeAdapter.getChildNodes(this.document).find(a=>this.treeAdapter.isDocumentTypeNode(a));s&&this.treeAdapter.setNodeSourceCodeLocation(s,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,G.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(e){const n=this.treeAdapter.createElement(e.tagName,G.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(L.HTML,G.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 o=this.treeAdapter.getChildNodes(n),i=r?o.lastIndexOf(r):o.length,s=o[i-1];if(this.treeAdapter.getNodeSourceCodeLocation(s)){const{endLine:l,endCol:c,endOffset:u}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(s,{endLine:l,endCol:c,endOffset:u})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(s,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,o=this.treeAdapter.getTagName(e),i=n.type===Fe.END_TAG&&o===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,i)}}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)===L.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===G.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===m.MGLYPH||e.tagID===m.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,G.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 o=this.treeAdapter.getNamespaceURI(n),i=this.treeAdapter.getAttrList(n);return l7(e,o,i,r)}_reconstructActiveFormattingElements(){const e=this.activeFormattingElements.entries.length;if(e){const n=this.activeFormattingElements.entries.findIndex(o=>o.type===Ir.Marker||this.openElements.contains(o.element)),r=n===-1?e-1:n-1;for(let o=r;o>=0;o--){const i=this.activeFormattingElements.entries[o];this._insertElement(i.token,this.treeAdapter.getNamespaceURI(i.element)),i.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=A.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=A.IN_ROW;return}case m.TBODY:case m.THEAD:case m.TFOOT:{this.insertionMode=A.IN_TABLE_BODY;return}case m.CAPTION:{this.insertionMode=A.IN_CAPTION;return}case m.COLGROUP:{this.insertionMode=A.IN_COLUMN_GROUP;return}case m.TABLE:{this.insertionMode=A.IN_TABLE;return}case m.BODY:{this.insertionMode=A.IN_BODY;return}case m.FRAMESET:{this.insertionMode=A.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?A.AFTER_HEAD:A.BEFORE_HEAD;return}case m.TD:case m.TH:{if(e>0){this.insertionMode=A.IN_CELL;return}break}case m.HEAD:{if(e>0){this.insertionMode=A.IN_HEAD;return}break}}this.insertionMode=A.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=A.IN_SELECT_IN_TABLE;return}}this.insertionMode=A.IN_SELECT}_isElementCausesFosterParenting(e){return bS.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)===G.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 O9[r].has(n)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){$F(this,e);return}switch(this.insertionMode){case A.INITIAL:{aa(this,e);break}case A.BEFORE_HTML:{Da(this,e);break}case A.BEFORE_HEAD:{La(this,e);break}case A.IN_HEAD:{Ra(this,e);break}case A.IN_HEAD_NO_SCRIPT:{Pa(this,e);break}case A.AFTER_HEAD:{Ba(this,e);break}case A.IN_BODY:case A.IN_CAPTION:case A.IN_CELL:case A.IN_TEMPLATE:{xS(this,e);break}case A.TEXT:case A.IN_SELECT:case A.IN_SELECT_IN_TABLE:{this._insertCharacters(e);break}case A.IN_TABLE:case A.IN_TABLE_BODY:case A.IN_ROW:{hh(this,e);break}case A.IN_TABLE_TEXT:{vS(this,e);break}case A.IN_COLUMN_GROUP:{Ru(this,e);break}case A.AFTER_BODY:{Pu(this,e);break}case A.AFTER_AFTER_BODY:{Gc(this,e);break}}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){VF(this,e);return}switch(this.insertionMode){case A.INITIAL:{aa(this,e);break}case A.BEFORE_HTML:{Da(this,e);break}case A.BEFORE_HEAD:{La(this,e);break}case A.IN_HEAD:{Ra(this,e);break}case A.IN_HEAD_NO_SCRIPT:{Pa(this,e);break}case A.AFTER_HEAD:{Ba(this,e);break}case A.TEXT:{this._insertCharacters(e);break}case A.IN_TABLE:case A.IN_TABLE_BODY:case A.IN_ROW:{hh(this,e);break}case A.IN_COLUMN_GROUP:{Ru(this,e);break}case A.AFTER_BODY:{Pu(this,e);break}case A.AFTER_AFTER_BODY:{Gc(this,e);break}}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML){im(this,e);return}switch(this.insertionMode){case A.INITIAL:case A.BEFORE_HTML:case A.BEFORE_HEAD:case A.IN_HEAD:case A.IN_HEAD_NO_SCRIPT:case A.AFTER_HEAD:case A.IN_BODY:case A.IN_TABLE:case A.IN_CAPTION:case A.IN_COLUMN_GROUP:case A.IN_TABLE_BODY:case A.IN_ROW:case A.IN_CELL:case A.IN_SELECT:case A.IN_SELECT_IN_TABLE:case A.IN_TEMPLATE:case A.IN_FRAMESET:case A.AFTER_FRAMESET:{im(this,e);break}case A.IN_TABLE_TEXT:{la(this,e);break}case A.AFTER_BODY:{E7(this,e);break}case A.AFTER_AFTER_BODY:case A.AFTER_AFTER_FRAMESET:{x7(this,e);break}}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case A.INITIAL:{C7(this,e);break}case A.BEFORE_HEAD:case A.IN_HEAD:case A.IN_HEAD_NO_SCRIPT:case A.AFTER_HEAD:{this._err(e,U.misplacedDoctype);break}case A.IN_TABLE_TEXT:{la(this,e);break}}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,U.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?jF(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case A.INITIAL:{aa(this,e);break}case A.BEFORE_HTML:{k7(this,e);break}case A.BEFORE_HEAD:{w7(this,e);break}case A.IN_HEAD:{kr(this,e);break}case A.IN_HEAD_NO_SCRIPT:{A7(this,e);break}case A.AFTER_HEAD:{N7(this,e);break}case A.IN_BODY:{nn(this,e);break}case A.IN_TABLE:{Hs(this,e);break}case A.IN_TABLE_TEXT:{la(this,e);break}case A.IN_CAPTION:{SF(this,e);break}case A.IN_COLUMN_GROUP:{b0(this,e);break}case A.IN_TABLE_BODY:{cf(this,e);break}case A.IN_ROW:{uf(this,e);break}case A.IN_CELL:{_F(this,e);break}case A.IN_SELECT:{NS(this,e);break}case A.IN_SELECT_IN_TABLE:{IF(this,e);break}case A.IN_TEMPLATE:{OF(this,e);break}case A.AFTER_BODY:{LF(this,e);break}case A.IN_FRAMESET:{RF(this,e);break}case A.AFTER_FRAMESET:{BF(this,e);break}case A.AFTER_AFTER_BODY:{HF(this,e);break}case A.AFTER_AFTER_FRAMESET:{UF(this,e);break}}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?zF(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case A.INITIAL:{aa(this,e);break}case A.BEFORE_HTML:{T7(this,e);break}case A.BEFORE_HEAD:{S7(this,e);break}case A.IN_HEAD:{v7(this,e);break}case A.IN_HEAD_NO_SCRIPT:{_7(this,e);break}case A.AFTER_HEAD:{I7(this,e);break}case A.IN_BODY:{lf(this,e);break}case A.TEXT:{mF(this,e);break}case A.IN_TABLE:{wl(this,e);break}case A.IN_TABLE_TEXT:{la(this,e);break}case A.IN_CAPTION:{vF(this,e);break}case A.IN_COLUMN_GROUP:{AF(this,e);break}case A.IN_TABLE_BODY:{sm(this,e);break}case A.IN_ROW:{_S(this,e);break}case A.IN_CELL:{NF(this,e);break}case A.IN_SELECT:{IS(this,e);break}case A.IN_SELECT_IN_TABLE:{MF(this,e);break}case A.IN_TEMPLATE:{DF(this,e);break}case A.AFTER_BODY:{OS(this,e);break}case A.IN_FRAMESET:{PF(this,e);break}case A.AFTER_FRAMESET:{FF(this,e);break}case A.AFTER_AFTER_BODY:{Gc(this,e);break}}}onEof(e){switch(this.insertionMode){case A.INITIAL:{aa(this,e);break}case A.BEFORE_HTML:{Da(this,e);break}case A.BEFORE_HEAD:{La(this,e);break}case A.IN_HEAD:{Ra(this,e);break}case A.IN_HEAD_NO_SCRIPT:{Pa(this,e);break}case A.AFTER_HEAD:{Ba(this,e);break}case A.IN_BODY:case A.IN_TABLE:case A.IN_CAPTION:case A.IN_COLUMN_GROUP:case A.IN_TABLE_BODY:case A.IN_ROW:case A.IN_CELL:case A.IN_SELECT:case A.IN_SELECT_IN_TABLE:{wS(this,e);break}case A.TEXT:{gF(this,e);break}case A.IN_TABLE_TEXT:{la(this,e);break}case A.IN_TEMPLATE:{MS(this,e);break}case A.AFTER_BODY:case A.IN_FRAMESET:case A.AFTER_FRAMESET:case A.AFTER_AFTER_BODY:case A.AFTER_AFTER_FRAMESET:{g0(this,e);break}}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===k.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 A.IN_HEAD:case A.IN_HEAD_NO_SCRIPT:case A.AFTER_HEAD:case A.TEXT:case A.IN_COLUMN_GROUP:case A.IN_SELECT:case A.IN_SELECT_IN_TABLE:case A.IN_FRAMESET:case A.AFTER_FRAMESET:{this._insertCharacters(e);break}case A.IN_BODY:case A.IN_CAPTION:case A.IN_CELL:case A.IN_TEMPLATE:case A.AFTER_BODY:case A.AFTER_AFTER_BODY:case A.AFTER_AFTER_FRAMESET:{ES(this,e);break}case A.IN_TABLE:case A.IN_TABLE_BODY:case A.IN_ROW:{hh(this,e);break}case A.IN_TABLE_TEXT:{SS(this,e);break}}}}function h7(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):TS(t,e),n}function p7(t,e){let n=null,r=t.openElements.stackTop;for(;r>=0;r--){const o=t.openElements.items[r];if(o===e.element)break;t._isSpecialElement(o,t.openElements.tagIDs[r])&&(n=o)}return n||(t.openElements.shortenToLength(Math.max(r,0)),t.activeFormattingElements.removeEntry(e)),n}function m7(t,e,n){let r=e,o=t.openElements.getCommonAncestor(e);for(let i=0,s=o;s!==n;i++,s=o){o=t.openElements.getCommonAncestor(s);const a=t.activeFormattingElements.getElementEntry(s),l=a&&i>=d7;!a||l?(l&&t.activeFormattingElements.removeEntry(a),t.openElements.remove(s)):(s=g7(t,a),r===e&&(t.activeFormattingElements.bookmark=a),t.treeAdapter.detachNode(r),t.treeAdapter.appendChild(s,r),r=s)}return r}function g7(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 b7(t,e,n){const r=t.treeAdapter.getTagName(e),o=sf(r);if(t._isElementCausesFosterParenting(o))t._fosterParentElement(n);else{const i=t.treeAdapter.getNamespaceURI(e);o===m.TEMPLATE&&i===G.HTML&&(e=t.treeAdapter.getTemplateContent(e)),t.treeAdapter.appendChild(e,n)}}function y7(t,e,n){const r=t.treeAdapter.getNamespaceURI(n.element),{token:o}=n,i=t.treeAdapter.createElement(o.tagName,r,o.attrs);t._adoptNodes(e,i),t.treeAdapter.appendChild(e,i),t.activeFormattingElements.insertElementAfterBookmark(i,o),t.activeFormattingElements.removeEntry(n),t.openElements.remove(n.element),t.openElements.insertAfter(e,i,o.tagID)}function m0(t,e){for(let n=0;n<u7;n++){const r=h7(t,e);if(!r)break;const o=p7(t,r);if(!o)break;t.activeFormattingElements.bookmark=r;const i=m7(t,o,r.element),s=t.openElements.getCommonAncestor(r.element);t.treeAdapter.detachNode(i),s&&b7(t,s,i),y7(t,o,r)}}function im(t,e){t._appendCommentNode(e,t.openElements.currentTmplContentOrNode)}function E7(t,e){t._appendCommentNode(e,t.openElements.items[0])}function x7(t,e){t._appendCommentNode(e,t.document)}function g0(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],o=t.treeAdapter.getNodeSourceCodeLocation(r);if(o&&!o.endTag&&(t._setEndLocation(r,e),t.openElements.stackTop>=1)){const i=t.openElements.items[1],s=t.treeAdapter.getNodeSourceCodeLocation(i);s&&!s.endTag&&t._setEndLocation(i,e)}}}}function C7(t,e){t._setDocumentType(e);const n=e.forceQuirks?qn.QUIRKS:X9(e);Q9(e)||t._err(e,U.nonConformingDoctype),t.treeAdapter.setDocumentMode(t.document,n),t.insertionMode=A.BEFORE_HTML}function aa(t,e){t._err(e,U.missingDoctype,!0),t.treeAdapter.setDocumentMode(t.document,qn.QUIRKS),t.insertionMode=A.BEFORE_HTML,t._processToken(e)}function k7(t,e){e.tagID===m.HTML?(t._insertElement(e,G.HTML),t.insertionMode=A.BEFORE_HEAD):Da(t,e)}function T7(t,e){const n=e.tagID;(n===m.HTML||n===m.HEAD||n===m.BODY||n===m.BR)&&Da(t,e)}function Da(t,e){t._insertFakeRootElement(),t.insertionMode=A.BEFORE_HEAD,t._processToken(e)}function w7(t,e){switch(e.tagID){case m.HTML:{nn(t,e);break}case m.HEAD:{t._insertElement(e,G.HTML),t.headElement=t.openElements.current,t.insertionMode=A.IN_HEAD;break}default:La(t,e)}}function S7(t,e){const n=e.tagID;n===m.HEAD||n===m.BODY||n===m.HTML||n===m.BR?La(t,e):t._err(e,U.endTagWithoutMatchingOpenElement)}function La(t,e){t._insertFakeElement(L.HEAD,m.HEAD),t.headElement=t.openElements.current,t.insertionMode=A.IN_HEAD,t._processToken(e)}function kr(t,e){switch(e.tagID){case m.HTML:{nn(t,e);break}case m.BASE:case m.BASEFONT:case m.BGSOUND:case m.LINK:case m.META:{t._appendElement(e,G.HTML),e.ackSelfClosing=!0;break}case m.TITLE:{t._switchToTextParsing(e,Cn.RCDATA);break}case m.NOSCRIPT:{t.options.scriptingEnabled?t._switchToTextParsing(e,Cn.RAWTEXT):(t._insertElement(e,G.HTML),t.insertionMode=A.IN_HEAD_NO_SCRIPT);break}case m.NOFRAMES:case m.STYLE:{t._switchToTextParsing(e,Cn.RAWTEXT);break}case m.SCRIPT:{t._switchToTextParsing(e,Cn.SCRIPT_DATA);break}case m.TEMPLATE:{t._insertTemplate(e),t.activeFormattingElements.insertMarker(),t.framesetOk=!1,t.insertionMode=A.IN_TEMPLATE,t.tmplInsertionModeStack.unshift(A.IN_TEMPLATE);break}case m.HEAD:{t._err(e,U.misplacedStartTagForHeadElement);break}default:Ra(t,e)}}function v7(t,e){switch(e.tagID){case m.HEAD:{t.openElements.pop(),t.insertionMode=A.AFTER_HEAD;break}case m.BODY:case m.BR:case m.HTML:{Ra(t,e);break}case m.TEMPLATE:{qi(t,e);break}default:t._err(e,U.endTagWithoutMatchingOpenElement)}}function qi(t,e){t.openElements.tmplCount>0?(t.openElements.generateImpliedEndTagsThoroughly(),t.openElements.currentTagId!==m.TEMPLATE&&t._err(e,U.closingOfElementWithOpenChildElements),t.openElements.popUntilTagNamePopped(m.TEMPLATE),t.activeFormattingElements.clearToLastMarker(),t.tmplInsertionModeStack.shift(),t._resetInsertionMode()):t._err(e,U.endTagWithoutMatchingOpenElement)}function Ra(t,e){t.openElements.pop(),t.insertionMode=A.AFTER_HEAD,t._processToken(e)}function A7(t,e){switch(e.tagID){case m.HTML:{nn(t,e);break}case m.BASEFONT:case m.BGSOUND:case m.HEAD:case m.LINK:case m.META:case m.NOFRAMES:case m.STYLE:{kr(t,e);break}case m.NOSCRIPT:{t._err(e,U.nestedNoscriptInHead);break}default:Pa(t,e)}}function _7(t,e){switch(e.tagID){case m.NOSCRIPT:{t.openElements.pop(),t.insertionMode=A.IN_HEAD;break}case m.BR:{Pa(t,e);break}default:t._err(e,U.endTagWithoutMatchingOpenElement)}}function Pa(t,e){const n=e.type===Fe.EOF?U.openElementsLeftAfterEof:U.disallowedContentInNoscriptInHead;t._err(e,n),t.openElements.pop(),t.insertionMode=A.IN_HEAD,t._processToken(e)}function N7(t,e){switch(e.tagID){case m.HTML:{nn(t,e);break}case m.BODY:{t._insertElement(e,G.HTML),t.framesetOk=!1,t.insertionMode=A.IN_BODY;break}case m.FRAMESET:{t._insertElement(e,G.HTML),t.insertionMode=A.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,U.abandonedHeadElementChild),t.openElements.push(t.headElement,m.HEAD),kr(t,e),t.openElements.remove(t.headElement);break}case m.HEAD:{t._err(e,U.misplacedStartTagForHeadElement);break}default:Ba(t,e)}}function I7(t,e){switch(e.tagID){case m.BODY:case m.HTML:case m.BR:{Ba(t,e);break}case m.TEMPLATE:{qi(t,e);break}default:t._err(e,U.endTagWithoutMatchingOpenElement)}}function Ba(t,e){t._insertFakeElement(L.BODY,m.BODY),t.insertionMode=A.IN_BODY,af(t,e)}function af(t,e){switch(e.type){case Fe.CHARACTER:{xS(t,e);break}case Fe.WHITESPACE_CHARACTER:{ES(t,e);break}case Fe.COMMENT:{im(t,e);break}case Fe.START_TAG:{nn(t,e);break}case Fe.END_TAG:{lf(t,e);break}case Fe.EOF:{wS(t,e);break}}}function ES(t,e){t._reconstructActiveFormattingElements(),t._insertCharacters(e)}function xS(t,e){t._reconstructActiveFormattingElements(),t._insertCharacters(e),t.framesetOk=!1}function M7(t,e){t.openElements.tmplCount===0&&t.treeAdapter.adoptAttributes(t.openElements.items[0],e.attrs)}function O7(t,e){const n=t.openElements.tryPeekProperlyNestedBodyElement();n&&t.openElements.tmplCount===0&&(t.framesetOk=!1,t.treeAdapter.adoptAttributes(n,e.attrs))}function D7(t,e){const n=t.openElements.tryPeekProperlyNestedBodyElement();t.framesetOk&&n&&(t.treeAdapter.detachNode(n),t.openElements.popAllUpToHtmlElement(),t._insertElement(e,G.HTML),t.insertionMode=A.IN_FRAMESET)}function L7(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,G.HTML)}function R7(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t.openElements.currentTagId!==void 0&&om.has(t.openElements.currentTagId)&&t.openElements.pop(),t._insertElement(e,G.HTML)}function P7(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,G.HTML),t.skipNextNewLine=!0,t.framesetOk=!1}function B7(t,e){const n=t.openElements.tmplCount>0;(!t.formElement||n)&&(t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,G.HTML),n||(t.formElement=t.openElements.current))}function F7(t,e){t.framesetOk=!1;const n=e.tagID;for(let r=t.openElements.stackTop;r>=0;r--){const o=t.openElements.tagIDs[r];if(n===m.LI&&o===m.LI||(n===m.DD||n===m.DT)&&(o===m.DD||o===m.DT)){t.openElements.generateImpliedEndTagsWithExclusion(o),t.openElements.popUntilTagNamePopped(o);break}if(o!==m.ADDRESS&&o!==m.DIV&&o!==m.P&&t._isSpecialElement(t.openElements.items[r],o))break}t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,G.HTML)}function H7(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,G.HTML),t.tokenizer.state=Cn.PLAINTEXT}function U7(t,e){t.openElements.hasInScope(m.BUTTON)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(m.BUTTON)),t._reconstructActiveFormattingElements(),t._insertElement(e,G.HTML),t.framesetOk=!1}function V7(t,e){const n=t.activeFormattingElements.getElementEntryInScopeWithTagName(L.A);n&&(m0(t,e),t.openElements.remove(n.element),t.activeFormattingElements.removeEntry(n)),t._reconstructActiveFormattingElements(),t._insertElement(e,G.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}function $7(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,G.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}function j7(t,e){t._reconstructActiveFormattingElements(),t.openElements.hasInScope(m.NOBR)&&(m0(t,e),t._reconstructActiveFormattingElements()),t._insertElement(e,G.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}function z7(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,G.HTML),t.activeFormattingElements.insertMarker(),t.framesetOk=!1}function q7(t,e){t.treeAdapter.getDocumentMode(t.document)!==qn.QUIRKS&&t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,G.HTML),t.framesetOk=!1,t.insertionMode=A.IN_TABLE}function CS(t,e){t._reconstructActiveFormattingElements(),t._appendElement(e,G.HTML),t.framesetOk=!1,e.ackSelfClosing=!0}function kS(t){const e=cS(t,Ci.TYPE);return e!=null&&e.toLowerCase()===c7}function W7(t,e){t._reconstructActiveFormattingElements(),t._appendElement(e,G.HTML),kS(e)||(t.framesetOk=!1),e.ackSelfClosing=!0}function G7(t,e){t._appendElement(e,G.HTML),e.ackSelfClosing=!0}function Y7(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._appendElement(e,G.HTML),t.framesetOk=!1,e.ackSelfClosing=!0}function K7(t,e){e.tagName=L.IMG,e.tagID=m.IMG,CS(t,e)}function Q7(t,e){t._insertElement(e,G.HTML),t.skipNextNewLine=!0,t.tokenizer.state=Cn.RCDATA,t.originalInsertionMode=t.insertionMode,t.framesetOk=!1,t.insertionMode=A.TEXT}function X7(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._reconstructActiveFormattingElements(),t.framesetOk=!1,t._switchToTextParsing(e,Cn.RAWTEXT)}function Z7(t,e){t.framesetOk=!1,t._switchToTextParsing(e,Cn.RAWTEXT)}function Gy(t,e){t._switchToTextParsing(e,Cn.RAWTEXT)}function J7(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,G.HTML),t.framesetOk=!1,t.insertionMode=t.insertionMode===A.IN_TABLE||t.insertionMode===A.IN_CAPTION||t.insertionMode===A.IN_TABLE_BODY||t.insertionMode===A.IN_ROW||t.insertionMode===A.IN_CELL?A.IN_SELECT_IN_TABLE:A.IN_SELECT}function eF(t,e){t.openElements.currentTagId===m.OPTION&&t.openElements.pop(),t._reconstructActiveFormattingElements(),t._insertElement(e,G.HTML)}function tF(t,e){t.openElements.hasInScope(m.RUBY)&&t.openElements.generateImpliedEndTags(),t._insertElement(e,G.HTML)}function nF(t,e){t.openElements.hasInScope(m.RUBY)&&t.openElements.generateImpliedEndTagsWithExclusion(m.RTC),t._insertElement(e,G.HTML)}function rF(t,e){t._reconstructActiveFormattingElements(),mS(e),p0(e),e.selfClosing?t._appendElement(e,G.MATHML):t._insertElement(e,G.MATHML),e.ackSelfClosing=!0}function oF(t,e){t._reconstructActiveFormattingElements(),gS(e),p0(e),e.selfClosing?t._appendElement(e,G.SVG):t._insertElement(e,G.SVG),e.ackSelfClosing=!0}function Yy(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,G.HTML)}function nn(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:{$7(t,e);break}case m.A:{V7(t,e);break}case m.H1:case m.H2:case m.H3:case m.H4:case m.H5:case m.H6:{R7(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:{L7(t,e);break}case m.LI:case m.DD:case m.DT:{F7(t,e);break}case m.BR:case m.IMG:case m.WBR:case m.AREA:case m.EMBED:case m.KEYGEN:{CS(t,e);break}case m.HR:{Y7(t,e);break}case m.RB:case m.RTC:{tF(t,e);break}case m.RT:case m.RP:{nF(t,e);break}case m.PRE:case m.LISTING:{P7(t,e);break}case m.XMP:{X7(t,e);break}case m.SVG:{oF(t,e);break}case m.HTML:{M7(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:{kr(t,e);break}case m.BODY:{O7(t,e);break}case m.FORM:{B7(t,e);break}case m.NOBR:{j7(t,e);break}case m.MATH:{rF(t,e);break}case m.TABLE:{q7(t,e);break}case m.INPUT:{W7(t,e);break}case m.PARAM:case m.TRACK:case m.SOURCE:{G7(t,e);break}case m.IMAGE:{K7(t,e);break}case m.BUTTON:{U7(t,e);break}case m.APPLET:case m.OBJECT:case m.MARQUEE:{z7(t,e);break}case m.IFRAME:{Z7(t,e);break}case m.SELECT:{J7(t,e);break}case m.OPTION:case m.OPTGROUP:{eF(t,e);break}case m.NOEMBED:case m.NOFRAMES:{Gy(t,e);break}case m.FRAMESET:{D7(t,e);break}case m.TEXTAREA:{Q7(t,e);break}case m.NOSCRIPT:{t.options.scriptingEnabled?Gy(t,e):Yy(t,e);break}case m.PLAINTEXT:{H7(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:Yy(t,e)}}function iF(t,e){if(t.openElements.hasInScope(m.BODY)&&(t.insertionMode=A.AFTER_BODY,t.options.sourceCodeLocationInfo)){const n=t.openElements.tryPeekProperlyNestedBodyElement();n&&t._setEndLocation(n,e)}}function sF(t,e){t.openElements.hasInScope(m.BODY)&&(t.insertionMode=A.AFTER_BODY,OS(t,e))}function aF(t,e){const n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(n))}function lF(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 cF(t){t.openElements.hasInButtonScope(m.P)||t._insertFakeElement(L.P,m.P),t._closePElement()}function uF(t){t.openElements.hasInListItemScope(m.LI)&&(t.openElements.generateImpliedEndTagsWithExclusion(m.LI),t.openElements.popUntilTagNamePopped(m.LI))}function dF(t,e){const n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTagsWithExclusion(n),t.openElements.popUntilTagNamePopped(n))}function fF(t){t.openElements.hasNumberedHeaderInScope()&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilNumberedHeaderPopped())}function hF(t,e){const n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(n),t.activeFormattingElements.clearToLastMarker())}function pF(t){t._reconstructActiveFormattingElements(),t._insertFakeElement(L.BR,m.BR),t.openElements.pop(),t.framesetOk=!1}function TS(t,e){const n=e.tagName,r=e.tagID;for(let o=t.openElements.stackTop;o>0;o--){const i=t.openElements.items[o],s=t.openElements.tagIDs[o];if(r===s&&(r!==m.UNKNOWN||t.treeAdapter.getTagName(i)===n)){t.openElements.generateImpliedEndTagsWithExclusion(r),t.openElements.stackTop>=o&&t.openElements.shortenToLength(o);break}if(t._isSpecialElement(i,s))break}}function lf(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:{m0(t,e);break}case m.P:{cF(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:{aF(t,e);break}case m.LI:{uF(t);break}case m.DD:case m.DT:{dF(t,e);break}case m.H1:case m.H2:case m.H3:case m.H4:case m.H5:case m.H6:{fF(t);break}case m.BR:{pF(t);break}case m.BODY:{iF(t,e);break}case m.HTML:{sF(t,e);break}case m.FORM:{lF(t);break}case m.APPLET:case m.OBJECT:case m.MARQUEE:{hF(t,e);break}case m.TEMPLATE:{qi(t,e);break}default:TS(t,e)}}function wS(t,e){t.tmplInsertionModeStack.length>0?MS(t,e):g0(t,e)}function mF(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 gF(t,e){t._err(e,U.eofInElementThatCanContainOnlyText),t.openElements.pop(),t.insertionMode=t.originalInsertionMode,t.onEof(e)}function hh(t,e){if(t.openElements.currentTagId!==void 0&&bS.has(t.openElements.currentTagId))switch(t.pendingCharacterTokens.length=0,t.hasNonWhitespacePendingCharacterToken=!1,t.originalInsertionMode=t.insertionMode,t.insertionMode=A.IN_TABLE_TEXT,e.type){case Fe.CHARACTER:{vS(t,e);break}case Fe.WHITESPACE_CHARACTER:{SS(t,e);break}}else $l(t,e)}function bF(t,e){t.openElements.clearBackToTableContext(),t.activeFormattingElements.insertMarker(),t._insertElement(e,G.HTML),t.insertionMode=A.IN_CAPTION}function yF(t,e){t.openElements.clearBackToTableContext(),t._insertElement(e,G.HTML),t.insertionMode=A.IN_COLUMN_GROUP}function EF(t,e){t.openElements.clearBackToTableContext(),t._insertFakeElement(L.COLGROUP,m.COLGROUP),t.insertionMode=A.IN_COLUMN_GROUP,b0(t,e)}function xF(t,e){t.openElements.clearBackToTableContext(),t._insertElement(e,G.HTML),t.insertionMode=A.IN_TABLE_BODY}function CF(t,e){t.openElements.clearBackToTableContext(),t._insertFakeElement(L.TBODY,m.TBODY),t.insertionMode=A.IN_TABLE_BODY,cf(t,e)}function kF(t,e){t.openElements.hasInTableScope(m.TABLE)&&(t.openElements.popUntilTagNamePopped(m.TABLE),t._resetInsertionMode(),t._processStartTag(e))}function TF(t,e){kS(e)?t._appendElement(e,G.HTML):$l(t,e),e.ackSelfClosing=!0}function wF(t,e){!t.formElement&&t.openElements.tmplCount===0&&(t._insertElement(e,G.HTML),t.formElement=t.openElements.current,t.openElements.pop())}function Hs(t,e){switch(e.tagID){case m.TD:case m.TH:case m.TR:{CF(t,e);break}case m.STYLE:case m.SCRIPT:case m.TEMPLATE:{kr(t,e);break}case m.COL:{EF(t,e);break}case m.FORM:{wF(t,e);break}case m.TABLE:{kF(t,e);break}case m.TBODY:case m.TFOOT:case m.THEAD:{xF(t,e);break}case m.INPUT:{TF(t,e);break}case m.CAPTION:{bF(t,e);break}case m.COLGROUP:{yF(t,e);break}default:$l(t,e)}}function wl(t,e){switch(e.tagID){case m.TABLE:{t.openElements.hasInTableScope(m.TABLE)&&(t.openElements.popUntilTagNamePopped(m.TABLE),t._resetInsertionMode());break}case m.TEMPLATE:{qi(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:$l(t,e)}}function $l(t,e){const n=t.fosterParentingEnabled;t.fosterParentingEnabled=!0,af(t,e),t.fosterParentingEnabled=n}function SS(t,e){t.pendingCharacterTokens.push(e)}function vS(t,e){t.pendingCharacterTokens.push(e),t.hasNonWhitespacePendingCharacterToken=!0}function la(t,e){let n=0;if(t.hasNonWhitespacePendingCharacterToken)for(;n<t.pendingCharacterTokens.length;n++)$l(t,t.pendingCharacterTokens[n]);else for(;n<t.pendingCharacterTokens.length;n++)t._insertCharacters(t.pendingCharacterTokens[n]);t.insertionMode=t.originalInsertionMode,t._processToken(e)}const AS=new Set([m.CAPTION,m.COL,m.COLGROUP,m.TBODY,m.TD,m.TFOOT,m.TH,m.THEAD,m.TR]);function SF(t,e){const n=e.tagID;AS.has(n)?t.openElements.hasInTableScope(m.CAPTION)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(m.CAPTION),t.activeFormattingElements.clearToLastMarker(),t.insertionMode=A.IN_TABLE,Hs(t,e)):nn(t,e)}function vF(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=A.IN_TABLE,n===m.TABLE&&wl(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:lf(t,e)}}function b0(t,e){switch(e.tagID){case m.HTML:{nn(t,e);break}case m.COL:{t._appendElement(e,G.HTML),e.ackSelfClosing=!0;break}case m.TEMPLATE:{kr(t,e);break}default:Ru(t,e)}}function AF(t,e){switch(e.tagID){case m.COLGROUP:{t.openElements.currentTagId===m.COLGROUP&&(t.openElements.pop(),t.insertionMode=A.IN_TABLE);break}case m.TEMPLATE:{qi(t,e);break}case m.COL:break;default:Ru(t,e)}}function Ru(t,e){t.openElements.currentTagId===m.COLGROUP&&(t.openElements.pop(),t.insertionMode=A.IN_TABLE,t._processToken(e))}function cf(t,e){switch(e.tagID){case m.TR:{t.openElements.clearBackToTableBodyContext(),t._insertElement(e,G.HTML),t.insertionMode=A.IN_ROW;break}case m.TH:case m.TD:{t.openElements.clearBackToTableBodyContext(),t._insertFakeElement(L.TR,m.TR),t.insertionMode=A.IN_ROW,uf(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=A.IN_TABLE,Hs(t,e));break}default:Hs(t,e)}}function sm(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=A.IN_TABLE);break}case m.TABLE:{t.openElements.hasTableBodyContextInTableScope()&&(t.openElements.clearBackToTableBodyContext(),t.openElements.pop(),t.insertionMode=A.IN_TABLE,wl(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:wl(t,e)}}function uf(t,e){switch(e.tagID){case m.TH:case m.TD:{t.openElements.clearBackToTableRowContext(),t._insertElement(e,G.HTML),t.insertionMode=A.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=A.IN_TABLE_BODY,cf(t,e));break}default:Hs(t,e)}}function _S(t,e){switch(e.tagID){case m.TR:{t.openElements.hasInTableScope(m.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=A.IN_TABLE_BODY);break}case m.TABLE:{t.openElements.hasInTableScope(m.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=A.IN_TABLE_BODY,sm(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=A.IN_TABLE_BODY,sm(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:wl(t,e)}}function _F(t,e){const n=e.tagID;AS.has(n)?(t.openElements.hasInTableScope(m.TD)||t.openElements.hasInTableScope(m.TH))&&(t._closeTableCell(),uf(t,e)):nn(t,e)}function NF(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=A.IN_ROW);break}case m.TABLE:case m.TBODY:case m.TFOOT:case m.THEAD:case m.TR:{t.openElements.hasInTableScope(n)&&(t._closeTableCell(),_S(t,e));break}case m.BODY:case m.CAPTION:case m.COL:case m.COLGROUP:case m.HTML:break;default:lf(t,e)}}function NS(t,e){switch(e.tagID){case m.HTML:{nn(t,e);break}case m.OPTION:{t.openElements.currentTagId===m.OPTION&&t.openElements.pop(),t._insertElement(e,G.HTML);break}case m.OPTGROUP:{t.openElements.currentTagId===m.OPTION&&t.openElements.pop(),t.openElements.currentTagId===m.OPTGROUP&&t.openElements.pop(),t._insertElement(e,G.HTML);break}case m.HR:{t.openElements.currentTagId===m.OPTION&&t.openElements.pop(),t.openElements.currentTagId===m.OPTGROUP&&t.openElements.pop(),t._appendElement(e,G.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:{kr(t,e);break}}}function IS(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:{qi(t,e);break}}}function IF(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)):NS(t,e)}function MF(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)):IS(t,e)}function OF(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:{kr(t,e);break}case m.CAPTION:case m.COLGROUP:case m.TBODY:case m.TFOOT:case m.THEAD:{t.tmplInsertionModeStack[0]=A.IN_TABLE,t.insertionMode=A.IN_TABLE,Hs(t,e);break}case m.COL:{t.tmplInsertionModeStack[0]=A.IN_COLUMN_GROUP,t.insertionMode=A.IN_COLUMN_GROUP,b0(t,e);break}case m.TR:{t.tmplInsertionModeStack[0]=A.IN_TABLE_BODY,t.insertionMode=A.IN_TABLE_BODY,cf(t,e);break}case m.TD:case m.TH:{t.tmplInsertionModeStack[0]=A.IN_ROW,t.insertionMode=A.IN_ROW,uf(t,e);break}default:t.tmplInsertionModeStack[0]=A.IN_BODY,t.insertionMode=A.IN_BODY,nn(t,e)}}function DF(t,e){e.tagID===m.TEMPLATE&&qi(t,e)}function MS(t,e){t.openElements.tmplCount>0?(t.openElements.popUntilTagNamePopped(m.TEMPLATE),t.activeFormattingElements.clearToLastMarker(),t.tmplInsertionModeStack.shift(),t._resetInsertionMode(),t.onEof(e)):g0(t,e)}function LF(t,e){e.tagID===m.HTML?nn(t,e):Pu(t,e)}function OS(t,e){var n;if(e.tagID===m.HTML){if(t.fragmentContext||(t.insertionMode=A.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 Pu(t,e)}function Pu(t,e){t.insertionMode=A.IN_BODY,af(t,e)}function RF(t,e){switch(e.tagID){case m.HTML:{nn(t,e);break}case m.FRAMESET:{t._insertElement(e,G.HTML);break}case m.FRAME:{t._appendElement(e,G.HTML),e.ackSelfClosing=!0;break}case m.NOFRAMES:{kr(t,e);break}}}function PF(t,e){e.tagID===m.FRAMESET&&!t.openElements.isRootHtmlElementCurrent()&&(t.openElements.pop(),!t.fragmentContext&&t.openElements.currentTagId!==m.FRAMESET&&(t.insertionMode=A.AFTER_FRAMESET))}function BF(t,e){switch(e.tagID){case m.HTML:{nn(t,e);break}case m.NOFRAMES:{kr(t,e);break}}}function FF(t,e){e.tagID===m.HTML&&(t.insertionMode=A.AFTER_AFTER_FRAMESET)}function HF(t,e){e.tagID===m.HTML?nn(t,e):Gc(t,e)}function Gc(t,e){t.insertionMode=A.IN_BODY,af(t,e)}function UF(t,e){switch(e.tagID){case m.HTML:{nn(t,e);break}case m.NOFRAMES:{kr(t,e);break}}}function VF(t,e){e.chars=lt,t._insertCharacters(e)}function $F(t,e){t._insertCharacters(e),t.framesetOk=!1}function DS(t){for(;t.treeAdapter.getNamespaceURI(t.openElements.current)!==G.HTML&&t.openElements.currentTagId!==void 0&&!t._isIntegrationPoint(t.openElements.currentTagId,t.openElements.current);)t.openElements.pop()}function jF(t,e){if(o7(e))DS(t),t._startTagOutsideForeignContent(e);else{const n=t._getAdjustedCurrentElement(),r=t.treeAdapter.getNamespaceURI(n);r===G.MATHML?mS(e):r===G.SVG&&(i7(e),gS(e)),p0(e),e.selfClosing?t._appendElement(e,r):t._insertElement(e,r),e.ackSelfClosing=!0}}function zF(t,e){if(e.tagID===m.P||e.tagID===m.BR){DS(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)===G.HTML){t._endTagOutsideForeignContent(e);break}const o=t.treeAdapter.getTagName(r);if(o.toLowerCase()===e.tagName){e.tagName=o,t.openElements.shortenToLength(n);break}}}L.AREA,L.BASE,L.BASEFONT,L.BGSOUND,L.BR,L.COL,L.EMBED,L.FRAME,L.HR,L.IMG,L.INPUT,L.KEYGEN,L.LINK,L.META,L.PARAM,L.SOURCE,L.TRACK,L.WBR;function qF(t,e){return yS.parse(t,e)}function WF(t,e,n){typeof t=="string"&&(n=e,e=t,t=null);const r=yS.getFragmentParser(t,n);return r.tokenizer.write(e,!0),r.getFragment()}function Fa(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?Ky(t.position):"start"in t||"end"in t?Ky(t):"line"in t||"column"in t?am(t):""}function am(t){return Qy(t&&t.line)+":"+Qy(t&&t.column)}function Ky(t){return am(t&&t.start)+"-"+am(t&&t.end)}function Qy(t){return t&&typeof t=="number"?t:1}class hn extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let o="",i={},s=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof e=="string"?o=e:!i.cause&&e&&(s=!0,o=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const a=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=a?a.line:void 0,this.name=Fa(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}hn.prototype.file="";hn.prototype.name="";hn.prototype.reason="";hn.prototype.message="";hn.prototype.stack="";hn.prototype.column=void 0;hn.prototype.line=void 0;hn.prototype.ancestors=void 0;hn.prototype.cause=void 0;hn.prototype.fatal=void 0;hn.prototype.place=void 0;hn.prototype.ruleId=void 0;hn.prototype.source=void 0;const vr={basename:GF,dirname:YF,extname:KF,join:QF,sep:"/"};function GF(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');jl(t);let n=0,r=-1,o=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;o--;)if(t.codePointAt(o)===47){if(i){n=o+1;break}}else r<0&&(i=!0,r=o+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let s=-1,a=e.length-1;for(;o--;)if(t.codePointAt(o)===47){if(i){n=o+1;break}}else s<0&&(i=!0,s=o+1),a>-1&&(t.codePointAt(o)===e.codePointAt(a--)?a<0&&(r=o):(a=-1,r=s));return n===r?r=s:r<0&&(r=t.length),t.slice(n,r)}function YF(t){if(jl(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 KF(t){jl(t);let e=t.length,n=-1,r=0,o=-1,i=0,s;for(;e--;){const a=t.codePointAt(e);if(a===47){if(s){r=e+1;break}continue}n<0&&(s=!0,n=e+1),a===46?o<0?o=e:i!==1&&(i=1):o>-1&&(i=-1)}return o<0||n<0||i===0||i===1&&o===n-1&&o===r+1?"":t.slice(o,n)}function QF(...t){let e=-1,n;for(;++e<t.length;)jl(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":XF(n)}function XF(t){jl(t);const e=t.codePointAt(0)===47;let n=ZF(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function ZF(t,e){let n="",r=0,o=-1,i=0,s=-1,a,l;for(;++s<=t.length;){if(s<t.length)a=t.codePointAt(s);else{if(a===47)break;a=47}if(a===47){if(!(o===s-1||i===1))if(o!==s-1&&i===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("/")),o=s,i=0;continue}}else if(n.length>0){n="",r=0,o=s,i=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(o+1,s):n=t.slice(o+1,s),r=s-o-1;o=s,i=0}else a===46&&i>-1?i++:i=-1}return n}function jl(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const JF={cwd:eH};function eH(){return"/"}function lm(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function tH(t){if(typeof t=="string")t=new URL(t);else if(!lm(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 nH(t)}function nH(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 o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(e)}const ph=["history","path","basename","stem","extname","dirname"];class cm{constructor(e){let n;e?lm(e)?n={path:e}:typeof e=="string"||rH(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":JF.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<ph.length;){const i=ph[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let o;for(o in n)ph.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?vr.basename(this.path):void 0}set basename(e){gh(e,"basename"),mh(e,"basename"),this.path=vr.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?vr.dirname(this.path):void 0}set dirname(e){Xy(this.basename,"dirname"),this.path=vr.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?vr.extname(this.path):void 0}set extname(e){if(mh(e,"extname"),Xy(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=vr.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){lm(e)&&(e=tH(e)),gh(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?vr.basename(this.path,this.extname):void 0}set stem(e){gh(e,"stem"),mh(e,"stem"),this.path=vr.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){const o=this.message(e,n,r);throw o.fatal=!0,o}info(e,n,r){const o=this.message(e,n,r);return o.fatal=void 0,o}message(e,n,r){const o=new hn(e,n,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function mh(t,e){if(t&&t.includes(vr.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+vr.sep+"`")}function gh(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function Xy(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function rH(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const oH={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"}},iH="https://html.spec.whatwg.org/multipage/parsing.html#parse-error-",sH=/-[a-z]/g,aH=/%c(?:([-+])(\d+))?/g,lH=/%x/g,cH={2:!0,1:!1,0:null},uH={};function dH(t,e){const n=e||uH,r=n.onerror,o=t instanceof cm?t:new cm(t),i=n.fragment?WF:qF,s=String(o),a=i(s,{sourceCodeLocationInfo:!0,onParseError:n.onerror?l:null,scriptingEnabled:!1});return p9(a,{file:o,space:n.space,verbose:n.verbose});function l(c){const u=c.code,d=fH(u),f=n[d],h=f??!0,p=typeof h=="number"?h:h?1:0;if(p){const b=oH[d],E=new hn(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"});o.path&&(E.file=o.path,E.name=o.path+":"+E.name),E.fatal=cH[p],E.note=g(b.description),E.url=b.url===!1?void 0:iH+u,r(E)}function g(b){return b.replace(aH,E).replace(lH,x);function E(T,D,O){const v=(O?Number.parseInt(O,10):0)*(D==="-"?-1:1),R=s.charAt(c.startOffset+v);return pH(R)}function x(){return mH(s.charCodeAt(c.startOffset))}}}}function fH(t){return t.replace(sH,hH)}function hH(t){return t.charAt(1).toUpperCase()}function pH(t){return t==="`"?"` ` `":t}function mH(t){return"0x"+t.toString(16).toUpperCase()}function gH(t){const e=this,{emitParseErrors:n,...r}={...e.data("settings"),...t};e.parser=o;function o(i,s){return dH(i,{...r,onerror:n?function(a){s.path&&(a.name=s.path+":"+a.name,a.file=s.path),s.messages.push(a)}:void 0})}}const LS=-1,df=0,Ha=1,Bu=2,y0=3,E0=4,x0=5,C0=6,RS=7,PS=8,Zy=typeof self=="object"?self:globalThis,bH=(t,e)=>{const n=(o,i)=>(t.set(i,o),o),r=o=>{if(t.has(o))return t.get(o);const[i,s]=e[o];switch(i){case df:case LS:return n(s,o);case Ha:{const a=n([],o);for(const l of s)a.push(r(l));return a}case Bu:{const a=n({},o);for(const[l,c]of s)a[r(l)]=r(c);return a}case y0:return n(new Date(s),o);case E0:{const{source:a,flags:l}=s;return n(new RegExp(a,l),o)}case x0:{const a=n(new Map,o);for(const[l,c]of s)a.set(r(l),r(c));return a}case C0:{const a=n(new Set,o);for(const l of s)a.add(r(l));return a}case RS:{const{name:a,message:l}=s;return n(new Zy[a](l),o)}case PS:return n(BigInt(s),o);case"BigInt":return n(Object(BigInt(s)),o);case"ArrayBuffer":return n(new Uint8Array(s).buffer,s);case"DataView":{const{buffer:a}=new Uint8Array(s);return n(new DataView(a),s)}}return n(new Zy[i](s),o)};return r},Jy=t=>bH(new Map,t)(0),Xi="",{toString:yH}={},{keys:EH}=Object,ca=t=>{const e=typeof t;if(e!=="object"||!t)return[df,e];const n=yH.call(t).slice(8,-1);switch(n){case"Array":return[Ha,Xi];case"Object":return[Bu,Xi];case"Date":return[y0,Xi];case"RegExp":return[E0,Xi];case"Map":return[x0,Xi];case"Set":return[C0,Xi];case"DataView":return[Ha,n]}return n.includes("Array")?[Ha,n]:n.includes("Error")?[RS,n]:[Bu,n]},bc=([t,e])=>t===df&&(e==="function"||e==="symbol"),xH=(t,e,n,r)=>{const o=(s,a)=>{const l=r.push(s)-1;return n.set(a,l),l},i=s=>{if(n.has(s))return n.get(s);let[a,l]=ca(s);switch(a){case df:{let u=s;switch(l){case"bigint":a=PS,u=s.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return o([LS],s)}return o([a,u],s)}case Ha:{if(l){let f=s;return l==="DataView"?f=new Uint8Array(s.buffer):l==="ArrayBuffer"&&(f=new Uint8Array(s)),o([l,[...f]],s)}const u=[],d=o([a,u],s);for(const f of s)u.push(i(f));return d}case Bu:{if(l)switch(l){case"BigInt":return o([l,s.toString()],s);case"Boolean":case"Number":case"String":return o([l,s.valueOf()],s)}if(e&&"toJSON"in s)return i(s.toJSON());const u=[],d=o([a,u],s);for(const f of EH(s))(t||!bc(ca(s[f])))&&u.push([i(f),i(s[f])]);return d}case y0:return o([a,s.toISOString()],s);case E0:{const{source:u,flags:d}=s;return o([a,{source:u,flags:d}],s)}case x0:{const u=[],d=o([a,u],s);for(const[f,h]of s)(t||!(bc(ca(f))||bc(ca(h))))&&u.push([i(f),i(h)]);return d}case C0:{const u=[],d=o([a,u],s);for(const f of s)(t||!bc(ca(f)))&&u.push(i(f));return d}}const{message:c}=s;return o([a,{name:l,message:c}],s)};return i},eE=(t,{json:e,lossy:n}={})=>{const r=[];return xH(!(e||n),!!e,new Map,r)(t),r},Us=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Jy(eE(t,e)):structuredClone(t):(t,e)=>Jy(eE(t,e)),k0=(function(t,e,n,r,o){const i=Tr(e);return BS(t)?i.call(o,t,n,r):!1}),Tr=(function(t){if(t==null)return TH;if(typeof t=="string")return kH(t);if(typeof t=="object")return CH(t);if(typeof t=="function")return T0(t);throw new Error("Expected function, string, or array as `test`")});function CH(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=Tr(t[n]);return T0(r);function r(...o){let i=-1;for(;++i<e.length;)if(e[i].apply(this,o))return!0;return!1}}function kH(t){return T0(e);function e(n){return n.tagName===t}}function T0(t){return e;function e(n,r,o){return!!(BS(n)&&t.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function TH(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="element"&&"tagName"in t&&typeof t.tagName=="string")}function BS(t){return t!==null&&typeof t=="object"&&"type"in t&&"tagName"in t}const FS=Tr(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"}),wH=/[ \t\n\f\r]/g;function zl(t){return typeof t=="object"?t.type==="text"?tE(t.value):!1:tE(t)}function tE(t){return t.replace(wH,"")===""}const Zs=(function(t){if(t==null)return _H;if(typeof t=="function")return ff(t);if(typeof t=="object")return Array.isArray(t)?SH(t):vH(t);if(typeof t=="string")return AH(t);throw new Error("Expected function, string, or object as test")});function SH(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=Zs(t[n]);return ff(r);function r(...o){let i=-1;for(;++i<e.length;)if(e[i].apply(this,o))return!0;return!1}}function vH(t){const e=t;return ff(n);function n(r){const o=r;let i;for(i in t)if(o[i]!==e[i])return!1;return!0}}function AH(t){return ff(e);function e(n){return n&&n.type===t}}function ff(t){return e;function e(n,r,o){return!!(NH(n)&&t.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function _H(){return!0}function NH(t){return t!==null&&typeof t=="object"&&"type"in t}const IH=["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"],MH=["button","input","select","textarea"],OH=["area","base","basefont","dialog","datalist","head","link","meta","noembed","noframes","param","rp","script","source","style","template","track","title"],DH={},w0=Zs(["comment","doctype"]);function LH(t,e){HS(t,{collapse:VH((e||DH).newlines?HH:UH),whitespace:"normal"})}function HS(t,e){if("children"in t){const n={...e};return(t.type==="root"||$S(t))&&(n.before=!0,n.after=!0),n.whitespace=$H(t,e),PH(t,n)}if(t.type==="text"){if(e.whitespace==="normal")return RH(t,e);e.whitespace==="nowrap"&&(t.value=e.collapse(t.value))}return{ignore:w0(t),stripAtStart:!1,remove:!1}}function RH(t,e){const n=e.collapse(t.value),r={ignore:!1,stripAtStart:!1,remove:!1};let o=0,i=n.length;return e.before&&nE(n.charAt(0))&&o++,o!==i&&nE(n.charAt(i-1))&&(e.after?i--:r.stripAtStart=!0),o===i?r.remove=!0:t.value=n.slice(o,i),r}function PH(t,e){let n=e.before;const r=e.after,o=t.children;let i=o.length,s=-1;for(;++s<i;){const a=HS(o[s],{...e,after:US(o,s,r),before:n});a.remove?(o.splice(s,1),s--,i--):a.ignore||(n=a.stripAtStart),VS(o[s])&&(n=!1)}return{ignore:!1,stripAtStart:!!(n||r),remove:!1}}function US(t,e,n){for(;++e<t.length;){const r=t[e];let o=BH(r);if(o===void 0&&"children"in r&&!FH(r)&&(o=US(r.children,-1)),typeof o=="boolean")return o}return n}function BH(t){if(t.type==="element"){if(VS(t))return!1;if($S(t))return!0}else if(t.type==="text"){if(!zl(t))return!1}else if(!w0(t))return!1}function VS(t){return FS(t)||k0(t,MH)}function $S(t){return k0(t,IH)}function FH(t){return!!(t.type==="element"&&t.properties.hidden)||w0(t)||k0(t,OH)}function nE(t){return t===" "||t===`
|
|
115
|
+
`}function HH(t){const e=/\r?\n|\r/.exec(t);return e?e[0]:" "}function UH(){return" "}function VH(t){return e;function e(n){return String(n).replace(/[\t\n\v\f\r ]+/g,t)}}function $H(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 jH(t){return function(e){LH(e,t)}}const jS=[],zH=!0,Fu=!1,zS="skip";function qS(t,e,n,r){let o;typeof e=="function"&&typeof n!="function"?(r=n,n=e):o=e;const i=Zs(o),s=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 h=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(h?"<"+h+">":""))+")"})}return f;function f(){let h=jS,p,g,b;if((!e||i(l,c,u[u.length-1]||void 0))&&(h=qH(n(l,u)),h[0]===Fu))return h;if("children"in l&&l.children){const E=l;if(E.children&&h[0]!==zS)for(g=(r?E.children.length:-1)+s,b=u.concat(E);g>-1&&g<E.children.length;){const x=E.children[g];if(p=a(x,g,b)(),p[0]===Fu)return p;g=typeof p[1]=="number"?p[1]:g+s}}return h}}}function qH(t){return Array.isArray(t)?t:typeof t=="number"?[zH,t]:t==null?jS:[t]}function Bi(t,e,n,r){let o,i,s;typeof e=="function"&&typeof n!="function"?(i=void 0,s=e,o=n):(i=e,s=n,o=r),qS(t,i,a,o);function a(l,c){const u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return s(l,d,u)}}const WS=YS("end"),GS=YS("start");function YS(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 KS(t){const e=GS(t),n=WS(t);if(e&&n)return{start:e,end:n}}function WH(t,e){const n=e.properties||{},r=t.all(e),o={type:"link",url:t.resolve(String(n.href||"")||null),title:n.title?String(n.title):null,children:r};return t.patch(e,o),o}function GH(t,e){t.baseFound||(t.frozenBaseUrl=String(e.properties&&e.properties.href||"")||void 0,t.baseFound=!0)}function YH(t,e){const n={type:"blockquote",children:t.toFlow(t.all(e))};return t.patch(e,n),n}function KH(t,e){const n={type:"break"};return t.patch(e,n),n}const rE=(function(t,e,n){const r=Zs(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]}),oE=/\n/g,iE=/[\t ]+/g,um=Tr("br"),sE=Tr(nU),QH=Tr("p"),aE=Tr("tr"),XH=Tr(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",tU,rU]),QS=Tr(["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 ql(t,e){const n={},r="children"in t?t.children:[],o=QS(t),i=JS(t,{whitespace:n.whitespace||"normal"}),s=[];(t.type==="text"||t.type==="comment")&&s.push(...ZS(t,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<r.length;)s.push(...XS(r[a],t,{whitespace:i,breakBefore:a?void 0:o,breakAfter:a<r.length-1?um(r[a+1]):o}));const l=[];let c;for(a=-1;++a<s.length;){const u=s[a];typeof u=="number"?c!==void 0&&u>c&&(c=u):u&&(c!==void 0&&c>-1&&l.push(`
|
|
116
|
+
`.repeat(c)||" "),c=-1,l.push(u))}return l.join("")}function XS(t,e,n){return t.type==="element"?ZH(t,e,n):t.type==="text"?n.whitespace==="normal"?ZS(t,n):JH(t):[]}function ZH(t,e,n){const r=JS(t,n),o=t.children||[];let i=-1,s=[];if(XH(t))return s;let a,l;for(um(t)||aE(t)&&rE(e,t,aE)?l=`
|
|
117
|
+
`:QH(t)?(a=2,l=2):QS(t)&&(a=1,l=1);++i<o.length;)s=s.concat(XS(o[i],t,{whitespace:r,breakBefore:i?void 0:a,breakAfter:i<o.length-1?um(o[i+1]):l}));return sE(t)&&rE(e,t,sE)&&s.push(" "),a&&s.unshift(a),l&&s.push(l),s}function ZS(t,e){const n=String(t.value),r=[],o=[];let i=0;for(;i<=n.length;){oE.lastIndex=i;const l=oE.exec(n),c=l&&"index"in l?l.index:n.length;r.push(eU(n.slice(i,c).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),i===0?e.breakBefore:!0,c===n.length?e.breakAfter:!0)),i=c+1}let s=-1,a;for(;++s<r.length;)r[s].charCodeAt(r[s].length-1)===8203||s<r.length-1&&r[s+1].charCodeAt(0)===8203?(o.push(r[s]),a=void 0):r[s]?(typeof a=="number"&&o.push(a),o.push(r[s]),a=0):(s===0||s===r.length-1)&&o.push(0);return o}function JH(t){return[String(t.value)]}function eU(t,e,n){const r=[];let o=0,i;for(;o<t.length;){iE.lastIndex=o;const s=iE.exec(t);i=s?s.index:t.length,!o&&!i&&s&&!e&&r.push(""),o!==i&&r.push(t.slice(o,i)),o=s?i+s[0].length:i}return o!==i&&!n&&r.push(""),r.join(" ")}function JS(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 tU(t){return!!(t.properties||{}).hidden}function nU(t){return t.tagName==="td"||t.tagName==="th"}function rU(t){return t.tagName==="dialog"&&!(t.properties||{}).open}function oU(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 bh="language-";function yc(t,e){const n=e.children;let r=-1,o,i;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)){o=a.properties.className;break}}if(o){for(r=-1;++r<o.length;)if(String(o[r]).slice(0,bh.length)===bh){i=String(o[r]).slice(bh.length);break}}const s={type:"code",lang:i||null,meta:null,value:oU(ql(e))};return t.patch(e,s),s}function iU(t,e){const n={type:"html",value:"<!--"+e.value+"-->"};return t.patch(e,n),n}function yh(t,e){const r={type:"delete",children:t.all(e)};return t.patch(e,r),r}function S0(t){let e=-1;if(t.length>1){for(;++e<t.length;)if(t[e].spread)return!0}return!1}function sU(t,e){const n=[],r=[];let o=-1;for(;++o<e.children.length;){const a=e.children[o];a.type==="element"&&a.tagName==="div"?n.push(...a.children):n.push(a)}let i={definitions:[],titles:[]};for(o=-1;++o<n.length;){const a=n[o];if(a.type==="element"&&a.tagName==="dt"){const l=n[o-1];l&&l.type==="element"&&l.tagName==="dd"&&(r.push(i),i={definitions:[],titles:[]}),i.titles.push(a)}else i.definitions.push(a)}r.push(i),o=-1;const s=[];for(;++o<r.length;){const a=[...lE(t,r[o].titles),...lE(t,r[o].definitions)];a.length>0&&s.push({type:"listItem",spread:a.length>1,checked:null,children:a})}if(s.length>0){const a={type:"list",ordered:!1,start:null,spread:S0(s),children:s};return t.patch(e,a),a}}function lE(t,e){const n=t.all({type:"root",children:e}),r=t.toSpecificContent(n,aU);return r.length===0?[]:r.length===1?r[0].children:[{type:"list",ordered:!1,start:null,spread:S0(r),children:r}]}function aU(){return{type:"listItem",spread:!1,checked:null,children:[]}}function Ec(t,e){const r={type:"emphasis",children:t.all(e)};return t.patch(e,r),r}function v0(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 Zi(t,e){const n=Number(e.tagName.charAt(1))||1,r=v0(t.all(e)),o={type:"heading",depth:n,children:r};return t.patch(e,o),o}function lU(t,e){const n={type:"thematicBreak"};return t.patch(e,n),n}function cU(t,e){const n=e.properties||{},r=String(n.src||""),o=String(n.title||"");if(r&&o){const i={type:"link",title:null,url:t.resolve(r),children:[{type:"text",value:o}]};return t.patch(e,i),i}}function cE(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 ua(t,e){const n={type:"inlineCode",value:ql(e)};return t.patch(e,n),n}function ev(t,e){const n=[],r=[],o=e||t.properties||{},i=tv(t),s=Math.min(Number.parseInt(String(o.size),10),0)||(o.multiple?4:1);let a=-1;for(;++a<i.length;){const u=i[a];u&&u.properties&&u.properties.selected&&n.push(u)}const l=n.length>0?n:i,c=Math.min(l.length,s);for(a=-1;++a<c;){const u=l[a],d=u.properties||{},f=ql(u),h=f||String(d.label||""),p=String(d.value||"")||f;r.push([p,h===p?void 0:h])}return r}function tv(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(...tv(r)),r.type==="element"&&r.tagName==="option"&&(!r.properties||!r.properties.disabled)&&e.push(r)}return e}const uU="[x]",dU="[ ]";function fU(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||uU:t.options.unchecked||dU};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 o=[];if(r)o=[[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"&&(o=ev(c,n))}if(o.length===0)return;if(n.type==="password"&&(o[0]=["•".repeat(o[0][0].length),void 0]),n.type==="email"||n.type==="url"){const l=[];let c=-1;for(;++c<o.length;){const u=t.resolve(o[c][0]),d={type:"link",title:null,url:n.type==="email"?"mailto:"+u:u,children:[{type:"text",value:o[c][1]||u}]};l.push(d),c!==o.length-1&&l.push({type:"text",value:", "})}return l}const i=[];let s=-1;for(;++s<o.length;)i.push(o[s][1]?o[s][1]+" ("+o[s][0]+")":o[s][0]);const a={type:"text",value:i.join(", ")};return t.patch(e,a),a}const hU={}.hasOwnProperty;function pU(t,e){const n=t.type==="element"&&hU.call(t.properties,e)&&t.properties[e];return n!=null&&n!==!1}const mU=new Set(["pingback","prefetch","stylesheet"]);function gU(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(!mU.has(String(e[n])))return!1;return!0}const bU=Tr(["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"]),yU=Tr("meta");function nv(t){return!!(t.type==="text"||bU(t)||FS(t)||gU(t)||yU(t)&&pU(t,"itemProp"))}function Eh(t,e){const{rest:n,checkbox:r}=ov(e),o=r?!!r.properties.checked:null,i=rv(n),s=t.toFlow(t.all(n)),a={type:"listItem",spread:i,checked:o,children:s};return t.patch(e,a),a}function rv(t){let e=-1,n=!1;for(;++e<t.children.length;){const r=t.children[e];if(r.type==="element"){if(nv(r))continue;if(r.tagName==="p"||n||rv(r))return!0;n=!0}}return!1}function ov(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}=ov(e);if(n){const o={...t,children:[r,...t.children.slice(1)]};return{checkbox:n,rest:o}}}return{checkbox:void 0,rest:t}}function xh(t,e){const n=e.tagName==="ol",r=t.toSpecificContent(t.all(e),EU);let o=null;n&&(o=e.properties&&e.properties.start?Number.parseInt(String(e.properties.start),10):1);const i={type:"list",ordered:n,start:o,spread:S0(r),children:r};return t.patch(e,i),i}function EU(){return{type:"listItem",spread:!1,checked:null,children:[]}}const xU={};function hf(t,e){const n=xU,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return iv(t,r,o)}function iv(t,e,n){if(CU(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 uE(t.children,e,n)}return Array.isArray(t)?uE(t,e,n):""}function uE(t,e,n){const r=[];let o=-1;for(;++o<t.length;)r[o]=iv(t[o],e,n);return r.join("")}function CU(t){return!!(t&&typeof t=="object")}const sv=Zs(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function pf(t){let e=-1;for(;++e<t.length;){const n=t[e];if(!cv(n)||"children"in n&&pf(n.children))return!0}return!1}function av(t){return lv(t,e,function(n){return n});function e(n){return n.every(function(r){return r.type==="text"?zl(r.value):!1})?[]:[{type:"paragraph",children:v0(n)}]}}function kU(t){return lv(t.children,e,n);function e(r){const o=Ch(t);return o.children=r,[o]}function n(r){if("children"in r&&"children"in t){const o=Ch(t),i=Ch(r);return o.children=r.children,i.children.push(o),i}return{...r}}}function lv(t,e,n){const r=TU(t),o=[];let i=[],s=-1;for(;++s<r.length;){const a=r[s];cv(a)?i.push(a):(i.length>0&&(o.push(...e(i)),i=[]),o.push(n(a)))}return i.length>0&&(o.push(...e(i)),i=[]),o}function TU(t){const e=[];let n=-1;for(;++n<t.length;){const r=t[n];(r.type==="delete"||r.type==="link")&&pf(r.children)?e.push(...kU(r)):e.push(r)}return e}function cv(t){const e=t.data&&t.data.hName;return e?nv({type:"element",tagName:e,properties:{},children:[]}):sv(t)}function Ch(t){return Us({...t,children:[]})}function dE(t,e){const n=e.properties||{},r=e.tagName==="video"?String(n.poster||""):"";let o=String(n.src||""),i=-1,s=!1,a=t.all(e);if(Bi({type:"root",children:a},function(d){if(d.type==="link")return s=!0,Fu}),s||pf(a))return a;for(;!o&&++i<e.children.length;){const d=e.children[i];d.type==="element"&&d.tagName==="source"&&d.properties&&(o=String(d.properties.src||""))}if(r){const d={type:"image",title:null,url:t.resolve(r),alt:hf(a)};t.patch(e,d),a=[d]}const c=a,u={type:"link",title:n.title?String(n.title):null,url:t.resolve(o),children:c};return t.patch(e,u),u}function fE(t,e){const n=v0(t.all(e));if(n.length>0){const r={type:"paragraph",children:n};return t.patch(e,r),r}}const wU=['"'];function SU(t,e){const n=t.options.quotes||wU;t.qNesting++;const r=t.all(e);t.qNesting--;const o=n[t.qNesting%n.length],i=r[0],s=r[r.length-1],a=o.charAt(0),l=o.length>1?o.charAt(1):o;return i&&i.type==="text"?i.value=a+i.value:r.unshift({type:"text",value:a}),s&&s.type==="text"?s.value+=l:r.push({type:"text",value:l}),r}function vU(t,e){let n=t.all(e);(t.options.document||pf(n))&&(n=av(n));const r={type:"root",children:n};return t.patch(e,r),r}function AU(t,e){const n=ev(e);let r=-1;const o=[];for(;++r<n.length;){const i=n[r];o.push(i[1]?i[1]+" ("+i[0]+")":i[0])}if(o.length>0){const i={type:"text",value:o.join(", ")};return t.patch(e,i),i}}function hE(t,e){const r={type:"strong",children:t.all(e)};return t.patch(e,r),r}function pE(t,e){const r={type:"tableCell",children:t.all(e)};if(t.patch(e,r),e.properties){const o=e.properties.rowSpan,i=e.properties.colSpan;if(o||i){const s=r.data||(r.data={});o&&(s.hastUtilToMdastTemporaryRowSpan=o),i&&(s.hastUtilToMdastTemporaryColSpan=i)}}return r}function _U(t,e){const r={type:"tableRow",children:t.toSpecificContent(t.all(e),NU)};return t.patch(e,r),r}function NU(){return{type:"tableCell",children:[]}}function IU(t,e){if(t.inTable){const c={type:"text",value:ql(e)};return t.patch(e,c),c}t.inTable=!0;const{align:n,headless:r}=MU(e),o=t.toSpecificContent(t.all(e),mE);r&&o.unshift(mE());let i=-1;for(;++i<o.length;){const c=o[i],u=t.toSpecificContent(c.children,OU);c.children=u}let s=1;for(i=-1;++i<o.length;){const c=o[i].children;let u=-1;for(;++u<c.length;){const d=c[u];if(d.data){const f=d.data,h=Number.parseInt(String(f.hastUtilToMdastTemporaryColSpan),10)||1,p=Number.parseInt(String(f.hastUtilToMdastTemporaryRowSpan),10)||1;if(h>1||p>1){let g=i-1;for(;++g<i+p;){let b=u-1;for(;++b<u+h&&o[g];){const E=[];(g!==i||b!==u)&&E.push({type:"tableCell",children:[]}),o[g].children.splice(b,0,...E)}}}"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>s&&(s=c.length)}for(i=-1;++i<o.length;){const c=o[i].children;let u=c.length-1;for(;++u<s;)c.push({type:"tableCell",children:[]})}let a=n.length-1;for(;++a<s;)n.push(null);t.inTable=!1;const l={type:"table",align:n,children:o};return t.patch(e,l),l}function MU(t){const e={align:[null],headless:!0};let n=0,r=0;return Bi(t,function(o){if(o.type==="element"){if(o.tagName==="table"&&t!==o)return zS;if((o.tagName==="th"||o.tagName==="td")&&o.properties){if(!e.align[r]){const i=String(o.properties.align||"")||null;(i==="center"||i==="left"||i==="right"||i===null)&&(e.align[r]=i)}e.headless&&n<2&&o.tagName==="th"&&(e.headless=!1),r++}else o.tagName==="thead"?e.headless=!1:o.tagName==="tr"&&(n++,r=0)}}),e}function OU(){return{type:"tableCell",children:[]}}function mE(){return{type:"tableRow",children:[]}}function DU(t,e){const n={type:"text",value:e.value};return t.patch(e,n),n}function LU(t,e){const n={type:"text",value:ql(e)};return t.patch(e,n),n}function RU(t,e){const n={type:"text",value:""};return t.patch(e,n),n}const PU={comment:iU,doctype:Ne,root:vU,text:DU},BU={applet:Ne,area:Ne,basefont:Ne,bgsound:Ne,caption:Ne,col:Ne,colgroup:Ne,command:Ne,content:Ne,datalist:Ne,dialog:Ne,element:Ne,embed:Ne,frame:Ne,frameset:Ne,isindex:Ne,keygen:Ne,link:Ne,math:Ne,menu:Ne,menuitem:Ne,meta:Ne,nextid:Ne,noembed:Ne,noframes:Ne,optgroup:Ne,option:Ne,param:Ne,script:Ne,shadow:Ne,source:Ne,spacer:Ne,style:Ne,svg:Ne,template:Ne,title:Ne,track:Ne,abbr:_e,acronym:_e,bdi:_e,bdo:_e,big:_e,blink:_e,button:_e,canvas:_e,cite:_e,data:_e,details:_e,dfn:_e,font:_e,ins:_e,label:_e,map:_e,marquee:_e,meter:_e,nobr:_e,noscript:_e,object:_e,output:_e,progress:_e,rb:_e,rbc:_e,rp:_e,rt:_e,rtc:_e,ruby:_e,slot:_e,small:_e,span:_e,sup:_e,sub:_e,tbody:_e,tfoot:_e,thead:_e,time:_e,address:kt,article:kt,aside:kt,body:kt,center:kt,div:kt,fieldset:kt,figcaption:kt,figure:kt,form:kt,footer:kt,header:kt,hgroup:kt,html:kt,legend:kt,main:kt,multicol:kt,nav:kt,picture:kt,section:kt,a:WH,audio:dE,b:hE,base:GH,blockquote:YH,br:KH,code:ua,dir:xh,dl:sU,dt:Eh,dd:Eh,del:yh,em:Ec,h1:Zi,h2:Zi,h3:Zi,h4:Zi,h5:Zi,h6:Zi,hr:lU,i:Ec,iframe:cU,img:cE,image:cE,input:fU,kbd:ua,li:Eh,listing:yc,mark:Ec,ol:xh,p:fE,plaintext:yc,pre:yc,q:SU,s:yh,samp:ua,select:AU,strike:yh,strong:hE,summary:fE,table:IU,td:pE,textarea:LU,th:pE,tr:_U,tt:ua,u:Ec,ul:xh,var:ua,video:dE,wbr:RU,xmp:yc};function _e(t,e){return t.all(e)}function kt(t,e){return t.toFlow(t.all(e))}function Ne(){}const gE={}.hasOwnProperty;function FU(t){return{all:HU,baseFound:!1,elementById:new Map,frozenBaseUrl:void 0,handlers:{...BU,...t.handlers},inTable:!1,nodeHandlers:{...PU,...t.nodeHandlers},one:UU,options:t,patch:VU,qNesting:0,resolve:$U,toFlow:jU,toSpecificContent:zU}}function HU(t){const e=t.children||[],n=[];let r=-1;for(;++r<e.length;){const o=e[r],i=this.one(o,t);Array.isArray(i)?n.push(...i):i&&n.push(i)}return n}function UU(t,e){if(t.type==="element"){if(t.properties&&t.properties.dataMdast==="ignore")return;if(gE.call(this.handlers,t.tagName))return this.handlers[t.tagName](this,t,e)||void 0}else if(gE.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 VU(t,e){t.position&&(e.position=KS(t))}function $U(t){const e=this.frozenBaseUrl;return t==null?"":e?String(new URL(t,e)):t}function jU(t){return av(t)}function zU(t,e){const n=e(),r=[];let o=[],i=-1;for(;++i<t.length;){const a=t[i];if(s(a))o.length>0&&(a.children.unshift(...o),o=[]),r.push(a);else{const l=a;o.push(l)}}if(o.length>0){let a=r[r.length-1];a||(a=e(),r.push(a)),a.children.push(...o),o=[]}return r;function s(a){return a.type===n.type}}const qU={};function bE(t,e){const n=Us(t),r=e||qU,o=jH({newlines:r.newlines===!0}),i=FU(r);let s;o(n),Bi(n,function(l){if(l&&l.type==="element"&&l.properties){const c=String(l.properties.id||"")||void 0;c&&!i.elementById.has(c)&&i.elementById.set(c,l)}});const a=i.one(n,void 0);return a?Array.isArray(a)?s={type:"root",children:a}:s=a:s={type:"root",children:[]},Bi(s,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}}),s}const yE={document:!0};function WU(t,e){return t&&"run"in t?async function(n,r){const o=bE(n,{...yE,...e});await t.run(o,r)}:function(n){return bE(n,{...yE,...t})}}function Hu(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,o=n.indexOf(e);for(;o!==-1;)r++,o=n.indexOf(e,o+e.length);return r}const sn=ni(/[A-Za-z]/),Xt=ni(/[\dA-Za-z]/),GU=ni(/[#-'*+\--9=?A-Z^-~]/);function Uu(t){return t!==null&&(t<32||t===127)}const dm=ni(/\d/),YU=ni(/[\dA-Fa-f]/),KU=ni(/[!-/:-@[-`{-~]/);function pe(t){return t!==null&&t<-2}function Je(t){return t!==null&&(t<0||t===32)}function De(t){return t===-2||t===-1||t===32}const mf=ni(new RegExp("\\p{P}|\\p{S}","u")),Fi=ni(/\s/);function ni(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function QU(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function XU(t,e,n){const o=Zs((n||{}).ignore||[]),i=ZU(e);let s=-1;for(;++s<i.length;)qS(t,"text",a);function a(c,u){let d=-1,f;for(;++d<u.length;){const h=u[d],p=f?f.children:void 0;if(o(h,p?p.indexOf(h):void 0,f))return;f=h}if(f)return l(c,u)}function l(c,u){const d=u[u.length-1],f=i[s][0],h=i[s][1];let p=0;const b=d.children.indexOf(c);let E=!1,x=[];f.lastIndex=0;let T=f.exec(c.value);for(;T;){const D=T.index,O={index:T.index,input:T.input,stack:[...u,c]};let v=h(...T,O);if(typeof v=="string"&&(v=v.length>0?{type:"text",value:v}:void 0),v===!1?f.lastIndex=D+1:(p!==D&&x.push({type:"text",value:c.value.slice(p,D)}),Array.isArray(v)?x.push(...v):v&&x.push(v),p=D+T[0].length,E=!0),!f.global)break;T=f.exec(c.value)}return E?(p<c.value.length&&x.push({type:"text",value:c.value.slice(p)}),d.children.splice(b,1,...x)):x=[c],b+x.length}}function ZU(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 o=n[r];e.push([JU(o[0]),eV(o[1])])}return e}function JU(t){return typeof t=="string"?new RegExp(QU(t),"g"):t}function eV(t){return typeof t=="function"?t:function(){return t}}const kh="phrasing",Th=["autolink","link","image","label"];function tV(){return{transforms:[lV],enter:{literalAutolink:rV,literalAutolinkEmail:wh,literalAutolinkHttp:wh,literalAutolinkWww:wh},exit:{literalAutolink:aV,literalAutolinkEmail:sV,literalAutolinkHttp:oV,literalAutolinkWww:iV}}}function nV(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:kh,notInConstruct:Th},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:kh,notInConstruct:Th},{character:":",before:"[ps]",after:"\\/",inConstruct:kh,notInConstruct:Th}]}}function rV(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function wh(t){this.config.enter.autolinkProtocol.call(this,t)}function oV(t){this.config.exit.autolinkProtocol.call(this,t)}function iV(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 sV(t){this.config.exit.autolinkEmail.call(this,t)}function aV(t){this.exit(t)}function lV(t){XU(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,cV],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),uV]],{ignore:["link","linkReference"]})}function cV(t,e,n,r,o){let i="";if(!uv(o)||(/^w/i.test(e)&&(n=e+n,e="",i="http://"),!dV(n)))return!1;const s=fV(n+r);if(!s[0])return!1;const a={type:"link",title:null,url:i+e+s[0],children:[{type:"text",value:e+s[0]}]};return s[1]?[a,{type:"text",value:s[1]}]:a}function uV(t,e,n,r){return!uv(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function dV(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 fV(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 o=Hu(t,"(");let i=Hu(t,")");for(;r!==-1&&o>i;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[t,n]}function uv(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||Fi(n)||mf(n))&&(!e||n!==47)}function pr(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}dv.peek=CV;function hV(){this.buffer()}function pV(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function mV(){this.buffer()}function gV(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function bV(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=pr(this.sliceSerialize(t)).toLowerCase(),n.label=e}function yV(t){this.exit(t)}function EV(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=pr(this.sliceSerialize(t)).toLowerCase(),n.label=e}function xV(t){this.exit(t)}function CV(){return"["}function dv(t,e,n,r){const o=n.createTracker(r);let i=o.move("[^");const s=n.enter("footnoteReference"),a=n.enter("reference");return i+=o.move(n.safe(n.associationId(t),{after:"]",before:i})),a(),s(),i+=o.move("]"),i}function kV(){return{enter:{gfmFootnoteCallString:hV,gfmFootnoteCall:pV,gfmFootnoteDefinitionLabelString:mV,gfmFootnoteDefinition:gV},exit:{gfmFootnoteCallString:bV,gfmFootnoteCall:yV,gfmFootnoteDefinitionLabelString:EV,gfmFootnoteDefinition:xV}}}function TV(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:dv},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,o,i,s){const a=i.createTracker(s);let l=a.move("[^");const c=i.enter("footnoteDefinition"),u=i.enter("label");return l+=a.move(i.safe(i.associationId(r),{before:l,after:"]"})),u(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((e?`
|
|
118
|
+
`:" ")+i.indentLines(i.containerFlow(r,a.current()),e?fv:wV))),c(),l}}function wV(t,e,n){return e===0?t:fv(t,e,n)}function fv(t,e,n){return(n?"":" ")+t}const SV=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];hv.peek=IV;function vV(){return{canContainEols:["delete"],enter:{strikethrough:_V},exit:{strikethrough:NV}}}function AV(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:SV}],handlers:{delete:hv}}}function _V(t){this.enter({type:"delete",children:[]},t)}function NV(t){this.exit(t)}function hv(t,e,n,r){const o=n.createTracker(r),i=n.enter("strikethrough");let s=o.move("~~");return s+=n.containerPhrasing(t,{...o.current(),before:s,after:"~"}),s+=o.move("~~"),i(),s}function IV(){return"~"}function MV(t){return t.length}function OV(t,e){const n=e||{},r=(n.align||[]).concat(),o=n.stringLength||MV,i=[],s=[],a=[],l=[];let c=0,u=-1;for(;++u<t.length;){const g=[],b=[];let E=-1;for(t[u].length>c&&(c=t[u].length);++E<t[u].length;){const x=DV(t[u][E]);if(n.alignDelimiters!==!1){const T=o(x);b[E]=T,(l[E]===void 0||T>l[E])&&(l[E]=T)}g.push(x)}s[u]=g,a[u]=b}let d=-1;if(typeof r=="object"&&"length"in r)for(;++d<c;)i[d]=EE(r[d]);else{const g=EE(r);for(;++d<c;)i[d]=g}d=-1;const f=[],h=[];for(;++d<c;){const g=i[d];let b="",E="";g===99?(b=":",E=":"):g===108?b=":":g===114&&(E=":");let x=n.alignDelimiters===!1?1:Math.max(1,l[d]-b.length-E.length);const T=b+"-".repeat(x)+E;n.alignDelimiters!==!1&&(x=b.length+x+E.length,x>l[d]&&(l[d]=x),h[d]=x),f[d]=T}s.splice(1,0,f),a.splice(1,0,h),u=-1;const p=[];for(;++u<s.length;){const g=s[u],b=a[u];d=-1;const E=[];for(;++d<c;){const x=g[d]||"";let T="",D="";if(n.alignDelimiters!==!1){const O=l[d]-(b[d]||0),v=i[d];v===114?T=" ".repeat(O):v===99?O%2?(T=" ".repeat(O/2+.5),D=" ".repeat(O/2-.5)):(T=" ".repeat(O/2),D=T):D=" ".repeat(O)}n.delimiterStart!==!1&&!d&&E.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&x==="")&&(n.delimiterStart!==!1||d)&&E.push(" "),n.alignDelimiters!==!1&&E.push(T),E.push(x),n.alignDelimiters!==!1&&E.push(D),n.padding!==!1&&E.push(" "),(n.delimiterEnd!==!1||d!==c-1)&&E.push("|")}p.push(n.delimiterEnd===!1?E.join("").replace(/ +$/,""):E.join(""))}return p.join(`
|
|
119
|
+
`)}function DV(t){return t==null?"":String(t)}function EE(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 xE={}.hasOwnProperty;function pv(t,e){const n=e||{};function r(o,...i){let s=r.invalid;const a=r.handlers;if(o&&xE.call(o,t)){const l=String(o[t]);s=xE.call(a,l)?a[l]:r.unknown}if(s)return s.call(this,o,...i)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const LV={}.hasOwnProperty;function mv(t,e){let n=-1,r;if(e.extensions)for(;++n<e.extensions.length;)mv(t,e.extensions[n]);for(r in e)if(LV.call(e,r))switch(r){case"extensions":break;case"unsafe":{CE(t[r],e[r]);break}case"join":{CE(t[r],e[r]);break}case"handlers":{RV(t[r],e[r]);break}default:t.options[r]=e[r]}return t}function CE(t,e){e&&t.push(...e)}function RV(t,e){e&&Object.assign(t,e)}function PV(t,e,n,r){const o=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const s=n.indentLines(n.containerFlow(t,i.current()),BV);return o(),s}function BV(t,e,n){return">"+(n?"":" ")+t}function gv(t,e){return kE(t,e.inConstruct,!0)&&!kE(t,e.notInConstruct,!1)}function kE(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 TE(t,e,n,r){let o=-1;for(;++o<n.unsafe.length;)if(n.unsafe[o].character===`
|
|
120
|
+
`&&gv(n.stack,n.unsafe[o]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
121
|
+
`}function FV(t,e){const n=String(t);let r=n.indexOf(e),o=r,i=0,s=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===o?++i>s&&(s=i):i=1,o=r+e.length,r=n.indexOf(e,o);return s}function fm(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 HV(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 UV(t,e,n,r){const o=HV(n),i=t.value||"",s=o==="`"?"GraveAccent":"Tilde";if(fm(t,n)){const d=n.enter("codeIndented"),f=n.indentLines(i,VV);return d(),f}const a=n.createTracker(r),l=o.repeat(Math.max(FV(i,o)+1,3)),c=n.enter("codeFenced");let u=a.move(l);if(t.lang){const d=n.enter(`codeFencedLang${s}`);u+=a.move(n.safe(t.lang,{before:u,after:" ",encode:["`"],...a.current()})),d()}if(t.lang&&t.meta){const d=n.enter(`codeFencedMeta${s}`);u+=a.move(" "),u+=a.move(n.safe(t.meta,{before:u,after:`
|
|
122
|
+
`,encode:["`"],...a.current()})),d()}return u+=a.move(`
|
|
123
|
+
`),i&&(u+=a.move(i+`
|
|
124
|
+
`)),u+=a.move(l),c(),u}function VV(t,e,n){return(n?"":" ")+t}function A0(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 $V(t,e,n,r){const o=A0(n),i=o==='"'?"Quote":"Apostrophe",s=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?" ":`
|
|
125
|
+
`,...l.current()}))),a(),t.title&&(a=n.enter(`title${i}`),c+=l.move(" "+o),c+=l.move(n.safe(t.title,{before:c,after:o,...l.current()})),c+=l.move(o),a()),s(),c}function jV(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 Ko(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Vs(t){if(t===null||Je(t)||Fi(t))return 1;if(mf(t))return 2}function Vu(t,e,n){const r=Vs(t),o=Vs(e);return r===void 0?o===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}bv.peek=zV;function bv(t,e,n,r){const o=jV(n),i=n.enter("emphasis"),s=n.createTracker(r),a=s.move(o);let l=s.move(n.containerPhrasing(t,{after:o,before:a,...s.current()}));const c=l.charCodeAt(0),u=Vu(r.before.charCodeAt(r.before.length-1),c,o);u.inside&&(l=Ko(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=Vu(r.after.charCodeAt(0),d,o);f.inside&&(l=l.slice(0,-1)+Ko(d));const h=s.move(o);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+h}function zV(t,e,n){return n.options.emphasis||"*"}function yv(t,e){let n=!1;return Bi(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Fu}),!!((!t.depth||t.depth<3)&&hf(t)&&(e.options.setext||n))}function qV(t,e,n,r){const o=Math.max(Math.min(6,t.depth||1),1),i=n.createTracker(r);if(yv(t,n)){const u=n.enter("headingSetext"),d=n.enter("phrasing"),f=n.containerPhrasing(t,{...i.current(),before:`
|
|
126
|
+
`,after:`
|
|
127
|
+
`});return d(),u(),f+`
|
|
128
|
+
`+(o===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
|
|
129
|
+
`))+1))}const s="#".repeat(o),a=n.enter("headingAtx"),l=n.enter("phrasing");i.move(s+" ");let c=n.containerPhrasing(t,{before:"# ",after:`
|
|
130
|
+
`,...i.current()});return/^[\t ]/.test(c)&&(c=Ko(c.charCodeAt(0))+c.slice(1)),c=c?s+" "+c:s,n.options.closeAtx&&(c+=" "+s),l(),a(),c}Ev.peek=WV;function Ev(t){return t.value||""}function WV(){return"<"}xv.peek=GV;function xv(t,e,n,r){const o=A0(n),i=o==='"'?"Quote":"Apostrophe",s=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${i}`),c+=l.move(" "+o),c+=l.move(n.safe(t.title,{before:c,after:o,...l.current()})),c+=l.move(o),a()),c+=l.move(")"),s(),c}function GV(){return"!"}Cv.peek=YV;function Cv(t,e,n,r){const o=t.referenceType,i=n.enter("imageReference");let s=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+"]["),s();const u=n.stack;n.stack=[],s=n.enter("reference");const d=n.safe(n.associationId(t),{before:l,after:"]",...a.current()});return s(),n.stack=u,i(),o==="full"||!c||c!==d?l+=a.move(d+"]"):o==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function YV(){return"!"}kv.peek=KV;function kv(t,e,n){let r=t.value||"",o="`",i=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(r);)o+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const s=n.unsafe[i],a=n.compilePattern(s);let l;if(s.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 o+r+o}function KV(){return"`"}function Tv(t,e){const n=hf(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))}wv.peek=QV;function wv(t,e,n,r){const o=A0(n),i=o==='"'?"Quote":"Apostrophe",s=n.createTracker(r);let a,l;if(Tv(t,n)){const u=n.stack;n.stack=[],a=n.enter("autolink");let d=s.move("<");return d+=s.move(n.containerPhrasing(t,{before:d,after:">",...s.current()})),d+=s.move(">"),a(),n.stack=u,d}a=n.enter("link"),l=n.enter("label");let c=s.move("[");return c+=s.move(n.containerPhrasing(t,{before:c,after:"](",...s.current()})),c+=s.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),c+=s.move("<"),c+=s.move(n.safe(t.url,{before:c,after:">",...s.current()})),c+=s.move(">")):(l=n.enter("destinationRaw"),c+=s.move(n.safe(t.url,{before:c,after:t.title?" ":")",...s.current()}))),l(),t.title&&(l=n.enter(`title${i}`),c+=s.move(" "+o),c+=s.move(n.safe(t.title,{before:c,after:o,...s.current()})),c+=s.move(o),l()),c+=s.move(")"),a(),c}function QV(t,e,n){return Tv(t,n)?"<":"["}Sv.peek=XV;function Sv(t,e,n,r){const o=t.referenceType,i=n.enter("linkReference");let s=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+"]["),s();const u=n.stack;n.stack=[],s=n.enter("reference");const d=n.safe(n.associationId(t),{before:l,after:"]",...a.current()});return s(),n.stack=u,i(),o==="full"||!c||c!==d?l+=a.move(d+"]"):o==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function XV(){return"["}function _0(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 ZV(t){const e=_0(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 JV(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 vv(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 e$(t,e,n,r){const o=n.enter("list"),i=n.bulletCurrent;let s=t.ordered?JV(n):_0(n);const a=t.ordered?s==="."?")":".":ZV(n);let l=e&&n.bulletLastUsed?s===n.bulletLastUsed:!1;if(!t.ordered){const u=t.children?t.children[0]:void 0;if((s==="*"||s==="-")&&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),vv(n)===s&&u){let d=-1;for(;++d<t.children.length;){const f=t.children[d];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(s=a),n.bulletCurrent=s;const c=n.containerFlow(t,r);return n.bulletLastUsed=s,n.bulletCurrent=i,o(),c}function t$(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 n$(t,e,n,r){const o=t$(n);let i=n.bulletCurrent||_0(n);e&&e.type==="list"&&e.ordered&&(i=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+i);let s=i.length+1;(o==="tab"||o==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(s=Math.ceil(s/4)*4);const a=n.createTracker(r);a.move(i+" ".repeat(s-i.length)),a.shift(s);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(t,a.current()),u);return l(),c;function u(d,f,h){return f?(h?"":" ".repeat(s))+d:(h?i:i+" ".repeat(s-i.length))+d}}function r$(t,e,n,r){const o=n.enter("paragraph"),i=n.enter("phrasing"),s=n.containerPhrasing(t,r);return i(),o(),s}function o$(t,e,n,r){return(t.children.some(function(s){return sv(s)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function i$(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}Av.peek=s$;function Av(t,e,n,r){const o=i$(n),i=n.enter("strong"),s=n.createTracker(r),a=s.move(o+o);let l=s.move(n.containerPhrasing(t,{after:o,before:a,...s.current()}));const c=l.charCodeAt(0),u=Vu(r.before.charCodeAt(r.before.length-1),c,o);u.inside&&(l=Ko(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=Vu(r.after.charCodeAt(0),d,o);f.inside&&(l=l.slice(0,-1)+Ko(d));const h=s.move(o+o);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+h}function s$(t,e,n){return n.options.strong||"*"}function a$(t,e,n,r){return n.safe(t.value,r)}function l$(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 c$(t,e,n){const r=(vv(n)+(n.options.ruleSpaces?" ":"")).repeat(l$(n));return n.options.ruleSpaces?r.slice(0,-1):r}const N0={blockquote:PV,break:TE,code:UV,definition:$V,emphasis:bv,hardBreak:TE,heading:qV,html:Ev,image:xv,imageReference:Cv,inlineCode:kv,link:wv,linkReference:Sv,list:e$,listItem:n$,paragraph:r$,root:o$,strong:Av,text:a$,thematicBreak:c$},u$=[d$];function d$(t,e,n,r){if(e.type==="code"&&fm(e,r)&&(t.type==="list"||t.type===e.type&&fm(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"&&yv(e,r))?void 0:n.spread?1:0}const oi=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],f$=[{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:`
|
|
131
|
+
`,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:oi},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r
|
|
132
|
+
]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:oi},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r
|
|
133
|
+
*])`},{character:"*",inConstruct:"phrasing",notInConstruct:oi},{atBreak:!0,character:"+",after:`(?:[ \r
|
|
134
|
+
])`},{atBreak:!0,character:"-",after:`(?:[ \r
|
|
135
|
+
-])`},{atBreak:!0,before:"\\d+",character:".",after:`(?:[ \r
|
|
136
|
+
]|$)`},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:oi},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:oi},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:oi},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:oi},{atBreak:!0,character:"~"}],wE=document.createElement("i");function I0(t){const e="&"+t+";";wE.innerHTML=e;const n=wE.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function _v(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 h$=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Nv(t){return t.replace(h$,p$)}function p$(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),i=o===120||o===88;return _v(n.slice(i?2:1),i?16:10)}return I0(n)||t}function m$(t){return t.label||!t.identifier?t.label||"":Nv(t.identifier)}function g$(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 b$(t,e,n){const r=e.indexStack,o=t.children||[],i=[];let s=-1,a=n.before,l;r.push(-1);let c=e.createTracker(n);for(;++s<o.length;){const u=o[s];let d;if(r[r.length-1]=s,s+1<o.length){let p=e.handle.handlers[o[s+1].type];p&&p.peek&&(p=p.peek),d=p?p(o[s+1],t,e,{before:"",after:"",...c.current()}).charAt(0):""}else d=n.after;i.length>0&&(a==="\r"||a===`
|
|
137
|
+
`)&&u.type==="html"&&(i[i.length-1]=i[i.length-1].replace(/(\r?\n|\r)$/," "),a=" ",c=e.createTracker(n),c.move(i.join("")));let f=e.handle(u,t,e,{...c.current(),after:d,before:a});l&&l===f.slice(0,1)&&(f=Ko(l.charCodeAt(0))+f.slice(1));const h=e.attentionEncodeSurroundingInfo;e.attentionEncodeSurroundingInfo=void 0,l=void 0,h&&(i.length>0&&h.before&&a===i[i.length-1].slice(-1)&&(i[i.length-1]=i[i.length-1].slice(0,-1)+Ko(a.charCodeAt(0))),h.after&&(l=d)),c.move(f),i.push(f),a=f.slice(-1)}return r.pop(),i.join("")}function y$(t,e,n){const r=e.indexStack,o=t.children||[],i=e.createTracker(n),s=[];let a=-1;for(r.push(-1);++a<o.length;){const l=o[a];r[r.length-1]=a,s.push(i.move(e.handle(l,t,e,{before:`
|
|
138
|
+
`,after:`
|
|
139
|
+
`,...i.current()}))),l.type!=="list"&&(e.bulletLastUsed=void 0),a<o.length-1&&s.push(i.move(E$(l,o[a+1],t,e)))}return r.pop(),s.join("")}function E$(t,e,n,r){let o=r.join.length;for(;o--;){const i=r.join[o](t,e,n,r);if(i===!0||i===1)break;if(typeof i=="number")return`
|
|
140
|
+
`.repeat(1+i);if(i===!1)return`
|
|
141
|
+
|
|
142
|
+
<!---->
|
|
143
|
+
|
|
144
|
+
`}return`
|
|
145
|
+
|
|
146
|
+
`}const x$=/\r?\n|\r/g;function C$(t,e){const n=[];let r=0,o=0,i;for(;i=x$.exec(t);)s(t.slice(r,i.index)),n.push(i[0]),r=i.index+i[0].length,o++;return s(t.slice(r)),n.join("");function s(a){n.push(e(a,o,!a))}}function k$(t,e,n){const r=(n.before||"")+(e||"")+(n.after||""),o=[],i=[],s={};let a=-1;for(;++a<t.unsafe.length;){const u=t.unsafe[a];if(!gv(t.stack,u))continue;const d=t.compilePattern(u);let f;for(;f=d.exec(r);){const h="before"in u||!!u.atBreak,p="after"in u,g=f.index+(h?f[1].length:0);o.includes(g)?(s[g].before&&!h&&(s[g].before=!1),s[g].after&&!p&&(s[g].after=!1)):(o.push(g),s[g]={before:h,after:p})}}o.sort(T$);let l=n.before?n.before.length:0;const c=r.length-(n.after?n.after.length:0);for(a=-1;++a<o.length;){const u=o[a];u<l||u>=c||u+1<c&&o[a+1]===u+1&&s[u].after&&!s[u+1].before&&!s[u+1].after||o[a-1]===u-1&&s[u].before&&!s[u-1].before&&!s[u-1].after||(l!==u&&i.push(SE(r.slice(l,u),"\\")),l=u,/[!-/:-@[-`{-~]/.test(r.charAt(u))&&(!n.encode||!n.encode.includes(r.charAt(u)))?i.push("\\"):(i.push(Ko(r.charCodeAt(u))),l++))}return i.push(SE(r.slice(l,c),n.after)),i.join("")}function T$(t,e){return t-e}function SE(t,e){const n=/\\(?=[!-/:-@[-`{-~])/g,r=[],o=[],i=t+e;let s=-1,a=0,l;for(;l=n.exec(i);)r.push(l.index);for(;++s<r.length;)a!==r[s]&&o.push(t.slice(a,r[s])),o.push("\\"),a=r[s];return o.push(t.slice(a)),o.join("")}function w$(t){const e=t||{},n=e.now||{};let r=e.lineShift||0,o=n.line||1,i=n.column||1;return{move:l,current:s,shift:a};function s(){return{now:{line:o,column:i},lineShift:r}}function a(c){r+=c}function l(c){const u=c||"",d=u.split(/\r?\n|\r/g),f=d[d.length-1];return o+=d.length-1,i=d.length===1?i+f.length:1+f.length+r,u}}function S$(t,e){const n=e||{},r={associationId:m$,containerPhrasing:N$,containerFlow:I$,createTracker:w$,compilePattern:g$,enter:i,handlers:{...N0},handle:void 0,indentLines:C$,indexStack:[],join:[...u$],options:{},safe:M$,stack:[],unsafe:[...f$]};mv(r,n),r.options.tightDefinitions&&r.join.push(_$),r.handle=pv("type",{invalid:v$,unknown:A$,handlers:r.handlers});let o=r.handle(t,void 0,r,{before:`
|
|
147
|
+
`,after:`
|
|
148
|
+
`,now:{line:1,column:1},lineShift:0});return o&&o.charCodeAt(o.length-1)!==10&&o.charCodeAt(o.length-1)!==13&&(o+=`
|
|
149
|
+
`),o;function i(s){return r.stack.push(s),a;function a(){r.stack.pop()}}}function v$(t){throw new Error("Cannot handle value `"+t+"`, expected node")}function A$(t){const e=t;throw new Error("Cannot handle unknown node `"+e.type+"`")}function _$(t,e){if(t.type==="definition"&&t.type===e.type)return 0}function N$(t,e){return b$(t,this,e)}function I$(t,e){return y$(t,this,e)}function M$(t,e){return k$(this,t,e)}function O$(){return{enter:{table:D$,tableData:vE,tableHeader:vE,tableRow:R$},exit:{codeText:P$,table:L$,tableData:Sh,tableHeader:Sh,tableRow:Sh}}}function D$(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 L$(t){this.exit(t),this.data.inTable=void 0}function R$(t){this.enter({type:"tableRow",children:[]},t)}function Sh(t){this.exit(t)}function vE(t){this.enter({type:"tableCell",children:[]},t)}function P$(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,B$));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function B$(t,e){return e==="|"?e:t}function F$(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,o=e.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
150
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:s,tableCell:l,tableRow:a}};function s(h,p,g,b){return c(u(h,g,b),h.align)}function a(h,p,g,b){const E=d(h,g,b),x=c([E]);return x.slice(0,x.indexOf(`
|
|
151
|
+
`))}function l(h,p,g,b){const E=g.enter("tableCell"),x=g.enter("phrasing"),T=g.containerPhrasing(h,{...b,before:i,after:i});return x(),E(),T}function c(h,p){return OV(h,{align:p,alignDelimiters:r,padding:n,stringLength:o})}function u(h,p,g){const b=h.children;let E=-1;const x=[],T=p.enter("table");for(;++E<b.length;)x[E]=d(b[E],p,g);return T(),x}function d(h,p,g){const b=h.children;let E=-1;const x=[],T=p.enter("tableRow");for(;++E<b.length;)x[E]=l(b[E],h,p,g);return T(),x}function f(h,p,g){let b=N0.inlineCode(h,p,g);return g.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function H$(){return{exit:{taskListCheckValueChecked:AE,taskListCheckValueUnchecked:AE,paragraph:V$}}}function U$(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:$$}}}function AE(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function V$(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 o=e.children;let i=-1,s;for(;++i<o.length;){const a=o[i];if(a.type==="paragraph"){s=a;break}}s===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 $$(t,e,n,r){const o=t.children[0],i=typeof t.checked=="boolean"&&o&&o.type==="paragraph",s="["+(t.checked?"x":" ")+"] ",a=n.createTracker(r);i&&a.move(s);let l=N0.listItem(t,e,n,{...r,...a.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(u){return u+s}}function j$(){return[tV(),kV(),vV(),O$(),H$()]}function z$(t){return{extensions:[nV(),TV(t),AV(),F$(t),U$()]}}function Bn(t,e,n,r){const o=t.length;let i=0,s;if(e<0?e=-e>o?0:o+e:e=e>o?o:e,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(e,n),t.splice(...s);else for(n&&t.splice(e,n);i<r.length;)s=r.slice(i,i+1e4),s.unshift(e,0),t.splice(...s),i+=1e4,e+=1e4}function Wn(t,e){return t.length>0?(Bn(t,t.length,0,e),t):e}const _E={}.hasOwnProperty;function Iv(t){const e={};let n=-1;for(;++n<t.length;)q$(e,t[n]);return e}function q$(t,e){let n;for(n in e){const o=(_E.call(t,n)?t[n]:void 0)||(t[n]={}),i=e[n];let s;if(i)for(s in i){_E.call(o,s)||(o[s]=[]);const a=i[s];W$(o[s],Array.isArray(a)?a:a?[a]:[])}}}function W$(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);Bn(t,0,0,r)}const G$={tokenize:J$,partial:!0},Mv={tokenize:ej,partial:!0},Ov={tokenize:tj,partial:!0},Dv={tokenize:nj,partial:!0},Y$={tokenize:rj,partial:!0},Lv={name:"wwwAutolink",tokenize:X$,previous:Pv},Rv={name:"protocolAutolink",tokenize:Z$,previous:Bv},mo={name:"emailAutolink",tokenize:Q$,previous:Fv},jr={};function K$(){return{text:jr}}let ii=48;for(;ii<123;)jr[ii]=mo,ii++,ii===58?ii=65:ii===91&&(ii=97);jr[43]=mo;jr[45]=mo;jr[46]=mo;jr[95]=mo;jr[72]=[mo,Rv];jr[104]=[mo,Rv];jr[87]=[mo,Lv];jr[119]=[mo,Lv];function Q$(t,e,n){const r=this;let o,i;return s;function s(d){return!hm(d)||!Fv.call(r,r.previous)||M0(r.events)?n(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(d))}function a(d){return hm(d)?(t.consume(d),a):d===64?(t.consume(d),l):n(d)}function l(d){return d===46?t.check(Y$,u,c)(d):d===45||d===95||Xt(d)?(i=!0,t.consume(d),l):u(d)}function c(d){return t.consume(d),o=!0,l}function u(d){return i&&o&&sn(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):n(d)}}function X$(t,e,n){const r=this;return o;function o(s){return s!==87&&s!==119||!Pv.call(r,r.previous)||M0(r.events)?n(s):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(G$,t.attempt(Mv,t.attempt(Ov,i),n),n)(s))}function i(s){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(s)}}function Z$(t,e,n){const r=this;let o="",i=!1;return s;function s(d){return(d===72||d===104)&&Bv.call(r,r.previous)&&!M0(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),o+=String.fromCodePoint(d),t.consume(d),a):n(d)}function a(d){if(sn(d)&&o.length<5)return o+=String.fromCodePoint(d),t.consume(d),a;if(d===58){const f=o.toLowerCase();if(f==="http"||f==="https")return t.consume(d),l}return n(d)}function l(d){return d===47?(t.consume(d),i?c:(i=!0,l)):n(d)}function c(d){return d===null||Uu(d)||Je(d)||Fi(d)||mf(d)?n(d):t.attempt(Mv,t.attempt(Ov,u),n)(d)}function u(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function J$(t,e,n){let r=0;return o;function o(s){return(s===87||s===119)&&r<3?(r++,t.consume(s),o):s===46&&r===3?(t.consume(s),i):n(s)}function i(s){return s===null?n(s):e(s)}}function ej(t,e,n){let r,o,i;return s;function s(c){return c===46||c===95?t.check(Dv,l,a)(c):c===null||Je(c)||Fi(c)||c!==45&&mf(c)?l(c):(i=!0,t.consume(c),s)}function a(c){return c===95?r=!0:(o=r,r=void 0),t.consume(c),s}function l(c){return o||r||!i?n(c):e(c)}}function tj(t,e){let n=0,r=0;return o;function o(s){return s===40?(n++,t.consume(s),o):s===41&&r<n?i(s):s===33||s===34||s===38||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===60||s===63||s===93||s===95||s===126?t.check(Dv,e,i)(s):s===null||Je(s)||Fi(s)?e(s):(t.consume(s),o)}function i(s){return s===41&&r++,t.consume(s),o}}function nj(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),i):a===93?(t.consume(a),o):a===60||a===null||Je(a)||Fi(a)?e(a):n(a)}function o(a){return a===null||a===40||a===91||Je(a)||Fi(a)?e(a):r(a)}function i(a){return sn(a)?s(a):n(a)}function s(a){return a===59?(t.consume(a),r):sn(a)?(t.consume(a),s):n(a)}}function rj(t,e,n){return r;function r(i){return t.consume(i),o}function o(i){return Xt(i)?n(i):e(i)}}function Pv(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Je(t)}function Bv(t){return!sn(t)}function Fv(t){return!(t===47||hm(t))}function hm(t){return t===43||t===45||t===46||t===95||Xt(t)}function M0(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 Js(t){const e=[];let n=-1,r=0,o=0;for(;++n<t.length;){const i=t.charCodeAt(n);let s="";if(i===37&&Xt(t.charCodeAt(n+1))&&Xt(t.charCodeAt(n+2)))o=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(s=String.fromCharCode(i));else if(i>55295&&i<57344){const a=t.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(s=String.fromCharCode(i,a),o=1):s="�"}else s=String.fromCharCode(i);s&&(e.push(t.slice(r,n),encodeURIComponent(s)),r=n+o+1,s=""),o&&(n+=o,o=0)}return e.join("")+t.slice(r)}function gf(t,e,n){const r=[];let o=-1;for(;++o<t.length;){const i=t[o].resolveAll;i&&!r.includes(i)&&(e=i(e,n),r.push(i))}return e}const pm={name:"attention",resolveAll:oj,tokenize:ij};function oj(t,e){let n=-1,r,o,i,s,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},f={...t[n][1].start};NE(d,-l),NE(f,l),s={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...t[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:f},i={type:l>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},o={type:l>1?"strong":"emphasis",start:{...s.start},end:{...a.end}},t[r][1].end={...s.start},t[n][1].start={...a.end},c=[],t[r][1].end.offset-t[r][1].start.offset&&(c=Wn(c,[["enter",t[r][1],e],["exit",t[r][1],e]])),c=Wn(c,[["enter",o,e],["enter",s,e],["exit",s,e],["enter",i,e]]),c=Wn(c,gf(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),c=Wn(c,[["exit",i,e],["enter",a,e],["exit",a,e],["exit",o,e]]),t[n][1].end.offset-t[n][1].start.offset?(u=2,c=Wn(c,[["enter",t[n][1],e],["exit",t[n][1],e]])):u=0,Bn(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 ij(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=Vs(r);let i;return s;function s(l){return i=l,t.enter("attentionSequence"),a(l)}function a(l){if(l===i)return t.consume(l),a;const c=t.exit("attentionSequence"),u=Vs(l),d=!u||u===2&&o||n.includes(l),f=!o||o===2&&u||n.includes(r);return c._open=!!(i===42?d:d&&(o||!f)),c._close=!!(i===42?f:f&&(u||!d)),e(l)}}function NE(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const sj={name:"autolink",tokenize:aj};function aj(t,e,n){let r=0;return o;function o(h){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(h),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),i}function i(h){return sn(h)?(t.consume(h),s):h===64?n(h):c(h)}function s(h){return h===43||h===45||h===46||Xt(h)?(r=1,a(h)):c(h)}function a(h){return h===58?(t.consume(h),r=0,l):(h===43||h===45||h===46||Xt(h))&&r++<32?(t.consume(h),a):(r=0,c(h))}function l(h){return h===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(h),t.exit("autolinkMarker"),t.exit("autolink"),e):h===null||h===32||h===60||Uu(h)?n(h):(t.consume(h),l)}function c(h){return h===64?(t.consume(h),u):GU(h)?(t.consume(h),c):n(h)}function u(h){return Xt(h)?d(h):n(h)}function d(h){return h===46?(t.consume(h),r=0,u):h===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(h),t.exit("autolinkMarker"),t.exit("autolink"),e):f(h)}function f(h){if((h===45||Xt(h))&&r++<63){const p=h===45?f:d;return t.consume(h),p}return n(h)}}function Pe(t,e,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return De(l)?(t.enter(n),a(l)):e(l)}function a(l){return De(l)&&i++<o?(t.consume(l),a):(t.exit(n),e(l))}}const Wl={partial:!0,tokenize:lj};function lj(t,e,n){return r;function r(i){return De(i)?Pe(t,o,"linePrefix")(i):o(i)}function o(i){return i===null||pe(i)?e(i):n(i)}}const Hv={continuation:{tokenize:uj},exit:dj,name:"blockQuote",tokenize:cj};function cj(t,e,n){const r=this;return o;function o(s){if(s===62){const a=r.containerState;return a.open||(t.enter("blockQuote",{_container:!0}),a.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(s),t.exit("blockQuoteMarker"),i}return n(s)}function i(s){return De(s)?(t.enter("blockQuotePrefixWhitespace"),t.consume(s),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(s))}}function uj(t,e,n){const r=this;return o;function o(s){return De(s)?Pe(t,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return t.attempt(Hv,e,n)(s)}}function dj(t){t.exit("blockQuote")}const Uv={name:"characterEscape",tokenize:fj};function fj(t,e,n){return r;function r(i){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(i),t.exit("escapeMarker"),o}function o(i){return KU(i)?(t.enter("characterEscapeValue"),t.consume(i),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(i)}}const Vv={name:"characterReference",tokenize:hj};function hj(t,e,n){const r=this;let o=0,i,s;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"),i=31,s=Xt,u(d))}function c(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),i=6,s=YU,u):(t.enter("characterReferenceValue"),i=7,s=dm,u(d))}function u(d){if(d===59&&o){const f=t.exit("characterReferenceValue");return s===Xt&&!I0(r.sliceSerialize(f))?n(d):(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return s(d)&&o++<i?(t.consume(d),u):n(d)}}const IE={partial:!0,tokenize:mj},ME={concrete:!0,name:"codeFenced",tokenize:pj};function pj(t,e,n){const r=this,o={partial:!0,tokenize:O};let i=0,s=0,a;return l;function l(v){return c(v)}function c(v){const R=r.events[r.events.length-1];return i=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,a=v,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),u(v)}function u(v){return v===a?(s++,t.consume(v),u):s<3?n(v):(t.exit("codeFencedFenceSequence"),De(v)?Pe(t,d,"whitespace")(v):d(v))}function d(v){return v===null||pe(v)?(t.exit("codeFencedFence"),r.interrupt?e(v):t.check(IE,g,D)(v)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),f(v))}function f(v){return v===null||pe(v)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(v)):De(v)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Pe(t,h,"whitespace")(v)):v===96&&v===a?n(v):(t.consume(v),f)}function h(v){return v===null||pe(v)?d(v):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===null||pe(v)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(v)):v===96&&v===a?n(v):(t.consume(v),p)}function g(v){return t.attempt(o,D,b)(v)}function b(v){return t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),E}function E(v){return i>0&&De(v)?Pe(t,x,"linePrefix",i+1)(v):x(v)}function x(v){return v===null||pe(v)?t.check(IE,g,D)(v):(t.enter("codeFlowValue"),T(v))}function T(v){return v===null||pe(v)?(t.exit("codeFlowValue"),x(v)):(t.consume(v),T)}function D(v){return t.exit("codeFenced"),e(v)}function O(v,R,j){let z=0;return I;function I(q){return v.enter("lineEnding"),v.consume(q),v.exit("lineEnding"),X}function X(q){return v.enter("codeFencedFence"),De(q)?Pe(v,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):F(q)}function F(q){return q===a?(v.enter("codeFencedFenceSequence"),W(q)):j(q)}function W(q){return q===a?(z++,v.consume(q),W):z>=s?(v.exit("codeFencedFenceSequence"),De(q)?Pe(v,B,"whitespace")(q):B(q)):j(q)}function B(q){return q===null||pe(q)?(v.exit("codeFencedFence"),R(q)):j(q)}}}function mj(t,e,n){const r=this;return o;function o(s){return s===null?n(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),i)}function i(s){return r.parser.lazy[r.now().line]?n(s):e(s)}}const vh={name:"codeIndented",tokenize:bj},gj={partial:!0,tokenize:yj};function bj(t,e,n){const r=this;return o;function o(c){return t.enter("codeIndented"),Pe(t,i,"linePrefix",5)(c)}function i(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?s(c):n(c)}function s(c){return c===null?l(c):pe(c)?t.attempt(gj,s,l)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||pe(c)?(t.exit("codeFlowValue"),s(c)):(t.consume(c),a)}function l(c){return t.exit("codeIndented"),e(c)}}function yj(t,e,n){const r=this;return o;function o(s){return r.parser.lazy[r.now().line]?n(s):pe(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),o):Pe(t,i,"linePrefix",5)(s)}function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(s):pe(s)?o(s):n(s)}}const Ej={name:"codeText",previous:Cj,resolve:xj,tokenize:kj};function xj(t){let e=t.length-4,n=3,r,o;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;)o===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(o=r):(r===e||t[r][1].type==="lineEnding")&&(t[o][1].type="codeTextData",r!==o+2&&(t[o][1].end=t[r-1][1].end,t.splice(o+2,r-o-2),e-=r-o-2,r=o+2),o=void 0);return t}function Cj(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function kj(t,e,n){let r=0,o,i;return s;function s(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?(i=t.enter("codeTextSequence"),o=0,u(d)):pe(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||pe(d)?(t.exit("codeTextData"),l(d)):(t.consume(d),c)}function u(d){return d===96?(t.consume(d),o++,u):o===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(d)):(i.type="codeTextData",c(d))}}class Tj{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 o=n||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&da(this.left,r),i.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),da(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),da(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);da(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);da(this.left,n.reverse())}}}function da(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 $v(t){const e={};let n=-1,r,o,i,s,a,l,c;const u=new Tj(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,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,wj(u,n)),n=e[n],c=!0);else if(r[1]._container){for(i=n,o=void 0;i--;)if(s=u.get(i),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank")s[0]==="enter"&&(o&&(u.get(o)[1].type="lineEndingBlank"),s[1].type="lineEnding",o=i);else if(!(s[1].type==="linePrefix"||s[1].type==="listItemIndent"))break;o&&(r[1].end={...u.get(o)[1].start},a=u.slice(o,n),a.unshift(r),u.splice(o,n-o+1,a))}}return Bn(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function wj(t,e){const n=t.get(e)[1],r=t.get(e)[2];let o=e-1;const i=[];let s=n._tokenizer;s||(s=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(s._contentTypeTextTrailing=!0));const a=s.events,l=[],c={};let u,d,f=-1,h=n,p=0,g=0;const b=[g];for(;h;){for(;t.get(++o)[1]!==h;);i.push(o),h._tokenizer||(u=r.sliceStream(h),h.next||u.push(null),d&&s.defineSkip(h.start),h._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(u),h._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),d=h,h=h.next}for(h=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(g=f+1,b.push(g),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(s.events=[],h?(h._tokenizer=void 0,h.previous=void 0):b.pop(),f=b.length;f--;){const E=a.slice(b[f],b[f+1]),x=i.pop();l.push([x,x+E.length-1]),t.splice(x,2,E)}for(l.reverse(),f=-1;++f<l.length;)c[p+l[f][0]]=p+l[f][1],p+=l[f][1]-l[f][0]-1;return c}const Sj={resolve:Aj,tokenize:_j},vj={partial:!0,tokenize:Nj};function Aj(t){return $v(t),t}function _j(t,e){let n;return r;function r(a){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),o(a)}function o(a){return a===null?i(a):pe(a)?t.check(vj,s,i)(a):(t.consume(a),o)}function i(a){return t.exit("chunkContent"),t.exit("content"),e(a)}function s(a){return t.consume(a),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function Nj(t,e,n){const r=this;return o;function o(s){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),Pe(t,i,"linePrefix")}function i(s){if(s===null||pe(s))return n(s);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(s):t.interrupt(r.parser.constructs.flow,n,e)(s)}}function jv(t,e,n,r,o,i,s,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(E){return E===60?(t.enter(r),t.enter(o),t.enter(i),t.consume(E),t.exit(i),f):E===null||E===32||E===41||Uu(E)?n(E):(t.enter(r),t.enter(s),t.enter(a),t.enter("chunkString",{contentType:"string"}),g(E))}function f(E){return E===62?(t.enter(i),t.consume(E),t.exit(i),t.exit(o),t.exit(r),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),h(E))}function h(E){return E===62?(t.exit("chunkString"),t.exit(a),f(E)):E===null||E===60||pe(E)?n(E):(t.consume(E),E===92?p:h)}function p(E){return E===60||E===62||E===92?(t.consume(E),h):h(E)}function g(E){return!u&&(E===null||E===41||Je(E))?(t.exit("chunkString"),t.exit(a),t.exit(s),t.exit(r),e(E)):u<c&&E===40?(t.consume(E),u++,g):E===41?(t.consume(E),u--,g):E===null||E===32||E===40||Uu(E)?n(E):(t.consume(E),E===92?b:g)}function b(E){return E===40||E===41||E===92?(t.consume(E),g):g(E)}}function zv(t,e,n,r,o,i){const s=this;let a=0,l;return c;function c(h){return t.enter(r),t.enter(o),t.consume(h),t.exit(o),t.enter(i),u}function u(h){return a>999||h===null||h===91||h===93&&!l||h===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?n(h):h===93?(t.exit(i),t.enter(o),t.consume(h),t.exit(o),t.exit(r),e):pe(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===null||h===91||h===93||pe(h)||a++>999?(t.exit("chunkString"),u(h)):(t.consume(h),l||(l=!De(h)),h===92?f:d)}function f(h){return h===91||h===92||h===93?(t.consume(h),a++,d):d(h)}}function qv(t,e,n,r,o,i){let s;return a;function a(f){return f===34||f===39||f===40?(t.enter(r),t.enter(o),t.consume(f),t.exit(o),s=f===40?41:f,l):n(f)}function l(f){return f===s?(t.enter(o),t.consume(f),t.exit(o),t.exit(r),e):(t.enter(i),c(f))}function c(f){return f===s?(t.exit(i),l(s)):f===null?n(f):pe(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),Pe(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===s||f===null||pe(f)?(t.exit("chunkString"),c(f)):(t.consume(f),f===92?d:u)}function d(f){return f===s||f===92?(t.consume(f),u):u(f)}}function Ua(t,e){let n;return r;function r(o){return pe(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),n=!0,r):De(o)?Pe(t,r,n?"linePrefix":"lineSuffix")(o):e(o)}}const Ij={name:"definition",tokenize:Oj},Mj={partial:!0,tokenize:Dj};function Oj(t,e,n){const r=this;let o;return i;function i(h){return t.enter("definition"),s(h)}function s(h){return zv.call(r,t,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function a(h){return o=pr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(t.enter("definitionMarker"),t.consume(h),t.exit("definitionMarker"),l):n(h)}function l(h){return Je(h)?Ua(t,c)(h):c(h)}function c(h){return jv(t,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function u(h){return t.attempt(Mj,d,d)(h)}function d(h){return De(h)?Pe(t,f,"whitespace")(h):f(h)}function f(h){return h===null||pe(h)?(t.exit("definition"),r.parser.defined.push(o),e(h)):n(h)}}function Dj(t,e,n){return r;function r(a){return Je(a)?Ua(t,o)(a):n(a)}function o(a){return qv(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return De(a)?Pe(t,s,"whitespace")(a):s(a)}function s(a){return a===null||pe(a)?e(a):n(a)}}const Lj={name:"hardBreakEscape",tokenize:Rj};function Rj(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),o}function o(i){return pe(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const Pj={name:"headingAtx",resolve:Bj,tokenize:Fj};function Bj(t,e){let n=t.length-2,r=3,o,i;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&&(o={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},i={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},Bn(t,r,n-r+1,[["enter",o,e],["enter",i,e],["exit",i,e],["exit",o,e]])),t}function Fj(t,e,n){let r=0;return o;function o(u){return t.enter("atxHeading"),i(u)}function i(u){return t.enter("atxHeadingSequence"),s(u)}function s(u){return u===35&&r++<6?(t.consume(u),s):u===null||Je(u)?(t.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(t.enter("atxHeadingSequence"),l(u)):u===null||pe(u)?(t.exit("atxHeading"),e(u)):De(u)?Pe(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||Je(u)?(t.exit("atxHeadingText"),a(u)):(t.consume(u),c)}}const Hj=["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"],OE=["pre","script","style","textarea"],Uj={concrete:!0,name:"htmlFlow",resolveTo:jj,tokenize:zj},Vj={partial:!0,tokenize:Wj},$j={partial:!0,tokenize:qj};function jj(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 zj(t,e,n){const r=this;let o,i,s,a,l;return c;function c(_){return u(_)}function u(_){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(_),d}function d(_){return _===33?(t.consume(_),f):_===47?(t.consume(_),i=!0,g):_===63?(t.consume(_),o=3,r.interrupt?e:S):sn(_)?(t.consume(_),s=String.fromCharCode(_),b):n(_)}function f(_){return _===45?(t.consume(_),o=2,h):_===91?(t.consume(_),o=5,a=0,p):sn(_)?(t.consume(_),o=4,r.interrupt?e:S):n(_)}function h(_){return _===45?(t.consume(_),r.interrupt?e:S):n(_)}function p(_){const ft="CDATA[";return _===ft.charCodeAt(a++)?(t.consume(_),a===ft.length?r.interrupt?e:F:p):n(_)}function g(_){return sn(_)?(t.consume(_),s=String.fromCharCode(_),b):n(_)}function b(_){if(_===null||_===47||_===62||Je(_)){const ft=_===47,Ue=s.toLowerCase();return!ft&&!i&&OE.includes(Ue)?(o=1,r.interrupt?e(_):F(_)):Hj.includes(s.toLowerCase())?(o=6,ft?(t.consume(_),E):r.interrupt?e(_):F(_)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(_):i?x(_):T(_))}return _===45||Xt(_)?(t.consume(_),s+=String.fromCharCode(_),b):n(_)}function E(_){return _===62?(t.consume(_),r.interrupt?e:F):n(_)}function x(_){return De(_)?(t.consume(_),x):I(_)}function T(_){return _===47?(t.consume(_),I):_===58||_===95||sn(_)?(t.consume(_),D):De(_)?(t.consume(_),T):I(_)}function D(_){return _===45||_===46||_===58||_===95||Xt(_)?(t.consume(_),D):O(_)}function O(_){return _===61?(t.consume(_),v):De(_)?(t.consume(_),O):T(_)}function v(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(t.consume(_),l=_,R):De(_)?(t.consume(_),v):j(_)}function R(_){return _===l?(t.consume(_),l=null,z):_===null||pe(_)?n(_):(t.consume(_),R)}function j(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||Je(_)?O(_):(t.consume(_),j)}function z(_){return _===47||_===62||De(_)?T(_):n(_)}function I(_){return _===62?(t.consume(_),X):n(_)}function X(_){return _===null||pe(_)?F(_):De(_)?(t.consume(_),X):n(_)}function F(_){return _===45&&o===2?(t.consume(_),oe):_===60&&o===1?(t.consume(_),Z):_===62&&o===4?(t.consume(_),Ee):_===63&&o===3?(t.consume(_),S):_===93&&o===5?(t.consume(_),ie):pe(_)&&(o===6||o===7)?(t.exit("htmlFlowData"),t.check(Vj,be,W)(_)):_===null||pe(_)?(t.exit("htmlFlowData"),W(_)):(t.consume(_),F)}function W(_){return t.check($j,B,be)(_)}function B(_){return t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),q}function q(_){return _===null||pe(_)?W(_):(t.enter("htmlFlowData"),F(_))}function oe(_){return _===45?(t.consume(_),S):F(_)}function Z(_){return _===47?(t.consume(_),s="",ee):F(_)}function ee(_){if(_===62){const ft=s.toLowerCase();return OE.includes(ft)?(t.consume(_),Ee):F(_)}return sn(_)&&s.length<8?(t.consume(_),s+=String.fromCharCode(_),ee):F(_)}function ie(_){return _===93?(t.consume(_),S):F(_)}function S(_){return _===62?(t.consume(_),Ee):_===45&&o===2?(t.consume(_),S):F(_)}function Ee(_){return _===null||pe(_)?(t.exit("htmlFlowData"),be(_)):(t.consume(_),Ee)}function be(_){return t.exit("htmlFlow"),e(_)}}function qj(t,e,n){const r=this;return o;function o(s){return pe(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),i):n(s)}function i(s){return r.parser.lazy[r.now().line]?n(s):e(s)}}function Wj(t,e,n){return r;function r(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),t.attempt(Wl,e,n)}}const Gj={name:"htmlText",tokenize:Yj};function Yj(t,e,n){const r=this;let o,i,s;return a;function a(S){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(S),l}function l(S){return S===33?(t.consume(S),c):S===47?(t.consume(S),O):S===63?(t.consume(S),T):sn(S)?(t.consume(S),j):n(S)}function c(S){return S===45?(t.consume(S),u):S===91?(t.consume(S),i=0,p):sn(S)?(t.consume(S),x):n(S)}function u(S){return S===45?(t.consume(S),h):n(S)}function d(S){return S===null?n(S):S===45?(t.consume(S),f):pe(S)?(s=d,Z(S)):(t.consume(S),d)}function f(S){return S===45?(t.consume(S),h):d(S)}function h(S){return S===62?oe(S):S===45?f(S):d(S)}function p(S){const Ee="CDATA[";return S===Ee.charCodeAt(i++)?(t.consume(S),i===Ee.length?g:p):n(S)}function g(S){return S===null?n(S):S===93?(t.consume(S),b):pe(S)?(s=g,Z(S)):(t.consume(S),g)}function b(S){return S===93?(t.consume(S),E):g(S)}function E(S){return S===62?oe(S):S===93?(t.consume(S),E):g(S)}function x(S){return S===null||S===62?oe(S):pe(S)?(s=x,Z(S)):(t.consume(S),x)}function T(S){return S===null?n(S):S===63?(t.consume(S),D):pe(S)?(s=T,Z(S)):(t.consume(S),T)}function D(S){return S===62?oe(S):T(S)}function O(S){return sn(S)?(t.consume(S),v):n(S)}function v(S){return S===45||Xt(S)?(t.consume(S),v):R(S)}function R(S){return pe(S)?(s=R,Z(S)):De(S)?(t.consume(S),R):oe(S)}function j(S){return S===45||Xt(S)?(t.consume(S),j):S===47||S===62||Je(S)?z(S):n(S)}function z(S){return S===47?(t.consume(S),oe):S===58||S===95||sn(S)?(t.consume(S),I):pe(S)?(s=z,Z(S)):De(S)?(t.consume(S),z):oe(S)}function I(S){return S===45||S===46||S===58||S===95||Xt(S)?(t.consume(S),I):X(S)}function X(S){return S===61?(t.consume(S),F):pe(S)?(s=X,Z(S)):De(S)?(t.consume(S),X):z(S)}function F(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(t.consume(S),o=S,W):pe(S)?(s=F,Z(S)):De(S)?(t.consume(S),F):(t.consume(S),B)}function W(S){return S===o?(t.consume(S),o=void 0,q):S===null?n(S):pe(S)?(s=W,Z(S)):(t.consume(S),W)}function B(S){return S===null||S===34||S===39||S===60||S===61||S===96?n(S):S===47||S===62||Je(S)?z(S):(t.consume(S),B)}function q(S){return S===47||S===62||Je(S)?z(S):n(S)}function oe(S){return S===62?(t.consume(S),t.exit("htmlTextData"),t.exit("htmlText"),e):n(S)}function Z(S){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(S),t.exit("lineEnding"),ee}function ee(S){return De(S)?Pe(t,ie,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):ie(S)}function ie(S){return t.enter("htmlTextData"),s(S)}}const O0={name:"labelEnd",resolveAll:Zj,resolveTo:Jj,tokenize:ez},Kj={tokenize:tz},Qj={tokenize:nz},Xj={tokenize:rz};function Zj(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 o=r.type==="labelImage"?4:2;r.type="data",e+=o}}return t.length!==n.length&&Bn(t,0,t.length,n),t}function Jj(t,e){let n=t.length,r=0,o,i,s,a;for(;n--;)if(o=t[n][1],i){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;t[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(s){if(t[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(i=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(s=n);const l={type:t[i][1].type==="labelLink"?"link":"image",start:{...t[i][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[i][1].start},end:{...t[s][1].end}},u={type:"labelText",start:{...t[i+r+2][1].end},end:{...t[s-2][1].start}};return a=[["enter",l,e],["enter",c,e]],a=Wn(a,t.slice(i+1,i+r+3)),a=Wn(a,[["enter",u,e]]),a=Wn(a,gf(e.parser.constructs.insideSpan.null,t.slice(i+r+4,s-3),e)),a=Wn(a,[["exit",u,e],t[s-2],t[s-1],["exit",c,e]]),a=Wn(a,t.slice(s+1)),a=Wn(a,[["exit",l,e]]),Bn(t,i,t.length,a),t}function ez(t,e,n){const r=this;let o=r.events.length,i,s;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){i=r.events[o][1];break}return a;function a(f){return i?i._inactive?d(f):(s=r.parser.defined.includes(pr(r.sliceSerialize({start:i.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(f),t.exit("labelMarker"),t.exit("labelEnd"),l):n(f)}function l(f){return f===40?t.attempt(Kj,u,s?u:d)(f):f===91?t.attempt(Qj,u,s?c:d)(f):s?u(f):d(f)}function c(f){return t.attempt(Xj,u,d)(f)}function u(f){return e(f)}function d(f){return i._balanced=!0,n(f)}}function tz(t,e,n){return r;function r(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),o}function o(d){return Je(d)?Ua(t,i)(d):i(d)}function i(d){return d===41?u(d):jv(t,s,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function s(d){return Je(d)?Ua(t,l)(d):u(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?qv(t,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return Je(d)?Ua(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 nz(t,e,n){const r=this;return o;function o(a){return zv.call(r,t,i,s,"reference","referenceMarker","referenceString")(a)}function i(a){return r.parser.defined.includes(pr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(a):n(a)}function s(a){return n(a)}}function rz(t,e,n){return r;function r(i){return t.enter("reference"),t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),o}function o(i){return i===93?(t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),t.exit("reference"),e):n(i)}}const oz={name:"labelStartImage",resolveAll:O0.resolveAll,tokenize:iz};function iz(t,e,n){const r=this;return o;function o(a){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(a),t.exit("labelImageMarker"),i}function i(a){return a===91?(t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelImage"),s):n(a)}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):e(a)}}const sz={name:"labelStartLink",resolveAll:O0.resolveAll,tokenize:az};function az(t,e,n){const r=this;return o;function o(s){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelLink"),i}function i(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):e(s)}}const Ah={name:"lineEnding",tokenize:lz};function lz(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),Pe(t,e,"linePrefix")}}const Yc={name:"thematicBreak",tokenize:cz};function cz(t,e,n){let r=0,o;return i;function i(c){return t.enter("thematicBreak"),s(c)}function s(c){return o=c,a(c)}function a(c){return c===o?(t.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||pe(c))?(t.exit("thematicBreak"),e(c)):n(c)}function l(c){return c===o?(t.consume(c),r++,l):(t.exit("thematicBreakSequence"),De(c)?Pe(t,a,"whitespace")(c):a(c))}}const mn={continuation:{tokenize:hz},exit:mz,name:"list",tokenize:fz},uz={partial:!0,tokenize:gz},dz={partial:!0,tokenize:pz};function fz(t,e,n){const r=this,o=r.events[r.events.length-1];let i=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,s=0;return a;function a(h){const p=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:dm(h)){if(r.containerState.type||(r.containerState.type=p,t.enter(p,{_container:!0})),p==="listUnordered")return t.enter("listItemPrefix"),h===42||h===45?t.check(Yc,n,c)(h):c(h);if(!r.interrupt||h===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(h)}return n(h)}function l(h){return dm(h)&&++s<10?(t.consume(h),l):(!r.interrupt||s<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(t.exit("listItemValue"),c(h)):n(h)}function c(h){return t.enter("listItemMarker"),t.consume(h),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,t.check(Wl,r.interrupt?n:u,t.attempt(uz,f,d))}function u(h){return r.containerState.initialBlankLine=!0,i++,f(h)}function d(h){return De(h)?(t.enter("listItemPrefixWhitespace"),t.consume(h),t.exit("listItemPrefixWhitespace"),f):n(h)}function f(h){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(h)}}function hz(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Wl,o,i);function o(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Pe(t,e,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!De(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(dz,e,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Pe(t,t.attempt(mn,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function pz(t,e,n){const r=this;return Pe(t,o,"listItemIndent",r.containerState.size+1);function o(i){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?e(i):n(i)}}function mz(t){t.exit(this.containerState.type)}function gz(t,e,n){const r=this;return Pe(t,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(i){const s=r.events[r.events.length-1];return!De(i)&&s&&s[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const DE={name:"setextUnderline",resolveTo:bz,tokenize:yz};function bz(t,e){let n=t.length,r,o,i;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(o=n)}else t[n][1].type==="content"&&t.splice(n,1),!i&&t[n][1].type==="definition"&&(i=n);const s={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[o][1].type="setextHeadingText",i?(t.splice(o,0,["enter",s,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end={...t[i][1].end}):t[r][1]=s,t.push(["exit",s,e]),t}function yz(t,e,n){const r=this;let o;return i;function i(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"),o=c,s(c)):n(c)}function s(c){return t.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===o?(t.consume(c),a):(t.exit("setextHeadingLineSequence"),De(c)?Pe(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||pe(c)?(t.exit("setextHeadingLine"),e(c)):n(c)}}const Ez={tokenize:Az,partial:!0};function xz(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:wz,continuation:{tokenize:Sz},exit:vz}},text:{91:{name:"gfmFootnoteCall",tokenize:Tz},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Cz,resolveTo:kz}}}}function Cz(t,e,n){const r=this;let o=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;o--;){const l=r.events[o][1];if(l.type==="labelImage"){s=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(!s||!s._balanced)return n(l);const c=pr(r.sliceSerialize({start:s.end,end:r.now()}));return c.codePointAt(0)!==94||!i.includes(c.slice(1))?n(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function kz(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)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},t[t.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},a=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",o,e],["exit",o,e],["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...a),t}function Tz(t,e,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,s;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(i>999||d===93&&!s||d===null||d===91||Je(d))return n(d);if(d===93){t.exit("chunkString");const f=t.exit("gfmFootnoteCallString");return o.includes(pr(r.sliceSerialize(f)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(d)}return Je(d)||(s=!0),i++,t.consume(d),d===92?u:c}function u(d){return d===91||d===92||d===93?(t.consume(d),i++,c):c(d)}}function wz(t,e,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,s=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(s>999||p===93&&!a||p===null||p===91||Je(p))return n(p);if(p===93){t.exit("chunkString");const g=t.exit("gfmFootnoteDefinitionLabelString");return i=pr(r.sliceSerialize(g)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(p),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),f}return Je(p)||(a=!0),s++,t.consume(p),p===92?d:u}function d(p){return p===91||p===92||p===93?(t.consume(p),s++,u):u(p)}function f(p){return p===58?(t.enter("definitionMarker"),t.consume(p),t.exit("definitionMarker"),o.includes(i)||o.push(i),Pe(t,h,"gfmFootnoteDefinitionWhitespace")):n(p)}function h(p){return e(p)}}function Sz(t,e,n){return t.check(Wl,e,t.attempt(Ez,e,n))}function vz(t){t.exit("gfmFootnoteDefinition")}function Az(t,e,n){const r=this;return Pe(t,o,"gfmFootnoteDefinitionIndent",5);function o(i){const s=r.events[r.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?e(i):n(i)}}function _z(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:o};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function o(s,a){let l=-1;for(;++l<s.length;)if(s[l][0]==="enter"&&s[l][1].type==="strikethroughSequenceTemporary"&&s[l][1]._close){let c=l;for(;c--;)if(s[c][0]==="exit"&&s[c][1].type==="strikethroughSequenceTemporary"&&s[c][1]._open&&s[l][1].end.offset-s[l][1].start.offset===s[c][1].end.offset-s[c][1].start.offset){s[l][1].type="strikethroughSequence",s[c][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},s[c][1].start),end:Object.assign({},s[l][1].end)},d={type:"strikethroughText",start:Object.assign({},s[c][1].end),end:Object.assign({},s[l][1].start)},f=[["enter",u,a],["enter",s[c][1],a],["exit",s[c][1],a],["enter",d,a]],h=a.parser.constructs.insideSpan.null;h&&Bn(f,f.length,0,gf(h,s.slice(c+1,l),a)),Bn(f,f.length,0,[["exit",d,a],["enter",s[l][1],a],["exit",s[l][1],a],["exit",u,a]]),Bn(s,c-1,l-c+3,f),l=c+f.length-2;break}}for(l=-1;++l<s.length;)s[l][1].type==="strikethroughSequenceTemporary"&&(s[l][1].type="data");return s}function i(s,a,l){const c=this.previous,u=this.events;let d=0;return f;function f(p){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(p):(s.enter("strikethroughSequenceTemporary"),h(p))}function h(p){const g=Vs(c);if(p===126)return d>1?l(p):(s.consume(p),d++,h);if(d<2&&!n)return l(p);const b=s.exit("strikethroughSequenceTemporary"),E=Vs(p);return b._open=!E||E===2&&!!g,b._close=!g||g===2&&!!E,a(p)}}}class Nz{constructor(){this.map=[]}add(e,n,r){Iz(this,e,n,r)}consume(e){if(this.map.sort(function(i,s){return i[0]-s[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 o=r.pop();for(;o;){for(const i of o)e.push(i);o=r.pop()}this.map.length=0}}function Iz(t,e,n,r){let o=0;if(!(n===0&&r.length===0)){for(;o<t.map.length;){if(t.map[o][0]===e){t.map[o][1]+=n,t.map[o][2].push(...r);return}o+=1}t.map.push([e,n,r])}}function Mz(t,e){let n=!1;const r=[];for(;e<t.length;){const o=t[e];if(n){if(o[0]==="enter")o[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function Oz(){return{flow:{null:{name:"table",tokenize:Dz,resolveAll:Lz}}}}function Dz(t,e,n){const r=this;let o=0,i=0,s;return a;function a(I){let X=r.events.length-1;for(;X>-1;){const B=r.events[X][1].type;if(B==="lineEnding"||B==="linePrefix")X--;else break}const F=X>-1?r.events[X][1].type:null,W=F==="tableHead"||F==="tableRow"?v:l;return W===v&&r.parser.lazy[r.now().line]?n(I):W(I)}function l(I){return t.enter("tableHead"),t.enter("tableRow"),c(I)}function c(I){return I===124||(s=!0,i+=1),u(I)}function u(I){return I===null?n(I):pe(I)?i>1?(i=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),h):n(I):De(I)?Pe(t,u,"whitespace")(I):(i+=1,s&&(s=!1,o+=1),I===124?(t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),s=!0,u):(t.enter("data"),d(I)))}function d(I){return I===null||I===124||Je(I)?(t.exit("data"),u(I)):(t.consume(I),I===92?f:d)}function f(I){return I===92||I===124?(t.consume(I),d):d(I)}function h(I){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(I):(t.enter("tableDelimiterRow"),s=!1,De(I)?Pe(t,p,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):p(I))}function p(I){return I===45||I===58?b(I):I===124?(s=!0,t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),g):O(I)}function g(I){return De(I)?Pe(t,b,"whitespace")(I):b(I)}function b(I){return I===58?(i+=1,s=!0,t.enter("tableDelimiterMarker"),t.consume(I),t.exit("tableDelimiterMarker"),E):I===45?(i+=1,E(I)):I===null||pe(I)?D(I):O(I)}function E(I){return I===45?(t.enter("tableDelimiterFiller"),x(I)):O(I)}function x(I){return I===45?(t.consume(I),x):I===58?(s=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(I),t.exit("tableDelimiterMarker"),T):(t.exit("tableDelimiterFiller"),T(I))}function T(I){return De(I)?Pe(t,D,"whitespace")(I):D(I)}function D(I){return I===124?p(I):I===null||pe(I)?!s||o!==i?O(I):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(I)):O(I)}function O(I){return n(I)}function v(I){return t.enter("tableRow"),R(I)}function R(I){return I===124?(t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),R):I===null||pe(I)?(t.exit("tableRow"),e(I)):De(I)?Pe(t,R,"whitespace")(I):(t.enter("data"),j(I))}function j(I){return I===null||I===124||Je(I)?(t.exit("data"),R(I)):(t.consume(I),I===92?z:j)}function z(I){return I===92||I===124?(t.consume(I),j):j(I)}}function Lz(t,e){let n=-1,r=!0,o=0,i=[0,0,0,0],s=[0,0,0,0],a=!1,l=0,c,u,d;const f=new Nz;for(;++n<t.length;){const h=t[n],p=h[1];h[0]==="enter"?p.type==="tableHead"?(a=!1,l!==0&&(LE(f,e,l,c,u),u=void 0,l=0),c={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(n,0,[["enter",c,e]])):p.type==="tableRow"||p.type==="tableDelimiterRow"?(r=!0,d=void 0,i=[0,0,0,0],s=[0,n+1,0,0],a&&(a=!1,u={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(n,0,[["enter",u,e]])),o=p.type==="tableDelimiterRow"?2:u?3:1):o&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")?(r=!1,s[2]===0&&(i[1]!==0&&(s[0]=s[1],d=xc(f,e,i,o,void 0,d),i=[0,0,0,0]),s[2]=n)):p.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(s[0]=s[1],d=xc(f,e,i,o,void 0,d)),i=s,s=[i[1],n,0,0])):p.type==="tableHead"?(a=!0,l=n):p.type==="tableRow"||p.type==="tableDelimiterRow"?(l=n,i[1]!==0?(s[0]=s[1],d=xc(f,e,i,o,n,d)):s[1]!==0&&(d=xc(f,e,s,o,n,d)),o=0):o&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")&&(s[3]=n)}for(l!==0&&LE(f,e,l,c,u),f.consume(e.events),n=-1;++n<e.events.length;){const h=e.events[n];h[0]==="enter"&&h[1].type==="table"&&(h[1]._align=Mz(e.events,n))}return t}function xc(t,e,n,r,o,i){const s=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(i.end=Object.assign({},is(e.events,n[0])),t.add(n[0],0,[["exit",i,e]]));const l=is(e.events,n[1]);if(i={type:s,start:Object.assign({},l),end:Object.assign({},l)},t.add(n[1],0,[["enter",i,e]]),n[2]!==0){const c=is(e.events,n[2]),u=is(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 f=e.events[n[2]],h=e.events[n[3]];if(f[1].end=Object.assign({},h[1].end),f[1].type="chunkText",f[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 o!==void 0&&(i.end=Object.assign({},is(e.events,o)),t.add(o,0,[["exit",i,e]]),i=void 0),i}function LE(t,e,n,r,o){const i=[],s=is(e.events,n);o&&(o.end=Object.assign({},s),i.push(["exit",o,e])),r.end=Object.assign({},s),i.push(["exit",r,e]),t.add(n+1,0,i)}function is(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const Rz={name:"tasklistCheck",tokenize:Bz};function Pz(){return{text:{91:Rz}}}function Bz(t,e,n){const r=this;return o;function o(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),i)}function i(l){return Je(l)?(t.enter("taskListCheckValueUnchecked"),t.consume(l),t.exit("taskListCheckValueUnchecked"),s):l===88||l===120?(t.enter("taskListCheckValueChecked"),t.consume(l),t.exit("taskListCheckValueChecked"),s):n(l)}function s(l){return l===93?(t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),a):n(l)}function a(l){return pe(l)?e(l):De(l)?t.check({tokenize:Fz},e,n)(l):n(l)}}function Fz(t,e,n){return Pe(t,r,"whitespace");function r(o){return o===null?n(o):e(o)}}function Hz(t){return Iv([K$(),xz(),_z(t),Oz(),Pz()])}const Uz={};function Wv(t){const e=this,n=t||Uz,r=e.data(),o=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);o.push(Hz(n)),i.push(j$()),s.push(z$(n))}function Vz(t){const e=this;e.compiler=n;function n(r){return S$(r,{...e.data("settings"),...t,extensions:e.data("toMarkdownExtensions")||[]})}}function RE(t){if(t)throw t}var _h,PE;function $z(){if(PE)return _h;PE=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=function(c){return typeof Array.isArray=="function"?Array.isArray(c):e.call(c)==="[object Array]"},i=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 f;for(f in c);return typeof f>"u"||t.call(c,f)},s=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 _h=function l(){var c,u,d,f,h,p,g=arguments[0],b=1,E=arguments.length,x=!1;for(typeof g=="boolean"&&(x=g,g=arguments[1]||{},b=2),(g==null||typeof g!="object"&&typeof g!="function")&&(g={});b<E;++b)if(c=arguments[b],c!=null)for(u in c)d=a(g,u),f=a(c,u),g!==f&&(x&&f&&(i(f)||(h=o(f)))?(h?(h=!1,p=d&&o(d)?d:[]):p=d&&i(d)?d:{},s(g,{name:u,newValue:l(x,p,f)})):typeof f<"u"&&s(g,{name:u,newValue:f}));return g},_h}var jz=$z();const Nh=gC(jz);function mm(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 zz(){const t=[],e={run:n,use:r};return e;function n(...o){let i=-1;const s=o.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);a(null,...o);function a(l,...c){const u=t[++i];let d=-1;if(l){s(l);return}for(;++d<o.length;)(c[d]===null||c[d]===void 0)&&(c[d]=o[d]);o=c,u?qz(u,a)(...c):s(null,...c)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return t.push(o),e}}function qz(t,e){let n;return r;function r(...s){const a=t.length>s.length;let l;a&&s.push(o);try{l=t.apply(this,s)}catch(c){const u=c;if(a&&n)throw u;return o(u)}a||(l&&l.then&&typeof l.then=="function"?l.then(i,o):l instanceof Error?o(l):i(l))}function o(s,...a){n||(n=!0,e(s,...a))}function i(s){o(null,s)}}const Wz=(function(t){const r=this.constructor.prototype,o=r[t],i=function(){return o.apply(i,arguments)};return Object.setPrototypeOf(i,r),i}),Gz={}.hasOwnProperty;class D0 extends Wz{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=zz()}copy(){const e=new D0;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(Nh(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(Oh("data",this.frozen),this.namespace[e]=n,this):Gz.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Oh("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 o=n.call(e,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=Cc(e),r=this.parser||this.Parser;return Ih("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),Ih("process",this.parser||this.Parser),Mh("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(i,s){const a=Cc(e),l=r.parse(a);r.run(l,a,function(u,d,f){if(u||!d||!f)return c(u);const h=d,p=r.stringify(h,f);Kz(p)?f.value=p:f.result=p,c(u,f)});function c(u,d){u||!d?s(u):i?i(d):n(void 0,d)}}}processSync(e){let n=!1,r;return this.freeze(),Ih("processSync",this.parser||this.Parser),Mh("processSync",this.compiler||this.Compiler),this.process(e,o),FE("processSync","process",n),r;function o(i,s){n=!0,RE(i),r=s}}run(e,n,r){BE(e),this.freeze();const o=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(s,a){const l=Cc(n);o.run(e,l,c);function c(u,d,f){const h=d||e;u?a(u):s?s(h):r(void 0,h,f)}}}runSync(e,n){let r=!1,o;return this.run(e,n,i),FE("runSync","run",r),o;function i(s,a){RE(s),o=a,r=!0}}stringify(e,n){this.freeze();const r=Cc(n),o=this.compiler||this.Compiler;return Mh("stringify",o),BE(e),o(e,r)}use(e,...n){const r=this.attachers,o=this.namespace;if(Oh("use",this.frozen),e!=null)if(typeof e=="function")l(e,n);else if(typeof e=="object")Array.isArray(e)?a(e):s(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function i(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...d]=c;l(u,d)}else s(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function s(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&&(o.settings=Nh(!0,o.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const d=c[u];i(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let d=-1,f=-1;for(;++d<r.length;)if(r[d][0]===c){f=d;break}if(f===-1)r.push([c,...u]);else if(u.length>0){let[h,...p]=u;const g=r[f][1];mm(g)&&mm(h)&&(h=Nh(!0,g,h)),r[f]=[c,h,...p]}}}}const Gv=new D0().freeze();function Ih(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Mh(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Oh(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 BE(t){if(!mm(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function FE(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Cc(t){return Yz(t)?t:new cm(t)}function Yz(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function Kz(t){return typeof t=="string"||Qz(t)}function Qz(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}function Xz(t,e){return Yv(t,{})||{type:"root",children:[]}}function Yv(t,e){const n=Zz(t,e);return n&&e.afterTransform&&e.afterTransform(t,n),n}function Zz(t,e){switch(t.nodeType){case 1:return nq(t,e);case 3:return eq(t);case 8:return tq(t);case 9:return HE(t,e);case 10:return Jz();case 11:return HE(t,e);default:return}}function HE(t,e){return{type:"root",children:Kv(t,e)}}function Jz(){return{type:"doctype"}}function eq(t){return{type:"text",value:t.nodeValue||""}}function tq(t){return{type:"comment",value:t.nodeValue||""}}function nq(t,e){const n=t.namespaceURI,r=n===qc.svg?rS:nS,o=n===qc.html?t.tagName.toLowerCase():t.tagName,i=n===qc.html&&o==="template"?t.content:t,s=t.getAttributeNames(),a={};let l=-1;for(;++l<s.length;)a[s[l]]=t.getAttribute(s[l])||"";return r(o,a,Kv(i,e))}function Kv(t,e){const n=t.childNodes,r=[];let o=-1;for(;++o<n.length;){const i=Yv(n[o],e);i!==void 0&&r.push(i)}return r}var rq=Object.defineProperty,oq=(t,e,n)=>e in t?rq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,qe=(t,e,n)=>oq(t,typeof e!="symbol"?e+"":e,n);function Qv(t){const e=Array.from(t.classList).filter(n=>!n.startsWith("bn-"))||[];e.length>0?t.className=e.join(" "):t.removeAttribute("class")}function Xv(t,e,n,r){var o;let i;if(e)if(typeof e=="string")i=yr([e],t.pmSchema);else if(Array.isArray(e))i=yr(e,t.pmSchema);else if(e.type==="tableContent")i=Jd(e,t.pmSchema);else throw new Hr(e.type);else throw new Error("blockContent is required");const s=(r?.document??document).createDocumentFragment();for(const a of i)if(a.type.name!=="text"&&t.schema.inlineContentSchema[a.type.name]){const l=t.schema.inlineContentSpecs[a.type.name].implementation;if(l){const c=Zg(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(s.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=Fn.renderSpec(document,u);d.contentDOM.appendChild(l),l=d.dom}s.appendChild(l)}else{const l=n.serializeFragment(V.from([a]),r);s.appendChild(l)}return s.childNodes.length===1&&((o=s.firstChild)==null?void 0:o.nodeType)===1&&Qv(s.firstChild),s}function iq(t,e,n,r,o,i,s){var a,l,c,u,d,f,h,p,g;const b=s?.document??document,E=e.pmSchema.nodes.blockContainer,x=n.props||{};for(const[z,I]of Object.entries(e.schema.blockSchema[n.type].propSchema))!(z in x)&&I.default!==void 0&&(x[z]=I.default);const T=(l=(a=E.spec)==null?void 0:a.toDOM)==null?void 0:l.call(a,E.create({id:n.id,...x})),D=Array.from(T.dom.attributes),O=e.blockImplementations[n.type].implementation,v=((c=O.toExternalHTML)==null?void 0:c.call({},{...n,props:x},e))||O.render.call({},{...n,props:x},e),R=b.createDocumentFragment();if(v.dom.classList.contains("bn-block-content")){const z=[...D,...Array.from(v.dom.attributes)].filter(I=>I.name.startsWith("data")&&I.name!=="data-content-type"&&I.name!=="data-file-block"&&I.name!=="data-node-view-wrapper"&&I.name!=="data-node-type"&&I.name!=="data-id"&&I.name!=="data-editable");for(const I of z)v.dom.firstChild.setAttribute(I.name,I.value);Qv(v.dom.firstChild),R.append(...Array.from(v.dom.childNodes))}else R.append(v.dom);if(v.contentDOM&&n.content){const z=Xv(e,n.content,r,s);v.contentDOM.appendChild(z)}let j;if(o.has(n.type)?j="OL":i.has(n.type)&&(j="UL"),j){if(((u=t.lastChild)==null?void 0:u.nodeName)!==j){const z=b.createElement(j);j==="OL"&&"start"in x&&x.start&&x?.start!==1&&z.setAttribute("start",x.start+""),t.append(z)}t.lastChild.appendChild(R)}else t.append(R);if(n.children&&n.children.length>0){const z=b.createDocumentFragment();if(Zv(z,e,n.children,r,o,i,s),((d=t.lastChild)==null?void 0:d.nodeName)==="UL"||((f=t.lastChild)==null?void 0:f.nodeName)==="OL")for(;((h=z.firstChild)==null?void 0:h.nodeName)==="UL"||((p=z.firstChild)==null?void 0:p.nodeName)==="OL";)t.lastChild.lastChild.appendChild(z.firstChild);e.pmSchema.nodes[n.type].isInGroup("blockContent")?t.append(z):(g=v.contentDOM)==null||g.append(z)}}const Zv=(t,e,n,r,o,i,s)=>{for(const a of n)iq(t,e,a,r,o,i,s)},sq=(t,e,n,r,o,i)=>{const s=(i?.document??document).createDocumentFragment();return Zv(s,t,e,n,r,o,i),s},bf=(t,e)=>{const n=Fn.fromSchema(t);return{exportBlocks:(r,o)=>{const i=sq(e,r,n,new Set(["numberedListItem"]),new Set(["bulletListItem","checkListItem","toggleListItem"]),o),s=document.createElement("div");return s.append(i),s.innerHTML},exportInlineContent:(r,o)=>{const i=Xv(e,r,n,o),s=document.createElement("div");return s.append(i.cloneNode(!0)),s.innerHTML}}};function aq(t,e){if(e===0)return;const n=t.resolve(e);for(let r=n.depth;r>0;r--){const o=n.node(r);if(r0(o))return o.attrs.id}}function lq(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 UE(t){const e="__root__",n={},r={},o=Et(t);return t.descendants((i,s)=>{if(!r0(i))return!0;const a=aq(t,s),l=a??e;r[l]||(r[l]=[]);const c=pt(i,o);return n[i.attrs.id]={block:c,parentId:a},r[l].push(i.attrs.id),!0}),{byId:n,childrenByParent:r}}function cq(t,e){const n=new Set;if(!t||!e)return n;const r=new Set(t),o=e.filter(g=>r.has(g)),i=t.filter(g=>o.includes(g));if(i.length<=1||o.length<=1)return n;const s={};for(let g=0;g<i.length;g++)s[i[g]]=g;const a=o.map(g=>s[g]),l=a.length,c=[],u=[],d=new Array(l).fill(-1),f=(g,b)=>{let E=0,x=g.length;for(;E<x;){const T=E+x>>>1;g[T]<b?E=T+1:x=T}return E};for(let g=0;g<l;g++){const b=a[g],E=f(c,b);E>0&&(d[g]=u[E-1]),E===c.length?(c.push(b),u.push(g)):(c[E]=b,u[E]=g)}const h=new Set;let p=u[u.length-1]??-1;for(;p!==-1;)h.add(p),p=d[p];for(let g=0;g<o.length;g++)h.has(g)||n.add(o[g]);return n}function Jv(t,e=[]){const n=lq(t),r=Wd(t.before,[t,...e]),o=UE(r.before),i=UE(r.doc),s=[],a=new Set;Object.keys(i.byId).filter(h=>!(h in o.byId)).forEach(h=>{s.push({type:"insert",block:i.byId[h].block,source:n,prevBlock:void 0}),a.add(h)}),Object.keys(o.byId).filter(h=>!(h in i.byId)).forEach(h=>{s.push({type:"delete",block:o.byId[h].block,source:n,prevBlock:void 0}),a.add(h)}),Object.keys(i.byId).filter(h=>h in o.byId).forEach(h=>{var p,g;const b=o.byId[h],E=i.byId[h];b.parentId!==E.parentId?(s.push({type:"move",block:E.block,prevBlock:b.block,source:n,prevParent:b.parentId?(p=o.byId[b.parentId])==null?void 0:p.block:void 0,currentParent:E.parentId?(g=i.byId[E.parentId])==null?void 0:g.block:void 0}),a.add(h)):D5({...b.block,children:void 0},{...E.block,children:void 0})||(s.push({type:"update",block:E.block,prevBlock:b.block,source:n}),a.add(h))});const l=o.childrenByParent,c=i.childrenByParent,u="__root__",d=new Set([...Object.keys(l),...Object.keys(c)]),f=new Set;return d.forEach(h=>{const p=cq(l[h],c[h]);p.size!==0&&p.forEach(g=>{var b,E;const x=o.byId[g],T=i.byId[g];!x||!T||x.parentId!==T.parentId||a.has(g)||(x.parentId??u)!==h||f.has(g)||(f.add(g),s.push({type:"move",block:T.block,prevBlock:x.block,source:n,prevParent:x.parentId?(b=o.byId[x.parentId])==null?void 0:b.block:void 0,currentParent:T.parentId?(E=i.byId[T.parentId])==null?void 0:E.block:void 0}),a.add(g))})}),s}function uq(){const t=e=>{let n=e.children.length;for(let r=0;r<n;r++){const o=e.children[r];if(o.type==="element"&&(t(o),o.tagName==="u"))if(o.children.length>0){e.children.splice(r,1,...o.children);const i=o.children.length-1;n+=i,r+=i}else e.children.splice(r,1),n--,r--}};return t}function dq(){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 o=e.children[r],i=r+1<e.children.length?e.children[r+1]:void 0;o.type==="element"&&o.tagName==="input"&&((n=o.properties)==null?void 0:n.type)==="checkbox"&&i?.type==="element"&&i.tagName==="p"?(i.tagName="span",i.children.splice(0,0,Xz(document.createTextNode(" ")))):t(o)}};return t}function fq(){return t=>{Bi(t,"element",(e,n,r)=>{var o,i,s,a;if(r&&e.tagName==="video"){const l=((o=e.properties)==null?void 0:o.src)||((i=e.properties)==null?void 0:i["data-url"])||"",c=((s=e.properties)==null?void 0:s.title)||((a=e.properties)==null?void 0:a["data-name"])||"";r.children[n]={type:"text",value:``}}})}}function L0(t){return Gv().use(gH,{fragment:!0}).use(fq).use(uq).use(dq).use(WU).use(Wv).use(Vz,{handlers:{text:e=>e.value}}).processSync(t).value}function hq(t,e,n,r){const o=bf(e,n).exportBlocks(t,r);return L0(o)}function eA(t){const e=[];return t.descendants(n=>{var r,o;const i=Et(n);return n.type.name==="blockContainer"&&((r=n.firstChild)==null?void 0:r.type.name)==="blockGroup"?!0:n.type.name==="columnList"&&n.childCount===1?((o=n.firstChild)==null||o.forEach(s=>{e.push(pt(s,i))}),!1):n.type.isInGroup("bnBlock")?(e.push(pt(n,i)),!1):!0}),e}const pq=ze(()=>{const t=[];return{key:"blockChange",prosemirrorPlugins:[new ye({key:new Oe("blockChange"),filterTransaction:e=>{let n;return t.reduce((r,o)=>r===!1?r:o({getChanges(){return n||(n=Jv(e),n)},tr:e})!==!1,!0)}})],subscribe(e){return t.push(e),()=>{t.splice(t.indexOf(e),1)}}}});function VE(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),o=parseInt(e.substring(4,6),16),i=[n/255,r/255,o/255].map(s=>s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4));return .2126*i[0]+.7152*i[1]+.0722*i[2]<=.179}function mq(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: ${VE(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: ${VE(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 gm=ze(({options:t})=>{const e=new Map;return t.provider&&"awareness"in t.provider&&typeof t.provider.awareness=="object"&&("setLocalStateField"in t.provider.awareness&&typeof t.provider.awareness.setLocalStateField=="function"&&t.provider.awareness.setLocalStateField("user",t.user),"on"in t.provider.awareness&&typeof t.provider.awareness.on=="function"&&t.showCursorLabels!=="always"&&t.provider.awareness.on("change",({updated:n})=>{for(const r of n){const o=e.get(r);o&&(o.element.setAttribute("data-active",""),o.hideTimeout&&clearTimeout(o.hideTimeout),e.set(r,{element:o.element,hideTimeout:setTimeout(()=>{o.element.removeAttribute("data-active")},2e3)}))}})),{key:"yCursor",prosemirrorPlugins:[FL(t.provider.awareness,{selectionBuilder:gw,cursorBuilder(n,r){let o=e.get(r);if(!o){const i=(t.renderCursor??mq)(n);t.showCursorLabels!=="always"&&(i.addEventListener("mouseenter",()=>{const s=e.get(r);s.element.setAttribute("data-active",""),s.hideTimeout&&(clearTimeout(s.hideTimeout),e.set(r,{element:s.element,hideTimeout:void 0}))}),i.addEventListener("mouseleave",()=>{const s=e.get(r);e.set(r,{element:s.element,hideTimeout:setTimeout(()=>{s.element.removeAttribute("data-active")},2e3)})})),o={element:i,hideTimeout:void 0},e.set(r,o)}return o.element}})],dependsOn:["ySync"],updateUser(n){t.provider.awareness.setLocalStateField("user",n)}}}),Kc=ze(({options:t})=>({key:"ySync",prosemirrorPlugins:[kL(t.fragment)],runsBefore:["default"]})),Qc=ze(({editor:t})=>({key:"yUndo",prosemirrorPlugins:[qL({trackedOrigins:[t]})],dependsOn:["yCursor","ySync"],undoCommand:VL,redoCommand:$L}));function gq(t,e){const n=t.doc;if(t._item===null){const r=Array.from(n.share.keys()).find(o=>n.share.get(o)===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,o=e.store.clients.get(r.id.client)??[],i=tr(o,r.id.clock);return o[i].content.type}}const bq=ze(({editor:t,options:e})=>{let n;const r=ei({isForked:!1});return{key:"yForkDoc",store:r,fork(){if(n)return;const o=e.fragment;if(!o)throw new Error("No fragment to fork from");const i=new Jo;Sb(i,vb(o.doc));const s=gq(o,i);n={undoStack:Lr.getState(t.prosemirrorState).undoManager.undoStack,originalFragment:o,forkedFragment:s},t.unregisterExtension([Qc,gm,Kc]);const a={...e,fragment:s};t.registerExtension([Kc(a),Qc({})]),r.setState({isForked:!0})},merge({keepChanges:o}){if(!n)return;t.unregisterExtension(["ySync","yCursor","yUndo"]);const{originalFragment:i,forkedFragment:s,undoStack:a}=n;if(t.registerExtension([Kc(e),gm(e),Qc({})]),Lr.getState(t.prosemirrorState).undoManager.undoStack=a,o){const l=vb(s.doc,J4(i.doc));Sb(i.doc,l,t)}n=void 0,r.setState({isForked:!1})}}}),tA=(t,e)=>{e(t),t.forEach(n=>{n instanceof Yt&&tA(n,e)})},yq=(t,e)=>{const n=new Map;return t.forEach(r=>{r instanceof Yt&&tA(r,o=>{if(o.nodeName==="blockContainer"&&o.hasAttribute("id")){const i=o.getAttribute("textColor"),s=o.getAttribute("backgroundColor"),a={textColor:i===He.textColor.default?void 0:i,backgroundColor:s===He.backgroundColor.default?void 0:s};(a.textColor||a.backgroundColor)&&n.set(o.getAttribute("id"),a)}})}),n.size===0?!1:(e.doc.descendants((r,o)=>{if(r.type.name==="blockContainer"&&n.has(r.attrs.id)){const i=e.doc.nodeAt(o+1);if(!i)throw new Error("No element found");e.setNodeMarkup(o+1,void 0,{...i.attrs,...n.get(r.attrs.id)})}}),!0)},Eq=[yq],xq=ze(({options:t})=>{let e=!1;const n=new Oe("schemaMigration");return{key:"schemaMigration",prosemirrorPlugins:[new ye({key:n,appendTransaction:(r,o,i)=>{if(e||!r.some(a=>a.getMeta("y-sync$"))||r.every(a=>!a.docChanged)||!t.fragment.firstChild)return;const s=i.tr;for(const a of Eq)a(t.fragment,s);if(e=!0,!!s.docChanged)return s}})]}}),Cq=ze(({editor:t,options:e})=>({key:"dropCursor",prosemirrorPlugins:[(e.dropCursor??j2)({width:5,color:"#ddeeff",editor:t})]})),Qo=ze(({editor:t})=>{const e=ei(!1),n=()=>t.transact(r=>{var o;if(r.selection.empty||r.selection instanceof le&&(r.selection.node.type.spec.content==="inline*"||((o=r.selection.node.firstChild)==null?void 0:o.type.spec.content)==="inline*")||r.selection instanceof ae&&r.doc.textBetween(r.selection.from,r.selection.to).length===0)return!1;let i=!1;return r.selection.content().content.descendants(s=>(s.type.spec.code&&(i=!0),!i)),!i});return{key:"formattingToolbar",store:e,mount({dom:r,signal:o}){let i=!1;const s=t.onChange(()=>{i||e.setState(n())}),a=t.onSelectionChange(()=>{i||e.setState(n())});r.addEventListener("pointerdown",()=>{i=!0,e.setState(!1)},{signal:o}),t.prosemirrorView.root.addEventListener("pointerup",()=>{i=!1,t.isFocused()&&e.setState(n())},{signal:o,capture:!0}),r.addEventListener("pointercancel",()=>{i=!1},{signal:o,capture:!0}),o.addEventListener("abort",()=>{s(),a()})}}}),kq=ze(()=>({key:"history",prosemirrorPlugins:[W2()],undoCommand:c0,redoCommand:u0})),Gl=ze(({editor:t})=>{function e(o){let i=t.prosemirrorView.nodeDOM(o);for(;i&&i.parentElement;){if(i.nodeName==="A")return i;i=i.parentElement}return null}function n(o,i){return t.transact(s=>{const a=s.doc.resolve(o),l=a.marks().find(u=>u.type.name===i);if(!l)return;const c=zd(a,l.type);if(c)return{range:c,mark:l,get text(){return s.doc.textBetween(c.from,c.to)},get position(){return jg(t.prosemirrorView,c.from,c.to).toJSON()}}})}function r(){return t.transact(o=>{const i=o.selection;if(i.empty)return n(i.anchor,"link")})}return{key:"linkToolbar",getLinkAtSelection:r,getLinkElementAtPos:e,getMarkAtPos:n,getLinkAtElement(o){return t.transact(()=>{const i=t.prosemirrorView.posAtDOM(o,0)+1;return n(i,"link")})},editLink(o,i,s=t.transact(a=>a.selection.anchor)){t.transact(a=>{const l=Et(a),{range:c}=n(s+1,"link")||{range:{from:a.selection.from,to:a.selection.to}};c&&(a.insertText(i,c.from,c.to),a.addMark(c.from,c.from+i.length,l.mark("link",{href:o})))}),t.prosemirrorView.focus()},deleteLink(o=t.transact(i=>i.selection.anchor)){t.transact(i=>{const s=Et(i),{range:a}=n(o+1,"link")||{range:{from:i.selection.from,to:i.selection.to}};a&&i.removeMark(a.from,a.to,s.marks.link).setMeta("preventAutolink",!0)}),t.prosemirrorView.focus()}}}),nA=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"],rA="https",Tq=new Oe("node-selection-keyboard"),wq=ze(()=>({key:"nodeSelectionKeyboard",prosemirrorPlugins:[new ye({key:Tq,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.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 ae(n.doc.resolve(t.state.tr.selection.$to.after()+1)))),!0}}return!1}}})]})),Sq=new Oe("blocknote-placeholder"),vq=ze(({editor:t,options:e})=>{const n=e.placeholders;return{key:"placeholder",prosemirrorPlugins:[new ye({key:Sq,view:r=>{const o=`placeholder-selector-${u2()}`;r.dom.classList.add(o);const i=document.createElement("style"),s=t._tiptapEditor.options.injectNonce;s&&i.setAttribute("nonce",s),r.root instanceof window.ShadowRoot?r.root.append(i):r.root.head.appendChild(i);const a=i.sheet,l=(c="")=>`.${o} .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(i):r.root.head.removeChild(i)}}},props:{decorations:r=>{const{doc:o,selection:i}=r;if(!t.isEditable||!i.empty||i.$from.parent.type.spec.code)return;const s=[];r.doc.content.size===6&&s.push(je.node(2,4,{"data-is-only-empty-block":"true"}));const a=i.$anchor,l=a.parent;if(l.content.size===0){const c=a.before();s.push(je.node(c,c+l.nodeSize,{"data-is-empty-and-focused":"true"}))}return ke.create(o,s)}}})]}}),$E=new Oe("previous-blocks"),Aq={index:"index",level:"level",type:"type",depth:"depth","depth-change":"depth-change"},_q=ze(()=>{let t;return{key:"previousBlockType",prosemirrorPlugins:[new ye({key:$E,view(e){return{update:async(n,r)=>{var o;((o=this.key)==null?void 0:o.getState(n.state).updatedBlocks.size)>0&&(t=setTimeout(()=>{n.dispatch(n.state.tr.setMeta($E,{clearUpdate:!0}))},0))},destroy:()=>{t&&clearTimeout(t)}}},state:{init(){return{prevTransactionOldBlockAttrs:{},currentTransactionOldBlockAttrs:{},updatedBlocks:new Set}},apply(e,n,r,o){if(n.currentTransactionOldBlockAttrs={},n.updatedBlocks.clear(),!e.docChanged||r.doc.eq(o.doc))return n;const i={},s=Kb(r.doc,c=>c.attrs.id),a=new Map(s.map(c=>[c.node.attrs.id,c])),l=Kb(o.doc,c=>c.attrs.id);for(const c of l){const u=a.get(c.node.attrs.id),d=u?.node.firstChild,f=c.node.firstChild;if(u&&d&&f){const h={index:f.attrs.index,level:f.attrs.level,type:f.type.name,depth:o.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};i[c.node.attrs.id]=p,n.currentTransactionOldBlockAttrs[c.node.attrs.id]=p,JSON.stringify(p)!==JSON.stringify(h)&&(p["depth-change"]=p.depth-h.depth,n.updatedBlocks.add(c.node.attrs.id))}}return n.prevTransactionOldBlockAttrs=i,n}},props:{decorations(e){const n=this.getState(e);if(n.updatedBlocks.size===0)return;const r=[];return e.doc.descendants((o,i)=>{if(!o.attrs.id||!n.updatedBlocks.has(o.attrs.id))return;const s=n.currentTransactionOldBlockAttrs[o.attrs.id],a={};for(const[c,u]of Object.entries(s))a["data-prev-"+Aq[c]]=u||"none";const l=je.node(i,i+o.nodeSize,{...a});r.push(l)}),ke.create(e.doc,r)}}})]}});function oA(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")}}let bm=class Xc extends me{constructor(e,n){super(e,n),qe(this,"nodes");const r=e.node();this.nodes=[],e.doc.nodesBetween(e.pos,n.pos,(o,i,s)=>{if(s!==null&&s.eq(r))return this.nodes.push(o),!1})}static create(e,n,r=n){return new Xc(e.resolve(n),e.resolve(r))}content(){return new Q(V.from(this.nodes),0,0)}eq(e){if(!(e instanceof Xc)||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),o=n.mapResult(this.to);return o.deleted?me.near(e.resolve(r.pos)):r.deleted?me.near(e.resolve(o.pos)):new Xc(e.resolve(r.pos),e.resolve(o.pos))}toJSON(){return{type:"multiple-node",anchor:this.anchor,head:this.head}}};me.jsonID("multiple-node",bm);let sr;function Nq(t,e){let n,r;const o=e.resolve(t.from).node().type.spec.group==="blockContent",i=e.resolve(t.to).node().type.spec.group==="blockContent",s=Math.min(t.$anchor.depth,t.$head.depth);if(o&&i){const a=t.$from.start(s-1),l=t.$to.end(s-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 jE(t,e,n=e){e===n&&(n+=t.state.doc.resolve(e+1).node().nodeSize);const r=t.domAtPos(e).node.cloneNode(!0),o=t.domAtPos(e).node,i=(u,d)=>Array.prototype.indexOf.call(u.children,d),s=i(o,t.domAtPos(e+1).node.parentElement),a=i(o,t.domAtPos(n-1).node.parentElement);for(let u=o.childElementCount-1;u>=0;u--)(u>a||u<s)&&r.removeChild(r.children[u]);iA(t.root),sr=r;const l=sr.getElementsByTagName("iframe");for(let u=0;u<l.length;u++){const d=l[u],f=d.parentElement;f&&f.removeChild(d)}const c=t.dom.className.split(" ").filter(u=>u!=="ProseMirror"&&u!=="bn-root"&&u!=="bn-editor").join(" ");sr.className=sr.className+" bn-drag-preview "+c,t.root instanceof ShadowRoot?t.root.appendChild(sr):t.root.body.appendChild(sr)}function iA(t){sr!==void 0&&(t instanceof ShadowRoot?t.removeChild(sr):t.body.removeChild(sr),sr=void 0)}function Iq(t,e,n){if(!t.dataTransfer||n.headless)return;const r=n.prosemirrorView,o=dn(e.id,r.state.doc);if(!o)throw new Error(`Block with ID ${e.id} not found`);const i=o.posBeforeNode;if(i!=null){const s=r.state.selection,a=r.state.doc,{from:l,to:c}=Nq(s,a),u=l<=i&&i<c,d=s.$anchor.node()!==s.$head.node()||s instanceof bm;u&&d?(r.dispatch(r.state.tr.setSelection(bm.create(a,l,c))),jE(r,l,c)):(r.dispatch(r.state.tr.setSelection(le.create(r.state.doc,i))),jE(r,i));const f=r.state.selection.content(),h=n.pmSchema,p=r.serializeForClipboard(f).dom.innerHTML,g=bf(h,n),b=eA(f.content),E=g.exportBlocks(b,{}),x=L0(E);t.dataTransfer.clearData(),t.dataTransfer.setData("blocknote/html",p),t.dataTransfer.setData("text/html",E),t.dataTransfer.setData("text/plain",x),t.dataTransfer.effectAllowed="move",t.dataTransfer.setDragImage(sr,0,0)}}const zE=250;function ym(t,e,n=!0){const r=t.root.elementsFromPoint(e.left,e.top);for(const o of r)if(t.dom.contains(o))return n&&o.closest("[data-node-type=columnList]")?ym(t,{left:e.left+50,top:e.top},!1):oA(o,t)}function Mq(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},o=ym(e,r);if(!o)return;const i=o.node.getBoundingClientRect();return ym(e,{left:i.right-10,top:t.y},!1)}let Oq=class{constructor(e,n,r){qe(this,"state"),qe(this,"emitUpdate"),qe(this,"mousePos"),qe(this,"hoveredBlock"),qe(this,"menuFrozen",!1),qe(this,"isDragOrigin",!1),qe(this,"updateState",o=>{this.state=o,this.emitUpdate(this.state)}),qe(this,"updateStateFromMousePos",()=>{var o,i,s,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>zE){(o=this.state)!=null&&o.show&&(this.state.show=!1,this.updateState(this.state));return}const u=Mq(this.mousePos,this.pmView);if(!u||!this.editor.isEditable){(i=this.state)!=null&&i.show&&(this.state.show=!1,this.updateState(this.state));return}if(!((s=this.state)!=null&&s.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(),f=u.node.closest("[data-node-type=column]");this.state={show:!0,referencePos:new DOMRect(f?f.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)}}),qe(this,"onDragStart",o=>{var i;const s=(i=o.dataTransfer)==null?void 0:i.getData("blocknote/html");if(!s||this.pmView.dragging)return;const a=document.createElement("div");a.innerHTML=s;const l=hr.fromSchema(this.pmView.state.schema).parse(a,{topNode:this.pmView.state.schema.nodes.blockGroup.create()});this.pmView.dragging={slice:new Q(l.content,0,0),move:!0}}),qe(this,"findClosestEditorElement",o=>{const i=Array.from(this.pmView.root.querySelectorAll(".bn-editor"));if(i.length===0)return null;let s=i[0],a=Number.MAX_VALUE;return i.forEach(l=>{const c=l.querySelector(".bn-block-group").getBoundingClientRect(),u=o.clientX<c.left?c.left-o.clientX:o.clientX>c.right?o.clientX-c.right:0,d=o.clientY<c.top?c.top-o.clientY:o.clientY>c.bottom?o.clientY-c.bottom:0,f=Math.sqrt(Math.pow(u,2)+Math.pow(d,2));f<a&&(a=f,s=l)}),{element:s,distance:a}}),qe(this,"onDragOver",o=>{if(o.synthetic)return;const i=this.getDragEventContext(o);if(!i||!i.isDropPoint){this.closeDropCursor();return}i.isDropPoint&&!i.isDropWithinEditorBounds&&this.dispatchSyntheticEvent(o)}),qe(this,"closeDropCursor",()=>{const o=new Event("dragleave",{bubbles:!1});o.synthetic=!0,this.pmView.dom.dispatchEvent(o)}),qe(this,"getDragEventContext",o=>{var i;const s=!((i=o.dataTransfer)!=null&&i.types.includes("blocknote/html"))&&!!this.pmView.dragging,a=!!this.isDragOrigin,l=s||a,c=this.findClosestEditorElement(o);if(!c||c.distance>zE)return;const u=c.element===this.pmView.dom,d=u&&c.distance===0;if(!(!u&&!l))return{isDropPoint:u,isDropWithinEditorBounds:d,isDragOrigin:l}}),qe(this,"onDrop",o=>{if(o.synthetic)return;const i=this.getDragEventContext(o);if(!i){this.closeDropCursor();return}const{isDropPoint:s,isDropWithinEditorBounds:a,isDragOrigin:l}=i;if(!a&&s&&this.dispatchSyntheticEvent(o),s){if(this.pmView.dragging)return;this.pmView.dispatch(this.pmView.state.tr.setSelection(ae.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}}),qe(this,"onDragEnd",o=>{o.synthetic||(this.pmView.dragging=null)}),qe(this,"onKeyDown",o=>{var i;(i=this.state)!=null&&i.show&&this.editor.isFocused()&&(this.state.show=!1,this.emitUpdate(this.state))}),qe(this,"onMouseMove",o=>{var i;if(this.menuFrozen)return;this.mousePos={x:o.clientX,y:o.clientY};const s=this.pmView.dom.getBoundingClientRect(),a=this.mousePos.x>s.left&&this.mousePos.x<s.right&&this.mousePos.y>s.top&&this.mousePos.y<s.bottom,l=this.pmView.dom.parentElement;if(a&&o&&o.target&&!(l===o.target||l.contains(o.target))){(i=this.state)!=null&&i.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 Dq=new Oe("SideMenuPlugin"),Er=ze(({editor:t})=>{let e;const n=ei(void 0);return{key:"sideMenu",store:n,prosemirrorPlugins:[new ye({key:Dq,view:r=>(e=new Oq(t,r,o=>{n.setState({...o})}),e)})],blockDragStart(r,o){e&&(e.isDragOrigin=!0),Iq(r,o,t)},blockDragEnd(){iA(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 bn;function qE(t){bn||(bn=document.createElement("div"),bn.innerHTML="_",bn.style.opacity="0",bn.style.height="1px",bn.style.width="1px",t instanceof Document?t.body.appendChild(bn):t.appendChild(bn))}function Lq(t){bn&&(t instanceof Document?t.body.removeChild(bn):t.removeChild(bn),bn=void 0)}function kc(t){return Array.prototype.indexOf.call(t.parentElement.childNodes,t)}function Rq(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 Pq(t,e){const n=e.querySelectorAll(t);for(let r=0;r<n.length;r++)n[r].style.visibility="hidden"}let Bq=class{constructor(e,n,r){qe(this,"state"),qe(this,"emitUpdate"),qe(this,"tableId"),qe(this,"tablePos"),qe(this,"tableElement"),qe(this,"menuFrozen",!1),qe(this,"mouseState","up"),qe(this,"prevWasEditable",null),qe(this,"viewMousedownHandler",()=>{this.mouseState="down"}),qe(this,"mouseUpHandler",o=>{this.mouseState="up",this.mouseMoveHandler(o)}),qe(this,"mouseMoveHandler",o=>{var i,s,a,l,c,u,d;if(this.menuFrozen||this.mouseState==="selecting"||!(o.target instanceof Element)||!this.pmView.dom.contains(o.target))return;const f=Rq(o.target);if(f?.type==="cell"&&this.mouseState==="down"&&!((i=this.state)!=null&&i.draggingState)){this.mouseState="selecting",(s=this.state)!=null&&s.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 h=f.tbodyNode.getBoundingClientRect(),p=oA(f.domNode,this.pmView);if(!p)return;this.tableElement=p.node;let g;const b=this.editor.transact(T=>dn(p.id,T.doc));if(!b)throw new Error(`Block with ID ${p.id} not found`);const E=pt(b.node,this.editor.pmSchema,this.editor.schema.blockSchema,this.editor.schema.inlineContentSchema,this.editor.schema.styleSchema);if(st(this.editor,"table")&&(this.tablePos=b.posBeforeNode+1,g=E),!g)return;this.tableId=p.id;const x=(l=f.domNode.closest(".tableWrapper"))==null?void 0:l.querySelector(".table-widgets-container");if(f?.type==="wrapper"){const T=o.clientY>=h.bottom-1&&o.clientY<h.bottom+20,D=o.clientX>=h.right-1&&o.clientX<h.right+20,O=o.clientX>h.right||o.clientY>h.bottom;this.state={...this.state,show:!0,showAddOrRemoveRowsButton:T,showAddOrRemoveColumnsButton:D,referencePosTable:h,block:g,widgetContainer:x,colIndex:O||(c=this.state)==null?void 0:c.colIndex,rowIndex:O||(u=this.state)==null?void 0:u.rowIndex,referencePosCell:O||(d=this.state)==null?void 0:d.referencePosCell}}else{const T=kc(f.domNode),D=kc(f.domNode.parentElement),O=f.domNode.getBoundingClientRect();if(this.state!==void 0&&this.state.show&&this.tableId===p.id&&this.state.rowIndex===D&&this.state.colIndex===T)return;this.state={show:!0,showAddOrRemoveColumnsButton:T===g.content.rows[0].cells.length-1,showAddOrRemoveRowsButton:D===g.content.rows.length-1,referencePosTable:h,block:g,draggingState:void 0,referencePosCell:O,colIndex:T,rowIndex:D,widgetContainer:x}}return this.emitUpdate(),!1}),qe(this,"dragOverHandler",o=>{var i;if(((i=this.state)==null?void 0:i.draggingState)===void 0)return;o.preventDefault(),o.dataTransfer.dropEffect="move",Pq(".prosemirror-dropcursor-block, .prosemirror-dropcursor-inline",this.pmView.root);const s={left:Math.min(Math.max(o.clientX,this.state.referencePosTable.left+1),this.state.referencePosTable.right-1),top:Math.min(Math.max(o.clientY,this.state.referencePosTable.top+1),this.state.referencePosTable.bottom-1)},a=this.pmView.root.elementsFromPoint(s.left,s.top).filter(g=>g.tagName==="TD"||g.tagName==="TH");if(a.length===0)return;const l=a[0];let c=!1;const u=kc(l.parentElement),d=kc(l),f=this.state.draggingState.draggedCellOrientation==="row"?this.state.rowIndex:this.state.colIndex,h=(this.state.draggingState.draggedCellOrientation==="row"?u:d)!==f;(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"?s.top:s.left;this.state.draggingState.mousePos!==p&&(this.state.draggingState.mousePos=p,c=!0),c&&this.emitUpdate(),h&&this.editor.transact(g=>g.setMeta(Ta,!0))}),qe(this,"dropHandler",o=>{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.");o.preventDefault();const{draggingState:i,colIndex:s,rowIndex:a}=this.state,l=this.state.block.content.columnWidths;if(i.draggedCellOrientation==="row"){if(!m2(this.state.block,i.originalIndex,a))return!1;const c=H5(this.state.block,i.originalIndex,a);this.editor.updateBlock(this.state.block,{type:"table",content:{...this.state.block.content,rows:c}})}else{if(!g2(this.state.block,i.originalIndex,s))return!1;const c=F5(this.state.block,i.originalIndex,s),[u]=l.splice(i.originalIndex,1);l.splice(s,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}=Jg(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 o=this.tableElement.querySelector("tbody");if(!o)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 i=o.children[this.state.rowIndex].children[this.state.colIndex];i?this.state.referencePosCell=i.getBoundingClientRect():(this.state.rowIndex=void 0,this.state.colIndex=void 0)}this.state.referencePosTable=o.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 Ta=new Oe("TableHandlesPlugin"),dt=ze(({editor:t})=>{let e;const n=ei(void 0);return{key:"tableHandles",store:n,prosemirrorPlugins:[new ye({key:Ta,view:r=>(e=new Bq(t,r,o=>{n.setState({...o,draggingState:o.draggingState?{...o.draggingState}: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 o=e.state.draggingState.draggedCellOrientation==="row"?e.state.rowIndex:e.state.colIndex;if(o===void 0)return;const i=[],{block:s,draggingState:a}=e.state,{originalIndex:l,draggedCellOrientation:c}=a;if(o===l||!s||c==="row"&&!m2(s,l,o)||c==="col"&&!g2(s,l,o))return ke.create(r.doc,i);const u=r.doc.resolve(e.tablePos+1);return e.state.draggingState.draggedCellOrientation==="row"?jp(e.state.block,o).forEach(({row:d,col:f})=>{const h=r.doc.resolve(u.posAtIndex(d)+1),p=r.doc.resolve(h.posAtIndex(f)+1),g=p.node(),b=p.pos+(o>l?g.nodeSize-2:0);i.push(je.widget(b,()=>{const E=document.createElement("div");return E.className="bn-table-drop-cursor",E.style.left="0",E.style.right="0",o>l?E.style.bottom="-2px":E.style.top="-3px",E.style.height="4px",E}))}):zp(e.state.block,o).forEach(({row:d,col:f})=>{const h=r.doc.resolve(u.posAtIndex(d)+1),p=r.doc.resolve(h.posAtIndex(f)+1),g=p.node(),b=p.pos+(o>l?g.nodeSize-2:0);i.push(je.widget(b,()=>{const E=document.createElement("div");return E.className="bn-table-drop-cursor",E.style.top="0",E.style.bottom="0",o>l?E.style.right="-2px":E.style.left="-3px",E.style.width="4px",E}))}),ke.create(r.doc,i)}}})],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(o=>o.setMeta(Ta,{draggedCellOrientation:e.state.draggingState.draggedCellOrientation,originalIndex:e.state.colIndex,newIndex:e.state.colIndex,tablePos:e.tablePos})),!t.headless&&(qE(t.prosemirrorView.root),r.dataTransfer.setDragImage(bn,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(o=>o.setMeta(Ta,{draggedCellOrientation:e.state.draggingState.draggedCellOrientation,originalIndex:e.state.rowIndex,newIndex:e.state.rowIndex,tablePos:e.tablePos})),!t.headless&&(qE(t.prosemirrorView.root),r.dataTransfer.setDragImage(bn,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(Ta,null)),!t.headless&&Lq(t.prosemirrorView.root)},freezeHandles(){e.menuFrozen=!0},unfreezeHandles(){e.menuFrozen=!1},getCellsAtRowHandle(r,o){return jp(r,o)},getCellsAtColumnHandle(r,o){return zp(r,o)},setCellSelection(r,o,i=o){if(!e)throw new Error("Table handles view not initialized");const s=r.doc.resolve(e.tablePos+1),a=r.doc.resolve(s.posAtIndex(o.row)+1),l=r.doc.resolve(a.posAtIndex(o.col)),c=r.doc.resolve(s.posAtIndex(i.row)+1),u=r.doc.resolve(c.posAtIndex(i.col)),d=r.tr;return d.setSelection(new Ge(l,u)),r.apply(d)},addRowOrColumn(r,o){t.exec((i,s)=>{const a=this.setCellSelection(i,o.orientation==="row"?{row:r,col:0}:{row:0,col:r});return o.orientation==="row"?o.side==="above"?dP(a,s):fP(a,s):o.side==="left"?sP(a,s):aP(a,s)})},removeRowOrColumn(r,o){return o==="row"?t.exec((i,s)=>{const a=this.setCellSelection(i,{row:r,col:0});return pP(a,s)}):t.exec((i,s)=>{const a=this.setCellSelection(i,{row:0,col:r});return cP(a,s)})},mergeCells(r){return t.exec((o,i)=>{const s=r?this.setCellSelection(o,r.relativeStartCell,r.relativeEndCell):o;return gP(s,i)})},splitCell(r){return t.exec((o,i)=>{const s=r?this.setCellSelection(o,r):o;return bP(s,i)})},getCellSelection(){return t.transact(r=>{const o=r.selection;let i=o.$from,s=o.$to;if(Jp(o)){const{ranges:g}=o;g.forEach(b=>{i=b.$from.min(i??b.$from),s=b.$to.max(s??b.$to)})}else if(i=r.doc.resolve(o.$from.pos-o.$from.parentOffset-1),s=r.doc.resolve(o.$to.pos-o.$to.parentOffset-1),i.pos===0||s.pos===0)return;const a=r.doc.resolve(i.pos-i.parentOffset-1),l=r.doc.resolve(s.pos-s.parentOffset-1),c=r.doc.resolve(a.pos-a.parentOffset-1),u=i.index(a.depth),d=a.index(c.depth),f=s.index(l.depth),h=l.index(c.depth),p=[];for(let g=d;g<=h;g++)for(let b=u;b<=f;b++)p.push({row:g,col:b});return{from:{row:d,col:u},to:{row:h,col:f},cells:p}})},getMergeDirection(r){return t.transact(o=>{const i=Jp(o.selection)?o.selection:void 0;if(!i||!r||i.ranges.length<=1)return;const s=this.getCellSelection();if(s)return $5(s.from,s.to,r)?"vertical":"horizontal"})},cropEmptyRowsOrColumns(r,o){return U5(r,o)},addRowsOrColumns(r,o,i){return V5(r,o,i)}}}),WE=new Oe("trailingNode"),Fq=ze(()=>({key:"trailingNode",prosemirrorPlugins:[new ye({key:WE,appendTransaction:(t,e,n)=>{const{doc:r,tr:o,schema:i}=n,s=WE.getState(n),a=r.content.size-2,l=i.nodes.blockContainer,c=i.nodes.paragraph;if(s)return o.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*"}}})]}));let Dh;async function Hq(){return Dh||(Dh=(async()=>{const[t,e]=await Promise.all([eu(()=>import("./module-RjUF93sV.js"),[]),eu(()=>import("./native-48B9X9Wg.js"),[])]),n="default"in t?t.default:t,r="default"in e?e.default:e;return await n.init({data:r}),{emojiMart:n,emojiData:r}})(),Dh)}async function Uq(t,e){if(!("text"in t.schema.inlineContentSchema)||t.schema.inlineContentSchema.text!==VB.text)return[];const{emojiData:n,emojiMart:r}=await Hq();return(e.trim()===""?Object.values(n.emojis):await r.SearchIndex.search(e)).map(o=>({id:o.skins[0].native,onItemClick:()=>t.insertInlineContent(o.skins[0].native+" ")}))}function Em(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&AC(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function fa(t){return"composedPath"in t?t.composedPath()[0]:t.target}function Lh(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const n=t;return n.target!=null&&e.contains(n.target)}function Vq(t){return t.matches("html,body")}function ds(t){return t?.ownerDocument||document}function Zc(t,e,n){return n===void 0&&(n=!0),t.filter(o=>{var i;return o.parentId===e&&(!n||((i=o.context)==null?void 0:i.open))}).flatMap(o=>[o,...Zc(t,o.id,n)])}function $q(t){return"nativeEvent"in t}function xm(t,e){const n=["mouse","pen"];return n.push("",void 0),n.includes(t)}var jq=typeof document<"u",zq=function(){},Xo=jq?C.useLayoutEffect:zq;const qq={...bC};function Bo(t){const e=C.useRef(t);return Xo(()=>{e.current=t}),e}const Wq=qq.useInsertionEffect,Gq=Wq||(t=>t());function Mr(t){const e=C.useRef(()=>{});return Gq(()=>{e.current=t}),C.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.current==null?void 0:e.current(...r)},[])}function Yq(t){const e=C.useRef(void 0),n=C.useCallback(r=>{const o=t.map(i=>{if(i!=null){if(typeof i=="function"){const s=i,a=s(r);return typeof a=="function"?a:()=>{s(null)}}return i.current=r,()=>{i.current=null}}});return()=>{o.forEach(i=>i?.())}},t);return C.useMemo(()=>t.every(r=>r==null)?null:r=>{e.current&&(e.current(),e.current=void 0),r!=null&&(e.current=n(r))},t)}const Kq="data-floating-ui-focusable",GE="active",YE="selected",Qq={...bC};let KE=!1,Xq=0;const QE=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Xq++;function Zq(){const[t,e]=C.useState(()=>KE?QE():void 0);return Xo(()=>{t==null&&e(QE())},[]),C.useEffect(()=>{KE=!0},[]),t}const Jq=Qq.useId,eW=Jq||Zq;function tW(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(o=>o(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var r;(r=t.get(e))==null||r.delete(n)}}}const nW=C.createContext(null),rW=C.createContext(null),sA=()=>{var t;return((t=C.useContext(nW))==null?void 0:t.id)||null},R0=()=>C.useContext(rW);function aA(t){return"data-floating-ui-"+t}function _n(t){t.current!==-1&&(clearTimeout(t.current),t.current=-1)}const XE=aA("safe-polygon");function Rh(t,e,n){if(n&&!xm(n))return 0;if(typeof t=="number")return t;if(typeof t=="function"){const r=t();return typeof r=="number"?r:r?.[e]}return t?.[e]}function Ph(t){return typeof t=="function"?t():t}function oW(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:s}=t,{enabled:a=!0,delay:l=0,handleClose:c=null,mouseOnly:u=!1,restMs:d=0,move:f=!0}=e,h=R0(),p=sA(),g=Bo(c),b=Bo(l),E=Bo(n),x=Bo(d),T=C.useRef(),D=C.useRef(-1),O=C.useRef(),v=C.useRef(-1),R=C.useRef(!0),j=C.useRef(!1),z=C.useRef(()=>{}),I=C.useRef(!1),X=Mr(()=>{var Z;const ee=(Z=o.current.openEvent)==null?void 0:Z.type;return ee?.includes("mouse")&&ee!=="mousedown"});C.useEffect(()=>{if(!a)return;function Z(ee){let{open:ie}=ee;ie||(_n(D),_n(v),R.current=!0,I.current=!1)}return i.on("openchange",Z),()=>{i.off("openchange",Z)}},[a,i]),C.useEffect(()=>{if(!a||!g.current||!n)return;function Z(ie){X()&&r(!1,ie,"hover")}const ee=ds(s.floating).documentElement;return ee.addEventListener("mouseleave",Z),()=>{ee.removeEventListener("mouseleave",Z)}},[s.floating,n,r,a,g,X]);const F=C.useCallback(function(Z,ee,ie){ee===void 0&&(ee=!0),ie===void 0&&(ie="hover");const S=Rh(b.current,"close",T.current);S&&!O.current?(_n(D),D.current=window.setTimeout(()=>r(!1,Z,ie),S)):ee&&(_n(D),r(!1,Z,ie))},[b,r]),W=Mr(()=>{z.current(),O.current=void 0}),B=Mr(()=>{if(j.current){const Z=ds(s.floating).body;Z.style.pointerEvents="",Z.removeAttribute(XE),j.current=!1}}),q=Mr(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);C.useEffect(()=>{if(!a)return;function Z(be){if(_n(D),R.current=!1,u&&!xm(T.current)||Ph(x.current)>0&&!Rh(b.current,"open"))return;const _=Rh(b.current,"open",T.current);_?D.current=window.setTimeout(()=>{E.current||r(!0,be,"hover")},_):n||r(!0,be,"hover")}function ee(be){if(q()){B();return}z.current();const _=ds(s.floating);if(_n(v),I.current=!1,g.current&&o.current.floatingContext){n||_n(D),O.current=g.current({...o.current.floatingContext,tree:h,x:be.clientX,y:be.clientY,onClose(){B(),W(),q()||F(be,!0,"safe-polygon")}});const Ue=O.current;_.addEventListener("mousemove",Ue),z.current=()=>{_.removeEventListener("mousemove",Ue)};return}(T.current==="touch"?!Em(s.floating,be.relatedTarget):!0)&&F(be)}function ie(be){q()||o.current.floatingContext&&(g.current==null||g.current({...o.current.floatingContext,tree:h,x:be.clientX,y:be.clientY,onClose(){B(),W(),q()||F(be)}})(be))}function S(){_n(D)}function Ee(be){q()||F(be,!1)}if(On(s.domReference)){const be=s.domReference,_=s.floating;return n&&be.addEventListener("mouseleave",ie),f&&be.addEventListener("mousemove",Z,{once:!0}),be.addEventListener("mouseenter",Z),be.addEventListener("mouseleave",ee),_&&(_.addEventListener("mouseleave",ie),_.addEventListener("mouseenter",S),_.addEventListener("mouseleave",Ee)),()=>{n&&be.removeEventListener("mouseleave",ie),f&&be.removeEventListener("mousemove",Z),be.removeEventListener("mouseenter",Z),be.removeEventListener("mouseleave",ee),_&&(_.removeEventListener("mouseleave",ie),_.removeEventListener("mouseenter",S),_.removeEventListener("mouseleave",Ee))}}},[s,a,t,u,f,F,W,B,r,n,E,h,b,g,o,q,x]),Xo(()=>{var Z;if(a&&n&&(Z=g.current)!=null&&(Z=Z.__options)!=null&&Z.blockPointerEvents&&X()){j.current=!0;const ie=s.floating;if(On(s.domReference)&&ie){var ee;const S=ds(s.floating).body;S.setAttribute(XE,"");const Ee=s.domReference,be=h==null||(ee=h.nodesRef.current.find(_=>_.id===p))==null||(ee=ee.context)==null?void 0:ee.elements.floating;return be&&(be.style.pointerEvents=""),S.style.pointerEvents="none",Ee.style.pointerEvents="auto",ie.style.pointerEvents="auto",()=>{S.style.pointerEvents="",Ee.style.pointerEvents="",ie.style.pointerEvents=""}}}},[a,n,p,s,h,g,X]),Xo(()=>{n||(T.current=void 0,I.current=!1,W(),B())},[n,W,B]),C.useEffect(()=>()=>{W(),_n(D),_n(v),B()},[a,s.domReference,W,B]);const oe=C.useMemo(()=>{function Z(ee){T.current=ee.pointerType}return{onPointerDown:Z,onPointerEnter:Z,onMouseMove(ee){const{nativeEvent:ie}=ee;function S(){!R.current&&!E.current&&r(!0,ie,"hover")}u&&!xm(T.current)||n||Ph(x.current)===0||I.current&&ee.movementX**2+ee.movementY**2<2||(_n(v),T.current==="touch"?S():(I.current=!0,v.current=window.setTimeout(S,Ph(x.current))))}}},[u,r,n,E,x]);return C.useMemo(()=>a?{reference:oe}:{},[a,oe])}function Bh(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&AC(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function iW(t){return"composedPath"in t?t.composedPath()[0]:t.target}const sW={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},aW={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},ZE=t=>{var e,n;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(n=t?.outsidePress)!=null?n:!0}};function lW(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,elements:o,dataRef:i}=t,{enabled:s=!0,escapeKey:a=!0,outsidePress:l=!0,outsidePressEvent:c="pointerdown",referencePress:u=!1,referencePressEvent:d="pointerdown",ancestorScroll:f=!1,bubbles:h,capture:p}=e,g=R0(),b=Mr(typeof l=="function"?l:()=>!1),E=typeof l=="function"?b:l,x=C.useRef(!1),{escapeKey:T,outsidePress:D}=ZE(h),{escapeKey:O,outsidePress:v}=ZE(p),R=C.useRef(!1),j=Mr(B=>{var q;if(!n||!s||!a||B.key!=="Escape"||R.current)return;const oe=(q=i.current.floatingContext)==null?void 0:q.nodeId,Z=g?Zc(g.nodesRef.current,oe):[];if(!T&&(B.stopPropagation(),Z.length>0)){let ee=!0;if(Z.forEach(ie=>{var S;if((S=ie.context)!=null&&S.open&&!ie.context.dataRef.current.__escapeKeyBubbles){ee=!1;return}}),!ee)return}r(!1,$q(B)?B.nativeEvent:B,"escape-key")}),z=Mr(B=>{var q;const oe=()=>{var Z;j(B),(Z=fa(B))==null||Z.removeEventListener("keydown",oe)};(q=fa(B))==null||q.addEventListener("keydown",oe)}),I=Mr(B=>{var q;const oe=i.current.insideReactTree;i.current.insideReactTree=!1;const Z=x.current;if(x.current=!1,c==="click"&&Z||oe||typeof E=="function"&&!E(B))return;const ee=fa(B),ie="["+aA("inert")+"]",S=ds(o.floating).querySelectorAll(ie);let Ee=On(ee)?ee:null;for(;Ee&&!_f(Ee);){const Ue=f3(Ee);if(_f(Ue)||!On(Ue))break;Ee=Ue}if(S.length&&On(ee)&&!Vq(ee)&&!Em(ee,o.floating)&&Array.from(S).every(Ue=>!Em(Ee,Ue)))return;if(h3(ee)&&W){const Ue=_f(ee),Ve=p3(ee),Lt=/auto|scroll/,$e=Ue||Lt.test(Ve.overflowX),Ye=Ue||Lt.test(Ve.overflowY),xt=$e&&ee.clientWidth>0&&ee.scrollWidth>ee.clientWidth,Rt=Ye&&ee.clientHeight>0&&ee.scrollHeight>ee.clientHeight,Vn=Ve.direction==="rtl",Gi=Rt&&(Vn?B.offsetX<=ee.offsetWidth-ee.clientWidth:B.offsetX>ee.clientWidth),ta=xt&&B.offsetY>ee.clientHeight;if(Gi||ta)return}const be=(q=i.current.floatingContext)==null?void 0:q.nodeId,_=g&&Zc(g.nodesRef.current,be).some(Ue=>{var Ve;return Lh(B,(Ve=Ue.context)==null?void 0:Ve.elements.floating)});if(Lh(B,o.floating)||Lh(B,o.domReference)||_)return;const ft=g?Zc(g.nodesRef.current,be):[];if(ft.length>0){let Ue=!0;if(ft.forEach(Ve=>{var Lt;if((Lt=Ve.context)!=null&&Lt.open&&!Ve.context.dataRef.current.__outsidePressBubbles){Ue=!1;return}}),!Ue)return}r(!1,B,"outside-press")}),X=Mr(B=>{var q;const oe=()=>{var Z;I(B),(Z=fa(B))==null||Z.removeEventListener(c,oe)};(q=fa(B))==null||q.addEventListener(c,oe)});C.useEffect(()=>{if(!n||!s)return;i.current.__escapeKeyBubbles=T,i.current.__outsidePressBubbles=D;let B=-1;function q(S){r(!1,S,"ancestor-scroll")}function oe(){window.clearTimeout(B),R.current=!0}function Z(){B=window.setTimeout(()=>{R.current=!1},d3()?5:0)}const ee=ds(o.floating);a&&(ee.addEventListener("keydown",O?z:j,O),ee.addEventListener("compositionstart",oe),ee.addEventListener("compositionend",Z)),E&&ee.addEventListener(c,v?X:I,v);let ie=[];return f&&(On(o.domReference)&&(ie=Af(o.domReference)),On(o.floating)&&(ie=ie.concat(Af(o.floating))),!On(o.reference)&&o.reference&&o.reference.contextElement&&(ie=ie.concat(Af(o.reference.contextElement)))),ie=ie.filter(S=>{var Ee;return S!==((Ee=ee.defaultView)==null?void 0:Ee.visualViewport)}),ie.forEach(S=>{S.addEventListener("scroll",q,{passive:!0})}),()=>{a&&(ee.removeEventListener("keydown",O?z:j,O),ee.removeEventListener("compositionstart",oe),ee.removeEventListener("compositionend",Z)),E&&ee.removeEventListener(c,v?X:I,v),ie.forEach(S=>{S.removeEventListener("scroll",q)}),window.clearTimeout(B)}},[i,o,a,E,c,n,r,f,s,T,D,j,O,z,I,v,X]),C.useEffect(()=>{i.current.insideReactTree=!1},[i,E,c]);const F=C.useMemo(()=>({onKeyDown:j,...u&&{[sW[d]]:B=>{r(!1,B.nativeEvent,"reference-press")},...d!=="click"&&{onClick(B){r(!1,B.nativeEvent,"reference-press")}}}}),[j,r,u,d]),W=C.useMemo(()=>({onKeyDown:j,onMouseDown(){x.current=!0},onMouseUp(){x.current=!0},[aW[c]]:()=>{i.current.insideReactTree=!0}}),[j,c,i]);return C.useMemo(()=>s?{reference:F,floating:W}:{},[s,F,W])}function cW(t){const{open:e=!1,onOpenChange:n,elements:r}=t,o=eW(),i=C.useRef({}),[s]=C.useState(()=>tW()),a=sA()!=null,[l,c]=C.useState(r.reference),u=Mr((h,p,g)=>{i.current.openEvent=h?p:void 0,s.emit("openchange",{open:h,event:p,reason:g,nested:a}),n?.(h,p,g)}),d=C.useMemo(()=>({setPositionReference:c}),[]),f=C.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return C.useMemo(()=>({dataRef:i,open:e,onOpenChange:u,elements:f,events:s,floatingId:o,refs:d}),[e,u,f,s,o,d])}function uW(t){t===void 0&&(t={});const{nodeId:e}=t,n=cW({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,o=r.elements,[i,s]=C.useState(null),[a,l]=C.useState(null),u=o?.domReference||i,d=C.useRef(null),f=R0();Xo(()=>{u&&(d.current=u)},[u]);const h=u3({...t,elements:{...o,...a&&{reference:a}}}),p=C.useCallback(T=>{const D=On(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),getClientRects:()=>T.getClientRects(),contextElement:T}:T;l(D),h.refs.setReference(D)},[h.refs]),g=C.useCallback(T=>{(On(T)||T===null)&&(d.current=T,s(T)),(On(h.refs.reference.current)||h.refs.reference.current===null||T!==null&&!On(T))&&h.refs.setReference(T)},[h.refs]),b=C.useMemo(()=>({...h.refs,setReference:g,setPositionReference:p,domReference:d}),[h.refs,g,p]),E=C.useMemo(()=>({...h.elements,domReference:u}),[h.elements,u]),x=C.useMemo(()=>({...h,...r,refs:b,elements:E,nodeId:e}),[h,b,E,e,r]);return Xo(()=>{r.dataRef.current.floatingContext=x;const T=f?.nodesRef.current.find(D=>D.id===e);T&&(T.context=x)}),C.useMemo(()=>({...h,context:x,refs:b,elements:E}),[h,b,E,x])}function Fh(t,e,n){const r=new Map,o=n==="item";let i=t;if(o&&t){const{[GE]:s,[YE]:a,...l}=t;i=l}return{...n==="floating"&&{tabIndex:-1,[Kq]:""},...i,...e.map(s=>{const a=s?s[n]:null;return typeof a=="function"?t?a(t):null:a}).concat(t).reduce((s,a)=>(a&&Object.entries(a).forEach(l=>{let[c,u]=l;if(!(o&&[GE,YE].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var d;(d=r.get(c))==null||d.push(u),s[c]=function(){for(var f,h=arguments.length,p=new Array(h),g=0;g<h;g++)p[g]=arguments[g];return(f=r.get(c))==null?void 0:f.map(b=>b(...p)).find(b=>b!==void 0)}}}else s[c]=u}),s),{})}}function dW(t){t===void 0&&(t=[]);const e=t.map(a=>a?.reference),n=t.map(a=>a?.floating),r=t.map(a=>a?.item),o=C.useCallback(a=>Fh(a,t,"reference"),e),i=C.useCallback(a=>Fh(a,t,"floating"),n),s=C.useCallback(a=>Fh(a,t,"item"),r);return C.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:s}),[o,i,s])}const JE=t=>t.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,n)=>(n?"-":"")+e.toLowerCase());function Ji(t,e){return typeof t=="function"?t(e):t}function fW(t,e){const[n,r]=C.useState(t);return t&&!n&&r(!0),C.useEffect(()=>{if(!t&&n){const o=setTimeout(()=>r(!1),e);return()=>clearTimeout(o)}},[t,n,e]),n}function lA(t,e){e===void 0&&(e={});const{open:n,elements:{floating:r}}=t,{duration:o=250}=e,s=(typeof o=="number"?o:o.close)||0,[a,l]=C.useState("unmounted"),c=fW(n,s);return!c&&a==="close"&&l("unmounted"),Xo(()=>{if(r){if(n){l("initial");const u=requestAnimationFrame(()=>{ki.flushSync(()=>{l("open")})});return()=>{cancelAnimationFrame(u)}}l("close")}},[n,r]),{isMounted:c,status:a}}function hW(t,e){e===void 0&&(e={});const{initial:n={opacity:0},open:r,close:o,common:i,duration:s=250}=e,a=t.placement,l=a.split("-")[0],c=C.useMemo(()=>({side:l,placement:a}),[l,a]),u=typeof s=="number",d=(u?s:s.open)||0,f=(u?s:s.close)||0,[h,p]=C.useState(()=>({...Ji(i,c),...Ji(n,c)})),{isMounted:g,status:b}=lA(t,{duration:s}),E=Bo(n),x=Bo(r),T=Bo(o),D=Bo(i);return Xo(()=>{const O=Ji(E.current,c),v=Ji(T.current,c),R=Ji(D.current,c),j=Ji(x.current,c)||Object.keys(O).reduce((z,I)=>(z[I]="",z),{});if(b==="initial"&&p(z=>({transitionProperty:z.transitionProperty,...R,...O})),b==="open"&&p({transitionProperty:Object.keys(j).map(JE).join(","),transitionDuration:d+"ms",...R,...j}),b==="close"){const z=v||O;p({transitionProperty:Object.keys(z).map(JE).join(","),transitionDuration:f+"ms",...R,...z})}},[f,T,E,x,D,d,b,c]),{isMounted:g,styles:h}}function cA(t,e,n){return n===void 0&&(n=!0),t.filter(o=>{var i;return o.parentId===e&&(!n||((i=o.context)==null?void 0:i.open))}).flatMap(o=>[o,...cA(t,o.id,n)])}function ex(t,e){const[n,r]=t;let o=!1;const i=e.length;for(let s=0,a=i-1;s<i;a=s++){const[l,c]=e[s]||[0,0],[u,d]=e[a]||[0,0];c>=r!=d>=r&&n<=(u-l)*(r-c)/(d-c)+l&&(o=!o)}return o}function pW(t,e){return t[0]>=e.x&&t[0]<=e.x+e.width&&t[1]>=e.y&&t[1]<=e.y+e.height}function mW(t){t===void 0&&(t={});const{buffer:e=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=t,o={current:-1};let i=!1,s=null,a=null,l=typeof performance<"u"?performance.now():0;function c(d,f){const h=performance.now(),p=h-l;if(s===null||a===null||p===0)return s=d,a=f,l=h,null;const g=d-s,b=f-a,x=Math.sqrt(g*g+b*b)/p;return s=d,a=f,l=h,x}const u=d=>{let{x:f,y:h,placement:p,elements:g,onClose:b,nodeId:E,tree:x}=d;return function(D){function O(){_n(o),b()}if(_n(o),!g.domReference||!g.floating||p==null||f==null||h==null)return;const{clientX:v,clientY:R}=D,j=[v,R],z=iW(D),I=D.type==="mouseleave",X=Bh(g.floating,z),F=Bh(g.domReference,z),W=g.domReference.getBoundingClientRect(),B=g.floating.getBoundingClientRect(),q=p.split("-")[0],oe=f>B.right-B.width/2,Z=h>B.bottom-B.height/2,ee=pW(j,W),ie=B.width>W.width,S=B.height>W.height,Ee=(ie?W:B).left,be=(ie?W:B).right,_=(S?W:B).top,ft=(S?W:B).bottom;if(X&&(i=!0,!I))return;if(F&&(i=!1),F&&!I){i=!0;return}if(I&&On(D.relatedTarget)&&Bh(g.floating,D.relatedTarget)||x&&cA(x.nodesRef.current,E).length)return;if(q==="top"&&h>=W.bottom-1||q==="bottom"&&h<=W.top+1||q==="left"&&f>=W.right-1||q==="right"&&f<=W.left+1)return O();let Ue=[];switch(q){case"top":Ue=[[Ee,W.top+1],[Ee,B.bottom-1],[be,B.bottom-1],[be,W.top+1]];break;case"bottom":Ue=[[Ee,B.top+1],[Ee,W.bottom-1],[be,W.bottom-1],[be,B.top+1]];break;case"left":Ue=[[B.right-1,ft],[B.right-1,_],[W.left+1,_],[W.left+1,ft]];break;case"right":Ue=[[W.right-1,ft],[W.right-1,_],[B.left+1,_],[B.left+1,ft]];break}function Ve(Lt){let[$e,Ye]=Lt;switch(q){case"top":{const xt=[ie?$e+e/2:oe?$e+e*4:$e-e*4,Ye+e+1],Rt=[ie?$e-e/2:oe?$e+e*4:$e-e*4,Ye+e+1],Vn=[[B.left,oe||ie?B.bottom-e:B.top],[B.right,oe?ie?B.bottom-e:B.top:B.bottom-e]];return[xt,Rt,...Vn]}case"bottom":{const xt=[ie?$e+e/2:oe?$e+e*4:$e-e*4,Ye-e],Rt=[ie?$e-e/2:oe?$e+e*4:$e-e*4,Ye-e],Vn=[[B.left,oe||ie?B.top+e:B.bottom],[B.right,oe?ie?B.top+e:B.bottom:B.top+e]];return[xt,Rt,...Vn]}case"left":{const xt=[$e+e+1,S?Ye+e/2:Z?Ye+e*4:Ye-e*4],Rt=[$e+e+1,S?Ye-e/2:Z?Ye+e*4:Ye-e*4];return[...[[Z||S?B.right-e:B.left,B.top],[Z?S?B.right-e:B.left:B.right-e,B.bottom]],xt,Rt]}case"right":{const xt=[$e-e,S?Ye+e/2:Z?Ye+e*4:Ye-e*4],Rt=[$e-e,S?Ye-e/2:Z?Ye+e*4:Ye-e*4],Vn=[[Z||S?B.left+e:B.right,B.top],[Z?S?B.left+e:B.right:B.left+e,B.bottom]];return[xt,Rt,...Vn]}}}if(!ex([v,R],Ue)){if(i&&!ee)return O();if(!I&&r){const Lt=c(D.clientX,D.clientY);if(Lt!==null&&Lt<.1)return O()}ex([v,R],Ve([f,h]))?!i&&r&&(o.current=window.setTimeout(O,40)):O()}}};return u.__options={blockPointerEvents:n},u}var gW=Object.defineProperty,bW=(t,e,n)=>e in t?gW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Qr=(t,e,n)=>bW(t,typeof e!="symbol"?e+"":e,n);function yW(t){const e=xW(t);let{roots:n,nonRoots:r}=tx(e);const o=[];for(;n.size;){o.push(n);const i=new Set;for(const s of n){const a=t.get(s);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&&i.add(l)}}n=i}if(r=tx(e).nonRoots,r.size)throw new Error(`Cycle(s) detected; toposort only works on acyclic graphs. Cyclic nodes: ${Array.from(r).join(", ")}`);return o}function EW(t){const e=CW(t);return yW(e)}function xW(t){const e=new Map;for(const[n,r]of t.entries()){e.has(n)||e.set(n,0);for(const o of r){const i=e.get(o)??0;e.set(o,i+1)}}return e}function tx(t){const e=new Set,n=new Set;for(const[r,o]of t.entries())o===0?e.add(r):n.add(r);return{roots:e,nonRoots:n}}function CW(t){const e=new Map;for(const[n,r]of t.entries()){e.has(n)||e.set(n,new Set);for(const o of r)e.has(o)||e.set(o,new Set),e.get(o).add(n)}return e}function kW(){return new Map}function nx(t,e,n){return t.has(e)||t.set(e,new Set),t.get(e).add(n),t}function uA(t){const e=kW();for(const o of t)Array.isArray(o.runsBefore)&&o.runsBefore.length>0?o.runsBefore.forEach(i=>{nx(e,o.key,i)}):nx(e,"default",o.key);const n=EW(e),r=n.findIndex(o=>o.has("default"));return o=>91+(n.findIndex(i=>i.has(o))+r)*10}function rx(t){return t&&Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0))}class TW{constructor(e){Qr(this,"BlockNoteEditor","only for types"),Qr(this,"Block","only for types"),Qr(this,"PartialBlock","only for types"),Qr(this,"inlineContentSpecs"),Qr(this,"styleSpecs"),Qr(this,"blockSpecs"),Qr(this,"blockSchema"),Qr(this,"inlineContentSchema"),Qr(this,"styleSchema"),this.opts=e;const{blockSpecs:n,inlineContentSpecs:r,styleSpecs:o,blockSchema:i,inlineContentSchema:s,styleSchema:a}=this.init();this.blockSpecs=n,this.styleSpecs=o,this.styleSchema=a,this.inlineContentSpecs=r,this.blockSchema=i,this.inlineContentSchema=s}init(){const e=uA(Object.entries({...this.opts.blockSpecs,...this.opts.inlineContentSpecs,...this.opts.styleSpecs}).map(([i,s])=>{var a;return{key:i,runsBefore:((a=s.implementation)==null?void 0:a.runsBefore)??[]}})),n=Object.fromEntries(Object.entries(this.opts.blockSpecs).map(([i,s])=>[i,k8(s.config,s.implementation,s.extensions,e(i))])),r=Object.fromEntries(Object.entries(this.opts.inlineContentSpecs).map(([i,s])=>{var a;return typeof s.config!="object"?[i,s]:[i,{...s,implementation:{...s.implementation,node:(a=s.implementation)==null?void 0:a.node.extend({priority:e(i)})}}]})),o=Object.fromEntries(Object.entries(this.opts.styleSpecs).map(([i,s])=>{var a;return[i,{...s,implementation:{...s.implementation,mark:(a=s.implementation)==null?void 0:a.mark.extend({priority:e(i)})}}]}));return{blockSpecs:n,blockSchema:Object.fromEntries(Object.entries(n).map(([i,s])=>[i,s.config])),inlineContentSpecs:rx(r),styleSpecs:rx(o),inlineContentSchema:N2(r),styleSchema:M2(o)}}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:o,blockSchema:i,inlineContentSchema:s,styleSchema:a}=this.init();return this.blockSpecs=n,this.styleSpecs=o,this.styleSchema=a,this.inlineContentSpecs=r,this.blockSchema=i,this.inlineContentSchema=s,this}}let P0=class dA extends TW{static create(e){return new dA({blockSpecs:e?.blockSpecs??V2,inlineContentSpecs:e?.inlineContentSpecs??$2,styleSpecs:e?.styleSpecs??l0})}};const wW={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 Wi{match;handler;undoable;inCode;inCodeMark;constructor(e,n,r={}){this.match=e,this.match=e,this.handler=typeof n=="string"?SW(n):n,this.undoable=r.undoable!==!1,this.inCode=r.inCode||!1,this.inCodeMark=r.inCodeMark!==!1}}function SW(t){return function(e,n,r,o){let i=t;if(n[1]){let s=n[0].lastIndexOf(n[1]);i+=n[0].slice(s+n[1].length),r+=s;let a=r-o;a>0&&(i=n[0].slice(s-a,s)+i,r=o)}return e.tr.insertText(i,r,o)}}const vW=500;function AW({rules:t}){let e=new ye({state:{init(){return null},apply(n,r){let o=n.getMeta(this);return o||(n.selectionSet||n.docChanged?null:r)}},props:{handleTextInput(n,r,o,i){return ox(n,r,o,i,t,e)},handleDOMEvents:{compositionend:n=>{setTimeout(()=>{let{$cursor:r}=n.state.selection;r&&ox(n,r.pos,r.pos,"",t,e)})}}},isInputRules:!0});return e}function ox(t,e,n,r,o,i){if(t.composing)return!1;const s=t.state.tr.insertText(r,e,n),a=s.mapping.map(e),l=s.mapping.map(n);let c=t.state.apply(s),u=c.doc.resolve(a),d=u.parent.textBetween(Math.max(0,u.parentOffset-vW),u.parentOffset,null,"");for(let f=0;f<o.length;f++){let h=o[f];if(!h.inCodeMark&&u.marks().some(b=>b.type.spec.code))continue;if(u.parent.type.spec.code){if(!h.inCode)continue}else if(h.inCode==="only")continue;let p=h.match.exec(d),g=p&&p[0].length>=r.length&&h.handler(c,p,a-p[0].length,l);if(g)return t.dispatch(s),t.dispatch(QB(t.state.tr)),h.undoable&&g.setMeta(i,{transform:g,from:a,to:l,text:r}),t.dispatch(g),!0}return!1}new Wi(/--$/,"—",{inCodeMark:!1});new Wi(/\.\.\.$/,"…",{inCodeMark:!1});new Wi(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1});new Wi(/"$/,"”",{inCodeMark:!1});new Wi(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1});new Wi(/'$/,"’",{inCodeMark:!1});class gt extends me{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return gt.valid(r)?new gt(r):me.near(r)}content(){return Q.empty}eq(e){return e instanceof gt&&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 gt(e.resolve(n.pos))}getBookmark(){return new B0(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!_W(e)||!NW(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&>.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let a=e.node(s);if(n>0?e.indexAfter(s)<a.childCount:e.index(s)>0){i=a.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=n;let l=e.doc.resolve(o);if(gt.valid(l))return l}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!le.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*n),r=!1;continue e}break}i=s,o+=n;let a=e.doc.resolve(o);if(gt.valid(a))return a}return null}}}gt.prototype.visible=!1;gt.findFrom=gt.findGapCursorFrom;me.jsonID("gapcursor",gt);class B0{constructor(e){this.pos=e}map(e){return new B0(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return gt.valid(n)?new gt(n):me.near(n)}}function fA(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function _W(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 o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||fA(o.type))return!0;if(o.inlineContent)return!1}}return!0}function NW(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 o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||fA(o.type))return!0;if(o.inlineContent)return!1}}return!0}function IW(){return new ye({props:{decorations:LW,createSelectionBetween(t,e,n){return e.pos==n.pos&>.valid(n)?new gt(n):null},handleClick:OW,handleKeyDown:MW,handleDOMEvents:{beforeinput:DW}}})}const MW=Rg({ArrowLeft:Tc("horiz",-1),ArrowRight:Tc("horiz",1),ArrowUp:Tc("vert",-1),ArrowDown:Tc("vert",1)});function Tc(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let s=r.selection,a=e>0?s.$to:s.$from,l=s.empty;if(s instanceof ae){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=gt.findGapCursorFrom(a,e,l);return c?(o&&o(r.tr.setSelection(new gt(c))),!0):!1}}function OW(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!gt.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&le.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new gt(r))),!0)}function DW(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof gt))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 o=V.empty;for(let s=r.length-1;s>=0;s--)o=V.from(r[s].createAndFill(null,o));let i=t.state.tr.replace(n.pos,n.pos,new Q(o,0,0));return i.setSelection(ae.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function LW(t){if(!(t.selection instanceof gt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ke.create(t.doc,[je.widget(t.selection.head,e,{key:"gapcursor"})])}We.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new ye({key:new Oe("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const o=this.options.limit;if(o==null||o===0){t=!0;return}const i=this.storage.characters({node:r.doc});if(i>o){const s=i-o,a=0,l=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(a,l);return t=!0,c}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const o=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||o>r&&i>r&&i<=o)return!0;if(o>r&&i>r&&i>o||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,l=i-r,c=a-l,u=a;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}});We.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[j2(this.options)]}});We.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new ye({key:new Oe("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=e,i=[];if(!n||!r)return ke.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((l,c)=>{if(l.isText)return;if(!(o>=c&&o<=c+l.nodeSize-1))return!1;s+=1});let a=0;return t.descendants((l,c)=>{if(l.isText||!(o>=c&&o<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&s-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";i.push(je.node(c,c+l.nodeSize,{class:this.options.className}))}),ke.create(t,i)}}})]}});var RW=We.create({name:"gapCursor",addProseMirrorPlugins(){return[IW()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Qe(de(t,"allowGapCursor",n)))!=null?e:null}}}),ix="placeholder";function PW(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}We.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:ix,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${PW(this.options.dataAttribute)}`:`data-${ix}`;return[new ye({key:new Oe("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=n,i=[];if(!r)return null;const s=this.editor.isEmpty;return e.descendants((a,l)=>{const c=o>=l&&o<=l+a.nodeSize,u=!a.isLeaf&&Yd(a);if((c||!this.options.showOnlyCurrent)&&u){const d=[this.options.emptyNodeClass];s&&d.push(this.options.emptyEditorClass);const f=je.node(l,l+a.nodeSize,{class:d.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:a,pos:l,hasAnchor:c}):this.options.placeholder});i.push(f)}return this.options.includeChildren}),ke.create(e,i)}}})]}});We.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new ye({key:new Oe("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||Ww(n.selection)||t.view.dragging?null:ke.create(n.doc,[je.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function sx({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}We.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Oe(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,o])=>o).filter(o=>(this.options.notAfter||[]).concat(n).includes(o.name));return[new ye({key:e,appendTransaction:(o,i,s)=>{const{doc:a,tr:l,schema:c}=s,u=e.getState(s),d=a.content.size,f=c.nodes[n];if(u)return l.insert(d,f.create())},state:{init:(o,i)=>{const s=i.tr.doc.lastChild;return!sx({node:s,types:r})},apply:(o,i)=>{if(!o.docChanged||o.getMeta("__uniqueIDTransaction"))return i;const s=o.doc.lastChild;return!sx({node:s,types:r})}}})]}});We.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>c0(t,e),redo:()=>({state:t,dispatch:e})=>u0(t,e)}},addProseMirrorPlugins(){return[W2(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}});const BW="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",FW="ελ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",Cm="numeric",km="ascii",Tm="alpha",Va="asciinumeric",wa="alphanumeric",wm="domain",hA="emoji",HW="scheme",UW="slashscheme",Hh="whitespace";function VW(t,e){return t in e||(e[t]=[]),e[t]}function fi(t,e,n){e[Cm]&&(e[Va]=!0,e[wa]=!0),e[km]&&(e[Va]=!0,e[Tm]=!0),e[Va]&&(e[wa]=!0),e[Tm]&&(e[wa]=!0),e[wa]&&(e[wm]=!0),e[hA]&&(e[wm]=!0);for(const r in e){const o=VW(r,n);o.indexOf(t)<0&&o.push(t)}}function $W(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function En(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}En.groups={};En.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 o=e.jr[r][0],i=e.jr[r][1];if(i&&o.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let o=0;o<t.length;o++)this.tt(t[o],e,n,r)},tr(t,e,n,r){r=r||En.groups;let o;return e&&e.j?o=e:(o=new En(e),n&&r&&fi(e,n,r)),this.jr.push([t,o]),o},ts(t,e,n,r){let o=this;const i=t.length;if(!i)return o;for(let s=0;s<i-1;s++)o=o.tt(t[s]);return o.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||En.groups;const o=this;if(e&&e.j)return o.j[t]=e,e;const i=e;let s,a=o.go(t);if(a?(s=new En,Object.assign(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new En,i){if(r)if(s.t&&typeof s.t=="string"){const l=Object.assign($W(s.t,r),n);fi(i,l,r)}else n&&fi(i,n,r);s.t=i}return o.j[t]=s,s}};const Ae=(t,e,n,r,o)=>t.ta(e,n,r,o),mt=(t,e,n,r,o)=>t.tr(e,n,r,o),ax=(t,e,n,r,o)=>t.ts(e,n,r,o),K=(t,e,n,r,o)=>t.tt(e,n,r,o),no="WORD",Sm="UWORD",pA="ASCIINUMERICAL",mA="ALPHANUMERICAL",Sl="LOCALHOST",vm="TLD",Am="UTLD",Jc="SCHEME",ss="SLASH_SCHEME",F0="NUM",_m="WS",H0="NL",$a="OPENBRACE",ja="CLOSEBRACE",$u="OPENBRACKET",ju="CLOSEBRACKET",zu="OPENPAREN",qu="CLOSEPAREN",Wu="OPENANGLEBRACKET",Gu="CLOSEANGLEBRACKET",Yu="FULLWIDTHLEFTPAREN",Ku="FULLWIDTHRIGHTPAREN",Qu="LEFTCORNERBRACKET",Xu="RIGHTCORNERBRACKET",Zu="LEFTWHITECORNERBRACKET",Ju="RIGHTWHITECORNERBRACKET",ed="FULLWIDTHLESSTHAN",td="FULLWIDTHGREATERTHAN",nd="AMPERSAND",rd="APOSTROPHE",od="ASTERISK",So="AT",id="BACKSLASH",sd="BACKTICK",ad="CARET",No="COLON",U0="COMMA",ld="DOLLAR",Ar="DOT",cd="EQUALS",V0="EXCLAMATION",jn="HYPHEN",za="PERCENT",ud="PIPE",dd="PLUS",fd="POUND",qa="QUERY",$0="QUOTE",gA="FULLWIDTHMIDDLEDOT",j0="SEMI",_r="SLASH",Wa="TILDE",hd="UNDERSCORE",bA="EMOJI",pd="SYM";var yA=Object.freeze({__proto__:null,ALPHANUMERICAL:mA,AMPERSAND:nd,APOSTROPHE:rd,ASCIINUMERICAL:pA,ASTERISK:od,AT:So,BACKSLASH:id,BACKTICK:sd,CARET:ad,CLOSEANGLEBRACKET:Gu,CLOSEBRACE:ja,CLOSEBRACKET:ju,CLOSEPAREN:qu,COLON:No,COMMA:U0,DOLLAR:ld,DOT:Ar,EMOJI:bA,EQUALS:cd,EXCLAMATION:V0,FULLWIDTHGREATERTHAN:td,FULLWIDTHLEFTPAREN:Yu,FULLWIDTHLESSTHAN:ed,FULLWIDTHMIDDLEDOT:gA,FULLWIDTHRIGHTPAREN:Ku,HYPHEN:jn,LEFTCORNERBRACKET:Qu,LEFTWHITECORNERBRACKET:Zu,LOCALHOST:Sl,NL:H0,NUM:F0,OPENANGLEBRACKET:Wu,OPENBRACE:$a,OPENBRACKET:$u,OPENPAREN:zu,PERCENT:za,PIPE:ud,PLUS:dd,POUND:fd,QUERY:qa,QUOTE:$0,RIGHTCORNERBRACKET:Xu,RIGHTWHITECORNERBRACKET:Ju,SCHEME:Jc,SEMI:j0,SLASH:_r,SLASH_SCHEME:ss,SYM:pd,TILDE:Wa,TLD:vm,UNDERSCORE:hd,UTLD:Am,UWORD:Sm,WORD:no,WS:_m});const Xr=/[a-z]/,ha=new RegExp("\\p{L}","u"),Uh=new RegExp("\\p{Emoji}","u"),Zr=/\d/,Vh=/\s/,lx="\r",$h=`
|
|
152
|
+
`,jW="️",zW="",jh="";let wc=null,Sc=null;function qW(t=[]){const e={};En.groups=e;const n=new En;wc==null&&(wc=cx(BW)),Sc==null&&(Sc=cx(FW)),K(n,"'",rd),K(n,"{",$a),K(n,"}",ja),K(n,"[",$u),K(n,"]",ju),K(n,"(",zu),K(n,")",qu),K(n,"<",Wu),K(n,">",Gu),K(n,"(",Yu),K(n,")",Ku),K(n,"「",Qu),K(n,"」",Xu),K(n,"『",Zu),K(n,"』",Ju),K(n,"<",ed),K(n,">",td),K(n,"&",nd),K(n,"*",od),K(n,"@",So),K(n,"`",sd),K(n,"^",ad),K(n,":",No),K(n,",",U0),K(n,"$",ld),K(n,".",Ar),K(n,"=",cd),K(n,"!",V0),K(n,"-",jn),K(n,"%",za),K(n,"|",ud),K(n,"+",dd),K(n,"#",fd),K(n,"?",qa),K(n,'"',$0),K(n,"/",_r),K(n,";",j0),K(n,"~",Wa),K(n,"_",hd),K(n,"\\",id),K(n,"・",gA);const r=mt(n,Zr,F0,{[Cm]:!0});mt(r,Zr,r);const o=mt(r,Xr,pA,{[Va]:!0}),i=mt(r,ha,mA,{[wa]:!0}),s=mt(n,Xr,no,{[km]:!0});mt(s,Zr,o),mt(s,Xr,s),mt(o,Zr,o),mt(o,Xr,o);const a=mt(n,ha,Sm,{[Tm]:!0});mt(a,Xr),mt(a,Zr,i),mt(a,ha,a),mt(i,Zr,i),mt(i,Xr),mt(i,ha,i);const l=K(n,$h,H0,{[Hh]:!0}),c=K(n,lx,_m,{[Hh]:!0}),u=mt(n,Vh,_m,{[Hh]:!0});K(n,jh,u),K(c,$h,l),K(c,jh,u),mt(c,Vh,u),K(u,lx),K(u,$h),mt(u,Vh,u),K(u,jh,u);const d=mt(n,Uh,bA,{[hA]:!0});K(d,"#"),mt(d,Uh,d),K(d,jW,d);const f=K(d,zW);K(f,"#"),mt(f,Uh,d);const h=[[Xr,s],[Zr,o]],p=[[Xr,null],[ha,a],[Zr,i]];for(let g=0;g<wc.length;g++)go(n,wc[g],vm,no,h);for(let g=0;g<Sc.length;g++)go(n,Sc[g],Am,Sm,p);fi(vm,{tld:!0,ascii:!0},e),fi(Am,{utld:!0,alpha:!0},e),go(n,"file",Jc,no,h),go(n,"mailto",Jc,no,h),go(n,"http",ss,no,h),go(n,"https",ss,no,h),go(n,"ftp",ss,no,h),go(n,"ftps",ss,no,h),fi(Jc,{scheme:!0,ascii:!0},e),fi(ss,{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],x=t[g][1]?{[HW]:!0}:{[UW]:!0};b.indexOf("-")>=0?x[wm]=!0:Xr.test(b)?Zr.test(b)?x[Va]=!0:x[km]=!0:x[Cm]=!0,ax(n,b,b,x)}return ax(n,"localhost",Sl,{ascii:!0}),n.jd=new En(pd),{start:n,tokens:Object.assign({groups:e},yA)}}function EA(t,e){const n=WW(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,o=[];let i=0,s=0;for(;s<r;){let a=t,l=null,c=0,u=null,d=-1,f=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(d=0,f=0,u=a):d>=0&&(d+=n[s].length,f++),c+=n[s].length,i+=n[s].length,s++;i-=d,s-=f,c-=d,o.push({t:u.t,v:e.slice(i-c,i),s:i-c,e:i})}return o}function WW(t){const e=[],n=t.length;let r=0;for(;r<n;){let o=t.charCodeAt(r),i,s=o<55296||o>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function go(t,e,n,r,o){let i;const s=e.length;for(let a=0;a<s-1;a++){const l=e[a];t.j[l]?i=t.j[l]:(i=new En(r),i.jr=o.slice(),t.j[l]=i),t=i}return i=new En(n),i.jr=o.slice(),t.j[e[s-1]]=i,i}function cx(t){const e=[],n=[];let r=0,o="0123456789";for(;r<t.length;){let i=0;for(;o.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+i),10);s>0;s--)n.pop();r+=i}else n.push(t[r]),r++}return e}const vl={defaultProtocol:"http",events:null,format:ux,formatHref:ux,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function z0(t,e=null){let n=Object.assign({},vl);t&&(n=Object.assign(n,t instanceof z0?t.o:t));const r=n.ignoreTags,o=[];for(let i=0;i<r.length;i++)o.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=o}z0.prototype={o:vl,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let o=this.o[t];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:vl[t],typeof o=="function"&&r&&(o=o(e,n))):typeof o=="function"&&r&&(o=o(e,n.t,n)),o)},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 ux(t){return t}function xA(t,e){this.t="token",this.v=t,this.tk=e}xA.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=vl.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),o=t.get("tagName",n,e),i=this.toFormattedString(t),s={},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 s.href=r,a&&(s.class=a),l&&(s.target=l),c&&(s.rel=c),u&&Object.assign(s,u),{tagName:o,attributes:s,content:i,eventListeners:d}}};function yf(t,e){class n extends xA{constructor(o,i){super(o,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const dx=yf("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),fx=yf("text"),GW=yf("nl"),vc=yf("url",{isLink:!0,toHref(t=vl.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Sl&&t[1].t===No}}),$n=t=>new En(t);function YW({groups:t}){const e=t.domain.concat([nd,od,So,id,sd,ad,ld,cd,jn,F0,za,ud,dd,fd,_r,pd,Wa,hd]),n=[rd,No,U0,Ar,V0,za,qa,$0,j0,Wu,Gu,$a,ja,ju,$u,zu,qu,Yu,Ku,Qu,Xu,Zu,Ju,ed,td],r=[nd,rd,od,id,sd,ad,ld,cd,jn,$a,ja,za,ud,dd,fd,qa,_r,pd,Wa,hd],o=$n(),i=K(o,Wa);Ae(i,r,i),Ae(i,t.domain,i);const s=$n(),a=$n(),l=$n();Ae(o,t.domain,s),Ae(o,t.scheme,a),Ae(o,t.slashscheme,l),Ae(s,r,i),Ae(s,t.domain,s);const c=K(s,So);K(i,So,c),K(a,So,c),K(l,So,c);const u=K(i,Ar);Ae(u,r,i),Ae(u,t.domain,i);const d=$n();Ae(c,t.domain,d),Ae(d,t.domain,d);const f=K(d,Ar);Ae(f,t.domain,d);const h=$n(dx);Ae(f,t.tld,h),Ae(f,t.utld,h),K(c,Sl,h);const p=K(d,jn);K(p,jn,p),Ae(p,t.domain,d),Ae(h,t.domain,d),K(h,Ar,f),K(h,jn,p);const g=K(h,No);Ae(g,t.numeric,dx);const b=K(s,jn),E=K(s,Ar);K(b,jn,b),Ae(b,t.domain,s),Ae(E,r,i),Ae(E,t.domain,s);const x=$n(vc);Ae(E,t.tld,x),Ae(E,t.utld,x),Ae(x,t.domain,s),Ae(x,r,i),K(x,Ar,E),K(x,jn,b),K(x,So,c);const T=K(x,No),D=$n(vc);Ae(T,t.numeric,D);const O=$n(vc),v=$n();Ae(O,e,O),Ae(O,n,v),Ae(v,e,O),Ae(v,n,v),K(x,_r,O),K(D,_r,O);const R=K(a,No),j=K(l,No),z=K(j,_r),I=K(z,_r);Ae(a,t.domain,s),K(a,Ar,E),K(a,jn,b),Ae(l,t.domain,s),K(l,Ar,E),K(l,jn,b),Ae(R,t.domain,O),K(R,_r,O),K(R,qa,O),Ae(I,t.domain,O),Ae(I,e,O),K(I,_r,O);const X=[[$a,ja],[$u,ju],[zu,qu],[Wu,Gu],[Yu,Ku],[Qu,Xu],[Zu,Ju],[ed,td]];for(let F=0;F<X.length;F++){const[W,B]=X[F],q=K(O,W);K(v,W,q),K(q,B,O);const oe=$n(vc);Ae(q,e,oe);const Z=$n();Ae(q,n),Ae(oe,e,oe),Ae(oe,n,Z),Ae(Z,e,oe),Ae(Z,n,Z),K(oe,B,O),K(Z,B,O)}return K(o,Sl,x),K(o,H0,GW),{start:o,tokens:yA}}function KW(t,e,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let a=t,l=null,c=null,u=0,d=null,f=-1;for(;o<r&&!(l=a.go(n[o].t));)s.push(n[o++]);for(;o<r&&(c=l||a.go(n[o].t));)l=null,a=c,a.accepts()?(f=0,d=a):f>=0&&f++,o++,u++;if(f<0)o-=u,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(zh(fx,e,s)),s=[]),o-=f,u-=f;const h=d.t,p=n.slice(o-u,o);i.push(zh(h,e,p))}}return s.length>0&&i.push(zh(fx,e,s)),i}function zh(t,e,n){const r=n[0].s,o=n[n.length-1].e,i=e.slice(r,o);return new t(i,n)}const QW=typeof console<"u"&&console&&console.warn||(()=>{}),XW="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",at={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function ZW(){return En.groups={},at.scanner=null,at.parser=null,at.tokenQueue=[],at.pluginQueue=[],at.customSchemes=[],at.initialized=!1,at}function hx(t,e=!1){if(at.initialized&&QW(`linkifyjs: already initialized - will not register custom scheme "${t}" ${XW}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
153
|
+
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
154
|
+
2. Cannot start or end with "-"
|
|
155
|
+
3. "-" cannot repeat`);at.customSchemes.push([t,e])}function JW(){at.scanner=qW(at.customSchemes);for(let t=0;t<at.tokenQueue.length;t++)at.tokenQueue[t][1]({scanner:at.scanner});at.parser=YW(at.scanner.tokens);for(let t=0;t<at.pluginQueue.length;t++)at.pluginQueue[t][1]({scanner:at.scanner,parser:at.parser});return at.initialized=!0,at}function q0(t){return at.initialized||JW(),KW(at.parser.start,t,EA(at.scanner.start,t))}q0.scan=EA;function CA(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 z0(n),o=q0(t),i=[];for(let s=0;s<o.length;s++){const a=o[s];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}var W0="[\0- -\u2029 ]",eG=new RegExp(W0),tG=new RegExp(`${W0}$`),nG=new RegExp(W0,"g");function rG(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function oG(t){return new ye({key:new Oe("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r,a=Wd(n.doc,[...e]);if(Vg(a).forEach(({newRange:c})=>{const u=Hw(r.doc,c,h=>h.isTextblock);let d,f;if(u.length>1)d=u[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const h=r.doc.textBetween(c.from,c.to," "," ");if(!tG.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(eG).filter(Boolean);if(h.length<=0)return!1;const p=h[h.length-1],g=d.pos+f.lastIndexOf(p);if(!p)return!1;const b=q0(p).map(E=>E.toObject(t.defaultProtocol));if(!rG(b))return!1;b.filter(E=>E.isLink).map(E=>({...E,from:g+E.start+1,to:g+E.end+1})).filter(E=>r.schema.marks.code?!r.doc.rangeHasMark(E.from,E.to,r.schema.marks.code):!0).filter(E=>t.validate(E.value)).filter(E=>t.shouldAutoLink(E.value)).forEach(E=>{$g(E.from,E.to,r.doc).some(x=>x.mark.type===t.type)||s.addMark(E.from,E.to,t.type.create({href:E.href}))})}}),!!s.steps.length)return s}})}function iG(t){return new ye({key:new Oe("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{const l=r.target;if(!l)return!1;const c=t.editor.view.dom;s=l.closest("a"),s&&!c.contains(s)&&(s=null)}if(!s)return!1;let a=!1;if(t.enableClickSelection&&(a=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const l=qw(e.state,t.type.name),c=(o=s.href)!=null?o:l.href,u=(i=s.target)!=null?i:l.target;c&&(window.open(c,u),a=!0)}return a}}})}function sG(t){return new ye({key:new Oe("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:o}=t,{state:i}=e,{selection:s}=i,{empty:a}=s;if(a)return!1;let l="";r.content.forEach(u=>{l+=u.textContent});const c=CA(l,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===l);return!l||!c||o!==void 0&&!o(c.value)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function si(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(nG,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var aG=rr.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"){hx(t);return}hx(t.scheme,t.optionalSlashes)})},onDestroy(){ZW()},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)=>!!si(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 o=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(o)||!/\./.test(o))}}},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=>!!si(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=>!!si(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Hn(this.options.HTMLAttributes,t),0]:["a",Hn(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,o,i;const s=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",a=(i=(o=t.attrs)==null?void 0:o.title)!=null?i:"",l=e.renderChildren(t);return a?`[${l}](${s} "${a}")`:`[${l}](${s})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!si(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=>!!si(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[Mi({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=CA(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!si(s,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.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(oG({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!si(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(iG({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(sG({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),lG=Cr.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""});const cG={tokenize:uG};function uG(t){const e=t.attempt(this.parser.constructs.contentInitial,r,o);let n;return e;function r(a){if(a===null){t.consume(a);return}return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),Pe(t,e,"linePrefix")}function o(a){return t.enter("paragraph"),i(a)}function i(a){const l=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(a)}function s(a){if(a===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(a);return}return pe(a)?(t.consume(a),t.exit("chunkText"),i):(t.consume(a),s)}}const dG={tokenize:fG},px={tokenize:hG};function fG(t){const e=this,n=[];let r=0,o,i,s;return a;function a(T){if(r<n.length){const D=n[r];return e.containerState=D[1],t.attempt(D[0].continuation,l,c)(T)}return c(T)}function l(T){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,o&&x();const D=e.events.length;let O=D,v;for(;O--;)if(e.events[O][0]==="exit"&&e.events[O][1].type==="chunkFlow"){v=e.events[O][1].end;break}E(r);let R=D;for(;R<e.events.length;)e.events[R][1].end={...v},R++;return Bn(e.events,O+1,0,e.events.slice(D)),e.events.length=R,c(T)}return a(T)}function c(T){if(r===n.length){if(!o)return f(T);if(o.currentConstruct&&o.currentConstruct.concrete)return p(T);e.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(px,u,d)(T)}function u(T){return o&&x(),E(r),f(T)}function d(T){return e.parser.lazy[e.now().line]=r!==n.length,s=e.now().offset,p(T)}function f(T){return e.containerState={},t.attempt(px,h,p)(T)}function h(T){return r++,n.push([e.currentConstruct,e.containerState]),f(T)}function p(T){if(T===null){o&&x(),E(0),t.consume(T);return}return o=o||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:i}),g(T)}function g(T){if(T===null){b(t.exit("chunkFlow"),!0),E(0),t.consume(T);return}return pe(T)?(t.consume(T),b(t.exit("chunkFlow")),r=0,e.interrupt=void 0,a):(t.consume(T),g)}function b(T,D){const O=e.sliceStream(T);if(D&&O.push(null),T.previous=i,i&&(i.next=T),i=T,o.defineSkip(T.start),o.write(O),e.parser.lazy[T.start.line]){let v=o.events.length;for(;v--;)if(o.events[v][1].start.offset<s&&(!o.events[v][1].end||o.events[v][1].end.offset>s))return;const R=e.events.length;let j=R,z,I;for(;j--;)if(e.events[j][0]==="exit"&&e.events[j][1].type==="chunkFlow"){if(z){I=e.events[j][1].end;break}z=!0}for(E(r),v=R;v<e.events.length;)e.events[v][1].end={...I},v++;Bn(e.events,j+1,0,e.events.slice(R)),e.events.length=v}}function E(T){let D=n.length;for(;D-- >T;){const O=n[D];e.containerState=O[1],O[0].exit.call(e,t)}n.length=T}function x(){o.write([null]),i=void 0,o=void 0,e.containerState._closeFlow=void 0}}function hG(t,e,n){return Pe(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}const pG={tokenize:mG};function mG(t){const e=this,n=t.attempt(Wl,r,t.attempt(this.parser.constructs.flowInitial,o,Pe(t,t.attempt(this.parser.constructs.flow,o,t.attempt(Sj,o)),"linePrefix")));return n;function r(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function o(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const gG={resolveAll:TA()},bG=kA("string"),yG=kA("text");function kA(t){return{resolveAll:TA(t==="text"?EG:void 0),tokenize:e};function e(n){const r=this,o=this.parser.constructs[t],i=n.attempt(o,s,a);return s;function s(u){return c(u)?i(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"),i(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const d=o[u];let f=-1;if(d)for(;++f<d.length;){const h=d[f];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function TA(t){return e;function e(n,r){let o=-1,i;for(;++o<=n.length;)i===void 0?n[o]&&n[o][1].type==="data"&&(i=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==i+2&&(n[i][1].end=n[o-1][1].end,n.splice(i+2,o-i-2),o=i+2),i=void 0);return t?t(n,r):n}}function EG(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],o=e.sliceStream(r);let i=o.length,s=-1,a=0,l;for(;i--;){const c=o[i];if(typeof c=="string"){for(s=c.length;c.charCodeAt(s-1)===32;)a++,s--;if(s)break;s=-1}else if(c===-2)l=!0,a++;else if(c!==-1){i++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(a=0),a){const c={type:n===t.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?s:r.start._bufferIndex+s,_index:r.start._index+i,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 xG={42:mn,43:mn,45:mn,48:mn,49:mn,50:mn,51:mn,52:mn,53:mn,54:mn,55:mn,56:mn,57:mn,62:Hv},CG={91:Ij},kG={[-2]:vh,[-1]:vh,32:vh},TG={35:Pj,42:Yc,45:[DE,Yc],60:Uj,61:DE,95:Yc,96:ME,126:ME},wG={38:Vv,92:Uv},SG={[-5]:Ah,[-4]:Ah,[-3]:Ah,33:oz,38:Vv,42:pm,60:[sj,Gj],91:sz,92:[Lj,Uv],93:O0,95:pm,96:Ej},vG={null:[pm,gG]},AG={null:[42,95]},_G={null:[]},NG=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:AG,contentInitial:CG,disable:_G,document:xG,flow:TG,flowInitial:kG,insideSpan:vG,string:wG,text:SG},Symbol.toStringTag,{value:"Module"}));function IG(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 o={},i=[];let s=[],a=[];const l={attempt:R(O),check:R(v),consume:x,enter:T,exit:D,interrupt:R(v,{interrupt:!0})},c={code:null,containerState:{},defineSkip:g,events:[],now:p,parser:t,previous:null,sliceSerialize:f,sliceStream:h,write:d};let u=e.tokenize.call(c,l);return e.resolveAll&&i.push(e),c;function d(X){return s=Wn(s,X),b(),s[s.length-1]!==null?[]:(j(e,0),c.events=gf(i,c.events,c),c.events)}function f(X,F){return OG(h(X),F)}function h(X){return MG(s,X)}function p(){const{_bufferIndex:X,_index:F,line:W,column:B,offset:q}=r;return{_bufferIndex:X,_index:F,line:W,column:B,offset:q}}function g(X){o[X.line]=X.column,I()}function b(){let X;for(;r._index<s.length;){const F=s[r._index];if(typeof F=="string")for(X=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===X&&r._bufferIndex<F.length;)E(F.charCodeAt(r._bufferIndex));else E(F)}}function E(X){u=u(X)}function x(X){pe(X)?(r.line++,r.column=1,r.offset+=X===-3?2:1,I()):X!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=X}function T(X,F){const W=F||{};return W.type=X,W.start=p(),c.events.push(["enter",W,c]),a.push(W),W}function D(X){const F=a.pop();return F.end=p(),c.events.push(["exit",F,c]),F}function O(X,F){j(X,F.from)}function v(X,F){F.restore()}function R(X,F){return W;function W(B,q,oe){let Z,ee,ie,S;return Array.isArray(B)?be(B):"tokenize"in B?be([B]):Ee(B);function Ee(Ve){return Lt;function Lt($e){const Ye=$e!==null&&Ve[$e],xt=$e!==null&&Ve.null,Rt=[...Array.isArray(Ye)?Ye:Ye?[Ye]:[],...Array.isArray(xt)?xt:xt?[xt]:[]];return be(Rt)($e)}}function be(Ve){return Z=Ve,ee=0,Ve.length===0?oe:_(Ve[ee])}function _(Ve){return Lt;function Lt($e){return S=z(),ie=Ve,Ve.partial||(c.currentConstruct=Ve),Ve.name&&c.parser.constructs.disable.null.includes(Ve.name)?Ue():Ve.tokenize.call(F?Object.assign(Object.create(c),F):c,l,ft,Ue)($e)}}function ft(Ve){return X(ie,S),q}function Ue(Ve){return S.restore(),++ee<Z.length?_(Z[ee]):oe}}}function j(X,F){X.resolveAll&&!i.includes(X)&&i.push(X),X.resolve&&Bn(c.events,F,c.events.length-F,X.resolve(c.events.slice(F),c)),X.resolveTo&&(c.events=X.resolveTo(c.events,c))}function z(){const X=p(),F=c.previous,W=c.currentConstruct,B=c.events.length,q=Array.from(a);return{from:B,restore:oe};function oe(){r=X,c.previous=F,c.currentConstruct=W,c.events.length=B,a=q,I()}}function I(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function MG(t,e){const n=e.start._index,r=e.start._bufferIndex,o=e.end._index,i=e.end._bufferIndex;let s;if(n===o)s=[t[n].slice(r,i)];else{if(s=t.slice(n,o),r>-1){const a=s[0];typeof a=="string"?s[0]=a.slice(r):s.shift()}i>0&&s.push(t[o].slice(0,i))}return s}function OG(t,e){let n=-1;const r=[];let o;for(;++n<t.length;){const i=t[n];let s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
|
|
156
|
+
`;break}case-3:{s=`\r
|
|
157
|
+
`;break}case-2:{s=e?" ":" ";break}case-1:{if(!e&&o)continue;s=" ";break}default:s=String.fromCharCode(i)}o=i===-2,r.push(s)}return r.join("")}function DG(t){const r={constructs:Iv([NG,...(t||{}).extensions||[]]),content:o(cG),defined:[],document:o(dG),flow:o(pG),lazy:{},string:o(bG),text:o(yG)};return r;function o(i){return s;function s(a){return IG(r,i,a)}}}function LG(t){for(;!$v(t););return t}const mx=/[\0\t\n\r]/g;function RG(){let t=1,e="",n=!0,r;return o;function o(i,s,a){const l=[];let c,u,d,f,h;for(i=e+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),d=0,e="",n&&(i.charCodeAt(0)===65279&&d++,n=void 0);d<i.length;){if(mx.lastIndex=d,c=mx.exec(i),f=c&&c.index!==void 0?c.index:i.length,h=i.charCodeAt(f),!c){e=i.slice(d);break}if(h===10&&d===f&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<f&&(l.push(i.slice(d,f)),t+=f-d),h){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=f+1}return a&&(r&&l.push(-5),e&&l.push(e),l.push(null)),l}}const wA={}.hasOwnProperty;function PG(t,e,n){return typeof e!="string"&&(n=e,e=void 0),BG(n)(LG(DG(n).document().write(RG()(t,e,!0))))}function BG(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(wf),autolinkProtocol:z,autolinkEmail:z,atxHeading:i(na),blockQuote:i(xt),characterEscape:z,characterReference:z,codeFenced:i(Rt),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(Rt,s),codeText:i(Vn,s),codeTextData:z,data:z,codeFlowValue:z,definition:i(Gi),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(ta),hardBreakEscape:i(ra),hardBreakTrailing:i(ra),htmlFlow:i(Kl,s),htmlFlowData:z,htmlText:i(Kl,s),htmlTextData:z,image:i(Tf),label:s,link:i(wf),listItem:i(N),listItemValue:f,listOrdered:i(oa,d),listUnordered:i(oa),paragraph:i(P),reference:_,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(na),strong:i($),thematicBreak:i(te)},exit:{atxHeading:l(),atxHeadingSequence:O,autolink:l(),autolinkEmail:Ye,autolinkProtocol:$e,blockQuote:l(),characterEscapeValue:I,characterReferenceMarkerHexadecimal:Ue,characterReferenceMarkerNumeric:Ue,characterReferenceValue:Ve,characterReference:Lt,codeFenced:l(b),codeFencedFence:g,codeFencedFenceInfo:h,codeFencedFenceMeta:p,codeFlowValue:I,codeIndented:l(E),codeText:l(q),codeTextData:I,data:I,definition:l(),definitionDestinationString:D,definitionLabelString:x,definitionTitleString:T,emphasis:l(),hardBreakEscape:l(F),hardBreakTrailing:l(F),htmlFlow:l(W),htmlFlowData:I,htmlText:l(B),htmlTextData:I,image:l(Z),label:ie,labelText:ee,lineEnding:X,link:l(oe),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ft,resourceDestinationString:S,resourceTitleString:Ee,resource:be,setextHeading:l(j),setextHeadingLineSequence:R,setextHeadingText:v,strong:l(),thematicBreak:l()}};SA(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(M){let H={type:"root",children:[]};const ne={stack:[H],tokenStack:[],config:e,enter:a,exit:c,buffer:s,resume:u,data:n},se=[];let xe=-1;for(;++xe<M.length;)if(M[xe][1].type==="listOrdered"||M[xe][1].type==="listUnordered")if(M[xe][0]==="enter")se.push(xe);else{const It=se.pop();xe=o(M,It,xe)}for(xe=-1;++xe<M.length;){const It=e[M[xe][0]];wA.call(It,M[xe][1].type)&&It[M[xe][1].type].call(Object.assign({sliceSerialize:M[xe][2].sliceSerialize},ne),M[xe][1])}if(ne.tokenStack.length>0){const It=ne.tokenStack[ne.tokenStack.length-1];(It[1]||gx).call(ne,void 0,It[0])}for(H.position={start:bo(M.length>0?M[0][1].start:{line:1,column:1,offset:0}),end:bo(M.length>0?M[M.length-2][1].end:{line:1,column:1,offset:0})},xe=-1;++xe<e.transforms.length;)H=e.transforms[xe](H)||H;return H}function o(M,H,ne){let se=H-1,xe=-1,It=!1,Kt,or,qr,Wr;for(;++se<=ne;){const rn=M[se];switch(rn[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{rn[0]==="enter"?xe++:xe--,Wr=void 0;break}case"lineEndingBlank":{rn[0]==="enter"&&(Kt&&!Wr&&!xe&&!qr&&(qr=se),Wr=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Wr=void 0}if(!xe&&rn[0]==="enter"&&rn[1].type==="listItemPrefix"||xe===-1&&rn[0]==="exit"&&(rn[1].type==="listUnordered"||rn[1].type==="listOrdered")){if(Kt){let Gr=se;for(or=void 0;Gr--;){const ir=M[Gr];if(ir[1].type==="lineEnding"||ir[1].type==="lineEndingBlank"){if(ir[0]==="exit")continue;or&&(M[or][1].type="lineEndingBlank",It=!0),ir[1].type="lineEnding",or=Gr}else if(!(ir[1].type==="linePrefix"||ir[1].type==="blockQuotePrefix"||ir[1].type==="blockQuotePrefixWhitespace"||ir[1].type==="blockQuoteMarker"||ir[1].type==="listItemIndent"))break}qr&&(!or||qr<or)&&(Kt._spread=!0),Kt.end=Object.assign({},or?M[or][1].start:rn[1].end),M.splice(or||se,0,["exit",Kt,rn[2]]),se++,ne++}if(rn[1].type==="listItemPrefix"){const Gr={type:"listItem",_spread:!1,start:Object.assign({},rn[1].start),end:void 0};Kt=Gr,M.splice(se,0,["enter",Gr,rn[2]]),se++,ne++,qr=void 0,Wr=!0}}}return M[H][1]._spread=It,ne}function i(M,H){return ne;function ne(se){a.call(this,M(se),se),H&&H.call(this,se)}}function s(){this.stack.push({type:"fragment",children:[]})}function a(M,H,ne){this.stack[this.stack.length-1].children.push(M),this.stack.push(M),this.tokenStack.push([H,ne||void 0]),M.position={start:bo(H.start),end:void 0}}function l(M){return H;function H(ne){M&&M.call(this,ne),c.call(this,ne)}}function c(M,H){const ne=this.stack.pop(),se=this.tokenStack.pop();if(se)se[0].type!==M.type&&(H?H.call(this,M,se[0]):(se[1]||gx).call(this,M,se[0]));else throw new Error("Cannot close `"+M.type+"` ("+Fa({start:M.start,end:M.end})+"): it’s not open");ne.position.end=bo(M.end)}function u(){return hf(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(M){if(this.data.expectingFirstListItemValue){const H=this.stack[this.stack.length-2];H.start=Number.parseInt(this.sliceSerialize(M),10),this.data.expectingFirstListItemValue=void 0}}function h(){const M=this.resume(),H=this.stack[this.stack.length-1];H.lang=M}function p(){const M=this.resume(),H=this.stack[this.stack.length-1];H.meta=M}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const M=this.resume(),H=this.stack[this.stack.length-1];H.value=M.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const M=this.resume(),H=this.stack[this.stack.length-1];H.value=M.replace(/(\r?\n|\r)$/g,"")}function x(M){const H=this.resume(),ne=this.stack[this.stack.length-1];ne.label=H,ne.identifier=pr(this.sliceSerialize(M)).toLowerCase()}function T(){const M=this.resume(),H=this.stack[this.stack.length-1];H.title=M}function D(){const M=this.resume(),H=this.stack[this.stack.length-1];H.url=M}function O(M){const H=this.stack[this.stack.length-1];if(!H.depth){const ne=this.sliceSerialize(M).length;H.depth=ne}}function v(){this.data.setextHeadingSlurpLineEnding=!0}function R(M){const H=this.stack[this.stack.length-1];H.depth=this.sliceSerialize(M).codePointAt(0)===61?1:2}function j(){this.data.setextHeadingSlurpLineEnding=void 0}function z(M){const ne=this.stack[this.stack.length-1].children;let se=ne[ne.length-1];(!se||se.type!=="text")&&(se=re(),se.position={start:bo(M.start),end:void 0},ne.push(se)),this.stack.push(se)}function I(M){const H=this.stack.pop();H.value+=this.sliceSerialize(M),H.position.end=bo(M.end)}function X(M){const H=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ne=H.children[H.children.length-1];ne.position.end=bo(M.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(H.type)&&(z.call(this,M),I.call(this,M))}function F(){this.data.atHardBreak=!0}function W(){const M=this.resume(),H=this.stack[this.stack.length-1];H.value=M}function B(){const M=this.resume(),H=this.stack[this.stack.length-1];H.value=M}function q(){const M=this.resume(),H=this.stack[this.stack.length-1];H.value=M}function oe(){const M=this.stack[this.stack.length-1];if(this.data.inReference){const H=this.data.referenceType||"shortcut";M.type+="Reference",M.referenceType=H,delete M.url,delete M.title}else delete M.identifier,delete M.label;this.data.referenceType=void 0}function Z(){const M=this.stack[this.stack.length-1];if(this.data.inReference){const H=this.data.referenceType||"shortcut";M.type+="Reference",M.referenceType=H,delete M.url,delete M.title}else delete M.identifier,delete M.label;this.data.referenceType=void 0}function ee(M){const H=this.sliceSerialize(M),ne=this.stack[this.stack.length-2];ne.label=Nv(H),ne.identifier=pr(H).toLowerCase()}function ie(){const M=this.stack[this.stack.length-1],H=this.resume(),ne=this.stack[this.stack.length-1];if(this.data.inReference=!0,ne.type==="link"){const se=M.children;ne.children=se}else ne.alt=H}function S(){const M=this.resume(),H=this.stack[this.stack.length-1];H.url=M}function Ee(){const M=this.resume(),H=this.stack[this.stack.length-1];H.title=M}function be(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function ft(M){const H=this.resume(),ne=this.stack[this.stack.length-1];ne.label=H,ne.identifier=pr(this.sliceSerialize(M)).toLowerCase(),this.data.referenceType="full"}function Ue(M){this.data.characterReferenceType=M.type}function Ve(M){const H=this.sliceSerialize(M),ne=this.data.characterReferenceType;let se;ne?(se=_v(H,ne==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):se=I0(H);const xe=this.stack[this.stack.length-1];xe.value+=se}function Lt(M){const H=this.stack.pop();H.position.end=bo(M.end)}function $e(M){I.call(this,M);const H=this.stack[this.stack.length-1];H.url=this.sliceSerialize(M)}function Ye(M){I.call(this,M);const H=this.stack[this.stack.length-1];H.url="mailto:"+this.sliceSerialize(M)}function xt(){return{type:"blockquote",children:[]}}function Rt(){return{type:"code",lang:null,meta:null,value:""}}function Vn(){return{type:"inlineCode",value:""}}function Gi(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ta(){return{type:"emphasis",children:[]}}function na(){return{type:"heading",depth:0,children:[]}}function ra(){return{type:"break"}}function Kl(){return{type:"html",value:""}}function Tf(){return{type:"image",title:null,url:"",alt:null}}function wf(){return{type:"link",title:null,url:"",children:[]}}function oa(M){return{type:"list",ordered:M.type==="listOrdered",start:null,spread:M._spread,children:[]}}function N(M){return{type:"listItem",spread:M._spread,checked:null,children:[]}}function P(){return{type:"paragraph",children:[]}}function $(){return{type:"strong",children:[]}}function re(){return{type:"text",value:""}}function te(){return{type:"thematicBreak"}}}function bo(t){return{line:t.line,column:t.column,offset:t.offset}}function SA(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?SA(t,r):FG(t,r)}}function FG(t,e){let n;for(n in e)if(wA.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 gx(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Fa({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Fa({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Fa({start:e.start,end:e.end})+") is still open")}function HG(t){const e=this;e.parser=n;function n(r){return PG(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function UG(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 VG(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
|
|
158
|
+
`}]}function $G(t,e){const n=e.value?e.value+`
|
|
159
|
+
`:"",r={},o=e.lang?e.lang.split(/\s+/):[];o.length>0&&(r.className=["language-"+o[0]]);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 jG(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function zG(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function qG(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),o=Js(r.toLowerCase()),i=t.footnoteOrder.indexOf(r);let s,a=t.footnoteCounts.get(r);a===void 0?(a=0,t.footnoteOrder.push(r),s=t.footnoteOrder.length):s=i+1,a+=1,t.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+o,id:n+"fnref-"+o+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};t.patch(e,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,c),t.applyData(e,c)}function WG(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 GG(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function vA(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 o=t.all(e),i=o[0];i&&i.type==="text"?i.value="["+i.value:o.unshift({type:"text",value:"["});const s=o[o.length-1];return s&&s.type==="text"?s.value+=r:o.push({type:"text",value:r}),o}function YG(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return vA(t,e);const o={src:Js(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(o.title=r.title);const i={type:"element",tagName:"img",properties:o,children:[]};return t.patch(e,i),t.applyData(e,i)}function KG(t,e){const n={src:Js(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 QG(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 XG(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return vA(t,e);const o={href:Js(r.url||"")};r.title!==null&&r.title!==void 0&&(o.title=r.title);const i={type:"element",tagName:"a",properties:o,children:t.all(e)};return t.patch(e,i),t.applyData(e,i)}function ZG(t,e){const n={href:Js(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 JG(t,e,n){const r=t.all(e),o=n?eY(n):AA(e),i={},s=[];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:[]}),i.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const u=r[a];(o||a!==0||u.type!=="element"||u.tagName!=="p")&&s.push({type:"text",value:`
|
|
160
|
+
`}),u.type==="element"&&u.tagName==="p"&&!o?s.push(...u.children):s.push(u)}const l=r[r.length-1];l&&(o||l.type!=="element"||l.tagName!=="p")&&s.push({type:"text",value:`
|
|
161
|
+
`});const c={type:"element",tagName:"li",properties:i,children:s};return t.patch(e,c),t.applyData(e,c)}function eY(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=AA(n[r])}return e}function AA(t){const e=t.spread;return e??t.children.length>1}function tY(t,e){const n={},r=t.all(e);let o=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++o<r.length;){const s=r[o];if(s.type==="element"&&s.tagName==="li"&&s.properties&&Array.isArray(s.properties.className)&&s.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(r,!0)};return t.patch(e,i),t.applyData(e,i)}function nY(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function rY(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function oY(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function iY(t,e){const n=t.all(e),r=n.shift(),o=[];if(r){const s={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],s),o.push(s)}if(n.length>0){const s={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},a=GS(e.children[1]),l=WS(e.children[e.children.length-1]);a&&l&&(s.position={start:a,end:l}),o.push(s)}const i={type:"element",tagName:"table",properties:{},children:t.wrap(o,!0)};return t.patch(e,i),t.applyData(e,i)}function sY(t,e,n){const r=n?n.children:void 0,i=(r?r.indexOf(e):1)===0?"th":"td",s=n&&n.type==="table"?n.align:void 0,a=s?s.length:e.children.length;let l=-1;const c=[];for(;++l<a;){const d=e.children[l],f={},h=s?s[l]:void 0;h&&(f.align=h);let p={type:"element",tagName:i,properties:f,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 aY(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const bx=9,yx=32;function lY(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),o=0;const i=[];for(;r;)i.push(Ex(e.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=n.exec(e);return i.push(Ex(e.slice(o),o>0,!1)),i.join("")}function Ex(t,e,n){let r=0,o=t.length;if(e){let i=t.codePointAt(r);for(;i===bx||i===yx;)r++,i=t.codePointAt(r)}if(n){let i=t.codePointAt(o-1);for(;i===bx||i===yx;)o--,i=t.codePointAt(o-1)}return o>r?t.slice(r,o):""}function cY(t,e){const n={type:"text",value:lY(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function uY(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const Nm={blockquote:UG,break:VG,code:$G,delete:jG,emphasis:zG,footnoteReference:qG,heading:WG,html:GG,imageReference:YG,image:KG,inlineCode:QG,linkReference:XG,link:ZG,listItem:JG,list:tY,paragraph:nY,root:rY,strong:oY,table:iY,tableCell:aY,tableRow:sY,text:cY,thematicBreak:uY,toml:Ac,yaml:Ac,definition:Ac,footnoteDefinition:Ac};function Ac(){}function dY(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 fY(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function hY(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||dY,r=t.options.footnoteBackLabel||fY,o=t.options.footnoteLabel||"Footnotes",i=t.options.footnoteLabelTagName||"h2",s=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(),f=Js(d.toLowerCase());let h=0;const p=[],g=t.footnoteCounts.get(d);for(;g!==void 0&&++h<=g;){p.length>0&&p.push({type:"text",value:" "});let x=typeof n=="string"?n:n(l,h);typeof x=="string"&&(x={type:"text",value:x}),p.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+f+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,h),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const b=u[u.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const x=b.children[b.children.length-1];x&&x.type==="text"?x.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...p)}else u.push(...p);const E={type:"element",tagName:"li",properties:{id:e+"fn-"+f},children:t.wrap(u,!0)};t.patch(c,E),a.push(E)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Us(s),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
162
|
+
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(a,!0)},{type:"text",value:`
|
|
163
|
+
`}]}}const Im={}.hasOwnProperty,pY={};function mY(t,e){const n=e||pY,r=new Map,o=new Map,i=new Map,s={...Nm,...n.handlers},a={all:c,applyData:bY,definitionById:r,footnoteById:o,footnoteCounts:i,footnoteOrder:[],handlers:s,one:l,options:n,patch:gY,wrap:EY};return Bi(t,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const d=u.type==="definition"?r:o,f=String(u.identifier).toUpperCase();d.has(f)||d.set(f,u)}}),a;function l(u,d){const f=u.type,h=a.handlers[f];if(Im.call(a.handlers,f)&&h)return h(a,u,d);if(a.options.passThrough&&a.options.passThrough.includes(f)){if("children"in u){const{children:g,...b}=u,E=Us(b);return E.children=a.all(u),E}return Us(u)}return(a.options.unknownHandler||yY)(a,u,d)}function c(u){const d=[];if("children"in u){const f=u.children;let h=-1;for(;++h<f.length;){const p=a.one(f[h],u);if(p){if(h&&f[h-1].type==="break"&&(!Array.isArray(p)&&p.type==="text"&&(p.value=xx(p.value)),!Array.isArray(p)&&p.type==="element")){const g=p.children[0];g&&g.type==="text"&&(g.value=xx(g.value))}Array.isArray(p)?d.push(...p):d.push(p)}}}return d}}function gY(t,e){t.position&&(e.position=KS(t))}function bY(t,e){let n=e;if(t&&t.data){const r=t.data.hName,o=t.data.hChildren,i=t.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const s="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:s}}n.type==="element"&&i&&Object.assign(n.properties,Us(i)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function yY(t,e){const n=e.data||{},r="value"in e&&!(Im.call(n,"hProperties")||Im.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 EY(t,e){const n=[];let r=-1;for(e&&n.push({type:"text",value:`
|
|
164
|
+
`});++r<t.length;)r&&n.push({type:"text",value:`
|
|
165
|
+
`}),n.push(t[r]);return e&&t.length>0&&n.push({type:"text",value:`
|
|
166
|
+
`}),n}function xx(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function Cx(t,e){const n=mY(t,e),r=n.one(t,void 0),o=hY(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&i.children.push({type:"text",value:`
|
|
167
|
+
`},o),i}function xY(t,e){return t&&"run"in t?async function(n,r){const o=Cx(n,{file:r,...e});await t.run(o,r)}:function(n,r){return Cx(n,{file:r,...t||e})}}const CY=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],kY=/["&'<>`]/g,TY=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,wY=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,SY=/[|\\{}()[\]^$+*?.]/g,kx=new WeakMap;function vY(t,e){if(t=t.replace(e.subset?AY(e.subset):kY,r),e.subset||e.escapeOnly)return t;return t.replace(TY,n).replace(wY,r);function n(o,i,s){return e.format((o.charCodeAt(0)-55296)*1024+o.charCodeAt(1)-56320+65536,s.charCodeAt(i+2),e)}function r(o,i,s){return e.format(o.charCodeAt(0),s.charCodeAt(i+1),e)}}function AY(t){let e=kx.get(t);return e||(e=_Y(t),kx.set(t,e)),e}function _Y(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(SY,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const NY=/[\dA-Fa-f]/;function IY(t,e,n){const r="&#x"+t.toString(16).toUpperCase();return n&&e&&!NY.test(String.fromCharCode(e))?r:r+";"}const MY=/\d/;function OY(t,e,n){const r="&#"+String(t);return n&&e&&!MY.test(String.fromCharCode(e))?r:r+";"}const DY=["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"],qh={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:"€"},LY=["cent","copy","divide","gt","lt","not","para","times"],_A={}.hasOwnProperty,Mm={};let _c;for(_c in qh)_A.call(qh,_c)&&(Mm[qh[_c]]=_c);const RY=/[^\dA-Za-z]/;function PY(t,e,n,r){const o=String.fromCharCode(t);if(_A.call(Mm,o)){const i=Mm[o],s="&"+i;return n&&DY.includes(i)&&!LY.includes(i)&&(!r||e&&e!==61&&RY.test(String.fromCharCode(e)))?s:s+";"}return""}function BY(t,e,n){let r=IY(t,e,n.omitOptionalSemicolons),o;if((n.useNamedReferences||n.useShortestReferences)&&(o=PY(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!o)&&n.useShortestReferences){const i=OY(t,e,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return o&&(!n.useShortestReferences||o.length<r.length)?o:r}function Ts(t,e){return vY(t,Object.assign({format:BY},e))}const FY=/^>|^->|<!--|-->|--!>|<!-$/g,HY=[">"],UY=["<",">"];function VY(t,e,n,r){return r.settings.bogusComments?"<?"+Ts(t.value,Object.assign({},r.settings.characterReferences,{subset:HY}))+">":"<!--"+t.value.replace(FY,o)+"-->";function o(i){return Ts(i,Object.assign({},r.settings.characterReferences,{subset:UY}))}}function $Y(t,e,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const Dt=IA(1),NA=IA(-1),jY=[];function IA(t){return e;function e(n,r,o){const i=n?n.children:jY;let s=(r||0)+t,a=i[s];if(!o)for(;a&&zl(a);)s+=t,a=i[s];return a}}const zY={}.hasOwnProperty;function MA(t){return e;function e(n,r,o){return zY.call(t,n.tagName)&&t[n.tagName](n,r,o)}}const G0=MA({body:WY,caption:Wh,colgroup:Wh,dd:QY,dt:KY,head:Wh,html:qY,li:YY,optgroup:XY,option:ZY,p:GY,rp:Tx,rt:Tx,tbody:eK,td:wx,tfoot:tK,th:wx,thead:JY,tr:nK});function Wh(t,e,n){const r=Dt(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&zl(r.value.charAt(0)))}function qY(t,e,n){const r=Dt(n,e);return!r||r.type!=="comment"}function WY(t,e,n){const r=Dt(n,e);return!r||r.type!=="comment"}function GY(t,e,n){const r=Dt(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 YY(t,e,n){const r=Dt(n,e);return!r||r.type==="element"&&r.tagName==="li"}function KY(t,e,n){const r=Dt(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function QY(t,e,n){const r=Dt(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function Tx(t,e,n){const r=Dt(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function XY(t,e,n){const r=Dt(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function ZY(t,e,n){const r=Dt(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function JY(t,e,n){const r=Dt(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function eK(t,e,n){const r=Dt(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function tK(t,e,n){return!Dt(n,e)}function nK(t,e,n){const r=Dt(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function wx(t,e,n){const r=Dt(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const rK=MA({body:sK,colgroup:aK,head:iK,html:oK,tbody:lK});function oK(t){const e=Dt(t,-1);return!e||e.type!=="comment"}function iK(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 sK(t){const e=Dt(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&zl(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function aK(t,e,n){const r=NA(n,e),o=Dt(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&G0(r,n.children.indexOf(r),n)?!1:!!(o&&o.type==="element"&&o.tagName==="col")}function lK(t,e,n){const r=NA(n,e),o=Dt(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&G0(r,n.children.indexOf(r),n)?!1:!!(o&&o.type==="element"&&o.tagName==="tr")}const Nc={name:[[`
|
|
168
|
+
\f\r &/=>`.split(""),`
|
|
169
|
+
\f\r "&'/=>\``.split("")],[`\0
|
|
170
|
+
\f\r "&'/<=>`.split(""),`\0
|
|
171
|
+
\f\r "&'/<=>\``.split("")]],unquoted:[[`
|
|
172
|
+
\f\r &>`.split(""),`\0
|
|
173
|
+
\f\r "&'<=>\``.split("")],[`\0
|
|
174
|
+
\f\r "&'<=>\``.split(""),`\0
|
|
175
|
+
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function cK(t,e,n,r){const o=r.schema,i=o.space==="svg"?!1:r.settings.omitOptionalTags;let s=o.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const a=[];let l;o.space==="html"&&t.tagName==="svg"&&(r.schema=Vl);const c=uK(r,t.properties),u=r.all(o.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=o,u&&(s=!1),(c||!i||!rK(t,e,n))&&(a.push("<",t.tagName,c?" "+c:""),s&&(o.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),!s&&(!i||!G0(t,e,n))&&a.push("</"+t.tagName+">"),a.join("")}function uK(t,e){const n=[];let r=-1,o;if(e){for(o in e)if(e[o]!==null&&e[o]!==void 0){const i=dK(t,o,e[o]);i&&n.push(i)}}for(;++r<n.length;){const i=t.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&i!=='"'&&i!=="'"&&(n[r]+=" ")}return n.join("")}function dK(t,e,n){const r=f0(t.schema,e),o=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,i=t.settings.allowDangerousCharacters?0:1;let s=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=Ts(r.attribute,Object.assign({},t.settings.characterReferences,{subset:Nc.name[o][i]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?o9:s9)(n,{padLeft:!t.settings.tightCommaSeparatedLists}):String(n),t.settings.collapseEmptyAttributes&&!n)?l:(t.settings.preferUnquoted&&(a=Ts(n,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:Nc.unquoted[o][i]}))),a!==n&&(t.settings.quoteSmart&&Hu(n,s)>Hu(n,t.alternative)&&(s=t.alternative),a=s+Ts(n,Object.assign({},t.settings.characterReferences,{subset:(s==="'"?Nc.single:Nc.double)[o][i],attribute:!0}))+s),l+(a&&"="+a))}const fK=["<","&"];function OA(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:Ts(t.value,Object.assign({},r.settings.characterReferences,{subset:fK}))}function hK(t,e,n,r){return r.settings.allowDangerousHtml?t.value:OA(t,e,n,r)}function pK(t,e,n,r){return r.all(t)}const mK=pv("type",{invalid:gK,unknown:bK,handlers:{comment:VY,doctype:$Y,element:cK,raw:hK,root:pK,text:OA}});function gK(t){throw new Error("Expected node, not `"+t+"`")}function bK(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const yK={},EK={},xK=[];function CK(t,e){const n=e||yK,r=n.quote||'"',o=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:kK,all:TK,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||CY,characterReferences:n.characterReferences||EK,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Vl:of,quote:r,alternative:o}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function kK(t,e,n){return mK(t,e,n,this)}function TK(t){const e=[],n=t&&t.children||xK;let r=-1;for(;++r<n.length;)e[r]=this.one(n[r],r,t);return e.join("")}function wK(t){const e=this,n={...e.data("settings"),...t};e.compiler=r;function r(o){return CK(o,n)}}var SK=Object.defineProperty,vK=(t,e,n)=>e in t?SK(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Be=(t,e,n)=>vK(t,typeof e!="symbol"?e+"":e,n);function AK(t,e,n,r="before"){const o=typeof n=="string"?n:n.id,i=Et(t),s=e.map(c=>$i(c,i)),a=dn(o,t.doc);if(!a)throw new Error(`Block with ID ${o} not found`);let l=a.posBeforeNode;return r==="after"&&(l+=a.node.nodeSize),t.step(new St(l,l,new Q(V.from(s),0,0))),s.map(c=>pt(c,i))}function Om(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 _K(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 o=r.childCount-1;o>=0;o--){const i=t.doc.resolve(n.pos+1).posAtIndex(o),s=t.doc.resolve(i).nodeAfter;if(!s||s.type.name!=="column")throw new Error("Invalid columnPos: does not point to column node.");Om(s)&&t.delete(i,i+s.nodeSize)}}function Dm(t,e){_K(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,o=t.doc.resolve(r).nodeAfter,i=e+n.nodeSize-1,s=t.doc.resolve(i).nodeBefore;if(!o||!s)throw new Error("Invalid columnList: does not contain children.");const a=Om(o),l=Om(s);if(a&&l){t.delete(e,e+n.nodeSize);return}if(a){t.step(new yt(e,e+n.nodeSize,i-s.nodeSize+1,i-1,Q.empty,0,!1));return}if(l){t.step(new yt(e,e+n.nodeSize,r+1,r+o.nodeSize-1,Q.empty,0,!1));return}}function Sx(t,e,n){const r=Et(t),o=n.map(u=>$i(u,r)),i=new Set(e.map(u=>typeof u=="string"?u:u.id)),s=[],a=new Set,l=typeof e[0]=="string"?e[0]:e[0].id;let c=0;if(t.doc.descendants((u,d)=>{if(i.size===0)return!1;if(!u.type.isInGroup("bnBlock")||!i.has(u.attrs.id))return!0;if(s.push(pt(u,r)),i.delete(u.attrs.id),n.length>0&&u.attrs.id===l){const g=t.doc.nodeSize;t.insert(d,o);const b=t.doc.nodeSize;c+=g-b}const f=t.doc.nodeSize,h=t.doc.resolve(d-c);h.node().type.name==="column"?a.add(h.before(-1)):h.node().type.name==="columnList"&&a.add(h.before()),h.node().type.name==="blockGroup"&&h.node(h.depth-1).type.name!=="doc"&&h.node().childCount===1?t.delete(h.before(),h.after()):t.delete(d-c,d-c+u.nodeSize);const p=t.doc.nodeSize;return c+=f-p,!1}),i.size>0){const u=[...i].join(`
|
|
176
|
+
`);throw Error("Blocks with the following IDs could not be found in the editor: "+u)}return a.forEach(u=>Dm(t,u)),{insertedBlocks:o.map(u=>pt(u,r)),removedBlocks:s}}function NK(t,e,n,r,o){let i;if(e)if(typeof e=="string")i=yr([e],t.pmSchema,r);else if(Array.isArray(e))i=yr(e,t.pmSchema,r);else if(e.type==="tableContent")i=Jd(e,t.pmSchema);else throw new Hr(e.type);else throw new Error("blockContent is required");const s=(o?.document??document).createDocumentFragment();for(const a of i)if(a.type.name!=="text"&&t.schema.inlineContentSchema[a.type.name]){const l=t.schema.inlineContentSpecs[a.type.name].implementation;if(l){const c=Zg(a,t.schema.inlineContentSchema,t.schema.styleSchema),u=l.render.call({renderType:"dom",props:void 0},c,()=>{},t);if(u){if(s.appendChild(u.dom),u.contentDOM){const d=n.serializeFragment(a.content,o);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=Fn.renderSpec(document,u);d.contentDOM.appendChild(l),l=d.dom}s.appendChild(l)}else{const l=n.serializeFragment(V.from([a]),o);s.appendChild(l)}return s}function IK(t,e,n,r){var o,i,s,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||[],f=t.blockImplementations[e.type].implementation.render.call({renderType:"dom",props:void 0},{...e,props:u,children:d},t);if(f.contentDOM&&e.content){const p=NK(t,e.content,n,e.type,r);f.contentDOM.appendChild(p)}if(t.pmSchema.nodes[e.type].isInGroup("bnBlock")){if(e.children&&e.children.length>0){const p=DA(t,e.children,n,r);(o=f.contentDOM)==null||o.append(p)}return f.dom}const h=(s=(i=c.spec)==null?void 0:i.toDOM)==null?void 0:s.call(i,c.create({id:e.id,...u}));return(a=h.contentDOM)==null||a.appendChild(f.dom),e.children&&e.children.length>0&&((l=h.contentDOM)==null||l.appendChild(LA(t,e.children,n,r))),h.dom}function DA(t,e,n,r){const o=(r?.document??document).createDocumentFragment();for(const i of e){const s=IK(t,i,n,r);o.appendChild(s)}return o}const LA=(t,e,n,r)=>{var o;const i=t.pmSchema.nodes.blockGroup,s=i.spec.toDOM(i.create({})),a=DA(t,e,n,r);return(o=s.contentDOM)==null||o.appendChild(a),s.dom},MK=(t,e)=>{const n=Fn.fromSchema(t);return{serializeBlocks:(r,o)=>LA(e,r,n,o).outerHTML}};function OK(t){return t.transact(e=>{const n=Go(e.doc,e.selection.anchor);if(e.selection instanceof Ge)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 le)return{type:"node",anchorBlockId:n.node.attrs.id};{const r=Go(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 DK(t,e){var n,r;const o=(n=dn(e.anchorBlockId,t.doc))==null?void 0:n.posBeforeNode;if(o===void 0)throw new Error(`Could not find block with ID ${e.anchorBlockId} to update selection`);let i;if(e.type==="cell")i=Ge.create(t.doc,o+e.anchorCellOffset,o+e.headCellOffset);else if(e.type==="node")i=le.create(t.doc,o+1);else{const s=(r=dn(e.headBlockId,t.doc))==null?void 0:r.posBeforeNode;if(s===void 0)throw new Error(`Could not find block with ID ${e.headBlockId} to update selection`);i=ae.create(t.doc,o+e.anchorOffset,s+e.headOffset)}t.setSelection(i)}function Lm(t){return t.map(e=>e.type==="columnList"?e.children.map(n=>Lm(n.children)).flat():{...e,children:Lm(e.children)}).flat()}function RA(t,e,n){t.transact(r=>{var o;const i=((o=t.getSelection())==null?void 0:o.blocks)||[t.getTextCursorPosition().block],s=OK(t);t.removeBlocks(i),t.insertBlocks(Lm(i),e,n),DK(r,s)})}function PA(t){return!t||t.type!=="columnList"}function BA(t,e,n){let r,o;if(e?e.children.length>0?(r=e.children[e.children.length-1],o="after"):(r=e,o="before"):n&&(r=n,o="before"),!r||!o)return;const i=t.getParentBlock(r);return PA(i)?{referenceBlock:r,placement:o}:BA(t,o==="after"?r:t.getPrevBlock(r),i)}function FA(t,e,n){let r,o;if(e?e.children.length>0?(r=e.children[0],o="before"):(r=e,o="after"):n&&(r=n,o="after"),!r||!o)return;const i=t.getParentBlock(r);return PA(i)?{referenceBlock:r,placement:o}:FA(t,o==="before"?r:t.getNextBlock(r),i)}function LK(t){t.transact(()=>{const e=t.getSelection(),n=e?.blocks[0]||t.getTextCursorPosition().block,r=BA(t,t.getPrevBlock(n),t.getParentBlock(n));r&&RA(t,r.referenceBlock,r.placement)})}function RK(t){t.transact(()=>{const e=t.getSelection(),n=e?.blocks[e?.blocks.length-1]||t.getTextCursorPosition().block,r=FA(t,t.getNextBlock(n),t.getParentBlock(n));r&&RA(t,r.referenceBlock,r.placement)})}function PK(t,e,n){const{$from:r,$to:o}=t.selection,i=r.blockRange(o,h=>h.childCount>0&&(h.type.name==="blockGroup"||h.type.name==="column"));if(!i)return!1;const s=i.startIndex;if(s===0)return!1;const a=i.parent.child(s-1);if(a.type!==e)return!1;const l=a.lastChild&&a.lastChild.type===n,c=V.from(l?e.create():null),u=new Q(V.from(e.create(null,V.from(n.create(null,c)))),l?3:1,0),d=i.start,f=i.end;return t.step(new yt(d-(l?3:1),f,d,f,u,1,!0)).scrollIntoView(),!0}function HA(t){return t.transact(e=>PK(e,t.pmSchema.nodes.blockContainer,t.pmSchema.nodes.blockGroup))}function BK(t){t._tiptapEditor.commands.liftListItem("blockContainer")}function FK(t){return t.transact(e=>{const{bnBlock:n}=Fl(e);return e.doc.resolve(n.beforePos).nodeBefore!==null})}function HK(t){return t.transact(e=>{const{bnBlock:n}=Fl(e);return e.doc.resolve(n.beforePos).depth>1})}function UK(t,e){const n=typeof e=="string"?e:e.id,r=Et(t),o=dn(n,t);if(o)return pt(o.node,r)}function VK(t,e){const n=typeof e=="string"?e:e.id,r=dn(n,t),o=Et(t);if(!r)return;const i=t.resolve(r.posBeforeNode).nodeBefore;if(i)return pt(i,o)}function $K(t,e){const n=typeof e=="string"?e:e.id,r=dn(n,t),o=Et(t);if(!r)return;const i=t.resolve(r.posBeforeNode+r.node.nodeSize).nodeAfter;if(i)return pt(i,o)}function jK(t,e){const n=typeof e=="string"?e:e.id,r=Et(t),o=dn(n,t);if(!o)return;const i=t.resolve(o.posBeforeNode),s=i.node(),a=i.node(-1),l=a.type.name!=="doc"?s.type.name==="blockGroup"?a:s:void 0;if(l)return pt(l,r)}let zK=class{constructor(e){this.editor=e}get document(){return this.editor.transact(e=>P5(e.doc,this.editor.pmSchema))}getBlock(e){return this.editor.transact(n=>UK(n.doc,e))}getPrevBlock(e){return this.editor.transact(n=>VK(n.doc,e))}getNextBlock(e){return this.editor.transact(n=>$K(n.doc,e))}getParentBlock(e){return this.editor.transact(n=>jK(n.doc,e))}forEachBlock(e,n=!1){const r=this.document.slice();n&&r.reverse();function o(i){for(const s of i){if(e(s)===!1)return!1;const a=n?s.children.slice().reverse():s.children;if(!o(a))return!1}return!0}o(r)}insertBlocks(e,n,r="before"){return this.editor.transact(o=>AK(o,e,n,r))}updateBlock(e,n){return this.editor.transact(r=>A8(r,e,n))}removeBlocks(e){return this.editor.transact(n=>Sx(n,e,[]).removedBlocks)}replaceBlocks(e,n){return this.editor.transact(r=>Sx(r,e,n))}canNestBlock(){return FK(this.editor)}nestBlock(){HA(this.editor)}canUnnestBlock(){return HK(this.editor)}unnestBlock(){BK(this.editor)}moveBlocksUp(){return LK(this.editor)}moveBlocksDown(){return RK(this.editor)}},qK=class extends Gg{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:o,appendedTransactions:i})=>{!n&&vx(o)||e(this.editor,{getChanges(){return Jv(o,i)}})};return this.on("onChange",r),()=>{this.off("onChange",r)}}onSelectionChange(e,n=!1){const r=o=>{!n&&vx(o.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 vx(t){return!!t.getMeta("y-sync$")}function WK(t){return Array.prototype.indexOf.call(t.parentElement.childNodes,t)}function GK(t){return t.nodeType===3&&!/\S/.test(t.nodeValue||"")}function YK(t){t.querySelectorAll("li > ul, li > ol").forEach(e=>{const n=WK(e),r=e.parentElement,o=Array.from(r.childNodes).slice(n+1);e.remove(),o.forEach(i=>{i.remove()}),r.insertAdjacentElement("afterend",e),o.reverse().forEach(i=>{if(GK(i))return;const s=document.createElement("li");s.append(i),e.insertAdjacentElement("afterend",s)}),r.childNodes.length===0&&r.remove()})}function KK(t){t.querySelectorAll("li + ul, li + ol").forEach(e=>{var n,r;const o=e.previousElementSibling,i=document.createElement("div");o.insertAdjacentElement("afterend",i),i.append(o);const s=document.createElement("div");for(s.setAttribute("data-node-type","blockGroup"),i.append(s);((n=i.nextElementSibling)==null?void 0:n.nodeName)==="UL"||((r=i.nextElementSibling)==null?void 0:r.nodeName)==="OL";)s.append(i.nextElementSibling)})}let Ax=null;function QK(){return Ax||(Ax=document.implementation.createHTMLDocument("title"))}function XK(t){if(typeof t=="string"){const e=QK().createElement("div");e.innerHTML=t,t=e}return YK(t),KK(t),t}function UA(t,e){const n=XK(t),r=hr.fromSchema(e).parse(n,{topNode:e.nodes.blockGroup.create()}),o=[];for(let i=0;i<r.childCount;i++)o.push(pt(r.child(i),e));return o}function ZK(t,e){const n=e.value?e.value:"",r={};e.lang&&(r["data-language"]=e.lang);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(o.data={meta:e.meta}),t.patch(e,o),o=t.applyData(e,o),o={type:"element",tagName:"pre",properties:{},children:[o]},t.patch(e,o),o}function JK(t,e){var n;const r=String(e?.url||""),o=e!=null&&e.title?String(e.title):void 0;let i={type:"element",tagName:"video",properties:{src:r,"data-name":o,"data-url":r,controls:!0},children:[]};return(n=t.patch)==null||n.call(t,e,i),i=t.applyData?t.applyData(e,i):i,i}function VA(t){return Gv().use(HG).use(Wv).use(xY,{handlers:{...Nm,image:(e,n)=>{const r=String(n?.url||"");return b8(r)?JK(e,n):Nm.image(e,n)},code:ZK}}).use(wK).processSync(t).value}function eQ(t,e){const n=VA(t);return UA(n,e)}let tQ=class{constructor(e){this.editor=e}blocksToHTMLLossy(e=this.editor.document){return bf(this.editor.pmSchema,this.editor).exportBlocks(e,{})}blocksToFullHTML(e=this.editor.document){return MK(this.editor.pmSchema,this.editor).serializeBlocks(e,{})}tryParseHTMLToBlocks(e){return UA(e,this.editor.pmSchema)}blocksToMarkdownLossy(e=this.editor.document){return hq(e,this.editor.pmSchema,this.editor,{})}tryParseMarkdownToBlocks(e){return eQ(e,this.editor.pmSchema)}pasteHTML(e,n=!1){var r;let o=e;if(!n){const i=this.tryParseHTMLToBlocks(e);o=this.blocksToFullHTML(i)}o&&((r=this.editor.prosemirrorView)==null||r.pasteHTML(o))}pasteText(e){var n;return(n=this.editor.prosemirrorView)==null?void 0:n.pasteText(e)}pasteMarkdown(e){const n=VA(e);return this.pasteHTML(n)}};const Y0=["vscode-editor-data","blocknote/html","text/markdown","text/html","text/plain","Files"];function nQ(t,e){if(!t.startsWith(".")||!e.startsWith("."))throw new Error("The strings provided are not valid file extensions.");return t===e}function rQ(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 _x(t,e,n,r="after"){let o;return Array.isArray(e.content)&&e.content.length===0?o=t.updateBlock(e,n).id:o=t.insertBlocks([n],e,r)[0].id,o}async function $A(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 o=null;for(const s of Y0)if(r.types.includes(s)){o=s;break}if(o!=="Files")return;const i=r.items;if(i){t.preventDefault();for(let s=0;s<i.length;s++){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("."),f=i[s].getAsFile();if(f&&(!d&&f.type&&rQ(i[s].type,u)||d&&nQ("."+f.name.split(".").pop(),u))){a=c.config.type;break}}const l=i[s].getAsFile();if(l){const c={type:a,props:{name:l.name}};let u;if(t.type==="paste"){const h=e.getTextCursorPosition().block;u=_x(e,h,c)}else if(t.type==="drop"){const h={left:t.clientX,top:t.clientY},p=e.prosemirrorView.posAtCoords(h);if(!p)return;u=e.transact(g=>{const b=Go(g.doc,p.pos),E=e.prosemirrorView.dom.querySelector(`[data-id="${b.node.attrs.id}"]`),x=E?.getBoundingClientRect();return _x(e,e.getBlock(b.node.attrs.id),c,x&&(x.top+x.bottom)/2>h.top?"before":"after")})}else return;const d=await e.uploadFile(l,u),f=typeof d=="string"?{props:{url:d}}:{...d};e.updateBlock(u,f)}}}}const oQ=t=>We.create({name:"dropFile",addProseMirrorPlugins(){return[new ye({props:{handleDOMEvents:{drop(e,n){if(!t.isEditable)return;let r=null;for(const o of Y0)if(n.dataTransfer.types.includes(o)){r=o;break}return r===null?!0:r==="Files"?($A(n,t),!0):!1}}}})]}}),iQ=/(^|\n) {0,3}#{1,6} {1,8}[^\n]{1,64}\r?\n\r?\n\s{0,32}\S/,sQ=/(_|__|\*|\*\*|~~|==|\+\+)(?!\s)(?:[^\s](?:.{0,62}[^\s])?|\S)(?=\1)/,aQ=/\[[^\]]{1,128}\]\(https?:\/\/\S{1,999}\)/,lQ=/(?:\s|^)`(?!\s)(?:[^\s`](?:[^`]{0,46}[^\s`])?|[^\s`])`([^\w]|$)/,cQ=/(?:^|\n)\s{0,5}-\s{1}[^\n]+\n\s{0,15}-\s/,uQ=/(?:^|\n)\s{0,5}\d+\.\s{1}[^\n]+\n\s{0,15}\d+\.\s/,dQ=/\n{2} {0,3}-{2,48}\n{2}/,fQ=/(?:\n|^)(```|~~~|\$\$)(?!`|~)[^\s]{0,64} {0,64}[^\n]{0,64}\n[\s\S]{0,9999}?\s*\1 {0,64}(?:\n+|$)/,hQ=/(?:\n|^)(?!\s)\w[^\n]{0,64}\r?\n(-|=)\1{0,64}\n\n\s{0,64}(\w|$)/,pQ=/(?:^|(\r?\n\r?\n))( {0,3}>[^\n]{1,333}\n){1,999}($|(\r?\n))/,mQ=/^\s*\|(.+\|)+\s*$/m,gQ=/^\s*\|(\s*[-:]+[-:]\s*\|)+\s*$/m,bQ=/^\s*\|(.+\|)+\s*$/m,yQ=t=>iQ.test(t)||sQ.test(t)||aQ.test(t)||lQ.test(t)||cQ.test(t)||uQ.test(t)||dQ.test(t)||fQ.test(t)||hQ.test(t)||pQ.test(t)||mQ.test(t)||gQ.test(t)||bQ.test(t);async function EQ(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 o=t.clipboardData.getData("vscode-editor-data"),i=o?JSON.parse(o):void 0,s=i?.mode;return s?(e.pasteHTML(`<pre><code class="language-${s}">${r.replace(/\r\n?/g,`
|
|
177
|
+
`)}</code></pre>`),!0):!1}function xQ({event:t,editor:e,prioritizeMarkdownOverHTML:n,plainTextAsMarkdown:r}){var o;if(e.transact(a=>a.selection.$from.parent.type.spec.code&&a.selection.$to.parent.type.spec.code)){const a=(o=t.clipboardData)==null?void 0:o.getData("text/plain");if(a)return e.pasteText(a),!0}let i;for(const a of Y0)if(t.clipboardData.types.includes(a)){i=a;break}if(!i)return!0;if(i==="vscode-editor-data")return EQ(t,e.prosemirrorView),!0;if(i==="Files")return $A(t,e),!0;const s=t.clipboardData.getData(i);if(i==="blocknote/html")return e.pasteHTML(s,!0),!0;if(i==="text/markdown")return e.pasteMarkdown(s),!0;if(n){const a=t.clipboardData.getData("text/plain");if(yQ(a))return e.pasteMarkdown(a),!0}return i==="text/html"?(e.pasteHTML(s),!0):r?(e.pasteMarkdown(s),!0):(e.pasteText(s),!0)}const CQ=(t,e)=>We.create({name:"pasteFromClipboard",addProseMirrorPlugins(){return[new ye({props:{handleDOMEvents:{paste(n,r){if(r.preventDefault(),!!t.isEditable)return e({event:r,editor:t,defaultPasteHandler:({prioritizeMarkdownOverHTML:o=!0,plainTextAsMarkdown:i=!0}={})=>xQ({event:r,editor:t,prioritizeMarkdownOverHTML:o,plainTextAsMarkdown:i})})}}}})]}});function kQ(t,e,n){var r;let o=!1;const i=t.state.selection instanceof Ge;if(!i){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));o=c.find(u=>u.type.isInGroup("bnBlock")||u.type.name==="blockGroup"||u.type.spec.group==="blockContent")===void 0,o&&(e=l)}let s;const a=bf(t.state.schema,n);if(i){((r=e.firstChild)==null?void 0:r.type.name)==="table"&&(e=e.firstChild.content);const l=h2(e,n.schema.inlineContentSchema,n.schema.styleSchema);s=`<table>${a.exportInlineContent(l,{})}</table>`}else if(o){const l=Zd(e,n.schema.inlineContentSchema,n.schema.styleSchema);s=a.exportInlineContent(l,{})}else{const l=eA(e);s=a.exportBlocks(l,{})}return s}function jA(t,e){"node"in t.state.selection&&t.state.selection.node.type.spec.group==="blockContent"&&e.transact(s=>s.setSelection(new le(s.doc.resolve(t.state.selection.from-1))));const n=t.serializeForClipboard(t.state.selection.content()).dom.innerHTML,r=t.state.selection.content().content,o=kQ(t,r,e),i=L0(o);return{clipboardHTML:n,externalHTML:o,markdown:i}}const Nx=()=>{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},Ix=(t,e,n)=>{n.preventDefault(),n.clipboardData.clearData();const{clipboardHTML:r,externalHTML:o,markdown:i}=jA(e,t);n.clipboardData.setData("blocknote/html",r),n.clipboardData.setData("text/html",o),n.clipboardData.setData("text/plain",i)},TQ=t=>We.create({name:"copyToClipboard",addProseMirrorPlugins(){return[new ye({props:{handleDOMEvents:{copy(e,n){return Nx()||Ix(t,e,n),!0},cut(e,n){return Nx()||(Ix(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(s=>s.setSelection(new le(s.doc.resolve(e.state.selection.from-1)))),n.preventDefault(),n.dataTransfer.clearData();const{clipboardHTML:r,externalHTML:o,markdown:i}=jA(e,t);return n.dataTransfer.setData("blocknote/html",r),n.dataTransfer.setData("text/html",o),n.dataTransfer.setData("text/plain",i),!0}}}})]}}),wQ=We.create({name:"blockBackgroundColor",addGlobalAttributes(){return[{types:["tableCell","tableHeader"],attributes:{backgroundColor:I8()}}]}}),SQ=Cr.create({name:"hardBreak",inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,priority:10,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Hn(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
178
|
+
`}}),Rm=(t,e)=>{const n=t.resolve(e),r=n.index();if(r===0)return;const o=n.posAtIndex(r-1);return Xd(t.resolve(o))},zA=(t,e)=>{for(;e.childContainer;){const n=e.childContainer.node,r=t.resolve(e.childContainer.beforePos+1).posAtIndex(n.childCount-1);e=Xd(t.resolve(r))}return e},vQ=(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*",AQ=(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 o=t.doc.resolve(r.childContainer.beforePos+1),i=t.doc.resolve(r.childContainer.afterPos-1),s=o.blockRange(i);if(e){const a=t.doc.resolve(r.bnBlock.beforePos);t.tr.lift(s,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},Mx=t=>({state:e,dispatch:n})=>{const r=e.doc.resolve(t),o=Xd(r),i=Rm(e.doc,o.bnBlock.beforePos);if(!i)return!1;const s=zA(e.doc,i);return vQ(s,o)?AQ(e,n,s,o):!1},_Q=We.create({priority:50,addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({chain:r,commands:o})=>[()=>o.deleteSelection(),()=>o.undoInputRule(),()=>o.command(({state:i})=>{const s=gn(i);if(!s.isBlockContainer)return!1;const a=i.selection.from===s.blockContent.beforePos+1,l=s.blockContent.node.type.name==="paragraph";return a&&!l?o.command(S8(s.bnBlock.beforePos,{type:"paragraph",props:{}})):!1}),()=>o.command(({state:i})=>{const s=gn(i);if(!s.isBlockContainer)return!1;const{blockContent:a}=s;return i.selection.from===a.beforePos+1?o.liftListItem("blockContainer"):!1}),()=>o.command(({state:i})=>{const s=gn(i);if(!s.isBlockContainer)return!1;const{bnBlock:a,blockContent:l}=s,c=i.selection.from===l.beforePos+1,u=i.selection.empty,d=a.beforePos;return c&&u?r().command(Mx(d)).scrollIntoView().run():!1}),()=>o.command(({state:i,tr:s,dispatch:a})=>{const l=gn(i);if(!l.isBlockContainer||s.selection.from!==l.blockContent.beforePos+1)return!1;const c=s.doc.resolve(l.bnBlock.beforePos);if(c.nodeBefore||c.node().type.name!=="column")return!1;const u=s.doc.resolve(l.bnBlock.beforePos),d=s.doc.resolve(u.before()),f=d.before();if(a){const h=s.doc.slice(l.bnBlock.beforePos,l.bnBlock.afterPos).content;s.delete(l.bnBlock.beforePos,l.bnBlock.afterPos),d.index()===0?(Dm(s,f),s.insert(f,h),s.setSelection(ae.near(s.doc.resolve(f)))):(s.insert(d.pos-1,h),s.setSelection(ae.near(s.doc.resolve(d.pos-1))),Dm(s,f))}return!0}),()=>o.command(({state:i})=>{const s=gn(i);if(!s.isBlockContainer)return!1;if(s.blockContent.node.childCount===0&&s.blockContent.node.type.spec.content==="inline*"){const a=Rm(i.doc,s.bnBlock.beforePos);if(!a||!a.isBlockContainer)return!1;let l=r();if(a.blockContent.node.type.spec.content==="tableRow+"){const c=s.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:s.bnBlock.beforePos,to:s.bnBlock.afterPos}).scrollIntoView().run()}return!1}),()=>o.command(({state:i})=>{const s=gn(i);if(!s.isBlockContainer)throw new Error("todo");const a=i.selection.from===s.blockContent.beforePos+1,l=i.selection.empty,c=Rm(i.doc,s.bnBlock.beforePos);if(c&&a&&l){const u=zA(i.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:s.bnBlock.beforePos,to:s.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:o})=>{const i=gn(o);if(!i.isBlockContainer)return!1;const{bnBlock:s,blockContent:a,childContainer:l}=i,{depth:c}=o.doc.resolve(s.beforePos),u=s.afterPos===o.doc.nodeSize-3,d=o.selection.from===a.afterPos-1,f=o.selection.empty;if(!u&&d&&f&&l===void 0){let h=c,p=s.afterPos+1,g=o.doc.resolve(p).depth;for(;g<h;)h=g,p+=2,g=o.doc.resolve(p).depth;return r.command(Mx(p-1))}return!1})]),n=(r=!1)=>this.editor.commands.first(({commands:o,tr:i})=>[()=>o.command(({state:s})=>{const a=gn(s);if(!a.isBlockContainer)return!1;const{bnBlock:l,blockContent:c}=a,{depth:u}=s.doc.resolve(l.beforePos),d=s.selection.$anchor.parentOffset===0,f=s.selection.anchor===s.selection.head,h=c.node.childCount===0,p=u>1;return d&&f&&h&&p?o.liftListItem("blockContainer"):!1}),()=>o.command(({state:s})=>{var a;const l=gn(s),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=i.storedMarks||i.selection.$head.marks().filter(d=>this.editor.extensionManager.splittableMarks.includes(d.type.name));return i.insert(i.selection.head,i.doc.type.schema.nodes.hardBreak.create()).ensureMarks(u),!0}return!1}),()=>o.command(({state:s,dispatch:a})=>{const l=gn(s);if(!l.isBlockContainer)return!1;const{bnBlock:c,blockContent:u}=l,d=s.selection.$anchor.parentOffset===0,f=s.selection.anchor===s.selection.head,h=u.node.childCount===0;if(d&&f&&h){const p=c.afterPos,g=p+2;if(a){const b=s.schema.nodes.blockContainer.createAndFill();s.tr.insert(p,b).scrollIntoView(),s.tr.setSelection(new ae(s.doc.resolve(g)))}return!0}return!1}),()=>o.command(({state:s,chain:a})=>{const l=gn(s);if(!l.isBlockContainer)return!1;const{blockContent:c}=l,u=s.selection.$anchor.parentOffset===0;return c.node.childCount===0?!1:(a().deleteSelection().command(iB(s.selection.from,u,u)).run(),!0)})]);return{Backspace:t,Delete:e,Enter:()=>n(),"Shift-Enter":()=>n(!0),Tab:()=>{var r,o;return this.options.tabBehavior!=="prefer-indent"&&((r=this.options.editor.getExtension(Qo))!=null&&r.store.state||((o=this.options.editor.getExtension(fr))==null?void 0:o.store.state)!==void 0)?!1:HA(this.options.editor)},"Shift-Tab":()=>{var r,o;return this.options.tabBehavior!=="prefer-indent"&&((r=this.options.editor.getExtension(Qo))!=null&&r.store.state||((o=this.options.editor.getExtension(fr))==null?void 0:o.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()}}}),NQ=rr.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}}]}}}),IQ=rr.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}}]}}}),MQ=rr.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}}]}}}),OQ=We.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}}}}]}}),DQ=We.create({name:"blockTextColor",addGlobalAttributes(){return[{types:["table","tableCell","tableHeader"],attributes:{textColor:M8()}}]}}),LQ={blockColor:"data-block-color",blockStyle:"data-block-style",id:"data-id",depth:"data-depth",depthChange:"data-depth-change"},RQ=Cr.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(LQ))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[i,s]of Object.entries(t))i!=="class"&&n.setAttribute(i,s);const r={...((e=this.options.domAttributes)==null?void 0:e.block)||{},...t},o=document.createElement("div");o.className=ut("bn-block",r.class),o.setAttribute("data-node-type",this.name);for(const[i,s]of Object.entries(r))i!=="class"&&o.setAttribute(i,s);return n.appendChild(o),{dom:n,contentDOM:o}}}),PQ=Cr.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=ut("bn-block-group",n.class),r.setAttribute("data-node-type","blockGroup");for(const[o,i]of Object.entries(n))o!=="class"&&r.setAttribute(o,i);return{dom:r,contentDOM:r}}}),BQ=Cr.create({name:"doc",topNode:!0,content:"blockGroup",marks:"insertion modification deletion"});let Ox=!1;function FQ(t,e){const n=[rs.ClipboardTextSerializer,rs.Commands,rs.Editable,rs.FocusEvents,rs.Tabindex,RW,Qd.configure({types:["blockContainer","columnList","column"],setIdAttribute:e.setIdAttribute}),SQ,lG,NQ,IQ,MQ,aG.extend({inclusive:!1}).configure({defaultProtocol:rA,protocols:Ox?[]:nA}),...Object.values(t.schema.styleSpecs).map(r=>r.implementation.mark.configure({editor:t})),DQ,wQ,OQ,We.create({name:"OverrideEscape",addKeyboardShortcuts:()=>({Escape:()=>{var r;return(r=t.getExtension(er))!=null&&r.shown()?!1:(t.blur(),!0)}})}),BQ,RQ.configure({editor:t,domAttributes:e.domAttributes}),_Q.configure({editor:t,tabBehavior:e.tabBehavior}),PQ.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})]:[]]),TQ(t),CQ(t,e.pasteHandler||(r=>r.defaultPasteHandler())),oQ(t)];return Ox=!0,n}function HQ(t,e){var n;const r=[pq(),Cq(e),fr(e),Qo(e),Gl(e),wq(),vq(e),ml(e),Er(e),er(e),...e.trailingBlock!==!1?[Fq()]:[]];return e.collaboration?(r.push(bq(e.collaboration)),(n=e.collaboration.provider)!=null&&n.awareness&&r.push(gm(e.collaboration)),r.push(Kc(e.collaboration)),r.push(Qc(e.collaboration)),r.push(xq(e.collaboration))):r.push(kq()),"table"in t.schema.blockSpecs&&r.push(dt(e)),e.animations!==!1&&r.push(_q()),r}class UQ{constructor(e,n){Be(this,"disabledExtensions",new Set),Be(this,"extensions",[]),Be(this,"abortMap",new Map),Be(this,"extensionFactories",new Map),Be(this,"extensionPlugins",new Map),this.editor=e,this.options=n,e.onMount(()=>{for(const r of this.extensions)if(r.mount){const o=new window.AbortController,i=r.mount({dom:e.prosemirrorView.dom,root:e.prosemirrorView.root,signal:o.signal});i&&o.signal.addEventListener("abort",()=>{i()}),this.abortMap.set(r,o)}}),e.onUnmount(()=>{for(const[r,o]of this.abortMap.entries())this.abortMap.delete(r),o.abort()}),this.disabledExtensions=new Set(n.disableExtensions||[]);for(const r of HQ(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 o of r.extensions??[])this.addExtension(o)}registerExtension(e){var n;const r=[].concat(e).filter(Boolean);if(!r.length){console.warn("No extensions found to register",e);return}const o=r.map(s=>this.addExtension(s)).filter(Boolean),i=new Set;for(const s of o)s!=null&&s.tiptapExtensions&&console.warn(`Extension ${s.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.`,s),(n=s?.inputRules)!=null&&n.length&&console.warn(`Extension ${s.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.`,s),this.getProsemirrorPluginsFromExtension(s).plugins.forEach(a=>{i.add(a)});this.updatePlugins(s=>[...s,...i])}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[Up];typeof r=="function"&&this.extensionFactories.set(r,n)}return this.extensions.push(n),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(o=>o.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 o=!1;const i=new Set;for(const s of r){this.extensions=this.extensions.filter(l=>l!==s),this.extensionFactories.forEach((l,c)=>{l===s&&this.extensionFactories.delete(c)}),(n=this.abortMap.get(s))==null||n.abort(),this.abortMap.delete(s);const a=this.extensionPlugins.get(s);a?.forEach(l=>{i.add(l)}),this.extensionPlugins.delete(s),s.tiptapExtensions&&!o&&(o=!0,console.warn(`Extension ${s.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(s=>s.filter(a=>!i.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=FQ(this.editor,this.options),r=uA(this.extensions),o=new Map;for(const i of this.extensions){i.tiptapExtensions&&n.push(...i.tiptapExtensions);const s=r(i.key),{plugins:a,inputRules:l}=this.getProsemirrorPluginsFromExtension(i);a.length&&n.push(We.create({name:i.key,priority:s,addProseMirrorPlugins:()=>a})),l.length&&(o.has(s)||o.set(s,[]),o.get(s).push(...l))}n.push(We.create({name:"blocknote-input-rules",addProseMirrorPlugins(){const i=[];return Array.from(o.keys()).sort().reverse().forEach(s=>{i.push(...o.get(s))}),[AW({rules:i})]}}));for(const i of((e=this.options._tiptapOptions)==null?void 0:e.extensions)??[])n.push(i);return n}getProsemirrorPluginsFromExtension(e){var n,r,o;const i=[...e.prosemirrorPlugins??[]],s=[];return!((n=e.prosemirrorPlugins)!=null&&n.length)&&!Object.keys(e.keyboardShortcuts||{}).length&&!((r=e.inputRules)!=null&&r.length)?{plugins:i,inputRules:s}:(this.extensionPlugins.set(e,i),(o=e.inputRules)!=null&&o.length&&s.push(...e.inputRules.map(a=>new Wi(a.find,(l,c,u,d)=>{const f=a.replace({match:c,range:{from:u,to:d},editor:this.editor});if(f){const h=this.editor.getTextCursorPosition();if(this.editor.schema.blockSchema[h.block.type].content!=="inline")return null;const p=Fl(l.tr),g=l.tr.deleteRange(u,d);return ef(g,p.bnBlock.beforePos,f),g}return null}))),Object.keys(e.keyboardShortcuts||{}).length&&i.push(Iw(Object.fromEntries(Object.entries(e.keyboardShortcuts).map(([a,l])=>[a,()=>l({editor:this.editor})])))),{plugins:i,inputRules:s})}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 VQ(t){const e=Et(t);if(t.selection.empty||"node"in t.selection)return;const n=t.doc.resolve(Go(t.doc,t.selection.from).posBeforeNode),r=t.doc.resolve(Go(t.doc,t.selection.to).posBeforeNode),o=(c,u)=>{const d=n.posAtIndex(c,u),f=t.doc.resolve(d).nodeAfter;if(!f)throw new Error(`Error getting selection - node not found at position ${d}`);return pt(f,e)},i=[],s=n.sharedDepth(r.pos),a=n.index(s),l=r.index(s);if(n.depth>s){i.push(pt(n.nodeAfter,e));for(let c=n.depth;c>s;c--)if(n.node(c).type.isInGroup("childContainer")){const u=n.index(c)+1,d=n.node(c).childCount;for(let f=u;f<d;f++)i.push(o(f,c))}}else i.push(o(a,s));for(let c=a+1;c<=l;c++)i.push(o(c,s));if(i.length===0)throw new Error(`Error getting selection - selection doesn't span any blocks (${t.selection})`);return{blocks:i}}function $Q(t,e,n){const r=typeof e=="string"?e:e.id,o=typeof n=="string"?n:n.id,i=Et(t),s=Hl(i);if(r===o)throw new Error(`Attempting to set selection with the same anchor and head blocks (id ${r})`);const a=dn(r,t.doc);if(!a)throw new Error(`Block with ID ${r} not found`);const l=dn(o,t.doc);if(!l)throw new Error(`Block with ID ${o} not found`);const c=Yo(a),u=Yo(l),d=s.blockSchema[c.blockNoteType],f=s.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||f.content==="none")throw new Error(`Attempting to set selection anchor in block without content (id ${o})`);let h,p;if(d.content==="table"){const g=rt.get(c.blockContent.node);h=c.blockContent.beforePos+g.positionAt(0,0,c.blockContent.node)+1+2}else h=c.blockContent.beforePos+1;if(f.content==="table"){const g=rt.get(u.blockContent.node),b=u.blockContent.beforePos+g.positionAt(g.height-1,g.width-1,u.blockContent.node)+1,E=t.doc.resolve(b).nodeAfter.nodeSize;p=b+E-2}else p=u.blockContent.afterPos-1;t.setSelection(ae.create(t.doc,h,p))}function jQ(t){const e=Et(t);let n=t.selection.$from,r=t.selection.$to;for(;r.parentOffset>=r.parent.nodeSize-2&&r.depth>0;)r=t.doc.resolve(r.pos+1);for(;r.parentOffset===0&&r.depth>0;)r=t.doc.resolve(r.pos-1);for(;n.parentOffset===0&&n.depth>0;)n=t.doc.resolve(n.pos-1);for(;n.parentOffset>=n.parent.nodeSize-2&&n.depth>0;)n=t.doc.resolve(n.pos+1);const o=B5(t.doc.slice(n.pos,r.pos,!0),e);return{_meta:{startPos:n.pos,endPos:r.pos},...o}}function zQ(t){const{bnBlock:e}=Fl(t),n=Et(t.doc),r=t.doc.resolve(e.beforePos),o=r.nodeBefore,i=t.doc.resolve(e.afterPos).nodeAfter;let s;return r.depth>1&&(s=r.node(),s.type.isInGroup("bnBlock")||(s=r.node(r.depth-1))),{block:pt(e.node,n),prevBlock:o===null?void 0:pt(o,n),nextBlock:i===null?void 0:pt(i,n),parentBlock:s===void 0?void 0:pt(s,n)}}function qA(t,e,n="start"){const r=typeof e=="string"?e:e.id,o=Et(t.doc),i=Hl(o),s=dn(r,t.doc);if(!s)throw new Error(`Block with ID ${r} not found`);const a=Yo(s),l=i.blockSchema[a.blockNoteType].content;if(a.isBlockContainer){const c=a.blockContent;if(l==="none"){t.setSelection(le.create(t.doc,c.beforePos));return}if(l==="inline")n==="start"?t.setSelection(ae.create(t.doc,c.beforePos+1)):t.setSelection(ae.create(t.doc,c.afterPos-1));else if(l==="table")n==="start"?t.setSelection(ae.create(t.doc,c.beforePos+4)):t.setSelection(ae.create(t.doc,c.afterPos-4));else throw new Hr(l)}else{const c=n==="start"?a.childContainer.node.firstChild:a.childContainer.node.lastChild;qA(t,c.attrs.id,n)}}class qQ{constructor(e){this.editor=e}getSelection(){return this.editor.transact(e=>VQ(e))}getSelectionCutBlocks(){return this.editor.transact(e=>jQ(e))}setSelection(e,n){return this.editor.transact(r=>$Q(r,e,n))}getTextCursorPosition(){return this.editor.transact(e=>zQ(e))}setTextCursorPosition(e,n="start"){return this.editor.transact(r=>qA(r,e,n))}getSelectionBoundingBox(){if(!this.editor.prosemirrorView)return;const{selection:e}=this.editor.prosemirrorState,{ranges:n}=e,r=Math.min(...n.map(i=>i.$from.pos)),o=Math.max(...n.map(i=>i.$to.pos));if(Ww(e)){const i=this.editor.prosemirrorView.nodeDOM(r);if(i)return i.getBoundingClientRect()}return jg(this.editor.prosemirrorView,r,o).toJSON()}}class WQ{constructor(e){Be(this,"activeTransaction",null),Be(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,o=>this.prosemirrorView.dispatch(o),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 GQ(t,e,n,r={updateSelection:!0}){let{from:o,to:i}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},s=!0,a=!0,l="";if(n.forEach(c=>{c.check(),s&&c.isText&&c.marks.length===0?l+=c.text:s=!1,a=a?c.isBlock:!1}),o===i&&a){const{parent:c}=t.doc.resolve(o);c.isTextblock&&!c.type.spec.code&&!c.childCount&&(o-=1,i+=1)}return s?t.insertText(l,o,i):t.replaceWith(o,i,n),r.updateSelection&&Pw(t,t.steps.length-1,-1),!0}class YQ{constructor(e){this.editor=e}insertInlineContent(e,{updateSelection:n=!1}={}){const r=yr(e,this.editor.pmSchema);this.editor.transact(o=>{GQ(o,{from:o.selection.from,to:o.selection.to},r,{updateSelection:n})})}getActiveStyles(){return this.editor.transact(e=>{const n={},r=e.selection.$to.marks();for(const o of r){const i=this.editor.schema.styleSchema[o.type.name];if(!i){o.type.name!=="link"&&!o.type.spec.blocknoteIgnore&&console.warn("mark not found in styleschema",o.type.name);continue}i.propSchema==="boolean"?n[i.type]=!0:n[i.type]=o.attrs.stringValue}return n})}addStyles(e){for(const[n,r]of Object.entries(e)){const o=this.editor.schema.styleSchema[n];if(!o)throw new Error(`style ${n} not found in styleSchema`);if(o.propSchema==="boolean")this.editor._tiptapEditor.commands.setMark(n);else if(o.propSchema==="string")this.editor._tiptapEditor.commands.setMark(n,{stringValue:r});else throw new Hr(o.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 o=this.editor.schema.styleSchema[n];if(!o)throw new Error(`style ${n} not found in styleSchema`);if(o.propSchema==="boolean")this.editor._tiptapEditor.commands.toggleMark(n);else if(o.propSchema==="string")this.editor._tiptapEditor.commands.toggleMark(n,{stringValue:r});else throw new Hr(o.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(o=>{const{from:i,to:s}=o.selection;n?o.insertText(n,i,s).addMark(i,i+n.length,r):o.setSelection(ae.create(o.doc,s)).addMark(i,s,r)})}}function KQ(t,e){const n=[];return t.forEach((r,o,i)=>{i!==e&&n.push(r)}),V.from(n)}function QQ(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 o=n[n.length-1],i=o.copy(o.content.addToEnd(t.child(r)));n[n.length-1]=i}else{const o=e.nodes.table.createChecked(void 0,t.child(r));n.push(o)}else n.push(t.child(r));return t=V.from(n),t}function XQ(t,e){let n=V.from(t.content);if(n=QQ(n,e.state.schema),!ZQ(n,e))return new Q(n,t.openStart,t.openEnd);for(let r=0;r<n.childCount;r++)if(n.child(r).type.spec.group==="blockContent"){const o=[n.child(r)];if(r+1<n.childCount&&n.child(r+1).type.name==="blockGroup"){const s=n.child(r+1).child(0).child(0);(s.type.name==="bulletListItem"||s.type.name==="numberedListItem"||s.type.name==="checkListItem")&&(o.push(n.child(r+1)),n=KQ(n,r+1))}const i=e.state.schema.nodes.blockContainer.createChecked(void 0,o);n=n.replaceChild(r,i)}return new Q(n,t.openStart,t.openEnd)}function ZQ(t,e){var n,r;const o=t.childCount===1,i=((n=t.firstChild)==null?void 0:n.type.spec.content)==="inline*",s=((r=t.firstChild)==null?void 0:r.type.spec.content)==="tableRow+";if(o){if(i)return!1;if(s){const a=gn(e.state);if(a.isBlockContainer)return a.blockContent.node.type.spec.content!=="tableRow+"}}return!0}const JQ={enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!1};let eX=class WA extends Gg{constructor(e){var n,r,o,i,s,a,l,c,u,d;super(),Be(this,"pmSchema"),Be(this,"_tiptapEditor"),Be(this,"elementRenderer",null),Be(this,"blockCache",new WeakMap),Be(this,"dictionary"),Be(this,"schema"),Be(this,"blockImplementations"),Be(this,"inlineContentImplementations"),Be(this,"styleImplementations"),Be(this,"uploadFile"),Be(this,"onUploadStartCallbacks",[]),Be(this,"onUploadEndCallbacks",[]),Be(this,"resolveFileUrl"),Be(this,"settings"),Be(this,"_blockManager"),Be(this,"_eventManager"),Be(this,"_exportManager"),Be(this,"_extensionManager"),Be(this,"_selectionManager"),Be(this,"_stateManager"),Be(this,"_styleManager"),Be(this,"unregisterExtension",(...x)=>this._extensionManager.unregisterExtension(...x)),Be(this,"registerExtension",(...x)=>this._extensionManager.registerExtension(...x)),Be(this,"getExtension",(...x)=>this._extensionManager.getExtension(...x)),Be(this,"mount",x=>{this._tiptapEditor.mount({mount:x})}),Be(this,"unmount",()=>{this._tiptapEditor.unmount()}),this.options=e,this.dictionary=e.dictionary||wW,this.settings={tables:{splitCells:((n=e?.tables)==null?void 0:n.splitCells)??!1,cellBackgroundColor:((r=e?.tables)==null?void 0:r.cellBackgroundColor)??!1,cellTextColor:((o=e?.tables)==null?void 0:o.cellTextColor)??!1,headers:((i=e?.tables)==null?void 0:i.headers)??!1}};const f={defaultStyles:!0,schema:e.schema||P0.create(),...e,placeholders:{...this.dictionary.placeholders,...e.placeholders}};if(this.schema=f.schema,this.blockImplementations=f.schema.blockSpecs,this.inlineContentImplementations=f.schema.inlineContentSpecs,this.styleImplementations=f.schema.styleSpecs,f.uploadFile){const x=f.uploadFile;this.uploadFile=async(T,D)=>{this.onUploadStartCallbacks.forEach(O=>O.apply(this,[D]));try{return await x(T,D)}finally{this.onUploadEndCallbacks.forEach(O=>O.apply(this,[D]))}}}this.resolveFileUrl=f.resolveFileUrl,this._eventManager=new qK(this),this._extensionManager=new UQ(this,f);const h=this._extensionManager.getTiptapExtensions(),p=this._extensionManager.hasExtension("ySync")||this._extensionManager.hasExtension("liveblocksExtension");p&&f.initialContent&&console.warn("When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider");const g={...JQ,...f._tiptapOptions,element:null,autofocus:f.autofocus??!1,extensions:h,editorProps:{...(s=f._tiptapOptions)==null?void 0:s.editorProps,attributes:{tabIndex:"0",...(l=(a=f._tiptapOptions)==null?void 0:a.editorProps)==null?void 0:l.attributes,...(c=f.domAttributes)==null?void 0:c.editor,class:ut("bn-editor",f.defaultStyles?"bn-default-styles":"",((d=(u=f.domAttributes)==null?void 0:u.editor)==null?void 0:d.class)||"")},transformPasted:XQ}};try{const x=f.initialContent||(p?[{type:"paragraph",id:"initialBlockId"}]:[{type:"paragraph",id:Qd.options.generateID()}]);if(!Array.isArray(x)||x.length===0)throw new Error("initialContent must be a non-empty array of blocks, received: "+x);const T=y6(g.extensions),D=x.map(v=>$i(v,T,this.schema.styleSchema).toJSON()),O=Iu({type:"doc",content:[{type:"blockGroup",content:D}]},T,g.parseOptions);this._tiptapEditor=new l5({...g,content:O.toJSON()}),this.pmSchema=this._tiptapEditor.schema}catch(x){throw new Error("Error creating document from blocks passed as `initialContent`",{cause:x})}let b;const E=this.pmSchema.nodes.doc.createAndFill;this.pmSchema.nodes.doc.createAndFill=(...x)=>{if(b)return b;const T=E.apply(this.pmSchema.nodes.doc,x),D=JSON.parse(JSON.stringify(T.toJSON()));return D.content[0].content[0].attrs.id="initialBlockId",b=ao.fromJSON(this.pmSchema,D),b},this.pmSchema.cached.blockNoteEditor=this,this._blockManager=new zK(this),this._exportManager=new tQ(this),this._selectionManager=new qQ(this),this._stateManager=new WQ(this),this._styleManager=new YQ(this),this.emit("create")}static create(e){return new WA(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(){this.headless||this.prosemirrorView.dom.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)}getTextCursorPosition(){return this._selectionManager.getTextCursorPosition()}setTextCursorPosition(e,n="start"){return this._selectionManager.setTextCursorPosition(e,n)}getSelection(){return this._selectionManager.getSelection()}getSelectionCutBlocks(){return this._selectionManager.getSelectionCutBlocks()}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)}};var Gh={exports:{}},Yh={};var Dx;function tX(){if(Dx)return Yh;Dx=1;var t=o3(),e=m3();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,o=e.useSyncExternalStore,i=t.useRef,s=t.useEffect,a=t.useMemo,l=t.useDebugValue;return Yh.useSyncExternalStoreWithSelector=function(c,u,d,f,h){var p=i(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=a(function(){function E(v){if(!x){if(x=!0,T=v,v=f(v),h!==void 0&&g.hasValue){var R=g.value;if(h(R,v))return D=R}return D=v}if(R=D,r(T,v))return R;var j=f(v);return h!==void 0&&h(R,j)?(T=v,R):(T=v,D=j)}var x=!1,T,D,O=d===void 0?null:d;return[function(){return E(u())},O===null?void 0:function(){return E(O())}]},[u,d,f,h]);var b=o(c,p[0],p[1]);return s(function(){g.hasValue=!0,g.value=b},[b]),l(b),b},Yh}var Lx;function nX(){return Lx||(Lx=1,Gh.exports=tX()),Gh.exports}var rX=nX();function oX(t,e=n=>n){return rX.useSyncExternalStoreWithSelector(t.subscribe,()=>t.state,()=>t.state,e,iX)}function iX(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[r,o]of t)if(!e.has(r)||!Object.is(o,e.get(r)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const r of t)if(!e.has(r))return!1;return!0}if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();const n=Rx(t);if(n.length!==Rx(e).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(e,n[r])||!Object.is(t[n[r]],e[n[r]]))return!1;return!0}function Rx(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}var sX=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},aX=({contentComponent:t})=>{const e=b3.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return y.jsx(y.Fragment,{children:Object.values(e)})};function lX(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:g3.createPortal(r.reactElement,r.element,n)},t.forEach(o=>o())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(o=>o())}}}var cX=class extends Ie.Component{constructor(t){var e;super(t),this.editorContentRef=Ie.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=lX(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return y.jsxs(y.Fragment,{children:[y.jsx("div",{ref:sX(e,this.editorContentRef),...n}),t?.contentComponent&&y.jsx(aX,{contentComponent:t.contentComponent})]})}},uX=C.forwardRef((t,e)=>{const n=Ie.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Ie.createElement(cX,{key:n,innerRef:e,...t})}),dX=Ie.memo(uX),GA=C.createContext({editor:null});GA.Consumer;var YA=C.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),KA=()=>C.useContext(YA),fX=Ie.forwardRef((t,e)=>{const{onDragStart:n}=KA(),r=t.as||"div";return y.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function Px(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function Bx(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function hX(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function pX(t){if(Px(t)||Bx(t))return!0;if(hX(t)){const e=t.type;if(e)return Px(e)||Bx(e)}return!1}function mX(){try{if(C.version)return parseInt(C.version.split(".")[0],10)>=19}catch{}return!1}var gX=class{constructor(t,{editor:e,props:n={},as:r="div",className:o=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=e,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),o&&this.element.classList.add(...o.split(" ")),this.editor.isInitialized?ki.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var t;if(this.destroyed)return;const e=this.component,n=this.props,r=this.editor,o=mX(),i=pX(e),s={...n};s.ref&&!(o||i)&&delete s.ref,!s.ref&&(o||i)&&(s.ref=a=>{this.ref=a}),this.reactElement=y.jsx(e,{...s}),(t=r?.contentComponent)==null||t.setRenderer(this.id,this)}updateProps(t={}){this.destroyed||(this.props={...this.props,...t},this.render())}destroy(){var t;this.destroyed=!0;const e=this.editor;(t=e?.contentComponent)==null||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(e=>{this.element.setAttribute(e,t[e])})}};Ie.createContext({markViewContentRef:()=>{}});var bX=class extends y5{constructor(t,e,n){if(super(t,e,n),this.selectionRafId=null,this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const t=this.editor,e=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(e,{get(n,r,o){var i;return r==="storage"?(i=t.storage[e.name])!=null?i:{}:Reflect.get(n,r,o)}})}return this.cachedExtensionWithSyncedStorage}mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:C.createRef()};if(!this.component.displayName){const l=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=l(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement&&(l.hasAttribute("data-node-view-wrapper")&&l.removeAttribute("data-node-view-wrapper"),l.appendChild(this.contentDOMElement))}},o=this.component,i=C.memo(l=>y.jsx(YA.Provider,{value:r,children:C.createElement(o,l)}));i.displayName="ReactNodeView";let s=this.node.isInline?"span":"div";this.options.as&&(s=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new gX(i,{editor:this.editor,props:t,as:s,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var t;if(this.renderer.element.firstElementChild&&!((t=this.renderer.element.firstElementChild)!=null&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const{from:t,to:e}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(t<=n&&e>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(t,e,n){const r=o=>{this.renderer.updateProps(o),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const o=this.node,i=this.decorations,s=this.innerDecorations;return this.node=t,this.decorations=e,this.innerDecorations=n,this.options.update({oldNode:o,oldDecorations:i,newNode:t,newDecorations:e,oldInnerDecorations:s,innerDecorations:n,updateProps:()=>r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}return t===this.node&&this.decorations===e&&this.innerDecorations===n||(this.node=t,this.decorations=e,this.innerDecorations=n,r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,n=El(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function yX(t,e){return n=>n.editor.contentComponent?new bX(t,n,e):{}}var K0=C.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});K0.displayName="TiptapContext";var EX=()=>C.useContext(K0);function QA({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const o=C.useMemo(()=>({editor:r}),[r]),i=C.useMemo(()=>({editor:r}),[r]);return y.jsx(GA.Provider,{value:i,children:y.jsx(K0.Provider,{value:o,children:n})})}QA.displayName="Tiptap";function XA({...t}){const{editor:e}=EX();return y.jsx(dX,{editor:e,...t})}XA.displayName="Tiptap.Content";Object.assign(QA,{Content:XA});var xX=Object.defineProperty,CX=(t,e,n)=>e in t?xX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,pa=(t,e,n)=>CX(t,typeof e!="symbol"?e+"":e,n);const ZA=C.createContext(void 0);function zr(t){return C.useContext(ZA)}const JA=C.createContext(void 0);function fe(){return C.useContext(JA)}function ge(t){const e=zr();if(!(e!=null&&e.editor))throw new Error("useBlockNoteEditor was called outside of a BlockNoteContext provider or BlockNoteView component");return e.editor}function ve(){return zr().editor.dictionary}const kX=t=>{const e=fe(),n=ve(),r=ge(),o=r.getBlock(t.blockId),[i,s]=C.useState(""),a=C.useCallback(u=>{s(u.currentTarget.value)},[]),l=C.useCallback(u=>{u.key==="Enter"&&(u.preventDefault(),r.updateBlock(o.id,{props:{name:xy(i),url:i}}))},[r,o.id,i]),c=C.useCallback(()=>{r.updateBlock(o.id,{props:{name:xy(i),url:i}})},[r,o.id,i]);return y.jsxs(e.FilePanel.TabPanel,{className:"bn-tab-panel",children:[y.jsx(e.FilePanel.TextInput,{className:"bn-text-input",placeholder:n.file_panel.embed.url_placeholder,value:i,onChange:a,onKeyDown:l,"data-test":"embed-input"}),y.jsx(e.FilePanel.Button,{className:"bn-button",onClick:c,"data-test":"embed-input-button",children:n.file_panel.embed.embed_button[o.type]||n.file_panel.embed.embed_button.file})]})},TX=t=>{var e,n;const r=fe(),o=ve(),{setLoading:i}=t,s=ge(),a=s.getBlock(t.blockId),[l,c]=C.useState(!1);C.useEffect(()=>{l&&setTimeout(()=>{c(!1)},3e3)},[l]);const u=C.useCallback(h=>{if(h===null)return;async function p(g){if(i(!0),s.uploadFile!==void 0)try{let b=await s.uploadFile(g,t.blockId);typeof b=="string"&&(b={props:{name:g.name,url:b}}),s.updateBlock(t.blockId,b)}catch{c(!0)}finally{i(!1)}}p(h)},[t.blockId,s,i]),d=s.schema.blockSpecs[a.type],f=(n=(e=d.implementation.meta)==null?void 0:e.fileBlockAccept)!=null&&n.length?d.implementation.meta.fileBlockAccept.join(","):"*/*";return y.jsxs(r.FilePanel.TabPanel,{className:"bn-tab-panel",children:[y.jsx(r.FilePanel.FileInput,{className:"bn-file-input","data-test":"upload-input",accept:f,placeholder:o.file_panel.upload.file_placeholder[a.type]||o.file_panel.upload.file_placeholder.file,value:null,onChange:u}),l&&y.jsx("div",{className:"bn-error-text",children:o.file_panel.upload.upload_error})]})},e_=t=>{const e=fe(),n=ve(),r=ge(),[o,i]=C.useState(!1),s=t.tabs??[...r.uploadFile!==void 0?[{name:n.file_panel.upload.title,tabPanel:y.jsx(TX,{blockId:t.blockId,setLoading:i})}]:[],{name:n.file_panel.embed.title,tabPanel:y.jsx(kX,{blockId:t.blockId})}],[a,l]=C.useState(t.defaultOpenTab||s[0].name);return y.jsx(e.FilePanel.Root,{className:"bn-panel",defaultOpenTab:a,openTab:a,setOpenTab:l,tabs:s,loading:o})};function wX(t){let e=new DOMRect;const n="getBoundingClientRect"in t?()=>t.getBoundingClientRect():()=>t.element.getBoundingClientRect();return()=>"element"in t&&(t.cacheMountedBoundingClientRect??!0)?(t.element.isConnected&&(e=n()),e):n()}const Or=t=>{var e,n,r;const{refs:o,floatingStyles:i,context:s}=uW({whileElementsMounted:y3,...t.useFloatingOptions}),{isMounted:a,styles:l}=hW(s,t.useTransitionStylesProps),{status:c}=lA(s,t.useTransitionStatusProps),u=lW(s,t.useDismissProps),d=oW(s,{enabled:!1,...t.useHoverProps}),{getFloatingProps:f}=dW([u,d]),h=C.useRef(""),p=C.useRef(null),g=Yq([p,o.setFloating]);if(C.useEffect(()=>{t.reference&&("element"in t.reference&&o.setReference(t.reference.element),o.setPositionReference({getBoundingClientRect:wX(t.reference)}))},[t.reference,o]),C.useEffect(()=>{var E;(c==="initial"||c==="open")&&(E=p.current)!=null&&E.innerHTML&&(h.current=p.current.innerHTML)},[c,t.reference,t.children]),!a)return!1;const b={...t.elementProps,style:{display:"flex",...(e=t.elementProps)==null?void 0:e.style,zIndex:`calc(var(--bn-ui-base-z-index) + ${((r=(n=t.elementProps)==null?void 0:n.style)==null?void 0:r.zIndex)||0})`,...i,...l},...f()};return c==="close"?y.jsx("div",{ref:g,...b,dangerouslySetInnerHTML:{__html:h.current}}):y.jsx("div",{ref:g,...b,children:t.children})},t_=t=>{const{blockId:e,children:n,...r}=t,o=ge(),i=C.useMemo(()=>o.transact(s=>{if(!e)return;const a=dn(e,s.doc);if(!a)return;const{node:l}=o.prosemirrorView.domAtPos(a.posBeforeNode+1);if(l instanceof Element)return{element:l}}),[o,e]);return y.jsx(Or,{reference:i,...r,children:e!==void 0&&n})};function Re(t,e){const n=(e?.editor??ge()).getExtension(t);if(!n)throw new Error("Extension not found",{cause:{plugin:t}});return n}function et(t,e){const{store:n}=Re(t,e);if(!n)throw new Error("Store not found on plugin",{cause:{plugin:t}});return oX(n,e?.selector)}const SX=t=>{const e=ge(),n=Re(fr),r=et(fr),o=C.useMemo(()=>({useFloatingOptions:{open:!!r,onOpenChange:(s,a,l)=>{s||n.closeMenu(),l==="escape-key"&&e.focus()},middleware:[Dr(10),Hi()]},elementProps:{style:{zIndex:90}},...t.floatingUIOptions}),[r,e,n,t.floatingUIOptions]),i=t.filePanel||e_;return y.jsx(t_,{blockId:r,...o,children:r&&y.jsx(i,{blockId:r})})};function vX(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var AX=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,o,i;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!t(e[o],n[o]))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(o of e.entries())if(!n.has(o[0]))return!1;for(o of e.entries())if(!t(o[1],n.get(o[0])))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(o of e.entries())if(!n.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(e[o]!==n[o])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(i=Object.keys(e),r=i.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;o--!==0;){var s=i[o];if(!(s==="_owner"&&e.$$typeof)&&!t(e[s],n[s]))return!1}return!0}return e!==e&&n!==n};const _X=vX(AX);var n_={exports:{}},Kh={},Fx={exports:{}},Qh={};var Hx;function NX(){if(Hx)return Qh;Hx=1;var t=Ie;function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,o=t.useEffect,i=t.useLayoutEffect,s=t.useDebugValue;function a(d,f){var h=f(),p=r({inst:{value:h,getSnapshot:f}}),g=p[0].inst,b=p[1];return i(function(){g.value=h,g.getSnapshot=f,l(g)&&b({inst:g})},[d,h,f]),o(function(){return l(g)&&b({inst:g}),d(function(){l(g)&&b({inst:g})})},[d]),s(h),h}function l(d){var f=d.getSnapshot;d=d.value;try{var h=f();return!n(d,h)}catch{return!0}}function c(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return Qh.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,Qh}var Ux;function IX(){return Ux||(Ux=1,Fx.exports=NX()),Fx.exports}var Vx;function MX(){if(Vx)return Kh;Vx=1;var t=Ie,e=IX();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,o=e.useSyncExternalStore,i=t.useRef,s=t.useEffect,a=t.useMemo,l=t.useDebugValue;return Kh.useSyncExternalStoreWithSelector=function(c,u,d,f,h){var p=i(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=a(function(){function E(v){if(!x){if(x=!0,T=v,v=f(v),h!==void 0&&g.hasValue){var R=g.value;if(h(R,v))return D=R}return D=v}if(R=D,r(T,v))return R;var j=f(v);return h!==void 0&&h(R,j)?(T=v,R):(T=v,D=j)}var x=!1,T,D,O=d===void 0?null:d;return[function(){return E(u())},O===null?void 0:function(){return E(O())}]},[u,d,f,h]);var b=o(c,p[0],p[1]);return s(function(){g.hasValue=!0,g.value=b},[b]),l(b),b},Kh}n_.exports=MX();var OX=n_.exports;const DX=typeof window<"u"?C.useLayoutEffect:C.useEffect;class LX{constructor(e){pa(this,"transactionNumber",0),pa(this,"lastTransactionNumber",0),pa(this,"lastSnapshot"),pa(this,"editor"),pa(this,"subscribers",new Set),this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e,n){if(this.editor=e,this.editor){const r=()=>{this.transactionNumber+=1,this.subscribers.forEach(s=>s())},o=this.editor._tiptapEditor,i={all:"transaction",selection:"selectionUpdate",change:"update"};return o.on(i[n],r),()=>{o.off(i[n],r)}}}}function Ot(t){const e=zr(),n=t.editor||e?.editor||null,r=t.on||"all",[o]=C.useState(()=>new LX(n)),i=OX.useSyncExternalStoreWithSelector(o.subscribe,o.getSnapshot,o.getServerSnapshot,t.selector,t.equalityFn??_X);return DX(()=>o.watch(n,r),[n,o,r]),C.useDebugValue(i),i}const Q0=t=>{const{position:e,children:n,...r}=t,{from:o,to:i}=e||{},s=ge(),a=C.useMemo(()=>{var l;if(!(o===void 0||i===void 0))return{element:((l=s.domElement)==null?void 0:l.firstElementChild)||void 0,getBoundingClientRect:()=>jg(s.prosemirrorView,o,i??o)}},[s,o,i]);return y.jsx(Or,{reference:a,...r,children:e!==void 0&&n})};var r_={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},$x=Ie.createContext&&Ie.createContext(r_),RX=["attr","size","title"];function PX(t,e){if(t==null)return{};var n=BX(t,e),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(o=0;o<i.length;o++)r=i[o],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function BX(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function md(){return md=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},md.apply(this,arguments)}function jx(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function gd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?jx(Object(n),!0).forEach(function(r){FX(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):jx(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function FX(t,e,n){return e=HX(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function HX(t){var e=UX(t,"string");return typeof e=="symbol"?e:e+""}function UX(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function o_(t){return t&&t.map((e,n)=>Ie.createElement(e.tag,gd({key:n},e.attr),o_(e.child)))}function he(t){return e=>Ie.createElement(VX,md({attr:gd({},t.attr)},e),o_(t.child))}function VX(t){var e=n=>{var{attr:r,size:o,title:i}=t,s=PX(t,RX),a=o||n.size||"1em",l;return n.className&&(l=n.className),t.className&&(l=(l?l+" ":"")+t.className),Ie.createElement("svg",md({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,s,{className:l,style:gd(gd({color:t.color||n.color},n.style),t.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),i&&Ie.createElement("title",null,i),t.children)};return $x!==void 0?Ie.createElement($x.Consumer,null,n=>e(n)):e(r_)}function $X(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 7V11L2 6L8 1V5H13C17.4183 5 21 8.58172 21 13C21 17.4183 17.4183 21 13 21H4V19H13C16.3137 19 19 16.3137 19 13C19 9.68629 16.3137 7 13 7H8Z"},child:[]}]})(t)}function i_(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M7.29117 20.8242L2 22L3.17581 16.7088C2.42544 15.3056 2 13.7025 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C10.2975 22 8.6944 21.5746 7.29117 20.8242ZM7.58075 18.711L8.23428 19.0605C9.38248 19.6745 10.6655 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 13.3345 4.32549 14.6175 4.93949 15.7657L5.28896 16.4192L4.63416 19.3658L7.58075 18.711Z"},child:[]}]})(t)}function jX(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M7.24264 17.9967H3V13.754L14.435 2.319C14.8256 1.92848 15.4587 1.92848 15.8492 2.319L18.6777 5.14743C19.0682 5.53795 19.0682 6.17112 18.6777 6.56164L7.24264 17.9967ZM3 19.9967H21V21.9967H3V19.9967Z"},child:[]}]})(t)}function zX(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M23 12L15.9289 19.0711L14.5147 17.6569L20.1716 12L14.5147 6.34317L15.9289 4.92896L23 12ZM3.82843 12L9.48528 17.6569L8.07107 19.0711L1 12L8.07107 4.92896L9.48528 6.34317L3.82843 12Z"},child:[]}]})(t)}function qX(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{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"},child:[]}]})(t)}function WX(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM5 19H19V21H5V19ZM3 14H21V16H3V14ZM5 9H19V11H5V9Z"},child:[]}]})(t)}function GX(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H21V21H3V19ZM3 14H21V16H3V14ZM3 9H21V11H3V9Z"},child:[]}]})(t)}function YX(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H17V21H3V19ZM3 14H21V16H3V14ZM3 9H17V11H3V9Z"},child:[]}]})(t)}function KX(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM7 19H21V21H7V19ZM3 14H21V16H3V14ZM7 9H21V11H7V9Z"},child:[]}]})(t)}function QX(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 11H12.5C13.8807 11 15 9.88071 15 8.5C15 7.11929 13.8807 6 12.5 6H8V11ZM18 15.5C18 17.9853 15.9853 20 13.5 20H6V4H12.5C14.9853 4 17 6.01472 17 8.5C17 9.70431 16.5269 10.7981 15.7564 11.6058C17.0979 12.3847 18 13.837 18 15.5ZM8 13V18H13.5C14.8807 18 16 16.8807 16 15.5C16 14.1193 14.8807 13 13.5 13H8Z"},child:[]}]})(t)}function XX(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3.41436 5.99995L5.70726 3.70706L4.29304 2.29285L0.585938 5.99995L4.29304 9.70706L5.70726 8.29285L3.41436 5.99995ZM9.58594 5.99995L7.29304 3.70706L8.70726 2.29285L12.4144 5.99995L8.70726 9.70706L7.29304 8.29285L9.58594 5.99995ZM14.0002 2.99995H21.0002C21.5524 2.99995 22.0002 3.44767 22.0002 3.99995V20C22.0002 20.5522 21.5524 21 21.0002 21H3.00015C2.44787 21 2.00015 20.5522 2.00015 20V12H4.00015V19H20.0002V4.99995H14.0002V2.99995Z"},child:[]}]})(t)}function zx(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5.55397 22H3.3999L10.9999 3H12.9999L20.5999 22H18.4458L16.0458 16H7.95397L5.55397 22ZM8.75397 14H15.2458L11.9999 5.88517L8.75397 14Z"},child:[]}]})(t)}function bd(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 20H11V13H4V20H2V4H4V11H11V4H13V20ZM21.0005 8V20H19.0005L19 10.204L17 10.74V8.67L19.5005 8H21.0005Z"},child:[]}]})(t)}function yd(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M4 4V11H11V4H13V20H11V13H4V20H2V4H4ZM18.5 8C20.5711 8 22.25 9.67893 22.25 11.75C22.25 12.6074 21.9623 13.3976 21.4781 14.0292L21.3302 14.2102L18.0343 18H22V20H15L14.9993 18.444L19.8207 12.8981C20.0881 12.5908 20.25 12.1893 20.25 11.75C20.25 10.7835 19.4665 10 18.5 10C17.5818 10 16.8288 10.7071 16.7558 11.6065L16.75 11.75H14.75C14.75 9.67893 16.4289 8 18.5 8Z"},child:[]}]})(t)}function Ed(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M22 8L21.9984 10L19.4934 12.883C21.0823 13.3184 22.25 14.7728 22.25 16.5C22.25 18.5711 20.5711 20.25 18.5 20.25C16.674 20.25 15.1528 18.9449 14.8184 17.2166L16.7821 16.8352C16.9384 17.6413 17.6481 18.25 18.5 18.25C19.4665 18.25 20.25 17.4665 20.25 16.5C20.25 15.5335 19.4665 14.75 18.5 14.75C18.214 14.75 17.944 14.8186 17.7056 14.9403L16.3992 13.3932L19.3484 10H15V8H22ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4Z"},child:[]}]})(t)}function s_(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 20H11V13H4V20H2V4H4V11H11V4H13V20ZM22 8V16H23.5V18H22V20H20V18H14.5V16.66L19.5 8H22ZM20 11.133L17.19 16H20V11.133Z"},child:[]}]})(t)}function a_(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M22 8V10H17.6769L17.2126 12.6358C17.5435 12.5472 17.8912 12.5 18.25 12.5C20.4591 12.5 22.25 14.2909 22.25 16.5C22.25 18.7091 20.4591 20.5 18.25 20.5C16.4233 20.5 14.8827 19.2756 14.4039 17.6027L16.3271 17.0519C16.5667 17.8881 17.3369 18.5 18.25 18.5C19.3546 18.5 20.25 17.6046 20.25 16.5C20.25 15.3954 19.3546 14.5 18.25 14.5C17.6194 14.5 17.057 14.7918 16.6904 15.2478L14.8803 14.3439L16 8H22ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4Z"},child:[]}]})(t)}function l_(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21.097 8L18.499 12.5C20.7091 12.5 22.5 14.2909 22.5 16.5C22.5 18.7091 20.7091 20.5 18.5 20.5C16.2909 20.5 14.5 18.7091 14.5 16.5C14.5 15.7636 14.699 15.0737 15.0461 14.4811L18.788 8H21.097ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4ZM18.5 14.5C17.3954 14.5 16.5 15.3954 16.5 16.5C16.5 17.6046 17.3954 18.5 18.5 18.5C19.6046 18.5 20.5 17.6046 20.5 16.5C20.5 15.3954 19.6046 14.5 18.5 14.5Z"},child:[]}]})(t)}function ZX(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H21V21H3V19ZM11 14H21V16H11V14ZM11 9H21V11H11V9ZM3 12.5L7 9V16L3 12.5Z"},child:[]}]})(t)}function JX(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H21V21H3V19ZM11 14H21V16H11V14ZM11 9H21V11H11V9ZM7 12.5L3 16V9L7 12.5Z"},child:[]}]})(t)}function qx(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 5H11V19H8V21H16V19H13V5H16V3H8V5ZM2 7C1.44772 7 1 7.44772 1 8V16C1 16.5523 1.44772 17 2 17H8V15H3V9H8V7H2ZM16 9H21V15H16V17H22C22.5523 17 23 16.5523 23 16V8C23 7.44772 22.5523 7 22 7H16V9Z"},child:[]}]})(t)}function eZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M15 20H7V18H9.92661L12.0425 6H9V4H17V6H14.0734L11.9575 18H15V20Z"},child:[]}]})(t)}function tZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 17H22V19H19V22H17V17ZM7 7H2V5H5V2H7V7ZM18.364 15.5355L16.9497 14.1213L18.364 12.7071C20.3166 10.7545 20.3166 7.58866 18.364 5.63604C16.4113 3.68342 13.2455 3.68342 11.2929 5.63604L9.87868 7.05025L8.46447 5.63604L9.87868 4.22183C12.6123 1.48816 17.0445 1.48816 19.7782 4.22183C22.5118 6.9555 22.5118 11.3877 19.7782 14.1213L18.364 15.5355ZM15.5355 18.364L14.1213 19.7782C11.3877 22.5118 6.9555 22.5118 4.22183 19.7782C1.48816 17.0445 1.48816 12.6123 4.22183 9.87868L5.63604 8.46447L7.05025 9.87868L5.63604 11.2929C3.68342 13.2455 3.68342 16.4113 5.63604 18.364C7.58866 20.3166 10.7545 20.3166 12.7071 18.364L14.1213 16.9497L15.5355 18.364ZM14.8284 7.75736L16.2426 9.17157L9.17157 16.2426L7.75736 14.8284L14.8284 7.75736Z"},child:[]}]})(t)}function c_(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M18.3638 15.5355L16.9496 14.1213L18.3638 12.7071C20.3164 10.7545 20.3164 7.58866 18.3638 5.63604C16.4112 3.68341 13.2453 3.68341 11.2927 5.63604L9.87849 7.05025L8.46428 5.63604L9.87849 4.22182C12.6122 1.48815 17.0443 1.48815 19.778 4.22182C22.5117 6.95549 22.5117 11.3876 19.778 14.1213L18.3638 15.5355ZM15.5353 18.364L14.1211 19.7782C11.3875 22.5118 6.95531 22.5118 4.22164 19.7782C1.48797 17.0445 1.48797 12.6123 4.22164 9.87868L5.63585 8.46446L7.05007 9.87868L5.63585 11.2929C3.68323 13.2455 3.68323 16.4113 5.63585 18.364C7.58847 20.3166 10.7543 20.3166 12.7069 18.364L14.1211 16.9497L15.5353 18.364ZM14.8282 7.75736L16.2425 9.17157L9.17139 16.2426L7.75717 14.8284L14.8282 7.75736Z"},child:[]}]})(t)}function u_(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8.00008 6V9H5.00008V6H8.00008ZM3.00008 4V11H10.0001V4H3.00008ZM13.0001 4H21.0001V6H13.0001V4ZM13.0001 11H21.0001V13H13.0001V11ZM13.0001 18H21.0001V20H13.0001V18ZM10.7072 16.2071L9.29297 14.7929L6.00008 18.0858L4.20718 16.2929L2.79297 17.7071L6.00008 20.9142L10.7072 16.2071Z"},child:[]}]})(t)}function d_(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 4H21V6H8V4ZM5 3V6H6V7H3V6H4V4H3V3H5ZM3 14V11.5H5V11H3V10H6V12.5H4V13H6V14H3ZM5 19.5H3V18.5H5V18H3V17H6V21H3V20H5V19.5ZM8 11H21V13H8V11ZM8 18H21V20H8V18Z"},child:[]}]})(t)}function f_(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 4H21V6H8V4ZM4.5 6.5C3.67157 6.5 3 5.82843 3 5C3 4.17157 3.67157 3.5 4.5 3.5C5.32843 3.5 6 4.17157 6 5C6 5.82843 5.32843 6.5 4.5 6.5ZM4.5 13.5C3.67157 13.5 3 12.8284 3 12C3 11.1716 3.67157 10.5 4.5 10.5C5.32843 10.5 6 11.1716 6 12C6 12.8284 5.32843 13.5 4.5 13.5ZM4.5 20.4C3.67157 20.4 3 19.7284 3 18.9C3 18.0716 3.67157 17.4 4.5 17.4C5.32843 17.4 6 18.0716 6 18.9C6 19.7284 5.32843 20.4 4.5 20.4ZM8 11H21V13H8V11ZM8 18H21V20H8V18Z"},child:[]}]})(t)}function nZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M20 3C20.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 3H20ZM11 5H5V10.999H7V9L10 12L7 15V13H5V19H11V17H13V19H19V13H17V15L14 12L17 9V10.999H19V5H13V7H11V5ZM13 13V15H11V13H13ZM13 9V11H11V9H13Z"},child:[]}]})(t)}function rZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21 20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20C20.5523 3 21 3.44772 21 4V20ZM19 11V5H13.001V7H15L12 10L9 7H11V5H5V11H7V13H5V19H11V17H9L12 14L15 17H13.001V19H19V13H17V11H19ZM11 13H9V11H11V13ZM15 13H13V11H15V13Z"},child:[]}]})(t)}function h_(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21 4H3V6H21V4ZM21 11H8V13H21V11ZM21 18H8V20H21V18ZM5 11H3V20H5V11Z"},child:[]}]})(t)}function oZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17.1538 14C17.3846 14.5161 17.5 15.0893 17.5 15.7196C17.5 17.0625 16.9762 18.1116 15.9286 18.867C14.8809 19.6223 13.4335 20 11.5862 20C9.94674 20 8.32335 19.6185 6.71592 18.8555V16.6009C8.23538 17.4783 9.7908 17.917 11.3822 17.917C13.9333 17.917 15.2128 17.1846 15.2208 15.7196C15.2208 15.0939 15.0049 14.5598 14.5731 14.1173C14.5339 14.0772 14.4939 14.0381 14.4531 14H3V12H21V14H17.1538ZM13.076 11H7.62908C7.4566 10.8433 7.29616 10.6692 7.14776 10.4778C6.71592 9.92084 6.5 9.24559 6.5 8.45207C6.5 7.21602 6.96583 6.165 7.89749 5.299C8.82916 4.43299 10.2706 4 12.2219 4C13.6934 4 15.1009 4.32808 16.4444 4.98426V7.13591C15.2448 6.44921 13.9293 6.10587 12.4978 6.10587C10.0187 6.10587 8.77917 6.88793 8.77917 8.45207C8.77917 8.87172 8.99709 9.23796 9.43293 9.55079C9.86878 9.86362 10.4066 10.1135 11.0463 10.3004C11.6665 10.4816 12.3431 10.7148 13.076 11H13.076Z"},child:[]}]})(t)}function iZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 10V14H19V10H13ZM11 10H5V14H11V10ZM13 19H19V16H13V19ZM11 19V16H5V19H11ZM13 5V8H19V5H13ZM11 5H5V8H11V5ZM4 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 3Z"},child:[]}]})(t)}function X0(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 6V21H11V6H5V4H19V6H13Z"},child:[]}]})(t)}function sZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 3V12C8 14.2091 9.79086 16 12 16C14.2091 16 16 14.2091 16 12V3H18V12C18 15.3137 15.3137 18 12 18C8.68629 18 6 15.3137 6 12V3H8ZM4 20H20V22H4V20Z"},child:[]}]})(t)}function aZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{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"},child:[]}]})(t)}function lZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{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"},child:[]}]})(t)}function cZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21 15V18H24V20H21V23H19V20H16V18H19V15H21ZM21.0082 3C21.556 3 22 3.44495 22 3.9934L22.0007 13.3417C21.3749 13.1204 20.7015 13 20 13V5H4L4.001 19L13.2929 9.70715C13.6528 9.34604 14.22 9.31823 14.6123 9.62322L14.7065 9.70772L18.2521 13.2586C15.791 14.0069 14 16.2943 14 19C14 19.7015 14.1204 20.3749 14.3417 21.0007L2.9918 21C2.44405 21 2 20.5551 2 20.0066V3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082ZM8 7C9.10457 7 10 7.89543 10 9C10 10.1046 9.10457 11 8 11C6.89543 11 6 10.1046 6 9C6 7.89543 6.89543 7 8 7Z"},child:[]}]})(t)}function uZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M20 3C20.5523 3 21 3.44772 21 4V5.757L19 7.757V5H5V13.1L9 9.1005L13.328 13.429L12.0012 14.7562L11.995 18.995L16.2414 19.0012L17.571 17.671L18.8995 19H19V16.242L21 14.242V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20ZM21.7782 7.80761L23.1924 9.22183L15.4142 17L13.9979 16.9979L14 15.5858L21.7782 7.80761ZM15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7Z"},child:[]}]})(t)}function p_(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M22 18V20H2V18H22ZM2 3.5L10 8.5L2 13.5V3.5ZM22 11V13H12V11H22ZM22 4V6H12V4H22Z"},child:[]}]})(t)}function dZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{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"},child:[]}]})(t)}function fZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M11 11V5H13V11H19V13H13V19H11V13H5V11H11Z"},child:[]}]})(t)}function hZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z"},child:[]}]})(t)}function pZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 6H22V8H20V21C20 21.5523 19.5523 22 19 22H5C4.44772 22 4 21.5523 4 21V8H2V6H7V3C7 2.44772 7.44772 2 8 2H16C16.5523 2 17 2.44772 17 3V6ZM18 8H6V20H18V8ZM9 4V6H15V4H9Z"},child:[]}]})(t)}function mZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 6H22V8H20V21C20 21.5523 19.5523 22 19 22H5C4.44772 22 4 21.5523 4 21V8H2V6H7V3C7 2.44772 7.44772 2 8 2H16C16.5523 2 17 2.44772 17 3V6ZM9 11V17H11V11H9ZM13 11V17H15V11H13ZM9 4V6H15V4H9Z"},child:[]}]})(t)}function gZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M4 19H20V12H22V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V12H4V19ZM14 9H19L12 16L5 9H10V3H14V9Z"},child:[]}]})(t)}function bZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M10 6V8H5V19H16V14H18V20C18 20.5523 17.5523 21 17 21H4C3.44772 21 3 20.5523 3 20V7C3 6.44772 3.44772 6 4 6H10ZM21 3V12L17.206 8.207L11.2071 14.2071L9.79289 12.7929L15.792 6.793L12 3H21Z"},child:[]}]})(t)}function yZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5 10C3.9 10 3 10.9 3 12C3 13.1 3.9 14 5 14C6.1 14 7 13.1 7 12C7 10.9 6.1 10 5 10ZM19 10C17.9 10 17 10.9 17 12C17 13.1 17.9 14 19 14C20.1 14 21 13.1 21 12C21 10.9 20.1 10 19 10ZM12 10C10.9 10 10 10.9 10 12C10 13.1 10.9 14 12 14C13.1 14 14 13.1 14 12C14 10.9 13.1 10 12 10Z"},child:[]}]})(t)}function EZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5 11V13H19V11H5Z"},child:[]}]})(t)}function xZ(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM8 13C8 15.2091 9.79086 17 12 17C14.2091 17 16 15.2091 16 13H8ZM8 11C8.82843 11 9.5 10.3284 9.5 9.5C9.5 8.67157 8.82843 8 8 8C7.17157 8 6.5 8.67157 6.5 9.5C6.5 10.3284 7.17157 11 8 11ZM16 11C16.8284 11 17.5 10.3284 17.5 9.5C17.5 8.67157 16.8284 8 16 8C15.1716 8 14.5 8.67157 14.5 9.5C14.5 10.3284 15.1716 11 16 11Z"},child:[]}]})(t)}function Wx(t){return he({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM8 13H16C16 15.2091 14.2091 17 12 17C9.79086 17 8 15.2091 8 13ZM8 11C7.17157 11 6.5 10.3284 6.5 9.5C6.5 8.67157 7.17157 8 8 8C8.82843 8 9.5 8.67157 9.5 9.5C9.5 10.3284 8.82843 11 8 11ZM16 11C15.1716 11 14.5 10.3284 14.5 9.5C14.5 8.67157 15.1716 8 16 8C16.8284 8 17.5 8.67157 17.5 9.5C17.5 10.3284 16.8284 11 16 11Z"},child:[]}]})(t)}const CZ={bold:QX,italic:eZ,underline:sZ,strike:oZ,code:zX};function kZ(t,e){return t in e.schema.styleSchema&&e.schema.styleSchema[t].type===t&&e.schema.styleSchema[t].propSchema==="boolean"}const Ic=t=>{const e=ve(),n=fe(),r=ge(),o=Ot({editor:r,selector:({editor:a})=>{var l;if(!(!a.isEditable||!kZ(t.basicTextStyle,a)||!(((l=a.getSelection())==null?void 0:l.blocks)||[a.getTextCursorPosition().block]).find(c=>c.content!==void 0)))return t.basicTextStyle in a.getActiveStyles()?{active:!0}:{active:!1}}}),i=C.useCallback(a=>{r.focus(),r.toggleStyles({[a]:!0})},[r,t]);if(o===void 0)return null;const s=CZ[t.basicTextStyle];return y.jsx(n.FormattingToolbar.Button,{className:"bn-button","data-test":t.basicTextStyle,onClick:()=>i(t.basicTextStyle),isSelected:o.active,label:e.formatting_toolbar[t.basicTextStyle].tooltip,mainTooltip:e.formatting_toolbar[t.basicTextStyle].tooltip,secondaryTooltip:Mn(e.formatting_toolbar[t.basicTextStyle].secondary_tooltip,e.generic.ctrl_shortcut),icon:y.jsx(s,{})})},Pm=t=>{const e=t.textColor||"default",n=t.backgroundColor||"default",r=t.size||16,o=C.useMemo(()=>({pointerEvents:"none",fontSize:(r*.75).toString()+"px",height:r.toString()+"px",lineHeight:r.toString()+"px",textAlign:"center",width:r.toString()+"px"}),[r]);return y.jsx("div",{className:"bn-color-icon","data-background-color":n,"data-text-color":e,style:o,children:"A"})},Gx=["default","gray","brown","red","orange","yellow","green","blue","purple","pink"],Ef=t=>{const e=fe(),n=ve();return y.jsxs(y.Fragment,{children:[y.jsx(()=>t.text?y.jsxs(y.Fragment,{children:[y.jsx(e.Generic.Menu.Label,{children:n.color_picker.text_title}),Gx.map(r=>y.jsx(e.Generic.Menu.Item,{onClick:()=>{t.onClick&&t.onClick(),t.text.setColor(r)},"data-test":"text-color-"+r,icon:y.jsx(Pm,{textColor:r,size:t.iconSize}),checked:t.text.color===r,children:n.color_picker.colors[r]},"text-color-"+r))]}):null,{}),y.jsx(()=>t.background?y.jsxs(y.Fragment,{children:[y.jsx(e.Generic.Menu.Label,{children:n.color_picker.background_title}),Gx.map(r=>y.jsx(e.Generic.Menu.Item,{onClick:()=>{t.onClick&&t.onClick(),t.background.setColor(r)},"data-test":"background-color-"+r,icon:y.jsx(Pm,{backgroundColor:r,size:t.iconSize}),checked:t.background.color===r,children:n.color_picker.colors[r]},"background-color-"+r))]}):null,{})]})};function Mc(t,e){return`${t}Color`in e.schema.styleSchema&&e.schema.styleSchema[`${t}Color`].type===`${t}Color`&&e.schema.styleSchema[`${t}Color`].propSchema==="string"}const TZ=()=>{const t=fe(),e=ve(),n=ge(),r=Mc("text",n),o=Mc("background",n),i=Ot({editor:n,selector:({editor:l})=>{var c;if(!l.isEditable||!(((c=l.getSelection())==null?void 0:c.blocks)||[l.getTextCursorPosition().block]).find(f=>f.content!==void 0))return;const u=Mc("text",l),d=Mc("background",l);if(!(!u&&!d))return{textColor:u?l.getActiveStyles().textColor||"default":void 0,backgroundColor:d?l.getActiveStyles().backgroundColor||"default":void 0}}}),s=C.useCallback(l=>{if(!r)throw Error("Tried to set text color, but style does not exist in editor schema.");l==="default"?n.removeStyles({textColor:l}):n.addStyles({textColor:l}),setTimeout(()=>{n.focus()})},[n,r]),a=C.useCallback(l=>{if(!o)throw Error("Tried to set background color, but style does not exist in editor schema.");l==="default"?n.removeStyles({backgroundColor:l}):n.addStyles({backgroundColor:l}),setTimeout(()=>{n.focus()})},[o,n]);return i===void 0?null:y.jsxs(t.Generic.Menu.Root,{children:[y.jsx(t.Generic.Menu.Trigger,{children:y.jsx(t.FormattingToolbar.Button,{className:"bn-button","data-test":"colors",label:e.formatting_toolbar.colors.tooltip,mainTooltip:e.formatting_toolbar.colors.tooltip,icon:y.jsx(Pm,{textColor:i.textColor,backgroundColor:i.backgroundColor,size:20})})}),y.jsx(t.Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-color-picker-dropdown",children:y.jsx(Ef,{text:i.textColor?{color:i.textColor,setColor:s}:void 0,background:i.backgroundColor?{color:i.backgroundColor,setColor:a}:void 0})})]})},Yx=t=>{for(const e of nA)if(t.startsWith(e))return t;return`${rA}://${t}`},m_=t=>{const e=fe(),n=ve(),{editLink:r}=Re(Gl),{url:o,text:i,showTextField:s}=t,[a,l]=C.useState(o),[c,u]=C.useState(i);C.useEffect(()=>{l(o),u(i)},[i,o]);const d=C.useCallback(g=>{var b,E;g.key==="Enter"&&(g.preventDefault(),r(Yx(a),c,t.range.from),(b=t.setToolbarOpen)==null||b.call(t,!1),(E=t.setToolbarFrozen)==null||E.call(t,!1))},[r,a,c,t]),f=C.useCallback(g=>l(g.currentTarget.value),[]),h=C.useCallback(g=>u(g.currentTarget.value),[]),p=C.useCallback(()=>{var g,b;r(Yx(a),c,t.range.from),(g=t.setToolbarOpen)==null||g.call(t,!1),(b=t.setToolbarFrozen)==null||b.call(t,!1)},[r,a,c,t]);return y.jsxs(e.Generic.Form.Root,{children:[y.jsx(e.Generic.Form.TextInput,{className:"bn-text-input",name:"url",icon:y.jsx(c_,{}),autoFocus:!0,placeholder:n.link_toolbar.form.url_placeholder,value:a,onKeyDown:d,onChange:f,onSubmit:p}),s!==!1&&y.jsx(e.Generic.Form.TextInput,{className:"bn-text-input",name:"title",icon:y.jsx(X0,{}),placeholder:n.link_toolbar.form.title_placeholder,value:c,onKeyDown:d,onChange:h,onSubmit:p})]})};function wZ(t){return"link"in t.schema.inlineContentSchema&&t.schema.inlineContentSchema.link==="link"}const SZ=()=>{const t=ge(),e=fe(),n=ve(),r=Re(Qo),{showSelection:o}=Re(ml),[i,s]=C.useState(!1);C.useEffect(()=>{o(i)},[i,o]);const a=Ot({editor:t,selector:({editor:l})=>{var c;if(!(!l.isEditable||!wZ(l)||Jp(l.prosemirrorState.selection)||!(((c=l.getSelection())==null?void 0:c.blocks)||[l.getTextCursorPosition().block]).find(u=>u.content!==void 0)))return{url:l.getSelectedLinkUrl(),text:l.getSelectedText(),range:{from:l.prosemirrorState.selection.from,to:l.prosemirrorState.selection.to}}}});return C.useEffect(()=>{const l=c=>{(c.ctrlKey||c.metaKey)&&c.key==="k"&&(s(!0),c.preventDefault())};return t.prosemirrorView.dom.addEventListener("keydown",l),()=>{t.prosemirrorView.dom.removeEventListener("keydown",l)}},[t.prosemirrorView,t.headless]),a===void 0?null:y.jsxs(e.Generic.Popover.Root,{open:i,children:[y.jsx(e.Generic.Popover.Trigger,{children:y.jsx(e.FormattingToolbar.Button,{className:"bn-button","data-test":"createLink",label:n.formatting_toolbar.link.tooltip,mainTooltip:n.formatting_toolbar.link.tooltip,secondaryTooltip:Mn(n.formatting_toolbar.link.secondary_tooltip,n.generic.ctrl_shortcut),icon:y.jsx(c_,{}),onClick:()=>s(!0)})}),y.jsx(e.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:y.jsx(m_,{url:a.url||"",text:a.text,range:a.range,showTextField:!1,setToolbarOpen:l=>r.store.setState(l)})})]})},vZ=()=>{const t=ve(),e=fe(),n=ge(),r=Ot({editor:n,selector:({editor:l})=>{var c;if(!l.isEditable)return;const u=((c=l.getSelection())==null?void 0:c.blocks)||[l.getTextCursorPosition().block];if(u.length!==1)return;const d=u[0];if(kn(d,l,d.type,{url:"string",caption:"string"}))return d}}),[o,i]=C.useState();C.useEffect(()=>{r!==void 0&&i(r.props.caption)},[r]);const s=C.useCallback(l=>i(l.currentTarget.value),[]),a=C.useCallback(l=>{r!==void 0&&st(n,r.type,{caption:"string"})&&l.key==="Enter"&&(l.preventDefault(),n.updateBlock(r.id,{props:{caption:o}}))},[r,o,n]);return r===void 0?null:y.jsxs(e.Generic.Popover.Root,{children:[y.jsx(e.Generic.Popover.Trigger,{children:y.jsx(e.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.file_caption.tooltip,mainTooltip:t.formatting_toolbar.file_caption.tooltip,icon:y.jsx(qx,{})})}),y.jsx(e.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:y.jsx(e.Generic.Form.Root,{children:y.jsx(e.Generic.Form.TextInput,{name:"file-caption",icon:y.jsx(qx,{}),value:o||"",autoFocus:!0,placeholder:t.formatting_toolbar.file_caption.input_placeholder,onKeyDown:a,onChange:s})})})]})},AZ=()=>{const t=ve(),e=fe(),n=ge(),r=Ot({editor:n,selector:({editor:i})=>{var s;if(!i.isEditable)return;const a=((s=i.getSelection())==null?void 0:s.blocks)||[i.getTextCursorPosition().block];if(a.length!==1)return;const l=a[0];if(kn(l,i,l.type,{url:"string"}))return l}}),o=C.useCallback(()=>{r!==void 0&&(n.focus(),n.removeBlocks([r.id]))},[r,n]);return r===void 0?null:y.jsx(e.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.file_delete.tooltip[r.type]||t.formatting_toolbar.file_delete.tooltip.file,mainTooltip:t.formatting_toolbar.file_delete.tooltip[r.type]||t.formatting_toolbar.file_delete.tooltip.file,icon:y.jsx(pZ,{}),onClick:o})},_Z=()=>{const t=ve(),e=fe(),n=ge(),r=Ot({editor:n,selector:({editor:l})=>{var c;if(!l.isEditable)return;const u=((c=l.getSelection())==null?void 0:c.blocks)||[l.getTextCursorPosition().block];if(u.length!==1)return;const d=u[0];if(kn(d,l,d.type,{url:"string",name:"string"}))return d}}),[o,i]=C.useState();C.useEffect(()=>{r!==void 0&&i(r.props.name)},[r]);const s=C.useCallback(l=>i(l.currentTarget.value),[]),a=C.useCallback(l=>{r!==void 0&&st(n,r.type,{name:"string"})&&l.key==="Enter"&&(l.preventDefault(),n.updateBlock(r.id,{props:{name:o}}))},[r,o,n]);return r===void 0?null:y.jsxs(e.Generic.Popover.Root,{children:[y.jsx(e.Generic.Popover.Trigger,{children:y.jsx(e.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.file_rename.tooltip[r.type]||t.formatting_toolbar.file_rename.tooltip.file,mainTooltip:t.formatting_toolbar.file_rename.tooltip[r.type]||t.formatting_toolbar.file_rename.tooltip.file,icon:y.jsx(zx,{})})}),y.jsx(e.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:y.jsx(e.Generic.Form.Root,{children:y.jsx(e.Generic.Form.TextInput,{name:"file-name",icon:y.jsx(zx,{}),value:o||"",autoFocus:!0,placeholder:t.formatting_toolbar.file_rename.input_placeholder[r.type]||t.formatting_toolbar.file_rename.input_placeholder.file,onKeyDown:a,onChange:s})})})]})},NZ=()=>{const t=ve(),e=fe(),n=ge(),r=Ot({editor:n,selector:({editor:o})=>{var i;if(!o.isEditable)return;const s=((i=o.getSelection())==null?void 0:i.blocks)||[o.getTextCursorPosition().block];if(s.length!==1)return;const a=s[0];if(kn(a,o,a.type,{url:"string"}))return a}});return r===void 0?null:y.jsxs(e.Generic.Popover.Root,{position:"bottom",children:[y.jsx(e.Generic.Popover.Trigger,{children:y.jsx(e.FormattingToolbar.Button,{className:"bn-button",mainTooltip:t.formatting_toolbar.file_replace.tooltip[r.type]||t.formatting_toolbar.file_replace.tooltip.file,label:t.formatting_toolbar.file_replace.tooltip[r.type]||t.formatting_toolbar.file_replace.tooltip.file,icon:y.jsx(uZ,{})})}),y.jsx(e.Generic.Popover.Content,{className:"bn-popover-content bn-panel-popover",variant:"panel-popover",children:y.jsx(e_,{blockId:r.id})})]})},IZ=()=>{const t=ve(),e=fe(),n=ge(),r=Ot({editor:n,selector:({editor:i})=>{var s;if(!(!i.isEditable||!(((s=i.getSelection())==null?void 0:s.blocks)||[i.getTextCursorPosition().block]).find(a=>a.content!==void 0)))return{canNestBlock:i.canNestBlock()}}}),o=C.useCallback(()=>{r!==void 0&&r.canNestBlock&&(n.focus(),n.nestBlock())},[n,r]);return r===void 0?null:y.jsx(e.FormattingToolbar.Button,{className:"bn-button","data-test":"nestBlock",onClick:o,isDisabled:!r.canNestBlock,label:t.formatting_toolbar.nest.tooltip,mainTooltip:t.formatting_toolbar.nest.tooltip,secondaryTooltip:Mn(t.formatting_toolbar.nest.secondary_tooltip,t.generic.ctrl_shortcut),icon:y.jsx(JX,{})})},MZ=()=>{const t=ve(),e=fe(),n=ge(),r=Ot({editor:n,selector:({editor:i})=>{var s;if(!(!i.isEditable||!(((s=i.getSelection())==null?void 0:s.blocks)||[i.getTextCursorPosition().block]).find(a=>a.content!==void 0)))return{canUnnestBlock:i.canUnnestBlock()}}}),o=C.useCallback(()=>{r!==void 0&&r.canUnnestBlock&&(n.focus(),n.unnestBlock())},[n,r]);return r===void 0?null:y.jsx(e.FormattingToolbar.Button,{className:"bn-button","data-test":"unnestBlock",onClick:o,isDisabled:!r.canUnnestBlock,label:t.formatting_toolbar.unnest.tooltip,mainTooltip:t.formatting_toolbar.unnest.tooltip,secondaryTooltip:Mn(t.formatting_toolbar.unnest.secondary_tooltip,t.generic.ctrl_shortcut),icon:y.jsx(ZX,{})})},OZ=t=>[{name:t.slash_menu.paragraph.title,type:"paragraph",icon:X0},{name:t.slash_menu.heading.title,type:"heading",props:{level:1,isToggleable:!1},icon:bd},{name:t.slash_menu.heading_2.title,type:"heading",props:{level:2,isToggleable:!1},icon:yd},{name:t.slash_menu.heading_3.title,type:"heading",props:{level:3,isToggleable:!1},icon:Ed},{name:t.slash_menu.heading_4.title,type:"heading",props:{level:4,isToggleable:!1},icon:s_},{name:t.slash_menu.heading_5.title,type:"heading",props:{level:5,isToggleable:!1},icon:a_},{name:t.slash_menu.heading_6.title,type:"heading",props:{level:6,isToggleable:!1},icon:l_},{name:t.slash_menu.toggle_heading.title,type:"heading",props:{level:1,isToggleable:!0},icon:bd},{name:t.slash_menu.toggle_heading_2.title,type:"heading",props:{level:2,isToggleable:!0},icon:yd},{name:t.slash_menu.toggle_heading_3.title,type:"heading",props:{level:3,isToggleable:!0},icon:Ed},{name:t.slash_menu.quote.title,type:"quote",icon:h_},{name:t.slash_menu.toggle_list.title,type:"toggleListItem",icon:p_},{name:t.slash_menu.bullet_list.title,type:"bulletListItem",icon:f_},{name:t.slash_menu.numbered_list.title,type:"numberedListItem",icon:d_},{name:t.slash_menu.check_list.title,type:"checkListItem",icon:u_}],DZ=t=>{const e=fe(),n=ge(),r=Ot({editor:n,selector:({editor:a})=>{var l;return((l=a.getSelection())==null?void 0:l.blocks)||[a.getTextCursorPosition().block]}}),o=r[0],i=C.useMemo(()=>(t.items||OZ(n.dictionary)).filter(a=>st(n,a.type,Object.fromEntries(Object.entries(a.props||{}).map(([l,c])=>[l,typeof c])))),[n,t.items]),s=C.useMemo(()=>i.map(a=>{const l=a.icon,c=a.type===o.type,u=Object.entries(a.props||{}).filter(([d,f])=>f!==o.props[d]).length===0;return{text:a.name,icon:y.jsx(l,{size:16}),onClick:()=>{n.focus(),n.transact(()=>{for(const d of r)n.updateBlock(d,{type:a.type,props:a.props})})},isSelected:c&&u}}),[n,i,o.props,o.type,r]);return!C.useMemo(()=>s.find(a=>a.isSelected)!==void 0,[s])||!n.isEditable?null:y.jsx(e.FormattingToolbar.Select,{className:"bn-select",items:s})},LZ=()=>{const t=ve(),e=fe(),n=Re("comments"),{store:r}=Re(Qo),o=C.useCallback(()=>{n.startPendingComment(),r.setState(!1)},[n,r]);return y.jsx(e.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.comment.tooltip,mainTooltip:t.formatting_toolbar.comment.tooltip,icon:y.jsx(i_,{}),onClick:o})},RZ=()=>ge().getExtension("comments")?y.jsx(LZ,{}):null,PZ=()=>{const t=ve(),e=fe(),n=ge(),r=C.useCallback(()=>{n._tiptapEditor.chain().focus().addPendingComment().run()},[n]);return!n._tiptapEditor.commands.addPendingComment||!n.isEditable?null:y.jsx(e.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.comment.tooltip,mainTooltip:t.formatting_toolbar.comment.tooltip,icon:y.jsx(i_,{}),onClick:r})};function Bm(t,e){try{const n=new URL(t,e);if(n.protocol!=="javascript:")return n.href}catch{}return"#"}const BZ=()=>{const t=ve(),e=fe(),n=ge(),r=Ot({editor:n,selector:({editor:i})=>{var s;const a=((s=i.getSelection())==null?void 0:s.blocks)||[i.getTextCursorPosition().block];if(a.length!==1)return;const l=a[0];if(kn(l,i,l.type,{url:"string"}))return l}}),o=C.useCallback(()=>{r!==void 0&&(n.focus(),n.resolveFileUrl?n.resolveFileUrl(r.props.url).then(i=>window.open(Bm(i,window.location.href))):window.open(Bm(r.props.url,window.location.href)))},[r,n]);return r===void 0?null:y.jsx(e.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.file_download.tooltip[r.type]||t.formatting_toolbar.file_download.tooltip.file,mainTooltip:t.formatting_toolbar.file_download.tooltip[r.type]||t.formatting_toolbar.file_download.tooltip.file,icon:y.jsx(gZ,{}),onClick:o})},FZ=()=>{const t=ve(),e=fe(),n=ge(),r=Ot({editor:n,selector:({editor:i})=>{var s;if(!i.isEditable)return;const a=((s=i.getSelection())==null?void 0:s.blocks)||[i.getTextCursorPosition().block];if(a.length!==1)return;const l=a[0];if(kn(l,i,l.type,{url:"string",showPreview:"boolean"}))return l}}),o=C.useCallback(()=>{r!==void 0&&st(n,r.type,{showPreview:"boolean"})&&n.updateBlock(r.id,{props:{showPreview:!r.props.showPreview}})},[r,n]);return r===void 0?null:y.jsx(e.FormattingToolbar.Button,{className:"bn-button",label:"Toggle preview",mainTooltip:t.formatting_toolbar.file_preview_toggle.tooltip,icon:y.jsx(cZ,{}),isSelected:r.props.showPreview,onClick:o})},HZ=()=>{const t=ve(),e=fe(),n=ge(),r=Re(dt),o=Ot({editor:n,selector:({editor:s})=>{var a;if(!s.isEditable||!s.settings.tables.splitCells)return;const l=((a=s.getSelection())==null?void 0:a.blocks)||[s.getTextCursorPosition().block];if(l.length!==1)return;const c=l[0];if(c.type==="table")return{mergeDirection:r.getMergeDirection(c)}}}),i=C.useCallback(()=>{r?.mergeCells()},[r]);return o===void 0?null:y.jsx(e.FormattingToolbar.Button,{className:"bn-button",label:t.formatting_toolbar.table_cell_merge.tooltip,mainTooltip:t.formatting_toolbar.table_cell_merge.tooltip,icon:o.mergeDirection==="horizontal"?y.jsx(nZ,{}):y.jsx(rZ,{}),onClick:i})},UZ={left:YX,center:WX,right:KX,justify:GX},Xh=t=>{const e=fe(),n=ve(),r=ge(),o=Re(dt),i=Ot({editor:r,selector:({editor:l})=>{var c;if(!l.isEditable)return;const u=((c=l.getSelection())==null?void 0:c.blocks)||[l.getTextCursorPosition().block],d=u[0];if(kn(d,l,d.type,{textAlignment:He.textAlignment}))return{textAlignment:d.props.textAlignment,blocks:u};if(u.length===1&&kn(d,l,"table"))return o.getCellSelection()?{textAlignment:qo(d.content.rows[0].cells[0]).props.textAlignment,blocks:[d]}:void 0}}),s=C.useCallback(l=>{if(i!==void 0){r.focus();for(const c of i.blocks)if(kn(c,r,c.type,{textAlignment:He.textAlignment})&&st(r,c.type,{textAlignment:He.textAlignment}))r.updateBlock(c,{props:{textAlignment:l}});else if(c.type==="table"){const u=o.getCellSelection();if(!u)continue;const d=c.content.rows.map(f=>({...f,cells:f.cells.map(h=>qo(h))}));u.cells.forEach(({row:f,col:h})=>{d[f].cells[h].props.textAlignment=l}),r.updateBlock(c,{type:"table",content:{...c.content,type:"tableContent",rows:d}}),r.setTextCursorPosition(c)}}},[r,i,o]);if(i===void 0)return null;const a=UZ[t.textAlignment];return y.jsx(e.FormattingToolbar.Button,{className:"bn-button","data-test":`alignText${t.textAlignment.slice(0,1).toUpperCase()+t.textAlignment.slice(1)}`,onClick:()=>s(t.textAlignment),isSelected:i.textAlignment===t.textAlignment,label:n.formatting_toolbar[`align_${t.textAlignment}`].tooltip,mainTooltip:n.formatting_toolbar[`align_${t.textAlignment}`].tooltip,icon:y.jsx(a,{})})},Z0=t=>[y.jsx(DZ,{items:t},"blockTypeSelect"),y.jsx(HZ,{},"tableCellMergeButton"),y.jsx(vZ,{},"fileCaptionButton"),y.jsx(NZ,{},"replaceFileButton"),y.jsx(_Z,{},"fileRenameButton"),y.jsx(AZ,{},"fileDeleteButton"),y.jsx(BZ,{},"fileDownloadButton"),y.jsx(FZ,{},"filePreviewButton"),y.jsx(Ic,{basicTextStyle:"bold"},"boldStyleButton"),y.jsx(Ic,{basicTextStyle:"italic"},"italicStyleButton"),y.jsx(Ic,{basicTextStyle:"underline"},"underlineStyleButton"),y.jsx(Ic,{basicTextStyle:"strike"},"strikeStyleButton"),y.jsx(Xh,{textAlignment:"left"},"textAlignLeftButton"),y.jsx(Xh,{textAlignment:"center"},"textAlignCenterButton"),y.jsx(Xh,{textAlignment:"right"},"textAlignRightButton"),y.jsx(TZ,{},"colorStyleButton"),y.jsx(IZ,{},"nestBlockButton"),y.jsx(MZ,{},"unnestBlockButton"),y.jsx(SZ,{},"createLinkButton"),y.jsx(RZ,{},"addCommentButton"),y.jsx(PZ,{},"addTiptapCommentButton")],J0=t=>{const e=fe();return y.jsx(e.FormattingToolbar.Root,{className:"bn-toolbar bn-formatting-toolbar",children:t.children||Z0(t.blockTypeSelectItems)})},VZ=t=>{switch(t){case"left":return"top-start";case"center":return"top";case"right":return"top-end";default:return"top-start"}},e1=t=>{const e=ge(),n=Re(Qo,{editor:e}),r=et(Qo,{editor:e}),o=Ot({editor:e,selector:({editor:l})=>n.store.state?{from:l.prosemirrorState.selection.from,to:l.prosemirrorState.selection.to}:void 0}),i=Ot({editor:e,selector:({editor:l})=>{const c=l.getTextCursorPosition().block;return kn(c,l,c.type,{textAlignment:He.textAlignment})?VZ(c.props.textAlignment):"top-start"}}),s=C.useMemo(()=>({useFloatingOptions:{open:r,onOpenChange:(l,c,u)=>{n.store.setState(l),u==="escape-key"&&e.focus()},placement:i,middleware:[Dr(10),Al(),Hi()]},elementProps:{style:{zIndex:40}},...t.floatingUIOptions}),[r,i,t.floatingUIOptions,n.store,e]),a=t.formattingToolbar||J0;return y.jsx(Q0,{position:o,...s,children:r&&y.jsx(a,{})})},g_=t=>{const e=fe(),n=ve(),{deleteLink:r}=Re(Gl);return y.jsx(e.LinkToolbar.Button,{className:"bn-button",label:n.link_toolbar.delete.tooltip,mainTooltip:n.link_toolbar.delete.tooltip,isSelected:!1,onClick:()=>{var o;r(t.range.from),(o=t.setToolbarOpen)==null||o.call(t,!1)},icon:y.jsx(tZ,{})})},b_=t=>{const e=fe(),n=ve();return y.jsxs(e.Generic.Popover.Root,{onOpenChange:t.setToolbarFrozen,children:[y.jsx(e.Generic.Popover.Trigger,{children:y.jsx(e.LinkToolbar.Button,{className:"bn-button",mainTooltip:n.link_toolbar.edit.tooltip,isSelected:!1,children:n.link_toolbar.edit.text})}),y.jsx(e.Generic.Popover.Content,{className:"bn-popover-content bn-form-popover",variant:"form-popover",children:y.jsx(m_,{url:t.url,text:t.text,range:t.range,setToolbarOpen:t.setToolbarOpen,setToolbarFrozen:t.setToolbarFrozen})})]})},$Z=t=>{const e=fe(),n=ve();return y.jsx(e.LinkToolbar.Button,{className:"bn-button",mainTooltip:n.link_toolbar.open.tooltip,label:n.link_toolbar.open.tooltip,isSelected:!1,onClick:()=>{window.open(Bm(t.url,window.location.href),"_blank")},icon:y.jsx(bZ,{})})},y_=t=>{const e=fe();return y.jsx(e.LinkToolbar.Root,{className:"bn-toolbar bn-link-toolbar",children:t.children||y.jsxs(y.Fragment,{children:[y.jsx(b_,{url:t.url,text:t.text,range:t.range,setToolbarFrozen:t.setToolbarFrozen,setToolbarOpen:t.setToolbarOpen}),y.jsx($Z,{url:t.url}),y.jsx(g_,{range:t.range,setToolbarOpen:t.setToolbarOpen})]})})},E_=t=>{const e=ge(),[n,r]=C.useState(!1),[o,i]=C.useState(!1),s=Re(Gl),a=Ot({editor:e,selector:()=>{const p=s.getLinkAtSelection();if(p)return{url:p.mark.attrs.href,text:p.text,range:p.range,element:s.getLinkElementAtPos(p.range.from)}}});C.useEffect(()=>{o||(r(!!a),a&&c(void 0))},[o,a]);const[l,c]=C.useState(void 0);C.useEffect(()=>{const p=g=>{if(a||!(g.target instanceof HTMLElement))return;const b=s.getLinkAtElement(g.target);b&&c({url:b.mark.attrs.href,text:b.text,range:b.range,element:s.getLinkElementAtPos(b.range.from)})};return document.body.addEventListener("mouseover",p),()=>{document.body.removeEventListener("mouseover",p)}},[o,s,l?.url,a]);const u=a||l,d=C.useMemo(()=>({useFloatingOptions:{open:n,onOpenChange:(p,g,b)=>{o||a&&b==="hover"||(b==="escape-key"&&e.focus(),r(p))},placement:"top-start",middleware:[Dr(10),Hi()]},useHoverProps:{enabled:!a&&!!l,delay:{open:250,close:250},handleClose:mW()},elementProps:{style:{zIndex:50}},...t.floatingUIOptions}),[e,o,l,n,t.floatingUIOptions,a]),f=C.useMemo(()=>u!=null&&u.element?{element:u.element}:void 0,[u?.element]);if(!e.isEditable)return null;const h=t.linkToolbar||y_;return y.jsx(Or,{reference:f,...d,children:u&&y.jsx(h,{url:u.url,text:u.text,range:u.range,setToolbarFrozen:i,setToolbarOpen:r})})};function jZ(t){return he({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8Z"},child:[]},{tag:"path",attr:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8Z"},child:[]}]})(t)}const zZ=()=>{const t=fe(),e=ve(),n=ge(),r=Re(er),o=et(Er,{editor:n,selector:s=>s?.block}),i=C.useCallback(()=>{if(o===void 0)return;const s=o.content;if(s!==void 0&&Array.isArray(s)&&s.length===0)n.setTextCursorPosition(o),r.openSuggestionMenu("/");else{const a=n.insertBlocks([{type:"paragraph"}],o,"after")[0];n.setTextCursorPosition(a),r.openSuggestionMenu("/")}},[o,n,r]);return o===void 0?null:y.jsx(t.SideMenu.Button,{className:"bn-button",label:e.side_menu.add_block_label,icon:y.jsx(jZ,{size:24,onClick:i,"data-test":"dragHandleAdd"})})};function x_(t){return he({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"},child:[]}]})(t)}function qZ(t){return he({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 10 5 5 5-5z"},child:[]}]})(t)}const WZ=t=>{const e=fe(),n=ge(),r=et(Er,{editor:n,selector:o=>o?.block});return r===void 0||!kn(r,n,r.type,{textColor:"string"})&&!kn(r,n,r.type,{backgroundColor:"string"})?null:y.jsxs(e.Generic.Menu.Root,{position:"right",sub:!0,children:[y.jsx(e.Generic.Menu.Trigger,{sub:!0,children:y.jsx(e.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:t.children})}),y.jsx(e.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:y.jsx(Ef,{iconSize:18,text:kn(r,n,r.type,{textColor:"string"})&&st(n,r.type,{textColor:"string"})?{color:r.props.textColor,setColor:o=>n.updateBlock(r,{type:r.type,props:{textColor:o}})}:void 0,background:kn(r,n,r.type,{backgroundColor:"string"})&&st(n,r.type,{backgroundColor:"string"})?{color:r.props.backgroundColor,setColor:o=>n.updateBlock(r,{props:{backgroundColor:o}})}:void 0})})]})},GZ=t=>{const e=fe(),n=ge(),r=et(Er,{editor:n,selector:o=>o?.block});return r===void 0?null:y.jsx(e.Generic.Menu.Item,{className:"bn-menu-item",onClick:()=>n.removeBlocks([r]),children:t.children})},YZ=t=>{const e=fe(),n=ge(),r=et(Er,{editor:n,selector:i=>i?.block});if(r===void 0||r.type!=="table"||!n.settings.tables.headers)return null;const o=!!r.content.headerRows;return y.jsx(e.Generic.Menu.Item,{className:"bn-menu-item",checked:o,onClick:()=>{n.updateBlock(r,{content:{...r.content,headerRows:o?void 0:1}})},children:t.children})},KZ=t=>{const e=fe(),n=ge(),r=et(Er,{editor:n,selector:i=>i?.block});if(r===void 0||r.type!=="table"||!n.settings.tables.headers)return null;const o=!!r.content.headerCols;return y.jsx(e.Generic.Menu.Item,{className:"bn-menu-item",checked:o,onClick:()=>{n.updateBlock(r,{content:{...r.content,headerCols:o?void 0:1}})},children:t.children})},QZ=t=>{const e=fe(),n=ve();return y.jsx(e.Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-drag-handle-menu",children:t.children||y.jsxs(y.Fragment,{children:[y.jsx(GZ,{children:n.drag_handle.delete_menuitem}),y.jsx(WZ,{children:n.drag_handle.colors_menuitem}),y.jsx(YZ,{children:n.drag_handle.header_row_menuitem}),y.jsx(KZ,{children:n.drag_handle.header_column_menuitem})]})})},XZ=t=>{const e=fe(),n=ve(),r=Re(Er),o=et(Er,{selector:s=>s?.block});if(o===void 0)return null;const i=t.dragHandleMenu||QZ;return y.jsxs(e.Generic.Menu.Root,{onOpenChange:s=>{s?r.freezeMenu():r.unfreezeMenu()},position:"left",children:[y.jsx(e.Generic.Menu.Trigger,{children:y.jsx(e.SideMenu.Button,{label:n.side_menu.drag_handle_label,draggable:!0,onDragStart:s=>r.blockDragStart(s,o),onDragEnd:r.blockDragEnd,className:"bn-button",icon:y.jsx(x_,{size:24,"data-test":"dragHandle"})})}),y.jsx(i,{children:t.children})]})},ZZ=t=>{const e=fe(),n=ge(),r=et(Er,{editor:n,selector:i=>i?.block}),o=C.useMemo(()=>{var i;if(r===void 0)return{};const s={"data-block-type":r.type};return r.type==="heading"&&(s["data-level"]=r.props.level.toString()),(i=n.schema.blockSpecs[r.type].implementation.meta)!=null&&i.fileBlockAccept&&(r.props.url?s["data-url"]="true":s["data-url"]="false"),s},[r,n.schema.blockSpecs]);return y.jsx(e.SideMenu.Root,{className:"bn-side-menu",...o,children:t.children||y.jsxs(y.Fragment,{children:[y.jsx(zZ,{}),y.jsx(XZ,{})]})})},JZ=t=>{const e=et(Er,{selector:s=>s!==void 0?{show:s.show,block:s.block}:void 0}),{show:n,block:r}=e||{},o=C.useMemo(()=>({useFloatingOptions:{open:n,placement:"left-start"},useDismissProps:{enabled:!1},elementProps:{style:{zIndex:20}},...t.floatingUIOptions}),[t.floatingUIOptions,n]),i=t.sideMenu||ZZ;return y.jsx(t_,{blockId:n?r?.id:void 0,...o,children:r?.id&&y.jsx(i,{})})};async function eJ(t,e){return(await Uq(t,e)).map(({id:n,onItemClick:r})=>({id:n,onItemClick:r,icon:n}))}function tJ(t){const e=fe(),n=ve(),{items:r,loadingState:o,selectedIndex:i,onItemClick:s,columns:a}=t,l=o==="loading-initial"||o==="loading"?y.jsx(e.GridSuggestionMenu.Loader,{className:"bn-grid-suggestion-menu-loader",columns:a}):null,c=C.useMemo(()=>{const u=[];for(let d=0;d<r.length;d++){const f=r[d];u.push(y.jsx(e.GridSuggestionMenu.Item,{className:"bn-grid-suggestion-menu-item",item:f,id:`bn-grid-suggestion-menu-item-${d}`,isSelected:d===i,onClick:()=>s?.(f)},f.id))}return u},[e,r,s,i]);return y.jsxs(e.GridSuggestionMenu.Root,{id:"bn-grid-suggestion-menu",columns:a,className:"bn-grid-suggestion-menu",children:[l,c,c.length===0&&t.loadingState==="loaded"&&y.jsx(e.GridSuggestionMenu.EmptyItem,{className:"bn-grid-suggestion-menu-empty-item",columns:a,children:n.suggestion_menu.no_items_title})]})}function C_(t,e,n,r=3){const o=C.useRef(0);C.useEffect(()=>{e!==void 0&&(t.length>0?o.current=e.length:e.length-o.current>r&&n())},[n,r,t.length,e])}function k_(t,e){const[n,r]=C.useState([]),[o,i]=C.useState(!1),s=C.useRef(void 0),a=C.useRef(void 0);return C.useEffect(()=>{const l=t;s.current=t,i(!0),e(t).then(c=>{s.current===l&&(r(c),i(!1),a.current=l)})},[t,e]),{items:n||[],usedQuery:a.current,loadingState:a.current===void 0?"loading-initial":o?"loading":"loaded"}}function nJ(t,e,n,r,o){const[i,s]=C.useState(0),a=r!==void 0&&r>1;return C.useEffect(()=>{var l;const c=u=>(u.key==="ArrowLeft"&&(u.preventDefault(),n.length&&s((i-1+n.length)%n.length)),u.key==="ArrowRight"&&(u.preventDefault(),n.length&&s((i+1+n.length)%n.length)),u.key==="ArrowUp"?(u.preventDefault(),n.length&&s((i-r+n.length)%n.length),!0):u.key==="ArrowDown"?(u.preventDefault(),n.length&&s((i+r)%n.length),!0):u.key==="Enter"&&!u.isComposing?(u.stopPropagation(),u.preventDefault(),n.length&&o?.(n[i]),!0):!1);return(l=t.domElement)==null||l.addEventListener("keydown",c,!0),()=>{var u;(u=t.domElement)==null||u.removeEventListener("keydown",c,!0)}},[t.domElement,n,i,o,r,a]),C.useEffect(()=>{s(0)},[e]),{selectedIndex:n.length===0?void 0:i}}function rJ(t){const e=zr().setContentEditableProps,n=ge(),{getItems:r,gridSuggestionMenuComponent:o,query:i,clearQuery:s,closeMenu:a,onItemClick:l,columns:c}=t,u=C.useCallback(g=>{a(),s(),l?.(g)},[l,a,s]),{items:d,usedQuery:f,loadingState:h}=k_(i,r);C_(d,f,a);const{selectedIndex:p}=nJ(n,i,d,c,u);return C.useEffect(()=>(e(g=>({...g,"aria-expanded":!0,"aria-controls":"bn-suggestion-menu"})),()=>{e(g=>({...g,"aria-expanded":!1,"aria-controls":void 0}))}),[e]),C.useEffect(()=>(e(g=>({...g,"aria-activedescendant":p?"bn-suggestion-menu-item-"+p:void 0})),()=>{e(g=>({...g,"aria-activedescendant":void 0}))}),[e,p]),y.jsx(o,{items:d,onItemClick:u,loadingState:h,selectedIndex:p,columns:c})}function oJ(t){var e;const n=ge(),{triggerCharacter:r,gridSuggestionMenuComponent:o,columns:i,minQueryLength:s,onItemClick:a,getItems:l}=t,c=C.useMemo(()=>a||(b=>{b.onItemClick(n)}),[n,a]),u=C.useMemo(()=>l||(async b=>await eJ(n,b)),[n,l]),d=Re(er);C.useEffect(()=>{d.addTriggerCharacter(r)},[d,r]);const f=et(er),h=et(er,{selector:b=>b?.referencePos||new DOMRect}),p=C.useMemo(()=>{var b;return{element:((b=n.domElement)==null?void 0:b.firstChild)||void 0,getBoundingClientRect:()=>h}},[(e=n.domElement)==null?void 0:e.firstChild,h]),g=C.useMemo(()=>({useFloatingOptions:{open:f?.show&&f?.triggerCharacter===r,onOpenChange:b=>{b||d.closeMenu()},placement:"bottom-start",middleware:[Dr(10),Hi({mainAxis:!0,crossAxis:!1}),Al(),tu({apply({availableHeight:b,elements:E}){Object.assign(E.floating.style,{maxHeight:`${b-10}px`})}})]},elementProps:{onMouseDownCapture:b=>b.preventDefault(),style:{zIndex:70}},...t.floatingUIOptions}),[t.floatingUIOptions,f?.show,f?.triggerCharacter,d,r]);return!f||!f.ignoreQueryLength&&s&&(f.query.startsWith(" ")||f.query.length<s)?null:y.jsx(Or,{reference:p,...g,children:r&&y.jsx(rJ,{query:f.query,closeMenu:d.closeMenu,clearQuery:d.clearQuery,getItems:u,columns:i,gridSuggestionMenuComponent:o||tJ,onItemClick:c})})}function iJ(t){const e=fe(),n=ve(),{items:r,loadingState:o,selectedIndex:i,onItemClick:s}=t,a=o==="loading-initial"||o==="loading"?y.jsx(e.SuggestionMenu.Loader,{className:"bn-suggestion-menu-loader"}):null,l=C.useMemo(()=>{let c;const u=[];for(let d=0;d<r.length;d++){const f=r[d];f.group!==c&&(c=f.group,u.push(y.jsx(e.SuggestionMenu.Label,{className:"bn-suggestion-menu-label",children:c},c))),u.push(y.jsx(e.SuggestionMenu.Item,{className:ut("bn-suggestion-menu-item",f.size==="small"?"bn-suggestion-menu-item-small":""),item:f,id:`bn-suggestion-menu-item-${d}`,isSelected:d===i,onClick:()=>s?.(f)},f.title))}return u},[e,r,s,i]);return y.jsxs(e.SuggestionMenu.Root,{id:"bn-suggestion-menu",className:"bn-suggestion-menu",children:[l,l.length===0&&(t.loadingState==="loading"||t.loadingState==="loaded")&&y.jsx(e.SuggestionMenu.EmptyItem,{className:"bn-suggestion-menu-item",children:n.suggestion_menu.no_items_title}),a]})}function sJ(t,e){const[n,r]=C.useState(0);return{selectedIndex:n,setSelectedIndex:r,handler:o=>{if(o.key==="ArrowUp")return o.preventDefault(),t.length&&r((n-1+t.length)%t.length),!0;if(o.key==="ArrowDown")return o.preventDefault(),t.length&&r((n+1)%t.length),!0;const i=aJ(o)?o.nativeEvent.isComposing:o.isComposing;return o.key==="Enter"&&!i?(o.preventDefault(),o.stopPropagation(),t.length&&e?.(t[n]),!0):!1}}}function aJ(t){return t.nativeEvent!==void 0}function lJ(t,e,n,r,o){const{selectedIndex:i,setSelectedIndex:s,handler:a}=sJ(n,r);return C.useEffect(()=>{var l;return(l=t.domElement)==null||l.addEventListener("keydown",a,!0),()=>{var c;(c=t.domElement)==null||c.removeEventListener("keydown",a,!0)}},[t.domElement,n,i,r,o,a]),C.useEffect(()=>{s(0)},[e,s]),{selectedIndex:n.length===0?void 0:i}}function cJ(t){const e=zr().setContentEditableProps,n=ge(),{getItems:r,suggestionMenuComponent:o,query:i,clearQuery:s,closeMenu:a,onItemClick:l}=t,c=C.useCallback(p=>{a(),s(),l?.(p)},[l,a,s]),{items:u,usedQuery:d,loadingState:f}=k_(i,r);C_(u,d,a);const{selectedIndex:h}=lJ(n,i,u,c);return C.useEffect(()=>(e(p=>({...p,"aria-expanded":!0,"aria-controls":"bn-suggestion-menu"})),()=>{e(p=>({...p,"aria-expanded":!1,"aria-controls":void 0}))}),[e]),C.useEffect(()=>(e(p=>({...p,"aria-activedescendant":h?"bn-suggestion-menu-item-"+h:void 0})),()=>{e(p=>({...p,"aria-activedescendant":void 0}))}),[e,h]),y.jsx(o,{items:u,onItemClick:c,loadingState:f,selectedIndex:h})}const uJ={heading:bd,heading_2:yd,heading_3:Ed,heading_4:s_,heading_5:a_,heading_6:l_,toggle_heading:bd,toggle_heading_2:yd,toggle_heading_3:Ed,quote:h_,toggle_list:p_,numbered_list:d_,bullet_list:f_,check_list:u_,paragraph:X0,table:iZ,image:lZ,video:aZ,audio:dZ,file:qX,emoji:xZ,code_block:XX,divider:EZ};function T_(t){return BB(t).map(e=>{const n=uJ[e.key];return{...e,icon:y.jsx(n,{size:18})}})}function w_(t){var e;const n=ge(),{triggerCharacter:r,suggestionMenuComponent:o,minQueryLength:i,onItemClick:s,getItems:a}=t,l=C.useMemo(()=>s||(g=>{g.onItemClick(n)}),[n,s]),c=C.useMemo(()=>a||(async g=>FB(T_(n),g)),[n,a]),u=Re(er);C.useEffect(()=>{u.addTriggerCharacter(r)},[u,r]);const d=et(er),f=et(er,{selector:g=>g?.referencePos||new DOMRect}),h=C.useMemo(()=>{var g;return{element:((g=n.domElement)==null?void 0:g.firstChild)||void 0,getBoundingClientRect:()=>f}},[(e=n.domElement)==null?void 0:e.firstChild,f]),p=C.useMemo(()=>({useFloatingOptions:{open:d?.show&&d?.triggerCharacter===r,onOpenChange:g=>{g||u.closeMenu()},placement:"bottom-start",middleware:[Dr(10),Hi({mainAxis:!0,crossAxis:!1}),Al(),tu({apply({availableHeight:g,elements:b}){Object.assign(b.floating.style,{maxHeight:`${g-10}px`,minHeight:"300px"})}})]},elementProps:{onMouseDownCapture:g=>g.preventDefault(),style:{zIndex:80}},...t.floatingUIOptions}),[t.floatingUIOptions,d?.show,d?.triggerCharacter,u,r]);return!d||!d.ignoreQueryLength&&i&&(d.query.startsWith(" ")||d.query.length<i)?null:y.jsx(Or,{reference:h,...p,children:r&&y.jsx(cJ,{query:d.query,closeMenu:u.closeMenu,clearQuery:u.clearQuery,getItems:c,suggestionMenuComponent:o||iJ,onItemClick:l})})}const dJ=(t,e=.3)=>{const n=Math.floor(t)+e,r=Math.ceil(t)-e;return t>=n&&t<=r?Math.round(t):t<n?Math.floor(t):Math.ceil(t)},fJ=t=>{const e=fe(),n=ge(),r=Re(dt),o=et(dt,{selector:u=>u?.block}),i=C.useRef(!1),[s,a]=C.useState(),l=C.useCallback(u=>{r.freezeHandles(),t.hideOtherElements(!0),o&&(a({originalContent:o.content,originalCroppedContent:{rows:r.cropEmptyRowsOrColumns(o,t.orientation==="addOrRemoveColumns"?"columns":"rows")},startPos:t.orientation==="addOrRemoveColumns"?u.clientX:u.clientY}),i.current=!1,u.preventDefault())},[o,t,r]),c=C.useCallback(()=>{!o||i.current||n.updateBlock(o,{type:"table",content:{...o.content,rows:t.orientation==="addOrRemoveColumns"?r.addRowsOrColumns(o,"columns",1):r.addRowsOrColumns(o,"rows",1)}})},[o,n,t.orientation,r]);return C.useEffect(()=>{const u=d=>{var f,h;if(!o)return;if(!s)throw new Error("editingState is undefined");i.current=!0;const p=(t.orientation==="addOrRemoveColumns"?d.clientX:d.clientY)-s.startPos,g=t.orientation==="addOrRemoveColumns"?((f=s.originalCroppedContent.rows[0])==null?void 0:f.cells.length)??0:s.originalCroppedContent.rows.length,b=t.orientation==="addOrRemoveColumns"?((h=s.originalContent.rows[0])==null?void 0:h.cells.length)??0:s.originalContent.rows.length,E=t.orientation==="addOrRemoveColumns"?o.content.rows[0].cells.length:o.content.rows.length,x=b+dJ(p/(t.orientation==="addOrRemoveColumns"?a0:EB),.3);x>=g&&x>0&&x!==E&&(n.updateBlock(o,{type:"table",content:{...o.content,rows:t.orientation==="addOrRemoveColumns"?r.addRowsOrColumns({type:"table",content:s.originalCroppedContent},"columns",x-g):r.addRowsOrColumns({type:"table",content:s.originalCroppedContent},"rows",x-g)}}),o.content&&n.setTextCursorPosition(o))};return s&&window.addEventListener("mousemove",u),()=>{window.removeEventListener("mousemove",u)}},[o,s,n,t.orientation,r]),C.useEffect(()=>{const u=()=>{t.hideOtherElements(!1),r.unfreezeHandles(),a(void 0)};return s&&window.addEventListener("mouseup",u),()=>{window.removeEventListener("mouseup",u)}},[s,t,r]),n.isEditable?y.jsx(e.TableHandle.ExtendButton,{className:ut("bn-extend-button",t.orientation==="addOrRemoveColumns"?"bn-extend-button-add-remove-columns":"bn-extend-button-add-remove-rows",s!==null?"bn-extend-button-editing":""),onClick:c,onMouseDown:l,children:t.children||y.jsx(fZ,{size:18,"data-test":"extendButton"})}):null},Kx=t=>{const e=fe(),n=ve(),r=Re(dt),o=et(dt,{selector:i=>t.orientation==="column"?i?.colIndex:i?.rowIndex});return r===void 0||o===void 0?null:y.jsx(e.Generic.Menu.Item,{onClick:()=>{r.addRowOrColumn(o,t.orientation==="row"?{orientation:"row",side:t.side}:{orientation:"column",side:t.side})},children:n.table_handle[`add_${t.side}_menuitem`]})},hJ=t=>{const e=fe(),n=ve(),r=Re(dt),o=et(dt,{selector:i=>t.orientation==="column"?i?.colIndex:i?.rowIndex});return r===void 0||o===void 0?null:y.jsx(e.Generic.Menu.Item,{onClick:()=>r.removeRowOrColumn(o,t.orientation),children:t.orientation==="row"?n.table_handle.delete_row_menuitem:n.table_handle.delete_column_menuitem})},pJ=t=>{const e=fe(),n=ve(),r=ge(),o=Re(dt),{block:i,index:s}=et(dt,{selector:u=>({block:u?.block,index:t.orientation==="column"?u?.colIndex:u?.rowIndex})}),a=C.useMemo(()=>o===void 0||i===void 0||s===void 0?[]:t.orientation==="row"?o.getCellsAtRowHandle(i,s):o.getCellsAtColumnHandle(i,s),[i,s,t.orientation,o]),l=(u,d)=>{if(i===void 0)return;const f=i.content.rows.map(h=>({...h,cells:h.cells.map(p=>qo(p))}));a.forEach(({row:h,col:p})=>{d==="text"?f[h].cells[p].props.textColor=u:f[h].cells[p].props.backgroundColor=u}),r.updateBlock(i,{type:"table",content:{...i.content,rows:f}}),r.setTextCursorPosition(i)};if(!a||!a[0]||!o||r.settings.tables.cellTextColor===!1&&r.settings.tables.cellBackgroundColor===!1)return null;const c=qo(a[0].cell);return y.jsxs(e.Generic.Menu.Root,{position:"right",sub:!0,children:[y.jsx(e.Generic.Menu.Trigger,{sub:!0,children:y.jsx(e.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:t.children||n.drag_handle.colors_menuitem})}),y.jsx(e.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:y.jsx(Ef,{iconSize:18,text:r.settings.tables.cellTextColor?{color:a.every(({cell:u})=>Wo(u)&&u.props.textColor===c.props.textColor)?c.props.textColor:"default",setColor:u=>{l(u,"text")}}:void 0,background:r.settings.tables.cellBackgroundColor?{color:a.every(({cell:u})=>Wo(u)&&u.props.backgroundColor===c.props.backgroundColor)?c.props.backgroundColor:"default",setColor:u=>l(u,"background")}:void 0})})]})},mJ=t=>{const e=fe(),n=ve(),r=ge(),o=Re(dt),{block:i,index:s}=et(dt,{selector:l=>({block:l?.block,index:t.orientation==="column"?l?.colIndex:l?.rowIndex})});if(o===void 0||i===void 0||s!==0||t.orientation!=="row"||!r.settings.tables.headers)return null;const a=!!i.content.headerRows;return y.jsx(e.Generic.Menu.Item,{className:"bn-menu-item",checked:a,onClick:()=>{r.updateBlock(i,{...i,content:{...i.content,headerRows:a?void 0:1}})},children:n.drag_handle.header_row_menuitem})},gJ=t=>{const e=fe(),n=ve(),r=ge(),o=Re(dt),i=et(dt,{selector:l=>l?.block}),s=et(dt,{selector:l=>t.orientation==="column"?l?.colIndex:l?.rowIndex});if(!o||s!==0||!i||t.orientation!=="column"||!r.settings.tables.headers)return null;const a=!!i.content.headerCols;return y.jsx(e.Generic.Menu.Item,{className:"bn-menu-item",checked:a,onClick:()=>{r.updateBlock(i,{...i,content:{...i.content,headerCols:a?void 0:1}})},children:n.drag_handle.header_column_menuitem})},bJ=t=>{const e=fe();return y.jsx(e.Generic.Menu.Dropdown,{className:"bn-table-handle-menu",children:t.children||y.jsxs(y.Fragment,{children:[y.jsx(hJ,{orientation:t.orientation}),y.jsx(Kx,{orientation:t.orientation,side:t.orientation==="row"?"above":"left"}),y.jsx(Kx,{orientation:t.orientation,side:t.orientation==="row"?"below":"right"}),y.jsx(mJ,{orientation:t.orientation}),y.jsx(gJ,{orientation:t.orientation}),y.jsx(pJ,{orientation:t.orientation})]})})},yJ=t=>{const e=ge(),n=fe(),[r,o]=C.useState(!1),i=t.tableHandleMenu||bJ,s=Re(dt),a=et(dt),l=C.useMemo(()=>!s||!a||!a.block||a.block.type!=="table"?!1:t.orientation==="column"?s.getCellsAtColumnHandle(a.block,a.colIndex).every(({cell:c})=>Di(c)===1):s.getCellsAtRowHandle(a.block,a.rowIndex).every(({cell:c})=>Cl(c)===1),[t.orientation,a,s]);return a?y.jsxs(n.Generic.Menu.Root,{onOpenChange:c=>{c?(s.freezeHandles(),t.hideOtherElements(!0)):(s.unfreezeHandles(),t.hideOtherElements(!1),e.focus())},position:"right",children:[y.jsx(n.Generic.Menu.Trigger,{children:y.jsx(n.TableHandle.Root,{className:ut("bn-table-handle",r?"bn-table-handle-dragging":"",l?"":"bn-table-handle-not-draggable"),draggable:l,onDragStart:c=>{o(!0),t.hideOtherElements(!0),t.orientation==="column"?s.colDragStart(c):s.rowDragStart(c)},onDragEnd:()=>{s.dragEnd(),t.hideOtherElements(!1),o(!1)},style:t.orientation==="column"?{transform:"rotate(0.25turn)"}:void 0,children:t.children||y.jsx(x_,{size:24,"data-test":"tableHandle"})})}),y.jsx(i,{orientation:t.orientation})]}):null},EJ=t=>{var e,n;const r=fe(),o=ve(),i=ge(),{block:s,colIndex:a,rowIndex:l}=et(dt,{selector:d=>({block:d?.block,colIndex:d?.colIndex,rowIndex:d?.rowIndex})}),c=(d,f)=>{if(s===void 0||a===void 0||l===void 0)return;const h=s.content.rows.map(p=>({...p,cells:p.cells.map(g=>qo(g))}));f==="text"?h[l].cells[a].props.textColor=d:h[l].cells[a].props.backgroundColor=d,i.updateBlock(s,{type:"table",content:{...s.content,rows:h}}),i.setTextCursorPosition(s)};if(s===void 0||a===void 0||l===void 0)return null;const u=(n=(e=s.content.rows[l])==null?void 0:e.cells)==null?void 0:n[a];return!u||i.settings.tables.cellTextColor===!1&&i.settings.tables.cellBackgroundColor===!1?null:y.jsxs(r.Generic.Menu.Root,{position:"right",sub:!0,children:[y.jsx(r.Generic.Menu.Trigger,{sub:!0,children:y.jsx(r.Generic.Menu.Item,{className:"bn-menu-item",subTrigger:!0,children:t.children||o.drag_handle.colors_menuitem})}),y.jsx(r.Generic.Menu.Dropdown,{sub:!0,className:"bn-menu-dropdown bn-color-picker-dropdown",children:y.jsx(Ef,{iconSize:18,text:i.settings.tables.cellTextColor?{color:Wo(u)?u.props.textColor:"default",setColor:d=>c(d,"text")}:void 0,background:i.settings.tables.cellBackgroundColor?{color:Wo(u)?u.props.backgroundColor:"default",setColor:d=>c(d,"background")}:void 0})})]})},xJ=()=>{var t,e;const n=fe(),r=ve(),o=ge(),i=Re(dt),{block:s,colIndex:a,rowIndex:l}=et(dt,{selector:u=>({block:u?.block,colIndex:u?.colIndex,rowIndex:u?.rowIndex})});if(s===void 0||a===void 0||l===void 0)return null;const c=(e=(t=s.content.rows[l])==null?void 0:t.cells)==null?void 0:e[a];return!c||!Wo(c)||Cl(c)===1&&Di(c)===1||!o.settings.tables.splitCells?null:y.jsx(n.Generic.Menu.Item,{onClick:()=>{i.splitCell({row:l,col:a})},children:r.table_handle.split_cell_menuitem})},CJ=t=>{const e=fe();return y.jsx(e.Generic.Menu.Dropdown,{className:"bn-menu-dropdown bn-table-handle-menu",children:t.children||y.jsxs(y.Fragment,{children:[y.jsx(xJ,{}),y.jsx(EJ,{})]})})},kJ=t=>{const e=fe(),n=ge(),r=Re(dt),o=t.tableCellMenu||CJ;return!n.settings.tables.splitCells&&!n.settings.tables.cellBackgroundColor&&!n.settings.tables.cellTextColor?null:y.jsxs(e.Generic.Menu.Root,{onOpenChange:i=>{i?(r.freezeHandles(),t.hideOtherElements(!0)):(r.unfreezeHandles(),t.hideOtherElements(!1),n.focus())},position:"right",children:[y.jsx(e.Generic.Menu.Trigger,{children:y.jsx(e.Generic.Menu.Button,{className:"bn-table-cell-handle",children:t.children||y.jsx(qZ,{size:12,"data-test":"tableCellHandle"})})}),y.jsx(o,{})]})},TJ=t=>{const e=ge(),[n,r]=C.useState(),o=et(dt),i=C.useMemo(()=>{if(o===void 0||o.rowIndex===void 0||o.colIndex===void 0)return{};const c=dn(o.block.id,e.prosemirrorState.doc);if(!c)return{};const u=c.posBeforeNode+1,d=e.prosemirrorView.domAtPos(u+1).node;if(!(d instanceof Element))return{};const f={element:d},h=e.prosemirrorState.doc.resolve(u+1).posAtIndex(o.rowIndex),p=e.prosemirrorState.doc.resolve(h+1).posAtIndex(o.colIndex),g=e.prosemirrorView.domAtPos(p+1).node;return g instanceof Element?{tableReference:f,cellReference:{element:g},rowReference:{element:d,getBoundingClientRect:()=>{const b=d.getBoundingClientRect(),E=g.getBoundingClientRect();return new DOMRect(b.x,o.draggingState&&o.draggingState.draggedCellOrientation==="row"?o.draggingState.mousePos-E.height/2:E.y,b.width,E.height)}},columnReference:{element:d,getBoundingClientRect:()=>{const b=d.getBoundingClientRect(),E=g.getBoundingClientRect();return new DOMRect(o.draggingState&&o.draggingState.draggedCellOrientation==="col"?o.draggingState.mousePos-E.width/2:E.x,b.y,E.width,b.height)}}}:{}},[e,o]);if(!o)return null;const s=t.tableHandle||yJ,a=t.extendButton||fJ,l=t.tableCellHandle||kJ;return y.jsxs(y.Fragment,{children:[y.jsx(Or,{reference:i?.rowReference,useFloatingOptions:{open:o.show&&o.rowIndex!==void 0&&(!n||n==="rowTableHandle"),placement:"left",middleware:[Dr(-10)]},elementProps:{style:{zIndex:10}},children:o.show&&o.rowIndex!==void 0&&(!n||n==="rowTableHandle")&&y.jsx(s,{orientation:"row",hideOtherElements:c=>r(c?"rowTableHandle":void 0)})}),y.jsx(Or,{reference:i?.columnReference,useFloatingOptions:{open:o.show&&o.colIndex!==void 0&&(!n||n==="columnTableHandle"),placement:"top",middleware:[Dr(-12)]},elementProps:{style:{zIndex:10}},children:o.show&&o.colIndex!==void 0&&(!n||n==="columnTableHandle")&&y.jsx(s,{orientation:"column",hideOtherElements:c=>r(c?"columnTableHandle":void 0)})}),y.jsx(Or,{reference:i?.cellReference,useFloatingOptions:{open:o.show&&o.rowIndex!==void 0&&o.colIndex!==void 0&&(!n||n==="tableCellHandle"),placement:"top-end",middleware:[Dr({mainAxis:-15,crossAxis:-1})]},elementProps:{style:{zIndex:10}},children:o.show&&o.rowIndex!==void 0&&o.colIndex!==void 0&&(!n||n==="tableCellHandle")&&y.jsx(l,{hideOtherElements:c=>r(c?"tableCellHandle":void 0)})}),y.jsx(Or,{reference:i?.tableReference,useFloatingOptions:{open:o.show&&o.showAddOrRemoveRowsButton&&(!n||n==="extendRowsButton"),placement:"bottom",middleware:[tu({apply({rects:c,elements:u}){Object.assign(u.floating.style,{width:`${c.reference.width}px`})}})]},elementProps:{style:{zIndex:10}},children:o.show&&o.showAddOrRemoveRowsButton&&(!n||n==="extendRowsButton")&&y.jsx(a,{orientation:"addOrRemoveRows",hideOtherElements:c=>r(c?"extendRowsButton":void 0)})}),y.jsx(Or,{reference:i?.tableReference,useFloatingOptions:{open:o.show&&o.showAddOrRemoveColumnsButton&&(!n||n==="extendColumnsButton"),placement:"right",middleware:[tu({apply({rects:c,elements:u}){Object.assign(u.floating.style,{height:`${c.reference.height}px`})}})]},elementProps:{style:{zIndex:10}},children:o.show&&o.showAddOrRemoveColumnsButton&&(!n||n==="extendColumnsButton")&&y.jsx(a,{orientation:"addOrRemoveColumns",hideOtherElements:c=>r(c?"extendColumnsButton":void 0)})})]})},wJ=C.lazy(()=>Promise.resolve().then(()=>YJ)),SJ=C.lazy(()=>Promise.resolve().then(()=>XJ));function vJ(t){const e=ge();if(!e)throw new Error("BlockNoteDefaultUI must be used within a BlockNoteContext.Provider");return y.jsxs(y.Fragment,{children:[e.getExtension(Qo)&&t.formattingToolbar!==!1&&y.jsx(e1,{}),e.getExtension(Gl)&&t.linkToolbar!==!1&&y.jsx(E_,{}),e.getExtension(er)&&t.slashMenu!==!1&&y.jsx(w_,{triggerCharacter:"/"}),e.getExtension(er)&&t.emojiPicker!==!1&&y.jsx(oJ,{triggerCharacter:":",columns:10,minQueryLength:2}),e.getExtension(Er)&&t.sideMenu!==!1&&y.jsx(JZ,{}),e.getExtension(fr)&&t.filePanel!==!1&&y.jsx(SX,{}),e.getExtension(dt)&&t.tableHandles!==!1&&y.jsx(TJ,{}),e.getExtension(nr)&&t.comments!==!1&&y.jsxs(C.Suspense,{children:[y.jsx(wJ,{}),y.jsx(SJ,{})]})]})}function AJ(t,e){const n=zr();e||(e=n?.editor),C.useEffect(()=>{if(!e)throw new Error("'editor' is required, either from BlockNoteContext or as a function argument");return e.onChange(t)},[t,e])}function _J(t,e,n){const r=zr();e||(e=r?.editor),C.useEffect(()=>{if(!e)throw new Error("'editor' is required, either from BlockNoteContext or as a function argument");return e.onSelectionChange(t,n)},[t,e,n])}const NJ=()=>{const t=C.useMemo(()=>{var s;return(s=window.matchMedia)==null?void 0:s.call(window,"(prefers-color-scheme: dark)")},[]),e=C.useMemo(()=>{var s;return(s=window.matchMedia)==null?void 0:s.call(window,"(prefers-color-scheme: light)")},[]),n=t?.matches,r=e?.matches,[o,i]=C.useState(n?"dark":r?"light":"no-preference");return C.useEffect(()=>{i(n?"dark":r?"light":"no-preference")},[n,r]),C.useEffect(()=>{if(typeof t?.addEventListener=="function"){const s=({matches:l})=>l&&i("dark"),a=({matches:l})=>l&&i("light");return t?.addEventListener("change",s),e?.addEventListener("change",a),()=>{t?.removeEventListener("change",s),e?.removeEventListener("change",a)}}else{const s=()=>i(t.matches?"dark":e.matches?"light":"no-preference");return t?.addEventListener("change",s),e?.addEventListener("change",s),()=>{t?.removeEventListener("change",s),e?.removeEventListener("change",s)}}},[t,e]),o},S_=C.createContext(void 0);function IJ(){return C.useContext(S_)}function MJ(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:ki.createPortal(r.reactElement,r.element,n)},t.forEach(o=>o())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(o=>o())}}}const OJ=({contentComponent:t})=>{const e=C.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return y.jsx(y.Fragment,{children:Object.values(e)})},DJ=C.forwardRef((t,e)=>{const[n,r]=C.useState();return C.useImperativeHandle(e,()=>(o,i)=>{ki.flushSync(()=>{r({node:o,container:i})}),r(void 0)},[]),y.jsx(y.Fragment,{children:n&&ki.createPortal(n.node,n.container)})}),Qx=()=>{};function LJ(t,e){const{editor:n,className:r,theme:o,children:i,editable:s,onSelectionChange:a,onChange:l,formattingToolbar:c,linkToolbar:u,slashMenu:d,emojiPicker:f,sideMenu:h,filePanel:p,tableHandles:g,comments:b,autoFocus:E,renderEditor:x=!0,...T}=t,[D,O]=C.useState(),v=zr(),R=NJ(),j=v?.colorSchemePreference||R,z=o||(j==="dark"?"dark":"light");AJ(l||Qx,n),_J(a||Qx,n),C.useEffect(()=>{n.isEditable=s!==!1},[s,n]);const I=C.useCallback(W=>{n.elementRenderer=W},[n]),X=C.useMemo(()=>({...v,editor:n,setContentEditableProps:O,colorSchemePreference:z}),[v,n,z]),F=C.useMemo(()=>({editorProps:{autoFocus:E,contentEditableProps:D},defaultUIProps:{formattingToolbar:c,linkToolbar:u,slashMenu:d,emojiPicker:f,sideMenu:h,filePanel:p,tableHandles:g,comments:b}}),[E,D,c,u,d,f,h,p,g,b]);return y.jsx(ZA.Provider,{value:X,children:y.jsxs(S_.Provider,{value:F,children:[y.jsx(DJ,{ref:I}),y.jsx(RJ,{className:r,renderEditor:x,editable:s,editorColorScheme:z,ref:e,...T,children:i})]})})}const RJ=Ie.forwardRef(({className:t,renderEditor:e,editable:n,editorColorScheme:r,children:o,...i},s)=>y.jsx("div",{className:ut("bn-container",r,t),"data-color-scheme":r,...i,ref:s,children:e?y.jsx(BJ,{editable:n,children:o}):o})),PJ=Ie.forwardRef(LJ),BJ=t=>{const e=IJ(),n=ge(),r=C.useMemo(()=>MJ(),[]),o=C.useCallback(i=>{t.editable!==void 0&&t.editable!==n.isEditable&&(n.isEditable=t.editable),n._tiptapEditor.contentComponent=r,i?n.mount(i):n.unmount()},[n,r,t.editable]);return y.jsxs(y.Fragment,{children:[y.jsx(OJ,{contentComponent:r}),y.jsx(FJ,{...e.editorProps,...t,mount:o}),y.jsx(vJ,{...e.defaultUIProps}),t.children]})},FJ=t=>{const{autoFocus:e,mount:n,contentEditableProps:r}=t;return y.jsx("div",{"aria-autocomplete":"list","aria-haspopup":"listbox","data-bn-autofocus":e,ref:n,...r})};function Xx(t,e){let n;const r=document.createElement("div");let o;if(e!=null&&e.elementRenderer)e.elementRenderer(t(l=>n=l||void 0),r);else{if(!(e!=null&&e.headless))throw new Error("elementRenderer not available, expected headless editor");o=s3.createRoot(r),ki.flushSync(()=>{o.render(t(l=>n=l||void 0))})}if(!r.childElementCount)return console.warn("ReactInlineContentSpec: renderHTML() failed"),{dom:document.createElement("span")};n?.setAttribute("data-tmp-find","true");const i=r.cloneNode(!0),s=i.firstElementChild,a=i.querySelector("[data-tmp-find]");return a?.removeAttribute("data-tmp-find"),o?.unmount(),{dom:s,contentDOM:a||void 0}}function Zh(t){var e;return y.jsx(fX,{onDragOver:n=>n.preventDefault(),...Object.fromEntries(Object.entries(t.domAttributes||{}).filter(([n])=>n!=="class")),className:ut("bn-block-content",((e=t.domAttributes)==null?void 0:e.class)||""),"data-content-type":t.blockType,...Object.fromEntries(Object.entries(t.blockProps).filter(([n,r])=>{const o=t.propSchema[n];return r!==o.default}).map(([n,r])=>[Ou(n),r])),"data-file-block":t.isFileBlock===!0||void 0,children:t.children})}function v_(t,e,n){return(r={})=>{const o=typeof t=="function"?t(r):t,i=typeof e=="function"?e(r):e;return{config:o,implementation:{...i,toExternalHTML(a,l){const c=i.toExternalHTML||i.render;return Xx(u=>y.jsx(Zh,{blockType:a.type,blockProps:a.props,propSchema:o.propSchema,domAttributes:this.blockContentDOMAttributes,children:y.jsx(c,{block:a,editor:l,contentRef:d=>{u(d),d&&(d.className=ut("bn-inline-content",d.className))}})}),l)},render(a,l){if(this.renderType==="nodeView")return yX(c=>{var u;const d=_2(c.getPos,l,c.editor,o.type),f=KA().nodeViewContentRef;if(!f)throw new Error("nodeViewContentRef is not set");const h=i.render;return y.jsx(Zh,{blockType:d.type,blockProps:d.props,propSchema:o.propSchema,isFileBlock:!!((u=i.meta)!=null&&u.fileBlockAccept),domAttributes:this.blockContentDOMAttributes,children:y.jsx(h,{block:d,editor:l,contentRef:p=>{f(p),p&&(p.className=ut("bn-inline-content",p.className),p.dataset.nodeViewContent="")}})})},{className:"bn-react-node-view-renderer"})(this.props);{const c=i.render;return Xx(u=>y.jsx(Zh,{blockType:a.type,blockProps:a.props,propSchema:o.propSchema,domAttributes:this.blockContentDOMAttributes,children:y.jsx(c,{block:a,editor:l,contentRef:d=>{u(d),d&&(d.className=ut("bn-inline-content",d.className))}})}),l)}}},extensions:void 0}}}const xf=(t={},e=[])=>C.useMemo(()=>{const n=eX.create(t);return window&&(window.ProseMirror=n._tiptapEditor),n},e),t1=t=>{const[e,n]=C.useState(!1),r=Ot({editor:t.editor,selector:({editor:a})=>a.isEmpty}),o=fe(),i=C.useCallback(()=>{n(!0)},[]),s=C.useCallback(()=>{n(!1)},[]);return C.useEffect(()=>{t.editable&&t.autoFocus&&t.editor.focus()},[t.autoFocus,t.editable,t.editor]),y.jsxs(y.Fragment,{children:[y.jsx(o.Comments.Editor,{autoFocus:t.autoFocus,className:"bn-comment-editor",editor:t.editor,onFocus:i,onBlur:s,editable:t.editable}),t.actions&&y.jsx("div",{className:"bn-comment-actions-wrapper",children:y.jsx(t.actions,{isFocused:e,isEmpty:r})})]})};let Jh;async function HJ(){return Jh||(Jh=(async()=>{const[t,e]=await Promise.all([eu(()=>import("./module-RjUF93sV.js"),[]),eu(()=>import("./native-48B9X9Wg.js"),[])]),n="default"in t?t.default:t,r="default"in e?e.default:e;return await n.init({data:r}),{emojiMart:n,emojiData:r}})(),Jh)}function UJ(t){const e=C.useRef(null),n=C.useRef(null);return n.current&&n.current.update(t),C.useEffect(()=>((async()=>{const{emojiMart:r}=await HJ();n.current=new r.Picker({...t,ref:e})})(),()=>{n.current=null}),[]),Ie.createElement("div",{ref:e})}const Zx=t=>{const[e,n]=C.useState(!1),r=fe(),o=ge(),i=zr();return y.jsxs(r.Generic.Popover.Root,{open:e,children:[y.jsx(r.Generic.Popover.Trigger,{children:y.jsx("div",{onClick:s=>{var a;s.preventDefault(),s.stopPropagation(),n(!e),(a=t.onOpenChange)==null||a.call(t,!e)},style:{display:"flex",justifyContent:"center",alignItems:"center"},children:t.children})}),ki.createPortal(y.jsx(r.Generic.Popover.Content,{className:"bn-emoji-picker-popover",variant:"panel-popover",children:y.jsx(UJ,{perLine:7,onClickOutside:()=>{var s;n(!1),(s=t.onOpenChange)==null||s.call(t,!1)},onEmojiSelect:s=>{var a;t.onEmojiSelect(s),n(!1),(a=t.onOpenChange)==null||a.call(t,!1)},theme:i?.colorSchemePreference})}),o.domElement.parentElement)]})};function VJ(t){return n1([t]).get(t)}function n1(t){const e=Re(nr).userStore,n=C.useCallback(()=>{const i=new Map;for(const s of t){const a=e.getUser(s);a&&i.set(s,a)}return i},[e,t]),r=C.useMemo(()=>({current:n()}),[n]),o=C.useCallback(i=>{const s=e.subscribe(a=>{r.current=n(),i()});return e.loadUsers(t),s},[e,n,t,r]);return C.useSyncExternalStore(o,()=>r.current)}const $J=t=>{const e=fe(),n=ve(),r=Re(nr),o=t.comment.reactions.find(l=>l.emoji===t.emoji);if(!o)throw new Error("Trying to render reaction badge for non-existing reaction");const[i,s]=C.useState([]),a=n1(i);return y.jsx(e.Generic.Badge.Root,{className:ut("bn-badge","bn-comment-reaction"),text:o.userIds.length.toString(),icon:o.emoji,isSelected:r.threadStore.auth.canDeleteReaction(t.comment,o.emoji),onClick:()=>t.onReactionSelect(o.emoji),onMouseEnter:()=>s(o.userIds),mainTooltip:n.comments.reactions.reacted_by,secondaryTooltip:`${Array.from(a.values()).map(l=>l.username).join(`
|
|
179
|
+
`)}`},o.emoji)},{textColor:Yre,backgroundColor:Kre,...jJ}=l0,r1=P0.create({blockSpecs:{paragraph:H2()},styleSpecs:jJ}),zJ=({comment:t,thread:e,showResolveButton:n})=>{const r=Re(nr),o=ve(),i=xf({initialContent:t.body,trailingBlock:!1,dictionary:{...o,placeholders:{emptyDocument:o.placeholders.edit_comment}},schema:r.commentEditorSchema||r1}),s=fe(),[a,l]=C.useState(!1),[c,u]=C.useState(!1),d=r.threadStore,f=C.useCallback(()=>{l(!0)},[]),h=C.useCallback(()=>{i.replaceBlocks(i.document,t.body),l(!1)},[i,t.body]),p=C.useCallback(async I=>{await d.updateComment({commentId:t.id,comment:{body:i.document},threadId:e.id}),l(!1)},[t,e.id,i,d]),g=C.useCallback(async()=>{await d.deleteComment({commentId:t.id,threadId:e.id})},[t,e.id,d]),b=C.useCallback(async I=>{d.auth.canAddReaction(t,I)?await d.addReaction({threadId:e.id,commentId:t.id,emoji:I}):d.auth.canDeleteReaction(t,I)&&await d.deleteReaction({threadId:e.id,commentId:t.id,emoji:I})},[d,t,e.id]),E=C.useCallback(async()=>{await d.resolveThread({threadId:e.id})},[e.id,d]),x=C.useCallback(async()=>{await d.unresolveThread({threadId:e.id})},[e.id,d]),T=VJ(t.userId);if(!t.body)return null;let D;const O=d.auth.canAddReaction(t),v=d.auth.canDeleteComment(t),R=d.auth.canUpdateComment(t),j=n&&(e.resolved?d.auth.canUnresolveThread(e):d.auth.canResolveThread(e));a||(D=y.jsxs(s.Generic.Toolbar.Root,{className:ut("bn-action-toolbar","bn-comment-actions"),variant:"action-toolbar",children:[O&&y.jsx(Zx,{onEmojiSelect:I=>b(I.native),onOpenChange:u,children:y.jsx(s.Generic.Toolbar.Button,{mainTooltip:o.comments.actions.add_reaction,variant:"compact",children:y.jsx(Wx,{size:16})},"add-reaction")}),j&&(e.resolved?y.jsx(s.Generic.Toolbar.Button,{mainTooltip:"Re-open",variant:"compact",onClick:x,children:y.jsx($X,{size:16})},"reopen"):y.jsx(s.Generic.Toolbar.Button,{mainTooltip:o.comments.actions.resolve,variant:"compact",onClick:E,children:y.jsx(hZ,{size:16})},"resolve")),(v||R)&&y.jsxs(s.Generic.Menu.Root,{position:"bottom-start",children:[y.jsx(s.Generic.Menu.Trigger,{children:y.jsx(s.Generic.Toolbar.Button,{mainTooltip:o.comments.actions.more_actions,variant:"compact",children:y.jsx(yZ,{size:16})},"more-actions")}),y.jsxs(s.Generic.Menu.Dropdown,{className:"bn-menu-dropdown",children:[R&&y.jsx(s.Generic.Menu.Item,{icon:y.jsx(jX,{}),onClick:f,children:o.comments.actions.edit_comment},"edit-comment"),v&&y.jsx(s.Generic.Menu.Item,{icon:y.jsx(mZ,{}),onClick:g,children:o.comments.actions.delete_comment},"delete-comment")]})]})]}));const z=t.createdAt.toLocaleDateString(void 0,{month:"short",day:"numeric"});if(!t.body)throw new Error("soft deletes are not yet supported");return y.jsx(s.Comments.Comment,{authorInfo:T??"loading",timeString:z,edited:t.updatedAt.getTime()!==t.createdAt.getTime(),showActions:"hover",actions:D,className:"bn-thread-comment",emojiPickerOpen:c,children:y.jsx(t1,{autoFocus:a,editor:i,editable:a,actions:t.reactions.length>0||a?({isEmpty:I})=>y.jsxs(y.Fragment,{children:[t.reactions.length>0&&!a&&y.jsxs(s.Generic.Badge.Group,{className:ut("bn-badge-group","bn-comment-reactions"),children:[t.reactions.map(X=>y.jsx($J,{comment:t,emoji:X.emoji,onReactionSelect:b},X.emoji)),O&&y.jsx(Zx,{onEmojiSelect:X=>b(X.native),onOpenChange:u,children:y.jsx(s.Generic.Badge.Root,{className:ut("bn-badge","bn-comment-add-reaction"),text:"+",icon:y.jsx(Wx,{size:16}),mainTooltip:o.comments.actions.add_reaction})})]}),a&&y.jsxs(s.Generic.Toolbar.Root,{variant:"action-toolbar",className:ut("bn-action-toolbar","bn-comment-actions"),children:[y.jsx(s.Generic.Toolbar.Button,{mainTooltip:o.comments.save_button_text,variant:"compact",onClick:p,isDisabled:I,children:o.comments.save_button_text}),y.jsx(s.Generic.Toolbar.Button,{className:"bn-button",mainTooltip:o.comments.cancel_button_text,variant:"compact",onClick:h,children:o.comments.cancel_button_text})]})]}):void 0})})},qJ=({thread:t,maxCommentsBeforeCollapse:e})=>{const n=fe(),r=ve(),o=n1(t.resolvedBy?[t.resolvedBy]:[]),i=t.comments.map((s,a)=>y.jsx(zJ,{thread:t,comment:s,showResolveButton:a===0},s.id+JSON.stringify(s.body||"{}")));if(t.resolved&&t.resolvedUpdatedAt&&t.resolvedBy){if(!o.get(t.resolvedBy))throw new Error(`User ${t.resolvedBy} resolved thread ${t.id}, but their data could not be found.`);const s=t.comments.findLastIndex(a=>t.resolvedUpdatedAt.getTime()>a.createdAt.getTime())+1;i.splice(s,0,y.jsx(n.Comments.Comment,{className:"bn-thread-comment",authorInfo:t.resolvedBy&&o.get(t.resolvedBy)||"loading",timeString:t.resolvedUpdatedAt.toLocaleDateString(void 0,{month:"short",day:"numeric"}),edited:!1,showActions:!1,children:y.jsx("div",{className:"bn-resolved-text",children:r.comments.sidebar.marked_as_resolved})},"resolved-comment"))}return e&&i.length>e&&i.splice(1,i.length-2,y.jsx(n.Comments.ExpandSectionsPrompt,{className:"bn-thread-expand-prompt",children:r.comments.sidebar.more_replies(t.comments.length-2)},"expand-prompt")),i};function WJ(){const t=Re(nr),e=fe(),n=ve(),r=xf({trailingBlock:!1,dictionary:{...n,placeholders:{emptyDocument:n.placeholders.new_comment}},schema:t.commentEditorSchema||r1});return y.jsx(e.Comments.Card,{className:"bn-thread",children:y.jsx(t1,{autoFocus:!0,editable:!0,editor:r,actions:({isEmpty:o})=>y.jsx(e.Generic.Toolbar.Root,{className:ut("bn-action-toolbar","bn-comment-actions"),variant:"action-toolbar",children:y.jsx(e.Generic.Toolbar.Button,{className:"bn-button",mainTooltip:"Save",variant:"compact",isDisabled:o,onClick:async()=>{await t.createThread({initialComment:{body:r.document}}),t.stopPendingComment()},children:"Save"})})})})}function GJ(t){const[e,n]=C.useState(!1),r=ge(),o=Re(nr),i=et(nr,{editor:r,selector:c=>c.pendingComment});C.useEffect(()=>{n(i)},[i]);const s=Ot({editor:r,selector:({editor:c})=>i?{from:c.prosemirrorState.selection.from,to:c.prosemirrorState.selection.to}:void 0}),a=C.useMemo(()=>({useFloatingOptions:{open:e,onOpenChange:c=>{c||(o.stopPendingComment(),r.focus()),n(c)},placement:"bottom",middleware:[Dr(10),Al(),Hi()]},elementProps:{style:{zIndex:60}},...t.floatingUIOptions}),[o,r,e,t.floatingUIOptions]),l=t.floatingComposer||WJ;return y.jsx(Q0,{position:s,...a,children:y.jsx(l,{})})}const YJ=Object.freeze(Object.defineProperty({__proto__:null,default:GJ},Symbol.toStringTag,{value:"Module"})),A_=({thread:t,selected:e,referenceText:n,maxCommentsBeforeCollapse:r,onFocus:o,onBlur:i,tabIndex:s})=>{const a=fe(),l=ve(),c=Re(nr),u=xf({trailingBlock:!1,dictionary:{...l,placeholders:{emptyDocument:l.placeholders.comment_reply}},schema:c.commentEditorSchema||r1}),d=C.useCallback(async()=>{await c.threadStore.addComment({comment:{body:u.document},threadId:t.id}),u.removeBlocks(u.document)},[c,u,t.id]);return y.jsxs(a.Comments.Card,{className:"bn-thread",headerText:n,onFocus:o,onBlur:i,selected:e,tabIndex:s,children:[y.jsx(a.Comments.CardSection,{className:"bn-thread-comments",children:y.jsx(qJ,{thread:t,maxCommentsBeforeCollapse:e?void 0:r||5})}),e&&y.jsx(a.Comments.CardSection,{className:"bn-thread-composer",children:y.jsx(t1,{autoFocus:!1,editable:!0,editor:u,actions:({isEmpty:f})=>f?null:y.jsx(a.Generic.Toolbar.Root,{variant:"action-toolbar",className:ut("bn-action-toolbar","bn-comment-actions"),children:y.jsx(a.Generic.Toolbar.Button,{mainTooltip:l.comments.save_button_text,variant:"compact",isDisabled:f,onClick:d,children:l.comments.save_button_text})})})})]})};function KJ(){const t=Re(nr).threadStore,e=C.useRef(void 0);e.current||(e.current=t.getThreads());const n=C.useCallback(r=>t.subscribe(o=>{e.current=o,r()}),[t]);return C.useSyncExternalStore(n,()=>e.current)}function QJ(t){const e=ge(),[n,r]=C.useState(!1),o=Re(nr),i=et(nr,{editor:e,selector:u=>u.selectedThreadId?{id:u.selectedThreadId,position:u.threadPositions.get(u.selectedThreadId)}:void 0});C.useEffect(()=>{r(!!i)},[i]);const s=KJ(),a=C.useMemo(()=>i?s.get(i.id):void 0,[i,s]),l=C.useMemo(()=>({useFloatingOptions:{open:n,onOpenChange:(u,d,f)=>{f==="escape-key"&&e.focus(),u||o.selectThread(void 0),r(u)},placement:"bottom",middleware:[Dr(10),Al(),Hi()]},elementProps:{style:{zIndex:30}},...t.floatingUIOptions}),[o,e,n,t.floatingUIOptions]),c=t.floatingThread||A_;return y.jsx(Q0,{position:i?.position,...l,children:a&&y.jsx(c,{thread:a,selected:!0})})}const XJ=Object.freeze(Object.defineProperty({__proto__:null,default:QJ},Symbol.toStringTag,{value:"Module"}));Ie.memo(({thread:t,selectedThreadId:e,maxCommentsBeforeCollapse:n,referenceText:r})=>{const o=Re(nr),i=C.useCallback(a=>{a.target.closest(".bn-action-toolbar")||o.selectThread(t.id)},[o,t.id]),s=C.useCallback(a=>{if(!a.relatedTarget||a.relatedTarget.closest(".bn-action-toolbar"))return;const l=a.target instanceof Node?a.target:null,c=a.relatedTarget instanceof Node?a.relatedTarget.closest(".bn-thread"):null;(!l||!c||!c.contains(l))&&o.selectThread(void 0)},[o]);return y.jsx(A_,{thread:t,selected:t.id===e,referenceText:r,maxCommentsBeforeCollapse:n,onFocus:i,onBlur:s,tabIndex:0})});function ZJ(t){return t.currentTarget instanceof HTMLElement&&t.relatedTarget instanceof HTMLElement?t.currentTarget.contains(t.relatedTarget):!1}function JJ({onBlur:t,onFocus:e}={}){const n=C.useRef(null),[r,o]=C.useState(!1),i=C.useRef(!1),s=c=>{o(c),i.current=c},a=c=>{i.current||(s(!0),e?.(c))},l=c=>{i.current&&!ZJ(c)&&(s(!1),t?.(c))};return C.useEffect(()=>{const c=n.current;if(c)return c.addEventListener("focusin",a),c.addEventListener("focusout",l),()=>{c?.removeEventListener("focusin",a),c?.removeEventListener("focusout",l)}},[a,l]),{ref:n,focused:r}}function __(t,e){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=n.top<r.top,i=n.bottom>r.bottom;return o&&i?"both":o?"top":i?"bottom":"none"}function N_(t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var Yl=t=>t.type==="checkbox",hi=t=>t instanceof Date,yn=t=>t==null;const I_=t=>typeof t=="object";var At=t=>!yn(t)&&!Array.isArray(t)&&I_(t)&&!hi(t),eee=t=>At(t)&&t.target?Yl(t.target)?t.target.checked:t.target.value:t,tee=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,nee=(t,e)=>t.has(tee(e)),ree=t=>{const e=t.constructor&&t.constructor.prototype;return At(e)&&e.hasOwnProperty("isPrototypeOf")},o1=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Mt(t){if(t instanceof Date)return new Date(t);const e=typeof FileList<"u"&&t instanceof FileList;if(o1&&(t instanceof Blob||e))return t;const n=Array.isArray(t);if(!n&&!(At(t)&&ree(t)))return t;const r=n?[]:Object.create(Object.getPrototypeOf(t));for(const o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=Mt(t[o]));return r}var Cf=t=>/^\w*$/.test(t),ht=t=>t===void 0,i1=t=>Array.isArray(t)?t.filter(Boolean):[],s1=t=>i1(t.replace(/["|']|\]/g,"").split(/\.|\[/)),ce=(t,e,n)=>{if(!e||!At(t))return n;const r=(Cf(e)?[e]:s1(e)).reduce((o,i)=>yn(o)?o:o[i],t);return ht(r)||r===t?ht(t[e])?n:t[e]:r},Nr=t=>typeof t=="boolean",lr=t=>typeof t=="function",ct=(t,e,n)=>{let r=-1;const o=Cf(e)?[e]:s1(e),i=o.length,s=i-1;for(;++r<i;){const a=o[r];let l=n;if(r!==s){const c=t[a];l=At(c)||Array.isArray(c)?c:isNaN(+o[r+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;t[a]=l,t=t[a]}};const Jx={BLUR:"blur",FOCUS_OUT:"focusout"},cr={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Jr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},M_=Ie.createContext(null);M_.displayName="HookFormControlContext";var oee=(t,e,n,r=!0)=>{const o={defaultValues:e._defaultValues};for(const i in t)Object.defineProperty(o,i,{get:()=>{const s=i;return e._proxyFormState[s]!==cr.all&&(e._proxyFormState[s]=!r||cr.all),t[s]}});return o};const iee=typeof window<"u"?Ie.useLayoutEffect:Ie.useEffect;var Rn=t=>typeof t=="string",see=(t,e,n,r,o)=>Rn(t)?(r&&e.watch.add(t),ce(n,t,o)):Array.isArray(t)?t.map(i=>(r&&e.watch.add(i),ce(n,i))):(r&&(e.watchAll=!0),n),Fm=t=>yn(t)||!I_(t);function Io(t,e,n=new WeakSet){if(Fm(t)||Fm(e))return Object.is(t,e);if(hi(t)&&hi(e))return Object.is(t.getTime(),e.getTime());const r=Object.keys(t),o=Object.keys(e);if(r.length!==o.length)return!1;if(n.has(t)||n.has(e))return!0;n.add(t),n.add(e);for(const i of r){const s=t[i];if(!o.includes(i))return!1;if(i!=="ref"){const a=e[i];if(hi(s)&&hi(a)||At(s)&&At(a)||Array.isArray(s)&&Array.isArray(a)?!Io(s,a,n):!Object.is(s,a))return!1}}return!0}const O_=Ie.createContext(null);O_.displayName="HookFormContext";const aee=t=>{const{children:e,watch:n,getValues:r,getFieldState:o,setError:i,clearErrors:s,setValue:a,trigger:l,formState:c,resetField:u,reset:d,handleSubmit:f,unregister:h,control:p,register:g,setFocus:b,subscribe:E}=t;return Ie.createElement(O_.Provider,{value:Ie.useMemo(()=>({watch:n,getValues:r,getFieldState:o,setError:i,clearErrors:s,setValue:a,trigger:l,formState:c,resetField:u,reset:d,handleSubmit:f,unregister:h,control:p,register:g,setFocus:b,subscribe:E}),[s,p,c,o,r,f,g,d,u,i,b,a,E,l,h,n])},Ie.createElement(M_.Provider,{value:p},e))};var lee=(t,e,n,r,o)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:o||!0}}:{},Ga=t=>Array.isArray(t)?t:[t],eC=()=>{let t=[];return{get observers(){return t},next:o=>{for(const i of t)i.next&&i.next(o)},subscribe:o=>(t.push(o),{unsubscribe:()=>{t=t.filter(i=>i!==o)}}),unsubscribe:()=>{t=[]}}};function D_(t,e){const n={};for(const r in t)if(t.hasOwnProperty(r)){const o=t[r],i=e[r];if(o&&At(o)&&i){const s=D_(o,i);At(s)&&(n[r]=s)}else t[r]&&(n[r]=i)}return n}var on=t=>At(t)&&!Object.keys(t).length,a1=t=>t.type==="file",xd=t=>{if(!o1)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},L_=t=>t.type==="select-multiple",l1=t=>t.type==="radio",cee=t=>l1(t)||Yl(t),ep=t=>xd(t)&&t.isConnected;function uee(t,e){const n=e.slice(0,-1).length;let r=0;for(;r<n;)t=ht(t)?r++:t[e[r++]];return t}function dee(t){for(const e in t)if(t.hasOwnProperty(e)&&!ht(t[e]))return!1;return!0}function Tt(t,e){const n=Array.isArray(e)?e:Cf(e)?[e]:s1(e),r=n.length===1?t:uee(t,n),o=n.length-1,i=n[o];return r&&delete r[i],o!==0&&(At(r)&&on(r)||Array.isArray(r)&&dee(r))&&Tt(t,n.slice(0,-1)),t}var fee=t=>{for(const e in t)if(lr(t[e]))return!0;return!1};function R_(t){return Array.isArray(t)||At(t)&&!fee(t)}function Hm(t,e={}){for(const n in t){const r=t[n];R_(r)?(e[n]=Array.isArray(r)?[]:{},Hm(r,e[n])):ht(r)||(e[n]=!0)}return e}function as(t,e,n){n||(n=Hm(e));for(const r in t){const o=t[r];if(R_(o))ht(e)||Fm(n[r])?n[r]=Hm(o,Array.isArray(o)?[]:{}):as(o,yn(e)?{}:e[r],n[r]);else{const i=e[r];n[r]=!Io(o,i)}}return n}const tC={value:!1,isValid:!1},nC={value:!0,isValid:!0};var P_=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!ht(t[0].attributes.value)?ht(t[0].value)||t[0].value===""?nC:{value:t[0].value,isValid:!0}:nC:tC}return tC},B_=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>ht(t)?t:e?t===""?NaN:t&&+t:n&&Rn(t)?new Date(t):r?r(t):t;const rC={isValid:!1,value:null};var F_=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,rC):rC;function oC(t){const e=t.ref;return a1(e)?e.files:l1(e)?F_(t.refs).value:L_(e)?[...e.selectedOptions].map(({value:n})=>n):Yl(e)?P_(t.refs).value:B_(ht(e.value)?t.ref.value:e.value,t)}var hee=(t,e,n,r)=>{const o={};for(const i of t){const s=ce(e,i);s&&ct(o,i,s._f)}return{criteriaMode:n,names:[...t],fields:o,shouldUseNativeValidation:r}},Cd=t=>t instanceof RegExp,ma=t=>ht(t)?t:Cd(t)?t.source:At(t)?Cd(t.value)?t.value.source:t.value:t,iC=t=>({isOnSubmit:!t||t===cr.onSubmit,isOnBlur:t===cr.onBlur,isOnChange:t===cr.onChange,isOnAll:t===cr.all,isOnTouch:t===cr.onTouched});const sC="AsyncFunction";var pee=t=>!!t&&!!t.validate&&!!(lr(t.validate)&&t.validate.constructor.name===sC||At(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===sC)),mee=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),aC=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(r=>t.startsWith(r)&&/^\.\w+/.test(t.slice(r.length))));const Ya=(t,e,n,r)=>{for(const o of n||Object.keys(t)){const i=ce(t,o);if(i){const{_f:s,...a}=i;if(s){if(s.refs&&s.refs[0]&&e(s.refs[0],o)&&!r)return!0;if(s.ref&&e(s.ref,s.name)&&!r)return!0;if(Ya(a,e))break}else if(At(a)&&Ya(a,e))break}}};function lC(t,e,n){const r=ce(t,n);if(r||Cf(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const i=o.join("."),s=ce(e,i),a=ce(t,i);if(s&&!Array.isArray(s)&&n!==i)return{name:n};if(a&&a.type)return{name:i,error:a};if(a&&a.root&&a.root.type)return{name:`${i}.root`,error:a.root};o.pop()}return{name:n}}var gee=(t,e,n,r)=>{n(t);const{name:o,...i}=t;return on(i)||Object.keys(i).length>=Object.keys(e).length||Object.keys(i).find(s=>e[s]===(!r||cr.all))},bee=(t,e,n)=>!t||!e||t===e||Ga(t).some(r=>r&&(n?r===e:r.startsWith(e)||e.startsWith(r))),yee=(t,e,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(e||t):(n?r.isOnBlur:o.isOnBlur)?!t:(n?r.isOnChange:o.isOnChange)?t:!0,Eee=(t,e)=>!i1(ce(t,e)).length&&Tt(t,e),xee=(t,e,n)=>{const r=Ga(ce(t,n));return ct(r,"root",e[n]),ct(t,n,r),t};function cC(t,e,n="validate"){if(Rn(t)||Array.isArray(t)&&t.every(Rn)||Nr(t)&&!t)return{type:n,message:Rn(t)?t:"",ref:e}}var es=t=>At(t)&&!Cd(t)?t:{value:t,message:""},uC=async(t,e,n,r,o,i)=>{const{ref:s,refs:a,required:l,maxLength:c,minLength:u,min:d,max:f,pattern:h,validate:p,name:g,valueAsNumber:b,mount:E}=t._f,x=ce(n,g);if(!E||e.has(g))return{};const T=a?a[0]:s,D=F=>{o&&T.reportValidity&&(T.setCustomValidity(Nr(F)?"":F||""),T.reportValidity())},O={},v=l1(s),R=Yl(s),j=v||R,z=(b||a1(s))&&ht(s.value)&&ht(x)||xd(s)&&s.value===""||x===""||Array.isArray(x)&&!x.length,I=lee.bind(null,g,r,O),X=(F,W,B,q=Jr.maxLength,oe=Jr.minLength)=>{const Z=F?W:B;O[g]={type:F?q:oe,message:Z,ref:s,...I(F?q:oe,Z)}};if(i?!Array.isArray(x)||!x.length:l&&(!j&&(z||yn(x))||Nr(x)&&!x||R&&!P_(a).isValid||v&&!F_(a).isValid)){const{value:F,message:W}=Rn(l)?{value:!!l,message:l}:es(l);if(F&&(O[g]={type:Jr.required,message:W,ref:T,...I(Jr.required,W)},!r))return D(W),O}if(!z&&(!yn(d)||!yn(f))){let F,W;const B=es(f),q=es(d);if(!yn(x)&&!isNaN(x)){const oe=s.valueAsNumber||x&&+x;yn(B.value)||(F=oe>B.value),yn(q.value)||(W=oe<q.value)}else{const oe=s.valueAsDate||new Date(x),Z=S=>new Date(new Date().toDateString()+" "+S),ee=s.type=="time",ie=s.type=="week";Rn(B.value)&&x&&(F=ee?Z(x)>Z(B.value):ie?x>B.value:oe>new Date(B.value)),Rn(q.value)&&x&&(W=ee?Z(x)<Z(q.value):ie?x<q.value:oe<new Date(q.value))}if((F||W)&&(X(!!F,B.message,q.message,Jr.max,Jr.min),!r))return D(O[g].message),O}if((c||u)&&!z&&(Rn(x)||i&&Array.isArray(x))){const F=es(c),W=es(u),B=!yn(F.value)&&x.length>+F.value,q=!yn(W.value)&&x.length<+W.value;if((B||q)&&(X(B,F.message,W.message),!r))return D(O[g].message),O}if(h&&!z&&Rn(x)){const{value:F,message:W}=es(h);if(Cd(F)&&!x.match(F)&&(O[g]={type:Jr.pattern,message:W,ref:s,...I(Jr.pattern,W)},!r))return D(W),O}if(p){if(lr(p)){const F=await p(x,n),W=cC(F,T);if(W&&(O[g]={...W,...I(Jr.validate,W.message)},!r))return D(W.message),O}else if(At(p)){let F={};for(const W in p){if(!on(F)&&!r)break;const B=cC(await p[W](x,n),T,W);B&&(F={...B,...I(W,B.message)},D(B.message),r&&(O[g]=F))}if(!on(F)&&(O[g]={ref:T,...F},!r))return O}}return D(!0),O};const Cee={mode:cr.onSubmit,reValidateMode:cr.onChange,shouldFocusError:!0};function kee(t={}){let e={...Cee,...t},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:lr(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},r={},o=At(e.defaultValues)||At(e.values)?Mt(e.defaultValues||e.values)||{}:{},i=e.shouldUnregister?{}:Mt(o),s={action:!1,mount:!1,watch:!1,keepIsValid:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l,c=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={...u};let f={...d};const h={array:eC(),state:eC()},p=e.criteriaMode===cr.all,g=N=>P=>{clearTimeout(c),c=setTimeout(N,P)},b=async N=>{if(!s.keepIsValid&&!e.disabled&&(d.isValid||f.isValid||N)){let P;e.resolver?(P=on((await j()).errors),E()):P=await I(r,!0),P!==n.isValid&&h.state.next({isValid:P})}},E=(N,P)=>{!e.disabled&&(d.isValidating||d.validatingFields||f.isValidating||f.validatingFields)&&((N||Array.from(a.mount)).forEach($=>{$&&(P?ct(n.validatingFields,$,P):Tt(n.validatingFields,$))}),h.state.next({validatingFields:n.validatingFields,isValidating:!on(n.validatingFields)}))},x=(N,P=[],$,re,te=!0,M=!0)=>{if(re&&$&&!e.disabled){if(s.action=!0,M&&Array.isArray(ce(r,N))){const H=$(ce(r,N),re.argA,re.argB);te&&ct(r,N,H)}if(M&&Array.isArray(ce(n.errors,N))){const H=$(ce(n.errors,N),re.argA,re.argB);te&&ct(n.errors,N,H),Eee(n.errors,N)}if((d.touchedFields||f.touchedFields)&&M&&Array.isArray(ce(n.touchedFields,N))){const H=$(ce(n.touchedFields,N),re.argA,re.argB);te&&ct(n.touchedFields,N,H)}(d.dirtyFields||f.dirtyFields)&&(n.dirtyFields=as(o,i)),h.state.next({name:N,isDirty:F(N,P),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else ct(i,N,P)},T=(N,P)=>{ct(n.errors,N,P),h.state.next({errors:n.errors})},D=N=>{n.errors=N,h.state.next({errors:n.errors,isValid:!1})},O=(N,P,$,re)=>{const te=ce(r,N);if(te){const M=ce(i,N,ht($)?ce(o,N):$);ht(M)||re&&re.defaultChecked||P?ct(i,N,P?M:oC(te._f)):q(N,M),s.mount&&!s.action&&b()}},v=(N,P,$,re,te)=>{let M=!1,H=!1;const ne={name:N};if(!e.disabled){if(!$||re){(d.isDirty||f.isDirty)&&(H=n.isDirty,n.isDirty=ne.isDirty=F(),M=H!==ne.isDirty);const se=Io(ce(o,N),P);H=!!ce(n.dirtyFields,N),se?Tt(n.dirtyFields,N):ct(n.dirtyFields,N,!0),ne.dirtyFields=n.dirtyFields,M=M||(d.dirtyFields||f.dirtyFields)&&H!==!se}if($){const se=ce(n.touchedFields,N);se||(ct(n.touchedFields,N,$),ne.touchedFields=n.touchedFields,M=M||(d.touchedFields||f.touchedFields)&&se!==$)}M&&te&&h.state.next(ne)}return M?ne:{}},R=(N,P,$,re)=>{const te=ce(n.errors,N),M=(d.isValid||f.isValid)&&Nr(P)&&n.isValid!==P;if(e.delayError&&$?(l=g(()=>T(N,$)),l(e.delayError)):(clearTimeout(c),l=null,$?ct(n.errors,N,$):Tt(n.errors,N)),($?!Io(te,$):te)||!on(re)||M){const H={...re,...M&&Nr(P)?{isValid:P}:{},errors:n.errors,name:N};n={...n,...H},h.state.next(H)}},j=async N=>(E(N,!0),await e.resolver(i,e.context,hee(N||a.mount,r,e.criteriaMode,e.shouldUseNativeValidation))),z=async N=>{const{errors:P}=await j(N);if(E(N),N)for(const $ of N){const re=ce(P,$);re?ct(n.errors,$,re):Tt(n.errors,$)}else n.errors=P;return P},I=async(N,P,$={valid:!0})=>{for(const re in N){const te=N[re];if(te){const{_f:M,...H}=te;if(M){const ne=a.array.has(M.name),se=te._f&&pee(te._f);se&&d.validatingFields&&E([M.name],!0);const xe=await uC(te,a.disabled,i,p,e.shouldUseNativeValidation&&!P,ne);if(se&&d.validatingFields&&E([M.name]),xe[M.name]&&($.valid=!1,P||t.shouldUseNativeValidation))break;!P&&(ce(xe,M.name)?ne?xee(n.errors,xe,M.name):ct(n.errors,M.name,xe[M.name]):Tt(n.errors,M.name))}!on(H)&&await I(H,P,$)}}return $.valid},X=()=>{for(const N of a.unMount){const P=ce(r,N);P&&(P._f.refs?P._f.refs.every($=>!ep($)):!ep(P._f.ref))&&$e(N)}a.unMount=new Set},F=(N,P)=>!e.disabled&&(N&&P&&ct(i,N,P),!Io(Ee(),o)),W=(N,P,$)=>see(N,a,{...s.mount?i:ht(P)?o:Rn(N)?{[N]:P}:P},$,P),B=N=>i1(ce(s.mount?i:o,N,e.shouldUnregister?ce(o,N,[]):[])),q=(N,P,$={})=>{const re=ce(r,N);let te=P;if(re){const M=re._f;M&&(!M.disabled&&ct(i,N,B_(P,M)),te=xd(M.ref)&&yn(P)?"":P,L_(M.ref)?[...M.ref.options].forEach(H=>H.selected=te.includes(H.value)):M.refs?Yl(M.ref)?M.refs.forEach(H=>{(!H.defaultChecked||!H.disabled)&&(Array.isArray(te)?H.checked=!!te.find(ne=>ne===H.value):H.checked=te===H.value||!!te)}):M.refs.forEach(H=>H.checked=H.value===te):a1(M.ref)?M.ref.value="":(M.ref.value=te,M.ref.type||h.state.next({name:N,values:Mt(i)})))}($.shouldDirty||$.shouldTouch)&&v(N,te,$.shouldTouch,$.shouldDirty,!0),$.shouldValidate&&S(N)},oe=(N,P,$)=>{for(const re in P){if(!P.hasOwnProperty(re))return;const te=P[re],M=N+"."+re,H=ce(r,M);(a.array.has(N)||At(te)||H&&!H._f)&&!hi(te)?oe(M,te,$):q(M,te,$)}},Z=(N,P,$={})=>{const re=ce(r,N),te=a.array.has(N),M=Mt(P);ct(i,N,M),te?(h.array.next({name:N,values:Mt(i)}),(d.isDirty||d.dirtyFields||f.isDirty||f.dirtyFields)&&$.shouldDirty&&h.state.next({name:N,dirtyFields:as(o,i),isDirty:F(N,M)})):re&&!re._f&&!yn(M)?oe(N,M,$):q(N,M,$),aC(N,a)?h.state.next({...n,name:N,values:Mt(i)}):h.state.next({name:s.mount?N:void 0,values:Mt(i)})},ee=async N=>{s.mount=!0;const P=N.target;let $=P.name,re=!0;const te=ce(r,$),M=se=>{re=Number.isNaN(se)||hi(se)&&isNaN(se.getTime())||Io(se,ce(i,$,se))},H=iC(e.mode),ne=iC(e.reValidateMode);if(te){let se,xe;const It=P.type?oC(te._f):eee(N),Kt=N.type===Jx.BLUR||N.type===Jx.FOCUS_OUT,or=!mee(te._f)&&!e.resolver&&!ce(n.errors,$)&&!te._f.deps||yee(Kt,ce(n.touchedFields,$),n.isSubmitted,ne,H),qr=aC($,a,Kt);ct(i,$,It),Kt?(!P||!P.readOnly)&&(te._f.onBlur&&te._f.onBlur(N),l&&l(0)):te._f.onChange&&te._f.onChange(N);const Wr=v($,It,Kt),rn=!on(Wr)||qr;if(!Kt&&h.state.next({name:$,type:N.type,values:Mt(i)}),or)return(d.isValid||f.isValid)&&(e.mode==="onBlur"?Kt&&b():Kt||b()),rn&&h.state.next({name:$,...qr?{}:Wr});if(!Kt&&qr&&h.state.next({...n}),e.resolver){const{errors:Gr}=await j([$]);if(E([$]),M(It),re){const ir=lC(n.errors,r,$),f1=lC(Gr,r,ir.name||$);se=f1.error,$=f1.name,xe=on(Gr)}}else E([$],!0),se=(await uC(te,a.disabled,i,p,e.shouldUseNativeValidation))[$],E([$]),M(It),re&&(se?xe=!1:(d.isValid||f.isValid)&&(xe=await I(r,!0)));re&&(te._f.deps&&(!Array.isArray(te._f.deps)||te._f.deps.length>0)&&S(te._f.deps),R($,xe,se,Wr))}},ie=(N,P)=>{if(ce(n.errors,P)&&N.focus)return N.focus(),1},S=async(N,P={})=>{let $,re;const te=Ga(N);if(e.resolver){const M=await z(ht(N)?N:te);$=on(M),re=N?!te.some(H=>ce(M,H)):$}else N?(re=(await Promise.all(te.map(async M=>{const H=ce(r,M);return await I(H&&H._f?{[M]:H}:H)}))).every(Boolean),!(!re&&!n.isValid)&&b()):re=$=await I(r);return h.state.next({...!Rn(N)||(d.isValid||f.isValid)&&$!==n.isValid?{}:{name:N},...e.resolver||!N?{isValid:$}:{},errors:n.errors}),P.shouldFocus&&!re&&Ya(r,ie,N?te:a.mount),re},Ee=(N,P)=>{let $={...s.mount?i:o};return P&&($=D_(P.dirtyFields?n.dirtyFields:n.touchedFields,$)),ht(N)?$:Rn(N)?ce($,N):N.map(re=>ce($,re))},be=(N,P)=>({invalid:!!ce((P||n).errors,N),isDirty:!!ce((P||n).dirtyFields,N),error:ce((P||n).errors,N),isValidating:!!ce(n.validatingFields,N),isTouched:!!ce((P||n).touchedFields,N)}),_=N=>{N&&Ga(N).forEach(P=>Tt(n.errors,P)),h.state.next({errors:N?n.errors:{}})},ft=(N,P,$)=>{const re=(ce(r,N,{_f:{}})._f||{}).ref,te=ce(n.errors,N)||{},{ref:M,message:H,type:ne,...se}=te;ct(n.errors,N,{...se,...P,ref:re}),h.state.next({name:N,errors:n.errors,isValid:!1}),$&&$.shouldFocus&&re&&re.focus&&re.focus()},Ue=(N,P)=>lr(N)?h.state.subscribe({next:$=>"values"in $&&N(W(void 0,P),$)}):W(N,P,!0),Ve=N=>h.state.subscribe({next:P=>{bee(N.name,P.name,N.exact)&&gee(P,N.formState||d,Tf,N.reRenderRoot)&&N.callback({values:{...i},...n,...P,defaultValues:o})}}).unsubscribe,Lt=N=>(s.mount=!0,f={...f,...N.formState},Ve({...N,formState:{...u,...N.formState}})),$e=(N,P={})=>{for(const $ of N?Ga(N):a.mount)a.mount.delete($),a.array.delete($),P.keepValue||(Tt(r,$),Tt(i,$)),!P.keepError&&Tt(n.errors,$),!P.keepDirty&&Tt(n.dirtyFields,$),!P.keepTouched&&Tt(n.touchedFields,$),!P.keepIsValidating&&Tt(n.validatingFields,$),!e.shouldUnregister&&!P.keepDefaultValue&&Tt(o,$);h.state.next({values:Mt(i)}),h.state.next({...n,...P.keepDirty?{isDirty:F()}:{}}),!P.keepIsValid&&b()},Ye=({disabled:N,name:P})=>{if(Nr(N)&&s.mount||N||a.disabled.has(P)){const te=a.disabled.has(P)!==!!N;N?a.disabled.add(P):a.disabled.delete(P),te&&s.mount&&!s.action&&b()}},xt=(N,P={})=>{let $=ce(r,N);const re=Nr(P.disabled)||Nr(e.disabled);return ct(r,N,{...$||{},_f:{...$&&$._f?$._f:{ref:{name:N}},name:N,mount:!0,...P}}),a.mount.add(N),$?Ye({disabled:Nr(P.disabled)?P.disabled:e.disabled,name:N}):O(N,!0,P.value),{...re?{disabled:P.disabled||e.disabled}:{},...e.progressive?{required:!!P.required,min:ma(P.min),max:ma(P.max),minLength:ma(P.minLength),maxLength:ma(P.maxLength),pattern:ma(P.pattern)}:{},name:N,onChange:ee,onBlur:ee,ref:te=>{if(te){xt(N,P),$=ce(r,N);const M=ht(te.value)&&te.querySelectorAll&&te.querySelectorAll("input,select,textarea")[0]||te,H=cee(M),ne=$._f.refs||[];if(H?ne.find(se=>se===M):M===$._f.ref)return;ct(r,N,{_f:{...$._f,...H?{refs:[...ne.filter(ep),M,...Array.isArray(ce(o,N))?[{}]:[]],ref:{type:M.type,name:N}}:{ref:M}}}),O(N,!1,void 0,M)}else $=ce(r,N,{}),$._f&&($._f.mount=!1),(e.shouldUnregister||P.shouldUnregister)&&!(nee(a.array,N)&&s.action)&&a.unMount.add(N)}}},Rt=()=>e.shouldFocusError&&Ya(r,ie,a.mount),Vn=N=>{Nr(N)&&(h.state.next({disabled:N}),Ya(r,(P,$)=>{const re=ce(r,$);re&&(P.disabled=re._f.disabled||N,Array.isArray(re._f.refs)&&re._f.refs.forEach(te=>{te.disabled=re._f.disabled||N}))},0,!1))},Gi=(N,P)=>async $=>{let re;$&&($.preventDefault&&$.preventDefault(),$.persist&&$.persist());let te=Mt(i);if(h.state.next({isSubmitting:!0}),e.resolver){const{errors:M,values:H}=await j();E(),n.errors=M,te=Mt(H)}else await I(r);if(a.disabled.size)for(const M of a.disabled)Tt(te,M);if(Tt(n.errors,"root"),on(n.errors)){h.state.next({errors:{}});try{await N(te,$)}catch(M){re=M}}else P&&await P({...n.errors},$),Rt(),setTimeout(Rt);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:on(n.errors)&&!re,submitCount:n.submitCount+1,errors:n.errors}),re)throw re},ta=(N,P={})=>{ce(r,N)&&(ht(P.defaultValue)?Z(N,Mt(ce(o,N))):(Z(N,P.defaultValue),ct(o,N,Mt(P.defaultValue))),P.keepTouched||Tt(n.touchedFields,N),P.keepDirty||(Tt(n.dirtyFields,N),n.isDirty=P.defaultValue?F(N,Mt(ce(o,N))):F()),P.keepError||(Tt(n.errors,N),d.isValid&&b()),h.state.next({...n}))},na=(N,P={})=>{const $=N?Mt(N):o,re=Mt($),te=on(N),M=te?o:re;if(P.keepDefaultValues||(o=$),!P.keepValues){if(P.keepDirtyValues){const H=new Set([...a.mount,...Object.keys(as(o,i))]);for(const ne of Array.from(H)){const se=ce(n.dirtyFields,ne),xe=ce(i,ne),It=ce(M,ne);se&&!ht(xe)?ct(M,ne,xe):!se&&!ht(It)&&Z(ne,It)}}else{if(o1&&ht(N))for(const H of a.mount){const ne=ce(r,H);if(ne&&ne._f){const se=Array.isArray(ne._f.refs)?ne._f.refs[0]:ne._f.ref;if(xd(se)){const xe=se.closest("form");if(xe){xe.reset();break}}}}if(P.keepFieldsRef)for(const H of a.mount)Z(H,ce(M,H));else r={}}i=e.shouldUnregister?P.keepDefaultValues?Mt(o):{}:Mt(M),h.array.next({values:{...M}}),h.state.next({values:{...M}})}a={mount:P.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!d.isValid||!!P.keepIsValid||!!P.keepDirtyValues||!e.shouldUnregister&&!on(M),s.watch=!!e.shouldUnregister,s.keepIsValid=!!P.keepIsValid,s.action=!1,P.keepErrors||(n.errors={}),h.state.next({submitCount:P.keepSubmitCount?n.submitCount:0,isDirty:te?!1:P.keepDirty?n.isDirty:!!(P.keepDefaultValues&&!Io(N,o)),isSubmitted:P.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:te?{}:P.keepDirtyValues?P.keepDefaultValues&&i?as(o,i):n.dirtyFields:P.keepDefaultValues&&N?as(o,N):P.keepDirty?n.dirtyFields:{},touchedFields:P.keepTouched?n.touchedFields:{},errors:P.keepErrors?n.errors:{},isSubmitSuccessful:P.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},ra=(N,P)=>na(lr(N)?N(i):N,{...e.resetOptions,...P}),Kl=(N,P={})=>{const $=ce(r,N),re=$&&$._f;if(re){const te=re.refs?re.refs[0]:re.ref;te.focus&&setTimeout(()=>{te.focus(),P.shouldSelect&&lr(te.select)&&te.select()})}},Tf=N=>{n={...n,...N}},oa={control:{register:xt,unregister:$e,getFieldState:be,handleSubmit:Gi,setError:ft,_subscribe:Ve,_runSchema:j,_updateIsValidating:E,_focusError:Rt,_getWatch:W,_getDirty:F,_setValid:b,_setFieldArray:x,_setDisabledField:Ye,_setErrors:D,_getFieldArray:B,_reset:na,_resetDefaultValues:()=>lr(e.defaultValues)&&e.defaultValues().then(N=>{ra(N,e.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:X,_disableForm:Vn,_subjects:h,_proxyFormState:d,get _fields(){return r},get _formValues(){return i},get _state(){return s},set _state(N){s=N},get _defaultValues(){return o},get _names(){return a},set _names(N){a=N},get _formState(){return n},get _options(){return e},set _options(N){e={...e,...N}}},subscribe:Lt,trigger:S,register:xt,handleSubmit:Gi,watch:Ue,setValue:Z,getValues:Ee,reset:ra,resetField:ta,clearErrors:_,unregister:$e,setError:ft,setFocus:Kl,getFieldState:be};return{...oa,formControl:oa}}function Tee(t={}){const e=Ie.useRef(void 0),n=Ie.useRef(void 0),[r,o]=Ie.useState({isDirty:!1,isValidating:!1,isLoading:lr(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:lr(t.defaultValues)?void 0:t.defaultValues});if(!e.current)if(t.formControl)e.current={...t.formControl,formState:r},t.defaultValues&&!lr(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:s,...a}=kee(t);e.current={...a,formState:r}}const i=e.current.control;return i._options=t,iee(()=>{const s=i._subscribe({formState:i._proxyFormState,callback:()=>o({...i._formState}),reRenderRoot:!0});return o(a=>({...a,isReady:!0})),i._formState.isReady=!0,s},[i]),Ie.useEffect(()=>i._disableForm(t.disabled),[i,t.disabled]),Ie.useEffect(()=>{t.mode&&(i._options.mode=t.mode),t.reValidateMode&&(i._options.reValidateMode=t.reValidateMode)},[i,t.mode,t.reValidateMode]),Ie.useEffect(()=>{t.errors&&(i._setErrors(t.errors),i._focusError())},[i,t.errors]),Ie.useEffect(()=>{t.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,t.shouldUnregister]),Ie.useEffect(()=>{if(i._proxyFormState.isDirty){const s=i._getDirty();s!==r.isDirty&&i._subjects.state.next({isDirty:s})}},[i,r.isDirty]),Ie.useEffect(()=>{var s;t.values&&!Io(t.values,n.current)?(i._reset(t.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((s=i._options.resetOptions)===null||s===void 0)&&s.keepIsValid||i._setValid(),n.current=t.values,o(a=>({...a}))):i._resetDefaultValues()},[i,t.values]),Ie.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),e.current.formState=Ie.useMemo(()=>oee(r,i),[i,r]),e.current}function wee(t,e=[]){let n=[];function r(i,s){const a=C.createContext(s);a.displayName=i+"Context";const l=n.length;n=[...n,s];const c=d=>{const{scope:f,children:h,...p}=d,g=f?.[t]?.[l]||a,b=C.useMemo(()=>p,Object.values(p));return y.jsx(g.Provider,{value:b,children:h})};c.displayName=i+"Provider";function u(d,f){const h=f?.[t]?.[l]||a,p=C.useContext(h);if(p)return p;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(s=>C.createContext(s));return function(a){const l=a?.[t]||i;return C.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return o.scopeName=t,[r,See(o,...e)]}function See(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return C.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var c1="Avatar",[vee]=wee(c1),[Aee,H_]=vee(c1),U_=C.forwardRef((t,e)=>{const{__scopeAvatar:n,...r}=t,[o,i]=C.useState("idle");return y.jsx(Aee,{scope:n,imageLoadingStatus:o,onImageLoadingStatusChange:i,children:y.jsx(kd.span,{...r,ref:e})})});U_.displayName=c1;var V_="AvatarImage",$_=C.forwardRef((t,e)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:o=()=>{},...i}=t,s=H_(V_,n),a=_ee(r,i),l=E3(c=>{o(c),s.onImageLoadingStatusChange(c)});return ip(()=>{a!=="idle"&&l(a)},[a,l]),a==="loaded"?y.jsx(kd.img,{...i,ref:e,src:r}):null});$_.displayName=V_;var j_="AvatarFallback",z_=C.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:r,...o}=t,i=H_(j_,n),[s,a]=C.useState(r===void 0);return C.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>a(!0),r);return()=>window.clearTimeout(l)}},[r]),s&&i.imageLoadingStatus!=="loaded"?y.jsx(kd.span,{...o,ref:e}):null});z_.displayName=j_;function dC(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function _ee(t,{referrerPolicy:e,crossOrigin:n}){const r=x3(),o=C.useRef(null),i=r?(o.current||(o.current=new window.Image),o.current):null,[s,a]=C.useState(()=>dC(i,t));return ip(()=>{a(dC(i,t))},[i,t]),ip(()=>{const l=d=>()=>{a(d)};if(!i)return;const c=l("loaded"),u=l("error");return i.addEventListener("load",c),i.addEventListener("error",u),e&&(i.referrerPolicy=e),typeof n=="string"&&(i.crossOrigin=n),()=>{i.removeEventListener("load",c),i.removeEventListener("error",u)}},[i,n,e]),s}var Nee=U_,Iee=$_,Mee=z_;const u1="-",Oee=t=>{const e=Lee(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:s=>{const a=s.split(u1);return a[0]===""&&a.length!==1&&a.shift(),q_(a,e)||Dee(s)},getConflictingClassGroupIds:(s,a)=>{const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}}},q_=(t,e)=>{if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),o=r?q_(t.slice(1),r):void 0;if(o)return o;if(e.validators.length===0)return;const i=t.join(u1);return e.validators.find(({validator:s})=>s(i))?.classGroupId},fC=/^\[(.+)\]$/,Dee=t=>{if(fC.test(t)){const e=fC.exec(t)[1],n=e?.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},Lee=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return Pee(Object.entries(t.classGroups),n).forEach(([i,s])=>{Um(s,r,i,e)}),r},Um=(t,e,n,r)=>{t.forEach(o=>{if(typeof o=="string"){const i=o===""?e:hC(e,o);i.classGroupId=n;return}if(typeof o=="function"){if(Ree(o)){Um(o(r),e,n,r);return}e.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,s])=>{Um(s,hC(e,i),n,r)})})},hC=(t,e)=>{let n=t;return e.split(u1).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},Ree=t=>t.isThemeGetter,Pee=(t,e)=>e?t.map(([n,r])=>{const o=r.map(i=>typeof i=="string"?e+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([s,a])=>[e+s,a])):i);return[n,o]}):t,Bee=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const o=(i,s)=>{n.set(i,s),e++,e>t&&(e=0,r=n,n=new Map)};return{get(i){let s=n.get(i);if(s!==void 0)return s;if((s=r.get(i))!==void 0)return o(i,s),s},set(i,s){n.has(i)?n.set(i,s):o(i,s)}}},W_="!",Fee=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,o=e[0],i=e.length,s=a=>{const l=[];let c=0,u=0,d;for(let b=0;b<a.length;b++){let E=a[b];if(c===0){if(E===o&&(r||a.slice(b,b+i)===e)){l.push(a.slice(u,b)),u=b+i;continue}if(E==="/"){d=b;continue}}E==="["?c++:E==="]"&&c--}const f=l.length===0?a:a.substring(u),h=f.startsWith(W_),p=h?f.substring(1):f,g=d&&d>u?d-u:void 0;return{modifiers:l,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:g}};return n?a=>n({className:a,parseClassName:s}):s},Hee=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},Uee=t=>({cache:Bee(t.cacheSize),parseClassName:Fee(t),...Oee(t)}),Vee=/\s+/,$ee=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=e,i=[],s=t.trim().split(Vee);let a="";for(let l=s.length-1;l>=0;l-=1){const c=s[l],{modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:h}=n(c);let p=!!h,g=r(p?f.substring(0,h):f);if(!g){if(!p){a=c+(a.length>0?" "+a:a);continue}if(g=r(f),!g){a=c+(a.length>0?" "+a:a);continue}p=!1}const b=Hee(u).join(":"),E=d?b+W_:b,x=E+g;if(i.includes(x))continue;i.push(x);const T=o(g,p);for(let D=0;D<T.length;++D){const O=T[D];i.push(E+O)}a=c+(a.length>0?" "+a:a)}return a};function jee(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=G_(e))&&(r&&(r+=" "),r+=n);return r}const G_=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=G_(t[r]))&&(n&&(n+=" "),n+=e);return n};function zee(t,...e){let n,r,o,i=s;function s(l){const c=e.reduce((u,d)=>d(u),t());return n=Uee(c),r=n.cache.get,o=n.cache.set,i=a,a(l)}function a(l){const c=r(l);if(c)return c;const u=$ee(l,n);return o(l,u),u}return function(){return i(jee.apply(null,arguments))}}const it=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},Y_=/^\[(?:([a-z-]+):)?(.+)\]$/i,qee=/^\d+\/\d+$/,Wee=new Set(["px","full","screen"]),Gee=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Yee=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Kee=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Qee=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Xee=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,eo=t=>ws(t)||Wee.has(t)||qee.test(t),yo=t=>ea(t,"length",ite),ws=t=>!!t&&!Number.isNaN(Number(t)),tp=t=>ea(t,"number",ws),ga=t=>!!t&&Number.isInteger(Number(t)),Zee=t=>t.endsWith("%")&&ws(t.slice(0,-1)),Te=t=>Y_.test(t),Eo=t=>Gee.test(t),Jee=new Set(["length","size","percentage"]),ete=t=>ea(t,Jee,K_),tte=t=>ea(t,"position",K_),nte=new Set(["image","url"]),rte=t=>ea(t,nte,ate),ote=t=>ea(t,"",ste),ba=()=>!0,ea=(t,e,n)=>{const r=Y_.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},ite=t=>Yee.test(t)&&!Kee.test(t),K_=()=>!1,ste=t=>Qee.test(t),ate=t=>Xee.test(t),lte=()=>{const t=it("colors"),e=it("spacing"),n=it("blur"),r=it("brightness"),o=it("borderColor"),i=it("borderRadius"),s=it("borderSpacing"),a=it("borderWidth"),l=it("contrast"),c=it("grayscale"),u=it("hueRotate"),d=it("invert"),f=it("gap"),h=it("gradientColorStops"),p=it("gradientColorStopPositions"),g=it("inset"),b=it("margin"),E=it("opacity"),x=it("padding"),T=it("saturate"),D=it("scale"),O=it("sepia"),v=it("skew"),R=it("space"),j=it("translate"),z=()=>["auto","contain","none"],I=()=>["auto","hidden","clip","visible","scroll"],X=()=>["auto",Te,e],F=()=>[Te,e],W=()=>["",eo,yo],B=()=>["auto",ws,Te],q=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],oe=()=>["solid","dashed","dotted","double","none"],Z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ee=()=>["start","end","center","between","around","evenly","stretch"],ie=()=>["","0",Te],S=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Ee=()=>[ws,Te];return{cacheSize:500,separator:":",theme:{colors:[ba],spacing:[eo,yo],blur:["none","",Eo,Te],brightness:Ee(),borderColor:[t],borderRadius:["none","","full",Eo,Te],borderSpacing:F(),borderWidth:W(),contrast:Ee(),grayscale:ie(),hueRotate:Ee(),invert:ie(),gap:F(),gradientColorStops:[t],gradientColorStopPositions:[Zee,yo],inset:X(),margin:X(),opacity:Ee(),padding:F(),saturate:Ee(),scale:Ee(),sepia:ie(),skew:Ee(),space:F(),translate:F()},classGroups:{aspect:[{aspect:["auto","square","video",Te]}],container:["container"],columns:[{columns:[Eo]}],"break-after":[{"break-after":S()}],"break-before":[{"break-before":S()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...q(),Te]}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ga,Te]}],basis:[{basis:X()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Te]}],grow:[{grow:ie()}],shrink:[{shrink:ie()}],order:[{order:["first","last","none",ga,Te]}],"grid-cols":[{"grid-cols":[ba]}],"col-start-end":[{col:["auto",{span:["full",ga,Te]},Te]}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":[ba]}],"row-start-end":[{row:["auto",{span:[ga,Te]},Te]}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Te]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Te]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...ee()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ee(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ee(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[R]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[R]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Te,e]}],"min-w":[{"min-w":[Te,e,"min","max","fit"]}],"max-w":[{"max-w":[Te,e,"none","full","min","max","fit","prose",{screen:[Eo]},Eo]}],h:[{h:[Te,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Te,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Te,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Te,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Eo,yo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",tp]}],"font-family":[{font:[ba]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Te]}],"line-clamp":[{"line-clamp":["none",ws,tp]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",eo,Te]}],"list-image":[{"list-image":["none",Te]}],"list-style-type":[{list:["none","disc","decimal",Te]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[E]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[E]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",eo,yo]}],"underline-offset":[{"underline-offset":["auto",eo,Te]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:F()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Te]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Te]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[E]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...q(),tte]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",ete]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},rte]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[E]}],"border-style":[{border:[...oe(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[E]}],"divide-style":[{divide:oe()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...oe()]}],"outline-offset":[{"outline-offset":[eo,Te]}],"outline-w":[{outline:[eo,yo]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[E]}],"ring-offset-w":[{"ring-offset":[eo,yo]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Eo,ote]}],"shadow-color":[{shadow:[ba]}],opacity:[{opacity:[E]}],"mix-blend":[{"mix-blend":[...Z(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Z()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Eo,Te]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[T]}],sepia:[{sepia:[O]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[E]}],"backdrop-saturate":[{"backdrop-saturate":[T]}],"backdrop-sepia":[{"backdrop-sepia":[O]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Te]}],duration:[{duration:Ee()}],ease:[{ease:["linear","in","out","in-out",Te]}],delay:[{delay:Ee()}],animate:[{animate:["none","spin","ping","pulse","bounce",Te]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[D]}],"scale-x":[{"scale-x":[D]}],"scale-y":[{"scale-y":[D]}],rotate:[{rotate:[ga,Te]}],"translate-x":[{"translate-x":[j]}],"translate-y":[{"translate-y":[j]}],"skew-x":[{"skew-x":[v]}],"skew-y":[{"skew-y":[v]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Te]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Te]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-ms":[{"scroll-ms":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-pe":[{"scroll-pe":F()}],"scroll-pt":[{"scroll-pt":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Te]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[eo,yo,tp]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},cte=zee(lte);const ute=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),dte=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),pC=t=>{const e=dte(t);return e.charAt(0).toUpperCase()+e.slice(1)},Q_=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),fte=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var hte={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const pte=C.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:s,...a},l)=>C.createElement("svg",{ref:l,...hte,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:Q_("lucide",o),...!i&&!fte(a)&&{"aria-hidden":"true"},...a},[...s.map(([c,u])=>C.createElement(c,u)),...Array.isArray(i)?i:[i]]));const kf=(t,e)=>{const n=C.forwardRef(({className:r,...o},i)=>C.createElement(pte,{ref:i,iconNode:e,className:Q_(`lucide-${ute(pC(t))}`,`lucide-${t}`,r),...o}));return n.displayName=pC(t),n};const mte=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],X_=kf("check",mte);const gte=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Z_=kf("chevron-down",gte);const bte=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],J_=kf("chevron-right",bte);const yte=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Ete=kf("chevron-up",yte);var xte="Label",e3=C.forwardRef((t,e)=>y.jsx(kd.label,{...t,ref:e,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(t.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));e3.displayName=xte;var Cte=e3;function ue(...t){return cte(a3(t))}function kte({className:t,...e}){return y.jsx(Nee,{"data-slot":"avatar",className:ue("relative flex size-8 shrink-0 overflow-hidden rounded-full",t),...e})}function Tte({className:t,...e}){return y.jsx(Iee,{"data-slot":"avatar-image",className:ue("aspect-square size-full",t),...e})}function wte({className:t,...e}){return y.jsx(Mee,{"data-slot":"avatar-fallback",className:ue("bg-muted flex size-full items-center justify-center rounded-full",t),...e})}const Ste=Vm("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function vte({className:t,variant:e,asChild:n=!1,...r}){return y.jsx(n?_C:"span",{"data-slot":"badge",className:ue(Ste({variant:e}),t),...r})}const Ate=Vm("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function _te({className:t,variant:e,size:n,asChild:r=!1,...o}){return y.jsx(r?_C:"button",{"data-slot":"button",className:ue(Ate({variant:e,size:n,className:t})),...o})}function Nte({className:t,...e}){return y.jsx("div",{"data-slot":"card",className:ue("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...e})}function Ite({className:t,...e}){return y.jsx("div",{"data-slot":"card-content",className:ue("px-6",t),...e})}function Mte({...t}){return y.jsx(J3,{"data-slot":"dropdown-menu",...t})}function Ote({...t}){return y.jsx(j3,{"data-slot":"dropdown-menu-trigger",...t})}function Dte({className:t,sideOffset:e=4,...n}){return y.jsx(Q3,{"data-slot":"dropdown-menu-content",sideOffset:e,className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md",t),...n})}function Lte({className:t,inset:e,variant:n="default",...r}){return y.jsx(K3,{"data-slot":"dropdown-menu-item","data-inset":e,"data-variant":n,className:ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...r})}function Rte({className:t,children:e,checked:n,...r}){return y.jsxs(X3,{"data-slot":"dropdown-menu-checkbox-item",className:ue("focus:bg-accent focus:text-accent-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-8 pr-2 text-sm data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),checked:n,...r,children:[y.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:y.jsx(Z3,{children:y.jsx(X_,{className:"size-4"})})}),e]})}function Pte({className:t,inset:e,...n}){return y.jsx(Y3,{"data-slot":"dropdown-menu-label","data-inset":e,className:ue("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t),...n})}function Bte({className:t,...e}){return y.jsx(G3,{"data-slot":"dropdown-menu-separator",className:ue("bg-border -mx-1 my-1 h-px",t),...e})}function Fte({...t}){return y.jsx(W3,{"data-slot":"dropdown-menu-sub",...t})}function Hte({className:t,inset:e,children:n,...r}){return y.jsxs(z3,{"data-slot":"dropdown-menu-sub-trigger","data-inset":e,className:ue("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground outline-hidden flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm data-[inset]:pl-8",t),...r,children:[n,y.jsx(J_,{className:"ml-auto size-4"})]})}function Ute({className:t,...e}){return y.jsx(q3,{"data-slot":"dropdown-menu-sub-content",className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-lg",t),...e})}function Vte({className:t,...e}){return y.jsx(Cte,{"data-slot":"label",className:ue("flex select-none items-center gap-2 text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50 group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50",t),...e})}const $te=aee;C.createContext({});C.createContext({});function jte({className:t,type:e,...n}){return y.jsx("input",{type:e,"data-slot":"input",className:ue("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input shadow-xs flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base outline-none transition-[color,box-shadow] file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...n})}function zte({...t}){return y.jsx($3,{"data-slot":"popover",...t})}function qte({...t}){return y.jsx(U3,{"data-slot":"popover-trigger",...t})}function Wte({className:t,align:e="center",sideOffset:n=4,...r}){return y.jsx(V3,{"data-slot":"popover-content",align:e,sideOffset:n,className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-popover-content-transform-origin) outline-hidden z-50 w-72 rounded-md border p-4 shadow-md",t),...r})}function Gte({...t}){return y.jsx(H3,{"data-slot":"select",...t})}function Yte({...t}){return y.jsx(M3,{"data-slot":"select-value",...t})}function Kte({className:t,size:e="default",children:n,...r}){return y.jsxs(O3,{"data-slot":"select-trigger","data-size":e,className:ue("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*=text-])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 shadow-xs flex w-fit items-center justify-between gap-2 whitespace-nowrap rounded-md border bg-transparent px-3 py-2 text-sm outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...r,children:[n,y.jsx(D3,{asChild:!0,children:y.jsx(Z_,{className:"size-4 opacity-50"})})]})}function Qte({className:t,children:e,position:n="popper",...r}){return y.jsxs(B3,{"data-slot":"select-content",className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-(--radix-select-content-available-height) origin-(--radix-select-content-transform-origin) relative z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[y.jsx(Zte,{}),y.jsx(F3,{className:ue("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:e}),y.jsx(Jte,{})]})}function Xte({className:t,children:e,...n}){return y.jsxs(L3,{"data-slot":"select-item",className:ue("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-2 pr-8 text-sm data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...n,children:[y.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:y.jsx(R3,{children:y.jsx(X_,{className:"size-4"})})}),y.jsx(P3,{children:e})]})}function Zte({className:t,...e}){return y.jsx(eN,{"data-slot":"select-scroll-up-button",className:ue("flex cursor-default items-center justify-center py-1",t),...e,children:y.jsx(Ete,{className:"size-4"})})}function Jte({className:t,...e}){return y.jsx(tN,{"data-slot":"select-scroll-down-button",className:ue("flex cursor-default items-center justify-center py-1",t),...e,children:y.jsx(Z_,{className:"size-4"})})}function ene({className:t,...e}){return y.jsx("div",{"data-slot":"skeleton",className:ue("bg-accent animate-pulse rounded-md",t),...e})}function tne({className:t,...e}){return y.jsx(I3,{"data-slot":"tabs",className:ue("flex flex-col gap-2",t),...e})}function nne({className:t,...e}){return y.jsx(_3,{"data-slot":"tabs-list",className:ue("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",t),...e})}function rne({className:t,...e}){return y.jsx(A3,{"data-slot":"tabs-trigger",className:ue("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-md border border-transparent px-2 py-1 text-sm font-medium transition-[color,box-shadow] focus-visible:outline-1 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...e})}function one({className:t,...e}){return y.jsx(N3,{"data-slot":"tabs-content",className:ue("flex-1 outline-none",t),...e})}const ine=Vm("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}});function sne({className:t,variant:e,size:n,...r}){return y.jsx(v3,{"data-slot":"toggle",className:ue(ine({variant:e,size:n,className:t})),...r})}function t3({delayDuration:t=0,...e}){return y.jsx(k3,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function ane({...t}){return y.jsx(t3,{children:y.jsx(S3,{"data-slot":"tooltip",...t})})}function lne({...t}){return y.jsx(C3,{"data-slot":"tooltip-trigger",...t})}function cne({className:t,sideOffset:e=0,children:n,...r}){return y.jsxs(T3,{"data-slot":"tooltip-content",sideOffset:e,className:ue("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-tooltip-content-transform-origin) z-50 w-fit text-balance rounded-md px-3 py-1.5 text-xs",t),...r,children:[n,y.jsx(w3,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})}const une={Avatar:{Avatar:kte,AvatarFallback:wte,AvatarImage:Tte},Badge:{Badge:vte},Button:{Button:_te},Card:{Card:Nte,CardContent:Ite},DropdownMenu:{DropdownMenu:Mte,DropdownMenuCheckboxItem:Rte,DropdownMenuContent:Dte,DropdownMenuItem:Lte,DropdownMenuLabel:Pte,DropdownMenuSeparator:Bte,DropdownMenuSub:Fte,DropdownMenuSubContent:Ute,DropdownMenuSubTrigger:Hte,DropdownMenuTrigger:Ote},Form:{Form:$te},Input:{Input:jte},Label:{Label:Vte},Popover:{Popover:zte,PopoverContent:Wte,PopoverTrigger:qte},Select:{Select:Gte,SelectContent:Qte,SelectItem:Xte,SelectTrigger:Kte,SelectValue:Yte},Skeleton:{Skeleton:ene},Tabs:{Tabs:tne,TabsContent:one,TabsList:nne,TabsTrigger:rne},Toggle:{Toggle:sne},Tooltip:{Tooltip:ane,TooltipContent:cne,TooltipProvider:t3,TooltipTrigger:lne}},n3=C.createContext(void 0);function Ke(){return C.useContext(n3)}const dne=t=>{const{children:e,...n}=t;Se(n);const r=Ke(),o=Tee();return y.jsx(r.Form.Form,{...o,children:e})},fne=C.forwardRef((t,e)=>{const{className:n,name:r,label:o,variant:i,icon:s,value:a,autoFocus:l,placeholder:c,disabled:u,onKeyDown:d,onChange:f,onSubmit:h,autoComplete:p,rightSection:g,...b}=t;Se(b);const E=Ke();return y.jsxs("div",{className:ue(n,"border-input bg-background ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring flex h-10 w-full rounded-md border px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50","text-foreground items-center gap-2"),children:[s,y.jsxs("div",{className:"flex-1",children:[o&&y.jsx(E.Label.Label,{htmlFor:o,children:o}),y.jsx(E.Input.Input,{className:ue(n,"h-auto border-none p-0"),id:o,name:r,autoFocus:l,placeholder:c,disabled:u,value:a,onKeyDown:d,onChange:f,onSubmit:h,ref:e})]}),g]})}),hne=t=>C.forwardRef((e,n)=>y.jsx(t,{onPointerDown:r=>{r.nativeEvent.fakeEvent||(r.ctrlKey=!0)},onPointerUp:r=>{const o=new PointerEvent("pointerdown",r.nativeEvent);o.fakeEvent=!0,r.target.dispatchEvent(o)},...e,ref:n})),pne=t=>{const{children:e,onOpenChange:n,position:r,sub:o,...i}=t;Se(i);const s=Ke();return o?y.jsx(s.DropdownMenu.DropdownMenuSub,{onOpenChange:n,children:e}):y.jsx(s.DropdownMenu.DropdownMenu,{modal:!1,onOpenChange:n,children:e})},mne=t=>{const{children:e,sub:n,...r}=t;Se(r);const o=Ke(),i=C.useMemo(()=>hne(o.DropdownMenu.DropdownMenuTrigger),[o.DropdownMenu.DropdownMenuTrigger]);return n?y.jsx(o.DropdownMenu.DropdownMenuSubTrigger,{children:e}):y.jsx(i,{asChild:!0,...r,children:e})},gne=C.forwardRef((t,e)=>{const{className:n,children:r,sub:o,...i}=t;Se(i);const s=Ke();return o?y.jsx(s.DropdownMenu.DropdownMenuSubContent,{className:n,ref:e,children:r}):y.jsx(s.DropdownMenu.DropdownMenuContent,{className:n,ref:e,children:r})}),bne=C.forwardRef((t,e)=>{const{className:n,children:r,icon:o,checked:i,subTrigger:s,onClick:a,...l}=t;Se(l);const c=Ke();return s?y.jsxs(y.Fragment,{children:[o,r]}):i!==void 0?y.jsxs(c.DropdownMenu.DropdownMenuCheckboxItem,{className:ue(n,"gap-1",i?"":"px-2"),ref:e,checked:i,onClick:a,...l,children:[o,r]}):y.jsxs(c.DropdownMenu.DropdownMenuItem,{className:n,ref:e,onClick:a,...l,children:[o,r,s&&y.jsx(J_,{className:"ml-auto h-4 w-4"})]})}),yne=C.forwardRef((t,e)=>{const{className:n,...r}=t;Se(r);const o=Ke();return y.jsx(o.DropdownMenu.DropdownMenuSeparator,{className:n,ref:e})}),Ene=C.forwardRef((t,e)=>{const{className:n,children:r,...o}=t;Se(o);const i=Ke();return y.jsx(i.DropdownMenu.DropdownMenuLabel,{className:n,ref:e,children:r})}),xne=C.forwardRef((t,e)=>{const{className:n,children:r,icon:o,onClick:i,onDragEnd:s,onDragStart:a,draggable:l,label:c,...u}=t;Se(u,!1);const d=Ke();return y.jsxs(d.Button.Button,{variant:"ghost",className:ue(n,"text-gray-400"),ref:e,"aria-label":c,onClick:i,onDragStart:a,onDragEnd:s,draggable:l,...u,children:[o,r]})}),Cne=C.forwardRef((t,e)=>{const{className:n,tabs:r,defaultOpenTab:o,openTab:i,setOpenTab:s,loading:a,...l}=t;Se(l);const c=Ke();return y.jsxs(c.Tabs.Tabs,{className:ue(n,"bg-popover max-w-screen rounded-lg p-2"),ref:e,value:i,defaultValue:o,onValueChange:s,children:[y.jsx(c.Tabs.TabsList,{children:r.map(u=>y.jsx(c.Tabs.TabsTrigger,{value:u.name,children:u.name},u.name))}),r.map(u=>y.jsx(c.Tabs.TabsContent,{value:u.name,children:y.jsx(c.Card.Card,{children:y.jsx(c.Card.CardContent,{className:"p-4",children:u.tabPanel})})},u.name))]})}),kne=C.forwardRef((t,e)=>{const{className:n,children:r,...o}=t;return Se(o),y.jsx("div",{className:ue(n,"flex flex-col items-start justify-center gap-2"),ref:e,children:r})}),Tne=C.forwardRef((t,e)=>{const{className:n,value:r,placeholder:o,onKeyDown:i,onChange:s,...a}=t;Se(a);const l=Ke();return y.jsx(l.Input.Input,{"data-test":"embed-input",className:ue(n,"w-80 max-w-full"),ref:e,value:r,placeholder:o,onKeyDown:i,onChange:s})}),wne=t=>{const{children:e,open:n,onOpenChange:r,position:o,...i}=t;Se(i);const s=Ke();return y.jsx(s.Popover.Popover,{open:n,onOpenChange:r,children:e})},Sne=C.forwardRef((t,e)=>{const{children:n,...r}=t;Se(r);const o=Ke();return y.jsx(o.Popover.PopoverTrigger,{ref:e,asChild:!0,children:n})}),vne=C.forwardRef((t,e)=>{const{className:n,variant:r,children:o,...i}=t;Se(i);const s=Ke();return y.jsx(s.Popover.PopoverContent,{sideOffset:8,className:ue(n,"z-[10000] flex flex-col gap-2",r==="panel-popover"?"w-fit max-w-none border-none p-0 shadow-none":""),ref:e,children:o})}),Ane=C.forwardRef((t,e)=>{const{className:n,children:r,...o}=t;return Se(o,!1),y.jsx("div",{className:n,ref:e,...o,children:r})}),_ne=C.forwardRef((t,e)=>{const{className:n,children:r,icon:o,onClick:i,onDragEnd:s,onDragStart:a,draggable:l,label:c,...u}=t;Se(u,!1);const d=Ke();return y.jsxs(d.Button.Button,{variant:"ghost",className:ue(n,"text-gray-400"),ref:e,"aria-label":c,onClick:i,onDragStart:a,onDragEnd:s,draggable:l,...u,children:[o,r]})}),Nne=C.forwardRef((t,e)=>{const{className:n,children:r,id:o,columns:i,...s}=t;return Se(s),y.jsx("div",{className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md","grid",n),style:{gridTemplateColumns:`repeat(${i}, 1fr)`},ref:e,id:o,role:"grid",children:r})}),Ine=C.forwardRef((t,e)=>{const{className:n,children:r,columns:o,...i}=t;return Se(i),y.jsx("div",{className:n,style:{gridColumn:`1 / ${o+1}`},ref:e,children:r})}),Mne=C.forwardRef((t,e)=>{const{className:n,children:r,id:o,...i}=t;return Se(i),y.jsx("div",{id:o,role:"listbox",className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-(--radix-dropdown-menu-content-available-height) origin-(--radix-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md",n),ref:e,children:r})}),One=C.forwardRef((t,e)=>{const{className:n,children:r,...o}=t;return Se(o),y.jsx("div",{className:ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive","aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive",n),ref:e,children:y.jsx("div",{children:r})})}),Dne=C.forwardRef((t,e)=>{const n=Ke(),{className:r,item:o,isSelected:i,onClick:s,id:a,...l}=t;Se(l);const c=C.useRef(null);return C.useEffect(()=>{if(!c.current||!i)return;const u=__(c.current,document.querySelector(".bn-suggestion-menu, #ai-suggestion-menu"));u==="top"?c.current.scrollIntoView(!0):u==="bottom"&&c.current.scrollIntoView(!1)},[i]),y.jsxs("div",{className:ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive","aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive",t.item.size==="small"?"gap-3 py-1":"",r),"data-highlighted":!0,ref:N_([e,c]),id:a,onMouseDown:u=>u.preventDefault(),onClick:s,role:"option","aria-selected":i||void 0,children:[o.icon&&y.jsx("div",{className:ue("p-3",t.item.size==="small"?"p-0":"",r),"data-position":"left",children:o.icon}),y.jsxs("div",{className:"flex-1",children:[y.jsx("div",{className:ue("text-base",t.item.size==="small"?"text-sm":"",r),children:o.title}),y.jsx("div",{className:ue("text-xs",t.item.size==="small"?"hidden":"",r),children:o.subtext})]}),o.badge&&y.jsx("div",{"data-position":"right",className:"text-xs",children:y.jsx(n.Badge.Badge,{variant:"secondary",children:o.badge})})]})}),Lne=C.forwardRef((t,e)=>{const{className:n,children:r,...o}=t;return Se(o),y.jsx("div",{className:ue("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",n),ref:e,children:r})}),Rne=C.forwardRef((t,e)=>{const{className:n,...r}=t;return Se(r),y.jsx("div",{className:ue(n,"animate-spin"),ref:e,children:y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",height:"1em",viewBox:"0 -960 960 960",width:"1em",fill:"#e8eaed",children:y.jsx("path",{d:"M480-80q-82 0-155-31.5t-127.5-86Q143-252 111.5-325T80-480q0-83 31.5-155.5t86-127Q252-817 325-848.5T480-880q17 0 28.5 11.5T520-840q0 17-11.5 28.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160q133 0 226.5-93.5T800-480q0-17 11.5-28.5T840-520q17 0 28.5 11.5T880-480q0 82-31.5 155t-86 127.5q-54.5 54.5-127 86T480-80Z"})})})}),Pne=C.forwardRef((t,e)=>{const{className:n,children:r,onMouseDown:o,onClick:i,...s}=t;Se(s,!1);const a=Ke();return y.jsx(a.Button.Button,{variant:"ghost",className:ue(n,"h-full w-full p-0 text-gray-400",n!=null&&n.includes("extend-button-add-remove-columns")?"ml-1":"mt-1",n!=null&&n.includes("extend-button-editing")?"bg-accent text-accent-foreground":""),ref:e,onClick:i,onMouseDown:o,...s,children:r})}),Bne=C.forwardRef((t,e)=>{const{className:n,children:r,draggable:o,onDragStart:i,onDragEnd:s,style:a,label:l,...c}=t;Se(c,!1);const u=Ke();return y.jsx(u.Button.Button,{variant:"ghost",className:ue(n,"h-fit w-fit p-0 text-gray-400"),ref:e,"aria-label":l,draggable:o,onDragStart:i,onDragEnd:s,style:a,...c,children:r})}),np=C.forwardRef((t,e)=>{const{className:n,children:r,onMouseEnter:o,onMouseLeave:i,variant:s,...a}=t;Se(a);const l=Ke();return y.jsx(l.Tooltip.TooltipProvider,{delayDuration:0,children:y.jsx("div",{className:ue(n,"bg-popover text-popover-foreground flex h-fit gap-1 rounded-lg border p-1 shadow-md",s==="action-toolbar"?"w-fit":""),ref:e,onMouseEnter:o,onMouseLeave:i,children:r})})}),rp=C.forwardRef((t,e)=>{const{className:n,children:r,mainTooltip:o,secondaryTooltip:i,icon:s,isSelected:a,isDisabled:l,onClick:c,label:u,variant:d,...f}=t;Se(f,!1);const h=Ke(),p=a===void 0?y.jsxs(h.Button.Button,{className:ue(n,d==="compact"?"h-6 min-w-6 p-0":""),variant:"ghost",size:d==="compact"?"sm":"default",disabled:l,onClick:c,ref:e,"aria-label":u,...f,children:[s,r]}):y.jsxs(h.Toggle.Toggle,{className:ue(n,"data-[state=open]:bg-accent data-[state=closed]:text-accent-foreground",d==="compact"?"h-6 min-w-6 p-0":""),size:d==="compact"?"sm":"default","aria-label":u,onClick:c,pressed:a,disabled:l,"data-state":a?"on":"off","data-disabled":l,ref:e,...f,children:[s,r]});return y.jsxs(h.Tooltip.Tooltip,{children:[y.jsx(h.Tooltip.TooltipTrigger,{asChild:!0,children:p}),y.jsxs(h.Tooltip.TooltipContent,{className:"flex flex-col items-center whitespace-pre-wrap",children:[y.jsx("span",{children:o}),i&&y.jsx("span",{children:i})]})]})}),op=C.forwardRef((t,e)=>{const{className:n,items:r,isDisabled:o,...i}=t;Se(i);const s=Ke(),a=c=>y.jsxs("div",{className:"flex items-center gap-1",children:[c.icon,c.text]}),l=r.filter(c=>c.isSelected)[0];return l?y.jsxs(s.Select.Select,{value:l.text,onValueChange:c=>{var u,d;return(d=(u=r.find(f=>f.text===c)).onClick)==null?void 0:d.call(u)},disabled:o,children:[y.jsx(s.Select.SelectTrigger,{className:"border-none",children:y.jsx(s.Select.SelectValue,{})}),y.jsx(s.Select.SelectContent,{className:n,ref:e,children:r.map(c=>y.jsx(s.Select.SelectItem,{disabled:c.isDisabled,value:c.text,children:y.jsx(a,{...c})},c.text))})]}):null}),Fne=C.forwardRef((t,e)=>{const{className:n,children:r,selected:o,headerText:i,onFocus:s,onBlur:a,tabIndex:l,...c}=t;Se(c);const u=Ke();return y.jsxs(u.Card.Card,{className:ue(n,"w-[300px]",o?"bg-accent text-accent-foreground":""),onFocus:s,onBlur:a,tabIndex:l,ref:e,children:[i&&y.jsx("div",{className:"px-4 pt-4 text-sm italic",children:i}),r]})}),Hne=C.forwardRef((t,e)=>{const{className:n,children:r,...o}=t;return Se(o),y.jsx("div",{className:ue(n,"p-4",n!=null&&n.includes("thread-comments")?"flex flex-col gap-6 border-b":""),ref:e,children:r})}),Une=C.forwardRef((t,e)=>{const{className:n,children:r,...o}=t;Se(o,!1);const i=Ke();return y.jsx(i.Button.Button,{className:ue(n,"text-foreground w-fit bg-transparent p-0 hover:bg-transparent"),ref:e,children:r})}),Vne=C.forwardRef((t,e)=>{const{authorInfo:n,timeString:r,edited:o,...i}=t,s=ve();Se(i,!1);const a=Ke();return n==="loading"?y.jsxs("div",{className:"flex flex-row flex-nowrap items-center gap-4",children:[y.jsx(a.Skeleton.Skeleton,{className:"size-7 animate-pulse rounded-full bg-neutral-400"}),y.jsx(a.Skeleton.Skeleton,{className:"h-3 w-32 animate-pulse rounded-full bg-neutral-400"})]}):y.jsxs("div",{className:"flex flex-row flex-nowrap items-center gap-4",children:[y.jsxs(a.Avatar.Avatar,{children:[y.jsx(a.Avatar.AvatarImage,{src:n.avatarUrl,alt:n.username,className:"h-7 rounded-full"}),y.jsx(a.Avatar.AvatarFallback,{children:n.username[0]})]}),y.jsxs("div",{className:"flex flex-row flex-nowrap items-center gap-2",children:[y.jsx("span",{className:"text-sm font-bold",children:n.username}),y.jsxs("span",{className:"text-xs",children:[r," ",o&&`(${s.comments.edited})`]})]})]})}),$ne=C.forwardRef((t,e)=>{const{className:n,showActions:r,authorInfo:o,timeString:i,actions:s,edited:a,emojiPickerOpen:l,children:c,...u}=t;Se(u);const[d,f]=C.useState(!1),{focused:h,ref:p}=JJ(),g=s&&(r===!0||r===void 0||r==="hover"&&d||h);return y.jsxs("div",{ref:e,className:ue(n,"relative flex flex-col gap-2"),onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),children:[g?y.jsx("div",{className:"absolute right-0 top-0 z-10",ref:p,children:s}):null,y.jsx(Vne,{...t}),c]})}),jne=C.forwardRef((t,e)=>{const{className:n,onFocus:r,onBlur:o,autoFocus:i,editor:s,editable:a,...l}=t;Se(l);const c=zr();return y.jsx(r3,{autoFocus:i,className:ue(n,""),theme:c?.colorSchemePreference,editor:t.editor,sideMenu:!1,slashMenu:!1,tableHandles:!1,filePanel:!1,formattingToolbar:!1,editable:a,ref:e,onFocus:r,onBlur:o,children:y.jsx(e1,{formattingToolbar:zne})})}),zne=()=>{const t=Z0([]).filter(e=>e.key!=="nestBlockButton"&&e.key!=="unnestBlockButton");return y.jsx(J0,{blockTypeSelectItems:[],children:t})},qne=C.forwardRef((t,e)=>{const{className:n,text:r,icon:o,isSelected:i,mainTooltip:s,secondaryTooltip:a,onClick:l,onMouseEnter:c,...u}=t;Se(u,!1);const d=Ke(),f=y.jsxs(d.Button.Button,{variant:i?"secondary":"outline",className:ue(n,"flex h-7 items-center gap-1 rounded-full px-2.5"),onClick:l,onMouseEnter:c,ref:e,children:[y.jsx("span",{children:o}),y.jsx("span",{children:r})]});return s?y.jsxs(d.Tooltip.Tooltip,{children:[y.jsx(d.Tooltip.TooltipTrigger,{asChild:!0,children:f}),y.jsxs(d.Tooltip.TooltipContent,{className:"flex flex-col items-center whitespace-pre-wrap",children:[y.jsx("span",{children:s}),a&&y.jsx("span",{children:a})]})]}):f}),Wne=C.forwardRef((t,e)=>{const{className:n,children:r,...o}=t;Se(o);const i=Ke();return y.jsx(i.Tooltip.TooltipProvider,{delayDuration:0,children:y.jsx("div",{className:ue(n,"flex w-full flex-row flex-wrap gap-1"),ref:e,children:r})})}),Gne=C.forwardRef((t,e)=>{const{className:n,children:r,onClick:o,label:i,...s}=t;Se(s);const a=Ke();return y.jsx(a.Button.Button,{type:"submit",className:n,"aria-label":i,ref:e,onClick:o,children:r})}),Yne=C.forwardRef((t,e)=>{const{className:n,accept:r,value:o,placeholder:i,onChange:s,...a}=t;Se(a);const l=Ke();return y.jsx(l.Input.Input,{type:"file",className:n,ref:e,accept:r,value:o?o.name:void 0,onChange:async c=>s?.(c.target.files[0]),placeholder:i})}),Kne=C.forwardRef((t,e)=>{const{className:n,isSelected:r,onClick:o,item:i,id:s,...a}=t;Se(a);const l=C.useRef(null);return C.useEffect(()=>{if(!l.current||!r)return;const c=__(l.current,document.querySelector(".bn-grid-suggestion-menu"));c==="top"?l.current.scrollIntoView(!0):c==="bottom"&&l.current.scrollIntoView(!1)},[r]),y.jsx("div",{className:ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0","hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive","aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive","text-lg!",n),ref:N_([e,l]),id:s,role:"option",onClick:o,"aria-selected":r||void 0,children:i.icon})}),Qne=C.forwardRef((t,e)=>{const{className:n,children:r,columns:o,...i}=t;return Se(i),y.jsx("div",{className:n,style:{gridColumn:`1 / ${o+1}`},ref:e,children:r})}),Xne={FormattingToolbar:{Root:np,Button:rp,Select:op},FilePanel:{Root:Cne,Button:Gne,FileInput:Yne,TabPanel:kne,TextInput:Tne},LinkToolbar:{Root:np,Button:rp,Select:op},SideMenu:{Root:Ane,Button:_ne},SuggestionMenu:{Root:Mne,Item:Dne,EmptyItem:One,Label:Lne,Loader:Rne},GridSuggestionMenu:{Root:Nne,Item:Kne,EmptyItem:Ine,Loader:Qne},TableHandle:{Root:Bne,ExtendButton:Pne},Comments:{Comment:$ne,Editor:jne,Card:Fne,CardSection:Hne,ExpandSectionsPrompt:Une},Generic:{Badge:{Root:qne,Group:Wne},Toolbar:{Root:np,Button:rp,Select:op},Form:{Root:dne,TextInput:fne},Menu:{Root:pne,Trigger:mne,Dropdown:gne,Divider:yne,Label:Ene,Item:bne,Button:xne},Popover:{Root:wne,Trigger:Sne,Content:vne}}},r3=t=>{const{className:e,shadCNComponents:n,...r}=t,o=C.useMemo(()=>({...une,...n}),[n]);return y.jsx(n3.Provider,{value:o,children:y.jsx(JA.Provider,{value:Xne,children:y.jsx(PJ,{className:ut("bn-shadcn",e||""),...r})})})};function mC({open:t,onClose:e,onSave:n,initial:r,hideCaption:o}){const[i,s]=C.useState(r?.url??""),[a,l]=C.useState(r?.mediaId??""),[c,u]=C.useState(r?.alt??""),[d,f]=C.useState(r?.caption??""),[h,p]=C.useState(r?.filename??""),[g,b]=C.useState(r?.width??0),[E,x]=C.useState(r?.height??0),[T,D]=C.useState(r?.thumbUrl??""),[O,v]=C.useState(!1),[R,j]=C.useState(!1),z=!!a,I=i?z&&T?sp(T):sp(i):"";function X(q){if(s(q.url),l(q.mediaId),p(q.filename),b(q.width??0),x(q.height??0),D(q.urls?.thumb_md??""),j(!1),!c.trim()){const oe=q.filename.replace(/\.[\w]+$/,"").replace(/[._-]+/g," ");u(oe)}v(!1)}function F(){s(""),l(""),p(""),b(0),x(0),D(""),j(!1)}function W(q){s(q),l(""),p(""),b(0),x(0),D(""),j(!1)}function B(){n({url:i,mediaId:a,alt:c,caption:d,filename:h,width:g,height:E})}return y.jsxs(y.Fragment,{children:[y.jsx(xC,{open:t,onOpenChange:()=>e(),children:y.jsxs(CC,{children:[y.jsxs(kC,{children:[y.jsx(TC,{children:r?"Edit Image":"Insert Image"}),y.jsx(wC,{className:"sr-only",children:"Set the image URL, alt text, and caption."})]}),y.jsxs("div",{className:"space-y-4",children:[i&&!R?y.jsx("div",{className:"flex justify-center",children:y.jsx("img",{src:I,alt:c||"Preview",className:"max-h-48 rounded-md object-contain",onError:()=>j(!0)})}):i&&R?y.jsx("div",{className:"flex justify-center",children:y.jsx("div",{className:"flex h-32 w-32 items-center justify-center rounded-md bg-muted",children:y.jsx(SC,{className:"h-8 w-8 text-muted-foreground","data-testid":"fallback-icon"})})}):null,y.jsxs("div",{className:"space-y-2",children:[y.jsx(Sf,{children:"Image"}),y.jsxs("div",{className:"flex gap-2",children:[z?y.jsxs(nN,{variant:"secondary",className:"flex max-w-full items-center gap-1.5 px-3 py-1.5 text-sm",children:[y.jsx(lN,{className:"h-3.5 w-3.5 shrink-0"}),y.jsx("span",{className:"truncate",children:h}),y.jsx("button",{type:"button",onClick:F,className:"ml-1 shrink-0 rounded-full p-0.5 hover:bg-muted","aria-label":"Clear media",children:y.jsx(l3,{className:"h-3 w-3"})})]}):y.jsx(vf,{placeholder:"https://example.com/image.jpg",value:i,onChange:q=>W(q.target.value)}),y.jsx(Sa,{type:"button",variant:"outline",onClick:()=>v(!0),children:"Select Media"})]})]}),y.jsxs("div",{className:"space-y-2",children:[y.jsx(Sf,{htmlFor:"image-alt",children:"Alt Text"}),y.jsx(vf,{id:"image-alt",value:c,onChange:q=>u(q.target.value),placeholder:"Describe the image"})]}),!o&&y.jsxs("div",{className:"space-y-2",children:[y.jsx(Sf,{htmlFor:"image-caption",children:"Caption (optional)"}),y.jsx(vf,{id:"image-caption",value:d,onChange:q=>f(q.target.value),placeholder:"Photo credit or description"})]})]}),y.jsxs(vC,{children:[y.jsx(Sa,{variant:"outline",onClick:e,children:"Cancel"}),y.jsx(Sa,{onClick:B,disabled:!i.trim(),children:"Save"})]})]})}),O&&y.jsx(rN,{open:O,onClose:()=>v(!1),onSelect:q=>X(q),allowedTypes:["image/*"]})]})}const Zne=v_({type:"image",propSchema:{mediaId:{default:""},url:{default:""},alt:{default:""},caption:{default:""},filename:{default:""},width:{default:0},height:{default:0}},content:"none"},{render:({block:t,editor:e})=>y.jsx(Jne,{block:t,editor:e})});function Jne({block:t,editor:e}){const n=!!t.props.url,[r,o]=C.useState(!n&&e.isEditable),i=n?sp(t.props.url):"";function s(a){e.updateBlock(t,{props:{url:a.url,mediaId:a.mediaId,alt:a.alt,caption:a.caption,filename:a.filename,width:a.width,height:a.height}}),o(!1)}return n?y.jsxs(y.Fragment,{children:[y.jsxs("figure",{className:`group my-2${e.isEditable?" cursor-pointer rounded-lg ring-primary hover:ring-2":""}`,onClick:()=>e.isEditable&&o(!0),children:[y.jsxs("div",{className:"relative inline-block",children:[y.jsx("img",{src:i,alt:t.props.alt,className:"max-w-full rounded-lg"}),e.isEditable&&y.jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-black/0 opacity-0 transition-opacity group-hover:bg-black/20 group-hover:opacity-100",children:y.jsx(NC,{className:"h-6 w-6 text-white drop-shadow"})})]}),t.props.caption&&y.jsx("figcaption",{className:"mt-1 text-sm text-muted-foreground",children:t.props.caption})]}),r&&y.jsx(mC,{open:r,onClose:()=>o(!1),onSave:s,initial:{url:t.props.url,mediaId:t.props.mediaId,alt:t.props.alt,caption:t.props.caption,filename:t.props.filename,width:t.props.width,height:t.props.height}})]}):y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"flex cursor-pointer flex-col items-center rounded-lg border-2 border-dashed p-8 text-center",onClick:()=>e.isEditable&&o(!0),children:[y.jsx(SC,{className:"mx-auto h-8 w-8 text-muted-foreground"}),y.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Click to select an image"})]}),r&&y.jsx(mC,{open:r,onClose:()=>o(!1),onSave:s})]})}function ere({blockType:t,props:e,onSave:n}){const[r,o]=C.useState(!1),[i,s]=C.useState({});function a(){s({...e}),o(!0)}function l(){n(i),o(!1)}return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"cursor-pointer",onClick:a,children:[y.jsxs("div",{className:"flex items-center gap-1 pb-1",children:[y.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.icon&&y.jsxs(y.Fragment,{children:[t.icon," "]}),t.label]}),y.jsx(NC,{className:"h-3 w-3 text-muted-foreground"})]}),y.jsx(sN,{blockType:t,props:e})]}),y.jsx(xC,{open:r,onOpenChange:o,children:y.jsxs(CC,{className:"max-w-lg",children:[y.jsxs(kC,{children:[y.jsxs(TC,{children:["Edit ",t.label]}),y.jsx(wC,{className:"sr-only",children:"Edit block properties"})]}),y.jsx(oN,{fields:t.fields??[],values:i,onChange:s}),y.jsxs(vC,{children:[y.jsx(Sa,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),y.jsx(Sa,{onClick:l,children:"Save"})]})]})})]})}function tre(t){const e={};for(const n of t??[])switch(n.type){case"boolean":e[n.name]={default:!1};break;case"number":e[n.name]={default:0};break;default:e[n.name]={default:""}}return e}function nre(t){const{image:e,...n}=V2,r={...n,image:Zne()};for(const o of t){const i=tre(o.fields??[]),s=v_({type:o.name,propSchema:i,content:"none"},{render:({block:a,editor:l})=>{const c=a;return y.jsx(ere,{blockType:o,props:c.props,onSave:u=>{l.updateBlock(a,{props:u})}})}});r[o.name]=s()}return P0.create({blockSpecs:r})}function rre(t){const e=C.useMemo(()=>nre(t),[t]),n=C.useMemo(()=>t.map(r=>r.name).sort().join(","),[t]);return{schema:e,schemaKey:n}}const d1="headroom://content/";function ore(t){return t.startsWith(d1)}function ire(t){if(!ore(t))return null;const e=t.slice(d1.length),n=e.indexOf("/");if(n===-1)return null;const r=e.slice(0,n),o=e.slice(n+1);return!r||!/^[0-9A-Z]{26}$/.test(o)?null:{collection:r,contentId:o}}function sre(t,e){return`${d1}${t}/${e}`}function are(){const t=ge(),e=fe(),{host:n}=yC(),{showSelection:r}=Re(ml),[o,i]=C.useState(!1);if(C.useEffect(()=>{r(o)},[o,r]),!e||!n)return null;function s(a){const l=sre(a.collection,a.contentId);t.createLink(l,a.title),i(!1)}return y.jsx(iN,{host:n,selectedIds:[],open:o,onOpenChange:i,onSelect:s,trigger:y.jsx(e.FormattingToolbar.Button,{className:"bn-button","data-test":"contentLink",label:"Link to Content",icon:y.jsx(c3,{size:18}),onClick:()=>i(!0)})})}function Qre({initialBlocks:t,onChange:e,blockTypes:n,compact:r}){const{schema:o,schemaKey:i}=rre(n);return y.jsx(lre,{schema:o,initialBlocks:t,onChange:e,blockTypes:n,compact:r},i)}function lre({schema:t,initialBlocks:e,onChange:n,blockTypes:r,compact:o}){const i=xf({schema:t,initialContent:e&&e.length>0?e:void 0});C.useMemo(()=>{let a=!1;i.onChange(()=>{if(!a){a=!0;return}n(i.document)})},[i]);const s=C.useMemo(()=>{const a=T_(i),l=r.map(c=>({title:c.label,subtext:`Insert ${c.label} block`,onItemClick:()=>{const u=i.getTextCursorPosition().block;i.insertBlocks([{type:c.name}],u,"after")},aliases:[c.name],group:"Custom Blocks"}));return[...a,...l]},[i,r]);return y.jsx("div",{className:o?"[&_.bn-editor]:min-h-[120px]":"[&_.bn-editor]:min-h-[300px]",children:y.jsxs(r3,{editor:i,slashMenu:!1,filePanel:!1,formattingToolbar:!1,linkToolbar:!1,theme:"light",children:[y.jsx(w_,{triggerCharacter:"/",getItems:async a=>s.filter(l=>l.title.toLowerCase().includes(a.toLowerCase()))}),y.jsx(e1,{formattingToolbar:cre}),y.jsx(E_,{linkToolbar:ure})]})})}function cre(t){return y.jsxs(J0,{...t,children:[Z0(t.blockTypeSelectItems),y.jsx(are,{})]})}function ure(t){const{host:e}=yC(),n=i3(),r=fe(),o=ire(t.url);return!o||!r?y.jsx(y_,{...t}):y.jsxs(r.Generic.Toolbar.Root,{className:"bn-toolbar bn-link-toolbar",variant:"action-toolbar",children:[y.jsx(r.Generic.Toolbar.Button,{className:"bn-button",label:`Content link · ${o.collection}`,mainTooltip:`Content link · ${o.collection}`,isDisabled:!0,onClick:()=>{}}),y.jsx(b_,{url:t.url,text:t.text,range:t.range,setToolbarFrozen:t.setToolbarFrozen,setToolbarOpen:t.setToolbarOpen}),y.jsx(r.Generic.Toolbar.Button,{className:"bn-button",label:"Open",mainTooltip:"Open in editor",onClick:()=>{n(`/sites/${e}/content/${o.contentId}`)}}),y.jsx(g_,{range:t.range,setToolbarOpen:t.setToolbarOpen})]})}export{Qre as default};
|